@evervault/js 2.0.2 → 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 +42 -156
  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;
@@ -108,95 +49,20 @@ declare type ApplePayButtonOptions = {
108
49
 
109
50
  declare type ApplePayButtonStyle = "black" | "white" | "white-outline";
110
51
 
111
- declare type ApplePayButtonStyle_2 = "black" | "white" | "white-outline";
112
-
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";
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";
155
53
 
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";
54
+ declare type ApplePayCardNetwork = "amex" | "bancomat" | "bancontact" | "cartesBancaires" | "chinaUnionPay" | "dankort" | "discover" | "eftpos" | "electron" | "elo" | "girocard" | "interac" | "jcb" | "mada" | "maestro" | "masterCard" | "mir" | "privateLabel" | "visa" | "vPay";
157
55
 
158
56
  declare interface ApplePayErrorMessage {
159
57
  message: string;
160
58
  }
161
59
 
162
60
  declare interface ApplePayEvents {
163
- ready: () => void;
164
- success: () => void;
165
- error: (error: string) => void;
166
- cancel: () => void;
167
- }
168
-
169
- declare interface ApplePayEvents_2 {
170
61
  success: () => void;
171
62
  error: (message?: string) => void;
172
63
  cancel: () => void;
173
64
  }
174
65
 
175
- declare interface ApplePayOptions {
176
- process: (
177
- data: EncryptedApplePayData,
178
- helpers: {
179
- fail: (error: ApplePayErrorMessage) => void;
180
- }
181
- ) => Promise<void>;
182
- type?: ApplePayButtonType;
183
- style?: ApplePayButtonStyle;
184
- locale?: ApplePayButtonLocale;
185
- padding?: string;
186
- borderRadius?: number;
187
- size?: { width: WalletDimension; height: WalletDimension };
188
- allowedCardNetworks?: ApplePayCardNetwork[];
189
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
190
- paymentOverrides?: {
191
- paymentMethodData?: PaymentMethodData[];
192
- paymentDetails?: PaymentDetailsInit;
193
- };
194
- disbursementOverrides?: {
195
- disbursementDetails?: PaymentDetailsInit;
196
- };
197
- requestPayerDetails?: ("name" | "email" | "phone")[];
198
- }
199
-
200
66
  declare interface BaseTransactionDetails {
201
67
  amount: number;
202
68
  currency: string;
@@ -239,6 +105,7 @@ declare class Card {
239
105
  } | undefined;
240
106
  autoProgress: boolean | undefined;
241
107
  redactCVC: boolean | undefined;
108
+ allow3DigitAmexCVC: boolean | undefined;
242
109
  };
243
110
  };
244
111
  mount(selector: SelectorType): this;
@@ -262,7 +129,8 @@ declare type CardBrandName =
262
129
  | "hipercard"
263
130
  | "hiper"
264
131
  | "szep"
265
- | "uatp";
132
+ | "uatp"
133
+ | "rupay";
266
134
 
267
135
  declare interface CardEvents {
268
136
  ready: () => void;
@@ -303,6 +171,7 @@ declare interface CardOptions {
303
171
  translations?: Partial<CardTranslations>;
304
172
  autoProgress?: boolean;
305
173
  redactCVC?: boolean;
174
+ allow3DigitAmexCVC?: boolean;
306
175
  defaultValues?: {
307
176
  name?: string;
308
177
  };
@@ -942,7 +811,12 @@ declare interface EncryptedFPAN {
942
811
  };
943
812
  }
944
813
 
945
- declare type EncryptedGooglePayData = EncryptedDPAN<"google"> | EncryptedFPAN;
814
+ declare type EncryptedGooglePayData = (
815
+ | EncryptedDPAN<"google">
816
+ | EncryptedFPAN
817
+ ) & {
818
+ billingAddress: google.payments.api.Address | null;
819
+ };
946
820
 
947
821
  declare const encryptionConstants: {
948
822
  cipherAlgorithm: "aes-256-gcm";
@@ -1115,6 +989,7 @@ declare class GooglePay {
1115
989
  borderRadius: number | undefined;
1116
990
  allowedAuthMethods: google.payments.api.CardAuthMethod[] | undefined;
1117
991
  allowedCardNetworks: google.payments.api.CardNetwork[] | undefined;
992
+ billingAddress: GooglePayBillingAddressConfig | undefined;
1118
993
  };
1119
994
  };
1120
995
  mount(selector: SelectorType): this;
@@ -1122,6 +997,13 @@ declare class GooglePay {
1122
997
  on<T extends keyof GooglePayEvents>(event: T, callback: GooglePayEvents[T]): () => void;
1123
998
  }
1124
999
 
1000
+ declare type GooglePayBillingAddressConfig =
1001
+ | boolean
1002
+ | {
1003
+ format?: google.payments.api.BillingAddressFormat;
1004
+ phoneNumber?: boolean;
1005
+ };
1006
+
1125
1007
  declare type GooglePayButtonColor = "black" | "white";
1126
1008
 
1127
1009
  declare type GooglePayButtonLocale =
@@ -1194,6 +1076,7 @@ declare interface GooglePayOptions {
1194
1076
  size?: { width: WalletDimension; height: WalletDimension };
1195
1077
  allowedAuthMethods?: google.payments.api.CardAuthMethod[];
1196
1078
  allowedCardNetworks?: google.payments.api.CardNetwork[];
1079
+ billingAddress?: GooglePayBillingAddressConfig;
1197
1080
  }
1198
1081
 
1199
1082
  declare interface HttpConfig {
@@ -10458,7 +10341,10 @@ declare class UIComponents {
10458
10341
  form(opts?: FormOptions): Form;
10459
10342
  threeDSecure(session: string, opts?: ThreeDSecureOptions): ThreeDSecure;
10460
10343
  googlePay(tx: Transaction, opts: GooglePayOptions): GooglePay;
10461
- applePay(tx: Transaction, opts: ApplePayOptions): ApplePay;
10344
+ applePay(tx: Transaction, opts: ApplePayButtonOptions): ApplePayButton;
10345
+ /**
10346
+ * @deprecated Use `applePay` instead.
10347
+ */
10462
10348
  applePayButton(tx: Transaction, opts: ApplePayButtonOptions): ApplePayButton;
10463
10349
  }
10464
10350
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "private": false,
3
3
  "name": "@evervault/js",
4
- "version": "2.0.2",
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.3",
23
+ "@evervault/browser": "2.45.0",
24
+ "themes": "0.1.15",
24
25
  "tsconfig": "0.1.0",
25
- "types": "0.13.0",
26
- "themes": "0.1.13"
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
  }