@medusajs/types 1.12.0-snapshot-20240405070935 → 1.12.0-snapshot-20240405154416
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/auth/common/auth-user.d.ts +21 -16
- package/dist/auth/common/auth-user.d.ts.map +1 -1
- package/dist/auth/common/provider.d.ts +28 -15
- package/dist/auth/common/provider.d.ts.map +1 -1
- package/dist/auth/service.d.ts +137 -75
- package/dist/auth/service.d.ts.map +1 -1
- package/dist/bundles.d.ts +2 -0
- package/dist/bundles.d.ts.map +1 -1
- package/dist/bundles.js +3 -1
- package/dist/bundles.js.map +1 -1
- package/dist/cart/common.d.ts +443 -62
- package/dist/cart/common.d.ts.map +1 -1
- package/dist/cart/mutations.d.ts +483 -0
- package/dist/cart/mutations.d.ts.map +1 -1
- package/dist/cart/mutations.js.map +1 -1
- package/dist/cart/service.d.ts +1607 -0
- package/dist/cart/service.d.ts.map +1 -1
- package/dist/common/index.d.ts +1 -0
- package/dist/common/index.d.ts.map +1 -1
- package/dist/common/index.js +1 -0
- package/dist/common/index.js.map +1 -1
- package/dist/common/rule.d.ts +2 -0
- package/dist/common/rule.d.ts.map +1 -0
- package/dist/common/rule.js +3 -0
- package/dist/common/rule.js.map +1 -0
- package/dist/customer/service.d.ts +445 -197
- package/dist/customer/service.d.ts.map +1 -1
- package/dist/file/common.d.ts +14 -0
- package/dist/file/common.d.ts.map +1 -0
- package/dist/file/common.js +3 -0
- package/dist/file/common.js.map +1 -0
- package/dist/file/index.d.ts +4 -0
- package/dist/file/index.d.ts.map +1 -0
- package/dist/file/index.js +20 -0
- package/dist/file/index.js.map +1 -0
- package/dist/file/mutations.d.ts +18 -0
- package/dist/file/mutations.d.ts.map +1 -0
- package/dist/file/mutations.js +3 -0
- package/dist/file/mutations.js.map +1 -0
- package/dist/file/service.d.ts +76 -0
- package/dist/file/service.d.ts.map +1 -0
- package/dist/file/service.js +3 -0
- package/dist/file/service.js.map +1 -0
- package/dist/fulfillment/mutations/shipping-option-rule.d.ts +2 -2
- package/dist/fulfillment/mutations/shipping-option-rule.d.ts.map +1 -1
- package/dist/http/fulfillment/admin/fulfillment-address.d.ts +22 -0
- package/dist/http/fulfillment/admin/fulfillment-address.d.ts.map +1 -0
- package/dist/http/fulfillment/admin/fulfillment-address.js +3 -0
- package/dist/http/fulfillment/admin/fulfillment-address.js.map +1 -0
- package/dist/http/fulfillment/admin/fulfillment-item.d.ts +17 -0
- package/dist/http/fulfillment/admin/fulfillment-item.d.ts.map +1 -0
- package/dist/http/fulfillment/admin/fulfillment-item.js +3 -0
- package/dist/http/fulfillment/admin/fulfillment-item.js.map +1 -0
- package/dist/http/fulfillment/admin/fulfillment-label.d.ts +14 -0
- package/dist/http/fulfillment/admin/fulfillment-label.d.ts.map +1 -0
- package/dist/http/fulfillment/admin/fulfillment-label.js +3 -0
- package/dist/http/fulfillment/admin/fulfillment-label.js.map +1 -0
- package/dist/http/fulfillment/admin/fulfillment-provider.d.ts +12 -0
- package/dist/http/fulfillment/admin/fulfillment-provider.d.ts.map +1 -0
- package/dist/http/fulfillment/admin/fulfillment-provider.js +3 -0
- package/dist/http/fulfillment/admin/fulfillment-provider.js.map +1 -0
- package/dist/http/fulfillment/admin/fulfillment-set.d.ts +15 -0
- package/dist/http/fulfillment/admin/fulfillment-set.d.ts.map +1 -0
- package/dist/http/fulfillment/admin/fulfillment-set.js +3 -0
- package/dist/http/fulfillment/admin/fulfillment-set.js.map +1 -0
- package/dist/http/fulfillment/admin/fulfillment.d.ts +27 -0
- package/dist/http/fulfillment/admin/fulfillment.d.ts.map +1 -0
- package/dist/http/fulfillment/admin/fulfillment.js +3 -0
- package/dist/http/fulfillment/admin/fulfillment.js.map +1 -0
- package/dist/http/fulfillment/admin/geo-zone.d.ts +17 -0
- package/dist/http/fulfillment/admin/geo-zone.d.ts.map +1 -0
- package/dist/http/fulfillment/admin/geo-zone.js +3 -0
- package/dist/http/fulfillment/admin/geo-zone.js.map +1 -0
- package/dist/http/fulfillment/admin/index.d.ts +13 -0
- package/dist/http/fulfillment/admin/index.d.ts.map +1 -0
- package/dist/http/fulfillment/admin/index.js +29 -0
- package/dist/http/fulfillment/admin/index.js.map +1 -0
- package/dist/http/fulfillment/admin/service-zone.d.ts +14 -0
- package/dist/http/fulfillment/admin/service-zone.d.ts.map +1 -0
- package/dist/http/fulfillment/admin/service-zone.js +3 -0
- package/dist/http/fulfillment/admin/service-zone.js.map +1 -0
- package/dist/http/fulfillment/admin/shipping-option-rule.d.ts +16 -0
- package/dist/http/fulfillment/admin/shipping-option-rule.d.ts.map +1 -0
- package/dist/http/fulfillment/admin/shipping-option-rule.js +3 -0
- package/dist/http/fulfillment/admin/shipping-option-rule.js.map +1 -0
- package/dist/http/fulfillment/admin/shipping-option-type.d.ts +14 -0
- package/dist/http/fulfillment/admin/shipping-option-type.d.ts.map +1 -0
- package/dist/http/fulfillment/admin/shipping-option-type.js +3 -0
- package/dist/http/fulfillment/admin/shipping-option-type.js.map +1 -0
- package/dist/http/fulfillment/admin/shipping-option.d.ts +31 -0
- package/dist/http/fulfillment/admin/shipping-option.d.ts.map +1 -0
- package/dist/http/fulfillment/admin/shipping-option.js +3 -0
- package/dist/http/fulfillment/admin/shipping-option.js.map +1 -0
- package/dist/http/fulfillment/admin/shipping-profile.d.ts +13 -0
- package/dist/http/fulfillment/admin/shipping-profile.d.ts.map +1 -0
- package/dist/http/fulfillment/admin/shipping-profile.js +3 -0
- package/dist/http/fulfillment/admin/shipping-profile.js.map +1 -0
- package/dist/http/fulfillment/index.d.ts +2 -0
- package/dist/http/fulfillment/index.d.ts.map +1 -0
- package/dist/http/fulfillment/index.js +18 -0
- package/dist/http/fulfillment/index.js.map +1 -0
- package/dist/http/index.d.ts +2 -0
- package/dist/http/index.d.ts.map +1 -0
- package/dist/http/index.js +18 -0
- package/dist/http/index.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/inventory/common/inventory-item.d.ts +55 -64
- package/dist/inventory/common/inventory-item.d.ts.map +1 -1
- package/dist/inventory/common/inventory-level.d.ts +37 -37
- package/dist/inventory/common/inventory-level.d.ts.map +1 -1
- package/dist/inventory/common/reservation-item.d.ts +34 -44
- package/dist/inventory/common/reservation-item.d.ts.map +1 -1
- package/dist/inventory/service-next.d.ts +596 -534
- package/dist/inventory/service-next.d.ts.map +1 -1
- package/dist/payment/common.d.ts +174 -53
- package/dist/payment/common.d.ts.map +1 -1
- package/dist/payment/common.js +3 -3
- package/dist/payment/common.js.map +1 -1
- package/dist/payment/mutations.d.ts +58 -17
- package/dist/payment/mutations.d.ts.map +1 -1
- package/dist/payment/provider.d.ts +128 -43
- package/dist/payment/provider.d.ts.map +1 -1
- package/dist/payment/provider.js.map +1 -1
- package/dist/payment/service.d.ts +460 -39
- package/dist/payment/service.d.ts.map +1 -1
- package/dist/pricing/common/price-list.d.ts +2 -2
- package/dist/pricing/common/price-set.d.ts +6 -4
- package/dist/pricing/common/price-set.d.ts.map +1 -1
- package/dist/pricing/service.d.ts +731 -1695
- package/dist/pricing/service.d.ts.map +1 -1
- package/dist/promotion/common/application-method.d.ts +153 -0
- package/dist/promotion/common/application-method.d.ts.map +1 -1
- package/dist/promotion/common/campaign-budget.d.ts +37 -0
- package/dist/promotion/common/campaign-budget.d.ts.map +1 -1
- package/dist/promotion/common/campaign.d.ts +36 -0
- package/dist/promotion/common/campaign.d.ts.map +1 -1
- package/dist/promotion/common/compute-actions.d.ts +135 -0
- package/dist/promotion/common/compute-actions.d.ts.map +1 -1
- package/dist/promotion/common/promotion-rule-value.d.ts +30 -0
- package/dist/promotion/common/promotion-rule-value.d.ts.map +1 -1
- package/dist/promotion/common/promotion-rule.d.ts +77 -0
- package/dist/promotion/common/promotion-rule.d.ts.map +1 -1
- package/dist/promotion/common/promotion.d.ts +100 -0
- package/dist/promotion/common/promotion.d.ts.map +1 -1
- package/dist/promotion/mutations.d.ts +84 -0
- package/dist/promotion/mutations.d.ts.map +1 -1
- package/dist/promotion/service.d.ts +786 -0
- package/dist/promotion/service.d.ts.map +1 -1
- package/dist/stock-location/common.d.ts +14 -0
- package/dist/stock-location/common.d.ts.map +1 -1
- package/dist/stock-location/service-next.d.ts +178 -186
- package/dist/stock-location/service-next.d.ts.map +1 -1
- package/dist/store/common/store.d.ts +42 -0
- package/dist/store/common/store.d.ts.map +1 -1
- package/dist/store/mutations/store.d.ts +75 -0
- package/dist/store/mutations/store.d.ts.map +1 -1
- package/dist/store/service.d.ts +113 -75
- package/dist/store/service.d.ts.map +1 -1
- package/dist/tax/common.d.ts +298 -10
- package/dist/tax/common.d.ts.map +1 -1
- package/dist/tax/mutations.d.ts +157 -0
- package/dist/tax/mutations.d.ts.map +1 -1
- package/dist/tax/provider.d.ts +126 -0
- package/dist/tax/provider.d.ts.map +1 -1
- package/dist/tax/service.d.ts +600 -0
- package/dist/tax/service.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/tax/provider.d.ts
CHANGED
@@ -27,8 +27,134 @@ export type ItemTaxCalculationLine = {
|
|
27
27
|
*/
|
28
28
|
rates: TaxRateDTO[];
|
29
29
|
};
|
30
|
+
/**
|
31
|
+
* ## Overview
|
32
|
+
*
|
33
|
+
* A tax provider is used to retrieve the tax lines in a provided context. The Tax Module provides a default `system` provider. You can create your own tax provider,
|
34
|
+
* either in a plugin, in a provider module, or directly in your Medusa application's codebase, then use it in any tax region.
|
35
|
+
*
|
36
|
+
* ---
|
37
|
+
*
|
38
|
+
* ## How to Create a Tax Provider
|
39
|
+
*
|
40
|
+
* A tax provider class is defined in a TypeScript or JavaScript file. The class must implement the
|
41
|
+
* `ITaxProvider` interface imported from `@medusajs/types`.
|
42
|
+
*
|
43
|
+
* The file can be defined in a plugin, a provider module, or under the `src/services` directory of your Medusa application. You can later pass the package's name or the
|
44
|
+
* path to the file in the `providers` option of the Tax Module.
|
45
|
+
*
|
46
|
+
* For example:
|
47
|
+
*
|
48
|
+
* ```ts title="src/services/my-tax.ts"
|
49
|
+
* import { ITaxProvider } from "@medusajs/types"
|
50
|
+
*
|
51
|
+
* export default class MyTaxProvider implements ITaxProvider {
|
52
|
+
* // ...
|
53
|
+
* }
|
54
|
+
* ```
|
55
|
+
*
|
56
|
+
* ---
|
57
|
+
*
|
58
|
+
* ## Identifier Property
|
59
|
+
*
|
60
|
+
* The `identifier` property in a tax provider is used when the tax provider is registered in the dependency container or added to the database. A tax provider is represented in the database by the `TaxProvider` data model.
|
61
|
+
*
|
62
|
+
* For example:
|
63
|
+
*
|
64
|
+
* ```ts title="src/services/my-tax.ts"
|
65
|
+
* export default class MyTaxProvider implements ITaxProvider {
|
66
|
+
* static identifier = "my-tax"
|
67
|
+
* // ...
|
68
|
+
* }
|
69
|
+
* ```
|
70
|
+
*
|
71
|
+
* ---
|
72
|
+
*
|
73
|
+
* ## Constructor
|
74
|
+
*
|
75
|
+
* You can use the `constructor` of your tax provider to access the resources registered in the dependency container.
|
76
|
+
*
|
77
|
+
* You can also use the constructor to initialize your integration with the third-party provider. For example, if you use a client to connect to the third-party provider’s APIs, you can initialize it in the constructor and use it in other methods in the service.
|
78
|
+
*
|
79
|
+
* Additionally, if you’re creating your tax provider as a plugin or a provider module to be installed in any Medusa application and you want to access its options, you can access them in the constructor.
|
80
|
+
*
|
81
|
+
* For example:
|
82
|
+
*
|
83
|
+
* export default class MyTaxProvider implements ITaxProvider {
|
84
|
+
* // ...
|
85
|
+
* constructor(container, options) {
|
86
|
+
* // you can access options here
|
87
|
+
*
|
88
|
+
* // you can also initialize a client that
|
89
|
+
* // communicates with a third-party service.
|
90
|
+
* this.client = new Client(options)
|
91
|
+
* }
|
92
|
+
* }
|
93
|
+
*
|
94
|
+
* ---
|
95
|
+
*/
|
30
96
|
export interface ITaxProvider {
|
97
|
+
/**
|
98
|
+
* @ignore
|
99
|
+
*/
|
31
100
|
getIdentifier(): string;
|
101
|
+
/**
|
102
|
+
* This method is used to retrieve the tax lines of items and shipping methods. It's used
|
103
|
+
* when the `getTaxLines` method of the Tax Module's main service is called.
|
104
|
+
*
|
105
|
+
* This method is useful during checkout or when calculating the totals of orders or exchanges.
|
106
|
+
*
|
107
|
+
* @param {ItemTaxCalculationLine[]} itemLines - The line item lines to calculate taxes for.
|
108
|
+
* @param {ShippingTaxCalculationLine[]} shippingLines - The shipping method lines to calculate taxes for.
|
109
|
+
* @param {TaxCalculationContext} context - The context relevant and useful for the taxes calculation.
|
110
|
+
* @return {Promise<(ItemTaxLineDTO | ShippingTaxLineDTO)[]>} The list of calculated line item and shipping tax lines.
|
111
|
+
* If an item in the array has the `shipping_line_id` property, then it's a shipping tax line. Otherwise, if it has
|
112
|
+
* the `line_item_id` property, then it's a line item tax line.
|
113
|
+
*
|
114
|
+
* @example
|
115
|
+
* An example of how this method is implemented in the `system` provider:
|
116
|
+
*
|
117
|
+
* ```ts
|
118
|
+
* // ...
|
119
|
+
*
|
120
|
+
* export default class SystemTaxService implements ITaxProvider {
|
121
|
+
* // ...
|
122
|
+
*
|
123
|
+
* async getTaxLines(
|
124
|
+
* itemLines: TaxTypes.ItemTaxCalculationLine[],
|
125
|
+
* shippingLines: TaxTypes.ShippingTaxCalculationLine[],
|
126
|
+
* _: TaxTypes.TaxCalculationContext
|
127
|
+
* ): Promise<(TaxTypes.ItemTaxLineDTO | TaxTypes.ShippingTaxLineDTO)[]> {
|
128
|
+
* let taxLines: (TaxTypes.ItemTaxLineDTO | TaxTypes.ShippingTaxLineDTO)[] =
|
129
|
+
* itemLines.flatMap((l) => {
|
130
|
+
* return l.rates.map((r) => ({
|
131
|
+
* rate_id: r.id,
|
132
|
+
* rate: r.rate || 0,
|
133
|
+
* name: r.name,
|
134
|
+
* code: r.code,
|
135
|
+
* line_item_id: l.line_item.id,
|
136
|
+
* provider_id: this.getIdentifier(),
|
137
|
+
* }))
|
138
|
+
* })
|
139
|
+
*
|
140
|
+
* taxLines = taxLines.concat(
|
141
|
+
* shippingLines.flatMap((l) => {
|
142
|
+
* return l.rates.map((r) => ({
|
143
|
+
* rate_id: r.id,
|
144
|
+
* rate: r.rate || 0,
|
145
|
+
* name: r.name,
|
146
|
+
* code: r.code,
|
147
|
+
* shipping_line_id: l.shipping_line.id,
|
148
|
+
* provider_id: this.getIdentifier(),
|
149
|
+
* }))
|
150
|
+
* })
|
151
|
+
* )
|
152
|
+
*
|
153
|
+
* return taxLines
|
154
|
+
* }
|
155
|
+
* }
|
156
|
+
* ```
|
157
|
+
*/
|
32
158
|
getTaxLines(itemLines: ItemTaxCalculationLine[], shippingLines: ShippingTaxCalculationLine[], context: TaxCalculationContext): Promise<(ItemTaxLineDTO | ShippingTaxLineDTO)[]>;
|
33
159
|
}
|
34
160
|
//# sourceMappingURL=provider.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"provider.d.ts","sourceRoot":"","sources":["../../src/tax/provider.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,cAAc,EACd,kBAAkB,EAClB,qBAAqB,EACrB,UAAU,EACV,cAAc,EACd,kBAAkB,EACnB,MAAM,UAAU,CAAA;AAEjB;;;GAGG;AACH,MAAM,MAAM,0BAA0B,GAAG;IACvC;;OAEG;IACH,aAAa,EAAE,kBAAkB,CAAA;IACjC;;OAEG;IACH,KAAK,EAAE,UAAU,EAAE,CAAA;CACpB,CAAA;AAED;;;GAGG;AACH,MAAM,MAAM,sBAAsB,GAAG;IACnC;;OAEG;IACH,SAAS,EAAE,cAAc,CAAA;IACzB;;OAEG;IACH,KAAK,EAAE,UAAU,EAAE,CAAA;CACpB,CAAA;AAED,MAAM,WAAW,YAAY;IAC3B,aAAa,IAAI,MAAM,CAAA;IAEvB,WAAW,CACT,SAAS,EAAE,sBAAsB,EAAE,EACnC,aAAa,EAAE,0BAA0B,EAAE,EAC3C,OAAO,EAAE,qBAAqB,GAC7B,OAAO,CAAC,CAAC,cAAc,GAAG,kBAAkB,CAAC,EAAE,CAAC,CAAA;CACpD"}
|
1
|
+
{"version":3,"file":"provider.d.ts","sourceRoot":"","sources":["../../src/tax/provider.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,cAAc,EACd,kBAAkB,EAClB,qBAAqB,EACrB,UAAU,EACV,cAAc,EACd,kBAAkB,EACnB,MAAM,UAAU,CAAA;AAEjB;;;GAGG;AACH,MAAM,MAAM,0BAA0B,GAAG;IACvC;;OAEG;IACH,aAAa,EAAE,kBAAkB,CAAA;IACjC;;OAEG;IACH,KAAK,EAAE,UAAU,EAAE,CAAA;CACpB,CAAA;AAED;;;GAGG;AACH,MAAM,MAAM,sBAAsB,GAAG;IACnC;;OAEG;IACH,SAAS,EAAE,cAAc,CAAA;IACzB;;OAEG;IACH,KAAK,EAAE,UAAU,EAAE,CAAA;CACpB,CAAA;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiEG;AACH,MAAM,WAAW,YAAY;IAC3B;;OAEG;IACH,aAAa,IAAI,MAAM,CAAA;IAEvB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAwDG;IACH,WAAW,CACT,SAAS,EAAE,sBAAsB,EAAE,EACnC,aAAa,EAAE,0BAA0B,EAAE,EAC3C,OAAO,EAAE,qBAAqB,GAC7B,OAAO,CAAC,CAAC,cAAc,GAAG,kBAAkB,CAAC,EAAE,CAAC,CAAA;CACpD"}
|