@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
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LoginForm.js","sources":["/@dropins/storefront-checkout/src/lib/validation.ts","/@dropins/storefront-checkout/src/components/LoginForm/Email.tsx","/@dropins/storefront-checkout/src/components/LoginForm/SignIn.tsx","/@dropins/storefront-checkout/src/components/LoginForm/LoginFormSkeleton.tsx","/@dropins/storefront-checkout/src/components/LoginForm/LoginForm.tsx","/@dropins/storefront-checkout/src/components/LoginForm/SignOut.tsx","/@dropins/storefront-checkout/src/containers/LoginForm/LoginForm.tsx"],"sourcesContent":["export const validationPatterns = {\n EMAIL:\n /^[a-z0-9,!#$%&'*+/=?^_`{|}~-]+(\\.[a-z0-9,!#$%&'*+/=?^_`{|}~-]+)*@([a-z0-9-]+\\.)+[a-z]{2,}$/i,\n};\n\nexport const validateEmail = (email: string): boolean => {\n return validationPatterns.EMAIL.test(email);\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 { Field, Input } from '@adobe-commerce/elsie/components';\nimport { useText } from '@adobe-commerce/elsie/i18n';\nimport { FunctionComponent } from 'preact';\nimport { HTMLAttributes } from 'preact/compat';\n\nexport interface LoginEmailProps extends HTMLAttributes<HTMLInputElement> {\n value: string;\n error: string;\n hint: string;\n onChange: (event: Event) => void;\n onBlur: (event: Event) => void;\n onInvalid: (event: Event) => void;\n}\n\nexport const Email: FunctionComponent<LoginEmailProps> = ({\n value,\n error,\n hint,\n onChange,\n onBlur,\n onInvalid,\n}) => {\n const translations = useText({\n LoginFormLabel: 'Checkout.LoginForm.ariaLabel',\n LoginFormFloatingLabel: 'Checkout.LoginForm.floatingLabel',\n LoginFormPlaceholder: 'Checkout.LoginForm.placeholder',\n });\n\n return (\n <Field error={error} hint={hint}>\n <Input\n aria-label={translations.LoginFormLabel}\n aria-required={true}\n autocomplete=\"email\"\n floatingLabel={translations.LoginFormFloatingLabel}\n id=\"customer-email\"\n name=\"customer-email\"\n placeholder={translations.LoginFormPlaceholder}\n required={true}\n type=\"email\"\n value={value}\n onBlur={onBlur}\n onChange={onChange}\n onInvalid={onInvalid}\n />\n </Field>\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 { useText } from '@adobe-commerce/elsie/i18n';\nimport { FunctionComponent } from 'preact';\n\ninterface SignInProps {\n onClick: (event: Event) => void;\n}\n\nexport const SignIn: FunctionComponent<SignInProps> = ({ onClick }) => {\n const translations = useText({\n account: 'Checkout.LoginForm.account',\n signIn: 'Checkout.LoginForm.signIn'\n });\n\n return (\n <div className=\"checkout-login-form__sign-in\">\n {translations.account}\n\n <a\n className=\"checkout-login-form__link\"\n data-testid=\"sign-in-link\"\n href=\"#\"\n rel=\"noreferrer\"\n target=\"_blank\"\n onClick={(event) => {\n event.preventDefault();\n onClick(event);\n }}\n >\n {translations.signIn}\n </a>\n </div>\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 { Skeleton, SkeletonRow } from '@adobe-commerce/elsie/components';\nimport { FunctionComponent } from 'preact';\n\nexport const LoginFormSkeleton: FunctionComponent = () => {\n return (\n <Skeleton data-testid=\"login-form-skeleton\">\n <SkeletonRow fullWidth={true} variant=\"heading\" />\n <SkeletonRow fullWidth={true} size=\"medium\" />\n </Skeleton>\n );\n};\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { Email } from '@/checkout/components';\nimport { WithConditionals } from '@/checkout/components/ConditionalWrapper/ConditionalWrapper';\nimport '@/checkout/components/LoginForm/LoginForm.css';\nimport { LoginFormSkeleton } from '@/checkout/components/LoginForm/LoginFormSkeleton';\nimport { Customer } from '@/checkout/data/models';\nimport { classes, VComponent } from '@adobe-commerce/elsie/lib';\nimport { FunctionComponent, VNode } from 'preact';\nimport { HTMLAttributes } from 'preact/compat';\n\nexport interface LoginFormProps\n extends Omit<HTMLAttributes<HTMLFormElement>, 'title'> {\n customer: Customer | null;\n email: string;\n error: string;\n headingContent?: VNode;\n hint: string | VNode;\n onEmailBlur: (event: Event) => void;\n onEmailChange: (event: Event) => void;\n onEmailInvalid: (event: Event) => void;\n title?: VNode;\n}\n\nconst LoginFormComponent: FunctionComponent<LoginFormProps> = ({\n className,\n customer,\n email,\n error,\n headingContent,\n hint,\n name,\n onEmailBlur,\n onEmailChange,\n onEmailInvalid,\n title,\n ...props\n}) => {\n return (\n <div className=\"checkout-login-form\" data-testid=\"checkout-login-form\">\n <div className=\"checkout-login-form__heading\">\n {title && (\n <VComponent className=\"checkout-login-form__title\" node={title} />\n )}\n\n {headingContent && (\n <VComponent\n className=\"checkout-login-form__heading-label\"\n node={headingContent}\n />\n )}\n </div>\n\n {customer ? (\n <div className=\"checkout-login-form__customer-details\">\n <div className=\"checkout-login-form__customer-name\">\n {`${customer.firstName} ${customer.lastName}`}\n </div>\n\n <div className=\"checkout-login-form__customer-email\">\n {customer.email}\n </div>\n </div>\n ) : (\n <div className=\"checkout-login-form__content\">\n <form\n {...props}\n noValidate\n className={classes(['dropin-login-form__form', className])}\n name={name}\n >\n {/* Prevent 'Enter' key press from submitting this form. */}\n <button\n disabled\n aria-hidden=\"true\"\n style=\"display: none\"\n type=\"submit\"\n />\n <Email\n error={error}\n hint={hint as any}\n value={email}\n onBlur={onEmailBlur}\n onChange={onEmailChange}\n onInvalid={onEmailInvalid}\n />\n </form>\n </div>\n )}\n </div>\n );\n};\n\nexport const LoginForm = WithConditionals(\n LoginFormComponent,\n LoginFormSkeleton\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 { useText } from '@adobe-commerce/elsie/i18n';\nimport { FunctionComponent } from 'preact';\n\ninterface SignOutProps {\n onClick: (event: Event) => void;\n}\n\nexport const SignOut: FunctionComponent<SignOutProps> = ({ onClick }) => {\n const translations = useText({\n switch: 'Checkout.LoginForm.switch',\n signOut: 'Checkout.LoginForm.signOut'\n });\n\n return (\n <p className=\"checkout-login-form__sign-out\">\n {translations.switch}\n\n <a\n className=\"checkout-login-form__link\"\n href=\"#\"\n rel=\"noreferrer\"\n target=\"_blank\"\n onClick={(event) => {\n event.preventDefault();\n onClick?.(event);\n }}\n >\n {translations.signOut}\n </a>\n </p>\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 getCustomer,\n isEmailAvailable,\n setGuestEmailOnCart,\n} from '@/checkout/api';\nimport {\n LoginForm as LoginFormComponent,\n SignIn,\n SignOut,\n} from '@/checkout/components/LoginForm';\nimport { Cart, Customer } from '@/checkout/data/models';\nimport {\n getCartEmail,\n getLatestCheckoutUpdate,\n getValue,\n notifyValues,\n validateEmail,\n} from '@/checkout/lib';\nimport { TitleProps } from '@/checkout/types';\nimport { useText } from '@adobe-commerce/elsie/i18n';\nimport { Container, Slot, SlotProps } from '@adobe-commerce/elsie/lib';\nimport { events } from '@adobe-commerce/event-bus';\nimport { HTMLAttributes } from 'preact/compat';\nimport {\n useCallback,\n useEffect,\n useMemo,\n useRef,\n useState,\n} from 'preact/hooks';\n\ninterface ValidationError {\n email: string;\n message: string;\n type: 'missing' | 'invalid';\n}\n\ninterface CartSyncError {\n email: string;\n error: Error;\n}\n\nexport interface LoginFormProps\n extends HTMLAttributes<HTMLFormElement>,\n TitleProps {\n active?: boolean;\n autoSync?: boolean;\n displayHeadingContent?: boolean;\n onSignInClick?: (email: string) => void;\n onSignOutClick?: () => void;\n onCartSyncError?: (error: CartSyncError) => void;\n onValidationError?: (error: ValidationError) => void;\n slots?: {\n Heading?: SlotProps<{\n authenticated: boolean;\n }>;\n } & TitleProps['slots'];\n}\n\nconst DEBOUNCE_TIME = 1000;\n\nexport const LoginForm: Container<LoginFormProps> = ({\n active = true,\n autoSync = true,\n displayHeadingContent = true,\n displayTitle = true,\n initialData,\n onCartSyncError,\n onSignInClick,\n onSignOutClick,\n onValidationError,\n slots,\n ...props\n}) => {\n const [customer, setCustomer] = useState<Customer | null>(null);\n const [email, setEmail] = useState<string>('');\n const [error, setError] = useState<string>('');\n const [isAuthenticated, setIsAuthenticated] = useState(false);\n const [isAvailable, setIsAvailable] = useState<boolean>(true);\n const [isInitialized, setIsInitialized] = useState<boolean>(false);\n\n const debounceTimer = useRef<ReturnType<typeof setTimeout> | null>(null);\n\n const {\n alreadyHaveAccountHint,\n cartSyncError,\n defaultTitle,\n fasterCheckoutHint,\n invalidEmailError,\n missingEmailError,\n signInLabel,\n } = useText({\n alreadyHaveAccountHint: 'Checkout.LoginForm.emailExists.alreadyHaveAccount',\n cartSyncError: 'Checkout.LoginForm.cartSyncError',\n defaultTitle: 'Checkout.LoginForm.title',\n fasterCheckoutHint: 'Checkout.LoginForm.emailExists.forFasterCheckout',\n invalidEmailError: 'Checkout.LoginForm.invalidEmailError',\n missingEmailError: 'Checkout.LoginForm.missingEmailError',\n signInLabel: 'Checkout.LoginForm.emailExists.signInButton',\n });\n\n const setEmailAndCheckAvailability = useCallback(\n (email: string) => {\n if (!validateEmail(email) || email === getCartEmail()) return;\n\n isEmailAvailable(email)\n .then((availability) => {\n setIsAvailable(availability);\n })\n .catch((error) => {\n console.error(error);\n setIsAvailable(true);\n });\n\n if (!autoSync) return;\n\n setGuestEmailOnCart(email).catch((error) => {\n onCartSyncError?.({ email, error });\n\n if (!onCartSyncError) {\n setError(cartSyncError);\n }\n });\n },\n [autoSync, onCartSyncError, cartSyncError]\n );\n\n const handleChange = useCallback(\n (event: Event) => {\n const target = event.target as HTMLInputElement;\n const email = target.value;\n\n setEmail(email);\n setIsAvailable(true);\n setError('');\n\n if (debounceTimer.current) {\n clearTimeout(debounceTimer.current);\n }\n\n debounceTimer.current = setTimeout(() => {\n setEmailAndCheckAvailability(email);\n notifyValues({ email });\n debounceTimer.current = null;\n }, DEBOUNCE_TIME);\n },\n [setEmailAndCheckAvailability]\n );\n\n const handleBlur = useCallback(\n (event: Event) => {\n const target = event.target as HTMLInputElement;\n const email = target.value.trim();\n const isValid = validateEmail(email);\n\n if (isValid) {\n setError('');\n target.setCustomValidity('');\n\n if (!debounceTimer.current) return;\n\n clearTimeout(debounceTimer.current);\n debounceTimer.current = null;\n setEmailAndCheckAvailability(email);\n notifyValues({ email });\n return;\n }\n\n const type = email === '' ? 'missing' : 'invalid';\n const message =\n type === 'missing' ? missingEmailError : invalidEmailError;\n\n if (onValidationError) {\n onValidationError({ email, message, type });\n return;\n }\n\n setError(message);\n target.setCustomValidity(message);\n },\n [\n invalidEmailError,\n missingEmailError,\n onValidationError,\n setEmailAndCheckAvailability,\n ]\n );\n\n const handleInvalid = useCallback(\n (event: Event) => {\n const target = event.target as HTMLInputElement;\n const validity = target.validity;\n\n const message = validity.valueMissing\n ? missingEmailError\n : invalidEmailError;\n\n if (!onValidationError) {\n setError(message);\n return;\n }\n\n onValidationError({\n email: target.value,\n message,\n type: validity.valueMissing ? 'missing' : 'invalid',\n });\n },\n [missingEmailError, invalidEmailError, onValidationError]\n );\n\n const handleSignIn = useCallback(() => {\n const email = getValue('email') ?? '';\n const isValid = validateEmail(email);\n onSignInClick?.(isValid ? email : '');\n }, [onSignInClick]);\n\n const handleSignOut = useCallback(() => {\n onSignOutClick?.();\n }, [onSignOutClick]);\n\n const handleCheckoutData = useCallback((data: Cart | null) => {\n const prevEmail = getValue('email') ?? '';\n const email = data?.email ?? '';\n\n if (email !== prevEmail) {\n setEmail(email);\n setError('');\n setIsAvailable(true);\n notifyValues({ email });\n }\n }, []);\n\n useEffect(() => {\n if (!active) return;\n\n const onAuthenticated = events.on(\n 'authenticated',\n (authenticated) => {\n setIsAuthenticated(authenticated);\n\n getCustomer()\n .then((customer) => {\n setCustomer(customer);\n })\n .catch(console.error);\n },\n { eager: true }\n );\n\n return () => {\n onAuthenticated?.off();\n };\n }, [active]);\n\n useEffect(() => {\n if (!active) return;\n\n const pastUpdate = getLatestCheckoutUpdate();\n\n if (pastUpdate) {\n setIsInitialized(true);\n // When component becomes active, restore local state from checkout data\n const checkoutEmail = pastUpdate.email ?? '';\n if (checkoutEmail) {\n setEmail(checkoutEmail);\n }\n handleCheckoutData(pastUpdate);\n return;\n }\n\n const onCheckoutInit = events.on(\n 'checkout/initialized',\n (data) => {\n setIsInitialized(true);\n handleCheckoutData(data);\n },\n { eager: true }\n );\n\n return () => {\n onCheckoutInit?.off();\n };\n }, [active, handleCheckoutData]);\n\n useEffect(() => {\n if (!active) return;\n\n const onCheckoutUpdated = events.on(\n 'checkout/updated',\n handleCheckoutData,\n { eager: false }\n );\n\n return () => {\n onCheckoutUpdated?.off();\n };\n }, [active, handleCheckoutData]);\n\n const titleContent = useMemo(() => {\n if (!displayTitle) return undefined;\n\n return (\n <Slot name=\"checkout-login-form-title\" slot={slots?.Title}>\n <h2>{defaultTitle}</h2>\n </Slot>\n );\n }, [displayTitle, slots, defaultTitle]);\n\n const headingContent = useMemo(() => {\n if (!displayHeadingContent) return undefined;\n\n return (\n <Slot\n context={{ authenticated: isAuthenticated }}\n name=\"checkout-login-form-heading-label\"\n slot={slots?.Heading}\n >\n {isAuthenticated ? (\n <SignOut onClick={handleSignOut} />\n ) : (\n <SignIn onClick={handleSignIn} />\n )}\n </Slot>\n );\n }, [\n displayHeadingContent,\n isAuthenticated,\n slots,\n handleSignIn,\n handleSignOut,\n ]);\n\n const hintContent = useMemo(() => {\n if (isAvailable) return '';\n\n return (\n <>\n {alreadyHaveAccountHint}{' '}\n <a href=\"#\" onClick={handleSignIn}>\n {signInLabel}\n </a>{' '}\n {fasterCheckoutHint}\n </>\n );\n }, [\n isAvailable,\n alreadyHaveAccountHint,\n signInLabel,\n fasterCheckoutHint,\n handleSignIn,\n ]);\n\n return (\n <LoginFormComponent\n {...props}\n customer={customer}\n email={email}\n error={error}\n headingContent={headingContent}\n hint={hintContent}\n initialized={isInitialized}\n title={titleContent}\n visible={active}\n onEmailBlur={handleBlur}\n onEmailChange={handleChange}\n onEmailInvalid={handleInvalid}\n />\n );\n};\n"],"names":["validationPatterns","validateEmail","email","Email","value","error","hint","onChange","onBlur","onInvalid","translations","useText","jsx","Field","Input","SignIn","onClick","jsxs","event","LoginFormSkeleton","Skeleton","SkeletonRow","LoginFormComponent","className","customer","headingContent","name","onEmailBlur","onEmailChange","onEmailInvalid","title","props","VComponent","classes","LoginForm","WithConditionals","SignOut","DEBOUNCE_TIME","active","autoSync","displayHeadingContent","displayTitle","initialData","onCartSyncError","onSignInClick","onSignOutClick","onValidationError","slots","setCustomer","useState","setEmail","setError","isAuthenticated","setIsAuthenticated","isAvailable","setIsAvailable","isInitialized","setIsInitialized","debounceTimer","useRef","alreadyHaveAccountHint","cartSyncError","defaultTitle","fasterCheckoutHint","invalidEmailError","missingEmailError","signInLabel","setEmailAndCheckAvailability","useCallback","getCartEmail","isEmailAvailable","availability","setGuestEmailOnCart","handleChange","notifyValues","handleBlur","target","type","message","handleInvalid","validity","handleSignIn","getValue","isValid","handleSignOut","handleCheckoutData","data","prevEmail","useEffect","onAuthenticated","events","authenticated","getCustomer","pastUpdate","getLatestCheckoutUpdate","checkoutEmail","onCheckoutInit","onCheckoutUpdated","titleContent","useMemo","Slot","hintContent","Fragment"],"mappings":"4pCAAO,MAAMA,GAAqB,CAChC,MACE,6FACJ,EAEaC,EAAiBC,GACrBF,GAAmB,MAAM,KAAKE,CAAK,ECyB/BC,GAA4C,CAAC,CACxD,MAAAC,EACA,MAAAC,EACA,KAAAC,EACA,SAAAC,EACA,OAAAC,EACA,UAAAC,CACF,IAAM,CACJ,MAAMC,EAAeC,EAAQ,CAC3B,eAAgB,+BAChB,uBAAwB,mCACxB,qBAAsB,gCAAA,CACvB,EAGC,OAAAC,EAACC,GAAM,CAAA,MAAAR,EAAc,KAAAC,EACnB,SAAAM,EAACE,GAAA,CACC,aAAYJ,EAAa,eACzB,gBAAe,GACf,aAAa,QACb,cAAeA,EAAa,uBAC5B,GAAG,iBACH,KAAK,iBACL,YAAaA,EAAa,qBAC1B,SAAU,GACV,KAAK,QACL,MAAAN,EACA,OAAAI,EACA,SAAAD,EACA,UAAAE,CAAA,CAAA,EAEJ,CAEJ,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S,CAAE,cAAehD,CAAgB,EAC1C,KAAK,oCACL,KAAML,GAAA,YAAAA,EAAO,QAEZ,SAAAK,IACEhB,GAAQ,CAAA,QAASgD,CAAe,CAAA,EAEjCxE,EAACG,GAAO,CAAA,QAASkE,CAAc,CAAA,CAAA,CAEnC,CAAA,EAED,CACDzC,EACAY,EACAL,EACAkC,EACAG,CAAA,CACD,EAEKiB,GAAcF,EAAQ,IACtB7C,EAAoB,GAInBrC,EAAAqF,GAAA,CAAA,SAAA,CAAA1C,EAAwB,MACxB,IAAE,CAAA,KAAK,IAAI,QAASqB,EAClB,SACHf,EAAA,EAAK,IACJH,CAAA,EACH,EAED,CACDT,EACAM,EACAM,EACAH,EACAkB,CAAA,CACD,EAGC,OAAArE,EAACU,GAAA,CACE,GAAGS,EACJ,SAAAP,EACA,MAAAtB,EACA,MAAAG,EACA,eAAAoB,GACA,KAAM4E,GACN,YAAa7C,GACb,MAAO0C,GACP,QAAS5D,EACT,YAAaqC,GACb,cAAeF,GACf,eAAgBM,EAAA,CAClB,CAEJ"}
|
|
1
|
+
{"version":3,"file":"LoginForm.js","sources":["/@dropins/storefront-checkout/src/components/LoginForm/Email.tsx","/@dropins/storefront-checkout/src/components/LoginForm/SignIn.tsx","/@dropins/storefront-checkout/src/components/LoginForm/LoginFormSkeleton.tsx","/@dropins/storefront-checkout/src/components/LoginForm/LoginForm.tsx","/@dropins/storefront-checkout/src/components/LoginForm/SignOut.tsx","/@dropins/storefront-checkout/src/containers/LoginForm/LoginForm.tsx"],"sourcesContent":["/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { Field, Input } from '@adobe-commerce/elsie/components';\nimport { useText } from '@adobe-commerce/elsie/i18n';\nimport { FunctionComponent } from 'preact';\nimport { HTMLAttributes } from 'preact/compat';\n\nexport interface LoginEmailProps extends HTMLAttributes<HTMLInputElement> {\n value: string;\n error: string;\n hint: string;\n onChange: (event: Event) => void;\n onBlur: (event: Event) => void;\n onInvalid: (event: Event) => void;\n}\n\nexport const Email: FunctionComponent<LoginEmailProps> = ({\n value,\n error,\n hint,\n onChange,\n onBlur,\n onInvalid,\n}) => {\n const translations = useText({\n LoginFormLabel: 'Checkout.LoginForm.ariaLabel',\n LoginFormFloatingLabel: 'Checkout.LoginForm.floatingLabel',\n LoginFormPlaceholder: 'Checkout.LoginForm.placeholder',\n });\n\n return (\n <Field error={error} hint={hint}>\n <Input\n aria-label={translations.LoginFormLabel}\n aria-required={true}\n autocomplete=\"email\"\n floatingLabel={translations.LoginFormFloatingLabel}\n id=\"customer-email\"\n name=\"customer-email\"\n placeholder={translations.LoginFormPlaceholder}\n required={true}\n type=\"email\"\n value={value}\n onBlur={onBlur}\n onChange={onChange}\n onInvalid={onInvalid}\n />\n </Field>\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 { useText } from '@adobe-commerce/elsie/i18n';\nimport { FunctionComponent } from 'preact';\n\ninterface SignInProps {\n onClick: (event: Event) => void;\n}\n\nexport const SignIn: FunctionComponent<SignInProps> = ({ onClick }) => {\n const translations = useText({\n account: 'Checkout.LoginForm.account',\n signIn: 'Checkout.LoginForm.signIn'\n });\n\n return (\n <div className=\"checkout-login-form__sign-in\">\n {translations.account}\n\n <a\n className=\"checkout-login-form__link\"\n data-testid=\"sign-in-link\"\n href=\"#\"\n rel=\"noreferrer\"\n target=\"_blank\"\n onClick={(event) => {\n event.preventDefault();\n onClick(event);\n }}\n >\n {translations.signIn}\n </a>\n </div>\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 { Skeleton, SkeletonRow } from '@adobe-commerce/elsie/components';\nimport { FunctionComponent } from 'preact';\n\nexport const LoginFormSkeleton: FunctionComponent = () => {\n return (\n <Skeleton data-testid=\"login-form-skeleton\">\n <SkeletonRow fullWidth={true} variant=\"heading\" />\n <SkeletonRow fullWidth={true} size=\"medium\" />\n </Skeleton>\n );\n};\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { Email } from '@/checkout/components';\nimport { WithConditionals } from '@/checkout/components/ConditionalWrapper/ConditionalWrapper';\nimport '@/checkout/components/LoginForm/LoginForm.css';\nimport { LoginFormSkeleton } from '@/checkout/components/LoginForm/LoginFormSkeleton';\nimport { Customer } from '@/checkout/data/models';\nimport { classes, VComponent } from '@adobe-commerce/elsie/lib';\nimport { FunctionComponent, VNode } from 'preact';\nimport { HTMLAttributes } from 'preact/compat';\n\nexport interface LoginFormProps\n extends Omit<HTMLAttributes<HTMLFormElement>, 'title'> {\n customer: Customer | null;\n email: string;\n error: string;\n headingContent?: VNode;\n hint: string | VNode;\n onEmailBlur: (event: Event) => void;\n onEmailChange: (event: Event) => void;\n onEmailInvalid: (event: Event) => void;\n title?: VNode;\n}\n\nconst LoginFormComponent: FunctionComponent<LoginFormProps> = ({\n className,\n customer,\n email,\n error,\n headingContent,\n hint,\n name,\n onEmailBlur,\n onEmailChange,\n onEmailInvalid,\n title,\n ...props\n}) => {\n return (\n <div className=\"checkout-login-form\" data-testid=\"checkout-login-form\">\n <div className=\"checkout-login-form__heading\">\n {title && (\n <VComponent className=\"checkout-login-form__title\" node={title} />\n )}\n\n {headingContent && (\n <VComponent\n className=\"checkout-login-form__heading-label\"\n node={headingContent}\n />\n )}\n </div>\n\n {customer ? (\n <div className=\"checkout-login-form__customer-details\">\n <div className=\"checkout-login-form__customer-name\">\n {`${customer.firstName} ${customer.lastName}`}\n </div>\n\n <div className=\"checkout-login-form__customer-email\">\n {customer.email}\n </div>\n </div>\n ) : (\n <div className=\"checkout-login-form__content\">\n <form\n {...props}\n noValidate\n className={classes(['dropin-login-form__form', className])}\n name={name}\n >\n {/* Prevent 'Enter' key press from submitting this form. */}\n <button\n disabled\n aria-hidden=\"true\"\n style=\"display: none\"\n type=\"submit\"\n />\n <Email\n error={error}\n hint={hint as any}\n value={email}\n onBlur={onEmailBlur}\n onChange={onEmailChange}\n onInvalid={onEmailInvalid}\n />\n </form>\n </div>\n )}\n </div>\n );\n};\n\nexport const LoginForm = WithConditionals(\n LoginFormComponent,\n LoginFormSkeleton\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 { useText } from '@adobe-commerce/elsie/i18n';\nimport { FunctionComponent } from 'preact';\n\ninterface SignOutProps {\n onClick: (event: Event) => void;\n}\n\nexport const SignOut: FunctionComponent<SignOutProps> = ({ onClick }) => {\n const translations = useText({\n switch: 'Checkout.LoginForm.switch',\n signOut: 'Checkout.LoginForm.signOut'\n });\n\n return (\n <p className=\"checkout-login-form__sign-out\">\n {translations.switch}\n\n <a\n className=\"checkout-login-form__link\"\n href=\"#\"\n rel=\"noreferrer\"\n target=\"_blank\"\n onClick={(event) => {\n event.preventDefault();\n onClick?.(event);\n }}\n >\n {translations.signOut}\n </a>\n </p>\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 getCustomer,\n isEmailAvailable,\n setGuestEmailOnCart,\n} from '@/checkout/api';\nimport {\n LoginForm as LoginFormComponent,\n SignIn,\n SignOut,\n} from '@/checkout/components/LoginForm';\nimport { Cart, Customer } from '@/checkout/data/models';\nimport {\n getCartEmail,\n getLatestCheckoutUpdate,\n getValue,\n notifyValues,\n validateEmail,\n} from '@/checkout/lib';\nimport { TitleProps } from '@/checkout/types';\nimport { useText } from '@adobe-commerce/elsie/i18n';\nimport { Container, Slot, SlotProps } from '@adobe-commerce/elsie/lib';\nimport { events } from '@adobe-commerce/event-bus';\nimport { HTMLAttributes } from 'preact/compat';\nimport {\n useCallback,\n useEffect,\n useMemo,\n useRef,\n useState,\n} from 'preact/hooks';\n\ninterface ValidationError {\n email: string;\n message: string;\n type: 'missing' | 'invalid';\n}\n\ninterface CartSyncError {\n email: string;\n error: Error;\n}\n\nexport interface LoginFormProps\n extends HTMLAttributes<HTMLFormElement>,\n TitleProps {\n active?: boolean;\n autoSync?: boolean;\n displayHeadingContent?: boolean;\n onSignInClick?: (email: string) => void;\n onSignOutClick?: () => void;\n onCartSyncError?: (error: CartSyncError) => void;\n onValidationError?: (error: ValidationError) => void;\n slots?: {\n Heading?: SlotProps<{\n authenticated: boolean;\n }>;\n } & TitleProps['slots'];\n}\n\nconst DEBOUNCE_TIME = 1000;\n\nexport const LoginForm: Container<LoginFormProps> = ({\n active = true,\n autoSync = true,\n displayHeadingContent = true,\n displayTitle = true,\n initialData,\n onCartSyncError,\n onSignInClick,\n onSignOutClick,\n onValidationError,\n slots,\n ...props\n}) => {\n const [customer, setCustomer] = useState<Customer | null>(null);\n const [email, setEmail] = useState<string>('');\n const [error, setError] = useState<string>('');\n const [isAuthenticated, setIsAuthenticated] = useState(false);\n const [isAvailable, setIsAvailable] = useState<boolean>(true);\n const [isInitialized, setIsInitialized] = useState<boolean>(false);\n\n const debounceTimer = useRef<ReturnType<typeof setTimeout> | null>(null);\n\n const {\n alreadyHaveAccountHint,\n cartSyncError,\n defaultTitle,\n fasterCheckoutHint,\n invalidEmailError,\n missingEmailError,\n signInLabel,\n } = useText({\n alreadyHaveAccountHint: 'Checkout.LoginForm.emailExists.alreadyHaveAccount',\n cartSyncError: 'Checkout.LoginForm.cartSyncError',\n defaultTitle: 'Checkout.LoginForm.title',\n fasterCheckoutHint: 'Checkout.LoginForm.emailExists.forFasterCheckout',\n invalidEmailError: 'Checkout.LoginForm.invalidEmailError',\n missingEmailError: 'Checkout.LoginForm.missingEmailError',\n signInLabel: 'Checkout.LoginForm.emailExists.signInButton',\n });\n\n const setEmailAndCheckAvailability = useCallback(\n (email: string) => {\n if (!validateEmail(email) || email === getCartEmail()) return;\n\n isEmailAvailable(email)\n .then((availability) => {\n setIsAvailable(availability);\n })\n .catch((error) => {\n console.error(error);\n setIsAvailable(true);\n });\n\n if (!autoSync) return;\n\n setGuestEmailOnCart(email).catch((error) => {\n onCartSyncError?.({ email, error });\n\n if (!onCartSyncError) {\n setError(cartSyncError);\n }\n });\n },\n [autoSync, onCartSyncError, cartSyncError]\n );\n\n const handleChange = useCallback(\n (event: Event) => {\n const target = event.target as HTMLInputElement;\n const email = target.value;\n\n setEmail(email);\n setIsAvailable(true);\n setError('');\n\n if (debounceTimer.current) {\n clearTimeout(debounceTimer.current);\n }\n\n debounceTimer.current = setTimeout(() => {\n setEmailAndCheckAvailability(email);\n notifyValues({ email });\n debounceTimer.current = null;\n }, DEBOUNCE_TIME);\n },\n [setEmailAndCheckAvailability]\n );\n\n const handleBlur = useCallback(\n (event: Event) => {\n const target = event.target as HTMLInputElement;\n const email = target.value.trim();\n const isValid = validateEmail(email);\n\n if (isValid) {\n setError('');\n target.setCustomValidity('');\n\n if (!debounceTimer.current) return;\n\n clearTimeout(debounceTimer.current);\n debounceTimer.current = null;\n setEmailAndCheckAvailability(email);\n notifyValues({ email });\n return;\n }\n\n const type = email === '' ? 'missing' : 'invalid';\n const message =\n type === 'missing' ? missingEmailError : invalidEmailError;\n\n if (onValidationError) {\n onValidationError({ email, message, type });\n return;\n }\n\n setError(message);\n target.setCustomValidity(message);\n },\n [\n invalidEmailError,\n missingEmailError,\n onValidationError,\n setEmailAndCheckAvailability,\n ]\n );\n\n const handleInvalid = useCallback(\n (event: Event) => {\n const target = event.target as HTMLInputElement;\n const validity = target.validity;\n\n const message = validity.valueMissing\n ? missingEmailError\n : invalidEmailError;\n\n if (!onValidationError) {\n setError(message);\n return;\n }\n\n onValidationError({\n email: target.value,\n message,\n type: validity.valueMissing ? 'missing' : 'invalid',\n });\n },\n [missingEmailError, invalidEmailError, onValidationError]\n );\n\n const handleSignIn = useCallback(() => {\n const email = getValue('email') ?? '';\n const isValid = validateEmail(email);\n onSignInClick?.(isValid ? email : '');\n }, [onSignInClick]);\n\n const handleSignOut = useCallback(() => {\n onSignOutClick?.();\n }, [onSignOutClick]);\n\n const handleCheckoutData = useCallback((data: Cart | null) => {\n const prevEmail = getValue('email') ?? '';\n const email = data?.email ?? '';\n\n if (email !== prevEmail) {\n setEmail(email);\n setError('');\n setIsAvailable(true);\n notifyValues({ email });\n }\n }, []);\n\n useEffect(() => {\n if (!active) return;\n\n const onAuthenticated = events.on(\n 'authenticated',\n (authenticated) => {\n setIsAuthenticated(authenticated);\n\n getCustomer()\n .then((customer) => {\n setCustomer(customer);\n })\n .catch(console.error);\n },\n { eager: true }\n );\n\n return () => {\n onAuthenticated?.off();\n };\n }, [active]);\n\n useEffect(() => {\n if (!active) return;\n\n const pastUpdate = getLatestCheckoutUpdate();\n\n if (pastUpdate) {\n setIsInitialized(true);\n // When component becomes active, restore local state from checkout data\n const checkoutEmail = pastUpdate.email ?? '';\n if (checkoutEmail) {\n setEmail(checkoutEmail);\n }\n handleCheckoutData(pastUpdate);\n return;\n }\n\n const onCheckoutInit = events.on(\n 'checkout/initialized',\n (data) => {\n setIsInitialized(true);\n handleCheckoutData(data);\n },\n { eager: true }\n );\n\n return () => {\n onCheckoutInit?.off();\n };\n }, [active, handleCheckoutData]);\n\n useEffect(() => {\n if (!active) return;\n\n const onCheckoutUpdated = events.on(\n 'checkout/updated',\n handleCheckoutData,\n { eager: false }\n );\n\n return () => {\n onCheckoutUpdated?.off();\n };\n }, [active, handleCheckoutData]);\n\n const titleContent = useMemo(() => {\n if (!displayTitle) return undefined;\n\n return (\n <Slot name=\"checkout-login-form-title\" slot={slots?.Title}>\n <h2>{defaultTitle}</h2>\n </Slot>\n );\n }, [displayTitle, slots, defaultTitle]);\n\n const headingContent = useMemo(() => {\n if (!displayHeadingContent) return undefined;\n\n return (\n <Slot\n context={{ authenticated: isAuthenticated }}\n name=\"checkout-login-form-heading-label\"\n slot={slots?.Heading}\n >\n {isAuthenticated ? (\n <SignOut onClick={handleSignOut} />\n ) : (\n <SignIn onClick={handleSignIn} />\n )}\n </Slot>\n );\n }, [\n displayHeadingContent,\n isAuthenticated,\n slots,\n handleSignIn,\n handleSignOut,\n ]);\n\n const hintContent = useMemo(() => {\n if (isAvailable) return '';\n\n return (\n <>\n {alreadyHaveAccountHint}{' '}\n <a href=\"#\" onClick={handleSignIn}>\n {signInLabel}\n </a>{' '}\n {fasterCheckoutHint}\n </>\n );\n }, [\n isAvailable,\n alreadyHaveAccountHint,\n signInLabel,\n fasterCheckoutHint,\n handleSignIn,\n ]);\n\n return (\n <LoginFormComponent\n {...props}\n customer={customer}\n email={email}\n error={error}\n headingContent={headingContent}\n hint={hintContent}\n initialized={isInitialized}\n title={titleContent}\n visible={active}\n onEmailBlur={handleBlur}\n onEmailChange={handleChange}\n onEmailInvalid={handleInvalid}\n />\n );\n};\n"],"names":["Email","value","error","hint","onChange","onBlur","onInvalid","translations","useText","jsx","Field","Input","SignIn","onClick","jsxs","event","LoginFormSkeleton","Skeleton","SkeletonRow","LoginFormComponent","className","customer","email","headingContent","name","onEmailBlur","onEmailChange","onEmailInvalid","title","props","VComponent","classes","LoginForm","WithConditionals","SignOut","DEBOUNCE_TIME","active","autoSync","displayHeadingContent","displayTitle","initialData","onCartSyncError","onSignInClick","onSignOutClick","onValidationError","slots","setCustomer","useState","setEmail","setError","isAuthenticated","setIsAuthenticated","isAvailable","setIsAvailable","isInitialized","setIsInitialized","debounceTimer","useRef","alreadyHaveAccountHint","cartSyncError","defaultTitle","fasterCheckoutHint","invalidEmailError","missingEmailError","signInLabel","setEmailAndCheckAvailability","useCallback","validateEmail","getCartEmail","isEmailAvailable","availability","setGuestEmailOnCart","handleChange","notifyValues","handleBlur","target","type","message","handleInvalid","validity","handleSignIn","getValue","isValid","handleSignOut","handleCheckoutData","data","prevEmail","useEffect","onAuthenticated","events","authenticated","getCustomer","pastUpdate","getLatestCheckoutUpdate","checkoutEmail","onCheckoutInit","onCheckoutUpdated","titleContent","useMemo","Slot","hintContent","Fragment"],"mappings":"wsCA+BO,MAAMA,G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D,EAAoBP,EAAO,GAC/B,mBACAL,EACA,CAAE,MAAO,EAAM,CACjB,EAEA,MAAO,IAAM,CACXY,GAAA,MAAAA,EAAmB,KACrB,CAAA,EACC,CAAC5D,EAAQgD,CAAkB,CAAC,EAEzB,MAAAa,GAAeC,EAAQ,IAAM,CAC7B,GAAC3D,EAGH,OAAA9B,EAAC0F,EAAK,CAAA,KAAK,4BAA4B,KAAMtD,GAAA,YAAAA,EAAO,MAClD,SAAApC,EAAC,KAAI,CAAA,SAAAmD,CAAa,CAAA,EACpB,CAED,EAAA,CAACrB,EAAcM,EAAOe,CAAY,CAAC,EAEhCrC,GAAiB2E,EAAQ,IAAM,CAC/B,GAAC5D,EAGH,OAAA7B,EAAC0F,EAAA,CACC,QAAS,CAAE,cAAejD,CAAgB,EAC1C,KAAK,oCACL,KAAML,GAAA,YAAAA,EAAO,QAEZ,SAAAK,IACEhB,GAAQ,CAAA,QAASiD,CAAe,CAAA,EAEjC1E,EAACG,GAAO,CAAA,QAASoE,CAAc,CAAA,CAAA,CAEnC,CAAA,EAED,CACD1C,EACAY,EACAL,EACAmC,EACAG,CAAA,CACD,EAEKiB,GAAcF,EAAQ,IACtB9C,EAAoB,GAInBtC,EAAAuF,GAAA,CAAA,SAAA,CAAA3C,EAAwB,MACxB,IAAE,CAAA,KAAK,IAAI,QAASsB,EAClB,SACHhB,EAAA,EAAK,IACJH,CAAA,EACH,EAED,CACDT,EACAM,EACAM,EACAH,EACAmB,CAAA,CACD,EAGC,OAAAvE,EAACU,GAAA,CACE,GAAGU,EACJ,SAAAR,EACA,MAAAC,EACA,MAAApB,EACA,eAAAqB,GACA,KAAM6E,GACN,YAAa9C,GACb,MAAO2C,GACP,QAAS7D,EACT,YAAasC,GACb,cAAeF,GACf,eAAgBM,EAAA,CAClB,CAEJ"}
|
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
import { PaymentMethodConfig } from '..';
|
|
2
2
|
|
|
3
|
-
export declare enum
|
|
3
|
+
export declare enum HandlerCode {
|
|
4
4
|
PaymentOnAccount = "companycredit",
|
|
5
5
|
PurchaseOrder = "purchaseorder"
|
|
6
6
|
}
|
|
7
|
+
export declare const handleRefNumberChange: (code: string, isRequired: boolean) => (this: any, ...args: any[]) => void;
|
|
8
|
+
export declare const resetHandlersCache: () => void;
|
|
9
|
+
export declare const createHandler: (code: HandlerCode) => PaymentMethodConfig;
|
|
7
10
|
export declare const defaultHandlers: {
|
|
8
11
|
companycredit: PaymentMethodConfig;
|
|
9
12
|
purchaseorder: PaymentMethodConfig;
|
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
* is strictly forbidden unless prior written permission is obtained
|
|
15
15
|
* from Adobe.
|
|
16
16
|
*******************************************************************/
|
|
17
|
+
export * from './handlers';
|
|
17
18
|
export * from './PaymentMethods';
|
|
18
19
|
export { PaymentMethods as default } from './PaymentMethods';
|
|
19
20
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/*! Copyright 2025 Adobe
|
|
2
2
|
All Rights Reserved. */
|
|
3
|
-
import{
|
|
3
|
+
import{h as ae,s as ce}from"../chunks/fetch-graphql.js";import{classes as V,VComponent as se,deepmerge as ie,Slot as H}from"@dropins/tools/lib.js";import{events as B}from"@dropins/tools/event-bus.js";import{v as me}from"../chunks/validation.js";import{s as q}from"../chunks/setPaymentMethod.js";import{jsxs as U,jsx as a}from"@dropins/tools/preact-jsx-runtime.js";import{useState as w,useMemo as $,useCallback as P,useEffect as j}from"@dropins/tools/preact-hooks.js";import"../chunks/TermsAndConditions.js";import{Skeleton as de,SkeletonRow as N,IllustratedMessage as ue,Icon as J,InLineAlert as le,ToggleButton as he,RadioButton as pe}from"@dropins/tools/components.js";/* empty css */import*as T from"@dropins/tools/preact-compat.js";import{useRef as fe,useEffect as ye}from"@dropins/tools/preact-compat.js";/* empty css *//* empty css *//* empty css *//* empty css */import{P as ke}from"../chunks/PurchaseOrder.js";import{P as ge}from"../chunks/PaymentOnAccount2.js";import{r as Me}from"../chunks/render.js";import{i as Se}from"../chunks/events.js";import{h as Ce,a as Pe}from"../chunks/events2.js";import{g as b,n as F}from"../chunks/values.js";import{W as ve}from"../chunks/ConditionalWrapper.js";import{s as Ee}from"../chunks/dom.js";import{useText as K}from"@dropins/tools/i18n.js";import"@dropins/tools/signals.js";import"@dropins/tools/fetch-graphql.js";import"../fragments.js";import"../chunks/guards.js";import"../chunks/synchronizeCheckout.js";import"../chunks/transform-shipping-methods.js";import"../chunks/classifiers.js";import"../chunks/getCompanyCredit.js";const _e=e=>T.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},T.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M17.93 14.8V18.75H5.97C4.75 18.75 3.75 17.97 3.75 17V6.5M3.75 6.5C3.75 5.53 4.74 4.75 5.97 4.75H15.94V8.25H5.97C4.75 8.25 3.75 7.47 3.75 6.5Z",stroke:"currentColor",strokeWidth:1,strokeLinecap:"round",strokeLinejoin:"round"}),T.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M19.35 11.64H14.04V14.81H19.35V11.64Z",stroke:"currentColor",strokeWidth:1,strokeLinecap:"round",strokeLinejoin:"round"}),T.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M17.9304 11.64V8.25H15.1504",stroke:"currentColor",strokeWidth:1,strokeLinecap:"round",strokeLinejoin:"round"})),we=()=>U(de,{"data-testid":"payment-methods-skeleton",children:[a(N,{size:"medium",variant:"heading"}),a(N,{size:"medium",variant:"empty"}),a(N,{fullWidth:!0,size:"xlarge"}),a(N,{fullWidth:!0,size:"xlarge"})]}),Ne=({UIComponentType:e="ToggleButton",busy:r,code:o,icon:m,onSelectionChange:n,selected:c,title:u})=>{const l={busy:r,className:"checkout-payment-methods__method",label:u,name:"payment-method",onChange:()=>n({code:o,title:u}),value:o};return e==="ToggleButton"?a(he,{...l,icon:m?a(J,{source:m}):void 0,selected:c}):a(pe,{...l,checked:c,icon:m??void 0})},Te=({className:e,error:r=null,busy:o=!1,onDismissError:m,onSelectionChange:n=()=>{},options:c,paymentMethodContent:u,selection:l,title:y,UIComponentType:C})=>{const M=K({EmptyState:"Checkout.PaymentMethods.emptyState"}),d=r!==null,S=fe(null);return ye(()=>{d&&S.current&&Ee(S.current)},[d]),U("div",{className:V(["checkout-payment-methods",e]),"data-testid":"checkout-payment-methods",children:[y&&a(se,{className:"checkout-payment-methods__title",node:y}),!o&&c.length===0&&a(ue,{"data-testid":"checkout-payment-methods-empty",icon:a(J,{source:_e}),message:a("p",{children:M.EmptyState})}),U("div",{className:V(["checkout-payment-methods__wrapper",["checkout-payment-methods__wrapper--busy",o]]),"data-testid":"checkout-payment-methods-wrapper",children:[a("div",{className:V(["checkout-payment-methods__methods",["checkout-payment-methods--full-width",c.length%2!==0]]),children:c==null?void 0:c.map(k=>a(Ne,{UIComponentType:C,busy:o,code:k.code,icon:k.icon,selected:(l==null?void 0:l.code)===k.code,title:k.displayLabel??!0?k.title:"",onSelectionChange:n},k.code))}),u&&a("div",{className:"checkout-payment-methods__content",children:u})]}),d&&a("div",{ref:S,className:"checkout-payment-methods__error","data-testid":"checkout-payment-methods-alert",children:a(le,{heading:r,type:"error",variant:"primary",onDismiss:m})})]})},be=ve(Te,we),Ie=(e,r)=>{let o;return function(...m){clearTimeout(o),o=setTimeout(()=>e.apply(this,m),r)}};var Oe=(e=>(e.PaymentOnAccount="companycredit",e.PurchaseOrder="purchaseorder",e))(Oe||{});const Z={companycredit:{Container:ge,autoSync:!0,formName:"payment-on-account",validateRefNumber:!1},purchaseorder:{Container:ke,autoSync:!1,formName:"purchase-order",validateRefNumber:!0}},I=new Map,Le=(e,r)=>{const o=`${e}-${r}`;if(!I.has(o)){const m=Ie(async n=>{if(!r||me(n))try{await q({code:e,purchase_order_number:n})}catch(c){console.error(`Failed to set payment method for ${e}:`,c)}},1e3);I.set(o,m)}return I.get(o)},_={},pt=()=>{Object.keys(_).forEach(e=>{delete _[e]}),I.clear()},G=e=>{if(!(e in Z))throw new Error(`Invalid handler code: ${e}`);if(_[e])return _[e];const r=Z[e],{autoSync:o,Container:m,formName:n,validateRefNumber:c}=r,u={enabled:!0,autoSync:o,render:l=>{var M;const y=String(((M=l.additionalData)==null?void 0:M.purchase_order_number)??""),C=document.createElement("div");Me.render(m,{name:n,initialReferenceNumber:y,onReferenceNumberChange:Le(e,c)})(C),l.replaceHTML(C)}};return _[e]=u,u},Ve={companycredit:G("companycredit"),purchaseorder:G("purchaseorder")};function R(e,r){return e?r.some(o=>o.code===e.code):!1}function Re(e,r){return!e||!r?!1:e.code===r.code}function Ue(e){return e?!!e.code&&!!e.title:!1}const ft=({UIComponentType:e="ToggleButton",active:r=!0,autoSync:o=!0,displayTitle:m=!0,slots:n,onCartSyncError:c,onSelectionChange:u})=>{const[l,y]=w(null),[C,M]=w(!1),[d,S]=w(null),[k,A]=w([]),Q=ae.value,h=$(()=>{const t=(n==null?void 0:n.Methods)??{};return ie(Ve,t)},[n==null?void 0:n.Methods]),X=k.filter(t=>{var s;return((s=h==null?void 0:h[t.code])==null?void 0:s.enabled)!==!1}).map(t=>{const s=(h==null?void 0:h[t.code])||{};return{...t,...s}}),{cartSyncError:W,defaultTitle:x}=K({cartSyncError:"Checkout.PaymentMethods.cartSyncError",defaultTitle:"Checkout.PaymentMethods.title"}),Y=P(t=>{S(i=>i&&{...i,additionalData:t});const s=b("selectedPaymentMethod");s&&F({selectedPaymentMethod:{...s,additionalData:t}})},[]),ee=P(()=>{y(null)},[]),f=P(t=>{y(null),S(t),F({selectedPaymentMethod:t})},[]),v=P(async(t,s)=>{if(!(Se()||Ce()))return;const p=h==null?void 0:h[t.code];((p==null?void 0:p.autoSync)??o)&&q({code:t.code}).catch(g=>{f(s??null),c==null||c({method:t,error:g}),c||y(W)})},[h,o,f,c,W]),te=P(async t=>{const s=b("selectedPaymentMethod");f(t),u==null||u(t),await v(t,s)},[u,f,v]),E=P(t=>{if(!t||t.isEmpty){f(null),A([]);return}const i=t.availablePaymentMethods??[];if(A(i),i.length===0){f(null);return}const p=t.selectedPaymentMethod??null,O=Ue(p),g=b("selectedPaymentMethod"),L=R(g,i),oe=Re(g,p);if(g&&L&&!oe){v(g,p);return}if((!g||!L)&&O&&R(p,i)){f(p);return}if((!g||!L)&&(!O||!R(p,i))){const D=i[0];f(D),v(D)}},[f,v]);j(()=>{if(!r)return;const t=Pe();if(t){M(!0);const i=b("selectedPaymentMethod");i&&S(i),E(t);return}const s=B.on("checkout/initialized",i=>{M(!0),E(i)},{eager:!0});return()=>{s==null||s.off()}},[r,E]),j(()=>{if(!r)return;const t=B.on("checkout/updated",E,{eager:!1});return()=>{t==null||t.off()}},[r,E]);const z=h[(d==null?void 0:d.code)||""],re=z?a(H,{context:{additionalData:d==null?void 0:d.additionalData,cartId:ce.cartId??"",replaceHTML(t){this.replaceWith(t)},setAdditionalData:Y},name:"PaymentMethodContent",slot:z.render},d==null?void 0:d.code):void 0,ne=$(()=>{if(m)return a(H,{name:"checkout-payment-methods-title",slot:n==null?void 0:n.Title,children:a("h2",{children:x})})},[m,n==null?void 0:n.Title,x]);return a(be,{UIComponentType:e,busy:Q,error:l,initialized:C,options:X,paymentMethodContent:re,selection:d,title:ne,visible:r,onDismissError:ee,onSelectionChange:te})};export{Oe as HandlerCode,ft as PaymentMethods,G as createHandler,ft as default,Ve as defaultHandlers,Le as handleRefNumberChange,pt as resetHandlersCache};
|
|
4
4
|
//# sourceMappingURL=PaymentMethods.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PaymentMethods.js","sources":["../../node_modules/@adobe-commerce/elsie/src/icons/Wallet.svg","/@dropins/storefront-checkout/src/components/PaymentMethods/PaymentMethodsSkeleton.tsx","/@dropins/storefront-checkout/src/components/PaymentMethods/PaymentMethods.tsx","../../node_modules/@adobe-commerce/elsie/src/lib/debounce.ts","/@dropins/storefront-checkout/src/containers/PaymentMethods/handlers.tsx","/@dropins/storefront-checkout/src/containers/PaymentMethods/PaymentMethods.tsx"],"sourcesContent":["import * as React from \"react\";\nconst SvgWallet = (props) => /* @__PURE__ */ React.createElement(\"svg\", { width: 24, height: 24, viewBox: \"0 0 24 24\", fill: \"none\", xmlns: \"http://www.w3.org/2000/svg\", ...props }, /* @__PURE__ */ React.createElement(\"path\", { vectorEffect: \"non-scaling-stroke\", d: \"M17.93 14.8V18.75H5.97C4.75 18.75 3.75 17.97 3.75 17V6.5M3.75 6.5C3.75 5.53 4.74 4.75 5.97 4.75H15.94V8.25H5.97C4.75 8.25 3.75 7.47 3.75 6.5Z\", stroke: \"currentColor\", strokeWidth: 1, strokeLinecap: \"round\", strokeLinejoin: \"round\" }), /* @__PURE__ */ React.createElement(\"path\", { vectorEffect: \"non-scaling-stroke\", d: \"M19.35 11.64H14.04V14.81H19.35V11.64Z\", stroke: \"currentColor\", strokeWidth: 1, strokeLinecap: \"round\", strokeLinejoin: \"round\" }), /* @__PURE__ */ React.createElement(\"path\", { vectorEffect: \"non-scaling-stroke\", d: \"M17.9304 11.64V8.25H15.1504\", stroke: \"currentColor\", strokeWidth: 1, strokeLinecap: \"round\", strokeLinejoin: \"round\" }));\nexport default SvgWallet;\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { Skeleton, SkeletonRow } from '@adobe-commerce/elsie/components';\nimport { FunctionComponent } from 'preact';\n\nexport const PaymentMethodsSkeleton: FunctionComponent = () => {\n return (\n <Skeleton data-testid=\"payment-methods-skeleton\">\n <SkeletonRow size=\"medium\" variant=\"heading\" />\n <SkeletonRow size=\"medium\" variant=\"empty\" />\n <SkeletonRow fullWidth={true} size=\"xlarge\" />\n <SkeletonRow fullWidth={true} size=\"xlarge\" />\n </Skeleton>\n );\n};\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { WithConditionals } from '@/checkout/components/ConditionalWrapper/ConditionalWrapper';\nimport '@/checkout/components/PaymentMethods/PaymentMethods.css';\nimport { PaymentMethodsSkeleton } from '@/checkout/components/PaymentMethods/PaymentMethodsSkeleton';\nimport { PaymentMethodConfig } from '@/checkout/containers';\nimport { PaymentMethod } from '@/checkout/data/models/payment-method';\nimport { scrollToElement } from '@/checkout/lib';\nimport { UIComponentType } from '@/checkout/types';\nimport {\n Icon,\n IllustratedMessage,\n InLineAlert,\n RadioButton,\n ToggleButton,\n} from '@adobe-commerce/elsie/components';\nimport { useText } from '@adobe-commerce/elsie/i18n';\nimport { Wallet } from '@adobe-commerce/elsie/icons';\nimport { classes, VComponent } from '@adobe-commerce/elsie/lib';\nimport { FunctionComponent, VNode } from 'preact';\nimport { HTMLAttributes, useEffect, useRef } from 'preact/compat';\n\ninterface ExtendedPaymentMethod extends PaymentMethodConfig, PaymentMethod {}\n\nexport interface PaymentMethodsProps\n extends Omit<HTMLAttributes<HTMLDivElement>, 'title'> {\n error?: string | null;\n busy?: boolean;\n onDismissError?: () => void;\n onSelectionChange?: (value: PaymentMethod) => void;\n options?: ExtendedPaymentMethod[];\n paymentMethodContent?: VNode;\n selection: PaymentMethod | null;\n title?: VNode;\n UIComponentType?: UIComponentType;\n}\n\ninterface PaymentOptionProps {\n UIComponentType?: UIComponentType;\n busy?: boolean;\n code: string;\n icon?: string;\n onSelectionChange: (value: PaymentMethod) => void;\n selected: boolean;\n title: string;\n}\n\nconst PaymentOption: FunctionComponent<PaymentOptionProps> = ({\n UIComponentType = 'ToggleButton',\n busy,\n code,\n icon,\n onSelectionChange,\n selected,\n title,\n}) => {\n const commonProps = {\n busy,\n className: 'checkout-payment-methods__method',\n label: title,\n name: 'payment-method',\n onChange: () => onSelectionChange({ code, title }),\n value: code,\n };\n\n return UIComponentType === 'ToggleButton' ? (\n <ToggleButton\n {...commonProps}\n // @ts-ignore\n icon={icon ? <Icon source={icon} /> : undefined}\n selected={selected}\n />\n ) : (\n <RadioButton {...commonProps} checked={selected} icon={icon ?? undefined} />\n );\n};\n\nconst PaymentMethodsComponent: FunctionComponent<PaymentMethodsProps> = ({\n className,\n error = null,\n busy = false,\n onDismissError,\n onSelectionChange = () => {},\n options,\n paymentMethodContent,\n selection,\n title,\n UIComponentType,\n}) => {\n const translations = useText({\n EmptyState: 'Checkout.PaymentMethods.emptyState',\n });\n\n const hasError = error !== null;\n const errorRef = useRef<HTMLDivElement>(null);\n\n useEffect(() => {\n if (hasError && errorRef.current) {\n scrollToElement(errorRef.current);\n }\n }, [hasError]);\n\n return (\n <div\n className={classes(['checkout-payment-methods', className])}\n data-testid=\"checkout-payment-methods\"\n >\n {title && (\n <VComponent className=\"checkout-payment-methods__title\" node={title} />\n )}\n\n {!busy && options!.length === 0 && (\n <IllustratedMessage\n data-testid=\"checkout-payment-methods-empty\"\n icon={<Icon source={Wallet} />}\n message={<p>{translations.EmptyState}</p>}\n />\n )}\n\n <div\n className={classes([\n 'checkout-payment-methods__wrapper',\n ['checkout-payment-methods__wrapper--busy', busy],\n ])}\n data-testid=\"checkout-payment-methods-wrapper\"\n >\n <div\n className={classes([\n 'checkout-payment-methods__methods',\n ['checkout-payment-methods--full-width', options!.length % 2 !== 0],\n ])}\n >\n {options?.map((method) => (\n <PaymentOption\n key={method.code}\n UIComponentType={UIComponentType}\n busy={busy}\n code={method.code}\n icon={method.icon}\n selected={selection?.code === method.code}\n title={method.displayLabel ?? true ? method.title : ''}\n onSelectionChange={onSelectionChange}\n />\n ))}\n </div>\n\n {paymentMethodContent && (\n <div className=\"checkout-payment-methods__content\">\n {paymentMethodContent}\n </div>\n )}\n </div>\n\n {hasError && (\n <div\n ref={errorRef}\n className=\"checkout-payment-methods__error\"\n data-testid=\"checkout-payment-methods-alert\"\n >\n <InLineAlert\n heading={error}\n type=\"error\"\n variant=\"primary\"\n onDismiss={onDismissError}\n />\n </div>\n )}\n </div>\n );\n};\n\nexport const PaymentMethods = WithConditionals(\n PaymentMethodsComponent,\n PaymentMethodsSkeleton\n);\n","/********************************************************************\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: Adobe permits you to use, modify, and distribute this \n * file in accordance with the terms of the Adobe license agreement \n * accompanying it. \n *******************************************************************/\n\nexport const debounce = (fn: Function, ms: number) => {\n let timeoutId: ReturnType<typeof setTimeout>;\n return function (this: any, ...args: any[]) {\n clearTimeout(timeoutId);\n timeoutId = setTimeout(() => fn.apply(this, args), ms);\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 { setPaymentMethod } from '@/checkout/api/index';\nimport {\n PaymentMethodConfig,\n PaymentOnAccount,\n PurchaseOrder,\n} from '@/checkout/containers';\nimport { render as Checkout } from '@/checkout/render/render';\nimport { debounce } from '@adobe-commerce/elsie/lib/debounce';\nimport { Container } from '@adobe-commerce/elsie/lib/types';\n\nconst createOrderRefHandler = (\n Container: Container<{\n initialReferenceNumber: string;\n onReferenceNumberChange: (refNumber: string) => void;\n }>,\n code: string\n): PaymentMethodConfig => ({\n enabled: true,\n autoSync: false,\n render: (ctx) => {\n const initialReferenceNumber = String(\n ctx.additionalData?.purchase_order_number ?? ''\n );\n const $wrapper = document.createElement('div');\n\n const onReferenceNumberChange = debounce((refNumber: string) => {\n setPaymentMethod({\n code,\n purchase_order_number: refNumber,\n }).catch(console.error);\n }, 1000);\n\n Checkout.render(Container, {\n initialReferenceNumber,\n onReferenceNumberChange,\n })($wrapper);\n\n ctx.replaceHTML($wrapper);\n },\n});\n\nexport enum PaymentMethods {\n PaymentOnAccount = 'companycredit',\n PurchaseOrder = 'purchaseorder',\n}\n\nexport const defaultHandlers = {\n [PaymentMethods.PaymentOnAccount]: createOrderRefHandler(\n PaymentOnAccount,\n PaymentMethods.PaymentOnAccount\n ),\n [PaymentMethods.PurchaseOrder]: createOrderRefHandler(\n PurchaseOrder,\n PaymentMethods.PurchaseOrder\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 { setPaymentMethod } from '@/checkout/api';\nimport { PaymentMethods as PaymentMethodsComponent } from '@/checkout/components/PaymentMethods/PaymentMethods';\nimport { Cart } from '@/checkout/data/models/cart';\nimport {\n AdditionalData,\n PaymentMethod,\n} from '@/checkout/data/models/payment-method';\nimport { NegotiableQuote } from '@/checkout/data/models/quote';\nimport {\n getLatestCheckoutUpdate,\n getValue,\n hasPendingUpdates,\n hasShippingAddress,\n isVirtualCart,\n notifyValues,\n state,\n} from '@/checkout/lib';\nimport { TitleProps, UIComponentType } from '@/checkout/types';\nimport { useText } from '@adobe-commerce/elsie/i18n';\nimport {\n Container,\n deepmerge,\n Slot,\n SlotProps,\n} from '@adobe-commerce/elsie/lib';\nimport { events } from '@adobe-commerce/event-bus';\nimport { HTMLAttributes } from 'preact/compat';\nimport { useCallback, useEffect, useMemo, useState } from 'preact/hooks';\nimport { defaultHandlers } from './handlers';\n\ninterface RenderContext {\n additionalData?: AdditionalData;\n cartId: string;\n replaceHTML: (domElement: HTMLElement) => void;\n setAdditionalData: (data: AdditionalData) => void;\n}\n\nexport interface PaymentMethodConfig {\n autoSync?: boolean;\n displayLabel?: boolean;\n enabled?: boolean;\n icon?: string;\n render?: SlotProps<RenderContext>;\n}\n\nexport interface PaymentMethodHandlers {\n [code: string]: PaymentMethodConfig;\n}\n\ninterface CartSyncError {\n method: PaymentMethod;\n error: Error;\n}\n\nexport interface PaymentMethodsProps\n extends HTMLAttributes<HTMLDivElement>,\n TitleProps {\n slots?: {\n Methods?: PaymentMethodHandlers;\n } & TitleProps['slots'];\n UIComponentType?: UIComponentType;\n active?: boolean;\n autoSync?: boolean;\n onCartSyncError?: (error: CartSyncError) => void;\n onSelectionChange?: (method: PaymentMethod) => void;\n}\n\nfunction isValidSelection(\n selection: PaymentMethod | null,\n options: PaymentMethod[]\n) {\n if (!selection) return false;\n return options.some((option) => option.code === selection.code);\n}\n\nfunction isEqual(a: PaymentMethod | null, b: PaymentMethod | null) {\n if (!a || !b) return false;\n return a.code === b.code;\n}\n\nfunction isValidPaymentMethod(method: PaymentMethod | null) {\n if (!method) return false;\n return !!method.code && !!method.title;\n}\n\nexport const PaymentMethods: Container<PaymentMethodsProps> = ({\n UIComponentType = 'ToggleButton',\n active = true,\n autoSync = true,\n displayTitle = true,\n slots,\n onCartSyncError,\n onSelectionChange,\n}) => {\n const [error, setError] = useState<string | null>(null);\n const [isInitialized, setIsInitialized] = useState(false);\n const [selection, setSelection] = useState<PaymentMethod | null>(null);\n const [options, setOptions] = useState<PaymentMethod[]>([]);\n const isBusy = hasPendingUpdates.value;\n\n const availableHandlers = useMemo(() => {\n const customHandlers = slots?.Methods ?? {};\n return deepmerge(defaultHandlers, customHandlers);\n }, [slots?.Methods]);\n\n const enabledOptions = options\n .filter((method) => {\n return availableHandlers?.[method.code]?.enabled !== false;\n })\n .map((method) => {\n const slotMethod = availableHandlers?.[method.code] || {};\n\n return {\n ...method,\n ...slotMethod,\n };\n });\n\n const { cartSyncError, defaultTitle } = useText({\n cartSyncError: 'Checkout.PaymentMethods.cartSyncError',\n defaultTitle: 'Checkout.PaymentMethods.title',\n });\n\n const setAdditionalData = useCallback((additionalData: AdditionalData) => {\n setSelection((prev) => {\n if (!prev) return prev;\n return { ...prev, additionalData };\n });\n\n const currentSelection = getValue('selectedPaymentMethod');\n\n if (!currentSelection) return;\n\n notifyValues({\n selectedPaymentMethod: {\n ...currentSelection,\n additionalData,\n },\n });\n }, []);\n\n const handleDismissError = useCallback(() => {\n setError(null);\n }, []);\n\n const setUserSelection = useCallback((selection: PaymentMethod | null) => {\n setError(null);\n setSelection(selection);\n notifyValues({ selectedPaymentMethod: selection });\n }, []);\n\n const setUserSelectionOnCart = useCallback(\n async (selection: PaymentMethod, fallback?: PaymentMethod | null) => {\n const canSetUserSelectionOnCart = isVirtualCart() || hasShippingAddress();\n if (!canSetUserSelectionOnCart) return;\n\n const methodConfig = availableHandlers?.[selection.code];\n const shouldAutoSync = methodConfig?.autoSync ?? autoSync;\n\n if (!shouldAutoSync) return;\n\n setPaymentMethod({ code: selection.code }).catch((error) => {\n setUserSelection(fallback ?? null);\n onCartSyncError?.({ method: selection, error });\n\n if (!onCartSyncError) {\n setError(cartSyncError);\n }\n });\n },\n [\n availableHandlers,\n autoSync,\n setUserSelection,\n onCartSyncError,\n cartSyncError,\n ]\n );\n\n const handleSelectionChange = useCallback(\n async (selection: PaymentMethod) => {\n const prevSelection = getValue('selectedPaymentMethod');\n\n setUserSelection(selection);\n onSelectionChange?.(selection);\n\n await setUserSelectionOnCart(selection, prevSelection);\n },\n [onSelectionChange, setUserSelection, setUserSelectionOnCart]\n );\n\n const handleCheckoutData = useCallback(\n (data: Cart | NegotiableQuote | null) => {\n const isEmptyCart = !data || data.isEmpty;\n\n if (isEmptyCart) {\n setUserSelection(null);\n setOptions([]);\n return;\n }\n\n const availableOptions = data.availablePaymentMethods ?? [];\n setOptions(availableOptions);\n\n if (availableOptions.length === 0) {\n setUserSelection(null);\n return;\n }\n\n const cartSelection = data.selectedPaymentMethod ?? null;\n const hasCartSelection = isValidPaymentMethod(cartSelection);\n const userSelection = getValue('selectedPaymentMethod');\n const isAvailable = isValidSelection(userSelection, availableOptions);\n const haveSameSelection = isEqual(userSelection, cartSelection);\n\n // User has valid selection that differs from cart\n if (userSelection && isAvailable && !haveSameSelection) {\n setUserSelectionOnCart(userSelection, cartSelection);\n return;\n }\n\n // User has invalid selection but cart has valid selection\n if (\n (!userSelection || !isAvailable) &&\n hasCartSelection &&\n isValidSelection(cartSelection, availableOptions)\n ) {\n setUserSelection(cartSelection);\n return;\n }\n\n // Neither user nor cart has valid selection (or both selections are unavailable)\n if (\n (!userSelection || !isAvailable) &&\n (!hasCartSelection ||\n !isValidSelection(cartSelection, availableOptions))\n ) {\n const newSelection = availableOptions[0];\n setUserSelection(newSelection);\n setUserSelectionOnCart(newSelection);\n }\n },\n [setUserSelection, setUserSelectionOnCart]\n );\n\n useEffect(() => {\n if (!active) return;\n\n const pastUpdate = getLatestCheckoutUpdate();\n\n if (pastUpdate) {\n setIsInitialized(true);\n // When component becomes active, restore key state so handleCheckoutData can work properly\n const userSelection = getValue('selectedPaymentMethod');\n if (userSelection) {\n setSelection(userSelection);\n }\n handleCheckoutData(pastUpdate);\n return;\n }\n\n const onCheckoutInit = events.on(\n 'checkout/initialized',\n (data: Cart | NegotiableQuote | null) => {\n setIsInitialized(true);\n handleCheckoutData(data);\n },\n { eager: true }\n );\n\n return () => {\n onCheckoutInit?.off();\n };\n }, [active, handleCheckoutData]);\n\n useEffect(() => {\n if (!active) return;\n\n const onCheckoutUpdated = events.on(\n 'checkout/updated',\n handleCheckoutData,\n { eager: false }\n );\n\n return () => {\n onCheckoutUpdated?.off();\n };\n }, [active, handleCheckoutData]);\n\n const selectionConfig = availableHandlers[selection?.code || ''];\n\n const paymentMethodContent = selectionConfig ? (\n <Slot\n key={selection?.code}\n context={{\n additionalData: selection?.additionalData,\n cartId: state.cartId ?? '',\n replaceHTML(domElement: HTMLElement) {\n this.replaceWith(domElement);\n },\n setAdditionalData,\n }}\n name=\"PaymentMethodContent\"\n slot={selectionConfig.render}\n />\n ) : undefined;\n\n const titleContent = useMemo(() => {\n if (!displayTitle) return undefined;\n\n return (\n <Slot name=\"checkout-payment-methods-title\" slot={slots?.Title}>\n <h2>{defaultTitle}</h2>\n </Slot>\n );\n }, [displayTitle, slots?.Title, defaultTitle]);\n\n return (\n <PaymentMethodsComponent\n UIComponentType={UIComponentType}\n busy={isBusy}\n error={error}\n initialized={isInitialized}\n options={enabledOptions}\n paymentMethodContent={paymentMethodContent}\n selection={selection}\n title={titleContent}\n visible={active}\n onDismissError={handleDismissError}\n onSelectionChange={handleSelectionChange}\n />\n );\n};\n"],"names":["SvgWallet","props","React","PaymentMethodsSkeleton","jsxs","Skeleton","jsx","SkeletonRow","PaymentOption","UIComponentType","busy","code","icon","onSelectionChange","selected","title","commonProps","ToggleButton","Icon","RadioButton","PaymentMethodsComponent","className","error","onDismissError","options","paymentMethodContent","selection","translations","useText","hasError","errorRef","useRef","useEffect","scrollToElement","classes","VComponent","IllustratedMessage","Wallet","method","InLineAlert","PaymentMethods","WithConditionals","debounce","fn","ms","timeoutId","args","createOrderRefHandler","Container","ctx","initialReferenceNumber","_a","$wrapper","onReferenceNumberChange","refNumber","setPaymentMethod","Checkout","defaultHandlers","PaymentOnAccount","PurchaseOrder","isValidSelection","option","isEqual","a","b","isValidPaymentMethod","active","autoSync","displayTitle","slots","onCartSyncError","setError","useState","isInitialized","setIsInitialized","setSelection","setOptions","isBusy","hasPendingUpdates","availableHandlers","useMemo","customHandlers","deepmerge","enabledOptions","slotMethod","cartSyncError","defaultTitle","setAdditionalData","useCallback","additionalData","prev","currentSelection","getValue","notifyValues","handleDismissError","setUserSelection","setUserSelectionOnCart","fallback","isVirtualCart","hasShippingAddress","methodConfig","handleSelectionChange","prevSelection","handleCheckoutData","data","availableOptions","cartSelection","hasCartSelection","userSelection","isAvailable","haveSameSelection","newSelection","pastUpdate","getLatestCheckoutUpdate","onCheckoutInit","events","onCheckoutUpdated","selectionConfig","Slot","state","domElement","titleContent"],"mappings":"2mDACA,MAAMA,GAAaC,GAA0BC,EAAM,cAAc,MAAO,CAAE,MAAO,GAAI,OAAQ,GAAI,QAAS,YAAa,KAAM,OAAQ,MAAO,6BAA8B,GAAGD,CAAO,EAAkBC,EAAM,cAAc,OAAQ,CAAE,aAAc,qBAAsB,EAAG,gJAAiJ,OAAQ,eAAgB,YAAa,EAAG,cAAe,QAAS,eAAgB,OAAO,CAAE,EAAmBA,EAAM,cAAc,OAAQ,CAAE,aAAc,qBAAsB,EAAG,wCAAyC,OAAQ,eAAgB,YAAa,EAAG,cAAe,QAAS,eAAgB,OAAS,CAAA,EAAmBA,EAAM,cAAc,OAAQ,CAAE,aAAc,qBAAsB,EAAG,8BAA+B,OAAQ,eAAgB,YAAa,EAAG,cAAe,QAAS,eAAgB,OAAO,CAAE,CAAC,ECmBn5BC,GAA4C,IAErDC,EAACC,GAAS,CAAA,cAAY,2BACpB,SAAA,CAAAC,EAACC,EAAY,CAAA,KAAK,SAAS,QAAQ,UAAU,EAC5CD,EAAAC,EAAA,CAAY,KAAK,SAAS,QAAQ,QAAQ,EAC1CD,EAAAC,EAAA,CAAY,UAAW,GAAM,KAAK,SAAS,EAC3CD,EAAAC,EAAA,CAAY,UAAW,GAAM,KAAK,QAAS,CAAA,CAAA,EAC9C,ECmCEC,GAAuD,CAAC,CAC5D,gBAAAC,EAAkB,eAClB,KAAAC,EACA,KAAAC,EACA,KAAAC,EACA,kBAAAC,EACA,SAAAC,EACA,MAAAC,CACF,IAAM,CACJ,MAAMC,EAAc,CAClB,KA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IAAM,CACd,GAAI,CAACkC,EAAQ,OAEb,MAAMkD,EAAoBD,EAAO,GAC/B,mBACAZ,EACA,CAAE,MAAO,EAAM,CACjB,EAEA,MAAO,IAAM,CACXa,GAAA,MAAAA,EAAmB,KACrB,CAAA,EACC,CAAClD,EAAQqC,CAAkB,CAAC,EAE/B,MAAMc,EAAkBtC,GAAkBrD,GAAA,YAAAA,EAAW,OAAQ,EAAE,EAEzDD,EAAuB4F,EAC3B/G,EAACgH,EAAA,CAEC,QAAS,CACP,eAAgB5F,GAAA,YAAAA,EAAW,eAC3B,OAAQ6F,GAAM,QAAU,GACxB,YAAYC,EAAyB,CACnC,KAAK,YAAYA,CAAU,CAC7B,EACA,kBAAAjC,CACF,EACA,KAAK,uBACL,KAAM8B,EAAgB,MAAA,EAVjB3F,GAAA,YAAAA,EAAW,IAAA,EAYhB,OAEE+F,GAAezC,EAAQ,IAAM,CAC7B,GAACZ,EAGH,OAAA9D,EAACgH,EAAK,CAAA,KAAK,iCAAiC,KAAMjD,GAAA,YAAAA,EAAO,MACvD,SAAA/D,EAAC,KAAI,CAAA,SAAAgF,CAAa,CAAA,EACpB,GAED,CAAClB,EAAcC,GAAA,YAAAA,EAAO,MAAOiB,CAAY,CAAC,EAG3C,OAAAhF,EAACc,GAAA,CACC,gBAAiBX,EACjB,KAAMoE,EACN,MAAAvD,EACA,YAAamD,EACb,QAASU,EACT,qBAAA1D,EACA,UAAAC,EACA,MAAO+F,GACP,QAASvD,EACT,eAAgB4B,EAChB,kBAAmBO,CAAA,CACrB,CAEJ","x_google_ignoreList":[0,3]}
|
|
1
|
+
{"version":3,"file":"PaymentMethods.js","sources":["../../node_modules/@adobe-commerce/elsie/src/icons/Wallet.svg","/@dropins/storefront-checkout/src/components/PaymentMethods/PaymentMethodsSkeleton.tsx","/@dropins/storefront-checkout/src/components/PaymentMethods/PaymentMethods.tsx","../../node_modules/@adobe-commerce/elsie/src/lib/debounce.ts","/@dropins/storefront-checkout/src/containers/PaymentMethods/handlers.tsx","/@dropins/storefront-checkout/src/containers/PaymentMethods/PaymentMethods.tsx"],"sourcesContent":["import * as React from \"react\";\nconst SvgWallet = (props) => /* @__PURE__ */ React.createElement(\"svg\", { width: 24, height: 24, viewBox: \"0 0 24 24\", fill: \"none\", xmlns: \"http://www.w3.org/2000/svg\", ...props }, /* @__PURE__ */ React.createElement(\"path\", { vectorEffect: \"non-scaling-stroke\", d: \"M17.93 14.8V18.75H5.97C4.75 18.75 3.75 17.97 3.75 17V6.5M3.75 6.5C3.75 5.53 4.74 4.75 5.97 4.75H15.94V8.25H5.97C4.75 8.25 3.75 7.47 3.75 6.5Z\", stroke: \"currentColor\", strokeWidth: 1, strokeLinecap: \"round\", strokeLinejoin: \"round\" }), /* @__PURE__ */ React.createElement(\"path\", { vectorEffect: \"non-scaling-stroke\", d: \"M19.35 11.64H14.04V14.81H19.35V11.64Z\", stroke: \"currentColor\", strokeWidth: 1, strokeLinecap: \"round\", strokeLinejoin: \"round\" }), /* @__PURE__ */ React.createElement(\"path\", { vectorEffect: \"non-scaling-stroke\", d: \"M17.9304 11.64V8.25H15.1504\", stroke: \"currentColor\", strokeWidth: 1, strokeLinecap: \"round\", strokeLinejoin: \"round\" }));\nexport default SvgWallet;\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { Skeleton, SkeletonRow } from '@adobe-commerce/elsie/components';\nimport { FunctionComponent } from 'preact';\n\nexport const PaymentMethodsSkeleton: FunctionComponent = () => {\n return (\n <Skeleton data-testid=\"payment-methods-skeleton\">\n <SkeletonRow size=\"medium\" variant=\"heading\" />\n <SkeletonRow size=\"medium\" variant=\"empty\" />\n <SkeletonRow fullWidth={true} size=\"xlarge\" />\n <SkeletonRow fullWidth={true} size=\"xlarge\" />\n </Skeleton>\n );\n};\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { WithConditionals } from '@/checkout/components/ConditionalWrapper/ConditionalWrapper';\nimport '@/checkout/components/PaymentMethods/PaymentMethods.css';\nimport { PaymentMethodsSkeleton } from '@/checkout/components/PaymentMethods/PaymentMethodsSkeleton';\nimport { PaymentMethodConfig } from '@/checkout/containers';\nimport { PaymentMethod } from '@/checkout/data/models/payment-method';\nimport { scrollToElement } from '@/checkout/lib';\nimport { UIComponentType } from '@/checkout/types';\nimport {\n Icon,\n IllustratedMessage,\n InLineAlert,\n RadioButton,\n ToggleButton,\n} from '@adobe-commerce/elsie/components';\nimport { useText } from '@adobe-commerce/elsie/i18n';\nimport { Wallet } from '@adobe-commerce/elsie/icons';\nimport { classes, VComponent } from '@adobe-commerce/elsie/lib';\nimport { FunctionComponent, VNode } from 'preact';\nimport { HTMLAttributes, useEffect, useRef } from 'preact/compat';\n\ninterface ExtendedPaymentMethod extends PaymentMethodConfig, PaymentMethod {}\n\nexport interface PaymentMethodsProps\n extends Omit<HTMLAttributes<HTMLDivElement>, 'title'> {\n error?: string | null;\n busy?: boolean;\n onDismissError?: () => void;\n onSelectionChange?: (value: PaymentMethod) => void;\n options?: ExtendedPaymentMethod[];\n paymentMethodContent?: VNode;\n selection: PaymentMethod | null;\n title?: VNode;\n UIComponentType?: UIComponentType;\n}\n\ninterface PaymentOptionProps {\n UIComponentType?: UIComponentType;\n busy?: boolean;\n code: string;\n icon?: string;\n onSelectionChange: (value: PaymentMethod) => void;\n selected: boolean;\n title: string;\n}\n\nconst PaymentOption: FunctionComponent<PaymentOptionProps> = ({\n UIComponentType = 'ToggleButton',\n busy,\n code,\n icon,\n onSelectionChange,\n selected,\n title,\n}) => {\n const commonProps = {\n busy,\n className: 'checkout-payment-methods__method',\n label: title,\n name: 'payment-method',\n onChange: () => onSelectionChange({ code, title }),\n value: code,\n };\n\n return UIComponentType === 'ToggleButton' ? (\n <ToggleButton\n {...commonProps}\n // @ts-ignore\n icon={icon ? <Icon source={icon} /> : undefined}\n selected={selected}\n />\n ) : (\n <RadioButton {...commonProps} checked={selected} icon={icon ?? undefined} />\n );\n};\n\nconst PaymentMethodsComponent: FunctionComponent<PaymentMethodsProps> = ({\n className,\n error = null,\n busy = false,\n onDismissError,\n onSelectionChange = () => {},\n options,\n paymentMethodContent,\n selection,\n title,\n UIComponentType,\n}) => {\n const translations = useText({\n EmptyState: 'Checkout.PaymentMethods.emptyState',\n });\n\n const hasError = error !== null;\n const errorRef = useRef<HTMLDivElement>(null);\n\n useEffect(() => {\n if (hasError && errorRef.current) {\n scrollToElement(errorRef.current);\n }\n }, [hasError]);\n\n return (\n <div\n className={classes(['checkout-payment-methods', className])}\n data-testid=\"checkout-payment-methods\"\n >\n {title && (\n <VComponent className=\"checkout-payment-methods__title\" node={title} />\n )}\n\n {!busy && options!.length === 0 && (\n <IllustratedMessage\n data-testid=\"checkout-payment-methods-empty\"\n icon={<Icon source={Wallet} />}\n message={<p>{translations.EmptyState}</p>}\n />\n )}\n\n <div\n className={classes([\n 'checkout-payment-methods__wrapper',\n ['checkout-payment-methods__wrapper--busy', busy],\n ])}\n data-testid=\"checkout-payment-methods-wrapper\"\n >\n <div\n className={classes([\n 'checkout-payment-methods__methods',\n ['checkout-payment-methods--full-width', options!.length % 2 !== 0],\n ])}\n >\n {options?.map((method) => (\n <PaymentOption\n key={method.code}\n UIComponentType={UIComponentType}\n busy={busy}\n code={method.code}\n icon={method.icon}\n selected={selection?.code === method.code}\n title={method.displayLabel ?? true ? method.title : ''}\n onSelectionChange={onSelectionChange}\n />\n ))}\n </div>\n\n {paymentMethodContent && (\n <div className=\"checkout-payment-methods__content\">\n {paymentMethodContent}\n </div>\n )}\n </div>\n\n {hasError && (\n <div\n ref={errorRef}\n className=\"checkout-payment-methods__error\"\n data-testid=\"checkout-payment-methods-alert\"\n >\n <InLineAlert\n heading={error}\n type=\"error\"\n variant=\"primary\"\n onDismiss={onDismissError}\n />\n </div>\n )}\n </div>\n );\n};\n\nexport const PaymentMethods = WithConditionals(\n PaymentMethodsComponent,\n PaymentMethodsSkeleton\n);\n","/********************************************************************\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: Adobe permits you to use, modify, and distribute this \n * file in accordance with the terms of the Adobe license agreement \n * accompanying it. \n *******************************************************************/\n\nexport const debounce = (fn: Function, ms: number) => {\n let timeoutId: ReturnType<typeof setTimeout>;\n return function (this: any, ...args: any[]) {\n clearTimeout(timeoutId);\n timeoutId = setTimeout(() => fn.apply(this, args), ms);\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 { setPaymentMethod } from '@/checkout/api';\nimport {\n PaymentMethodConfig,\n PaymentOnAccount,\n PurchaseOrder,\n} from '@/checkout/containers';\nimport { validateNotEmpty } from '@/checkout/lib/validation';\nimport { render as Checkout } from '@/checkout/render/render';\nimport { Container } from '@adobe-commerce/elsie/lib';\nimport { debounce } from '@adobe-commerce/elsie/lib/debounce';\n\ninterface HandlerConfig {\n Container: Container<any>;\n autoSync: boolean;\n formName?: string;\n validateRefNumber: boolean;\n}\n\nexport enum HandlerCode {\n PaymentOnAccount = 'companycredit',\n PurchaseOrder = 'purchaseorder',\n}\n\nconst HANDLERS_CONFIG: Record<HandlerCode, HandlerConfig> = {\n [HandlerCode.PaymentOnAccount]: {\n Container: PaymentOnAccount,\n autoSync: true,\n formName: 'payment-on-account',\n validateRefNumber: false,\n },\n [HandlerCode.PurchaseOrder]: {\n Container: PurchaseOrder,\n autoSync: false,\n formName: 'purchase-order',\n validateRefNumber: true,\n },\n} as const;\n\n// Cache for debounced handlers to prevent memory leaks\nconst debouncedHandlers = new Map<string, ReturnType<typeof debounce>>();\n\nexport const handleRefNumberChange = (code: string, isRequired: boolean) => {\n const key = `${code}-${isRequired}`;\n\n if (!debouncedHandlers.has(key)) {\n const debouncedFn = debounce(async (refNumber: string) => {\n if (!isRequired || validateNotEmpty(refNumber)) {\n try {\n await setPaymentMethod({\n code,\n purchase_order_number: refNumber,\n });\n } catch (error) {\n console.error(`Failed to set payment method for ${code}:`, error);\n }\n }\n }, 1000);\n\n debouncedHandlers.set(key, debouncedFn);\n }\n\n return debouncedHandlers.get(key)!;\n};\n\nconst handlerCache: Partial<Record<HandlerCode, PaymentMethodConfig>> = {};\n\nexport const resetHandlersCache = () => {\n Object.keys(handlerCache).forEach((key) => {\n delete handlerCache[key as HandlerCode];\n });\n\n debouncedHandlers.clear();\n};\n\nexport const createHandler = (code: HandlerCode): PaymentMethodConfig => {\n if (!(code in HANDLERS_CONFIG)) {\n throw new Error(`Invalid handler code: ${code}`);\n }\n\n if (handlerCache[code]) {\n return handlerCache[code] as PaymentMethodConfig;\n }\n\n const config = HANDLERS_CONFIG[code];\n\n const { autoSync, Container, formName, validateRefNumber } = config;\n\n const handler: PaymentMethodConfig = {\n enabled: true,\n autoSync,\n render: (ctx) => {\n const initialReferenceNumber = String(\n ctx.additionalData?.purchase_order_number ?? ''\n );\n\n const $wrapper = document.createElement('div');\n\n Checkout.render(Container, {\n name: formName,\n initialReferenceNumber,\n onReferenceNumberChange: handleRefNumberChange(code, validateRefNumber),\n })($wrapper);\n\n ctx.replaceHTML($wrapper);\n },\n };\n\n handlerCache[code] = handler;\n\n return handler;\n};\n\nexport const defaultHandlers = {\n [HandlerCode.PaymentOnAccount]: createHandler(HandlerCode.PaymentOnAccount),\n [HandlerCode.PurchaseOrder]: createHandler(HandlerCode.PurchaseOrder),\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 { setPaymentMethod } from '@/checkout/api';\nimport { PaymentMethods as PaymentMethodsComponent } from '@/checkout/components/PaymentMethods/PaymentMethods';\nimport { Cart } from '@/checkout/data/models/cart';\nimport {\n AdditionalData,\n PaymentMethod,\n} from '@/checkout/data/models/payment-method';\nimport { NegotiableQuote } from '@/checkout/data/models/quote';\nimport {\n getLatestCheckoutUpdate,\n getValue,\n hasPendingUpdates,\n hasShippingAddress,\n isVirtualCart,\n notifyValues,\n state,\n} from '@/checkout/lib';\nimport { TitleProps, UIComponentType } from '@/checkout/types';\nimport { useText } from '@adobe-commerce/elsie/i18n';\nimport {\n Container,\n deepmerge,\n Slot,\n SlotProps,\n} from '@adobe-commerce/elsie/lib';\nimport { events } from '@adobe-commerce/event-bus';\nimport { HTMLAttributes } from 'preact/compat';\nimport { useCallback, useEffect, useMemo, useState } from 'preact/hooks';\nimport { defaultHandlers } from './handlers';\n\ninterface RenderContext {\n additionalData?: AdditionalData;\n cartId: string;\n replaceHTML: (domElement: HTMLElement) => void;\n setAdditionalData: (data: AdditionalData) => void;\n}\n\nexport interface PaymentMethodConfig {\n autoSync?: boolean;\n displayLabel?: boolean;\n enabled?: boolean;\n icon?: string;\n render?: SlotProps<RenderContext>;\n}\n\nexport interface PaymentMethodHandlers {\n [code: string]: PaymentMethodConfig;\n}\n\ninterface CartSyncError {\n method: PaymentMethod;\n error: Error;\n}\n\nexport interface PaymentMethodsProps\n extends HTMLAttributes<HTMLDivElement>,\n TitleProps {\n slots?: {\n Methods?: PaymentMethodHandlers;\n } & TitleProps['slots'];\n UIComponentType?: UIComponentType;\n active?: boolean;\n autoSync?: boolean;\n onCartSyncError?: (error: CartSyncError) => void;\n onSelectionChange?: (method: PaymentMethod) => void;\n}\n\nfunction isValidSelection(\n selection: PaymentMethod | null,\n options: PaymentMethod[]\n) {\n if (!selection) return false;\n return options.some((option) => option.code === selection.code);\n}\n\nfunction isEqual(a: PaymentMethod | null, b: PaymentMethod | null) {\n if (!a || !b) return false;\n return a.code === b.code;\n}\n\nfunction isValidPaymentMethod(method: PaymentMethod | null) {\n if (!method) return false;\n return !!method.code && !!method.title;\n}\n\nexport const PaymentMethods: Container<PaymentMethodsProps> = ({\n UIComponentType = 'ToggleButton',\n active = true,\n autoSync = true,\n displayTitle = true,\n slots,\n onCartSyncError,\n onSelectionChange,\n}) => {\n const [error, setError] = useState<string | null>(null);\n const [isInitialized, setIsInitialized] = useState(false);\n const [selection, setSelection] = useState<PaymentMethod | null>(null);\n const [options, setOptions] = useState<PaymentMethod[]>([]);\n const isBusy = hasPendingUpdates.value;\n\n const availableHandlers = useMemo(() => {\n const customHandlers = slots?.Methods ?? {};\n return deepmerge(defaultHandlers, customHandlers);\n }, [slots?.Methods]);\n\n const enabledOptions = options\n .filter((method) => {\n return availableHandlers?.[method.code]?.enabled !== false;\n })\n .map((method) => {\n const slotMethod = availableHandlers?.[method.code] || {};\n\n return {\n ...method,\n ...slotMethod,\n };\n });\n\n const { cartSyncError, defaultTitle } = useText({\n cartSyncError: 'Checkout.PaymentMethods.cartSyncError',\n defaultTitle: 'Checkout.PaymentMethods.title',\n });\n\n const setAdditionalData = useCallback((additionalData: AdditionalData) => {\n setSelection((prev) => {\n if (!prev) return prev;\n return { ...prev, additionalData };\n });\n\n const currentSelection = getValue('selectedPaymentMethod');\n\n if (!currentSelection) return;\n\n notifyValues({\n selectedPaymentMethod: {\n ...currentSelection,\n additionalData,\n },\n });\n }, []);\n\n const handleDismissError = useCallback(() => {\n setError(null);\n }, []);\n\n const setUserSelection = useCallback((selection: PaymentMethod | null) => {\n setError(null);\n setSelection(selection);\n notifyValues({ selectedPaymentMethod: selection });\n }, []);\n\n const setUserSelectionOnCart = useCallback(\n async (selection: PaymentMethod, fallback?: PaymentMethod | null) => {\n const canSetUserSelectionOnCart = isVirtualCart() || hasShippingAddress();\n if (!canSetUserSelectionOnCart) return;\n\n const methodConfig = availableHandlers?.[selection.code];\n const shouldAutoSync = methodConfig?.autoSync ?? autoSync;\n\n if (!shouldAutoSync) return;\n\n setPaymentMethod({ code: selection.code }).catch((error) => {\n setUserSelection(fallback ?? null);\n onCartSyncError?.({ method: selection, error });\n\n if (!onCartSyncError) {\n setError(cartSyncError);\n }\n });\n },\n [\n availableHandlers,\n autoSync,\n setUserSelection,\n onCartSyncError,\n cartSyncError,\n ]\n );\n\n const handleSelectionChange = useCallback(\n async (selection: PaymentMethod) => {\n const prevSelection = getValue('selectedPaymentMethod');\n\n setUserSelection(selection);\n onSelectionChange?.(selection);\n\n await setUserSelectionOnCart(selection, prevSelection);\n },\n [onSelectionChange, setUserSelection, setUserSelectionOnCart]\n );\n\n const handleCheckoutData = useCallback(\n (data: Cart | NegotiableQuote | null) => {\n const isEmptyCart = !data || data.isEmpty;\n\n if (isEmptyCart) {\n setUserSelection(null);\n setOptions([]);\n return;\n }\n\n const availableOptions = data.availablePaymentMethods ?? [];\n setOptions(availableOptions);\n\n if (availableOptions.length === 0) {\n setUserSelection(null);\n return;\n }\n\n const cartSelection = data.selectedPaymentMethod ?? null;\n const hasCartSelection = isValidPaymentMethod(cartSelection);\n const userSelection = getValue('selectedPaymentMethod');\n const isAvailable = isValidSelection(userSelection, availableOptions);\n const haveSameSelection = isEqual(userSelection, cartSelection);\n\n // User has valid selection that differs from cart\n if (userSelection && isAvailable && !haveSameSelection) {\n setUserSelectionOnCart(userSelection, cartSelection);\n return;\n }\n\n // User has invalid selection but cart has valid selection\n if (\n (!userSelection || !isAvailable) &&\n hasCartSelection &&\n isValidSelection(cartSelection, availableOptions)\n ) {\n setUserSelection(cartSelection);\n return;\n }\n\n // Neither user nor cart has valid selection (or both selections are unavailable)\n if (\n (!userSelection || !isAvailable) &&\n (!hasCartSelection ||\n !isValidSelection(cartSelection, availableOptions))\n ) {\n const newSelection = availableOptions[0];\n setUserSelection(newSelection);\n setUserSelectionOnCart(newSelection);\n }\n },\n [setUserSelection, setUserSelectionOnCart]\n );\n\n useEffect(() => {\n if (!active) return;\n\n const pastUpdate = getLatestCheckoutUpdate();\n\n if (pastUpdate) {\n setIsInitialized(true);\n // When component becomes active, restore key state so handleCheckoutData can work properly\n const userSelection = getValue('selectedPaymentMethod');\n if (userSelection) {\n setSelection(userSelection);\n }\n handleCheckoutData(pastUpdate);\n return;\n }\n\n const onCheckoutInit = events.on(\n 'checkout/initialized',\n (data: Cart | NegotiableQuote | null) => {\n setIsInitialized(true);\n handleCheckoutData(data);\n },\n { eager: true }\n );\n\n return () => {\n onCheckoutInit?.off();\n };\n }, [active, handleCheckoutData]);\n\n useEffect(() => {\n if (!active) return;\n\n const onCheckoutUpdated = events.on(\n 'checkout/updated',\n handleCheckoutData,\n { eager: false }\n );\n\n return () => {\n onCheckoutUpdated?.off();\n };\n }, [active, handleCheckoutData]);\n\n const selectionConfig = availableHandlers[selection?.code || ''];\n\n const paymentMethodContent = selectionConfig ? (\n <Slot\n key={selection?.code}\n context={{\n additionalData: selection?.additionalData,\n cartId: state.cartId ?? '',\n replaceHTML(domElement: HTMLElement) {\n this.replaceWith(domElement);\n },\n setAdditionalData,\n }}\n name=\"PaymentMethodContent\"\n slot={selectionConfig.render}\n />\n ) : undefined;\n\n const titleContent = useMemo(() => {\n if (!displayTitle) return undefined;\n\n return (\n <Slot name=\"checkout-payment-methods-title\" slot={slots?.Title}>\n <h2>{defaultTitle}</h2>\n </Slot>\n );\n }, [displayTitle, slots?.Title, defaultTitle]);\n\n return (\n <PaymentMethodsComponent\n UIComponentType={UIComponentType}\n busy={isBusy}\n error={error}\n initialized={isInitialized}\n options={enabledOptions}\n paymentMethodContent={paymentMethodContent}\n selection={selection}\n title={titleContent}\n visible={active}\n onDismissError={handleDismissError}\n onSelectionChange={handleSelectionChange}\n />\n );\n};\n"],"names":["SvgWallet","props","React","PaymentMethodsSkeleton","jsxs","Skeleton","jsx","SkeletonRow","PaymentOption","UIComponentType","busy","code","icon","onSelectionChange","selected","title","commonProps","ToggleButton","Icon","RadioButton","PaymentMethodsComponent","className","error","onDismissError","options","paymentMethodContent","selection","translations","useText","hasError","errorRef","useRef","useEffect","scrollToElement","classes","VComponent","IllustratedMessage","Wallet","method","InLineAlert","PaymentMethods","WithConditionals","debounce","fn","ms","timeoutId","args","HandlerCode","HANDLERS_CONFIG","PaymentOnAccount","PurchaseOrder","debouncedHandlers","handleRefNumberChange","isRequired","key","debouncedFn","refNumber","validateNotEmpty","setPaymentMethod","handlerCache","resetHandlersCache","createHandler","config","autoSync","Container","formName","validateRefNumber","handler","ctx","initialReferenceNumber","_a","$wrapper","Checkout","defaultHandlers","isValidSelection","option","isEqual","a","b","isValidPaymentMethod","active","displayTitle","slots","onCartSyncError","setError","useState","isInitialized","setIsInitialized","setSelection","setOptions","isBusy","hasPendingUpdates","availableHandlers","useMemo","customHandlers","deepmerge","enabledOptions","slotMethod","cartSyncError","defaultTitle","setAdditionalData","useCallback","additionalData","prev","currentSelection","getValue","notifyValues","handleDismissError","setUserSelection","setUserSelectionOnCart","fallback","isVirtualCart","hasShippingAddress","methodConfig","handleSelectionChange","prevSelection","handleCheckoutData","data","availableOptions","cartSelection","hasCartSelection","userSelection","isAvailable","haveSameSelection","new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AAA,YAAAA,EAAW,eAC3B,OAAQ0G,GAAM,QAAU,GACxB,YAAYC,EAAyB,CACnC,KAAK,YAAYA,CAAU,CAC7B,EACA,kBAAAjC,CACF,EACA,KAAK,uBACL,KAAM8B,EAAgB,MAAA,EAVjBxG,GAAA,YAAAA,EAAW,IAAA,EAYhB,OAEE4G,GAAezC,EAAQ,IAAM,CAC7B,GAACZ,EAGH,OAAA3E,EAAC6H,EAAK,CAAA,KAAK,iCAAiC,KAAMjD,GAAA,YAAAA,EAAO,MACvD,SAAA5E,EAAC,KAAI,CAAA,SAAA6F,CAAa,CAAA,EACpB,GAED,CAAClB,EAAcC,GAAA,YAAAA,EAAO,MAAOiB,CAAY,CAAC,EAG3C,OAAA7F,EAACc,GAAA,CACC,gBAAiBX,EACjB,KAAMiF,EACN,MAAApE,EACA,YAAagE,EACb,QAASU,EACT,qBAAAvE,GACA,UAAAC,EACA,MAAO4G,GACP,QAAStD,EACT,eAAgB2B,GAChB,kBAAmBO,EAAA,CACrB,CAEJ","x_google_ignoreList":[0,3]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/*! Copyright 2025 Adobe
|
|
2
2
|
All Rights Reserved. */
|
|
3
|
-
import{P as
|
|
3
|
+
import{P as b,P as g}from"../chunks/PurchaseOrder.js";import"@dropins/tools/preact-jsx-runtime.js";import"../chunks/TermsAndConditions.js";import"@dropins/tools/lib.js";import"@dropins/tools/components.js";/* empty css */import"../chunks/fetch-graphql.js";import"@dropins/tools/event-bus.js";import"@dropins/tools/signals.js";import"@dropins/tools/fetch-graphql.js";import"../chunks/validation.js";import"@dropins/tools/preact-compat.js";/* empty css *//* empty css */import"@dropins/tools/i18n.js";/* empty css */import"@dropins/tools/preact-hooks.js";export{b as PurchaseOrder,g as default};
|
|
4
4
|
//# sourceMappingURL=PurchaseOrder.js.map
|
package/data/models/address.d.ts
CHANGED
|
@@ -51,8 +51,6 @@ declare const transformCartShippingAddress: (data: ({
|
|
|
51
51
|
label: string;
|
|
52
52
|
};
|
|
53
53
|
custom_attributes: ({
|
|
54
|
-
__typename?: "AttributeFile" | undefined;
|
|
55
|
-
} | {
|
|
56
54
|
__typename?: "AttributeSelectedOptions" | undefined;
|
|
57
55
|
} | {
|
|
58
56
|
__typename?: "AttributeValue" | undefined;
|
|
@@ -9,6 +9,7 @@ declare const transformQuoteShippingAddress: (data: ({
|
|
|
9
9
|
__typename?: "NegotiableQuoteShippingAddress" | undefined;
|
|
10
10
|
city: string;
|
|
11
11
|
company?: string | null | undefined;
|
|
12
|
+
customer_address_uid?: string | null | undefined;
|
|
12
13
|
fax?: string | null | undefined;
|
|
13
14
|
firstname: string;
|
|
14
15
|
lastname: string;
|
|
@@ -49,8 +50,6 @@ declare const transformQuoteShippingAddress: (data: ({
|
|
|
49
50
|
label: string;
|
|
50
51
|
};
|
|
51
52
|
custom_attributes?: ({
|
|
52
|
-
__typename?: "AttributeFile" | undefined;
|
|
53
|
-
} | {
|
|
54
53
|
__typename?: "AttributeSelectedOptions" | undefined;
|
|
55
54
|
} | {
|
|
56
55
|
__typename?: "AttributeValue" | undefined;
|
package/fragments.js
CHANGED
|
@@ -20,7 +20,7 @@ const e=`
|
|
|
20
20
|
currency
|
|
21
21
|
}
|
|
22
22
|
}
|
|
23
|
-
`,
|
|
23
|
+
`,_=`
|
|
24
24
|
fragment SELECTED_SHIPPING_METHOD_FRAGMENT on SelectedShippingMethod {
|
|
25
25
|
amount {
|
|
26
26
|
currency
|
|
@@ -112,8 +112,8 @@ const e=`
|
|
|
112
112
|
}
|
|
113
113
|
|
|
114
114
|
${e}
|
|
115
|
-
${
|
|
116
|
-
`,
|
|
115
|
+
${_}
|
|
116
|
+
`,t=`
|
|
117
117
|
fragment AVAILABLE_PAYMENT_METHOD_FRAGMENT on AvailablePaymentMethod {
|
|
118
118
|
code
|
|
119
119
|
title
|
|
@@ -146,7 +146,7 @@ const e=`
|
|
|
146
146
|
|
|
147
147
|
${a}
|
|
148
148
|
${i}
|
|
149
|
-
${
|
|
149
|
+
${t}
|
|
150
150
|
${E}
|
|
151
151
|
`,r=`
|
|
152
152
|
fragment CUSTOMER_FRAGMENT on Customer {
|
|
@@ -154,7 +154,7 @@ const e=`
|
|
|
154
154
|
lastname
|
|
155
155
|
email
|
|
156
156
|
}
|
|
157
|
-
`,
|
|
157
|
+
`,o=`
|
|
158
158
|
fragment NEGOTIABLE_QUOTE_BILLING_ADDRESS_FRAGMENT on NegotiableQuoteBillingAddress {
|
|
159
159
|
city
|
|
160
160
|
company
|
|
@@ -168,6 +168,7 @@ const e=`
|
|
|
168
168
|
value
|
|
169
169
|
}
|
|
170
170
|
}
|
|
171
|
+
customer_address_uid
|
|
171
172
|
fax
|
|
172
173
|
firstname
|
|
173
174
|
lastname
|
|
@@ -185,7 +186,7 @@ const e=`
|
|
|
185
186
|
uid
|
|
186
187
|
vat_id
|
|
187
188
|
}
|
|
188
|
-
`,
|
|
189
|
+
`,n=`
|
|
189
190
|
fragment NEGOTIABLE_QUOTE_SHIPPING_ADDRESS_FRAGMENT on NegotiableQuoteShippingAddress {
|
|
190
191
|
available_shipping_methods {
|
|
191
192
|
...AVAILABLE_SHIPPING_METHOD_FRAGMENT
|
|
@@ -202,6 +203,7 @@ const e=`
|
|
|
202
203
|
value
|
|
203
204
|
}
|
|
204
205
|
}
|
|
206
|
+
customer_address_uid
|
|
205
207
|
fax
|
|
206
208
|
firstname
|
|
207
209
|
lastname
|
|
@@ -224,7 +226,7 @@ const e=`
|
|
|
224
226
|
}
|
|
225
227
|
|
|
226
228
|
${e}
|
|
227
|
-
${
|
|
229
|
+
${_}
|
|
228
230
|
`,T=`
|
|
229
231
|
fragment NEGOTIABLE_QUOTE_FRAGMENT on NegotiableQuote {
|
|
230
232
|
available_payment_methods {
|
|
@@ -247,9 +249,9 @@ const e=`
|
|
|
247
249
|
uid
|
|
248
250
|
}
|
|
249
251
|
|
|
250
|
-
${n}
|
|
251
252
|
${o}
|
|
252
|
-
${
|
|
253
|
+
${n}
|
|
254
|
+
${t}
|
|
253
255
|
${E}
|
|
254
|
-
`;export{
|
|
256
|
+
`;export{t as AVAILABLE_PAYMENT_METHOD_FRAGMENT,e as AVAILABLE_SHIPPING_METHOD_FRAGMENT,a as BILLING_CART_ADDRESS_FRAGMENT,A as CHECKOUT_DATA_FRAGMENT,r as CUSTOMER_FRAGMENT,o as NEGOTIABLE_QUOTE_BILLING_ADDRESS_FRAGMENT,T as NEGOTIABLE_QUOTE_FRAGMENT,n as NEGOTIABLE_QUOTE_SHIPPING_ADDRESS_FRAGMENT,E as SELECTED_PAYMENT_METHOD_FRAGMENT,_ as SELECTED_SHIPPING_METHOD_FRAGMENT,i as SHIPPING_CART_ADDRESS_FRAGMENT};
|
|
255
257
|
//# sourceMappingURL=fragments.js.map
|
package/fragments.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fragments.js","sources":["/@dropins/storefront-checkout/src/api/graphql/ShippingMethodFragment.graphql.ts","/@dropins/storefront-checkout/src/api/graphql/CartAddressFragment.graphql.ts","/@dropins/storefront-checkout/src/api/graphql/PaymentMethodFragment.graphql.ts","/@dropins/storefront-checkout/src/api/graphql/CheckoutDataFragment.graphql.ts","/@dropins/storefront-checkout/src/api/graphql/CustomerFragment.graphql.ts","/@dropins/storefront-checkout/src/api/graphql/NegotiableQuoteAddressFragment.graphql.ts","/@dropins/storefront-checkout/src/api/graphql/NegotiableQuoteFragment.graphql.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 const AVAILABLE_SHIPPING_METHOD_FRAGMENT = /* GraphQL */ `\n fragment AVAILABLE_SHIPPING_METHOD_FRAGMENT on AvailableShippingMethod {\n amount {\n currency\n value\n }\n carrier_code\n carrier_title\n error_message\n method_code\n method_title\n price_excl_tax {\n value\n currency\n }\n price_incl_tax {\n value\n currency\n }\n }\n`;\n\nexport const SELECTED_SHIPPING_METHOD_FRAGMENT = /* GraphQL */ `\n fragment SELECTED_SHIPPING_METHOD_FRAGMENT on SelectedShippingMethod {\n amount {\n currency\n value\n }\n carrier_code\n carrier_title\n method_code\n method_title\n price_excl_tax {\n value\n currency\n }\n price_incl_tax {\n value\n currency\n }\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 AVAILABLE_SHIPPING_METHOD_FRAGMENT,\n SELECTED_SHIPPING_METHOD_FRAGMENT,\n} from './ShippingMethodFragment.graphql';\n\nexport const BILLING_CART_ADDRESS_FRAGMENT = /* GraphQL */ `\n fragment BILLING_CART_ADDRESS_FRAGMENT on BillingCartAddress {\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 id\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`;\n\nexport const SHIPPING_CART_ADDRESS_FRAGMENT = /* GraphQL */ `\n fragment SHIPPING_CART_ADDRESS_FRAGMENT on ShippingCartAddress {\n available_shipping_methods {\n ...AVAILABLE_SHIPPING_METHOD_FRAGMENT\n }\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 id\n lastname\n middlename\n postcode\n prefix\n region {\n region_id\n code\n label\n }\n same_as_billing\n selected_shipping_method {\n ...SELECTED_SHIPPING_METHOD_FRAGMENT\n }\n street\n suffix\n telephone\n uid\n vat_id\n }\n\n ${AVAILABLE_SHIPPING_METHOD_FRAGMENT}\n ${SELECTED_SHIPPING_METHOD_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\nexport const AVAILABLE_PAYMENT_METHOD_FRAGMENT = /* GraphQL */ `\n fragment AVAILABLE_PAYMENT_METHOD_FRAGMENT on AvailablePaymentMethod {\n code\n title\n }\n`;\n\nexport const SELECTED_PAYMENT_METHOD_FRAGMENT = /* GraphQL */ `\n fragment SELECTED_PAYMENT_METHOD_FRAGMENT on SelectedPaymentMethod {\n code\n title\n purchase_order_number\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 BILLING_CART_ADDRESS_FRAGMENT,\n SHIPPING_CART_ADDRESS_FRAGMENT,\n} from './CartAddressFragment.graphql';\nimport {\n AVAILABLE_PAYMENT_METHOD_FRAGMENT,\n SELECTED_PAYMENT_METHOD_FRAGMENT,\n} from './PaymentMethodFragment.graphql';\n\nexport const CHECKOUT_DATA_FRAGMENT = /* GraphQL */ `\n fragment CHECKOUT_DATA_FRAGMENT on Cart {\n id\n is_virtual\n email\n total_quantity\n billing_address {\n ...BILLING_CART_ADDRESS_FRAGMENT\n }\n shipping_addresses {\n ...SHIPPING_CART_ADDRESS_FRAGMENT\n }\n available_payment_methods {\n ...AVAILABLE_PAYMENT_METHOD_FRAGMENT\n }\n selected_payment_method {\n ...SELECTED_PAYMENT_METHOD_FRAGMENT\n }\n }\n\n ${BILLING_CART_ADDRESS_FRAGMENT}\n ${SHIPPING_CART_ADDRESS_FRAGMENT}\n ${AVAILABLE_PAYMENT_METHOD_FRAGMENT}\n ${SELECTED_PAYMENT_METHOD_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\nexport const CUSTOMER_FRAGMENT = /* GraphQL */ `\n fragment CUSTOMER_FRAGMENT on Customer {\n firstname\n lastname\n email\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 {\n AVAILABLE_SHIPPING_METHOD_FRAGMENT,\n SELECTED_SHIPPING_METHOD_FRAGMENT,\n} from './ShippingMethodFragment.graphql';\n\nexport const NEGOTIABLE_QUOTE_BILLING_ADDRESS_FRAGMENT = /* GraphQL */ `\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`;\n\nexport const NEGOTIABLE_QUOTE_SHIPPING_ADDRESS_FRAGMENT = /* GraphQL */ `\n fragment NEGOTIABLE_QUOTE_SHIPPING_ADDRESS_FRAGMENT on NegotiableQuoteShippingAddress {\n available_shipping_methods {\n ...AVAILABLE_SHIPPING_METHOD_FRAGMENT\n }\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 selected_shipping_method {\n ...SELECTED_SHIPPING_METHOD_FRAGMENT\n }\n street\n suffix\n telephone\n uid\n vat_id\n }\n\n ${AVAILABLE_SHIPPING_METHOD_FRAGMENT}\n ${SELECTED_SHIPPING_METHOD_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 {\n NEGOTIABLE_QUOTE_BILLING_ADDRESS_FRAGMENT,\n NEGOTIABLE_QUOTE_SHIPPING_ADDRESS_FRAGMENT,\n} from './NegotiableQuoteAddressFragment.graphql';\n\nimport {\n AVAILABLE_PAYMENT_METHOD_FRAGMENT,\n SELECTED_PAYMENT_METHOD_FRAGMENT,\n} from './PaymentMethodFragment.graphql';\n\nexport const NEGOTIABLE_QUOTE_FRAGMENT = /* GraphQL */ `\n fragment NEGOTIABLE_QUOTE_FRAGMENT on NegotiableQuote {\n available_payment_methods {\n ...AVAILABLE_PAYMENT_METHOD_FRAGMENT\n }\n billing_address {\n ...NEGOTIABLE_QUOTE_BILLING_ADDRESS_FRAGMENT\n }\n email\n is_virtual\n name\n selected_payment_method {\n ...SELECTED_PAYMENT_METHOD_FRAGMENT\n }\n shipping_addresses {\n ...NEGOTIABLE_QUOTE_SHIPPING_ADDRESS_FRAGMENT\n }\n status\n total_quantity\n uid\n }\n\n ${NEGOTIABLE_QUOTE_BILLING_ADDRESS_FRAGMENT}\n ${NEGOTIABLE_QUOTE_SHIPPING_ADDRESS_FRAGMENT}\n ${AVAILABLE_PAYMENT_METHOD_FRAGMENT}\n ${SELECTED_PAYMENT_METHOD_FRAGMENT}\n`;\n"],"names":["AVAILABLE_SHIPPING_METHOD_FRAGMENT","SELECTED_SHIPPING_METHOD_FRAGMENT","BILLING_CART_ADDRESS_FRAGMENT","SHIPPING_CART_ADDRESS_FRAGMENT","AVAILABLE_PAYMENT_METHOD_FRAGMENT","SELECTED_PAYMENT_METHOD_FRAGMENT","CHECKOUT_DATA_FRAGMENT","CUSTOMER_FRAGMENT","NEGOTIABLE_QUOTE_BILLING_ADDRESS_FRAGMENT","NEGOTIABLE_QUOTE_SHIPPING_ADDRESS_FRAGMENT","NEGOTIABLE_QUOTE_FRAGMENT"],"mappings":"AAiBa,MAAAA,EAAmD;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAsBnDC,EAAkD;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,ECjBlDC,EAA8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AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAsCpET,CAAkC;AAAA,IAClCC,CAAiC;AAAA,ECnExBS,EAA0C;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAsBnDF,CAAyC;AAAA,IACzCC,CAA0C;AAAA,IAC1CL,CAAiC;AAAA,IACjCC,CAAgC;"}
|
|
1
|
+
{"version":3,"file":"fragments.js","sources":["/@dropins/storefront-checkout/src/api/graphql/ShippingMethodFragment.graphql.ts","/@dropins/storefront-checkout/src/api/graphql/CartAddressFragment.graphql.ts","/@dropins/storefront-checkout/src/api/graphql/PaymentMethodFragment.graphql.ts","/@dropins/storefront-checkout/src/api/graphql/CheckoutDataFragment.graphql.ts","/@dropins/storefront-checkout/src/api/graphql/CustomerFragment.graphql.ts","/@dropins/storefront-checkout/src/api/graphql/NegotiableQuoteAddressFragment.graphql.ts","/@dropins/storefront-checkout/src/api/graphql/NegotiableQuoteFragment.graphql.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 const AVAILABLE_SHIPPING_METHOD_FRAGMENT = /* GraphQL */ `\n fragment AVAILABLE_SHIPPING_METHOD_FRAGMENT on AvailableShippingMethod {\n amount {\n currency\n value\n }\n carrier_code\n carrier_title\n error_message\n method_code\n method_title\n price_excl_tax {\n value\n currency\n }\n price_incl_tax {\n value\n currency\n }\n }\n`;\n\nexport const SELECTED_SHIPPING_METHOD_FRAGMENT = /* GraphQL */ `\n fragment SELECTED_SHIPPING_METHOD_FRAGMENT on SelectedShippingMethod {\n amount {\n currency\n value\n }\n carrier_code\n carrier_title\n method_code\n method_title\n price_excl_tax {\n value\n currency\n }\n price_incl_tax {\n value\n currency\n }\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 AVAILABLE_SHIPPING_METHOD_FRAGMENT,\n SELECTED_SHIPPING_METHOD_FRAGMENT,\n} from './ShippingMethodFragment.graphql';\n\nexport const BILLING_CART_ADDRESS_FRAGMENT = /* GraphQL */ `\n fragment BILLING_CART_ADDRESS_FRAGMENT on BillingCartAddress {\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 id\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`;\n\nexport const SHIPPING_CART_ADDRESS_FRAGMENT = /* GraphQL */ `\n fragment SHIPPING_CART_ADDRESS_FRAGMENT on ShippingCartAddress {\n available_shipping_methods {\n ...AVAILABLE_SHIPPING_METHOD_FRAGMENT\n }\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 id\n lastname\n middlename\n postcode\n prefix\n region {\n region_id\n code\n label\n }\n same_as_billing\n selected_shipping_method {\n ...SELECTED_SHIPPING_METHOD_FRAGMENT\n }\n street\n suffix\n telephone\n uid\n vat_id\n }\n\n ${AVAILABLE_SHIPPING_METHOD_FRAGMENT}\n ${SELECTED_SHIPPING_METHOD_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\nexport const AVAILABLE_PAYMENT_METHOD_FRAGMENT = /* GraphQL */ `\n fragment AVAILABLE_PAYMENT_METHOD_FRAGMENT on AvailablePaymentMethod {\n code\n title\n }\n`;\n\nexport const SELECTED_PAYMENT_METHOD_FRAGMENT = /* GraphQL */ `\n fragment SELECTED_PAYMENT_METHOD_FRAGMENT on SelectedPaymentMethod {\n code\n title\n purchase_order_number\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 BILLING_CART_ADDRESS_FRAGMENT,\n SHIPPING_CART_ADDRESS_FRAGMENT,\n} from './CartAddressFragment.graphql';\nimport {\n AVAILABLE_PAYMENT_METHOD_FRAGMENT,\n SELECTED_PAYMENT_METHOD_FRAGMENT,\n} from './PaymentMethodFragment.graphql';\n\nexport const CHECKOUT_DATA_FRAGMENT = /* GraphQL */ `\n fragment CHECKOUT_DATA_FRAGMENT on Cart {\n id\n is_virtual\n email\n total_quantity\n billing_address {\n ...BILLING_CART_ADDRESS_FRAGMENT\n }\n shipping_addresses {\n ...SHIPPING_CART_ADDRESS_FRAGMENT\n }\n available_payment_methods {\n ...AVAILABLE_PAYMENT_METHOD_FRAGMENT\n }\n selected_payment_method {\n ...SELECTED_PAYMENT_METHOD_FRAGMENT\n }\n }\n\n ${BILLING_CART_ADDRESS_FRAGMENT}\n ${SHIPPING_CART_ADDRESS_FRAGMENT}\n ${AVAILABLE_PAYMENT_METHOD_FRAGMENT}\n ${SELECTED_PAYMENT_METHOD_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\nexport const CUSTOMER_FRAGMENT = /* GraphQL */ `\n fragment CUSTOMER_FRAGMENT on Customer {\n firstname\n lastname\n email\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 {\n AVAILABLE_SHIPPING_METHOD_FRAGMENT,\n SELECTED_SHIPPING_METHOD_FRAGMENT,\n} from './ShippingMethodFragment.graphql';\n\nexport const NEGOTIABLE_QUOTE_BILLING_ADDRESS_FRAGMENT = /* GraphQL */ `\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`;\n\nexport const NEGOTIABLE_QUOTE_SHIPPING_ADDRESS_FRAGMENT = /* GraphQL */ `\n fragment NEGOTIABLE_QUOTE_SHIPPING_ADDRESS_FRAGMENT on NegotiableQuoteShippingAddress {\n available_shipping_methods {\n ...AVAILABLE_SHIPPING_METHOD_FRAGMENT\n }\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 selected_shipping_method {\n ...SELECTED_SHIPPING_METHOD_FRAGMENT\n }\n street\n suffix\n telephone\n uid\n vat_id\n }\n\n ${AVAILABLE_SHIPPING_METHOD_FRAGMENT}\n ${SELECTED_SHIPPING_METHOD_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 {\n NEGOTIABLE_QUOTE_BILLING_ADDRESS_FRAGMENT,\n NEGOTIABLE_QUOTE_SHIPPING_ADDRESS_FRAGMENT,\n} from './NegotiableQuoteAddressFragment.graphql';\n\nimport {\n AVAILABLE_PAYMENT_METHOD_FRAGMENT,\n SELECTED_PAYMENT_METHOD_FRAGMENT,\n} from './PaymentMethodFragment.graphql';\n\nexport const NEGOTIABLE_QUOTE_FRAGMENT = /* GraphQL */ `\n fragment NEGOTIABLE_QUOTE_FRAGMENT on NegotiableQuote {\n available_payment_methods {\n ...AVAILABLE_PAYMENT_METHOD_FRAGMENT\n }\n billing_address {\n ...NEGOTIABLE_QUOTE_BILLING_ADDRESS_FRAGMENT\n }\n email\n is_virtual\n name\n selected_payment_method {\n ...SELECTED_PAYMENT_METHOD_FRAGMENT\n }\n shipping_addresses {\n ...NEGOTIABLE_QUOTE_SHIPPING_ADDRESS_FRAGMENT\n }\n status\n total_quantity\n uid\n }\n\n ${NEGOTIABLE_QUOTE_BILLING_ADDRESS_FRAGMENT}\n ${NEGOTIABLE_QUOTE_SHIPPING_ADDRESS_FRAGMENT}\n ${AVAILABLE_PAYMENT_METHOD_FRAGMENT}\n ${SELECTED_PAYMENT_METHOD_FRAGMENT}\n`;\n"],"names":["AVAILABLE_SHIPPING_METHOD_FRAGMENT","SELECTED_SHIPPING_METHOD_FRAGMENT","BILLING_CART_ADDRESS_FRAGMENT","SHIPPING_CART_ADDRESS_FRAGMENT","AVAILABLE_PAYMENT_METHOD_FRAGMENT","SELECTED_PAYMENT_METHOD_FRAGMENT","CHECKOUT_DATA_FRAGMENT","CUSTOMER_FRAGMENT","NEGOTIABLE_QUOTE_BILLING_ADDRESS_FRAGMENT","NEGOTIABLE_QUOTE_SHIPPING_ADDRESS_FRAGMENT","NEGOTIABLE_QUOTE_FRAGMENT"],"mappings":"AAiBa,MAAAA,EAAmD;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAsBnDC,EAAkD;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,ECjBlDC,EAA8C;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;A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