@movmo_app/payments 0.2.0 → 0.2.1
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/dist/index.cjs.js +10 -10
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +67 -6
- package/dist/index.es.js +1169 -866
- package/dist/index.es.js.map +1 -1
- package/dist/style.css +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -7,6 +7,16 @@ export declare interface CardFieldError {
|
|
|
7
7
|
message: string;
|
|
8
8
|
}
|
|
9
9
|
|
|
10
|
+
/**
|
|
11
|
+
* Focus state of each Spreedly-hosted iframe. The browser's `focus-within`
|
|
12
|
+
* CSS pseudo-class can't see across iframe boundaries, so the consumer needs
|
|
13
|
+
* an explicit signal to render the "active border" on the iframe shell.
|
|
14
|
+
*/
|
|
15
|
+
declare interface CardFieldFocus {
|
|
16
|
+
number: boolean;
|
|
17
|
+
cvv: boolean;
|
|
18
|
+
}
|
|
19
|
+
|
|
10
20
|
declare interface CardFieldValidity {
|
|
11
21
|
/** True only when the card-number field has a complete, length-valid value. */
|
|
12
22
|
number: boolean;
|
|
@@ -32,7 +42,7 @@ export declare const getPaymentsConfig: () => InternalPaymentsConfig;
|
|
|
32
42
|
/* Excluded from this release type: InternalPaymentsConfig */
|
|
33
43
|
|
|
34
44
|
export declare const MovmoCardForm: {
|
|
35
|
-
({ userId, onSuccess, onError, isDefault, className, defaultCardholderName, defaultCardholderFirstName, defaultCardholderLastName, autoSave, formId, hideInternalSaveButton, onCanSubmitChange, }: MovmoCardFormProps): JSX_2.Element;
|
|
45
|
+
({ userId, onSuccess, onError, isDefault, className, defaultCardholderName, defaultCardholderFirstName, defaultCardholderLastName, autoSave, formId, hideInternalSaveButton, onCanSubmitChange, onSavingChange, autoFocus, }: MovmoCardFormProps): JSX_2.Element;
|
|
36
46
|
displayName: string;
|
|
37
47
|
};
|
|
38
48
|
|
|
@@ -77,15 +87,32 @@ export declare interface MovmoCardFormProps {
|
|
|
77
87
|
* not in flight). Use to enable / disable an external Save button.
|
|
78
88
|
*/
|
|
79
89
|
onCanSubmitChange?: (canSubmit: boolean) => void;
|
|
90
|
+
/**
|
|
91
|
+
* Fires whenever the form transitions in / out of the "saving" state
|
|
92
|
+
* (tokenize call or save POST in flight). A parent rendering its own
|
|
93
|
+
* Save button (e.g. a modal footer) uses this to swap the button label
|
|
94
|
+
* for a spinner. The hook's loading state is internal and not surfaced
|
|
95
|
+
* directly — this callback is the single source of truth.
|
|
96
|
+
*/
|
|
97
|
+
onSavingChange?: (isSaving: boolean) => void;
|
|
98
|
+
/**
|
|
99
|
+
* When set, the named Spreedly hosted-fields iframe receives keyboard
|
|
100
|
+
* focus the moment the field becomes ready. Use `"number"` for the
|
|
101
|
+
* accounts-ui add-card modal so the user can start typing immediately.
|
|
102
|
+
*/
|
|
103
|
+
autoFocus?: 'number' | 'cvv';
|
|
80
104
|
}
|
|
81
105
|
|
|
82
106
|
/**
|
|
83
|
-
* Compact preview of a single saved card: brand icon +
|
|
84
|
-
*
|
|
85
|
-
*
|
|
107
|
+
* Compact preview of a single saved card: brand icon + label. Used by
|
|
108
|
+
* consumers (e.g. flights-ui's collapsed checkout drawer) to show the
|
|
109
|
+
* currently-selected card outside the full `<PaymentMethodsManager />`
|
|
86
110
|
* list view. Keeps the brand-icon styling consistent with the expanded list.
|
|
111
|
+
*
|
|
112
|
+
* Brand icon is sized to match flights-ui main's `w-[34px]` collapsed view.
|
|
113
|
+
* No vertical padding — the parent controls spacing.
|
|
87
114
|
*/
|
|
88
|
-
export declare const PaymentMethodPreview: ({ method, trailing, onClick, className, }: PaymentMethodPreviewProps) => JSX_2.Element;
|
|
115
|
+
export declare const PaymentMethodPreview: ({ method, trailing, onClick, cardLabelFormat, className, }: PaymentMethodPreviewProps) => JSX_2.Element;
|
|
89
116
|
|
|
90
117
|
export declare interface PaymentMethodPreviewProps {
|
|
91
118
|
/**
|
|
@@ -98,11 +125,17 @@ export declare interface PaymentMethodPreviewProps {
|
|
|
98
125
|
trailing?: React.ReactNode;
|
|
99
126
|
/** Whole-row click handler — typically toggles the drawer open. */
|
|
100
127
|
onClick?: () => void;
|
|
128
|
+
/**
|
|
129
|
+
* Controls how the card label is rendered.
|
|
130
|
+
* - `'branded'` (default): "Visa 4242" — brand name + last4
|
|
131
|
+
* - `'masked'`: "•••• 4242" — masked bullets + last4 (flights-ui collapsed-drawer style)
|
|
132
|
+
*/
|
|
133
|
+
cardLabelFormat?: 'masked' | 'branded';
|
|
101
134
|
className?: string;
|
|
102
135
|
}
|
|
103
136
|
|
|
104
137
|
export declare const PaymentMethodsManager: {
|
|
105
|
-
({ userId, defaultCardholderName, defaultCardholderFirstName, defaultCardholderLastName, selectedId, onSelect, onChange, paymentTypeSelector, autoSaveFirstCard, selectionSetsDefault, showDefaultBadge, className, }: PaymentMethodsManagerProps): JSX_2.Element;
|
|
138
|
+
({ userId, defaultCardholderName, defaultCardholderFirstName, defaultCardholderLastName, selectedId, onSelect, onChange, paymentTypeSelector, autoSaveFirstCard, selectionSetsDefault, showDefaultBadge, collapsible, cardLabelFormat, className, }: PaymentMethodsManagerProps): JSX_2.Element;
|
|
106
139
|
displayName: string;
|
|
107
140
|
};
|
|
108
141
|
|
|
@@ -151,6 +184,19 @@ export declare interface PaymentMethodsManagerProps {
|
|
|
151
184
|
* Defaults to `true`.
|
|
152
185
|
*/
|
|
153
186
|
showDefaultBadge?: boolean;
|
|
187
|
+
/**
|
|
188
|
+
* When `true` AND the user has at least one saved card, the list collapses
|
|
189
|
+
* into a compact preview row with a chevron-down toggle. Expanding shows the
|
|
190
|
+
* full list + Add button. Defaults to `false` (accounts-ui behaviour).
|
|
191
|
+
* flights-ui passes `true`.
|
|
192
|
+
*/
|
|
193
|
+
collapsible?: boolean;
|
|
194
|
+
/**
|
|
195
|
+
* Controls the card label format inside rows.
|
|
196
|
+
* - `'branded'` (default): "Visa 4242" — brand name + last4
|
|
197
|
+
* - `'masked'`: "•••• 4242" — masked bullets + last4 (flights-ui style)
|
|
198
|
+
*/
|
|
199
|
+
cardLabelFormat?: 'masked' | 'branded';
|
|
154
200
|
className?: string;
|
|
155
201
|
}
|
|
156
202
|
|
|
@@ -171,6 +217,15 @@ export declare interface PaymentsConfig {
|
|
|
171
217
|
* consumers should override at boot once a prod CDN is set up.
|
|
172
218
|
*/
|
|
173
219
|
iconCdnBaseUrl?: string;
|
|
220
|
+
/**
|
|
221
|
+
* Custom `fetch` impl used by every API call in this package. Defaults to
|
|
222
|
+
* `globalThis.fetch`. Consumers that need auth-token refresh, CSRF-token
|
|
223
|
+
* injection, or any other request-shaping logic should provide their own
|
|
224
|
+
* wrapper here (e.g. one that retries on 401/403 after refreshing the
|
|
225
|
+
* session cookie). The package never adds business headers — that's the
|
|
226
|
+
* consumer's responsibility.
|
|
227
|
+
*/
|
|
228
|
+
fetch?: typeof fetch;
|
|
174
229
|
}
|
|
175
230
|
|
|
176
231
|
export declare const setPaymentsConfig: (config: Partial<PaymentsConfig>) => void;
|
|
@@ -231,6 +286,12 @@ export declare interface UseMovmoCardFieldsResult {
|
|
|
231
286
|
validity: CardFieldValidity;
|
|
232
287
|
/** Latest detected brand (or null if unknown). */
|
|
233
288
|
brand: string | null;
|
|
289
|
+
/**
|
|
290
|
+
* Live focus state for each iframe. True while the user is editing that
|
|
291
|
+
* field. Consumers use this to apply an "active" border on the iframe shell
|
|
292
|
+
* (the browser's `:focus-within` CSS doesn't propagate across iframes).
|
|
293
|
+
*/
|
|
294
|
+
focused: CardFieldFocus;
|
|
234
295
|
/**
|
|
235
296
|
* Programmatically move keyboard focus into one of the Spreedly iframes.
|
|
236
297
|
* No-op when the hook is not in the `'ready'` state. Used to auto-advance
|