@artisanpack-ui/ecommerce-storefront-react 0.0.0-stage → 1.0.0

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.
Files changed (98) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +67 -2
  3. package/dist/Addresses-D3ESHG3L.mjs +27 -0
  4. package/dist/Addresses-D3ESHG3L.mjs.map +1 -0
  5. package/dist/CategoryShow-OAGROEMA.mjs +12 -0
  6. package/dist/CategoryShow-OAGROEMA.mjs.map +1 -0
  7. package/dist/Claim-CJ4UOAUD.mjs +22 -0
  8. package/dist/Claim-CJ4UOAUD.mjs.map +1 -0
  9. package/dist/Confirmation-TLMMBPWS.mjs +20 -0
  10. package/dist/Confirmation-TLMMBPWS.mjs.map +1 -0
  11. package/dist/Dashboard-ARXORMTL.mjs +24 -0
  12. package/dist/Dashboard-ARXORMTL.mjs.map +1 -0
  13. package/dist/Downloads-CEQBY7JO.mjs +25 -0
  14. package/dist/Downloads-CEQBY7JO.mjs.map +1 -0
  15. package/dist/Index-KRR3Q7EJ.mjs +12 -0
  16. package/dist/Index-KRR3Q7EJ.mjs.map +1 -0
  17. package/dist/Index-RLQFEBTX.mjs +22 -0
  18. package/dist/Index-RLQFEBTX.mjs.map +1 -0
  19. package/dist/Index-WDJYGR5Q.mjs +12 -0
  20. package/dist/Index-WDJYGR5Q.mjs.map +1 -0
  21. package/dist/Index-XYU5QLUT.mjs +23 -0
  22. package/dist/Index-XYU5QLUT.mjs.map +1 -0
  23. package/dist/Lookup-QNUQKUID.mjs +19 -0
  24. package/dist/Lookup-QNUQKUID.mjs.map +1 -0
  25. package/dist/OrderShow-RYTP62YA.mjs +27 -0
  26. package/dist/OrderShow-RYTP62YA.mjs.map +1 -0
  27. package/dist/Orders-LZW57GE6.mjs +25 -0
  28. package/dist/Orders-LZW57GE6.mjs.map +1 -0
  29. package/dist/Profile-ZAAWFCAL.mjs +25 -0
  30. package/dist/Profile-ZAAWFCAL.mjs.map +1 -0
  31. package/dist/Show-LFWUO3KR.mjs +14 -0
  32. package/dist/Show-LFWUO3KR.mjs.map +1 -0
  33. package/dist/TagShow-FXKXRGY2.mjs +12 -0
  34. package/dist/TagShow-FXKXRGY2.mjs.map +1 -0
  35. package/dist/chunk-5UUNH3EH.mjs +1888 -0
  36. package/dist/chunk-5UUNH3EH.mjs.map +1 -0
  37. package/dist/chunk-A3MMQ2RY.mjs +183 -0
  38. package/dist/chunk-A3MMQ2RY.mjs.map +1 -0
  39. package/dist/chunk-ABGPTZ3Q.mjs +198 -0
  40. package/dist/chunk-ABGPTZ3Q.mjs.map +1 -0
  41. package/dist/chunk-BJ3FJFZQ.mjs +32 -0
  42. package/dist/chunk-BJ3FJFZQ.mjs.map +1 -0
  43. package/dist/chunk-BSASRFQ7.mjs +89 -0
  44. package/dist/chunk-BSASRFQ7.mjs.map +1 -0
  45. package/dist/chunk-CGCW3555.mjs +148 -0
  46. package/dist/chunk-CGCW3555.mjs.map +1 -0
  47. package/dist/chunk-DWR23FJD.mjs +643 -0
  48. package/dist/chunk-DWR23FJD.mjs.map +1 -0
  49. package/dist/chunk-ENY3MH2W.mjs +148 -0
  50. package/dist/chunk-ENY3MH2W.mjs.map +1 -0
  51. package/dist/chunk-EWJLRWPO.mjs +280 -0
  52. package/dist/chunk-EWJLRWPO.mjs.map +1 -0
  53. package/dist/chunk-FL5XL3ET.mjs +212 -0
  54. package/dist/chunk-FL5XL3ET.mjs.map +1 -0
  55. package/dist/chunk-FOOP6UK3.mjs +218 -0
  56. package/dist/chunk-FOOP6UK3.mjs.map +1 -0
  57. package/dist/chunk-HCC7GTVO.mjs +115 -0
  58. package/dist/chunk-HCC7GTVO.mjs.map +1 -0
  59. package/dist/chunk-HXZMY3GE.mjs +2331 -0
  60. package/dist/chunk-HXZMY3GE.mjs.map +1 -0
  61. package/dist/chunk-IOL2YQ62.mjs +109 -0
  62. package/dist/chunk-IOL2YQ62.mjs.map +1 -0
  63. package/dist/chunk-JH7SFSZA.mjs +104 -0
  64. package/dist/chunk-JH7SFSZA.mjs.map +1 -0
  65. package/dist/chunk-JJOPX4PI.mjs +205 -0
  66. package/dist/chunk-JJOPX4PI.mjs.map +1 -0
  67. package/dist/chunk-LT3GG7YQ.mjs +32 -0
  68. package/dist/chunk-LT3GG7YQ.mjs.map +1 -0
  69. package/dist/chunk-MZFULGDI.mjs +267 -0
  70. package/dist/chunk-MZFULGDI.mjs.map +1 -0
  71. package/dist/chunk-O4WPMMSH.mjs +58 -0
  72. package/dist/chunk-O4WPMMSH.mjs.map +1 -0
  73. package/dist/chunk-OU3WYFIH.mjs +397 -0
  74. package/dist/chunk-OU3WYFIH.mjs.map +1 -0
  75. package/dist/chunk-P3NIV4YG.mjs +998 -0
  76. package/dist/chunk-P3NIV4YG.mjs.map +1 -0
  77. package/dist/chunk-PEBBSZ5R.mjs +201 -0
  78. package/dist/chunk-PEBBSZ5R.mjs.map +1 -0
  79. package/dist/chunk-T5OWL6EG.mjs +73 -0
  80. package/dist/chunk-T5OWL6EG.mjs.map +1 -0
  81. package/dist/chunk-THPUK35U.mjs +132 -0
  82. package/dist/chunk-THPUK35U.mjs.map +1 -0
  83. package/dist/chunk-TPOKMH5E.mjs +142 -0
  84. package/dist/chunk-TPOKMH5E.mjs.map +1 -0
  85. package/dist/chunk-VX5TEJNU.mjs +1898 -0
  86. package/dist/chunk-VX5TEJNU.mjs.map +1 -0
  87. package/dist/chunk-WUL34MB2.mjs +268 -0
  88. package/dist/chunk-WUL34MB2.mjs.map +1 -0
  89. package/dist/chunk-WYGOMIZK.mjs +140 -0
  90. package/dist/chunk-WYGOMIZK.mjs.map +1 -0
  91. package/dist/chunk-Y2IOBBN7.mjs +127 -0
  92. package/dist/chunk-Y2IOBBN7.mjs.map +1 -0
  93. package/dist/chunk-Y5BRPEHA.mjs +54 -0
  94. package/dist/chunk-Y5BRPEHA.mjs.map +1 -0
  95. package/dist/index.d.ts +4607 -0
  96. package/dist/index.mjs +1515 -0
  97. package/dist/index.mjs.map +1 -0
  98. package/package.json +112 -4
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/checkout/payment/usePaymentDriver.ts","../src/checkout/payment/RedirectPayment.tsx","../src/checkout/payment/stripeDriver.ts","../src/checkout/payment/StripePayment.tsx","../src/checkout/payment/registerPaymentDrivers.ts","../src/checkout/checkoutState.tsx","../src/checkout/CheckoutErrorSummary.tsx","../src/checkout/CheckoutOrderSummary.tsx","../src/checkout/addressLines.ts","../src/checkout/CheckoutStepSummary.tsx","../src/checkout/payment/PaymentDriverHost.tsx","../src/checkout/Placement.tsx","../src/checkout/steps/AddressStep.tsx","../src/checkout/steps/ContactStep.tsx","../src/checkout/steps/PaymentStep.tsx","../src/checkout/steps/ReviewStep.tsx","../src/checkout/steps/ShippingStep.tsx","../src/checkout/Checkout.tsx"],"sourcesContent":["/**\n * The React side of the payment-driver contract.\n *\n * A gateway's client half is a `PaymentDriver` from `-core` (`mount`,\n * `confirm`, `error`, `unmount`). The component registered under its key\n * in the `paymentDrivers` registry draws the driver's UI and wraps the\n * driver with {@link usePaymentDriver}, which mounts it once its element\n * is in the page, confirms it when the shopper pays, hands the result to\n * the checkout and shows the failures the checkout learns of.\n *\n * @since 1.0.0\n */\n\nimport {\n __,\n paymentFailureMessage,\n type PaymentDriver,\n type PaymentDriverContext,\n type PaymentDriverResult,\n} from '@artisanpack-ui/ecommerce-storefront-core';\nimport { useCallback, useEffect, useRef, useState, type RefObject } from 'react';\n\n/**\n * A payment failure the checkout knows of. The id changes with every\n * failure, so the same message is shown again.\n *\n * @since 1.0.0\n */\nexport interface PaymentDriverFailure {\n id: number;\n message: string;\n /**\n * `server`: the server refused a confirmed payment (the default).\n * `driver`: the driver's own failure, which it already showed; it comes\n * back only so a remounted driver shows it again.\n */\n source?: 'driver' | 'server';\n}\n\n/**\n * Where a reported result left the shopper: on their way elsewhere, or\n * still on the checkout.\n *\n * @since 1.0.0\n */\nexport type PaymentReportOutcome = 'left' | 'stayed';\n\n/**\n * What the checkout gives the component registered for a payment driver.\n *\n * @since 1.0.0\n */\nexport interface PaymentDriverComponentProps<TProps extends object = Record<string, unknown>> {\n /** The session to pay, the driver's props, the return URL and the payable check. */\n context: PaymentDriverContext<TProps>;\n /**\n * Hands the driver's result to the checkout: `confirmed` places the\n * order, `redirect` leaves for the provider, `failed` is reported to the\n * server. Resolves once the checkout has acted on it: `left` when the\n * shopper is on their way elsewhere (the confirmation page, the\n * provider), `stayed` when they are still on the checkout and the driver\n * should give \"Pay\" back.\n */\n report: (result: PaymentDriverResult) => Promise<PaymentReportOutcome | void>;\n /**\n * The latest failure the checkout knows of, or null. A driver that mounts\n * with one shows its message.\n */\n failure: PaymentDriverFailure | null;\n}\n\n/**\n * Where a driver is: ready, taking the payment, or done (the checkout is\n * placing the order, or the browser is leaving for the provider).\n *\n * @since 1.0.0\n */\nexport type PaymentDriverStatus = 'idle' | 'paying' | 'placing';\n\n/**\n * What {@link usePaymentDriver} returns.\n *\n * @since 1.0.0\n */\nexport interface UsePaymentDriver {\n /** The element the driver mounts its UI in. */\n elementRef: RefObject<HTMLDivElement | null>;\n /** Takes the payment. Ignored while a payment is under way. */\n pay: () => Promise<void>;\n status: PaymentDriverStatus;\n /** The failure to show, as plain text, or null. */\n error: string | null;\n /** Bumped with every error, so a live region can announce the same message again. */\n errorId: number;\n}\n\n/**\n * Wraps a `PaymentDriver` for a React component.\n *\n * A driver may add `report: false` to a failed result for a failure the\n * shopper fixes in its own form (a validation error): it is shown, but not\n * reported to the server.\n *\n * Only a failure gives the shopper \"Pay\" back: after a confirmed payment\n * the checkout is placing the order, and a second press would confirm a\n * payment that has already gone through.\n *\n * @since 1.0.0\n *\n * @param driver - The driver; keep the same object for the component's life.\n * @param props - The props the checkout gave the component.\n * @returns The element ref, `pay()`, the status and the error.\n */\nexport function usePaymentDriver<TProps extends object>(\n driver: PaymentDriver<TProps>,\n { context, report, failure }: PaymentDriverComponentProps<TProps>,\n): UsePaymentDriver {\n const elementRef = useRef<HTMLDivElement | null>(null);\n const contextRef = useRef(context);\n const busy = useRef(false);\n const [status, setStatus] = useState<PaymentDriverStatus>('idle');\n // A driver that remounts (a new payment session) shows the last failure.\n const [error, setErrorText] = useState<string | null>(() => failure?.message ?? null);\n const [errorId, setErrorId] = useState(0);\n const [seenFailure, setSeenFailure] = useState<PaymentDriverFailure | null>(failure);\n const refusal = null !== failure && 'driver' !== failure.source;\n\n // A new refusal from the server gives \"Pay\" back with its message; the\n // driver's own failures were already shown by `pay()`.\n if (failure !== seenFailure) {\n setSeenFailure(failure);\n\n if (refusal) {\n setStatus('idle');\n setErrorText(failure.message);\n setErrorId((id) => id + 1);\n }\n }\n\n useEffect(() => {\n contextRef.current = context;\n });\n\n const showError = useCallback((message: string) => {\n setErrorText(message);\n setErrorId((id) => id + 1);\n }, []);\n\n useEffect(() => {\n void Promise.resolve(driver.mount(elementRef.current, contextRef.current)).catch(() => {\n showError(paymentFailureMessage(null));\n });\n\n return () => {\n driver.unmount?.();\n };\n }, [driver, showError]);\n\n useEffect(() => {\n if (null === failure || 'driver' === failure.source) {\n return;\n }\n\n busy.current = false;\n driver.error?.(failure.message);\n }, [driver, failure]);\n\n const pay = useCallback(async (): Promise<void> => {\n if (busy.current) {\n return;\n }\n\n busy.current = true;\n setStatus('paying');\n setErrorText(null);\n\n let result: PaymentDriverResult;\n\n try {\n result = await driver.confirm(contextRef.current);\n } catch {\n result = {\n status: 'failed',\n message: __(\"Your payment couldn't be completed. Try again or use another payment method.\"),\n };\n }\n\n if ('failed' === result.status) {\n const message = paymentFailureMessage(result.message);\n\n busy.current = false;\n setStatus('idle');\n showError(message);\n\n // A failure the driver flags `report: false` (the shopper's input, such\n // as a card number the provider's form rejected) stays in the driver.\n if (false !== (result as { report?: boolean }).report) {\n await report({ status: 'failed', message });\n }\n\n return;\n }\n\n setStatus('placing');\n\n // Placing the order can end without leaving the checkout (throttled,\n // the cart gone, a server error): \"Pay\" comes back then.\n if ('stayed' === (await report(result))) {\n busy.current = false;\n setStatus('idle');\n }\n }, [driver, report, showError]);\n\n return { elementRef, pay, status, error, errorId };\n}\n","/**\n * The core `redirect` payment driver.\n *\n * @since 1.0.0\n */\n\nimport {\n __,\n createRedirectDriver,\n type RedirectPaymentDriverProps,\n} from '@artisanpack-ui/ecommerce-storefront-core';\nimport { Alert, Button, Card, Icon } from '@artisanpack-ui/react';\nimport { useState, type ReactElement } from 'react';\n\nimport { usePaymentDriver, type PaymentDriverComponentProps } from './usePaymentDriver';\n\n/**\n * Whether a URL is an http(s) page the browser may be sent to.\n *\n * @param url - The URL.\n * @returns True for http(s).\n */\nfunction isHttpUrl(url: string | null | undefined): url is string {\n return 'string' === typeof url && /^https?:\\/\\//i.test(url);\n}\n\n/**\n * A Card: an external-link icon tile beside \"Pay with {gateway}\" and one\n * line saying the shopper finishes paying on the gateway's site and comes\n * back, then a full-width neutral \"Continue to {gateway}\" with a trailing\n * arrow (mirrored in right-to-left layouts). Without a usable redirect\n * URL, a warning Alert says the method isn't available.\n *\n * @since 1.0.0\n *\n * @param props - What the checkout gives a payment driver.\n * @returns The driver's UI.\n */\nexport function RedirectPayment(\n props: PaymentDriverComponentProps<RedirectPaymentDriverProps>,\n): ReactElement {\n const [driver] = useState(createRedirectDriver);\n const { pay, status } = usePaymentDriver(driver, props);\n const { payment } = props.context;\n const label = payment.label;\n\n return (\n <div className=\"ec-redirect\" data-payment-driver=\"redirect\">\n {isHttpUrl(payment.props.redirectUrl) ? (\n <Card className=\"ec-redirect__card\">\n <div className=\"ec-redirect__intro\">\n <Icon name=\"external-link\" variant=\"tile\" />\n\n <div className=\"ec-redirect__text\">\n <p className=\"ec-redirect__title\">{__('Pay with :gateway', { gateway: label })}</p>\n <p className=\"ec-redirect__description\">\n {__(\"You'll finish paying on :gateway's site, then come back here.\", {\n gateway: label,\n })}\n </p>\n </div>\n </div>\n\n <Button\n color=\"neutral\"\n trailingIcon=\"arrow-right\"\n className=\"ec-redirect__continue\"\n disabled={'idle' !== status}\n onClick={() => void pay()}\n data-payment-redirect=\"\"\n >\n {__('Continue to :gateway', { gateway: label })}\n </Button>\n </Card>\n ) : (\n <Alert\n color=\"warning\"\n icon=\"triangle-alert\"\n title={__(\"This payment method isn't available.\")}\n data-payment-unavailable=\"\"\n />\n )}\n </div>\n );\n}\n","/**\n * The core `stripe-payment-element` payment driver's behavior.\n *\n * @since 1.0.0\n */\n\nimport {\n __,\n paymentFailureMessage,\n type PaymentDriver,\n type StripePaymentElementDriverProps,\n} from '@artisanpack-ui/ecommerce-storefront-core';\nimport type {\n Appearance,\n Stripe,\n StripeElementLocale,\n StripeElements,\n StripePaymentElement,\n} from '@stripe/stripe-js';\n\n/**\n * What the driver tells its component.\n *\n * @since 1.0.0\n */\nexport interface StripeDriverCallbacks {\n /** Stripe's form is ready to take a payment. */\n onReady: () => void;\n /** Stripe.js or the form couldn't load. */\n onLoadError: (message: string) => void;\n}\n\n/**\n * Loads Stripe.js. `@stripe/stripe-js` is an optional peer, imported only\n * when a Stripe payment form mounts, so a store without Stripe never needs\n * it.\n *\n * @since 1.0.0\n */\nexport type StripeLoader = (\n publishableKey: string,\n options: { locale: StripeElementLocale },\n) => Promise<Stripe | null>;\n\n/**\n * The default loader: `loadStripe()` from `@stripe/stripe-js`, which loads\n * Stripe.js once per page from Stripe's CDN (PCI).\n *\n * @param publishableKey - The publishable key.\n * @param options - Stripe's options.\n * @returns Stripe, or null when it couldn't load.\n */\nconst defaultLoader: StripeLoader = async (publishableKey, options) => {\n const { loadStripe } = await import('@stripe/stripe-js');\n\n return loadStripe(publishableKey, options);\n};\n\n/**\n * A design-system color as `rgb()`: the tokens may be `oklch()`, which\n * Stripe can't read, so it paints one pixel and reads it back.\n *\n * @param value - A CSS color.\n * @returns The `rgb()` color, or null.\n */\nfunction toRgb(value: string): string | null {\n if ('' === value) {\n return null;\n }\n\n let context: CanvasRenderingContext2D | null = null;\n\n try {\n context = document.createElement('canvas').getContext('2d', { willReadFrequently: true });\n } catch {\n context = null;\n }\n\n if (null === context || undefined === context) {\n return null;\n }\n\n context.clearRect(0, 0, 1, 1);\n context.fillStyle = value;\n context.fillRect(0, 0, 1, 1);\n\n const [red, green, blue] = context.getImageData(0, 0, 1, 1).data;\n\n return `rgb(${red}, ${green}, ${blue})`;\n}\n\n/**\n * Drops empty values.\n *\n * @param declarations - The declarations.\n * @returns Those with a value.\n */\nfunction declared<T extends Record<string, string | null | undefined>>(\n declarations: T,\n): Record<string, string> {\n return Object.fromEntries(\n Object.entries(declarations).filter(\n (entry): entry is [string, string] => 'string' === typeof entry[1] && '' !== entry[1],\n ),\n );\n}\n\n/**\n * Stripe's appearance from the `--apui-*` tokens, so its fields match the\n * Input: the field radius, border, text, placeholder and error colors, and\n * the focus ring. The gateway's `appearance` goes on top.\n *\n * @since 1.0.0\n *\n * @param root - An element inside the storefront, to read the tokens from.\n * @param custom - The gateway's appearance.\n * @returns Stripe's appearance.\n */\nexport function stripeAppearance(root: HTMLElement, custom: Record<string, unknown>): Appearance {\n const styles = getComputedStyle(root);\n const token = (name: string): string => styles.getPropertyValue(name).trim();\n const color = (name: string): string | null => toRgb(token(name));\n const px = (name: string, fallback: number): number => Number.parseFloat(token(name)) || fallback;\n\n const variables = declared({\n colorPrimary: color('--apui-color-primary'),\n colorBackground: color('--apui-surface-default'),\n colorText: color('--apui-text-default'),\n colorTextSecondary: color('--apui-text-muted'),\n colorTextPlaceholder: color('--apui-text-subtle'),\n colorDanger: color('--apui-color-error-text'),\n borderRadius: token('--apui-radius-field') || null,\n fontFamily: styles.fontFamily || null,\n });\n\n // Stripe only takes plain values in `rules` (no calc(), nothing empty),\n // so the ring's spread is worked out here in px.\n const border = color('--apui-border-default');\n const ring = color('--apui-focus-ring-color');\n const ringOffset = color('--apui-focus-ring-offset-color') ?? variables.colorBackground ?? null;\n const offset = px('--apui-focus-ring-offset', 2);\n const spread = offset + px('--apui-focus-ring-width', 2);\n\n const rules = Object.fromEntries(\n Object.entries({\n '.Input': declared({\n border: null === border ? null : `${px('--apui-border-width', 1)}px solid ${border}`,\n boxShadow: 'none',\n }),\n '.Input:hover': declared({ borderColor: color('--apui-border-strong') }),\n // A transparent outline is invisible until forced colors paints it,\n // where the box-shadow ring is dropped.\n '.Input:focus': declared({\n outline: `${px('--apui-focus-ring-width', 2)}px solid transparent`,\n boxShadow:\n null === ring\n ? null\n : `0 0 0 ${offset}px ${ringOffset ?? 'transparent'}, 0 0 0 ${spread}px ${ring}`,\n }),\n '.Label': declared({\n color: variables.colorText,\n fontWeight: token('--apui-font-weight-medium'),\n }),\n '.Error': declared({ color: variables.colorDanger }),\n }).filter(([, declarations]) => Object.keys(declarations).length > 0),\n );\n\n const customVariables = (custom.variables ?? {}) as Record<string, string>;\n const customRules = (custom.rules ?? {}) as Record<string, Record<string, string>>;\n\n return {\n theme: 'stripe',\n ...(custom as Appearance),\n variables: { ...variables, ...customVariables },\n rules: { ...rules, ...customRules },\n };\n}\n\n/**\n * Creates the Stripe Payment Element driver: it mounts Stripe's form in\n * the component's element, keeps its look in step with light, dark and\n * theme switches, and confirms with `redirect: 'if_required'`, so 3-D\n * Secure runs in the page and methods that must redirect come back through\n * the return route. No card data passes through the storefront.\n *\n * @since 1.0.0\n *\n * @param callbacks - Ready and load-failure callbacks.\n * @param loader - Loads Stripe.js; `@stripe/stripe-js`'s `loadStripe()` by default.\n * @returns The driver.\n */\nexport function createStripePaymentElementDriver(\n callbacks: StripeDriverCallbacks,\n loader: StripeLoader = defaultLoader,\n): PaymentDriver<StripePaymentElementDriverProps> {\n const loadFailed = __(\n \"The payment form couldn't load. Check your connection and reload the page.\",\n );\n let stripe: Stripe | null = null;\n let elements: StripeElements | null = null;\n let element: StripePaymentElement | null = null;\n let teardown: (() => void) | null = null;\n // Each mount's number: a mount whose Stripe.js arrives after an unmount\n // (or a newer mount) stops there.\n let mounts = 0;\n let current = 0;\n\n return {\n async mount(root, { payment }) {\n const props = payment.props;\n\n const mountNumber = ++mounts;\n\n current = mountNumber;\n\n if (null === root || !props.available) {\n return;\n }\n\n try {\n const locale = (props.locale || 'auto') as StripeElementLocale;\n const loaded = await loader(props.publishableKey, { locale });\n\n if (mountNumber !== current) {\n return;\n }\n\n if (null === loaded) {\n callbacks.onLoadError(loadFailed);\n\n return;\n }\n\n stripe = loaded;\n elements = loaded.elements({\n clientSecret: props.clientSecret,\n appearance: stripeAppearance(root, props.appearance),\n locale,\n });\n element = elements.create('payment');\n element.on('ready', () => callbacks.onReady());\n element.on('loaderror', (event) => {\n callbacks.onLoadError(event?.error?.message || loadFailed);\n });\n element.mount(root);\n\n // Light, dark or a theme switch while the form is open: give Stripe\n // the new token values.\n const retheme = (): void => {\n elements?.update({ appearance: stripeAppearance(root, props.appearance) });\n };\n const scheme = window.matchMedia?.('(prefers-color-scheme: dark)');\n const observer =\n 'undefined' !== typeof MutationObserver ? new MutationObserver(retheme) : null;\n\n scheme?.addEventListener?.('change', retheme);\n observer?.observe(document.documentElement, {\n attributes: true,\n attributeFilter: ['class', 'data-theme'],\n });\n\n teardown = () => {\n observer?.disconnect();\n scheme?.removeEventListener?.('change', retheme);\n };\n } catch {\n if (mountNumber === current) {\n callbacks.onLoadError(loadFailed);\n }\n }\n },\n\n async confirm(context) {\n if (null === stripe || null === elements) {\n return { status: 'failed', message: paymentFailureMessage(null) };\n }\n\n // The order may have changed in another tab since this form was set\n // up: Stripe would charge the old amount. The checkout sets the\n // payment up again for the new total.\n if (true !== (await context.stillPayable())) {\n return {\n status: 'failed',\n message: __(\n \"Your order changed, so we're updating the payment form. Check the new total, then pay.\",\n ),\n };\n }\n\n const returnUrl = context.returnUrl ?? context.payment.props.returnUrl;\n const { error } = await stripe.confirmPayment({\n elements,\n ...(null !== returnUrl ? { confirmParams: { return_url: returnUrl } } : {}),\n redirect: 'if_required',\n });\n\n if (undefined !== error) {\n // Stripe marks the form's own fields for a validation error; like\n // Livewire, the checkout isn't told about those.\n return {\n status: 'failed',\n message: paymentFailureMessage(error.message),\n ...('validation_error' === error.type ? { report: false } : {}),\n };\n }\n\n return { status: 'confirmed', reference: context.payment.reference };\n },\n\n unmount() {\n current = 0;\n teardown?.();\n teardown = null;\n element?.destroy();\n element = null;\n elements = null;\n stripe = null;\n },\n };\n}\n","/**\n * The core `stripe-payment-element` payment driver.\n *\n * @since 1.0.0\n */\n\nimport {\n __,\n type StripePaymentElementDriverProps,\n} from '@artisanpack-ui/ecommerce-storefront-core';\nimport { Alert, Button, Card, Icon, Loading, Skeleton } from '@artisanpack-ui/react';\nimport { useState, type ReactElement } from 'react';\n\nimport { createStripePaymentElementDriver, type StripeLoader } from './stripeDriver';\nimport { usePaymentDriver, type PaymentDriverComponentProps } from './usePaymentDriver';\n\n/**\n * Props of {@link StripePayment}.\n *\n * @since 1.0.0\n */\nexport interface StripePaymentProps extends PaymentDriverComponentProps<StripePaymentElementDriverProps> {\n /** Loads Stripe.js; `@stripe/stripe-js`'s `loadStripe()` by default. */\n loader?: StripeLoader;\n}\n\n/**\n * A Card holding Stripe's form, then the reassurance line (a shield icon\n * and \"Your card details go straight to Stripe…\") and a full-width \"Pay\n * now\". While Stripe loads, field skeletons sit under the glass Loading\n * overlay with \"Loading the payment form…\". A Stripe error shows under the\n * form in an assertive live region. Without a publishable key and client\n * secret, a warning Alert says the method isn't available.\n *\n * After Stripe confirms, \"Pay now\" stays disabled and says \"Placing your\n * order…\" until the checkout moves on; only a failure gives it back.\n * React never renders inside Stripe's element, so its iframe survives\n * every re-render.\n *\n * @since 1.0.0\n *\n * @param props - What the checkout gives a payment driver.\n * @returns The driver's UI.\n */\nexport function StripePayment({ loader, ...props }: StripePaymentProps): ReactElement {\n const [loading, setLoading] = useState(true);\n const [ready, setReady] = useState(false);\n const [loadError, setLoadError] = useState<string | null>(null);\n const [driver] = useState(() =>\n createStripePaymentElementDriver(\n {\n onReady: () => {\n setLoading(false);\n setReady(true);\n },\n onLoadError: (message) => {\n setLoading(false);\n setLoadError(message);\n },\n },\n loader,\n ),\n );\n const { elementRef, pay, status, error, errorId } = usePaymentDriver(driver, props);\n const shownError = error ?? loadError;\n\n if (!props.context.payment.props.available) {\n return (\n <div className=\"ec-stripe\" data-payment-driver=\"stripe-payment-element\">\n <Alert\n color=\"warning\"\n icon=\"triangle-alert\"\n title={__(\"This payment method isn't available.\")}\n data-payment-unavailable=\"\"\n />\n </div>\n );\n }\n\n return (\n <div className=\"ec-stripe\" data-payment-driver=\"stripe-payment-element\">\n <Card className=\"ec-stripe__card\">\n <div className=\"ec-stripe__form\">\n <div className=\"ec-stripe__field\" data-loading={loading ? '' : undefined}>\n <div className=\"ec-stripe__loading\" hidden={!loading} data-stripe-loading=\"\">\n <div className=\"ec-stripe__skeletons\" aria-hidden=\"true\">\n <Skeleton className=\"ec-stripe__skeleton\" />\n <div className=\"ec-stripe__skeleton-row\">\n <Skeleton className=\"ec-stripe__skeleton\" />\n <Skeleton className=\"ec-stripe__skeleton\" />\n </div>\n </div>\n\n <Loading overlay delay={0}>\n {__('Loading the payment form…')}\n </Loading>\n </div>\n\n <div ref={elementRef} className=\"ec-stripe__element\" data-stripe-element=\"\" />\n </div>\n\n <p\n key={`stripe-error-${errorId}`}\n className=\"ec-stripe__error\"\n role=\"alert\"\n aria-live=\"assertive\"\n data-stripe-error=\"\"\n >\n {shownError}\n </p>\n\n <p className=\"ec-stripe__reassurance\">\n <Icon name=\"shield\" />\n <span>\n {__('Your card details go straight to Stripe. This store never sees or stores them.')}\n </span>\n </p>\n\n <Button\n color=\"primary\"\n leadingIcon=\"lock\"\n className=\"ec-stripe__pay\"\n disabled={!ready || 'idle' !== status}\n aria-busy={'placing' === status ? 'true' : undefined}\n onClick={() => void pay()}\n data-stripe-pay=\"\"\n >\n <span data-stripe-pay-label=\"\">\n {'placing' === status ? __('Placing your order…') : __('Pay now')}\n </span>\n </Button>\n </div>\n </Card>\n </div>\n );\n}\n","/**\n * The core payment drivers' registration.\n *\n * @since 1.0.0\n */\n\nimport { addBuiltInRegistration } from '../../registries';\nimport { RedirectPayment } from './RedirectPayment';\nimport { StripePayment } from './StripePayment';\n\n/**\n * The core drivers, by `paymentDrivers` registry key.\n *\n * @since 1.0.0\n */\nexport const CORE_PAYMENT_DRIVERS = {\n 'stripe-payment-element': StripePayment,\n redirect: RedirectPayment,\n} as const;\n\nlet registered = false;\n\n/**\n * Adds the core payment drivers (`stripe-payment-element` and `redirect`)\n * to the `paymentDrivers` registry. A satellite that registered its own\n * component under one of these keys first keeps it.\n *\n * @since 1.0.0\n */\nexport function registerPaymentDrivers(): void {\n if (registered) {\n return;\n }\n\n registered = true;\n addBuiltInRegistration((registries) => {\n let position = 10;\n\n for (const [key, component] of Object.entries(CORE_PAYMENT_DRIVERS)) {\n registries.paymentDrivers.register(key, component, { position });\n position += 10;\n }\n });\n}\n","/**\n * What every part of the checkout shares: the page's props, the merged\n * errors and the requests a step sends.\n *\n * Every step posts to its route and is redirected back to the checkout on\n * the step to show next (`?step=`), so a step that worked brings a fresh\n * page (its forms start again from the new `forms` prop) and one that\n * failed keeps the shopper's input beside the errors.\n *\n * @since 1.0.0\n */\n\nimport type {\n CheckoutIndexProps,\n StorefrontCheckoutUrls,\n} from '@artisanpack-ui/ecommerce-storefront-core';\nimport { router } from '@inertiajs/react';\nimport { createContext, useCallback, useContext, useState } from 'react';\n\nimport type { PaymentDriverFailure } from './payment/usePaymentDriver';\n\n/**\n * The checkout's own props: the page's, plus whether it prints the\n * \"Checkout\" title (the page does; the Checkout Steps block may not).\n *\n * @since 1.0.0\n */\nexport type CheckoutProps = Omit<CheckoutIndexProps, 'ecommerceStorefront' | 'errors'> & {\n /** Print the \"Checkout\" title (the page's h1). Defaults to true. */\n showTitle?: boolean;\n};\n\n/**\n * How a step's request keeps the page.\n *\n * - `step`: a submit that moves on; a fresh page when it works, the input\n * kept when it fails.\n * - `keep`: a choice applied straight away (a shipping rate, a gateway);\n * the page keeps its state, so focus stays on the control.\n *\n * @since 1.0.0\n */\nexport type CheckoutPostMode = 'step' | 'keep';\n\n/**\n * What the checkout context holds.\n *\n * @since 1.0.0\n */\nexport interface CheckoutContextValue {\n props: CheckoutProps;\n /** The page's errors and the open step's setup problems, keyed alike. */\n errors: Record<string, string>;\n /** Posts to a checkout route; ignored when the route isn't registered. */\n post: (\n url: string | null,\n data: Record<string, unknown>,\n mode?: CheckoutPostMode,\n callbacks?: CheckoutPostCallbacks,\n ) => void;\n /** Opens a step (`?step=`), as \"Edit\" and \"Change address\" do. */\n goTo: (step: string) => void;\n /** The URL being posted to, while a request runs. */\n processing: string | null;\n /** Bumped by every failed submit, so the error summary is announced again. */\n errorRound: number;\n /**\n * The last payment failure, kept here rather than in the driver so it\n * survives the driver remounting (a new payment session after a failed\n * payment re-keys it). Cleared by a new attempt or another gateway.\n */\n paymentFailure: PaymentDriverFailure | null;\n /** Records a payment failure: the driver's own, or the server's refusal. */\n reportPaymentFailure: (message: string, source: 'driver' | 'server') => void;\n /** Forgets the last payment failure. */\n clearPaymentFailure: () => void;\n}\n\n/**\n * Called when a checkout request finishes.\n *\n * @since 1.0.0\n */\nexport interface CheckoutPostCallbacks {\n onSuccess?: () => void;\n onError?: (errors: Record<string, string>) => void;\n onFinish?: () => void;\n}\n\nconst CheckoutContext = createContext<CheckoutContextValue | null>(null);\n\n/**\n * Set when a request moves the checkout on: the page that comes back\n * focuses the open step's title (or the placement's), as Livewire's\n * `focusStep` does. A module flag, because a step that worked remounts the\n * page.\n */\nlet focusRequested = false;\n\n/**\n * Asks the next checkout render to move focus to the open step's title.\n *\n * @since 1.0.0\n */\nexport function requestStepFocus(): void {\n focusRequested = true;\n}\n\n/**\n * Whether focus should move to the open step's title, clearing the\n * request.\n *\n * @since 1.0.0\n *\n * @returns True once after {@link requestStepFocus}.\n */\nexport function takeStepFocus(): boolean {\n const requested = focusRequested;\n\n focusRequested = false;\n\n return requested;\n}\n\n/**\n * The checkout URL with `?step=`.\n *\n * @since 1.0.0\n *\n * @param urls - The checkout's URLs.\n * @param step - The step key.\n * @returns The URL, or null without a checkout route.\n */\nexport function stepUrl(urls: StorefrontCheckoutUrls, step: string): string | null {\n if (null === urls.checkout) {\n return null;\n }\n\n const base = 'undefined' !== typeof window ? window.location.href : 'http://localhost';\n const url = new URL(urls.checkout, base);\n\n url.searchParams.set('step', step);\n\n return url.origin === new URL(base).origin ? url.pathname + url.search : url.toString();\n}\n\n/**\n * Builds the checkout context for a page.\n *\n * @since 1.0.0\n *\n * @param props - The checkout's props.\n * @param pageErrors - The page's `errors` prop.\n * @returns The context value.\n */\nexport function useCheckoutState(\n props: CheckoutProps,\n pageErrors: Record<string, string>,\n): CheckoutContextValue {\n const [processing, setProcessing] = useState<string | null>(null);\n const [errorRound, setErrorRound] = useState(0);\n const [paymentFailure, setPaymentFailure] = useState<PaymentDriverFailure | null>(null);\n const errors = { ...props.problems, ...pageErrors };\n\n const post = useCallback<CheckoutContextValue['post']>(\n (url, data, mode = 'step', callbacks = {}) => {\n if (null === url) {\n return;\n }\n\n router.post(url, data as never, {\n preserveScroll: true,\n preserveState: 'keep' === mode ? true : 'errors',\n onStart: () => setProcessing(url),\n onFinish: () => {\n setProcessing(null);\n callbacks.onFinish?.();\n },\n onSuccess: () => {\n if ('step' === mode) {\n requestStepFocus();\n }\n\n callbacks.onSuccess?.();\n },\n onError: (next: Record<string, string>) => {\n setErrorRound((round) => round + 1);\n callbacks.onError?.(next);\n },\n });\n },\n [],\n );\n\n const goTo = useCallback(\n (step: string) => {\n const url = stepUrl(props.urls, step);\n\n if (null === url) {\n return;\n }\n\n requestStepFocus();\n router.get(url, {}, { preserveScroll: true });\n },\n [props.urls],\n );\n\n const reportPaymentFailure = useCallback((message: string, source: 'driver' | 'server') => {\n setPaymentFailure((previous) => ({ id: (previous?.id ?? 0) + 1, message, source }));\n }, []);\n\n const clearPaymentFailure = useCallback(() => setPaymentFailure(null), []);\n\n return {\n props,\n errors,\n post,\n goTo,\n processing,\n errorRound,\n paymentFailure,\n reportPaymentFailure,\n clearPaymentFailure,\n };\n}\n\n/**\n * The checkout context provider.\n *\n * @since 1.0.0\n */\nexport const CheckoutProvider = CheckoutContext.Provider;\n\n/**\n * The checkout context, inside a checkout.\n *\n * @since 1.0.0\n *\n * @returns The context value.\n */\nexport function useCheckout(): CheckoutContextValue {\n const value = useContext(CheckoutContext);\n\n if (null === value) {\n throw new Error('useCheckout() must be used inside the checkout.');\n }\n\n return value;\n}\n","/**\n * The checkout's error summary.\n *\n * @since 1.0.0\n */\n\nimport { __, trans_choice } from '@artisanpack-ui/ecommerce-storefront-core';\nimport { ValidationSummary } from '@artisanpack-ui/react';\nimport type { MouseEvent, ReactElement } from 'react';\n\nimport { useCheckout } from './checkoutState';\n\n/**\n * Moves focus to a field the summary links to: the control inside the\n * field's `data-field-key` or `data-field` wrapper, when the design\n * system's own lookup (by id or name) found nothing.\n *\n * @param event - The click.\n */\nfunction focusField(event: MouseEvent<HTMLDivElement>): void {\n if (event.defaultPrevented) {\n return;\n }\n\n const link = (event.target as HTMLElement).closest('a');\n\n if (null === link || '' === link.hash) {\n return;\n }\n\n const key = decodeURIComponent(link.hash.slice(1));\n const field = [...document.querySelectorAll<HTMLElement>('[data-field-key], [data-field]')].find(\n (element) => (element.dataset.fieldKey ?? element.dataset.field) === key,\n );\n const control = field?.querySelector<HTMLElement>('input:not([type=hidden]), select, textarea');\n\n if (undefined !== control && null !== control) {\n event.preventDefault();\n control.focus();\n control.scrollIntoView?.({ block: 'center' });\n }\n}\n\n/**\n * Every problem on the step, each prefixed with its field's label\n * (`errorLabels`) and linked to the field. It is re-created after each\n * failed submit, so it is announced and focused again.\n *\n * @since 1.0.0\n *\n * @returns The summary, or null without errors.\n */\nexport function CheckoutErrorSummary(): ReactElement | null {\n const { errors, errorRound, props } = useCheckout();\n const entries = Object.entries(errors).filter(([, message]) => '' !== message);\n\n if (0 === entries.length) {\n return null;\n }\n\n const labelled = Object.fromEntries(\n entries.map(([field, message]) => {\n const label = props.errorLabels[field];\n\n return [\n field,\n undefined === label ? message : __(':field: :message', { field: label, message }),\n ];\n }),\n );\n\n return (\n <ValidationSummary\n key={`checkout-errors-${errorRound}`}\n errors={labelled}\n title={trans_choice(\n 'There is :count problem to fix:|There are :count problems to fix:',\n entries.length,\n { count: entries.length },\n )}\n id=\"ec-checkout-errors\"\n className=\"ec-error-summary\"\n onClick={focusField}\n data-checkout-errors=\"\"\n />\n );\n}\n","/**\n * The checkout's order summary.\n *\n * @since 1.0.0\n */\n\nimport { __, type StorefrontCartSummary } from '@artisanpack-ui/ecommerce-storefront-core';\nimport { Icon, Link } from '@artisanpack-ui/react';\nimport { useState, type ReactElement } from 'react';\n\nimport { OrderTotals } from '../cart/OrderTotals';\nimport { Money } from '../components/Money';\nimport { cx } from '../internal/classes';\n\n/**\n * Props of {@link CheckoutOrderSummary}.\n *\n * @since 1.0.0\n */\nexport interface CheckoutOrderSummaryProps {\n summary: StorefrontCartSummary | null;\n /** \"Edit cart\" links here; null hides it. */\n cartUrl: string | null;\n}\n\n/**\n * A Card with the lines (a thumbnail carrying the quantity, the name, the\n * options or \"Free gift\", the line total) and the totals, which follow the\n * shipping rate and tax as the shopper chooses them. Sticky beside the\n * steps from 1024px; below that, a \"Show order summary\" bar with the total\n * opens it.\n *\n * @since 1.0.0\n *\n * @param props - The cart summary and the cart URL.\n * @returns The summary.\n */\nexport function CheckoutOrderSummary({\n summary,\n cartUrl,\n}: CheckoutOrderSummaryProps): ReactElement {\n const [open, setOpen] = useState(false);\n const totals = summary?.totals ?? null;\n const lines = summary?.lines ?? [];\n\n return (\n <section\n className=\"apui-card ec-checkout-summary\"\n data-surface=\"default\"\n aria-labelledby=\"ec-checkout-summary-heading\"\n data-checkout-summary=\"\"\n >\n <button\n type=\"button\"\n className=\"ec-checkout-summary__toggle\"\n aria-expanded={open ? 'true' : 'false'}\n aria-controls=\"ec-checkout-summary-body\"\n onClick={() => setOpen((current) => !current)}\n data-checkout-summary-toggle=\"\"\n >\n <span className=\"ec-checkout-summary__toggle-label\">\n <Icon name=\"shopping-bag\" aria-hidden=\"true\" />\n <span>{open ? __('Hide order summary') : __('Show order summary')}</span>\n </span>\n\n {null !== totals ? (\n <Money money={totals.total} className=\"ec-checkout-summary__toggle-total\" />\n ) : null}\n </button>\n\n <div\n id=\"ec-checkout-summary-body\"\n className={cx('ec-checkout-summary__body', open && 'is-open')}\n data-checkout-summary-body=\"\"\n >\n <div className=\"ec-checkout-summary__header\">\n <h2 id=\"ec-checkout-summary-heading\" className=\"ec-checkout-summary__title\">\n {__('Order summary')}\n </h2>\n\n {null !== cartUrl ? (\n <Link href={cartUrl} data-checkout-edit-cart=\"\">\n {__('Edit cart')}\n </Link>\n ) : null}\n </div>\n\n <ul role=\"list\" className=\"ec-checkout-summary__lines\" data-checkout-lines=\"\">\n {lines.map((line) => (\n <li key={line.id} className=\"ec-checkout-summary__line\" data-checkout-line={line.id}>\n <span className=\"ec-checkout-summary__thumb\">\n {null !== line.image ? (\n <img\n src={line.image.url}\n srcSet={line.image.srcset ?? undefined}\n sizes={null !== line.image.srcset ? '56px' : undefined}\n width={56}\n height={56}\n alt=\"\"\n loading=\"lazy\"\n decoding=\"async\"\n />\n ) : (\n <Icon name=\"image\" aria-hidden=\"true\" />\n )}\n <span className=\"ec-checkout-summary__quantity\" aria-hidden=\"true\">\n {line.quantity}\n </span>\n </span>\n\n <span className=\"ec-checkout-summary__details\">\n <span className=\"ec-checkout-summary__name\">\n {line.name}{' '}\n <span className=\"apui-sr-only\">\n {__('× :quantity', { quantity: line.quantity })}\n </span>\n </span>\n {line.free ? (\n <span className=\"ec-checkout-summary__meta\">{__('Free gift')}</span>\n ) : line.options.length > 0 ? (\n <span className=\"ec-checkout-summary__meta\">{line.options.join(' · ')}</span>\n ) : null}\n </span>\n\n <span className=\"ec-checkout-summary__amount\">\n {line.free ? __('Free') : <Money money={line.total} />}\n </span>\n </li>\n ))}\n </ul>\n\n {null !== totals ? (\n <OrderTotals\n totals={totals}\n shippingPending={__('Calculated at the shipping step')}\n taxPending={__('Calculated once we have your address')}\n />\n ) : null}\n </div>\n </section>\n );\n}\n","/**\n * Display lines for an address the checkout only has as form values.\n *\n * @since 1.0.0\n */\n\nimport type {\n StorefrontAddressForm,\n StorefrontAddressValues,\n} from '@artisanpack-ui/ecommerce-storefront-core';\n\n/**\n * A value, trimmed.\n *\n * @param values - The address.\n * @param field - The field.\n * @returns The text, or ''.\n */\nfunction part(values: StorefrontAddressValues, field: keyof StorefrontAddressValues): string {\n return (values[field] ?? '').trim();\n}\n\n/**\n * The name of an option's value, or the value itself when the list\n * doesn't have it.\n *\n * @param options - The options.\n * @param value - The value.\n * @returns The label.\n */\nfunction optionLabel(options: { value: string; label: string }[], value: string): string {\n const upper = value.toUpperCase();\n\n return options.find((option) => option.value.toUpperCase() === upper)?.label ?? value;\n}\n\n/**\n * The region as the server's `AddressPresenter` shows it: the free-text\n * region, else the region code's name when the form's regions are for the\n * address's country, else the code.\n *\n * @param values - The address.\n * @param form - The address's form, with its country's regions.\n * @returns The region, or ''.\n */\nfunction regionText(values: StorefrontAddressValues, form: StorefrontAddressForm | null): string {\n const region = part(values, 'region');\n\n if ('' !== region) {\n return region;\n }\n\n const code = part(values, 'region_code');\n const country = part(values, 'country_code').toUpperCase();\n\n if ('' === code || null === form || (form.format.country ?? '').toUpperCase() !== country) {\n return code;\n }\n\n return optionLabel(form.format.regions, code);\n}\n\n/**\n * The address as display lines, matching the server's `AddressPresenter`:\n * the name, the company, the street lines, \"City, Region Postcode\" and the\n * country's name. The checkout's props carry the cart's addresses as form\n * values only, so the finished address step draws them from those, naming\n * the country and region from the address form's options.\n *\n * @since 1.0.0\n *\n * @param values - The address's fields.\n * @param form - The address form, for the country and region names.\n * @returns The lines, without empty ones.\n */\nexport function addressLines(\n values: StorefrontAddressValues,\n form: StorefrontAddressForm | null = null,\n): string[] {\n const name = [part(values, 'first_name'), part(values, 'last_name')].filter(Boolean).join(' ');\n const locality = [\n [part(values, 'city'), regionText(values, form)].filter(Boolean).join(', '),\n part(values, 'postal_code'),\n ]\n .filter(Boolean)\n .join(' ');\n const country = part(values, 'country_code');\n\n return [\n name,\n part(values, 'company'),\n part(values, 'address1'),\n part(values, 'address2'),\n locality,\n '' === country || null === form ? country : optionLabel(form.countries, country),\n ].filter((line) => '' !== line);\n}\n\n/**\n * The address on one line, as the shipping step's \"Shipping to …\" shows\n * it: the street, the city, then the region and postcode.\n *\n * @since 1.0.0\n *\n * @param values - The address's fields.\n * @returns The line, or '' when there is nothing to show.\n */\nexport function shipToLine(values: StorefrontAddressValues): string {\n const region = part(values, 'region_code') || part(values, 'region');\n\n return [\n part(values, 'address1'),\n part(values, 'city'),\n `${region} ${part(values, 'postal_code')}`.trim(),\n ]\n .filter((segment) => '' !== segment)\n .join(', ');\n}\n","/**\n * What a finished checkout step chose.\n *\n * @since 1.0.0\n */\n\nimport { __ } from '@artisanpack-ui/ecommerce-storefront-core';\nimport type { ReactElement } from 'react';\n\nimport { Address } from '../components/Address';\nimport { Money } from '../components/Money';\nimport { addressLines } from './addressLines';\nimport { useCheckout } from './checkoutState';\n\n/**\n * Props of {@link CheckoutStepSummary}.\n *\n * @since 1.0.0\n */\nexport interface CheckoutStepSummaryProps {\n /** The step's key. */\n step: string;\n}\n\n/**\n * Under a finished step's title: the email, the ship-to and bill-to\n * addresses side by side (from 640px), the shipping option and its price,\n * what the review settled (terms accepted, an account to create, a note),\n * or the payment.\n *\n * @since 1.0.0\n *\n * @param props - The step.\n * @returns The summary.\n */\nexport function CheckoutStepSummary({ step }: CheckoutStepSummaryProps): ReactElement | null {\n const { props } = useCheckout();\n const { forms, address, shipping, review, payment } = props;\n\n switch (step) {\n case 'contact':\n return <p className=\"ec-step-summary__text\">{forms?.email ?? ''}</p>;\n\n case 'address':\n return (\n <div className=\"ec-step-summary__addresses\">\n {address.ships && null !== forms ? (\n <div>\n <p className=\"ec-step-summary__label\">{__('Ship to')}</p>\n <Address lines={addressLines(forms.shipping, address.shippingForm)} />\n </div>\n ) : null}\n\n <div>\n <p className=\"ec-step-summary__label\">{__('Bill to')}</p>\n {null !== forms && (!address.ships || !forms.billingSameAsShipping) ? (\n <Address lines={addressLines(forms.billing, address.billingForm)} />\n ) : (\n <p className=\"ec-step-summary__text\">{__('Same as shipping')}</p>\n )}\n </div>\n </div>\n );\n\n case 'shipping': {\n if (null === shipping.chosen) {\n return null;\n }\n\n // What is charged (zero under free shipping), not the rate's own price.\n const charged = props.summary?.totals?.shipping ?? null;\n\n return (\n <p className=\"ec-step-summary__text\">\n {shipping.chosen.label} &middot;{' '}\n {null !== charged && 'chosen' === charged.state && (charged.amount.amount ?? 0) > 0 ? (\n <Money money={charged.amount} />\n ) : (\n __('Free')\n )}\n </p>\n );\n }\n\n case 'review': {\n const parts = [\n review.summary?.terms ? __('Terms accepted') : null,\n review.summary?.account ? __('Account will be created') : null,\n review.summary?.note ? __('Note added') : null,\n ].filter((part): part is string => null !== part);\n\n return (\n <p className=\"ec-step-summary__text\">\n {0 === parts.length ? __('Done') : parts.join(' · ')}\n </p>\n );\n }\n\n case 'payment':\n return (\n <p className=\"ec-step-summary__text\">\n {payment.required\n ? (payment.gatewayLabel ?? __('Payment confirmed'))\n : __('No payment needed')}\n </p>\n );\n\n default:\n return <p className=\"ec-step-summary__text\">{__('Done')}</p>;\n }\n}\n","/**\n * Renders the payment driver for a payment session.\n *\n * @since 1.0.0\n */\n\nimport {\n paymentFailureMessage,\n type PaymentDriverContext,\n type PaymentDriverResult,\n type StorefrontPaymentSetup,\n} from '@artisanpack-ui/ecommerce-storefront-core';\nimport { router } from '@inertiajs/react';\nimport { useCallback, useEffect, useMemo, useRef, type ReactElement } from 'react';\n\nimport { postJson } from '../../cart/cartRoutes';\nimport { getRegistries } from '../../registries';\nimport { useCheckout } from '../checkoutState';\nimport type { PaymentReportOutcome } from './usePaymentDriver';\n\n/**\n * Props of {@link PaymentDriverHost}.\n *\n * @since 1.0.0\n */\nexport interface PaymentDriverHostProps {\n /** The payment session and its driver. */\n setup: StorefrontPaymentSetup;\n /** The one-time token placing the order carries; null for a placed order's payment. */\n token: string | null;\n}\n\n/**\n * Whether a URL is an http(s) page the browser may be sent to.\n *\n * @param url - The URL.\n * @returns True for http(s).\n */\nfunction isHttpUrl(url: string): boolean {\n return /^https?:\\/\\//i.test(url);\n}\n\n/**\n * Looks the session's `component` up in the `paymentDrivers` registry and\n * renders it with the driver context. It acts on what the driver reports:\n * a confirmed payment is posted with the token to\n * `urls.paymentConfirmed` (the server checks it with the gateway and\n * places the order), a redirect leaves for the provider, and a failure is\n * posted to `urls.paymentFailed`. A refusal from the server goes back to\n * the driver as its `failure`.\n *\n * @since 1.0.0\n *\n * @param props - The session and the token.\n * @returns The driver, or null when no component is registered for it.\n */\nexport function PaymentDriverHost({ setup, token }: PaymentDriverHostProps): ReactElement | null {\n const { props, paymentFailure, reportPaymentFailure, clearPaymentFailure } = useCheckout();\n const { urls } = props;\n\n const stillPayable = useCallback(async (): Promise<boolean> => {\n if (null === urls.paymentPayable) {\n return true;\n }\n\n const answer = await postJson<{ payable?: boolean }>(urls.paymentPayable, {\n reference: setup.reference,\n });\n\n if (200 === answer.status && true === answer.body?.payable) {\n return true;\n }\n\n // Only the server saying the order changed needs the payment set up\n // again for the order as it is now. A 429 already showed its toasts;\n // a failed request (offline, an expired page, a server error) changes\n // nothing, so it gets the generic message.\n if (200 === answer.status && false === answer.body?.payable) {\n router.reload();\n } else if (429 !== answer.status) {\n reportPaymentFailure(paymentFailureMessage(null), 'server');\n }\n\n return false;\n }, [setup.reference, urls.paymentPayable, reportPaymentFailure]);\n\n const context = useMemo<PaymentDriverContext>(\n () => ({ payment: setup, returnUrl: urls.return, stillPayable }),\n [setup, urls.return, stillPayable],\n );\n\n const mounted = useRef(true);\n\n useEffect(() => {\n mounted.current = true;\n\n return () => {\n mounted.current = false;\n };\n }, []);\n\n const report = useCallback(\n (result: PaymentDriverResult): Promise<PaymentReportOutcome> =>\n new Promise<PaymentReportOutcome>((resolve) => {\n if ('failed' === result.status) {\n reportPaymentFailure(result.message, 'driver');\n } else {\n clearPaymentFailure();\n }\n\n if ('redirect' === result.status) {\n if (isHttpUrl(result.url)) {\n window.location.assign(result.url);\n resolve('left');\n\n return;\n }\n\n reportPaymentFailure(paymentFailureMessage(null), 'server');\n resolve('stayed');\n\n return;\n }\n\n const url = 'confirmed' === result.status ? urls.paymentConfirmed : urls.paymentFailed;\n\n if (null === url) {\n resolve('stayed');\n\n return;\n }\n\n let answered = false;\n let left = false;\n const checkoutPath = window.location.pathname;\n\n router.post(\n url,\n 'confirmed' === result.status ? { reference: result.reference, token: token ?? '' } : {},\n {\n preserveScroll: true,\n preserveState: true,\n onSuccess: (page: { url: string }) => {\n answered = true;\n // Decided from the page Inertia swapped in, not from React's\n // commit timing, which differs between Inertia 2 and 3.\n left = new URL(page.url, window.location.origin).pathname !== checkoutPath;\n },\n onError: (errors: Record<string, string>) => {\n answered = true;\n\n if ('confirmed' !== result.status) {\n return;\n }\n\n const message = paymentFailureMessage(\n errors.gateway ?? errors.payment ?? Object.values(errors)[0],\n );\n\n reportPaymentFailure(message, 'server');\n },\n onFinish: () => {\n // Placed: the confirmation page took the checkout's place.\n if (left || !mounted.current) {\n resolve('left');\n\n return;\n }\n\n // Neither placed nor refused (a 419, a server error): say so.\n if (!answered && 'confirmed' === result.status) {\n reportPaymentFailure(paymentFailureMessage(null), 'server');\n }\n\n resolve('stayed');\n },\n },\n );\n }),\n [token, urls.paymentConfirmed, urls.paymentFailed, reportPaymentFailure, clearPaymentFailure],\n );\n\n const Component = getRegistries().paymentDrivers.get(setup.component)?.component;\n\n if (undefined === Component) {\n return null;\n }\n\n return <Component context={context} report={report} failure={paymentFailure} />;\n}\n","/**\n * An order that is placed but not paid yet.\n *\n * @since 1.0.0\n */\n\nimport { __, type StorefrontCheckoutPlacement } from '@artisanpack-ui/ecommerce-storefront-core';\nimport { Alert, Card, Icon } from '@artisanpack-ui/react';\nimport { useEffect, useRef, type ReactElement } from 'react';\n\nimport { Money } from '../components/Money';\nimport { filled } from '../internal/classes';\nimport { CheckoutErrorSummary } from './CheckoutErrorSummary';\nimport { takeStepFocus, useCheckout } from './checkoutState';\nimport { PaymentDriverHost } from './payment/PaymentDriverHost';\n\n/**\n * Props of {@link Placement}.\n *\n * @since 1.0.0\n */\nexport interface PlacementProps {\n placement: StorefrontCheckoutPlacement;\n}\n\n/**\n * One centered Card: a warning clock icon tile, \"Finish paying for order\n * {number}\" (the page's h1 when the checkout shows its title, else an h2),\n * a line saying the order is saved, an error Alert with what happened, the\n * order's items, shipping and total, then the payment driver for the\n * order's own payment. Confirming it finishes the order.\n *\n * @since 1.0.0\n *\n * @param props - The placed order.\n * @returns The placement.\n */\nexport function Placement({ placement }: PlacementProps): ReactElement {\n const { props, errors } = useCheckout();\n const { payment } = props;\n const order = placement.order;\n const Heading = false === props.showTitle ? 'h2' : 'h1';\n const heading = useRef<HTMLHeadingElement>(null);\n const shipping = order?.totals.shipping ?? null;\n\n useEffect(() => {\n if (takeStepFocus()) {\n heading.current?.focus();\n }\n }, []);\n\n return (\n <div className=\"ec-placement\" data-checkout-placement={placement.number}>\n <CheckoutErrorSummary />\n\n <Card\n className=\"ec-placement__card\"\n role=\"region\"\n aria-labelledby=\"ec-checkout-placement-heading\"\n >\n <Icon name=\"clock\" variant=\"tile\" color=\"warning\" size=\"lg\" />\n\n <div className=\"ec-placement__intro\">\n <Heading\n ref={heading}\n id=\"ec-checkout-placement-heading\"\n tabIndex={-1}\n className=\"ec-placement__title\"\n >\n {__('Finish paying for order :number', { number: placement.number })}\n </Heading>\n\n <p className=\"ec-placement__lead\">\n {__(\"Your order is saved, and we'll hold it while you finish paying.\")}\n </p>\n </div>\n\n {null !== payment.problem ? (\n <Alert\n color=\"error\"\n icon=\"circle-alert\"\n title={payment.problem}\n data-checkout-payment-problem=\"\"\n />\n ) : null}\n\n {null !== order ? (\n <dl className=\"ec-placement__meta\" data-checkout-summary=\"\">\n <div className=\"ec-placement__meta-row\">\n <dt>{__('Items')}</dt>\n <dd data-checkout-placement-items=\"\">{order.itemCount}</dd>\n </div>\n\n {null !== shipping && filled(shipping.label) ? (\n <div className=\"ec-placement__meta-row\">\n <dt>{__('Shipping')}</dt>\n <dd data-checkout-placement-shipping=\"\">\n {shipping.label}\n <span aria-hidden=\"true\"> &middot; </span>\n <span className=\"apui-sr-only\">, </span>\n {(shipping.amount.amount ?? 0) > 0 ? (\n <Money money={shipping.amount} />\n ) : (\n __('Free')\n )}\n </dd>\n </div>\n ) : null}\n\n <div className=\"ec-placement__meta-row ec-placement__meta-row--total\">\n <dt>{__('Total')}</dt>\n <dd>\n <Money money={order.totals.total} data-cart-total=\"\" />\n </dd>\n </div>\n </dl>\n ) : null}\n\n <div className=\"ec-placement__payment\" data-field=\"gateway\">\n {null !== payment.setup ? (\n <div data-checkout-payment-driver={payment.setup.driver}>\n <PaymentDriverHost\n key={payment.setup.reference}\n setup={payment.setup}\n token={payment.token}\n />\n </div>\n ) : (\n <Alert\n color=\"warning\"\n icon=\"triangle-alert\"\n title={__(\"This payment can't be finished here\")}\n description={__('Please contact the store to complete your order.')}\n data-checkout-placement-unavailable=\"\"\n />\n )}\n\n {undefined !== errors.gateway ? (\n <p className=\"ec-placement__error\">\n <Icon name=\"circle-alert\" size=\"sm\" />\n <span>{errors.gateway}</span>\n </p>\n ) : null}\n </div>\n </Card>\n </div>\n );\n}\n","/**\n * Checkout step: address.\n *\n * @since 1.0.0\n */\n\nimport {\n __,\n type StorefrontAddressFieldName,\n type StorefrontAddressForm,\n type StorefrontAddressValues,\n type StorefrontCheckoutSavedAddress,\n} from '@artisanpack-ui/ecommerce-storefront-core';\nimport { Button, Checkbox, RadioGroup } from '@artisanpack-ui/react';\nimport { useState, type FormEvent, type ReactElement } from 'react';\n\nimport { AddressForm } from '../../components/AddressForm';\nimport { useCheckout } from '../checkoutState';\n\n/**\n * The saved addresses as radio card options.\n *\n * @param saved - The saved addresses (the last is \"Use a new address\").\n * @returns The options.\n */\nfunction savedOptions(saved: StorefrontCheckoutSavedAddress[]) {\n return saved.map((address) => ({\n value: address.id,\n label: address.name,\n ...(null !== address.hint ? { description: address.hint } : {}),\n }));\n}\n\n/**\n * One address group: the saved addresses (for a signed-in shopper) and,\n * for a new address, the form.\n */\nfunction AddressGroup({\n model,\n saved,\n choice,\n onChoice,\n form,\n values,\n onChange,\n legend,\n newLegend,\n}: {\n model: 'shipping' | 'billing';\n saved: StorefrontCheckoutSavedAddress[];\n choice: string;\n onChoice: (value: string) => void;\n form: StorefrontAddressForm | null;\n values: StorefrontAddressValues;\n onChange: (field: StorefrontAddressFieldName, value: string) => void;\n legend: string;\n newLegend: string;\n}): ReactElement {\n const { props, errors } = useCheckout();\n const hasSaved = saved.length > 0;\n\n return (\n <div className=\"ec-checkout-form__group\" {...{ [`data-checkout-${model}-address`]: '' }}>\n {hasSaved ? (\n <RadioGroup\n id={`ec-checkout-saved-${model}`}\n name={`saved_${model}`}\n label={legend}\n variant=\"cards\"\n className=\"ec-checkout-choices\"\n options={savedOptions(saved)}\n value={choice}\n onValueChange={(value) => onChoice(String(value))}\n data-checkout-saved={model}\n />\n ) : null}\n\n {(!hasSaved || 'new' === choice) && null !== form ? (\n <AddressForm\n name={model}\n form={form}\n values={values}\n onChange={onChange}\n errors={errors}\n legend={hasSaved ? newLegend : legend}\n section={model}\n formatUrl={props.urls.addressFormat}\n />\n ) : null}\n </div>\n );\n}\n\n/**\n * \"Ship to\" and the address form, then \"Billing address is the same as\n * shipping\" (checked); unchecked, \"Bill to\" and a second form. A cart that\n * doesn't ship asks for the billing address only, and says why. A\n * signed-in shopper with saved addresses picks one from radio cards (or\n * \"Use a new address\", which opens the form), and can save a new one to\n * their address book. Then \"Continue\".\n *\n * @since 1.0.0\n *\n * @returns The step's form.\n */\nexport function AddressStep(): ReactElement {\n const { props, post, processing } = useCheckout();\n const { address, urls } = props;\n const forms = props.forms;\n const [shipping, setShipping] = useState<StorefrontAddressValues>(forms?.shipping ?? {});\n const [billing, setBilling] = useState<StorefrontAddressValues>(forms?.billing ?? {});\n const [sameAsShipping, setSameAsShipping] = useState(forms?.billingSameAsShipping ?? true);\n const [savedShipping, setSavedShipping] = useState(forms?.savedShipping ?? 'new');\n const [savedBilling, setSavedBilling] = useState(forms?.savedBilling ?? 'new');\n const [saveToAddressBook, setSaveToAddressBook] = useState(false);\n\n const hasSaved = address.savedAddresses.length > 0;\n const newAddress = !hasSaved || 'new' === (address.ships ? savedShipping : savedBilling);\n const asksBilling = !address.ships || !sameAsShipping;\n\n const submit = (event: FormEvent<HTMLFormElement>): void => {\n event.preventDefault();\n post(urls.address, {\n shipping: address.ships ? shipping : null,\n billing: asksBilling ? billing : null,\n billing_same_as_shipping: address.ships && sameAsShipping,\n saved_shipping: hasSaved && address.ships ? savedShipping : null,\n saved_billing: hasSaved && asksBilling ? savedBilling : null,\n save_to_address_book: newAddress && address.canSave && saveToAddressBook,\n });\n };\n\n return (\n <form\n noValidate\n className=\"ec-checkout-form ec-checkout-form--loose\"\n onSubmit={submit}\n data-checkout-address-form=\"\"\n >\n {address.ships ? (\n <>\n <AddressGroup\n model=\"shipping\"\n saved={address.savedAddresses}\n choice={savedShipping}\n onChoice={setSavedShipping}\n form={address.shippingForm}\n values={shipping}\n onChange={(field, value) => setShipping((current) => ({ ...current, [field]: value }))}\n legend={__('Ship to')}\n newLegend={__('Shipping address')}\n />\n\n <Checkbox\n label={__('Billing address is the same as shipping')}\n checked={sameAsShipping}\n onCheckedChange={setSameAsShipping}\n data-checkout-billing-same=\"\"\n />\n </>\n ) : (\n <p className=\"ec-checkout-form__note\" data-checkout-digital-only=\"\">\n {__('Nothing in your order ships, so we only need your billing address.')}\n </p>\n )}\n\n {asksBilling ? (\n <AddressGroup\n model=\"billing\"\n saved={address.savedAddresses}\n choice={savedBilling}\n onChoice={setSavedBilling}\n form={address.billingForm}\n values={billing}\n onChange={(field, value) => setBilling((current) => ({ ...current, [field]: value }))}\n legend={__('Bill to')}\n newLegend={__('Billing address')}\n />\n ) : null}\n\n {newAddress && address.canSave ? (\n <Checkbox\n label={__('Save this address to my address book')}\n checked={saveToAddressBook}\n onCheckedChange={setSaveToAddressBook}\n data-checkout-save-address=\"\"\n />\n ) : null}\n\n <div className=\"ec-checkout-form__actions\">\n <Button\n type=\"submit\"\n color=\"primary\"\n className=\"ec-checkout-form__submit\"\n disabled={urls.address === processing}\n data-checkout-address-submit=\"\"\n >\n {__('Continue')}\n </Button>\n </div>\n </form>\n );\n}\n","/**\n * Checkout step: contact.\n *\n * @since 1.0.0\n */\n\nimport { __ } from '@artisanpack-ui/ecommerce-storefront-core';\nimport { Alert, Button, Checkbox, Icon } from '@artisanpack-ui/react';\nimport { useState, type FormEvent, type ReactElement } from 'react';\n\nimport { Field } from '../../components/Field';\nimport { useCheckout } from '../checkoutState';\n\n/**\n * For a guest, the sign-in prompt (a person icon, \"Have an account? Sign\n * in for faster checkout.\" and an outline \"Sign in\"), or, when the store\n * needs an account to pay, an info Alert with \"Sign in\" and \"Create an\n * account\". Then the email (a mail icon, and a hint saying what it's used\n * for), \"Email me news and offers\" and \"Continue\". Posts `{ email,\n * marketing_consent }` to `urls.contact`.\n *\n * @since 1.0.0\n *\n * @returns The step's form.\n */\nexport function ContactStep(): ReactElement {\n const { props, errors, post, processing } = useCheckout();\n const { status, urls } = props;\n const [email, setEmail] = useState(props.forms?.email ?? '');\n const [marketingConsent, setMarketingConsent] = useState(props.forms?.marketingConsent ?? false);\n\n const submit = (event: FormEvent<HTMLFormElement>): void => {\n event.preventDefault();\n post(urls.contact, { email, marketing_consent: marketingConsent });\n };\n\n return (\n <form noValidate className=\"ec-checkout-form\" onSubmit={submit} data-checkout-contact-form=\"\">\n {status.isGuest && null !== urls.login && !status.needsAccount ? (\n <div className=\"ec-checkout-callout\" data-checkout-sign-in-link=\"\">\n <Icon name=\"user\" className=\"ec-checkout-callout__icon\" aria-hidden=\"true\" />\n <p className=\"ec-checkout-callout__text\">\n {__('Have an account? Sign in for faster checkout.')}\n </p>\n <Button\n href={urls.login}\n variant=\"outline\"\n color=\"neutral\"\n size=\"sm\"\n className=\"ec-checkout-callout__action\"\n >\n {__('Sign in')}\n </Button>\n </div>\n ) : null}\n\n {status.needsAccount ? (\n <Alert\n color=\"info\"\n icon=\"info\"\n title={__(\"You'll need an account to pay\")}\n description={__(\n 'Fill in your details now, then sign in or create an account before paying.',\n )}\n actions={\n <>\n {null !== urls.login ? (\n <Button variant=\"outline\" color=\"neutral\" size=\"sm\" href={urls.login}>\n {__('Sign in')}\n </Button>\n ) : null}\n {null !== urls.register ? (\n <Button variant=\"outline\" color=\"neutral\" size=\"sm\" href={urls.register}>\n {__('Create an account')}\n </Button>\n ) : null}\n </>\n }\n data-checkout-account-needed=\"\"\n />\n ) : null}\n\n <div data-field=\"email\">\n <Field\n id=\"ec-checkout-email\"\n name=\"email\"\n type=\"email\"\n label={__('Email')}\n hint={__(\"We'll send your receipt and shipping updates here.\")}\n leadingIcon=\"mail\"\n autoComplete=\"email\"\n inputMode=\"email\"\n required\n value={email}\n error={errors.email ?? null}\n onValueChange={setEmail}\n />\n </div>\n\n <Checkbox\n label={__('Email me news and offers')}\n checked={marketingConsent}\n onCheckedChange={setMarketingConsent}\n data-checkout-marketing=\"\"\n />\n\n <div className=\"ec-checkout-form__actions\">\n <Button\n type=\"submit\"\n color=\"primary\"\n className=\"ec-checkout-form__submit\"\n disabled={urls.contact === processing}\n data-checkout-contact-submit=\"\"\n >\n {__('Continue')}\n </Button>\n </div>\n </form>\n );\n}\n","/**\n * Checkout step: payment, the last step.\n *\n * @since 1.0.0\n */\n\nimport { __ } from '@artisanpack-ui/ecommerce-storefront-core';\nimport { Alert, Button, Icon } from '@artisanpack-ui/react';\nimport { useState, type ReactElement } from 'react';\n\nimport { useCheckout } from '../checkoutState';\nimport { PaymentDriverHost } from '../payment/PaymentDriverHost';\n\n/**\n * \"Payment method\": the gateways as radio cards, each with its name, an\n * optional description and icon. Choosing one posts `{ gateway }` to\n * `urls.gateway`, and the chosen card opens to hold the gateway's payment\n * driver; confirming the payment places the order, as the line under the\n * cards says. With one gateway it is chosen for the shopper, and its card\n * has no radio.\n *\n * The cards follow the design-system RadioGroup's markup contract\n * (`fieldset.apui-radio-group[data-variant=\"cards\"]` and its parts) rather\n * than the component, because a card holds the driver's own form, which\n * can't sit inside the radio's label.\n *\n * While a payment is stranded, no payment method is offered. A free order\n * is placed with \"Place order\", and one whose payment is already confirmed\n * with \"Place order · {total}\" (POST `urls.place` with the token). A guest\n * who needs an account is asked to sign in or register; with no gateway, a\n * warning says to contact the store.\n *\n * @since 1.0.0\n *\n * @returns The step.\n */\nexport function PaymentStep(): ReactElement {\n const { props, errors, post, processing, clearPaymentFailure } = useCheckout();\n const { payment, status, urls, summary } = props;\n const [gateway, setGateway] = useState(props.forms?.gateway ?? '');\n const total = summary?.totals?.total ?? null;\n const placeOrder =\n null === total || (total.amount ?? 0) <= 0\n ? __('Place order')\n : __('Place order · :total', { total: total.formatted ?? '' });\n const single = 1 === payment.methods.length;\n const settingUp = null !== processing && urls.gateway === processing;\n const gatewayError = errors.gateway ?? null;\n\n const choose = (key: string): void => {\n if (key !== gateway) {\n clearPaymentFailure();\n }\n\n setGateway(key);\n post(urls.gateway, { gateway: key }, 'keep');\n };\n\n let body: ReactElement;\n\n if (null !== payment.stranded) {\n // The warning above the steps says what happened; nothing here takes another payment.\n body = (\n <p className=\"ec-checkout-form__note\" data-checkout-payment-stranded-note=\"\">\n {__(\"Don't pay again. Contact us about your payment.\")}\n </p>\n );\n } else if (!payment.required || payment.confirmed) {\n body = (\n <>\n {payment.required ? (\n <Alert\n color=\"success\"\n icon=\"circle-check\"\n title={__('Your payment is confirmed. Place your order to finish.')}\n data-checkout-payment-confirmed=\"\"\n />\n ) : (\n <p className=\"ec-checkout-form__note\" data-checkout-payment-free=\"\">\n {__(\"Your order is free, so there's nothing to pay.\")}\n </p>\n )}\n\n <div className=\"ec-checkout-form__actions\">\n <Button\n color=\"primary\"\n className=\"ec-checkout-form__submit\"\n disabled={urls.place === processing}\n onClick={() => post(urls.place, { token: payment.token ?? '' })}\n data-checkout-place-order=\"\"\n >\n {placeOrder}\n </Button>\n </div>\n </>\n );\n } else if (status.needsAccount) {\n body = (\n <Alert\n color=\"info\"\n icon=\"lock\"\n title={__('Sign in or create an account to pay')}\n description={__(\n \"This store needs an account to place an order. You'll come back here afterwards.\",\n )}\n actions={\n <>\n {null !== urls.login ? (\n <Button size=\"sm\" href={urls.login} color=\"primary\">\n {__('Sign in')}\n </Button>\n ) : null}\n {null !== urls.register ? (\n <Button variant=\"outline\" color=\"neutral\" size=\"sm\" href={urls.register}>\n {__('Create an account')}\n </Button>\n ) : null}\n </>\n }\n data-checkout-payment-account-needed=\"\"\n />\n );\n } else if (0 === payment.methods.length) {\n body = (\n <Alert\n color=\"warning\"\n icon=\"triangle-alert\"\n title={__('No payment methods are available')}\n description={__('Please contact the store to complete your order.')}\n data-checkout-no-gateways=\"\"\n />\n );\n } else {\n body = (\n <>\n <div data-field=\"gateway\">\n <fieldset\n className=\"apui-radio-group ec-payment-methods\"\n id=\"ec-checkout-gateway\"\n data-orientation=\"vertical\"\n data-variant=\"cards\"\n data-invalid={null !== gatewayError ? '' : undefined}\n aria-describedby={null !== gatewayError ? 'ec-checkout-gateway-error' : undefined}\n data-checkout-gateways={single ? undefined : ''}\n >\n <legend data-scope=\"radio-group\" data-part=\"label\">\n {__('Payment method')}\n </legend>\n\n <div data-scope=\"radio-group\" data-part=\"items\">\n {payment.methods.map((method, index) => {\n const methodId = `ec-checkout-gateway-${index}`;\n const selected = single || gateway === method.key;\n const showsDriver =\n selected && null !== payment.setup && payment.setup.gateway === method.key;\n\n return (\n <div\n key={method.key}\n className=\"ec-payment-method\"\n data-selected={selected ? '' : undefined}\n data-checkout-gateway={method.key}\n >\n {single ? (\n <div className=\"ec-payment-method__header\" data-checkout-gateway-single=\"\">\n <span className=\"ec-payment-method__text\">\n {__('Pay with :gateway', { gateway: method.label })}\n </span>\n {null !== method.description ? (\n <span className=\"ec-payment-method__description\">\n {method.description}\n </span>\n ) : null}\n {null !== method.icon ? (\n <Icon\n name={method.icon}\n className=\"ec-payment-method__icon\"\n aria-hidden=\"true\"\n />\n ) : null}\n </div>\n ) : (\n <label\n data-scope=\"radio-group\"\n data-part=\"item\"\n className=\"ec-payment-method__header\"\n htmlFor={methodId}\n >\n <span data-scope=\"radio-group\" data-part=\"box\">\n <input\n type=\"radio\"\n data-scope=\"radio-group\"\n data-part=\"control\"\n id={methodId}\n name=\"ec-checkout-gateway\"\n value={method.key}\n checked={selected}\n onChange={() => choose(method.key)}\n aria-invalid={null !== gatewayError ? 'true' : undefined}\n aria-describedby={\n null !== method.description ? `${methodId}-description` : undefined\n }\n />\n <span data-scope=\"radio-group\" data-part=\"indicator\" aria-hidden=\"true\" />\n </span>\n <span data-scope=\"radio-group\" data-part=\"item-text\">\n {method.label}\n </span>\n {null !== method.description ? (\n <span\n data-scope=\"radio-group\"\n data-part=\"item-description\"\n id={`${methodId}-description`}\n >\n {method.description}\n </span>\n ) : null}\n {null !== method.icon ? (\n <Icon\n name={method.icon}\n className=\"ec-payment-method__icon\"\n aria-hidden=\"true\"\n />\n ) : null}\n </label>\n )}\n\n {showsDriver && null !== payment.setup && !settingUp ? (\n <div\n className=\"ec-payment-method__panel\"\n data-checkout-payment-driver={payment.setup.driver}\n >\n <PaymentDriverHost\n key={payment.setup.reference}\n setup={payment.setup}\n token={payment.token}\n />\n </div>\n ) : null}\n </div>\n );\n })}\n </div>\n\n {null !== gatewayError ? (\n <p data-scope=\"radio-group\" data-part=\"error\" id=\"ec-checkout-gateway-error\">\n <Icon name=\"circle-alert\" aria-hidden=\"true\" />\n {gatewayError}\n </p>\n ) : null}\n </fieldset>\n </div>\n\n {settingUp ? (\n <p className=\"ec-checkout-form__note\" data-checkout-payment-loading=\"\">\n {__('Setting up your payment…')}\n </p>\n ) : null !== payment.setup ? (\n <p className=\"ec-checkout-form__note\" data-checkout-payment-places-order=\"\">\n {__('Your order is placed as soon as your payment is confirmed.')}\n </p>\n ) : null}\n </>\n );\n }\n\n return (\n <div className=\"ec-checkout-form\" data-checkout-payment=\"\">\n {body}\n\n <div data-field=\"payment\">\n {undefined !== errors.payment ? (\n <p className=\"ec-checkout-form__error\" data-checkout-payment-error=\"\">\n <Icon name=\"circle-alert\" aria-hidden=\"true\" />\n <span>{errors.payment}</span>\n </p>\n ) : null}\n </div>\n </div>\n );\n}\n","/**\n * Checkout step: review.\n *\n * @since 1.0.0\n */\n\nimport { __ } from '@artisanpack-ui/ecommerce-storefront-core';\nimport { Button, Checkbox } from '@artisanpack-ui/react';\nimport { useState, type FormEvent, type ReactElement } from 'react';\n\nimport { Field } from '../../components/Field';\nimport { useCheckout } from '../checkoutState';\n\n/**\n * Before payment, what's left to settle: the optional order note (with a\n * character count), \"Create an account with this email\" for guests when\n * the store offers it (the password under it once checked), the terms\n * checkbox with its link (when a terms page is set), and \"Continue to\n * payment\". Posts `{ note, accept_terms, create_account, password }` to\n * `urls.review`; the password is never sent back.\n *\n * @since 1.0.0\n *\n * @returns The step's form.\n */\nexport function ReviewStep(): ReactElement {\n const { props, errors, post, processing } = useCheckout();\n const { review, urls } = props;\n const [note, setNote] = useState(props.forms?.note ?? '');\n const [acceptTerms, setAcceptTerms] = useState(props.forms?.acceptTerms ?? false);\n const [createAccount, setCreateAccount] = useState(props.forms?.createAccount ?? false);\n const [password, setPassword] = useState('');\n const [termsBefore, termsAfter = ''] = __('I accept the :terms').split(':terms', 2);\n\n const submit = (event: FormEvent<HTMLFormElement>): void => {\n event.preventDefault();\n post(urls.review, {\n note,\n accept_terms: null !== review.termsUrl && acceptTerms,\n create_account: review.offersAccount && createAccount,\n password: review.offersAccount && createAccount ? password : null,\n });\n };\n\n return (\n <form\n noValidate\n className=\"ec-checkout-form ec-checkout-form--loose\"\n onSubmit={submit}\n data-checkout-review-form=\"\"\n >\n <div data-field=\"note\">\n <Field\n control=\"textarea\"\n id=\"ec-checkout-order-note\"\n name=\"note\"\n label={__('Order note')}\n optional\n placeholder={__('Anything the store should know about your order')}\n hint={__('Anything the store should know about your order. Up to :max characters.', {\n max: review.noteMaxLength,\n })}\n maxLength={review.noteMaxLength}\n value={note}\n error={errors.note ?? null}\n onValueChange={setNote}\n attributes={{ rows: 3, 'data-checkout-order-note': '' }}\n />\n </div>\n\n {review.offersAccount ? (\n <div className=\"ec-checkout-callout ec-checkout-callout--stacked\" data-checkout-account=\"\">\n <Checkbox\n label={__('Create an account with this email')}\n description={__('Track this order and check out faster next time.')}\n checked={createAccount}\n onCheckedChange={setCreateAccount}\n data-checkout-create-account=\"\"\n />\n\n {createAccount ? (\n <div className=\"ec-checkout-callout__nested\" data-field=\"password\">\n <Field\n control=\"password\"\n id=\"ec-checkout-password\"\n name=\"password\"\n label={__('Password')}\n autoComplete=\"new-password\"\n value={password}\n error={errors.password ?? null}\n onValueChange={setPassword}\n attributes={{ 'data-checkout-password': '' }}\n />\n </div>\n ) : null}\n </div>\n ) : null}\n\n {null !== review.termsUrl ? (\n <div data-field=\"accept_terms\">\n <Checkbox\n id=\"ec-checkout-terms\"\n name=\"accept_terms\"\n checked={acceptTerms}\n onCheckedChange={setAcceptTerms}\n error={errors.accept_terms}\n label={\n <>\n {termsBefore}\n <a\n href={review.termsUrl}\n className=\"apui-link\"\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n data-checkout-terms-link=\"\"\n >\n {__('terms and conditions')}\n <span className=\"apui-sr-only\"> {__('(opens in a new tab)')}</span>\n </a>\n {termsAfter}\n </>\n }\n data-checkout-terms=\"\"\n />\n </div>\n ) : null}\n\n <div className=\"ec-checkout-form__actions\">\n <Button\n type=\"submit\"\n color=\"primary\"\n className=\"ec-checkout-form__submit\"\n disabled={urls.review === processing}\n data-checkout-review-submit=\"\"\n >\n {__('Continue to payment')}\n </Button>\n </div>\n </form>\n );\n}\n","/**\n * Checkout step: shipping.\n *\n * @since 1.0.0\n */\n\nimport { __ } from '@artisanpack-ui/ecommerce-storefront-core';\nimport { Alert, Button, RadioGroup } from '@artisanpack-ui/react';\nimport { useState, type FormEvent, type ReactElement } from 'react';\n\nimport { shipToLine } from '../addressLines';\nimport { useCheckout } from '../checkoutState';\n\n/**\n * \"Shipping to\" the cart's address on one line, with \"Change address\"\n * (back to the address step). Then the rates quoted for it as radio cards,\n * one per row: the name and its delivery estimate, with the price (or\n * \"Free\") at the end. The chosen one is applied straight away (POST\n * `urls.shippingRate`), so the order summary's totals follow it. Then\n * \"Continue\" (POST `urls.shipping`). With no rates for the address, a\n * warning Alert offers \"Change address\" instead.\n *\n * @since 1.0.0\n *\n * @returns The step's form.\n */\nexport function ShippingStep(): ReactElement {\n const { props, errors, post, goTo, processing } = useCheckout();\n const { shipping, urls } = props;\n const [rate, setRate] = useState(props.forms?.rate || shipping.chosen?.id || '');\n const rates = shipping.rates ?? [];\n const shipTo = shipToLine(props.forms?.shipping ?? {});\n const [before, after = ''] = __('Shipping to :address').split(':address', 2);\n const busy =\n null !== processing && (urls.shipping === processing || urls.shippingRate === processing);\n\n const choose = (value: string): void => {\n setRate(value);\n post(urls.shippingRate, { rate: value }, 'keep');\n };\n\n const submit = (event: FormEvent<HTMLFormElement>): void => {\n event.preventDefault();\n post(urls.shipping, { rate });\n };\n\n return (\n <form noValidate className=\"ec-checkout-form\" onSubmit={submit} data-checkout-shipping-form=\"\">\n {'' !== shipTo ? (\n <div className=\"ec-checkout-ship-to\" data-checkout-ship-to=\"\">\n <p className=\"ec-checkout-ship-to__text\">\n {before}\n <span className=\"ec-checkout-ship-to__address\">{shipTo}</span>\n {after}\n </p>\n <Button\n variant=\"link\"\n size=\"sm\"\n onClick={() => goTo('address')}\n data-checkout-change-address=\"\"\n >\n {__('Change address')}\n </Button>\n </div>\n ) : null}\n\n {null !== shipping.notice ? (\n <Alert\n color=\"warning\"\n icon=\"triangle-alert\"\n title={shipping.notice}\n data-checkout-shipping-notice=\"\"\n />\n ) : null}\n\n {null !== shipping.rates && 0 === rates.length ? (\n <Alert\n color=\"warning\"\n icon=\"truck\"\n title={__(\"We can't ship to this address\")}\n description={__('Check the address, or use a different one.')}\n actions={\n <Button\n variant=\"outline\"\n color=\"neutral\"\n size=\"sm\"\n onClick={() => goTo('address')}\n data-checkout-change-address=\"\"\n >\n {__('Change address')}\n </Button>\n }\n data-checkout-no-rates=\"\"\n />\n ) : rates.length > 0 ? (\n <>\n <div data-field=\"rate\">\n <RadioGroup\n id=\"ec-checkout-shipping-rate\"\n name=\"rate\"\n label={__('Shipping option')}\n variant=\"cards\"\n className=\"ec-checkout-choices ec-checkout-choices--priced\"\n options={rates.map((option) => ({\n value: option.id,\n label: option.label,\n ...(null !== option.estimate ? { description: option.estimate } : {}),\n meta:\n (option.amount.amount ?? 0) > 0 ? (option.amount.formatted ?? '') : __('Free'),\n }))}\n value={'' === rate ? null : rate}\n error={errors.rate}\n onValueChange={(value) => choose(String(value))}\n data-checkout-rates=\"\"\n />\n </div>\n\n <div className=\"ec-checkout-form__actions\">\n <Button\n type=\"submit\"\n color=\"primary\"\n className=\"ec-checkout-form__submit\"\n disabled={busy}\n data-checkout-shipping-submit=\"\"\n >\n {__('Continue')}\n </Button>\n </div>\n </>\n ) : null}\n </form>\n );\n}\n","/**\n * The checkout.\n *\n * @since 1.0.0\n */\n\nimport { __, type StorefrontCheckoutStep } from '@artisanpack-ui/ecommerce-storefront-core';\nimport { Alert, Button, Icon, Step, Steps } from '@artisanpack-ui/react';\nimport { useCallback, useEffect, useRef, type ComponentType, type ReactElement } from 'react';\n\nimport { EmptyState } from '../components/EmptyState';\nimport { getRegistries } from '../registries';\nimport { registerPaymentDrivers } from './payment/registerPaymentDrivers';\nimport { usePageErrors } from '../useStorefront';\nimport { CheckoutErrorSummary } from './CheckoutErrorSummary';\nimport { CheckoutOrderSummary } from './CheckoutOrderSummary';\nimport { CheckoutStepSummary } from './CheckoutStepSummary';\nimport {\n CheckoutProvider,\n takeStepFocus,\n useCheckout,\n useCheckoutState,\n type CheckoutProps,\n} from './checkoutState';\nimport { Placement } from './Placement';\nimport { AddressStep } from './steps/AddressStep';\nimport { ContactStep } from './steps/ContactStep';\nimport { PaymentStep } from './steps/PaymentStep';\nimport { ReviewStep } from './steps/ReviewStep';\nimport { ShippingStep } from './steps/ShippingStep';\n\n/**\n * Props a satellite's checkout step component gets (`checkoutSteps`\n * registry).\n *\n * @since 1.0.0\n */\nexport interface CheckoutStepComponentProps {\n /** The step, with its `completeUrl`. */\n step: StorefrontCheckoutStep;\n /** Posts to the step's `completeUrl`, moving the checkout on. */\n complete: (data?: Record<string, unknown>) => void;\n}\n\nregisterPaymentDrivers();\n\nconst CORE_STEPS: Record<string, ComponentType> = {\n contact: ContactStep,\n address: AddressStep,\n shipping: ShippingStep,\n review: ReviewStep,\n payment: PaymentStep,\n};\n\n/**\n * The open step's form: a core step's, or the component a satellite\n * registered for its step.\n */\nfunction StepBody({ step }: { step: StorefrontCheckoutStep }): ReactElement | null {\n const { post } = useCheckout();\n const complete = useCallback(\n (data: Record<string, unknown> = {}) => post(step.completeUrl, data),\n [post, step.completeUrl],\n );\n\n if (null !== step.component) {\n const Satellite = getRegistries().checkoutSteps.get(step.component)?.component;\n\n return undefined === Satellite ? null : <Satellite step={step} complete={complete} />;\n }\n\n const Core = CORE_STEPS[step.key];\n\n return undefined === Core ? null : <Core />;\n}\n\n/**\n * The page's \"Checkout\" title, when it shows one.\n */\nfunction Title(): ReactElement | null {\n const { props } = useCheckout();\n\n return false === props.showTitle ? null : (\n <h1 className=\"ec-checkout__title\">{__('Checkout')}</h1>\n );\n}\n\n/**\n * The order was placed and there is no confirmation page: thank the\n * shopper, and move focus to the page's heading, as the \"Place order\"\n * button is gone.\n */\nfunction Placed({ number }: { number: string }): ReactElement {\n const root = useRef<HTMLDivElement>(null);\n\n useEffect(() => {\n const heading = root.current?.querySelector<HTMLElement>('h1, h2');\n\n if (undefined !== heading && null !== heading) {\n heading.setAttribute('tabindex', '-1');\n heading.focus();\n }\n }, []);\n\n return (\n <div ref={root} className=\"ec-checkout__placed\" data-checkout-placed=\"\">\n <Title />\n\n <EmptyState\n icon=\"circle-check\"\n title={__('Thank you for your order')}\n description={__(\"Your order :number is placed. We've emailed you a confirmation.\", {\n number,\n })}\n card\n />\n </div>\n );\n}\n\n/**\n * The steps beside the order summary.\n */\nfunction CheckoutSteps(): ReactElement {\n const { props, goTo } = useCheckout();\n const { steps, layout, status, payment } = props;\n const singlePage = 'single_page' === layout;\n const current = steps.find((step) => step.current) ?? null;\n const blocking = [...steps].reverse().find((step) => step.reachable)?.label ?? '';\n const currentKey = current?.key ?? null;\n\n useEffect(() => {\n if (takeStepFocus() && null !== currentKey) {\n document.getElementById(`ec-checkout-step-${currentKey}`)?.focus();\n }\n }, [currentKey]);\n\n return (\n <div className=\"ec-checkout__layout\">\n <div className=\"ec-checkout__main\">\n <Title />\n\n {!singlePage && steps.length > 0 ? (\n <>\n {null !== current ? (\n // Below 768px; the live announcement says the same to assistive tech.\n <p className=\"ec-checkout__step-line\" aria-hidden=\"true\" data-checkout-step-line=\"\">\n {__('Step :number of :total', { number: current.number, total: steps.length })}{' '}\n &middot; <span>{current.label}</span>\n </p>\n ) : null}\n\n <div aria-hidden=\"true\" className=\"ec-checkout__progress\" data-checkout-progress=\"\">\n <Steps value={props.progress}>\n {steps.map((step) => (\n <Step key={step.key} title={step.label} />\n ))}\n </Steps>\n </div>\n </>\n ) : null}\n\n {status.adjustments.length > 0 ? (\n <Alert color=\"warning\" title={__(\"We've updated your cart\")} data-checkout-adjustments=\"\">\n <ul className=\"ec-checkout__adjustments\">\n {status.adjustments.map((adjustment, index) => (\n <li key={index}>{adjustment}</li>\n ))}\n </ul>\n </Alert>\n ) : null}\n\n {null !== payment.stranded ? (\n <Alert\n color=\"warning\"\n icon=\"circle-alert\"\n title={payment.stranded.title}\n description={payment.stranded.message}\n data-checkout-payment-stranded=\"\"\n />\n ) : null}\n\n <CheckoutErrorSummary />\n\n <ol\n role=\"list\"\n className=\"ec-checkout__steps\"\n aria-label={__('Checkout steps')}\n data-checkout-steps=\"\"\n >\n {steps.map((step) => {\n const done = !step.current && step.complete && step.reachable;\n const state = step.current ? 'current' : done ? 'complete' : 'upcoming';\n\n return (\n <li\n key={`${step.key}-${state}`}\n className=\"ec-checkout-step\"\n data-state={state}\n aria-current={step.current ? 'step' : undefined}\n data-checkout-step={step.key}\n data-checkout-step-state={state}\n >\n <div className=\"ec-checkout-step__header\">\n <h2\n id={`ec-checkout-step-${step.key}`}\n tabIndex={-1}\n className=\"ec-checkout-step__title\"\n >\n <span className=\"ec-checkout-step__number\" aria-hidden=\"true\">\n {done ? <Icon name=\"check\" /> : step.number}\n </span>\n <span className=\"apui-sr-only\">\n {__('Step :number:', { number: step.number })}\n </span>\n <span>{step.label}</span>\n {done ? (\n <span className=\"apui-sr-only\">{__('(completed)')}</span>\n ) : !step.reachable ? (\n <span className=\"apui-sr-only\" data-checkout-step-unavailable=\"\">\n {__('(not available yet)')}\n </span>\n ) : null}\n </h2>\n\n {done ? (\n <Button\n variant=\"ghost\"\n color=\"neutral\"\n size=\"sm\"\n leadingIcon=\"pencil\"\n onClick={() => goTo(step.key)}\n aria-label={__('Edit :step', { step: step.label })}\n data-checkout-edit={step.key}\n >\n {__('Edit')}\n </Button>\n ) : null}\n </div>\n\n {step.current ? (\n <div className=\"ec-checkout-step__body\">\n <StepBody step={step} />\n </div>\n ) : done ? (\n <div className=\"ec-checkout-step__summary\" data-checkout-step-summary={step.key}>\n <CheckoutStepSummary step={step.key} />\n </div>\n ) : singlePage && !step.reachable ? (\n <p className=\"ec-checkout-step__locked\" data-checkout-step-locked={step.key}>\n {__('Complete “:step” first.', { step: blocking })}\n </p>\n ) : null}\n </li>\n );\n })}\n </ol>\n </div>\n\n <CheckoutOrderSummary summary={props.summary} cartUrl={props.urls.cart} />\n </div>\n );\n}\n\n/**\n * What the checkout shows: the placed order, why it can't be shown, the\n * sign-in prompt, an unpaid placed order, or the steps.\n */\nfunction CheckoutBody(): ReactElement {\n const { props } = useCheckout();\n const { status, urls } = props;\n\n if (null !== status.placedOrder) {\n return <Placed number={status.placedOrder} />;\n }\n\n if (null !== status.unavailable) {\n return (\n <>\n <Title />\n <EmptyState\n icon=\"shopping-bag\"\n title={status.unavailable}\n card\n data-checkout-unavailable=\"\"\n >\n {null !== urls.cart ? (\n <Button href={urls.cart} color=\"primary\">\n {__('Go to your cart')}\n </Button>\n ) : null}\n </EmptyState>\n </>\n );\n }\n\n if (status.signInRequired) {\n return (\n <>\n <Title />\n <EmptyState\n icon=\"lock\"\n title={__('Sign in to check out')}\n description={__('You need an account to place an order with this store.')}\n card\n data-checkout-sign-in-required=\"\"\n >\n {null !== urls.login ? (\n <Button href={urls.login} color=\"primary\" data-checkout-login=\"\">\n {__('Sign in')}\n </Button>\n ) : null}\n {null !== urls.register ? (\n <Button\n variant=\"outline\"\n color=\"neutral\"\n href={urls.register}\n data-checkout-register=\"\"\n >\n {__('Create an account')}\n </Button>\n ) : null}\n </EmptyState>\n </>\n );\n }\n\n if (null !== props.placement) {\n return <Placement placement={props.placement} />;\n }\n\n return <CheckoutSteps />;\n}\n\n/**\n * The checkout: the steps beside a sticky order summary (from 1024px;\n * below that the summary is a \"Show order summary\" bar above the title),\n * with the \"Checkout\" title first when `showTitle`.\n *\n * Multi-step: the design-system Steps from 768px (below that, \"Step 2 of\n * 5 · Address\"), then every step as a card: finished steps collapse to\n * what they chose with \"Edit\", the open step shows its form, and the\n * steps still to come are muted. Single page: every step, with the ones\n * after an unfinished step disabled and saying why. A satellite's step is\n * the component it registered in the `checkoutSteps` registry.\n *\n * After an order is placed but its payment isn't finished, the payment for\n * that order is shown instead, with \"Finish paying for order …\" as the\n * title.\n *\n * @since 1.0.0\n *\n * @param props - The checkout page's props.\n * @returns The checkout.\n */\nexport function Checkout(props: CheckoutProps): ReactElement {\n const state = useCheckoutState(props, usePageErrors());\n\n return (\n <CheckoutProvider value={state}>\n <div className=\"ec-checkout\" data-ecommerce-checkout=\"\" data-checkout-layout={props.layout}>\n <p\n className=\"apui-sr-only\"\n role=\"status\"\n aria-live=\"polite\"\n aria-atomic=\"true\"\n data-checkout-announcement=\"\"\n >\n {props.status.announcement}\n </p>\n\n <CheckoutBody />\n </div>\n </CheckoutProvider>\n );\n}\n\nexport type { CheckoutProps };\n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MAAM,QAClF;AAAA,oBAAAD;AAAA,MAAC;AAAA;AAAA,QACC,WAAU;AAAA,QACV,MAAK;AAAA,QACL,aAAU;AAAA,QACV,eAAY;AAAA,QACZ,8BAA2B;AAAA,QAE1B,gBAAM,OAAO;AAAA;AAAA,IAChB;AAAA,IAEA,gBAAAA,MAAC,gBAAa;AAAA,KAChB,GACF;AAEJ;","names":["__","useState","useState","__","__","paymentFailureMessage","__","Alert","Button","Card","Icon","useState","jsx","jsxs","useState","Alert","__","Card","Icon","Button","useCallback","useState","__","jsx","__","__","Icon","useState","jsx","jsxs","useState","Icon","__","__","jsx","jsxs","__","part","paymentFailureMessage","router","useCallback","useEffect","useRef","jsx","isHttpUrl","useCallback","router","paymentFailureMessage","useRef","useEffect","__","Alert","Card","Icon","useEffect","useRef","jsx","jsxs","useRef","useEffect","Card","Icon","__","Alert","__","Button","useState","jsx","jsxs","useState","__","Button","__","Alert","Button","Checkbox","Icon","useState","Fragment","jsx","jsxs","useState","Icon","__","Button","Alert","Checkbox","__","Alert","Button","Icon","useState","Fragment","jsx","jsxs","useState","__","Alert","Button","Icon","__","Button","Checkbox","useState","Fragment","jsx","jsxs","useState","__","Checkbox","Button","__","Alert","Button","RadioGroup","useState","Fragment","jsx","jsxs","useState","__","Button","Alert","RadioGroup","__","Alert","Button","Icon","useCallback","useEffect","useRef","Fragment","jsx","jsxs","useCallback","__","useRef","useEffect","Alert","Icon","Button"]}
@@ -0,0 +1,183 @@
1
+ import {
2
+ Field
3
+ } from "./chunk-WYGOMIZK.mjs";
4
+ import {
5
+ cx
6
+ } from "./chunk-VX5TEJNU.mjs";
7
+
8
+ // src/components/AddressForm.tsx
9
+ import {
10
+ __
11
+ } from "@artisanpack-ui/ecommerce-storefront-core";
12
+ import { Fieldset } from "@artisanpack-ui/react";
13
+ import { useEffect, useState } from "react";
14
+ import { jsx, jsxs } from "react/jsx-runtime";
15
+ async function fetchFormat(url, country) {
16
+ try {
17
+ const target = new URL(url, window.location.href);
18
+ target.searchParams.set("country", country);
19
+ const response = await fetch(target.toString(), {
20
+ headers: { Accept: "application/json", "X-Requested-With": "XMLHttpRequest" },
21
+ credentials: "same-origin"
22
+ });
23
+ return response.ok ? await response.json() : null;
24
+ } catch {
25
+ return null;
26
+ }
27
+ }
28
+ function AddressForm({
29
+ name,
30
+ form,
31
+ values,
32
+ onChange,
33
+ onBlur,
34
+ errors = {},
35
+ legend = null,
36
+ section = null,
37
+ formatUrl = null,
38
+ className
39
+ }) {
40
+ const [format, setFormat] = useState(form.format);
41
+ const [givenFormat, setGivenFormat] = useState(form.format);
42
+ const country = (values.country_code ?? "").toUpperCase() || null;
43
+ if (givenFormat !== form.format) {
44
+ setGivenFormat(form.format);
45
+ setFormat(form.format);
46
+ }
47
+ useEffect(() => {
48
+ if (null === formatUrl || null === country || country === format.country) {
49
+ return;
50
+ }
51
+ let current = true;
52
+ void fetchFormat(formatUrl, country).then((next) => {
53
+ if (current && null !== next) {
54
+ setFormat(next);
55
+ }
56
+ });
57
+ return () => {
58
+ current = false;
59
+ };
60
+ }, [formatUrl, country, format.country]);
61
+ const id = (field) => `${name}.${field}`;
62
+ const autocomplete = (token) => null === section || "" === section ? token : `${section} ${token}`;
63
+ const error = (field) => errors[id(field)] ?? null;
64
+ const fieldProps = (field) => ({
65
+ id: id(field),
66
+ name: id(field),
67
+ error: error(field),
68
+ value: values[field] ?? "",
69
+ onValueChange: (value) => onChange(field, value),
70
+ onBlur: void 0 === onBlur ? void 0 : () => onBlur(field)
71
+ });
72
+ const phone = form.fields.find((field) => "phone" === field.name) ?? null;
73
+ const fields = form.fields.filter((field) => "phone" !== field.name);
74
+ return /* @__PURE__ */ jsx(
75
+ Fieldset,
76
+ {
77
+ variant: "plain",
78
+ title: legend ?? void 0,
79
+ className: cx("ec-address-form", className),
80
+ "data-address-form": name,
81
+ children: /* @__PURE__ */ jsxs("div", { className: "ec-address-form__grid", children: [
82
+ /* @__PURE__ */ jsx("div", { className: "ec-address-form__cell", "data-span": "full", "data-field": id("country_code"), children: /* @__PURE__ */ jsx(
83
+ Field,
84
+ {
85
+ ...fieldProps("country_code"),
86
+ control: "select",
87
+ label: __("Country"),
88
+ hint: __("Fields change to match the country's address format."),
89
+ options: form.countries,
90
+ placeholder: __("Select a country"),
91
+ autoComplete: autocomplete("country"),
92
+ required: true
93
+ }
94
+ ) }),
95
+ fields.map((field) => /* @__PURE__ */ jsx(
96
+ "div",
97
+ {
98
+ className: "ec-address-form__cell",
99
+ "data-span": field.wide ? "full" : "half",
100
+ "data-field": id(field.name),
101
+ children: /* @__PURE__ */ jsx(
102
+ Field,
103
+ {
104
+ ...fieldProps(field.name),
105
+ label: field.label,
106
+ autoComplete: autocomplete(field.autocomplete),
107
+ required: field.required,
108
+ optional: !field.required
109
+ }
110
+ )
111
+ },
112
+ field.name
113
+ )),
114
+ format.regions.length > 0 ? /* @__PURE__ */ jsx(
115
+ "div",
116
+ {
117
+ className: "ec-address-form__cell",
118
+ "data-span": "quarter",
119
+ "data-field": id("region_code"),
120
+ children: /* @__PURE__ */ jsx(
121
+ Field,
122
+ {
123
+ ...fieldProps("region_code"),
124
+ control: "select",
125
+ label: format.regionLabel,
126
+ options: format.regions,
127
+ placeholder: __("Select one"),
128
+ autoComplete: autocomplete("address-level1"),
129
+ required: true
130
+ }
131
+ )
132
+ },
133
+ `region_code-${format.country ?? ""}`
134
+ ) : /* @__PURE__ */ jsx("div", { className: "ec-address-form__cell", "data-span": "quarter", "data-field": id("region"), children: /* @__PURE__ */ jsx(
135
+ Field,
136
+ {
137
+ ...fieldProps("region"),
138
+ label: format.regionLabel,
139
+ autoComplete: autocomplete("address-level1"),
140
+ optional: true
141
+ }
142
+ ) }),
143
+ /* @__PURE__ */ jsx(
144
+ "div",
145
+ {
146
+ className: "ec-address-form__cell",
147
+ "data-span": "quarter",
148
+ "data-field": id("postal_code"),
149
+ children: /* @__PURE__ */ jsx(
150
+ Field,
151
+ {
152
+ ...fieldProps("postal_code"),
153
+ label: format.postcodeLabel,
154
+ hint: format.postcodeHint,
155
+ autoComplete: autocomplete("postal-code"),
156
+ required: format.postcodeRequired,
157
+ optional: !format.postcodeRequired
158
+ }
159
+ )
160
+ },
161
+ `postal_code-${format.country ?? ""}`
162
+ ),
163
+ null !== phone ? /* @__PURE__ */ jsx("div", { className: "ec-address-form__cell", "data-span": "full", "data-field": id("phone"), children: /* @__PURE__ */ jsx(
164
+ Field,
165
+ {
166
+ ...fieldProps("phone"),
167
+ type: "tel",
168
+ label: phone.label,
169
+ hint: __("Only used if the carrier needs to reach you."),
170
+ autoComplete: autocomplete(phone.autocomplete),
171
+ required: phone.required,
172
+ optional: !phone.required
173
+ }
174
+ ) }) : null
175
+ ] })
176
+ }
177
+ );
178
+ }
179
+
180
+ export {
181
+ AddressForm
182
+ };
183
+ //# sourceMappingURL=chunk-A3MMQ2RY.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/components/AddressForm.tsx"],"sourcesContent":["/**\n * `ec-address-form`: an address fieldset that follows the country's format.\n *\n * Mirrors ecommerce-storefront-livewire's `<x-artisanpack-ec-address-form>`:\n * the country first, then the name and street fields, then the region (a\n * select when the country has regions, else optional text), the postal code\n * with the country's label and hint, and the phone last. When the country\n * changes, the form asks `formatUrl` (the `address-format` JSON route) for\n * the new country's regions and postal code rules.\n *\n * @since 1.0.0\n */\n\nimport {\n __,\n type StorefrontAddressFieldName,\n type StorefrontAddressForm,\n type StorefrontAddressFormat,\n type StorefrontAddressValues,\n} from '@artisanpack-ui/ecommerce-storefront-core';\nimport { Fieldset } from '@artisanpack-ui/react';\nimport { useEffect, useState, type ReactElement } from 'react';\n\nimport { cx } from '../internal/classes';\nimport { Field } from './Field';\n\n/**\n * Props for {@link AddressForm}.\n *\n * @since 1.0.0\n */\nexport interface AddressFormProps {\n /** The fields' name prefix, such as `shipping`: ids and error keys are `shipping.city`. */\n name: string;\n /** The countries, fields and the current country's format. */\n form: StorefrontAddressForm;\n /** The address so far. */\n values: StorefrontAddressValues;\n /** Called with a field and its new value. */\n onChange: (field: StorefrontAddressFieldName, value: string) => void;\n /** Called when a field loses focus, for forms that check as the shopper goes. */\n onBlur?: (field: StorefrontAddressFieldName) => void;\n /** The page's errors, keyed `{name}.{field}`. */\n errors?: Record<string, string>;\n /** The fieldset's legend. */\n legend?: string | null;\n /** An autocomplete section, such as `shipping`: tokens become `shipping postal-code`. */\n section?: string | null;\n /** The `address-format` JSON route; without it the format stays as given. */\n formatUrl?: string | null;\n className?: string;\n}\n\n/**\n * Fetches a country's address format.\n *\n * @param url - The `address-format` route.\n * @param country - The country code.\n * @returns The format, or null when the request fails.\n */\nasync function fetchFormat(url: string, country: string): Promise<StorefrontAddressFormat | null> {\n try {\n const target = new URL(url, window.location.href);\n\n target.searchParams.set('country', country);\n\n const response = await fetch(target.toString(), {\n headers: { Accept: 'application/json', 'X-Requested-With': 'XMLHttpRequest' },\n credentials: 'same-origin',\n });\n\n return response.ok ? ((await response.json()) as StorefrontAddressFormat) : null;\n } catch {\n return null;\n }\n}\n\n/**\n * An address form.\n *\n * @since 1.0.0\n *\n * @param props - The form, values and handlers.\n * @returns The fieldset.\n */\nexport function AddressForm({\n name,\n form,\n values,\n onChange,\n onBlur,\n errors = {},\n legend = null,\n section = null,\n formatUrl = null,\n className,\n}: AddressFormProps): ReactElement {\n const [format, setFormat] = useState<StorefrontAddressFormat>(form.format);\n const [givenFormat, setGivenFormat] = useState(form.format);\n const country = (values.country_code ?? '').toUpperCase() || null;\n\n // A new format from the server replaces the one fetched here.\n if (givenFormat !== form.format) {\n setGivenFormat(form.format);\n setFormat(form.format);\n }\n\n useEffect(() => {\n if (null === formatUrl || null === country || country === format.country) {\n return;\n }\n\n let current = true;\n\n void fetchFormat(formatUrl, country).then((next) => {\n if (current && null !== next) {\n setFormat(next);\n }\n });\n\n return () => {\n current = false;\n };\n }, [formatUrl, country, format.country]);\n\n const id = (field: StorefrontAddressFieldName): string => `${name}.${field}`;\n const autocomplete = (token: string): string =>\n null === section || '' === section ? token : `${section} ${token}`;\n const error = (field: StorefrontAddressFieldName): string | null => errors[id(field)] ?? null;\n const fieldProps = (field: StorefrontAddressFieldName) => ({\n id: id(field),\n name: id(field),\n error: error(field),\n value: values[field] ?? '',\n onValueChange: (value: string) => onChange(field, value),\n onBlur: undefined === onBlur ? undefined : () => onBlur(field),\n });\n\n const phone = form.fields.find((field) => 'phone' === field.name) ?? null;\n const fields = form.fields.filter((field) => 'phone' !== field.name);\n\n return (\n <Fieldset\n variant=\"plain\"\n title={legend ?? undefined}\n className={cx('ec-address-form', className)}\n data-address-form={name}\n >\n <div className=\"ec-address-form__grid\">\n <div className=\"ec-address-form__cell\" data-span=\"full\" data-field={id('country_code')}>\n <Field\n {...fieldProps('country_code')}\n control=\"select\"\n label={__('Country')}\n hint={__(\"Fields change to match the country's address format.\")}\n options={form.countries}\n placeholder={__('Select a country')}\n autoComplete={autocomplete('country')}\n required\n />\n </div>\n\n {fields.map((field) => (\n <div\n key={field.name}\n className=\"ec-address-form__cell\"\n data-span={field.wide ? 'full' : 'half'}\n data-field={id(field.name)}\n >\n <Field\n {...fieldProps(field.name)}\n label={field.label}\n autoComplete={autocomplete(field.autocomplete)}\n required={field.required}\n optional={!field.required}\n />\n </div>\n ))}\n\n {format.regions.length > 0 ? (\n <div\n key={`region_code-${format.country ?? ''}`}\n className=\"ec-address-form__cell\"\n data-span=\"quarter\"\n data-field={id('region_code')}\n >\n <Field\n {...fieldProps('region_code')}\n control=\"select\"\n label={format.regionLabel}\n options={format.regions}\n placeholder={__('Select one')}\n autoComplete={autocomplete('address-level1')}\n required\n />\n </div>\n ) : (\n <div className=\"ec-address-form__cell\" data-span=\"quarter\" data-field={id('region')}>\n <Field\n {...fieldProps('region')}\n label={format.regionLabel}\n autoComplete={autocomplete('address-level1')}\n optional\n />\n </div>\n )}\n\n <div\n key={`postal_code-${format.country ?? ''}`}\n className=\"ec-address-form__cell\"\n data-span=\"quarter\"\n data-field={id('postal_code')}\n >\n <Field\n {...fieldProps('postal_code')}\n label={format.postcodeLabel}\n hint={format.postcodeHint}\n autoComplete={autocomplete('postal-code')}\n required={format.postcodeRequired}\n optional={!format.postcodeRequired}\n />\n </div>\n\n {null !== phone ? (\n <div className=\"ec-address-form__cell\" data-span=\"full\" data-field={id('phone')}>\n <Field\n {...fieldProps('phone')}\n type=\"tel\"\n label={phone.label}\n hint={__('Only used if the carrier needs to reach you.')}\n autoComplete={autocomplete(phone.autocomplete)}\n required={phone.required}\n optional={!phone.required}\n />\n </div>\n ) : null}\n </div>\n </Fieldset>\n );\n}\n"],"mappings":";;;;;;;;AAaA;AAAA,EACE;AAAA,OAKK;AACP,SAAS,gBAAgB;AACzB,SAAS,WAAW,gBAAmC;AA+HjD,SAEI,KAFJ;AAxFN,eAAe,YAAY,KAAa,SAA0D;AAChG,MAAI;AACF,UAAM,SAAS,IAAI,IAAI,KAAK,OAAO,SAAS,IAAI;AAEhD,WAAO,aAAa,IAAI,WAAW,OAAO;AAE1C,UAAM,WAAW,MAAM,MAAM,OAAO,SAAS,GAAG;AAAA,MAC9C,SAAS,EAAE,QAAQ,oBAAoB,oBAAoB,iBAAiB;AAAA,MAC5E,aAAa;AAAA,IACf,CAAC;AAED,WAAO,SAAS,KAAO,MAAM,SAAS,KAAK,IAAiC;AAAA,EAC9E,QAAQ;AACN,WAAO;AAAA,EACT;AACF;AAUO,SAAS,YAAY;AAAA,EAC1B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,SAAS,CAAC;AAAA,EACV,SAAS;AAAA,EACT,UAAU;AAAA,EACV,YAAY;AAAA,EACZ;AACF,GAAmC;AACjC,QAAM,CAAC,QAAQ,SAAS,IAAI,SAAkC,KAAK,MAAM;AACzE,QAAM,CAAC,aAAa,cAAc,IAAI,SAAS,KAAK,MAAM;AAC1D,QAAM,WAAW,OAAO,gBAAgB,IAAI,YAAY,KAAK;AAG7D,MAAI,gBAAgB,KAAK,QAAQ;AAC/B,mBAAe,KAAK,MAAM;AAC1B,cAAU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