@dropins/storefront-checkout 0.1.0-alpha45 → 0.1.0-alpha46

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{jsx as e,jsxs as E,Fragment as L}from"@dropins/tools/preact-jsx-runtime.js";import"../chunks/ShippingMethods.js";import{events as S}from"@dropins/tools/event-bus.js";import{useState as M,useEffect as k}from"@dropins/tools/preact-hooks.js";import{m as w,T as I}from"../chunks/getCart.graphql.js";import{VComponent as A,classes as C}from"@dropins/tools/lib.js";import{Skeleton as B,SkeletonRow as G,Price as l}from"@dropins/tools/components.js";import"../chunks/BillToShippingAddress.js";import{useText as P,Text as c}from"@dropins/tools/i18n.js";import"../chunks/setShippingMethods.js";import"../chunks/setBillingAddress.js";import"@dropins/tools/preact-compat.js";import"../chunks/ErrorBanner.js";import"../chunks/MergedCartBanner.js";import"@dropins/tools/signals.js";import"@dropins/tools/fetch-graphql.js";const U=()=>e(B,{"data-testid":"estimate-shipping-skeleton",children:e(G,{size:"xsmall"})}),tt=()=>{const[t,p]=M(),r=t!==void 0,s=(t==null?void 0:t.amount.value)===0,{data:n,pending:_}=w.value,y=_||n===void 0,d=n==null?void 0:n.shoppingCartDisplaySetting.shipping,D=d===I.INCLUDING_EXCLUDING_TAX,g=d===I.INCLUDING_TAX,x=P({freeShipping:"Checkout.EstimateShipping.freeShipping",taxToBeDetermined:"Checkout.EstimateShipping.taxToBeDetermined"});k(()=>{const i=S.on("shipping/estimate",a=>{const o=a.shippingMethod,{amount:m,amountExclTax:u,amountInclTax:h}=o;p({estimated:!0,amount:m,amountExclTax:u,amountInclTax:h})});return()=>{i==null||i.off()}},[]),k(()=>{const i=S.on("checkout/data",a=>{var f,T;const o=(T=(f=a==null?void 0:a.shippingAddresses)==null?void 0:f[0])==null?void 0:T.selectedShippingMethod;if(!o)return;const{amount:m,amountExclTax:u,amountInclTax:h}=o;p({estimated:!1,amount:m,amountExclTax:u,amountInclTax:h})});return()=>{i==null||i.off()}},[]);const N=()=>s?e("span",{"data-testId":"free-shipping",children:x.freeShipping}):g&&(t!=null&&t.amountInclTax)?e(l,{"data-testid":"shipping",amount:t.amountInclTax.value,currency:t.amountInclTax.currency}):e(l,{"data-testid":"shipping",amount:t==null?void 0:t.amount.value,currency:t==null?void 0:t.amount.currency}),v=()=>t!=null&&t.amountExclTax?e(l,{"data-testid":"shipping-excluding-tax",amount:t.amountExclTax.value,currency:t.amountExclTax.currency}):e("span",{children:x.taxToBeDetermined});return e("div",{"data-testid":"estimate-shipping",className:"checkout-estimate-shipping",children:!r||y?e(U,{}):e(X,{estimated:t.estimated,price:N(),taxExcluded:D&&!s,taxIncluded:g&&!s,priceExclTax:v()})})},X=({estimated:t=!1,price:p,priceExclTax:r,taxExcluded:s=!1,taxIncluded:n=!1})=>E(L,{children:[e("span",{className:"checkout-estimate-shipping__label",children:t?e(c,{id:"Checkout.EstimateShipping.estimated"}):e(c,{id:"Checkout.EstimateShipping.label"})}),e(A,{node:p,className:"checkout-estimate-shipping__price"}),n&&e("span",{"data-testid":"shipping-tax-included",className:C(["checkout-estimate-shipping__caption"]),children:e(c,{id:"Checkout.EstimateShipping.withTaxes"})}),s&&E("span",{"data-testid":"shipping-tax-included-excluded",className:C(["checkout-estimate-shipping__caption"]),children:[r," ",e(c,{id:"Checkout.EstimateShipping.withoutTaxes"})]})]});export{tt as EstimateShipping,tt as default};
1
+ import{jsx as t,jsxs as E,Fragment as L}from"@dropins/tools/preact-jsx-runtime.js";import"../chunks/ShippingMethods.js";import{events as S}from"@dropins/tools/event-bus.js";import{useState as M,useEffect as k}from"@dropins/tools/preact-hooks.js";import{m as w,T as I}from"../chunks/getCart.graphql.js";import{VComponent as A,classes as C}from"@dropins/tools/lib.js";import{Skeleton as B,SkeletonRow as G,Price as l}from"@dropins/tools/components.js";import"../chunks/BillToShippingAddress.js";import{useText as P,Text as c}from"@dropins/tools/i18n.js";import"../chunks/setShippingMethods.js";import"../chunks/setBillingAddress.js";import"@dropins/tools/preact-compat.js";import"../chunks/ErrorBanner.js";import"../chunks/MergedCartBanner.js";import"@dropins/tools/signals.js";import"@dropins/tools/fetch-graphql.js";const U=()=>t(B,{"data-testid":"estimate-shipping-skeleton",children:t(G,{size:"xsmall"})}),ee=()=>{const[e,p]=M(),r=e!==void 0,s=(e==null?void 0:e.amount.value)===0,{data:n,pending:_}=w.value,y=_||n===void 0,d=n==null?void 0:n.shoppingCartDisplaySetting.shipping,D=d===I.INCLUDING_EXCLUDING_TAX,g=d===I.INCLUDING_TAX,x=P({freeShipping:"Checkout.EstimateShipping.freeShipping",taxToBeDetermined:"Checkout.EstimateShipping.taxToBeDetermined"});k(()=>{const i=S.on("shipping/estimate",a=>{const o=a.shippingMethod,{amount:m,amountExclTax:u,amountInclTax:h}=o;p({estimated:!0,amount:m,amountExclTax:u,amountInclTax:h})},{eager:!0});return()=>{i==null||i.off()}},[]),k(()=>{const i=S.on("checkout/data",a=>{var f,T;const o=(T=(f=a==null?void 0:a.shippingAddresses)==null?void 0:f[0])==null?void 0:T.selectedShippingMethod;if(!o)return;const{amount:m,amountExclTax:u,amountInclTax:h}=o;p({estimated:!1,amount:m,amountExclTax:u,amountInclTax:h})},{eager:!0});return()=>{i==null||i.off()}},[]);const N=()=>s?t("span",{"data-testId":"free-shipping",children:x.freeShipping}):g&&(e!=null&&e.amountInclTax)?t(l,{"data-testid":"shipping",amount:e.amountInclTax.value,currency:e.amountInclTax.currency}):t(l,{"data-testid":"shipping",amount:e==null?void 0:e.amount.value,currency:e==null?void 0:e.amount.currency}),v=()=>e!=null&&e.amountExclTax?t(l,{"data-testid":"shipping-excluding-tax",amount:e.amountExclTax.value,currency:e.amountExclTax.currency}):t("span",{children:x.taxToBeDetermined});return t("div",{"data-testid":"estimate-shipping",className:"checkout-estimate-shipping",children:!r||y?t(U,{}):t(X,{estimated:e.estimated,price:N(),taxExcluded:D&&!s,taxIncluded:g&&!s,priceExclTax:v()})})},X=({estimated:e=!1,price:p,priceExclTax:r,taxExcluded:s=!1,taxIncluded:n=!1})=>E(L,{children:[t("span",{className:"checkout-estimate-shipping__label",children:e?t(c,{id:"Checkout.EstimateShipping.estimated"}):t(c,{id:"Checkout.EstimateShipping.label"})}),t(A,{node:p,className:"checkout-estimate-shipping__price"}),n&&t("span",{"data-testid":"shipping-tax-included",className:C(["checkout-estimate-shipping__caption"]),children:t(c,{id:"Checkout.EstimateShipping.withTaxes"})}),s&&E("span",{"data-testid":"shipping-tax-included-excluded",className:C(["checkout-estimate-shipping__caption"]),children:[r," ",t(c,{id:"Checkout.EstimateShipping.withoutTaxes"})]})]});export{ee as EstimateShipping,ee as default};
package/package.json CHANGED
@@ -1 +1 @@
1
- {"name": "@dropins/storefront-checkout", "version": "0.1.0-alpha45", "@dropins/tools": "~0.28.2"}
1
+ {"name": "@dropins/storefront-checkout", "version": "0.1.0-alpha46", "@dropins/tools": "~0.28.2"}