@things-factory/integration-sellercraft 4.2.7 → 4.2.8
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-server/constants/order-status-mapping.js +5 -1
- package/dist-server/constants/order-status-mapping.js.map +1 -1
- package/dist-server/controllers/sellercraft-channel-integration/apis/ingest-channel-order-package.js +5 -2
- package/dist-server/controllers/sellercraft-channel-integration/apis/ingest-channel-order-package.js.map +1 -1
- package/dist-server/controllers/sellercraft-channel-integration/apis/ingest-channel-order.js +1 -1
- package/dist-server/controllers/sellercraft-channel-integration/apis/ingest-channel-order.js.map +1 -1
- package/dist-server/routers/sellercraft-router.js +24 -16
- package/dist-server/routers/sellercraft-router.js.map +1 -1
- package/dist-server/service/marketplace-channel/marketplace-channel-order-mutation.js +272 -236
- package/dist-server/service/marketplace-channel/marketplace-channel-order-mutation.js.map +1 -1
- package/package.json +3 -3
- package/server/constants/order-status-mapping.ts +5 -0
- package/server/controllers/sellercraft-channel-integration/apis/ingest-channel-order-package.ts +6 -2
- package/server/controllers/sellercraft-channel-integration/apis/ingest-channel-order.ts +1 -1
- package/server/routers/sellercraft-router.ts +21 -16
- package/server/service/marketplace-channel/marketplace-channel-order-mutation.ts +324 -285
@@ -1,6 +1,6 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.ORDER_STATUS = void 0;
|
3
|
+
exports.SHIPPING_TYPE = exports.ORDER_STATUS = void 0;
|
4
4
|
exports.ORDER_STATUS = {
|
5
5
|
pending: 'CONFIRMED',
|
6
6
|
processing: 'CONFIRMED',
|
@@ -21,4 +21,8 @@ exports.ORDER_STATUS = {
|
|
21
21
|
ttk_202: '',
|
22
22
|
ttk_203: 'CANCELLED' // CANCEL_COMPLETED
|
23
23
|
};
|
24
|
+
exports.SHIPPING_TYPE = {
|
25
|
+
DROP_SHIPPING: 'DROP_SHIPPING',
|
26
|
+
CROSS_DOCKING_PICKUP: 'CROSS_DOCKING_PICKUP'
|
27
|
+
};
|
24
28
|
//# sourceMappingURL=order-status-mapping.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"order-status-mapping.js","sourceRoot":"","sources":["../../server/constants/order-status-mapping.ts"],"names":[],"mappings":";;;AAAa,QAAA,YAAY,GAAG;IAC1B,OAAO,EAAE,WAAW;IACpB,UAAU,EAAE,WAAW;IACvB,SAAS,EAAE,WAAW;IACtB,SAAS,EAAE,WAAW;IACtB,QAAQ,EAAE,WAAW;IACrB,QAAQ,EAAE,iBAAiB;IAC3B,MAAM,EAAE,0BAA0B;IAClC,MAAM,EAAE,iBAAiB;IACzB,OAAO,EAAE,iBAAiB;IAC1B,OAAO,EAAE,WAAW;IACpB,OAAO,EAAE,eAAe;IACxB,OAAO,EAAE,SAAS;IAClB,OAAO,EAAE,WAAW;IACpB,OAAO,EAAE,QAAQ;IACjB,OAAO,EAAE,WAAW;IACpB,OAAO,EAAE,wBAAwB;IACjC,OAAO,EAAE,EAAE;IACX,OAAO,EAAE,WAAW,CAAC,mBAAmB;CACzC,CAAA"}
|
1
|
+
{"version":3,"file":"order-status-mapping.js","sourceRoot":"","sources":["../../server/constants/order-status-mapping.ts"],"names":[],"mappings":";;;AAAa,QAAA,YAAY,GAAG;IAC1B,OAAO,EAAE,WAAW;IACpB,UAAU,EAAE,WAAW;IACvB,SAAS,EAAE,WAAW;IACtB,SAAS,EAAE,WAAW;IACtB,QAAQ,EAAE,WAAW;IACrB,QAAQ,EAAE,iBAAiB;IAC3B,MAAM,EAAE,0BAA0B;IAClC,MAAM,EAAE,iBAAiB;IACzB,OAAO,EAAE,iBAAiB;IAC1B,OAAO,EAAE,WAAW;IACpB,OAAO,EAAE,eAAe;IACxB,OAAO,EAAE,SAAS;IAClB,OAAO,EAAE,WAAW;IACpB,OAAO,EAAE,QAAQ;IACjB,OAAO,EAAE,WAAW;IACpB,OAAO,EAAE,wBAAwB;IACjC,OAAO,EAAE,EAAE;IACX,OAAO,EAAE,WAAW,CAAC,mBAAmB;CACzC,CAAA;AAEY,QAAA,aAAa,GAAG;IAC3B,aAAa,EAAE,eAAe;IAC9B,oBAAoB,EAAE,sBAAsB;CAC7C,CAAA"}
|
package/dist-server/controllers/sellercraft-channel-integration/apis/ingest-channel-order-package.js
CHANGED
@@ -24,10 +24,10 @@ function ingestChannelOrderPackage() {
|
|
24
24
|
is_cod_supported: shipper_last_mile.isCodSupported,
|
25
25
|
name: shipper_last_mile.name
|
26
26
|
};
|
27
|
-
|
27
|
+
let newOrderPackage = {
|
28
28
|
channel_shop_id,
|
29
29
|
native_order_id,
|
30
|
-
native_package_id,
|
30
|
+
native_package_id: native_package_id.toString(),
|
31
31
|
shipping_tracking_code,
|
32
32
|
shipping_type_value,
|
33
33
|
warehouse_code,
|
@@ -36,6 +36,9 @@ function ingestChannelOrderPackage() {
|
|
36
36
|
shipper_last_mile,
|
37
37
|
order_item_ids
|
38
38
|
};
|
39
|
+
return {
|
40
|
+
payload: Object.assign({}, newOrderPackage)
|
41
|
+
};
|
39
42
|
},
|
40
43
|
normalize(res) {
|
41
44
|
return res;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"ingest-channel-order-package.js","sourceRoot":"","sources":["../../../../server/controllers/sellercraft-channel-integration/apis/ingest-channel-order-package.ts"],"names":[],"mappings":";AAAA,oGAAoG;;;AAEpG,SAAgB,yBAAyB;IACvC,OAAO;QACL,MAAM,EAAE,MAAM;QACd,IAAI,EAAE,+BAA+B;QACrC,WAAW,CAAC,GAAG;YACb,IAAI,EACF,aAAa,EAAE,eAAe,EAC9B,aAAa,EAAE,eAAe,EAC9B,eAAe,EAAE,iBAAiB,EAClC,oBAAoB,EAAE,sBAAsB,EAC5C,iBAAiB,EAAE,mBAAmB,EACtC,aAAa,EAAE,cAAc,EAC7B,OAAO,EACP,SAAS,EACT,eAAe,EAAE,iBAAiB,EAClC,YAAY,EAAE,cAAc,EAC7B,GAAG,GAAG,CAAA;YAEP,SAAS,GAAG,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE;gBAC5B,MAAM,EAAE,aAAa,EAAE,eAAe,EAAE,QAAQ,EAAE,SAAS,EAAE,IAAI,EAAE,GAAG,CAAC,CAAA;gBAEvE,OAAO;oBACL,eAAe;oBACf,SAAS;oBACT,IAAI;iBACL,CAAA;YACH,CAAC,CAAC,CAAA;YAEF,OAAO,GAAG;gBACR,gBAAgB,EAAE,OAAO,CAAC,cAAc;gBACxC,IAAI,EAAE,OAAO,CAAC,IAAI;aACnB,CAAA;YAED,iBAAiB,GAAG;gBAClB,gBAAgB,EAAE,iBAAiB,CAAC,cAAc;gBAClD,IAAI,EAAE,iBAAiB,CAAC,IAAI;aAC7B,CAAA;YAED,
|
1
|
+
{"version":3,"file":"ingest-channel-order-package.js","sourceRoot":"","sources":["../../../../server/controllers/sellercraft-channel-integration/apis/ingest-channel-order-package.ts"],"names":[],"mappings":";AAAA,oGAAoG;;;AAEpG,SAAgB,yBAAyB;IACvC,OAAO;QACL,MAAM,EAAE,MAAM;QACd,IAAI,EAAE,+BAA+B;QACrC,WAAW,CAAC,GAAG;YACb,IAAI,EACF,aAAa,EAAE,eAAe,EAC9B,aAAa,EAAE,eAAe,EAC9B,eAAe,EAAE,iBAAiB,EAClC,oBAAoB,EAAE,sBAAsB,EAC5C,iBAAiB,EAAE,mBAAmB,EACtC,aAAa,EAAE,cAAc,EAC7B,OAAO,EACP,SAAS,EACT,eAAe,EAAE,iBAAiB,EAClC,YAAY,EAAE,cAAc,EAC7B,GAAG,GAAG,CAAA;YAEP,SAAS,GAAG,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE;gBAC5B,MAAM,EAAE,aAAa,EAAE,eAAe,EAAE,QAAQ,EAAE,SAAS,EAAE,IAAI,EAAE,GAAG,CAAC,CAAA;gBAEvE,OAAO;oBACL,eAAe;oBACf,SAAS;oBACT,IAAI;iBACL,CAAA;YACH,CAAC,CAAC,CAAA;YAEF,OAAO,GAAG;gBACR,gBAAgB,EAAE,OAAO,CAAC,cAAc;gBACxC,IAAI,EAAE,OAAO,CAAC,IAAI;aACnB,CAAA;YAED,iBAAiB,GAAG;gBAClB,gBAAgB,EAAE,iBAAiB,CAAC,cAAc;gBAClD,IAAI,EAAE,iBAAiB,CAAC,IAAI;aAC7B,CAAA;YAED,IAAI,eAAe,GAAQ;gBACzB,eAAe;gBACf,eAAe;gBACf,iBAAiB,EAAE,iBAAiB,CAAC,QAAQ,EAAE;gBAC/C,sBAAsB;gBACtB,mBAAmB;gBACnB,cAAc;gBACd,OAAO;gBACP,SAAS;gBACT,iBAAiB;gBACjB,cAAc;aACf,CAAA;YAED,OAAO;gBACL,OAAO,oBAAO,eAAe,CAAE;aAChC,CAAA;QACH,CAAC;QACD,SAAS,CAAC,GAAG;YACX,OAAO,GAAG,CAAA;QACZ,CAAC;KACF,CAAA;AACH,CAAC;AA3DD,8DA2DC"}
|
package/dist-server/controllers/sellercraft-channel-integration/apis/ingest-channel-order.js
CHANGED
@@ -13,7 +13,7 @@ function ingestChannelOrder() {
|
|
13
13
|
return {
|
14
14
|
organisation_id: order.organisationId,
|
15
15
|
channel_shop_id: order.channelShopId,
|
16
|
-
native_order_id: order.id,
|
16
|
+
native_order_id: order.id.toString(),
|
17
17
|
ordered_at_date: new Date(order.createdAt).toISOString(),
|
18
18
|
ordered_at_time: new Date(order.createdAt).toISOString(),
|
19
19
|
updated_at_date: new Date(order.updatedAt).toISOString(),
|
package/dist-server/controllers/sellercraft-channel-integration/apis/ingest-channel-order.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"ingest-channel-order.js","sourceRoot":"","sources":["../../../../server/controllers/sellercraft-channel-integration/apis/ingest-channel-order.ts"],"names":[],"mappings":";AAAA,4FAA4F;;;AAE5F,kDAAiD;AAEjD,SAAgB,kBAAkB;IAChC,OAAO;QACL,MAAM,EAAE,MAAM;QACd,IAAI,EAAE,uBAAuB;QAC7B,WAAW,CAAC,GAAG;YACb,MAAM,EAAE,MAAM,EAAE,GAAG,GAAG,CAAA;YAEtB,IAAI,SAAS,GAAG,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE;gBACjC,OAAO;oBACL,eAAe,EAAE,KAAK,CAAC,cAAc;oBACrC,eAAe,EAAE,KAAK,CAAC,aAAa;oBACpC,eAAe,EAAE,KAAK,CAAC,EAAE;
|
1
|
+
{"version":3,"file":"ingest-channel-order.js","sourceRoot":"","sources":["../../../../server/controllers/sellercraft-channel-integration/apis/ingest-channel-order.ts"],"names":[],"mappings":";AAAA,4FAA4F;;;AAE5F,kDAAiD;AAEjD,SAAgB,kBAAkB;IAChC,OAAO;QACL,MAAM,EAAE,MAAM;QACd,IAAI,EAAE,uBAAuB;QAC7B,WAAW,CAAC,GAAG;YACb,MAAM,EAAE,MAAM,EAAE,GAAG,GAAG,CAAA;YAEtB,IAAI,SAAS,GAAG,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE;gBACjC,OAAO;oBACL,eAAe,EAAE,KAAK,CAAC,cAAc;oBACrC,eAAe,EAAE,KAAK,CAAC,aAAa;oBACpC,eAAe,EAAE,KAAK,CAAC,EAAE,CAAC,QAAQ,EAAE;oBACpC,eAAe,EAAE,IAAI,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,WAAW,EAAE;oBACxD,eAAe,EAAE,IAAI,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,WAAW,EAAE;oBACxD,eAAe,EAAE,IAAI,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,WAAW,EAAE;oBACxD,eAAe,EAAE,IAAI,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,WAAW,EAAE;oBACxD,mBAAmB,EAAE,KAAK,CAAC,aAAa;oBACxC,kBAAkB,EAAE,KAAK,CAAC,YAAY;oBACtC,OAAO,EAAE,EAAE;oBACX,gBAAgB,EAAE;wBAChB,UAAU,EAAE,KAAK,CAAC,aAAa;wBAC/B,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eAAe,EAAE,IAAI,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,WAAW,EAAE;4BACxD,eAAe,EAAE,IAAI,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,WAAW,EAAE;4BACxD,eAAe,EAAE,IAAI,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,WAAW,EAAE;4BACxD,cAAc,EAAE,CAAA,SAAS,aAAT,SAAS,uBAAT,SAAS,CAAE,YAAY,EAAC,CAAC,CAAC,IAAI,IAAI,CAAC,SAAS,CAAC,YAAY,CAAC,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC,IAAI;4BAC/F,OAAO,EAAE,SAAS,CAAC,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE;gCACtC,OAAO;oCACL,iBAAiB,EAAE,MAAM,CAAC,IAAI;oCAC9B,YAAY,EAAE,UAAU,CAAC,MAAM,CAAC,WAAW,CAAC,IAAI,CAAC;oCACjD,WAAW,EAAE,UAAU,CAAC,MAAM,CAAC,UAAU,CAAC,IAAI,CAAC;iCAChD,CAAA;4BACH,CAAC,CAAC;4BACF,kBAAkB,EAAE,wBAAY,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC;yBACpD,CAAA;oBACH,CAAC,CAAC;iBACH,CAAA;YACH,CAAC,CAAC,CAAA;YAEF,OAAO;gBACL,OAAO,EAAE,CAAC,GAAG,SAAS,CAAC;aACxB,CAAA;QACH,CAAC;QACD,SAAS,CAAC,GAAG;YACX,OAAO,GAAG,CAAA;QACZ,CAAC;KACF,CAAA;AACH,CAAC;AA9ED,gDA8EC"}
|
@@ -11,6 +11,7 @@ const constants_1 = require("../constants");
|
|
11
11
|
const debug = require('debug')('things-factory:integration-sellercraft:sellercraft-router');
|
12
12
|
exports.sellercraftRouter = new koa_router_1.default();
|
13
13
|
exports.sellercraftRouter.post('/sellercraft/store/update-product-price', async (context, next) => {
|
14
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
14
15
|
const sellercraftChannelIntegrationConfig = env_1.config.get('sellercraftChannelIntegrationConfig', {});
|
15
16
|
const { tokenCraftApiKey: apiKey, tokenCraftUrl } = sellercraftChannelIntegrationConfig;
|
16
17
|
const xApiKey = context.headers['x-api-key'];
|
@@ -33,11 +34,12 @@ exports.sellercraftRouter.post('/sellercraft/store/update-product-price', async
|
|
33
34
|
store = await response.json();
|
34
35
|
}
|
35
36
|
let mappedStore = {
|
36
|
-
accessKey: store.shop.credential.consumer_key,
|
37
|
-
accessSecret: store.shop.credential.consumer_secret,
|
38
|
-
storeURL: store.shop.credential.store_url,
|
37
|
+
accessKey: ((_b = (_a = store.shop) === null || _a === void 0 ? void 0 : _a.credential) === null || _b === void 0 ? void 0 : _b.consumer_key) || '',
|
38
|
+
accessSecret: ((_d = (_c = store.shop) === null || _c === void 0 ? void 0 : _c.credential) === null || _d === void 0 ? void 0 : _d.consumer_secret) || '',
|
39
|
+
storeURL: (_f = (_e = store.shop) === null || _e === void 0 ? void 0 : _e.credential) === null || _f === void 0 ? void 0 : _f.store_url,
|
39
40
|
platform: constants_1.PLATFORM[`${store.shop.org_prefix}`],
|
40
|
-
accessToken: store.shop.credential.access_token
|
41
|
+
accessToken: (_h = (_g = store.shop) === null || _g === void 0 ? void 0 : _g.credential) === null || _h === void 0 ? void 0 : _h.access_token,
|
42
|
+
channelShopId: (_j = store.shop) === null || _j === void 0 ? void 0 : _j.channel_shop_id
|
41
43
|
};
|
42
44
|
if (requestBody[i].native_variant_id != requestBody[i].native_product_id) {
|
43
45
|
const req = {
|
@@ -63,6 +65,7 @@ exports.sellercraftRouter.post('/sellercraft/store/update-product-price', async
|
|
63
65
|
context.status = 200;
|
64
66
|
});
|
65
67
|
exports.sellercraftRouter.post('/sellercraft/store/update-product-stock', async (context, next) => {
|
68
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
66
69
|
const sellercraftChannelIntegrationConfig = env_1.config.get('sellercraftChannelIntegrationConfig', {});
|
67
70
|
const { tokenCraftApiKey: apiKey, tokenCraftUrl } = sellercraftChannelIntegrationConfig;
|
68
71
|
const xApiKey = context.headers['x-api-key'];
|
@@ -85,11 +88,12 @@ exports.sellercraftRouter.post('/sellercraft/store/update-product-stock', async
|
|
85
88
|
store = await response.json();
|
86
89
|
}
|
87
90
|
let mappedStore = {
|
88
|
-
accessKey: store.shop.credential.consumer_key,
|
89
|
-
accessSecret: store.shop.credential.consumer_secret,
|
90
|
-
storeURL: store.shop.credential.store_url,
|
91
|
+
accessKey: ((_b = (_a = store.shop) === null || _a === void 0 ? void 0 : _a.credential) === null || _b === void 0 ? void 0 : _b.consumer_key) || '',
|
92
|
+
accessSecret: ((_d = (_c = store.shop) === null || _c === void 0 ? void 0 : _c.credential) === null || _d === void 0 ? void 0 : _d.consumer_secret) || '',
|
93
|
+
storeURL: (_f = (_e = store.shop) === null || _e === void 0 ? void 0 : _e.credential) === null || _f === void 0 ? void 0 : _f.store_url,
|
91
94
|
platform: constants_1.PLATFORM[`${store.shop.org_prefix}`],
|
92
|
-
accessToken: store.shop.credential.access_token
|
95
|
+
accessToken: (_h = (_g = store.shop) === null || _g === void 0 ? void 0 : _g.credential) === null || _h === void 0 ? void 0 : _h.access_token,
|
96
|
+
channelShopId: (_j = store.shop) === null || _j === void 0 ? void 0 : _j.channel_shop_id
|
93
97
|
};
|
94
98
|
if (requestBody[i].native_variant_id != requestBody[i].native_product_id) {
|
95
99
|
const req = {
|
@@ -115,6 +119,7 @@ exports.sellercraftRouter.post('/sellercraft/store/update-product-stock', async
|
|
115
119
|
context.status = 200;
|
116
120
|
});
|
117
121
|
exports.sellercraftRouter.post('/sellercraft/store/update-order-status', async (context, next) => {
|
122
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
118
123
|
const sellercraftChannelIntegrationConfig = env_1.config.get('sellercraftChannelIntegrationConfig', {});
|
119
124
|
const { tokenCraftApiKey: apiKey, tokenCraftUrl } = sellercraftChannelIntegrationConfig;
|
120
125
|
const xApiKey = context.headers['x-api-key'];
|
@@ -136,11 +141,12 @@ exports.sellercraftRouter.post('/sellercraft/store/update-order-status', async (
|
|
136
141
|
store = await response.json();
|
137
142
|
}
|
138
143
|
let mappedStore = {
|
139
|
-
accessKey: store.shop.credential.consumer_key,
|
140
|
-
accessSecret: store.shop.credential.consumer_secret,
|
141
|
-
storeURL: store.shop.credential.store_url,
|
144
|
+
accessKey: ((_b = (_a = store.shop) === null || _a === void 0 ? void 0 : _a.credential) === null || _b === void 0 ? void 0 : _b.consumer_key) || '',
|
145
|
+
accessSecret: ((_d = (_c = store.shop) === null || _c === void 0 ? void 0 : _c.credential) === null || _d === void 0 ? void 0 : _d.consumer_secret) || '',
|
146
|
+
storeURL: (_f = (_e = store.shop) === null || _e === void 0 ? void 0 : _e.credential) === null || _f === void 0 ? void 0 : _f.store_url,
|
142
147
|
platform: constants_1.PLATFORM[`${store.shop.org_prefix}`],
|
143
|
-
accessToken: store.shop.credential.access_token
|
148
|
+
accessToken: (_h = (_g = store.shop) === null || _g === void 0 ? void 0 : _g.credential) === null || _h === void 0 ? void 0 : _h.access_token,
|
149
|
+
channelShopId: (_j = store.shop) === null || _j === void 0 ? void 0 : _j.channel_shop_id
|
144
150
|
};
|
145
151
|
const reqBody = {
|
146
152
|
orderId: requestBody.native_order_id,
|
@@ -154,6 +160,7 @@ exports.sellercraftRouter.post('/sellercraft/store/update-order-status', async (
|
|
154
160
|
context.status = 200;
|
155
161
|
});
|
156
162
|
exports.sellercraftRouter.post('/sellercraft/store/update-product-attribute', async (context, next) => {
|
163
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
157
164
|
const sellercraftChannelIntegrationConfig = env_1.config.get('sellercraftChannelIntegrationConfig', {});
|
158
165
|
const { tokenCraftApiKey: apiKey, tokenCraftUrl } = sellercraftChannelIntegrationConfig;
|
159
166
|
const xApiKey = context.headers['x-api-key'];
|
@@ -174,11 +181,12 @@ exports.sellercraftRouter.post('/sellercraft/store/update-product-attribute', as
|
|
174
181
|
store = await response.json();
|
175
182
|
}
|
176
183
|
let mappedStore = {
|
177
|
-
accessKey: store.shop.credential.consumer_key,
|
178
|
-
accessSecret: store.shop.credential.consumer_secret,
|
179
|
-
storeURL: store.shop.credential.store_url,
|
184
|
+
accessKey: ((_b = (_a = store.shop) === null || _a === void 0 ? void 0 : _a.credential) === null || _b === void 0 ? void 0 : _b.consumer_key) || '',
|
185
|
+
accessSecret: ((_d = (_c = store.shop) === null || _c === void 0 ? void 0 : _c.credential) === null || _d === void 0 ? void 0 : _d.consumer_secret) || '',
|
186
|
+
storeURL: (_f = (_e = store.shop) === null || _e === void 0 ? void 0 : _e.credential) === null || _f === void 0 ? void 0 : _f.store_url,
|
180
187
|
platform: constants_1.PLATFORM[`${store.shop.org_prefix}`],
|
181
|
-
accessToken: store.shop.credential.access_token
|
188
|
+
accessToken: (_h = (_g = store.shop) === null || _g === void 0 ? void 0 : _g.credential) === null || _h === void 0 ? void 0 : _h.access_token,
|
189
|
+
channelShopId: (_j = store.shop) === null || _j === void 0 ? void 0 : _j.channel_shop_id
|
182
190
|
};
|
183
191
|
let { product_sku: productSku, native_product_id: itemId, variants } = requestBody;
|
184
192
|
variants.map(variant => {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"sellercraft-router.js","sourceRoot":"","sources":["../../server/routers/sellercraft-router.ts"],"names":[],"mappings":";;;;;;AAAA,4DAA+B;AAE/B,6CAA4C;AAC5C,qFAAkE;
|
1
|
+
{"version":3,"file":"sellercraft-router.js","sourceRoot":"","sources":["../../server/routers/sellercraft-router.ts"],"names":[],"mappings":";;;;;;AAAA,4DAA+B;AAE/B,6CAA4C;AAC5C,qFAAkE;AAElE,4CAAuC;AAEvC,MAAM,KAAK,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC,2DAA2D,CAAC,CAAA;AAE9E,QAAA,iBAAiB,GAAG,IAAI,oBAAM,EAAE,CAAA;AAE7C,yBAAiB,CAAC,IAAI,CAAC,yCAAyC,EAAE,K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