Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to the latest version of the IAB TCF library #6

Open
wants to merge 162 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
162 commits
Select commit Hold shift + click to select a range
e561db0
Add missing status parameter for custom callbacks in the CmpApi
kemalmustafic Aug 5, 2020
a987e62
fix(cmpapi): fixes missing tcfPolicyVersion on TCData obj when gdprAp…
nhagen Feb 23, 2021
65cf7a2
Bump ws from 6.2.1 to 6.2.2 in /modules/core
dependabot[bot] Jun 5, 2021
4585895
Bump glob-parent from 5.1.0 to 5.1.2 in /modules/core
dependabot[bot] Jun 10, 2021
afef252
Add validation to accept special purposes only vendors
Jun 20, 2021
f220f65
Move logic to set LI in specialPurposes only inside current validations
Jun 23, 2021
8833f40
Remove extra const declaration
Jun 23, 2021
4bc6744
Fix typos
Jun 28, 2021
8bdb309
Update unit test according to special purposes feature
Jun 29, 2021
f7622a5
Merge pull request #289 from jcmlmorav/master
kenario Jun 30, 2021
8c7eda1
Merge pull request #283 from InteractiveAdvertisingBureau/dependabot/…
kenario Jul 6, 2021
cd92ca2
Bump ws from 6.2.1 to 6.2.2
dependabot[bot] Jul 6, 2021
6c72bb4
Merge pull request #284 from InteractiveAdvertisingBureau/dependabot/…
kenario Jul 6, 2021
e2b3e83
Bump ws from 6.2.1 to 6.2.2 in /modules/cmpapi
dependabot[bot] Jul 6, 2021
c9e38e4
Merge pull request #285 from InteractiveAdvertisingBureau/dependabot/…
kenario Jul 6, 2021
f9f33a9
Merge pull request #286 from InteractiveAdvertisingBureau/dependabot/…
kenario Jul 6, 2021
6e1c63b
Bump glob-parent from 5.1.0 to 5.1.2 in /modules/cmpapi
dependabot[bot] Jul 6, 2021
9f0d85e
Merge pull request #287 from InteractiveAdvertisingBureau/dependabot/…
kenario Jul 6, 2021
d26dcf7
Merge pull request #252 from nhagen/fix-policy-version
kenario Jul 6, 2021
62b65a8
Merge pull request #200 from jawadst/fix/cmpapi-readme
kenario Jul 6, 2021
b336c64
Removed global and typescript dependencies.
Jul 6, 2021
81f1555
Fixed documentation for Custom Commands callback 'songLyricaCallback'.
Jul 6, 2021
c7ee9ef
Merge pull request #291 from shortaflip/bugfix#251
kenario Jul 7, 2021
4ccc283
Remove changes to tests related to PR #252
nhagen Jul 8, 2021
49acb5c
Merge pull request #292 from nhagen/fix-policyversion-tests
kenario Jul 8, 2021
806fa1f
Merge pull request #290 from shortaflip/master
kenario Jul 8, 2021
c1325a3
v1.3.0-0
Jul 8, 2021
8c06bbe
v1.3.0-1
Jul 8, 2021
7429161
v1.3.0-2
Jul 8, 2021
2665a9b
Merge pull request #293 from shortaflip/master
kenario Jul 8, 2021
a09168a
Removed line referring to global scope.
Jul 20, 2021
6dbc0a2
Merge pull request #294 from shortaflip/master
kenario Jul 20, 2021
81318c8
v1.3.0
Jul 21, 2021
ba9aebd
Merge branch 'InteractiveAdvertisingBureau:master' into master
kenario Jul 21, 2021
7a118e1
Merge pull request #295 from shortaflip/master
kenario Jul 21, 2021
227717a
Bump tar from 4.4.13 to 4.4.15
dependabot[bot] Aug 4, 2021
856e665
Merge pull request #298 from InteractiveAdvertisingBureau/dependabot/…
kenario Aug 5, 2021
687f034
added fix for #166
friedemannsommer Aug 11, 2021
9bf46a4
Bump path-parse from 1.0.6 to 1.0.7
dependabot[bot] Aug 11, 2021
74d88f9
Merge pull request #301 from InteractiveAdvertisingBureau/dependabot/…
kenario Aug 13, 2021
c5c3809
Bump path-parse from 1.0.6 to 1.0.7 in /modules/cmpapi
dependabot[bot] Aug 13, 2021
a139396
Merge pull request #302 from InteractiveAdvertisingBureau/dependabot/…
kenario Aug 13, 2021
37a671a
Bump path-parse from 1.0.6 to 1.0.7 in /modules/core
dependabot[bot] Aug 13, 2021
b12d795
Updated documetnation for CmpApi 'getTCData' usage with 'removeEventL…
Aug 13, 2021
0fcb400
Merge branch 'master' into issue-296
Aug 13, 2021
f94f8dc
Merge pull request #303 from InteractiveAdvertisingBureau/dependabot/…
kenario Aug 13, 2021
e4c6721
Bump path-parse from 1.0.6 to 1.0.7 in /modules/stub
dependabot[bot] Aug 13, 2021
53883e7
Merge pull request #304 from InteractiveAdvertisingBureau/dependabot/…
kenario Aug 16, 2021
e7480e5
Added fix to GVL clone function to make sure language property is als…
Aug 17, 2021
514049c
Updated unit test to include assertion that we are not fetching trans…
Aug 18, 2021
ca59657
Merge pull request #305 from shortaflip/issue-296
kenario Aug 27, 2021
70c7b97
Merge pull request #300 from friedemannsommer/master
kenario Aug 27, 2021
cda4675
Updated comments for cloning a GVL and added documentation for clonin…
Aug 30, 2021
9b8c62c
Updated some documentation errors.
Aug 30, 2021
1d61696
Merge pull request #306 from shortaflip/issue-297
kenario Sep 1, 2021
4e2168e
Bump tar from 4.4.15 to 4.4.19
dependabot[bot] Sep 2, 2021
ce3b89d
Merge pull request #311 from InteractiveAdvertisingBureau/dependabot/…
kenario Sep 2, 2021
ba3c73d
v1.3.1-0
Sep 7, 2021
5a232f8
v1.3.1
Sep 22, 2021
257c71c
Merge pull request #313 from shortaflip/master
kenario Sep 22, 2021
016678a
Set created and lastUpdated dates to a day-level UTC timestamp when t…
tla-sirdata Jan 12, 2022
70a2e59
Update doc for cli tool
tla-sirdata Jan 12, 2022
9a36ffa
Update created and lastUpdated dates for testing tool
tla-sirdata Jan 12, 2022
7c953a1
Merge pull request #316 from tla-sirdata/master
kenario Jan 14, 2022
4a5f28e
v1.4.0-0
Jan 14, 2022
24b0014
Merge pull request #318 from shortaflip/master
kenario Jan 14, 2022
3618bca
Bump shelljs from 0.8.3 to 0.8.5 in /modules/core
dependabot[bot] Jan 15, 2022
a8dbdc0
v1.4.0
Jan 31, 2022
96347f4
Merge pull request #322 from shortaflip/master
kenario Jan 31, 2022
9d46f1b
added fix for #325
giniyat202 Feb 9, 2022
02eac3e
Bump pathval from 1.1.0 to 1.1.1
dependabot[bot] Feb 11, 2022
e083710
Bump pathval from 1.1.0 to 1.1.1 in /modules/cmpapi
dependabot[bot] Feb 11, 2022
70ed357
Explicit type conversion in CmpApi
marco-prontera Feb 16, 2022
fe1040c
Change type conversion in Core with explicit type conversion
marco-prontera Feb 16, 2022
98029ad
Remove unused lock
marco-prontera Feb 17, 2022
0c28f74
Update dependency for testing
marco-prontera Feb 17, 2022
a4872f9
Update other dependency
marco-prontera Feb 17, 2022
c4c4055
Fix code
marco-prontera Feb 17, 2022
450cd08
Remove mocharc.yml
marco-prontera Feb 17, 2022
1c855e3
Add mocharc.json most commonly used
marco-prontera Feb 17, 2022
44882ea
Add mocharc for core
marco-prontera Feb 17, 2022
c26c4c7
Convert output to ESM
marco-prontera Feb 17, 2022
0563243
Fix tests: require to import && reset instances to default before exec
marco-prontera Feb 17, 2022
e8485a5
Merge pull request #319 from InteractiveAdvertisingBureau/dependabot/…
kenario Apr 4, 2022
e4fb8f9
Bump ansi-regex from 3.0.0 to 3.0.1 in /modules/cmpapi
dependabot[bot] Apr 4, 2022
314af59
Bump ajv from 6.10.2 to 6.12.6 in /modules/core
dependabot[bot] Apr 4, 2022
ba33933
Bump shelljs from 0.8.3 to 0.8.5
dependabot[bot] Apr 4, 2022
94e1386
Merge pull request #320 from InteractiveAdvertisingBureau/dependabot/…
kenario Apr 4, 2022
5d2f1fa
Bump shelljs from 0.8.3 to 0.8.5 in /modules/cmpapi
dependabot[bot] Apr 4, 2022
c57cda2
Merge pull request #321 from InteractiveAdvertisingBureau/dependabot/…
kenario Apr 4, 2022
029797a
Merge pull request #327 from InteractiveAdvertisingBureau/dependabot/…
kenario Apr 4, 2022
50bf5d5
Merge pull request #328 from InteractiveAdvertisingBureau/dependabot/…
kenario Apr 4, 2022
f5394cc
Merge pull request #331 from InteractiveAdvertisingBureau/dependabot/…
kenario Apr 4, 2022
f2317f0
Bump ajv from 6.10.2 to 6.12.6
dependabot[bot] Apr 4, 2022
de04082
Merge pull request #332 from InteractiveAdvertisingBureau/dependabot/…
kenario Apr 4, 2022
1f23f40
Bump ajv from 6.10.2 to 6.12.6 in /modules/cmpapi
dependabot[bot] Apr 4, 2022
53f40ff
Merge pull request #333 from InteractiveAdvertisingBureau/dependabot/…
kenario Apr 4, 2022
fb36e7d
Bump ajv from 6.10.2 to 6.12.6 in /modules/stub
dependabot[bot] Apr 4, 2022
824decd
Merge pull request #334 from InteractiveAdvertisingBureau/dependabot/…
kenario Apr 4, 2022
2e34aa1
Merge pull request #343 from InteractiveAdvertisingBureau/dependabot/…
kenario Apr 4, 2022
ca58681
Bump ansi-regex from 3.0.0 to 3.0.1 in /modules/core
dependabot[bot] Apr 4, 2022
c26459f
Merge pull request #344 from InteractiveAdvertisingBureau/dependabot/…
kenario Apr 4, 2022
177a609
Bump ansi-regex from 4.1.0 to 4.1.1 in /modules/stub
dependabot[bot] Apr 4, 2022
942c5e5
Merge pull request #345 from InteractiveAdvertisingBureau/dependabot/…
kenario Apr 4, 2022
7640733
Merge pull request #326 from giniyat202/master
kenario Apr 4, 2022
f3df257
Merge pull request #336 from Marco-Prontera/feature/335
kenario Apr 4, 2022
713047c
Merge branch 'master' into feature/337
marco-prontera Apr 5, 2022
4ef9ca9
Add workflows for lint and test
marco-prontera Apr 5, 2022
5c85a44
Add yarn install before
marco-prontera Apr 5, 2022
1cd94ae
Fix test
marco-prontera Apr 5, 2022
39596d9
Fix test
marco-prontera Apr 5, 2022
255bdbc
Remove lint
marco-prontera Apr 5, 2022
d70d19e
Update lock
marco-prontera Apr 5, 2022
b1acb55
Try Update mocha command
marco-prontera Apr 5, 2022
817e9e9
Add comment lines
marco-prontera Apr 5, 2022
00d318d
Separates the initialization of the created field in the constructor …
Apr 5, 2022
42b40e9
Merge pull request #346 from shortaflip/bugfix/342
kenario Apr 7, 2022
c2afe58
Revert "Merge pull request #346 from shortaflip/bugfix/342"
Apr 11, 2022
49972aa
Merge pull request #347 from shortaflip/master
kenario Apr 11, 2022
6b2b6a9
Merge branch 'feature/337' into feature/323
marco-prontera Apr 21, 2022
9e574e5
Expose modules with esm and cjs
marco-prontera Apr 21, 2022
df57cb7
Use ESM for tests
marco-prontera Apr 21, 2022
fec66f2
Merge branch 'spike-esm-cjs' into feature/323
marco-prontera Apr 21, 2022
6c3075a
Merge pull request #338 from Marco-Prontera/feature/337
kenario May 4, 2022
d110860
Update circleci config to use new node LTS version
marco-prontera May 4, 2022
d436f8e
Merge pull request #339 from Marco-Prontera/feature/323
kenario May 4, 2022
97bc87d
Fixed circleci setup fail.
May 4, 2022
90f682f
Merge pull request #351 from shortaflip/master
kenario May 4, 2022
7dae7d7
Added next tag for publish script.
May 4, 2022
4f676b2
Merge branch 'master' of https://github.com/shortaflip/iabtcf-es
May 4, 2022
e713958
Merge pull request #352 from shortaflip/master
kenario May 4, 2022
1867e41
v1.5.0-0
May 4, 2022
1eeb3f9
Merge pull request #353 from shortaflip/master
kenario May 4, 2022
8ed50b0
Fix support ESM
marco-prontera May 10, 2022
6e9eb99
Doc
marco-prontera May 10, 2022
6ef07a0
Merge pull request #355 from Marco-Prontera/feature/354
kenario May 23, 2022
88ba0e2
v1.5.0-1
May 23, 2022
c4a10eb
v1.5.0-2
May 23, 2022
eb8698b
Merge pull request #356 from shortaflip/master
kenario May 23, 2022
edc531f
Fix FieldEncoderMap bug that happens for some bundler
marco-prontera May 24, 2022
7a60ca7
Merge pull request #358 from Marco-Prontera/bugfix/357
kenario Jun 15, 2022
198aad3
v1.5.0-3
Jun 15, 2022
7ac1085
Merge pull request #359 from shortaflip/master
kenario Jun 15, 2022
2aee90f
Bump jsdom from 15.1.1 to 16.5.0 in /modules/cmpapi
dependabot[bot] Jun 23, 2022
15f7340
v1.5.0
Jul 12, 2022
a62505f
v1.5.1
Jul 12, 2022
b661065
v1.5.2
Jul 12, 2022
346609e
v1.5.3
Jul 12, 2022
0f4fac2
Merge pull request #364 from shortaflip/master
kenario Jul 12, 2022
d7df8e8
Bump terser from 4.4.3 to 4.8.1 in /modules/stub
dependabot[bot] Jul 20, 2022
cdef5cb
Merge pull request #360 from InteractiveAdvertisingBureau/dependabot/…
kenario Aug 22, 2022
e6b4db6
Bump jsdom from 15.1.1 to 16.5.0 in /modules/core
dependabot[bot] Aug 22, 2022
27c186b
Merge pull request #361 from InteractiveAdvertisingBureau/dependabot/…
kenario Aug 22, 2022
e2eac47
Merge pull request #366 from InteractiveAdvertisingBureau/dependabot/…
kenario Aug 22, 2022
756653c
Bump terser from 4.6.6 to 4.8.1 in /modules/cmpapi
dependabot[bot] Aug 22, 2022
85f3357
Merge pull request #367 from InteractiveAdvertisingBureau/dependabot/…
kenario Aug 22, 2022
4b7302a
Bump terser from 4.6.6 to 4.8.1 in /modules/core
dependabot[bot] Aug 22, 2022
fd756ec
Merge pull request #368 from InteractiveAdvertisingBureau/dependabot/…
kenario Aug 22, 2022
976f438
Bump terser from 4.8.0 to 4.8.1
dependabot[bot] Aug 22, 2022
d21927f
Merge pull request #369 from InteractiveAdvertisingBureau/dependabot/…
kenario Aug 22, 2022
ab7e329
fix for CallResponder - remove RemoveEventListener from custom comman…
sevriugin Jun 17, 2021
d195eac
remove test for RemoveEventListener as a custom command and add test …
sevriugin Aug 23, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
# This job run on circleci https://circleci.com/ on every PR.
# The purpose is to execute all tests and see the result in the test-results.xml
version: 2.1
jobs:
build:
docker:
- image: 'circleci/node:10.15.3'
- image: "cimg/node:16.15.0"
steps:
- checkout
- run: yarn
Expand Down
13 changes: 9 additions & 4 deletions .eslintrc.js → .eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,15 @@ module.exports = {
'plugin:json/recommended',
],
settings: {
'import/parsers': {
'@typescript-eslint/parser': [
'.ts'
]
"import/parsers": {
"@typescript-eslint/parser": [".ts"]
},
"import/resolver": {
// This with eslint-import-resolver-typescript allow use '.js' suffix in exports to allow ESM work also in browser
"typescript": {
"alwaysTryTypes": true,
},
}
},
parserOptions: {
parser: '@typescript-eslint/parser',
Expand All @@ -23,6 +27,7 @@ module.exports = {
},
rules: {
'import/no-cycle': ['error', { maxDepth: 1 }],
'import/namespace': 0,
'max-len': 0,
'no-multiple-empty-lines':['error', {'max':1, 'maxEOF':0, 'maxBOF':0}],
'require-jsdoc': [0],
Expand Down
30 changes: 30 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# This job run on GitHub actions on every PR opened.
# The purpose is to perform the build and all module tests.
name: CI

on:
pull_request:
branches: [ '**' ]

concurrency:
group: ${{ github.workflow }}-${{ github.event.number || github.sha }}
cancel-in-progress: true

jobs:
build-and-test:

runs-on: ubuntu-latest

strategy:
matrix:
node-version: [16.15.0]

steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- run: yarn install
- run: yarn build
- run: yarn test
12 changes: 12 additions & 0 deletions .mocharc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"require": [
"ts-node/register",
"jsdom-global/register",
"source-map-support/register"
],
"node-option": [
"experimental-specifier-resolution=node",
"loader=ts-node/esm"
],
"spec": "./modules/**/test/Root.test.ts"
}
5 changes: 0 additions & 5 deletions .mocharc.yml

This file was deleted.

53 changes: 53 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# Contribution

In order to contribute to the improvement of the project, below you will find the project development flow.
Before being able to open a PR with changes to be applied or bug fixes to be solved, it is necessary to open an issue
and explain the reason and a possible solution. You can open each PR by forking the project and creating the PR directly from
your project to the project of our library.

Main rules:
- Open issue
- Create PR from forked project
- Link your PR to the issue

## Development environment

To ease local development you have to install these tools:

- [NodeJs v16.15.0](https://nodejs.org/it/)
- [Yarn 1.22.17](https://yarnpkg.com/)

### Install dependencies

To install dependencies, execute these commands:
```sh
yarn install
```

### Test project

To run tests, execute this command:
```sh
yarn test
```

### Lint project

To lint the project files, execute this command:
```sh
yarn lint
```

### Compile and minify for production

To create a production version, execute this command:
```sh
yarn build
```

## ESM - CJS

This library is exported to support both ESM and CJS usage.
To ensure a good output on ESM we need to add the extension on exports and imports with '.js'.
This is necessary and also recommended by Typescript maintainers to
generate code that works in environments where ESM can be used.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,7 @@ This is a mono repo containing 5 modules:
[Testing](./modules/testing#iabtcftesting) - Tools for testing the core library including random TCModel and GVL generators.

[Stub](./modules/stub#iabtcfstub) - Code for the on-page `__tcfapi()` CMP stub.

## Contributing

Here you can find the [contributing guide](CONTRIBUTING.md) to help maintain and update the library.
2 changes: 1 addition & 1 deletion bin/publish-version
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ fi

for pkg in ./modules/*; do
if [[ -d $pkg ]]; then
yarn publish --access public --new-version $npm_package_version $pkg
yarn publish --access public --new-version $npm_package_version --tag next $pkg
fi
done

Expand Down
12 changes: 12 additions & 0 deletions modules/.mocharc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"require": [
"ts-node/register",
"jsdom-global/register",
"source-map-support/register"
],
"node-option": [
"experimental-specifier-resolution=node",
"loader=ts-node/esm"
],
"spec": "./test/Root.test.ts"
}
5 changes: 0 additions & 5 deletions modules/.mocharc.yml

This file was deleted.

18 changes: 16 additions & 2 deletions modules/build
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,26 @@
rm -rf lib
mkdir lib

tsc
tsc -p tsconfig.json

FILES=$(find lib -name "*.js")
tsc -p tsconfig-cjs.json

FILES=$(find lib/cjs -name "*.js")

for FILE in $FILES; do

terser $FILE --ecma 5 -m -c -o $FILE

done

cat >lib/cjs/package.json <<!EOF
{
"type": "commonjs"
}
!EOF

cat >lib/mjs/package.json <<!EOF
{
"type": "module"
}
!EOF
4 changes: 2 additions & 2 deletions modules/cli/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ cmpId: 2
cmpVersion: 1
consentScreen: 2
consentLanguage: "EN"
created: Mon Dec 09 2019 18:01:46 GMT-0800 (Pacific Standard Time)
lastUpdated: Mon Dec 09 2019 18:01:46 GMT-0800 (Pacific Standard Time)
created: Mon Dec 09 2019 00:00:00 GMT
lastUpdated: Mon Dec 09 2019 00:00:00 GMT
policyVersion: 2
isServiceSpecific: false
useNonStandardStacks: false
Expand Down
25 changes: 18 additions & 7 deletions modules/cli/package.json
Original file line number Diff line number Diff line change
@@ -1,31 +1,42 @@
{
"name": "@iabtcf/cli",
"version": "1.2.1",
"version": "1.5.3",
"description": "Decode a iab TCF (Transparency and Consent Framework) TC String via the command line",
"author": "Chris Paterson <tcf@chrispaterson.io>",
"homepage": "https://iabtcf.com/",
"license": "Apache-2.0",
"bin": {
"tcstring": "./lib/index.js"
"tcstring": "./lib/cjs/index.js"
},
"type": "module",
"main": "lib/cjs/index.js",
"module": "lib/mjs/index.js",
"exports": {
".": {
"import": "./lib/mjs/index.js",
"require": "./lib/cjs/index.js"
}
},
"types": "lib/mjs/index.d.ts",
"files": [
"lib/**/*"
],
"scripts": {
"preversion": "echo 'woops I think you meant to go to the root' && exit 1",
"build": "rm -rf lib ; tsc ; chmod a+x lib/index.js",
"build": "../build ; chmod a+x lib/mjs/index.js ; chmod a+x lib/cjs/index.js",
"lint": "eslint `find src -name '*.ts'`"
},
"dependencies": {
"@iabtcf/core": "1.2.1"
"@iabtcf/core": "1.5.3"
},
"devDependencies": {
"@types/node": "^17.0.18",
"@typescript-eslint/eslint-plugin": "^2.10.0",
"@typescript-eslint/parser": "^2.10.0",
"@typescript-eslint/parser": "^5.12.0",
"eslint": "6.8.0",
"source-map-support": "^0.5.12",
"ts-node": "^8.5.4",
"typescript": "^3.7.0"
"ts-node": "^10.5.0",
"typescript": "^4.5.5"
},
"eslintIgnore": [
"lib"
Expand Down
16 changes: 16 additions & 0 deletions modules/cli/tsconfig-cjs.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"extends": "../tsconfig.json",
"compilerOptions": {
"rootDir": "src",
"outDir": "lib/cjs",
"module": "commonjs",
"target": "es2015"
},
"exclude": [
"node_modules"
],
"include": [
"src"
]
}

12 changes: 12 additions & 0 deletions modules/cmpapi/.mocharc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"require": [
"ts-node/register",
"jsdom-global/register",
"source-map-support/register"
],
"node-option": [
"experimental-specifier-resolution=node",
"loader=ts-node/esm"
],
"spec": "./test/Root.test.ts"
}
1 change: 0 additions & 1 deletion modules/cmpapi/.mocharc.yml

This file was deleted.

20 changes: 13 additions & 7 deletions modules/cmpapi/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ const cmpApi = new CmpApi(1, 3, false, {

});

const songLyricCallback = (lyrics) => {
const songLyricCallback = (lyrics, success) => {

if(success) {

Expand All @@ -181,7 +181,7 @@ __tcfapi('connectBones', 2, songLyricCallback, 'knee', 'thigh');
### Built-In and Custom Commands
Beginning in 1.1.0, if a custom command is defined that overlaps with a built-in command (`"ping"`, `"getTCData"`, `"getInAppTCData"`, `"getVendorList"`) then the custom command will act as a "middleware" being passed the built-in command's response and expected to pass along the response when finished.

**Note:** `"addEventListener"` and `"removeEventListener"` can __not__ be overwritten. `"addEventListener"` utilizes the `"getTCData"` command, so to modify `TCData` responses, write a Built-In custom command for that command and both `"getTCData"` and `"addEventListener"` will utilize it.
**Note:** `"addEventListener"` and `"removeEventListener"` can __not__ be overwritten. `"addEventListener"` utilizes the `"getTCData"` command, so to modify `TCData` responses, write a Built-In custom command for that command and both `"getTCData"` and `"addEventListener"` will utilize it. If the `"removeEventListener"` command is also used with a custom `"getTCData"` command, note that `"removeEventListener"` will not return `tcData` but rather a boolean that indicates if the listener was removed. So it is important to add a check, otherwise the CmpApi will catch that error and the callbacks will return with `tcData: null`.

**Example**
````javascript
Expand All @@ -190,13 +190,19 @@ import {CmpApi} from '@iabtcf/cmpapi';

const cmpApi = new CmpApi(1, 3, false, {

'getTCData': (next, tcData) => {
'getTCData': (next, tcData, status) => {

// tcData will be constructed via the TC string and can be added to here
tcData.reallyImportantExtraProperty = true;
/*
* If using with 'removeEventListener' command, add a check to see if tcData is not a boolean. */
if (typeof tcData !== 'boolean') {

// pass data along
next(tcData);
// tcData will be constructed via the TC string and can be added to here
tcData.reallyImportantExtraProperty = true;

}

// pass data and status along
next(tcData, status);


},
Expand Down
Loading