@dropins/storefront-checkout 2.2.0-alpha1 → 2.2.0-alpha3
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/getCompanyCredit/graphql/getCompanyCredit.graphql.d.ts +1 -1
- package/api/graphql/NegotiableQuoteAddressFragment.graphql.d.ts +1 -1
- package/chunks/PurchaseOrder.js +1 -1
- package/chunks/PurchaseOrder.js.map +1 -1
- package/chunks/dom.js +1 -1
- package/chunks/dom.js.map +1 -1
- package/chunks/getCompanyCredit.js +1 -0
- package/chunks/getCompanyCredit.js.map +1 -1
- package/chunks/render.js +1 -1
- package/chunks/render.js.map +1 -1
- package/chunks/synchronizeCheckout.js +5 -5
- package/chunks/synchronizeCheckout.js.map +1 -1
- package/chunks/validation.js +4 -0
- package/chunks/validation.js.map +1 -0
- package/components/PurchaseOrder/PurchaseOrder.d.ts +3 -1
- package/containers/LoginForm.js +1 -1
- package/containers/LoginForm.js.map +1 -1
- package/containers/PaymentMethods/handlers.d.ts +4 -1
- package/containers/PaymentMethods/index.d.ts +1 -0
- package/containers/PaymentMethods.js +1 -1
- package/containers/PaymentMethods.js.map +1 -1
- package/containers/PurchaseOrder.js +1 -1
- package/data/models/address.d.ts +1 -0
- package/data/transforms/transform-cart-address.d.ts +0 -2
- package/data/transforms/transform-quote-address.d.ts +1 -2
- package/fragments.js +12 -10
- package/fragments.js.map +1 -1
- package/i18n/en_US.json.d.ts +3 -2
- package/lib/utils/dom.d.ts +2 -0
- package/lib/utils/forms.d.ts +8 -2
- package/lib/utils.js +1 -1
- package/lib/utils.js.map +1 -1
- package/lib/validation.d.ts +6 -0
- package/package.json +1 -1
- package/tests/fixtures/fragments/cart.d.ts +1 -4
|
@@ -14,5 +14,5 @@
|
|
|
14
14
|
* is strictly forbidden unless prior written permission is obtained
|
|
15
15
|
* from Adobe.
|
|
16
16
|
*******************************************************************/
|
|
17
|
-
export declare const getCompanyCreditQuery = "\n query getCompanyCredit {\n company {\n credit {\n available_credit {\n value\n currency\n }\n }\n }\n }\n";
|
|
17
|
+
export declare const getCompanyCreditQuery = "\n query getCompanyCredit {\n company {\n credit {\n exceed_limit\n available_credit {\n value\n currency\n }\n }\n }\n }\n";
|
|
18
18
|
//# sourceMappingURL=getCompanyCredit.graphql.d.ts.map
|
|
@@ -14,6 +14,6 @@
|
|
|
14
14
|
* is strictly forbidden unless prior written permission is obtained
|
|
15
15
|
* from Adobe.
|
|
16
16
|
*******************************************************************/
|
|
17
|
-
export declare const NEGOTIABLE_QUOTE_BILLING_ADDRESS_FRAGMENT = "\n fragment NEGOTIABLE_QUOTE_BILLING_ADDRESS_FRAGMENT on NegotiableQuoteBillingAddress {\n city\n company\n country {\n code\n label\n }\n custom_attributes {\n ... on AttributeValue {\n code\n value\n }\n }\n fax\n firstname\n lastname\n middlename\n postcode\n prefix\n region {\n region_id\n code\n label\n }\n street\n suffix\n telephone\n uid\n vat_id\n }\n";
|
|
17
|
+
export declare const NEGOTIABLE_QUOTE_BILLING_ADDRESS_FRAGMENT = "\n fragment NEGOTIABLE_QUOTE_BILLING_ADDRESS_FRAGMENT on NegotiableQuoteBillingAddress {\n city\n company\n country {\n code\n label\n }\n custom_attributes {\n ... on AttributeValue {\n code\n value\n }\n }\n customer_address_uid\n fax\n firstname\n lastname\n middlename\n postcode\n prefix\n region {\n region_id\n code\n label\n }\n street\n suffix\n telephone\n uid\n vat_id\n }\n";
|
|
18
18
|
export declare const NEGOTIABLE_QUOTE_SHIPPING_ADDRESS_FRAGMENT: string;
|
|
19
19
|
//# sourceMappingURL=NegotiableQuoteAddressFragment.graphql.d.ts.map
|
package/chunks/PurchaseOrder.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/*! Copyright 2025 Adobe
|
|
2
2
|
All Rights Reserved. */
|
|
3
|
-
import{jsx as
|
|
3
|
+
import{jsx as i}from"@dropins/tools/preact-jsx-runtime.js";import"./TermsAndConditions.js";import{classes as k}from"@dropins/tools/lib.js";import{Field as O,Input as E}from"@dropins/tools/components.js";/* empty css */import"./fetch-graphql.js";import"@dropins/tools/event-bus.js";import{h as x,v as y}from"./validation.js";import{useState as b,useCallback as c}from"@dropins/tools/preact-compat.js";/* empty css *//* empty css */import{useText as v}from"@dropins/tools/i18n.js";/* empty css */import"@dropins/tools/preact-hooks.js";const I=({className:d,error:r="",referenceNumber:t="",onReferenceNumberBlur:l,onReferenceNumberChange:h,onInvalidReferenceNumber:u,...p})=>{const o=v({refNumberHint:"Checkout.PurchaseOrder.referenceNumberHint",refNumberLabel:"Checkout.PurchaseOrder.referenceNumberLabel",refNumberPlaceholder:"Checkout.PurchaseOrder.referenceNumberPlaceholder"});return i("div",{className:"checkout-purchase-order","data-testid":"checkout-purchase-order",children:i("form",{...p,noValidate:!0,className:k(["checkout-purchase-order__form",d]),"data-testid":"checkout-purchase-order-form",children:i(O,{error:r,hint:o.refNumberHint||void 0,children:i(E,{"aria-required":"true",floatingLabel:`${o.refNumberLabel} *`,id:"reference-number",name:"reference-number",pattern:x.NOT_EMPTY,placeholder:o.refNumberPlaceholder,required:!0,type:"text",value:t,onBlur:l,onChange:h,onInvalid:u})})})})},w=({initialReferenceNumber:d="",onReferenceNumberChange:r,onReferenceNumberBlur:t,...l})=>{const[h,u]=b(""),[p,o]=b(d),{missingRefNumberError:m}=v({missingRefNumberError:"Checkout.PurchaseOrder.missingReferenceNumberError"}),n=c(e=>{const s=y(e);u(s?"":m)},[m]),f=c(e=>{u(e.valid?"":m)},[m]),N=c(e=>{const a=e.target.value;o(a),n(a),r==null||r(a)},[r,n]),P=c(e=>{const a=e.target.value;n(a),t==null||t(a)},[t,n]),g=c(e=>{const s=e.target;f(s.validity)},[f]);return i(I,{...l,error:h,referenceNumber:p,onInvalidReferenceNumber:g,onReferenceNumberBlur:P,onReferenceNumberChange:N})};export{w as P};
|
|
4
4
|
//# sourceMappingURL=PurchaseOrder.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PurchaseOrder.js","sources":["/@dropins/storefront-checkout/src/components/PurchaseOrder/PurchaseOrder.tsx","/@dropins/storefront-checkout/src/containers/PurchaseOrder/PurchaseOrder.tsx"],"sourcesContent":["/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 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 '@/checkout/components/PurchaseOrder/PurchaseOrder.css';\nimport { Field, Input } from '@adobe-commerce/elsie/components';\nimport { useText } from '@adobe-commerce/elsie/i18n';\nimport { classes } from '@adobe-commerce/elsie/lib';\nimport { FunctionComponent } from 'preact';\nimport { HTMLAttributes } from 'preact/compat';\n\nexport interface PurchaseOrderProps extends HTMLAttributes<HTMLFormElement> {\n referenceNumber?: string;\n onReferenceNumberChange?: (event: Event) => void;\n
|
|
1
|
+
{"version":3,"file":"PurchaseOrder.js","sources":["/@dropins/storefront-checkout/src/components/PurchaseOrder/PurchaseOrder.tsx","/@dropins/storefront-checkout/src/containers/PurchaseOrder/PurchaseOrder.tsx"],"sourcesContent":["/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 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 '@/checkout/components/PurchaseOrder/PurchaseOrder.css';\nimport { htmlPatterns } from '@/checkout/lib/validation';\nimport { Field, Input } from '@adobe-commerce/elsie/components';\nimport { useText } from '@adobe-commerce/elsie/i18n';\nimport { classes } from '@adobe-commerce/elsie/lib';\nimport { FunctionComponent } from 'preact';\nimport { HTMLAttributes } from 'preact/compat';\n\nexport interface PurchaseOrderProps extends HTMLAttributes<HTMLFormElement> {\n error?: string;\n referenceNumber?: string;\n onReferenceNumberBlur?: (event: Event) => void;\n onReferenceNumberChange?: (event: Event) => void;\n onInvalidReferenceNumber?: (event: Event) => void;\n}\n\nexport const PurchaseOrder: FunctionComponent<PurchaseOrderProps> = ({\n className,\n error = '',\n referenceNumber = '',\n onReferenceNumberBlur,\n onReferenceNumberChange,\n onInvalidReferenceNumber,\n ...props\n}) => {\n const translations = useText({\n refNumberHint: 'Checkout.PurchaseOrder.referenceNumberHint',\n refNumberLabel: 'Checkout.PurchaseOrder.referenceNumberLabel',\n refNumberPlaceholder: 'Checkout.PurchaseOrder.referenceNumberPlaceholder',\n });\n\n return (\n <div\n className=\"checkout-purchase-order\"\n data-testid=\"checkout-purchase-order\"\n >\n <form\n {...props}\n noValidate\n className={classes(['checkout-purchase-order__form', className])}\n data-testid=\"checkout-purchase-order-form\"\n >\n <Field error={error} hint={translations.refNumberHint || undefined}>\n <Input\n aria-required=\"true\"\n floatingLabel={`${translations.refNumberLabel} *`}\n id=\"reference-number\"\n name=\"reference-number\"\n pattern={htmlPatterns.NOT_EMPTY}\n placeholder={translations.refNumberPlaceholder}\n required={true}\n type=\"text\"\n value={referenceNumber}\n onBlur={onReferenceNumberBlur}\n onChange={onReferenceNumberChange}\n onInvalid={onInvalidReferenceNumber}\n />\n </Field>\n </form>\n </div>\n );\n};\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 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 { PurchaseOrder as PurchaseOrderComponent } from '@/checkout/components';\nimport { validateNotEmpty } from '@/checkout/lib/validation';\nimport { useText } from '@adobe-commerce/elsie/i18n';\nimport { Container } from '@adobe-commerce/elsie/lib';\nimport { HTMLAttributes, useCallback, useState } from 'preact/compat';\n\nexport interface PurchaseOrderProps extends HTMLAttributes<HTMLFormElement> {\n initialReferenceNumber?: string;\n onReferenceNumberChange?: (referenceNumber: string) => void;\n onReferenceNumberBlur?: (referenceNumber: string) => void;\n}\n\nexport const PurchaseOrder: Container<PurchaseOrderProps> = ({\n initialReferenceNumber = '',\n onReferenceNumberChange,\n onReferenceNumberBlur,\n ...props\n}) => {\n const [error, setError] = useState<string>('');\n const [referenceNumber, setReferenceNumber] = useState<string>(\n initialReferenceNumber\n );\n\n const { missingRefNumberError } = useText({\n missingRefNumberError: 'Checkout.PurchaseOrder.missingReferenceNumberError',\n });\n\n const validateRefNumber = useCallback(\n (value: string) => {\n const isMissing = validateNotEmpty(value);\n setError(isMissing ? '' : missingRefNumberError);\n },\n [missingRefNumberError]\n );\n\n const checkValidity = useCallback(\n (validity: ValidityState) => {\n setError(validity.valid ? '' : missingRefNumberError);\n },\n [missingRefNumberError]\n );\n\n const handleReferenceNumberChange = useCallback(\n (event: Event) => {\n const target = event.target as HTMLInputElement;\n const value = target.value;\n setReferenceNumber(value);\n validateRefNumber(value);\n onReferenceNumberChange?.(value);\n },\n [onReferenceNumberChange, validateRefNumber]\n );\n\n const handleReferenceNumberBlur = useCallback(\n (event: Event) => {\n const target = event.target as HTMLInputElement;\n const value = target.value;\n validateRefNumber(value);\n onReferenceNumberBlur?.(value);\n },\n [onReferenceNumberBlur, validateRefNumber]\n );\n\n const handleInvalidReferenceNumber = useCallback(\n (event: Event) => {\n const target = event.target as HTMLInputElement;\n checkValidity(target.validity);\n },\n [checkValidity]\n );\n\n return (\n <PurchaseOrderComponent\n {...props}\n error={error}\n referenceNumber={referenceNumber}\n onInvalidReferenceNumber={handleInvalidReferenceNumber}\n onReferenceNumberBlur={handleReferenceNumberBlur}\n onReferenceNumberChange={handleReferenceNumberChange}\n />\n );\n};\n"],"names":["PurchaseOrder","className","error","referenceNumber","onReferenceNumberBlur","onReferenceNumberChange","onInvalidReferenceNumber","props","translations","useText","jsx","classes","Field","Input","htmlPatterns","initialReferenceNumber","setError","useState","setReferenceNumber","missingRefNumberError","validateRefNumber","useCallback","value","isMissing","validateNotEmpty","checkValidity","validity","handleReferenceNumberChange","event","handleReferenceNumberBlur","handleInvalidReferenceNumber","target","PurchaseOrderComponent"],"mappings":"+kBAiCO,MAAMA,EAAuD,CAAC,CACnE,UAAAC,EACA,MAAAC,EAAQ,GACR,gBAAAC,EAAkB,GAClB,sBAAAC,EACA,wBAAAC,EACA,yBAAAC,EACA,GAAGC,CACL,IAAM,CACJ,MAAMC,EAAeC,EAAQ,CAC3B,cAAe,6CACf,eAAgB,8CAChB,qBAAsB,mDAAA,CACvB,EAGC,OAAAC,EAAC,MAAA,CACC,UAAU,0BACV,cAAY,0BAEZ,SAAAA,EAAC,OAAA,CACE,GAAGH,EACJ,WAAU,GACV,UAAWI,EAAQ,CAAC,gCAAiCV,CAAS,CAAC,EAC/D,cAAY,+BAEZ,WAACW,EAAM,CAAA,MAAAV,EAAc,KAAMM,EAAa,eAAiB,OACvD,SAAAE,EAACG,EAAA,CACC,gBAAc,OACd,cAAe,GAAGL,EAAa,cAAc,KAC7C,GAAG,mBACH,KAAK,mBACL,QAASM,EAAa,UACtB,YAAaN,EAAa,qBAC1B,SAAU,GACV,KAAK,OACL,MAAOL,EACP,OAAQC,EACR,SAAUC,EACV,UAAWC,CAAA,CAAA,CAEf,CAAA,CAAA,CAAA,CACF,CACF,CAEJ,ECjDaN,EAA+C,CAAC,CAC3D,uBAAAe,EAAyB,GACzB,wBAAAV,EACA,sBAAAD,EACA,GAAGG,CACL,IAAM,CACJ,KAAM,CAACL,EAAOc,CAAQ,EAAIC,EAAiB,EAAE,EACvC,CAACd,EAAiBe,CAAkB,EAAID,EAC5CF,CACF,EAEM,CAAE,sBAAAI,CAAsB,EAAIV,EAAQ,CACxC,sBAAuB,oDAAA,CACxB,EAEKW,EAAoBC,EACvBC,GAAkB,CACX,MAAAC,EAAYC,EAAiBF,CAAK,EAC/BN,EAAAO,EAAY,GAAKJ,CAAqB,CACjD,EACA,CAACA,CAAqB,CACxB,EAEMM,EAAgBJ,EACnBK,GAA4B,CAClBV,EAAAU,EAAS,MAAQ,GAAKP,CAAqB,CACtD,EACA,CAACA,CAAqB,CACxB,EAEMQ,EAA8BN,EACjCO,GAAiB,CAEhB,MAAMN,EADSM,EAAM,OACA,MACrBV,EAAmBI,CAAK,EACxBF,EAAkBE,CAAK,EACvBjB,GAAA,MAAAA,EAA0BiB,EAC5B,EACA,CAACjB,EAAyBe,CAAiB,CAC7C,EAEMS,EAA4BR,EAC/BO,GAAiB,CAEhB,MAAMN,EADSM,EAAM,OACA,MACrBR,EAAkBE,CAAK,EACvBlB,GAAA,MAAAA,EAAwBkB,EAC1B,EACA,CAAClB,EAAuBgB,CAAiB,CAC3C,EAEMU,EAA+BT,EAClCO,GAAiB,CAChB,MAAMG,EAASH,EAAM,OACrBH,EAAcM,EAAO,QAAQ,CAC/B,EACA,CAACN,CAAa,CAChB,EAGE,OAAAf,EAACsB,EAAA,CACE,GAAGzB,EACJ,MAAAL,EACA,gBAAAC,EACA,yBAA0B2B,EAC1B,sBAAuBD,EACvB,wBAAyBF,CAAA,CAC3B,CAEJ"}
|
package/chunks/dom.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/*! Copyright 2025 Adobe
|
|
2
2
|
All Rights Reserved. */
|
|
3
|
-
function
|
|
3
|
+
function t(o){return o.closest("[data-dropin-container]")}function a(o){o.focus(),document.activeElement!==o&&o.scrollIntoView({behavior:"smooth"})}function r(o){const n=t(o);n&&a(n)}export{r as a,t as g,a as s};
|
|
4
4
|
//# sourceMappingURL=dom.js.map
|
package/chunks/dom.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dom.js","sources":["/@dropins/storefront-checkout/src/lib/utils/dom.ts"],"sourcesContent":["/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 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\nexport function
|
|
1
|
+
{"version":3,"file":"dom.js","sources":["/@dropins/storefront-checkout/src/lib/utils/dom.ts"],"sourcesContent":["/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 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\nexport function getParentContainer(element: HTMLElement): HTMLElement | null {\n return element.closest('[data-dropin-container]') as HTMLElement | null;\n}\n\nexport function scrollToElement(element: HTMLElement) {\n element.focus();\n\n if (document.activeElement !== element) {\n element.scrollIntoView({ behavior: 'smooth' });\n }\n}\n\nexport function scrollToParentContainer(element: HTMLElement) {\n const container = getParentContainer(element);\n\n if (container) {\n scrollToElement(container);\n }\n}\n"],"names":["getParentContainer","element","scrollToElement","scrollToParentContainer","container"],"mappings":"AAiBO,SAASA,EAAmBC,EAA0C,CACpE,OAAAA,EAAQ,QAAQ,yBAAyB,CAClD,CAEO,SAASC,EAAgBD,EAAsB,CACpDA,EAAQ,MAAM,EAEV,SAAS,gBAAkBA,GAC7BA,EAAQ,eAAe,CAAE,SAAU,QAAA,CAAU,CAEjD,CAEO,SAASE,EAAwBF,EAAsB,CACtD,MAAAG,EAAYJ,EAAmBC,CAAO,EAExCG,GACFF,EAAgBE,CAAS,CAE7B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getCompanyCredit.js","sources":["/@dropins/storefront-checkout/src/data/transforms/transform-company-credit.ts","/@dropins/storefront-checkout/src/api/getCompanyCredit/graphql/getCompanyCredit.graphql.ts","/@dropins/storefront-checkout/src/api/getCompanyCredit/getCompanyCredit.ts"],"sourcesContent":["/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 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 { CompanyCredit as CompanyCreditModel } from '@/checkout/data/models';\nimport { CompanyCredit as CompanyCreditType } from '@/checkout/__generated__/types';\n\ntype OptionalCompanyCredit = CompanyCreditType | null | undefined;\n\nconst transformCompanyCredit = (data: OptionalCompanyCredit): CompanyCreditModel | null => {\n if (!data || !data?.available_credit || data.available_credit.value == null || !data.available_credit.currency) return null;\n\n const model = {\n availableCredit: {\n value: data.available_credit.value,\n currency: data.available_credit.currency,\n },\n exceedLimit: data?.exceed_limit || false,\n };\n\n return model;\n};\n\nexport { transformCompanyCredit };\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 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\nexport const getCompanyCreditQuery = /* GraphQL */ `\n query getCompanyCredit {\n company {\n credit {\n available_credit {\n value\n currency\n }\n }\n }\n }\n`;\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 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 { getCompanyCreditQuery } from '@/checkout/api/getCompanyCredit/graphql/getCompanyCredit.graphql';\nimport { CompanyCredit } from '@/checkout/data/models';\nimport { transformCompanyCredit } from '@/checkout/data/transforms';\nimport { dispatchApiCall } from '@/checkout/lib/dispatchApiCall';\n\nexport const getCompanyCredit = async (): Promise<CompanyCredit | null> => {\n return await dispatchApiCall({\n type: 'query',\n query: getCompanyCreditQuery,\n options: { method: 'GET', cache: 'no-cache' },\n path: 'company.credit',\n transformer: transformCompanyCredit,\n defaultValueOnFail: null,\n });\n};\n"],"names":["transformCompanyCredit","data","getCompanyCreditQuery","getCompanyCredit","dispatchApiCall"],"mappings":"yGAsBA,MAAMA,EAA0BC,GAC1B,CAACA,GAAQ,EAACA,GAAA,MAAAA,EAAM,mBAAoBA,EAAK,iBAAiB,OAAS,MAAQ,CAACA,EAAK,iBAAiB,SAAiB,KAEzG,CACZ,gBAAiB,CACf,MAAOA,EAAK,iBAAiB,MAC7B,SAAUA,EAAK,iBAAiB,QAClC,EACA,aAAaA,GAAA,YAAAA,EAAM,eAAgB,EACrC,ECdWC,EAAsC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,ECKtCC,EAAmB,SACvB,MAAMC,EAAgB,CAC3B,KAAM,QACN,MAAOF,EACP,QAAS,CAAE,OAAQ,MAAO,MAAO,UAAW,EAC5C,KAAM,iBACN,YAAaF,EACb,mBAAoB,IAAA,CACrB"}
|
|
1
|
+
{"version":3,"file":"getCompanyCredit.js","sources":["/@dropins/storefront-checkout/src/data/transforms/transform-company-credit.ts","/@dropins/storefront-checkout/src/api/getCompanyCredit/graphql/getCompanyCredit.graphql.ts","/@dropins/storefront-checkout/src/api/getCompanyCredit/getCompanyCredit.ts"],"sourcesContent":["/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 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 { CompanyCredit as CompanyCreditModel } from '@/checkout/data/models';\nimport { CompanyCredit as CompanyCreditType } from '@/checkout/__generated__/types';\n\ntype OptionalCompanyCredit = CompanyCreditType | null | undefined;\n\nconst transformCompanyCredit = (data: OptionalCompanyCredit): CompanyCreditModel | null => {\n if (!data || !data?.available_credit || data.available_credit.value == null || !data.available_credit.currency) return null;\n\n const model = {\n availableCredit: {\n value: data.available_credit.value,\n currency: data.available_credit.currency,\n },\n exceedLimit: data?.exceed_limit || false,\n };\n\n return model;\n};\n\nexport { transformCompanyCredit };\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 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\nexport const getCompanyCreditQuery = /* GraphQL */ `\n query getCompanyCredit {\n company {\n credit {\n exceed_limit\n available_credit {\n value\n currency\n }\n }\n }\n }\n`;\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 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 { getCompanyCreditQuery } from '@/checkout/api/getCompanyCredit/graphql/getCompanyCredit.graphql';\nimport { CompanyCredit } from '@/checkout/data/models';\nimport { transformCompanyCredit } from '@/checkout/data/transforms';\nimport { dispatchApiCall } from '@/checkout/lib/dispatchApiCall';\n\nexport const getCompanyCredit = async (): Promise<CompanyCredit | null> => {\n return await dispatchApiCall({\n type: 'query',\n query: getCompanyCreditQuery,\n options: { method: 'GET', cache: 'no-cache' },\n path: 'company.credit',\n transformer: transformCompanyCredit,\n defaultValueOnFail: null,\n });\n};\n"],"names":["transformCompanyCredit","data","getCompanyCreditQuery","getCompanyCredit","dispatchApiCall"],"mappings":"yGAsBA,MAAMA,EAA0BC,GAC1B,CAACA,GAAQ,EAACA,GAAA,MAAAA,EAAM,mBAAoBA,EAAK,iBAAiB,OAAS,MAAQ,CAACA,EAAK,iBAAiB,SAAiB,KAEzG,CACZ,gBAAiB,CACf,MAAOA,EAAK,iBAAiB,MAC7B,SAAUA,EAAK,iBAAiB,QAClC,EACA,aAAaA,GAAA,YAAAA,EAAM,eAAgB,EACrC,ECdWC,EAAsC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,ECKtCC,EAAmB,SACvB,MAAMC,EAAgB,CAC3B,KAAM,QACN,MAAOF,EACP,QAAS,CAAE,OAAQ,MAAO,MAAO,UAAW,EAC5C,KAAM,iBACN,YAAaF,EACb,mBAAoB,IAAA,CACrB"}
|
package/chunks/render.js
CHANGED
|
@@ -6,5 +6,5 @@ All Rights Reserved. */
|
|
|
6
6
|
.checkout-payment-on-account{margin-bottom:var(--spacing-medium)}.checkout-payment-on-account__form{width:100%}.checkout-payment-on-account__credit{display:flex;justify-content:space-between;align-items:center;padding:var(--spacing-small);margin-bottom:var(--spacing-medium);background-color:var(--color-neutral-100);border:1px solid var(--color-neutral-300);border-radius:4px;font-size:14px;line-height:1.4}.checkout-payment-on-account__credit-label{font-weight:500;color:var(--color-neutral-700)}.checkout-payment-on-account__credit-amount{font-weight:600;color:var(--color-success-600)}.checkout-payment-on-account__exceed-message{margin-top:var(--spacing-medium);margin-bottom:var(--spacing-medium)}.checkout-payment-on-account .dropin-field{margin-bottom:0}
|
|
7
7
|
.checkout-bill-to-shipping-address label{font:var(--type-body-2-default-font);letter-spacing:var(--type-body-2-default-letter-spacing);gap:0}.checkout-bill-to-shipping-address__error{margin-top:var(--spacing-medium)}
|
|
8
8
|
.checkout-address-validation{display:grid;gap:var(--spacing-medium)}.checkout-address-validation__options--busy{opacity:.4;pointer-events:none}.checkout-address-validation__title{margin-bottom:var(--spacing-small)}.checkout-address-validation__subtitle{color:var(--color-neutral-700);font:var(--type-body-2-default-font);letter-spacing:var(--type-body-2-default-letter-spacing)}.checkout-address-validation__options{display:grid;gap:var(--spacing-xbig);grid-template-columns:1fr 1fr}.checkout-address-validation__option{margin:0}.checkout-address-validation__option-title{margin-bottom:var(--spacing-xsmall)}.checkout-estimate-shipping{display:grid;grid-template-columns:1fr 1fr;gap:var(--spacing-xxsmall);align-items:center;color:var(--color-neutral-800)}.checkout-estimate-shipping__label,.checkout-estimate-shipping__price{font:var(--type-body-1-default-font);letter-spacing:var(--type-body-1-default-letter-spacing)}.checkout-estimate-shipping__label--muted{font:var(--type-body-2-default-font);letter-spacing:var(--type-body-2-default-letter-spacing);color:var(--color-neutral-700)}.checkout-estimate-shipping__price--muted{font:var(--type-body-2-default-font);letter-spacing:var(--type-body-2-default-letter-spacing)}.checkout-estimate-shipping__price{text-align:right}.checkout-estimate-shipping__label--bold,.checkout-estimate-shipping__price--bold{font:var(--type-body-1-emphasized-font);letter-spacing:var(--type-body-1-emphasized-letter-spacing)}.checkout-estimate-shipping__caption{font:var(--type-details-caption-2-font);letter-spacing:var(--type-details-caption-2-letter-spacing);color:var(--color-neutral-700)}.cart-order-summary__shipping .dropin-skeleton{grid-template-columns:1fr}.checkout-login-form__heading{display:grid;grid-template-columns:1fr max-content;grid-auto-rows:max-content;margin:0 0 var(--spacing-medium) 0;align-items:center}.checkout-login-form__heading:empty{display:none}.checkout-login-form__content{grid-auto-rows:max-content}.checkout-login-form__content .dropin-field__hint a{font-weight:400}.checkout-login-form__customer-details{display:grid;grid-auto-flow:row;gap:var(--spacing-xxsmall)}.checkout-login-form__customer-name{font:var(--type-body-1-strong-font);letter-spacing:var(--type-body-1-default-letter-spacing)}.checkout-login-form__customer-email{font:var(--type-body-2-default-font);letter-spacing:var(--type-body-2-default-letter-spacing);color:var(--color-neutral-700)}.checkout-login-form__title,.checkout-login-form__title h2{grid-column-start:1;color:var(--color-neutral-800);font:var(--type-headline-2-default-font);letter-spacing:var(--type-headline-2-default-letter-spacing);margin:0}.checkout-login-form__heading-label,.checkout-login-form__sign-in,.checkout-login-form__sign-out{grid-column-start:2;color:var(--color-neutral-800);font:var(--type-body-2-default-font);letter-spacing:var(--type-body-2-default-letter-spacing);justify-self:flex-end}.checkout-login-form__heading-label a,a.checkout-login-form__link{font:var(--type-body-2-strong-font);letter-spacing:var(--type-body-2-strong-letter-spacing);margin-left:var(--spacing-xxsmall)}@media only screen and (min-width: 320px) and (max-width: 768px){.checkout-login-form__heading{grid-template-columns:1fr;grid-template-rows:1fr}.checkout-login-form__heading-label{grid-column-start:1;align-self:flex-start;justify-self:flex-start;margin-top:var(--spacing-medium)}}.checkout-out-of-stock.dropin-card{border-color:var(--color-warning-500)}.checkout-out-of-stock .dropin-card__content{gap:var(--spacing-small);padding:var(--spacing-small)}.checkout-out-of-stock__title{color:var(--color-neutral-900);font:var(--type-body-2-strong-font);letter-spacing:var(--type-body-2-strong-letter-spacing);margin:0;display:flex;gap:var(--spacing-xxsmall);align-items:center;justify-content:left;text-align:center}.checkout-out-of-stock__message{color:var(--color-neutral-800);font:var(--type-body-1-default-font);letter-spacing:var(--type-body-1-default-letter-spacing);margin:0}.checkout-out-of-stock__items{display:grid;grid-template-columns:repeat(5,100px);grid-gap:var(--spacing-small);list-style:none;padding:0;margin:0}.checkout-out-of-stock__item img{width:100%;height:auto}.checkout-out-of-stock__actions{display:flex;gap:var(--spacing-small);justify-content:flex-end}a.checkout-out-of-stock__action{color:var(--color-brand-500);font:var(--type-details-caption-1-font);letter-spacing:var(--type-details-caption-1-letter-spacing)}.checkout-out-of-stock__action{color:var(--color-brand-500);font:var(--type-details-caption-1-font);letter-spacing:var(--type-details-caption-1-letter-spacing);background:none;border:none;padding:0;cursor:pointer}.checkout-out-of-stock__action:hover{--textColor: var(--color-brand-700);text-decoration:solid underline var(--textColor);text-underline-offset:6px}@media only screen and (width >= 320px) and (width <= 768px){.checkout-out-of-stock__items{grid-template-columns:repeat(3,100px)}}.checkout-payment-methods__title,.checkout-payment-methods__title h2{color:var(--color-neutral-800);font:var(--type-headline-2-default-font);letter-spacing:var(--type-headline-2-default-letter-spacing);margin:0 0 var(--spacing-medium) 0}.checkout-payment-methods__wrapper{position:relative;display:grid}.checkout-payment-methods__wrapper--busy{opacity:.4;pointer-events:none}.checkout-payment-methods__methods{display:grid;grid-template-columns:1fr 1fr;gap:var(--spacing-medium)}.checkout-payment-methods__content{font:var(--type-body-2-default-font);letter-spacing:var(--type-body-2-default-letter-spacing);margin-top:var(--spacing-xbig)}.checkout-payment-methods__content>div[data-slot=PaymentMethodSlot]:not(:empty){margin-top:var(--spacing-medium)}.checkout-payment-methods--full-width{grid-template-columns:1fr}.checkout-payment-methods__spinner{margin:0 auto;position:absolute;z-index:999;left:0;right:0;top:calc(50% - (var(--size) / 2));bottom:0}.checkout__content [data-slot=PaymentMethods]:empty{display:none}.checkout-payment-methods__error{margin-top:var(--spacing-medium)}@media only screen and (min-width: 320px) and (max-width: 768px){.checkout-payment-methods__methods{grid-template-columns:1fr}}.checkout-purchase-order{margin-bottom:var(--spacing-medium)}.checkout-purchase-order__form{width:100%}.checkout-purchase-order .dropin-field{margin-bottom:0}.checkout-server-error{position:relative;text-align:center}.checkout-server-error__icon .error-icon{color:var(--color-alert-500)}.checkout-server-error a{font:var(--type-body-2-strong-font);letter-spacing:var(--type-body-2-strong-letter-spacing)}.checkout-terms-and-conditions{display:grid}.checkout-terms-and-conditions__error{font:var(--type-details-caption-2-font);letter-spacing:var(--type-details-caption-2-letter-spacing);color:var(--color-alert-800);text-align:left;margin-top:var(--spacing-xsmall)}.checkout-terms-and-conditions__error:empty{display:none}`,{styleId:"checkout"});
|
|
9
|
-
import{jsx as d}from"@dropins/tools/preact-jsx-runtime.js";import{Render as f}from"@dropins/tools/lib.js";import"./fetch-graphql.js";import{events as
|
|
9
|
+
import{jsx as d}from"@dropins/tools/preact-jsx-runtime.js";import{Render as f}from"@dropins/tools/lib.js";import"./fetch-graphql.js";import{events as g}from"@dropins/tools/event-bus.js";import{c as y}from"./synchronizeCheckout.js";import{UIProvider as b}from"@dropins/tools/components.js";import{useState as h,useEffect as p}from"@dropins/tools/preact-hooks.js";function w(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var O=function(r){return E(r)&&!S(r)};function E(e){return!!e&&typeof e=="object"}function S(e){var r=Object.prototype.toString.call(e);return r==="[object RegExp]"||r==="[object Date]"||A(e)}var v=typeof Symbol=="function"&&Symbol.for,P=v?Symbol.for("react.element"):60103;function A(e){return e.$$typeof===P}function j(e){return Array.isArray(e)?[]:{}}function o(e,r){return r.clone!==!1&&r.isMergeableObject(e)?i(j(e),e,r):e}function M(e,r,t){return e.concat(r).map(function(a){return o(a,t)})}function x(e,r){if(!r.customMerge)return i;var t=r.customMerge(e);return typeof t=="function"?t:i}function T(e){return Object.getOwnPropertySymbols?Object.getOwnPropertySymbols(e).filter(function(r){return Object.propertyIsEnumerable.call(e,r)}):[]}function l(e){return Object.keys(e).concat(T(e))}function m(e,r){try{return r in e}catch{return!1}}function I(e,r){return m(e,r)&&!(Object.hasOwnProperty.call(e,r)&&Object.propertyIsEnumerable.call(e,r))}function C(e,r,t){var a={};return t.isMergeableObject(e)&&l(e).forEach(function(n){a[n]=o(e[n],t)}),l(r).forEach(function(n){I(e,n)||(m(e,n)&&t.isMergeableObject(r[n])?a[n]=x(n,t)(e[n],r[n],t):a[n]=o(r[n],t))}),a}function i(e,r,t){t=t||{},t.arrayMerge=t.arrayMerge||M,t.isMergeableObject=t.isMergeableObject||O,t.cloneUnlessOtherwiseSpecified=o;var a=Array.isArray(r),n=Array.isArray(e),s=a===n;return s?a?t.arrayMerge(e,r,t):C(e,r,t):o(r,t)}i.all=function(r,t){if(!Array.isArray(r))throw new Error("first argument should be an array");return r.reduce(function(a,n){return i(a,n,t)},{})};var L=i,N=L;const R=w(N),D={AddressValidation:{title:"Verify your address",subtitle:"To ensure accurate delivery, we suggest the changes highlighted below. Please choose which address you would like to use. If neither option is correct, edit your address.",suggestedAddress:"Suggested Address",originalAddress:"Original Address"},BillToShippingAddress:{cartSyncError:"We were unable to save your changes. Please try again later.",title:"Bill to shipping address"},EmptyCart:{button:"Start shopping",title:"Your cart is empty"},EstimateShipping:{estimated:"Estimated Shipping",freeShipping:"Free",label:"Shipping",taxToBeDetermined:"TBD",withoutTaxes:"Excluding taxes",withTaxes:"Including taxes"},LoginForm:{account:"Already have an account?",ariaLabel:"Email",emailExists:{alreadyHaveAccount:"It looks like you already have an account.",forFasterCheckout:"for a faster checkout.",signInButton:"Sign in"},floatingLabel:"Email *",invalidEmailError:"Please enter a valid email address.",missingEmailError:"Enter an email address.",cartSyncError:"We were unable to save your changes. Please try again later.",placeholder:"Enter your email address",signIn:"Sign In",signOut:"Sign Out",switch:"Do you want to switch account?",title:"Contact details"},MergedCartBanner:{items:{many:"{{count}} items from a previous session were added to your cart. Please review your new subtotal.",one:"1 item from a previous session was added to your cart. Please review your new subtotal."}},OutOfStock:{actions:{removeOutOfStock:"Remove out of stock items",reviewCart:"Review cart"},alert:"Out of stock!",lowInventory:{many:"Only {{count}} left!",one:"Last item!"},message:"The following items are out of stock:",title:"Your cart contains items that are out of stock"},PaymentMethods:{cartSyncError:"We were unable to save your changes. Please try again later.",emptyState:"No payment methods available",title:"Payment"},PaymentOnAccount:{referenceNumberLabel:"Custom Reference Number",referenceNumberPlaceholder:"Enter custom reference number",referenceNumberHint:"",availableCreditLabel:"Available Credit",exceedLimitWarning:"The credit limit is {{creditLimit}}. It will be exceeded by {{exceededAmount}} with this order.",exceedLimitWarningPrefix:"The credit limit is",exceedLimitWarningMiddle:". It will be exceeded by",exceedLimitWarningSuffix:"with this order.",exceedLimitError:"Payment On Account cannot be used for this order because your order amount exceeds your credit amount."},PurchaseOrder:{missingReferenceNumberError:"Reference number is required",referenceNumberHint:"",referenceNumberLabel:"Custom Reference Number",referenceNumberPlaceholder:"Enter custom reference number"},PlaceOrder:{button:"Place Order"},ServerError:{button:"Try again",contactSupport:"If you continue to have issues, please contact support.",title:"We were unable to process your order",unexpected:"An unexpected error occurred while processing your order. Please try again later."},Quote:{permissionDenied:"You do not have permission to checkout with this quote.",dataError:"We were unable to retrieve the quote data. Please try again later."},ShippingMethods:{cartSyncError:"We were unable to save your changes. Please try again later.",emptyState:"This order can't be shipped to the address provided. Please review the address details you entered and make sure they're correct.",title:"Shipping options"},Summary:{Edit:"Edit"},TermsAndConditions:{error:"Please accept the Terms and Conditions to continue.",label:"I have read, understand, and accept our <a href='https://www.adobe.com/legal/terms.html' target='_blank'>Terms of Use, Terms of Sales, Privacy Policy, and Return Policy</a>."},title:"Checkout"},W={Checkout:D},_={default:W},k=({children:e})=>{var s;const[r,t]=h(),a=(s=y.getConfig())==null?void 0:s.langDefinitions;p(()=>{const c=g.on("locale",u=>{u!==r&&t(u)},{eager:!0});return()=>{c==null||c.off()}},[r]);const n=R(_,a??{});return d(b,{lang:r,langDefinitions:n,children:e})},$=new f(d(k,{}));export{k as P,$ as r};
|
|
10
10
|
//# sourceMappingURL=render.js.map
|
package/chunks/render.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"render.js","sources":["../../node_modules/deepmerge/dist/cjs.js","/@dropins/storefront-checkout/src/render/Provider.tsx","/@dropins/storefront-checkout/src/render/render.tsx"],"sourcesContent":["'use strict';\n\nvar isMergeableObject = function isMergeableObject(value) {\n\treturn isNonNullObject(value)\n\t\t&& !isSpecial(value)\n};\n\nfunction isNonNullObject(value) {\n\treturn !!value && typeof value === 'object'\n}\n\nfunction isSpecial(value) {\n\tvar stringValue = Object.prototype.toString.call(value);\n\n\treturn stringValue === '[object RegExp]'\n\t\t|| stringValue === '[object Date]'\n\t\t|| isReactElement(value)\n}\n\n// see https://github.com/facebook/react/blob/b5ac963fb791d1298e7f396236383bc955f916c1/src/isomorphic/classic/element/ReactElement.js#L21-L25\nvar canUseSymbol = typeof Symbol === 'function' && Symbol.for;\nvar REACT_ELEMENT_TYPE = canUseSymbol ? Symbol.for('react.element') : 0xeac7;\n\nfunction isReactElement(value) {\n\treturn value.$$typeof === REACT_ELEMENT_TYPE\n}\n\nfunction emptyTarget(val) {\n\treturn Array.isArray(val) ? [] : {}\n}\n\nfunction cloneUnlessOtherwiseSpecified(value, options) {\n\treturn (options.clone !== false && options.isMergeableObject(value))\n\t\t? deepmerge(emptyTarget(value), value, options)\n\t\t: value\n}\n\nfunction defaultArrayMerge(target, source, options) {\n\treturn target.concat(source).map(function(element) {\n\t\treturn cloneUnlessOtherwiseSpecified(element, options)\n\t})\n}\n\nfunction getMergeFunction(key, options) {\n\tif (!options.customMerge) {\n\t\treturn deepmerge\n\t}\n\tvar customMerge = options.customMerge(key);\n\treturn typeof customMerge === 'function' ? customMerge : deepmerge\n}\n\nfunction getEnumerableOwnPropertySymbols(target) {\n\treturn Object.getOwnPropertySymbols\n\t\t? Object.getOwnPropertySymbols(target).filter(function(symbol) {\n\t\t\treturn Object.propertyIsEnumerable.call(target, symbol)\n\t\t})\n\t\t: []\n}\n\nfunction getKeys(target) {\n\treturn Object.keys(target).concat(getEnumerableOwnPropertySymbols(target))\n}\n\nfunction propertyIsOnObject(object, property) {\n\ttry {\n\t\treturn property in object\n\t} catch(_) {\n\t\treturn false\n\t}\n}\n\n// Protects from prototype poisoning and unexpected merging up the prototype chain.\nfunction propertyIsUnsafe(target, key) {\n\treturn propertyIsOnObject(target, key) // Properties are safe to merge if they don't exist in the target yet,\n\t\t&& !(Object.hasOwnProperty.call(target, key) // unsafe if they exist up the prototype chain,\n\t\t\t&& Object.propertyIsEnumerable.call(target, key)) // and also unsafe if they're nonenumerable.\n}\n\nfunction mergeObject(target, source, options) {\n\tvar destination = {};\n\tif (options.isMergeableObject(target)) {\n\t\tgetKeys(target).forEach(function(key) {\n\t\t\tdestination[key] = cloneUnlessOtherwiseSpecified(target[key], options);\n\t\t});\n\t}\n\tgetKeys(source).forEach(function(key) {\n\t\tif (propertyIsUnsafe(target, key)) {\n\t\t\treturn\n\t\t}\n\n\t\tif (propertyIsOnObject(target, key) && options.isMergeableObject(source[key])) {\n\t\t\tdestination[key] = getMergeFunction(key, options)(target[key], source[key], options);\n\t\t} else {\n\t\t\tdestination[key] = cloneUnlessOtherwiseSpecified(source[key], options);\n\t\t}\n\t});\n\treturn destination\n}\n\nfunction deepmerge(target, source, options) {\n\toptions = options || {};\n\toptions.arrayMerge = options.arrayMerge || defaultArrayMerge;\n\toptions.isMergeableObject = options.isMergeableObject || isMergeableObject;\n\t// cloneUnlessOtherwiseSpecified is added to `options` so that custom arrayMerge()\n\t// implementations can use it. The caller may not replace it.\n\toptions.cloneUnlessOtherwiseSpecified = cloneUnlessOtherwiseSpecified;\n\n\tvar sourceIsArray = Array.isArray(source);\n\tvar targetIsArray = Array.isArray(target);\n\tvar sourceAndTargetTypesMatch = sourceIsArray === targetIsArray;\n\n\tif (!sourceAndTargetTypesMatch) {\n\t\treturn cloneUnlessOtherwiseSpecified(source, options)\n\t} else if (sourceIsArray) {\n\t\treturn options.arrayMerge(target, source, options)\n\t} else {\n\t\treturn mergeObject(target, source, options)\n\t}\n}\n\ndeepmerge.all = function deepmergeAll(array, options) {\n\tif (!Array.isArray(array)) {\n\t\tthrow new Error('first argument should be an array')\n\t}\n\n\treturn array.reduce(function(prev, next) {\n\t\treturn deepmerge(prev, next, options)\n\t}, {})\n};\n\nvar deepmerge_1 = deepmerge;\n\nmodule.exports = deepmerge_1;\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 { config } from '@/checkout/api';\nimport { UIProvider } from '@adobe-commerce/elsie/components';\nimport { Lang } from '@adobe-commerce/elsie/i18n';\nimport { deepmerge } from '@adobe-commerce/elsie/lib/deepmerge';\nimport { events } from '@adobe-commerce/event-bus';\nimport { FunctionComponent } from 'preact';\nimport { useEffect, useState } from 'preact/hooks';\n\nimport en_US from '../i18n/en_US.json';\n\n// Langs\nconst langDefinitions = {\n default: en_US,\n};\n\ninterface IntlProviderProps {\n children?: any;\n}\n\nexport const Provider: FunctionComponent<IntlProviderProps> = ({\n children,\n}) => {\n const [locale, setLang] = useState<Lang>();\n\n const userLangDefinitions = config.getConfig()?.langDefinitions;\n\n useEffect(() => {\n const localeEvent = events.on(\n 'locale',\n (payload) => {\n if (payload !== locale) setLang(payload as Lang);\n },\n { eager: true }\n );\n return () => {\n localeEvent?.off();\n };\n }, [locale]);\n\n // Merge language definitions with user language definitions\n const definitions = deepmerge(langDefinitions, userLangDefinitions ?? {});\n\n return (\n <UIProvider lang={locale} langDefinitions={definitions}>\n {children}\n </UIProvider>\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 { Render } from '@adobe-commerce/elsie/lib';\nimport { Provider } from './Provider';\nexport { Provider };\nexport const render = new Render(<Provider />);\n"],"names":["isMergeableObject","value","isNonNullObject","isSpecial","stringValue","isReactElement","canUseSymbol","REACT_ELEMENT_TYPE","emptyTarget","val","cloneUnlessOtherwiseSpecified","options","deepmerge","defaultArrayMerge","target","source","element","getMergeFunction","key","customMerge","getEnumerableOwnPropertySymbols","symbol","getKeys","propertyIsOnObject","object","property","propertyIsUnsafe","mergeObject","destination","sourceIsArray","targetIsArray","sourceAndTargetTypesMatch","array","prev","next","deepmerge_1","cjs","langDefinitions","en_US","Provider","children","locale","setLang","useState","userLangDefinitions","_a","config","useEffect","localeEvent","events","payload","definitions","UIProvider","render","Render","jsx"],"mappings":"8cAEA,IAAIA,EAAoB,SAA2BC,EAAO,CACzD,OAAOC,EAAgBD,CAAK,GACxB,CAACE,EAAUF,CAAK,CACrB,EAEA,SAASC,EAAgBD,EAAO,CAC/B,MAAO,CAAC,CAACA,GAAS,OAAOA,GAAU,QACpC,CAEA,SAASE,EAAUF,EAAO,CACzB,IAAIG,EAAc,OAAO,UAAU,SAAS,KAAKH,CAAK,EAEtD,OAAOG,IAAgB,mBACnBA,IAAgB,iBAChBC,EAAeJ,CAAK,CACzB,CAGA,IAAIK,EAAe,O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B,EAAiBD,8iHCxGXE,EAAkB,CACtB,QAASC,CACX,EAMaC,EAAiD,CAAC,CAC7D,SAAAC,CACF,IAAM,OACJ,KAAM,CAACC,EAAQC,CAAO,EAAIC,EAAe,EAEnCC,GAAsBC,EAAAC,EAAO,UAAA,IAAP,YAAAD,EAAoB,gBAEhDE,EAAU,IAAM,CACd,MAAMC,EAAcC,EAAO,GACzB,SACCC,GAAY,CACPA,IAAYT,GAAQC,EAAQQ,CAAe,CACjD,EACA,CAAE,MAAO,EAAK,CAChB,EACA,MAAO,IAAM,CACXF,GAAA,MAAAA,EAAa,KACf,CAAA,EACC,CAACP,CAAM,CAAC,EAGX,MAAMU,EAAcvC,EAAUyB,EAAiBO,GAAuB,CAAA,CAAE,EAExE,SACGQ,EAAW,CAAA,KAAMX,EAAQ,gBAAiBU,EACxC,SAAAX,EACH,CAEJ,EC5Caa,EAAS,IAAIC,EAAOC,EAAChB,IAAS,CAAE","x_google_ignoreList":[0]}
|
|
1
|
+
{"version":3,"file":"render.js","sources":["../../node_modules/deepmerge/dist/cjs.js","/@dropins/storefront-checkout/src/render/Provider.tsx","/@dropins/storefront-checkout/src/render/render.tsx"],"sourcesContent":["'use strict';\n\nvar isMergeableObject = function isMergeableObject(value) {\n\treturn isNonNullObject(value)\n\t\t&& !isSpecial(value)\n};\n\nfunction isNonNullObject(value) {\n\treturn !!value && typeof value === 'object'\n}\n\nfunction isSpecial(value) {\n\tvar stringValue = Object.prototype.toString.call(value);\n\n\treturn stringValue === '[object RegExp]'\n\t\t|| stringValue === '[object Date]'\n\t\t|| isReactElement(value)\n}\n\n// see https://github.com/facebook/react/blob/b5ac963fb791d1298e7f396236383bc955f916c1/src/isomorphic/classic/element/ReactElement.js#L21-L25\nvar canUseSymbol = typeof Symbol === 'function' && Symbol.for;\nvar REACT_ELEMENT_TYPE = canUseSymbol ? Symbol.for('react.element') : 0xeac7;\n\nfunction isReactElement(value) {\n\treturn value.$$typeof === REACT_ELEMENT_TYPE\n}\n\nfunction emptyTarget(val) {\n\treturn Array.isArray(val) ? [] : {}\n}\n\nfunction cloneUnlessOtherwiseSpecified(value, options) {\n\treturn (options.clone !== false && options.isMergeableObject(value))\n\t\t? deepmerge(emptyTarget(value), value, options)\n\t\t: value\n}\n\nfunction defaultArrayMerge(target, source, options) {\n\treturn target.concat(source).map(function(element) {\n\t\treturn cloneUnlessOtherwiseSpecified(element, options)\n\t})\n}\n\nfunction getMergeFunction(key, options) {\n\tif (!options.customMerge) {\n\t\treturn deepmerge\n\t}\n\tvar customMerge = options.customMerge(key);\n\treturn typeof customMerge === 'function' ? customMerge : deepmerge\n}\n\nfunction getEnumerableOwnPropertySymbols(target) {\n\treturn Object.getOwnPropertySymbols\n\t\t? Object.getOwnPropertySymbols(target).filter(function(symbol) {\n\t\t\treturn Object.propertyIsEnumerable.call(target, symbol)\n\t\t})\n\t\t: []\n}\n\nfunction getKeys(target) {\n\treturn Object.keys(target).concat(getEnumerableOwnPropertySymbols(target))\n}\n\nfunction propertyIsOnObject(object, property) {\n\ttry {\n\t\treturn property in object\n\t} catch(_) {\n\t\treturn false\n\t}\n}\n\n// Protects from prototype poisoning and unexpected merging up the prototype chain.\nfunction propertyIsUnsafe(target, key) {\n\treturn propertyIsOnObject(target, key) // Properties are safe to merge if they don't exist in the target yet,\n\t\t&& !(Object.hasOwnProperty.call(target, key) // unsafe if they exist up the prototype chain,\n\t\t\t&& Object.propertyIsEnumerable.call(target, key)) // and also unsafe if they're nonenumerable.\n}\n\nfunction mergeObject(target, source, options) {\n\tvar destination = {};\n\tif (options.isMergeableObject(target)) {\n\t\tgetKeys(target).forEach(function(key) {\n\t\t\tdestination[key] = cloneUnlessOtherwiseSpecified(target[key], options);\n\t\t});\n\t}\n\tgetKeys(source).forEach(function(key) {\n\t\tif (propertyIsUnsafe(target, key)) {\n\t\t\treturn\n\t\t}\n\n\t\tif (propertyIsOnObject(target, key) && options.isMergeableObject(source[key])) {\n\t\t\tdestination[key] = getMergeFunction(key, options)(target[key], source[key], options);\n\t\t} else {\n\t\t\tdestination[key] = cloneUnlessOtherwiseSpecified(source[key], options);\n\t\t}\n\t});\n\treturn destination\n}\n\nfunction deepmerge(target, source, options) {\n\toptions = options || {};\n\toptions.arrayMerge = options.arrayMerge || defaultArrayMerge;\n\toptions.isMergeableObject = options.isMergeableObject || isMergeableObject;\n\t// cloneUnlessOtherwiseSpecified is added to `options` so that custom arrayMerge()\n\t// implementations can use it. The caller may not replace it.\n\toptions.cloneUnlessOtherwiseSpecified = cloneUnlessOtherwiseSpecified;\n\n\tvar sourceIsArray = Array.isArray(source);\n\tvar targetIsArray = Array.isArray(target);\n\tvar sourceAndTargetTypesMatch = sourceIsArray === targetIsArray;\n\n\tif (!sourceAndTargetTypesMatch) {\n\t\treturn cloneUnlessOtherwiseSpecified(source, options)\n\t} else if (sourceIsArray) {\n\t\treturn options.arrayMerge(target, source, options)\n\t} else {\n\t\treturn mergeObject(target, source, options)\n\t}\n}\n\ndeepmerge.all = function deepmergeAll(array, options) {\n\tif (!Array.isArray(array)) {\n\t\tthrow new Error('first argument should be an array')\n\t}\n\n\treturn array.reduce(function(prev, next) {\n\t\treturn deepmerge(prev, next, options)\n\t}, {})\n};\n\nvar deepmerge_1 = deepmerge;\n\nmodule.exports = deepmerge_1;\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 { config } from '@/checkout/api';\nimport { UIProvider } from '@adobe-commerce/elsie/components';\nimport { Lang } from '@adobe-commerce/elsie/i18n';\nimport { deepmerge } from '@adobe-commerce/elsie/lib/deepmerge';\nimport { events } from '@adobe-commerce/event-bus';\nimport { FunctionComponent } from 'preact';\nimport { useEffect, useState } from 'preact/hooks';\n\nimport en_US from '../i18n/en_US.json';\n\n// Langs\nconst langDefinitions = {\n default: en_US,\n};\n\ninterface IntlProviderProps {\n children?: any;\n}\n\nexport const Provider: FunctionComponent<IntlProviderProps> = ({\n children,\n}) => {\n const [locale, setLang] = useState<Lang>();\n\n const userLangDefinitions = config.getConfig()?.langDefinitions;\n\n useEffect(() => {\n const localeEvent = events.on(\n 'locale',\n (payload) => {\n if (payload !== locale) setLang(payload as Lang);\n },\n { eager: true }\n );\n return () => {\n localeEvent?.off();\n };\n }, [locale]);\n\n // Merge language definitions with user language definitions\n const definitions = deepmerge(langDefinitions, userLangDefinitions ?? {});\n\n return (\n <UIProvider lang={locale} langDefinitions={definitions}>\n {children}\n </UIProvider>\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 { Render } from '@adobe-commerce/elsie/lib';\nimport { Provider } from './Provider';\nexport { Provider };\nexport const render = new Render(<Provider />);\n"],"names":["isMergeableObject","value","isNonNullObject","isSpecial","stringValue","isReactElement","canUseSymbol","REACT_ELEMENT_TYPE","emptyTarget","val","cloneUnlessOtherwiseSpecified","options","deepmerge","defaultArrayMerge","target","source","element","getMergeFunction","key","customMerge","getEnumerableOwnPropertySymbols","symbol","getKeys","propertyIsOnObject","object","property","propertyIsUnsafe","mergeObject","destination","sourceIsArray","targetIsArray","sourceAndTargetTypesMatch","array","prev","next","deepmerge_1","cjs","langDefinitions","en_US","Provider","children","locale","setLang","useState","userLangDefinitions","_a","config","useEffect","localeEvent","events","payload","defin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WG,EAAQC,EAAQJ,CAAO,EAE1CgB,EAAYb,EAAQC,EAAQJ,CAAO,EAJnCD,EAA8BK,EAAQJ,CAAO,CAMtD,CAEAC,EAAU,IAAM,SAAsBoB,EAAOrB,EAAS,CACrD,GAAI,CAAC,MAAM,QAAQqB,CAAK,EACvB,MAAM,IAAI,MAAM,mCAAmC,EAGpD,OAAOA,EAAM,OAAO,SAASC,EAAMC,EAAM,CACxC,OAAOtB,EAAUqB,EAAMC,EAAMvB,CAAO,CACtC,EAAI,CAAE,CAAA,CACN,EAEA,IAAIwB,EAAcvB,EAElBwB,EAAiBD,ymHCxGXE,EAAkB,CACtB,QAASC,CACX,EAMaC,EAAiD,CAAC,CAC7D,SAAAC,CACF,IAAM,OACJ,KAAM,CAACC,EAAQC,CAAO,EAAIC,EAAe,EAEnCC,GAAsBC,EAAAC,EAAO,UAAA,IAAP,YAAAD,EAAoB,gBAEhDE,EAAU,IAAM,CACd,MAAMC,EAAcC,EAAO,GACzB,SACCC,GAAY,CACPA,IAAYT,GAAQC,EAAQQ,CAAe,CACjD,EACA,CAAE,MAAO,EAAK,CAChB,EACA,MAAO,IAAM,CACXF,GAAA,MAAAA,EAAa,KACf,CAAA,EACC,CAACP,CAAM,CAAC,EAGX,MAAMU,EAAcvC,EAAUyB,EAAiBO,GAAuB,CAAA,CAAE,EAExE,SACGQ,EAAW,CAAA,KAAMX,EAAQ,gBAAiBU,EACxC,SAAAX,EACH,CAEJ,EC5Caa,EAAS,IAAIC,EAAOC,EAAChB,IAAS,CAAE","x_google_ignoreList":[0]}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
/*! Copyright 2025 Adobe
|
|
2
2
|
All Rights Reserved. */
|
|
3
|
-
import{s as r,n as Q,d as y,U as N,t as D,e as S}from"./fetch-graphql.js";import{merge as k,Initializer as z,deepmerge as G}from"@dropins/tools/lib.js";import{events as d}from"@dropins/tools/event-bus.js";import{CHECKOUT_DATA_FRAGMENT as
|
|
3
|
+
import{s as r,n as Q,d as y,U as N,t as D,e as S}from"./fetch-graphql.js";import{merge as k,Initializer as z,deepmerge as G}from"@dropins/tools/lib.js";import{events as d}from"@dropins/tools/event-bus.js";import{CHECKOUT_DATA_FRAGMENT as _,NEGOTIABLE_QUOTE_FRAGMENT as O}from"../fragments.js";import{b as R,c as U,d as P,a as L,e as x,f as B,g as $}from"./transform-shipping-methods.js";import{E as g}from"./classifiers.js";const F=async(e=!1)=>{r.authenticated=e},C=e=>{if(!e)return;const{code:t,title:i,...s}=e;return{code:t,title:i,additionalData:s}},b=e=>{if(e)return e.filter(t=>!!t).map(t=>{const{code:i,title:s,...c}=t;return{code:i,title:s,additionalData:c}})},H=e=>{var i,s,c;if(!e)return;const t={availablePaymentMethods:b(e.available_payment_methods),billingAddress:U(e.billing_address),email:e.email??void 0,id:e.id,isEmpty:e.total_quantity===0,isVirtual:e.is_virtual,selectedPaymentMethod:C(e.selected_payment_method),shippingAddresses:R(e.shipping_addresses),isGuest:!r.authenticated};return k(t,(c=(s=(i=te.getConfig().models)==null?void 0:i.CartModel)==null?void 0:s.transformer)==null?void 0:c.call(s,e))},q=e=>{const t=e.street.filter(Boolean);return{city:e.city,company:e.company||void 0,country:$(e.country),customAttributes:B(e.custom_attributes),customerAddressUid:e.customer_address_uid||void 0,fax:e.fax||void 0,firstName:e.firstname,lastName:e.lastname,middleName:e.middlename||void 0,postCode:e.postcode||void 0,prefix:e.prefix||void 0,region:x(e.region),street:t,suffix:e.suffix||void 0,telephone:e.telephone||void 0,uid:e.uid,vatId:e.vat_id||void 0}},K=e=>{if(e)return q(e)},V=e=>e.filter(t=>!!t).map(t=>{const{available_shipping_methods:i,selected_shipping_method:s,...c}=t;return{...q(c),availableShippingMethods:L(i),selectedShippingMethod:P(s)}}),W=e=>e?{availablePaymentMethods:b(e.available_payment_methods),billingAddress:K(e.billing_address),email:e.email??"",isEmpty:e.total_quantity===0,isVirtual:e.is_virtual,name:e.name,selectedPaymentMethod:C(e.selected_payment_method),shippingAddresses:V(e.shipping_addresses),status:e.status,uid:e.uid}:null,Y=`
|
|
4
4
|
query getCart($cartId: String!) {
|
|
5
5
|
cart(cart_id: $cartId) {
|
|
6
6
|
...CHECKOUT_DATA_FRAGMENT
|
|
7
7
|
}
|
|
8
8
|
}
|
|
9
9
|
|
|
10
|
-
${
|
|
10
|
+
${_}
|
|
11
11
|
`,j=`
|
|
12
12
|
query getCustomerCart {
|
|
13
13
|
cart: customerCart {
|
|
@@ -15,8 +15,8 @@ import{s as r,n as Q,d as y,U as N,t as D,e as S}from"./fetch-graphql.js";import
|
|
|
15
15
|
}
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
-
${
|
|
19
|
-
`,
|
|
18
|
+
${_}
|
|
19
|
+
`,A=async()=>{const e=r.cartId,t=r.authenticated===!1,i=t?Y:j,s=t?{cartId:e}:{};if(t&&!e)throw new Q;return await y({type:"query",query:i,options:{method:"POST",cache:"no-cache",variables:s},path:"cart",transformer:H})},J=`
|
|
20
20
|
query getNegotiableQuote($quoteId: ID!) {
|
|
21
21
|
negotiableQuote(uid: $quoteId) {
|
|
22
22
|
...NEGOTIABLE_QUOTE_FRAGMENT
|
|
@@ -24,5 +24,5 @@ import{s as r,n as Q,d as y,U as N,t as D,e as S}from"./fetch-graphql.js";import
|
|
|
24
24
|
}
|
|
25
25
|
|
|
26
26
|
${O}
|
|
27
|
-
`,
|
|
27
|
+
`,I=async(e={})=>{const t=e.uid??r.quoteId;if(r.authenticated===!1)throw new N;if(!t)throw new D;return await y({type:"query",query:J,options:{method:"GET",cache:"no-cache",variables:{quoteId:t}},path:"negotiableQuote",transformer:W})},m={eager:!0},X=e=>{var f,p;const t=((p=(f=e==null?void 0:e.features)==null?void 0:f.b2b)==null?void 0:p.quotes)??!1;return[["authenticated",(u=!1)=>{var o,a,l;if(F(u),!t||u)return;const n=(l=(a=(o=e==null?void 0:e.features)==null?void 0:o.b2b)==null?void 0:a.routeLogin)==null?void 0:l.call(a);n&&window.location.assign(n)},m],...t?[["quote-management/quote-data/initialized",u=>{var n,o,a,l;if(!u.quote.canCheckout){const M=((l=(a=(o=(n=e==null?void 0:e.langDefinitions)==null?void 0:n.default)==null?void 0:o.Checkout)==null?void 0:a.Quote)==null?void 0:l.permissionDenied)||"You do not have permission to checkout with this quote.";d.emit("checkout/error",{message:M,code:g.QUOTE_PERMISSION_DENIED});return}h(u.quote)},m],["quote-management/quote-data/error",()=>{var n,o,a,l;const u=((l=(a=(o=(n=e==null?void 0:e.langDefinitions)==null?void 0:n.default)==null?void 0:o.Checkout)==null?void 0:a.Quote)==null?void 0:l.dataError)||"We were unable to retrieve the quote data. Please try again later.";d.emit("checkout/error",{message:u,code:g.QUOTE_DATA_ERROR})}]]:[["cart/initialized",h,m],["cart/reset",w],["cart/updated",T]]].map(([u,n,o])=>d.on(u,n,o))},Z=new URL(window.location.href),ee=Z.searchParams.get("quoteId");r.quoteId=ee;const v=new z({init:async(e={})=>{v.config.setConfig(G({defaults:{isBillToShipping:!0,selectedShippingMethod:t=>t.length>0?t[0]:null},features:{b2b:{quotes:!1}}},e))},listeners:X}),te=v.config,E=e=>"id"in e,re=async e=>{try{return E(e)?(r.cartId=e.id,r.quoteId=null,await A()??null):(r.cartId=null,r.quoteId=e.uid,await I()??null)}catch(t){return console.error("Checkout initialization failed:",t),null}},h=async e=>{if(r.initialized){await T(e);return}r.config||(r.config=await S());const t=e?await re(e):null;r.initialized=!0,d.emit("checkout/initialized",t)},w=()=>{r.initialized&&(r.cartId=null,r.quoteId=null,d.emit("checkout/updated",null))},se=async e=>{try{return E(e)?(r.cartId=e.id,r.quoteId=null,await A()??null):(r.cartId=null,r.quoteId=e.uid,await I()??null)}catch(t){return console.error("Checkout synchronization failed:",t),null}},T=async e=>{if(!r.initialized)return h(e);if(e===null){w();return}const t=await se(e);d.emit("checkout/updated",t)};export{F as a,I as b,te as c,h as d,W as e,A as g,v as i,w as r,T as s,H as t};
|
|
28
28
|
//# sourceMappingURL=synchronizeCheckout.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"synchronizeCheckout.js","sources":["/@dropins/storefront-checkout/src/api/authenticateCustomer/authenticateCustomer.ts","/@dropins/storefront-checkout/src/data/transforms/transform-payment-methods.ts","/@dropins/storefront-checkout/src/data/transforms/transform-cart.ts","/@dropins/storefront-checkout/src/data/transforms/transform-quote-address.ts","/@dropins/storefront-checkout/src/data/transforms/transform-negotiable-quote.ts","/@dropins/storefront-checkout/src/api/getCart/graphql/getCart.graphql.ts","/@dropins/storefront-checkout/src/api/getCart/getCart.ts","/@dropins/storefront-checkout/src/api/getNegotiableQuote/graphql/getNegotiableQuote.graphql.ts","/@dropins/storefront-checkout/src/api/getNegotiableQuote/getNegotiableQuote.ts","/@dropins/storefront-checkout/src/api/initialize/listeners.ts","/@dropins/storefront-checkout/src/api/initialize/initialize.ts","/@dropins/storefront-checkout/src/types/guards.ts","/@dropins/storefront-checkout/src/api/initializeCheckout/initializeCheckout.ts","/@dropins/storefront-checkout/src/api/resetCheckout/resetCheckout.ts","/@dropins/storefront-checkout/src/api/synchronizeCheckout/synchronizeCheckout.ts"],"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 { state } from '@/checkout/lib/state';\n\nexport const authenticateCustomer = async (authenticated = false) => {\n state.authenticated = authenticated;\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 { PaymentMethod } from '@/checkout/data/models/payment-method';\nimport { GetCartQuery } from '@/checkout/__generated__/types';\n\ntype SelectedPaymentMethod = NonNullable<\n GetCartQuery['cart']\n>['selected_payment_method'];\n\ntype AvailablePaymentMethods = NonNullable<\n GetCartQuery['cart']\n>['available_payment_methods'];\n\ntype AvailablePaymentMethod = NonNullable<AvailablePaymentMethods>[number];\n\ntype NonNullabePaymentMethod = NonNullable<AvailablePaymentMethod>;\n\nconst transformSelectedPaymentMethod = (\n data: SelectedPaymentMethod\n): PaymentMethod | undefined => {\n if (!data) return;\n const { code, title, ...additionalData } = data;\n return { code, title, additionalData };\n};\n\nconst transformAvailablePaymentMethods = (\n data: AvailablePaymentMethods\n): PaymentMethod[] | undefined => {\n if (!data) return;\n\n return data\n .filter((method) => !!method)\n .map((method) => {\n const { code, title, ...additionalData } =\n method as NonNullabePaymentMethod;\n return { code, title, additionalData };\n });\n};\n\nexport { transformAvailablePaymentMethods, transformSelectedPaymentMethod };\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 { config } from '@/checkout/api';\nimport { Cart as CartModel } from '@/checkout/data/models';\nimport {\n transformAvailablePaymentMethods,\n transformSelectedPaymentMethod,\n} from '@/checkout/data/transforms/transform-payment-methods';\nimport { GetCartQuery } from '@/checkout/__generated__/types';\nimport { merge } from '@adobe-commerce/elsie/lib';\n\nimport {\n transformCartBillingAddress,\n transformCartShippingAddress,\n} from '@/checkout/data/transforms/transform-cart-address';\nimport { state } from '@/checkout/lib/state';\n\ntype Cart = GetCartQuery['cart'];\n\nconst transformCart = (data: Cart): CartModel | undefined => {\n if (!data) return;\n\n const model = {\n availablePaymentMethods: transformAvailablePaymentMethods(\n data.available_payment_methods\n ),\n billingAddress: transformCartBillingAddress(data.billing_address),\n email: data.email ?? undefined,\n id: data.id,\n isEmpty: data.total_quantity === 0,\n isVirtual: data.is_virtual,\n selectedPaymentMethod: transformSelectedPaymentMethod(\n data.selected_payment_method\n ),\n shippingAddresses: transformCartShippingAddress(data.shipping_addresses),\n isGuest: !state.authenticated,\n };\n\n // Extend the model merging custom transformer, if provided\n return merge(\n model, // default transformer\n config.getConfig().models?.CartModel?.transformer?.(data) // custom transformer\n );\n};\n\nexport { Cart, transformCart };\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 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 {\n Address as AddressModel,\n ShippingAddress as ShippingAddressModel,\n} from '@/checkout/data/models';\n\nimport {\n transformAddressCountry,\n transformAddressRegion,\n transformCustomAttributes,\n transformSelectedShippingMethod,\n transformShippingMethods,\n} from '@/checkout/data/transforms';\nimport { GetNegotiableQuoteQuery } from '@/checkout/__generated__/types';\n\ntype QuoteShippingAddresses = NonNullable<\n GetNegotiableQuoteQuery['negotiableQuote']\n>['shipping_addresses'];\ntype QuoteShippingAddress = QuoteShippingAddresses[0];\ntype NonNullableShippingAddress = NonNullable<QuoteShippingAddress>;\n\ntype QuoteBillingAddress = NonNullable<\n GetNegotiableQuoteQuery['negotiableQuote']\n>['billing_address'];\ntype NonNullableBillingAddress = NonNullable<QuoteBillingAddress>;\n\nconst transformAddress = (\n data: NonNullableShippingAddress | NonNullableBillingAddress\n): AddressModel => {\n const street = data.street.filter(Boolean) as string[];\n\n return {\n city: data.city,\n company: data.company || undefined,\n country: transformAddressCountry(data.country),\n customAttributes: transformCustomAttributes(data.custom_attributes),\n fax: data.fax || undefined,\n firstName: data.firstname,\n lastName: data.lastname,\n middleName: data.middlename || undefined,\n postCode: data.postcode || undefined,\n prefix: data.prefix || undefined,\n region: transformAddressRegion(data.region),\n street,\n suffix: data.suffix || undefined,\n telephone: data.telephone || undefined,\n uid: data.uid,\n vatId: data.vat_id || undefined,\n };\n};\n\nconst transformQuoteBillingAddress = (\n data: QuoteBillingAddress\n): AddressModel | undefined => {\n if (!data) return;\n return transformAddress(data);\n};\n\nconst transformQuoteShippingAddress = (\n data: QuoteShippingAddresses\n): ShippingAddressModel[] => {\n return data\n .filter((address) => !!address)\n .map((address) => {\n const {\n available_shipping_methods,\n selected_shipping_method,\n ...baseData\n } = address as NonNullableShippingAddress;\n\n return {\n ...transformAddress(baseData as NonNullableShippingAddress),\n availableShippingMethods: transformShippingMethods(\n available_shipping_methods\n ),\n selectedShippingMethod: transformSelectedShippingMethod(\n selected_shipping_method\n ),\n };\n });\n};\n\nexport {\n QuoteBillingAddress,\n QuoteShippingAddress,\n transformQuoteBillingAddress,\n transformQuoteShippingAddress,\n};\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 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 { NegotiableQuote as NegotiableQuoteModel } from '@/checkout/data/models/';\nimport { GetNegotiableQuoteQuery } from '@/checkout/__generated__/types';\n\nimport {\n transformAvailablePaymentMethods,\n transformQuoteBillingAddress,\n transformQuoteShippingAddress,\n transformSelectedPaymentMethod,\n} from '@/checkout/data/transforms';\n\ntype NegotiableQuote = GetNegotiableQuoteQuery['negotiableQuote'];\n\nexport const transformNegotiableQuote = (\n data: NegotiableQuote | undefined\n): NegotiableQuoteModel | null => {\n if (!data) return null;\n\n return {\n availablePaymentMethods: transformAvailablePaymentMethods(\n data.available_payment_methods\n ),\n billingAddress: transformQuoteBillingAddress(data.billing_address),\n email: data.email ?? '',\n isEmpty: data.total_quantity === 0,\n isVirtual: data.is_virtual,\n name: data.name,\n selectedPaymentMethod: transformSelectedPaymentMethod(\n data.selected_payment_method\n ),\n shippingAddresses: transformQuoteShippingAddress(data.shipping_addresses),\n status: data.status,\n uid: data.uid,\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 { CHECKOUT_DATA_FRAGMENT } from '@/checkout/api/graphql/CheckoutDataFragment.graphql';\n\nexport const getCartQuery = /* GraphQL */ `\n query getCart($cartId: String!) {\n cart(cart_id: $cartId) {\n ...CHECKOUT_DATA_FRAGMENT\n }\n }\n\n ${CHECKOUT_DATA_FRAGMENT}\n`;\n\nexport const getCustomerCartQuery = /* GraphQL */ `\n query getCustomerCart {\n cart: customerCart {\n ...CHECKOUT_DATA_FRAGMENT\n }\n }\n\n ${CHECKOUT_DATA_FRAGMENT}\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 {\n getCartQuery,\n getCustomerCartQuery,\n} from '@/checkout/api/getCart/graphql';\nimport { transformCart } from '@/checkout/data/transforms';\nimport { dispatchApiCall } from '@/checkout/lib/dispatchApiCall';\nimport { state } from '@/checkout/lib';\nimport { MissingCart } from '@/checkout/lib/errors';\n\nexport const getCart = async () => {\n const cartId = state.cartId;\n const isGuest = state.authenticated === false;\n const query = isGuest ? getCartQuery : getCustomerCartQuery;\n const variables = isGuest ? { cartId } : {};\n\n if (isGuest && !cartId) throw new MissingCart();\n\n return await dispatchApiCall({\n type: 'query',\n query,\n options: { method: 'POST', cache: 'no-cache', variables },\n path: 'cart',\n transformer: transformCart,\n });\n};\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 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 { NEGOTIABLE_QUOTE_FRAGMENT } from '@/checkout/api/graphql/NegotiableQuoteFragment.graphql';\n\nexport const getNegotiableQuoteQuery = /* GraphQL */ `\n query getNegotiableQuote($quoteId: ID!) {\n negotiableQuote(uid: $quoteId) {\n ...NEGOTIABLE_QUOTE_FRAGMENT\n }\n }\n\n ${NEGOTIABLE_QUOTE_FRAGMENT}\n`;\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 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 { getNegotiableQuoteQuery } from '@/checkout/api/getNegotiableQuote/graphql';\nimport { transformNegotiableQuote as transformer } from '@/checkout/data/transforms';\nimport { state } from '@/checkout/lib';\nimport { dispatchApiCall } from '@/checkout/lib/dispatchApiCall';\nimport {\n MissingNegotiableQuoteId,\n Unauthenticated,\n} from '@/checkout/lib/errors';\n\ntype GetNegotiableQuoteInput = {\n uid?: string;\n};\n\nexport const getNegotiableQuote = async (\n input: GetNegotiableQuoteInput = {}\n) => {\n const quoteId = input.uid ?? state.quoteId;\n const isGuest = state.authenticated === false;\n\n if (isGuest) throw new Unauthenticated();\n if (!quoteId) throw new MissingNegotiableQuoteId();\n\n const variables = { quoteId };\n\n return await dispatchApiCall({\n type: 'query',\n query: getNegotiableQuoteQuery,\n options: { method: 'GET', cache: 'no-cache', variables },\n path: 'negotiableQuote',\n transformer,\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 {\n authenticateCustomer,\n ConfigProps,\n initializeCheckout,\n resetCheckout,\n synchronizeCheckout,\n} from '@/checkout/api';\nimport { ErrorCodes } from '@/checkout/lib/errors';\nimport { events, Events } from '@adobe-commerce/event-bus';\n\ntype Listener = [keyof Events, (...args: any[]) => void, { eager: boolean }?];\n\nconst asEager = { eager: true };\n\nexport const addCheckoutEventListeners = (config: ConfigProps | undefined) => {\n const useB2bQuotes = config?.features?.b2b?.quotes ?? false;\n\n const handleAuthenticated = (isAuthenticated = false) => {\n authenticateCustomer(isAuthenticated);\n\n if (!useB2bQuotes) return;\n if (isAuthenticated) return;\n\n const destination = config?.features?.b2b?.routeLogin?.();\n if (destination) {\n window.location.assign(destination);\n }\n };\n\n const cartListeners: Listener[] = [\n ['cart/initialized', initializeCheckout, asEager],\n ['cart/reset', resetCheckout],\n ['cart/updated', synchronizeCheckout],\n ];\n\n const quoteListeners: Listener[] = [\n [\n 'quote-management/quote-data/initialized',\n (data) => {\n if (!data.quote.canCheckout) {\n const message =\n config?.langDefinitions?.default?.Checkout?.Quote\n ?.permissionDenied ||\n 'You do not have permission to checkout with this quote.';\n events.emit('checkout/error', {\n message,\n code: ErrorCodes.QUOTE_PERMISSION_DENIED,\n });\n return;\n }\n\n initializeCheckout(data.quote);\n },\n asEager,\n ],\n [\n 'quote-management/quote-data/error',\n () => {\n const message =\n config?.langDefinitions?.default?.Checkout?.Quote?.dataError ||\n 'We were unable to retrieve the quote data. Please try again later.';\n events.emit('checkout/error', {\n message,\n code: ErrorCodes.QUOTE_DATA_ERROR,\n });\n },\n ],\n ];\n\n const listeners: Listener[] = [\n ['authenticated', handleAuthenticated, asEager],\n ...(useB2bQuotes ? quoteListeners : cartListeners),\n ];\n\n return listeners.map(([eventName, handler, options]) => {\n return events.on(eventName, handler, options);\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 { addCheckoutEventListeners } from '@/checkout/api/initialize/listeners';\nimport {\n Cart as CartModel,\n Customer as CustomerModel,\n ShippingMethod,\n} from '@/checkout/data/models';\nimport { state } from '@/checkout/lib';\nimport { Filter, Selector } from '@/checkout/types/utils';\nimport { definition } from '@adobe-commerce/elsie/i18n';\nimport { deepmerge, Initializer, Model } from '@adobe-commerce/elsie/lib';\n\nconst url = new URL(window.location.href);\nconst quoteId = url.searchParams.get('quoteId');\nstate.quoteId = quoteId;\n\nexport type ConfigProps = {\n defaults?: {\n isBillToShipping?: boolean;\n selectedShippingMethod?: Selector<ShippingMethod>;\n };\n shipping?: {\n filterOptions?: Filter<ShippingMethod>;\n };\n features?: {\n b2b?: {\n quotes?: boolean;\n routeLogin?: () => string | void;\n };\n };\n langDefinitions?: typeof definition & { default: { Checkout: any } };\n models?: {\n CartModel?: Model<CartModel>;\n CustomerModel?: Model<CustomerModel>;\n };\n};\n\nexport const initialize = new Initializer<ConfigProps>({\n init: async (_config = {}) => {\n initialize.config.setConfig(\n deepmerge(\n {\n defaults: {\n isBillToShipping: true,\n selectedShippingMethod: (options) => {\n return options.length > 0 ? options[0] : null;\n },\n },\n features: {\n b2b: { quotes: false },\n },\n },\n _config\n )\n );\n },\n listeners: addCheckoutEventListeners,\n});\n\nexport const config = initialize.config;\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 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 {\n CartModel,\n InitializeInput,\n NegotiableQuoteModel,\n SynchronizeInput,\n} from '@/checkout/types';\n\nexport const isCartInput = (\n input: NonNullable<InitializeInput | SynchronizeInput>\n): input is CartModel => {\n return 'id' in input;\n};\n\nexport const isNegotiableQuoteInput = (\n input: NonNullable<InitializeInput | SynchronizeInput>\n): input is NegotiableQuoteModel => {\n return 'uid' in input;\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 {\n getCart,\n getNegotiableQuote,\n getStoreConfig,\n synchronizeCheckout,\n} from '@/checkout/api';\nimport { state } from '@/checkout/lib';\nimport { InitializeInput, isCartInput } from '@/checkout/types';\nimport { events } from '@adobe-commerce/event-bus';\n\nconst getInitialData = async (input: NonNullable<InitializeInput>) => {\n try {\n if (isCartInput(input)) {\n state.cartId = input.id;\n state.quoteId = null;\n return (await getCart()) ?? null;\n }\n state.cartId = null;\n state.quoteId = input.uid;\n return (await getNegotiableQuote()) ?? null;\n } catch (error) {\n console.error('Checkout initialization failed:', error);\n return null;\n }\n};\n\nexport const initializeCheckout = async (input: InitializeInput) => {\n if (state.initialized) {\n await synchronizeCheckout(input);\n return;\n }\n\n if (!state.config) {\n state.config = await getStoreConfig();\n }\n\n const initialData = input ? await getInitialData(input) : null;\n\n state.initialized = true;\n events.emit('checkout/initialized', initialData);\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 { state } from '@/checkout/lib/state';\nimport { events } from '@adobe-commerce/event-bus';\n\nexport const resetCheckout = () => {\n if (!state.initialized) return;\n state.cartId = null;\n state.quoteId = null;\n events.emit('checkout/updated', null);\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 {\n getCart,\n getNegotiableQuote,\n initializeCheckout,\n resetCheckout,\n} from '@/checkout/api';\nimport { state } from '@/checkout/lib/state';\nimport { isCartInput, SynchronizeInput } from '@/checkout/types';\nimport { events } from '@adobe-commerce/event-bus';\n\nconst getSynchronizedData = async (input: NonNullable<SynchronizeInput>) => {\n try {\n if (isCartInput(input)) {\n state.cartId = input.id;\n state.quoteId = null;\n return (await getCart()) ?? null;\n }\n state.cartId = null;\n state.quoteId = input.uid;\n return (await getNegotiableQuote()) ?? null;\n } catch (error) {\n console.error('Checkout synchronization failed:', error);\n return null;\n }\n};\n\nexport const synchronizeCheckout = async (data: SynchronizeInput) => {\n if (!state.initialized) return initializeCheckout(data);\n\n if (data === null) {\n resetCheckout();\n return;\n }\n\n const update = await getSynchronizedData(data);\n\n events.emit('checkout/updated', update);\n};\n"],"names":["authenticateCustomer","authenticated","state","transformSelectedPaymentMethod","data","code","title","additionalData","transformAvailablePaymentMethods","method","transformCart","model","transformCartBillingAddress","transformCartShippingAddress","merge","_c","_b","_a","config","transformAddress","street","transformAddressCountry","transformCustomAttributes","transformAddressRegion","transformQuoteBillingAddress","transformQuoteShippingAddress","address","available_shipping_methods","selected_shipping_method","baseData","transformShippingMethods","transformSelectedShippingMethod","transformNegotiableQuote","getCartQuery","CHECKOUT_DATA_FRAGMENT","getCustomerCartQuery","getCart","cartId","isGuest","query","variables","MissingCart","dispatchApiCall","getNegotiableQuoteQuery","NEGOTIABLE_QUOTE_FRAGMENT","getNegotiableQuote","input","quoteId","Unauthenticated","MissingNegotiableQuoteId","transformer","asEager","addCheckoutEventListeners","useB2bQuotes","isAuthenticated","destination","message","_d","events","ErrorCodes","initializeCheckout","resetCheckout","synchronizeCheckout","eventName","handler","options","url","initialize","Initializer","_config","deepmerge","isCartInput","getInitialData","error","getStoreConfig","initialData","getSynchronizedData","update"],"mappings":"waAmBa,MAAAA,EAAuB,MAAOC,EAAgB,KAAU,CACnEC,EAAM,cAAgBD,CACxB,ECWME,EACJC,GAC8B,CAC9B,GAAI,CAACA,EAAM,OACX,KAAM,CAAE,KAAAC,EAAM,MAAAC,EAAO,GAAGC,CAAmB,EAAAH,EACpC,MAAA,CAAE,KAAAC,EAAM,MAAAC,EAAO,eAAAC,CAAe,CACvC,EAEMC,EACJJ,GACgC,CAChC,GAAKA,EAEE,OAAAA,EACJ,OAAQK,GAAW,CAAC,CAACA,CAAM,EAC3B,IAAKA,GAAW,CACf,KAAM,CAAE,KAAAJ,EAAM,MAAAC,EAAO,GAAGC,CACtB,EAAAE,EACK,MAAA,CAAE,KAAAJ,EAAM,MAAAC,EAAO,eAAAC,CAAe,CAAA,CACtC,CACL,EClBMG,EAAiBN,GAAsC,WAC3D,GAAI,CAACA,EAAM,OAEX,MAAMO,EAAQ,CACZ,wBAAyBH,EACvBJ,EAAK,yBACP,EACA,eAAgBQ,EAA4BR,EAAK,eAAe,EAChE,MAAOA,EAAK,OAAS,OACrB,GAAIA,EAAK,GACT,QAASA,EAAK,iBAAmB,EACjC,UAAWA,EAAK,WAChB,sBAAuBD,EACrBC,EAAK,uBACP,EACA,kBAAmBS,EAA6BT,EAAK,kBAAkB,EACvE,QAAS,CAACF,EAAM,aAClB,EAGO,OAAAY,EACLH,GACAI,GAAAC,GAAAC,EAAAC,GAAO,UAAU,EAAE,SAAnB,YAAAD,EAA2B,YAA3B,YAAAD,EAAsC,cAAtC,YAAAD,EAAA,KAAAC,EA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A,CAGI,MAAAgB,EAAS,MAAMD,GAAoBxE,CAAI,EAEtCsD,EAAA,KAAK,mBAAoBmB,CAAM,CACxC"}
|
|
1
|
+
{"version":3,"file":"synchronizeCheckout.js","sources":["/@dropins/storefront-checkout/src/api/authenticateCustomer/authenticateCustomer.ts","/@dropins/storefront-checkout/src/data/transforms/transform-payment-methods.ts","/@dropins/storefront-checkout/src/data/transforms/transform-cart.ts","/@dropins/storefront-checkout/src/data/transforms/transform-quote-address.ts","/@dropins/storefront-checkout/src/data/transforms/transform-negotiable-quote.ts","/@dropins/storefront-checkout/src/api/getCart/graphql/getCart.graphql.ts","/@dropins/storefront-checkout/src/api/getCart/getCart.ts","/@dropins/storefront-checkout/src/api/getNegotiableQuote/graphql/getNegotiableQuote.graphql.ts","/@dropins/storefront-checkout/src/api/getNegotiableQuote/getNegotiableQuote.ts","/@dropins/storefront-checkout/src/api/initialize/listeners.ts","/@dropins/storefront-checkout/src/api/initialize/initialize.ts","/@dropins/storefront-checkout/src/types/guards.ts","/@dropins/storefront-checkout/src/api/initializeCheckout/initializeCheckout.ts","/@dropins/storefront-checkout/src/api/resetCheckout/resetCheckout.ts","/@dropins/storefront-checkout/src/api/synchronizeCheckout/synchronizeCheckout.ts"],"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 { state } from '@/checkout/lib/state';\n\nexport const authenticateCustomer = async (authenticated = false) => {\n state.authenticated = authenticated;\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 { PaymentMethod } from '@/checkout/data/models/payment-method';\nimport { GetCartQuery } from '@/checkout/__generated__/types';\n\ntype SelectedPaymentMethod = NonNullable<\n GetCartQuery['cart']\n>['selected_payment_method'];\n\ntype AvailablePaymentMethods = NonNullable<\n GetCartQuery['cart']\n>['available_payment_methods'];\n\ntype AvailablePaymentMethod = NonNullable<AvailablePaymentMethods>[number];\n\ntype NonNullabePaymentMethod = NonNullable<AvailablePaymentMethod>;\n\nconst transformSelectedPaymentMethod = (\n data: SelectedPaymentMethod\n): PaymentMethod | undefined => {\n if (!data) return;\n const { code, title, ...additionalData } = data;\n return { code, title, additionalData };\n};\n\nconst transformAvailablePaymentMethods = (\n data: AvailablePaymentMethods\n): PaymentMethod[] | undefined => {\n if (!data) return;\n\n return data\n .filter((method) => !!method)\n .map((method) => {\n const { code, title, ...additionalData } =\n method as NonNullabePaymentMethod;\n return { code, title, additionalData };\n });\n};\n\nexport { transformAvailablePaymentMethods, transformSelectedPaymentMethod };\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 { config } from '@/checkout/api';\nimport { Cart as CartModel } from '@/checkout/data/models';\nimport {\n transformAvailablePaymentMethods,\n transformSelectedPaymentMethod,\n} from '@/checkout/data/transforms/transform-payment-methods';\nimport { GetCartQuery } from '@/checkout/__generated__/types';\nimport { merge } from '@adobe-commerce/elsie/lib';\n\nimport {\n transformCartBillingAddress,\n transformCartShippingAddress,\n} from '@/checkout/data/transforms/transform-cart-address';\nimport { state } from '@/checkout/lib/state';\n\ntype Cart = GetCartQuery['cart'];\n\nconst transformCart = (data: Cart): CartModel | undefined => {\n if (!data) return;\n\n const model = {\n availablePaymentMethods: transformAvailablePaymentMethods(\n data.available_payment_methods\n ),\n billingAddress: transformCartBillingAddress(data.billing_address),\n email: data.email ?? undefined,\n id: data.id,\n isEmpty: data.total_quantity === 0,\n isVirtual: data.is_virtual,\n selectedPaymentMethod: transformSelectedPaymentMethod(\n data.selected_payment_method\n ),\n shippingAddresses: transformCartShippingAddress(data.shipping_addresses),\n isGuest: !state.authenticated,\n };\n\n // Extend the model merging custom transformer, if provided\n return merge(\n model, // default transformer\n config.getConfig().models?.CartModel?.transformer?.(data) // custom transformer\n );\n};\n\nexport { Cart, transformCart };\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 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 {\n Address as AddressModel,\n ShippingAddress as ShippingAddressModel,\n} from '@/checkout/data/models';\n\nimport {\n transformAddressCountry,\n transformAddressRegion,\n transformCustomAttributes,\n transformSelectedShippingMethod,\n transformShippingMethods,\n} from '@/checkout/data/transforms';\nimport { GetNegotiableQuoteQuery } from '@/checkout/__generated__/types';\n\ntype QuoteShippingAddresses = NonNullable<\n GetNegotiableQuoteQuery['negotiableQuote']\n>['shipping_addresses'];\ntype QuoteShippingAddress = QuoteShippingAddresses[0];\ntype NonNullableShippingAddress = NonNullable<QuoteShippingAddress>;\n\ntype QuoteBillingAddress = NonNullable<\n GetNegotiableQuoteQuery['negotiableQuote']\n>['billing_address'];\ntype NonNullableBillingAddress = NonNullable<QuoteBillingAddress>;\n\nconst transformAddress = (\n data: NonNullableShippingAddress | NonNullableBillingAddress\n): AddressModel => {\n const street = data.street.filter(Boolean) as string[];\n\n return {\n city: data.city,\n company: data.company || undefined,\n country: transformAddressCountry(data.country),\n customAttributes: transformCustomAttributes(data.custom_attributes),\n customerAddressUid: data.customer_address_uid || undefined,\n fax: data.fax || undefined,\n firstName: data.firstname,\n lastName: data.lastname,\n middleName: data.middlename || undefined,\n postCode: data.postcode || undefined,\n prefix: data.prefix || undefined,\n region: transformAddressRegion(data.region),\n street,\n suffix: data.suffix || undefined,\n telephone: data.telephone || undefined,\n uid: data.uid,\n vatId: data.vat_id || undefined,\n };\n};\n\nconst transformQuoteBillingAddress = (\n data: QuoteBillingAddress\n): AddressModel | undefined => {\n if (!data) return;\n return transformAddress(data);\n};\n\nconst transformQuoteShippingAddress = (\n data: QuoteShippingAddresses\n): ShippingAddressModel[] => {\n return data\n .filter((address) => !!address)\n .map((address) => {\n const {\n available_shipping_methods,\n selected_shipping_method,\n ...baseData\n } = address as NonNullableShippingAddress;\n\n return {\n ...transformAddress(baseData as NonNullableShippingAddress),\n availableShippingMethods: transformShippingMethods(\n available_shipping_methods\n ),\n selectedShippingMethod: transformSelectedShippingMethod(\n selected_shipping_method\n ),\n };\n });\n};\n\nexport {\n QuoteBillingAddress,\n QuoteShippingAddress,\n transformQuoteBillingAddress,\n transformQuoteShippingAddress,\n};\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 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 { NegotiableQuote as NegotiableQuoteModel } from '@/checkout/data/models/';\nimport { GetNegotiableQuoteQuery } from '@/checkout/__generated__/types';\n\nimport {\n transformAvailablePaymentMethods,\n transformQuoteBillingAddress,\n transformQuoteShippingAddress,\n transformSelectedPaymentMethod,\n} from '@/checkout/data/transforms';\n\ntype NegotiableQuote = GetNegotiableQuoteQuery['negotiableQuote'];\n\nexport const transformNegotiableQuote = (\n data: NegotiableQuote | undefined\n): NegotiableQuoteModel | null => {\n if (!data) return null;\n\n return {\n availablePaymentMethods: transformAvailablePaymentMethods(\n data.available_payment_methods\n ),\n billingAddress: transformQuoteBillingAddress(data.billing_address),\n email: data.email ?? '',\n isEmpty: data.total_quantity === 0,\n isVirtual: data.is_virtual,\n name: data.name,\n selectedPaymentMethod: transformSelectedPaymentMethod(\n data.selected_payment_method\n ),\n shippingAddresses: transformQuoteShippingAddress(data.shipping_addresses),\n status: data.status,\n uid: data.uid,\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 { CHECKOUT_DATA_FRAGMENT } from '@/checkout/api/graphql/CheckoutDataFragment.graphql';\n\nexport const getCartQuery = /* GraphQL */ `\n query getCart($cartId: String!) {\n cart(cart_id: $cartId) {\n ...CHECKOUT_DATA_FRAGMENT\n }\n }\n\n ${CHECKOUT_DATA_FRAGMENT}\n`;\n\nexport const getCustomerCartQuery = /* GraphQL */ `\n query getCustomerCart {\n cart: customerCart {\n ...CHECKOUT_DATA_FRAGMENT\n }\n }\n\n ${CHECKOUT_DATA_FRAGMENT}\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 {\n getCartQuery,\n getCustomerCartQuery,\n} from '@/checkout/api/getCart/graphql';\nimport { transformCart } from '@/checkout/data/transforms';\nimport { dispatchApiCall } from '@/checkout/lib/dispatchApiCall';\nimport { state } from '@/checkout/lib';\nimport { MissingCart } from '@/checkout/lib/errors';\n\nexport const getCart = async () => {\n const cartId = state.cartId;\n const isGuest = state.authenticated === false;\n const query = isGuest ? getCartQuery : getCustomerCartQuery;\n const variables = isGuest ? { cartId } : {};\n\n if (isGuest && !cartId) throw new MissingCart();\n\n return await dispatchApiCall({\n type: 'query',\n query,\n options: { method: 'POST', cache: 'no-cache', variables },\n path: 'cart',\n transformer: transformCart,\n });\n};\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 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 { NEGOTIABLE_QUOTE_FRAGMENT } from '@/checkout/api/graphql/NegotiableQuoteFragment.graphql';\n\nexport const getNegotiableQuoteQuery = /* GraphQL */ `\n query getNegotiableQuote($quoteId: ID!) {\n negotiableQuote(uid: $quoteId) {\n ...NEGOTIABLE_QUOTE_FRAGMENT\n }\n }\n\n ${NEGOTIABLE_QUOTE_FRAGMENT}\n`;\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 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 { getNegotiableQuoteQuery } from '@/checkout/api/getNegotiableQuote/graphql';\nimport { transformNegotiableQuote as transformer } from '@/checkout/data/transforms';\nimport { state } from '@/checkout/lib';\nimport { dispatchApiCall } from '@/checkout/lib/dispatchApiCall';\nimport {\n MissingNegotiableQuoteId,\n Unauthenticated,\n} from '@/checkout/lib/errors';\n\ntype GetNegotiableQuoteInput = {\n uid?: string;\n};\n\nexport const getNegotiableQuote = async (\n input: GetNegotiableQuoteInput = {}\n) => {\n const quoteId = input.uid ?? state.quoteId;\n const isGuest = state.authenticated === false;\n\n if (isGuest) throw new Unauthenticated();\n if (!quoteId) throw new MissingNegotiableQuoteId();\n\n const variables = { quoteId };\n\n return await dispatchApiCall({\n type: 'query',\n query: getNegotiableQuoteQuery,\n options: { method: 'GET', cache: 'no-cache', variables },\n path: 'negotiableQuote',\n transformer,\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 {\n authenticateCustomer,\n ConfigProps,\n initializeCheckout,\n resetCheckout,\n synchronizeCheckout,\n} from '@/checkout/api';\nimport { ErrorCodes } from '@/checkout/lib/errors';\nimport { events, Events } from '@adobe-commerce/event-bus';\n\ntype Listener = [keyof Events, (...args: any[]) => void, { eager: boolean }?];\n\nconst asEager = { eager: true };\n\nexport const addCheckoutEventListeners = (config: ConfigProps | undefined) => {\n const useB2bQuotes = config?.features?.b2b?.quotes ?? false;\n\n const handleAuthenticated = (isAuthenticated = false) => {\n authenticateCustomer(isAuthenticated);\n\n if (!useB2bQuotes) return;\n if (isAuthenticated) return;\n\n const destination = config?.features?.b2b?.routeLogin?.();\n if (destination) {\n window.location.assign(destination);\n }\n };\n\n const cartListeners: Listener[] = [\n ['cart/initialized', initializeCheckout, asEager],\n ['cart/reset', resetCheckout],\n ['cart/updated', synchronizeCheckout],\n ];\n\n const quoteListeners: Listener[] = [\n [\n 'quote-management/quote-data/initialized',\n (data) => {\n if (!data.quote.canCheckout) {\n const message =\n config?.langDefinitions?.default?.Checkout?.Quote\n ?.permissionDenied ||\n 'You do not have permission to checkout with this quote.';\n events.emit('checkout/error', {\n message,\n code: ErrorCodes.QUOTE_PERMISSION_DENIED,\n });\n return;\n }\n\n initializeCheckout(data.quote);\n },\n asEager,\n ],\n [\n 'quote-management/quote-data/error',\n () => {\n const message =\n config?.langDefinitions?.default?.Checkout?.Quote?.dataError ||\n 'We were unable to retrieve the quote data. Please try again later.';\n events.emit('checkout/error', {\n message,\n code: ErrorCodes.QUOTE_DATA_ERROR,\n });\n },\n ],\n ];\n\n const listeners: Listener[] = [\n ['authenticated', handleAuthenticated, asEager],\n ...(useB2bQuotes ? quoteListeners : cartListeners),\n ];\n\n return listeners.map(([eventName, handler, options]) => {\n return events.on(eventName, handler, options);\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 { addCheckoutEventListeners } from '@/checkout/api/initialize/listeners';\nimport {\n Cart as CartModel,\n Customer as CustomerModel,\n ShippingMethod,\n} from '@/checkout/data/models';\nimport { state } from '@/checkout/lib';\nimport { Filter, Selector } from '@/checkout/types/utils';\nimport { definition } from '@adobe-commerce/elsie/i18n';\nimport { deepmerge, Initializer, Model } from '@adobe-commerce/elsie/lib';\n\nconst url = new URL(window.location.href);\nconst quoteId = url.searchParams.get('quoteId');\nstate.quoteId = quoteId;\n\nexport type ConfigProps = {\n defaults?: {\n isBillToShipping?: boolean;\n selectedShippingMethod?: Selector<ShippingMethod>;\n };\n shipping?: {\n filterOptions?: Filter<ShippingMethod>;\n };\n features?: {\n b2b?: {\n quotes?: boolean;\n routeLogin?: () => string | void;\n };\n };\n langDefinitions?: typeof definition & { default: { Checkout: any } };\n models?: {\n CartModel?: Model<CartModel>;\n CustomerModel?: Model<CustomerModel>;\n };\n};\n\nexport const initialize = new Initializer<ConfigProps>({\n init: async (_config = {}) => {\n initialize.config.setConfig(\n deepmerge(\n {\n defaults: {\n isBillToShipping: true,\n selectedShippingMethod: (options) => {\n return options.length > 0 ? options[0] : null;\n },\n },\n features: {\n b2b: { quotes: false },\n },\n },\n _config\n )\n );\n },\n listeners: addCheckoutEventListeners,\n});\n\nexport const config = initialize.config;\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 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 {\n CartModel,\n InitializeInput,\n NegotiableQuoteModel,\n SynchronizeInput,\n} from '@/checkout/types';\n\nexport const isCartInput = (\n input: NonNullable<InitializeInput | SynchronizeInput>\n): input is CartModel => {\n return 'id' in input;\n};\n\nexport const isNegotiableQuoteInput = (\n input: NonNullable<InitializeInput | SynchronizeInput>\n): input is NegotiableQuoteModel => {\n return 'uid' in input;\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 {\n getCart,\n getNegotiableQuote,\n getStoreConfig,\n synchronizeCheckout,\n} from '@/checkout/api';\nimport { state } from '@/checkout/lib';\nimport { InitializeInput, isCartInput } from '@/checkout/types';\nimport { events } from '@adobe-commerce/event-bus';\n\nconst getInitialData = async (input: NonNullable<InitializeInput>) => {\n try {\n if (isCartInput(input)) {\n state.cartId = input.id;\n state.quoteId = null;\n return (await getCart()) ?? null;\n }\n state.cartId = null;\n state.quoteId = input.uid;\n return (await getNegotiableQuote()) ?? null;\n } catch (error) {\n console.error('Checkout initialization failed:', error);\n return null;\n }\n};\n\nexport const initializeCheckout = async (input: InitializeInput) => {\n if (state.initialized) {\n await synchronizeCheckout(input);\n return;\n }\n\n if (!state.config) {\n state.config = await getStoreConfig();\n }\n\n const initialData = input ? await getInitialData(input) : null;\n\n state.initialized = true;\n events.emit('checkout/initialized', initialData);\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 { state } from '@/checkout/lib/state';\nimport { events } from '@adobe-commerce/event-bus';\n\nexport const resetCheckout = () => {\n if (!state.initialized) return;\n state.cartId = null;\n state.quoteId = null;\n events.emit('checkout/updated', null);\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 {\n getCart,\n getNegotiableQuote,\n initializeCheckout,\n resetCheckout,\n} from '@/checkout/api';\nimport { state } from '@/checkout/lib/state';\nimport { isCartInput, SynchronizeInput } from '@/checkout/types';\nimport { events } from '@adobe-commerce/event-bus';\n\nconst getSynchronizedData = async (input: NonNullable<SynchronizeInput>) => {\n try {\n if (isCartInput(input)) {\n state.cartId = input.id;\n state.quoteId = null;\n return (await getCart()) ?? null;\n }\n state.cartId = null;\n state.quoteId = input.uid;\n return (await getNegotiableQuote()) ?? null;\n } catch (error) {\n console.error('Checkout synchronization failed:', error);\n return null;\n }\n};\n\nexport const synchronizeCheckout = async (data: SynchronizeInput) => {\n if (!state.initialized) return initializeCheckout(data);\n\n if (data === null) {\n resetCheckout();\n return;\n }\n\n const update = await getSynchronizedData(data);\n\n events.emit('checkout/updated', update);\n};\n"],"names":["authenticateCustomer","authenticated","state","transformSelectedPaymentMethod","data","code","title","additionalData","transformAvailablePaymentMethods","method","transformCart","model","transformCartBillingAddress","transformCartShippingAddress","merge","_c","_b","_a","config","transformAddress","street","transformAddressCountry","transformCustomAttributes","transformAddressRegion","transformQuoteBillingAddress","transformQuoteShippingAddress","address","available_shipping_methods","selected_shipping_method","baseData","transformShippingMethods","transformSelectedShippingMethod","transformNegotiableQuote","getCartQuery","CHECKOUT_DATA_FRAGMENT","getCustomerCartQuery","getCart","cartId","isGuest","query","variables","MissingCart","dispatchApiCall","getNegotiableQuoteQuery","NEGOTIABLE_QUOTE_FRAGMENT","getNegotiableQuote","input","quoteId","Unauthenticated","MissingNegotiableQuoteId","transformer","asEager","addCheckoutEventListeners","useB2bQuotes","isAuthenticated","destination","message","_d","events","ErrorCodes","initializeCheckout","resetCheckout","synchronizeCheckout","eventName","handler","options","url","initialize","Initializer","_config","deepmerge","isCartInput","getInitialData","error","getStoreConfig","initialData","getSynchronizedData","update"],"mappings":"waAmBa,MAAAA,EAAuB,MAAOC,EAAgB,KAAU,CACnEC,EAAM,cAAgBD,CACxB,ECWME,EACJC,GAC8B,CAC9B,GAAI,CAACA,EAAM,OACX,KAAM,CAAE,KAAAC,EAAM,MAAAC,EAAO,GAAGC,CAAmB,EAAAH,EACpC,MAAA,CAAE,KAAAC,EAAM,MAAAC,EAAO,eAAAC,CAAe,CACvC,EAEMC,EACJJ,GACgC,CAChC,GAAKA,EAEE,OAAAA,EACJ,OAAQK,GAAW,CAAC,CAACA,CAAM,EAC3B,IAAKA,GAAW,CACf,KAAM,CAAE,KAAAJ,EAAM,MAAAC,EAAO,GAAGC,CACtB,EAAAE,EACK,MAAA,CAAE,KAAAJ,EAAM,MAAAC,EAAO,eAAAC,CAAe,CAAA,CACtC,CACL,EClBMG,EAAiBN,GAAsC,WAC3D,GAAI,CAACA,EAAM,OAEX,MAAMO,EAAQ,CACZ,wBAAyBH,EACvBJ,EAAK,yBACP,EACA,eAAgBQ,EAA4BR,EAAK,eAAe,EAChE,MAAOA,EAAK,OAAS,OACrB,GAAIA,EAAK,GACT,QAASA,EAAK,iBAAmB,EACjC,UAAWA,EAAK,WAChB,sBAAuBD,EACrBC,EAAK,uBACP,EACA,kBAAmBS,EAA6BT,EAAK,kBAAkB,EACvE,QAAS,CAACF,EAAM,aAClB,EAGO,OAAAY,EACLH,GACA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D,IAAA,CAEX,EAEaX,EAAsB,MAAO1D,GAA2B,CACnE,GAAI,CAACF,EAAM,YAAa,OAAO0D,EAAmBxD,CAAI,EAEtD,GAAIA,IAAS,KAAM,CACHyD,EAAA,EACd,MAAA,CAGI,MAAAgB,EAAS,MAAMD,GAAoBxE,CAAI,EAEtCsD,EAAA,KAAK,mBAAoBmB,CAAM,CACxC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
/*! Copyright 2025 Adobe
|
|
2
|
+
All Rights Reserved. */
|
|
3
|
+
const a={EMAIL:/^[a-z0-9,!#$%&'*+/=?^_`{|}~-]+(\.[a-z0-9,!#$%&'*+/=?^_`{|}~-]+)*@([a-z0-9-]+\.)+[a-z]{2,}$/i,NOT_EMPTY:/^(?!\s*$).+/},s=t=>a.EMAIL.test(t),e=t=>a.NOT_EMPTY.test(t),n={NOT_EMPTY:a.NOT_EMPTY.source};export{s as a,n as h,e as v};
|
|
4
|
+
//# sourceMappingURL=validation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validation.js","sources":["/@dropins/storefront-checkout/src/lib/validation.ts"],"sourcesContent":["export const validationPatterns = {\n EMAIL:\n /^[a-z0-9,!#$%&'*+/=?^_`{|}~-]+(\\.[a-z0-9,!#$%&'*+/=?^_`{|}~-]+)*@([a-z0-9-]+\\.)+[a-z]{2,}$/i,\n NOT_EMPTY: /^(?!\\s*$).+/,\n};\n\nexport const validateEmail = (email: string): boolean => {\n return validationPatterns.EMAIL.test(email);\n};\n\nexport const validateNotEmpty = (value: string): boolean => {\n return validationPatterns.NOT_EMPTY.test(value);\n};\n\nexport const htmlPatterns = {\n EMAIL: validationPatterns.EMAIL.source,\n NOT_EMPTY: validationPatterns.NOT_EMPTY.source,\n};\n"],"names":["validationPatterns","validateEmail","email","validateNotEmpty","value","htmlPatterns"],"mappings":"AAAO,MAAMA,EAAqB,CAChC,MACE,8FACF,UAAW,aACb,EAEaC,EAAiBC,GACrBF,EAAmB,MAAM,KAAKE,CAAK,EAG/BC,EAAoBC,GACxBJ,EAAmB,UAAU,KAAKI,CAAK,EAGnCC,EAAe,CAE1B,UAAWL,EAAmB,UAAU,MAC1C"}
|
|
@@ -2,9 +2,11 @@ import { FunctionComponent } from 'preact';
|
|
|
2
2
|
import { HTMLAttributes } from 'preact/compat';
|
|
3
3
|
|
|
4
4
|
export interface PurchaseOrderProps extends HTMLAttributes<HTMLFormElement> {
|
|
5
|
+
error?: string;
|
|
5
6
|
referenceNumber?: string;
|
|
6
|
-
onReferenceNumberChange?: (event: Event) => void;
|
|
7
7
|
onReferenceNumberBlur?: (event: Event) => void;
|
|
8
|
+
onReferenceNumberChange?: (event: Event) => void;
|
|
9
|
+
onInvalidReferenceNumber?: (event: Event) => void;
|
|
8
10
|
}
|
|
9
11
|
export declare const PurchaseOrder: FunctionComponent<PurchaseOrderProps>;
|
|
10
12
|
//# sourceMappingURL=PurchaseOrder.d.ts.map
|
package/containers/LoginForm.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/*! Copyright 2025 Adobe
|
|
2
2
|
All Rights Reserved. */
|
|
3
|
-
import{jsx as r,jsxs as u,Fragment as le}from"@dropins/tools/preact-jsx-runtime.js";import"../chunks/fetch-graphql.js";import{VComponent as G,classes as se,Slot as J}from"@dropins/tools/lib.js";import{b as ce,a as me}from"../chunks/events2.js";import{n as
|
|
3
|
+
import{jsx as r,jsxs as u,Fragment as le}from"@dropins/tools/preact-jsx-runtime.js";import"../chunks/fetch-graphql.js";import{VComponent as G,classes as se,Slot as J}from"@dropins/tools/lib.js";import{b as ce,a as me}from"../chunks/events2.js";import{a as z}from"../chunks/validation.js";import{n as B,g as K}from"../chunks/values.js";import{events as D}from"@dropins/tools/event-bus.js";import{i as ue,s as he,g as de}from"../chunks/setGuestEmailOnCart.js";import{Field as ge,Input as fe,Skeleton as pe,SkeletonRow as Q}from"@dropins/tools/components.js";import{useText as I}from"@dropins/tools/i18n.js";import"../chunks/TermsAndConditions.js";/* empty css */import{W as ke}from"../chunks/ConditionalWrapper.js";import"@dropins/tools/preact-compat.js";/* empty css *//* empty css *//* empty css */import{useState as k,useRef as Le,useCallback as d,useEffect as w,useMemo as M}from"@dropins/tools/preact-hooks.js";import"@dropins/tools/signals.js";import"@dropins/tools/fetch-graphql.js";import"../fragments.js";import"../chunks/synchronizeCheckout.js";import"../chunks/transform-shipping-methods.js";import"../chunks/classifiers.js";const ve=({value:o,error:n,hint:a,onChange:g,onBlur:L,onInvalid:c})=>{const l=I({LoginFormLabel:"Checkout.LoginForm.ariaLabel",LoginFormFloatingLabel:"Checkout.LoginForm.floatingLabel",LoginFormPlaceholder:"Checkout.LoginForm.placeholder"});return r(ge,{error:n,hint:a,children:r(fe,{"aria-label":l.LoginFormLabel,"aria-required":!0,autocomplete:"email",floatingLabel:l.LoginFormFloatingLabel,id:"customer-email",name:"customer-email",placeholder:l.LoginFormPlaceholder,required:!0,type:"email",value:o,onBlur:L,onChange:g,onInvalid:c})})},Fe=({onClick:o})=>{const n=I({account:"Checkout.LoginForm.account",signIn:"Checkout.LoginForm.signIn"});return u("div",{className:"checkout-login-form__sign-in",children:[n.account,r("a",{className:"checkout-login-form__link","data-testid":"sign-in-link",href:"#",rel:"noreferrer",target:"_blank",onClick:a=>{a.preventDefault(),o(a)},children:n.signIn})]})},_e=()=>u(pe,{"data-testid":"login-form-skeleton",children:[r(Q,{fullWidth:!0,variant:"heading"}),r(Q,{fullWidth:!0,size:"medium"})]}),be=({className:o,customer:n,email:a,error:g,headingContent:L,hint:c,name:l,onEmailBlur:f,onEmailChange:m,onEmailInvalid:s,title:F,...y})=>u("div",{className:"checkout-login-form","data-testid":"checkout-login-form",children:[u("div",{className:"checkout-login-form__heading",children:[F&&r(G,{className:"checkout-login-form__title",node:F}),L&&r(G,{className:"checkout-login-form__heading-label",node:L})]}),n?u("div",{className:"checkout-login-form__customer-details",children:[r("div",{className:"checkout-login-form__customer-name",children:`${n.firstName} ${n.lastName}`}),r("div",{className:"checkout-login-form__customer-email",children:n.email})]}):r("div",{className:"checkout-login-form__content",children:u("form",{...y,noValidate:!0,className:se(["dropin-login-form__form",o]),name:l,children:[r("button",{disabled:!0,"aria-hidden":"true",style:"display: none",type:"submit"}),r(ve,{error:g,hint:c,value:a,onBlur:f,onChange:m,onInvalid:s})]})})]}),Ee=ke(be,_e),Ce=({onClick:o})=>{const n=I({switch:"Checkout.LoginForm.switch",signOut:"Checkout.LoginForm.signOut"});return u("p",{className:"checkout-login-form__sign-out",children:[n.switch,r("a",{className:"checkout-login-form__link",href:"#",rel:"noreferrer",target:"_blank",onClick:a=>{a.preventDefault(),o==null||o(a)},children:n.signOut})]})},Ne=1e3,Xe=({active:o=!0,autoSync:n=!0,displayHeadingContent:a=!0,displayTitle:g=!0,initialData:L,onCartSyncError:c,onSignInClick:l,onSignOutClick:f,onValidationError:m,slots:s,...F})=>{const[y,X]=k(null),[Y,A]=k(""),[Z,p]=k(""),[x,S]=k(!1),[V,_]=k(!0),[ee,W]=k(!1),h=Le(null),{alreadyHaveAccountHint:$,cartSyncError:j,defaultTitle:q,fasterCheckoutHint:O,invalidEmailError:b,missingEmailError:E,signInLabel:P}=I({alreadyHaveAccountHint:"Checkout.LoginForm.emailExists.alreadyHaveAccount",cartSyncError:"Checkout.LoginForm.cartSyncError",defaultTitle:"Checkout.LoginForm.title",fasterCheckoutHint:"Checkout.LoginForm.emailExists.forFasterCheckout",invalidEmailError:"Checkout.LoginForm.invalidEmailError",missingEmailError:"Checkout.LoginForm.missingEmailError",signInLabel:"Checkout.LoginForm.emailExists.signInButton"}),C=d(e=>{!z(e)||e===ce()||(ue(e).then(t=>{_(t)}).catch(t=>{console.error(t),_(!0)}),n&&he(e).catch(t=>{c==null||c({email:e,error:t}),c||p(j)}))},[n,c,j]),te=d(e=>{const i=e.target.value;A(i),_(!0),p(""),h.current&&clearTimeout(h.current),h.current=setTimeout(()=>{C(i),B({email:i}),h.current=null},Ne)},[C]),ie=d(e=>{const t=e.target,i=t.value.trim();if(z(i)){if(p(""),t.setCustomValidity(""),!h.current)return;clearTimeout(h.current),h.current=null,C(i),B({email:i});return}const U=i===""?"missing":"invalid",H=U==="missing"?E:b;if(m){m({email:i,message:H,type:U});return}p(H),t.setCustomValidity(H)},[b,E,m,C]),re=d(e=>{const t=e.target,i=t.validity,T=i.valueMissing?E:b;if(!m){p(T);return}m({email:t.value,message:T,type:i.valueMissing?"missing":"invalid"})},[E,b,m]),N=d(()=>{const e=K("email")??"",t=z(e);l==null||l(t?e:"")},[l]),R=d(()=>{f==null||f()},[f]),v=d(e=>{const t=K("email")??"",i=(e==null?void 0:e.email)??"";i!==t&&(A(i),p(""),_(!0),B({email:i}))},[]);w(()=>{if(!o)return;const e=D.on("authenticated",t=>{S(t),de().then(i=>{X(i)}).catch(console.error)},{eager:!0});return()=>{e==null||e.off()}},[o]),w(()=>{if(!o)return;const e=me();if(e){W(!0);const i=e.email??"";i&&A(i),v(e);return}const t=D.on("checkout/initialized",i=>{W(!0),v(i)},{eager:!0});return()=>{t==null||t.off()}},[o,v]),w(()=>{if(!o)return;const e=D.on("checkout/updated",v,{eager:!1});return()=>{e==null||e.off()}},[o,v]);const oe=M(()=>{if(g)return r(J,{name:"checkout-login-form-title",slot:s==null?void 0:s.Title,children:r("h2",{children:q})})},[g,s,q]),ne=M(()=>{if(a)return r(J,{context:{authenticated:x},name:"checkout-login-form-heading-label",slot:s==null?void 0:s.Heading,children:x?r(Ce,{onClick:R}):r(Fe,{onClick:N})})},[a,x,s,N,R]),ae=M(()=>V?"":u(le,{children:[$," ",r("a",{href:"#",onClick:N,children:P})," ",O]}),[V,$,P,O,N]);return r(Ee,{...F,customer:y,email:Y,error:Z,headingContent:ne,hint:ae,initialized:ee,title:oe,visible:o,onEmailBlur:ie,onEmailChange:te,onEmailInvalid:re})};export{Xe as LoginForm,Xe as default};
|
|
4
4
|
//# sourceMappingURL=LoginForm.js.map
|