Skip to content

Commit

Permalink
Merge pull request #2 from jingyi-gao-ttd/uid2-decouple-cstg
Browse files Browse the repository at this point in the history
Uid2 decouple cstg
  • Loading branch information
jingyi-gao-ttd authored Oct 10, 2023
2 parents 879b401 + 0e62274 commit f644840
Show file tree
Hide file tree
Showing 6 changed files with 652 additions and 566 deletions.
3 changes: 2 additions & 1 deletion features.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
[
"NATIVE",
"VIDEO"
"VIDEO",
"UID2_CSTG"
]
2 changes: 1 addition & 1 deletion integrationExamples/gpt/userId_example.html
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
var pbjs = pbjs || {};
pbjs.que = pbjs.que || [];
</script>
<script type="text/javascript" src="../../build/dev/prebid.js" async></script>
<script type="text/javascript" src="../../build/dev/prebid.js" async></script>

<script>
function getHashedEmail() { }
Expand Down
17 changes: 9 additions & 8 deletions modules/uid2IdSystem.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
*/

import { logInfo, logWarn } from '../src/utils.js';
import {submodule} from '../src/hook.js';
import { submodule } from '../src/hook.js';
import {getStorageManager} from '../src/storageManager.js';
import {MODULE_TYPE_UID} from '../src/activities/modules.js';

Expand Down Expand Up @@ -83,21 +83,22 @@ export const uid2IdSubmodule = {
return;
}

let mappedCstgConfig = {
serverPublicKey: config?.params?.serverPublicKey,
subscriptionId: config?.params?.subscriptionId,
...extractIdentityFromParams(config?.params ?? {})
}

const mappedConfig = {
apiBaseUrl: config?.params?.uid2ApiBase ?? UID2_BASE_URL,
paramToken: config?.params?.uid2Token,
serverCookieName: config?.params?.uid2Cookie ?? config?.params?.uid2ServerCookie,
storage: config?.params?.storage ?? 'localStorage',
cstg: mappedCstgConfig,
clientId: UID2_CLIENT_ID,
internalStorage: ADVERTISING_COOKIE
}

if (FEATURES.UID2_CSTG) {
mappedConfig.cstg = {
serverPublicKey: config?.params?.serverPublicKey,
subscriptionId: config?.params?.subscriptionId,
...extractIdentityFromParams(config?.params ?? {})
}
}
_logInfo(`UID2 configuration loaded and mapped.`, mappedConfig);
const result = Uid2GetId(mappedConfig, storage, _logInfo, _logWarn);
_logInfo(`UID2 getId returned`, result);
Expand Down
Loading

0 comments on commit f644840

Please sign in to comment.