@evervault/js 2.20.0 → 2.22.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 +210 -19
  2. package/package.json +4 -4
@@ -146,6 +146,24 @@ declare interface ApplePayCardEnrichment {
146
146
 
147
147
  declare type ApplePayCardNetwork = "amex" | "bancomat" | "bancontact" | "cartesBancaires" | "chinaUnionPay" | "dankort" | "discover" | "eftpos" | "electron" | "elo" | "girocard" | "interac" | "jcb" | "mada" | "maestro" | "masterCard" | "mir" | "privateLabel" | "visa" | "vPay";
148
148
 
149
+ /** Shape of Apple Pay's native billing/shipping contact, as passed through unmodified. */
150
+ declare interface ApplePayContact {
151
+ givenName?: string;
152
+ familyName?: string;
153
+ phoneticGivenName?: string;
154
+ phoneticFamilyName?: string;
155
+ emailAddress?: string;
156
+ phoneNumber?: string;
157
+ addressLines?: string[];
158
+ subLocality?: string;
159
+ locality?: string;
160
+ postalCode?: string;
161
+ subAdministrativeArea?: string;
162
+ administrativeArea?: string;
163
+ country?: string;
164
+ countryCode?: string;
165
+ }
166
+
149
167
  /** Maps to ApplePayErrorCode values for coupon validation on the sheet. */
150
168
  declare type ApplePayCouponCodeErrorCode = "couponCodeInvalid" | "couponCodeExpired";
151
169
 
@@ -1097,27 +1115,12 @@ EncryptedDPAN<"apple">,
1097
1115
  > & {
1098
1116
  networkToken: PaymentToken<"apple"> & { rawExpiry: string };
1099
1117
  card: EncryptedDPAN<"apple">["card"] & ApplePayCardEnrichment;
1100
- billingContact?: {
1101
- givenName?: string;
1102
- familyName?: string;
1103
- phoneticGivenName?: string;
1104
- phoneticFamilyName?: string;
1105
- emailAddress?: string;
1106
- phoneNumber?: string;
1107
- address?: unknown;
1108
- };
1118
+ billingContact?: ApplePayContact;
1109
1119
  paymentDataType: string;
1110
1120
  transactionType: ApplePayTransactionType;
1111
1121
  transactionId: string;
1112
1122
  deviceManufacturerIdentifier: string;
1113
- shippingContact?: {
1114
- givenName?: string;
1115
- familyName?: string;
1116
- phoneticGivenName?: string;
1117
- phoneticFamilyName?: string;
1118
- emailAddress?: string;
1119
- phoneNumber?: string;
1120
- };
1123
+ shippingContact?: ApplePayContact;
1121
1124
  /**
1122
1125
  * Set when `requestPayerDetails` is used. Apple Pay collects these on the
1123
1126
  * shipping contact, so they also appear on `shippingContact`.
@@ -1168,11 +1171,30 @@ declare interface EncryptedFPAN {
1168
1171
  }
1169
1172
 
1170
1173
  declare type EncryptedGooglePayData = (
1171
- | EncryptedDPAN<"google">
1172
- | EncryptedFPAN
1174
+ | EncryptedGooglePayDPAN
1175
+ | EncryptedGooglePayFPAN
1173
1176
  ) & {
1174
1177
  email?: string | null;
1175
1178
  billingAddress?: google.payments.api.Address | null;
1179
+ /**
1180
+ * The address the buyer chose in the sheet. Present when shipping-address
1181
+ * collection was enabled directly or through `shippingOptions`.
1182
+ */
1183
+ shippingAddress?: google.payments.api.Address | null;
1184
+ /**
1185
+ * The shipping option the buyer chose in the sheet. Present only when
1186
+ * `shippingOptions` were configured on the Google Pay button.
1187
+ */
1188
+ shippingOption?: GooglePayShippingOption | null;
1189
+ assuranceDetails?: google.payments.api.AssuranceDetails | null;
1190
+ };
1191
+
1192
+ declare type EncryptedGooglePayDPAN = Omit<EncryptedDPAN<"google">, "card"> & {
1193
+ card: EncryptedDPAN<"google">["card"] & GooglePayCardEnrichment;
1194
+ };
1195
+
1196
+ declare type EncryptedGooglePayFPAN = Omit<EncryptedFPAN, "card"> & {
1197
+ card: EncryptedFPAN["card"] & GooglePayCardEnrichment;
1176
1198
  };
1177
1199
 
1178
1200
  declare const encryptionConstants: {
@@ -1351,7 +1373,18 @@ declare class GooglePay {
1351
1373
  allowedAuthMethods: google.payments.api.CardAuthMethod[] | undefined;
1352
1374
  allowedCardNetworks: google.payments.api.CardNetwork[] | undefined;
1353
1375
  billingAddress: GooglePayBillingAddressConfig | undefined;
1376
+ shippingAddress: GooglePayShippingAddressConfig | undefined;
1377
+ shippingOptions: GooglePayShippingOptionsConfig | undefined;
1354
1378
  emailRequired: boolean | undefined;
1379
+ checkoutOption: google.payments.api.CheckoutOption | undefined;
1380
+ transactionId: string | undefined;
1381
+ totalPriceStatus: "ESTIMATED" | "FINAL" | undefined;
1382
+ allowPrepaidCards: boolean | undefined;
1383
+ allowCreditCards: boolean | undefined;
1384
+ softwareInfo: google.payments.api.SoftwareInfo | undefined;
1385
+ assuranceDetailsRequired: boolean | undefined;
1386
+ existingPaymentMethodRequired: boolean | undefined;
1387
+ prefetchPaymentData: boolean | undefined;
1355
1388
  };
1356
1389
  };
1357
1390
  mount(selector: SelectorType): this;
@@ -1412,6 +1445,37 @@ declare type GooglePayButtonType =
1412
1445
  | "plain"
1413
1446
  | "subscribe";
1414
1447
 
1448
+ declare interface GooglePayCardEnrichment {
1449
+ funding?: string;
1450
+ segment?: string;
1451
+ country?: string;
1452
+ currency?: string;
1453
+ issuer?: string;
1454
+ }
1455
+
1456
+ /** Rejects the buyer's current selection and shows an error in the sheet. */
1457
+ declare interface GooglePayDataChangeFailure {
1458
+ error: GooglePayErrorMessage;
1459
+ amount?: never;
1460
+ lineItems?: never;
1461
+ shippingOptions?: never;
1462
+ }
1463
+
1464
+ /**
1465
+ * A successful patch for the open sheet. Omitted fields retain their current
1466
+ * values. Amounts use the currency's minor units, like `transaction.amount`.
1467
+ */
1468
+ declare interface GooglePayDataChangeSuccess {
1469
+ amount?: number;
1470
+ lineItems?: TransactionLineItem[];
1471
+ shippingOptions?: GooglePayShippingOptionsConfig;
1472
+ error?: never;
1473
+ }
1474
+
1475
+ declare type GooglePayDataChangeUpdate =
1476
+ | GooglePayDataChangeSuccess
1477
+ | GooglePayDataChangeFailure;
1478
+
1415
1479
  declare interface GooglePayErrorMessage {
1416
1480
  message: string;
1417
1481
  reason?: google.payments.api.ErrorReason;
@@ -1442,7 +1506,119 @@ declare interface GooglePayOptions {
1442
1506
  allowedAuthMethods?: google.payments.api.CardAuthMethod[];
1443
1507
  allowedCardNetworks?: google.payments.api.CardNetwork[];
1444
1508
  billingAddress?: GooglePayBillingAddressConfig;
1509
+ /**
1510
+ * Collect a shipping address in the sheet. Pass `true` for any supported
1511
+ * country, or parameters to restrict countries / request a phone number.
1512
+ */
1513
+ shippingAddress?: GooglePayShippingAddressConfig;
1514
+ /**
1515
+ * Offer shipping options in the sheet. This also enables shipping-address
1516
+ * collection when `shippingAddress` is omitted.
1517
+ */
1518
+ shippingOptions?: GooglePayShippingOptionsConfig;
1519
+ /**
1520
+ * Called when the buyer picks or changes their shipping address, while the
1521
+ * sheet is still open. Return updated totals, line items or options. The
1522
+ * callback has 10 seconds to complete.
1523
+ */
1524
+ onShippingAddressChange?: (
1525
+ address: google.payments.api.IntermediateAddress,
1526
+ context: GooglePayShippingContext
1527
+ ) =>
1528
+ | GooglePayDataChangeUpdate
1529
+ | void
1530
+ | Promise<GooglePayDataChangeUpdate | void>;
1531
+ /**
1532
+ * Called when the buyer picks a different shipping option. The callback has
1533
+ * 10 seconds to complete.
1534
+ */
1535
+ onShippingOptionChange?: (
1536
+ option: GooglePayShippingOption,
1537
+ context: GooglePayShippingContext
1538
+ ) =>
1539
+ | GooglePayDataChangeUpdate
1540
+ | void
1541
+ | Promise<GooglePayDataChangeUpdate | void>;
1445
1542
  theme?: ThemeDefinition;
1543
+ /**
1544
+ * Whether to show a 'Continue' or 'Pay Now' button on the Google Pay sheet.
1545
+ * @default "DEFAULT"
1546
+ */
1547
+ checkoutOption?: google.payments.api.CheckoutOption;
1548
+ /**
1549
+ * A merchant-generated ID for this transaction, used for fraud correlation.
1550
+ */
1551
+ transactionId?: string;
1552
+ /**
1553
+ * Whether the total price is known and final, or still an estimate.
1554
+ *
1555
+ * `"NOT_CURRENTLY_KNOWN"` isn't supported — same as Android and our
1556
+ * current shipping implementation.
1557
+ * @default "FINAL"
1558
+ */
1559
+ totalPriceStatus?: Exclude<
1560
+ google.payments.api.TotalPriceStatus,
1561
+ "NOT_CURRENTLY_KNOWN"
1562
+ >;
1563
+ /** @default true */
1564
+ allowPrepaidCards?: boolean;
1565
+ /** @default true */
1566
+ allowCreditCards?: boolean;
1567
+ /**
1568
+ * Identifies the software used to integrate with Google Pay, for Google's
1569
+ * own metrics.
1570
+ */
1571
+ softwareInfo?: google.payments.api.SoftwareInfo;
1572
+ /**
1573
+ * When true, requests that Google Pay perform cardholder ID&V/possession
1574
+ * checks and return the result as `assuranceDetails` on the payment method.
1575
+ */
1576
+ assuranceDetailsRequired?: boolean;
1577
+ /**
1578
+ * When true, requires the user to have an existing payment method
1579
+ * associated with their Google account for the button to be shown as
1580
+ * ready. Checked by `isReadyToPay`, not `loadPaymentData`.
1581
+ * @default false
1582
+ */
1583
+ existingPaymentMethodRequired?: boolean;
1584
+ /**
1585
+ * When true, asks Google Pay to prefetch payment data as soon as the
1586
+ * button is ready, so the sheet opens faster when the user clicks it.
1587
+ * Fire-and-forget; has no effect on `process()`'s result.
1588
+ */
1589
+ prefetchPaymentData?: boolean;
1590
+ }
1591
+
1592
+ declare type GooglePayShippingAddressConfig =
1593
+ | boolean
1594
+ | GooglePayShippingAddressParameters;
1595
+
1596
+ declare type GooglePayShippingAddressParameters =
1597
+ google.payments.api.ShippingAddressParameters;
1598
+
1599
+ /** The current shipping state when Google Pay asks for an update. */
1600
+ declare interface GooglePayShippingContext {
1601
+ trigger: google.payments.api.CallbackTrigger;
1602
+ shippingAddress?: google.payments.api.IntermediateAddress | null;
1603
+ selectedShippingOption?: GooglePayShippingOption | null;
1604
+ /** The current total in the currency's minor units. */
1605
+ amount: number;
1606
+ lineItems?: TransactionLineItem[];
1607
+ shippingOptions?: GooglePayShippingOptionsConfig;
1608
+ }
1609
+
1610
+ declare type GooglePayShippingOption = google.payments.api.SelectionOption & {
1611
+ /**
1612
+ * Optional shipping cost in minor units. Google Pay does not display this
1613
+ * field automatically. Include it in `label` when buyers must see the price.
1614
+ */
1615
+ amount?: number;
1616
+ };
1617
+
1618
+ declare interface GooglePayShippingOptionsConfig {
1619
+ options: GooglePayShippingOption[];
1620
+ /** Defaults to the first option when omitted, matching Google's own default. */
1621
+ defaultSelectedOptionId?: string;
1446
1622
  }
1447
1623
 
1448
1624
  declare interface HttpConfig {
@@ -11755,10 +11931,19 @@ declare interface SwipedCard {
11755
11931
 
11756
11932
  declare type ThemeDefinition = ThemeObject | ThemeFunction;
11757
11933
 
11934
+ declare interface ThemeFontFace {
11935
+ fontFamily: string;
11936
+ src: string;
11937
+ fontWeight?: string | number;
11938
+ fontStyle?: string;
11939
+ fontDisplay?: string;
11940
+ }
11941
+
11758
11942
  declare type ThemeFunction = (utilities: ThemeUtilities) => ThemeObject;
11759
11943
 
11760
11944
  declare interface ThemeObject {
11761
11945
  fonts?: string[];
11946
+ fontFaces?: ThemeFontFace[];
11762
11947
  styles?: ThemeStyles;
11763
11948
  }
11764
11949
 
@@ -11835,6 +12020,12 @@ declare interface TransactionLineItem {
11835
12020
  * Defaults to `"final"` when omitted.
11836
12021
  */
11837
12022
  type?: TransactionLineItemType;
12023
+ /**
12024
+ * The kind of line item, for platforms that distinguish it (currently Google
12025
+ * Pay only, where it maps to `displayItems[].type`). Has no effect on Apple
12026
+ * Pay or disbursements. Defaults to `"line_item"` when omitted.
12027
+ */
12028
+ category?: "line_item" | "subtotal" | "tax" | "discount" | "shipping_option";
11838
12029
  }
11839
12030
 
11840
12031
  declare type TransactionLineItemType = "final" | "pending";
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "private": false,
3
3
  "name": "@evervault/js",
4
- "version": "2.20.0",
4
+ "version": "2.22.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.6.3",
21
21
  "vite": "^8.1.4",
22
22
  "vite-plugin-dts": "^5.0.2",
23
- "themes": "0.1.24",
24
- "@evervault/browser": "2.63.0",
23
+ "@evervault/browser": "2.65.0",
25
24
  "tsconfig": "0.1.0",
26
- "types": "0.23.1"
25
+ "types": "0.23.1",
26
+ "themes": "0.1.24"
27
27
  },
28
28
  "scripts": {
29
29
  "build": "vite build",