@cmssy/ai-tools 0.92.0 → 0.93.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.
- package/dist/index.d.ts +3 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -1
- package/dist/index.js.map +1 -1
- package/dist/registry.d.ts.map +1 -1
- package/dist/registry.js +2 -0
- package/dist/registry.js.map +1 -1
- package/dist/schemas.d.ts +47 -1
- package/dist/schemas.d.ts.map +1 -1
- package/dist/schemas.js +98 -8
- package/dist/schemas.js.map +1 -1
- package/dist/tools/bulk-update-products.tool.js +3 -3
- package/dist/tools/bulk-update-products.tool.js.map +1 -1
- package/dist/tools/create-discount.tool.d.ts +4 -0
- package/dist/tools/create-discount.tool.d.ts.map +1 -1
- package/dist/tools/create-discount.tool.js +12 -7
- package/dist/tools/create-discount.tool.js.map +1 -1
- package/dist/tools/create-manual-order.tool.d.ts +1 -0
- package/dist/tools/create-manual-order.tool.d.ts.map +1 -1
- package/dist/tools/create-manual-order.tool.js +7 -4
- package/dist/tools/create-manual-order.tool.js.map +1 -1
- package/dist/tools/create-model.tool.d.ts +1 -1
- package/dist/tools/create-sales-channel.tool.d.ts +1 -0
- package/dist/tools/create-sales-channel.tool.d.ts.map +1 -1
- package/dist/tools/create-sales-channel.tool.js +10 -3
- package/dist/tools/create-sales-channel.tool.js.map +1 -1
- package/dist/tools/get-discount.tool.js +1 -1
- package/dist/tools/get-discount.tool.js.map +1 -1
- package/dist/tools/get-price-list.tool.d.ts +1 -0
- package/dist/tools/get-price-list.tool.d.ts.map +1 -1
- package/dist/tools/get-price-list.tool.js +12 -3
- package/dist/tools/get-price-list.tool.js.map +1 -1
- package/dist/tools/get-record.tool.js +1 -1
- package/dist/tools/get-record.tool.js.map +1 -1
- package/dist/tools/mark-order-paid.tool.d.ts.map +1 -1
- package/dist/tools/mark-order-paid.tool.js +5 -2
- package/dist/tools/mark-order-paid.tool.js.map +1 -1
- package/dist/tools/record-order-payment.tool.d.ts.map +1 -1
- package/dist/tools/record-order-payment.tool.js +5 -2
- package/dist/tools/record-order-payment.tool.js.map +1 -1
- package/dist/tools/refund-order.tool.d.ts.map +1 -1
- package/dist/tools/refund-order.tool.js +2 -2
- package/dist/tools/refund-order.tool.js.map +1 -1
- package/dist/tools/remove-price-list-entries.tool.d.ts +1 -0
- package/dist/tools/remove-price-list-entries.tool.d.ts.map +1 -1
- package/dist/tools/remove-price-list-entries.tool.js +1 -1
- package/dist/tools/remove-price-list-entries.tool.js.map +1 -1
- package/dist/tools/set-price-list-entries.tool.d.ts +1 -0
- package/dist/tools/set-price-list-entries.tool.d.ts.map +1 -1
- package/dist/tools/set-price-list-entries.tool.js +1 -1
- package/dist/tools/set-price-list-entries.tool.js.map +1 -1
- package/dist/tools/set-price-list-entry.tool.d.ts +1 -0
- package/dist/tools/set-price-list-entry.tool.d.ts.map +1 -1
- package/dist/tools/set-price-list-entry.tool.js +1 -1
- package/dist/tools/set-price-list-entry.tool.js.map +1 -1
- package/dist/tools/set-product-currency-prices.tool.d.ts +17 -0
- package/dist/tools/set-product-currency-prices.tool.d.ts.map +1 -0
- package/dist/tools/set-product-currency-prices.tool.js +20 -0
- package/dist/tools/set-product-currency-prices.tool.js.map +1 -0
- package/dist/tools/set-product-tiers.tool.js +1 -1
- package/dist/tools/set-product-tiers.tool.js.map +1 -1
- package/dist/tools/set-product-variants.tool.d.ts +8 -0
- package/dist/tools/set-product-variants.tool.d.ts.map +1 -1
- package/dist/tools/set-product-variants.tool.js +11 -4
- package/dist/tools/set-product-variants.tool.js.map +1 -1
- package/dist/tools/update-cart-config.tool.d.ts +8 -0
- package/dist/tools/update-cart-config.tool.d.ts.map +1 -1
- package/dist/tools/update-cart-config.tool.js +10 -7
- package/dist/tools/update-cart-config.tool.js.map +1 -1
- package/dist/tools/update-discount.tool.d.ts +5 -1
- package/dist/tools/update-discount.tool.d.ts.map +1 -1
- package/dist/tools/update-discount.tool.js +11 -4
- package/dist/tools/update-discount.tool.js.map +1 -1
- package/dist/tools/update-model.tool.d.ts +1 -1
- package/dist/tools/update-sales-channel.tool.d.ts +1 -0
- package/dist/tools/update-sales-channel.tool.d.ts.map +1 -1
- package/dist/tools/update-sales-channel.tool.js +15 -6
- package/dist/tools/update-sales-channel.tool.js.map +1 -1
- package/dist/types.d.ts +54 -3
- package/dist/types.d.ts.map +1 -1
- package/package.json +2 -2
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"set-product-currency-prices.tool.js","sourceRoot":"","sources":["../../src/tools/set-product-currency-prices.tool.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,yBAAyB,EAAE,MAAM,cAAc,CAAC;AAEzD,OAAO,EACL,0BAA0B,EAC1B,sBAAsB,GACvB,MAAM,eAAe,CAAC;AAEvB,MAAM,WAAW,GAAG,CAAC,CAAC,MAAM,CAAC;IAC3B,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,mBAAmB,CAAC;IACzD,MAAM,EAAE,CAAC;SACN,KAAK,CAAC,0BAA0B,CAAC;SACjC,GAAG,CAAC,yBAAyB,CAAC;SAC9B,WAAW,CAAC,CAAC,KAAK,EAAE,GAAG,EAAE,EAAE,CAAC,sBAAsB,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;SAC/D,QAAQ,CACP,2KAA2K,CAC5K;CACJ,CAAC,CAAC;AAIH,MAAM,CAAC,MAAM,4BAA4B,GAA2B;IAClE,IAAI,EAAE,6BAA6B;IACnC,WAAW,EACT,0tBAA0tB;IAC5tB,WAAW;IACX,mBAAmB,EAAE,CAAC,aAAa,CAAC;IACpC,YAAY,EAAE,IAAI;IAClB,OAAO,EAAE,KAAK,EAAE,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,GAAG,EAAE,EAAE,CAC3C,GAAG,CAAC,QAAQ,CAAC,iBAAiB,CAC5B,QAAQ,EACR,MAAqC,CACtC;CACJ,CAAC"}
|
|
@@ -9,7 +9,7 @@ const inputSchema = z.object({
|
|
|
9
9
|
});
|
|
10
10
|
export const setProductTiersTool = {
|
|
11
11
|
name: "set_product_tiers",
|
|
12
|
-
description: "Set the record-level volume price breaks on a product (B2B quantity discounts). They price the product and every variant that defines no breaks of its own; a variant's own breaks are part of its definition, so set those with set_product_variants. A line's unit price steps down to the highest break its quantity reaches, and the cart and the order both charge that price. Prices are minor units. Passing an empty array removes the breaks. increment sets the order step on the same record.",
|
|
12
|
+
description: "Set the record-level volume price breaks on a product (B2B quantity discounts). They price the product and every variant that defines no breaks of its own; a variant's own breaks are part of its definition, so set those with set_product_variants. A line's unit price steps down to the highest break its quantity reaches, and the cart and the order both charge that price. Prices are minor units of the default currency; breaks in an additional currency are set with set_product_currency_prices. Passing an empty array removes the breaks. increment sets the order step on the same record.",
|
|
13
13
|
inputSchema,
|
|
14
14
|
requiredPermissions: ["models:edit"],
|
|
15
15
|
execute: async ({ recordId, tiers, increment }, ops) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"set-product-tiers.tool.js","sourceRoot":"","sources":["../../src/tools/set-product-tiers.tool.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAExE,MAAM,WAAW,GAAG,CAAC,CAAC,MAAM,CAAC;IAC3B,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,mBAAmB,CAAC;IACzD,KAAK,EAAE,mBAAmB;IAC1B,SAAS,EAAE,kBAAkB;SAC1B,QAAQ,EAAE;SACV,QAAQ,CACP,mJAAmJ,CACpJ;CACJ,CAAC,CAAC;AAIH,MAAM,CAAC,MAAM,mBAAmB,GAA2B;IACzD,IAAI,EAAE,mBAAmB;IACzB,WAAW,EACT,
|
|
1
|
+
{"version":3,"file":"set-product-tiers.tool.js","sourceRoot":"","sources":["../../src/tools/set-product-tiers.tool.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAExE,MAAM,WAAW,GAAG,CAAC,CAAC,MAAM,CAAC;IAC3B,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,mBAAmB,CAAC;IACzD,KAAK,EAAE,mBAAmB;IAC1B,SAAS,EAAE,kBAAkB;SAC1B,QAAQ,EAAE;SACV,QAAQ,CACP,mJAAmJ,CACpJ;CACJ,CAAC,CAAC;AAIH,MAAM,CAAC,MAAM,mBAAmB,GAA2B;IACzD,IAAI,EAAE,mBAAmB;IACzB,WAAW,EACT,6kBAA6kB;IAC/kB,WAAW;IACX,mBAAmB,EAAE,CAAC,aAAa,CAAC;IACpC,OAAO,EAAE,KAAK,EAAE,EAAE,QAAQ,EAAE,KAAK,EAAE,SAAS,EAAE,EAAE,GAAG,EAAE,EAAE;QACrD,OAAO,GAAG,CAAC,QAAQ,CAAC,QAAQ,CAAC,QAAQ,EAAE,KAAoB,EAAE,SAAS,CAAC,CAAC;IAC1E,CAAC;CACF,CAAC"}
|
|
@@ -11,6 +11,14 @@ declare const inputSchema: z.ZodObject<{
|
|
|
11
11
|
minQty: z.ZodNumber;
|
|
12
12
|
price: z.ZodNumber;
|
|
13
13
|
}, z.core.$strip>>>;
|
|
14
|
+
currencyPrices: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
15
|
+
currency: z.ZodString;
|
|
16
|
+
price: z.ZodNumber;
|
|
17
|
+
tiers: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
18
|
+
minQty: z.ZodNumber;
|
|
19
|
+
price: z.ZodNumber;
|
|
20
|
+
}, z.core.$strip>>>;
|
|
21
|
+
}, z.core.$strip>>>;
|
|
14
22
|
}, z.core.$strip>>;
|
|
15
23
|
}, z.core.$strip>;
|
|
16
24
|
type Input = z.infer<typeof inputSchema>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"set-product-variants.tool.d.ts","sourceRoot":"","sources":["../../src/tools/set-product-variants.tool.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"set-product-variants.tool.d.ts","sourceRoot":"","sources":["../../src/tools/set-product-variants.tool.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AA2D1C,QAAA,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;iBAQf,CAAC;AAEH,KAAK,KAAK,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,WAAW,CAAC,CAAC;AAEzC,eAAO,MAAM,sBAAsB,EAAE,MAAM,CAAC,KAAK,EAAE,OAAO,CAUzD,CAAC"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
import {
|
|
2
|
+
import { ADDITIONAL_CURRENCIES_MAX } from "@cmssy/types";
|
|
3
|
+
import { priceTierListSchema, refineUniqueCurrencies, variantCurrencyPriceSchema, } from "../schemas.js";
|
|
3
4
|
const VARIANT_MAX_VARIANTS = 500;
|
|
4
5
|
const VARIANT_MAX_OPTIONS = 20;
|
|
5
6
|
const variantSchema = z.object({
|
|
@@ -17,7 +18,7 @@ const variantSchema = z.object({
|
|
|
17
18
|
.number()
|
|
18
19
|
.int()
|
|
19
20
|
.min(0)
|
|
20
|
-
.describe("Minor units - 4900 = $49.00. Unlike the product's price field, which is major units."),
|
|
21
|
+
.describe("Minor units of the default currency - 4900 = $49.00. Unlike the product's price field, which is major units."),
|
|
21
22
|
inventory: z
|
|
22
23
|
.number()
|
|
23
24
|
.int()
|
|
@@ -26,7 +27,13 @@ const variantSchema = z.object({
|
|
|
26
27
|
.describe("Units on hand - list_products reports it as onHand. null when the variant's stock is not tracked."),
|
|
27
28
|
tiers: priceTierListSchema
|
|
28
29
|
.optional()
|
|
29
|
-
.describe("This variant's own volume breaks, minor units. Omit to keep the breaks it has. [] drops them, and the variant is then priced by the record's breaks (set_product_tiers), not by none."),
|
|
30
|
+
.describe("This variant's own volume breaks, minor units of the default currency. Omit to keep the breaks it has. [] drops them, and the variant is then priced by the record's breaks (set_product_tiers), not by none."),
|
|
31
|
+
currencyPrices: z
|
|
32
|
+
.array(variantCurrencyPriceSchema)
|
|
33
|
+
.max(ADDITIONAL_CURRENCIES_MAX)
|
|
34
|
+
.superRefine((items, ctx) => refineUniqueCurrencies(items, ctx))
|
|
35
|
+
.optional()
|
|
36
|
+
.describe("The variant's prices in additional currencies, e.g. [{currency: 'EUR', price: 4500}]. Omit to keep the ones it has; [] clears them. A variant with no price in a channel's currency is not sold on that channel"),
|
|
30
37
|
});
|
|
31
38
|
const inputSchema = z.object({
|
|
32
39
|
recordId: z.string().min(1).describe("Product record id"),
|
|
@@ -37,7 +44,7 @@ const inputSchema = z.object({
|
|
|
37
44
|
});
|
|
38
45
|
export const setProductVariantsTool = {
|
|
39
46
|
name: "set_product_variants",
|
|
40
|
-
description: "Define a product's variants. Each variant is one combination of values for the model's variantAxes (set those with update_model) and carries its own price, stock, SKU and volume breaks. The call replaces the whole set, so send every variant the product keeps - a variant left out is deleted. Every field but tiers is written as sent, so copy sku and stock (onHand) from list_products for each variant you keep; both are required, null for none. Stock already reserved by carts stays with the variant that keeps its selection. Prices are minor units.",
|
|
47
|
+
description: "Define a product's variants. Each variant is one combination of values for the model's variantAxes (set those with update_model) and carries its own price, stock, SKU and volume breaks. The call replaces the whole set, so send every variant the product keeps - a variant left out is deleted. Every field but tiers and currencyPrices is written as sent (those two are kept when omitted), so copy sku and stock (onHand) from list_products for each variant you keep; both are required, null for none. Stock already reserved by carts stays with the variant that keeps its selection. Prices are minor units: price and tiers in the default currency, currencyPrices in each additional currency (omitted = kept, like tiers).",
|
|
41
48
|
inputSchema,
|
|
42
49
|
requiredPermissions: ["models:edit"],
|
|
43
50
|
confirmGated: true,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"set-product-variants.tool.js","sourceRoot":"","sources":["../../src/tools/set-product-variants.tool.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"set-product-variants.tool.js","sourceRoot":"","sources":["../../src/tools/set-product-variants.tool.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,yBAAyB,EAAE,MAAM,cAAc,CAAC;AACzD,OAAO,EACL,mBAAmB,EACnB,sBAAsB,EACtB,0BAA0B,GAC3B,MAAM,eAAe,CAAC;AAEvB,MAAM,oBAAoB,GAAG,GAAG,CAAC;AACjC,MAAM,mBAAmB,GAAG,EAAE,CAAC;AAE/B,MAAM,aAAa,GAAG,CAAC,CAAC,MAAM,CAAC;IAC7B,UAAU,EAAE,CAAC;SACV,MAAM,CAAC,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC;SAC9B,MAAM,CACL,CAAC,UAAU,EAAE,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,MAAM,IAAI,mBAAmB,EACrE;QACE,OAAO,EAAE,yBAAyB,mBAAmB,UAAU;KAChE,CACF;SACA,QAAQ,CACP,+LAA+L,CAChM;IACH,GAAG,EAAE,CAAC;SACH,MAAM,EAAE;SACR,QAAQ,EAAE;SACV,QAAQ,CACP,oGAAoG,CACrG;IACH,KAAK,EAAE,CA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AC;CACF,CAAC"}
|
|
@@ -2,6 +2,7 @@ import { z } from "zod";
|
|
|
2
2
|
import type { AiTool } from "../types.js";
|
|
3
3
|
declare const inputSchema: z.ZodObject<{
|
|
4
4
|
defaultCurrency: z.ZodOptional<z.ZodString>;
|
|
5
|
+
additionalCurrencies: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
5
6
|
pricesIncludeTax: z.ZodOptional<z.ZodBoolean>;
|
|
6
7
|
taxRates: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
7
8
|
id: z.ZodString;
|
|
@@ -20,6 +21,13 @@ declare const inputSchema: z.ZodObject<{
|
|
|
20
21
|
minSubtotal: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
21
22
|
maxSubtotal: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
22
23
|
freeAbove: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
24
|
+
currencyPrices: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
25
|
+
currency: z.ZodString;
|
|
26
|
+
price: z.ZodNumber;
|
|
27
|
+
minSubtotal: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
28
|
+
maxSubtotal: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
29
|
+
freeAbove: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
30
|
+
}, z.core.$strip>>>;
|
|
23
31
|
}, z.core.$strip>>>;
|
|
24
32
|
orderFields: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
25
33
|
key: z.ZodString;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"update-cart-config.tool.d.ts","sourceRoot":"","sources":["../../src/tools/update-cart-config.tool.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"update-cart-config.tool.d.ts","sourceRoot":"","sources":["../../src/tools/update-cart-config.tool.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAMxB,OAAO,KAAK,EAAE,MAAM,EAAmB,MAAM,aAAa,CAAC;AAQ3D,QAAA,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kBAqHN,CAAC;AAEZ,KAAK,KAAK,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,WAAW,CAAC,CAAC;AAEzC,eAAO,MAAM,oBAAoB,EAAE,MAAM,CAAC,KAAK,EAAE,OAAO,CASvD,CAAC"}
|
|
@@ -1,13 +1,16 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
import { EXPORT_NOTE_MAX_LEN, REVERSE_CHARGE_NOTE_MAX_LEN } from "@cmssy/types";
|
|
3
|
-
import { orderFieldSchema, shippingMethodSchema, taxRateSchema, } from "../schemas.js";
|
|
2
|
+
import { ADDITIONAL_CURRENCIES_MAX, EXPORT_NOTE_MAX_LEN, REVERSE_CHARGE_NOTE_MAX_LEN, } from "@cmssy/types";
|
|
3
|
+
import { currencyCodeSchema, orderFieldSchema, shippingMethodSchema, taxRateSchema, } from "../schemas.js";
|
|
4
4
|
const inputSchema = z
|
|
5
5
|
.object({
|
|
6
|
-
defaultCurrency:
|
|
7
|
-
.
|
|
8
|
-
.
|
|
6
|
+
defaultCurrency: currencyCodeSchema
|
|
7
|
+
.optional()
|
|
8
|
+
.describe("ISO 4217 code, e.g. EUR - the catalogue's base currency. Locked while any additional currency exists"),
|
|
9
|
+
additionalCurrencies: z
|
|
10
|
+
.array(currencyCodeSchema)
|
|
11
|
+
.max(ADDITIONAL_CURRENCIES_MAX)
|
|
9
12
|
.optional()
|
|
10
|
-
.describe(
|
|
13
|
+
.describe(`Other currencies the workspace sells in through sales channels, at most ${ADDITIONAL_CURRENCIES_MAX}; replaces the list, [] removes them all. Removing one a sales channel sells in is refused (CURRENCY_IN_USE), and so is adding one product records still carry as their currency value (CURRENCY_USED_BY_RECORDS). Prices in a removed currency are kept but price nothing`),
|
|
11
14
|
pricesIncludeTax: z
|
|
12
15
|
.boolean()
|
|
13
16
|
.optional()
|
|
@@ -95,7 +98,7 @@ const inputSchema = z
|
|
|
95
98
|
.strict();
|
|
96
99
|
export const updateCartConfigTool = {
|
|
97
100
|
name: "update_cart_config",
|
|
98
|
-
description: "Configure the workspace's commerce settings:
|
|
101
|
+
description: "Configure the workspace's commerce settings: default and additional currencies, whether prices include tax, tax rates, shipping methods, custom order fields, stock thresholds, cart limits, session lifetimes and the B2B toggles. Only provided fields change; arrays replace the whole list. companyTaxRounding is the workspace's VAT rounding for company buyers who read net prices (a company can override it with set_company_tax_rounding); consumers are always rounded per_line. sellerCountry and reverseChargeNote drive reverse charge: a company with a verified EU VAT id of another member state (set_company_vat_verified) pays 0% VAT and its orders carry the note. A sellerCountry outside the EU zero-rates every order shipped to another country as an export, for any buyer, with exportNote on the order. Nothing is converted between currencies: a sales channel sells in one of them (create_sales_channel currency), and every price in an additional currency is set explicitly (set_product_currency_prices, set_product_variants, set_price_list_entries currency, shippingMethods currencyPrices). Which models the store sells is not set here: a model is sellable when its product capability is enabled (update_model, product.enabled).",
|
|
99
102
|
inputSchema,
|
|
100
103
|
requiredPermissions: ["site:config:edit"],
|
|
101
104
|
execute: async (input, ops) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"update-cart-config.tool.js","sourceRoot":"","sources":["../../src/tools/update-cart-config.tool.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,
|
|
1
|
+
{"version":3,"file":"update-cart-config.tool.js","sourceRoot":"","sources":["../../src/tools/update-cart-config.tool.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EACL,yBAAyB,EACzB,mBAAmB,EACnB,2BAA2B,GAC5B,MAAM,cAAc,CAAC;AAE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CAAC;SACxB,QAAQ,EAAE;SACV,QAAQ,EAAE;SACV,QAAQ,CACP,mGAAmG,mBAAmB,0FAA0F,CACjN;IACH,gBAAgB,EAAE,CAAC;SAChB,MAAM,EAAE;SACR,GAAG,EAAE;SACL,GAAG,CAAC,CAAC,CAAC;SACN,GAAG,CAAC,GAAG,CAAC;SACR,QAAQ,EAAE;SACV,QAAQ,EAAE;SACV,QAAQ,CACP,4HAA4H,CAC7H;CACJ,CAAC;KACD,MAAM,EAAE,CAAC;AAIZ,MAAM,CAAC,MAAM,oBAAoB,GAA2B;IAC1D,IAAI,EAAE,oBAAoB;IAC1B,WAAW,EACT,gtCAAgtC;IACltC,WAAW;IACX,mBAAmB,EAAE,CAAC,kBAAkB,CAAC;IACzC,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,GAAG,EAAE,EAAE;QAC5B,OAAO,GAAG,CAAC,SAAS,CAAC,gBAAgB,CAAC,KAAwB,CAAC,CAAC;IAClE,CAAC;CACF,CAAC"}
|
|
@@ -10,7 +10,11 @@ declare const inputSchema: z.ZodObject<{
|
|
|
10
10
|
}>>;
|
|
11
11
|
value: z.ZodOptional<z.ZodNumber>;
|
|
12
12
|
currency: z.ZodOptional<z.ZodString>;
|
|
13
|
-
minSubtotal: z.ZodOptional<z.ZodNumber
|
|
13
|
+
minSubtotal: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
14
|
+
minSubtotalByCurrency: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
15
|
+
currency: z.ZodString;
|
|
16
|
+
amount: z.ZodNumber;
|
|
17
|
+
}, z.core.$strip>>>;
|
|
14
18
|
maxUses: z.ZodOptional<z.ZodNumber>;
|
|
15
19
|
startsAt: z.ZodOptional<z.ZodString>;
|
|
16
20
|
endsAt: z.ZodOptional<z.ZodString>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"update-discount.tool.d.ts","sourceRoot":"","sources":["../../src/tools/update-discount.tool.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EACV,MAAM,EAEN,mBAAmB,EACpB,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"update-discount.tool.d.ts","sourceRoot":"","sources":["../../src/tools/update-discount.tool.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EACV,MAAM,EAEN,mBAAmB,EACpB,MAAM,aAAa,CAAC;AAOrB,QAAA,MAAM,WAAW;;;;;;;;;;;;;;;;;;;iBAsBf,CAAC;AAEH,KAAK,KAAK,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,WAAW,CAAC,CAAC;AAEzC,eAAO,MAAM,kBAAkB,EAAE,MAAM,CAAC,KAAK,EAAE,mBAAmB,CAmBjE,CAAC"}
|
|
@@ -1,12 +1,19 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
import { isoDateTimeSchema } from "../schemas.js";
|
|
2
|
+
import { currencyAmountListSchema, currencyCodeSchema, isoDateTimeSchema, } from "../schemas.js";
|
|
3
3
|
const inputSchema = z.object({
|
|
4
4
|
idOrSlug: z.string().min(1).describe("The discount's id or code to update"),
|
|
5
5
|
code: z.string().optional(),
|
|
6
6
|
type: z.enum(["percentage", "fixed", "free_shipping"]).optional(),
|
|
7
7
|
value: z.number().optional(),
|
|
8
|
-
currency:
|
|
9
|
-
minSubtotal: z
|
|
8
|
+
currency: currencyCodeSchema.optional(),
|
|
9
|
+
minSubtotal: z
|
|
10
|
+
.number()
|
|
11
|
+
.nullable()
|
|
12
|
+
.optional()
|
|
13
|
+
.describe("Minimum subtotal in minor units: the code's own currency for 'fixed', the default currency otherwise. null clears it - with minSubtotalByCurrency set, the code then no longer applies to default-currency carts"),
|
|
14
|
+
minSubtotalByCurrency: currencyAmountListSchema
|
|
15
|
+
.optional()
|
|
16
|
+
.describe("'percentage' and 'free_shipping' only: replaces the per-currency minimums for carts in additional currencies; [] clears them. Omit to keep them. Changing such a code to 'fixed' needs [] here"),
|
|
10
17
|
maxUses: z.number().int().optional(),
|
|
11
18
|
startsAt: isoDateTimeSchema.optional().describe("ISO date-time"),
|
|
12
19
|
endsAt: isoDateTimeSchema.optional().describe("ISO date-time"),
|
|
@@ -14,7 +21,7 @@ const inputSchema = z.object({
|
|
|
14
21
|
});
|
|
15
22
|
export const updateDiscountTool = {
|
|
16
23
|
name: "update_discount",
|
|
17
|
-
description: "Update a discount (partial). code/type/currency become immutable once the discount has been used.",
|
|
24
|
+
description: "Update a discount (partial). code/type/currency become immutable once the discount has been used. A code with any minimum (minSubtotal for the default currency, minSubtotalByCurrency for additional currencies) applies only in the currencies those minimums name.",
|
|
18
25
|
inputSchema,
|
|
19
26
|
requiredPermissions: ["discounts:manage"],
|
|
20
27
|
execute: async ({ idOrSlug, ...patch }, ops) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"update-discount.tool.js","sourceRoot":"","sources":["../../src/tools/update-discount.tool.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAMxB,OAAO,
|
|
1
|
+
{"version":3,"file":"update-discount.tool.js","sourceRoot":"","sources":["../../src/tools/update-discount.tool.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAMxB,OAAO,EACL,wBAAwB,EACxB,kBAAkB,EAClB,iBAAiB,GAClB,MAAM,eAAe,CAAC;AAEvB,MAAM,WAAW,GAAG,CAAC,CAAC,MAAM,CAAC;IAC3B,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,qCAAqC,CAAC;IAC3E,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC3B,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,YAAY,EAAE,OAAO,E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MAAM,IAAI,KAAK,CAAC,aAAa,QAAQ,aAAa,CAAC,CAAC;QACtD,CAAC;QACD,OAAO,MAAM,CAAC;IAChB,CAAC;CACF,CAAC"}
|
|
@@ -33,7 +33,7 @@ declare const inputSchema: z.ZodObject<{
|
|
|
33
33
|
priceField: z.ZodOptional<z.ZodString>;
|
|
34
34
|
inventoryField: z.ZodOptional<z.ZodString>;
|
|
35
35
|
nameField: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
36
|
-
currencyField: z.ZodOptional<z.
|
|
36
|
+
currencyField: z.ZodOptional<z.ZodNull>;
|
|
37
37
|
imageField: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
38
38
|
taxRateField: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
39
39
|
}, z.core.$strip>>;
|
|
@@ -12,6 +12,7 @@ declare const inputSchema: z.ZodObject<{
|
|
|
12
12
|
MEMBERS: "MEMBERS";
|
|
13
13
|
COMPANY_MEMBERS: "COMPANY_MEMBERS";
|
|
14
14
|
}>>;
|
|
15
|
+
currency: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
15
16
|
}, z.core.$strip>;
|
|
16
17
|
type Input = z.infer<typeof inputSchema>;
|
|
17
18
|
export declare const updateSalesChannelTool: AiTool<Input, SalesChannelSummary>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"update-sales-channel.tool.d.ts","sourceRoot":"","sources":["../../src/tools/update-sales-channel.tool.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,KAAK,EAAE,MAAM,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"update-sales-channel.tool.d.ts","sourceRoot":"","sources":["../../src/tools/update-sales-channel.tool.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,KAAK,EAAE,MAAM,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAO/D,QAAA,MAAM,WAAW;;;;;;;;;;;;;iBAmBf,CAAC;AAEH,KAAK,KAAK,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,WAAW,CAAC,CAAC;AAEzC,eAAO,MAAM,sBAAsB,EAAE,MAAM,CAAC,KAAK,EAAE,mBAAmB,CAwBrE,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import { SALES_CHANNEL_NAME_MAX_LEN } from "@cmssy/types";
|
|
3
|
-
import { channelPriceAccessSchema, priceDisplayModeSchema, } from "../schemas.js";
|
|
3
|
+
import { channelCurrencySchema, channelPriceAccessSchema, priceDisplayModeSchema, } from "../schemas.js";
|
|
4
4
|
const inputSchema = z.object({
|
|
5
5
|
id: z
|
|
6
6
|
.string()
|
|
@@ -15,19 +15,28 @@ const inputSchema = z.object({
|
|
|
15
15
|
.describe("New display name"),
|
|
16
16
|
displayMode: priceDisplayModeSchema.optional(),
|
|
17
17
|
priceAccess: channelPriceAccessSchema.optional(),
|
|
18
|
+
currency: channelCurrencySchema
|
|
19
|
+
.optional()
|
|
20
|
+
.describe("Omit to keep it; null or the default currency sells in the default currency, else one of the workspace's additional currencies. A change abandons the channel's open carts (activeCartCount)"),
|
|
18
21
|
});
|
|
19
22
|
export const updateSalesChannelTool = {
|
|
20
23
|
name: "update_sales_channel",
|
|
21
|
-
description: "Rename a sales channel or change its displayMode or
|
|
24
|
+
description: "Rename a sales channel or change its displayMode, priceAccess or currency. The key cannot change. Changing the currency abandons the carts open on the channel - check activeCartCount first. Narrowing priceAccess refuses carts and checkout to buyers who no longer qualify; their carts are kept and come back if access returns. Which lists price the channel is changed on the price list (update_price_list channels).",
|
|
22
25
|
inputSchema,
|
|
23
26
|
requiredPermissions: ["models:edit"],
|
|
24
|
-
execute: async ({ id, name, displayMode, priceAccess }, ops) => {
|
|
27
|
+
execute: async ({ id, name, displayMode, priceAccess, currency }, ops) => {
|
|
25
28
|
if (name === undefined &&
|
|
26
29
|
displayMode === undefined &&
|
|
27
|
-
priceAccess === undefined
|
|
28
|
-
|
|
30
|
+
priceAccess === undefined &&
|
|
31
|
+
currency === undefined) {
|
|
32
|
+
throw new Error("Provide name, displayMode, priceAccess or currency to update");
|
|
29
33
|
}
|
|
30
|
-
return ops.salesChannels.update(id, {
|
|
34
|
+
return ops.salesChannels.update(id, {
|
|
35
|
+
name,
|
|
36
|
+
displayMode,
|
|
37
|
+
priceAccess,
|
|
38
|
+
...(currency !== undefined && { currency }),
|
|
39
|
+
});
|
|
31
40
|
},
|
|
32
41
|
};
|
|
33
42
|
//# sourceMappingURL=update-sales-channel.tool.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"update-sales-channel.tool.js","sourceRoot":"","sources":["../../src/tools/update-sales-channel.tool.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,0BAA0B,EAAE,MAAM,cAAc,CAAC;AAE1D,OAAO,EACL,wBAAwB,EACxB,sBAAsB,GACvB,MAAM,eAAe,CAAC;AAEvB,MAAM,WAAW,GAAG,CAAC,CAAC,MAAM,CAAC;IAC3B,EAAE,EAAE,CAAC;SACF,MAAM,EAAE;SACR,GAAG,CAAC,CAAC,CAAC;SACN,QAAQ,CAAC,mDAAmD,CAAC;IAChE,IAAI,EAAE,CAAC;SACJ,MAAM,EAAE;SACR,IAAI,EAAE;SACN,GAAG,CAAC,CAAC,CAAC;SACN,GAAG,CAAC,0BAA0B,CAAC;SAC/B,QAAQ,EAAE;SACV,QAAQ,CAAC,kBAAkB,CAAC;IAC/B,WAAW,EAAE,sBAAsB,CAAC,QAAQ,EAAE;IAC9C,WAAW,EAAE,wBAAwB,CAAC,QAAQ,EAAE;
|
|
1
|
+
{"version":3,"file":"update-sales-channel.tool.js","sourceRoot":"","sources":["../../src/tools/update-sales-channel.tool.ts"],"names":[],"mappings":"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AAG,CAAC,QAAQ,KAAK,SAAS,IAAI,EAAE,QAAQ,EAAE,CAAC;SAC5C,CAAC,CAAC;IACL,CAAC;CACF,CAAC"}
|
package/dist/types.d.ts
CHANGED
|
@@ -87,7 +87,7 @@ export interface ModelProductConfigInput {
|
|
|
87
87
|
priceField?: string;
|
|
88
88
|
inventoryField?: string;
|
|
89
89
|
nameField?: string | null;
|
|
90
|
-
currencyField?:
|
|
90
|
+
currencyField?: null;
|
|
91
91
|
imageField?: string | null;
|
|
92
92
|
taxRateField?: string | null;
|
|
93
93
|
}
|
|
@@ -105,9 +105,21 @@ export interface RecordDetail {
|
|
|
105
105
|
vatVerifiedAt?: string | null;
|
|
106
106
|
vatVerifiedBy?: string | null;
|
|
107
107
|
taxExemptReason?: string | null;
|
|
108
|
+
currencyPrices?: CurrencyPrice[];
|
|
109
|
+
variantCurrencyPrices?: VariantCurrencyPrices[];
|
|
108
110
|
createdAt: string | null;
|
|
109
111
|
updatedAt: string | null;
|
|
110
112
|
}
|
|
113
|
+
export interface CurrencyPrice {
|
|
114
|
+
currency: string;
|
|
115
|
+
price: number | null;
|
|
116
|
+
tiers: PriceTier[];
|
|
117
|
+
enabled: boolean;
|
|
118
|
+
}
|
|
119
|
+
export interface VariantCurrencyPrices {
|
|
120
|
+
variantKey: string;
|
|
121
|
+
currencyPrices: CurrencyPrice[];
|
|
122
|
+
}
|
|
111
123
|
export interface RecordListOptions {
|
|
112
124
|
filter?: Record<string, unknown>;
|
|
113
125
|
sort?: string;
|
|
@@ -915,7 +927,7 @@ export interface OrderOps {
|
|
|
915
927
|
list(options?: OrderListOptions): Promise<OrderListResult>;
|
|
916
928
|
get(id: string): Promise<OrderDetail | null>;
|
|
917
929
|
getPipeline(): Promise<unknown>;
|
|
918
|
-
createManual(customerEmail: string, items: OrderItemInput[], customerId?: string, shippingAddress?: OrderAddressInput): Promise<OrderWriteResult>;
|
|
930
|
+
createManual(customerEmail: string, items: OrderItemInput[], customerId?: string, shippingAddress?: OrderAddressInput, currency?: string): Promise<OrderWriteResult>;
|
|
919
931
|
edit(orderId: string, items: OrderItemInput[]): Promise<OrderWriteResult>;
|
|
920
932
|
updateDetails(orderId: string, details: OrderDetailsInput): Promise<OrderWriteResult>;
|
|
921
933
|
markPaid(orderId: string, payment: OrderPaymentInput): Promise<OrderWriteResult>;
|
|
@@ -938,6 +950,10 @@ export interface OrderOps {
|
|
|
938
950
|
recordInvoice(orderId: string, invoice: OrderInvoiceInput): Promise<OrderWriteResult>;
|
|
939
951
|
}
|
|
940
952
|
export type DiscountType = "percentage" | "fixed" | "free_shipping";
|
|
953
|
+
export interface CurrencyAmount {
|
|
954
|
+
currency: string;
|
|
955
|
+
amount: number;
|
|
956
|
+
}
|
|
941
957
|
export interface DiscountInput {
|
|
942
958
|
code: string;
|
|
943
959
|
type: DiscountType;
|
|
@@ -945,6 +961,7 @@ export interface DiscountInput {
|
|
|
945
961
|
currency?: string;
|
|
946
962
|
enabled: boolean;
|
|
947
963
|
minSubtotal?: number;
|
|
964
|
+
minSubtotalByCurrency?: CurrencyAmount[];
|
|
948
965
|
maxUses?: number;
|
|
949
966
|
startsAt?: string;
|
|
950
967
|
endsAt?: string;
|
|
@@ -981,6 +998,7 @@ export interface DiscountDetail {
|
|
|
981
998
|
enabled: boolean;
|
|
982
999
|
currency: string | null;
|
|
983
1000
|
minSubtotal: number | null;
|
|
1001
|
+
minSubtotalByCurrency: CurrencyAmount[];
|
|
984
1002
|
maxUses: number | null;
|
|
985
1003
|
currentUses: number | null;
|
|
986
1004
|
startsAt: string | null;
|
|
@@ -991,7 +1009,8 @@ export interface DiscountUpdateInput {
|
|
|
991
1009
|
type?: DiscountType;
|
|
992
1010
|
value?: number;
|
|
993
1011
|
currency?: string;
|
|
994
|
-
minSubtotal?: number;
|
|
1012
|
+
minSubtotal?: number | null;
|
|
1013
|
+
minSubtotalByCurrency?: CurrencyAmount[];
|
|
995
1014
|
maxUses?: number;
|
|
996
1015
|
startsAt?: string;
|
|
997
1016
|
endsAt?: string;
|
|
@@ -1118,12 +1137,30 @@ export interface PriceTier {
|
|
|
1118
1137
|
minQty: number;
|
|
1119
1138
|
price: number;
|
|
1120
1139
|
}
|
|
1140
|
+
export interface VariantCurrencyPriceInput {
|
|
1141
|
+
currency: string;
|
|
1142
|
+
price: number;
|
|
1143
|
+
tiers?: PriceTier[];
|
|
1144
|
+
}
|
|
1145
|
+
export interface ProductCurrencyPriceInput {
|
|
1146
|
+
currency: string;
|
|
1147
|
+
price: number | null;
|
|
1148
|
+
tiers?: PriceTier[];
|
|
1149
|
+
}
|
|
1121
1150
|
export interface ProductVariantInput {
|
|
1122
1151
|
selections: Record<string, string>;
|
|
1123
1152
|
sku: string | null;
|
|
1124
1153
|
price: number;
|
|
1125
1154
|
inventory: number | null;
|
|
1126
1155
|
tiers?: PriceTier[];
|
|
1156
|
+
currencyPrices?: VariantCurrencyPriceInput[];
|
|
1157
|
+
}
|
|
1158
|
+
export interface ShippingMethodCurrencyPriceInput {
|
|
1159
|
+
currency: string;
|
|
1160
|
+
price: number;
|
|
1161
|
+
minSubtotal?: number | null;
|
|
1162
|
+
maxSubtotal?: number | null;
|
|
1163
|
+
freeAbove?: number | null;
|
|
1127
1164
|
}
|
|
1128
1165
|
export interface ShippingMethodInput {
|
|
1129
1166
|
id: string;
|
|
@@ -1136,6 +1173,7 @@ export interface ShippingMethodInput {
|
|
|
1136
1173
|
minSubtotal?: number | null;
|
|
1137
1174
|
maxSubtotal?: number | null;
|
|
1138
1175
|
freeAbove?: number | null;
|
|
1176
|
+
currencyPrices?: ShippingMethodCurrencyPriceInput[];
|
|
1139
1177
|
}
|
|
1140
1178
|
export interface TaxRateInput {
|
|
1141
1179
|
id: string;
|
|
@@ -1159,6 +1197,7 @@ export interface OrderFieldInput {
|
|
|
1159
1197
|
}
|
|
1160
1198
|
export interface CartConfigInput {
|
|
1161
1199
|
defaultCurrency?: string;
|
|
1200
|
+
additionalCurrencies?: string[];
|
|
1162
1201
|
pricesIncludeTax?: boolean;
|
|
1163
1202
|
taxRates?: TaxRateInput[];
|
|
1164
1203
|
defaultTaxRateId?: string;
|
|
@@ -1191,6 +1230,7 @@ export interface ProductOps {
|
|
|
1191
1230
|
bulkUpdate(modelId: string, selection: ProductSelection, patch: ProductPatch): Promise<CountResult>;
|
|
1192
1231
|
setTiers(recordId: string, tiers: PriceTier[], increment?: number): Promise<unknown>;
|
|
1193
1232
|
setVariants(recordId: string, variants: ProductVariantInput[]): Promise<unknown>;
|
|
1233
|
+
setCurrencyPrices(recordId: string, prices: ProductCurrencyPriceInput[]): Promise<unknown>;
|
|
1194
1234
|
bulkDelete(modelId: string, selection: ProductSelection): Promise<ProductBulkDeleteResult>;
|
|
1195
1235
|
}
|
|
1196
1236
|
export interface TeamMemberSummary {
|
|
@@ -1312,11 +1352,16 @@ export interface PriceListSummary {
|
|
|
1312
1352
|
endsAt: string | null;
|
|
1313
1353
|
active: boolean;
|
|
1314
1354
|
overrideCount: number;
|
|
1355
|
+
overrideCountByCurrency: PriceListCurrencyCount[];
|
|
1315
1356
|
assignedCount: number;
|
|
1316
1357
|
channels: PriceListChannel[];
|
|
1317
1358
|
createdAt: string | null;
|
|
1318
1359
|
updatedAt: string | null;
|
|
1319
1360
|
}
|
|
1361
|
+
export interface PriceListCurrencyCount {
|
|
1362
|
+
currency: string;
|
|
1363
|
+
count: number;
|
|
1364
|
+
}
|
|
1320
1365
|
export interface PriceListChannel {
|
|
1321
1366
|
id: string;
|
|
1322
1367
|
key: string;
|
|
@@ -1349,6 +1394,7 @@ export interface SalesChannelSummary {
|
|
|
1349
1394
|
id: string;
|
|
1350
1395
|
key: string;
|
|
1351
1396
|
name: string;
|
|
1397
|
+
currency: string;
|
|
1352
1398
|
displayMode: PriceDisplayMode;
|
|
1353
1399
|
priceAccess: ChannelPriceAccess;
|
|
1354
1400
|
activeCartCount: number;
|
|
@@ -1361,11 +1407,13 @@ export interface SalesChannelSummary {
|
|
|
1361
1407
|
export interface SalesChannelInput {
|
|
1362
1408
|
key: string;
|
|
1363
1409
|
name: string;
|
|
1410
|
+
currency?: string | null;
|
|
1364
1411
|
displayMode?: PriceDisplayMode;
|
|
1365
1412
|
priceAccess?: ChannelPriceAccess;
|
|
1366
1413
|
}
|
|
1367
1414
|
export interface SalesChannelUpdateInput {
|
|
1368
1415
|
name?: string;
|
|
1416
|
+
currency?: string | null;
|
|
1369
1417
|
displayMode?: PriceDisplayMode;
|
|
1370
1418
|
priceAccess?: ChannelPriceAccess;
|
|
1371
1419
|
}
|
|
@@ -1391,6 +1439,7 @@ export interface PriceListEntry {
|
|
|
1391
1439
|
export interface PriceListEntryInput {
|
|
1392
1440
|
recordId: string;
|
|
1393
1441
|
variantKey?: string;
|
|
1442
|
+
currency?: string;
|
|
1394
1443
|
price: number;
|
|
1395
1444
|
tiers?: PriceTier[];
|
|
1396
1445
|
minQuantity?: number | null;
|
|
@@ -1399,9 +1448,11 @@ export interface PriceListEntryInput {
|
|
|
1399
1448
|
export interface PriceListEntryKey {
|
|
1400
1449
|
recordId: string;
|
|
1401
1450
|
variantKey?: string;
|
|
1451
|
+
currency?: string;
|
|
1402
1452
|
}
|
|
1403
1453
|
export interface PriceListEntriesOptions {
|
|
1404
1454
|
recordId?: string;
|
|
1455
|
+
currency?: string;
|
|
1405
1456
|
first?: number;
|
|
1406
1457
|
after?: string;
|
|
1407
1458
|
}
|