@movmo_app/payments 0.5.0 → 0.6.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
@@ -256,6 +256,23 @@ export declare interface PaymentManagerError {
256
256
  cause?: unknown;
257
257
  }
258
258
 
259
+ /**
260
+ * Payment-domain action reported by `PaymentMethodsManager`'s `onEvent`
261
+ * callback (MOVMO-479). Success-only — failures are covered by `onError`
262
+ * above. The package is analytics-agnostic: it never imports an analytics
263
+ * SDK, it just emits these action strings (plus PII-free props) for a
264
+ * consumer to map onto its own telemetry catalog.
265
+ *
266
+ * - `autoselected` — the manager auto-selected the default card on first load.
267
+ * - `selected` — a genuine user row click (NOT the internal reselection
268
+ * fired after `added`/`deleted`).
269
+ * - `added` — a new card was saved.
270
+ * - `edited` — the cardholder/zip PUT succeeded.
271
+ * - `deleted` — the delete request succeeded.
272
+ * - `set_default` — the set-default PUT succeeded.
273
+ */
274
+ export declare type PaymentMethodEvent = 'autoselected' | 'selected' | 'added' | 'edited' | 'deleted' | 'set_default';
275
+
259
276
  /**
260
277
  * Compact preview of a single saved card: brand icon + label. Used by
261
278
  * consumers (e.g. flights-ui's collapsed checkout drawer) to show the
@@ -288,7 +305,7 @@ export declare interface PaymentMethodPreviewProps {
288
305
  }
289
306
 
290
307
  export declare const PaymentMethodsManager: {
291
- ({ userId, defaultCardholderName, defaultCardholderFirstName, defaultCardholderLastName, selectedId, onSelect, onChange, onError, paymentTypeSelector, autoSaveFirstCard, selectionSetsDefault, showDefaultBadge, collapsible, cardLabelFormat, className, }: PaymentMethodsManagerProps): JSX_2.Element;
308
+ ({ userId, defaultCardholderName, defaultCardholderFirstName, defaultCardholderLastName, selectedId, onSelect, onChange, onError, onEvent, paymentTypeSelector, autoSaveFirstCard, selectionSetsDefault, showDefaultBadge, collapsible, cardLabelFormat, className, }: PaymentMethodsManagerProps): JSX_2.Element;
292
309
  displayName: string;
293
310
  };
294
311
 
@@ -319,6 +336,20 @@ export declare interface PaymentMethodsManagerProps {
319
336
  * gates. Additive and non-intrusive — errors are still rendered in-SDK.
320
337
  */
321
338
  onError?: (error: PaymentManagerError) => void;
339
+ /**
340
+ * Analytics-agnostic observability hook (MOVMO-479). Fires for successful
341
+ * payment-domain actions only — `onError` above already covers failures.
342
+ * The package never imports an analytics SDK; it just emits a
343
+ * `PaymentMethodEvent` action string plus PII-free props, and it's up to
344
+ * the consumer to map that to whatever telemetry system it uses (e.g.
345
+ * flights-ui's `@movmo_app/analytics` catalog). Fire points: `autoselected`
346
+ * (first-load default selection), `selected` (a genuine user row click —
347
+ * NOT the internal reselection after add/delete), `added`, `edited`
348
+ * (`fields` is key names only, never card values), `deleted`, and
349
+ * `set_default`. Kept referentially stable via a ref, same discipline as
350
+ * `onError`/`reportError`.
351
+ */
352
+ onEvent?: (action: PaymentMethodEvent, props?: Record<string, unknown>) => void;
322
353
  /**
323
354
  * Show the Credit card / PayPal / GooglePay / Klarna / ACH radios above
324
355
  * the card-capture form. Only Credit card is functional today; the others