diff --git a/modules/userId/eids.js b/modules/userId/eids.js index bf425b8d9f0..57341773184 100644 --- a/modules/userId/eids.js +++ b/modules/userId/eids.js @@ -1,6 +1,7 @@ import {deepClone, isFn, isStr} from '../../src/utils.js'; -/* - * @typedef {import('../modules/userId/index.js').SubmoduleContainer} SubmoduleContainer + +/** + * @typedef {import('./index.js').SubmodulePriorityMap} SubmodulePriorityMap */ export const EID_CONFIG = new Map(); diff --git a/modules/userId/index.js b/modules/userId/index.js index f7c6e1c5433..2ac23011417 100644 --- a/modules/userId/index.js +++ b/modules/userId/index.js @@ -4,63 +4,47 @@ */ /** - * @interface Submodule + * @typedef Submodule + * @property {string} name - used to link submodule with config + * @property {decode} decode + * @property {getId} getId + * @property {Object} eids + * @property {number} [gvlid] - vendor ID + * @property {extendId} [extendId] + * @property {function} [domainOverride] - use a predefined domain override for cookies or provide your own + * @property {function(): string} [findRootDomain] - returns the root domain */ /** - * @function - * @summary performs action to obtain id and return a value in the callback's response argument. - * If IdResponse#id is defined, then it will be written to the current active storage. - * If IdResponse#callback is defined, then it'll called at the end of auction. - * It's permissible to return neither, one, or both fields. - * @name Submodule#getId + * Performs action to obtain id and return a value in the callback's response argument. + * If IdResponse#id is defined, then it will be written to the current active storage. + * If IdResponse#callback is defined, then it'll called at the end of auction. + * It's permissible to return neither, one, or both fields. + * @callback getId * @param {SubmoduleConfig} config * @param {ConsentData|undefined} consentData - * @param {(Object|undefined)} cacheIdObj - * @return {(IdResponse|undefined)} A response object that contains id and/or callback. + * @param {Object|undefined} cacheIdObj + * @returns {IdResponse|undefined} A response object that contains id and/or callback. */ /** - * @function - * @summary Similar to Submodule#getId, this optional method returns response to for id that exists already. - * If IdResponse#id is defined, then it will be written to the current active storage even if it exists already. - * If IdResponse#callback is defined, then it'll called at the end of auction. - * It's permissible to return neither, one, or both fields. - * @name Submodule#extendId + * Similar to `getId`, this optional method returns response to for id that exists already. + * If IdResponse#id is defined, then it will be written to the current active storage even if it exists already. + * If IdResponse#callback is defined, then it'll called at the end of auction. + * It's permissible to return neither, one, or both fields. + * @callback extendId * @param {SubmoduleConfig} config * @param {ConsentData|undefined} consentData * @param {Object} storedId - existing id, if any - * @return {(IdResponse|function(callback:function))} A response object that contains id and/or callback. + * @returns {IdResponse|function(callback:function)} A response object that contains id and/or callback. */ /** - * @function - * @summary decode a stored value for passing to bid requests - * @name Submodule#decode + * Decode a stored value for passing to bid requests + * @callback decode * @param {Object|string} value * @param {SubmoduleConfig|undefined} config - * @return {(Object|undefined)} - */ - -/** - * @property - * @summary used to link submodule with config - * @name Submodule#name - * @type {string} - */ - -/** - * @property - * @summary use a predefined domain override for cookies or provide your own - * @name Submodule#domainOverride - * @type {(undefined|function)} - */ - -/** - * @function - * @summary Returns the root domain - * @name Submodule#findRootDomain - * @returns {string} + * @returns {Object|undefined} */ /** @@ -69,6 +53,7 @@ * @property {(SubmoduleStorage|undefined)} storage - browser storage config * @property {(SubmoduleParams|undefined)} params - params config for use by the submodule.getId function * @property {(Object|undefined)} value - if not empty, this value is added to bid requests for access in adapters + * @property {string[]} [enabledStorageTypes] */ /** @@ -111,6 +96,7 @@ * @property {(Object|undefined)} idObj - cache decoded id value (this is copied to every adUnit bid) * @property {(function|undefined)} callback - holds reference to submodule.getId() result if it returned a function. Will be set to undefined after callback executes * @property {StorageManager} storageMgr + * @property {string[]} [enabledStorageTypes] */ /** @@ -122,8 +108,8 @@ /** * @typedef {Object} IdResponse - * @property {(Object|undefined)} id - id data - * @property {(function|undefined)} callback - function that will return an id + * @property {Object} [id] - id data + * @property {function} [callback] - function that will return an id */ /** diff --git a/modules/yandexIdSystem.js b/modules/yandexIdSystem.js index 24b1f611ccd..e482a9645a4 100644 --- a/modules/yandexIdSystem.js +++ b/modules/yandexIdSystem.js @@ -6,6 +6,11 @@ // @ts-check +/** + * @typedef {import('../modules/userId/index.js').Submodule} Submodule + * @typedef {import('../modules/userId/index.js').SubmoduleConfig} SubmoduleConfig + */ + import { MODULE_TYPE_UID } from '../src/activities/modules.js'; import { submodule } from '../src/hook.js'; import { getStorageManager } from '../src/storageManager.js'; @@ -26,11 +31,8 @@ export const PREBID_STORAGE = getStorageManager({ bidderCode: undefined }); +/** @type {Submodule} */ export const yandexIdSubmodule = { - /** - * Used to link submodule with config. - * @type {string} - */ name: BIDDER_CODE, /** * Decodes the stored id value for passing to bid requests. @@ -41,11 +43,6 @@ export const yandexIdSubmodule = { return { [YANDEX_ID_KEY]: value }; }, - /** - * @param {import('./userId/index.js').SubmoduleConfig} submoduleConfig - * @param {unknown} [_consentData] - * @param {string} [storedId] Id that was saved by the core previously. - */ getId(submoduleConfig, _consentData, storedId) { if (checkConfigHasErrorsAndReport(submoduleConfig)) { return; @@ -70,7 +67,7 @@ export const yandexIdSubmodule = { }; /** - * @param {import('./userId/index.js').SubmoduleConfig} submoduleConfig + * @param {SubmoduleConfig} submoduleConfig * @returns {boolean} `true` - when there are errors, `false` - otherwise. */ function checkConfigHasErrorsAndReport(submoduleConfig) {