@solution25/n8n-nodes-shopware 1.4.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/README.md +80 -0
- package/dist/credentials/ShopwareOAuth2Api.credentials.d.ts +16 -0
- package/dist/credentials/ShopwareOAuth2Api.credentials.js +78 -0
- package/dist/credentials/ShopwareOAuth2Api.credentials.js.map +1 -0
- package/dist/nodes/Shopware/Shopware.node.d.ts +4 -0
- package/dist/nodes/Shopware/Shopware.node.js +23 -0
- package/dist/nodes/Shopware/Shopware.node.js.map +1 -0
- package/dist/nodes/Shopware/Shopware.node.json +18 -0
- package/dist/nodes/Shopware/test/v1/node/customer/getMany.test.d.ts +1 -0
- package/dist/nodes/Shopware/test/v1/node/customer/getMany.test.js +98 -0
- package/dist/nodes/Shopware/test/v1/node/customer/getMany.test.js.map +1 -0
- package/dist/nodes/Shopware/test/v1/node/helpers.d.ts +6 -0
- package/dist/nodes/Shopware/test/v1/node/helpers.js +44 -0
- package/dist/nodes/Shopware/test/v1/node/helpers.js.map +1 -0
- package/dist/nodes/Shopware/test/v1/node/order/getMany.test.d.ts +1 -0
- package/dist/nodes/Shopware/test/v1/node/order/getMany.test.js +111 -0
- package/dist/nodes/Shopware/test/v1/node/order/getMany.test.js.map +1 -0
- package/dist/nodes/Shopware/test/v1/node/product/getMany.test.d.ts +1 -0
- package/dist/nodes/Shopware/test/v1/node/product/getMany.test.js +96 -0
- package/dist/nodes/Shopware/test/v1/node/product/getMany.test.js.map +1 -0
- package/dist/nodes/Shopware/v1/ShopwareV1.node.d.ts +10 -0
- package/dist/nodes/Shopware/v1/ShopwareV1.node.js +23 -0
- package/dist/nodes/Shopware/v1/ShopwareV1.node.js.map +1 -0
- package/dist/nodes/Shopware/v1/actions/category/Category.resource.d.ts +8 -0
- package/dist/nodes/Shopware/v1/actions/category/Category.resource.js +98 -0
- package/dist/nodes/Shopware/v1/actions/category/Category.resource.js.map +1 -0
- package/dist/nodes/Shopware/v1/actions/category/create.operation.d.ts +27 -0
- package/dist/nodes/Shopware/v1/actions/category/create.operation.js +211 -0
- package/dist/nodes/Shopware/v1/actions/category/create.operation.js.map +1 -0
- package/dist/nodes/Shopware/v1/actions/category/deleteCategory.operation.d.ts +27 -0
- package/dist/nodes/Shopware/v1/actions/category/deleteCategory.operation.js +47 -0
- package/dist/nodes/Shopware/v1/actions/category/deleteCategory.operation.js.map +1 -0
- package/dist/nodes/Shopware/v1/actions/category/fields.d.ts +1 -0
- package/dist/nodes/Shopware/v1/actions/category/fields.js +21 -0
- package/dist/nodes/Shopware/v1/actions/category/fields.js.map +1 -0
- package/dist/nodes/Shopware/v1/actions/category/get.operation.d.ts +27 -0
- package/dist/nodes/Shopware/v1/actions/category/get.operation.js +77 -0
- package/dist/nodes/Shopware/v1/actions/category/get.operation.js.map +1 -0
- package/dist/nodes/Shopware/v1/actions/category/getMany.operation.d.ts +27 -0
- package/dist/nodes/Shopware/v1/actions/category/getMany.operation.js +164 -0
- package/dist/nodes/Shopware/v1/actions/category/getMany.operation.js.map +1 -0
- package/dist/nodes/Shopware/v1/actions/category/types.d.ts +19 -0
- package/dist/nodes/Shopware/v1/actions/category/types.js +3 -0
- package/dist/nodes/Shopware/v1/actions/category/types.js.map +1 -0
- package/dist/nodes/Shopware/v1/actions/category/update.operation.d.ts +27 -0
- package/dist/nodes/Shopware/v1/actions/category/update.operation.js +120 -0
- package/dist/nodes/Shopware/v1/actions/category/update.operation.js.map +1 -0
- package/dist/nodes/Shopware/v1/actions/customer/Customer.resource.d.ts +8 -0
- package/dist/nodes/Shopware/v1/actions/customer/Customer.resource.js +98 -0
- package/dist/nodes/Shopware/v1/actions/customer/Customer.resource.js.map +1 -0
- package/dist/nodes/Shopware/v1/actions/customer/create.operation.d.ts +27 -0
- package/dist/nodes/Shopware/v1/actions/customer/create.operation.js +301 -0
- package/dist/nodes/Shopware/v1/actions/customer/create.operation.js.map +1 -0
- package/dist/nodes/Shopware/v1/actions/customer/deleteCustomer.operation.d.ts +27 -0
- package/dist/nodes/Shopware/v1/actions/customer/deleteCustomer.operation.js +47 -0
- package/dist/nodes/Shopware/v1/actions/customer/deleteCustomer.operation.js.map +1 -0
- package/dist/nodes/Shopware/v1/actions/customer/fields.d.ts +4 -0
- package/dist/nodes/Shopware/v1/actions/customer/fields.js +30 -0
- package/dist/nodes/Shopware/v1/actions/customer/fields.js.map +1 -0
- package/dist/nodes/Shopware/v1/actions/customer/get.operation.d.ts +27 -0
- package/dist/nodes/Shopware/v1/actions/customer/get.operation.js +77 -0
- package/dist/nodes/Shopware/v1/actions/customer/get.operation.js.map +1 -0
- package/dist/nodes/Shopware/v1/actions/customer/getMany.operation.d.ts +27 -0
- package/dist/nodes/Shopware/v1/actions/customer/getMany.operation.js +319 -0
- package/dist/nodes/Shopware/v1/actions/customer/getMany.operation.js.map +1 -0
- package/dist/nodes/Shopware/v1/actions/customer/types.d.ts +54 -0
- package/dist/nodes/Shopware/v1/actions/customer/types.js +3 -0
- package/dist/nodes/Shopware/v1/actions/customer/types.js.map +1 -0
- package/dist/nodes/Shopware/v1/actions/customer/update.operation.d.ts +27 -0
- package/dist/nodes/Shopware/v1/actions/customer/update.operation.js +287 -0
- package/dist/nodes/Shopware/v1/actions/customer/update.operation.js.map +1 -0
- package/dist/nodes/Shopware/v1/actions/fields.d.ts +5 -0
- package/dist/nodes/Shopware/v1/actions/fields.js +26 -0
- package/dist/nodes/Shopware/v1/actions/fields.js.map +1 -0
- package/dist/nodes/Shopware/v1/actions/node.type.d.ts +9 -0
- package/dist/nodes/Shopware/v1/actions/node.type.js +3 -0
- package/dist/nodes/Shopware/v1/actions/node.type.js.map +1 -0
- package/dist/nodes/Shopware/v1/actions/order/Order.resource.d.ts +8 -0
- package/dist/nodes/Shopware/v1/actions/order/Order.resource.js +98 -0
- package/dist/nodes/Shopware/v1/actions/order/Order.resource.js.map +1 -0
- package/dist/nodes/Shopware/v1/actions/order/create.operation.d.ts +27 -0
- package/dist/nodes/Shopware/v1/actions/order/create.operation.js +861 -0
- package/dist/nodes/Shopware/v1/actions/order/create.operation.js.map +1 -0
- package/dist/nodes/Shopware/v1/actions/order/deleteOrder.operation.d.ts +27 -0
- package/dist/nodes/Shopware/v1/actions/order/deleteOrder.operation.js +47 -0
- package/dist/nodes/Shopware/v1/actions/order/deleteOrder.operation.js.map +1 -0
- package/dist/nodes/Shopware/v1/actions/order/fields.d.ts +2 -0
- package/dist/nodes/Shopware/v1/actions/order/fields.js +25 -0
- package/dist/nodes/Shopware/v1/actions/order/fields.js.map +1 -0
- package/dist/nodes/Shopware/v1/actions/order/get.operation.d.ts +27 -0
- package/dist/nodes/Shopware/v1/actions/order/get.operation.js +77 -0
- package/dist/nodes/Shopware/v1/actions/order/get.operation.js.map +1 -0
- package/dist/nodes/Shopware/v1/actions/order/getMany.operation.d.ts +27 -0
- package/dist/nodes/Shopware/v1/actions/order/getMany.operation.js +226 -0
- package/dist/nodes/Shopware/v1/actions/order/getMany.operation.js.map +1 -0
- package/dist/nodes/Shopware/v1/actions/order/types.d.ts +171 -0
- package/dist/nodes/Shopware/v1/actions/order/types.js +3 -0
- package/dist/nodes/Shopware/v1/actions/order/types.js.map +1 -0
- package/dist/nodes/Shopware/v1/actions/order/update.operation.d.ts +27 -0
- package/dist/nodes/Shopware/v1/actions/order/update.operation.js +723 -0
- package/dist/nodes/Shopware/v1/actions/order/update.operation.js.map +1 -0
- package/dist/nodes/Shopware/v1/actions/product/Product.resource.d.ts +8 -0
- package/dist/nodes/Shopware/v1/actions/product/Product.resource.js +98 -0
- package/dist/nodes/Shopware/v1/actions/product/Product.resource.js.map +1 -0
- package/dist/nodes/Shopware/v1/actions/product/create.operation.d.ts +27 -0
- package/dist/nodes/Shopware/v1/actions/product/create.operation.js +335 -0
- package/dist/nodes/Shopware/v1/actions/product/create.operation.js.map +1 -0
- package/dist/nodes/Shopware/v1/actions/product/deleteProduct.operation.d.ts +27 -0
- package/dist/nodes/Shopware/v1/actions/product/deleteProduct.operation.js +47 -0
- package/dist/nodes/Shopware/v1/actions/product/deleteProduct.operation.js.map +1 -0
- package/dist/nodes/Shopware/v1/actions/product/fields.d.ts +7 -0
- package/dist/nodes/Shopware/v1/actions/product/fields.js +33 -0
- package/dist/nodes/Shopware/v1/actions/product/fields.js.map +1 -0
- package/dist/nodes/Shopware/v1/actions/product/get.operation.d.ts +27 -0
- package/dist/nodes/Shopware/v1/actions/product/get.operation.js +77 -0
- package/dist/nodes/Shopware/v1/actions/product/get.operation.js.map +1 -0
- package/dist/nodes/Shopware/v1/actions/product/getMany.operation.d.ts +27 -0
- package/dist/nodes/Shopware/v1/actions/product/getMany.operation.js +319 -0
- package/dist/nodes/Shopware/v1/actions/product/getMany.operation.js.map +1 -0
- package/dist/nodes/Shopware/v1/actions/product/types.d.ts +66 -0
- package/dist/nodes/Shopware/v1/actions/product/types.js +3 -0
- package/dist/nodes/Shopware/v1/actions/product/types.js.map +1 -0
- package/dist/nodes/Shopware/v1/actions/product/update.operation.d.ts +27 -0
- package/dist/nodes/Shopware/v1/actions/product/update.operation.js +287 -0
- package/dist/nodes/Shopware/v1/actions/product/update.operation.js.map +1 -0
- package/dist/nodes/Shopware/v1/actions/router.d.ts +2 -0
- package/dist/nodes/Shopware/v1/actions/router.js +78 -0
- package/dist/nodes/Shopware/v1/actions/router.js.map +1 -0
- package/dist/nodes/Shopware/v1/actions/types.d.ts +97 -0
- package/dist/nodes/Shopware/v1/actions/types.js +3 -0
- package/dist/nodes/Shopware/v1/actions/types.js.map +1 -0
- package/dist/nodes/Shopware/v1/actions/versionDescription.d.ts +2 -0
- package/dist/nodes/Shopware/v1/actions/versionDescription.js +93 -0
- package/dist/nodes/Shopware/v1/actions/versionDescription.js.map +1 -0
- package/dist/nodes/Shopware/v1/helpers/handlers.d.ts +14 -0
- package/dist/nodes/Shopware/v1/helpers/handlers.js +261 -0
- package/dist/nodes/Shopware/v1/helpers/handlers.js.map +1 -0
- package/dist/nodes/Shopware/v1/helpers/interfaces.d.ts +1 -0
- package/dist/nodes/Shopware/v1/helpers/interfaces.js +3 -0
- package/dist/nodes/Shopware/v1/helpers/interfaces.js.map +1 -0
- package/dist/nodes/Shopware/v1/helpers/utils.d.ts +16 -0
- package/dist/nodes/Shopware/v1/helpers/utils.js +354 -0
- package/dist/nodes/Shopware/v1/helpers/utils.js.map +1 -0
- package/dist/nodes/Shopware/v1/methods/index.d.ts +1 -0
- package/dist/nodes/Shopware/v1/methods/index.js +38 -0
- package/dist/nodes/Shopware/v1/methods/index.js.map +1 -0
- package/dist/nodes/Shopware/v1/methods/loadOptions.d.ts +18 -0
- package/dist/nodes/Shopware/v1/methods/loadOptions.js +143 -0
- package/dist/nodes/Shopware/v1/methods/loadOptions.js.map +1 -0
- package/dist/nodes/Shopware/v1/transport/index.d.ts +2 -0
- package/dist/nodes/Shopware/v1/transport/index.js +25 -0
- package/dist/nodes/Shopware/v1/transport/index.js.map +1 -0
- package/dist/package.json +63 -0
- package/dist/shopware.png +0 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/package.json +63 -0
|
@@ -0,0 +1,287 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.description = void 0;
|
|
4
|
+
exports.execute = execute;
|
|
5
|
+
const n8n_workflow_1 = require("n8n-workflow");
|
|
6
|
+
const utils_1 = require("../../helpers/utils");
|
|
7
|
+
const fields_1 = require("./fields");
|
|
8
|
+
const transport_1 = require("../../transport");
|
|
9
|
+
const properties = [
|
|
10
|
+
{
|
|
11
|
+
displayName: 'Product ID',
|
|
12
|
+
name: 'id',
|
|
13
|
+
type: 'string',
|
|
14
|
+
default: '',
|
|
15
|
+
placeholder: 'e.g. 2a88d9b59d474...',
|
|
16
|
+
required: true,
|
|
17
|
+
description: 'ID of the product to update. You can find the ID in the URL when viewing the product in Shopware Admin (e.g. https://your-domain.com/admin#/sw/product/detail/<productId>).',
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
displayName: 'Update Fields',
|
|
21
|
+
name: 'updateFields',
|
|
22
|
+
type: 'collection',
|
|
23
|
+
placeholder: 'Add Field',
|
|
24
|
+
default: {},
|
|
25
|
+
options: [
|
|
26
|
+
{
|
|
27
|
+
displayName: 'Active',
|
|
28
|
+
name: 'active',
|
|
29
|
+
type: 'boolean',
|
|
30
|
+
default: true,
|
|
31
|
+
description: 'Whether the product is active and visible in the storefront',
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
displayName: 'Categories',
|
|
35
|
+
name: 'categories',
|
|
36
|
+
type: 'multiOptions',
|
|
37
|
+
typeOptions: {
|
|
38
|
+
loadOptionsMethod: 'getCategories',
|
|
39
|
+
},
|
|
40
|
+
default: [],
|
|
41
|
+
description: 'Choose the categories to assign the product to',
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
displayName: 'Description',
|
|
45
|
+
name: 'description',
|
|
46
|
+
type: 'string',
|
|
47
|
+
typeOptions: {
|
|
48
|
+
rows: 4,
|
|
49
|
+
},
|
|
50
|
+
default: '',
|
|
51
|
+
placeholder: 'e.g. A high-quality mobile phone with a sleek design and advanced features.',
|
|
52
|
+
description: 'Description of the product',
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
displayName: 'EAN',
|
|
56
|
+
name: 'ean',
|
|
57
|
+
type: 'string',
|
|
58
|
+
default: '',
|
|
59
|
+
placeholder: 'e.g. 4006381333931',
|
|
60
|
+
description: 'European Article Number (EAN) of the product',
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
displayName: 'Manufacturer',
|
|
64
|
+
name: 'manufacturer',
|
|
65
|
+
type: 'string',
|
|
66
|
+
default: '',
|
|
67
|
+
placeholder: 'e.g. Apple',
|
|
68
|
+
description: 'Name of the manufacturer of the product',
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
displayName: 'Name',
|
|
72
|
+
name: 'name',
|
|
73
|
+
type: 'string',
|
|
74
|
+
default: '',
|
|
75
|
+
placeholder: 'e.g. Mobile Phone',
|
|
76
|
+
description: 'Product name',
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
displayName: 'Parent ID',
|
|
80
|
+
name: 'parentId',
|
|
81
|
+
type: 'string',
|
|
82
|
+
default: '',
|
|
83
|
+
placeholder: 'e.g. 2a88d9b59d474...',
|
|
84
|
+
description: 'ID of the parent product if this product is a variant',
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
displayName: 'Prices',
|
|
88
|
+
name: 'prices',
|
|
89
|
+
placeholder: 'Add Price',
|
|
90
|
+
type: 'fixedCollection',
|
|
91
|
+
typeOptions: {
|
|
92
|
+
multipleValues: true,
|
|
93
|
+
},
|
|
94
|
+
description: 'Different prices for different currencies',
|
|
95
|
+
default: {},
|
|
96
|
+
options: [
|
|
97
|
+
{
|
|
98
|
+
name: 'price',
|
|
99
|
+
displayName: 'Price',
|
|
100
|
+
values: [
|
|
101
|
+
{
|
|
102
|
+
displayName: 'Currency',
|
|
103
|
+
name: 'currency',
|
|
104
|
+
type: 'options',
|
|
105
|
+
typeOptions: {
|
|
106
|
+
loadOptionsMethod: 'getCurrencies',
|
|
107
|
+
},
|
|
108
|
+
required: true,
|
|
109
|
+
default: '',
|
|
110
|
+
description: 'Choose the price currency from the list',
|
|
111
|
+
},
|
|
112
|
+
{
|
|
113
|
+
displayName: 'Gross Price',
|
|
114
|
+
name: 'grossPrice',
|
|
115
|
+
type: 'number',
|
|
116
|
+
typeOptions: {
|
|
117
|
+
maxValue: 999000000,
|
|
118
|
+
minValue: 0,
|
|
119
|
+
numberPrecision: 2,
|
|
120
|
+
},
|
|
121
|
+
required: true,
|
|
122
|
+
default: 0,
|
|
123
|
+
placeholder: 'e.g. 499.99',
|
|
124
|
+
description: 'Gross price of the product',
|
|
125
|
+
},
|
|
126
|
+
{
|
|
127
|
+
displayName: 'Autocalculate Net',
|
|
128
|
+
name: 'autoCalculateNet',
|
|
129
|
+
type: 'boolean',
|
|
130
|
+
default: true,
|
|
131
|
+
description: 'Whether to automatically calculate the net price based on the gross price and tax rate',
|
|
132
|
+
},
|
|
133
|
+
{
|
|
134
|
+
displayName: 'Net Price',
|
|
135
|
+
name: 'netPrice',
|
|
136
|
+
type: 'number',
|
|
137
|
+
typeOptions: {
|
|
138
|
+
maxValue: 999000000,
|
|
139
|
+
minValue: 0,
|
|
140
|
+
numberPrecision: 2,
|
|
141
|
+
},
|
|
142
|
+
displayOptions: {
|
|
143
|
+
show: {
|
|
144
|
+
autoCalculateNet: [false],
|
|
145
|
+
},
|
|
146
|
+
},
|
|
147
|
+
required: true,
|
|
148
|
+
default: 0,
|
|
149
|
+
placeholder: 'e.g. 499.99',
|
|
150
|
+
description: 'Net price of the product',
|
|
151
|
+
},
|
|
152
|
+
],
|
|
153
|
+
},
|
|
154
|
+
],
|
|
155
|
+
},
|
|
156
|
+
{
|
|
157
|
+
displayName: 'Sales Channels',
|
|
158
|
+
name: 'salesChannels',
|
|
159
|
+
type: 'multiOptions',
|
|
160
|
+
typeOptions: {
|
|
161
|
+
loadOptionsMethod: 'getSalesChannels',
|
|
162
|
+
},
|
|
163
|
+
default: [],
|
|
164
|
+
description: 'Choose the sales channels to assign the product to',
|
|
165
|
+
},
|
|
166
|
+
{
|
|
167
|
+
displayName: 'Stock',
|
|
168
|
+
name: 'stock',
|
|
169
|
+
type: 'number',
|
|
170
|
+
typeOptions: {
|
|
171
|
+
maxValue: 1000000,
|
|
172
|
+
minValue: 0,
|
|
173
|
+
},
|
|
174
|
+
default: 0,
|
|
175
|
+
description: 'Available stock quantity of the product',
|
|
176
|
+
},
|
|
177
|
+
{
|
|
178
|
+
displayName: 'Tax Rate',
|
|
179
|
+
name: 'taxRate',
|
|
180
|
+
type: 'options',
|
|
181
|
+
typeOptions: {
|
|
182
|
+
loadOptionsMethod: 'getTaxRates',
|
|
183
|
+
},
|
|
184
|
+
default: '',
|
|
185
|
+
description: 'Choose the tax rate from the list',
|
|
186
|
+
},
|
|
187
|
+
],
|
|
188
|
+
},
|
|
189
|
+
];
|
|
190
|
+
const displayOptions = {
|
|
191
|
+
show: {
|
|
192
|
+
resource: ['product'],
|
|
193
|
+
operation: ['update'],
|
|
194
|
+
},
|
|
195
|
+
};
|
|
196
|
+
exports.description = (0, n8n_workflow_1.updateDisplayOptions)(displayOptions, properties);
|
|
197
|
+
async function execute(items) {
|
|
198
|
+
var _a, _b, _c, _d;
|
|
199
|
+
const returnData = [];
|
|
200
|
+
for (let i = 0; i < items.length; i++) {
|
|
201
|
+
try {
|
|
202
|
+
const id = this.getNodeParameter('id', i);
|
|
203
|
+
const searchBody = {
|
|
204
|
+
fields: fields_1.productFields,
|
|
205
|
+
includes: {
|
|
206
|
+
product: fields_1.productFields,
|
|
207
|
+
},
|
|
208
|
+
filter: [{ type: 'equals', field: 'id', value: id }],
|
|
209
|
+
};
|
|
210
|
+
const product = (await transport_1.apiRequest.call(this, 'POST', `/search/product`, searchBody)).data[0];
|
|
211
|
+
if (!product) {
|
|
212
|
+
throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'Product does not exist', {
|
|
213
|
+
description: 'There is no product with id ' + id,
|
|
214
|
+
itemIndex: i,
|
|
215
|
+
});
|
|
216
|
+
}
|
|
217
|
+
const updateFields = this.getNodeParameter('updateFields', i);
|
|
218
|
+
const updateBody = {
|
|
219
|
+
parentId: updateFields.parentId,
|
|
220
|
+
ean: updateFields.ean,
|
|
221
|
+
name: updateFields.name,
|
|
222
|
+
description: updateFields.description,
|
|
223
|
+
price: [
|
|
224
|
+
...(((_a = updateFields.prices) === null || _a === void 0 ? void 0 : _a.price)
|
|
225
|
+
? updateFields.prices.price.map((price) => ({
|
|
226
|
+
currencyId: price.currency,
|
|
227
|
+
gross: price.grossPrice,
|
|
228
|
+
net: price.autoCalculateNet ? 0 : price.netPrice,
|
|
229
|
+
linked: true,
|
|
230
|
+
}))
|
|
231
|
+
: []),
|
|
232
|
+
],
|
|
233
|
+
taxId: (_b = updateFields.taxRate) === null || _b === void 0 ? void 0 : _b.split('-')[0],
|
|
234
|
+
manufacturer: updateFields.manufacturer
|
|
235
|
+
? {
|
|
236
|
+
name: updateFields.manufacturer,
|
|
237
|
+
}
|
|
238
|
+
: undefined,
|
|
239
|
+
stock: updateFields.stock,
|
|
240
|
+
categories: (_c = updateFields.categories) === null || _c === void 0 ? void 0 : _c.map((category) => ({
|
|
241
|
+
id: category.split('-')[0],
|
|
242
|
+
name: category.split('-')[1],
|
|
243
|
+
})),
|
|
244
|
+
visibilities: (_d = updateFields.salesChannels) === null || _d === void 0 ? void 0 : _d.map((salesChannelId) => ({
|
|
245
|
+
salesChannelId,
|
|
246
|
+
visibility: 30,
|
|
247
|
+
})),
|
|
248
|
+
active: updateFields.active,
|
|
249
|
+
};
|
|
250
|
+
for (const key in updateBody) {
|
|
251
|
+
const typedKey = key;
|
|
252
|
+
if (Array.isArray(updateBody[typedKey]) &&
|
|
253
|
+
updateBody[typedKey].length === 0) {
|
|
254
|
+
delete updateBody[typedKey];
|
|
255
|
+
}
|
|
256
|
+
else if (updateBody[typedKey] === '') {
|
|
257
|
+
delete updateBody[typedKey];
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
if (updateBody.price) {
|
|
261
|
+
const taxRate = updateFields.taxRate
|
|
262
|
+
? parseFloat(updateFields.taxRate.split('-')[2])
|
|
263
|
+
: await utils_1.getProductTaxRate.call(this, id);
|
|
264
|
+
updateBody.price.forEach((price) => {
|
|
265
|
+
if (price.net === 0) {
|
|
266
|
+
price.net = parseFloat((price.gross / (1 + taxRate / 100)).toFixed(2));
|
|
267
|
+
}
|
|
268
|
+
});
|
|
269
|
+
}
|
|
270
|
+
await transport_1.apiRequest.call(this, 'PATCH', `/product/${id}`, updateBody);
|
|
271
|
+
const response = await transport_1.apiRequest.call(this, 'POST', `/search/product`, searchBody);
|
|
272
|
+
const executionData = this.helpers.constructExecutionMetaData((0, utils_1.wrapData)(response.data), {
|
|
273
|
+
itemData: { item: i },
|
|
274
|
+
});
|
|
275
|
+
returnData.push(...executionData);
|
|
276
|
+
}
|
|
277
|
+
catch (error) {
|
|
278
|
+
if (this.continueOnFail()) {
|
|
279
|
+
returnData.push({ json: { error: error.message } });
|
|
280
|
+
continue;
|
|
281
|
+
}
|
|
282
|
+
throw new n8n_workflow_1.NodeApiError(this.getNode(), error);
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
return returnData;
|
|
286
|
+
}
|
|
287
|
+
//# sourceMappingURL=update.operation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"update.operation.js","sourceRoot":"","sources":["../../../../../../nodes/Shopware/v1/actions/product/update.operation.ts"],"names":[],"mappings":";;;AAqNA,0BAkHC;AAjUD,+CAQsB;AAEtB,+CAAkE;AAClE,qCAAyC;AACzC,+CAA6C;AAE7C,MAAM,UAAU,GAAsB;IACrC;QACC,WAAW,EAAE,YAAY;QACzB,IAAI,EAAE,IAAI;QACV,IAAI,EAAE,QAAQ;QACd,OAAO,EAAE,EAAE;QACX,WAAW,EAAE,uBAAuB;QACpC,QAAQ,EAAE,IAAI;QACd,WAAW,EACV,mLAAmL;KACpL;IACD;QACC,WAAW,EAAE,eAAe;QAC5B,IAAI,EAAE,cAAc;QACpB,IAAI,EAAE,YAAY;QAClB,WAAW,EAAE,WAAW;QACxB,OAAO,EAAE,EAAE;QACX,OAAO,EAAE;YACR;gBACC,WAAW,EAAE,QAAQ;gBACrB,IAAI,EAAE,QAAQ;gBACd,IAAI,EAAE,SAAS;gBACf,OAAO,EAAE,IAAI;gBACb,WAAW,EAAE,6DAA6D;aAC1E;YACD;gBACC,WAAW,EAAE,YAAY;gBACzB,IAAI,EAAE,YAAY;gBAClB,IAAI,EAAE,cAAc;gBACpB,WAAW,EAAE;oBACZ,iBAAiB,EAAE,eAAe;iBAClC;gBACD,OAAO,EAAE,EAAE;gBACX,WAAW,EAAE,gDAAgD;aAC7D;YACD;gBACC,WAAW,EAAE,aAAa;gBAC1B,IAAI,EAAE,aAAa;gBACnB,IAAI,EAAE,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K,GAAG,CAAC,CAAC,GAAG,OAAO,GAAG,GAAG,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC;oBACxE,CAAC;gBACF,CAAC,CAAC,CAAC;YACJ,CAAC;YAED,MAAM,sBAAU,CAAC,IAAI,CAAC,IAAI,EAAE,OAAO,EAAE,YAAY,EAAE,EAAE,EAAE,UAAU,CAAC,CAAC;YAEnE,MAAM,QAAQ,GAAG,MAAM,sBAAU,CAAC,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,iBAAiB,EAAE,UAAU,CAAC,CAAC;YAEpF,MAAM,aAAa,GAAG,IAAI,CAAC,OAAO,CAAC,0BAA0B,CAAC,IAAA,gBAAQ,EAAC,QAAQ,CAAC,IAAI,CAAC,EAAE;gBACtF,QAAQ,EAAE,EAAE,IAAI,EAAE,CAAC,EAAE;aACrB,CAAC,CAAC;YAEH,UAAU,CAAC,IAAI,CAAC,GAAG,aAAa,CAAC,CAAC;QACnC,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YAChB,IAAI,IAAI,CAAC,cAAc,EAAE,EAAE,CAAC;gBAC3B,UAAU,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,EAAE,KAAK,EAAE,KAAK,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;gBACpD,SAAS;YACV,CAAC;YAED,MAAM,IAAI,2BAAY,CAAC,IAAI,CAAC,OAAO,EAAE,EAAE,KAAmB,CAAC,CAAC;QAC7D,CAAC;IACF,CAAC;IAED,OAAO,UAAU,CAAC;AACnB,CAAC"}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
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);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.router = router;
|
|
37
|
+
const n8n_workflow_1 = require("n8n-workflow");
|
|
38
|
+
const product = __importStar(require("./product/Product.resource"));
|
|
39
|
+
const customer = __importStar(require("./customer/Customer.resource"));
|
|
40
|
+
const order = __importStar(require("./order/Order.resource"));
|
|
41
|
+
const category = __importStar(require("./category/Category.resource"));
|
|
42
|
+
async function router() {
|
|
43
|
+
let returnData = [];
|
|
44
|
+
const items = this.getInputData();
|
|
45
|
+
const resource = this.getNodeParameter('resource', 0);
|
|
46
|
+
const operation = this.getNodeParameter('operation', 0);
|
|
47
|
+
const shopwareNodeData = {
|
|
48
|
+
resource,
|
|
49
|
+
operation,
|
|
50
|
+
};
|
|
51
|
+
try {
|
|
52
|
+
switch (shopwareNodeData.resource) {
|
|
53
|
+
case 'product':
|
|
54
|
+
returnData = await product[shopwareNodeData.operation].execute.call(this, items);
|
|
55
|
+
break;
|
|
56
|
+
case 'customer':
|
|
57
|
+
returnData = await customer[shopwareNodeData.operation].execute.call(this, items);
|
|
58
|
+
break;
|
|
59
|
+
case 'order':
|
|
60
|
+
returnData = await order[shopwareNodeData.operation].execute.call(this, items);
|
|
61
|
+
break;
|
|
62
|
+
case 'category':
|
|
63
|
+
returnData = await category[shopwareNodeData.operation].execute.call(this, items);
|
|
64
|
+
break;
|
|
65
|
+
default:
|
|
66
|
+
throw new n8n_workflow_1.NodeOperationError(this.getNode(), `The resource is not supported!`);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
catch (error) {
|
|
70
|
+
if (error.description &&
|
|
71
|
+
error.description.includes('cannot accept the provided value')) {
|
|
72
|
+
error.description = `${error.description}. Consider using 'Typecast' option`;
|
|
73
|
+
}
|
|
74
|
+
throw error;
|
|
75
|
+
}
|
|
76
|
+
return [returnData];
|
|
77
|
+
}
|
|
78
|
+
//# sourceMappingURL=router.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"router.js","sourceRoot":"","sources":["../../../../../nodes/Shopware/v1/actions/router.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmBA,wBA2CC;AA5DD,+CAAkD;AAClD,oEAAsD;AACtD,uEAAyD;AACzD,8DAAgD;AAChD,uEAAyD;AAalD,KAAK,UAAU,MAAM;IAC3B,IAAI,UAAU,GAAyB,EAAE,CAAC;IAE1C,MAAM,KAAK,GAAG,IAAI,CAAC,YAAY,EAAE,CAAC;IAClC,MAAM,QAAQ,GAAG,IAAI,CAAC,gBAAgB,CAAe,UAAU,EAAE,CAA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,CAAC"}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import { GenericValue, IDataObject } from "n8n-workflow";
|
|
2
|
+
export type GenericOption = {
|
|
3
|
+
id: string;
|
|
4
|
+
name: string;
|
|
5
|
+
};
|
|
6
|
+
type ProductPrice = {
|
|
7
|
+
currencyId: string;
|
|
8
|
+
net: number;
|
|
9
|
+
};
|
|
10
|
+
export interface ProductResponse {
|
|
11
|
+
id: string;
|
|
12
|
+
name: string;
|
|
13
|
+
states: string[];
|
|
14
|
+
price: Array<ProductPrice>;
|
|
15
|
+
taxId: string;
|
|
16
|
+
}
|
|
17
|
+
export interface LineItemResponse {
|
|
18
|
+
identifier: string;
|
|
19
|
+
productId: string;
|
|
20
|
+
label: string;
|
|
21
|
+
states: string[];
|
|
22
|
+
unitPrice: number;
|
|
23
|
+
taxRate: number;
|
|
24
|
+
}
|
|
25
|
+
export interface CustomerResponse {
|
|
26
|
+
id: string;
|
|
27
|
+
firstName: string;
|
|
28
|
+
lastName: string;
|
|
29
|
+
email: string;
|
|
30
|
+
salutationId: string;
|
|
31
|
+
salesChannelId: string;
|
|
32
|
+
languageId: string;
|
|
33
|
+
defaultBillingAddressId: string;
|
|
34
|
+
defaultShippingAddressId: string;
|
|
35
|
+
}
|
|
36
|
+
export interface CustomerAddressResponse {
|
|
37
|
+
id: string;
|
|
38
|
+
countryId: string;
|
|
39
|
+
firstName: string;
|
|
40
|
+
lastName: string;
|
|
41
|
+
street: string;
|
|
42
|
+
city: string;
|
|
43
|
+
}
|
|
44
|
+
export interface OrderCustomerResponse extends CustomerResponse {
|
|
45
|
+
billingAddress: CustomerAddressResponse;
|
|
46
|
+
shippingAddress: CustomerAddressResponse;
|
|
47
|
+
}
|
|
48
|
+
export type ShippingMethodPrice = {
|
|
49
|
+
currencyId: string;
|
|
50
|
+
net: number;
|
|
51
|
+
};
|
|
52
|
+
export type ShippingMethodDataResponse = {
|
|
53
|
+
unitPrice: number;
|
|
54
|
+
taxRate: number;
|
|
55
|
+
};
|
|
56
|
+
export type DeliveryTimeResponse = {
|
|
57
|
+
min: number;
|
|
58
|
+
max: number;
|
|
59
|
+
unit: 'hour' | 'day' | 'week';
|
|
60
|
+
};
|
|
61
|
+
export type SalutationOption = {
|
|
62
|
+
id: string;
|
|
63
|
+
displayName: string;
|
|
64
|
+
};
|
|
65
|
+
export type SearchFilter = {
|
|
66
|
+
type: 'equals' | 'equalsAny' | 'contains' | 'range';
|
|
67
|
+
field: string;
|
|
68
|
+
value?: GenericValue;
|
|
69
|
+
parameters?: {
|
|
70
|
+
gte?: GenericValue;
|
|
71
|
+
lte?: GenericValue;
|
|
72
|
+
gt?: GenericValue;
|
|
73
|
+
lt?: GenericValue;
|
|
74
|
+
};
|
|
75
|
+
};
|
|
76
|
+
export interface PaginationData {
|
|
77
|
+
page: number;
|
|
78
|
+
limit: number;
|
|
79
|
+
}
|
|
80
|
+
export interface SearchBodyConstruct extends PaginationData, IDataObject {
|
|
81
|
+
fields: string[];
|
|
82
|
+
includes: {
|
|
83
|
+
[key: string]: string[];
|
|
84
|
+
};
|
|
85
|
+
associations?: {
|
|
86
|
+
[key: string]: object;
|
|
87
|
+
};
|
|
88
|
+
filter?: Array<SearchFilter>;
|
|
89
|
+
}
|
|
90
|
+
export type PriceUi = {
|
|
91
|
+
price: {
|
|
92
|
+
currency: string;
|
|
93
|
+
minPrice?: string;
|
|
94
|
+
maxPrice?: string;
|
|
95
|
+
};
|
|
96
|
+
};
|
|
97
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../../nodes/Shopware/v1/actions/types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
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);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.versionDescription = void 0;
|
|
37
|
+
const product = __importStar(require("./product/Product.resource"));
|
|
38
|
+
const customer = __importStar(require("./customer/Customer.resource"));
|
|
39
|
+
const order = __importStar(require("./order/Order.resource"));
|
|
40
|
+
const category = __importStar(require("./category/Category.resource"));
|
|
41
|
+
exports.versionDescription = {
|
|
42
|
+
displayName: 'Shopware',
|
|
43
|
+
name: 'shopware',
|
|
44
|
+
icon: 'file:../../../shopware.png',
|
|
45
|
+
group: ['input'],
|
|
46
|
+
version: [1],
|
|
47
|
+
subtitle: '={{ $parameter["operation"] + ": " + $parameter["resource"] }}',
|
|
48
|
+
description: 'Read, update, write and delete data from Shopware',
|
|
49
|
+
defaults: {
|
|
50
|
+
name: 'Shopware',
|
|
51
|
+
},
|
|
52
|
+
inputs: ['main'],
|
|
53
|
+
outputs: ['main'],
|
|
54
|
+
credentials: [
|
|
55
|
+
{
|
|
56
|
+
name: 'shopwareOAuth2Api',
|
|
57
|
+
required: true,
|
|
58
|
+
},
|
|
59
|
+
],
|
|
60
|
+
properties: [
|
|
61
|
+
{
|
|
62
|
+
displayName: 'Resource',
|
|
63
|
+
name: 'resource',
|
|
64
|
+
type: 'options',
|
|
65
|
+
noDataExpression: true,
|
|
66
|
+
required: true,
|
|
67
|
+
options: [
|
|
68
|
+
{
|
|
69
|
+
name: 'Product',
|
|
70
|
+
value: 'product',
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
name: 'Customer',
|
|
74
|
+
value: 'customer',
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
name: 'Order',
|
|
78
|
+
value: 'order',
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
name: 'Category',
|
|
82
|
+
value: 'category',
|
|
83
|
+
},
|
|
84
|
+
],
|
|
85
|
+
default: 'product',
|
|
86
|
+
},
|
|
87
|
+
...product.description,
|
|
88
|
+
...customer.description,
|
|
89
|
+
...order.description,
|
|
90
|
+
...category.description,
|
|
91
|
+
],
|
|
92
|
+
};
|
|
93
|
+
//# sourceMappingURL=versionDescription.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"versionDescription.js","sourceRoot":"","sources":["../../../../../nodes/Shopware/v1/actions/versionDescription.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGA,oEAAsD;AACtD,uEAAyD;AACzD,8DAAgD;AAChD,uEAAyD;AAE5C,QAAA,kBAAkB,GAAyB;IACvD,WAAW,EAAE,UAAU;IACvB,IAAI,EAAE,UAAU;IAEhB,IAAI,EAAE,4BAA4B;IAClC,KAAK,EAAE,CAAC,OAAO,CAAC;IAChB,OAAO,EAAE,CAAC,CAAC,CAAC;IACZ,QAAQ,EAAE,gEAAgE;IAC1E,WAAW,EAAE,mDAAmD;IAChE,QAAQ,EAAE;QACT,IAAI,EAAE,UAAU;KAChB;IACD,MAAM,EAAE,CAAC,MAAM,CAAC;IAChB,OAAO,EAAE,CAAC,MAAM,CAAC;IACjB,WAAW,EAAE;QACZ;YACC,IAAI,EAAE,mBAAmB;YACzB,QAAQ,EAAE,IAAI;SACd;KACD;IACD,UAAU,EAAE;QACX;YACC,WAAW,EAAE,UAAU;YACvB,IAAI,EAAE,UAAU;YAChB,IAAI,EAAE,SAAS;YACf,gBAAgB,EAAE,IAAI;YACtB,QAAQ,EAAE,IAAI;YACd,OAAO,EAAE;gBACR;oBACC,IAAI,EAAE,SAAS;oBACf,KAAK,EAAE,SAAS;iBAChB;gBACD;oBACC,IAAI,EAAE,UAAU;oBAChB,KAAK,EAAE,UAAU;iBACjB;gBACD;oBACC,IAAI,EAAE,OAAO;oBACb,KAAK,EAAE,OAAO;iBACd;gBACD;oBACC,IAAI,EAAE,UAAU;oBAChB,KAAK,EAAE,UAAU;iBACjB;aACD;YACD,OAAO,EAAE,SAAS;SAClB;QACD,GAAG,OAAO,CAAC,WAAW;QACtB,GAAG,QAAQ,CAAC,WAAW;QACvB,GAAG,KAAK,CAAC,WAAW;QACpB,GAAG,QAAQ,CAAC,WAAW;KACvB;CACD,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { GenericValue } from 'n8n-workflow';
|
|
2
|
+
import { PriceUi, SearchFilter } from '../actions/types';
|
|
3
|
+
export declare const orderFilterHandlers: {
|
|
4
|
+
[key: string]: (value: GenericValue) => SearchFilter;
|
|
5
|
+
};
|
|
6
|
+
export declare const customerFilterHandlers: {
|
|
7
|
+
[key: string]: (value: GenericValue) => SearchFilter;
|
|
8
|
+
};
|
|
9
|
+
export declare const productFilterHandlers: {
|
|
10
|
+
[key: string]: (value: GenericValue | PriceUi) => SearchFilter;
|
|
11
|
+
};
|
|
12
|
+
export declare const categoryFilterHandlers: {
|
|
13
|
+
[key: string]: (value: GenericValue | PriceUi) => SearchFilter;
|
|
14
|
+
};
|