@evervault/js 2.0.1 → 2.1.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.
Files changed (2) hide show
  1. package/dist/evervault.d.ts +44 -162
  2. package/package.json +5 -5
@@ -1,96 +1,37 @@
1
1
  import { events } from 'events';
2
2
 
3
- declare class ApplePay {
4
- #private;
5
- constructor(client: EvervaultClient, transaction: Transaction, options: ApplePayOptions);
6
- get config(): {
7
- config: {
8
- type: ApplePayButtonType | undefined;
9
- style: ApplePayButtonStyle | undefined;
10
- locale: ApplePayButtonLocale | undefined;
11
- borderRadius: number | undefined;
12
- allowedCardNetworks: ApplePayCardNetwork[] | undefined;
13
- transaction: TransactionDetailsWithDomain;
14
- paymentOverrides: {
15
- paymentMethodData?: PaymentMethodData[];
16
- paymentDetails?: PaymentDetailsInit;
17
- } | undefined;
18
- disbursementOverrides: {
19
- disbursementDetails?: PaymentDetailsInit;
20
- } | undefined;
21
- requestPayerDetails: ("name" | "email" | "phone")[] | undefined;
22
- };
23
- };
24
- mount(selector: SelectorType): this;
25
- update(options?: ApplePayOptions): this;
26
- unmount(): this;
27
- on<T extends keyof ApplePayEvents>(event: T, callback: ApplePayEvents[T]): () => void;
28
- }
29
-
30
3
  declare class ApplePayButton {
31
4
  #private;
32
5
  client: EvervaultClient;
33
6
  transaction: Transaction;
34
7
  constructor(client: EvervaultClient, transaction: Transaction, options: ApplePayButtonOptions);
35
- on(event: keyof ApplePayEvents_2, callback: ApplePayEvents_2[keyof ApplePayEvents_2]): () => void;
36
- mount(selector: SelectorType): void;
8
+ on(event: keyof ApplePayEvents, callback: ApplePayEvents[keyof ApplePayEvents]): () => void;
9
+ /**
10
+ * Checks the availability of Apple Pay on the current device.
11
+ *
12
+ * @returns {Promise<"available" | "unavailable" | "unsupported">} A promise that resolves to a string indicating the availability status of Apple Pay:
13
+ * - "available": Apple Pay is available and can be used.
14
+ * - "unavailable": Apple Pay is not available due to payment credentials being unavailable.
15
+ * - "unsupported": Apple Pay is not supported on this device or browser.
16
+ */
17
+ availability(): Promise<"available" | "unavailable" | "unsupported">;
18
+ mount(selector: SelectorType): Promise<void>;
37
19
  unmount(): void;
38
20
  }
39
21
 
40
- declare type ApplePayButtonLocale =
41
- | "ar-AB"
42
- | "ca-ES"
43
- | "cs-CZ"
44
- | "da-DK"
45
- | "de-DE"
46
- | "el-GR"
47
- | "en-AU"
48
- | "en-GB"
49
- | "en-US"
50
- | "es-ES"
51
- | "es-MX"
52
- | "fi-FI"
53
- | "fr-CA"
54
- | "fr-FR"
55
- | "he-IL"
56
- | "hi-IN"
57
- | "hr-HR"
58
- | "hu-HU"
59
- | "id-ID"
60
- | "it-IT"
61
- | "ja-JP"
62
- | "ko-KR"
63
- | "ms-MY"
64
- | "nb-NO"
65
- | "nl-NL"
66
- | "pl-PL"
67
- | "pt-BR"
68
- | "pt-PT"
69
- | "ro-RO"
70
- | "ru-RU"
71
- | "sk-SK"
72
- | "sv-SE"
73
- | "th-TH"
74
- | "tr-TR"
75
- | "uk-UA"
76
- | "vi-VN"
77
- | "zh-CN"
78
- | "zh-HK"
79
- | "zh-TW";
80
-
81
- declare type ApplePayButtonLocale_2 = "ar-AB" | "ca-ES" | "cs-CZ" | "da-DK" | "de-DE" | "el-GR" | "en-AU" | "en-GB" | "en-US" | "es-ES" | "es-MX" | "fi-FI" | "fr-CA" | "fr-FR" | "he-IL" | "hi-IN" | "hr-HR" | "hu-HU" | "id-ID" | "it-IT" | "ja-JP" | "ko-KR" | "ms-MY" | "nb-NO" | "nl-NL" | "pl-PL" | "pt-BR" | "pt-PT" | "ro-RO" | "ru-RU" | "sk-SK" | "sv-SE" | "th-TH" | "tr-TR" | "uk-UA" | "vi-VN" | "zh-CN" | "zh-HK" | "zh-TW";
22
+ declare type ApplePayButtonLocale = "ar-AB" | "ca-ES" | "cs-CZ" | "da-DK" | "de-DE" | "el-GR" | "en-AU" | "en-GB" | "en-US" | "es-ES" | "es-MX" | "fi-FI" | "fr-CA" | "fr-FR" | "he-IL" | "hi-IN" | "hr-HR" | "hu-HU" | "id-ID" | "it-IT" | "ja-JP" | "ko-KR" | "ms-MY" | "nb-NO" | "nl-NL" | "pl-PL" | "pt-BR" | "pt-PT" | "ro-RO" | "ru-RU" | "sk-SK" | "sv-SE" | "th-TH" | "tr-TR" | "uk-UA" | "vi-VN" | "zh-CN" | "zh-HK" | "zh-TW";
82
23
 
83
24
  declare type ApplePayButtonOptions = {
84
- type?: ApplePayButtonType_2;
85
- style?: ApplePayButtonStyle_2;
86
- locale?: ApplePayButtonLocale_2;
25
+ type?: ApplePayButtonType;
26
+ style?: ApplePayButtonStyle;
27
+ locale?: ApplePayButtonLocale;
87
28
  padding?: string;
88
- borderRadius?: string;
29
+ borderRadius?: string | number;
89
30
  size?: {
90
31
  width: string | number;
91
32
  height: string | number;
92
33
  };
93
- allowedCardNetworks?: ApplePayCardNetwork_2[];
34
+ allowedCardNetworks?: ApplePayCardNetwork[];
94
35
  requestPayerDetails?: ("name" | "email" | "phone")[];
95
36
  requestBillingAddress?: boolean;
96
37
  requestShipping?: boolean;
@@ -101,106 +42,27 @@ declare type ApplePayButtonOptions = {
101
42
  disbursementOverrides?: {
102
43
  disbursementDetails?: PaymentDetailsInit;
103
44
  };
104
- process: (data: unknown, helpers: {
105
- fail: (error?: ApplePayError_2) => void;
45
+ process: (data: EncryptedApplePayData, helpers: {
46
+ fail: (error?: ApplePayErrorMessage) => void;
106
47
  }) => Promise<void>;
107
48
  };
108
49
 
109
50
  declare type ApplePayButtonStyle = "black" | "white" | "white-outline";
110
51
 
111
- declare type ApplePayButtonStyle_2 = "black" | "white" | "white-outline";
52
+ declare type ApplePayButtonType = "add-money" | "book" | "buy" | "check-out" | "continue" | "contribute" | "donate" | "order" | "pay" | "plain" | "reload" | "rent" | "set-up" | "subscribe" | "support" | "tip" | "top-up";
112
53
 
113
- declare type ApplePayButtonType =
114
- | "add-money"
115
- | "book"
116
- | "buy"
117
- | "check-out"
118
- | "continue"
119
- | "contribute"
120
- | "donate"
121
- | "order"
122
- | "pay"
123
- | "plain"
124
- | "reload"
125
- | "rent"
126
- | "set-up"
127
- | "subscribe"
128
- | "support"
129
- | "tip"
130
- | "top-up";
131
-
132
- declare type ApplePayButtonType_2 = "add-money" | "book" | "buy" | "check-out" | "continue" | "contribute" | "donate" | "order" | "pay" | "plain" | "reload" | "rent" | "set-up" | "subscribe" | "support" | "tip" | "top-up";
133
-
134
- declare type ApplePayCardNetwork =
135
- | "amex"
136
- | "bancomat"
137
- | "bancontact"
138
- | "cartesBancaires"
139
- | "chinaUnionPay"
140
- | "dankort"
141
- | "discover"
142
- | "eftpos"
143
- | "electron"
144
- | "elo"
145
- | "girocard"
146
- | "interac"
147
- | "jcb"
148
- | "mada"
149
- | "maestro"
150
- | "masterCard"
151
- | "mir"
152
- | "privateLabel"
153
- | "visa"
154
- | "vPay";
155
-
156
- declare type ApplePayCardNetwork_2 = "amex" | "bancomat" | "bancontact" | "cartesBancaires" | "chinaUnionPay" | "dankort" | "discover" | "eftpos" | "electron" | "elo" | "girocard" | "interac" | "jcb" | "mada" | "maestro" | "masterCard" | "mir" | "privateLabel" | "visa" | "vPay";
157
-
158
- declare interface ApplePayError_2 {
159
- message: string;
160
- }
54
+ declare type ApplePayCardNetwork = "amex" | "bancomat" | "bancontact" | "cartesBancaires" | "chinaUnionPay" | "dankort" | "discover" | "eftpos" | "electron" | "elo" | "girocard" | "interac" | "jcb" | "mada" | "maestro" | "masterCard" | "mir" | "privateLabel" | "visa" | "vPay";
161
55
 
162
56
  declare interface ApplePayErrorMessage {
163
57
  message: string;
164
58
  }
165
59
 
166
60
  declare interface ApplePayEvents {
167
- ready: () => void;
168
- success: () => void;
169
- error: (error: string) => void;
170
- cancel: () => void;
171
- }
172
-
173
- declare interface ApplePayEvents_2 {
174
61
  success: () => void;
175
62
  error: (message?: string) => void;
176
63
  cancel: () => void;
177
64
  }
178
65
 
179
- declare interface ApplePayOptions {
180
- process: (
181
- data: EncryptedApplePayData,
182
- helpers: {
183
- fail: (error: ApplePayErrorMessage) => void;
184
- }
185
- ) => Promise<void>;
186
- type?: ApplePayButtonType;
187
- style?: ApplePayButtonStyle;
188
- locale?: ApplePayButtonLocale;
189
- padding?: string;
190
- borderRadius?: number;
191
- size?: { width: WalletDimension; height: WalletDimension };
192
- allowedCardNetworks?: ApplePayCardNetwork[];
193
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
194
- paymentOverrides?: {
195
- paymentMethodData?: PaymentMethodData[];
196
- paymentDetails?: PaymentDetailsInit;
197
- };
198
- disbursementOverrides?: {
199
- disbursementDetails?: PaymentDetailsInit;
200
- };
201
- requestPayerDetails?: ("name" | "email" | "phone")[];
202
- }
203
-
204
66
  declare interface BaseTransactionDetails {
205
67
  amount: number;
206
68
  currency: string;
@@ -243,6 +105,7 @@ declare class Card {
243
105
  } | undefined;
244
106
  autoProgress: boolean | undefined;
245
107
  redactCVC: boolean | undefined;
108
+ allow3DigitAmexCVC: boolean | undefined;
246
109
  };
247
110
  };
248
111
  mount(selector: SelectorType): this;
@@ -266,7 +129,8 @@ declare type CardBrandName =
266
129
  | "hipercard"
267
130
  | "hiper"
268
131
  | "szep"
269
- | "uatp";
132
+ | "uatp"
133
+ | "rupay";
270
134
 
271
135
  declare interface CardEvents {
272
136
  ready: () => void;
@@ -307,6 +171,7 @@ declare interface CardOptions {
307
171
  translations?: Partial<CardTranslations>;
308
172
  autoProgress?: boolean;
309
173
  redactCVC?: boolean;
174
+ allow3DigitAmexCVC?: boolean;
310
175
  defaultValues?: {
311
176
  name?: string;
312
177
  };
@@ -946,7 +811,12 @@ declare interface EncryptedFPAN {
946
811
  };
947
812
  }
948
813
 
949
- declare type EncryptedGooglePayData = EncryptedDPAN<"google"> | EncryptedFPAN;
814
+ declare type EncryptedGooglePayData = (
815
+ | EncryptedDPAN<"google">
816
+ | EncryptedFPAN
817
+ ) & {
818
+ billingAddress: google.payments.api.Address | null;
819
+ };
950
820
 
951
821
  declare const encryptionConstants: {
952
822
  cipherAlgorithm: "aes-256-gcm";
@@ -1119,6 +989,7 @@ declare class GooglePay {
1119
989
  borderRadius: number | undefined;
1120
990
  allowedAuthMethods: google.payments.api.CardAuthMethod[] | undefined;
1121
991
  allowedCardNetworks: google.payments.api.CardNetwork[] | undefined;
992
+ billingAddress: GooglePayBillingAddressConfig | undefined;
1122
993
  };
1123
994
  };
1124
995
  mount(selector: SelectorType): this;
@@ -1126,6 +997,13 @@ declare class GooglePay {
1126
997
  on<T extends keyof GooglePayEvents>(event: T, callback: GooglePayEvents[T]): () => void;
1127
998
  }
1128
999
 
1000
+ declare type GooglePayBillingAddressConfig =
1001
+ | boolean
1002
+ | {
1003
+ format?: google.payments.api.BillingAddressFormat;
1004
+ phoneNumber?: boolean;
1005
+ };
1006
+
1129
1007
  declare type GooglePayButtonColor = "black" | "white";
1130
1008
 
1131
1009
  declare type GooglePayButtonLocale =
@@ -1198,6 +1076,7 @@ declare interface GooglePayOptions {
1198
1076
  size?: { width: WalletDimension; height: WalletDimension };
1199
1077
  allowedAuthMethods?: google.payments.api.CardAuthMethod[];
1200
1078
  allowedCardNetworks?: google.payments.api.CardNetwork[];
1079
+ billingAddress?: GooglePayBillingAddressConfig;
1201
1080
  }
1202
1081
 
1203
1082
  declare interface HttpConfig {
@@ -10462,7 +10341,10 @@ declare class UIComponents {
10462
10341
  form(opts?: FormOptions): Form;
10463
10342
  threeDSecure(session: string, opts?: ThreeDSecureOptions): ThreeDSecure;
10464
10343
  googlePay(tx: Transaction, opts: GooglePayOptions): GooglePay;
10465
- applePay(tx: Transaction, opts: ApplePayOptions): ApplePay;
10344
+ applePay(tx: Transaction, opts: ApplePayButtonOptions): ApplePayButton;
10345
+ /**
10346
+ * @deprecated Use `applePay` instead.
10347
+ */
10466
10348
  applePayButton(tx: Transaction, opts: ApplePayButtonOptions): ApplePayButton;
10467
10349
  }
10468
10350
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "private": false,
3
3
  "name": "@evervault/js",
4
- "version": "2.0.1",
4
+ "version": "2.1.0",
5
5
  "description": "Evervault.js loader for client-side browser applications",
6
6
  "license": "MIT",
7
7
  "type": "module",
@@ -20,10 +20,10 @@
20
20
  "typescript": "5.5.4",
21
21
  "vite": "^5.4.11",
22
22
  "vite-plugin-dts": "^4.3.0",
23
- "@evervault/browser": "2.42.2",
24
- "themes": "0.1.13",
23
+ "@evervault/browser": "2.45.0",
24
+ "themes": "0.1.15",
25
25
  "tsconfig": "0.1.0",
26
- "types": "0.13.0"
26
+ "types": "0.15.0"
27
27
  },
28
28
  "scripts": {
29
29
  "build": "vite build",
@@ -34,6 +34,6 @@
34
34
  "lint:fix": "eslint --fix .",
35
35
  "preinstall": "npx only-allow pnpm",
36
36
  "typecheck": "tsc --noEmit",
37
- "clean": "rm -rf .turbo node_modules dist"
37
+ "clean": "rm -rf node_modules dist"
38
38
  }
39
39
  }