diff --git a/.pnp.cjs b/.pnp.cjs index 62c92e67..a3b04d93 100755 --- a/.pnp.cjs +++ b/.pnp.cjs @@ -29,7 +29,7 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) { "packageLocation": "./",\ "packageDependencies": [\ ["@monaco-editor/react", "virtual:c76842a5689228a0ce1b65e064c1f5e0d5b61e442d08b6527a3b1f100ca1f2105e58f5f1435c5a59df3cce3338560737838d99dae36d25b47d20aa50c89d0539#npm:4.4.5"],\ - ["@transcend-io/airgap.js-types", "npm:10.0.0-alpha.0"],\ + ["@transcend-io/airgap.js-types", "npm:10.0.0-alpha.2"],\ ["@transcend-io/internationalization", "npm:1.5.1"],\ ["@transcend-io/logger", "npm:1.1.0"],\ ["@transcend-io/type-utils", "npm:1.0.7"],\ @@ -1728,10 +1728,10 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) { }]\ ]],\ ["@transcend-io/airgap.js-types", [\ - ["npm:10.0.0-alpha.0", {\ - "packageLocation": "./.yarn/cache/@transcend-io-airgap.js-types-npm-10.0.0-alpha.0-0cf63fbdb5-9c99d43672.zip/node_modules/@transcend-io/airgap.js-types/",\ + ["npm:10.0.0-alpha.2", {\ + "packageLocation": "./.yarn/cache/@transcend-io-airgap.js-types-npm-10.0.0-alpha.2-54611d9baa-f35921a0c0.zip/node_modules/@transcend-io/airgap.js-types/",\ "packageDependencies": [\ - ["@transcend-io/airgap.js-types", "npm:10.0.0-alpha.0"],\ + ["@transcend-io/airgap.js-types", "npm:10.0.0-alpha.2"],\ ["@transcend-io/type-utils", "npm:1.0.5"],\ ["fp-ts", "npm:2.11.8"],\ ["io-ts", "virtual:53d562f9656f9223c4532e7e2b6feefabcf4bfa2c0659bc8d6557c1f9633b17688cca8b3d2effb8a926da81d6d2f2353092c812bd38f1a03f5ff9a9a3e1b3408#npm:2.2.16"]\ @@ -1756,7 +1756,7 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) { "packageDependencies": [\ ["@transcend-io/consent-manager-ui", "workspace:."],\ ["@monaco-editor/react", "virtual:c76842a5689228a0ce1b65e064c1f5e0d5b61e442d08b6527a3b1f100ca1f2105e58f5f1435c5a59df3cce3338560737838d99dae36d25b47d20aa50c89d0539#npm:4.4.5"],\ - ["@transcend-io/airgap.js-types", "npm:10.0.0-alpha.0"],\ + ["@transcend-io/airgap.js-types", "npm:10.0.0-alpha.2"],\ ["@transcend-io/internationalization", "npm:1.5.1"],\ ["@transcend-io/logger", "npm:1.1.0"],\ ["@transcend-io/type-utils", "npm:1.0.7"],\ diff --git a/.yarn/cache/@transcend-io-airgap.js-types-npm-10.0.0-alpha.0-0cf63fbdb5-9c99d43672.zip b/.yarn/cache/@transcend-io-airgap.js-types-npm-10.0.0-alpha.0-0cf63fbdb5-9c99d43672.zip deleted file mode 100644 index e9bc239e..00000000 Binary files a/.yarn/cache/@transcend-io-airgap.js-types-npm-10.0.0-alpha.0-0cf63fbdb5-9c99d43672.zip and /dev/null differ diff --git a/package.json b/package.json index 55af7b20..d8fb1c00 100644 --- a/package.json +++ b/package.json @@ -44,7 +44,7 @@ }, "devDependencies": { "@monaco-editor/react": "^4.4.5", - "@transcend-io/airgap.js-types": "^10.0.0-alpha.0", + "@transcend-io/airgap.js-types": "^10.0.0-alpha.2", "@transcend-io/type-utils": "^1.0.7", "@types/node": "^17.0.21", "@typescript-eslint/eslint-plugin": "^5.12.1", diff --git a/src/hooks/useViewState.ts b/src/hooks/useViewState.ts index 5bba0888..302195f5 100644 --- a/src/hooks/useViewState.ts +++ b/src/hooks/useViewState.ts @@ -5,6 +5,8 @@ import type { ResponseViewState, InitialViewState, ViewState, + ViewStateEventDetails, + TranscendEventType, } from '@transcend-io/airgap.js-types'; import { logger } from '../logger'; import type { HandleSetViewState } from '../types'; @@ -137,9 +139,14 @@ export function useViewState({ ); // Now that the viewState has updated, dispatch an event on the `transcend` API / event target + const eventDetails: ViewStateEventDetails = { + viewState: state.current, + previousViewState: state.previous, + }; + const eventType: TranscendEventType = 'view-state-change'; eventTarget.dispatchEvent( - new CustomEvent('view-state-change', { - detail: { viewState: state.current, previousViewState: state.previous }, + new CustomEvent(eventType, { + detail: eventDetails, }), ); diff --git a/yarn.lock b/yarn.lock index e3b1ab96..9a3c7101 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1155,14 +1155,14 @@ __metadata: languageName: node linkType: hard -"@transcend-io/airgap.js-types@npm:^10.0.0-alpha.0": - version: 10.0.0-alpha.0 - resolution: "@transcend-io/airgap.js-types@npm:10.0.0-alpha.0" +"@transcend-io/airgap.js-types@npm:^10.0.0-alpha.2": + version: 10.0.0-alpha.2 + resolution: "@transcend-io/airgap.js-types@npm:10.0.0-alpha.2" dependencies: "@transcend-io/type-utils": ^1.0.5 fp-ts: ^2.11.8 io-ts: ^2.2.16 - checksum: 9c99d436727263b3820da9cd6a859a400fc3688775bf46a46814f865e8cfbbc1ca220bd53d5c7fe6014e4805febf0bb84113342d521fc0c7679c9f4bdb0368f1 + checksum: f35921a0c0e29651921f51e73184a660ebe13ab61bd7997dc332c13dec6fbec1c56a2b8615ae33ea9529db8302381ffd8c490754039b820f7cacbd7e64d7840a languageName: node linkType: hard @@ -1183,7 +1183,7 @@ __metadata: resolution: "@transcend-io/consent-manager-ui@workspace:." dependencies: "@monaco-editor/react": ^4.4.5 - "@transcend-io/airgap.js-types": ^10.0.0-alpha.0 + "@transcend-io/airgap.js-types": ^10.0.0-alpha.2 "@transcend-io/internationalization": ^1.5.1 "@transcend-io/logger": ^1.0.14 "@transcend-io/type-utils": ^1.0.7