@ikas/storefront 6.1.0-beta.259 → 6.1.0-beta.260
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
|
|
1
|
+
import{__awaiter as e,__generator as t}from'./../../ext/tslib/tslib.es6.js';import*as o from"react";import{IkasStorefrontConfig as n}from"@ikas/storefront-config";import{IkasBaseStore as r}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,v=s.useExistingCart,f=void 0!==v&&v,g=n.getPayWithIkasUrl();if(!g)return null;var h=null!==(c=process.env.NEXT_PUBLIC_GQL_URL)&&void 0!==c?c:"",p=null==h?void 0:h.includes(".dev"),m="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=f?m:w.toString(),k=o.useRef(null),P=o.useState(0),E=P[0],I=P[1],W=null;o.useEffect((function(){var e=function(e){if(e.persisted){if("undefined"!=typeof navigator&&(/iPad|iPhone|iPod/.test(navigator.userAgent)||"MacIntel"===navigator.platform&&navigator.maxTouchPoints>1))return console.log("[PayWithIkas] iOS bfcache restore, forcing full reload"),void window.location.reload();console.log("[PayWithIkas] Page restored from bfcache, reloading iframe"),a=!1,I((function(e){return e+1}))}};return window.addEventListener("pageshow",e),function(){window.removeEventListener("pageshow",e)}}),[]);var L=E>0?"".concat(b,"&_bfcache=").concat(E):b;return o.useEffect((function(){var o=function(o){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"!==o.data.type)return[2];if((null===(n=k.current)||void 0===n?void 0:n.contentWindow)!==o.source)return[2];if(console.log("[PayWithIkas] Button clicked, isPayWithIkasInProgress:",a),a)return[2];if(a=!0,f&&!(null===(i=r.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,r.getInstance().cartStore.createPayWithIkasSession(d,u,f?null===(s=r.getInstance().cartStore.cart)||void 0===s?void 0:s.id:void 0)];case 2:return e=t.sent(),null===(l=null===(c=k.current)||void 0===c?void 0:c.contentWindow)||void 0===l||l.postMessage({type:"ikas-buy-loading-stop"},"*"),e.success&&e.payUrl?(v=e.payUrl,console.log("[PayWithIkas] Navigating to:",v),window.location.href=v,[3,4]):(console.error("Pay with ikas error:",e.error),[2]);case 3:return a=!1,[7];case 4:return[2]}var v}))}))};return window.addEventListener("message",o),W=i((function(){var e,t;console.log("Notify ikas-pay"),null===(t=null===(e=k.current)||void 0===e?void 0:e.contentWindow)||void 0===t||t.postMessage({type:"ikas-buy-enabled-state-change",isAddToCartEnabled:!!f||((null==d?void 0:d.isAddToCartEnabled)||!1)},"*")})),function(){window.removeEventListener("message",o),null==W||W()}}),[d,u]),o.createElement("iframe",{ref:k,src:L,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.260",
|
|
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.260",
|
|
27
|
+
"@ikas/storefront-config": "^6.1.0-beta.260",
|
|
28
|
+
"@ikas/storefront-model-functions": "^6.1.0-beta.260",
|
|
29
|
+
"@ikas/storefront-models": "^6.1.0-beta.260",
|
|
30
|
+
"@ikas/storefront-providers": "^6.1.0-beta.260",
|
|
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.260",
|
|
66
|
+
"@ikas/storefront-config": "^6.1.0-beta.260",
|
|
67
|
+
"@ikas/storefront-model-functions": "^6.1.0-beta.260",
|
|
68
|
+
"@ikas/storefront-models": "^6.1.0-beta.260",
|
|
69
|
+
"@ikas/storefront-providers": "^6.1.0-beta.260",
|
|
70
70
|
"mobx": "^6.1.3",
|
|
71
71
|
"mobx-react-lite": "^3.1.5",
|
|
72
72
|
"next": "12.2.0",
|