@zonos/elements 1.3.268 → 1.3.269
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.
- package/dist/cjs/{cart-af7c024e.js → cart-87fbbb5a.js} +1 -1
- package/dist/cjs/{hasInclusivePrice-0fa6e022.js → hasInclusivePrice-c86ed1f5.js} +1 -1
- package/dist/cjs/index.cjs.js +7 -7
- package/dist/cjs/{invoice-c2e3f232.js → invoice-952f32c4.js} +2 -2
- package/dist/cjs/{isCollectMobileTablet-6014787b.js → isCollectMobileTablet-1cb21c59.js} +2 -2
- package/dist/cjs/{localization-f897bc45.js → localization-a969f224.js} +239 -2
- package/dist/cjs/{paypal-6756a0da.js → paypal-cfe1e8e9.js} +2 -2
- package/dist/cjs/{placeTestOrder-a4874e51.js → placeTestOrder-613878fb.js} +2 -2
- package/dist/cjs/{renderCheckoutCurrency-584d50fe.js → renderCheckoutCurrency-5a333d29.js} +2 -2
- package/dist/cjs/zonos-address-display_8.cjs.entry.js +2 -2
- package/dist/cjs/zonos-address_4.cjs.entry.js +2 -2
- package/dist/cjs/zonos-card_5.cjs.entry.js +3 -3
- package/dist/cjs/zonos-cart-items_12.cjs.entry.js +6 -6
- package/dist/cjs/zonos-checkout.cjs.entry.js +15 -72
- package/dist/cjs/zonos-collect-cart-items_3.cjs.entry.js +2 -2
- package/dist/cjs/zonos-collect-finish_6.cjs.entry.js +6 -6
- package/dist/cjs/zonos-collect.cjs.entry.js +4 -4
- package/dist/cjs/zonos-controller.cjs.entry.js +2 -2
- package/dist/cjs/zonos-country-flag.cjs.entry.js +1 -1
- package/dist/cjs/zonos-country-select_4.cjs.entry.js +1 -1
- package/dist/cjs/zonos-hello-dialog.cjs.entry.js +2 -2
- package/dist/cjs/zonos-hello.cjs.entry.js +2 -45
- package/dist/cjs/zonos-invoice-cart-items_2.cjs.entry.js +4 -4
- package/dist/cjs/zonos-invoice-finish_5.cjs.entry.js +6 -6
- package/dist/cjs/zonos-invoice.cjs.entry.js +4 -4
- package/dist/cjs/zonos-language-select_2.cjs.entry.js +1 -1
- package/dist/cjs/zonos-policy-consent_2.cjs.entry.js +3 -3
- package/dist/collection/components/hello/zonos-hello/zonos-hello.js +2 -44
- package/dist/collection/components/store/hello/localization.js +12 -1
- package/dist/collection/components/utils/checkout/bigcommerceStorefrontApi.js +28 -0
- package/dist/collection/components/utils/checkout/removeBigcommerceCartShipping.js +83 -0
- package/dist/collection/components/utils/hello/shouldShowHelloWidget.js +61 -0
- package/dist/collection/utils/toggleBigcommerceNativeCurrencySelector.js +2 -1
- package/dist/esm/{cart-68c16805.js → cart-663ef7d5.js} +1 -1
- package/dist/esm/{hasInclusivePrice-f1ca1610.js → hasInclusivePrice-f8bd057d.js} +1 -1
- package/dist/esm/index.js +7 -7
- package/dist/esm/{invoice-d0eadc6a.js → invoice-db7211a6.js} +2 -2
- package/dist/esm/{isCollectMobileTablet-11ade63f.js → isCollectMobileTablet-24c912b1.js} +2 -2
- package/dist/esm/{localization-8e81b696.js → localization-dc19e8bb.js} +236 -3
- package/dist/esm/{paypal-e32877e9.js → paypal-cdbe69ef.js} +2 -2
- package/dist/esm/{placeTestOrder-4cf429d7.js → placeTestOrder-ba67e208.js} +2 -2
- package/dist/esm/{renderCheckoutCurrency-9459b8a3.js → renderCheckoutCurrency-fb1cbd28.js} +2 -2
- package/dist/esm/zonos-address-display_8.entry.js +2 -2
- package/dist/esm/zonos-address_4.entry.js +2 -2
- package/dist/esm/zonos-card_5.entry.js +3 -3
- package/dist/esm/zonos-cart-items_12.entry.js +6 -6
- package/dist/esm/zonos-checkout.entry.js +4 -61
- package/dist/esm/zonos-collect-cart-items_3.entry.js +2 -2
- package/dist/esm/zonos-collect-finish_6.entry.js +6 -6
- package/dist/esm/zonos-collect.entry.js +4 -4
- package/dist/esm/zonos-controller.entry.js +2 -2
- package/dist/esm/zonos-country-flag.entry.js +1 -1
- package/dist/esm/zonos-country-select_4.entry.js +1 -1
- package/dist/esm/zonos-hello-dialog.entry.js +2 -2
- package/dist/esm/zonos-hello.entry.js +2 -45
- package/dist/esm/zonos-invoice-cart-items_2.entry.js +4 -4
- package/dist/esm/zonos-invoice-finish_5.entry.js +6 -6
- package/dist/esm/zonos-invoice.entry.js +4 -4
- package/dist/esm/zonos-language-select_2.entry.js +1 -1
- package/dist/esm/zonos-policy-consent_2.entry.js +3 -3
- package/dist/esm-es5/{cart-68c16805.js → cart-663ef7d5.js} +1 -1
- package/dist/esm-es5/{hasInclusivePrice-f1ca1610.js → hasInclusivePrice-f8bd057d.js} +1 -1
- package/dist/esm-es5/index.js +1 -1
- package/dist/esm-es5/{invoice-d0eadc6a.js → invoice-db7211a6.js} +1 -1
- package/dist/esm-es5/{isCollectMobileTablet-11ade63f.js → isCollectMobileTablet-24c912b1.js} +1 -1
- package/dist/esm-es5/{localization-8e81b696.js → localization-dc19e8bb.js} +1 -1
- package/dist/esm-es5/{paypal-e32877e9.js → paypal-cdbe69ef.js} +1 -1
- package/dist/esm-es5/{placeTestOrder-4cf429d7.js → placeTestOrder-ba67e208.js} +1 -1
- package/dist/esm-es5/{renderCheckoutCurrency-9459b8a3.js → renderCheckoutCurrency-fb1cbd28.js} +1 -1
- package/dist/esm-es5/zonos-address-display_8.entry.js +1 -1
- package/dist/esm-es5/zonos-address_4.entry.js +1 -1
- package/dist/esm-es5/zonos-card_5.entry.js +1 -1
- package/dist/esm-es5/zonos-cart-items_12.entry.js +1 -1
- package/dist/esm-es5/zonos-checkout.entry.js +1 -1
- package/dist/esm-es5/zonos-collect-cart-items_3.entry.js +1 -1
- package/dist/esm-es5/zonos-collect-finish_6.entry.js +1 -1
- package/dist/esm-es5/zonos-collect.entry.js +1 -1
- package/dist/esm-es5/zonos-controller.entry.js +1 -1
- package/dist/esm-es5/zonos-country-flag.entry.js +1 -1
- package/dist/esm-es5/zonos-country-select_4.entry.js +1 -1
- package/dist/esm-es5/zonos-hello-dialog.entry.js +1 -1
- package/dist/esm-es5/zonos-hello.entry.js +1 -1
- package/dist/esm-es5/zonos-invoice-cart-items_2.entry.js +1 -1
- package/dist/esm-es5/zonos-invoice-finish_5.entry.js +1 -1
- package/dist/esm-es5/zonos-invoice.entry.js +1 -1
- package/dist/esm-es5/zonos-language-select_2.entry.js +1 -1
- package/dist/esm-es5/zonos-policy-consent_2.entry.js +1 -1
- package/dist/scripts/index.js +1 -1
- package/dist/scripts/loadZonos.js +1 -1
- package/dist/scripts/zonos.js +1 -1
- package/dist/types/components/hello/zonos-hello/zonos-hello.d.ts +0 -1
- package/dist/types/components/utils/checkout/bigcommerceStorefrontApi.d.ts +9 -0
- package/dist/types/components/utils/checkout/removeBigcommerceCartShipping.d.ts +18 -0
- package/dist/types/components/utils/hello/shouldShowHelloWidget.d.ts +16 -0
- package/dist/zonos-elements/index.esm.js +1 -1
- package/dist/zonos-elements/{p-50362897.entry.js → p-049fc407.entry.js} +1 -1
- package/dist/zonos-elements/{p-c7ca3e98.system.entry.js → p-0581cfc9.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-01913da8.js → p-097d7819.js} +1 -1
- package/dist/zonos-elements/{p-5e18d92b.system.entry.js → p-09d32e53.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-8ddc21f1.system.entry.js → p-0daed059.system.entry.js} +1 -1
- package/dist/zonos-elements/p-1bde60d5.system.entry.js +1 -0
- package/dist/zonos-elements/{p-dcafbd4e.js → p-243dda5f.js} +1 -1
- package/dist/zonos-elements/p-263d14da.system.entry.js +1 -0
- package/dist/zonos-elements/p-29b60bf3.system.js +1 -1
- package/dist/zonos-elements/p-2be4335f.js +1 -0
- package/dist/zonos-elements/{p-64e8f05d.system.entry.js → p-33a37c42.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-17e3cd62.js → p-44147850.js} +1 -1
- package/dist/zonos-elements/{p-97da66f2.entry.js → p-488c1af1.entry.js} +1 -1
- package/dist/zonos-elements/{p-95b460e9.system.entry.js → p-48ec0b61.system.entry.js} +1 -1
- package/dist/zonos-elements/p-4af88255.entry.js +1 -0
- package/dist/zonos-elements/p-4b6e367d.system.js +1 -0
- package/dist/zonos-elements/{p-7fef8558.entry.js → p-513e8278.entry.js} +1 -1
- package/dist/zonos-elements/p-56711a61.js +1 -0
- package/dist/zonos-elements/{p-e3d6f9b4.entry.js → p-57b55808.entry.js} +1 -1
- package/dist/zonos-elements/p-57c3c68f.entry.js +1 -0
- package/dist/zonos-elements/{p-c3459f4a.entry.js → p-680da401.entry.js} +1 -1
- package/dist/zonos-elements/p-699276f2.system.js +1 -0
- package/dist/zonos-elements/{p-a0ee01dd.system.entry.js → p-71528303.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-44b279cc.system.js → p-7662d32a.system.js} +1 -1
- package/dist/zonos-elements/{p-48805ed6.system.entry.js → p-82ce355d.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-620a9013.entry.js → p-84d4f04d.entry.js} +1 -1
- package/dist/zonos-elements/{p-673407b8.entry.js → p-858103a0.entry.js} +1 -1
- package/dist/zonos-elements/{p-bc9a30a1.system.entry.js → p-882fb843.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-24091606.system.entry.js → p-8a24701c.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-593764cf.system.entry.js → p-8f0bdb87.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-4fe3d5e0.system.js → p-8f817a47.system.js} +1 -1
- package/dist/zonos-elements/{p-38311c16.entry.js → p-9092f655.entry.js} +1 -1
- package/dist/zonos-elements/{p-6f41c193.entry.js → p-9377b5c2.entry.js} +1 -1
- package/dist/zonos-elements/{p-b93b66c2.entry.js → p-9799193c.entry.js} +1 -1
- package/dist/zonos-elements/{p-fc5007e0.entry.js → p-9a509268.entry.js} +1 -1
- package/dist/zonos-elements/{p-69089a6f.system.entry.js → p-9ea67d63.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-7166df08.entry.js → p-a237429e.entry.js} +1 -1
- package/dist/zonos-elements/{p-1eef8c23.system.js → p-a3a79b2f.system.js} +1 -1
- package/dist/zonos-elements/p-accccb9c.entry.js +1 -0
- package/dist/zonos-elements/{p-623fc89a.system.entry.js → p-b0ed0fe7.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-7628569a.entry.js → p-ba127f51.entry.js} +1 -1
- package/dist/zonos-elements/{p-72c3756a.js → p-bbef037c.js} +1 -1
- package/dist/zonos-elements/p-be64a52e.entry.js +1 -0
- package/dist/zonos-elements/{p-5b05b461.system.js → p-c2023a08.system.js} +1 -1
- package/dist/zonos-elements/{p-1376e67f.system.entry.js → p-c4ef873a.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-774de1ec.system.js → p-c5caf47b.system.js} +1 -1
- package/dist/zonos-elements/{p-108b5307.system.entry.js → p-c62293d5.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-b71ef46e.js → p-cd5444b0.js} +1 -1
- package/dist/zonos-elements/p-d437bc28.js +1 -0
- package/dist/zonos-elements/{p-2ccd20c0.system.js → p-d932973f.system.js} +1 -1
- package/dist/zonos-elements/{p-95f3bbad.system.entry.js → p-df0c8fb6.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-c91fade3.entry.js → p-e05e5825.entry.js} +1 -1
- package/dist/zonos-elements/{p-53a59935.system.js → p-f5684fc2.system.js} +1 -1
- package/dist/zonos-elements/{p-af12a1b7.system.entry.js → p-fc270539.system.entry.js} +1 -1
- package/dist/zonos-elements/zonos-elements.esm.js +1 -1
- package/package.json +1 -1
- package/dist/zonos-elements/p-000b895a.entry.js +0 -1
- package/dist/zonos-elements/p-06e7fe2a.system.entry.js +0 -1
- package/dist/zonos-elements/p-0803ad10.js +0 -1
- package/dist/zonos-elements/p-11439d12.entry.js +0 -1
- package/dist/zonos-elements/p-17be8409.entry.js +0 -1
- package/dist/zonos-elements/p-5fa2395d.system.js +0 -1
- package/dist/zonos-elements/p-72960738.js +0 -1
- package/dist/zonos-elements/p-7a220941.system.js +0 -1
- package/dist/zonos-elements/p-7cf8e1f0.js +0 -1
- package/dist/zonos-elements/p-8116d3ba.entry.js +0 -1
- package/dist/zonos-elements/p-b9a615bc.system.entry.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
var __awaiter=this&&this.__awaiter||function(e,r,t,o){function n(e){return e instanceof t?e:new t((function(r){r(e)}))}return new(t||(t=Promise))((function(t,i){function a(e){try{d(o.next(e))}catch(e){i(e)}}function s(e){try{d(o["throw"](e))}catch(e){i(e)}}function d(e){e.done?t(e.value):n(e.value).then(a,s)}d((o=o.apply(e,r||[])).next())}))};var __generator=this&&this.__generator||function(e,r){var t={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},o,n,i,a;return a={next:s(0),throw:s(1),return:s(2)},typeof Symbol==="function"&&(a[Symbol.iterator]=function(){return this}),a;function s(e){return function(r){return d([e,r])}}function d(s){if(o)throw new TypeError("Generator is already executing.");while(a&&(a=0,s[0]&&(t=0)),t)try{if(o=1,n&&(i=s[0]&2?n["return"]:s[0]?n["throw"]||((i=n["return"])&&i.call(n),0):n.next)&&!(i=i.call(n,s[1])).done)return i;if(n=0,i)s=[s[0]&2,i.value];switch(s[0]){case 0:case 1:i=s;break;case 4:t.label++;return{value:s[1],done:false};case 5:t.label++;n=s[1];s=[0];continue;case 7:s=t.ops.pop();t.trys.pop();continue;default:if(!(i=t.trys,i=i.length>0&&i[i.length-1])&&(s[0]===6||s[0]===2)){t=0;continue}if(s[0]===3&&(!i||s[1]>i[0]&&s[1]<i[3])){t.label=s[1];break}if(s[0]===6&&t.label<i[1]){t.label=i[1];i=s;break}if(i&&t.label<i[2]){t.label=i[2];t.ops.push(s);break}if(i[2])t.ops.pop();t.trys.pop();continue}s=r.call(e,t)}catch(e){s=[6,e];n=0}finally{o=i=0}if(s[0]&5)throw s[1];return{value:s[0]?s[1]:void 0,done:true}}};import{c as createStore,z as zonosStore}from"./zonosStore-8e19daff.js";import{b as stripeStore,K as stripeStoreBuildAddressForPartyCreate,d as cartStore,L as cartStoreUpdateSelectedShippingOption}from"./cart-
|
|
1
|
+
var __awaiter=this&&this.__awaiter||function(e,r,t,o){function n(e){return e instanceof t?e:new t((function(r){r(e)}))}return new(t||(t=Promise))((function(t,i){function a(e){try{d(o.next(e))}catch(e){i(e)}}function s(e){try{d(o["throw"](e))}catch(e){i(e)}}function d(e){e.done?t(e.value):n(e.value).then(a,s)}d((o=o.apply(e,r||[])).next())}))};var __generator=this&&this.__generator||function(e,r){var t={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},o,n,i,a;return a={next:s(0),throw:s(1),return:s(2)},typeof Symbol==="function"&&(a[Symbol.iterator]=function(){return this}),a;function s(e){return function(r){return d([e,r])}}function d(s){if(o)throw new TypeError("Generator is already executing.");while(a&&(a=0,s[0]&&(t=0)),t)try{if(o=1,n&&(i=s[0]&2?n["return"]:s[0]?n["throw"]||((i=n["return"])&&i.call(n),0):n.next)&&!(i=i.call(n,s[1])).done)return i;if(n=0,i)s=[s[0]&2,i.value];switch(s[0]){case 0:case 1:i=s;break;case 4:t.label++;return{value:s[1],done:false};case 5:t.label++;n=s[1];s=[0];continue;case 7:s=t.ops.pop();t.trys.pop();continue;default:if(!(i=t.trys,i=i.length>0&&i[i.length-1])&&(s[0]===6||s[0]===2)){t=0;continue}if(s[0]===3&&(!i||s[1]>i[0]&&s[1]<i[3])){t.label=s[1];break}if(s[0]===6&&t.label<i[1]){t.label=i[1];i=s;break}if(i&&t.label<i[2]){t.label=i[2];t.ops.push(s);break}if(i[2])t.ops.pop();t.trys.pop();continue}s=r.call(e,t)}catch(e){s=[6,e];n=0}finally{o=i=0}if(s[0]&5)throw s[1];return{value:s[0]?s[1]:void 0,done:true}}};import{c as createStore,z as zonosStore}from"./zonosStore-8e19daff.js";import{b as stripeStore,K as stripeStoreBuildAddressForPartyCreate,d as cartStore,L as cartStoreUpdateSelectedShippingOption}from"./cart-663ef7d5.js";import{s as storageStore}from"./localization-dc19e8bb.js";import{h as handleFetch,s as sendErrorLog,l as logError}from"./handleFetch-a844cac1.js";import{b as allLogs}from"./VarianceTest-572cecf5.js";var _e=createStore((function(){return{amountTotalDue:null,isFetchingPayorInfo:true,landedCostShortId:null,partyBillingId:null,payorAddress:null}})),invoiceStoreReset=_e.reset,invoiceStore=_e.state;var invoiceStoreInitShippingInfo=function(e){return __awaiter(void 0,[e],void 0,(function(e){var r,t,o,n,i;var a=e.landedCostId,s=e.retries,d=s===void 0?5:s;return __generator(this,(function(e){switch(e.label){case 0:invoiceStore.isFetchingPayorInfo=true;return[4,handleFetch("/api/zonos-elements/invoice/get-payor-info-by-lc-id",{body:{landedCostId:a},method:"POST"})];case 1:n=e.sent();if(!n.errors.length)return[3,4];if(!(d>0))return[3,3];return[4,new Promise((function(e){return setTimeout(e,1e3)}))];case 2:e.sent();return[2,invoiceStoreInitShippingInfo({landedCostId:a,retries:d-1})];case 3:return[2,null];case 4:invoiceStore.landedCostShortId=((r=n.json)===null||r===void 0?void 0:r.landedCostShortId)||null;invoiceStore.isFetchingPayorInfo=false;invoiceStore.payorAddress=((t=n.json)===null||t===void 0?void 0:t.payor)||null;i=(o=cartStore.checkoutSession)===null||o===void 0?void 0:o.subtotals;invoiceStore.amountTotalDue=(i===null||i===void 0?void 0:i.items)||0;if(invoiceStore.amountTotalDue===0){void sendErrorLog({endpoint:"INVOICE_NO_TOTAL_DUE",errors:[],metadata:{landedCostId:a,organizationId:zonosStore.organizationId}})}return[2]}}))}))};var invoiceStoreAsyncAddressUpdate=function(){return __awaiter(void 0,void 0,void 0,(function(){var e,r,t,o,n,i,a,s,d,c;return __generator(this,(function(l){switch(l.label){case 0:if(!((e=stripeStore.stripeBillingAddressEventData)===null||e===void 0?void 0:e.complete)){return[2,{partiesCreated:false}]}n=(t=(r=cartStore.checkoutSession)===null||r===void 0?void 0:r.landedCost)===null||t===void 0?void 0:t.rootId;if(!n){void sendErrorLog({endpoint:"PF_NO_SELECTED_LANDED_COST",errors:["No selected landed cost"],metadata:{allLogs:allLogs,cartId:window.Zonos.cartId,checkoutSessionId:storageStore.checkoutSessionId}});return[2,{partiesCreated:false}]}if(!storageStore.checkoutSessionId){void sendErrorLog({endpoint:"INVOICE_NO_CHECKOUT_SESSION_ID",errors:["No checkout session id"],metadata:{allLogs:allLogs,cartId:window.Zonos.cartId,landedCostRootId:n}});return[2,{partiesCreated:false}]}i=stripeStoreBuildAddressForPartyCreate({address:stripeStore.stripeBillingAddressEventData.value.address,firstName:stripeStore.stripeBillingAddressEventData.value.firstName,lastName:stripeStore.stripeBillingAddressEventData.value.lastName,name:stripeStore.stripeBillingAddressEventData.value.name,phone:stripeStore.stripeBillingAddressEventData.value.phone});a=new URLSearchParams(window.location.search).get("zonosE2ETest")==="1";return[4,handleFetch("/api/zonos-elements/create-billing-party",{body:{billingAddress:i,checkoutSessionId:storageStore.checkoutSessionId,companyName:stripeStore.companyName,email:((o=stripeStore.stripeLinkEventData)===null||o===void 0?void 0:o.value.email)||"",isTest:a,rootId:n},method:"POST"})];case 1:s=l.sent(),d=s.errors,c=s.json;if(d.length||!c){logError("Error occurs when creating billing party",JSON.stringify(d,null,2));void sendErrorLog({endpoint:"INVOICE_BILLING_PARTY_CREATE_FAILED",errors:["[INVOICE] Failed to create billing party"],metadata:{allLogs:allLogs,cartId:window.Zonos.cartId,checkoutSessionId:storageStore.checkoutSessionId,errors:d,json:c}});return[2,{partiesCreated:false}]}invoiceStore.partyBillingId=c.billToPartyId;return[2,{partiesCreated:true}]}}))}))};var invoiceStoreUpdateSelectedShippingOption=function(e){return __awaiter(void 0,void 0,void 0,(function(){var r;return __generator(this,(function(t){r=e.landedCost;if(!r){return[2,false]}cartStore.landedCostData=[Object.assign(Object.assign({},e),{landedCost:Object.assign({},r),landedCostId:r.id})];return[2,cartStoreUpdateSelectedShippingOption({applySubtotalsOnly:true,landedCostId:r.id,selectedShippingOption:r.shipmentRating})]}))}))};export{invoiceStoreInitShippingInfo as a,invoiceStoreAsyncAddressUpdate as b,invoiceStore as c,invoiceStoreUpdateSelectedShippingOption as i};
|
package/dist/esm-es5/{isCollectMobileTablet-11ade63f.js → isCollectMobileTablet-24c912b1.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
var __awaiter=this&&this.__awaiter||function(e,t,o,r){function n(e){return e instanceof o?e:new o((function(t){t(e)}))}return new(o||(o=Promise))((function(o,i){function l(e){try{c(r.next(e))}catch(e){i(e)}}function a(e){try{c(r["throw"](e))}catch(e){i(e)}}function c(e){e.done?o(e.value):n(e.value).then(l,a)}c((r=r.apply(e,t||[])).next())}))};var __generator=this&&this.__generator||function(e,t){var o={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},r,n,i,l;return l={next:a(0),throw:a(1),return:a(2)},typeof Symbol==="function"&&(l[Symbol.iterator]=function(){return this}),l;function a(e){return function(t){return c([e,t])}}function c(a){if(r)throw new TypeError("Generator is already executing.");while(l&&(l=0,a[0]&&(o=0)),o)try{if(r=1,n&&(i=a[0]&2?n["return"]:a[0]?n["throw"]||((i=n["return"])&&i.call(n),0):n.next)&&!(i=i.call(n,a[1])).done)return i;if(n=0,i)a=[a[0]&2,i.value];switch(a[0]){case 0:case 1:i=a;break;case 4:o.label++;return{value:a[1],done:false};case 5:o.label++;n=a[1];a=[0];continue;case 7:a=o.ops.pop();o.trys.pop();continue;default:if(!(i=o.trys,i=i.length>0&&i[i.length-1])&&(a[0]===6||a[0]===2)){o=0;continue}if(a[0]===3&&(!i||a[1]>i[0]&&a[1]<i[3])){o.label=a[1];break}if(a[0]===6&&o.label<i[1]){o.label=i[1];i=a;break}if(i&&o.label<i[2]){o.label=i[2];o.ops.push(a);break}if(i[2])o.ops.pop();o.trys.pop();continue}a=t.call(e,o)}catch(e){a=[6,e];n=0}finally{r=i=0}if(a[0]&5)throw a[1];return{value:a[0]?a[1]:void 0,done:true}}};import{c as createStore,z as zonosStore}from"./zonosStore-8e19daff.js";import{b as stripeStore,K as stripeStoreBuildAddressForPartyCreate,d as cartStore,L as cartStoreUpdateSelectedShippingOption}from"./cart-
|
|
1
|
+
var __awaiter=this&&this.__awaiter||function(e,t,o,r){function n(e){return e instanceof o?e:new o((function(t){t(e)}))}return new(o||(o=Promise))((function(o,i){function l(e){try{c(r.next(e))}catch(e){i(e)}}function a(e){try{c(r["throw"](e))}catch(e){i(e)}}function c(e){e.done?o(e.value):n(e.value).then(l,a)}c((r=r.apply(e,t||[])).next())}))};var __generator=this&&this.__generator||function(e,t){var o={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},r,n,i,l;return l={next:a(0),throw:a(1),return:a(2)},typeof Symbol==="function"&&(l[Symbol.iterator]=function(){return this}),l;function a(e){return function(t){return c([e,t])}}function c(a){if(r)throw new TypeError("Generator is already executing.");while(l&&(l=0,a[0]&&(o=0)),o)try{if(r=1,n&&(i=a[0]&2?n["return"]:a[0]?n["throw"]||((i=n["return"])&&i.call(n),0):n.next)&&!(i=i.call(n,a[1])).done)return i;if(n=0,i)a=[a[0]&2,i.value];switch(a[0]){case 0:case 1:i=a;break;case 4:o.label++;return{value:a[1],done:false};case 5:o.label++;n=a[1];a=[0];continue;case 7:a=o.ops.pop();o.trys.pop();continue;default:if(!(i=o.trys,i=i.length>0&&i[i.length-1])&&(a[0]===6||a[0]===2)){o=0;continue}if(a[0]===3&&(!i||a[1]>i[0]&&a[1]<i[3])){o.label=a[1];break}if(a[0]===6&&o.label<i[1]){o.label=i[1];i=a;break}if(i&&o.label<i[2]){o.label=i[2];o.ops.push(a);break}if(i[2])o.ops.pop();o.trys.pop();continue}a=t.call(e,o)}catch(e){a=[6,e];n=0}finally{r=i=0}if(a[0]&5)throw a[1];return{value:a[0]?a[1]:void 0,done:true}}};import{c as createStore,z as zonosStore}from"./zonosStore-8e19daff.js";import{b as stripeStore,K as stripeStoreBuildAddressForPartyCreate,d as cartStore,L as cartStoreUpdateSelectedShippingOption}from"./cart-663ef7d5.js";import{s as storageStore}from"./localization-dc19e8bb.js";import{h as handleFetch,s as sendErrorLog,l as logError}from"./handleFetch-a844cac1.js";import{b as allLogs}from"./VarianceTest-572cecf5.js";var _k=createStore((function(){return{amountDutyTaxFeeTotal:null,amountTotalPaid:null,isFetchingShippingInfo:true,landedCostShortId:null,originCompanyName:null,partyBillingId:null,shippingAddress:null}})),collectStoreReset=_k.reset,collectStore=_k.state;var collectStoreInitShippingInfo=function(e){return __awaiter(void 0,[e],void 0,(function(e){var t,o,r,n,i,l,a,c,s,d,u,p,S;var f=e.landedCostId,v=e.retries,h=v===void 0?5:v;return __generator(this,(function(e){switch(e.label){case 0:collectStore.isFetchingShippingInfo=true;return[4,handleFetch("/api/zonos-elements/collect/get-shipping-info-by-lc-id",{body:{landedCostId:f},method:"POST"})];case 1:d=e.sent();if(!d.errors.length)return[3,4];if(!(h>0))return[3,3];return[4,new Promise((function(e){return setTimeout(e,1e3)}))];case 2:e.sent();return[2,collectStoreInitShippingInfo({landedCostId:f,retries:h-1})];case 3:return[2,null];case 4:collectStore.landedCostShortId=((t=d.json)===null||t===void 0?void 0:t.landedCostShortId)||null;collectStore.isFetchingShippingInfo=false;collectStore.shippingAddress=((o=d.json)===null||o===void 0?void 0:o.shipping)||null;u=(r=cartStore.checkoutSession)===null||r===void 0?void 0:r.landedCost;p=(n=cartStore.checkoutSession)===null||n===void 0?void 0:n.subtotals;S=(((i=u===null||u===void 0?void 0:u.amountSubtotals)===null||i===void 0?void 0:i.shipping)||0)+(((l=u===null||u===void 0?void 0:u.amountSubtotals)===null||l===void 0?void 0:l.items)||0);collectStore.amountTotalPaid=S*(((a=p===null||p===void 0?void 0:p.exchangeRate)===null||a===void 0?void 0:a.rate)||1);collectStore.amountDutyTaxFeeTotal=((p===null||p===void 0?void 0:p.duties)||0)+((p===null||p===void 0?void 0:p.taxes)||0)+((p===null||p===void 0?void 0:p.fees)||0);collectStore.originCompanyName=((s=(c=d.json)===null||c===void 0?void 0:c.origin)===null||s===void 0?void 0:s.companyName)||null;if(collectStore.amountTotalPaid===0){void sendErrorLog({endpoint:"COLLECT_NO_TOTAL_PAID",errors:[],metadata:{landedCostId:f,organizationId:zonosStore.organizationId}})}return[2]}}))}))};var collectStoreAsyncAddressUpdate=function(){return __awaiter(void 0,void 0,void 0,(function(){var e,t,o,r,n,i,l,a,c,s;return __generator(this,(function(d){switch(d.label){case 0:if(!((e=stripeStore.stripeBillingAddressEventData)===null||e===void 0?void 0:e.complete)){return[2,{partiesCreated:false}]}n=(o=(t=cartStore.checkoutSession)===null||t===void 0?void 0:t.landedCost)===null||o===void 0?void 0:o.rootId;if(!n){void sendErrorLog({endpoint:"PF_NO_SELECTED_LANDED_COST",errors:["No selected landed cost"],metadata:{allLogs:allLogs,cartId:window.Zonos.cartId,checkoutSessionId:storageStore.checkoutSessionId}});return[2,{partiesCreated:false}]}if(!storageStore.checkoutSessionId){void sendErrorLog({endpoint:"COLLECT_NO_CHECKOUT_SESSION_ID",errors:["No checkout session id"],metadata:{allLogs:allLogs,cartId:window.Zonos.cartId,landedCostRootId:n}});return[2,{partiesCreated:false}]}i=stripeStoreBuildAddressForPartyCreate({address:stripeStore.stripeBillingAddressEventData.value.address,firstName:stripeStore.stripeBillingAddressEventData.value.firstName,lastName:stripeStore.stripeBillingAddressEventData.value.lastName,name:stripeStore.stripeBillingAddressEventData.value.name,phone:stripeStore.stripeBillingAddressEventData.value.phone});l=new URLSearchParams(window.location.search).get("zonosE2ETest")==="1";return[4,handleFetch("/api/zonos-elements/create-billing-party",{body:{billingAddress:i,checkoutSessionId:storageStore.checkoutSessionId,companyName:stripeStore.companyName,email:((r=stripeStore.stripeLinkEventData)===null||r===void 0?void 0:r.value.email)||"",isTest:l,rootId:n},method:"POST"})];case 1:a=d.sent(),c=a.errors,s=a.json;if(c.length||!s){logError("Error occurs when creating billing party",JSON.stringify(c,null,2));void sendErrorLog({endpoint:"COLLECT_BILLING_PARTY_CREATE_FAILED",errors:["[COLLECT] Failed to create billing party"],metadata:{allLogs:allLogs,cartId:window.Zonos.cartId,checkoutSessionId:storageStore.checkoutSessionId,errors:c,json:s}});return[2,{partiesCreated:false}]}collectStore.partyBillingId=s.billToPartyId;return[2,{partiesCreated:true}]}}))}))};var collectStoreUpdateSelectedShippingOption=function(e){return __awaiter(void 0,void 0,void 0,(function(){var t;return __generator(this,(function(o){t=e.landedCost;if(!t){return[2,false]}cartStore.landedCostData=[Object.assign(Object.assign({},e),{landedCost:Object.assign({},t),landedCostId:t.id})];return[2,cartStoreUpdateSelectedShippingOption({applySubtotalsOnly:true,landedCostId:t.id,selectedShippingOption:t.shipmentRating})]}))}))};var collectTabletBreakpoint=1024;var collectMobileBreakpoint=768;var isCollectTablet=function(e){return e||window.innerWidth<collectTabletBreakpoint&&window.innerWidth>=collectMobileBreakpoint};var isCollectMobile=function(e){return e||window.innerWidth<collectMobileBreakpoint};export{isCollectTablet as a,collectStoreInitShippingInfo as b,collectStoreUpdateSelectedShippingOption as c,collectStoreAsyncAddressUpdate as d,collectStore as e,isCollectMobile as i};
|