@dropins/storefront-checkout 2.0.1 → 2.1.0-beta2
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/api/fragments.d.ts +4 -1
- package/{lib/network-error.d.ts → api/getNegotiableQuote/getNegotiableQuote.d.ts} +7 -7
- package/{signals/ServerErrorSignal.d.ts → api/getNegotiableQuote/graphql/getNegotiableQuote.graphql.d.ts} +3 -3
- package/{errors → api/getNegotiableQuote/graphql}/index.d.ts +2 -2
- package/{signals → api/getNegotiableQuote}/index.d.ts +2 -2
- package/api/graphql/CartAddressFragment.graphql.d.ts +1 -1
- package/api/graphql/NegotiableQuoteAddressFragment.graphql.d.ts +19 -0
- package/api/graphql/NegotiableQuoteFragment.graphql.d.ts +18 -0
- package/api/graphql/{CartPaymentMethodFragment.graphql.d.ts → PaymentMethodFragment.graphql.d.ts} +1 -1
- package/api/graphql/ShippingMethodFragment.graphql.d.ts +19 -0
- package/api/index.d.ts +5 -1
- package/api/setNegotiableQuoteBillingAddress/graphql/index.d.ts +18 -0
- package/api/setNegotiableQuoteBillingAddress/graphql/setNegotiableQuoteBillingAddress.graphql.d.ts +18 -0
- package/api/setNegotiableQuoteBillingAddress/index.d.ts +18 -0
- package/api/setNegotiableQuoteBillingAddress/setNegotiableQuoteBillingAddress.d.ts +6 -0
- package/api/setNegotiableQuotePaymentMethod/graphql/index.d.ts +18 -0
- package/api/setNegotiableQuotePaymentMethod/graphql/setNegotiableQuotePaymentMethod.graphql.d.ts +18 -0
- package/api/setNegotiableQuotePaymentMethod/index.d.ts +18 -0
- package/api/setNegotiableQuotePaymentMethod/setNegotiableQuotePaymentMethod.d.ts +6 -0
- package/api/setNegotiableQuoteShippingAddress/graphql/index.d.ts +18 -0
- package/api/setNegotiableQuoteShippingAddress/graphql/setNegotiableQuoteShippingAddress.graphql.d.ts +18 -0
- package/api/setNegotiableQuoteShippingAddress/index.d.ts +18 -0
- package/api/setNegotiableQuoteShippingAddress/setNegotiableQuoteShippingAddress.d.ts +6 -0
- package/api/setNegotiableQuoteShippingMethods/graphql/index.d.ts +18 -0
- package/api/setNegotiableQuoteShippingMethods/graphql/setNegotiableQuoteShippingMethods.graphql.d.ts +18 -0
- package/api/setNegotiableQuoteShippingMethods/index.d.ts +18 -0
- package/api/setNegotiableQuoteShippingMethods/setNegotiableQuoteShippingMethods.d.ts +18 -0
- package/api.js +78 -7
- package/api.js.map +1 -1
- package/chunks/checkout.js.map +1 -1
- package/chunks/fetch-graphql.js +14 -0
- package/chunks/fetch-graphql.js.map +1 -0
- package/chunks/setBillingAddress.js +2 -2
- package/chunks/setBillingAddress.js.map +1 -1
- package/chunks/setGuestEmailOnCart.js +4 -4
- package/chunks/setGuestEmailOnCart.js.map +1 -1
- package/chunks/setPaymentMethod.js +2 -2
- package/chunks/setPaymentMethod.js.map +1 -1
- package/chunks/setShippingMethods.js +3 -3
- package/chunks/setShippingMethods.js.map +1 -1
- package/chunks/synchronizeCheckout.js +3 -3
- package/chunks/synchronizeCheckout.js.map +1 -1
- package/containers/BillToShippingAddress.js +1 -1
- package/containers/BillToShippingAddress.js.map +1 -1
- package/containers/EstimateShipping.js +1 -1
- package/containers/EstimateShipping.js.map +1 -1
- package/containers/LoginForm.js +1 -1
- package/containers/LoginForm.js.map +1 -1
- package/containers/OutOfStock.js +1 -1
- package/containers/OutOfStock.js.map +1 -1
- package/containers/PaymentMethods.js +1 -1
- package/containers/PaymentMethods.js.map +1 -1
- package/containers/PlaceOrder.js +1 -1
- package/containers/PlaceOrder.js.map +1 -1
- package/containers/ServerError.js +1 -1
- package/containers/ServerError.js.map +1 -1
- package/containers/ShippingMethods.js +1 -1
- package/containers/ShippingMethods.js.map +1 -1
- package/containers/TermsAndConditions.js +1 -1
- package/containers/TermsAndConditions.js.map +1 -1
- package/data/models/address.d.ts +5 -8
- package/data/models/api.d.ts +3 -3
- package/data/models/cart.d.ts +14 -7
- package/data/models/checkout.d.ts +14 -0
- package/data/models/country.d.ts +1 -1
- package/data/models/index.d.ts +2 -1
- package/data/models/{price.d.ts → money.d.ts} +2 -2
- package/data/models/quote.d.ts +15 -0
- package/data/models/shipping-estimate.d.ts +4 -4
- package/data/models/shipping-method.d.ts +4 -4
- package/data/transforms/index.d.ts +6 -1
- package/data/transforms/{transform-address.d.ts → transform-cart-address.d.ts} +12 -13
- package/data/transforms/transform-cart.d.ts +1 -1
- package/data/transforms/transform-country.d.ts +8 -0
- package/data/transforms/transform-negotiable-quote.d.ts +7 -0
- package/data/transforms/transform-payment-methods.d.ts +1 -1
- package/data/transforms/transform-quote-address.d.ts +75 -0
- package/data/transforms/transform-region.d.ts +8 -0
- package/fragments.js +126 -43
- package/fragments.js.map +1 -1
- package/lib/enqueueRequest.d.ts +1 -0
- package/lib/errors/classifiers.d.ts +36 -0
- package/lib/errors/customErrors.d.ts +39 -0
- package/lib/errors/index.d.ts +20 -0
- package/lib/errors/mapErrorToCode.d.ts +4 -0
- package/lib/index.d.ts +1 -1
- package/lib/state.d.ts +1 -0
- package/package.json +1 -1
- package/render.js +1 -1
- package/render.js.map +1 -1
- package/tests/constants.d.ts +1 -0
- package/tests/fixtures/fragments/cart.d.ts +1 -2
- package/chunks/ServerErrorSignal.js +0 -4
- package/chunks/ServerErrorSignal.js.map +0 -1
- package/chunks/errors.js +0 -14
- package/chunks/errors.js.map +0 -1
- package/errors/errors.d.ts +0 -30
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/*! Copyright 2025 Adobe
|
|
2
2
|
All Rights Reserved. */
|
|
3
|
-
import{jsx as e,jsxs as M}from"@dropins/tools/preact-jsx-runtime.js";/* empty css */import{Skeleton as v,SkeletonRow as S,Checkbox as b}from"@dropins/tools/components.js";import{p as N}from"../chunks/TermsAndConditions.js";import{classes as f,VComponent as U,Slot as w}from"@dropins/tools/lib.js";/* empty css */import{s as E}from"../chunks/
|
|
3
|
+
import{jsx as e,jsxs as M}from"@dropins/tools/preact-jsx-runtime.js";/* empty css */import{Skeleton as v,SkeletonRow as S,Checkbox as b}from"@dropins/tools/components.js";import{p as N}from"../chunks/TermsAndConditions.js";import{classes as f,VComponent as U,Slot as w}from"@dropins/tools/lib.js";/* empty css */import{s as E}from"../chunks/fetch-graphql.js";import{A as V}from"../chunks/checkout.js";import{events as W}from"@dropins/tools/event-bus.js";import{W as j,g as y}from"../chunks/ConditionalWrapper.js";import"@dropins/tools/preact-compat.js";/* empty css *//* empty css */import{useState as g,useEffect as D}from"@dropins/tools/preact-hooks.js";import{useText as H,MarkupText as L}from"@dropins/tools/i18n.js";import"@dropins/tools/signals.js";import"@dropins/tools/fetch-graphql.js";const P=({html:n})=>{const t=N.sanitize(n,{ADD_ATTR:["target"]});return t===""?null:e("span",{dangerouslySetInnerHTML:{__html:t}})},R=()=>e(v,{className:"checkout-terms-and-conditions-skeleton","data-testid":"checkout-terms-and-conditions-skeleton",children:e(S,{fullWidth:!0,size:"small",variant:"row"})}),$=({className:n,agreements:t,error:r,...s})=>e("div",{className:"checkout-terms-and-conditions","data-testid":"checkout-terms-and-conditions",children:M("form",{...s,noValidate:!0,className:f(["checkout-terms-and-conditions__form",n]),"data-testid":"checkout-terms-and-conditions-form",name:"checkout-terms-and-conditions__form",children:[t&&e(U,{className:f(["checkout-terms-and-conditions__agreements"]),"data-testid":"checkout-terms-and-conditions-agreements",node:t}),r&&e("div",{className:"checkout-terms-and-conditions__error","data-testid":"checkout-terms-and-conditions-error",children:r})]})}),q=j($,R),ae=({active:n=!0,slots:t,...r})=>{var c;const[s,d]=g(!1),[k,m]=g(""),{errorMessage:_}=H({errorMessage:"Checkout.TermsAndConditions.error"}),i=((c=E.config)==null?void 0:c.agreementsEnabled)===!1,A=()=>{m("")},C=()=>{m(_)};return D(()=>{if(!n||i)return;if(y()){d(!0);return}const o=W.on("checkout/initialized",()=>{d(!0)},{eager:!0});return()=>{o==null||o.off()}},[n,i]),e(q,{...r,agreements:e(w,{context:{appendAgreement(l){this._registerMethod((...o)=>{const u=l(...o);if(!u)return;const{mode:T,name:p,text:a,translationId:h}=u;if(!a&&!h){console.warn(`The agreement ${p} is misconfigured. Please provide a text or a translationId.`);return}const x=a?e(P,{html:a}):e(L,{id:h}),z=e(b,{checked:T===V.AUTO,label:x,name:p,required:!0,onChange:A,onInvalid:C});this._setProps(I=>({children:[...I.children||[],z]}))})}},name:"Agreements",slot:t==null?void 0:t.Agreements}),error:k,initialized:s,visible:n&&!i})};export{ae as TermsAndConditions,ae as default};
|
|
4
4
|
//# sourceMappingURL=TermsAndConditions.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TermsAndConditions.js","sources":["/@dropins/storefront-checkout/src/components/Markup/Markup.tsx","/@dropins/storefront-checkout/src/components/TermsAndConditions/TermsAndConditionsSkeleton.tsx","/@dropins/storefront-checkout/src/components/TermsAndConditions/TermsAndConditions.tsx","/@dropins/storefront-checkout/src/containers/TermsAndConditions/TermsAndConditions.tsx"],"sourcesContent":["/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport DOMPurify from 'dompurify';\nimport { FunctionComponent } from 'preact';\n\ninterface MarkupProps {\n html: string;\n}\n\nexport const Markup: FunctionComponent<MarkupProps> = ({ html }) => {\n const sanitizedHtml = DOMPurify.sanitize(html, { ADD_ATTR: ['target'] });\n if (sanitizedHtml === '') return null;\n // eslint-disable-next-line react/no-danger\n return <span dangerouslySetInnerHTML={{ __html: sanitizedHtml }} />;\n};\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { Skeleton, SkeletonRow } from '@adobe-commerce/elsie/components';\nimport { FunctionComponent } from 'preact';\n\nexport const TermsAndConditionsSkeleton: FunctionComponent = () => {\n return (\n <Skeleton\n className=\"checkout-terms-and-conditions-skeleton\"\n data-testid=\"checkout-terms-and-conditions-skeleton\"\n >\n <SkeletonRow fullWidth={true} size=\"small\" variant=\"row\" />\n </Skeleton>\n );\n};\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { WithConditionals } from '@/checkout/components';\nimport '@/checkout/components/TermsAndConditions/TermsAndConditions.css';\nimport { TermsAndConditionsSkeleton } from '@/checkout/components/TermsAndConditions/TermsAndConditionsSkeleton';\nimport { classes, VComponent } from '@adobe-commerce/elsie/lib';\nimport { FunctionComponent, VNode } from 'preact';\nimport { HTMLAttributes } from 'preact/compat';\n\nexport interface TermsAndConditionsProps\n extends HTMLAttributes<HTMLFormElement> {\n agreements?: VNode;\n error?: string;\n}\n\nconst TermsAndConditionsComponent: FunctionComponent<\n TermsAndConditionsProps\n> = ({ className, agreements, error, ...props }) => {\n return (\n <div\n className=\"checkout-terms-and-conditions\"\n data-testid=\"checkout-terms-and-conditions\"\n >\n <form\n {...props}\n noValidate\n className={classes(['checkout-terms-and-conditions__form', className])}\n data-testid=\"checkout-terms-and-conditions-form\"\n name=\"checkout-terms-and-conditions__form\"\n >\n {agreements && (\n <VComponent\n className={classes(['checkout-terms-and-conditions__agreements'])}\n data-testid=\"checkout-terms-and-conditions-agreements\"\n node={agreements}\n />\n )}\n\n {error && (\n <div\n className=\"checkout-terms-and-conditions__error\"\n data-testid=\"checkout-terms-and-conditions-error\"\n >\n {error}\n </div>\n )}\n </form>\n </div>\n );\n};\n\nexport const TermsAndConditions = WithConditionals(\n TermsAndConditionsComponent,\n TermsAndConditionsSkeleton\n);\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { Markup } from '@/checkout/components';\nimport { TermsAndConditions as TermsAndConditionsComponent } from '@/checkout/components/TermsAndConditions';\nimport { AgreementMode } from '@/checkout/data/models';\nimport { getLatestCheckoutUpdate, state } from '@/checkout/lib';\nimport { Checkbox } from '@adobe-commerce/elsie/components';\nimport { MarkupText, useText } from '@adobe-commerce/elsie/i18n';\nimport {\n Container,\n Slot,\n SlotMethod,\n SlotProps,\n} from '@adobe-commerce/elsie/lib';\nimport { events } from '@adobe-commerce/event-bus';\nimport { useEffect, useState } from 'preact/hooks';\n\nexport interface TermsAndConditionsProps {\n active?: boolean;\n slots?: {\n Agreements?: SlotProps<{\n appendAgreement: SlotMethod<{\n name: string;\n mode: AgreementMode;\n translationId?: string;\n text?: string;\n }>;\n }>;\n };\n}\n\nexport const TermsAndConditions: Container<TermsAndConditionsProps> = ({\n active = true,\n slots,\n ...props\n}) => {\n const [isInitialized, setIsInitialized] = useState(false);\n const [error, setError] = useState<string>('');\n\n const { errorMessage } = useText({\n errorMessage: 'Checkout.TermsAndConditions.error',\n });\n\n const disabledViaConfig = state.config?.agreementsEnabled === false;\n\n const handleChange = () => {\n setError('');\n };\n\n const handleInvalid = () => {\n setError(errorMessage);\n };\n\n useEffect(() => {\n if (!active || disabledViaConfig) return;\n\n const pastUpdate = getLatestCheckoutUpdate();\n\n if (pastUpdate) {\n setIsInitialized(true);\n return;\n }\n\n const onCheckoutInit = events.on(\n 'checkout/initialized',\n () => {\n setIsInitialized(true);\n },\n { eager: true }\n );\n return () => {\n onCheckoutInit?.off();\n };\n }, [active, disabledViaConfig]);\n\n return (\n <TermsAndConditionsComponent\n {...props}\n agreements={\n <Slot\n context={{\n appendAgreement(callback) {\n this._registerMethod((...attrs) => {\n const _agreement = callback(...attrs);\n\n if (!_agreement) return;\n\n const { mode, name, text, translationId } = _agreement;\n\n if (!text && !translationId) {\n console.warn(\n `The agreement ${name} is misconfigured. Please provide a text or a translationId.`\n );\n return;\n }\n\n const label = text ? (\n <Markup html={text} />\n ) : (\n <MarkupText id={translationId!} />\n );\n\n const agreement = (\n <Checkbox\n checked={mode === AgreementMode.AUTO}\n label={label}\n name={name}\n required={true}\n onChange={handleChange}\n onInvalid={handleInvalid}\n />\n );\n\n this._setProps((prev: any) => ({\n children: [...(prev.children || []), agreement],\n }));\n });\n },\n }}\n name=\"Agreements\"\n slot={slots?.Agreements}\n />\n }\n error={error}\n initialized={isInitialized}\n visible={active && !disabledViaConfig}\n />\n );\n};\n"],"names":["Markup","html","sanitizedHtml","DOMPurify","TermsAndConditionsSkeleton","jsx","Skeleton","SkeletonRow","TermsAndConditionsComponent","className","agreements","error","props","jsxs","classes","VComponent","TermsAndConditions","WithConditionals","active","slots","isInitialized","setIsInitialized","useState","setError","errorMessage","useText","disabledViaConfig","_a","state","handleChange","handleInvalid","useEffect","getLatestCheckoutUpdate","onCheckoutInit","events","Slot","callback","attrs","_agreement","mode","name","text","translationId","label","MarkupText","agreement","Checkbox","AgreementMode","prev"],"mappings":"42BAwBO,MAAMA,EAAyC,CAAC,CAAE,KAAAC,KAAW,CAC5D,MAAAC,EAAgBC,EAAU,SAASF,EAAM,CAAE,SAAU,CAAC,QAAQ,EAAG,EACnE,OAAAC,IAAkB,GAAW,OAEzB,OAAK,CAAA,wBAAyB,CAAE,OAAQA,GAAiB,CACnE,ECTaE,EAAgD,IAEzDC,EAACC,EAAA,CACC,UAAU,yCACV,cAAY,yCAEZ,WAACC,EAAY,CAAA,UAAW,GAAM,KAAK,QAAQ,QAAQ,KAAM,CAAA,CAAA,CAC3D,ECGEC,EAEF,CAAC,CAAE,UAAAC,EAAW,WAAAC,EAAY,MAAAC,EAAO,GAAGC,KAEpCP,EAAC,MAAA,CACC,UAAU,gCACV,cAAY,gCAEZ,SAAAQ,EAAC,OAAA,CACE,GAAGD,EACJ,WAAU,GACV,UAAWE,EAAQ,CAAC,sCAAuCL,CAAS,CAAC,EACrE,cAAY,qCACZ,KAAK,sCAEJ,SAAA,CACCC,GAAAL,EAACU,EAAA,CACC,UAAWD,EAAQ,CAAC,2CAA2C,CAAC,EAChE,cAAY,2CACZ,KAAMJ,CAAA,CACR,EAGDC,GACCN,EAAC,MAAA,CACC,UAAU,uCACV,cAAY,sCAEX,SAAAM,CAAA,CAAA,CACH,CAAA,CAAA,CAEJ,CACF,EAISK,EAAqBC,EAChCT,EACAJ,CACF,ECvBaY,GAAyD,CAAC,CACrE,OAAAE,EAAS,GACT,MAAAC,EACA,GAAGP,CACL,IAAM,OACJ,KAAM,CAACQ,EAAeC,CAAgB,EAAIC,EAAS,EAAK,EAClD,CAACX,EAAOY,CAAQ,EAAID,EAAiB,EAAE,EAEvC,CAAE,aAAAE,CAAa,EAAIC,EAAQ,CAC/B,aAAc,mCAAA,CACf,EAEKC,IAAoBC,EAAAC,EAAM,SAAN,YAAAD,EAAc,qBAAsB,GAExDE,EAAe,IAAM,CACzBN,EAAS,EAAE,CACb,EAEMO,EAAgB,IAAM,CAC1BP,EAASC,CAAY,CACvB,EAEA,OAAAO,EAAU,IAAM,CACV,GAAA,CAACb,GAAUQ,EAAmB,OAIlC,GAFmBM,EAAwB,EAE3B,CACdX,EAAiB,EAAI,EACrB,MAAA,CAGF,MAAMY,EAAiBC,EAAO,GAC5B,uBACA,IAAM,CACJb,EAAiB,EAAI,CACvB,EACA,CAAE,MAAO,EAAK,CAChB,EACA,MAAO,IAAM,CACXY,GAAA,MAAAA,EAAgB,KAClB,CAAA,EACC,CAACf,EAAQQ,CAAiB,CAAC,EAG5BrB,EAACG,EAAA,CACE,GAAGI,EACJ,WACEP,EAAC8B,EAAA,CACC,QAAS,CACP,gBAAgBC,EAAU,CACnB,KAAA,gBAAgB,IAAIC,IAAU,CAC3B,MAAAC,EAAaF,EAAS,GAAGC,CAAK,EAEpC,GAAI,CAACC,EAAY,OAEjB,KAAM,CAAE,KAAAC,EAAM,KAAAC,EAAM,KAAAC,EAAM,cAAAC,CAAkB,EAAAJ,EAExC,GAAA,CAACG,GAAQ,CAACC,EAAe,CACnB,QAAA,KACN,iBAAiBF,CAAI,8DACvB,EACA,MAAA,CAGI,MAAAG,EAAQF,EACZpC,EAACL,EAAO,CAAA,KAAMyC,CAAM,CAAA,EAEpBpC,EAACuC,EAAW,CAAA,GAAIF,CAAgB,CAAA,EAG5BG,EACJxC,EAACyC,EAAA,CACC,QAASP,IAASQ,EAAc,KAChC,MAAAJ,EACA,KAAAH,EACA,SAAU,GACV,SAAUX,EACV,UAAWC,CAAA,CACb,EAGG,KAAA,UAAWkB,IAAe,CAC7B,SAAU,CAAC,GAAIA,EAAK,UAAY,GAAKH,CAAS,CAAA,EAC9C,CAAA,CACH,CAAA,CAEL,EACA,KAAK,aACL,KAAM1B,GAAA,YAAAA,EAAO,UAAA,CACf,EAEF,MAAAR,EACA,YAAaS,EACb,QAASF,GAAU,CAACQ,CAAA,CACtB,CAEJ"}
|
|
1
|
+
{"version":3,"file":"TermsAndConditions.js","sources":["/@dropins/storefront-checkout/src/components/Markup/Markup.tsx","/@dropins/storefront-checkout/src/components/TermsAndConditions/TermsAndConditionsSkeleton.tsx","/@dropins/storefront-checkout/src/components/TermsAndConditions/TermsAndConditions.tsx","/@dropins/storefront-checkout/src/containers/TermsAndConditions/TermsAndConditions.tsx"],"sourcesContent":["/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport DOMPurify from 'dompurify';\nimport { FunctionComponent } from 'preact';\n\ninterface MarkupProps {\n html: string;\n}\n\nexport const Markup: FunctionComponent<MarkupProps> = ({ html }) => {\n const sanitizedHtml = DOMPurify.sanitize(html, { ADD_ATTR: ['target'] });\n if (sanitizedHtml === '') return null;\n // eslint-disable-next-line react/no-danger\n return <span dangerouslySetInnerHTML={{ __html: sanitizedHtml }} />;\n};\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { Skeleton, SkeletonRow } from '@adobe-commerce/elsie/components';\nimport { FunctionComponent } from 'preact';\n\nexport const TermsAndConditionsSkeleton: FunctionComponent = () => {\n return (\n <Skeleton\n className=\"checkout-terms-and-conditions-skeleton\"\n data-testid=\"checkout-terms-and-conditions-skeleton\"\n >\n <SkeletonRow fullWidth={true} size=\"small\" variant=\"row\" />\n </Skeleton>\n );\n};\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { WithConditionals } from '@/checkout/components';\nimport '@/checkout/components/TermsAndConditions/TermsAndConditions.css';\nimport { TermsAndConditionsSkeleton } from '@/checkout/components/TermsAndConditions/TermsAndConditionsSkeleton';\nimport { classes, VComponent } from '@adobe-commerce/elsie/lib';\nimport { FunctionComponent, VNode } from 'preact';\nimport { HTMLAttributes } from 'preact/compat';\n\nexport interface TermsAndConditionsProps\n extends HTMLAttributes<HTMLFormElement> {\n agreements?: VNode;\n error?: string;\n}\n\nconst TermsAndConditionsComponent: FunctionComponent<\n TermsAndConditionsProps\n> = ({ className, agreements, error, ...props }) => {\n return (\n <div\n className=\"checkout-terms-and-conditions\"\n data-testid=\"checkout-terms-and-conditions\"\n >\n <form\n {...props}\n noValidate\n className={classes(['checkout-terms-and-conditions__form', className])}\n data-testid=\"checkout-terms-and-conditions-form\"\n name=\"checkout-terms-and-conditions__form\"\n >\n {agreements && (\n <VComponent\n className={classes(['checkout-terms-and-conditions__agreements'])}\n data-testid=\"checkout-terms-and-conditions-agreements\"\n node={agreements}\n />\n )}\n\n {error && (\n <div\n className=\"checkout-terms-and-conditions__error\"\n data-testid=\"checkout-terms-and-conditions-error\"\n >\n {error}\n </div>\n )}\n </form>\n </div>\n );\n};\n\nexport const TermsAndConditions = WithConditionals(\n TermsAndConditionsComponent,\n TermsAndConditionsSkeleton\n);\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { Markup } from '@/checkout/components';\nimport { TermsAndConditions as TermsAndConditionsComponent } from '@/checkout/components/TermsAndConditions';\nimport { AgreementMode } from '@/checkout/data/models';\nimport { getLatestCheckoutUpdate, state } from '@/checkout/lib';\nimport { Checkbox } from '@adobe-commerce/elsie/components';\nimport { MarkupText, useText } from '@adobe-commerce/elsie/i18n';\nimport {\n Container,\n Slot,\n SlotMethod,\n SlotProps,\n} from '@adobe-commerce/elsie/lib';\nimport { events } from '@adobe-commerce/event-bus';\nimport { useEffect, useState } from 'preact/hooks';\n\nexport interface TermsAndConditionsProps {\n active?: boolean;\n slots?: {\n Agreements?: SlotProps<{\n appendAgreement: SlotMethod<{\n name: string;\n mode: AgreementMode;\n translationId?: string;\n text?: string;\n }>;\n }>;\n };\n}\n\nexport const TermsAndConditions: Container<TermsAndConditionsProps> = ({\n active = true,\n slots,\n ...props\n}) => {\n const [isInitialized, setIsInitialized] = useState(false);\n const [error, setError] = useState<string>('');\n\n const { errorMessage } = useText({\n errorMessage: 'Checkout.TermsAndConditions.error',\n });\n\n const disabledViaConfig = state.config?.agreementsEnabled === false;\n\n const handleChange = () => {\n setError('');\n };\n\n const handleInvalid = () => {\n setError(errorMessage);\n };\n\n useEffect(() => {\n if (!active || disabledViaConfig) return;\n\n const pastUpdate = getLatestCheckoutUpdate();\n\n if (pastUpdate) {\n setIsInitialized(true);\n return;\n }\n\n const onCheckoutInit = events.on(\n 'checkout/initialized',\n () => {\n setIsInitialized(true);\n },\n { eager: true }\n );\n return () => {\n onCheckoutInit?.off();\n };\n }, [active, disabledViaConfig]);\n\n return (\n <TermsAndConditionsComponent\n {...props}\n agreements={\n <Slot\n context={{\n appendAgreement(callback) {\n this._registerMethod((...attrs) => {\n const _agreement = callback(...attrs);\n\n if (!_agreement) return;\n\n const { mode, name, text, translationId } = _agreement;\n\n if (!text && !translationId) {\n console.warn(\n `The agreement ${name} is misconfigured. Please provide a text or a translationId.`\n );\n return;\n }\n\n const label = text ? (\n <Markup html={text} />\n ) : (\n <MarkupText id={translationId!} />\n );\n\n const agreement = (\n <Checkbox\n checked={mode === AgreementMode.AUTO}\n label={label}\n name={name}\n required={true}\n onChange={handleChange}\n onInvalid={handleInvalid}\n />\n );\n\n this._setProps((prev: any) => ({\n children: [...(prev.children || []), agreement],\n }));\n });\n },\n }}\n name=\"Agreements\"\n slot={slots?.Agreements}\n />\n }\n error={error}\n initialized={isInitialized}\n visible={active && !disabledViaConfig}\n />\n );\n};\n"],"names":["Markup","html","sanitizedHtml","DOMPurify","TermsAndConditionsSkeleton","jsx","Skeleton","SkeletonRow","TermsAndConditionsComponent","className","agreements","error","props","jsxs","classes","VComponent","TermsAndConditions","WithConditionals","active","slots","isInitialized","setIsInitialized","useState","setError","errorMessage","useText","disabledViaConfig","_a","state","handleChange","handleInvalid","useEffect","getLatestCheckoutUpdate","onCheckoutInit","events","Slot","callback","attrs","_agreement","mode","name","text","translationId","label","MarkupText","agreement","Checkbox","AgreementMode","prev"],"mappings":"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"}
|
package/data/models/address.d.ts
CHANGED
|
@@ -1,21 +1,18 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Country, Region, ShippingMethod } from '.';
|
|
2
2
|
|
|
3
3
|
export interface Address {
|
|
4
|
-
id?: number;
|
|
5
4
|
city: string;
|
|
6
5
|
company?: string;
|
|
7
6
|
country: Country;
|
|
8
|
-
customAttributes: CustomAttribute[];
|
|
9
7
|
firstName: string;
|
|
10
8
|
lastName: string;
|
|
11
9
|
postCode?: string;
|
|
12
10
|
region?: Region;
|
|
13
11
|
street: string[];
|
|
14
12
|
telephone?: string;
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
fax?: string;
|
|
13
|
+
}
|
|
14
|
+
export interface ShippingAddress extends Address {
|
|
15
|
+
availableShippingMethods?: ShippingMethod[];
|
|
16
|
+
selectedShippingMethod?: ShippingMethod;
|
|
20
17
|
}
|
|
21
18
|
//# sourceMappingURL=address.d.ts.map
|
package/data/models/api.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { CustomAttribute } from './custom-attribute';
|
|
2
2
|
|
|
3
|
-
export interface
|
|
3
|
+
export interface CartAddressInput {
|
|
4
4
|
city: string;
|
|
5
5
|
company?: string;
|
|
6
6
|
countryCode: string;
|
|
@@ -20,12 +20,12 @@ export interface CartAddress {
|
|
|
20
20
|
fax?: string;
|
|
21
21
|
}
|
|
22
22
|
export interface ShippingAddressInput {
|
|
23
|
-
address?:
|
|
23
|
+
address?: CartAddressInput;
|
|
24
24
|
customerAddressId?: number;
|
|
25
25
|
pickupLocationCode?: string;
|
|
26
26
|
}
|
|
27
27
|
export interface BillingAddressInput {
|
|
28
|
-
address?:
|
|
28
|
+
address?: CartAddressInput;
|
|
29
29
|
customerAddressId?: number;
|
|
30
30
|
sameAsShipping?: boolean;
|
|
31
31
|
useForShipping?: boolean;
|
package/data/models/cart.d.ts
CHANGED
|
@@ -1,19 +1,26 @@
|
|
|
1
|
-
import { Address, PaymentMethod,
|
|
1
|
+
import { Address, CustomAttribute, PaymentMethod, ShippingAddress } from '.';
|
|
2
2
|
|
|
3
|
-
export interface
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
3
|
+
export interface CartAddress extends Address {
|
|
4
|
+
customAttributes: CustomAttribute[];
|
|
5
|
+
fax?: string;
|
|
6
|
+
id?: number;
|
|
7
|
+
middleName?: string;
|
|
8
|
+
prefix?: string;
|
|
9
|
+
suffix?: string;
|
|
10
|
+
vatId?: string;
|
|
7
11
|
}
|
|
12
|
+
export type CartShippingAddress = CartAddress & ShippingAddress & {
|
|
13
|
+
sameAsBilling?: boolean;
|
|
14
|
+
};
|
|
8
15
|
export interface Cart {
|
|
9
16
|
availablePaymentMethods?: PaymentMethod[];
|
|
10
|
-
billingAddress?:
|
|
17
|
+
billingAddress?: CartAddress;
|
|
11
18
|
email?: string;
|
|
12
19
|
id: string;
|
|
13
20
|
isEmpty: boolean;
|
|
14
21
|
isGuest: boolean;
|
|
15
22
|
isVirtual: boolean;
|
|
16
23
|
selectedPaymentMethod?: PaymentMethod;
|
|
17
|
-
shippingAddresses
|
|
24
|
+
shippingAddresses: CartShippingAddress[];
|
|
18
25
|
}
|
|
19
26
|
//# sourceMappingURL=cart.d.ts.map
|
|
@@ -30,5 +30,19 @@ export interface CheckoutAgreement {
|
|
|
30
30
|
name: string;
|
|
31
31
|
text: string;
|
|
32
32
|
}
|
|
33
|
+
export interface CheckoutError {
|
|
34
|
+
/**
|
|
35
|
+
* The primary, user-friendly error message. This should be safe to display
|
|
36
|
+
* directly in the UI.
|
|
37
|
+
* @example "Your card was declined."
|
|
38
|
+
*/
|
|
39
|
+
message: string;
|
|
40
|
+
/**
|
|
41
|
+
* An optional, unique error code for programmatic handling. This allows the
|
|
42
|
+
* ServerError component to show specific icons, links, or actions.
|
|
43
|
+
* @example "payment_intent_declined"
|
|
44
|
+
*/
|
|
45
|
+
code?: string;
|
|
46
|
+
}
|
|
33
47
|
export {};
|
|
34
48
|
//# sourceMappingURL=checkout.d.ts.map
|
package/data/models/country.d.ts
CHANGED
package/data/models/index.d.ts
CHANGED
|
@@ -22,8 +22,9 @@ export * from './country';
|
|
|
22
22
|
export * from './custom-attribute';
|
|
23
23
|
export * from './customer';
|
|
24
24
|
export * from './email-availability';
|
|
25
|
+
export * from './money';
|
|
25
26
|
export * from './payment-method';
|
|
26
|
-
export * from './
|
|
27
|
+
export * from './quote';
|
|
27
28
|
export * from './region';
|
|
28
29
|
export * from './shipping-estimate';
|
|
29
30
|
export * from './shipping-method';
|
|
@@ -14,8 +14,8 @@
|
|
|
14
14
|
* is strictly forbidden unless prior written permission is obtained
|
|
15
15
|
* from Adobe.
|
|
16
16
|
*******************************************************************/
|
|
17
|
-
export type
|
|
17
|
+
export type Money = {
|
|
18
18
|
value: number;
|
|
19
19
|
currency: string;
|
|
20
20
|
};
|
|
21
|
-
//# sourceMappingURL=
|
|
21
|
+
//# sourceMappingURL=money.d.ts.map
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Address, PaymentMethod, ShippingAddress } from '.';
|
|
2
|
+
import { NegotiableQuoteStatus } from '../../__generated__/types';
|
|
3
|
+
|
|
4
|
+
export interface NegotiableQuote {
|
|
5
|
+
availablePaymentMethods?: PaymentMethod[];
|
|
6
|
+
billingAddress?: Address;
|
|
7
|
+
email?: string;
|
|
8
|
+
isVirtual: boolean;
|
|
9
|
+
name: string;
|
|
10
|
+
selectedPaymentMethod?: PaymentMethod;
|
|
11
|
+
shippingAddresses: ShippingAddress[];
|
|
12
|
+
status: NegotiableQuoteStatus;
|
|
13
|
+
uid: string;
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=quote.d.ts.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Money, ShippingMethod } from '.';
|
|
2
2
|
|
|
3
3
|
export interface PartialShippingAddress {
|
|
4
4
|
countryCode: string;
|
|
@@ -8,11 +8,11 @@ export interface PartialShippingAddress {
|
|
|
8
8
|
regionId?: number;
|
|
9
9
|
}
|
|
10
10
|
export interface ShippingEstimateShippingMethod {
|
|
11
|
-
amount:
|
|
11
|
+
amount: Money;
|
|
12
12
|
carrierCode: string;
|
|
13
13
|
methodCode: string;
|
|
14
|
-
amountExclTax?:
|
|
15
|
-
amountInclTax?:
|
|
14
|
+
amountExclTax?: Money;
|
|
15
|
+
amountInclTax?: Money;
|
|
16
16
|
}
|
|
17
17
|
export interface ShippingEstimate {
|
|
18
18
|
address: PartialShippingAddress;
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Money } from './money';
|
|
2
2
|
|
|
3
3
|
type Carrier = {
|
|
4
4
|
code: string;
|
|
5
5
|
title: string;
|
|
6
6
|
};
|
|
7
7
|
export type ShippingMethod = {
|
|
8
|
-
amount:
|
|
8
|
+
amount: Money;
|
|
9
9
|
carrier: Carrier;
|
|
10
10
|
code: string;
|
|
11
11
|
title: string;
|
|
12
12
|
value: string;
|
|
13
|
-
amountExclTax?:
|
|
14
|
-
amountInclTax?:
|
|
13
|
+
amountExclTax?: Money;
|
|
14
|
+
amountInclTax?: Money;
|
|
15
15
|
};
|
|
16
16
|
export {};
|
|
17
17
|
//# sourceMappingURL=shipping-method.d.ts.map
|
|
@@ -14,11 +14,16 @@
|
|
|
14
14
|
* is strictly forbidden unless prior written permission is obtained
|
|
15
15
|
* from Adobe.
|
|
16
16
|
*******************************************************************/
|
|
17
|
-
export * from './transform-address';
|
|
18
17
|
export * from './transform-cart';
|
|
18
|
+
export * from './transform-cart-address';
|
|
19
|
+
export * from './transform-quote-address';
|
|
19
20
|
export * from './transform-checkout-agreements';
|
|
21
|
+
export * from './transform-country';
|
|
20
22
|
export * from './transform-customer';
|
|
21
23
|
export * from './transform-email-availability';
|
|
24
|
+
export * from './transform-negotiable-quote';
|
|
25
|
+
export * from './transform-payment-methods';
|
|
26
|
+
export * from './transform-region';
|
|
22
27
|
export * from './transform-shipping-estimate';
|
|
23
28
|
export * from './transform-shipping-methods';
|
|
24
29
|
export * from './transform-store-config';
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
+
import { CartAddress as CartAddressModel, CartAddressInput as CartAddressInputModel, CartShippingAddress as CartShippingAddressModel, CustomAttribute as CustomAttributeModel } from '../models';
|
|
1
2
|
import { CartAddressInput, GetCartQuery } from '../../__generated__/types';
|
|
2
|
-
import { Address as AddressModel, CustomAttribute as CustomAttributeModel, ShippingAddress as ShippingAddressModel, CartAddress as CartAddressModel } from '../models';
|
|
3
3
|
|
|
4
4
|
type ShippingAddresses = NonNullable<GetCartQuery['cart']>['shipping_addresses'];
|
|
5
|
-
type
|
|
6
|
-
type NonNullableShippingAddress = NonNullable<
|
|
7
|
-
type
|
|
8
|
-
type NonNullableBillingAddress = NonNullable<
|
|
5
|
+
type CartShippingAddress = ShippingAddresses[0];
|
|
6
|
+
type NonNullableShippingAddress = NonNullable<CartShippingAddress>;
|
|
7
|
+
type CartBillingAddress = NonNullable<GetCartQuery['cart']>['billing_address'];
|
|
8
|
+
type NonNullableBillingAddress = NonNullable<CartBillingAddress>;
|
|
9
9
|
type CustomAttributes = NonNullableShippingAddress['custom_attributes'] | NonNullableBillingAddress['custom_attributes'];
|
|
10
10
|
export declare const transformCustomAttributes: (data: CustomAttributes) => CustomAttributeModel[];
|
|
11
|
-
declare const
|
|
12
|
-
declare const
|
|
11
|
+
declare const transformCartBillingAddress: (data: CartBillingAddress) => CartAddressModel | undefined;
|
|
12
|
+
declare const transformCartShippingAddress: (data: ({
|
|
13
13
|
__typename?: "ShippingCartAddress" | undefined;
|
|
14
14
|
id?: number | null | undefined;
|
|
15
15
|
firstname: string;
|
|
@@ -45,7 +45,6 @@ declare const transformShippingAddresses: (data: ({
|
|
|
45
45
|
} | null)[];
|
|
46
46
|
available_shipping_methods?: ({
|
|
47
47
|
__typename?: "AvailableShippingMethod" | undefined;
|
|
48
|
-
available: boolean;
|
|
49
48
|
carrier_code: string;
|
|
50
49
|
carrier_title: string;
|
|
51
50
|
error_message?: string | null | undefined;
|
|
@@ -75,8 +74,8 @@ declare const transformShippingAddresses: (data: ({
|
|
|
75
74
|
method_title: string;
|
|
76
75
|
amount: {
|
|
77
76
|
__typename?: "Money" | undefined;
|
|
78
|
-
value?: number | null | undefined;
|
|
79
77
|
currency?: import('../../__generated__/types').CurrencyEnum | null | undefined;
|
|
78
|
+
value?: number | null | undefined;
|
|
80
79
|
};
|
|
81
80
|
price_excl_tax: {
|
|
82
81
|
__typename?: "Money" | undefined;
|
|
@@ -89,7 +88,7 @@ declare const transformShippingAddresses: (data: ({
|
|
|
89
88
|
currency?: import('../../__generated__/types').CurrencyEnum | null | undefined;
|
|
90
89
|
};
|
|
91
90
|
} | null | undefined;
|
|
92
|
-
} | null)[]) =>
|
|
93
|
-
declare const
|
|
94
|
-
export {
|
|
95
|
-
//# sourceMappingURL=transform-address.d.ts.map
|
|
91
|
+
} | null)[]) => CartShippingAddressModel[];
|
|
92
|
+
declare const transformCartAddressInput: (address: CartAddressInputModel) => CartAddressInput;
|
|
93
|
+
export { CartBillingAddress, CartShippingAddress, transformCartAddressInput, transformCartBillingAddress, transformCartShippingAddress, };
|
|
94
|
+
//# sourceMappingURL=transform-cart-address.d.ts.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { GetCartQuery } from '../../__generated__/types';
|
|
2
1
|
import { Cart as CartModel } from '../models';
|
|
2
|
+
import { GetCartQuery } from '../../__generated__/types';
|
|
3
3
|
|
|
4
4
|
type Cart = GetCartQuery['cart'];
|
|
5
5
|
declare const transformCart: (data: Cart) => CartModel | undefined;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { CartAddressCountry, NegotiableQuoteAddressCountry } from '../../__generated__/types';
|
|
2
|
+
import { Country as CountryModel } from '../models';
|
|
3
|
+
|
|
4
|
+
type AddressCountry = CartAddressCountry | NegotiableQuoteAddressCountry;
|
|
5
|
+
type OptionalAddressCountry = AddressCountry | undefined | null;
|
|
6
|
+
export declare const transformAddressCountry: (data: OptionalAddressCountry) => CountryModel;
|
|
7
|
+
export {};
|
|
8
|
+
//# sourceMappingURL=transform-country.d.ts.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { NegotiableQuote as NegotiableQuoteModel } from '../models';
|
|
2
|
+
import { GetNegotiableQuoteQuery } from '../../__generated__/types';
|
|
3
|
+
|
|
4
|
+
type NegotiableQuote = GetNegotiableQuoteQuery['negotiableQuote'];
|
|
5
|
+
export declare const transformNegotiableQuote: (data: NegotiableQuote | undefined) => NegotiableQuoteModel | null;
|
|
6
|
+
export {};
|
|
7
|
+
//# sourceMappingURL=transform-negotiable-quote.d.ts.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { GetCartQuery } from '../../__generated__/types';
|
|
2
1
|
import { PaymentMethod } from '../models/payment-method';
|
|
2
|
+
import { GetCartQuery } from '../../__generated__/types';
|
|
3
3
|
|
|
4
4
|
type SelectedPaymentMethod = NonNullable<GetCartQuery['cart']>['selected_payment_method'];
|
|
5
5
|
type AvailablePaymentMethods = NonNullable<GetCartQuery['cart']>['available_payment_methods'];
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { Address as AddressModel, ShippingAddress as ShippingAddressModel } from '../models';
|
|
2
|
+
import { GetNegotiableQuoteQuery } from '../../__generated__/types';
|
|
3
|
+
|
|
4
|
+
type QuoteShippingAddresses = NonNullable<GetNegotiableQuoteQuery['negotiableQuote']>['shipping_addresses'];
|
|
5
|
+
type QuoteShippingAddress = QuoteShippingAddresses[0];
|
|
6
|
+
type QuoteBillingAddress = NonNullable<GetNegotiableQuoteQuery['negotiableQuote']>['billing_address'];
|
|
7
|
+
declare const transformQuoteBillingAddress: (data: QuoteBillingAddress) => AddressModel | undefined;
|
|
8
|
+
declare const transformQuoteShippingAddress: (data: ({
|
|
9
|
+
__typename?: "NegotiableQuoteShippingAddress" | undefined;
|
|
10
|
+
firstname: string;
|
|
11
|
+
lastname: string;
|
|
12
|
+
company?: string | null | undefined;
|
|
13
|
+
street: (string | null)[];
|
|
14
|
+
city: string;
|
|
15
|
+
postcode?: string | null | undefined;
|
|
16
|
+
telephone?: string | null | undefined;
|
|
17
|
+
region?: {
|
|
18
|
+
__typename?: "NegotiableQuoteAddressRegion" | undefined;
|
|
19
|
+
region_id?: number | null | undefined;
|
|
20
|
+
code?: string | null | undefined;
|
|
21
|
+
label?: string | null | undefined;
|
|
22
|
+
} | null | undefined;
|
|
23
|
+
country: {
|
|
24
|
+
__typename?: "NegotiableQuoteAddressCountry" | undefined;
|
|
25
|
+
code: string;
|
|
26
|
+
label: string;
|
|
27
|
+
};
|
|
28
|
+
available_shipping_methods?: ({
|
|
29
|
+
__typename?: "AvailableShippingMethod" | undefined;
|
|
30
|
+
carrier_code: string;
|
|
31
|
+
carrier_title: string;
|
|
32
|
+
error_message?: string | null | undefined;
|
|
33
|
+
method_code?: string | null | undefined;
|
|
34
|
+
method_title?: string | null | undefined;
|
|
35
|
+
amount: {
|
|
36
|
+
__typename?: "Money" | undefined;
|
|
37
|
+
currency?: import('../../__generated__/types').CurrencyEnum | null | undefined;
|
|
38
|
+
value?: number | null | undefined;
|
|
39
|
+
};
|
|
40
|
+
price_excl_tax: {
|
|
41
|
+
__typename?: "Money" | undefined;
|
|
42
|
+
value?: number | null | undefined;
|
|
43
|
+
currency?: import('../../__generated__/types').CurrencyEnum | null | undefined;
|
|
44
|
+
};
|
|
45
|
+
price_incl_tax: {
|
|
46
|
+
__typename?: "Money" | undefined;
|
|
47
|
+
value?: number | null | undefined;
|
|
48
|
+
currency?: import('../../__generated__/types').CurrencyEnum | null | undefined;
|
|
49
|
+
};
|
|
50
|
+
} | null)[] | null | undefined;
|
|
51
|
+
selected_shipping_method?: {
|
|
52
|
+
__typename?: "SelectedShippingMethod" | undefined;
|
|
53
|
+
carrier_code: string;
|
|
54
|
+
carrier_title: string;
|
|
55
|
+
method_code: string;
|
|
56
|
+
method_title: string;
|
|
57
|
+
amount: {
|
|
58
|
+
__typename?: "Money" | undefined;
|
|
59
|
+
currency?: import('../../__generated__/types').CurrencyEnum | null | undefined;
|
|
60
|
+
value?: number | null | undefined;
|
|
61
|
+
};
|
|
62
|
+
price_excl_tax: {
|
|
63
|
+
__typename?: "Money" | undefined;
|
|
64
|
+
value?: number | null | undefined;
|
|
65
|
+
currency?: import('../../__generated__/types').CurrencyEnum | null | undefined;
|
|
66
|
+
};
|
|
67
|
+
price_incl_tax: {
|
|
68
|
+
__typename?: "Money" | undefined;
|
|
69
|
+
value?: number | null | undefined;
|
|
70
|
+
currency?: import('../../__generated__/types').CurrencyEnum | null | undefined;
|
|
71
|
+
};
|
|
72
|
+
} | null | undefined;
|
|
73
|
+
} | null)[]) => ShippingAddressModel[];
|
|
74
|
+
export { QuoteBillingAddress, QuoteShippingAddress, transformQuoteBillingAddress, transformQuoteShippingAddress, };
|
|
75
|
+
//# sourceMappingURL=transform-quote-address.d.ts.map
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Region as RegionModel } from '../models';
|
|
2
|
+
import { CartAddressRegion, NegotiableQuoteAddressRegion } from '../../__generated__/types';
|
|
3
|
+
|
|
4
|
+
type AddressRegion = CartAddressRegion | NegotiableQuoteAddressRegion;
|
|
5
|
+
type OptionalAddressRegion = AddressRegion | undefined | null;
|
|
6
|
+
export declare const transformAddressRegion: (data: OptionalAddressRegion) => RegionModel | undefined;
|
|
7
|
+
export {};
|
|
8
|
+
//# sourceMappingURL=transform-region.d.ts.map
|