@evervault/js 2.20.0 → 2.23.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.
@@ -1,5 +1,18 @@
1
1
  import { nodeEvents } from 'node:events';
2
2
 
3
+ declare interface AgentToolsConfig {
4
+ enabled: boolean;
5
+ namePrefix?: string;
6
+ productName?: string;
7
+ exposeTo?: string[];
8
+ }
9
+
10
+ declare interface AgentToolsFrameConfig {
11
+ namePrefix: string;
12
+ productName: string;
13
+ exposeTo: string[];
14
+ }
15
+
3
16
  declare class ApplePayButton {
4
17
  #private;
5
18
  client: EvervaultClient;
@@ -146,6 +159,24 @@ declare interface ApplePayCardEnrichment {
146
159
 
147
160
  declare type ApplePayCardNetwork = "amex" | "bancomat" | "bancontact" | "cartesBancaires" | "chinaUnionPay" | "dankort" | "discover" | "eftpos" | "electron" | "elo" | "girocard" | "interac" | "jcb" | "mada" | "maestro" | "masterCard" | "mir" | "privateLabel" | "visa" | "vPay";
148
161
 
162
+ /** Shape of Apple Pay's native billing/shipping contact, as passed through unmodified. */
163
+ declare interface ApplePayContact {
164
+ givenName?: string;
165
+ familyName?: string;
166
+ phoneticGivenName?: string;
167
+ phoneticFamilyName?: string;
168
+ emailAddress?: string;
169
+ phoneNumber?: string;
170
+ addressLines?: string[];
171
+ subLocality?: string;
172
+ locality?: string;
173
+ postalCode?: string;
174
+ subAdministrativeArea?: string;
175
+ administrativeArea?: string;
176
+ country?: string;
177
+ countryCode?: string;
178
+ }
179
+
149
180
  /** Maps to ApplePayErrorCode values for coupon validation on the sheet. */
150
181
  declare type ApplePayCouponCodeErrorCode = "couponCodeInvalid" | "couponCodeExpired";
151
182
 
@@ -224,43 +255,17 @@ declare interface CageKey {
224
255
 
225
256
  declare class Card {
226
257
  #private;
227
- values: CardPayload;
228
258
  constructor(client: EvervaultClient, options?: CardOptions);
229
- get config(): {
230
- theme: ThemeDefinition | undefined;
231
- config: {
232
- icons: boolean | Partial< CardIcons> | undefined;
233
- autoFocus: boolean | undefined;
234
- translations: Partial< CardTranslations> | undefined;
235
- hiddenFields: string;
236
- fields: CardField[] | undefined;
237
- acceptedBrands: CardBrandName[] | undefined;
238
- customBrands: CustomBrand[] | undefined;
239
- defaultValues: {
240
- name?: string;
241
- } | undefined;
242
- autoComplete: {
243
- name?: boolean;
244
- number?: boolean;
245
- expiry?: boolean;
246
- cvc?: boolean;
247
- } | undefined;
248
- autoProgress: boolean | undefined;
249
- redactCVC: boolean | undefined;
250
- allow3DigitAmexCVC: boolean | undefined;
251
- validation: {
252
- name?: {
253
- regex?: RegExp;
254
- };
255
- cvc?: {
256
- optional?: boolean;
257
- };
258
- } | undefined;
259
- };
259
+ get values(): CardPayload;
260
+ get config(): CardHostConfiguration & {
261
+ config: CardFrameConfig;
260
262
  };
261
263
  mount(selector: SelectorType): this;
264
+ preload(selector: SelectorType): this;
265
+ show(): this;
262
266
  update(options?: CardOptions): this;
263
267
  unmount(): this;
268
+ destroy(): this;
264
269
  on<T extends keyof CardEvents>(event: T, callback: CardEvents[T]): () => void;
265
270
  validate(): this;
266
271
  }
@@ -309,6 +314,43 @@ extends TranslationsObject {
309
314
  errors?: E;
310
315
  }
311
316
 
317
+ declare interface CardFrameConfig {
318
+ icons?: boolean | Partial<CardIcons>;
319
+ autoFocus?: boolean;
320
+ hiddenFields?: string; // deprecated, sent comma-joined
321
+ // A field list from `ui.card()`, or the node tree a declared card renders.
322
+ fields?: CardField[] | CardSpecNode[];
323
+ acceptedBrands?: CardBrandName[];
324
+ customBrands?: CustomBrand[];
325
+ translations?: Partial<CardTranslations>;
326
+ autoProgress?: boolean;
327
+ redactCVC?: boolean;
328
+ allow3DigitAmexCVC?: boolean;
329
+ defaultValues?: {
330
+ name?: string;
331
+ };
332
+ autoComplete?: {
333
+ name?: boolean;
334
+ number?: boolean;
335
+ expiry?: boolean;
336
+ cvc?: boolean;
337
+ };
338
+ validation?: {
339
+ name?: {
340
+ regex?: RegExp;
341
+ };
342
+ cvc?: {
343
+ optional?: boolean;
344
+ };
345
+ };
346
+ agentTools?: AgentToolsFrameConfig;
347
+ }
348
+
349
+ declare interface CardHostConfiguration {
350
+ theme?: ThemeDefinition;
351
+ config?: CardFrameConfig;
352
+ }
353
+
312
354
  declare type CardIcons = Record<CardBrandName | "default", string>;
313
355
 
314
356
  declare interface CardOptions {
@@ -341,6 +383,7 @@ declare interface CardOptions {
341
383
  optional?: boolean;
342
384
  };
343
385
  };
386
+ agentTools?: AgentToolsConfig;
344
387
  }
345
388
 
346
389
  declare interface CardPayload {
@@ -363,6 +406,15 @@ declare interface CardPayload {
363
406
  }>;
364
407
  }
365
408
 
409
+ declare interface CardSpecNode {
410
+ type: CardSpecNodeType;
411
+ id: string;
412
+ props: Record<string, string>;
413
+ children?: CardSpecNode[];
414
+ }
415
+
416
+ declare type CardSpecNodeType = "row" | CardField;
417
+
366
418
  declare interface CardTranslations extends TranslationsObject {
367
419
  number: CardFieldTranslations<{
368
420
  invalid?: string;
@@ -372,112 +424,9 @@ declare interface CardTranslations extends TranslationsObject {
372
424
  cvc: CardFieldTranslations<{ invalid?: string }>;
373
425
  }
374
426
 
375
- declare function clean(extended?: ThemeDefinition): ThemeDefinition {
376
- return (utils) => ({
377
- styles: {
378
- ":root": {
379
- "--icon-offset": "1.9rem",
380
- },
381
- body: {
382
- paddingBottom: 2,
383
- },
384
- label: {
385
- fontSize: 14,
386
- marginBottom: 4,
387
- display: "block",
388
- color: "#0a2540",
389
- },
390
- input: {
391
- height: 40,
392
- fontSize: 16,
393
- borderRadius: 6,
394
- color: "#0a2540",
395
- padding: "0 12px",
396
- backgroundColor: "#fff",
397
- border: "1px solid #e6ebf1",
398
- boxShadow:
399
- "0px 1px 1px rgba(0, 0, 0, .03), 0px 3px 6px rgba(0, 0, 0, .02)",
400
-
401
- "&::placeholder": {
402
- color: "#717f96",
403
- },
404
-
405
- "&:focus": {
406
- outline: "none",
407
- borderColor: "#63e",
408
- },
409
- },
410
- textarea: {
411
- height: 40,
412
- fontSize: 16,
413
- borderRadius: 6,
414
- color: "#0a2540",
415
- padding: "6px 12px",
416
- backgroundColor: "#fff",
417
- border: "1px solid #e6ebf1",
418
-
419
- boxShadow:
420
- "0px 1px 1px rgba(0, 0, 0, .03), 0px 3px 6px rgba(0, 0, 0, .02)",
421
-
422
- "&::placeholder": {
423
- color: "#717f96",
424
- },
425
-
426
- "&:focus": {
427
- outline: "none",
428
- borderColor: "#63e",
429
- },
430
- },
431
- select: {
432
- height: 40,
433
- fontSize: 16,
434
- borderRadius: 6,
435
- color: "#0a2540",
436
- padding: "6px 12px",
437
- backgroundColor: "#fff",
438
- border: "1px solid #e6ebf1",
439
- },
440
- button: {
441
- fontSize: 16,
442
- height: 40,
443
- border: "1px solid #e6ebf1",
444
- padding: "0 12px",
445
- },
446
- ".field[ev-valid=false] input": {
447
- color: "#df1c41",
448
- borderColor: "#df1c41",
449
- },
450
- ".error": {
451
- color: "#df1c41",
452
- fontSize: "0.75rem",
453
- padding: "0.25rem 0",
454
- },
455
- "[ev-component=card]": {
456
- gap: 16,
457
- },
458
- "[ev-component=pin] input": {
459
- height: 80,
460
- fontSize: 20,
461
- caretColor: "transparent",
462
- },
463
- "[ev-component=card]:has(.icon)": {
464
- "& .field[ev-name=number]": {
465
- position: "relative",
466
- },
467
- "& .icon": {
468
- left: 10,
469
- height: 20,
470
- position: "absolute",
471
- top: "var(--icon-offset)",
472
- },
473
- "& .field[ev-name=number] input": {
474
- paddingLeft: 48,
475
- },
476
- },
477
- ...(extended ? utils.extend(extended) : {}),
478
- },
479
- });
480
- }
427
+ export declare function clean(config?: PresetConfig): ThemeDefinition;
428
+
429
+ export declare function clean(extended?: ThemeDefinition, config?: PresetConfig): ThemeDefinition;
481
430
 
482
431
  declare type ColorScheme =
483
432
  | "normal"
@@ -538,6 +487,8 @@ PaymentTransactionDetails,
538
487
  "type"
539
488
  > & { type?: "payment" };
540
489
 
490
+ export declare function cssVar(name: string): string;
491
+
541
492
  declare interface CustomBrand {
542
493
  name: string;
543
494
  isLocal: true;
@@ -1097,27 +1048,12 @@ EncryptedDPAN<"apple">,
1097
1048
  > & {
1098
1049
  networkToken: PaymentToken<"apple"> & { rawExpiry: string };
1099
1050
  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
- };
1051
+ billingContact?: ApplePayContact;
1109
1052
  paymentDataType: string;
1110
1053
  transactionType: ApplePayTransactionType;
1111
1054
  transactionId: string;
1112
1055
  deviceManufacturerIdentifier: string;
1113
- shippingContact?: {
1114
- givenName?: string;
1115
- familyName?: string;
1116
- phoneticGivenName?: string;
1117
- phoneticFamilyName?: string;
1118
- emailAddress?: string;
1119
- phoneNumber?: string;
1120
- };
1056
+ shippingContact?: ApplePayContact;
1121
1057
  /**
1122
1058
  * Set when `requestPayerDetails` is used. Apple Pay collects these on the
1123
1059
  * shipping contact, so they also appear on `shippingContact`.
@@ -1168,11 +1104,30 @@ declare interface EncryptedFPAN {
1168
1104
  }
1169
1105
 
1170
1106
  declare type EncryptedGooglePayData = (
1171
- | EncryptedDPAN<"google">
1172
- | EncryptedFPAN
1107
+ | EncryptedGooglePayDPAN
1108
+ | EncryptedGooglePayFPAN
1173
1109
  ) & {
1174
1110
  email?: string | null;
1175
1111
  billingAddress?: google.payments.api.Address | null;
1112
+ /**
1113
+ * The address the buyer chose in the sheet. Present when shipping-address
1114
+ * collection was enabled directly or through `shippingOptions`.
1115
+ */
1116
+ shippingAddress?: google.payments.api.Address | null;
1117
+ /**
1118
+ * The shipping option the buyer chose in the sheet. Present only when
1119
+ * `shippingOptions` were configured on the Google Pay button.
1120
+ */
1121
+ shippingOption?: GooglePayShippingOption | null;
1122
+ assuranceDetails?: google.payments.api.AssuranceDetails | null;
1123
+ };
1124
+
1125
+ declare type EncryptedGooglePayDPAN = Omit<EncryptedDPAN<"google">, "card"> & {
1126
+ card: EncryptedDPAN<"google">["card"] & GooglePayCardEnrichment;
1127
+ };
1128
+
1129
+ declare type EncryptedGooglePayFPAN = Omit<EncryptedFPAN, "card"> & {
1130
+ card: EncryptedFPAN["card"] & GooglePayCardEnrichment;
1176
1131
  };
1177
1132
 
1178
1133
  declare const encryptionConstants: {
@@ -1351,7 +1306,18 @@ declare class GooglePay {
1351
1306
  allowedAuthMethods: google.payments.api.CardAuthMethod[] | undefined;
1352
1307
  allowedCardNetworks: google.payments.api.CardNetwork[] | undefined;
1353
1308
  billingAddress: GooglePayBillingAddressConfig | undefined;
1309
+ shippingAddress: GooglePayShippingAddressConfig | undefined;
1310
+ shippingOptions: GooglePayShippingOptionsConfig | undefined;
1354
1311
  emailRequired: boolean | undefined;
1312
+ checkoutOption: google.payments.api.CheckoutOption | undefined;
1313
+ transactionId: string | undefined;
1314
+ totalPriceStatus: "ESTIMATED" | "FINAL" | undefined;
1315
+ allowPrepaidCards: boolean | undefined;
1316
+ allowCreditCards: boolean | undefined;
1317
+ softwareInfo: google.payments.api.SoftwareInfo | undefined;
1318
+ assuranceDetailsRequired: boolean | undefined;
1319
+ existingPaymentMethodRequired: boolean | undefined;
1320
+ prefetchPaymentData: boolean | undefined;
1355
1321
  };
1356
1322
  };
1357
1323
  mount(selector: SelectorType): this;
@@ -1412,6 +1378,37 @@ declare type GooglePayButtonType =
1412
1378
  | "plain"
1413
1379
  | "subscribe";
1414
1380
 
1381
+ declare interface GooglePayCardEnrichment {
1382
+ funding?: string;
1383
+ segment?: string;
1384
+ country?: string;
1385
+ currency?: string;
1386
+ issuer?: string;
1387
+ }
1388
+
1389
+ /** Rejects the buyer's current selection and shows an error in the sheet. */
1390
+ declare interface GooglePayDataChangeFailure {
1391
+ error: GooglePayErrorMessage;
1392
+ amount?: never;
1393
+ lineItems?: never;
1394
+ shippingOptions?: never;
1395
+ }
1396
+
1397
+ /**
1398
+ * A successful patch for the open sheet. Omitted fields retain their current
1399
+ * values. Amounts use the currency's minor units, like `transaction.amount`.
1400
+ */
1401
+ declare interface GooglePayDataChangeSuccess {
1402
+ amount?: number;
1403
+ lineItems?: TransactionLineItem[];
1404
+ shippingOptions?: GooglePayShippingOptionsConfig;
1405
+ error?: never;
1406
+ }
1407
+
1408
+ declare type GooglePayDataChangeUpdate =
1409
+ | GooglePayDataChangeSuccess
1410
+ | GooglePayDataChangeFailure;
1411
+
1415
1412
  declare interface GooglePayErrorMessage {
1416
1413
  message: string;
1417
1414
  reason?: google.payments.api.ErrorReason;
@@ -1442,7 +1439,119 @@ declare interface GooglePayOptions {
1442
1439
  allowedAuthMethods?: google.payments.api.CardAuthMethod[];
1443
1440
  allowedCardNetworks?: google.payments.api.CardNetwork[];
1444
1441
  billingAddress?: GooglePayBillingAddressConfig;
1442
+ /**
1443
+ * Collect a shipping address in the sheet. Pass `true` for any supported
1444
+ * country, or parameters to restrict countries / request a phone number.
1445
+ */
1446
+ shippingAddress?: GooglePayShippingAddressConfig;
1447
+ /**
1448
+ * Offer shipping options in the sheet. This also enables shipping-address
1449
+ * collection when `shippingAddress` is omitted.
1450
+ */
1451
+ shippingOptions?: GooglePayShippingOptionsConfig;
1452
+ /**
1453
+ * Called when the buyer picks or changes their shipping address, while the
1454
+ * sheet is still open. Return updated totals, line items or options. The
1455
+ * callback has 10 seconds to complete.
1456
+ */
1457
+ onShippingAddressChange?: (
1458
+ address: google.payments.api.IntermediateAddress,
1459
+ context: GooglePayShippingContext
1460
+ ) =>
1461
+ | GooglePayDataChangeUpdate
1462
+ | void
1463
+ | Promise<GooglePayDataChangeUpdate | void>;
1464
+ /**
1465
+ * Called when the buyer picks a different shipping option. The callback has
1466
+ * 10 seconds to complete.
1467
+ */
1468
+ onShippingOptionChange?: (
1469
+ option: GooglePayShippingOption,
1470
+ context: GooglePayShippingContext
1471
+ ) =>
1472
+ | GooglePayDataChangeUpdate
1473
+ | void
1474
+ | Promise<GooglePayDataChangeUpdate | void>;
1445
1475
  theme?: ThemeDefinition;
1476
+ /**
1477
+ * Whether to show a 'Continue' or 'Pay Now' button on the Google Pay sheet.
1478
+ * @default "DEFAULT"
1479
+ */
1480
+ checkoutOption?: google.payments.api.CheckoutOption;
1481
+ /**
1482
+ * A merchant-generated ID for this transaction, used for fraud correlation.
1483
+ */
1484
+ transactionId?: string;
1485
+ /**
1486
+ * Whether the total price is known and final, or still an estimate.
1487
+ *
1488
+ * `"NOT_CURRENTLY_KNOWN"` isn't supported — same as Android and our
1489
+ * current shipping implementation.
1490
+ * @default "FINAL"
1491
+ */
1492
+ totalPriceStatus?: Exclude<
1493
+ google.payments.api.TotalPriceStatus,
1494
+ "NOT_CURRENTLY_KNOWN"
1495
+ >;
1496
+ /** @default true */
1497
+ allowPrepaidCards?: boolean;
1498
+ /** @default true */
1499
+ allowCreditCards?: boolean;
1500
+ /**
1501
+ * Identifies the software used to integrate with Google Pay, for Google's
1502
+ * own metrics.
1503
+ */
1504
+ softwareInfo?: google.payments.api.SoftwareInfo;
1505
+ /**
1506
+ * When true, requests that Google Pay perform cardholder ID&V/possession
1507
+ * checks and return the result as `assuranceDetails` on the payment method.
1508
+ */
1509
+ assuranceDetailsRequired?: boolean;
1510
+ /**
1511
+ * When true, requires the user to have an existing payment method
1512
+ * associated with their Google account for the button to be shown as
1513
+ * ready. Checked by `isReadyToPay`, not `loadPaymentData`.
1514
+ * @default false
1515
+ */
1516
+ existingPaymentMethodRequired?: boolean;
1517
+ /**
1518
+ * When true, asks Google Pay to prefetch payment data as soon as the
1519
+ * button is ready, so the sheet opens faster when the user clicks it.
1520
+ * Fire-and-forget; has no effect on `process()`'s result.
1521
+ */
1522
+ prefetchPaymentData?: boolean;
1523
+ }
1524
+
1525
+ declare type GooglePayShippingAddressConfig =
1526
+ | boolean
1527
+ | GooglePayShippingAddressParameters;
1528
+
1529
+ declare type GooglePayShippingAddressParameters =
1530
+ google.payments.api.ShippingAddressParameters;
1531
+
1532
+ /** The current shipping state when Google Pay asks for an update. */
1533
+ declare interface GooglePayShippingContext {
1534
+ trigger: google.payments.api.CallbackTrigger;
1535
+ shippingAddress?: google.payments.api.IntermediateAddress | null;
1536
+ selectedShippingOption?: GooglePayShippingOption | null;
1537
+ /** The current total in the currency's minor units. */
1538
+ amount: number;
1539
+ lineItems?: TransactionLineItem[];
1540
+ shippingOptions?: GooglePayShippingOptionsConfig;
1541
+ }
1542
+
1543
+ declare type GooglePayShippingOption = google.payments.api.SelectionOption & {
1544
+ /**
1545
+ * Optional shipping cost in minor units. Google Pay does not display this
1546
+ * field automatically. Include it in `label` when buyers must see the price.
1547
+ */
1548
+ amount?: number;
1549
+ };
1550
+
1551
+ declare interface GooglePayShippingOptionsConfig {
1552
+ options: GooglePayShippingOption[];
1553
+ /** Defaults to the first option when omitted, matching Google's own default. */
1554
+ defaultSelectedOptionId?: string;
1446
1555
  }
1447
1556
 
1448
1557
  declare interface HttpConfig {
@@ -1511,313 +1620,13 @@ declare type JssValue =
1511
1620
 
1512
1621
  export declare function loadEvervault(team: string, app: string, config?: CustomConfig): Promise<EvervaultInstance>;
1513
1622
 
1514
- declare function material(extended?: ThemeDefinition): ThemeDefinition {
1515
- return (utils) => ({
1516
- styles: {
1517
- body: {
1518
- paddingTop: 4,
1519
- },
1520
-
1521
- ".field": {
1522
- position: "relative",
1523
- },
1524
-
1525
- label: {
1526
- top: 10,
1527
- left: 8,
1528
- zIndex: 3,
1529
- fontSize: 14,
1530
- lineHeight: 1,
1531
- height: "20px",
1532
- display: "flex",
1533
- color: "#717f96",
1534
- padding: "0 4px",
1535
- alignItems: "center",
1536
- position: "absolute",
1537
- pointerEvents: "none",
1538
- transformOrigin: "center left",
1539
- transition: "transform 150ms, background 150ms",
1540
- },
1541
-
1542
- input: {
1543
- height: 40,
1544
- fontSize: 16,
1545
- borderRadius: 6,
1546
- color: "#0a2540",
1547
- padding: "0 12px",
1548
- backgroundColor: "#fff",
1549
- border: "1px solid #e6ebf1",
1550
-
1551
- "&::placeholder": {
1552
- color: "transparent",
1553
- },
1554
-
1555
- "&:focus": {
1556
- outline: "none",
1557
- borderColor: "#63e",
1558
- },
1559
- },
1560
-
1561
- textarea: {
1562
- height: 40,
1563
- fontSize: 16,
1564
- borderRadius: 6,
1565
- color: "#0a2540",
1566
- padding: "6 12px",
1567
- backgroundColor: "#fff",
1568
- border: "1px solid #e6ebf1",
1569
-
1570
- "&::placeholder": {
1571
- color: "transparent",
1572
- },
1573
-
1574
- "&:focus": {
1575
- outline: "none",
1576
- borderColor: "#63e",
1577
- },
1578
- },
1579
-
1580
- ".field[ev-valid=false] input": {
1581
- color: "#df1c41",
1582
- borderColor: "#df1c41",
1583
- },
1584
-
1585
- ".field:focus-within label, .field:not([ev-has-value=false]) label": {
1586
- background: "white",
1587
- transform: "translateY(-100%) scale(0.8)",
1588
- },
1589
-
1590
- ".error": {
1591
- color: "#df1c41",
1592
- fontSize: "0.75rem",
1593
- padding: "0.25rem 0",
1594
- },
1595
-
1596
- ".field:not([ev-valid=false]):focus-within label": {
1597
- color: "#63e",
1598
- },
1599
-
1600
- ".field[ev-valid=false] label": {
1601
- color: "#df1c41",
1602
- },
1603
-
1604
- ".field[ev-has-value=true][ev-valid=true]:not(:focus-within) label": {
1605
- color: "#0a2540",
1606
- },
1607
-
1608
- "[ev-component=card]": {
1609
- gap: 16,
1610
- },
1611
-
1612
- "[ev-component=card]:has(.icon)": {
1613
- "& .icon": {
1614
- left: 10,
1615
- height: 20,
1616
- position: "absolute",
1617
- top: 10,
1618
- opacity: 0,
1619
- },
1620
-
1621
- "& .field[ev-name=number]:focus-within, & .field[ev-name=number]:not([ev-has-value=false])":
1622
- {
1623
- "& .icon": {
1624
- opacity: 1,
1625
- },
1626
- "& input": {
1627
- paddingLeft: 45,
1628
- },
1629
- },
1630
- },
1631
- ...(extended ? utils.extend(extended) : {}),
1632
- },
1633
- });
1634
- }
1623
+ export declare function material(config?: PresetConfig): ThemeDefinition;
1635
1624
 
1636
- declare function minimal(extended?: ThemeDefinition): ThemeDefinition {
1637
- return (utils) => ({
1638
- styles: {
1639
- ":root": {
1640
- "--icon-offset": "34px",
1641
- },
1642
-
1643
- body: {
1644
- paddingBottom: 2,
1645
- },
1646
-
1647
- label: {
1648
- fontSize: 14,
1649
- marginBottom: "0.5rem",
1650
- color: "#0a2540",
1651
- display: "none",
1652
- },
1653
-
1654
- ".field:first-child label": {
1655
- display: "block",
1656
- },
1657
-
1658
- "fieldset[ev-valid=false]": {
1659
- paddingBottom: "1.5rem",
1660
- },
1661
-
1662
- input: {
1663
- height: 40,
1664
- fontSize: 16,
1665
- borderRadius: 0,
1666
- color: "#0a2540",
1667
- padding: "0 12px",
1668
- backgroundColor: "#fff",
1669
- border: "1px solid #e6ebf1",
1670
-
1671
- boxShadow:
1672
- "0px 1px 1px rgba(0, 0, 0, .03), 0px 3px 6px rgba(0, 0, 0, .02)",
1673
-
1674
- "&::placeholder": {
1675
- color: "#717f96",
1676
- },
1677
-
1678
- "&:focus": {
1679
- outline: "none",
1680
- borderColor: "#63e",
1681
- },
1682
- },
1683
-
1684
- textarea: {
1685
- height: 40,
1686
- fontSize: 16,
1687
- borderRadius: 0,
1688
- color: "#0a2540",
1689
- padding: "6 12px",
1690
- backgroundColor: "#fff",
1691
- border: "1px solid #e6ebf1",
1692
-
1693
- boxShadow:
1694
- "0px 1px 1px rgba(0, 0, 0, .03), 0px 3px 6px rgba(0, 0, 0, .02)",
1695
-
1696
- "&::placeholder": {
1697
- color: "#717f96",
1698
- },
1699
-
1700
- "&:focus": {
1701
- outline: "none",
1702
- borderColor: "#63e",
1703
- },
1704
- },
1705
-
1706
- ".field[ev-valid=false] input": {
1707
- color: "#df1c41",
1708
- borderColor: "#df1c41",
1709
- },
1710
-
1711
- ".error": {
1712
- color: "#df1c41",
1713
- fontSize: "0.75rem",
1714
- padding: "0.25rem 0",
1715
- position: "absolute",
1716
- left: 0,
1717
- bottom: 0,
1718
- display: "none",
1719
- },
1720
-
1721
- ".field[ev-valid=false]": {
1722
- zIndex: 4,
1723
- },
1724
-
1725
- ".field:focus-within": {
1726
- zIndex: 5,
1727
- },
1728
-
1729
- "[ev-component=card]": {
1730
- gap: 0,
1731
-
1732
- "& .field[ev-valid=false]:nth-child(1) .error": {
1733
- display: "block",
1734
- },
1735
-
1736
- "& [ev-valid=true]:nth-child(1) + [ev-valid=false] .error": {
1737
- display: "block",
1738
- },
1739
-
1740
- "& [ev-valid=true]:nth-child(1) + [ev-valid=true]:nth-child(2) + [ev-valid=false] .error":
1741
- {
1742
- display: "block",
1743
- },
1744
-
1745
- "& [ev-valid=true]:nth-child(1) + [ev-valid=true]:nth-child(2) + [ev-valid=true]:nth-child(3) + [ev-valid=false] .error":
1746
- {
1747
- display: "block",
1748
- },
1749
-
1750
- "& .field:not(:last-child)": {
1751
- marginBottom: "-1px",
1752
- },
1753
-
1754
- "& .field:first-child": {
1755
- "& input": {
1756
- borderTopLeftRadius: 6,
1757
- borderTopRightRadius: 6,
1758
- },
1759
- },
1760
-
1761
- "& .field:last-child": {
1762
- "& input": {
1763
- borderBottomRightRadius: 6,
1764
- borderBottomLeftRadius: 6,
1765
- },
1766
- },
1767
- },
1768
-
1769
- "[ev-component=card][ev-fields*=cvc][ev-fields*=expiry]": {
1770
- "& .field[ev-name=expiry]": {
1771
- "& input": {
1772
- borderBottomLeftRadius: 6,
1773
- },
1774
- },
1775
-
1776
- "& .field[ev-name=cvc]": {
1777
- marginLeft: "-1px",
1778
-
1779
- "& input": {
1780
- borderBottomLeftRadius: 0,
1781
- },
1782
- },
1783
- },
1784
-
1785
- "[ev-component=pin]": {
1786
- gap: 0,
1787
-
1788
- "& input": {
1789
- height: 60,
1790
- },
1791
-
1792
- "& .field:not(:first-child)": {
1793
- marginLeft: "-1px",
1794
- },
1795
-
1796
- "& .field:first-child input": {
1797
- borderTopLeftRadius: 6,
1798
- borderBottomLeftRadius: 6,
1799
- },
1800
-
1801
- "& .field:last-child input": {
1802
- borderTopRightRadius: 6,
1803
- borderBottomRightRadius: 6,
1804
- },
1805
- },
1806
- "[ev-component=card]:has(.icon)": {
1807
- "& .icon": {
1808
- left: 10,
1809
- height: 20,
1810
- position: "absolute",
1811
- top: "var(--icon-offset)",
1812
- },
1813
- "& .field[ev-name=number] input": {
1814
- paddingLeft: 48,
1815
- },
1816
- },
1817
- ...(extended ? utils.extend(extended) : {}),
1818
- },
1819
- });
1820
- }
1625
+ export declare function material(extended?: ThemeDefinition, config?: PresetConfig): ThemeDefinition;
1626
+
1627
+ export declare function minimal(config?: PresetConfig): ThemeDefinition;
1628
+
1629
+ export declare function minimal(extended?: ThemeDefinition, config?: PresetConfig): ThemeDefinition;
1821
1630
 
1822
1631
  declare interface MinimalObservable<T> {
1823
1632
  subscribe(nextOrObserver: ((value: T) => void) | {next: (value: T) => void}): {
@@ -2952,6 +2761,14 @@ declare interface PinPayload {
2952
2761
  value: string | null;
2953
2762
  }
2954
2763
 
2764
+ export declare interface PresetConfig {
2765
+ primary?: string;
2766
+ greyTone?: string;
2767
+ roundness?: string;
2768
+ font?: string;
2769
+ selectors?: ThemeStyles;
2770
+ }
2771
+
2955
2772
  declare interface Properties<TLength = (string & {}) | 0, TTime = string & {}>
2956
2773
  extends StandardProperties<TLength, TTime>,
2957
2774
  VendorProperties<TLength, TTime>,
@@ -4756,6 +4573,7 @@ declare class RevealCopyButton {
4756
4573
 
4757
4574
  declare interface RevealCopyButtonEvents {
4758
4575
  copy: () => void;
4576
+ error: () => void;
4759
4577
  }
4760
4578
 
4761
4579
  declare interface RevealCopyButtonOptions {
@@ -4800,6 +4618,11 @@ declare class RevealText {
4800
4618
  constructor(reveal: Reveal, client: EvervaultClient, path: string, options?: RevealTextOptions);
4801
4619
  mount(selector: SelectorType): this;
4802
4620
  unmount(): this;
4621
+ on<T extends keyof RevealTextEvents>(event: T, callback: RevealTextEvents[T]): () => void;
4622
+ }
4623
+
4624
+ declare interface RevealTextEvents {
4625
+ error: () => void;
4803
4626
  }
4804
4627
 
4805
4628
  declare interface RevealTextOptions {
@@ -11753,12 +11576,21 @@ declare interface SwipedCard {
11753
11576
  bin: string | null;
11754
11577
  }
11755
11578
 
11756
- declare type ThemeDefinition = ThemeObject | ThemeFunction;
11579
+ export declare type ThemeDefinition = ThemeObject | ThemeFunction;
11580
+
11581
+ declare interface ThemeFontFace {
11582
+ fontFamily: string;
11583
+ src: string;
11584
+ fontWeight?: string | number;
11585
+ fontStyle?: string;
11586
+ fontDisplay?: string;
11587
+ }
11757
11588
 
11758
11589
  declare type ThemeFunction = (utilities: ThemeUtilities) => ThemeObject;
11759
11590
 
11760
11591
  declare interface ThemeObject {
11761
11592
  fonts?: string[];
11593
+ fontFaces?: ThemeFontFace[];
11762
11594
  styles?: ThemeStyles;
11763
11595
  }
11764
11596
 
@@ -11766,7 +11598,9 @@ declare namespace themes {
11766
11598
  export {
11767
11599
  clean,
11768
11600
  material,
11769
- minimal
11601
+ minimal,
11602
+ PresetConfig,
11603
+ cssVar
11770
11604
  }
11771
11605
  }
11772
11606
 
@@ -11835,6 +11669,12 @@ declare interface TransactionLineItem {
11835
11669
  * Defaults to `"final"` when omitted.
11836
11670
  */
11837
11671
  type?: TransactionLineItemType;
11672
+ /**
11673
+ * The kind of line item, for platforms that distinguish it (currently Google
11674
+ * Pay only, where it maps to `displayItems[].type`). Has no effect on Apple
11675
+ * Pay or disbursements. Defaults to `"line_item"` when omitted.
11676
+ */
11677
+ category?: "line_item" | "subtotal" | "tax" | "discount" | "shipping_option";
11838
11678
  }
11839
11679
 
11840
11680
  declare type TransactionLineItemType = "final" | "pending";
@@ -11858,6 +11698,7 @@ declare class UIComponents {
11858
11698
  * @deprecated Use `applePay` instead.
11859
11699
  */
11860
11700
  applePayButton(tx: Transaction, opts: ApplePayButtonOptions): ApplePayButton;
11701
+ mountElements(): void;
11861
11702
  }
11862
11703
 
11863
11704
  declare interface VendorLonghandProperties<TLength = (string & {}) | 0, TTime = string & {}> {
@@ -41933,6 +41774,99 @@ declare global {
41933
41774
 
41934
41775
 
41935
41776
 
41777
+ declare module "@vitest/expect" {
41778
+ interface MatcherState {
41779
+ environment: string;
41780
+ snapshotState: SnapshotState;
41781
+ task?: Readonly<Test>;
41782
+ }
41783
+ interface ExpectPollOptions {
41784
+ interval?: number;
41785
+ timeout?: number;
41786
+ message?: string;
41787
+ }
41788
+ interface ExpectStatic {
41789
+ assert: Chai.AssertStatic;
41790
+ unreachable: (message?: string) => never;
41791
+ soft: <T>(actual: T, message?: string) => Assertion<T>;
41792
+ poll: <T>(actual: () => T, options?: ExpectPollOptions) => PromisifyAssertion<Awaited<T>>;
41793
+ addEqualityTesters: (testers: Array<Tester>) => void;
41794
+ assertions: (expected: number) => void;
41795
+ hasAssertions: () => void;
41796
+ addSnapshotSerializer: (plugin: Plugin) => void;
41797
+ }
41798
+ interface Assertion<T> {
41799
+ matchSnapshot: SnapshotMatcher<T>;
41800
+ toMatchSnapshot: SnapshotMatcher<T>;
41801
+ toMatchInlineSnapshot: InlineSnapshotMatcher<T>;
41802
+ /**
41803
+ * Checks that an error thrown by a function matches a previously recorded snapshot.
41804
+ *
41805
+ * @param hint - Optional custom error message.
41806
+ *
41807
+ * @example
41808
+ * expect(functionWithError).toThrowErrorMatchingSnapshot();
41809
+ */
41810
+ toThrowErrorMatchingSnapshot: (hint?: string) => void;
41811
+ /**
41812
+ * Checks that an error thrown by a function matches an inline snapshot within the test file.
41813
+ * Useful for keeping snapshots close to the test code.
41814
+ *
41815
+ * @param snapshot - Optional inline snapshot string to match.
41816
+ * @param hint - Optional custom error message.
41817
+ *
41818
+ * @example
41819
+ * const throwError = () => { throw new Error('Error occurred') };
41820
+ * expect(throwError).toThrowErrorMatchingInlineSnapshot(`"Error occurred"`);
41821
+ */
41822
+ toThrowErrorMatchingInlineSnapshot: (snapshot?: string, hint?: string) => void;
41823
+ /**
41824
+ * Compares the received value to a snapshot saved in a specified file.
41825
+ * Useful for cases where snapshot content is large or needs to be shared across tests.
41826
+ *
41827
+ * @param filepath - Path to the snapshot file.
41828
+ * @param hint - Optional custom error message.
41829
+ *
41830
+ * @example
41831
+ * await expect(largeData).toMatchFileSnapshot('path/to/snapshot.json');
41832
+ */
41833
+ toMatchFileSnapshot: (filepath: string, hint?: string) => Promise<void>;
41834
+ }
41835
+ }
41836
+
41837
+
41838
+
41839
+
41840
+ declare module "@vitest/runner" {
41841
+ interface TestContext {
41842
+ /**
41843
+ * `expect` instance bound to the current test.
41844
+ *
41845
+ * This API is useful for running snapshot tests concurrently because global expect cannot track them.
41846
+ */
41847
+ readonly expect: ExpectStatic;
41848
+ /** @internal */
41849
+ _local: boolean;
41850
+ }
41851
+ interface TaskMeta {
41852
+ typecheck?: boolean;
41853
+ benchmark?: boolean;
41854
+ }
41855
+ interface File {
41856
+ prepareDuration?: number;
41857
+ environmentLoad?: number;
41858
+ }
41859
+ interface TaskBase {
41860
+ logs?: UserConsoleLog[];
41861
+ }
41862
+ interface TaskResult {
41863
+ benchmark?: BenchmarkResult;
41864
+ }
41865
+ }
41866
+
41867
+
41868
+
41869
+
41936
41870
  declare namespace Emitter {
41937
41871
  /**
41938
41872
  * Returns a union of all event types, both public and reserved, for the given emitter.
@@ -42062,99 +41996,6 @@ declare namespace EventMap {
42062
41996
 
42063
41997
 
42064
41998
 
42065
- declare module "@vitest/expect" {
42066
- interface MatcherState {
42067
- environment: string;
42068
- snapshotState: SnapshotState;
42069
- task?: Readonly<Test>;
42070
- }
42071
- interface ExpectPollOptions {
42072
- interval?: number;
42073
- timeout?: number;
42074
- message?: string;
42075
- }
42076
- interface ExpectStatic {
42077
- assert: Chai.AssertStatic;
42078
- unreachable: (message?: string) => never;
42079
- soft: <T>(actual: T, message?: string) => Assertion<T>;
42080
- poll: <T>(actual: () => T, options?: ExpectPollOptions) => PromisifyAssertion<Awaited<T>>;
42081
- addEqualityTesters: (testers: Array<Tester>) => void;
42082
- assertions: (expected: number) => void;
42083
- hasAssertions: () => void;
42084
- addSnapshotSerializer: (plugin: Plugin) => void;
42085
- }
42086
- interface Assertion<T> {
42087
- matchSnapshot: SnapshotMatcher<T>;
42088
- toMatchSnapshot: SnapshotMatcher<T>;
42089
- toMatchInlineSnapshot: InlineSnapshotMatcher<T>;
42090
- /**
42091
- * Checks that an error thrown by a function matches a previously recorded snapshot.
42092
- *
42093
- * @param hint - Optional custom error message.
42094
- *
42095
- * @example
42096
- * expect(functionWithError).toThrowErrorMatchingSnapshot();
42097
- */
42098
- toThrowErrorMatchingSnapshot: (hint?: string) => void;
42099
- /**
42100
- * Checks that an error thrown by a function matches an inline snapshot within the test file.
42101
- * Useful for keeping snapshots close to the test code.
42102
- *
42103
- * @param snapshot - Optional inline snapshot string to match.
42104
- * @param hint - Optional custom error message.
42105
- *
42106
- * @example
42107
- * const throwError = () => { throw new Error('Error occurred') };
42108
- * expect(throwError).toThrowErrorMatchingInlineSnapshot(`"Error occurred"`);
42109
- */
42110
- toThrowErrorMatchingInlineSnapshot: (snapshot?: string, hint?: string) => void;
42111
- /**
42112
- * Compares the received value to a snapshot saved in a specified file.
42113
- * Useful for cases where snapshot content is large or needs to be shared across tests.
42114
- *
42115
- * @param filepath - Path to the snapshot file.
42116
- * @param hint - Optional custom error message.
42117
- *
42118
- * @example
42119
- * await expect(largeData).toMatchFileSnapshot('path/to/snapshot.json');
42120
- */
42121
- toMatchFileSnapshot: (filepath: string, hint?: string) => Promise<void>;
42122
- }
42123
- }
42124
-
42125
-
42126
-
42127
-
42128
- declare module "@vitest/runner" {
42129
- interface TestContext {
42130
- /**
42131
- * `expect` instance bound to the current test.
42132
- *
42133
- * This API is useful for running snapshot tests concurrently because global expect cannot track them.
42134
- */
42135
- readonly expect: ExpectStatic;
42136
- /** @internal */
42137
- _local: boolean;
42138
- }
42139
- interface TaskMeta {
42140
- typecheck?: boolean;
42141
- benchmark?: boolean;
42142
- }
42143
- interface File {
42144
- prepareDuration?: number;
42145
- environmentLoad?: number;
42146
- }
42147
- interface TaskBase {
42148
- logs?: UserConsoleLog[];
42149
- }
42150
- interface TaskResult {
42151
- benchmark?: BenchmarkResult;
42152
- }
42153
- }
42154
-
42155
-
42156
-
42157
-
42158
41999
 
42159
42000
  declare namespace buildConnector {
42160
42001
  export type BuildOptions = (ConnectionOptions | TcpNetConnectOpts | IpcNetConnectOpts) & {