rerobe-js-orm 4.8.0 → 4.8.2
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/lib/constants/product-constants.d.ts +11 -0
- package/lib/constants/product-constants.js +20 -1
- package/lib/factories/Merchant/MerchantFromFormState.js +6 -0
- package/lib/factories/Product/ProductFromFormState.js +1 -0
- package/lib/form-states/Merchant/MerchantFormState.js +10 -1
- package/lib/form-states/Product/ProductFormState.d.ts +3 -0
- package/lib/form-states/Product/ProductFormState.js +25 -13
- package/lib/form-states/Product/options.d.ts +4 -0
- package/lib/form-states/Product/options.js +8 -1
- package/lib/models/Merchant.d.ts +1 -0
- package/lib/models/Merchant.js +11 -1
- package/lib/models/Product.js +1 -0
- package/lib/types/merchant-types.d.ts +2 -0
- package/lib/types/rerobe-product-types.d.ts +2 -0
- package/package.json +1 -1
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
export function getDefaultTaxCategory(isConsignment: any, countryCode: any): any;
|
|
1
2
|
export namespace SELLER_DRIVEN_STATES {
|
|
2
3
|
let sellerDonated: string;
|
|
3
4
|
let sellRequestReview: string;
|
|
@@ -327,6 +328,16 @@ export namespace PAYOUT_SYSTEM {
|
|
|
327
328
|
export { RIBBN_CREDITS_1 as RIBBN_CREDITS };
|
|
328
329
|
}
|
|
329
330
|
export const ADMIN_STATES: {};
|
|
331
|
+
export namespace TAX_CATEGORIES {
|
|
332
|
+
let STANDARD: string;
|
|
333
|
+
let FOOD: string;
|
|
334
|
+
let CULTURE: string;
|
|
335
|
+
let EXEMPT: string;
|
|
336
|
+
}
|
|
337
|
+
export namespace CONSIGNMENT_TAX_DEFAULTS {
|
|
338
|
+
let SE: string;
|
|
339
|
+
let _default: string;
|
|
340
|
+
}
|
|
330
341
|
export namespace PRODUCT_CLASS_VALUES {
|
|
331
342
|
let UNIQUE: string;
|
|
332
343
|
let MULTIVARIANT: string;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.PRODUCT_CLASS_VALUES = exports.ADMIN_STATES = exports.PAYOUT_SYSTEM = exports.PAYOUT_METHOD = exports.PUBLISH_TYPE = exports.MEASUREMENT_FIELDS_DICT = exports.MEASUREMENT_CATEGORY = exports.PRODUCT_STATE_LABELS_ADMIN_VIEW = exports.PRODUCT_STATE_LABELS = exports.ADMIN_SIMPLIFIED_STATES = exports.PRODUCT_STATES = exports.SYSTEM_DRIVEN_STATES = exports.ADMIN_ACTION_DRIVEN_STATES = exports.ADMIN_DRIVEN_STATES = exports.SELLER_DRIVEN_STATES = void 0;
|
|
3
|
+
exports.PRODUCT_CLASS_VALUES = exports.CONSIGNMENT_TAX_DEFAULTS = exports.TAX_CATEGORIES = exports.ADMIN_STATES = exports.PAYOUT_SYSTEM = exports.PAYOUT_METHOD = exports.PUBLISH_TYPE = exports.MEASUREMENT_FIELDS_DICT = exports.MEASUREMENT_CATEGORY = exports.PRODUCT_STATE_LABELS_ADMIN_VIEW = exports.PRODUCT_STATE_LABELS = exports.ADMIN_SIMPLIFIED_STATES = exports.PRODUCT_STATES = exports.SYSTEM_DRIVEN_STATES = exports.ADMIN_ACTION_DRIVEN_STATES = exports.ADMIN_DRIVEN_STATES = exports.SELLER_DRIVEN_STATES = void 0;
|
|
4
|
+
exports.getDefaultTaxCategory = getDefaultTaxCategory;
|
|
4
5
|
exports.SELLER_DRIVEN_STATES = {
|
|
5
6
|
sellerDonated: 'SELLER_DONATED',
|
|
6
7
|
sellRequestReview: 'SELL_REQUEST_REVIEW',
|
|
@@ -234,6 +235,24 @@ exports.ADMIN_STATES = Object.entries(exports.PRODUCT_STATES)
|
|
|
234
235
|
acc[key] = value;
|
|
235
236
|
return acc;
|
|
236
237
|
}, {});
|
|
238
|
+
exports.TAX_CATEGORIES = {
|
|
239
|
+
STANDARD: 'STANDARD',
|
|
240
|
+
FOOD: 'FOOD',
|
|
241
|
+
CULTURE: 'CULTURE',
|
|
242
|
+
EXEMPT: 'EXEMPT',
|
|
243
|
+
};
|
|
244
|
+
exports.CONSIGNMENT_TAX_DEFAULTS = {
|
|
245
|
+
SE: 'EXEMPT',
|
|
246
|
+
_default: 'EXEMPT',
|
|
247
|
+
};
|
|
248
|
+
function getDefaultTaxCategory(isConsignment, countryCode) {
|
|
249
|
+
if (!isConsignment)
|
|
250
|
+
return exports.TAX_CATEGORIES.STANDARD;
|
|
251
|
+
const map = exports.CONSIGNMENT_TAX_DEFAULTS;
|
|
252
|
+
if (countryCode && map[countryCode] !== undefined)
|
|
253
|
+
return map[countryCode];
|
|
254
|
+
return map._default;
|
|
255
|
+
}
|
|
237
256
|
exports.PRODUCT_CLASS_VALUES = {
|
|
238
257
|
UNIQUE: 'UNIQUE',
|
|
239
258
|
MULTIVARIANT: 'MULTIVARIANT',
|
|
@@ -4,6 +4,7 @@ const MerchantFactory_1 = require("./MerchantFactory");
|
|
|
4
4
|
const Merchant_1 = require("../../models/Merchant");
|
|
5
5
|
class MerchantFromFormState extends MerchantFactory_1.default {
|
|
6
6
|
createMerchant(fs) {
|
|
7
|
+
var _a;
|
|
7
8
|
const MerchantMutableData = {
|
|
8
9
|
name: fs.fields.name.inputValue,
|
|
9
10
|
type: fs.fields.type.selectedValue,
|
|
@@ -23,6 +24,11 @@ class MerchantFromFormState extends MerchantFactory_1.default {
|
|
|
23
24
|
organizationNumber: fs.fields.organizationNumber.inputValue,
|
|
24
25
|
returnPolicy: fs.fields.returnPolicy.inputValue,
|
|
25
26
|
};
|
|
27
|
+
// Include organizationNumbers if it has entries
|
|
28
|
+
const orgNumbers = (_a = fs.fields.organizationNumbers) === null || _a === void 0 ? void 0 : _a.selectedValue;
|
|
29
|
+
if (orgNumbers && Object.keys(orgNumbers).length > 0) {
|
|
30
|
+
MerchantMutableData.organizationNumbers = orgNumbers;
|
|
31
|
+
}
|
|
26
32
|
return new Merchant_1.default(Object.assign(Object.assign({}, fs.props), MerchantMutableData));
|
|
27
33
|
}
|
|
28
34
|
}
|
|
@@ -17,6 +17,7 @@ class ProductFromFormState extends ProductFactory_1.default {
|
|
|
17
17
|
imageUrlsForAI: ((_e = props.props) === null || _e === void 0 ? void 0 : _e.imageUrlsForAI) || [],
|
|
18
18
|
price: props.fields.price.inputValue,
|
|
19
19
|
isTaxable: props.fields.isTaxable.selectedValue,
|
|
20
|
+
taxCategory: props.fields.taxCategory.selectedValue,
|
|
20
21
|
productClass: props.fields.productClass.selectedValue,
|
|
21
22
|
createdAt: ((_f = props.props) === null || _f === void 0 ? void 0 : _f.createdAt) || new Date().toUTCString(), // ToDo look into different timestamp
|
|
22
23
|
updatedAt: ((_g = props.props) === null || _g === void 0 ? void 0 : _g.updatedAt) || new Date().toUTCString(), // ToDo look into different timestamp
|
|
@@ -15,6 +15,7 @@ class MerchantFormState extends FormState_1.default {
|
|
|
15
15
|
this.fields.industry = this.fieldFactory('singleSelect', 'industry', options_1.industryOptions);
|
|
16
16
|
this.fields.legalName = this.fieldFactory('textInput', 'legalName');
|
|
17
17
|
this.fields.organizationNumber = this.fieldFactory('textInput', 'organizationNumber');
|
|
18
|
+
this.fields.organizationNumbers = this.fieldFactory('singleSelect', 'organizationNumbers');
|
|
18
19
|
this.fields.returnPolicy = this.fieldFactory('textInput', 'returnPolicy');
|
|
19
20
|
this.fields.phone = this.fieldFactory('textInput', 'phone');
|
|
20
21
|
this.fields.address = this.fieldFactory('singleSelect', 'address');
|
|
@@ -32,7 +33,11 @@ class MerchantFormState extends FormState_1.default {
|
|
|
32
33
|
}
|
|
33
34
|
fieldFactory(fieldType, fieldKey, fieldOptions) {
|
|
34
35
|
const options = fieldOptions || [];
|
|
35
|
-
if (fieldType === 'textInput' &&
|
|
36
|
+
if (fieldType === 'textInput' &&
|
|
37
|
+
fieldKey !== 'address' &&
|
|
38
|
+
fieldKey !== 'webhooks' &&
|
|
39
|
+
fieldKey !== 'socialLinks' &&
|
|
40
|
+
fieldKey !== 'organizationNumbers') {
|
|
36
41
|
const inputValue = this.props[fieldKey] || '';
|
|
37
42
|
const valid = !!this.props[fieldKey];
|
|
38
43
|
let onChangeHandler = (val) => this.textInputChangeHandler(fieldKey, String(val));
|
|
@@ -102,6 +107,10 @@ class MerchantFormState extends FormState_1.default {
|
|
|
102
107
|
!!Object.keys(this.props.socialLinks).length &&
|
|
103
108
|
!!Object.values(this.props.socialLinks).filter((item) => !!item).length;
|
|
104
109
|
}
|
|
110
|
+
else if (fieldKey === 'organizationNumbers') {
|
|
111
|
+
selectedValue = this.props.organizationNumbers || {};
|
|
112
|
+
valid = true; // organizationNumbers is optional
|
|
113
|
+
}
|
|
105
114
|
else if (fieldKey === 'unitSystem') {
|
|
106
115
|
onChangeHandler = (val) => this.unitSystemSelectHandler(val);
|
|
107
116
|
selectedValue = this.props[fieldKey] || '';
|
|
@@ -31,7 +31,10 @@ export default class ProductFormState extends FormState {
|
|
|
31
31
|
majorDefects: string[];
|
|
32
32
|
minorDefects: string[];
|
|
33
33
|
primaryAgeCategories: string[];
|
|
34
|
+
countryCode?: string;
|
|
35
|
+
isConsignment?: boolean;
|
|
34
36
|
};
|
|
37
|
+
private _rawProps?;
|
|
35
38
|
constructor(props?: any, opts?: any);
|
|
36
39
|
autoCreateTitle(): string;
|
|
37
40
|
autoCreateDescription(): string;
|
|
@@ -15,9 +15,11 @@ const FormState_1 = require("../FormState");
|
|
|
15
15
|
const options_1 = require("./options");
|
|
16
16
|
const Product_1 = require("../../models/Product");
|
|
17
17
|
const ProductFromFormState_1 = require("../../factories/Product/ProductFromFormState");
|
|
18
|
+
const product_constants_1 = require("../../constants/product-constants");
|
|
18
19
|
class ProductFormState extends FormState_1.default {
|
|
19
20
|
constructor(props, opts) {
|
|
20
21
|
super();
|
|
22
|
+
this._rawProps = props;
|
|
21
23
|
this.props = new Product_1.default(props).toObj();
|
|
22
24
|
this.opts = opts;
|
|
23
25
|
// ProductAttributesFormFields
|
|
@@ -26,6 +28,7 @@ class ProductFormState extends FormState_1.default {
|
|
|
26
28
|
this.fields.title = this.fieldFactory('textInput', 'title');
|
|
27
29
|
this.fields.price = this.fieldFactory('textInput', 'price');
|
|
28
30
|
this.fields.isTaxable = this.fieldFactory('singleSelect', 'isTaxable', options_1.productYesNoOptions);
|
|
31
|
+
this.fields.taxCategory = this.fieldFactory('singleSelect', 'taxCategory', options_1.taxCategoryOptions);
|
|
29
32
|
this.fields.weight = this.fieldFactory('textInput', 'weight');
|
|
30
33
|
this.fields.weightRange = this.fieldFactory('singleSelect', 'weightRange', options_1.productWeightRanges);
|
|
31
34
|
this.fields.weightUnit = this.fieldFactory('singleSelect', 'weightUnit', options_1.weightUnits);
|
|
@@ -1042,7 +1045,7 @@ class ProductFormState extends FormState_1.default {
|
|
|
1042
1045
|
this.fields.inventoryLocations.valid = aggregated.length > 0;
|
|
1043
1046
|
}
|
|
1044
1047
|
fieldFactory(fieldType, fieldKey, fieldOptions) {
|
|
1045
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x;
|
|
1048
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0;
|
|
1046
1049
|
let options = fieldOptions || [];
|
|
1047
1050
|
let hidden = false;
|
|
1048
1051
|
if (fieldType === 'singleSelect') {
|
|
@@ -1060,7 +1063,16 @@ class ProductFormState extends FormState_1.default {
|
|
|
1060
1063
|
onChangeHandler = (val) => this.singleSelectChangeHandler(fieldKey, val);
|
|
1061
1064
|
}
|
|
1062
1065
|
if (fieldKey === 'isTaxable') {
|
|
1063
|
-
|
|
1066
|
+
const hasExplicitValue = this._rawProps && this._rawProps.isTaxable;
|
|
1067
|
+
selectedValue = hasExplicitValue ? this.props[fieldKey] || '' : ((_a = this.opts) === null || _a === void 0 ? void 0 : _a.isConsignment) ? 'no' : '';
|
|
1068
|
+
valid = true;
|
|
1069
|
+
onChangeHandler = (val) => this.singleSelectChangeHandler(fieldKey, val);
|
|
1070
|
+
}
|
|
1071
|
+
if (fieldKey === 'taxCategory') {
|
|
1072
|
+
const hasExplicitValue = this._rawProps && this._rawProps.taxCategory;
|
|
1073
|
+
selectedValue = hasExplicitValue
|
|
1074
|
+
? this.props[fieldKey] || 'STANDARD'
|
|
1075
|
+
: (0, product_constants_1.getDefaultTaxCategory)(!!((_b = this.opts) === null || _b === void 0 ? void 0 : _b.isConsignment), (_c = this.opts) === null || _c === void 0 ? void 0 : _c.countryCode);
|
|
1064
1076
|
valid = true;
|
|
1065
1077
|
onChangeHandler = (val) => this.singleSelectChangeHandler(fieldKey, val);
|
|
1066
1078
|
}
|
|
@@ -1090,7 +1102,7 @@ class ProductFormState extends FormState_1.default {
|
|
|
1090
1102
|
});
|
|
1091
1103
|
}
|
|
1092
1104
|
}
|
|
1093
|
-
if ((
|
|
1105
|
+
if ((_e = (_d = this.opts) === null || _d === void 0 ? void 0 : _d.materials) === null || _e === void 0 ? void 0 : _e.length) {
|
|
1094
1106
|
const materialsOptions = this.opts.materials.map((t) => ({
|
|
1095
1107
|
label: t,
|
|
1096
1108
|
value: t,
|
|
@@ -1151,7 +1163,7 @@ class ProductFormState extends FormState_1.default {
|
|
|
1151
1163
|
options.splice(0, 0, ...selectedSizeOptions);
|
|
1152
1164
|
}
|
|
1153
1165
|
}
|
|
1154
|
-
if ((
|
|
1166
|
+
if ((_g = (_f = this.opts) === null || _f === void 0 ? void 0 : _f.sizes) === null || _g === void 0 ? void 0 : _g.length) {
|
|
1155
1167
|
const sizesOptions = this.opts.sizes.map((t) => ({ label: t, value: t }));
|
|
1156
1168
|
options = this.utilities.uniqObjArray([...selectedSizeOptions, ...sizesOptions], 'value');
|
|
1157
1169
|
}
|
|
@@ -1165,7 +1177,7 @@ class ProductFormState extends FormState_1.default {
|
|
|
1165
1177
|
options.splice(0, 0, ...selectedJeanSizeOptions);
|
|
1166
1178
|
}
|
|
1167
1179
|
}
|
|
1168
|
-
if ((
|
|
1180
|
+
if ((_j = (_h = this.opts) === null || _h === void 0 ? void 0 : _h.jeanSizes) === null || _j === void 0 ? void 0 : _j.length) {
|
|
1169
1181
|
const jeanSizesOptions = this.opts.jeanSizes.map((t) => ({ label: t, value: t }));
|
|
1170
1182
|
options = this.utilities.uniqObjArray([...selectedJeanSizeOptions, ...jeanSizesOptions], 'value');
|
|
1171
1183
|
}
|
|
@@ -1179,7 +1191,7 @@ class ProductFormState extends FormState_1.default {
|
|
|
1179
1191
|
options.splice(0, 0, ...selectedShoeSizeOptions);
|
|
1180
1192
|
}
|
|
1181
1193
|
}
|
|
1182
|
-
if ((
|
|
1194
|
+
if ((_l = (_k = this.opts) === null || _k === void 0 ? void 0 : _k.shoeSizes) === null || _l === void 0 ? void 0 : _l.length) {
|
|
1183
1195
|
const shoeSizesOptions = this.opts.shoeSizes.map((t) => ({ label: t, value: t }));
|
|
1184
1196
|
options = this.utilities.uniqObjArray([...selectedShoeSizeOptions, ...shoeSizesOptions], 'value');
|
|
1185
1197
|
}
|
|
@@ -1192,7 +1204,7 @@ class ProductFormState extends FormState_1.default {
|
|
|
1192
1204
|
options.splice(0, 0, ...selectedBrandOptions);
|
|
1193
1205
|
}
|
|
1194
1206
|
}
|
|
1195
|
-
if ((
|
|
1207
|
+
if ((_o = (_m = this.opts) === null || _m === void 0 ? void 0 : _m.brands) === null || _o === void 0 ? void 0 : _o.length) {
|
|
1196
1208
|
const brandsOptions = this.opts.brands.map((t) => ({ label: t, value: t }));
|
|
1197
1209
|
options = this.utilities.uniqObjArray([...selectedBrandOptions, ...brandsOptions], 'value');
|
|
1198
1210
|
}
|
|
@@ -1205,7 +1217,7 @@ class ProductFormState extends FormState_1.default {
|
|
|
1205
1217
|
options.splice(0, 0, ...selectedColorOptions);
|
|
1206
1218
|
}
|
|
1207
1219
|
}
|
|
1208
|
-
if ((
|
|
1220
|
+
if ((_q = (_p = this.opts) === null || _p === void 0 ? void 0 : _p.colors) === null || _q === void 0 ? void 0 : _q.length) {
|
|
1209
1221
|
const colorsOptions = this.opts.colors.map((t) => ({ label: t, value: t }));
|
|
1210
1222
|
options = this.utilities.uniqObjArray([...selectedColorOptions, ...colorsOptions], 'value');
|
|
1211
1223
|
}
|
|
@@ -1230,7 +1242,7 @@ class ProductFormState extends FormState_1.default {
|
|
|
1230
1242
|
options.splice(0, 0, ...selectedPrimaryAgeCategoryOptions);
|
|
1231
1243
|
}
|
|
1232
1244
|
}
|
|
1233
|
-
if ((
|
|
1245
|
+
if ((_s = (_r = this.opts) === null || _r === void 0 ? void 0 : _r.primaryAgeCategories) === null || _s === void 0 ? void 0 : _s.length) {
|
|
1234
1246
|
const suppliedPrimaryAgeCategoryOptions = this.opts.primaryAgeCategories.map((t) => ({ label: t, value: t }));
|
|
1235
1247
|
options = this.utilities.uniqObjArray([...selectedPrimaryAgeCategoryOptions, ...suppliedPrimaryAgeCategoryOptions], 'value');
|
|
1236
1248
|
}
|
|
@@ -1243,7 +1255,7 @@ class ProductFormState extends FormState_1.default {
|
|
|
1243
1255
|
options.splice(0, 0, ...selectedOptions);
|
|
1244
1256
|
}
|
|
1245
1257
|
}
|
|
1246
|
-
if ((
|
|
1258
|
+
if ((_u = (_t = this.opts) === null || _t === void 0 ? void 0 : _t.conditions) === null || _u === void 0 ? void 0 : _u.length) {
|
|
1247
1259
|
const conditionsOptions = this.opts.conditions.map((t) => ({
|
|
1248
1260
|
label: t.label || '',
|
|
1249
1261
|
value: t.value || '',
|
|
@@ -1298,7 +1310,7 @@ class ProductFormState extends FormState_1.default {
|
|
|
1298
1310
|
if (this.props.gender === 'Man') {
|
|
1299
1311
|
options = options_1.manClothingSizeOptions;
|
|
1300
1312
|
}
|
|
1301
|
-
if ((
|
|
1313
|
+
if ((_w = (_v = this.opts) === null || _v === void 0 ? void 0 : _v.clothingSizes) === null || _w === void 0 ? void 0 : _w.length) {
|
|
1302
1314
|
const clothingSizesOptions = this.opts.clothingSizes.map((t) => ({ label: t, value: t }));
|
|
1303
1315
|
options = this.utilities.uniqObjArray(clothingSizesOptions, 'value');
|
|
1304
1316
|
}
|
|
@@ -1311,7 +1323,7 @@ class ProductFormState extends FormState_1.default {
|
|
|
1311
1323
|
selectedMajorDefectsOptions = this.props.majorDefects.map((t) => ({ label: t, value: t }));
|
|
1312
1324
|
}
|
|
1313
1325
|
let majorDefectsOptions = [];
|
|
1314
|
-
if ((
|
|
1326
|
+
if ((_y = (_x = this.opts) === null || _x === void 0 ? void 0 : _x.majorDefects) === null || _y === void 0 ? void 0 : _y.length) {
|
|
1315
1327
|
majorDefectsOptions = this.opts.majorDefects.map((t) => ({ label: t, value: t }));
|
|
1316
1328
|
}
|
|
1317
1329
|
options = this.utilities.uniqObjArray([...selectedMajorDefectsOptions, ...majorDefectsOptions], 'value');
|
|
@@ -1323,7 +1335,7 @@ class ProductFormState extends FormState_1.default {
|
|
|
1323
1335
|
selectedMinorDefectsOptions = this.props.minorDefects.map((t) => ({ label: t, value: t }));
|
|
1324
1336
|
}
|
|
1325
1337
|
let minorDefectsOptions = [];
|
|
1326
|
-
if ((
|
|
1338
|
+
if ((_0 = (_z = this.opts) === null || _z === void 0 ? void 0 : _z.minorDefects) === null || _0 === void 0 ? void 0 : _0.length) {
|
|
1327
1339
|
minorDefectsOptions = this.opts.minorDefects.map((t) => ({ label: t, value: t }));
|
|
1328
1340
|
}
|
|
1329
1341
|
options = this.utilities.uniqObjArray([...selectedMinorDefectsOptions, ...minorDefectsOptions], 'value');
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.primaryAgeCategoryOptions = exports.adminStatusOptionsSimplified = exports.adminStatusOptions = exports.measurementCategoryOptions = exports.minorDefectOptions = exports.majorDefectOptions = exports.productOptions = exports.productClassOptions = exports.productYesNoOptions = exports.discountTypeOptions = exports.salesChannelOptions = exports.unisexJewelry = exports.mensJewelry = exports.jewelry = exports.unisexAccessories = exports.mensAccessories = exports.accessories = exports.unisexBags = exports.mensBags = exports.bags = exports.weightUnits = exports.productWeightRanges = exports.unisexShoes = exports.mensShoes = exports.shoes = exports.unisexClothing = exports.mensClothing = exports.clothing = exports.productCategories = exports.clothingMaterials = exports.shoeSizes = exports.jeanSizes = exports.genderOptions = exports.conditions = exports.colors = exports.brands = exports.sizeCommentOptions = exports.manClothingSizeOptions = exports.womanClothingSizeOptions = exports.clothingSizeOptions = exports.sizeOptions = exports.statusOptions = exports.publishTypeOptions = exports.availableForSaleOptions = void 0;
|
|
3
|
+
exports.primaryAgeCategoryOptions = exports.adminStatusOptionsSimplified = exports.adminStatusOptions = exports.measurementCategoryOptions = exports.minorDefectOptions = exports.majorDefectOptions = exports.productOptions = exports.productClassOptions = exports.taxCategoryOptions = exports.productYesNoOptions = exports.discountTypeOptions = exports.salesChannelOptions = exports.unisexJewelry = exports.mensJewelry = exports.jewelry = exports.unisexAccessories = exports.mensAccessories = exports.accessories = exports.unisexBags = exports.mensBags = exports.bags = exports.weightUnits = exports.productWeightRanges = exports.unisexShoes = exports.mensShoes = exports.shoes = exports.unisexClothing = exports.mensClothing = exports.clothing = exports.productCategories = exports.clothingMaterials = exports.shoeSizes = exports.jeanSizes = exports.genderOptions = exports.conditions = exports.colors = exports.brands = exports.sizeCommentOptions = exports.manClothingSizeOptions = exports.womanClothingSizeOptions = exports.clothingSizeOptions = exports.sizeOptions = exports.statusOptions = exports.publishTypeOptions = exports.availableForSaleOptions = void 0;
|
|
4
4
|
const product_constants_1 = require("../../constants/product-constants");
|
|
5
5
|
const lodash_1 = require("lodash");
|
|
6
6
|
const availableForSaleOptions = [
|
|
@@ -1058,6 +1058,13 @@ const productYesNoOptions = [
|
|
|
1058
1058
|
},
|
|
1059
1059
|
];
|
|
1060
1060
|
exports.productYesNoOptions = productYesNoOptions;
|
|
1061
|
+
const taxCategoryOptions = [
|
|
1062
|
+
{ label: 'Standard', value: 'STANDARD' },
|
|
1063
|
+
{ label: 'Food & Beverages', value: 'FOOD' },
|
|
1064
|
+
{ label: 'Books & Culture', value: 'CULTURE' },
|
|
1065
|
+
{ label: 'Exempt', value: 'EXEMPT' },
|
|
1066
|
+
];
|
|
1067
|
+
exports.taxCategoryOptions = taxCategoryOptions;
|
|
1061
1068
|
const productClassOptions = [
|
|
1062
1069
|
{
|
|
1063
1070
|
label: 'Unique',
|
package/lib/models/Merchant.d.ts
CHANGED
|
@@ -84,6 +84,7 @@ export default class Merchant extends Base {
|
|
|
84
84
|
isZettleUser?: boolean;
|
|
85
85
|
hasStripeBluetoothReader?: boolean;
|
|
86
86
|
organizationNumber?: string;
|
|
87
|
+
organizationNumbers?: Record<string, string>;
|
|
87
88
|
returnPolicy?: string;
|
|
88
89
|
stripeRegion?: string;
|
|
89
90
|
hasAutomatedPayouts?: boolean;
|
package/lib/models/Merchant.js
CHANGED
|
@@ -49,6 +49,9 @@ class Merchant extends Base_1.default {
|
|
|
49
49
|
tiktok: '',
|
|
50
50
|
};
|
|
51
51
|
this.organizationNumber = (props === null || props === void 0 ? void 0 : props.organizationNumber) || '';
|
|
52
|
+
if ((props === null || props === void 0 ? void 0 : props.organizationNumbers) && typeof props.organizationNumbers === 'object') {
|
|
53
|
+
this.organizationNumbers = props.organizationNumbers;
|
|
54
|
+
}
|
|
52
55
|
this.returnPolicy = (props === null || props === void 0 ? void 0 : props.returnPolicy) || '';
|
|
53
56
|
this.subscriptionStatus = (props === null || props === void 0 ? void 0 : props.subscriptionStatus) || merchant_constants_1.SUBSCRIPTION_STATUSES.trialing;
|
|
54
57
|
this.hasActiveWebshop = (props === null || props === void 0 ? void 0 : props.hasActiveWebshop) || false;
|
|
@@ -135,10 +138,13 @@ class Merchant extends Base_1.default {
|
|
|
135
138
|
if (this.hasReceiptPrinter) {
|
|
136
139
|
mObj.hasReceiptPrinter = this.hasReceiptPrinter;
|
|
137
140
|
}
|
|
141
|
+
if (this.organizationNumbers && Object.keys(this.organizationNumbers).length > 0) {
|
|
142
|
+
mObj.organizationNumbers = this.organizationNumbers;
|
|
143
|
+
}
|
|
138
144
|
return mObj;
|
|
139
145
|
}
|
|
140
146
|
toMerchantMutableData() {
|
|
141
|
-
|
|
147
|
+
const data = {
|
|
142
148
|
name: this.name,
|
|
143
149
|
type: this.type,
|
|
144
150
|
contactEmail: this.contactEmail,
|
|
@@ -156,6 +162,10 @@ class Merchant extends Base_1.default {
|
|
|
156
162
|
webhooks: this.webhooks,
|
|
157
163
|
socialLinks: this.socialLinks,
|
|
158
164
|
};
|
|
165
|
+
if (this.organizationNumbers && Object.keys(this.organizationNumbers).length > 0) {
|
|
166
|
+
data.organizationNumbers = this.organizationNumbers;
|
|
167
|
+
}
|
|
168
|
+
return data;
|
|
159
169
|
}
|
|
160
170
|
}
|
|
161
171
|
Merchant.MERCHANT_TYPES = merchant_constants_1.MERCHANT_TYPES;
|
package/lib/models/Product.js
CHANGED
|
@@ -42,6 +42,7 @@ class Product extends Base_1.default {
|
|
|
42
42
|
metaDataTitle: (props === null || props === void 0 ? void 0 : props.metaDataTitle) || '',
|
|
43
43
|
metaDataDescription: (props === null || props === void 0 ? void 0 : props.metaDataDescription) || '',
|
|
44
44
|
isTaxable: (props === null || props === void 0 ? void 0 : props.isTaxable) || '',
|
|
45
|
+
taxCategory: (props === null || props === void 0 ? void 0 : props.taxCategory) || 'STANDARD',
|
|
45
46
|
productClass: (props === null || props === void 0 ? void 0 : props.productClass) || 'UNIQUE',
|
|
46
47
|
};
|
|
47
48
|
this.filterAttributes = {
|
|
@@ -23,6 +23,7 @@ type MerchantMutableData = {
|
|
|
23
23
|
webhooks: MerchantWebHook[];
|
|
24
24
|
socialLinks: SocialLinksType | null;
|
|
25
25
|
organizationNumber?: string;
|
|
26
|
+
organizationNumbers?: Record<string, string>;
|
|
26
27
|
returnPolicy?: string;
|
|
27
28
|
};
|
|
28
29
|
type MerchantSystemOnlyMutableData = {
|
|
@@ -85,6 +86,7 @@ type MerchantFormFields = {
|
|
|
85
86
|
industry: SingleSelectFormField<string>;
|
|
86
87
|
legalName: TextInputFormField<string>;
|
|
87
88
|
organizationNumber: TextInputFormField<string>;
|
|
89
|
+
organizationNumbers: SingleSelectFormField<Record<string, string>>;
|
|
88
90
|
returnPolicy: TextInputFormField<string>;
|
|
89
91
|
phone: TextInputFormField<string>;
|
|
90
92
|
address: SingleSelectFormField<AddressInput>;
|
|
@@ -31,6 +31,7 @@ type ProductAttributes = {
|
|
|
31
31
|
metaDataTitle?: string;
|
|
32
32
|
metaDataDescription?: string;
|
|
33
33
|
isTaxable?: string;
|
|
34
|
+
taxCategory?: string;
|
|
34
35
|
productClass?: 'UNIQUE' | 'MULTIVARIANT' | 'TEMPLATE' | 'SUPPLY' | 'DIGITAL' | string;
|
|
35
36
|
variantInventory?: VariantInventory[];
|
|
36
37
|
};
|
|
@@ -206,6 +207,7 @@ type ProductAttributesFormFields = {
|
|
|
206
207
|
metaDataDescription: TextInputFormField<string>;
|
|
207
208
|
handle: TextInputFormField<string>;
|
|
208
209
|
isTaxable: SingleSelectFormField<string>;
|
|
210
|
+
taxCategory: SingleSelectFormField<string>;
|
|
209
211
|
productClass: SingleSelectFormField<string>;
|
|
210
212
|
variantInventory: MultiSelectFormField<VariantInventory>;
|
|
211
213
|
};
|