@epilot/pricing-client 2.1.4 → 2.1.5

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.
package/dist/index.js CHANGED
@@ -1,11 +1,7 @@
1
1
  "use strict";
2
2
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
3
  if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
4
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
9
5
  }) : (function(o, m, k, k2) {
10
6
  if (k2 === undefined) k2 = k;
11
7
  o[k2] = m[k];
package/dist/openapi.d.ts CHANGED
@@ -158,12 +158,105 @@ declare namespace Components {
158
158
  }[];
159
159
  }
160
160
  /**
161
- * Represents a valid base price item from a client.
161
+ * Represents a price item
162
+ * example:
163
+ * {
164
+ * "$ref": "#/components/examples/price-item"
165
+ * }
162
166
  */
163
- export interface BasePriceItemDto {
167
+ export interface BasePriceItem {
168
+ /**
169
+ * price item id
170
+ */
171
+ id?: string;
172
+ metadata?: /* A set of key-value pairs used to store meta data information about an entity. */ MetaData;
173
+ /**
174
+ * The unit amount value
175
+ */
176
+ unit_amount?: number;
177
+ /**
178
+ * Total before any (discounts or) taxes are applied.
179
+ */
180
+ amount_subtotal?: number;
181
+ /**
182
+ * Net unit amount without taxes or discounts.
183
+ */
184
+ unit_amount_net?: number;
185
+ /**
186
+ * The unit amount in cents to be charged, represented as a decimal string with at most 12 decimal places.
187
+ */
188
+ unit_amount_decimal?: string;
189
+ /**
190
+ * Total after (discounts and) taxes.
191
+ */
192
+ amount_total?: number;
193
+ currency?: /**
194
+ * Three-letter ISO currency code, in lowercase. Must be a supported currency.
195
+ * ISO 4217 CURRENCY CODES as specified in the documentation: https://www.iso.org/iso-4217-currency-codes.html
196
+ *
197
+ * example:
198
+ * EUR
199
+ */
200
+ Currency;
201
+ /**
202
+ * An arbitrary string attached to the price item. Often useful for displaying to users. Defaults to product name.
203
+ */
204
+ description?: string;
205
+ /**
206
+ * The quantity of products being purchased.
207
+ */
208
+ quantity?: number;
209
+ /**
210
+ * The id of the product.
211
+ */
212
+ product_id?: string;
213
+ /**
214
+ * The id of the price.
215
+ */
216
+ price_id?: string;
217
+ /**
218
+ * The flag for prices that contain price components.
219
+ */
220
+ is_composite_price?: boolean;
221
+ /**
222
+ * The price snapshot data.
223
+ */
224
+ _price?: /* The price snapshot data. */ /**
225
+ * The price entity schema for simple pricing
226
+ * example:
227
+ * {
228
+ * "$ref": "#/components/examples/price"
229
+ * }
230
+ */
231
+ Price | /**
232
+ * The price entity schema for dynamic pricing
233
+ * example:
234
+ * {
235
+ * "$ref": "#/components/examples/composite-price"
236
+ * }
237
+ */
238
+ CompositePrice;
239
+ _product?: /**
240
+ * The product entity
241
+ * example:
242
+ * {
243
+ * "$ref": "#/components/examples/product"
244
+ * }
245
+ */
246
+ Product;
247
+ /**
248
+ * The taxes applied to the price item.
249
+ */
250
+ taxes?: (/* A tax amount associated with a specific tax rate. */ TaxAmount)[];
164
251
  /**
165
- * An additional structure to keep metadata related with the price item.
252
+ * The sum of amounts of the price items by recurrence.
166
253
  */
254
+ recurrences?: (/* An amount associated with a specific recurrence. */ RecurrenceAmount)[];
255
+ }
256
+ /**
257
+ * Represents a valid base price item from a client.
258
+ */
259
+ export interface BasePriceItemDto {
167
260
  metadata?: /* A set of key-value pairs used to store meta data information about an entity. */ MetaData;
168
261
  /**
169
262
  * The quantity of products being purchased.
@@ -190,16 +283,96 @@ declare namespace Components {
190
283
  */
191
284
  recurrences?: (/* An amount associated with a specific recurrence. */ RecurrenceAmountDto)[];
192
285
  /**
193
- * The snapshot of the product linked to the price item.
286
+ * The flag for prices that contain price components.
194
287
  */
195
- _product?: /**
196
- * The product entity
288
+ is_composite_price?: boolean;
289
+ /**
290
+ * The snapshot of the product.
197
291
  * example:
198
292
  * {
199
293
  * "$ref": "#/components/examples/product"
200
294
  * }
201
295
  */
202
- Product;
296
+ _product?: {
297
+ [name: string]: any;
298
+ /**
299
+ * The product code
300
+ */
301
+ code?: string;
302
+ /**
303
+ * The type of Product:
304
+ *
305
+ * | type | description |
306
+ * |----| ----|
307
+ * | `product` | Represents a physical good |
308
+ * | `service` | Represents a service or virtual product |
309
+ *
310
+ */
311
+ type?: "product" | "service";
312
+ /**
313
+ * The product main name
314
+ */
315
+ name?: string;
316
+ feature?: {
317
+ /**
318
+ * An arbitrary set of tags attached to a feature
319
+ */
320
+ _tags?: string[];
321
+ feature?: string;
322
+ }[];
323
+ /**
324
+ * Stores references to products that can be cross sold with the current product.
325
+ */
326
+ cross_sellable_products?: {
327
+ $relation?: EntityRelation[];
328
+ };
329
+ /**
330
+ * Stores references to a set of file images of the product
331
+ */
332
+ product_images?: {
333
+ $relation?: EntityRelation[];
334
+ };
335
+ /**
336
+ * Stores references to a set of files downloadable from the product.
337
+ * e.g: tech specifications, quality control sheets, privacy policy agreements
338
+ *
339
+ */
340
+ product_downloads?: {
341
+ $relation?: EntityRelation[];
342
+ };
343
+ /**
344
+ * A set of [prices](/api/pricing#tag/simple_price_schema) or [composite prices](/api/pricing#tag/dynamic_price_schema) for the current product.
345
+ */
346
+ price_options?: {
347
+ $relation?: EntityRelation[];
348
+ };
349
+ /**
350
+ * Stores references to the availability files that define where this product is available.
351
+ * These files are used when interacting with products via epilot Journeys, thought the AvailabilityCheck block.
352
+ *
353
+ */
354
+ _availability_files?: File[];
355
+ /**
356
+ * The product id
357
+ */
358
+ _id?: string;
359
+ /**
360
+ * The autogenerated product title
361
+ */
362
+ _title?: string;
363
+ /**
364
+ * The organization id the product belongs to
365
+ */
366
+ _org_id?: string;
367
+ /**
368
+ * The product creation date
369
+ */
370
+ _created_at?: string;
371
+ /**
372
+ * The product last update date
373
+ */
374
+ _updated_at?: string;
375
+ };
203
376
  }
204
377
  export type BillingPeriod = "weekly" | "monthly" | "every_quarter" | "every_6_months" | "yearly" | "one_time";
205
378
  /**
@@ -438,6 +611,10 @@ declare namespace Components {
438
611
  * EUR
439
612
  */
440
613
  Currency;
614
+ /**
615
+ * The flag for prices that contain price components.
616
+ */
617
+ is_composite_price?: boolean;
441
618
  /**
442
619
  * The price creation date
443
620
  */
@@ -542,10 +719,7 @@ declare namespace Components {
542
719
  * }
543
720
  */
544
721
  CompositePrice;
545
- /**
546
- * The product snapshot data.
547
- */
548
- _product?: /* The product snapshot data. */ /**
722
+ _product?: /**
549
723
  * The product entity
550
724
  * example:
551
725
  * {
@@ -602,14 +776,97 @@ declare namespace Components {
602
776
  * The taxes applied to the price item.
603
777
  */
604
778
  recurrences?: (/* An amount associated with a specific recurrence. */ RecurrenceAmountDto)[];
605
- _product?: /**
606
- * The product entity
779
+ /**
780
+ * The flag for prices that contain price components.
781
+ */
782
+ is_composite_price?: boolean;
783
+ /**
784
+ * The snapshot of the product.
607
785
  * example:
608
786
  * {
609
787
  * "$ref": "#/components/examples/product"
610
788
  * }
611
789
  */
612
- Product;
790
+ _product?: {
791
+ [name: string]: any;
792
+ /**
793
+ * The product code
794
+ */
795
+ code?: string;
796
+ /**
797
+ * The type of Product:
798
+ *
799
+ * | type | description |
800
+ * |----| ----|
801
+ * | `product` | Represents a physical good |
802
+ * | `service` | Represents a service or virtual product |
803
+ *
804
+ */
805
+ type?: "product" | "service";
806
+ /**
807
+ * The product main name
808
+ */
809
+ name?: string;
810
+ feature?: {
811
+ /**
812
+ * An arbitrary set of tags attached to a feature
813
+ */
814
+ _tags?: string[];
815
+ feature?: string;
816
+ }[];
817
+ /**
818
+ * Stores references to products that can be cross sold with the current product.
819
+ */
820
+ cross_sellable_products?: {
821
+ $relation?: EntityRelation[];
822
+ };
823
+ /**
824
+ * Stores references to a set of file images of the product
825
+ */
826
+ product_images?: {
827
+ $relation?: EntityRelation[];
828
+ };
829
+ /**
830
+ * Stores references to a set of files downloadable from the product.
831
+ * e.g: tech specifications, quality control sheets, privacy policy agreements
832
+ *
833
+ */
834
+ product_downloads?: {
835
+ $relation?: EntityRelation[];
836
+ };
837
+ /**
838
+ * A set of [prices](/api/pricing#tag/simple_price_schema) or [composite prices](/api/pricing#tag/dynamic_price_schema) for the current product.
839
+ */
840
+ price_options?: {
841
+ $relation?: EntityRelation[];
842
+ };
843
+ /**
844
+ * Stores references to the availability files that define where this product is available.
845
+ * These files are used when interacting with products via epilot Journeys, thought the AvailabilityCheck block.
846
+ *
847
+ */
848
+ _availability_files?: File[];
849
+ /**
850
+ * The product id
851
+ */
852
+ _id?: string;
853
+ /**
854
+ * The autogenerated product title
855
+ */
856
+ _title?: string;
857
+ /**
858
+ * The organization id the product belongs to
859
+ */
860
+ _org_id?: string;
861
+ /**
862
+ * The product creation date
863
+ */
864
+ _created_at?: string;
865
+ /**
866
+ * The product last update date
867
+ */
868
+ _updated_at?: string;
869
+ };
613
870
  /**
614
871
  * Contains price item configurations, per price component, when the main price item is a [composite price](/api/pricing#tag/dynamic_price_schema).
615
872
  */
@@ -1151,6 +1408,10 @@ declare namespace Components {
1151
1408
  * Whether the price can be used for new purchases.
1152
1409
  */
1153
1410
  active?: boolean;
1411
+ /**
1412
+ * The flag for prices that contain price components.
1413
+ */
1414
+ is_composite_price?: boolean;
1154
1415
  /**
1155
1416
  * Describes how to compute the price per period. Either `per_unit` or `tiered`.
1156
1417
  * - `per_unit` indicates that the fixed amount (specified in unit_amount or unit_amount_decimal) will be charged per unit in quantity
@@ -1395,10 +1656,7 @@ declare namespace Components {
1395
1656
  * }
1396
1657
  */
1397
1658
  CompositePrice;
1398
- /**
1399
- * The product snapshot data.
1400
- */
1401
- _product?: /* The product snapshot data. */ /**
1659
+ _product?: /**
1402
1660
  * The product entity
1403
1661
  * example:
1404
1662
  * {
@@ -1414,6 +1672,10 @@ declare namespace Components {
1414
1672
  * The sum of amounts of the price items by recurrence.
1415
1673
  */
1416
1674
  recurrences?: (/* An amount associated with a specific recurrence. */ RecurrenceAmount)[];
1675
+ /**
1676
+ * One of `one_time` or `recurring` depending on whether the price is for a one-time purchase or a recurring (subscription) purchase.
1677
+ */
1678
+ type?: "one_time" | "recurring";
1417
1679
  }
1418
1680
  /**
1419
1681
  * Represents a price input to the pricing library.
@@ -1444,14 +1706,101 @@ declare namespace Components {
1444
1706
  * The taxes applied to the price item.
1445
1707
  */
1446
1708
  recurrences?: (/* An amount associated with a specific recurrence. */ RecurrenceAmountDto)[];
1447
- _product?: /**
1448
- * The product entity
1709
+ /**
1710
+ * The flag for prices that contain price components.
1711
+ */
1712
+ is_composite_price?: boolean;
1713
+ /**
1714
+ * The snapshot of the product.
1449
1715
  * example:
1450
1716
  * {
1451
1717
  * "$ref": "#/components/examples/product"
1452
1718
  * }
1453
1719
  */
1454
- Product;
1720
+ _product?: {
1721
+ [name: string]: any;
1722
+ /**
1723
+ * The product code
1724
+ */
1725
+ code?: string;
1726
+ /**
1727
+ * The type of Product:
1728
+ *
1729
+ * | type | description |
1730
+ * |----| ----|
1731
+ * | `product` | Represents a physical good |
1732
+ * | `service` | Represents a service or virtual product |
1733
+ *
1734
+ */
1735
+ type?: "product" | "service";
1736
+ /**
1737
+ * The product main name
1738
+ */
1739
+ name?: string;
1740
+ feature?: {
1741
+ /**
1742
+ * An arbitrary set of tags attached to a feature
1743
+ */
1744
+ _tags?: string[];
1745
+ feature?: string;
1746
+ }[];
1747
+ /**
1748
+ * Stores references to products that can be cross sold with the current product.
1749
+ */
1750
+ cross_sellable_products?: {
1751
+ $relation?: EntityRelation[];
1752
+ };
1753
+ /**
1754
+ * Stores references to a set of file images of the product
1755
+ */
1756
+ product_images?: {
1757
+ $relation?: EntityRelation[];
1758
+ };
1759
+ /**
1760
+ * Stores references to a set of files downloadable from the product.
1761
+ * e.g: tech specifications, quality control sheets, privacy policy agreements
1762
+ *
1763
+ */
1764
+ product_downloads?: {
1765
+ $relation?: EntityRelation[];
1766
+ };
1767
+ /**
1768
+ * A set of [prices](/api/pricing#tag/simple_price_schema) or [composite prices](/api/pricing#tag/dynamic_price_schema) for the current product.
1769
+ */
1770
+ price_options?: {
1771
+ $relation?: EntityRelation[];
1772
+ };
1773
+ /**
1774
+ * Stores references to the availability files that define where this product is available.
1775
+ * These files are used when interacting with products via epilot Journeys, thought the AvailabilityCheck block.
1776
+ *
1777
+ */
1778
+ _availability_files?: File[];
1779
+ /**
1780
+ * The product id
1781
+ */
1782
+ _id?: string;
1783
+ /**
1784
+ * The autogenerated product title
1785
+ */
1786
+ _title?: string;
1787
+ /**
1788
+ * The organization id the product belongs to
1789
+ */
1790
+ _org_id?: string;
1791
+ /**
1792
+ * The product creation date
1793
+ */
1794
+ _created_at?: string;
1795
+ /**
1796
+ * The product last update date
1797
+ */
1798
+ _updated_at?: string;
1799
+ };
1800
+ /**
1801
+ * One of `one_time` or `recurring` depending on whether the price is for a one-time purchase or a recurring (subscription) purchase.
1802
+ */
1803
+ type?: "one_time" | "recurring";
1455
1804
  /**
1456
1805
  * The unit amount value
1457
1806
  */
@@ -1460,14 +1809,172 @@ declare namespace Components {
1460
1809
  * The unit amount in cents to be charged, represented as a decimal string with at most 12 decimal places.
1461
1810
  */
1462
1811
  unit_amount_decimal?: string;
1463
- _price?: /**
1464
- * The price entity schema for simple pricing
1812
+ /**
1813
+ * The snapshot of the price linked to the price item.
1465
1814
  * example:
1466
1815
  * {
1467
1816
  * "$ref": "#/components/examples/price"
1468
1817
  * }
1469
1818
  */
1470
- Price;
1819
+ _price?: {
1820
+ [name: string]: any;
1821
+ /**
1822
+ * Whether the price can be used for new purchases.
1823
+ */
1824
+ active?: boolean;
1825
+ /**
1826
+ * The flag for prices that contain price components.
1827
+ */
1828
+ is_composite_price?: boolean;
1829
+ /**
1830
+ * Describes how to compute the price per period. Either `per_unit` or `tiered`.
1831
+ * - `per_unit` indicates that the fixed amount (specified in unit_amount or unit_amount_decimal) will be charged per unit in quantity
1832
+ * - `tiered` indicates that the unit pricing will be computed using a tiering strategy as defined using the tiers and tiers_mode attributes.
1833
+ *
1834
+ * ⚠️ Tiered pricing is **not supported** yet.
1835
+ *
1836
+ */
1837
+ billing_scheme?: "per_unit";
1838
+ /**
1839
+ * A brief description of the price.
1840
+ */
1841
+ description?: string;
1842
+ /**
1843
+ * The default tax rate applicable to the product.
1844
+ * This field is deprecated, use the new `tax` attribute.
1845
+ *
1846
+ */
1847
+ sales_tax?: /**
1848
+ * The default tax rate applicable to the product.
1849
+ * This field is deprecated, use the new `tax` attribute.
1850
+ *
1851
+ */
1852
+ SalesTax;
1853
+ /**
1854
+ * The default tax rate applied to the price
1855
+ */
1856
+ tax?: /* The default tax rate applied to the price */ {
1857
+ $relation?: EntityRelation[];
1858
+ } | /**
1859
+ * the tax configuration
1860
+ * example:
1861
+ * {
1862
+ * "_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
1863
+ * "type": "VAT",
1864
+ * "description": "Tax description",
1865
+ * "behavior": "Exclusive",
1866
+ * "active": "true",
1867
+ * "region": "DE",
1868
+ * "region_label": "Germany",
1869
+ * "_org": "123",
1870
+ * "_schema": "tax",
1871
+ * "_tags": [
1872
+ * "example",
1873
+ * "mock"
1874
+ * ],
1875
+ * "_created_at": "2021-02-09T12:41:43.662Z",
1876
+ * "_updated_at": "2021-02-09T12:41:43.662Z"
1877
+ * }
1878
+ */
1879
+ Tax[];
1880
+ /**
1881
+ * Specifies whether the price is considered `inclusive` of taxes or `exclusive` of taxes.
1882
+ * One of `inclusive`, `exclusive`, or `unspecified`.
1883
+ *
1884
+ */
1885
+ tax_behavior?: "inclusive" | "exclusive";
1886
+ /**
1887
+ * Defines the tiered pricing type of the price.
1888
+ */
1889
+ tiers_mode?: "standard";
1890
+ /**
1891
+ * One of `one_time` or `recurring` depending on whether the price is for a one-time purchase or a recurring (subscription) purchase.
1892
+ */
1893
+ type?: "one_time" | "recurring";
1894
+ /**
1895
+ * For recurring prices `billing_period` defines the default extent of the recurrence.
1896
+ */
1897
+ billing_period?: /* For recurring prices `billing_period` defines the default extent of the recurrence. */ BillingPeriod;
1898
+ /**
1899
+ * The unit amount in cents to be charged, represented as a whole integer if possible.
1900
+ */
1901
+ unit_amount?: number;
1902
+ /**
1903
+ * The unit amount in cents to be charged, represented as a decimal string with at most 12 decimal places.
1904
+ */
1905
+ unit_amount_decimal?: string;
1906
+ /**
1907
+ * Three-letter ISO currency code, in lowercase.
1908
+ */
1909
+ unit_amount_currency?: /* Three-letter ISO currency code, in lowercase. */ /**
1910
+ * Three-letter ISO currency code, in lowercase. Must be a supported currency.
1911
+ * ISO 4217 CURRENCY CODES as specified in the documentation: https://www.iso.org/iso-4217-currency-codes.html
1912
+ *
1913
+ * example:
1914
+ * EUR
1915
+ */
1916
+ Currency;
1917
+ /**
1918
+ * Defines the way the price amount is display in epilot journeys.
1919
+ */
1920
+ price_display_in_journeys?: "show_price" | "show_as_starting_price" | "show_as_on_request";
1921
+ /**
1922
+ * The billing period duration
1923
+ */
1924
+ billing_duration_amount?: number;
1925
+ /**
1926
+ * The billing period duration unit
1927
+ */
1928
+ billing_duration_unit?: "weeks" | "months" | "years";
1929
+ /**
1930
+ * The notice period duration
1931
+ */
1932
+ notice_time_amount?: number;
1933
+ /**
1934
+ * The notice period duration unit
1935
+ */
1936
+ notice_time_unit?: "weeks" | "months" | "years";
1937
+ /**
1938
+ * The termination period duration
1939
+ */
1940
+ termination_time_amount?: number;
1941
+ /**
1942
+ * The termination period duration unit
1943
+ */
1944
+ termination_time_unit?: "weeks" | "months" | "years";
1945
+ /**
1946
+ * The renewal period duration
1947
+ */
1948
+ renewal_duration_amount?: number;
1949
+ /**
1950
+ * The renewal period duration unit
1951
+ */
1952
+ renewal_duration_unit?: "weeks" | "months" | "years";
1953
+ /**
1954
+ * The price creation date
1955
+ */
1956
+ _created_at?: string;
1957
+ /**
1958
+ * The price id
1959
+ */
1960
+ _id?: string;
1961
+ /**
1962
+ * The price autogenerated title
1963
+ */
1964
+ _title?: string;
1965
+ /**
1966
+ * The price last update date
1967
+ */
1968
+ _updated_at?: string;
1969
+ /**
1970
+ * The organization id the price belongs to
1971
+ */
1972
+ _org_id?: string;
1973
+ /**
1974
+ * An arbitrary set of tags attached to the price
1975
+ */
1976
+ _tags?: string[];
1977
+ };
1471
1978
  }
1472
1979
  /**
1473
1980
  * Tracks a set of product prices, quantities, (discounts) and taxes.
@@ -1757,10 +2264,7 @@ declare namespace Components {
1757
2264
  * The tax rate value applied. With the release of the tax manager feature this field is being deprecated in favor of the tax field.
1758
2265
  */
1759
2266
  rateValue?: number;
1760
- /**
1761
- * The tax applied.
1762
- */
1763
- tax?: /* The tax applied. */ TaxBreakdownInfo;
2267
+ tax?: TaxBreakdownInfo;
1764
2268
  }
1765
2269
  /**
1766
2270
  * A valid tax rate from a client.
@@ -1772,10 +2276,7 @@ declare namespace Components {
1772
2276
  *
1773
2277
  */
1774
2278
  rate?: string;
1775
- /**
1776
- * The tax applied.
1777
- */
1778
- tax?: /* The tax applied. */ /**
2279
+ tax?: /**
1779
2280
  * the tax configuration
1780
2281
  * example:
1781
2282
  * {