@stripe/extensibility-sdk 0.22.4 → 0.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.
Files changed (41) hide show
  1. package/dist/api-surface.d.ts.map +1 -0
  2. package/dist/config-values/generate.cjs +1 -1
  3. package/dist/config-values/generate.d.ts +2 -2
  4. package/dist/config-values/generate.d.ts.map +1 -1
  5. package/dist/config-values/generate.js +1 -1
  6. package/dist/extensibility-sdk-alpha.d.ts +1293 -1
  7. package/dist/extensibility-sdk-beta.d.ts +1293 -1
  8. package/dist/extensibility-sdk-config-values-internal.d.ts +2 -2
  9. package/dist/extensibility-sdk-extensions-alpha.d.ts +56 -77
  10. package/dist/extensibility-sdk-extensions-beta.d.ts +56 -77
  11. package/dist/extensibility-sdk-extensions-internal.d.ts +67 -110
  12. package/dist/extensibility-sdk-extensions-public.d.ts +56 -77
  13. package/dist/extensibility-sdk-internal.d.ts +1304 -1
  14. package/dist/extensibility-sdk-public.d.ts +1293 -1
  15. package/dist/extensions/billing/bill/discount_calculation.d.ts +3 -5
  16. package/dist/extensions/billing/customer_balance_application.d.ts +1 -3
  17. package/dist/extensions/billing/invoice_collection_setting.d.ts +11 -15
  18. package/dist/extensions/billing/prorations.d.ts +21 -30
  19. package/dist/extensions/billing/recurring_billing_item_handling.d.ts +23 -41
  20. package/dist/extensions/billing/types.d.ts +4 -4
  21. package/dist/extensions/core/workflows/custom_action.d.ts +2 -6
  22. package/dist/extensions/extend/workflows/custom_action.d.ts +2 -6
  23. package/dist/index.cjs +2317 -0
  24. package/dist/index.d.ts +2 -1
  25. package/dist/index.d.ts.map +1 -1
  26. package/dist/index.js +2320 -0
  27. package/dist/stdlib/decimal.d.ts +4 -40
  28. package/dist/stdlib/refs.d.ts +7 -21
  29. package/dist/stdlib/scalars.d.ts +16 -71
  30. package/dist/stdlib/type-utils.d.ts +1 -3
  31. package/dist/stdlib/types.d.ts +6 -6
  32. package/dist/tsconfig.build.tsbuildinfo +1 -1
  33. package/package.json +2 -10
  34. package/dist/extensibility-sdk-jsonschema-alpha.d.ts +0 -3
  35. package/dist/extensibility-sdk-jsonschema-beta.d.ts +0 -3
  36. package/dist/extensibility-sdk-jsonschema-internal.d.ts +0 -15
  37. package/dist/extensibility-sdk-jsonschema-public.d.ts +0 -3
  38. package/dist/jsonschema.cjs +0 -18
  39. package/dist/jsonschema.d.ts +0 -2
  40. package/dist/jsonschema.d.ts.map +0 -1
  41. package/dist/jsonschema.js +0 -0
package/dist/index.js CHANGED
@@ -1,3 +1,9 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __export = (target, all) => {
3
+ for (var name in all)
4
+ __defProp(target, name, { get: all[name], enumerable: true });
5
+ };
6
+
1
7
  // src/stdlib/scalars.ts
2
8
  import "@formspec/core";
3
9
  function roundToInteger(value, direction) {
@@ -1423,10 +1429,2324 @@ function _applyConfig(descriptor, inputObject, appCtx) {
1423
1429
  const strategy = appCtx?.clockTime !== void 0 ? createJsonWireToType(appCtx) : _JsonWireToType;
1424
1430
  return _apply(descriptor, strategy, inputObject);
1425
1431
  }
1432
+
1433
+ // src/extensions/billing/index.ts
1434
+ var billing_exports = {};
1435
+ __export(billing_exports, {
1436
+ Bill: () => bill_exports,
1437
+ CustomerBalanceApplication: () => CustomerBalanceApplication,
1438
+ InvoiceCollectionSetting: () => InvoiceCollectionSetting,
1439
+ Prorations: () => Prorations,
1440
+ RecurringBillingItemHandling: () => RecurringBillingItemHandling
1441
+ });
1442
+
1443
+ // src/extensions/billing/bill/index.ts
1444
+ var bill_exports = {};
1445
+ __export(bill_exports, {
1446
+ DiscountCalculation: () => DiscountCalculation
1447
+ });
1448
+
1449
+ // src/extensions/billing/bill/discount_calculation.ts
1450
+ var DiscountCalculation;
1451
+ ((DiscountCalculation2) => {
1452
+ const billingReasonEnumValues = new _ProtoEnum({
1453
+ BILLING_REASON_AUTOMATIC_PENDING_INVOICE_ITEM_INVOICE: "automatic_pending_invoice_item_invoice",
1454
+ BILLING_REASON_MANUAL: "manual",
1455
+ BILLING_REASON_SUBSCRIPTION: "subscription",
1456
+ BILLING_REASON_SUBSCRIPTION_CREATE: "subscription_create",
1457
+ BILLING_REASON_SUBSCRIPTION_CYCLE: "subscription_cycle",
1458
+ BILLING_REASON_SUBSCRIPTION_CANCEL: "subscription_cancel",
1459
+ BILLING_REASON_SUBSCRIPTION_THRESHOLD: "subscription_threshold",
1460
+ BILLING_REASON_SUBSCRIPTION_TRIAL_ENDED: "subscription_trial_ended",
1461
+ BILLING_REASON_SUBSCRIPTION_UPDATE: "subscription_update",
1462
+ BILLING_REASON_UPCOMING: "upcoming",
1463
+ BILLING_REASON_QUOTE_ACCEPT: "quote_accept"
1464
+ });
1465
+ const pricingTierModeEnumValues = new _ProtoEnum({
1466
+ PRICING_TIER_MODE_GRADUATED: "graduated",
1467
+ PRICING_TIER_MODE_VOLUME: "volume"
1468
+ });
1469
+ const priceTypeEnumValues = new _ProtoEnum({
1470
+ PRICE_TYPE_ONE_TIME: "one_time",
1471
+ PRICE_TYPE_RECURRING: "recurring"
1472
+ });
1473
+ const pricingSchemeEnumValues = new _ProtoEnum({
1474
+ PRICING_SCHEME_PER_UNIT: "per_unit",
1475
+ PRICING_SCHEME_TIERED: "tiered"
1476
+ });
1477
+ const usageTypeEnumValues = new _ProtoEnum({
1478
+ USAGE_TYPE_LICENSED: "licensed",
1479
+ USAGE_TYPE_METERED: "metered"
1480
+ });
1481
+ const recurringPriceIntervalEnumValues = new _ProtoEnum({
1482
+ RECURRING_PRICE_INTERVAL_DAY: "day",
1483
+ RECURRING_PRICE_INTERVAL_WEEK: "week",
1484
+ RECURRING_PRICE_INTERVAL_MONTH: "month",
1485
+ RECURRING_PRICE_INTERVAL_YEAR: "year"
1486
+ });
1487
+ const currencyEnumValues = new _ProtoEnum({
1488
+ CURRENCY_AED: "aed",
1489
+ CURRENCY_AFN: "afn",
1490
+ CURRENCY_ALL: "all",
1491
+ CURRENCY_AMD: "amd",
1492
+ CURRENCY_ANG: "ang",
1493
+ CURRENCY_AOA: "aoa",
1494
+ CURRENCY_APT: "apt",
1495
+ CURRENCY_ARB: "arb",
1496
+ CURRENCY_ARS: "ars",
1497
+ CURRENCY_AUD: "aud",
1498
+ CURRENCY_AVAX: "avax",
1499
+ CURRENCY_AWG: "awg",
1500
+ CURRENCY_AZN: "azn",
1501
+ CURRENCY_BAM: "bam",
1502
+ CURRENCY_BBD: "bbd",
1503
+ CURRENCY_BDT: "bdt",
1504
+ CURRENCY_BGN: "bgn",
1505
+ CURRENCY_BHD: "bhd",
1506
+ CURRENCY_BIF: "bif",
1507
+ CURRENCY_BMD: "bmd",
1508
+ CURRENCY_BNB: "bnb",
1509
+ CURRENCY_BND: "bnd",
1510
+ CURRENCY_BOB: "bob",
1511
+ CURRENCY_BOV: "bov",
1512
+ CURRENCY_BRL: "brl",
1513
+ CURRENCY_BSD: "bsd",
1514
+ CURRENCY_BTC: "btc",
1515
+ CURRENCY_BTN: "btn",
1516
+ CURRENCY_BUIDL: "buidl",
1517
+ CURRENCY_BWP: "bwp",
1518
+ CURRENCY_BYN: "byn",
1519
+ CURRENCY_BYR: "byr",
1520
+ CURRENCY_BZD: "bzd",
1521
+ CURRENCY_CAD: "cad",
1522
+ CURRENCY_CDF: "cdf",
1523
+ CURRENCY_CELO: "celo",
1524
+ CURRENCY_CHE: "che",
1525
+ CURRENCY_CHF: "chf",
1526
+ CURRENCY_CHW: "chw",
1527
+ CURRENCY_CLF: "clf",
1528
+ CURRENCY_CLP: "clp",
1529
+ CURRENCY_CNY: "cny",
1530
+ CURRENCY_COP: "cop",
1531
+ CURRENCY_COU: "cou",
1532
+ CURRENCY_CRC: "crc",
1533
+ CURRENCY_CUC: "cuc",
1534
+ CURRENCY_CUP: "cup",
1535
+ CURRENCY_CVE: "cve",
1536
+ CURRENCY_CZK: "czk",
1537
+ CURRENCY_DAI: "dai",
1538
+ CURRENCY_DJF: "djf",
1539
+ CURRENCY_DKK: "dkk",
1540
+ CURRENCY_DOP: "dop",
1541
+ CURRENCY_DZD: "dzd",
1542
+ CURRENCY_EEK: "eek",
1543
+ CURRENCY_EGP: "egp",
1544
+ CURRENCY_ERN: "ern",
1545
+ CURRENCY_ETB: "etb",
1546
+ CURRENCY_ETH: "eth",
1547
+ CURRENCY_EUR: "eur",
1548
+ CURRENCY_EURC: "eurc",
1549
+ CURRENCY_FJD: "fjd",
1550
+ CURRENCY_FKP: "fkp",
1551
+ CURRENCY_FRXUSD: "frxusd",
1552
+ CURRENCY_GBP: "gbp",
1553
+ CURRENCY_GEL: "gel",
1554
+ CURRENCY_GHC: "ghc",
1555
+ CURRENCY_GHS: "ghs",
1556
+ CURRENCY_GIP: "gip",
1557
+ CURRENCY_GMD: "gmd",
1558
+ CURRENCY_GNF: "gnf",
1559
+ CURRENCY_GTQ: "gtq",
1560
+ CURRENCY_GYD: "gyd",
1561
+ CURRENCY_HKD: "hkd",
1562
+ CURRENCY_HNL: "hnl",
1563
+ CURRENCY_HRK: "hrk",
1564
+ CURRENCY_HTG: "htg",
1565
+ CURRENCY_HUF: "huf",
1566
+ CURRENCY_HYPE: "hype",
1567
+ CURRENCY_IDR: "idr",
1568
+ CURRENCY_ILS: "ils",
1569
+ CURRENCY_INR: "inr",
1570
+ CURRENCY_IQD: "iqd",
1571
+ CURRENCY_IRR: "irr",
1572
+ CURRENCY_ISK: "isk",
1573
+ CURRENCY_JMD: "jmd",
1574
+ CURRENCY_JOD: "jod",
1575
+ CURRENCY_JPY: "jpy",
1576
+ CURRENCY_KES: "kes",
1577
+ CURRENCY_KGS: "kgs",
1578
+ CURRENCY_KHR: "khr",
1579
+ CURRENCY_KMF: "kmf",
1580
+ CURRENCY_KPW: "kpw",
1581
+ CURRENCY_KRW: "krw",
1582
+ CURRENCY_KWD: "kwd",
1583
+ CURRENCY_KYD: "kyd",
1584
+ CURRENCY_KZT: "kzt",
1585
+ CURRENCY_LAK: "lak",
1586
+ CURRENCY_LBP: "lbp",
1587
+ CURRENCY_LKR: "lkr",
1588
+ CURRENCY_LRD: "lrd",
1589
+ CURRENCY_LSL: "lsl",
1590
+ CURRENCY_LTL: "ltl",
1591
+ CURRENCY_LVL: "lvl",
1592
+ CURRENCY_LYD: "lyd",
1593
+ CURRENCY_LZD: "lzd",
1594
+ CURRENCY_M: "m",
1595
+ CURRENCY_MAD: "mad",
1596
+ CURRENCY_MDL: "mdl",
1597
+ CURRENCY_MGA: "mga",
1598
+ CURRENCY_MKD: "mkd",
1599
+ CURRENCY_MMK: "mmk",
1600
+ CURRENCY_MNT: "mnt",
1601
+ CURRENCY_MOP: "mop",
1602
+ CURRENCY_MRO: "mro",
1603
+ CURRENCY_MRU: "mru",
1604
+ CURRENCY_MUR: "mur",
1605
+ CURRENCY_MVR: "mvr",
1606
+ CURRENCY_MWK: "mwk",
1607
+ CURRENCY_MXN: "mxn",
1608
+ CURRENCY_MXV: "mxv",
1609
+ CURRENCY_MYR: "myr",
1610
+ CURRENCY_MZN: "mzn",
1611
+ CURRENCY_NAD: "nad",
1612
+ CURRENCY_NGN: "ngn",
1613
+ CURRENCY_NIO: "nio",
1614
+ CURRENCY_NOK: "nok",
1615
+ CURRENCY_NPR: "npr",
1616
+ CURRENCY_NZD: "nzd",
1617
+ CURRENCY_OMR: "omr",
1618
+ CURRENCY_PAB: "pab",
1619
+ CURRENCY_PEN: "pen",
1620
+ CURRENCY_PGK: "pgk",
1621
+ CURRENCY_PHP: "php",
1622
+ CURRENCY_PKR: "pkr",
1623
+ CURRENCY_PLN: "pln",
1624
+ CURRENCY_POL: "pol",
1625
+ CURRENCY_PYG: "pyg",
1626
+ CURRENCY_PYUSD: "pyusd",
1627
+ CURRENCY_QAR: "qar",
1628
+ CURRENCY_RD: "rd",
1629
+ CURRENCY_RE: "re",
1630
+ CURRENCY_RON: "ron",
1631
+ CURRENCY_RSD: "rsd",
1632
+ CURRENCY_RUB: "rub",
1633
+ CURRENCY_RWF: "rwf",
1634
+ CURRENCY_SAR: "sar",
1635
+ CURRENCY_SBD: "sbd",
1636
+ CURRENCY_SCR: "scr",
1637
+ CURRENCY_SDG: "sdg",
1638
+ CURRENCY_SEK: "sek",
1639
+ CURRENCY_SGD: "sgd",
1640
+ CURRENCY_SHP: "shp",
1641
+ CURRENCY_SLE: "sle",
1642
+ CURRENCY_SLL: "sll",
1643
+ CURRENCY_SOL: "sol",
1644
+ CURRENCY_SOS: "sos",
1645
+ CURRENCY_SRD: "srd",
1646
+ CURRENCY_SSP: "ssp",
1647
+ CURRENCY_STD: "std",
1648
+ CURRENCY_STN: "stn",
1649
+ CURRENCY_SUI: "sui",
1650
+ CURRENCY_SVC: "svc",
1651
+ CURRENCY_SYP: "syp",
1652
+ CURRENCY_SZL: "szl",
1653
+ CURRENCY_THB: "thb",
1654
+ CURRENCY_TJS: "tjs",
1655
+ CURRENCY_TMT: "tmt",
1656
+ CURRENCY_TND: "tnd",
1657
+ CURRENCY_TOP: "top",
1658
+ CURRENCY_TRX: "trx",
1659
+ CURRENCY_TRY: "try",
1660
+ CURRENCY_TTD: "ttd",
1661
+ CURRENCY_TWD: "twd",
1662
+ CURRENCY_TZS: "tzs",
1663
+ CURRENCY_UAH: "uah",
1664
+ CURRENCY_UGX: "ugx",
1665
+ CURRENCY_USD: "usd",
1666
+ CURRENCY_USDB: "usdb",
1667
+ CURRENCY_USDC: "usdc",
1668
+ CURRENCY_USDG: "usdg",
1669
+ CURRENCY_USDP: "usdp",
1670
+ CURRENCY_USDT: "usdt",
1671
+ CURRENCY_USN: "usn",
1672
+ CURRENCY_USTB: "ustb",
1673
+ CURRENCY_UYI: "uyi",
1674
+ CURRENCY_UYU: "uyu",
1675
+ CURRENCY_UZS: "uzs",
1676
+ CURRENCY_VEF: "vef",
1677
+ CURRENCY_VES: "ves",
1678
+ CURRENCY_VND: "vnd",
1679
+ CURRENCY_VUV: "vuv",
1680
+ CURRENCY_WST: "wst",
1681
+ CURRENCY_XAF: "xaf",
1682
+ CURRENCY_XCD: "xcd",
1683
+ CURRENCY_XCG: "xcg",
1684
+ CURRENCY_XEUR: "xeur",
1685
+ CURRENCY_XLM: "xlm",
1686
+ CURRENCY_XOF: "xof",
1687
+ CURRENCY_XPF: "xpf",
1688
+ CURRENCY_XPL: "xpl",
1689
+ CURRENCY_XUSD: "xusd",
1690
+ CURRENCY_YER: "yer",
1691
+ CURRENCY_ZAR: "zar",
1692
+ CURRENCY_ZMK: "zmk",
1693
+ CURRENCY_ZMW: "zmw",
1694
+ CURRENCY_ZWD: "zwd",
1695
+ CURRENCY_ZWG: "zwg",
1696
+ CURRENCY_ZWL: "zwl"
1697
+ });
1698
+ const DiscountResultDescriptor = new _ShapeDescriptor(
1699
+ "DiscountResult",
1700
+ [
1701
+ {
1702
+ type: "discount",
1703
+ transform: _required(_translateShape(() => DiscountDescriptor))
1704
+ }
1705
+ ]
1706
+ );
1707
+ const DiscountDescriptor = new _ShapeDescriptor("Discount", [
1708
+ {
1709
+ type: "amount",
1710
+ transform: _required(_translateShape(() => MonetaryAmountDescriptor))
1711
+ }
1712
+ ]);
1713
+ const DiscountableItemDescriptor = new _ShapeDescriptor(
1714
+ "DiscountableItem",
1715
+ [
1716
+ {
1717
+ type: "lineItems",
1718
+ transform: _required(
1719
+ _translateArray(_translateShape(() => DiscountableLineItemDescriptor))
1720
+ )
1721
+ },
1722
+ {
1723
+ type: "grossAmount",
1724
+ transform: _required(_translateShape(() => MonetaryAmountDescriptor))
1725
+ },
1726
+ { type: "customer", transform: _translateShape(() => CustomerDescriptor) },
1727
+ { type: "billingReason", transform: _translateEnum(billingReasonEnumValues) },
1728
+ { type: "subscription", transform: _translateShape(() => SubscriptionDescriptor) }
1729
+ ]
1730
+ );
1731
+ const SubscriptionDescriptor = new _ShapeDescriptor(
1732
+ "Subscription",
1733
+ [
1734
+ { type: "id", transform: _required() },
1735
+ { type: "billingCycleAnchor", transform: _identity },
1736
+ {
1737
+ type: "billingCycleAnchorConfig",
1738
+ transform: _translateShape(() => BillingCycleAnchorConfigDescriptor)
1739
+ },
1740
+ { type: "metadata", transform: _required(_translateMap(_identity, _identity)) }
1741
+ ]
1742
+ );
1743
+ const BillingCycleAnchorConfigDescriptor = new _ShapeDescriptor("BillingCycleAnchorConfig", [
1744
+ { type: "month", transform: _required() },
1745
+ { type: "dayOfMonth", transform: _required() },
1746
+ { type: "hour", transform: _required() },
1747
+ { type: "minute", transform: _required() },
1748
+ { type: "second", transform: _required() }
1749
+ ]);
1750
+ const CustomerDescriptor = new _ShapeDescriptor("Customer", [
1751
+ { type: "id", transform: _required() },
1752
+ { type: "metadata", transform: _required(_translateMap(_identity, _identity)) }
1753
+ ]);
1754
+ const DiscountableLineItemDescriptor = new _ShapeDescriptor(
1755
+ "DiscountableLineItem",
1756
+ [
1757
+ {
1758
+ type: "subtotal",
1759
+ transform: _required(_translateShape(() => MonetaryAmountDescriptor))
1760
+ },
1761
+ { type: "quantity", transform: _translateDecimal },
1762
+ {
1763
+ type: "period",
1764
+ transform: _required(_translateUnion(() => AnyTimeRangeDescriptor))
1765
+ },
1766
+ { type: "price", transform: _translateShape(() => PriceDescriptor) }
1767
+ ]
1768
+ );
1769
+ const PriceDescriptor = new _ShapeDescriptor("Price", [
1770
+ { type: "id", transform: _required() },
1771
+ { type: "product", transform: _translateShape(() => ProductDescriptor) },
1772
+ { type: "recurring", transform: _translateShape(() => RecurringPriceDescriptor) },
1773
+ { type: "billingScheme", transform: _translateEnum(pricingSchemeEnumValues) },
1774
+ {
1775
+ type: "tiers",
1776
+ transform: _required(_translateArray(_translateShape(() => PriceTierDescriptor)))
1777
+ },
1778
+ { type: "type", transform: _translateEnum(priceTypeEnumValues) },
1779
+ { type: "tiersMode", transform: _translateEnum(pricingTierModeEnumValues) },
1780
+ { type: "metadata", transform: _required(_translateMap(_identity, _identity)) },
1781
+ { type: "unitAmount", transform: _translateDecimal }
1782
+ ]);
1783
+ const PriceTierDescriptor = new _ShapeDescriptor(
1784
+ "PriceTier",
1785
+ [
1786
+ { type: "flatAmount", transform: _translateDecimal },
1787
+ { type: "unitAmount", transform: _translateDecimal },
1788
+ { type: "upTo", transform: _translateDecimal }
1789
+ ]
1790
+ );
1791
+ const RecurringPriceDescriptor = new _ShapeDescriptor(
1792
+ "RecurringPrice",
1793
+ [
1794
+ {
1795
+ type: "interval",
1796
+ transform: _required(_translateEnum(recurringPriceIntervalEnumValues))
1797
+ },
1798
+ { type: "intervalCount", transform: _required() },
1799
+ { type: "usageType", transform: _translateEnum(usageTypeEnumValues) },
1800
+ { type: "meter", transform: _identity }
1801
+ ]
1802
+ );
1803
+ const ProductDescriptor = new _ShapeDescriptor("Product", [
1804
+ { type: "id", transform: _required() },
1805
+ { type: "name", transform: _required() },
1806
+ { type: "metadata", transform: _required(_translateMap(_identity, _identity)) }
1807
+ ]);
1808
+ const MonetaryAmountDescriptor = new _ShapeDescriptor("MonetaryAmount", [
1809
+ { type: "amount", transform: _required(_translateDecimal) },
1810
+ { type: "currency", transform: _required(_translateEnum(currencyEnumValues)) }
1811
+ ]);
1812
+ const AnyTimeRangeDescriptor = new _UnionDescriptor(
1813
+ "AnyTimeRange",
1814
+ "value",
1815
+ [
1816
+ {
1817
+ wireKey: "oneTime",
1818
+ typeKey: "oneTime",
1819
+ shape: [{ type: "at", transform: _required(_translateDateTime) }]
1820
+ },
1821
+ {
1822
+ wireKey: "timeRange",
1823
+ typeKey: "timeRange",
1824
+ shape: [
1825
+ { type: "startDate", transform: _required(_translateDateTime) },
1826
+ { type: "endDate", transform: _required(_translateDateTime) }
1827
+ ]
1828
+ }
1829
+ ]
1830
+ );
1831
+ let __stripe_shim_active__ = false;
1832
+ function prepareArgsComputeDiscounts(proto) {
1833
+ if (__stripe_shim_active__) {
1834
+ return proto;
1835
+ }
1836
+ return _apply(
1837
+ DiscountableItemDescriptor,
1838
+ _ProtoWireToType,
1839
+ proto
1840
+ );
1841
+ }
1842
+ DiscountCalculation2.prepareArgsComputeDiscounts = prepareArgsComputeDiscounts;
1843
+ function prepareResultComputeDiscounts(result) {
1844
+ if (__stripe_shim_active__) return result;
1845
+ return _apply(
1846
+ DiscountResultDescriptor,
1847
+ _TypeToProtoWire,
1848
+ result
1849
+ );
1850
+ }
1851
+ DiscountCalculation2.prepareResultComputeDiscounts = prepareResultComputeDiscounts;
1852
+ function $platformWrapComputeDiscounts(configTransformer) {
1853
+ return (cls, wireArgs, wireConfig, ctx) => {
1854
+ __stripe_shim_active__ = true;
1855
+ const instance = new cls();
1856
+ const request = _apply(
1857
+ DiscountableItemDescriptor,
1858
+ _ProtoWireToType,
1859
+ wireArgs
1860
+ );
1861
+ const config = configTransformer !== void 0 ? configTransformer(wireConfig, _configAppContextFromContext(ctx)) : wireConfig;
1862
+ const result = instance.computeDiscounts(request, config, ctx);
1863
+ if (_isPromiseLike(result)) {
1864
+ return Promise.resolve(result).then((r) => {
1865
+ const typedR = r;
1866
+ return _apply(DiscountResultDescriptor, _TypeToProtoWire, typedR);
1867
+ });
1868
+ }
1869
+ const typedResult = result;
1870
+ return _apply(DiscountResultDescriptor, _TypeToProtoWire, typedResult);
1871
+ };
1872
+ }
1873
+ DiscountCalculation2.$platformWrapComputeDiscounts = $platformWrapComputeDiscounts;
1874
+ const _prepareArgsAlias = prepareArgsComputeDiscounts;
1875
+ DiscountCalculation2.prepareArgs = _prepareArgsAlias;
1876
+ const _prepareResultAlias = prepareResultComputeDiscounts;
1877
+ DiscountCalculation2.prepareResult = _prepareResultAlias;
1878
+ })(DiscountCalculation || (DiscountCalculation = {}));
1879
+
1880
+ // src/extensions/billing/customer_balance_application.ts
1881
+ var CustomerBalanceApplication;
1882
+ ((CustomerBalanceApplication2) => {
1883
+ const currencyEnumValues = new _ProtoEnum({
1884
+ CURRENCY_AED: "aed",
1885
+ CURRENCY_AFN: "afn",
1886
+ CURRENCY_ALL: "all",
1887
+ CURRENCY_AMD: "amd",
1888
+ CURRENCY_ANG: "ang",
1889
+ CURRENCY_AOA: "aoa",
1890
+ CURRENCY_APT: "apt",
1891
+ CURRENCY_ARB: "arb",
1892
+ CURRENCY_ARS: "ars",
1893
+ CURRENCY_AUD: "aud",
1894
+ CURRENCY_AVAX: "avax",
1895
+ CURRENCY_AWG: "awg",
1896
+ CURRENCY_AZN: "azn",
1897
+ CURRENCY_BAM: "bam",
1898
+ CURRENCY_BBD: "bbd",
1899
+ CURRENCY_BDT: "bdt",
1900
+ CURRENCY_BGN: "bgn",
1901
+ CURRENCY_BHD: "bhd",
1902
+ CURRENCY_BIF: "bif",
1903
+ CURRENCY_BMD: "bmd",
1904
+ CURRENCY_BNB: "bnb",
1905
+ CURRENCY_BND: "bnd",
1906
+ CURRENCY_BOB: "bob",
1907
+ CURRENCY_BOV: "bov",
1908
+ CURRENCY_BRL: "brl",
1909
+ CURRENCY_BSD: "bsd",
1910
+ CURRENCY_BTC: "btc",
1911
+ CURRENCY_BTN: "btn",
1912
+ CURRENCY_BUIDL: "buidl",
1913
+ CURRENCY_BWP: "bwp",
1914
+ CURRENCY_BYN: "byn",
1915
+ CURRENCY_BYR: "byr",
1916
+ CURRENCY_BZD: "bzd",
1917
+ CURRENCY_CAD: "cad",
1918
+ CURRENCY_CDF: "cdf",
1919
+ CURRENCY_CELO: "celo",
1920
+ CURRENCY_CHE: "che",
1921
+ CURRENCY_CHF: "chf",
1922
+ CURRENCY_CHW: "chw",
1923
+ CURRENCY_CLF: "clf",
1924
+ CURRENCY_CLP: "clp",
1925
+ CURRENCY_CNY: "cny",
1926
+ CURRENCY_COP: "cop",
1927
+ CURRENCY_COU: "cou",
1928
+ CURRENCY_CRC: "crc",
1929
+ CURRENCY_CUC: "cuc",
1930
+ CURRENCY_CUP: "cup",
1931
+ CURRENCY_CVE: "cve",
1932
+ CURRENCY_CZK: "czk",
1933
+ CURRENCY_DAI: "dai",
1934
+ CURRENCY_DJF: "djf",
1935
+ CURRENCY_DKK: "dkk",
1936
+ CURRENCY_DOP: "dop",
1937
+ CURRENCY_DZD: "dzd",
1938
+ CURRENCY_EEK: "eek",
1939
+ CURRENCY_EGP: "egp",
1940
+ CURRENCY_ERN: "ern",
1941
+ CURRENCY_ETB: "etb",
1942
+ CURRENCY_ETH: "eth",
1943
+ CURRENCY_EUR: "eur",
1944
+ CURRENCY_EURC: "eurc",
1945
+ CURRENCY_FJD: "fjd",
1946
+ CURRENCY_FKP: "fkp",
1947
+ CURRENCY_FRXUSD: "frxusd",
1948
+ CURRENCY_GBP: "gbp",
1949
+ CURRENCY_GEL: "gel",
1950
+ CURRENCY_GHC: "ghc",
1951
+ CURRENCY_GHS: "ghs",
1952
+ CURRENCY_GIP: "gip",
1953
+ CURRENCY_GMD: "gmd",
1954
+ CURRENCY_GNF: "gnf",
1955
+ CURRENCY_GTQ: "gtq",
1956
+ CURRENCY_GYD: "gyd",
1957
+ CURRENCY_HKD: "hkd",
1958
+ CURRENCY_HNL: "hnl",
1959
+ CURRENCY_HRK: "hrk",
1960
+ CURRENCY_HTG: "htg",
1961
+ CURRENCY_HUF: "huf",
1962
+ CURRENCY_HYPE: "hype",
1963
+ CURRENCY_IDR: "idr",
1964
+ CURRENCY_ILS: "ils",
1965
+ CURRENCY_INR: "inr",
1966
+ CURRENCY_IQD: "iqd",
1967
+ CURRENCY_IRR: "irr",
1968
+ CURRENCY_ISK: "isk",
1969
+ CURRENCY_JMD: "jmd",
1970
+ CURRENCY_JOD: "jod",
1971
+ CURRENCY_JPY: "jpy",
1972
+ CURRENCY_KES: "kes",
1973
+ CURRENCY_KGS: "kgs",
1974
+ CURRENCY_KHR: "khr",
1975
+ CURRENCY_KMF: "kmf",
1976
+ CURRENCY_KPW: "kpw",
1977
+ CURRENCY_KRW: "krw",
1978
+ CURRENCY_KWD: "kwd",
1979
+ CURRENCY_KYD: "kyd",
1980
+ CURRENCY_KZT: "kzt",
1981
+ CURRENCY_LAK: "lak",
1982
+ CURRENCY_LBP: "lbp",
1983
+ CURRENCY_LKR: "lkr",
1984
+ CURRENCY_LRD: "lrd",
1985
+ CURRENCY_LSL: "lsl",
1986
+ CURRENCY_LTL: "ltl",
1987
+ CURRENCY_LVL: "lvl",
1988
+ CURRENCY_LYD: "lyd",
1989
+ CURRENCY_LZD: "lzd",
1990
+ CURRENCY_M: "m",
1991
+ CURRENCY_MAD: "mad",
1992
+ CURRENCY_MDL: "mdl",
1993
+ CURRENCY_MGA: "mga",
1994
+ CURRENCY_MKD: "mkd",
1995
+ CURRENCY_MMK: "mmk",
1996
+ CURRENCY_MNT: "mnt",
1997
+ CURRENCY_MOP: "mop",
1998
+ CURRENCY_MRO: "mro",
1999
+ CURRENCY_MRU: "mru",
2000
+ CURRENCY_MUR: "mur",
2001
+ CURRENCY_MVR: "mvr",
2002
+ CURRENCY_MWK: "mwk",
2003
+ CURRENCY_MXN: "mxn",
2004
+ CURRENCY_MXV: "mxv",
2005
+ CURRENCY_MYR: "myr",
2006
+ CURRENCY_MZN: "mzn",
2007
+ CURRENCY_NAD: "nad",
2008
+ CURRENCY_NGN: "ngn",
2009
+ CURRENCY_NIO: "nio",
2010
+ CURRENCY_NOK: "nok",
2011
+ CURRENCY_NPR: "npr",
2012
+ CURRENCY_NZD: "nzd",
2013
+ CURRENCY_OMR: "omr",
2014
+ CURRENCY_PAB: "pab",
2015
+ CURRENCY_PEN: "pen",
2016
+ CURRENCY_PGK: "pgk",
2017
+ CURRENCY_PHP: "php",
2018
+ CURRENCY_PKR: "pkr",
2019
+ CURRENCY_PLN: "pln",
2020
+ CURRENCY_POL: "pol",
2021
+ CURRENCY_PYG: "pyg",
2022
+ CURRENCY_PYUSD: "pyusd",
2023
+ CURRENCY_QAR: "qar",
2024
+ CURRENCY_RD: "rd",
2025
+ CURRENCY_RE: "re",
2026
+ CURRENCY_RON: "ron",
2027
+ CURRENCY_RSD: "rsd",
2028
+ CURRENCY_RUB: "rub",
2029
+ CURRENCY_RWF: "rwf",
2030
+ CURRENCY_SAR: "sar",
2031
+ CURRENCY_SBD: "sbd",
2032
+ CURRENCY_SCR: "scr",
2033
+ CURRENCY_SDG: "sdg",
2034
+ CURRENCY_SEK: "sek",
2035
+ CURRENCY_SGD: "sgd",
2036
+ CURRENCY_SHP: "shp",
2037
+ CURRENCY_SLE: "sle",
2038
+ CURRENCY_SLL: "sll",
2039
+ CURRENCY_SOL: "sol",
2040
+ CURRENCY_SOS: "sos",
2041
+ CURRENCY_SRD: "srd",
2042
+ CURRENCY_SSP: "ssp",
2043
+ CURRENCY_STD: "std",
2044
+ CURRENCY_STN: "stn",
2045
+ CURRENCY_SUI: "sui",
2046
+ CURRENCY_SVC: "svc",
2047
+ CURRENCY_SYP: "syp",
2048
+ CURRENCY_SZL: "szl",
2049
+ CURRENCY_THB: "thb",
2050
+ CURRENCY_TJS: "tjs",
2051
+ CURRENCY_TMT: "tmt",
2052
+ CURRENCY_TND: "tnd",
2053
+ CURRENCY_TOP: "top",
2054
+ CURRENCY_TRX: "trx",
2055
+ CURRENCY_TRY: "try",
2056
+ CURRENCY_TTD: "ttd",
2057
+ CURRENCY_TWD: "twd",
2058
+ CURRENCY_TZS: "tzs",
2059
+ CURRENCY_UAH: "uah",
2060
+ CURRENCY_UGX: "ugx",
2061
+ CURRENCY_USD: "usd",
2062
+ CURRENCY_USDB: "usdb",
2063
+ CURRENCY_USDC: "usdc",
2064
+ CURRENCY_USDG: "usdg",
2065
+ CURRENCY_USDP: "usdp",
2066
+ CURRENCY_USDT: "usdt",
2067
+ CURRENCY_USN: "usn",
2068
+ CURRENCY_USTB: "ustb",
2069
+ CURRENCY_UYI: "uyi",
2070
+ CURRENCY_UYU: "uyu",
2071
+ CURRENCY_UZS: "uzs",
2072
+ CURRENCY_VEF: "vef",
2073
+ CURRENCY_VES: "ves",
2074
+ CURRENCY_VND: "vnd",
2075
+ CURRENCY_VUV: "vuv",
2076
+ CURRENCY_WST: "wst",
2077
+ CURRENCY_XAF: "xaf",
2078
+ CURRENCY_XCD: "xcd",
2079
+ CURRENCY_XCG: "xcg",
2080
+ CURRENCY_XEUR: "xeur",
2081
+ CURRENCY_XLM: "xlm",
2082
+ CURRENCY_XOF: "xof",
2083
+ CURRENCY_XPF: "xpf",
2084
+ CURRENCY_XPL: "xpl",
2085
+ CURRENCY_XUSD: "xusd",
2086
+ CURRENCY_YER: "yer",
2087
+ CURRENCY_ZAR: "zar",
2088
+ CURRENCY_ZMK: "zmk",
2089
+ CURRENCY_ZMW: "zmw",
2090
+ CURRENCY_ZWD: "zwd",
2091
+ CURRENCY_ZWG: "zwg",
2092
+ CURRENCY_ZWL: "zwl"
2093
+ });
2094
+ const CustomerBalanceApplicationResultDescriptor = new _ShapeDescriptor("CustomerBalanceApplicationResult", [
2095
+ {
2096
+ type: "appliedCustomerBalance",
2097
+ transform: _required(_translateShape(() => MonetaryAmountDescriptor))
2098
+ }
2099
+ ]);
2100
+ const CustomerBalanceApplicationInputDescriptor = new _ShapeDescriptor("CustomerBalanceApplicationInput", [
2101
+ {
2102
+ type: "totalAmount",
2103
+ transform: _required(_translateShape(() => MonetaryAmountDescriptor))
2104
+ },
2105
+ {
2106
+ type: "customerBalance",
2107
+ transform: _required(_translateShape(() => MonetaryAmountDescriptor))
2108
+ }
2109
+ ]);
2110
+ const MonetaryAmountDescriptor = new _ShapeDescriptor("MonetaryAmount", [
2111
+ { type: "amount", transform: _required(_translateDecimal) },
2112
+ { type: "currency", transform: _required(_translateEnum(currencyEnumValues)) }
2113
+ ]);
2114
+ let __stripe_shim_active__ = false;
2115
+ function prepareArgsComputeAppliedCustomerBalance(proto) {
2116
+ if (__stripe_shim_active__) {
2117
+ return proto;
2118
+ }
2119
+ return _apply(
2120
+ CustomerBalanceApplicationInputDescriptor,
2121
+ _ProtoWireToType,
2122
+ proto
2123
+ );
2124
+ }
2125
+ CustomerBalanceApplication2.prepareArgsComputeAppliedCustomerBalance = prepareArgsComputeAppliedCustomerBalance;
2126
+ function prepareResultComputeAppliedCustomerBalance(result) {
2127
+ if (__stripe_shim_active__) return result;
2128
+ return _apply(
2129
+ CustomerBalanceApplicationResultDescriptor,
2130
+ _TypeToProtoWire,
2131
+ result
2132
+ );
2133
+ }
2134
+ CustomerBalanceApplication2.prepareResultComputeAppliedCustomerBalance = prepareResultComputeAppliedCustomerBalance;
2135
+ function $platformWrapComputeAppliedCustomerBalance(configTransformer) {
2136
+ return (cls, wireArgs, wireConfig, ctx) => {
2137
+ __stripe_shim_active__ = true;
2138
+ const instance = new cls();
2139
+ const request = _apply(
2140
+ CustomerBalanceApplicationInputDescriptor,
2141
+ _ProtoWireToType,
2142
+ wireArgs
2143
+ );
2144
+ const config = configTransformer !== void 0 ? configTransformer(wireConfig, _configAppContextFromContext(ctx)) : wireConfig;
2145
+ const result = instance.computeAppliedCustomerBalance(request, config, ctx);
2146
+ if (_isPromiseLike(result)) {
2147
+ return Promise.resolve(result).then((r) => {
2148
+ const typedR = r;
2149
+ return _apply(
2150
+ CustomerBalanceApplicationResultDescriptor,
2151
+ _TypeToProtoWire,
2152
+ typedR
2153
+ );
2154
+ });
2155
+ }
2156
+ const typedResult = result;
2157
+ return _apply(
2158
+ CustomerBalanceApplicationResultDescriptor,
2159
+ _TypeToProtoWire,
2160
+ typedResult
2161
+ );
2162
+ };
2163
+ }
2164
+ CustomerBalanceApplication2.$platformWrapComputeAppliedCustomerBalance = $platformWrapComputeAppliedCustomerBalance;
2165
+ const _prepareArgsAlias = prepareArgsComputeAppliedCustomerBalance;
2166
+ CustomerBalanceApplication2.prepareArgs = _prepareArgsAlias;
2167
+ const _prepareResultAlias = prepareResultComputeAppliedCustomerBalance;
2168
+ CustomerBalanceApplication2.prepareResult = _prepareResultAlias;
2169
+ })(CustomerBalanceApplication || (CustomerBalanceApplication = {}));
2170
+
2171
+ // src/extensions/billing/invoice_collection_setting.ts
2172
+ var InvoiceCollectionSetting;
2173
+ ((InvoiceCollectionSetting2) => {
2174
+ const parentTypeEnumValues = new _ProtoEnum({
2175
+ PARENT_TYPE_SUBSCRIPTION: "subscription",
2176
+ PARENT_TYPE_CONTRACT: "contract",
2177
+ PARENT_TYPE_QUOTE: "quote",
2178
+ PARENT_TYPE_BILLING_CADENCE: "billing_cadence",
2179
+ PARENT_TYPE_SUBSCRIPTION_SCHEDULE: "subscription_schedule",
2180
+ PARENT_TYPE_STANDALONE: "standalone"
2181
+ });
2182
+ const paymentMethodTypeEnumValues = new _ProtoEnum({
2183
+ PAYMENT_METHOD_TYPE_CARD: "card",
2184
+ PAYMENT_METHOD_TYPE_ACH_DEBIT: "ach_debit",
2185
+ PAYMENT_METHOD_TYPE_ACH_CREDIT_TRANSFER: "ach_credit_transfer",
2186
+ PAYMENT_METHOD_TYPE_SEPA_DEBIT: "sepa_debit",
2187
+ PAYMENT_METHOD_TYPE_SEPA_CREDIT_TRANSFER: "sepa_credit_transfer",
2188
+ PAYMENT_METHOD_TYPE_BACS_DEBIT: "bacs_debit",
2189
+ PAYMENT_METHOD_TYPE_AU_BECS_DEBIT: "au_becs_debit",
2190
+ PAYMENT_METHOD_TYPE_US_BANK_ACCOUNT: "us_bank_account",
2191
+ PAYMENT_METHOD_TYPE_LINK: "link",
2192
+ PAYMENT_METHOD_TYPE_BOLETO: "boleto",
2193
+ PAYMENT_METHOD_TYPE_OXXO: "oxxo",
2194
+ PAYMENT_METHOD_TYPE_IDEAL: "ideal",
2195
+ PAYMENT_METHOD_TYPE_BANCONTACT: "bancontact",
2196
+ PAYMENT_METHOD_TYPE_GIROPAY: "giropay",
2197
+ PAYMENT_METHOD_TYPE_EPS: "eps",
2198
+ PAYMENT_METHOD_TYPE_P24: "p24",
2199
+ PAYMENT_METHOD_TYPE_SOFORT: "sofort",
2200
+ PAYMENT_METHOD_TYPE_ALIPAY: "alipay",
2201
+ PAYMENT_METHOD_TYPE_WECHAT_PAY: "wechat_pay",
2202
+ PAYMENT_METHOD_TYPE_KLARNA: "klarna",
2203
+ PAYMENT_METHOD_TYPE_AFFIRM: "affirm",
2204
+ PAYMENT_METHOD_TYPE_AFTERPAY_CLEARPAY: "afterpay_clearpay",
2205
+ PAYMENT_METHOD_TYPE_CASHAPP: "cashapp",
2206
+ PAYMENT_METHOD_TYPE_PAYPAL: "paypal",
2207
+ PAYMENT_METHOD_TYPE_MULTIBANCO: "multibanco",
2208
+ PAYMENT_METHOD_TYPE_KONBINI: "konbini",
2209
+ PAYMENT_METHOD_TYPE_PROMPTPAY: "promptpay",
2210
+ PAYMENT_METHOD_TYPE_PAYNOW: "paynow",
2211
+ PAYMENT_METHOD_TYPE_GRABPAY: "grabpay",
2212
+ PAYMENT_METHOD_TYPE_FPX: "fpx"
2213
+ });
2214
+ const collectionMethodEnumValues = new _ProtoEnum({
2215
+ COLLECTION_METHOD_SEND_INVOICE: "send_invoice",
2216
+ COLLECTION_METHOD_CHARGE_AUTOMATICALLY: "charge_automatically"
2217
+ });
2218
+ const InvoiceCollectionResponseDescriptor = new _ShapeDescriptor("InvoiceCollectionResponse", [
2219
+ { type: "autoAdvance", transform: _identity }
2220
+ ]);
2221
+ const InvoiceCollectionRequestDescriptor = new _ShapeDescriptor(
2222
+ "InvoiceCollectionRequest",
2223
+ [
2224
+ {
2225
+ type: "collectionSettings",
2226
+ transform: _required(_translateShape(() => CollectionSettingsDescriptor))
2227
+ },
2228
+ { type: "parent", transform: _required(_translateShape(() => ParentDescriptor)) }
2229
+ ],
2230
+ [
2231
+ {
2232
+ discriminant: "payer",
2233
+ optional: false,
2234
+ branches: [
2235
+ {
2236
+ wireKey: "customer",
2237
+ typeKey: "customer",
2238
+ transform: _translateShape(() => CustomerDescriptor)
2239
+ }
2240
+ ]
2241
+ }
2242
+ ]
2243
+ );
2244
+ const CustomerDescriptor = new _ShapeDescriptor("Customer", [
2245
+ { type: "id", transform: _required() },
2246
+ { type: "metadata", transform: _required(_translateMap(_identity, _identity)) }
2247
+ ]);
2248
+ const ParentDescriptor = new _ShapeDescriptor("Parent", [
2249
+ { type: "type", transform: _required(_translateEnum(parentTypeEnumValues)) },
2250
+ { type: "metadata", transform: _required(_translateMap(_identity, _identity)) }
2251
+ ]);
2252
+ const CollectionSettingsDescriptor = new _ShapeDescriptor(
2253
+ "CollectionSettings",
2254
+ [
2255
+ { type: "autoAdvance", transform: _required() },
2256
+ {
2257
+ type: "collectionMethod",
2258
+ transform: _required(_translateEnum(collectionMethodEnumValues))
2259
+ },
2260
+ { type: "finalizationGracePeriod", transform: _required() },
2261
+ {
2262
+ type: "paymentMethods",
2263
+ transform: _required(
2264
+ _translateArray(_translateEnum(paymentMethodTypeEnumValues))
2265
+ )
2266
+ }
2267
+ ]
2268
+ );
2269
+ let __stripe_shim_active__ = false;
2270
+ function prepareArgsCollectionOverride(proto) {
2271
+ if (__stripe_shim_active__) {
2272
+ return proto;
2273
+ }
2274
+ return _apply(
2275
+ InvoiceCollectionRequestDescriptor,
2276
+ _ProtoWireToType,
2277
+ proto
2278
+ );
2279
+ }
2280
+ InvoiceCollectionSetting2.prepareArgsCollectionOverride = prepareArgsCollectionOverride;
2281
+ function prepareResultCollectionOverride(result) {
2282
+ if (__stripe_shim_active__) return result;
2283
+ return _apply(
2284
+ InvoiceCollectionResponseDescriptor,
2285
+ _TypeToProtoWire,
2286
+ result
2287
+ );
2288
+ }
2289
+ InvoiceCollectionSetting2.prepareResultCollectionOverride = prepareResultCollectionOverride;
2290
+ function $platformWrapCollectionOverride(configTransformer) {
2291
+ return (cls, wireArgs, wireConfig, ctx) => {
2292
+ __stripe_shim_active__ = true;
2293
+ const instance = new cls();
2294
+ const request = _apply(
2295
+ InvoiceCollectionRequestDescriptor,
2296
+ _ProtoWireToType,
2297
+ wireArgs
2298
+ );
2299
+ const config = configTransformer !== void 0 ? configTransformer(wireConfig, _configAppContextFromContext(ctx)) : wireConfig;
2300
+ const result = instance.collectionOverride(request, config, ctx);
2301
+ if (_isPromiseLike(result)) {
2302
+ return Promise.resolve(result).then((r) => {
2303
+ const typedR = r;
2304
+ return _apply(InvoiceCollectionResponseDescriptor, _TypeToProtoWire, typedR);
2305
+ });
2306
+ }
2307
+ const typedResult = result;
2308
+ return _apply(InvoiceCollectionResponseDescriptor, _TypeToProtoWire, typedResult);
2309
+ };
2310
+ }
2311
+ InvoiceCollectionSetting2.$platformWrapCollectionOverride = $platformWrapCollectionOverride;
2312
+ const _prepareArgsAlias = prepareArgsCollectionOverride;
2313
+ InvoiceCollectionSetting2.prepareArgs = _prepareArgsAlias;
2314
+ const _prepareResultAlias = prepareResultCollectionOverride;
2315
+ InvoiceCollectionSetting2.prepareResult = _prepareResultAlias;
2316
+ })(InvoiceCollectionSetting || (InvoiceCollectionSetting = {}));
2317
+
2318
+ // src/extensions/billing/prorations.ts
2319
+ var Prorations;
2320
+ ((Prorations2) => {
2321
+ const pricingTierModeEnumValues = new _ProtoEnum({
2322
+ PRICING_TIER_MODE_GRADUATED: "graduated",
2323
+ PRICING_TIER_MODE_VOLUME: "volume"
2324
+ });
2325
+ const recurringPriceIntervalEnumValues = new _ProtoEnum({
2326
+ RECURRING_PRICE_INTERVAL_DAY: "day",
2327
+ RECURRING_PRICE_INTERVAL_WEEK: "week",
2328
+ RECURRING_PRICE_INTERVAL_MONTH: "month",
2329
+ RECURRING_PRICE_INTERVAL_YEAR: "year"
2330
+ });
2331
+ const priceTypeEnumValues = new _ProtoEnum({
2332
+ PRICE_TYPE_ONE_TIME: "one_time",
2333
+ PRICE_TYPE_RECURRING: "recurring"
2334
+ });
2335
+ const pricingSchemeEnumValues = new _ProtoEnum({
2336
+ PRICING_SCHEME_PER_UNIT: "per_unit",
2337
+ PRICING_SCHEME_TIERED: "tiered"
2338
+ });
2339
+ const usageTypeEnumValues = new _ProtoEnum({
2340
+ USAGE_TYPE_LICENSED: "licensed",
2341
+ USAGE_TYPE_METERED: "metered"
2342
+ });
2343
+ const itemTypeEnumValues = new _ProtoEnum({
2344
+ ITEM_TYPE_CREDIT: "credit",
2345
+ ITEM_TYPE_DEBIT: "debit"
2346
+ });
2347
+ const currencyEnumValues = new _ProtoEnum({
2348
+ CURRENCY_AED: "aed",
2349
+ CURRENCY_AFN: "afn",
2350
+ CURRENCY_ALL: "all",
2351
+ CURRENCY_AMD: "amd",
2352
+ CURRENCY_ANG: "ang",
2353
+ CURRENCY_AOA: "aoa",
2354
+ CURRENCY_APT: "apt",
2355
+ CURRENCY_ARB: "arb",
2356
+ CURRENCY_ARS: "ars",
2357
+ CURRENCY_AUD: "aud",
2358
+ CURRENCY_AVAX: "avax",
2359
+ CURRENCY_AWG: "awg",
2360
+ CURRENCY_AZN: "azn",
2361
+ CURRENCY_BAM: "bam",
2362
+ CURRENCY_BBD: "bbd",
2363
+ CURRENCY_BDT: "bdt",
2364
+ CURRENCY_BGN: "bgn",
2365
+ CURRENCY_BHD: "bhd",
2366
+ CURRENCY_BIF: "bif",
2367
+ CURRENCY_BMD: "bmd",
2368
+ CURRENCY_BNB: "bnb",
2369
+ CURRENCY_BND: "bnd",
2370
+ CURRENCY_BOB: "bob",
2371
+ CURRENCY_BOV: "bov",
2372
+ CURRENCY_BRL: "brl",
2373
+ CURRENCY_BSD: "bsd",
2374
+ CURRENCY_BTC: "btc",
2375
+ CURRENCY_BTN: "btn",
2376
+ CURRENCY_BUIDL: "buidl",
2377
+ CURRENCY_BWP: "bwp",
2378
+ CURRENCY_BYN: "byn",
2379
+ CURRENCY_BYR: "byr",
2380
+ CURRENCY_BZD: "bzd",
2381
+ CURRENCY_CAD: "cad",
2382
+ CURRENCY_CDF: "cdf",
2383
+ CURRENCY_CELO: "celo",
2384
+ CURRENCY_CHE: "che",
2385
+ CURRENCY_CHF: "chf",
2386
+ CURRENCY_CHW: "chw",
2387
+ CURRENCY_CLF: "clf",
2388
+ CURRENCY_CLP: "clp",
2389
+ CURRENCY_CNY: "cny",
2390
+ CURRENCY_COP: "cop",
2391
+ CURRENCY_COU: "cou",
2392
+ CURRENCY_CRC: "crc",
2393
+ CURRENCY_CUC: "cuc",
2394
+ CURRENCY_CUP: "cup",
2395
+ CURRENCY_CVE: "cve",
2396
+ CURRENCY_CZK: "czk",
2397
+ CURRENCY_DAI: "dai",
2398
+ CURRENCY_DJF: "djf",
2399
+ CURRENCY_DKK: "dkk",
2400
+ CURRENCY_DOP: "dop",
2401
+ CURRENCY_DZD: "dzd",
2402
+ CURRENCY_EEK: "eek",
2403
+ CURRENCY_EGP: "egp",
2404
+ CURRENCY_ERN: "ern",
2405
+ CURRENCY_ETB: "etb",
2406
+ CURRENCY_ETH: "eth",
2407
+ CURRENCY_EUR: "eur",
2408
+ CURRENCY_EURC: "eurc",
2409
+ CURRENCY_FJD: "fjd",
2410
+ CURRENCY_FKP: "fkp",
2411
+ CURRENCY_FRXUSD: "frxusd",
2412
+ CURRENCY_GBP: "gbp",
2413
+ CURRENCY_GEL: "gel",
2414
+ CURRENCY_GHC: "ghc",
2415
+ CURRENCY_GHS: "ghs",
2416
+ CURRENCY_GIP: "gip",
2417
+ CURRENCY_GMD: "gmd",
2418
+ CURRENCY_GNF: "gnf",
2419
+ CURRENCY_GTQ: "gtq",
2420
+ CURRENCY_GYD: "gyd",
2421
+ CURRENCY_HKD: "hkd",
2422
+ CURRENCY_HNL: "hnl",
2423
+ CURRENCY_HRK: "hrk",
2424
+ CURRENCY_HTG: "htg",
2425
+ CURRENCY_HUF: "huf",
2426
+ CURRENCY_HYPE: "hype",
2427
+ CURRENCY_IDR: "idr",
2428
+ CURRENCY_ILS: "ils",
2429
+ CURRENCY_INR: "inr",
2430
+ CURRENCY_IQD: "iqd",
2431
+ CURRENCY_IRR: "irr",
2432
+ CURRENCY_ISK: "isk",
2433
+ CURRENCY_JMD: "jmd",
2434
+ CURRENCY_JOD: "jod",
2435
+ CURRENCY_JPY: "jpy",
2436
+ CURRENCY_KES: "kes",
2437
+ CURRENCY_KGS: "kgs",
2438
+ CURRENCY_KHR: "khr",
2439
+ CURRENCY_KMF: "kmf",
2440
+ CURRENCY_KPW: "kpw",
2441
+ CURRENCY_KRW: "krw",
2442
+ CURRENCY_KWD: "kwd",
2443
+ CURRENCY_KYD: "kyd",
2444
+ CURRENCY_KZT: "kzt",
2445
+ CURRENCY_LAK: "lak",
2446
+ CURRENCY_LBP: "lbp",
2447
+ CURRENCY_LKR: "lkr",
2448
+ CURRENCY_LRD: "lrd",
2449
+ CURRENCY_LSL: "lsl",
2450
+ CURRENCY_LTL: "ltl",
2451
+ CURRENCY_LVL: "lvl",
2452
+ CURRENCY_LYD: "lyd",
2453
+ CURRENCY_LZD: "lzd",
2454
+ CURRENCY_M: "m",
2455
+ CURRENCY_MAD: "mad",
2456
+ CURRENCY_MDL: "mdl",
2457
+ CURRENCY_MGA: "mga",
2458
+ CURRENCY_MKD: "mkd",
2459
+ CURRENCY_MMK: "mmk",
2460
+ CURRENCY_MNT: "mnt",
2461
+ CURRENCY_MOP: "mop",
2462
+ CURRENCY_MRO: "mro",
2463
+ CURRENCY_MRU: "mru",
2464
+ CURRENCY_MUR: "mur",
2465
+ CURRENCY_MVR: "mvr",
2466
+ CURRENCY_MWK: "mwk",
2467
+ CURRENCY_MXN: "mxn",
2468
+ CURRENCY_MXV: "mxv",
2469
+ CURRENCY_MYR: "myr",
2470
+ CURRENCY_MZN: "mzn",
2471
+ CURRENCY_NAD: "nad",
2472
+ CURRENCY_NGN: "ngn",
2473
+ CURRENCY_NIO: "nio",
2474
+ CURRENCY_NOK: "nok",
2475
+ CURRENCY_NPR: "npr",
2476
+ CURRENCY_NZD: "nzd",
2477
+ CURRENCY_OMR: "omr",
2478
+ CURRENCY_PAB: "pab",
2479
+ CURRENCY_PEN: "pen",
2480
+ CURRENCY_PGK: "pgk",
2481
+ CURRENCY_PHP: "php",
2482
+ CURRENCY_PKR: "pkr",
2483
+ CURRENCY_PLN: "pln",
2484
+ CURRENCY_POL: "pol",
2485
+ CURRENCY_PYG: "pyg",
2486
+ CURRENCY_PYUSD: "pyusd",
2487
+ CURRENCY_QAR: "qar",
2488
+ CURRENCY_RD: "rd",
2489
+ CURRENCY_RE: "re",
2490
+ CURRENCY_RON: "ron",
2491
+ CURRENCY_RSD: "rsd",
2492
+ CURRENCY_RUB: "rub",
2493
+ CURRENCY_RWF: "rwf",
2494
+ CURRENCY_SAR: "sar",
2495
+ CURRENCY_SBD: "sbd",
2496
+ CURRENCY_SCR: "scr",
2497
+ CURRENCY_SDG: "sdg",
2498
+ CURRENCY_SEK: "sek",
2499
+ CURRENCY_SGD: "sgd",
2500
+ CURRENCY_SHP: "shp",
2501
+ CURRENCY_SLE: "sle",
2502
+ CURRENCY_SLL: "sll",
2503
+ CURRENCY_SOL: "sol",
2504
+ CURRENCY_SOS: "sos",
2505
+ CURRENCY_SRD: "srd",
2506
+ CURRENCY_SSP: "ssp",
2507
+ CURRENCY_STD: "std",
2508
+ CURRENCY_STN: "stn",
2509
+ CURRENCY_SUI: "sui",
2510
+ CURRENCY_SVC: "svc",
2511
+ CURRENCY_SYP: "syp",
2512
+ CURRENCY_SZL: "szl",
2513
+ CURRENCY_THB: "thb",
2514
+ CURRENCY_TJS: "tjs",
2515
+ CURRENCY_TMT: "tmt",
2516
+ CURRENCY_TND: "tnd",
2517
+ CURRENCY_TOP: "top",
2518
+ CURRENCY_TRX: "trx",
2519
+ CURRENCY_TRY: "try",
2520
+ CURRENCY_TTD: "ttd",
2521
+ CURRENCY_TWD: "twd",
2522
+ CURRENCY_TZS: "tzs",
2523
+ CURRENCY_UAH: "uah",
2524
+ CURRENCY_UGX: "ugx",
2525
+ CURRENCY_USD: "usd",
2526
+ CURRENCY_USDB: "usdb",
2527
+ CURRENCY_USDC: "usdc",
2528
+ CURRENCY_USDG: "usdg",
2529
+ CURRENCY_USDP: "usdp",
2530
+ CURRENCY_USDT: "usdt",
2531
+ CURRENCY_USN: "usn",
2532
+ CURRENCY_USTB: "ustb",
2533
+ CURRENCY_UYI: "uyi",
2534
+ CURRENCY_UYU: "uyu",
2535
+ CURRENCY_UZS: "uzs",
2536
+ CURRENCY_VEF: "vef",
2537
+ CURRENCY_VES: "ves",
2538
+ CURRENCY_VND: "vnd",
2539
+ CURRENCY_VUV: "vuv",
2540
+ CURRENCY_WST: "wst",
2541
+ CURRENCY_XAF: "xaf",
2542
+ CURRENCY_XCD: "xcd",
2543
+ CURRENCY_XCG: "xcg",
2544
+ CURRENCY_XEUR: "xeur",
2545
+ CURRENCY_XLM: "xlm",
2546
+ CURRENCY_XOF: "xof",
2547
+ CURRENCY_XPF: "xpf",
2548
+ CURRENCY_XPL: "xpl",
2549
+ CURRENCY_XUSD: "xusd",
2550
+ CURRENCY_YER: "yer",
2551
+ CURRENCY_ZAR: "zar",
2552
+ CURRENCY_ZMK: "zmk",
2553
+ CURRENCY_ZMW: "zmw",
2554
+ CURRENCY_ZWD: "zwd",
2555
+ CURRENCY_ZWG: "zwg",
2556
+ CURRENCY_ZWL: "zwl"
2557
+ });
2558
+ const ProrateItemsResultDescriptor = new _ShapeDescriptor(
2559
+ "ProrateItemsResult",
2560
+ [
2561
+ {
2562
+ type: "items",
2563
+ transform: _required(
2564
+ _translateArray(_translateShape(() => ItemWithProrationDescriptor))
2565
+ )
2566
+ }
2567
+ ]
2568
+ );
2569
+ const ItemWithProrationDescriptor = new _ShapeDescriptor(
2570
+ "ItemWithProration",
2571
+ [
2572
+ { type: "key", transform: _required() },
2573
+ { type: "prorationFactor", transform: _required(_translateDecimal) },
2574
+ {
2575
+ type: "lineItemPeriod",
2576
+ transform: _required(_translateShape(() => TimeRangeDescriptor))
2577
+ }
2578
+ ]
2579
+ );
2580
+ const ProrateItemsInputDescriptor = new _ShapeDescriptor(
2581
+ "ProrateItemsInput",
2582
+ [
2583
+ {
2584
+ type: "items",
2585
+ transform: _required(
2586
+ _translateArray(_translateShape(() => ProratableItemDescriptor))
2587
+ )
2588
+ }
2589
+ ]
2590
+ );
2591
+ const ProratableItemDescriptor = new _ShapeDescriptor(
2592
+ "ProratableItem",
2593
+ [
2594
+ { type: "key", transform: _required() },
2595
+ { type: "type", transform: _required(_translateEnum(itemTypeEnumValues)) },
2596
+ { type: "isProration", transform: _required() },
2597
+ {
2598
+ type: "servicePeriod",
2599
+ transform: _required(_translateShape(() => TimeRangeDescriptor))
2600
+ },
2601
+ { type: "currentProrationFactor", transform: _required(_translateDecimal) },
2602
+ { type: "priceIntervalDuration", transform: _required() },
2603
+ {
2604
+ type: "correspondingDebit",
2605
+ transform: _translateShape(() => PreviousDebitDescriptor)
2606
+ }
2607
+ ],
2608
+ [
2609
+ {
2610
+ discriminant: "priceKind",
2611
+ optional: false,
2612
+ branches: [
2613
+ {
2614
+ wireKey: "price",
2615
+ typeKey: "price",
2616
+ transform: _translateShape(() => PriceDescriptor)
2617
+ },
2618
+ {
2619
+ wireKey: "licenseFee",
2620
+ typeKey: "licenseFee",
2621
+ transform: _translateShape(() => LicenseFeeDescriptor)
2622
+ },
2623
+ {
2624
+ wireKey: "rateCardRate",
2625
+ typeKey: "rateCardRate",
2626
+ transform: _translateShape(() => RateCardRateDescriptor)
2627
+ },
2628
+ {
2629
+ wireKey: "customPricingUnitOverageRate",
2630
+ typeKey: "customPricingUnitOverageRate",
2631
+ transform: _translateShape(() => CustomPricingUnitOverageRateDescriptor)
2632
+ }
2633
+ ]
2634
+ }
2635
+ ]
2636
+ );
2637
+ const PreviousDebitDescriptor = new _ShapeDescriptor(
2638
+ "PreviousDebit",
2639
+ [
2640
+ {
2641
+ type: "servicePeriod",
2642
+ transform: _required(_translateShape(() => TimeRangeDescriptor))
2643
+ }
2644
+ ]
2645
+ );
2646
+ const CustomPricingUnitOverageRateDescriptor = new _ShapeDescriptor("CustomPricingUnitOverageRate", [
2647
+ { type: "id", transform: _required() },
2648
+ { type: "metadata", transform: _required(_translateMap(_identity, _identity)) },
2649
+ {
2650
+ type: "rateCard",
2651
+ transform: _required(_translateShape(() => RateCardDescriptor))
2652
+ },
2653
+ { type: "customPricingUnit", transform: _required() },
2654
+ { type: "unitAmount", transform: _required(_translateDecimal) }
2655
+ ]);
2656
+ const RateCardDescriptor = new _ShapeDescriptor("RateCard", [
2657
+ { type: "id", transform: _required() },
2658
+ { type: "currency", transform: _required(_translateEnum(currencyEnumValues)) }
2659
+ ]);
2660
+ const RateCardRateDescriptor = new _ShapeDescriptor(
2661
+ "RateCardRate",
2662
+ [
2663
+ { type: "id", transform: _required() },
2664
+ { type: "metadata", transform: _required(_translateMap(_identity, _identity)) },
2665
+ {
2666
+ type: "rateCard",
2667
+ transform: _required(_translateShape(() => RateCardDescriptor))
2668
+ },
2669
+ { type: "tieringMode", transform: _translateEnum(pricingTierModeEnumValues) },
2670
+ {
2671
+ type: "tiers",
2672
+ transform: _required(
2673
+ _translateArray(_translateShape(() => RateCardRateTierDescriptor))
2674
+ )
2675
+ },
2676
+ { type: "unitAmount", transform: _translateDecimal }
2677
+ ]
2678
+ );
2679
+ const RateCardRateTierDescriptor = new _ShapeDescriptor(
2680
+ "RateCardRateTier",
2681
+ [
2682
+ { type: "flatAmount", transform: _translateDecimal },
2683
+ { type: "unitAmount", transform: _translateDecimal },
2684
+ { type: "upTo", transform: _translateDecimal }
2685
+ ]
2686
+ );
2687
+ const LicenseFeeDescriptor = new _ShapeDescriptor(
2688
+ "LicenseFee",
2689
+ [
2690
+ { type: "id", transform: _required() },
2691
+ { type: "lookupKey", transform: _identity },
2692
+ { type: "metadata", transform: _required(_translateMap(_identity, _identity)) },
2693
+ {
2694
+ type: "serviceInterval",
2695
+ transform: _required(_translateEnum(recurringPriceIntervalEnumValues))
2696
+ },
2697
+ { type: "serviceIntervalCount", transform: _required() },
2698
+ { type: "tieringMode", transform: _translateEnum(pricingTierModeEnumValues) },
2699
+ {
2700
+ type: "tiers",
2701
+ transform: _required(
2702
+ _translateArray(_translateShape(() => LicenseFeeTierDescriptor))
2703
+ )
2704
+ },
2705
+ { type: "currency", transform: _required(_translateEnum(currencyEnumValues)) },
2706
+ { type: "unitAmount", transform: _translateDecimal }
2707
+ ]
2708
+ );
2709
+ const LicenseFeeTierDescriptor = new _ShapeDescriptor(
2710
+ "LicenseFeeTier",
2711
+ [
2712
+ { type: "flatAmount", transform: _translateDecimal },
2713
+ { type: "unitAmount", transform: _translateDecimal },
2714
+ { type: "upTo", transform: _translateDecimal }
2715
+ ]
2716
+ );
2717
+ const PriceDescriptor = new _ShapeDescriptor("Price", [
2718
+ { type: "id", transform: _required() },
2719
+ { type: "product", transform: _required(_translateShape(() => ProductDescriptor)) },
2720
+ { type: "recurring", transform: _translateShape(() => RecurringPriceDescriptor) },
2721
+ {
2722
+ type: "billingScheme",
2723
+ transform: _required(_translateEnum(pricingSchemeEnumValues))
2724
+ },
2725
+ {
2726
+ type: "tiers",
2727
+ transform: _required(_translateArray(_translateShape(() => PriceTierDescriptor)))
2728
+ },
2729
+ { type: "type", transform: _required(_translateEnum(priceTypeEnumValues)) },
2730
+ { type: "tiersMode", transform: _translateEnum(pricingTierModeEnumValues) },
2731
+ { type: "metadata", transform: _required(_translateMap(_identity, _identity)) },
2732
+ { type: "currency", transform: _required(_translateEnum(currencyEnumValues)) },
2733
+ { type: "unitAmount", transform: _translateDecimal }
2734
+ ]);
2735
+ const PriceTierDescriptor = new _ShapeDescriptor(
2736
+ "PriceTier",
2737
+ [
2738
+ { type: "flatAmount", transform: _translateDecimal },
2739
+ { type: "unitAmount", transform: _translateDecimal },
2740
+ { type: "upTo", transform: _identity }
2741
+ ]
2742
+ );
2743
+ const RecurringPriceDescriptor = new _ShapeDescriptor(
2744
+ "RecurringPrice",
2745
+ [
2746
+ {
2747
+ type: "interval",
2748
+ transform: _required(_translateEnum(recurringPriceIntervalEnumValues))
2749
+ },
2750
+ { type: "intervalCount", transform: _required() },
2751
+ { type: "usageType", transform: _translateEnum(usageTypeEnumValues) },
2752
+ { type: "meter", transform: _identity }
2753
+ ]
2754
+ );
2755
+ const ProductDescriptor = new _ShapeDescriptor("Product", [
2756
+ { type: "id", transform: _required() },
2757
+ { type: "name", transform: _required() },
2758
+ { type: "metadata", transform: _required(_translateMap(_identity, _identity)) }
2759
+ ]);
2760
+ const TimeRangeDescriptor = new _ShapeDescriptor("TimeRange", [
2761
+ { type: "startDate", transform: _required(_translateDateTime) },
2762
+ { type: "endDate", transform: _required(_translateDateTime) }
2763
+ ]);
2764
+ let __stripe_shim_active__ = false;
2765
+ function prepareArgsProrateItems(proto) {
2766
+ if (__stripe_shim_active__) {
2767
+ return proto;
2768
+ }
2769
+ return _apply(
2770
+ ProrateItemsInputDescriptor,
2771
+ _ProtoWireToType,
2772
+ proto
2773
+ );
2774
+ }
2775
+ Prorations2.prepareArgsProrateItems = prepareArgsProrateItems;
2776
+ function prepareResultProrateItems(result) {
2777
+ if (__stripe_shim_active__) return result;
2778
+ return _apply(
2779
+ ProrateItemsResultDescriptor,
2780
+ _TypeToProtoWire,
2781
+ result
2782
+ );
2783
+ }
2784
+ Prorations2.prepareResultProrateItems = prepareResultProrateItems;
2785
+ function $platformWrapProrateItems(configTransformer) {
2786
+ return (cls, wireArgs, wireConfig, ctx) => {
2787
+ __stripe_shim_active__ = true;
2788
+ const instance = new cls();
2789
+ const request = _apply(
2790
+ ProrateItemsInputDescriptor,
2791
+ _ProtoWireToType,
2792
+ wireArgs
2793
+ );
2794
+ const config = configTransformer !== void 0 ? configTransformer(wireConfig, _configAppContextFromContext(ctx)) : wireConfig;
2795
+ const result = instance.prorateItems(request, config, ctx);
2796
+ if (_isPromiseLike(result)) {
2797
+ return Promise.resolve(result).then((r) => {
2798
+ const typedR = r;
2799
+ return _apply(ProrateItemsResultDescriptor, _TypeToProtoWire, typedR);
2800
+ });
2801
+ }
2802
+ const typedResult = result;
2803
+ return _apply(ProrateItemsResultDescriptor, _TypeToProtoWire, typedResult);
2804
+ };
2805
+ }
2806
+ Prorations2.$platformWrapProrateItems = $platformWrapProrateItems;
2807
+ const _prepareArgsAlias = prepareArgsProrateItems;
2808
+ Prorations2.prepareArgs = _prepareArgsAlias;
2809
+ const _prepareResultAlias = prepareResultProrateItems;
2810
+ Prorations2.prepareResult = _prepareResultAlias;
2811
+ })(Prorations || (Prorations = {}));
2812
+
2813
+ // src/extensions/billing/recurring_billing_item_handling.ts
2814
+ var RecurringBillingItemHandling;
2815
+ ((RecurringBillingItemHandling2) => {
2816
+ const pricingTierModeEnumValues = new _ProtoEnum({
2817
+ PRICING_TIER_MODE_GRADUATED: "graduated",
2818
+ PRICING_TIER_MODE_VOLUME: "volume"
2819
+ });
2820
+ const recurringPriceIntervalEnumValues = new _ProtoEnum({
2821
+ RECURRING_PRICE_INTERVAL_DAY: "day",
2822
+ RECURRING_PRICE_INTERVAL_WEEK: "week",
2823
+ RECURRING_PRICE_INTERVAL_MONTH: "month",
2824
+ RECURRING_PRICE_INTERVAL_YEAR: "year"
2825
+ });
2826
+ const priceTypeEnumValues = new _ProtoEnum({
2827
+ PRICE_TYPE_ONE_TIME: "one_time",
2828
+ PRICE_TYPE_RECURRING: "recurring"
2829
+ });
2830
+ const pricingSchemeEnumValues = new _ProtoEnum({
2831
+ PRICING_SCHEME_PER_UNIT: "per_unit",
2832
+ PRICING_SCHEME_TIERED: "tiered"
2833
+ });
2834
+ const usageTypeEnumValues = new _ProtoEnum({
2835
+ USAGE_TYPE_LICENSED: "licensed",
2836
+ USAGE_TYPE_METERED: "metered"
2837
+ });
2838
+ const itemTypeEnumValues = new _ProtoEnum({
2839
+ ITEM_TYPE_CREDIT: "credit",
2840
+ ITEM_TYPE_DEBIT: "debit"
2841
+ });
2842
+ const currencyEnumValues = new _ProtoEnum({
2843
+ CURRENCY_AED: "aed",
2844
+ CURRENCY_AFN: "afn",
2845
+ CURRENCY_ALL: "all",
2846
+ CURRENCY_AMD: "amd",
2847
+ CURRENCY_ANG: "ang",
2848
+ CURRENCY_AOA: "aoa",
2849
+ CURRENCY_APT: "apt",
2850
+ CURRENCY_ARB: "arb",
2851
+ CURRENCY_ARS: "ars",
2852
+ CURRENCY_AUD: "aud",
2853
+ CURRENCY_AVAX: "avax",
2854
+ CURRENCY_AWG: "awg",
2855
+ CURRENCY_AZN: "azn",
2856
+ CURRENCY_BAM: "bam",
2857
+ CURRENCY_BBD: "bbd",
2858
+ CURRENCY_BDT: "bdt",
2859
+ CURRENCY_BGN: "bgn",
2860
+ CURRENCY_BHD: "bhd",
2861
+ CURRENCY_BIF: "bif",
2862
+ CURRENCY_BMD: "bmd",
2863
+ CURRENCY_BNB: "bnb",
2864
+ CURRENCY_BND: "bnd",
2865
+ CURRENCY_BOB: "bob",
2866
+ CURRENCY_BOV: "bov",
2867
+ CURRENCY_BRL: "brl",
2868
+ CURRENCY_BSD: "bsd",
2869
+ CURRENCY_BTC: "btc",
2870
+ CURRENCY_BTN: "btn",
2871
+ CURRENCY_BUIDL: "buidl",
2872
+ CURRENCY_BWP: "bwp",
2873
+ CURRENCY_BYN: "byn",
2874
+ CURRENCY_BYR: "byr",
2875
+ CURRENCY_BZD: "bzd",
2876
+ CURRENCY_CAD: "cad",
2877
+ CURRENCY_CDF: "cdf",
2878
+ CURRENCY_CELO: "celo",
2879
+ CURRENCY_CHE: "che",
2880
+ CURRENCY_CHF: "chf",
2881
+ CURRENCY_CHW: "chw",
2882
+ CURRENCY_CLF: "clf",
2883
+ CURRENCY_CLP: "clp",
2884
+ CURRENCY_CNY: "cny",
2885
+ CURRENCY_COP: "cop",
2886
+ CURRENCY_COU: "cou",
2887
+ CURRENCY_CRC: "crc",
2888
+ CURRENCY_CUC: "cuc",
2889
+ CURRENCY_CUP: "cup",
2890
+ CURRENCY_CVE: "cve",
2891
+ CURRENCY_CZK: "czk",
2892
+ CURRENCY_DAI: "dai",
2893
+ CURRENCY_DJF: "djf",
2894
+ CURRENCY_DKK: "dkk",
2895
+ CURRENCY_DOP: "dop",
2896
+ CURRENCY_DZD: "dzd",
2897
+ CURRENCY_EEK: "eek",
2898
+ CURRENCY_EGP: "egp",
2899
+ CURRENCY_ERN: "ern",
2900
+ CURRENCY_ETB: "etb",
2901
+ CURRENCY_ETH: "eth",
2902
+ CURRENCY_EUR: "eur",
2903
+ CURRENCY_EURC: "eurc",
2904
+ CURRENCY_FJD: "fjd",
2905
+ CURRENCY_FKP: "fkp",
2906
+ CURRENCY_FRXUSD: "frxusd",
2907
+ CURRENCY_GBP: "gbp",
2908
+ CURRENCY_GEL: "gel",
2909
+ CURRENCY_GHC: "ghc",
2910
+ CURRENCY_GHS: "ghs",
2911
+ CURRENCY_GIP: "gip",
2912
+ CURRENCY_GMD: "gmd",
2913
+ CURRENCY_GNF: "gnf",
2914
+ CURRENCY_GTQ: "gtq",
2915
+ CURRENCY_GYD: "gyd",
2916
+ CURRENCY_HKD: "hkd",
2917
+ CURRENCY_HNL: "hnl",
2918
+ CURRENCY_HRK: "hrk",
2919
+ CURRENCY_HTG: "htg",
2920
+ CURRENCY_HUF: "huf",
2921
+ CURRENCY_HYPE: "hype",
2922
+ CURRENCY_IDR: "idr",
2923
+ CURRENCY_ILS: "ils",
2924
+ CURRENCY_INR: "inr",
2925
+ CURRENCY_IQD: "iqd",
2926
+ CURRENCY_IRR: "irr",
2927
+ CURRENCY_ISK: "isk",
2928
+ CURRENCY_JMD: "jmd",
2929
+ CURRENCY_JOD: "jod",
2930
+ CURRENCY_JPY: "jpy",
2931
+ CURRENCY_KES: "kes",
2932
+ CURRENCY_KGS: "kgs",
2933
+ CURRENCY_KHR: "khr",
2934
+ CURRENCY_KMF: "kmf",
2935
+ CURRENCY_KPW: "kpw",
2936
+ CURRENCY_KRW: "krw",
2937
+ CURRENCY_KWD: "kwd",
2938
+ CURRENCY_KYD: "kyd",
2939
+ CURRENCY_KZT: "kzt",
2940
+ CURRENCY_LAK: "lak",
2941
+ CURRENCY_LBP: "lbp",
2942
+ CURRENCY_LKR: "lkr",
2943
+ CURRENCY_LRD: "lrd",
2944
+ CURRENCY_LSL: "lsl",
2945
+ CURRENCY_LTL: "ltl",
2946
+ CURRENCY_LVL: "lvl",
2947
+ CURRENCY_LYD: "lyd",
2948
+ CURRENCY_LZD: "lzd",
2949
+ CURRENCY_M: "m",
2950
+ CURRENCY_MAD: "mad",
2951
+ CURRENCY_MDL: "mdl",
2952
+ CURRENCY_MGA: "mga",
2953
+ CURRENCY_MKD: "mkd",
2954
+ CURRENCY_MMK: "mmk",
2955
+ CURRENCY_MNT: "mnt",
2956
+ CURRENCY_MOP: "mop",
2957
+ CURRENCY_MRO: "mro",
2958
+ CURRENCY_MRU: "mru",
2959
+ CURRENCY_MUR: "mur",
2960
+ CURRENCY_MVR: "mvr",
2961
+ CURRENCY_MWK: "mwk",
2962
+ CURRENCY_MXN: "mxn",
2963
+ CURRENCY_MXV: "mxv",
2964
+ CURRENCY_MYR: "myr",
2965
+ CURRENCY_MZN: "mzn",
2966
+ CURRENCY_NAD: "nad",
2967
+ CURRENCY_NGN: "ngn",
2968
+ CURRENCY_NIO: "nio",
2969
+ CURRENCY_NOK: "nok",
2970
+ CURRENCY_NPR: "npr",
2971
+ CURRENCY_NZD: "nzd",
2972
+ CURRENCY_OMR: "omr",
2973
+ CURRENCY_PAB: "pab",
2974
+ CURRENCY_PEN: "pen",
2975
+ CURRENCY_PGK: "pgk",
2976
+ CURRENCY_PHP: "php",
2977
+ CURRENCY_PKR: "pkr",
2978
+ CURRENCY_PLN: "pln",
2979
+ CURRENCY_POL: "pol",
2980
+ CURRENCY_PYG: "pyg",
2981
+ CURRENCY_PYUSD: "pyusd",
2982
+ CURRENCY_QAR: "qar",
2983
+ CURRENCY_RD: "rd",
2984
+ CURRENCY_RE: "re",
2985
+ CURRENCY_RON: "ron",
2986
+ CURRENCY_RSD: "rsd",
2987
+ CURRENCY_RUB: "rub",
2988
+ CURRENCY_RWF: "rwf",
2989
+ CURRENCY_SAR: "sar",
2990
+ CURRENCY_SBD: "sbd",
2991
+ CURRENCY_SCR: "scr",
2992
+ CURRENCY_SDG: "sdg",
2993
+ CURRENCY_SEK: "sek",
2994
+ CURRENCY_SGD: "sgd",
2995
+ CURRENCY_SHP: "shp",
2996
+ CURRENCY_SLE: "sle",
2997
+ CURRENCY_SLL: "sll",
2998
+ CURRENCY_SOL: "sol",
2999
+ CURRENCY_SOS: "sos",
3000
+ CURRENCY_SRD: "srd",
3001
+ CURRENCY_SSP: "ssp",
3002
+ CURRENCY_STD: "std",
3003
+ CURRENCY_STN: "stn",
3004
+ CURRENCY_SUI: "sui",
3005
+ CURRENCY_SVC: "svc",
3006
+ CURRENCY_SYP: "syp",
3007
+ CURRENCY_SZL: "szl",
3008
+ CURRENCY_THB: "thb",
3009
+ CURRENCY_TJS: "tjs",
3010
+ CURRENCY_TMT: "tmt",
3011
+ CURRENCY_TND: "tnd",
3012
+ CURRENCY_TOP: "top",
3013
+ CURRENCY_TRX: "trx",
3014
+ CURRENCY_TRY: "try",
3015
+ CURRENCY_TTD: "ttd",
3016
+ CURRENCY_TWD: "twd",
3017
+ CURRENCY_TZS: "tzs",
3018
+ CURRENCY_UAH: "uah",
3019
+ CURRENCY_UGX: "ugx",
3020
+ CURRENCY_USD: "usd",
3021
+ CURRENCY_USDB: "usdb",
3022
+ CURRENCY_USDC: "usdc",
3023
+ CURRENCY_USDG: "usdg",
3024
+ CURRENCY_USDP: "usdp",
3025
+ CURRENCY_USDT: "usdt",
3026
+ CURRENCY_USN: "usn",
3027
+ CURRENCY_USTB: "ustb",
3028
+ CURRENCY_UYI: "uyi",
3029
+ CURRENCY_UYU: "uyu",
3030
+ CURRENCY_UZS: "uzs",
3031
+ CURRENCY_VEF: "vef",
3032
+ CURRENCY_VES: "ves",
3033
+ CURRENCY_VND: "vnd",
3034
+ CURRENCY_VUV: "vuv",
3035
+ CURRENCY_WST: "wst",
3036
+ CURRENCY_XAF: "xaf",
3037
+ CURRENCY_XCD: "xcd",
3038
+ CURRENCY_XCG: "xcg",
3039
+ CURRENCY_XEUR: "xeur",
3040
+ CURRENCY_XLM: "xlm",
3041
+ CURRENCY_XOF: "xof",
3042
+ CURRENCY_XPF: "xpf",
3043
+ CURRENCY_XPL: "xpl",
3044
+ CURRENCY_XUSD: "xusd",
3045
+ CURRENCY_YER: "yer",
3046
+ CURRENCY_ZAR: "zar",
3047
+ CURRENCY_ZMK: "zmk",
3048
+ CURRENCY_ZMW: "zmw",
3049
+ CURRENCY_ZWD: "zwd",
3050
+ CURRENCY_ZWG: "zwg",
3051
+ CURRENCY_ZWL: "zwl"
3052
+ });
3053
+ const GroupItemsResultDescriptor = new _ShapeDescriptor(
3054
+ "GroupItemsResult",
3055
+ [
3056
+ {
3057
+ type: "groups",
3058
+ transform: _required(_translateArray(_translateShape(() => ItemGroupDescriptor)))
3059
+ }
3060
+ ]
3061
+ );
3062
+ const ItemGroupDescriptor = new _ShapeDescriptor(
3063
+ "ItemGroup",
3064
+ [
3065
+ {
3066
+ type: "items",
3067
+ transform: _required(
3068
+ _translateArray(_translateShape(() => GroupedItemDescriptor))
3069
+ )
3070
+ },
3071
+ { type: "setsLatestInvoice", transform: _required() }
3072
+ ]
3073
+ );
3074
+ const GroupedItemDescriptor = new _ShapeDescriptor(
3075
+ "GroupedItem",
3076
+ [{ type: "key", transform: _required() }]
3077
+ );
3078
+ const GroupItemsInputDescriptor = new _ShapeDescriptor(
3079
+ "GroupItemsInput",
3080
+ [
3081
+ {
3082
+ type: "items",
3083
+ transform: _required(_translateArray(_translateShape(() => ItemDescriptor)))
3084
+ }
3085
+ ]
3086
+ );
3087
+ const ItemDescriptor = new _ShapeDescriptor(
3088
+ "Item",
3089
+ [
3090
+ { type: "key", transform: _required() },
3091
+ { type: "type", transform: _required(_translateEnum(itemTypeEnumValues)) },
3092
+ { type: "isProration", transform: _required() },
3093
+ {
3094
+ type: "servicePeriod",
3095
+ transform: _required(_translateUnion(() => AnyTimeRangeDescriptor))
3096
+ },
3097
+ { type: "prorationFactor", transform: _required(_translateDecimal) }
3098
+ ],
3099
+ [
3100
+ {
3101
+ discriminant: "priceKind",
3102
+ optional: false,
3103
+ branches: [
3104
+ {
3105
+ wireKey: "price",
3106
+ typeKey: "price",
3107
+ transform: _translateShape(() => PriceDescriptor)
3108
+ },
3109
+ {
3110
+ wireKey: "licenseFee",
3111
+ typeKey: "licenseFee",
3112
+ transform: _translateShape(() => LicenseFeeDescriptor)
3113
+ },
3114
+ {
3115
+ wireKey: "rateCardRate",
3116
+ typeKey: "rateCardRate",
3117
+ transform: _translateShape(() => RateCardRateDescriptor)
3118
+ },
3119
+ {
3120
+ wireKey: "customPricingUnitOverageRate",
3121
+ typeKey: "customPricingUnitOverageRate",
3122
+ transform: _translateShape(() => CustomPricingUnitOverageRateDescriptor)
3123
+ }
3124
+ ]
3125
+ }
3126
+ ]
3127
+ );
3128
+ const CustomPricingUnitOverageRateDescriptor = new _ShapeDescriptor("CustomPricingUnitOverageRate", [
3129
+ { type: "id", transform: _required() },
3130
+ { type: "metadata", transform: _required(_translateMap(_identity, _identity)) },
3131
+ {
3132
+ type: "rateCard",
3133
+ transform: _required(_translateShape(() => RateCardDescriptor))
3134
+ },
3135
+ { type: "customPricingUnit", transform: _required() },
3136
+ { type: "unitAmount", transform: _required(_translateDecimal) }
3137
+ ]);
3138
+ const RateCardDescriptor = new _ShapeDescriptor("RateCard", [
3139
+ { type: "id", transform: _required() },
3140
+ { type: "currency", transform: _required(_translateEnum(currencyEnumValues)) }
3141
+ ]);
3142
+ const RateCardRateDescriptor = new _ShapeDescriptor(
3143
+ "RateCardRate",
3144
+ [
3145
+ { type: "id", transform: _required() },
3146
+ { type: "metadata", transform: _required(_translateMap(_identity, _identity)) },
3147
+ {
3148
+ type: "rateCard",
3149
+ transform: _required(_translateShape(() => RateCardDescriptor))
3150
+ },
3151
+ { type: "tieringMode", transform: _translateEnum(pricingTierModeEnumValues) },
3152
+ {
3153
+ type: "tiers",
3154
+ transform: _required(
3155
+ _translateArray(_translateShape(() => RateCardRateTierDescriptor))
3156
+ )
3157
+ },
3158
+ { type: "unitAmount", transform: _translateDecimal }
3159
+ ]
3160
+ );
3161
+ const RateCardRateTierDescriptor = new _ShapeDescriptor(
3162
+ "RateCardRateTier",
3163
+ [
3164
+ { type: "flatAmount", transform: _translateDecimal },
3165
+ { type: "unitAmount", transform: _translateDecimal },
3166
+ { type: "upTo", transform: _translateDecimal }
3167
+ ]
3168
+ );
3169
+ const LicenseFeeDescriptor = new _ShapeDescriptor(
3170
+ "LicenseFee",
3171
+ [
3172
+ { type: "id", transform: _required() },
3173
+ { type: "lookupKey", transform: _identity },
3174
+ { type: "metadata", transform: _required(_translateMap(_identity, _identity)) },
3175
+ {
3176
+ type: "serviceInterval",
3177
+ transform: _required(_translateEnum(recurringPriceIntervalEnumValues))
3178
+ },
3179
+ { type: "serviceIntervalCount", transform: _required() },
3180
+ { type: "tieringMode", transform: _translateEnum(pricingTierModeEnumValues) },
3181
+ {
3182
+ type: "tiers",
3183
+ transform: _required(
3184
+ _translateArray(_translateShape(() => LicenseFeeTierDescriptor))
3185
+ )
3186
+ },
3187
+ { type: "currency", transform: _required(_translateEnum(currencyEnumValues)) },
3188
+ { type: "unitAmount", transform: _translateDecimal }
3189
+ ]
3190
+ );
3191
+ const LicenseFeeTierDescriptor = new _ShapeDescriptor(
3192
+ "LicenseFeeTier",
3193
+ [
3194
+ { type: "flatAmount", transform: _translateDecimal },
3195
+ { type: "unitAmount", transform: _translateDecimal },
3196
+ { type: "upTo", transform: _translateDecimal }
3197
+ ]
3198
+ );
3199
+ const PriceDescriptor = new _ShapeDescriptor("Price", [
3200
+ { type: "id", transform: _required() },
3201
+ { type: "product", transform: _required(_translateShape(() => ProductDescriptor)) },
3202
+ { type: "recurring", transform: _translateShape(() => RecurringPriceDescriptor) },
3203
+ {
3204
+ type: "billingScheme",
3205
+ transform: _required(_translateEnum(pricingSchemeEnumValues))
3206
+ },
3207
+ {
3208
+ type: "tiers",
3209
+ transform: _required(_translateArray(_translateShape(() => PriceTierDescriptor)))
3210
+ },
3211
+ { type: "type", transform: _required(_translateEnum(priceTypeEnumValues)) },
3212
+ { type: "tiersMode", transform: _translateEnum(pricingTierModeEnumValues) },
3213
+ { type: "metadata", transform: _required(_translateMap(_identity, _identity)) },
3214
+ { type: "currency", transform: _required(_translateEnum(currencyEnumValues)) },
3215
+ { type: "unitAmount", transform: _translateDecimal }
3216
+ ]);
3217
+ const PriceTierDescriptor = new _ShapeDescriptor(
3218
+ "PriceTier",
3219
+ [
3220
+ { type: "flatAmount", transform: _translateDecimal },
3221
+ { type: "unitAmount", transform: _translateDecimal },
3222
+ { type: "upTo", transform: _identity }
3223
+ ]
3224
+ );
3225
+ const RecurringPriceDescriptor = new _ShapeDescriptor(
3226
+ "RecurringPrice",
3227
+ [
3228
+ {
3229
+ type: "interval",
3230
+ transform: _required(_translateEnum(recurringPriceIntervalEnumValues))
3231
+ },
3232
+ { type: "intervalCount", transform: _required() },
3233
+ { type: "usageType", transform: _translateEnum(usageTypeEnumValues) },
3234
+ { type: "meter", transform: _identity }
3235
+ ]
3236
+ );
3237
+ const ProductDescriptor = new _ShapeDescriptor("Product", [
3238
+ { type: "id", transform: _required() },
3239
+ { type: "name", transform: _required() },
3240
+ { type: "metadata", transform: _required(_translateMap(_identity, _identity)) }
3241
+ ]);
3242
+ const FilterItemsResultDescriptor = new _ShapeDescriptor(
3243
+ "FilterItemsResult",
3244
+ [
3245
+ {
3246
+ type: "items",
3247
+ transform: _required(
3248
+ _translateArray(_translateShape(() => ItemToInvoiceDescriptor))
3249
+ )
3250
+ }
3251
+ ]
3252
+ );
3253
+ const ItemToInvoiceDescriptor = new _ShapeDescriptor(
3254
+ "ItemToInvoice",
3255
+ [{ type: "key", transform: _required() }]
3256
+ );
3257
+ const FilterItemsInputDescriptor = new _ShapeDescriptor(
3258
+ "FilterItemsInput",
3259
+ [
3260
+ {
3261
+ type: "items",
3262
+ transform: _required(_translateArray(_translateShape(() => ItemDescriptor)))
3263
+ }
3264
+ ]
3265
+ );
3266
+ const BeforeItemCreationResultDescriptor = new _ShapeDescriptor("BeforeItemCreationResult", [
3267
+ {
3268
+ type: "items",
3269
+ transform: _required(
3270
+ _translateArray(_translateShape(() => ItemWithCreationStrategyDescriptor))
3271
+ )
3272
+ }
3273
+ ]);
3274
+ const ItemWithCreationStrategyDescriptor = new _ShapeDescriptor(
3275
+ "ItemWithCreationStrategy",
3276
+ [{ type: "key", transform: _required() }],
3277
+ [
3278
+ {
3279
+ discriminant: "creationStrategy",
3280
+ optional: false,
3281
+ branches: [
3282
+ { wireKey: "doNotCreate", typeKey: "doNotCreate" },
3283
+ { wireKey: "invoice", typeKey: "invoice" }
3284
+ ]
3285
+ }
3286
+ ]
3287
+ );
3288
+ const BeforeItemCreationInputDescriptor = new _ShapeDescriptor("BeforeItemCreationInput", [
3289
+ {
3290
+ type: "items",
3291
+ transform: _required(_translateArray(_translateShape(() => ItemDescriptor)))
3292
+ }
3293
+ ]);
3294
+ const AnyTimeRangeDescriptor = new _UnionDescriptor(
3295
+ "AnyTimeRange",
3296
+ "value",
3297
+ [
3298
+ {
3299
+ wireKey: "oneTime",
3300
+ typeKey: "oneTime",
3301
+ shape: [{ type: "at", transform: _required(_translateDateTime) }]
3302
+ },
3303
+ {
3304
+ wireKey: "timeRange",
3305
+ typeKey: "timeRange",
3306
+ shape: [
3307
+ { type: "startDate", transform: _required(_translateDateTime) },
3308
+ { type: "endDate", transform: _required(_translateDateTime) }
3309
+ ]
3310
+ }
3311
+ ]
3312
+ );
3313
+ let __stripe_shim_active__ = false;
3314
+ function prepareArgsBeforeItemCreation(proto) {
3315
+ if (__stripe_shim_active__) {
3316
+ return proto;
3317
+ }
3318
+ return _apply(
3319
+ BeforeItemCreationInputDescriptor,
3320
+ _ProtoWireToType,
3321
+ proto
3322
+ );
3323
+ }
3324
+ RecurringBillingItemHandling2.prepareArgsBeforeItemCreation = prepareArgsBeforeItemCreation;
3325
+ function prepareResultBeforeItemCreation(result) {
3326
+ if (__stripe_shim_active__) return result;
3327
+ return _apply(
3328
+ BeforeItemCreationResultDescriptor,
3329
+ _TypeToProtoWire,
3330
+ result
3331
+ );
3332
+ }
3333
+ RecurringBillingItemHandling2.prepareResultBeforeItemCreation = prepareResultBeforeItemCreation;
3334
+ function $platformWrapBeforeItemCreation(configTransformer) {
3335
+ return (cls, wireArgs, wireConfig, ctx) => {
3336
+ __stripe_shim_active__ = true;
3337
+ const instance = new cls();
3338
+ const request = _apply(
3339
+ BeforeItemCreationInputDescriptor,
3340
+ _ProtoWireToType,
3341
+ wireArgs
3342
+ );
3343
+ const config = configTransformer !== void 0 ? configTransformer(wireConfig, _configAppContextFromContext(ctx)) : wireConfig;
3344
+ const result = instance.beforeItemCreation(request, config, ctx);
3345
+ if (_isPromiseLike(result)) {
3346
+ return Promise.resolve(result).then((r) => {
3347
+ const typedR = r;
3348
+ return _apply(BeforeItemCreationResultDescriptor, _TypeToProtoWire, typedR);
3349
+ });
3350
+ }
3351
+ const typedResult = result;
3352
+ return _apply(BeforeItemCreationResultDescriptor, _TypeToProtoWire, typedResult);
3353
+ };
3354
+ }
3355
+ RecurringBillingItemHandling2.$platformWrapBeforeItemCreation = $platformWrapBeforeItemCreation;
3356
+ function prepareArgsFilterItems(proto) {
3357
+ if (__stripe_shim_active__) {
3358
+ return proto;
3359
+ }
3360
+ return _apply(
3361
+ FilterItemsInputDescriptor,
3362
+ _ProtoWireToType,
3363
+ proto
3364
+ );
3365
+ }
3366
+ RecurringBillingItemHandling2.prepareArgsFilterItems = prepareArgsFilterItems;
3367
+ function prepareResultFilterItems(result) {
3368
+ if (__stripe_shim_active__) return result;
3369
+ return _apply(
3370
+ FilterItemsResultDescriptor,
3371
+ _TypeToProtoWire,
3372
+ result
3373
+ );
3374
+ }
3375
+ RecurringBillingItemHandling2.prepareResultFilterItems = prepareResultFilterItems;
3376
+ function $platformWrapFilterItems(configTransformer) {
3377
+ return (cls, wireArgs, wireConfig, ctx) => {
3378
+ __stripe_shim_active__ = true;
3379
+ const instance = new cls();
3380
+ const request = _apply(
3381
+ FilterItemsInputDescriptor,
3382
+ _ProtoWireToType,
3383
+ wireArgs
3384
+ );
3385
+ const config = configTransformer !== void 0 ? configTransformer(wireConfig, _configAppContextFromContext(ctx)) : wireConfig;
3386
+ const result = instance.filterItems(request, config, ctx);
3387
+ if (_isPromiseLike(result)) {
3388
+ return Promise.resolve(result).then((r) => {
3389
+ const typedR = r;
3390
+ return _apply(FilterItemsResultDescriptor, _TypeToProtoWire, typedR);
3391
+ });
3392
+ }
3393
+ const typedResult = result;
3394
+ return _apply(FilterItemsResultDescriptor, _TypeToProtoWire, typedResult);
3395
+ };
3396
+ }
3397
+ RecurringBillingItemHandling2.$platformWrapFilterItems = $platformWrapFilterItems;
3398
+ function prepareArgsGroupItems(proto) {
3399
+ if (__stripe_shim_active__) {
3400
+ return proto;
3401
+ }
3402
+ return _apply(
3403
+ GroupItemsInputDescriptor,
3404
+ _ProtoWireToType,
3405
+ proto
3406
+ );
3407
+ }
3408
+ RecurringBillingItemHandling2.prepareArgsGroupItems = prepareArgsGroupItems;
3409
+ function prepareResultGroupItems(result) {
3410
+ if (__stripe_shim_active__) return result;
3411
+ return _apply(
3412
+ GroupItemsResultDescriptor,
3413
+ _TypeToProtoWire,
3414
+ result
3415
+ );
3416
+ }
3417
+ RecurringBillingItemHandling2.prepareResultGroupItems = prepareResultGroupItems;
3418
+ function $platformWrapGroupItems(configTransformer) {
3419
+ return (cls, wireArgs, wireConfig, ctx) => {
3420
+ __stripe_shim_active__ = true;
3421
+ const instance = new cls();
3422
+ const request = _apply(
3423
+ GroupItemsInputDescriptor,
3424
+ _ProtoWireToType,
3425
+ wireArgs
3426
+ );
3427
+ const config = configTransformer !== void 0 ? configTransformer(wireConfig, _configAppContextFromContext(ctx)) : wireConfig;
3428
+ const result = instance.groupItems(request, config, ctx);
3429
+ if (_isPromiseLike(result)) {
3430
+ return Promise.resolve(result).then((r) => {
3431
+ const typedR = r;
3432
+ return _apply(GroupItemsResultDescriptor, _TypeToProtoWire, typedR);
3433
+ });
3434
+ }
3435
+ const typedResult = result;
3436
+ return _apply(GroupItemsResultDescriptor, _TypeToProtoWire, typedResult);
3437
+ };
3438
+ }
3439
+ RecurringBillingItemHandling2.$platformWrapGroupItems = $platformWrapGroupItems;
3440
+ })(RecurringBillingItemHandling || (RecurringBillingItemHandling = {}));
3441
+
3442
+ // src/extensions/core/index.ts
3443
+ var core_exports = {};
3444
+ __export(core_exports, {
3445
+ Workflows: () => workflows_exports
3446
+ });
3447
+
3448
+ // src/extensions/core/workflows/index.ts
3449
+ var workflows_exports = {};
3450
+ __export(workflows_exports, {
3451
+ CustomAction: () => CustomAction
3452
+ });
3453
+
3454
+ // src/extensions/core/workflows/custom_action.ts
3455
+ var CustomAction;
3456
+ ((CustomAction3) => {
3457
+ const GetFormStateResponseDescriptor = new _ShapeDescriptor(
3458
+ "GetFormStateResponse",
3459
+ [
3460
+ { type: "values", transform: _required(_translateMap(_identity, _identity)) },
3461
+ {
3462
+ type: "config",
3463
+ transform: _required(
3464
+ _translateMap(
3465
+ _identity,
3466
+ _translateShape(() => FormStateFieldConfigDescriptor)
3467
+ )
3468
+ )
3469
+ }
3470
+ ]
3471
+ );
3472
+ const FormStateFieldConfigDescriptor = new _ShapeDescriptor(
3473
+ "FormStateFieldConfig",
3474
+ [
3475
+ {
3476
+ type: "options",
3477
+ transform: _required(
3478
+ _translateArray(_translateShape(() => SelectOptionDescriptor))
3479
+ )
3480
+ },
3481
+ { type: "schema", transform: _required(_translateMap(_identity, _identity)) },
3482
+ { type: "disabled", transform: _identity },
3483
+ { type: "hidden", transform: _identity },
3484
+ { type: "warning", transform: _identity },
3485
+ { type: "error", transform: _identity }
3486
+ ]
3487
+ );
3488
+ const SelectOptionDescriptor = new _ShapeDescriptor(
3489
+ "SelectOption",
3490
+ [
3491
+ { type: "value", transform: _required() },
3492
+ { type: "label", transform: _required() }
3493
+ ]
3494
+ );
3495
+ const GetFormStateRequestDescriptor = new _ShapeDescriptor(
3496
+ "GetFormStateRequest",
3497
+ [
3498
+ { type: "values", transform: _required(_translateMap(_identity, _identity)) },
3499
+ { type: "changedField", transform: _identity }
3500
+ ]
3501
+ );
3502
+ const ExecuteCustomActionResponseDescriptor = new _ShapeDescriptor("ExecuteCustomActionResponse", []);
3503
+ const ExecuteCustomActionRequestDescriptor = new _ShapeDescriptor("ExecuteCustomActionRequest", [
3504
+ { type: "customInput", transform: _required(_translateMap(_identity, _identity)) }
3505
+ ]);
3506
+ let __stripe_shim_active__ = false;
3507
+ function prepareArgsExecute(proto) {
3508
+ if (__stripe_shim_active__) {
3509
+ return proto;
3510
+ }
3511
+ return _apply(
3512
+ ExecuteCustomActionRequestDescriptor,
3513
+ _ProtoWireToType,
3514
+ proto
3515
+ );
3516
+ }
3517
+ CustomAction3.prepareArgsExecute = prepareArgsExecute;
3518
+ function prepareResultExecute(result) {
3519
+ if (__stripe_shim_active__) return result;
3520
+ return _apply(
3521
+ ExecuteCustomActionResponseDescriptor,
3522
+ _TypeToProtoWire,
3523
+ result
3524
+ );
3525
+ }
3526
+ CustomAction3.prepareResultExecute = prepareResultExecute;
3527
+ function $platformWrapExecute(configTransformer) {
3528
+ return (cls, wireArgs, wireConfig, ctx) => {
3529
+ __stripe_shim_active__ = true;
3530
+ const instance = new cls();
3531
+ const request = _apply(
3532
+ ExecuteCustomActionRequestDescriptor,
3533
+ _ProtoWireToType,
3534
+ wireArgs
3535
+ );
3536
+ const config = configTransformer !== void 0 ? configTransformer(wireConfig, _configAppContextFromContext(ctx)) : wireConfig;
3537
+ const result = instance.execute(request, config, ctx);
3538
+ if (_isPromiseLike(result)) {
3539
+ return Promise.resolve(result).then((r) => {
3540
+ const typedR = r;
3541
+ return _apply(ExecuteCustomActionResponseDescriptor, _TypeToProtoWire, typedR);
3542
+ });
3543
+ }
3544
+ const typedResult = result;
3545
+ return _apply(ExecuteCustomActionResponseDescriptor, _TypeToProtoWire, typedResult);
3546
+ };
3547
+ }
3548
+ CustomAction3.$platformWrapExecute = $platformWrapExecute;
3549
+ function prepareArgsGetFormState(proto) {
3550
+ if (__stripe_shim_active__) {
3551
+ return proto;
3552
+ }
3553
+ return _apply(
3554
+ GetFormStateRequestDescriptor,
3555
+ _ProtoWireToType,
3556
+ proto
3557
+ );
3558
+ }
3559
+ CustomAction3.prepareArgsGetFormState = prepareArgsGetFormState;
3560
+ function prepareResultGetFormState(result) {
3561
+ if (__stripe_shim_active__) return result;
3562
+ return _apply(
3563
+ GetFormStateResponseDescriptor,
3564
+ _TypeToProtoWire,
3565
+ result
3566
+ );
3567
+ }
3568
+ CustomAction3.prepareResultGetFormState = prepareResultGetFormState;
3569
+ function $platformWrapGetFormState(configTransformer) {
3570
+ return (cls, wireArgs, wireConfig, ctx) => {
3571
+ __stripe_shim_active__ = true;
3572
+ const instance = new cls();
3573
+ const request = _apply(
3574
+ GetFormStateRequestDescriptor,
3575
+ _ProtoWireToType,
3576
+ wireArgs
3577
+ );
3578
+ const config = configTransformer !== void 0 ? configTransformer(wireConfig, _configAppContextFromContext(ctx)) : wireConfig;
3579
+ const result = instance.getFormState(request, config, ctx);
3580
+ if (_isPromiseLike(result)) {
3581
+ return Promise.resolve(result).then((r) => {
3582
+ const typedR = r;
3583
+ return _apply(GetFormStateResponseDescriptor, _TypeToProtoWire, typedR);
3584
+ });
3585
+ }
3586
+ const typedResult = result;
3587
+ return _apply(GetFormStateResponseDescriptor, _TypeToProtoWire, typedResult);
3588
+ };
3589
+ }
3590
+ CustomAction3.$platformWrapGetFormState = $platformWrapGetFormState;
3591
+ })(CustomAction || (CustomAction = {}));
3592
+
3593
+ // src/extensions/extend/index.ts
3594
+ var extend_exports = {};
3595
+ __export(extend_exports, {
3596
+ Workflows: () => workflows_exports2
3597
+ });
3598
+
3599
+ // src/extensions/extend/workflows/index.ts
3600
+ var workflows_exports2 = {};
3601
+ __export(workflows_exports2, {
3602
+ CustomAction: () => CustomAction2
3603
+ });
3604
+
3605
+ // src/extensions/extend/workflows/custom_action.ts
3606
+ var CustomAction2;
3607
+ ((CustomAction3) => {
3608
+ const GetFormStateResponseDescriptor = new _ShapeDescriptor(
3609
+ "GetFormStateResponse",
3610
+ [
3611
+ { type: "values", transform: _required(_translateMap(_identity, _identity)) },
3612
+ {
3613
+ type: "config",
3614
+ transform: _required(
3615
+ _translateMap(
3616
+ _identity,
3617
+ _translateShape(() => FormStateFieldConfigDescriptor)
3618
+ )
3619
+ )
3620
+ }
3621
+ ]
3622
+ );
3623
+ const FormStateFieldConfigDescriptor = new _ShapeDescriptor(
3624
+ "FormStateFieldConfig",
3625
+ [
3626
+ {
3627
+ type: "options",
3628
+ transform: _required(
3629
+ _translateArray(_translateShape(() => SelectOptionDescriptor))
3630
+ )
3631
+ },
3632
+ { type: "schema", transform: _required(_translateMap(_identity, _identity)) },
3633
+ { type: "disabled", transform: _identity },
3634
+ { type: "hidden", transform: _identity },
3635
+ { type: "warning", transform: _identity },
3636
+ { type: "error", transform: _identity }
3637
+ ]
3638
+ );
3639
+ const SelectOptionDescriptor = new _ShapeDescriptor(
3640
+ "SelectOption",
3641
+ [
3642
+ { type: "value", transform: _required() },
3643
+ { type: "label", transform: _required() }
3644
+ ]
3645
+ );
3646
+ const GetFormStateRequestDescriptor = new _ShapeDescriptor(
3647
+ "GetFormStateRequest",
3648
+ [
3649
+ { type: "values", transform: _required(_translateMap(_identity, _identity)) },
3650
+ { type: "changedField", transform: _identity }
3651
+ ]
3652
+ );
3653
+ const ExecuteCustomActionResponseDescriptor = new _ShapeDescriptor("ExecuteCustomActionResponse", []);
3654
+ const ExecuteCustomActionRequestDescriptor = new _ShapeDescriptor("ExecuteCustomActionRequest", [
3655
+ { type: "customInput", transform: _required(_translateMap(_identity, _identity)) }
3656
+ ]);
3657
+ let __stripe_shim_active__ = false;
3658
+ function prepareArgsExecute(proto) {
3659
+ if (__stripe_shim_active__) {
3660
+ return proto;
3661
+ }
3662
+ return _apply(
3663
+ ExecuteCustomActionRequestDescriptor,
3664
+ _ProtoWireToType,
3665
+ proto
3666
+ );
3667
+ }
3668
+ CustomAction3.prepareArgsExecute = prepareArgsExecute;
3669
+ function prepareResultExecute(result) {
3670
+ if (__stripe_shim_active__) return result;
3671
+ return _apply(
3672
+ ExecuteCustomActionResponseDescriptor,
3673
+ _TypeToProtoWire,
3674
+ result
3675
+ );
3676
+ }
3677
+ CustomAction3.prepareResultExecute = prepareResultExecute;
3678
+ function $platformWrapExecute(configTransformer) {
3679
+ return (cls, wireArgs, wireConfig, ctx) => {
3680
+ __stripe_shim_active__ = true;
3681
+ const instance = new cls();
3682
+ const request = _apply(
3683
+ ExecuteCustomActionRequestDescriptor,
3684
+ _ProtoWireToType,
3685
+ wireArgs
3686
+ );
3687
+ const config = configTransformer !== void 0 ? configTransformer(wireConfig, _configAppContextFromContext(ctx)) : wireConfig;
3688
+ const result = instance.execute(request, config, ctx);
3689
+ if (_isPromiseLike(result)) {
3690
+ return Promise.resolve(result).then((r) => {
3691
+ const typedR = r;
3692
+ return _apply(ExecuteCustomActionResponseDescriptor, _TypeToProtoWire, typedR);
3693
+ });
3694
+ }
3695
+ const typedResult = result;
3696
+ return _apply(ExecuteCustomActionResponseDescriptor, _TypeToProtoWire, typedResult);
3697
+ };
3698
+ }
3699
+ CustomAction3.$platformWrapExecute = $platformWrapExecute;
3700
+ function prepareArgsGetFormState(proto) {
3701
+ if (__stripe_shim_active__) {
3702
+ return proto;
3703
+ }
3704
+ return _apply(
3705
+ GetFormStateRequestDescriptor,
3706
+ _ProtoWireToType,
3707
+ proto
3708
+ );
3709
+ }
3710
+ CustomAction3.prepareArgsGetFormState = prepareArgsGetFormState;
3711
+ function prepareResultGetFormState(result) {
3712
+ if (__stripe_shim_active__) return result;
3713
+ return _apply(
3714
+ GetFormStateResponseDescriptor,
3715
+ _TypeToProtoWire,
3716
+ result
3717
+ );
3718
+ }
3719
+ CustomAction3.prepareResultGetFormState = prepareResultGetFormState;
3720
+ function $platformWrapGetFormState(configTransformer) {
3721
+ return (cls, wireArgs, wireConfig, ctx) => {
3722
+ __stripe_shim_active__ = true;
3723
+ const instance = new cls();
3724
+ const request = _apply(
3725
+ GetFormStateRequestDescriptor,
3726
+ _ProtoWireToType,
3727
+ wireArgs
3728
+ );
3729
+ const config = configTransformer !== void 0 ? configTransformer(wireConfig, _configAppContextFromContext(ctx)) : wireConfig;
3730
+ const result = instance.getFormState(request, config, ctx);
3731
+ if (_isPromiseLike(result)) {
3732
+ return Promise.resolve(result).then((r) => {
3733
+ const typedR = r;
3734
+ return _apply(GetFormStateResponseDescriptor, _TypeToProtoWire, typedR);
3735
+ });
3736
+ }
3737
+ const typedResult = result;
3738
+ return _apply(GetFormStateResponseDescriptor, _TypeToProtoWire, typedResult);
3739
+ };
3740
+ }
3741
+ CustomAction3.$platformWrapGetFormState = $platformWrapGetFormState;
3742
+ })(CustomAction2 || (CustomAction2 = {}));
1426
3743
  export {
3744
+ billing_exports as Billing,
3745
+ core_exports as Core,
1427
3746
  DEFAULT_DIV_PRECISION,
1428
3747
  Decimal,
1429
3748
  DecimalRoundingPresets,
3749
+ extend_exports as Extend,
1430
3750
  Integer,
1431
3751
  PositiveInteger,
1432
3752
  Ref,