@duffel/components 3.5.0--canary-4 → 3.5.0--canary-5

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.
@@ -0,0 +1,2 @@
1
+ import { DuffelCardFormAction } from "./types";
2
+ export declare function getNewActionsStack(previousActions: DuffelCardFormAction[], newActions: DuffelCardFormAction[]): DuffelCardFormAction[];
@@ -1,28 +1,23 @@
1
- export interface CreateCardForTemporaryUseData {
1
+ interface CommonCardData {
2
2
  id: string;
3
+ last_4_digits: string;
3
4
  live_mode: false;
4
5
  }
5
- export type CreateCardForTemporaryUseError = {
6
- status: number;
7
- message: string;
8
- };
9
- export type SaveCardError = {
6
+ interface CardActionError {
10
7
  status: number;
11
8
  message: string;
12
- };
13
- export interface SaveCardData {
14
- id: string;
15
- live_mode: boolean;
16
- last_4_digits: string;
17
- expiry_month: number;
18
- expiry_year: number;
19
- brand: string;
20
- cardholder_name: string;
21
- /**
22
- * The card will no longer be available for use after this time.
23
- */
9
+ }
10
+ export interface CreateCardForTemporaryUseData extends CommonCardData {
11
+ saved: false;
12
+ /** The card will no longer be available for use after this time. */
24
13
  unavailable_at: string;
25
14
  }
15
+ export interface SaveCardData extends CommonCardData {
16
+ saved: true;
17
+ unavailable_at: null;
18
+ }
19
+ export type SaveCardError = CardActionError;
20
+ export type CreateCardForTemporaryUseError = CardActionError;
26
21
  /**
27
22
  * An object where each key value pair is a style to be applied.
28
23
  * e.g. { 'background-image': 'red', 'color': '#000', 'margin-inline': '8px' }
@@ -45,7 +40,7 @@ export interface DuffelCardFormStyles {
45
40
  sectionTitle?: StylesMap;
46
41
  layoutGrid?: StylesMap;
47
42
  }
48
- export type DuffelCardFormActions = "validate" | "save-card" | "create-card-for-temporary-use";
43
+ export type DuffelCardFormAction = "validate" | "save-card" | "create-card-for-temporary-use";
49
44
  export type DuffelCardFormIntent = "to-create-card-for-temporary-use" | "to-use-saved-card" | "to-save-card";
50
45
  export interface DuffelCardFormProps {
51
46
  /**
@@ -83,7 +78,7 @@ export interface DuffelCardFormProps {
83
78
  * We recommend using the `useDuffelCardFormActions` hook for a simpler, more readable interface to manage the actions array.
84
79
  *
85
80
  */
86
- actions: DuffelCardFormActions[];
81
+ actions: DuffelCardFormAction[];
87
82
  /**
88
83
  * Once a card is saved, in order to use it, travellers need to enter its cvv.
89
84
  * When using the `use-saved-card` intent, you must provide the card ID.