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