@vtex/faststore 0.0.5 → 0.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +45 -0
- package/dist/actions.json +181 -0
- package/dist/catalog.json +1543 -495
- package/dist/client.d.ts +2 -1
- package/dist/client.js +2 -1
- package/dist/components.d.ts +28 -7
- package/dist/components.js +31 -12
- package/dist/docs/access-code-sign-in.md +1 -1
- package/dist/docs/address-summary.md +24 -3
- package/dist/docs/alert-dialog.md +204 -0
- package/dist/docs/billing-address.md +284 -0
- package/dist/docs/card-entry.md +250 -0
- package/dist/docs/cardholder-document.md +142 -0
- package/dist/docs/client-preferences-fieldset.md +148 -0
- package/dist/docs/client-preferences.md +2 -1
- package/dist/docs/client-profile-fieldset.md +184 -0
- package/dist/docs/client-profile.md +1 -1
- package/dist/docs/document-field.md +58 -4
- package/dist/docs/field.md +317 -0
- package/dist/docs/form.md +307 -0
- package/dist/docs/identity-edit.md +6 -6
- package/dist/docs/identity-summary.md +5 -5
- package/dist/docs/installments.md +248 -0
- package/dist/docs/my-account-profile.md +1 -0
- package/dist/docs/order-placed-payment-summary.md +138 -0
- package/dist/docs/payment-method-badges.md +232 -0
- package/dist/docs/payment-methods.md +1 -0
- package/dist/docs/payment.md +218 -0
- package/dist/docs/phone-field.md +58 -4
- package/dist/docs/place-order.md +157 -0
- package/dist/docs/save-card.md +186 -0
- package/dist/docs/saved-cards.md +218 -0
- package/dist/docs/select.md +465 -0
- package/dist/docs/shipping-address.md +110 -258
- package/dist/index.d.ts +4 -1
- package/dist/internal/client.d.ts +3 -1
- package/dist/internal/client.js +3 -1
- package/dist/matter/access-code-sign-in/access-code-sign-in.js +9 -8
- package/dist/matter/access-code-sign-in/access-code-sign-in.js.map +1 -1
- package/dist/matter/billing-address/billing-address.d.ts +165 -0
- package/dist/matter/billing-address/billing-address.js +408 -0
- package/dist/matter/billing-address/billing-address.js.map +1 -0
- package/dist/matter/card-entry/card-capture.d.ts +25 -0
- package/dist/matter/card-entry/card-capture.js +25 -0
- package/dist/matter/card-entry/card-capture.js.map +1 -0
- package/dist/matter/card-entry/card-entry.d.ts +120 -0
- package/dist/matter/card-entry/card-entry.js +832 -0
- package/dist/matter/card-entry/card-entry.js.map +1 -0
- package/dist/matter/cardholder-document/cardholder-document.d.ts +45 -0
- package/dist/matter/cardholder-document/cardholder-document.js +70 -0
- package/dist/matter/cardholder-document/cardholder-document.js.map +1 -0
- package/dist/matter/client-preferences/client-preferences-fieldset.d.ts +77 -0
- package/dist/matter/client-preferences/client-preferences-fieldset.js +299 -0
- package/dist/matter/client-preferences/client-preferences-fieldset.js.map +1 -0
- package/dist/matter/client-preferences/client-preferences.d.ts +3 -5
- package/dist/matter/client-preferences/client-preferences.js +6 -6
- package/dist/matter/client-preferences/client-preferences.js.map +1 -1
- package/dist/matter/client-profile/client-profile.d.ts +4 -6
- package/dist/matter/client-profile/client-profile.js +9 -6
- package/dist/matter/client-profile/client-profile.js.map +1 -1
- package/dist/matter/client-profile-form/client-profile-fieldset.d.ts +119 -0
- package/dist/matter/client-profile-form/client-profile-fieldset.js +488 -0
- package/dist/matter/client-profile-form/client-profile-fieldset.js.map +1 -0
- package/dist/matter/identity-edit/identity-edit.js +2 -2
- package/dist/matter/identity-edit/identity-edit.js.map +1 -1
- package/dist/matter/identity-summary/identity-summary.js +2 -2
- package/dist/matter/identity-summary/identity-summary.js.map +1 -1
- package/dist/matter/installments/installments-select.d.ts +42 -0
- package/dist/matter/installments/installments-select.js +167 -0
- package/dist/matter/installments/installments-select.js.map +1 -0
- package/dist/matter/installments/installments.d.ts +58 -0
- package/dist/matter/installments/installments.js +176 -0
- package/dist/matter/installments/installments.js.map +1 -0
- package/dist/matter/installments/use-installments-selection.d.ts +29 -0
- package/dist/matter/installments/use-installments-selection.js +95 -0
- package/dist/matter/installments/use-installments-selection.js.map +1 -0
- package/dist/matter/my-account-profile/my-account-profile.js +4 -4
- package/dist/matter/my-account-profile/my-account-profile.js.map +1 -1
- package/dist/matter/order-placed-payment-summary/order-placed-payment-summary.d.ts +63 -0
- package/dist/matter/order-placed-payment-summary/order-placed-payment-summary.js +305 -0
- package/dist/matter/order-placed-payment-summary/order-placed-payment-summary.js.map +1 -0
- package/dist/matter/payment/payment-card-capture.d.ts +19 -0
- package/dist/matter/payment/payment-card-capture.js +129 -0
- package/dist/matter/payment/payment-card-capture.js.map +1 -0
- package/dist/matter/payment/payment-controller.d.ts +24 -0
- package/dist/matter/payment/payment-controller.js +107 -0
- package/dist/matter/payment/payment-controller.js.map +1 -0
- package/dist/matter/payment/payment-method-badges.d.ts +57 -0
- package/dist/matter/payment/payment-method-badges.js +192 -0
- package/dist/matter/payment/payment-method-badges.js.map +1 -0
- package/dist/matter/payment/payment.d.ts +89 -0
- package/dist/matter/payment/payment.js +263 -0
- package/dist/matter/payment/payment.js.map +1 -0
- package/dist/matter/payment/use-payment-method-selection.d.ts +302 -0
- package/dist/matter/payment/use-payment-method-selection.js +458 -0
- package/dist/matter/payment/use-payment-method-selection.js.map +1 -0
- package/dist/matter/payment/use-payment-submit-gate.d.ts +111 -0
- package/dist/matter/payment/use-payment-submit-gate.js +144 -0
- package/dist/matter/payment/use-payment-submit-gate.js.map +1 -0
- package/dist/matter/place-order/place-order.d.ts +74 -0
- package/dist/matter/place-order/place-order.js +379 -0
- package/dist/matter/place-order/place-order.js.map +1 -0
- package/dist/matter/product-list/product-list.d.ts +1 -0
- package/dist/matter/product-list/product-list.js.map +1 -1
- package/dist/matter/product-shelf/product-shelf.d.ts +1 -0
- package/dist/matter/product-shelf/product-shelf.js +2 -0
- package/dist/matter/product-shelf/product-shelf.js.map +1 -1
- package/dist/matter/region/region.js +1 -1
- package/dist/matter/region/region.js.map +1 -1
- package/dist/matter/save-card/save-card.d.ts +49 -0
- package/dist/matter/save-card/save-card.js +188 -0
- package/dist/matter/save-card/save-card.js.map +1 -0
- package/dist/matter/saved-cards/saved-cards.d.ts +79 -0
- package/dist/matter/saved-cards/saved-cards.js +387 -0
- package/dist/matter/saved-cards/saved-cards.js.map +1 -0
- package/dist/matter/shipping-address/country-descriptors.js +20 -10
- package/dist/matter/shipping-address/country-descriptors.js.map +1 -1
- package/dist/matter/shipping-address/shipping-address.d.ts +113 -174
- package/dist/matter/shipping-address/shipping-address.js +480 -791
- package/dist/matter/shipping-address/shipping-address.js.map +1 -1
- package/dist/matter/variant-selector/variant-selector.js +1 -1
- package/dist/particles/address-summary/address-summary.d.ts +24 -0
- package/dist/particles/address-summary/address-summary.js +83 -2
- package/dist/particles/address-summary/address-summary.js.map +1 -1
- package/dist/particles/alert-dialog/alert-dialog.d.ts +68 -0
- package/dist/particles/alert-dialog/alert-dialog.js +187 -0
- package/dist/particles/alert-dialog/alert-dialog.js.map +1 -0
- package/dist/particles/checkbox/checkbox.d.ts +7 -3
- package/dist/particles/checkbox/checkbox.js +4 -1
- package/dist/particles/checkbox/checkbox.js.map +1 -1
- package/dist/particles/document-field/document-field.d.ts +48 -5
- package/dist/particles/document-field/document-field.js +189 -32
- package/dist/particles/document-field/document-field.js.map +1 -1
- package/dist/particles/field/bound-field-registry.js +52 -0
- package/dist/particles/field/bound-field-registry.js.map +1 -0
- package/dist/particles/field/field.d.ts +116 -0
- package/dist/particles/field/field.js +497 -6
- package/dist/particles/field/field.js.map +1 -1
- package/dist/particles/fieldset/fieldset.js +2 -2
- package/dist/particles/fieldset/fieldset.js.map +1 -1
- package/dist/particles/form/form.d.ts +104 -0
- package/dist/particles/form/form.js +485 -0
- package/dist/particles/form/form.js.map +1 -0
- package/dist/particles/phone-field/phone-field.d.ts +38 -10
- package/dist/particles/phone-field/phone-field.js +183 -39
- package/dist/particles/phone-field/phone-field.js.map +1 -1
- package/dist/particles/postal-code-field/postal-code-field.js +2 -2
- package/dist/particles/postal-code-field/postal-code-field.js.map +1 -1
- package/dist/particles/select/field-select.d.ts +43 -0
- package/dist/particles/select/field-select.js +150 -0
- package/dist/particles/select/field-select.js.map +1 -0
- package/dist/particles/select/select.d.ts +2 -0
- package/dist/particles/select/select.js.map +1 -1
- package/dist/particles/shared/compose-refs.js +21 -0
- package/dist/particles/shared/compose-refs.js.map +1 -0
- package/dist/schema.graphql +701 -2
- package/dist/sdk/actions/analytics-action-provider.d.ts +15 -0
- package/dist/sdk/actions/analytics-action-provider.js +19 -0
- package/dist/sdk/actions/analytics-action-provider.js.map +1 -0
- package/dist/sdk/actions/index.d.ts +3 -1
- package/dist/sdk/actions/index.js +3 -1
- package/dist/sdk/actions/payment-action-provider.d.ts +22 -0
- package/dist/sdk/actions/payment-action-provider.js +26 -0
- package/dist/sdk/actions/payment-action-provider.js.map +1 -0
- package/dist/sdk/actions/types.d.ts +6 -2
- package/dist/sdk/analytics/analytics-destination.d.ts +43 -0
- package/dist/sdk/analytics/analytics-destination.js +90 -0
- package/dist/sdk/analytics/analytics-destination.js.map +1 -0
- package/dist/sdk/analytics/use-analytics-actions.d.ts +57 -0
- package/dist/sdk/analytics/use-analytics-actions.js +108 -0
- package/dist/sdk/analytics/use-analytics-actions.js.map +1 -0
- package/dist/sdk/cart/use-cart-actions.js +1 -1
- package/dist/sdk/data/entity-resolution-context.js +31 -0
- package/dist/sdk/data/entity-resolution-context.js.map +1 -0
- package/dist/sdk/data/entity-subscriber.js +18 -8
- package/dist/sdk/data/entity-subscriber.js.map +1 -1
- package/dist/sdk/data/index.js +1 -0
- package/dist/sdk/data/page-reactive-data-root.d.ts +36 -0
- package/dist/sdk/data/page-reactive-data-root.js +4 -2
- package/dist/sdk/data/page-reactive-data-root.js.map +1 -1
- package/dist/sdk/data/reactive-data-provider.js +7 -3
- package/dist/sdk/data/reactive-data-provider.js.map +1 -1
- package/dist/sdk/data/reactive-list-item-data-provider.js +12 -4
- package/dist/sdk/data/reactive-list-item-data-provider.js.map +1 -1
- package/dist/sdk/data/use-reactive-data-settled.js +39 -0
- package/dist/sdk/data/use-reactive-data-settled.js.map +1 -0
- package/dist/sdk/data/use-reactive-entity.js +5 -1
- package/dist/sdk/data/use-reactive-entity.js.map +1 -1
- package/dist/sdk/generated/fragment-types.js +2 -0
- package/dist/sdk/generated/fragment-types.js.map +1 -1
- package/dist/sdk/generated/graphql.js.map +1 -1
- package/dist/sdk/i18n/messages/en-US.js +3 -0
- package/dist/sdk/i18n/messages/en-US.json +3 -0
- package/dist/sdk/i18n/messages/en-US.json.d.ts +3 -0
- package/dist/sdk/i18n/messages/es-ES.js +3 -0
- package/dist/sdk/i18n/messages/es-ES.json +3 -0
- package/dist/sdk/i18n/messages/pt-BR.js +3 -0
- package/dist/sdk/i18n/messages/pt-BR.json +3 -0
- package/dist/sdk/identity/use-identity-actions.js +3 -2
- package/dist/sdk/identity/use-identity-actions.js.map +1 -1
- package/dist/sdk/payment/gateway-origin.js +35 -0
- package/dist/sdk/payment/gateway-origin.js.map +1 -0
- package/dist/sdk/payment/gateway.d.ts +85 -0
- package/dist/sdk/payment/gateway.js +183 -0
- package/dist/sdk/payment/gateway.js.map +1 -0
- package/dist/sdk/payment/operations.d.ts +52 -0
- package/dist/sdk/payment/operations.js +223 -0
- package/dist/sdk/payment/operations.js.map +1 -0
- package/dist/sdk/payment/security-code-mask.js +71 -0
- package/dist/sdk/payment/security-code-mask.js.map +1 -0
- package/dist/sdk/payment/submission-registry.d.ts +33 -0
- package/dist/sdk/payment/submission-registry.js +58 -0
- package/dist/sdk/payment/submission-registry.js.map +1 -0
- package/dist/sdk/payment/use-payment-actions.d.ts +78 -0
- package/dist/sdk/payment/use-payment-actions.js +276 -0
- package/dist/sdk/payment/use-payment-actions.js.map +1 -0
- package/dist/sdk/payment/use-place-order.d.ts +65 -0
- package/dist/sdk/payment/use-place-order.js +640 -0
- package/dist/sdk/payment/use-place-order.js.map +1 -0
- package/dist/sdk/shipping/use-shipping-actions.js +1 -1
- package/dist/utils/loggable-error-name.js +49 -0
- package/dist/utils/loggable-error-name.js.map +1 -0
- package/dist/utils/resolve-authored-copy.js +18 -0
- package/dist/utils/resolve-authored-copy.js.map +1 -0
- package/dist/utils/substitute-template.js +33 -0
- package/dist/utils/substitute-template.js.map +1 -0
- package/package.json +2 -1
- package/src/styles/tailwind.css +34 -0
- package/dist/docs/client-profile-form.md +0 -192
- package/dist/matter/client-profile-form/client-profile-form.d.ts +0 -126
- package/dist/matter/client-profile-form/client-profile-form.js +0 -662
- package/dist/matter/client-profile-form/client-profile-form.js.map +0 -1
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { defineComponent } from "../../core/dist/define-component.js";
|
|
3
|
+
import "../../core/dist/index.js";
|
|
4
|
+
import { useActionsOverride } from "../../sdk/actions/actions-override-context.js";
|
|
5
|
+
import { useDataOverride } from "../../sdk/data/data-override-context.js";
|
|
6
|
+
import { PaymentSubmissionProvider } from "../../sdk/payment/submission-registry.js";
|
|
7
|
+
import { usePaymentMethodSelection } from "./use-payment-method-selection.js";
|
|
8
|
+
import { PaymentCardCaptureProvider } from "./payment-card-capture.js";
|
|
9
|
+
import { DEFAULT_METHOD_GROUP, PaymentContext } from "./payment.js";
|
|
10
|
+
import { cloneElement, isValidElement, useMemo, useState } from "react";
|
|
11
|
+
import { jsx } from "react/jsx-runtime";
|
|
12
|
+
const PaymentSectionControllerDefinition = defineComponent({
|
|
13
|
+
name: "PaymentSectionController",
|
|
14
|
+
importPath: "@vtex/faststore/components",
|
|
15
|
+
component: PaymentSectionController,
|
|
16
|
+
fragment: `
|
|
17
|
+
fragment PaymentSectionControllerData on Query {
|
|
18
|
+
payment {
|
|
19
|
+
__typename
|
|
20
|
+
id
|
|
21
|
+
methods {
|
|
22
|
+
__typename
|
|
23
|
+
id
|
|
24
|
+
name
|
|
25
|
+
groupName
|
|
26
|
+
validator {
|
|
27
|
+
__typename
|
|
28
|
+
numberMask
|
|
29
|
+
numberRegex
|
|
30
|
+
cvvMask
|
|
31
|
+
cvvRegex
|
|
32
|
+
cvvRequired
|
|
33
|
+
expirationRequired
|
|
34
|
+
holderNameRequired
|
|
35
|
+
billingAddressRequired
|
|
36
|
+
documentDisplayable
|
|
37
|
+
documentRequired
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
selectedMethodId
|
|
41
|
+
selectedAccountId
|
|
42
|
+
selectedBin
|
|
43
|
+
}
|
|
44
|
+
cart {
|
|
45
|
+
__typename
|
|
46
|
+
id
|
|
47
|
+
total {
|
|
48
|
+
__typename
|
|
49
|
+
amount
|
|
50
|
+
currencyCode
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
`,
|
|
55
|
+
fetchStrategy: "reactive",
|
|
56
|
+
actions: {
|
|
57
|
+
payment: ["setMethod", "sendPayments"],
|
|
58
|
+
analytics: ["track"]
|
|
59
|
+
},
|
|
60
|
+
providesContext: ["payment", "card-capture"],
|
|
61
|
+
editor: {
|
|
62
|
+
label: "Payment Section Controller",
|
|
63
|
+
category: "commerce"
|
|
64
|
+
},
|
|
65
|
+
schema: { group: {
|
|
66
|
+
type: "array",
|
|
67
|
+
default: ["creditCardPaymentGroup", "debitCardPaymentGroup"],
|
|
68
|
+
label: "Payment method group"
|
|
69
|
+
} },
|
|
70
|
+
guideline: "State-only controller for a collapsed payment section: wrap a single DialogRoot (centered modal) or DrawerRoot (slide-in) child and it becomes controlled. Renders no markup and bakes no styling — compose the overlay particles (DialogTrigger/DialogPortal/DialogBackdrop/DialogPopup or the Drawer equivalents) directly as page nodes, put a static label (Text) inside the trigger — no component echoes the current choice there, and put PaymentMethodList plus the payment leaves (CardEntry, Installments, SavedCards, PlaceOrder, …) inside the popup. Provides the same 'payment' and 'card-capture' contexts as PaymentSectionRoot, so every leaf composes under either with no change. Unlike the delivery-options controller it does NOT close on a successful selection — picking a method is mid-flow — so close it from a DrawerClose/DialogClose particle or from the leaf that finishes the flow. See payment.md.",
|
|
71
|
+
docPath: "./payment.md"
|
|
72
|
+
});
|
|
73
|
+
function PaymentSectionController({ group = DEFAULT_METHOD_GROUP, $data: $dataProp, $actions: $actionsProp, children }) {
|
|
74
|
+
const $data = useDataOverride($dataProp);
|
|
75
|
+
const $actions = useActionsOverride($actionsProp);
|
|
76
|
+
const selection = usePaymentMethodSelection({
|
|
77
|
+
group,
|
|
78
|
+
$data: $data?.payment ?? null,
|
|
79
|
+
$actions
|
|
80
|
+
});
|
|
81
|
+
const [open, setOpen] = useState(false);
|
|
82
|
+
const payment = useMemo(() => ({
|
|
83
|
+
...selection,
|
|
84
|
+
open,
|
|
85
|
+
setOpen
|
|
86
|
+
}), [selection, open]);
|
|
87
|
+
if (!isValidElement(children)) return children;
|
|
88
|
+
return /* @__PURE__ */ jsx(PaymentContext, {
|
|
89
|
+
value: payment,
|
|
90
|
+
children: /* @__PURE__ */ jsx(PaymentSubmissionProvider, {
|
|
91
|
+
path: selection.draft.path,
|
|
92
|
+
children: /* @__PURE__ */ jsx(PaymentCardCaptureProvider, {
|
|
93
|
+
selection,
|
|
94
|
+
cart: $data?.cart,
|
|
95
|
+
$actions,
|
|
96
|
+
children: cloneElement(children, {
|
|
97
|
+
open,
|
|
98
|
+
onOpenChange: setOpen
|
|
99
|
+
})
|
|
100
|
+
})
|
|
101
|
+
})
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
//#endregion
|
|
105
|
+
export { PaymentSectionController, PaymentSectionControllerDefinition };
|
|
106
|
+
|
|
107
|
+
//# sourceMappingURL=payment-controller.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"payment-controller.js","names":[],"sources":["../../../src/matter/payment/payment-controller.tsx"],"sourcesContent":["'use client';\n\nimport { defineComponent } from '@vtex/fs-core';\nimport { cloneElement, isValidElement, type ReactNode, useMemo, useState } from 'react';\nimport { useActionsOverride } from '../../sdk/actions/actions-override-context.js';\nimport type { ComponentActions } from '../../sdk/actions/types.js';\nimport { useDataOverride } from '../../sdk/data/data-override-context.js';\nimport { PaymentSubmissionProvider } from '../../sdk/payment/submission-registry.js';\nimport {\n DEFAULT_METHOD_GROUP,\n PaymentContext,\n type PaymentContextValue,\n type PaymentSectionRootData,\n} from './payment.js';\nimport { PaymentCardCaptureProvider } from './payment-card-capture.js';\nimport { usePaymentMethodSelection } from './use-payment-method-selection.js';\n\n/**\n * The collapsed payment section (centered modal / slide-in panel) as a state-only controller\n * (specs/payment-section-root.md, T5; docs/features/credit-card/rfc.md § D1). The page composes a raw\n * `DialogRoot` or `DrawerRoot` and each of its particles (`DialogTrigger` / `DialogBackdrop` /\n * `DialogPopup` …) directly as `page.json` nodes, so every part — including the portaled backdrop and\n * popup a descendant selector could not reach — is a swatch-addressable node with zero Tailwind baked\n * into the package, exactly as `DeliveryOptionsController` established.\n *\n * `PaymentSectionController` renders no markup: it runs the shared `usePaymentMethodSelection` engine,\n * holds the open state, provides the same `payment` context `PaymentSectionRoot` does (ADR-0009 matches\n * by contract identifier, so every leaf composes under either with no edit), then injects\n * `open` / `onOpenChange` into its single overlay-`Root` child via `cloneElement` — the same mechanism\n * as `CartOpenOnAdd` and `ShippingAddressSavedAddressDrawerController`.\n *\n * It diverges from `DeliveryOptionsController` in one deliberate way: a successful method selection\n * does **not** close the surface. Picking a delivery option completes that interaction; picking a\n * payment method is the first step of several — the shopper still types a card, picks an installment,\n * and places the order. Closing is therefore the composition's call, through the context's `setOpen`\n * (T14 on a placed order) or a `DrawerClose` / `DialogClose` particle.\n *\n * The trigger holds a static label (`Text`): no component echoes the current choice there, and none is\n * shipped here — `payment.md` documents the same composition.\n */\n\n// Repeats `PaymentSectionData`'s selection set verbatim under its own name. Two definitions cannot\n// share one fragment name in a page query, and the native catalog builder resolves\n// `defineComponent({ fragment })` statically — a value imported from another module is silently\n// dropped from the built catalog. `delivery-options` duplicates for the same reason;\n// `payment.test.tsx` asserts the two sets stay field-for-field identical.\nconst fragment = /* GraphQL */ `\n fragment PaymentSectionControllerData on Query {\n payment {\n __typename\n id\n methods {\n __typename\n id\n name\n groupName\n validator {\n __typename\n numberMask\n numberRegex\n cvvMask\n cvvRegex\n cvvRequired\n expirationRequired\n holderNameRequired\n billingAddressRequired\n documentDisplayable\n documentRequired\n }\n }\n selectedMethodId\n selectedAccountId\n selectedBin\n }\n cart {\n __typename\n id\n total {\n __typename\n amount\n currencyCode\n }\n }\n }\n`;\n\n// The minimal open-state shape the controller injects into its overlay-Root child; both `DialogRoot`\n// and `DrawerRoot` accept it.\ntype OverlayOpenProps = {\n open?: boolean;\n onOpenChange?: (open: boolean) => void;\n};\n\n// ---------------------------------------------------------------------------\n// Props\n// ---------------------------------------------------------------------------\n\nexport type PaymentSectionControllerProps = {\n /**\n * Scopes the method list to a **set** of `PaymentMethod.groupName` values — a method is in scope\n * when its `groupName` is a member (T140, FR-1, Decision 1). A single string is still accepted and\n * scopes to exactly that one group. An empty string scopes nothing.\n */\n group?: string | readonly string[];\n /** Keyed `{ payment, cart }` forwarded by the reactive runtime (arity-2 fragment, ADR-0015). */\n $data?: PaymentSectionRootData;\n /** Compiler-injected action surface; carries `payment.setMethod`, `payment.sendPayments`, and `analytics.track`. */\n $actions?: ComponentActions;\n /** The single overlay `Root` to control — a `DialogRoot` (modal) or `DrawerRoot` (slide-in). */\n children?: ReactNode;\n};\n\n// ---------------------------------------------------------------------------\n// Definition\n// ---------------------------------------------------------------------------\n\nexport const PaymentSectionControllerDefinition = defineComponent<PaymentSectionControllerProps>({\n name: 'PaymentSectionController',\n importPath: '@vtex/faststore/components',\n component: PaymentSectionController,\n fragment,\n fetchStrategy: 'reactive',\n actions: { payment: ['setMethod', 'sendPayments'], analytics: ['track'] },\n providesContext: ['payment', 'card-capture'],\n editor: { label: 'Payment Section Controller', category: 'commerce' },\n schema: {\n // Literal, not `DEFAULT_METHOD_GROUP` — see the same note on `PaymentSectionRootDefinition`.\n // T140, Decision 2/OQ-6: same widened shape as `PaymentSectionRootDefinition` — see its own note.\n group: {\n type: 'array',\n default: ['creditCardPaymentGroup', 'debitCardPaymentGroup'],\n label: 'Payment method group',\n },\n },\n guideline:\n \"State-only controller for a collapsed payment section: wrap a single DialogRoot (centered modal) or DrawerRoot (slide-in) child and it becomes controlled. Renders no markup and bakes no styling — compose the overlay particles (DialogTrigger/DialogPortal/DialogBackdrop/DialogPopup or the Drawer equivalents) directly as page nodes, put a static label (Text) inside the trigger — no component echoes the current choice there, and put PaymentMethodList plus the payment leaves (CardEntry, Installments, SavedCards, PlaceOrder, …) inside the popup. Provides the same 'payment' and 'card-capture' contexts as PaymentSectionRoot, so every leaf composes under either with no change. Unlike the delivery-options controller it does NOT close on a successful selection — picking a method is mid-flow — so close it from a DrawerClose/DialogClose particle or from the leaf that finishes the flow. See payment.md.\",\n // The convention-based `<file-stem>.md` (`payment-controller.md`) does not exist — this component's\n // doc is `payment.md`, shared with PaymentSectionRoot/PaymentMethodList (T25/FR-8).\n docPath: './payment.md',\n});\n\n// ---------------------------------------------------------------------------\n// Implementation\n// ---------------------------------------------------------------------------\n\nexport function PaymentSectionController({\n group = DEFAULT_METHOD_GROUP,\n $data: $dataProp,\n $actions: $actionsProp,\n children,\n}: Readonly<PaymentSectionControllerProps>) {\n const $data = useDataOverride($dataProp);\n const $actions = useActionsOverride($actionsProp);\n const selection = usePaymentMethodSelection({ group, $data: $data?.payment ?? null, $actions });\n const [open, setOpen] = useState(false);\n const payment = useMemo<PaymentContextValue>(() => ({ ...selection, open, setOpen }), [selection, open]);\n\n if (!isValidElement<OverlayOpenProps>(children)) {\n return children;\n }\n\n return (\n <PaymentContext value={payment}>\n <PaymentSubmissionProvider path={selection.draft.path}>\n <PaymentCardCaptureProvider selection={selection} cart={$data?.cart} $actions={$actions}>\n {cloneElement(children, { open, onOpenChange: setOpen })}\n </PaymentCardCaptureProvider>\n </PaymentSubmissionProvider>\n </PaymentContext>\n );\n}\n"],"mappings":";;;;;;;;;;;AAoHA,MAAa,qCAAqC,gBAA+C;CAC/F,MAAM;CACN,YAAY;CACZ,WAAW;CACX;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACA,eAAe;CACf,SAAS;EAAE,SAAS,CAAC,aAAa,cAAc;EAAG,WAAW,CAAC,OAAO;CAAE;CACxE,iBAAiB,CAAC,WAAW,cAAc;CAC3C,QAAQ;EAAE,OAAO;EAA8B,UAAU;CAAW;CACpE,QAAQ,EAGN,OAAO;EACL,MAAM;EACN,SAAS,CAAC,0BAA0B,uBAAuB;EAC3D,OAAO;CACT,EACF;CACA,WACE;CAGF,SAAS;AACX,CAAC;AAMD,SAAgB,yBAAyB,EACvC,QAAQ,sBACR,OAAO,WACP,UAAU,cACV,YAC0C;CAC1C,MAAM,QAAQ,gBAAgB,SAAS;CACvC,MAAM,WAAW,mBAAmB,YAAY;CAChD,MAAM,YAAY,0BAA0B;EAAE;EAAO,OAAO,OAAO,WAAW;EAAM;CAAS,CAAC;CAC9F,MAAM,CAAC,MAAM,WAAW,SAAS,KAAK;CACtC,MAAM,UAAU,eAAoC;EAAE,GAAG;EAAW;EAAM;CAAQ,IAAI,CAAC,WAAW,IAAI,CAAC;CAEvG,IAAI,CAAC,eAAiC,QAAQ,GAC5C,OAAO;CAGT,OACE,oBAAC,gBAAD;EAAgB,OAAO;EACrB,UAAA,oBAAC,2BAAD;GAA2B,MAAM,UAAU,MAAM;GAC/C,UAAA,oBAAC,4BAAD;IAAuC;IAAW,MAAM,OAAO;IAAgB;IAC5E,UAAA,aAAa,UAAU;KAAE;KAAM,cAAc;IAAQ,CAAC;GAC7B,CAAA;EACH,CAAA;CACb,CAAA;AAEpB"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { ComponentDefinition } from "../../core/dist/define-component.js";
|
|
2
|
+
import "../../core/dist/index.js";
|
|
3
|
+
import { ComponentPropsWithRef } from "react";
|
|
4
|
+
//#region src/matter/payment/payment-method-badges.d.ts
|
|
5
|
+
/**
|
|
6
|
+
* `PaymentMethodBadges` (specs/render-the-accepted-payment-method-badges.md, T75 of the Credit Card
|
|
7
|
+
* epic). Requirement 12.19's payment-step half: a section-level, data-driven, non-interactive strip —
|
|
8
|
+
* one badge per payment method the store currently accepts, read off `usePayment()` on every render.
|
|
9
|
+
* Never a prop, never local state, never CMS content.
|
|
10
|
+
*
|
|
11
|
+
* Three components render something visually similar and are not this (Decision 1):
|
|
12
|
+
* - `CardEntry`'s own detected-network mark (T71/T172) — a single mark (0 or 1), shown only once a
|
|
13
|
+
* network is recognized from typed digits — lives inside the card-number field's own box, scoped
|
|
14
|
+
* to the card group. It cannot be placed independently and cannot carry a wallet method.
|
|
15
|
+
* - The `PaymentMethods` particle (`particles/payment-methods/`) renders the same look from CMS
|
|
16
|
+
* content. It serves store footers and does not react to a method being enabled or disabled in the
|
|
17
|
+
* payment configuration.
|
|
18
|
+
* - `PaymentMethodList` is the selectable radio picker, not reassurance.
|
|
19
|
+
*
|
|
20
|
+
* Reads `allMethods` — the section's unfiltered list — rather than the group-scoped `methods` every
|
|
21
|
+
* picker and rendering leaf otherwise reads (Decision 3): the wallet methods this requirement names
|
|
22
|
+
* (PayPal, Google Pay) arrive under a different `groupName` and would never reach a `methods`-scoped
|
|
23
|
+
* leaf. See `allMethods`'s own doc comment in `use-payment-method-selection.ts` for the exception this
|
|
24
|
+
* strip is recorded as. Apple Pay itself carries no key in the map below: it is not a payment system in
|
|
25
|
+
* this read model at all (T133 tracks it as its own, separately blocked task).
|
|
26
|
+
*/
|
|
27
|
+
export declare const PAYMENT_METHOD_ICON_BY_KEY: Record<string, string>;
|
|
28
|
+
export type PaymentMethodBadgesProps = ComponentPropsWithRef<'div'> & {
|
|
29
|
+
/** Names the strip. Absent or blank renders no heading and leaves the list unnamed (FR-5) — no invented default. */
|
|
30
|
+
heading?: string;
|
|
31
|
+
};
|
|
32
|
+
export declare const PaymentMethodBadgesDefinition: ComponentDefinition<PaymentMethodBadgesProps>;
|
|
33
|
+
export declare function PaymentMethodBadges({ heading, className, ...props }: PaymentMethodBadgesProps): import("react/jsx-runtime").JSX.Element;
|
|
34
|
+
/**
|
|
35
|
+
* The unwrapped value of the fragment's single top-level `payment` field (arity-1, ADR-0015) — never
|
|
36
|
+
* a `{ payment: … }` wrapper. `methods` is optional: a resolved-but-partial slice is legal and
|
|
37
|
+
* collapses to the `empty` state, mirroring `usePaymentMethodSelection`'s R1 note. Nullable, matching
|
|
38
|
+
* every sibling slice type in this package (`PaymentSummaryData`, `CardEntryData`,
|
|
39
|
+
* `InstallmentsSelectData`, `PaymentSectionData`, …): `null`/absent until the entity resolves, which
|
|
40
|
+
* is exactly the `$data == null` branch below.
|
|
41
|
+
*/
|
|
42
|
+
export type AcceptedPaymentMethodBadgesData = {
|
|
43
|
+
methods?: Array<{
|
|
44
|
+
id: string;
|
|
45
|
+
name: string;
|
|
46
|
+
}>;
|
|
47
|
+
} | null;
|
|
48
|
+
export type AcceptedPaymentMethodBadgesProps = ComponentPropsWithRef<'div'> & {
|
|
49
|
+
/** Names the strip. Absent or blank renders no heading and leaves the list unnamed (FR-6) — no invented default. */
|
|
50
|
+
heading?: string;
|
|
51
|
+
/** Slice forwarded by the reactive runtime. `null`/absent until the entity resolves. */
|
|
52
|
+
$data?: AcceptedPaymentMethodBadgesData;
|
|
53
|
+
};
|
|
54
|
+
export declare const AcceptedPaymentMethodBadgesDefinition: ComponentDefinition<AcceptedPaymentMethodBadgesProps>;
|
|
55
|
+
export declare function AcceptedPaymentMethodBadges({ heading, className, $data: $dataProp, ...props }: AcceptedPaymentMethodBadgesProps): import("react/jsx-runtime").JSX.Element;
|
|
56
|
+
//#endregion
|
|
57
|
+
//# sourceMappingURL=payment-method-badges.d.ts.map
|
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { defineComponent } from "../../core/dist/define-component.js";
|
|
3
|
+
import "../../core/dist/index.js";
|
|
4
|
+
import { useDataOverride } from "../../sdk/data/data-override-context.js";
|
|
5
|
+
import { Icon } from "../../particles/icon/icon.js";
|
|
6
|
+
import { usePayment } from "./payment.js";
|
|
7
|
+
import { NETWORK_ICON_BY_KEY } from "../card-entry/card-entry.js";
|
|
8
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
9
|
+
//#region src/matter/payment/payment-method-badges.tsx
|
|
10
|
+
/**
|
|
11
|
+
* `PaymentMethodBadges` (specs/render-the-accepted-payment-method-badges.md, T75 of the Credit Card
|
|
12
|
+
* epic). Requirement 12.19's payment-step half: a section-level, data-driven, non-interactive strip —
|
|
13
|
+
* one badge per payment method the store currently accepts, read off `usePayment()` on every render.
|
|
14
|
+
* Never a prop, never local state, never CMS content.
|
|
15
|
+
*
|
|
16
|
+
* Three components render something visually similar and are not this (Decision 1):
|
|
17
|
+
* - `CardEntry`'s own detected-network mark (T71/T172) — a single mark (0 or 1), shown only once a
|
|
18
|
+
* network is recognized from typed digits — lives inside the card-number field's own box, scoped
|
|
19
|
+
* to the card group. It cannot be placed independently and cannot carry a wallet method.
|
|
20
|
+
* - The `PaymentMethods` particle (`particles/payment-methods/`) renders the same look from CMS
|
|
21
|
+
* content. It serves store footers and does not react to a method being enabled or disabled in the
|
|
22
|
+
* payment configuration.
|
|
23
|
+
* - `PaymentMethodList` is the selectable radio picker, not reassurance.
|
|
24
|
+
*
|
|
25
|
+
* Reads `allMethods` — the section's unfiltered list — rather than the group-scoped `methods` every
|
|
26
|
+
* picker and rendering leaf otherwise reads (Decision 3): the wallet methods this requirement names
|
|
27
|
+
* (PayPal, Google Pay) arrive under a different `groupName` and would never reach a `methods`-scoped
|
|
28
|
+
* leaf. See `allMethods`'s own doc comment in `use-payment-method-selection.ts` for the exception this
|
|
29
|
+
* strip is recorded as. Apple Pay itself carries no key in the map below: it is not a payment system in
|
|
30
|
+
* this read model at all (T133 tracks it as its own, separately blocked task).
|
|
31
|
+
*/
|
|
32
|
+
const PAYMENT_METHOD_ICON_BY_KEY = Object.freeze({
|
|
33
|
+
...NETWORK_ICON_BY_KEY,
|
|
34
|
+
paypal: "paypal",
|
|
35
|
+
googlepay: "google-pay",
|
|
36
|
+
pix: "pix",
|
|
37
|
+
stripe: "stripe"
|
|
38
|
+
});
|
|
39
|
+
/**
|
|
40
|
+
* Splits a store-configured name into lowercase a-z-only words. Every run of characters outside
|
|
41
|
+
* a-z — spaces, punctuation, digits, accents — is a word *boundary*, never a character silently
|
|
42
|
+
* stripped in place: `"WH Google Pay"` → `["wh", "google", "pay"]`; `"Boleto Bancário"` →
|
|
43
|
+
* `["boleto", "banc", "rio"]` (the "á" splits the word instead of vanishing from inside it).
|
|
44
|
+
*/
|
|
45
|
+
function paymentMethodNameTokens(name) {
|
|
46
|
+
return name.toLowerCase().split(/[^a-z]+/).filter(Boolean);
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Resolves a store-configured method name to a base-dialect icon name by matching a key against one
|
|
50
|
+
* token, or a run of adjacent tokens joined back together — never a raw substring of the whole name
|
|
51
|
+
* (review fix, 2026-08-26). The previous implementation normalised the whole name to one string and
|
|
52
|
+
* checked `String.includes`, which matched `elo` inside real, unrelated Brazilian payment-system and
|
|
53
|
+
* acquirer names — "Cielo" and "Visanet" resolved to a network they are not, "Pague pelo Pix" and
|
|
54
|
+
* "Nubank pelo Pix" resolved to Elo instead of Pix, and "Alelo Refeição" (a real meal-voucher brand)
|
|
55
|
+
* resolved to Elo too — because the key's letters simply occur in that order somewhere in the name.
|
|
56
|
+
* Token equality cannot do that: `"cielo"` is one token, and it is never *equal* to `"elo"`, only
|
|
57
|
+
* spelled with it in the middle.
|
|
58
|
+
*
|
|
59
|
+
* This still resolves `"WH Google Pay"` → `googlepay`, the false negative containment was introduced
|
|
60
|
+
* to fix: joining tokens 1 and 2 (`google` + `pay`) produces a string equal to that key, even though
|
|
61
|
+
* neither token alone is. For each start position the longest run of adjacent tokens is tried first,
|
|
62
|
+
* falling back to shorter ones only when the longer run matches no key — "Mastercard Debit" needs
|
|
63
|
+
* exactly that fallback (`mastercarddebit` is not a key; `mastercard` alone is) — which is also what
|
|
64
|
+
* disambiguates a shorter key from a longer one built out of the same tokens (`diners` vs
|
|
65
|
+
* `dinersclub`) without a separate sort step whose removal a test cannot observe.
|
|
66
|
+
*/
|
|
67
|
+
function paymentMethodIconName(name) {
|
|
68
|
+
const tokens = paymentMethodNameTokens(name);
|
|
69
|
+
for (let start = 0; start < tokens.length; start += 1) for (let end = tokens.length; end > start; end -= 1) {
|
|
70
|
+
const icon = PAYMENT_METHOD_ICON_BY_KEY[tokens.slice(start, end).join("")];
|
|
71
|
+
if (icon) return icon;
|
|
72
|
+
}
|
|
73
|
+
return null;
|
|
74
|
+
}
|
|
75
|
+
function badgesState({ loading, count }) {
|
|
76
|
+
if (loading) return "loading";
|
|
77
|
+
if (count === 0) return "empty";
|
|
78
|
+
return "ready";
|
|
79
|
+
}
|
|
80
|
+
const PaymentMethodBadgesDefinition = defineComponent({
|
|
81
|
+
name: "PaymentMethodBadges",
|
|
82
|
+
importPath: "@vtex/faststore/components",
|
|
83
|
+
component: PaymentMethodBadges,
|
|
84
|
+
requiresContext: "payment",
|
|
85
|
+
editor: {
|
|
86
|
+
label: "Payment Method Badges",
|
|
87
|
+
category: "commerce"
|
|
88
|
+
},
|
|
89
|
+
schema: { heading: {
|
|
90
|
+
type: "string",
|
|
91
|
+
label: "Heading"
|
|
92
|
+
} },
|
|
93
|
+
guideline: "A read-only strip of one badge per payment method the store currently accepts, derived from the live order form on every render — never authored, never CMS content — so it updates the moment a method is enabled or disabled in the payment configuration. Place it inside a PaymentSectionRoot or PaymentSectionController, alongside PaymentMethodList and CardEntry; it renders nothing selectable and dispatches no action. Not PaymentMethods, which is the CMS-authored footer strip that cannot reflect the store's live configuration. See payment-method-badges.md."
|
|
94
|
+
});
|
|
95
|
+
/**
|
|
96
|
+
* Shared render path (Decision 3, T121): both `PaymentMethodBadges` and `AcceptedPaymentMethodBadges`
|
|
97
|
+
* below call this one function, so the DOM contract cannot drift between the payment-step and the
|
|
98
|
+
* cart-order-summary surface (FR-9). Takes the raw method list rather than either caller's own
|
|
99
|
+
* already-resolved badge array, because icon resolution (`paymentMethodIconName`) belongs to this one
|
|
100
|
+
* path, never duplicated per caller.
|
|
101
|
+
*/
|
|
102
|
+
function renderPaymentMethodBadges({ methods, loading, heading, className, rest }) {
|
|
103
|
+
const badges = methods.map((method) => ({
|
|
104
|
+
id: method.id,
|
|
105
|
+
name: method.name,
|
|
106
|
+
icon: paymentMethodIconName(method.name)
|
|
107
|
+
}));
|
|
108
|
+
const named = Boolean(heading?.trim());
|
|
109
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
110
|
+
...rest,
|
|
111
|
+
className,
|
|
112
|
+
"data-fs-payment-method-badges": "",
|
|
113
|
+
"data-fs-payment-method-badges-state": badgesState({
|
|
114
|
+
loading,
|
|
115
|
+
count: methods.length
|
|
116
|
+
}),
|
|
117
|
+
children: [named ? /* @__PURE__ */ jsx("h3", {
|
|
118
|
+
"data-fs-text": "",
|
|
119
|
+
"data-fs-payment-method-badges-heading": "",
|
|
120
|
+
children: heading
|
|
121
|
+
}) : null, badges.length > 0 ? /* @__PURE__ */ jsx("ul", {
|
|
122
|
+
role: "list",
|
|
123
|
+
"data-fs-payment-method-badges-list": "",
|
|
124
|
+
"aria-label": named ? heading : void 0,
|
|
125
|
+
children: badges.map((badge) => /* @__PURE__ */ jsx("li", {
|
|
126
|
+
"data-fs-payment-method-badge": "",
|
|
127
|
+
"data-fs-payment-method-badge-id": badge.id,
|
|
128
|
+
"aria-hidden": badge.icon || badge.name ? void 0 : true,
|
|
129
|
+
children: badge.icon ? /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(Icon, {
|
|
130
|
+
name: badge.icon,
|
|
131
|
+
"data-fs-payment-method-badge-icon": ""
|
|
132
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
133
|
+
"data-fs-sr-only": "",
|
|
134
|
+
className: "sr-only",
|
|
135
|
+
children: badge.name
|
|
136
|
+
})] }) : badge.name
|
|
137
|
+
}, badge.id))
|
|
138
|
+
}) : null]
|
|
139
|
+
});
|
|
140
|
+
}
|
|
141
|
+
function PaymentMethodBadges({ heading, className, ...props }) {
|
|
142
|
+
const { allMethods, loading } = usePayment();
|
|
143
|
+
return renderPaymentMethodBadges({
|
|
144
|
+
methods: allMethods,
|
|
145
|
+
loading,
|
|
146
|
+
heading,
|
|
147
|
+
className,
|
|
148
|
+
rest: props
|
|
149
|
+
});
|
|
150
|
+
}
|
|
151
|
+
const AcceptedPaymentMethodBadgesDefinition = defineComponent({
|
|
152
|
+
name: "AcceptedPaymentMethodBadges",
|
|
153
|
+
importPath: "@vtex/faststore/components",
|
|
154
|
+
component: AcceptedPaymentMethodBadges,
|
|
155
|
+
fragment: `
|
|
156
|
+
fragment AcceptedPaymentMethodBadgesData on Query {
|
|
157
|
+
payment {
|
|
158
|
+
__typename
|
|
159
|
+
id
|
|
160
|
+
methods {
|
|
161
|
+
__typename
|
|
162
|
+
id
|
|
163
|
+
name
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
`,
|
|
168
|
+
fetchStrategy: "reactive",
|
|
169
|
+
editor: {
|
|
170
|
+
label: "Accepted Payment Method Badges",
|
|
171
|
+
category: "commerce"
|
|
172
|
+
},
|
|
173
|
+
schema: { heading: {
|
|
174
|
+
type: "string",
|
|
175
|
+
label: "Heading"
|
|
176
|
+
} },
|
|
177
|
+
guideline: "A read-only strip of one badge per payment method the store currently accepts, derived from the live order form on every render — never authored, never CMS content. Owns its own Query.payment fragment — no PaymentSectionRoot or PaymentSectionController ancestor required — so place it on the cart order summary or another checkout-adjacent surface that already has a live cart. Placing it on a page with no cart context (a footer, home, or PDP) still resolves Query.payment on every server render, which mints a fresh upstream order form each time — a real cost in logs and upstream state, not a correctness error. Use PaymentMethodBadges instead for the strip inside a payment section; the two share one render contract and differ only in where their data comes from. Not PaymentMethods, the CMS-authored footer strip that cannot reflect the store's live configuration; not PaymentMethodList, the selectable picker; not CardEntry's own in-field network row. See payment-method-badges.md."
|
|
178
|
+
});
|
|
179
|
+
function AcceptedPaymentMethodBadges({ heading, className, $data: $dataProp, ...props }) {
|
|
180
|
+
const $data = useDataOverride($dataProp);
|
|
181
|
+
return renderPaymentMethodBadges({
|
|
182
|
+
methods: $data?.methods ?? [],
|
|
183
|
+
loading: $data == null,
|
|
184
|
+
heading,
|
|
185
|
+
className,
|
|
186
|
+
rest: props
|
|
187
|
+
});
|
|
188
|
+
}
|
|
189
|
+
//#endregion
|
|
190
|
+
export { AcceptedPaymentMethodBadges, AcceptedPaymentMethodBadgesDefinition, PAYMENT_METHOD_ICON_BY_KEY, PaymentMethodBadges, PaymentMethodBadgesDefinition };
|
|
191
|
+
|
|
192
|
+
//# sourceMappingURL=payment-method-badges.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"payment-method-badges.js","names":[],"sources":["../../../src/matter/payment/payment-method-badges.tsx"],"sourcesContent":["'use client';\n\nimport { defineComponent } from '@vtex/fs-core';\nimport type { ComponentPropsWithRef } from 'react';\nimport { Icon } from '../../particles/icon/icon.js';\nimport { useDataOverride } from '../../sdk/data/data-override-context.js';\nimport { NETWORK_ICON_BY_KEY } from '../card-entry/card-entry.js';\nimport { usePayment } from './payment.js';\n\n/**\n * `PaymentMethodBadges` (specs/render-the-accepted-payment-method-badges.md, T75 of the Credit Card\n * epic). Requirement 12.19's payment-step half: a section-level, data-driven, non-interactive strip —\n * one badge per payment method the store currently accepts, read off `usePayment()` on every render.\n * Never a prop, never local state, never CMS content.\n *\n * Three components render something visually similar and are not this (Decision 1):\n * - `CardEntry`'s own detected-network mark (T71/T172) — a single mark (0 or 1), shown only once a\n * network is recognized from typed digits — lives inside the card-number field's own box, scoped\n * to the card group. It cannot be placed independently and cannot carry a wallet method.\n * - The `PaymentMethods` particle (`particles/payment-methods/`) renders the same look from CMS\n * content. It serves store footers and does not react to a method being enabled or disabled in the\n * payment configuration.\n * - `PaymentMethodList` is the selectable radio picker, not reassurance.\n *\n * Reads `allMethods` — the section's unfiltered list — rather than the group-scoped `methods` every\n * picker and rendering leaf otherwise reads (Decision 3): the wallet methods this requirement names\n * (PayPal, Google Pay) arrive under a different `groupName` and would never reach a `methods`-scoped\n * leaf. See `allMethods`'s own doc comment in `use-payment-method-selection.ts` for the exception this\n * strip is recorded as. Apple Pay itself carries no key in the map below: it is not a payment system in\n * this read model at all (T133 tracks it as its own, separately blocked task).\n */\n\n// ---------------------------------------------------------------------------\n// Icon resolution (Decision 4, engineer gate + spike, 2026-08-26; matching redesigned in the review\n// pass that followed, same day). `PAYMENT_METHOD_ICON_BY_KEY` supersets T71's `NETWORK_ICON_BY_KEY`\n// (imported, never duplicated or mutated — INV-4) with the wallet glyphs this strip also needs.\n// Frozen: this map renders a brand mark for whatever the store called the method, so a value\n// silently overwritten at runtime would spoof that mark for every shopper who sees the strip.\n// ---------------------------------------------------------------------------\n\nexport const PAYMENT_METHOD_ICON_BY_KEY: Record<string, string> = Object.freeze({\n ...NETWORK_ICON_BY_KEY,\n paypal: 'paypal',\n googlepay: 'google-pay',\n pix: 'pix',\n stripe: 'stripe',\n});\n\n/**\n * Splits a store-configured name into lowercase a-z-only words. Every run of characters outside\n * a-z — spaces, punctuation, digits, accents — is a word *boundary*, never a character silently\n * stripped in place: `\"WH Google Pay\"` → `[\"wh\", \"google\", \"pay\"]`; `\"Boleto Bancário\"` →\n * `[\"boleto\", \"banc\", \"rio\"]` (the \"á\" splits the word instead of vanishing from inside it).\n */\nfunction paymentMethodNameTokens(name: string): string[] {\n return name\n .toLowerCase()\n .split(/[^a-z]+/)\n .filter(Boolean);\n}\n\n/**\n * Resolves a store-configured method name to a base-dialect icon name by matching a key against one\n * token, or a run of adjacent tokens joined back together — never a raw substring of the whole name\n * (review fix, 2026-08-26). The previous implementation normalised the whole name to one string and\n * checked `String.includes`, which matched `elo` inside real, unrelated Brazilian payment-system and\n * acquirer names — \"Cielo\" and \"Visanet\" resolved to a network they are not, \"Pague pelo Pix\" and\n * \"Nubank pelo Pix\" resolved to Elo instead of Pix, and \"Alelo Refeição\" (a real meal-voucher brand)\n * resolved to Elo too — because the key's letters simply occur in that order somewhere in the name.\n * Token equality cannot do that: `\"cielo\"` is one token, and it is never *equal* to `\"elo\"`, only\n * spelled with it in the middle.\n *\n * This still resolves `\"WH Google Pay\"` → `googlepay`, the false negative containment was introduced\n * to fix: joining tokens 1 and 2 (`google` + `pay`) produces a string equal to that key, even though\n * neither token alone is. For each start position the longest run of adjacent tokens is tried first,\n * falling back to shorter ones only when the longer run matches no key — \"Mastercard Debit\" needs\n * exactly that fallback (`mastercarddebit` is not a key; `mastercard` alone is) — which is also what\n * disambiguates a shorter key from a longer one built out of the same tokens (`diners` vs\n * `dinersclub`) without a separate sort step whose removal a test cannot observe.\n */\nfunction paymentMethodIconName(name: string): string | null {\n const tokens = paymentMethodNameTokens(name);\n for (let start = 0; start < tokens.length; start += 1) {\n for (let end = tokens.length; end > start; end -= 1) {\n const icon = PAYMENT_METHOD_ICON_BY_KEY[tokens.slice(start, end).join('')];\n if (icon) return icon;\n }\n }\n return null;\n}\n\n// ---------------------------------------------------------------------------\n// The strip's own presence state (FR-4), resolved the same way `methodListState` (payment.tsx) is.\n// ---------------------------------------------------------------------------\n\nfunction badgesState({ loading, count }: { loading: boolean; count: number }): 'loading' | 'empty' | 'ready' {\n if (loading) return 'loading';\n if (count === 0) return 'empty';\n return 'ready';\n}\n\n/** One badge. Derived on every render; never stored, never a prop. */\ntype PaymentMethodBadge = {\n /** `PaymentSectionMethod.id` — the value of `data-fs-payment-method-badge-id`. */\n id: string;\n /** `PaymentSectionMethod.name`, store-configured free text. The visible text when `icon` is null. */\n name: string;\n /** A `BASE_ICON_DIALECT` name, or `null` when the name maps to none (FR-3). */\n icon: string | null;\n};\n\nexport type PaymentMethodBadgesProps = ComponentPropsWithRef<'div'> & {\n /** Names the strip. Absent or blank renders no heading and leaves the list unnamed (FR-5) — no invented default. */\n heading?: string;\n};\n\nexport const PaymentMethodBadgesDefinition = defineComponent<PaymentMethodBadgesProps>({\n name: 'PaymentMethodBadges',\n importPath: '@vtex/faststore/components',\n component: PaymentMethodBadges,\n requiresContext: 'payment',\n editor: { label: 'Payment Method Badges', category: 'commerce' },\n schema: { heading: { type: 'string', label: 'Heading' } },\n guideline:\n \"A read-only strip of one badge per payment method the store currently accepts, derived from the live order form on every render — never authored, never CMS content — so it updates the moment a method is enabled or disabled in the payment configuration. Place it inside a PaymentSectionRoot or PaymentSectionController, alongside PaymentMethodList and CardEntry; it renders nothing selectable and dispatches no action. Not PaymentMethods, which is the CMS-authored footer strip that cannot reflect the store's live configuration. See payment-method-badges.md.\",\n});\n\n/**\n * Shared render path (Decision 3, T121): both `PaymentMethodBadges` and `AcceptedPaymentMethodBadges`\n * below call this one function, so the DOM contract cannot drift between the payment-step and the\n * cart-order-summary surface (FR-9). Takes the raw method list rather than either caller's own\n * already-resolved badge array, because icon resolution (`paymentMethodIconName`) belongs to this one\n * path, never duplicated per caller.\n */\nfunction renderPaymentMethodBadges({\n methods,\n loading,\n heading,\n className,\n rest,\n}: {\n methods: ReadonlyArray<{ id: string; name: string }>;\n loading: boolean;\n heading?: string;\n className?: string;\n rest: ComponentPropsWithRef<'div'>;\n}) {\n const badges: PaymentMethodBadge[] = methods.map((method) => ({\n id: method.id,\n name: method.name,\n icon: paymentMethodIconName(method.name),\n }));\n\n const named = Boolean(heading?.trim());\n\n return (\n <div\n {...rest}\n className={className}\n data-fs-payment-method-badges=\"\"\n data-fs-payment-method-badges-state={badgesState({ loading, count: methods.length })}\n >\n {named ? (\n <h3 data-fs-text=\"\" data-fs-payment-method-badges-heading=\"\">\n {heading}\n </h3>\n ) : null}\n {badges.length > 0 ? (\n // biome-ignore lint/a11y/noRedundantRoles: WebKit drops the implicit list role from a ul whose computed `list-style` is `none` — exactly what this component's swatch sets — so the explicit role is what holds the semantics the named list was chosen for.\n <ul role=\"list\" data-fs-payment-method-badges-list=\"\" aria-label={named ? heading : undefined}>\n {badges.map((badge) => (\n <li\n key={badge.id}\n data-fs-payment-method-badge=\"\"\n data-fs-payment-method-badge-id={badge.id}\n // A method whose `name` is blank has nothing to show (no glyph, no text) — hide the\n // otherwise-empty item from assistive tech rather than exposing a nameless list entry.\n aria-hidden={badge.icon || badge.name ? undefined : true}\n >\n {badge.icon ? (\n <>\n <Icon name={badge.icon} data-fs-payment-method-badge-icon=\"\" />\n <span data-fs-sr-only=\"\" className=\"sr-only\">\n {badge.name}\n </span>\n </>\n ) : (\n badge.name\n )}\n </li>\n ))}\n </ul>\n ) : null}\n </div>\n );\n}\n\nexport function PaymentMethodBadges({ heading, className, ...props }: PaymentMethodBadgesProps) {\n const { allMethods, loading } = usePayment();\n return renderPaymentMethodBadges({ methods: allMethods, loading, heading, className, rest: props });\n}\n\n// ---------------------------------------------------------------------------\n// AcceptedPaymentMethodBadges (credit-card epic, T121 — the cart-order-summary half of requirement\n// 12.19; specs/render-the-accepted-payment-method-badges-cart-summary.md). Same render contract as\n// `PaymentMethodBadges` above — both call `renderPaymentMethodBadges` — but a different data source:\n// this component owns its own `Query.payment` fragment and declares no `requiresContext`, so it\n// composes on any surface outside a payment section, a cart order summary above all, with no\n// `PaymentSectionRoot` / `PaymentSectionController` ancestor. This is the settled ruling recorded at\n// `docs/features/credit-card/decisions.md:2575` — reuse the render contract, swap the data source —\n// mechanically expressed the way `PaymentSummary` already composes standalone off its own fragment.\n//\n// Reads `Payment.methods` unfiltered (Decision 2): the read model has one field, and `allMethods` vs\n// `methods` is a client-side `groupName` filter, not two sources — so this strip and T75's both show\n// every method the store accepts, wallets included, with no `group` prop to scope either one.\n// ---------------------------------------------------------------------------\n\nconst fragment = /* GraphQL */ `\n fragment AcceptedPaymentMethodBadgesData on Query {\n payment {\n __typename\n id\n methods {\n __typename\n id\n name\n }\n }\n }\n`;\n\n/**\n * The unwrapped value of the fragment's single top-level `payment` field (arity-1, ADR-0015) — never\n * a `{ payment: … }` wrapper. `methods` is optional: a resolved-but-partial slice is legal and\n * collapses to the `empty` state, mirroring `usePaymentMethodSelection`'s R1 note. Nullable, matching\n * every sibling slice type in this package (`PaymentSummaryData`, `CardEntryData`,\n * `InstallmentsSelectData`, `PaymentSectionData`, …): `null`/absent until the entity resolves, which\n * is exactly the `$data == null` branch below.\n */\nexport type AcceptedPaymentMethodBadgesData = {\n methods?: Array<{ id: string; name: string }>;\n} | null;\n\nexport type AcceptedPaymentMethodBadgesProps = ComponentPropsWithRef<'div'> & {\n /** Names the strip. Absent or blank renders no heading and leaves the list unnamed (FR-6) — no invented default. */\n heading?: string;\n /** Slice forwarded by the reactive runtime. `null`/absent until the entity resolves. */\n $data?: AcceptedPaymentMethodBadgesData;\n};\n\nexport const AcceptedPaymentMethodBadgesDefinition = defineComponent<AcceptedPaymentMethodBadgesProps>({\n name: 'AcceptedPaymentMethodBadges',\n importPath: '@vtex/faststore/components',\n component: AcceptedPaymentMethodBadges,\n fragment,\n fetchStrategy: 'reactive',\n editor: { label: 'Accepted Payment Method Badges', category: 'commerce' },\n schema: { heading: { type: 'string', label: 'Heading' } },\n guideline:\n \"A read-only strip of one badge per payment method the store currently accepts, derived from the live order form on every render — never authored, never CMS content. Owns its own Query.payment fragment — no PaymentSectionRoot or PaymentSectionController ancestor required — so place it on the cart order summary or another checkout-adjacent surface that already has a live cart. Placing it on a page with no cart context (a footer, home, or PDP) still resolves Query.payment on every server render, which mints a fresh upstream order form each time — a real cost in logs and upstream state, not a correctness error. Use PaymentMethodBadges instead for the strip inside a payment section; the two share one render contract and differ only in where their data comes from. Not PaymentMethods, the CMS-authored footer strip that cannot reflect the store's live configuration; not PaymentMethodList, the selectable picker; not CardEntry's own in-field network row. See payment-method-badges.md.\",\n});\n\nexport function AcceptedPaymentMethodBadges({\n heading,\n className,\n $data: $dataProp,\n ...props\n}: AcceptedPaymentMethodBadgesProps) {\n const $data = useDataOverride($dataProp);\n return renderPaymentMethodBadges({\n methods: $data?.methods ?? [],\n loading: $data == null,\n heading,\n className,\n rest: props,\n });\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAwCA,MAAa,6BAAqD,OAAO,OAAO;CAC9E,GAAG;CACH,QAAQ;CACR,WAAW;CACX,KAAK;CACL,QAAQ;AACV,CAAC;;;;;;;AAQD,SAAS,wBAAwB,MAAwB;CACvD,OAAO,KACJ,YAAY,CAAC,CACb,MAAM,SAAS,CAAC,CAChB,OAAO,OAAO;AACnB;;;;;;;;;;;;;;;;;;;;AAqBA,SAAS,sBAAsB,MAA6B;CAC1D,MAAM,SAAS,wBAAwB,IAAI;CAC3C,KAAK,IAAI,QAAQ,GAAG,QAAQ,OAAO,QAAQ,SAAS,GAClD,KAAK,IAAI,MAAM,OAAO,QAAQ,MAAM,OAAO,OAAO,GAAG;EACnD,MAAM,OAAO,2BAA2B,OAAO,MAAM,OAAO,GAAG,CAAC,CAAC,KAAK,EAAE;EACxE,IAAI,MAAM,OAAO;CACnB;CAEF,OAAO;AACT;AAMA,SAAS,YAAY,EAAE,SAAS,SAA6E;CAC3G,IAAI,SAAS,OAAO;CACpB,IAAI,UAAU,GAAG,OAAO;CACxB,OAAO;AACT;AAiBA,MAAa,gCAAgC,gBAA0C;CACrF,MAAM;CACN,YAAY;CACZ,WAAW;CACX,iBAAiB;CACjB,QAAQ;EAAE,OAAO;EAAyB,UAAU;CAAW;CAC/D,QAAQ,EAAE,SAAS;EAAE,MAAM;EAAU,OAAO;CAAU,EAAE;CACxD,WACE;AACJ,CAAC;;;;;;;;AASD,SAAS,0BAA0B,EACjC,SACA,SACA,SACA,WACA,QAOC;CACD,MAAM,SAA+B,QAAQ,KAAK,YAAY;EAC5D,IAAI,OAAO;EACX,MAAM,OAAO;EACb,MAAM,sBAAsB,OAAO,IAAI;CACzC,EAAE;CAEF,MAAM,QAAQ,QAAQ,SAAS,KAAK,CAAC;CAErC,OACE,qBAAC,OAAD;EACE,GAAI;EACO;EACX,iCAA8B;EAC9B,uCAAqC,YAAY;GAAE;GAAS,OAAO,QAAQ;EAAO,CAAC;EAJrF,UAAA,CAMG,QACC,oBAAC,MAAD;GAAI,gBAAa;GAAG,yCAAsC;GACvD,UAAA;EACC,CAAA,IACF,MACH,OAAO,SAAS,IAEf,oBAAC,MAAD;GAAI,MAAK;GAAO,sCAAmC;GAAG,cAAY,QAAQ,UAAU,KAAA;GACjF,UAAA,OAAO,KAAK,UACX,oBAAC,MAAD;IAEE,gCAA6B;IAC7B,mCAAiC,MAAM;IAGvC,eAAa,MAAM,QAAQ,MAAM,OAAO,KAAA,IAAY;IAEnD,UAAA,MAAM,OACL,qBAAA,UAAA,EAAA,UAAA,CACE,oBAAC,MAAD;KAAM,MAAM,MAAM;KAAM,qCAAkC;IAAI,CAAA,GAC9D,oBAAC,QAAD;KAAM,mBAAgB;KAAG,WAAU;KAChC,UAAA,MAAM;IACH,CAAA,CACN,EAAA,CAAA,IAEF,MAAM;GAEN,GAjBG,MAAM,EAiBT,CACL;EACC,CAAA,IACF,IACD;;AAET;AAEA,SAAgB,oBAAoB,EAAE,SAAS,WAAW,GAAG,SAAmC;CAC9F,MAAM,EAAE,YAAY,YAAY,WAAW;CAC3C,OAAO,0BAA0B;EAAE,SAAS;EAAY;EAAS;EAAS;EAAW,MAAM;CAAM,CAAC;AACpG;AAkDA,MAAa,wCAAwC,gBAAkD;CACrG,MAAM;CACN,YAAY;CACZ,WAAW;CACX;;;;;;;;;;;;;CACA,eAAe;CACf,QAAQ;EAAE,OAAO;EAAkC,UAAU;CAAW;CACxE,QAAQ,EAAE,SAAS;EAAE,MAAM;EAAU,OAAO;CAAU,EAAE;CACxD,WACE;AACJ,CAAC;AAED,SAAgB,4BAA4B,EAC1C,SACA,WACA,OAAO,WACP,GAAG,SACgC;CACnC,MAAM,QAAQ,gBAAgB,SAAS;CACvC,OAAO,0BAA0B;EAC/B,SAAS,OAAO,WAAW,CAAC;EAC5B,SAAS,SAAS;EAClB;EACA;EACA,MAAM;CACR,CAAC;AACH"}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { ComponentDefinition } from "../../core/dist/define-component.js";
|
|
2
|
+
import "../../core/dist/index.js";
|
|
3
|
+
import { ComponentActions } from "../../sdk/actions/types.js";
|
|
4
|
+
import { PaymentMethodSelection, PaymentSectionData } from "./use-payment-method-selection.js";
|
|
5
|
+
import { PaymentCartData } from "./payment-card-capture.js";
|
|
6
|
+
import { ComponentPropsWithRef } from "react";
|
|
7
|
+
//#region src/matter/payment/payment.d.ts
|
|
8
|
+
/**
|
|
9
|
+
* The default payment-group scope: credit and debit (T140, FR-2, Decision 2). Both strings are
|
|
10
|
+
* store-configured, so a store whose groups differ must set `group` explicitly; `group: ''` scopes
|
|
11
|
+
* nothing (specs/payment-section-root.md § Documentation Gaps item 1). Widened from a single string to
|
|
12
|
+
* a set (Decision 1) — a public API break for any consumer importing it directly (Interfaces).
|
|
13
|
+
*/
|
|
14
|
+
/**
|
|
15
|
+
* The roots' keyed `$data` (ADR-0015, arity 2): the `Payment` slice the selection engine reads, and the
|
|
16
|
+
* cart total `add_payment_info` needs (moved here from `CardEntry`, which reads no cart).
|
|
17
|
+
*/
|
|
18
|
+
export type PaymentSectionRootData = {
|
|
19
|
+
payment?: PaymentSectionData;
|
|
20
|
+
cart?: PaymentCartData;
|
|
21
|
+
} | null;
|
|
22
|
+
export declare const DEFAULT_METHOD_GROUP: readonly string[];
|
|
23
|
+
/**
|
|
24
|
+
* The `payment` context contract, normative for T7–T12 and T14. Everything the selection engine
|
|
25
|
+
* resolves, plus the overlay disclosure. What is deliberately absent is part of the contract too: no
|
|
26
|
+
* card number, CVV, expiration, or holder name (RFC D13 — they live only in the card entry's local
|
|
27
|
+
* state); no submission channel for the place-order sequence, which is the separate, narrow
|
|
28
|
+
* `PaymentSubmissionProvider` below (T13) precisely so no card-shaped value ever joins this contract;
|
|
29
|
+
* no `installmentOptions` / `savedCards` / `selectedInstallment` (their owners' fragments); and no
|
|
30
|
+
* optimistic mirror of the persisted selection.
|
|
31
|
+
*/
|
|
32
|
+
export type PaymentContextValue = Readonly<PaymentMethodSelection & {
|
|
33
|
+
/** The collapsed surface's disclosure state. Always `true` under `PaymentSectionRoot`. */
|
|
34
|
+
open: boolean;
|
|
35
|
+
/**
|
|
36
|
+
* Drives the collapsed surface. A no-op under `PaymentSectionRoot`, so a leaf written for the
|
|
37
|
+
* overlay composes unchanged inline. Selecting a method never closes the surface on its own — the
|
|
38
|
+
* shopper still has a card to type — so closing is the composition's call (Decision 5).
|
|
39
|
+
*/
|
|
40
|
+
setOpen: (open: boolean) => void;
|
|
41
|
+
}>;
|
|
42
|
+
/** The provider both section roots render. Exported for `PaymentSectionController`. */
|
|
43
|
+
export declare const PaymentContext: React.Context<PaymentContextValue>;
|
|
44
|
+
/**
|
|
45
|
+
* Read the payment section's selection state, draft, and overlay disclosure from the nearest
|
|
46
|
+
* `PaymentSectionRoot` or `PaymentSectionController`. Throws outside either subtree — a misplaced
|
|
47
|
+
* consumer is a composition bug the author should see immediately, not a silent degrade to an empty
|
|
48
|
+
* selection — mirroring `useSession()` / `useDeliveryOptions()`. ADR-0009's compiler check catches the
|
|
49
|
+
* same mistake before emission for schema-authored pages; this is the defense-in-depth layer for
|
|
50
|
+
* Storybook, tests, and hand-written JSX.
|
|
51
|
+
*/
|
|
52
|
+
export declare function usePayment(): PaymentContextValue;
|
|
53
|
+
export type PaymentSectionRootProps = ComponentPropsWithRef<'div'> & {
|
|
54
|
+
/**
|
|
55
|
+
* Scopes the method list to a **set** of `PaymentMethod.groupName` values — a method is in scope
|
|
56
|
+
* when its `groupName` is a member (T140, FR-1, Decision 1). A single string is still accepted and
|
|
57
|
+
* scopes to exactly that one group (FR-4, US-3). T1's read model is method-agnostic and assigns the
|
|
58
|
+
* narrowing to the consumer; this prop supplies no method, label, or ordering — the list itself is
|
|
59
|
+
* fragment data. An empty string scopes nothing.
|
|
60
|
+
*/
|
|
61
|
+
group?: string | readonly string[];
|
|
62
|
+
/** Keyed `{ payment, cart }` forwarded by the reactive runtime (arity-2 fragment, ADR-0015). */
|
|
63
|
+
$data?: PaymentSectionRootData;
|
|
64
|
+
/** Compiler-injected action surface; carries `payment.setMethod`, `payment.sendPayments`, and `analytics.track`. */
|
|
65
|
+
$actions?: ComponentActions;
|
|
66
|
+
};
|
|
67
|
+
/** Renders its own controls from the context's method list — `children` would have nothing to template. */
|
|
68
|
+
export type PaymentMethodListProps = Omit<ComponentPropsWithRef<'div'>, 'children'> & {
|
|
69
|
+
/**
|
|
70
|
+
* The radio group's accessible name, rendered as a visible `Fieldset.Legend` (T38, Decision 1).
|
|
71
|
+
* Resolved through `resolveAuthoredCopy`: an authored empty or whitespace-only string falls back to
|
|
72
|
+
* the default rather than rendering a nameless group.
|
|
73
|
+
*/
|
|
74
|
+
legend?: string;
|
|
75
|
+
/**
|
|
76
|
+
* The single card control's name (T171, Decision 8). The control stands for every in-scope
|
|
77
|
+
* credit/debit method at once, so it cannot take its name from one of their `method.name` values the
|
|
78
|
+
* way a per-network row did — it is authored copy instead, defaulting to the PRD's own string.
|
|
79
|
+
* Resolved through `resolveAuthoredCopy` exactly as `legend` is, so an authored empty or
|
|
80
|
+
* whitespace-only string falls back rather than rendering a nameless control.
|
|
81
|
+
*/
|
|
82
|
+
cardLabel?: string;
|
|
83
|
+
};
|
|
84
|
+
export declare const PaymentSectionRootDefinition: ComponentDefinition<PaymentSectionRootProps>;
|
|
85
|
+
export declare const PaymentMethodListDefinition: ComponentDefinition<PaymentMethodListProps>;
|
|
86
|
+
export declare function PaymentSectionRoot({ group, $data: $dataProp, $actions: $actionsProp, className, children, ...props }: PaymentSectionRootProps): import("react/jsx-runtime").JSX.Element;
|
|
87
|
+
export declare function PaymentMethodList({ legend, cardLabel, className, ...props }: PaymentMethodListProps): import("react/jsx-runtime").JSX.Element;
|
|
88
|
+
//#endregion
|
|
89
|
+
//# sourceMappingURL=payment.d.ts.map
|