@ikas/storefront 6.1.0-beta.57 → 6.1.0-beta.58
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
|
|
1
|
+
import{__awaiter as t,__generator as e}from'./../../ext/tslib/tslib.es6.js';import*as n from"react";import{observer as r}from"mobx-react-lite";import{IkasBaseStore as o}from"../../store/base.js";import"../../store/customer/index.js";import"../../store/cart/index.js";import a from"../../store/checkout/index.js";import{IkasStorefrontConfig as i}from"@ikas/storefront-config";var c=r((function(r){var c=r.product,s=r.layout,d=r.color,u=r.shape,l=r.label,p=o.getInstance(),f=p.cartStore.cart,v=n.useState(""),m=v[0],y=v[1],h=n.useState(""),g=h[0],I=h[1],P=n.useState(""),w=P[0],b=P[1],E=n.useRef(null);return n.useEffect((function(){if(w){t(void 0,void 0,void 0,(function(){var t,n,r,o,s,d;return e(this,(function(e){switch(e.label){case 0:return e.trys.push([0,2,,3]),t=i.getPaymentGateways().map((function(t){return t.id})),[4,a.listPaymentGateway({cartId:w,id:{in:t},locale:i.getCurrentLocale(),transactionAmount:c.selectedVariant.finalPrice})];case 1:return n=e.sent(),r=null===(d=null===(s=n.data)||void 0===s?void 0:s.find((function(t){return"PAYPAL"===t.code})))||void 0===d?void 0:d.id,I(r||""),[3,3];case 2:return o=e.sent(),console.error("Error fetching PayPal ID:",o),[3,3];case 3:return[2]}}))}))}}),[w,c.selectedVariant.finalPrice]),n.useEffect((function(){if(w&&g){t(void 0,void 0,void 0,(function(){var t,n,r;return e(this,(function(e){switch(e.label){case 0:return e.trys.push([0,2,,3]),[4,a.getPayPalClientId({input:{cartId:w,paymentGatewayId:g}})];case 1:return t=e.sent(),y((null===(r=t.data)||void 0===r?void 0:r.clientId)||""),[3,3];case 2:return n=e.sent(),console.error("Error fetching Client ID:",n),[3,3];case 3:return[2]}}))}))}}),[w,g]),n.useEffect((function(){f&&b(f.id)}),[null==f?void 0:f.id]),n.useEffect((function(){if(w&&g&&m){var n=document.createElement("script");return n.src="https://www.paypal.com/sdk/js?client-id=".concat(m,"¤cy=").concat(c.selectedVariant.price.currency),n.setAttribute("data-page-type","product-details"),n.addEventListener("load",(function(){window.paypal&&window.paypal.Buttons({style:{layout:s,color:d,shape:u,label:l},createOrder:function(){return t(void 0,void 0,void 0,(function(){var t,n,r;return e(this,(function(e){switch(e.label){case 0:return[4,a.createPayPalOrder({input:{cartId:w,paymentGatewayId:g},isPayNow:!0})];case 1:return t=e.sent(),console.log("res",t.data),(null===(n=t.data)||void 0===n?void 0:n.transactionId)&&(o=t.data.transactionId,E.current=o),[2,null===(r=t.data)||void 0===r?void 0:r.sessionToken]}var o}))}))},onShippingOptionsChange:function(t){console.log("SELECTED_OPTION",t.selectedShippingOption)},onShippingAddressChange:function(n){return t(this,void 0,void 0,(function(){var t,r;return e(this,(function(e){switch(e.label){case 0:return console.log("SHIPPING_ADDRESS",n),t=E.current,console.log("Transaction ID (Ref):",t),t?[4,a.updatePaypalOrder({input:{cartId:w,transactionId:t}})]:[2];case 1:return r=e.sent(),console.log("updatePaypalResponse",r),[2]}}))}))},onApprove:function(t,e){return e.order.capture().then((function(e){console.log("data",t),console.log("details",e)}))}}).render("#paypal-button-container")})),document.body.appendChild(n),function(){document.body.removeChild(n)}}}),[m]),n.createElement("div",null,n.createElement("div",{id:"paypal-button-container"}),n.createElement("div",{onClick:function(){return t(void 0,void 0,void 0,(function(){var t,n,r,o;return e(this,(function(e){switch(e.label){case 0:return[4,p.cartStore.addItem(c.selectedVariant,c)];case 1:return t=e.sent(),(null===(o=null===(r=t.response)||void 0===r?void 0:r.data)||void 0===o?void 0:o.id)?(n=t.response.data,b(n.id),[2]):[2]}}))}))}},"paypal"))}));export{c as PaypalExpressCheckout};
|
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.58",
|
|
4
4
|
"description": "Storefront functionality for ikas storefront themes.",
|
|
5
5
|
"author": "ikas",
|
|
6
6
|
"license": "ISC",
|
|
@@ -21,11 +21,11 @@
|
|
|
21
21
|
"swiper": "11.0.6"
|
|
22
22
|
},
|
|
23
23
|
"devDependencies": {
|
|
24
|
-
"@ikas/storefront-api": "^6.1.0-beta.
|
|
25
|
-
"@ikas/storefront-config": "^6.1.0-beta.
|
|
26
|
-
"@ikas/storefront-model-functions": "^6.1.0-beta.
|
|
27
|
-
"@ikas/storefront-models": "^6.1.0-beta.
|
|
28
|
-
"@ikas/storefront-providers": "^6.1.0-beta.
|
|
24
|
+
"@ikas/storefront-api": "^6.1.0-beta.58",
|
|
25
|
+
"@ikas/storefront-config": "^6.1.0-beta.58",
|
|
26
|
+
"@ikas/storefront-model-functions": "^6.1.0-beta.58",
|
|
27
|
+
"@ikas/storefront-models": "^6.1.0-beta.58",
|
|
28
|
+
"@ikas/storefront-providers": "^6.1.0-beta.58",
|
|
29
29
|
"@ikas/localized-address": "1.0.0-beta.6",
|
|
30
30
|
"@adyen/adyen-web": "^5.57.0",
|
|
31
31
|
"@rollup/plugin-commonjs": "^22.0.0",
|
|
@@ -60,11 +60,11 @@
|
|
|
60
60
|
},
|
|
61
61
|
"peerDependencies": {
|
|
62
62
|
"@ikas/localized-address": "1.0.0-beta.6",
|
|
63
|
-
"@ikas/storefront-api": "^6.1.0-beta.
|
|
64
|
-
"@ikas/storefront-config": "^6.1.0-beta.
|
|
65
|
-
"@ikas/storefront-model-functions": "^6.1.0-beta.
|
|
66
|
-
"@ikas/storefront-models": "^6.1.0-beta.
|
|
67
|
-
"@ikas/storefront-providers": "^6.1.0-beta.
|
|
63
|
+
"@ikas/storefront-api": "^6.1.0-beta.58",
|
|
64
|
+
"@ikas/storefront-config": "^6.1.0-beta.58",
|
|
65
|
+
"@ikas/storefront-model-functions": "^6.1.0-beta.58",
|
|
66
|
+
"@ikas/storefront-models": "^6.1.0-beta.58",
|
|
67
|
+
"@ikas/storefront-providers": "^6.1.0-beta.58",
|
|
68
68
|
"mobx": "^6.1.3",
|
|
69
69
|
"mobx-react-lite": "^3.1.5",
|
|
70
70
|
"next": "12.2.0",
|