@movmo_app/payments 0.6.0 → 0.7.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.
package/dist/index.d.ts CHANGED
@@ -39,6 +39,8 @@ declare interface CardFieldValidity {
39
39
  cvv: boolean;
40
40
  }
41
41
 
42
+ export declare type CardFormField = 'number' | 'expiry' | 'cvv' | 'zip' | 'name';
43
+
42
44
  export declare type CardFormStatus = 'idle' | 'loading' | 'ready' | 'tokenizing' | 'saving' | 'error';
43
45
 
44
46
  export declare interface CardholderTokenizeData {
@@ -52,6 +54,18 @@ export declare interface CardholderTokenizeData {
52
54
  zip?: string;
53
55
  }
54
56
 
57
+ /**
58
+ * PII-free validation snapshot: field KEYS only, never values. Lets a parent
59
+ * (e.g. `PaymentMethodsManager`) turn touched-invalid streaks into a
60
+ * consumer-side friction signal without the SDK importing an analytics
61
+ * library or leaking anything the traveler typed.
62
+ */
63
+ export declare interface CardValidationState {
64
+ valid: boolean;
65
+ missing: CardFormField[];
66
+ touchedInvalid: CardFormField[];
67
+ }
68
+
55
69
  /**
56
70
  * Builds an auth-aware `fetch` that the payments package (or any other
57
71
  * consumer that registers it via `setPaymentsConfig({ fetch })`) can call.
@@ -154,7 +168,7 @@ export declare const getPaymentsConfig: () => InternalPaymentsConfig;
154
168
  /* Excluded from this release type: InternalPaymentsConfig */
155
169
 
156
170
  export declare const MovmoCardForm: {
157
- ({ userId, onSuccess, onError, onErrorDetail, isDefault, className, defaultCardholderName, defaultCardholderFirstName, defaultCardholderLastName, autoSave, formId, hideInternalSaveButton, onCanSubmitChange, onSavingChange, autoFocus, }: MovmoCardFormProps): JSX_2.Element;
171
+ ({ userId, onSuccess, onError, onErrorDetail, isDefault, className, defaultCardholderName, defaultCardholderFirstName, defaultCardholderLastName, autoSave, formId, hideInternalSaveButton, onCanSubmitChange, onSavingChange, autoFocus, onValidationChange, }: MovmoCardFormProps): JSX_2.Element;
158
172
  displayName: string;
159
173
  };
160
174
 
@@ -221,6 +235,14 @@ export declare interface MovmoCardFormProps {
221
235
  * accounts-ui add-card modal so the user can start typing immediately.
222
236
  */
223
237
  autoFocus?: 'number' | 'cvv';
238
+ /**
239
+ * Fires whenever the validation snapshot changes (missing fields or
240
+ * touched-invalid fields). PII-free by design — carries field KEYS only,
241
+ * never values — so a parent can turn a touched-invalid streak into an
242
+ * analytics-neutral friction event without the SDK importing an analytics
243
+ * library.
244
+ */
245
+ onValidationChange?: (state: CardValidationState) => void;
224
246
  }
225
247
 
226
248
  /**
@@ -270,8 +292,15 @@ export declare interface PaymentManagerError {
270
292
  * - `edited` — the cardholder/zip PUT succeeded.
271
293
  * - `deleted` — the delete request succeeded.
272
294
  * - `set_default` — the set-default PUT succeeded.
295
+ * - `validation_error` — a touched card-form field is invalid (fires once per
296
+ * invalid streak, not per keystroke). This is a friction
297
+ * signal, not a failure — it's the analytics-neutral
298
+ * counterpart to `onError`'s `card-tokenize` source, meant
299
+ * to surface which fields trip people up. Props are
300
+ * `field_count` and `fields` (touched-invalid field KEYS
301
+ * only, e.g. `'zip'` — never card values).
273
302
  */
274
- export declare type PaymentMethodEvent = 'autoselected' | 'selected' | 'added' | 'edited' | 'deleted' | 'set_default';
303
+ export declare type PaymentMethodEvent = 'autoselected' | 'selected' | 'added' | 'edited' | 'deleted' | 'set_default' | 'validation_error';
275
304
 
276
305
  /**
277
306
  * Compact preview of a single saved card: brand icon + label. Used by
@@ -415,7 +444,7 @@ export declare interface PaymentMethodSummary {
415
444
  vault?: 'stripe' | 'spreedly';
416
445
  /** Current cardholder name (MOVMO-381). Empty/absent for legacy rows. */
417
446
  cardholderName?: string;
418
- /** Current billing ZIP (MOVMO-381). Empty/absent for legacy rows. */
447
+ /** Current billing postal code (MOVMO-381). Empty/absent for legacy rows. */
419
448
  zip?: string;
420
449
  }
421
450