diff --git a/.github/workflows/build-secure-signal.yml b/.github/workflows/build-secure-signal.yml index c8eec53..37050b0 100644 --- a/.github/workflows/build-secure-signal.yml +++ b/.github/workflows/build-secure-signal.yml @@ -45,7 +45,7 @@ jobs: - name: Install dependencies run: npm install - name: Build - run: npm run build:esp -- --mode=${{ matrix.target }} + run: npm run build:secureSignals -- --mode=${{ matrix.target }} # Upload UID2 Secure Signals Files - name: Upload UID2 Secure Signals Files diff --git a/.github/workflows/publish-cstg-example.yml b/.github/workflows/publish-cstg-example.yml deleted file mode 100644 index 6228f96..0000000 --- a/.github/workflows/publish-cstg-example.yml +++ /dev/null @@ -1,38 +0,0 @@ -name: Release CSTG Example Docker Image -run-name: ${{ github.action_ref == 'refs/head/main' && 'Release' || 'Publish Pre-release' }} CSTG Example Docker Image by @${{ github.actor }} - -on: - workflow_dispatch: - -env: - REGISTRY: ghcr.io - IMAGE_NAME: iabtechlab/uid2-cstg-example - -jobs: - build-cstg-example: - runs-on: ubuntu-latest - permissions: - contents: read - packages: write - steps: - - uses: actions/checkout@v4 - - name: Log in to the Container registry - uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9 - with: - registry: ${{ env.REGISTRY }} - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} - - name: Extract metadata (tags, labels) for Docker - id: meta - uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38 - with: - images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} - tags: | - type=sha,format=short - - name: Build and push Docker CSTG Example image - uses: docker/build-push-action@v5 - with: - context: examples/cstg - push: true - tags: ${{ steps.meta.outputs.tags }} - labels: ${{ steps.meta.outputs.labels }} diff --git a/.github/workflows/publish-js-sdk-example.yml b/.github/workflows/publish-js-sdk-example.yml deleted file mode 100644 index ad2fb90..0000000 --- a/.github/workflows/publish-js-sdk-example.yml +++ /dev/null @@ -1,38 +0,0 @@ -name: Release JS SDK Example Docker Image -run-name: ${{ github.action_ref == 'refs/head/main' && 'Release' || 'Publish Pre-release' }} JS SDK Example Docker Image by @${{ github.actor }} - -on: - workflow_dispatch: - -env: - REGISTRY: ghcr.io - IMAGE_NAME: iabtechlab/uid2-js-sdk-example - -jobs: - build-js-sdk-example: - runs-on: ubuntu-latest - permissions: - contents: read - packages: write - steps: - - uses: actions/checkout@v4 - - name: Log in to the Container registry - uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9 - with: - registry: ${{ env.REGISTRY }} - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} - - name: Extract metadata (tags, labels) for Docker - id: meta - uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38 - with: - images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} - tags: | - type=sha,format=short - - name: Build and push Docker JS SDK Example image - uses: docker/build-push-action@v5 - with: - context: examples/js-sdk - push: true - tags: ${{ steps.meta.outputs.tags }} - labels: ${{ steps.meta.outputs.labels }} diff --git a/.github/workflows/publish-secure-signal-examples.yml b/.github/workflows/publish-secure-signal-examples.yml deleted file mode 100644 index 3a42bba..0000000 --- a/.github/workflows/publish-secure-signal-examples.yml +++ /dev/null @@ -1,102 +0,0 @@ -name: Release Secure Signal Examples Docker Image -run-name: ${{ github.action_ref == 'refs/head/main' && 'Release' || 'Publish Pre-release' }} Secure Signal Examples Docker Image by @${{ github.actor }} - -on: - workflow_dispatch: - -env: - REGISTRY: ghcr.io - -jobs: - build-server-side: - runs-on: ubuntu-latest - permissions: - contents: read - packages: write - steps: - - uses: actions/checkout@v4 - - name: Log in to the Container registry - uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9 - with: - registry: ${{ env.REGISTRY }} - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} - - name: Extract metadata (tags, labels) for Docker - id: meta - uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38 - with: - images: ${{ env.REGISTRY }}/iabtechlab/uid2-secure-signals-example-srvonly - tags: | - type=sha,format=short - type=raw,value=latest - - name: Build and push Docker server_side image - uses: docker/build-push-action@v5 - with: - context: examples/google-secure-signals-integration/server_side - push: true - tags: ${{ steps.meta.outputs.tags }} - labels: ${{ steps.meta.outputs.labels }} - - build-standard: - runs-on: ubuntu-latest - permissions: - contents: read - packages: write - steps: - - uses: actions/checkout@v4 - - name: Log in to the Container registry - uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9 - with: - registry: ${{ env.REGISTRY }} - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} - - name: Extract metadata (tags, labels) for Docker - id: meta - uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38 - with: - images: ${{ env.REGISTRY }}/iabtechlab/uid2-secure-signals-example-jssdk - tags: | - type=sha,format=short - type=raw,value=latest - - name: Build and push Docker standard image - uses: docker/build-push-action@v5 - with: - context: examples/google-secure-signals-integration/with_sdk_v3 - push: true - tags: ${{ steps.meta.outputs.tags }} - labels: ${{ steps.meta.outputs.labels }} - build-client-side: - runs-on: ubuntu-latest - permissions: - contents: read - packages: write - steps: - - uses: actions/checkout@v4 - - name: Log in to the Container registry - uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9 - with: - registry: ${{ env.REGISTRY }} - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} - - name: Extract metadata (tags, labels) for Docker - id: meta - uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38 - with: - images: ${{ env.REGISTRY }}/iabtechlab/uid2-secure-signals-example-client-side - tags: | - type=sha,format=short - type=raw,value=latest - - name: Build and push Docker client_side image - uses: docker/build-push-action@v5 - with: - context: examples/google-secure-signals-integration/client_side - push: true - tags: ${{ steps.meta.outputs.tags }} - labels: ${{ steps.meta.outputs.labels }} - - name: Build and push Docker React image - uses: docker/build-push-action@v5 - with: - context: examples/google-secure-signals-integration/react_client_side - push: true - tags: ${{ steps.meta.outputs.tags }} - labels: ${{ steps.meta.outputs.labels }} diff --git a/.github/workflows/release-secure-signal-examples-docker-image-server-only.yaml b/.github/workflows/release-secure-signal-examples-docker-image-server-only.yaml deleted file mode 100644 index abc0846..0000000 --- a/.github/workflows/release-secure-signal-examples-docker-image-server-only.yaml +++ /dev/null @@ -1,36 +0,0 @@ -name: Release Secure Signal Examples Docker Image for Server Only -run-name: ${{ inputs.release_type == 'Snapshot' && 'Publish Pre-release' || format('Release {0}', inputs.release_type)}} Secure Signal Examples Docker Image for Server Only by @${{ github.actor }} -on: - workflow_dispatch: - inputs: - release_type: - type: choice - description: The type of release - options: - - Major - - Minor - - Patch - - Snapshot - required: true - -jobs: - incrementVersionNumber: - uses: IABTechLab/uid2-shared-actions/.github/workflows/shared-increase-version-number.yaml@v2 - with: - release_type: ${{ inputs.release_type }} - working_dir: examples/google-secure-signals-integration/server_side - secrets: inherit - - publishForSecureSignalsExampleSrvOnly: - uses: IABTechLab/uid2-shared-actions/.github/workflows/shared-publish-to-docker-versioned.yaml@v3 - needs: incrementVersionNumber - with: - new_version: ${{ needs.incrementVersionNumber.outputs.new_version }} - image_tag: ${{ needs.incrementVersionNumber.outputs.image_tag }} - release_type: ${{ inputs.release_type }} - docker_file: examples/google-secure-signals-integration/server_side/Dockerfile - docker_context: examples/google-secure-signals-integration/server_side - docker_image_name: iabtechlab/uid2-esp-example-srvonly - docker_registry: ghcr.io - force_release: no - secrets: inherit diff --git a/.github/workflows/release-secure-signal-examples-docker-image-standard.yaml b/.github/workflows/release-secure-signal-examples-docker-image-standard.yaml deleted file mode 100644 index aefc616..0000000 --- a/.github/workflows/release-secure-signal-examples-docker-image-standard.yaml +++ /dev/null @@ -1,36 +0,0 @@ -name: Release Secure Signal Examples Docker Image for Standard -run-name: ${{ inputs.release_type == 'Snapshot' && 'Publish Pre-release' || format('Release {0}', inputs.release_type)}} Secure Signal Examples Docker Image for Standard by @${{ github.actor }} -on: - workflow_dispatch: - inputs: - release_type: - type: choice - description: The type of release - options: - - Major - - Minor - - Patch - - Snapshot - required: true - -jobs: - incrementVersionNumber: - uses: IABTechLab/uid2-shared-actions/.github/workflows/shared-increase-version-number.yaml@v2 - with: - release_type: ${{ inputs.release_type }} - working_dir: examples/google-secure-signals-integration/with_sdk_v3 - secrets: inherit - - publishForSecureSignalsExampleJssdk: - uses: IABTechLab/uid2-shared-actions/.github/workflows/shared-publish-to-docker-versioned.yaml@v3 - needs: incrementVersionNumber - with: - new_version: ${{ needs.incrementVersionNumber.outputs.new_version }} - image_tag: ${{ needs.incrementVersionNumber.outputs.image_tag }} - release_type: ${{ inputs.release_type }} - docker_file: examples/google-secure-signals-integration/with_sdk_v3/Dockerfile - docker_context: examples/google-secure-signals-integration/with_sdk_v3 - docker_image_name: iabtechlab/uid2-esp-example-jssdk - docker_registry: ghcr.io - force_release: no - secrets: inherit diff --git a/.github/workflows/release-secure-signals-client-side-uid2.yml b/.github/workflows/release-secure-signals-client-side-uid2.yml deleted file mode 100644 index 0671e76..0000000 --- a/.github/workflows/release-secure-signals-client-side-uid2.yml +++ /dev/null @@ -1,36 +0,0 @@ -name: Release Secure Signal Examples Docker Image for UID2 Client Side -run-name: ${{ inputs.release_type == 'Snapshot' && 'Publish Pre-release' || format('Release {0}', inputs.release_type)}} Secure Signal Examples Docker Image for UID2 Client Side by @${{ github.actor }} -on: - workflow_dispatch: - inputs: - release_type: - type: choice - description: The type of release - options: - - Major - - Minor - - Patch - - Snapshot - required: true - -jobs: - incrementVersionNumber: - uses: IABTechLab/uid2-shared-actions/.github/workflows/shared-increase-version-number.yaml@v2 - with: - release_type: ${{ inputs.release_type }} - working_dir: examples/google-secure-signals-integration/client_side - secrets: inherit - - publishForSecureSignalsExampleClientSide: - uses: IABTechLab/uid2-shared-actions/.github/workflows/shared-publish-to-docker-versioned.yaml@v3 - needs: incrementVersionNumber - with: - new_version: ${{ needs.incrementVersionNumber.outputs.new_version }} - image_tag: ${{ needs.incrementVersionNumber.outputs.image_tag }} - release_type: ${{ inputs.release_type }} - docker_file: examples/google-secure-signals-integration/client_side/Dockerfile - docker_context: examples/google-secure-signals-integration/client_side - docker_image_name: iabtechlab/uid2-secure-signals-example-client-side - docker_registry: ghcr.io - force_release: no - secrets: inherit diff --git a/.github/workflows/release-secure-signals-react-uid2.yml b/.github/workflows/release-secure-signals-react-uid2.yml deleted file mode 100644 index 3c7fb4d..0000000 --- a/.github/workflows/release-secure-signals-react-uid2.yml +++ /dev/null @@ -1,36 +0,0 @@ -name: Release Secure Signal Examples Docker Image for UID2 React -run-name: ${{ inputs.release_type == 'Snapshot' && 'Publish Pre-release' || format('Release {0}', inputs.release_type)}} Secure Signal Examples Docker Image for UID2 React by @${{ github.actor }} -on: - workflow_dispatch: - inputs: - release_type: - type: choice - description: The type of release - options: - - Major - - Minor - - Patch - - Snapshot - required: true - -jobs: - incrementVersionNumber: - uses: IABTechLab/uid2-shared-actions/.github/workflows/shared-increase-version-number.yaml@v2 - with: - release_type: ${{ inputs.release_type }} - working_dir: examples/google-secure-signals-integration/react_client_side - secrets: inherit - - publishForSecureSignalsExampleReact: - uses: IABTechLab/uid2-shared-actions/.github/workflows/shared-publish-to-docker-versioned.yaml@v3 - needs: incrementVersionNumber - with: - new_version: ${{ needs.incrementVersionNumber.outputs.new_version }} - image_tag: ${{ needs.incrementVersionNumber.outputs.image_tag }} - release_type: ${{ inputs.release_type }} - docker_file: examples/google-secure-signals-integration/react_client_side/Dockerfile - docker_context: examples/google-secure-signals-integration/react_client_side - docker_image_name: iabtechlab/uid2-secure-signals-example-react - docker_registry: ghcr.io - force_release: no - secrets: inherit diff --git a/package.json b/package.json index c4d2220..28689f6 100644 --- a/package.json +++ b/package.json @@ -22,7 +22,7 @@ "watch": "webpack watch --mode=development", "webpack-dev-server": "webpack-dev-server --config webpack-dev-server.config.js --hot --port 9091", "uid2-examples": "webpack --mode=development --env outputToExamples=true", - "build:esp": "webpack --env espOnly=true", + "build:secureSignals": "webpack --env secureSignalsOnly=true", "createCA": "tsx createCA.ts", "localtest": "cd localtest && tsx server.ts" }, diff --git a/src/integrationTests/euidSdk.test.ts b/src/integrationTests/euidSdk.test.ts index 682b519..107837c 100644 --- a/src/integrationTests/euidSdk.test.ts +++ b/src/integrationTests/euidSdk.test.ts @@ -11,7 +11,7 @@ import { ProductDetails } from '../product'; let callback: any; let asyncCallback: jest.Mock; let xhrMock: any; -let uid2ESP: UidSecureSignalProvider; +let euidSecureSignals: UidSecureSignalProvider; let secureSignalProvidersPushMock: jest.Mock<(p: any) => Promise>; let getAdvertisingTokenMock: jest.Mock<() => Promise>; getAdvertisingTokenMock = jest.fn<() => Promise>(); @@ -115,11 +115,11 @@ describe('when a callback is provided', () => { }); }); - describe('when getUid2AdvertisingToken exists and returns valid advertisingToken', () => { - test('should send signal to Google ESP', async () => { + describe('when geteuidSecureSignalsAdvertisingToken exists and returns valid advertisingToken', () => { + test('should send signal to Google Secure Signals', async () => { window.getEuidAdvertisingToken = getAdvertisingTokenMock; getAdvertisingTokenMock.mockReturnValue(Promise.resolve('testToken')); - uid2ESP = new UidSecureSignalProvider(false, true); + euidSecureSignals = new UidSecureSignalProvider(false, true); expect(secureSignalProvidersPushMock).toHaveBeenCalledTimes(1); expect(secureSignalProvidersPushMock).toHaveBeenCalledWith( expect.objectContaining({ @@ -131,7 +131,7 @@ describe('when a callback is provided', () => { }); describe('When SDK initialized after both SDK and SS script loaded - EUID', () => { - test('should send identity to Google ESP', async () => { + test('should send identity to Google Secure Signals', async () => { __euidInternalHandleScriptLoad(); __euidSSProviderScriptLoad(); (sdkWindow.__euid as EUID).init({ identity }); diff --git a/src/integrationTests/secureSignal.test.ts b/src/integrationTests/secureSignal.test.ts index 5f2ac81..39c592e 100644 --- a/src/integrationTests/secureSignal.test.ts +++ b/src/integrationTests/secureSignal.test.ts @@ -7,7 +7,7 @@ import { clearWarnMock, setWarnMock } from '../mocks'; let getAdvertisingTokenMock: jest.Mock<() => Promise>; let secureSignalProvidersPushMock: jest.Mock<(p: any) => Promise>; -let uid2ESP: UidSecureSignalProvider; +let uid2SecureSignals: UidSecureSignalProvider; let xhrMock: any; mocks.setupFakeTime(); @@ -35,10 +35,10 @@ describe('Secure Signal Tests', () => { window.__uid2 = undefined; describe('when getUid2AdvertisingToken exists and returns valid advertisingToken', () => { - test('should send signal to Google ESP', async () => { + test('should send signal to Google Secure Signals', async () => { window.getUid2AdvertisingToken = getAdvertisingTokenMock; getAdvertisingTokenMock.mockReturnValue(Promise.resolve('testToken')); - uid2ESP = new UidSecureSignalProvider(); + uid2SecureSignals = new UidSecureSignalProvider(); expect(secureSignalProvidersPushMock).toHaveBeenCalledTimes(1); await expect(secureSignalProvidersPushMock).toHaveBeenCalledWith( expect.objectContaining({ @@ -50,14 +50,14 @@ describe('Secure Signal Tests', () => { }); describe('when getUid2AdvertisingToken is not defined', () => { - test('should not send signal to ESP', () => { - uid2ESP = new UidSecureSignalProvider(); + test('should not send signal to Google Secure Signals', () => { + uid2SecureSignals = new UidSecureSignalProvider(); expect(secureSignalProvidersPushMock).not.toBeCalled(); }); describe('when publisher trigger registerSecureSignalProvider', () => { test('should log warning message to console and not send message', () => { - uid2ESP.registerSecureSignalProvider(); + uid2SecureSignals.registerSecureSignalProvider(); expect(console.warn).toHaveBeenCalledTimes(1); expect(mocks.warnMock).toHaveBeenCalledWith( 'UidSecureSignal: Please implement `getUidAdvertisingToken`' @@ -68,7 +68,7 @@ describe('Secure Signal Tests', () => { }); describe('when getUid2AdvertisingToken exists and returns invalid token', () => { - test('should not send signal to ESP', () => { + test('should not send signal to Google Secure Signals', () => { getAdvertisingTokenMock.mockReturnValue(Promise.resolve('')); new UidSecureSignalProvider(); expect(secureSignalProvidersPushMock).not.toBeCalled(); @@ -103,7 +103,7 @@ describe('Secure Signal Tests', () => { mocks.removeUid2LocalStorage(); }); - test('should send signal to Google ESP when SDK initialized', async () => { + test('should send signal to Google Secure Signals when SDK initialized', async () => { __uid2SSProviderScriptLoad(); __uid2InternalHandleScriptLoad(); (window.__uid2 as UID2).init({ identity }); @@ -119,7 +119,7 @@ describe('Secure Signal Tests', () => { ); }); - test('should send signal to Google ESP when SDK initialized and Identity is available', async () => { + test('should send signal to Google Secure Signals when SDK initialized and Identity is available', async () => { mocks.setUid2LocalStorage(identity); __uid2SSProviderScriptLoad(); __uid2InternalHandleScriptLoad(); @@ -136,7 +136,7 @@ describe('Secure Signal Tests', () => { ); }); - test('should send signal to Google ESP when SDK initialized and Identity is set after', async () => { + test.only('should send signal to Google Secure Signals when SDK initialized and Identity is set after', async () => { __uid2SSProviderScriptLoad(); __uid2InternalHandleScriptLoad(); (window.__uid2 as UID2).init({}); @@ -153,7 +153,7 @@ describe('Secure Signal Tests', () => { ); }); - test('should send signal to Google ESP when SDK initialized and SS script is included later', async () => { + test('should send signal to Google Secure Signals when SDK initialized and SS script is included later', async () => { __uid2InternalHandleScriptLoad(); (window.__uid2 as UID2).init({ identity }); __uid2SSProviderScriptLoad(); @@ -186,7 +186,7 @@ describe('Secure Signal Tests', () => { window.__uid2SecureSignalProvider = undefined; }); - test('should send signal to Google ESP once loaded', async () => { + test('should send signal to Google Secure Signals once loaded', async () => { uid2.init({ identity }); window.__uid2SecureSignalProvider = new UidSecureSignalProvider(); UID2.setupGoogleSecureSignals(); @@ -211,7 +211,7 @@ describe('Secure Signal Tests', () => { expect(secureSignalProvidersPushMock).toHaveBeenCalledTimes(0); }); - test('should send signal with updated identity to Google ESP', async () => { + test('should send signal with updated identity to Google Secure Signals', async () => { const outdatedIdentity = mocks.makeIdentityV2({ refresh_from: Date.now() - 1, }); @@ -237,7 +237,7 @@ describe('Secure Signal Tests', () => { window.__uid2 = new UID2(); mocks.removeUid2LocalStorage(); }); - test('should send identity to Google ESP', async () => { + test('should send identity to Google Secure Signals', async () => { __uid2InternalHandleScriptLoad(); __uid2SSProviderScriptLoad(); (window.__uid2 as UID2).init({ identity }); diff --git a/webpack.config.js b/webpack.config.js index fe4d0eb..2c1aa05 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -1,21 +1,21 @@ const uid2Entrypoint = './src/uid2Sdk.ts'; const euidEntrypoint = './src/euidSdk.ts'; -const espEntryPointUid2 = './src/secureSignalUid2.ts'; -const espEntryPointEuid = './src/secureSignalEuid.ts'; +const secureSignalsEntryPointUid2 = './src/secureSignalUid2.ts'; +const secureSignalsEntryPointEuid = './src/secureSignalEuid.ts'; -const espOutput = { +const secureSignalsOutput = { 'uid2-secureSignals': { - import: espEntryPointUid2, + import: secureSignalsEntryPointUid2, filename: `uid2SecureSignal.js`, }, 'euid-secureSignals': { - import: espEntryPointEuid, + import: secureSignalsEntryPointEuid, filename: `euidSecureSignal.js`, }, }; // n.b. if you add more outputs, the path is relative to the dist folder. -const getExampleOutputs = (env) => (!env.outputToExamples ? {} : espOutput); +const getExampleOutputs = (env) => (!env.outputToExamples ? {} : secureSignalsOutput); module.exports = (env, argv) => { const buildMode = argv.mode; @@ -25,7 +25,7 @@ module.exports = (env, argv) => { return { mode: buildMode, devtool: prodSourceMaps ? 'source-map' : false, - entry: !env.espOnly + entry: !env.secureSignalsOnly ? { 'uid2-sdk': { import: uid2Entrypoint, @@ -37,7 +37,7 @@ module.exports = (env, argv) => { }, ...getExampleOutputs(env), } - : espOutput, + : secureSignalsOutput, module: { rules: [ {