@evervault/js 2.0.2 → 2.2.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 +83 -158
  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,6 +42,14 @@ declare type ApplePayButtonOptions = {
101
42
  disbursementOverrides?: {
102
43
  disbursementDetails?: PaymentDetailsInit;
103
44
  };
45
+ onShippingAddressChange?: (newAddress: ShippingAddress) => Promise<{
46
+ amount: number;
47
+ lineItems?: TransactionLineItem[];
48
+ }>;
49
+ prepareTransaction?: () => Promise<{
50
+ amount?: number;
51
+ lineItems?: TransactionLineItem[];
52
+ }>;
104
53
  process: (data: EncryptedApplePayData, helpers: {
105
54
  fail: (error?: ApplePayErrorMessage) => void;
106
55
  }) => Promise<void>;
@@ -108,95 +57,20 @@ declare type ApplePayButtonOptions = {
108
57
 
109
58
  declare type ApplePayButtonStyle = "black" | "white" | "white-outline";
110
59
 
111
- declare type ApplePayButtonStyle_2 = "black" | "white" | "white-outline";
60
+ 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
61
 
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";
62
+ declare type ApplePayCardNetwork = "amex" | "bancomat" | "bancontact" | "cartesBancaires" | "chinaUnionPay" | "dankort" | "discover" | "eftpos" | "electron" | "elo" | "girocard" | "interac" | "jcb" | "mada" | "maestro" | "masterCard" | "mir" | "privateLabel" | "visa" | "vPay";
157
63
 
158
64
  declare interface ApplePayErrorMessage {
159
65
  message: string;
160
66
  }
161
67
 
162
68
  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
69
  success: () => void;
171
70
  error: (message?: string) => void;
172
71
  cancel: () => void;
173
72
  }
174
73
 
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
74
  declare interface BaseTransactionDetails {
201
75
  amount: number;
202
76
  currency: string;
@@ -239,6 +113,7 @@ declare class Card {
239
113
  } | undefined;
240
114
  autoProgress: boolean | undefined;
241
115
  redactCVC: boolean | undefined;
116
+ allow3DigitAmexCVC: boolean | undefined;
242
117
  };
243
118
  };
244
119
  mount(selector: SelectorType): this;
@@ -262,7 +137,8 @@ declare type CardBrandName =
262
137
  | "hipercard"
263
138
  | "hiper"
264
139
  | "szep"
265
- | "uatp";
140
+ | "uatp"
141
+ | "rupay";
266
142
 
267
143
  declare interface CardEvents {
268
144
  ready: () => void;
@@ -303,6 +179,7 @@ declare interface CardOptions {
303
179
  translations?: Partial<CardTranslations>;
304
180
  autoProgress?: boolean;
305
181
  redactCVC?: boolean;
182
+ allow3DigitAmexCVC?: boolean;
306
183
  defaultValues?: {
307
184
  name?: string;
308
185
  };
@@ -926,6 +803,8 @@ declare interface EncryptedDPAN<P> {
926
803
  token: PaymentToken<P>;
927
804
  card: {
928
805
  brand: string;
806
+ lastFour?: string;
807
+ displayName?: string;
929
808
  };
930
809
  cryptogram: string;
931
810
  eci: string;
@@ -935,6 +814,8 @@ declare interface EncryptedFPAN {
935
814
  card: {
936
815
  brand: string;
937
816
  number: string;
817
+ lastFour?: string;
818
+ displayName?: string;
938
819
  expiry: {
939
820
  month: string;
940
821
  year: string;
@@ -942,7 +823,12 @@ declare interface EncryptedFPAN {
942
823
  };
943
824
  }
944
825
 
945
- declare type EncryptedGooglePayData = EncryptedDPAN<"google"> | EncryptedFPAN;
826
+ declare type EncryptedGooglePayData = (
827
+ | EncryptedDPAN<"google">
828
+ | EncryptedFPAN
829
+ ) & {
830
+ billingAddress?: google.payments.api.Address | null;
831
+ };
946
832
 
947
833
  declare const encryptionConstants: {
948
834
  cipherAlgorithm: "aes-256-gcm";
@@ -1044,7 +930,7 @@ declare class EvervaultClient {
1044
930
  }>;
1045
931
  isInDebugMode(): boolean;
1046
932
  get transactions(): {
1047
- create: (details: CreateTransactionDetails | DisbursementTransactionDetails) => Transaction;
933
+ create: (details: CreateTransactionDetails | RecurringTransactionDetails | DisbursementTransactionDetails) => Transaction;
1048
934
  };
1049
935
  }
1050
936
 
@@ -1115,6 +1001,7 @@ declare class GooglePay {
1115
1001
  borderRadius: number | undefined;
1116
1002
  allowedAuthMethods: google.payments.api.CardAuthMethod[] | undefined;
1117
1003
  allowedCardNetworks: google.payments.api.CardNetwork[] | undefined;
1004
+ billingAddress: GooglePayBillingAddressConfig | undefined;
1118
1005
  };
1119
1006
  };
1120
1007
  mount(selector: SelectorType): this;
@@ -1122,6 +1009,13 @@ declare class GooglePay {
1122
1009
  on<T extends keyof GooglePayEvents>(event: T, callback: GooglePayEvents[T]): () => void;
1123
1010
  }
1124
1011
 
1012
+ declare type GooglePayBillingAddressConfig =
1013
+ | boolean
1014
+ | {
1015
+ format?: google.payments.api.BillingAddressFormat;
1016
+ phoneNumber?: boolean;
1017
+ };
1018
+
1125
1019
  declare type GooglePayButtonColor = "black" | "white";
1126
1020
 
1127
1021
  declare type GooglePayButtonLocale =
@@ -1194,6 +1088,7 @@ declare interface GooglePayOptions {
1194
1088
  size?: { width: WalletDimension; height: WalletDimension };
1195
1089
  allowedAuthMethods?: google.payments.api.CardAuthMethod[];
1196
1090
  allowedCardNetworks?: google.payments.api.CardNetwork[];
1091
+ billingAddress?: GooglePayBillingAddressConfig;
1197
1092
  }
1198
1093
 
1199
1094
  declare interface HttpConfig {
@@ -4340,6 +4235,19 @@ declare namespace Property {
4340
4235
  type VectorEffect = Globals | "non-scaling-stroke" | "none";
4341
4236
  }
4342
4237
 
4238
+ declare interface RecurringTransactionDetails extends BaseTransactionDetails {
4239
+ type: "recurring";
4240
+ managementURL: string;
4241
+ billingAgreement: string;
4242
+ description: string;
4243
+ regularBilling: TransactionLineItem & {
4244
+ recurringPaymentStartDate: Date;
4245
+ };
4246
+ trialBilling?: TransactionLineItem & {
4247
+ trialPaymentStartDate: Date;
4248
+ };
4249
+ }
4250
+
4343
4251
  declare type RequiredRecipientDetail = "email" | "phone" | "name" | "address";
4344
4252
 
4345
4253
  declare class Reveal {
@@ -4422,6 +4330,19 @@ declare type SdkContext = "inputs" | "default";
4422
4330
 
4423
4331
  declare type SelectorType = string | HTMLElement;
4424
4332
 
4333
+ declare interface ShippingAddress {
4334
+ addressLine: string[];
4335
+ city: string;
4336
+ country: string;
4337
+ dependentLocality: string;
4338
+ organization: string;
4339
+ phone: string;
4340
+ postalCode: string;
4341
+ recipient: string;
4342
+ region: string;
4343
+ sortingCode: string;
4344
+ }
4345
+
4425
4346
  declare interface StandardLonghandProperties<TLength = (string & {}) | 0, TTime = string & {}> {
4426
4347
  /**
4427
4348
  * The **`accent-color`** CSS property sets the accent color for user-interface controls generated by some elements.
@@ -10428,11 +10349,12 @@ declare interface ThreeDSecureOptions {
10428
10349
 
10429
10350
  declare class Transaction {
10430
10351
  details: TransactionDetailsWithDomain;
10431
- constructor(details: CreateTransactionDetails | DisbursementTransactionDetails);
10352
+ constructor(details: CreateTransactionDetails | RecurringTransactionDetails | DisbursementTransactionDetails);
10432
10353
  }
10433
10354
 
10434
10355
  declare type TransactionDetails =
10435
10356
  | PaymentTransactionDetails
10357
+ | RecurringTransactionDetails
10436
10358
  | DisbursementTransactionDetails;
10437
10359
 
10438
10360
  declare type TransactionDetailsWithDomain = TransactionDetails & {
@@ -10458,7 +10380,10 @@ declare class UIComponents {
10458
10380
  form(opts?: FormOptions): Form;
10459
10381
  threeDSecure(session: string, opts?: ThreeDSecureOptions): ThreeDSecure;
10460
10382
  googlePay(tx: Transaction, opts: GooglePayOptions): GooglePay;
10461
- applePay(tx: Transaction, opts: ApplePayOptions): ApplePay;
10383
+ applePay(tx: Transaction, opts: ApplePayButtonOptions): ApplePayButton;
10384
+ /**
10385
+ * @deprecated Use `applePay` instead.
10386
+ */
10462
10387
  applePayButton(tx: Transaction, opts: ApplePayButtonOptions): ApplePayButton;
10463
10388
  }
10464
10389
 
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.2.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
+ "themes": "0.1.16",
24
24
  "tsconfig": "0.1.0",
25
- "types": "0.13.0",
26
- "themes": "0.1.13"
25
+ "types": "0.16.0",
26
+ "@evervault/browser": "2.46.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
  }