@ikas/storefront 6.1.0-beta.253 → 6.1.0-beta.255
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1 +1 @@
|
|
|
1
|
-
import{__awaiter as e,__generator as t}from'./../../ext/tslib/tslib.es6.js';import*as r from"react";import{IkasStorefrontConfig as n}from"@ikas/storefront-config";import{IkasBaseStore as o}from"../../store/base.js";import{autorun as i}from"mobx";var a=!1,s=function(s){var d
|
|
1
|
+
import{__awaiter as e,__generator as t}from'./../../ext/tslib/tslib.es6.js';import*as r from"react";import{IkasStorefrontConfig as n}from"@ikas/storefront-config";import{IkasBaseStore as o}from"../../store/base.js";import{autorun as i}from"mobx";var a=!1,s=function(s){var c,d=s.product,l=s.quantity,u=void 0===l?1:l,f=s.useExistingCart,v=void 0!==f&&f,g=n.getPayWithIkasUrl();if(!g)return null;var m=null!==(c=process.env.NEXT_PUBLIC_GQL_URL)&&void 0!==c?c:"",p=null==m?void 0:m.includes(".dev"),h="https://pay.ikas.".concat(p?"dev":"com","/widget?isAddToCartEnabled=true&radius=12&color=light_blue"),y=(null==d?void 0:d.isAddToCartEnabled)||!1,w=new URL(g);w.searchParams.set("isAddToCartEnabled",y.toString());var b=v?h:w.toString(),E=r.useRef(null),k=r.useState(0),I=k[0],P=k[1],L=null;r.useEffect((function(){var e=function(e){e.persisted&&(console.log("[PayWithIkas] Page restored from bfcache, reloading iframe"),a=!1,P((function(e){var t=e+1;return console.log("[PayWithIkas] refreshKey:",e,"->",t),t})))};return window.addEventListener("pageshow",e),function(){window.removeEventListener("pageshow",e)}}),[]);var W=I>0?"".concat(b,"&_bfcache=").concat(I):b;return r.useEffect((function(){console.log("[PayWithIkas] iframe src:",W)}),[W]),r.useEffect((function(){var r=function(r){return e(void 0,void 0,void 0,(function(){var e,n,i,s,c,l;return t(this,(function(t){switch(t.label){case 0:if("ikas-buy-click"!==r.data.type)return[2];if((null===(n=E.current)||void 0===n?void 0:n.contentWindow)!==r.source)return[2];if(a)return[2];if(a=!0,v&&!(null===(i=o.getInstance().cartStore.cart)||void 0===i?void 0:i.id))return console.error("No existing cart found"),[2];t.label=1;case 1:return t.trys.push([1,,3,4]),[4,o.getInstance().cartStore.createPayWithIkasSession(d,u,v?null===(s=o.getInstance().cartStore.cart)||void 0===s?void 0:s.id:void 0)];case 2:return e=t.sent(),null===(l=null===(c=E.current)||void 0===c?void 0:c.contentWindow)||void 0===l||l.postMessage({type:"ikas-buy-loading-stop"},"*"),e.success&&e.payUrl?(f=e.payUrl,window.location.href=f,[3,4]):(console.error("Pay with ikas error:",e.error),[2]);case 3:return a=!1,[7];case 4:return[2]}var f}))}))};return window.addEventListener("message",r),L=i((function(){var e,t;console.log("Notify ikas-pay"),null===(t=null===(e=E.current)||void 0===e?void 0:e.contentWindow)||void 0===t||t.postMessage({type:"ikas-buy-enabled-state-change",isAddToCartEnabled:!!v||((null==d?void 0:d.isAddToCartEnabled)||!1)},"*")})),function(){window.removeEventListener("message",r),null==L||L()}}),[d,u]),r.createElement("iframe",{ref:E,src:W,width:"100%",height:"100%",style:{border:"none"}})};export{s as PayWithIkas};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ikas/storefront",
|
|
3
|
-
"version": "6.1.0-beta.
|
|
3
|
+
"version": "6.1.0-beta.255",
|
|
4
4
|
"description": "Storefront functionality for ikas storefront themes.",
|
|
5
5
|
"author": "ikas",
|
|
6
6
|
"license": "ISC",
|
|
@@ -23,11 +23,11 @@
|
|
|
23
23
|
"swiper": "11.0.6"
|
|
24
24
|
},
|
|
25
25
|
"devDependencies": {
|
|
26
|
-
"@ikas/storefront-api": "^6.1.0-beta.
|
|
27
|
-
"@ikas/storefront-config": "^6.1.0-beta.
|
|
28
|
-
"@ikas/storefront-model-functions": "^6.1.0-beta.
|
|
29
|
-
"@ikas/storefront-models": "^6.1.0-beta.
|
|
30
|
-
"@ikas/storefront-providers": "^6.1.0-beta.
|
|
26
|
+
"@ikas/storefront-api": "^6.1.0-beta.255",
|
|
27
|
+
"@ikas/storefront-config": "^6.1.0-beta.255",
|
|
28
|
+
"@ikas/storefront-model-functions": "^6.1.0-beta.255",
|
|
29
|
+
"@ikas/storefront-models": "^6.1.0-beta.255",
|
|
30
|
+
"@ikas/storefront-providers": "^6.1.0-beta.255",
|
|
31
31
|
"@ikas/localized-address": "1.0.0-beta.6",
|
|
32
32
|
"@adyen/adyen-web": "^5.57.0",
|
|
33
33
|
"@rollup/plugin-commonjs": "^22.0.0",
|
|
@@ -62,11 +62,11 @@
|
|
|
62
62
|
},
|
|
63
63
|
"peerDependencies": {
|
|
64
64
|
"@ikas/localized-address": "1.0.0-beta.6",
|
|
65
|
-
"@ikas/storefront-api": "^6.1.0-beta.
|
|
66
|
-
"@ikas/storefront-config": "^6.1.0-beta.
|
|
67
|
-
"@ikas/storefront-model-functions": "^6.1.0-beta.
|
|
68
|
-
"@ikas/storefront-models": "^6.1.0-beta.
|
|
69
|
-
"@ikas/storefront-providers": "^6.1.0-beta.
|
|
65
|
+
"@ikas/storefront-api": "^6.1.0-beta.255",
|
|
66
|
+
"@ikas/storefront-config": "^6.1.0-beta.255",
|
|
67
|
+
"@ikas/storefront-model-functions": "^6.1.0-beta.255",
|
|
68
|
+
"@ikas/storefront-models": "^6.1.0-beta.255",
|
|
69
|
+
"@ikas/storefront-providers": "^6.1.0-beta.255",
|
|
70
70
|
"mobx": "^6.1.3",
|
|
71
71
|
"mobx-react-lite": "^3.1.5",
|
|
72
72
|
"next": "12.2.0",
|