diff --git a/package-lock.json b/package-lock.json index 11a89be..e4ab9a9 100644 --- a/package-lock.json +++ b/package-lock.json @@ -8,7 +8,7 @@ "name": "widgets", "version": "0.1.0", "dependencies": { - "@bosonprotocol/react-kit": "^0.24.2-alpha.0", + "@bosonprotocol/react-kit": "^0.24.2-alpha.1", "@testing-library/jest-dom": "^5.16.5", "@testing-library/react": "^13.4.0", "@testing-library/user-event": "^13.5.0", @@ -2152,11 +2152,11 @@ } }, "node_modules/@bosonprotocol/common": { - "version": "1.25.0", - "resolved": "https://registry.npmjs.org/@bosonprotocol/common/-/common-1.25.0.tgz", - "integrity": "sha512-0g79mwIreI4ZdSOhhV2q0yo/VPOdD98ha7CtdK9+d1nEUvCIXP5G9ibXbrUzPNXN1/iAdrlY66HgcWLyQOqkyA==", + "version": "1.25.1-alpha.0", + "resolved": "https://registry.npmjs.org/@bosonprotocol/common/-/common-1.25.1-alpha.0.tgz", + "integrity": "sha512-lLTc+lv1LVpwyyOxAEQkaXpXWP878jbPhRrZ1LyqXkpQvmT9f+4Rf6KiDxwaUpR1zDvJFKNqPCa99bUbszDNBw==", "dependencies": { - "@bosonprotocol/metadata": "^1.13.0", + "@bosonprotocol/metadata": "^1.13.1-alpha.0", "@ethersproject/abi": "^5.5.0", "@ethersproject/address": "^5.5.0", "@ethersproject/bignumber": "^5.5.0", @@ -2166,11 +2166,11 @@ } }, "node_modules/@bosonprotocol/core-sdk": { - "version": "1.34.1-alpha.0", - "resolved": "https://registry.npmjs.org/@bosonprotocol/core-sdk/-/core-sdk-1.34.1-alpha.0.tgz", - "integrity": "sha512-dSJPx6LVXPdXrsj3FdfqRL84Oih4bhe6PV7R48bz2QIO8iEEQl2ef20qfgQUWxqP5zck8tA9BVfbKszj3XzTAw==", + "version": "1.34.1-alpha.1", + "resolved": "https://registry.npmjs.org/@bosonprotocol/core-sdk/-/core-sdk-1.34.1-alpha.1.tgz", + "integrity": "sha512-SCpYgcwDLUEWc/86EpsOccUU3/01RqdkF1n9sugORc7bX3vZXq2lk3x6lMzFjsOfECMp2ea5xhqfZamhRtWcnw==", "dependencies": { - "@bosonprotocol/common": "^1.25.0", + "@bosonprotocol/common": "^1.25.1-alpha.0", "@ethersproject/abi": "^5.5.0", "@ethersproject/address": "^5.5.0", "@ethersproject/bignumber": "^5.5.0", @@ -2199,44 +2199,44 @@ } }, "node_modules/@bosonprotocol/ethers-sdk": { - "version": "1.12.11", - "resolved": "https://registry.npmjs.org/@bosonprotocol/ethers-sdk/-/ethers-sdk-1.12.11.tgz", - "integrity": "sha512-qHvgHYF3l+DvqoN+5FnllGaV/ods8Sqb+aCnSRf8KdroU17wVM7OWi3KDfoAY99AStkjks2t0OYnqXffSnPGDw==", + "version": "1.12.12-alpha.0", + "resolved": "https://registry.npmjs.org/@bosonprotocol/ethers-sdk/-/ethers-sdk-1.12.12-alpha.0.tgz", + "integrity": "sha512-OEi0Xvdg8BE4C01uFhYuYQ/HsGmxcSQnT9btvlTLDamMvAGaEiVfFB8pskSzzoJPVMYFNw7BqgLO+AoG3jvTFg==", "dependencies": { - "@bosonprotocol/common": "^1.25.0" + "@bosonprotocol/common": "^1.25.1-alpha.0" }, "peerDependencies": { "ethers": "^5.5.0" } }, "node_modules/@bosonprotocol/ipfs-storage": { - "version": "1.10.10", - "resolved": "https://registry.npmjs.org/@bosonprotocol/ipfs-storage/-/ipfs-storage-1.10.10.tgz", - "integrity": "sha512-HzcZvmzPErpXGIGx2ICun7N6iBtfd8CIl8Q0YfGy1S8WlNmaOH6hf7xcOJo2JSrn2jnoyijDSD3/0JC4EhWyxg==", + "version": "1.10.11-alpha.0", + "resolved": "https://registry.npmjs.org/@bosonprotocol/ipfs-storage/-/ipfs-storage-1.10.11-alpha.0.tgz", + "integrity": "sha512-fBywpV1162VMbfQOsct8QKK3E1ge0EOpHCOJCzcFMMIe2IuO0lYv76MX5YTosjhzAb4avFJ26GP5fyDUWN43Iw==", "dependencies": { - "@bosonprotocol/metadata": "^1.13.0", + "@bosonprotocol/metadata": "^1.13.1-alpha.0", "ipfs-http-client": "^56.0.1", "multiformats": "^9.6.4", "uint8arrays": "^3.0.0" } }, "node_modules/@bosonprotocol/metadata": { - "version": "1.13.0", - "resolved": "https://registry.npmjs.org/@bosonprotocol/metadata/-/metadata-1.13.0.tgz", - "integrity": "sha512-4sex/mRpFlg/Ba2LQ2QezGtZ6+hkJi1swyECEvkIn5ExlFTm9CU3ha7Twu/eP8JLuMbCoX3/tnweX9WUiH+mhg==", + "version": "1.13.1-alpha.0", + "resolved": "https://registry.npmjs.org/@bosonprotocol/metadata/-/metadata-1.13.1-alpha.0.tgz", + "integrity": "sha512-3g8QLr4hXhkTy5PAGRt3u01ixczVY/YZlF41a0OrSsRklGlgi1Ra0DlA3hpsDLc9W8Q2LHVU11DtxzHLS2DVFw==", "dependencies": { "schema-to-yup": "^1.11.11" } }, "node_modules/@bosonprotocol/react-kit": { - "version": "0.24.2-alpha.0", - "resolved": "https://registry.npmjs.org/@bosonprotocol/react-kit/-/react-kit-0.24.2-alpha.0.tgz", - "integrity": "sha512-2HttnU35IPI7njqJbTRUAgssgRK/lDMHXiwPIfBOSR4q/gpJ48fdTq7czG0xAqUGxiCnoimYquC3weA45RIvvw==", + "version": "0.24.2-alpha.1", + "resolved": "https://registry.npmjs.org/@bosonprotocol/react-kit/-/react-kit-0.24.2-alpha.1.tgz", + "integrity": "sha512-6SgZjpDsw8pd54Y8fa2Z8wrreReTyy8shBQC2vpDbNm4vOiEQ2AFLgnR+f3mXVCFayQQbfchzo0EiDAlUlKc2Q==", "dependencies": { "@bosonprotocol/chat-sdk": "^1.3.1-alpha.9", - "@bosonprotocol/core-sdk": "^1.34.1-alpha.0", - "@bosonprotocol/ethers-sdk": "^1.12.11", - "@bosonprotocol/ipfs-storage": "^1.10.10", + "@bosonprotocol/core-sdk": "^1.34.1-alpha.1", + "@bosonprotocol/ethers-sdk": "^1.12.12-alpha.0", + "@bosonprotocol/ipfs-storage": "^1.10.11-alpha.0", "@davatar/react": "1.11.1", "@ethersproject/units": "5.6.0", "@glidejs/glide": "3.6.0", @@ -25660,9 +25660,9 @@ } }, "node_modules/schema-to-yup": { - "version": "1.12.15", - "resolved": "https://registry.npmjs.org/schema-to-yup/-/schema-to-yup-1.12.15.tgz", - "integrity": "sha512-fFP1gHTU3YgBsSz4gKcp3SNrt80qziXo8BaYsD32egST5bosMr6sttX+RhPno0MKjhoBb/KH0/blu4lbdetnGA==", + "version": "1.12.18", + "resolved": "https://registry.npmjs.org/schema-to-yup/-/schema-to-yup-1.12.18.tgz", + "integrity": "sha512-rzMtnIQpkokOzyb6JfsuCB+/BklFB5J7pFcvc/SnybOtmks8uW4SJXfMpzMQT98f826XgI3/mlPGQf0HBhF8FQ==", "dependencies": { "dashify": "^2.0.0", "uniq": "^1.0.1", @@ -25682,9 +25682,9 @@ } }, "node_modules/schema-to-yup/node_modules/yup": { - "version": "1.3.2", - "resolved": "https://registry.npmjs.org/yup/-/yup-1.3.2.tgz", - "integrity": "sha512-6KCM971iQtJ+/KUaHdrhVr2LDkfhBtFPRnsG1P8F4q3uUVQ2RfEM9xekpha9aA4GXWJevjM10eDcPQ1FfWlmaQ==", + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/yup/-/yup-1.3.3.tgz", + "integrity": "sha512-v8QwZSsHH2K3/G9WSkp6mZKO+hugKT1EmnMqLNUcfu51HU9MDyhlETT/JgtzprnrnQHPWsjc6MUDMBp/l9fNnw==", "dependencies": { "property-expr": "^2.0.5", "tiny-case": "^1.0.3", @@ -31124,11 +31124,11 @@ } }, "@bosonprotocol/common": { - "version": "1.25.0", - "resolved": "https://registry.npmjs.org/@bosonprotocol/common/-/common-1.25.0.tgz", - "integrity": "sha512-0g79mwIreI4ZdSOhhV2q0yo/VPOdD98ha7CtdK9+d1nEUvCIXP5G9ibXbrUzPNXN1/iAdrlY66HgcWLyQOqkyA==", + "version": "1.25.1-alpha.0", + "resolved": "https://registry.npmjs.org/@bosonprotocol/common/-/common-1.25.1-alpha.0.tgz", + "integrity": "sha512-lLTc+lv1LVpwyyOxAEQkaXpXWP878jbPhRrZ1LyqXkpQvmT9f+4Rf6KiDxwaUpR1zDvJFKNqPCa99bUbszDNBw==", "requires": { - "@bosonprotocol/metadata": "^1.13.0", + "@bosonprotocol/metadata": "^1.13.1-alpha.0", "@ethersproject/abi": "^5.5.0", "@ethersproject/address": "^5.5.0", "@ethersproject/bignumber": "^5.5.0", @@ -31138,11 +31138,11 @@ } }, "@bosonprotocol/core-sdk": { - "version": "1.34.1-alpha.0", - "resolved": "https://registry.npmjs.org/@bosonprotocol/core-sdk/-/core-sdk-1.34.1-alpha.0.tgz", - "integrity": "sha512-dSJPx6LVXPdXrsj3FdfqRL84Oih4bhe6PV7R48bz2QIO8iEEQl2ef20qfgQUWxqP5zck8tA9BVfbKszj3XzTAw==", + "version": "1.34.1-alpha.1", + "resolved": "https://registry.npmjs.org/@bosonprotocol/core-sdk/-/core-sdk-1.34.1-alpha.1.tgz", + "integrity": "sha512-SCpYgcwDLUEWc/86EpsOccUU3/01RqdkF1n9sugORc7bX3vZXq2lk3x6lMzFjsOfECMp2ea5xhqfZamhRtWcnw==", "requires": { - "@bosonprotocol/common": "^1.25.0", + "@bosonprotocol/common": "^1.25.1-alpha.0", "@ethersproject/abi": "^5.5.0", "@ethersproject/address": "^5.5.0", "@ethersproject/bignumber": "^5.5.0", @@ -31170,41 +31170,41 @@ } }, "@bosonprotocol/ethers-sdk": { - "version": "1.12.11", - "resolved": "https://registry.npmjs.org/@bosonprotocol/ethers-sdk/-/ethers-sdk-1.12.11.tgz", - "integrity": "sha512-qHvgHYF3l+DvqoN+5FnllGaV/ods8Sqb+aCnSRf8KdroU17wVM7OWi3KDfoAY99AStkjks2t0OYnqXffSnPGDw==", + "version": "1.12.12-alpha.0", + "resolved": "https://registry.npmjs.org/@bosonprotocol/ethers-sdk/-/ethers-sdk-1.12.12-alpha.0.tgz", + "integrity": "sha512-OEi0Xvdg8BE4C01uFhYuYQ/HsGmxcSQnT9btvlTLDamMvAGaEiVfFB8pskSzzoJPVMYFNw7BqgLO+AoG3jvTFg==", "requires": { - "@bosonprotocol/common": "^1.25.0" + "@bosonprotocol/common": "^1.25.1-alpha.0" } }, "@bosonprotocol/ipfs-storage": { - "version": "1.10.10", - "resolved": "https://registry.npmjs.org/@bosonprotocol/ipfs-storage/-/ipfs-storage-1.10.10.tgz", - "integrity": "sha512-HzcZvmzPErpXGIGx2ICun7N6iBtfd8CIl8Q0YfGy1S8WlNmaOH6hf7xcOJo2JSrn2jnoyijDSD3/0JC4EhWyxg==", + "version": "1.10.11-alpha.0", + "resolved": "https://registry.npmjs.org/@bosonprotocol/ipfs-storage/-/ipfs-storage-1.10.11-alpha.0.tgz", + "integrity": "sha512-fBywpV1162VMbfQOsct8QKK3E1ge0EOpHCOJCzcFMMIe2IuO0lYv76MX5YTosjhzAb4avFJ26GP5fyDUWN43Iw==", "requires": { - "@bosonprotocol/metadata": "^1.13.0", + "@bosonprotocol/metadata": "^1.13.1-alpha.0", "ipfs-http-client": "^56.0.1", "multiformats": "^9.6.4", "uint8arrays": "^3.0.0" } }, "@bosonprotocol/metadata": { - "version": "1.13.0", - "resolved": "https://registry.npmjs.org/@bosonprotocol/metadata/-/metadata-1.13.0.tgz", - "integrity": "sha512-4sex/mRpFlg/Ba2LQ2QezGtZ6+hkJi1swyECEvkIn5ExlFTm9CU3ha7Twu/eP8JLuMbCoX3/tnweX9WUiH+mhg==", + "version": "1.13.1-alpha.0", + "resolved": "https://registry.npmjs.org/@bosonprotocol/metadata/-/metadata-1.13.1-alpha.0.tgz", + "integrity": "sha512-3g8QLr4hXhkTy5PAGRt3u01ixczVY/YZlF41a0OrSsRklGlgi1Ra0DlA3hpsDLc9W8Q2LHVU11DtxzHLS2DVFw==", "requires": { "schema-to-yup": "^1.11.11" } }, "@bosonprotocol/react-kit": { - "version": "0.24.2-alpha.0", - "resolved": "https://registry.npmjs.org/@bosonprotocol/react-kit/-/react-kit-0.24.2-alpha.0.tgz", - "integrity": "sha512-2HttnU35IPI7njqJbTRUAgssgRK/lDMHXiwPIfBOSR4q/gpJ48fdTq7czG0xAqUGxiCnoimYquC3weA45RIvvw==", + "version": "0.24.2-alpha.1", + "resolved": "https://registry.npmjs.org/@bosonprotocol/react-kit/-/react-kit-0.24.2-alpha.1.tgz", + "integrity": "sha512-6SgZjpDsw8pd54Y8fa2Z8wrreReTyy8shBQC2vpDbNm4vOiEQ2AFLgnR+f3mXVCFayQQbfchzo0EiDAlUlKc2Q==", "requires": { "@bosonprotocol/chat-sdk": "^1.3.1-alpha.9", - "@bosonprotocol/core-sdk": "^1.34.1-alpha.0", - "@bosonprotocol/ethers-sdk": "^1.12.11", - "@bosonprotocol/ipfs-storage": "^1.10.10", + "@bosonprotocol/core-sdk": "^1.34.1-alpha.1", + "@bosonprotocol/ethers-sdk": "^1.12.12-alpha.0", + "@bosonprotocol/ipfs-storage": "^1.10.11-alpha.0", "@davatar/react": "1.11.1", "@ethersproject/units": "5.6.0", "@glidejs/glide": "3.6.0", @@ -48670,9 +48670,9 @@ } }, "schema-to-yup": { - "version": "1.12.15", - "resolved": "https://registry.npmjs.org/schema-to-yup/-/schema-to-yup-1.12.15.tgz", - "integrity": "sha512-fFP1gHTU3YgBsSz4gKcp3SNrt80qziXo8BaYsD32egST5bosMr6sttX+RhPno0MKjhoBb/KH0/blu4lbdetnGA==", + "version": "1.12.18", + "resolved": "https://registry.npmjs.org/schema-to-yup/-/schema-to-yup-1.12.18.tgz", + "integrity": "sha512-rzMtnIQpkokOzyb6JfsuCB+/BklFB5J7pFcvc/SnybOtmks8uW4SJXfMpzMQT98f826XgI3/mlPGQf0HBhF8FQ==", "requires": { "dashify": "^2.0.0", "uniq": "^1.0.1", @@ -48686,9 +48686,9 @@ "integrity": "sha512-RAH822pAdBgcNMAfWnCBU3CFZcfZ/i1eZjwFU/dsLKumyuuP3niueg2UAukXYF0E2AAoc82ZSSf9J0WQBinzHA==" }, "yup": { - "version": "1.3.2", - "resolved": "https://registry.npmjs.org/yup/-/yup-1.3.2.tgz", - "integrity": "sha512-6KCM971iQtJ+/KUaHdrhVr2LDkfhBtFPRnsG1P8F4q3uUVQ2RfEM9xekpha9aA4GXWJevjM10eDcPQ1FfWlmaQ==", + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/yup/-/yup-1.3.3.tgz", + "integrity": "sha512-v8QwZSsHH2K3/G9WSkp6mZKO+hugKT1EmnMqLNUcfu51HU9MDyhlETT/JgtzprnrnQHPWsjc6MUDMBp/l9fNnw==", "requires": { "property-expr": "^2.0.5", "tiny-case": "^1.0.3", diff --git a/package.json b/package.json index 7a0a82a..1695697 100644 --- a/package.json +++ b/package.json @@ -3,7 +3,7 @@ "version": "0.1.0", "private": true, "dependencies": { - "@bosonprotocol/react-kit": "^0.24.2-alpha.0", + "@bosonprotocol/react-kit": "^0.24.2-alpha.1", "@testing-library/jest-dom": "^5.16.5", "@testing-library/react": "^13.4.0", "@testing-library/user-event": "^13.5.0", diff --git a/public/example.html b/public/example.html index 33c07ee..74ee1be 100644 --- a/public/example.html +++ b/public/example.html @@ -165,6 +165,15 @@

Redemption Widget

+ + EventTag + + + + + + + Should Wait For Response @@ -274,7 +283,7 @@

Redemption Widget

window.addEventListener("message", (event) => { if (event.data.type === constants.deliveryInfoMessage) { console.log( - `Received message '${event.data.type}' from '${event.origin}'. Content: '${JSON.stringify(event.data.message)}' Signature: '${event.data.signature}'` + `Received message '${event.data.type}' from '${event.origin}'. Content: '${JSON.stringify(event.data)}'` ); if (getValue('input-wait-for-response', 'checked')) { // wait for a bit and send a response to the iFrame (only relevant when ) diff --git a/public/scripts/boson-widgets.js b/public/scripts/boson-widgets.js index 9f4007c..9ba7f9f 100644 --- a/public/scripts/boson-widgets.js +++ b/public/scripts/boson-widgets.js @@ -18,6 +18,7 @@ const constants = { showRedemptionOverviewTag: "data-show-redemption-overview", widgetActionTag: "data-widget-action", deliveryInfoTag: "data-delivery-info", + eventTagTag: "data-event-tag", postDeliveryInfoUrlTag: "data-post-delivery-info-url", postDeliveryInfoHeadersTag: "data-post-delivery-info-headers", dataTargetOrigin: "data-target-origin", @@ -175,6 +176,7 @@ function bosonWidgetReload(onLoadIframe) { showRedeemId.attributes[constants.dataSendDeliveryInfoXMTP]?.value; const withExternalSigner = showRedeemId.attributes[constants.dataWithExternalSigner]?.value; + const eventTag = showRedeemId.attributes[constants.eventTagTag]?.value; bosonWidgetShowRedeem( { @@ -197,7 +199,8 @@ function bosonWidgetReload(onLoadIframe) { targetOrigin, shouldWaitForResponse, sendDeliveryInfoThroughXMTP, - withExternalSigner + withExternalSigner, + eventTag }, onLoadIframe ); @@ -254,7 +257,8 @@ function bosonWidgetShowRedeem(args, onLoadIframe) { { tag: "withExternalSigner", value: args.withExternalSigner - } + }, + { tag: "eventTag", value: args.eventTag } ]); showLoading(); hideIFrame(); diff --git a/src/components/widgets/redeem/Redeem.tsx b/src/components/widgets/redeem/Redeem.tsx index 161d78f..d40c954 100644 --- a/src/components/widgets/redeem/Redeem.tsx +++ b/src/components/widgets/redeem/Redeem.tsx @@ -109,6 +109,8 @@ export function Redeem() { const signaturesStr = searchParams.get("signatures") as string; const signatures = signaturesStr ? signaturesStr.split(",") : undefined; + const eventTag = searchParams.get("eventTag") as string; + // In case the deliveryInfo shall be transferred between frontend windows, the targetOrigin // the deliveryInfo message shall be posted to // (see https://developer.mozilla.org/en-US/docs/Web/API/Window/postMessage#targetorigin) @@ -161,7 +163,8 @@ export function Redeem() { const event = { type: "boson-delivery-info", message, - signature + signature, + tag: eventTag }; // precaution: register to the response before posting the message const responseType = "boson-delivery-info-response";