Skip to content

Commit

Permalink
👽️ Support receiving wnft message from iscn-ar popup window
Browse files Browse the repository at this point in the history
  • Loading branch information
williamchong committed Jan 13, 2023
1 parent 888897b commit 46a9292
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
2 changes: 1 addition & 1 deletion likecoin/assets/js/sidebar/index.asset.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?php return array(
'dependencies' => array( 'react', 'wp-api-fetch', 'wp-data', 'wp-edit-post', 'wp-element', 'wp-i18n', 'wp-plugins', 'wp-wordcount' ),
'version' => 'da9183a7f612662e0f732e8114edf9cf',
'version' => 'df8b1aa87dc7e8019232d641e5eaa8d9',
);
2 changes: 1 addition & 1 deletion likecoin/assets/js/sidebar/index.js

Large diffs are not rendered by default.

7 changes: 6 additions & 1 deletion likecoin/js/sidebar/src/pages/LikeCoinPlugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,10 @@ function LikeCoinPlugin() {

const onPostMessageCallback = useCallback(
async (event) => {
if (event && event.data && event.origin === ISCN_WIDGET_ORIGIN && typeof event.data === 'string') {
if (event
&& event.data
&& (event.origin === ISCN_WIDGET_ORIGIN || event.origin === NFT_WIDGET_ORIGIN)
&& typeof event.data === 'string') {
try {
const { action, data } = JSON.parse(event.data);
if (action === 'ISCN_WIDGET_READY') {
Expand All @@ -142,6 +145,8 @@ function LikeCoinPlugin() {
onArweaveCallback(data);
} else if (action === 'ISCN_SUBMITTED') {
onISCNCallback(data);
} else if (action === 'NFT_MINT_DATA') {
if (data.classId) setNFTClassId(data.classId);
} else {
console.warn(`Unknown event: ${action}`);
}
Expand Down

0 comments on commit 46a9292

Please sign in to comment.