@things-factory/integration-sellercraft 9.0.0-beta.79 → 9.0.0-beta.80

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.
Files changed (36) hide show
  1. package/dist-server/controllers/sellercraft/apis/add-inbound-order.js +5 -2
  2. package/dist-server/controllers/sellercraft/apis/add-inbound-order.js.map +1 -1
  3. package/dist-server/controllers/sellercraft/apis/echo.js +3 -3
  4. package/dist-server/controllers/sellercraft/apis/echo.js.map +1 -1
  5. package/dist-server/controllers/sellercraft/sellercraft.d.ts +1 -1
  6. package/dist-server/controllers/sellercraft/sellercraft.js +3 -1
  7. package/dist-server/controllers/sellercraft/sellercraft.js.map +1 -1
  8. package/dist-server/controllers/sellercraft-api/decorators.js +2 -2
  9. package/dist-server/controllers/sellercraft-api/decorators.js.map +1 -1
  10. package/dist-server/controllers/sellercraft-api/index.js +1 -1
  11. package/dist-server/controllers/sellercraft-api/index.js.map +1 -1
  12. package/dist-server/controllers/sellercraft-channel-integration/apis/echo.js +3 -3
  13. package/dist-server/controllers/sellercraft-channel-integration/apis/echo.js.map +1 -1
  14. package/dist-server/controllers/sellercraft-channel-integration/apis/ingest-channel-order-package.js +1 -1
  15. package/dist-server/controllers/sellercraft-channel-integration/apis/ingest-channel-order-package.js.map +1 -1
  16. package/dist-server/controllers/sellercraft-channel-integration/apis/ingest-channel-order.js +5 -5
  17. package/dist-server/controllers/sellercraft-channel-integration/apis/ingest-channel-order.js.map +1 -1
  18. package/dist-server/controllers/sellercraft-channel-integration/apis/ingest-channel-product.js +23 -19
  19. package/dist-server/controllers/sellercraft-channel-integration/apis/ingest-channel-product.js.map +1 -1
  20. package/dist-server/controllers/sellercraft-channel-integration/sellercraft-channel-integration.d.ts +1 -1
  21. package/dist-server/controllers/sellercraft-channel-integration/sellercraft-channel-integration.js +4 -3
  22. package/dist-server/controllers/sellercraft-channel-integration/sellercraft-channel-integration.js.map +1 -1
  23. package/dist-server/controllers/sellercraft-channel-integration-api/index.js +1 -1
  24. package/dist-server/controllers/sellercraft-channel-integration-api/index.js.map +1 -1
  25. package/dist-server/routers/sellercraft-router.js +21 -23
  26. package/dist-server/routers/sellercraft-router.js.map +1 -1
  27. package/dist-server/service/marketplace-channel/marketplace-channel-order-mutation.js +22 -21
  28. package/dist-server/service/marketplace-channel/marketplace-channel-order-mutation.js.map +1 -1
  29. package/dist-server/service/marketplace-channel/marketplace-channel-product-mutation.js +9 -11
  30. package/dist-server/service/marketplace-channel/marketplace-channel-product-mutation.js.map +1 -1
  31. package/dist-server/service/sellercraft/sellercraft-mutation.js +33 -7
  32. package/dist-server/service/sellercraft/sellercraft-mutation.js.map +1 -1
  33. package/dist-server/tsconfig.tsbuildinfo +1 -1
  34. package/dist-server/utils/tokencraft-util.js +8 -9
  35. package/dist-server/utils/tokencraft-util.js.map +1 -1
  36. package/package.json +4 -4
@@ -8,7 +8,6 @@ const env_1 = require("@things-factory/env");
8
8
  const constants_1 = require("../constants");
9
9
  const integration_base_1 = require("@things-factory/integration-base");
10
10
  async function getShop(context, channelId, shopId) {
11
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
12
11
  const sellercraftChannelIntegrationConfig = env_1.config.get('sellercraftChannelIntegrationConfig', {});
13
12
  const { tokenCraftApiKey: apiKey, tokenCraftUrl } = sellercraftChannelIntegrationConfig;
14
13
  const xApiKey = context.headers['x-api-key'];
@@ -25,18 +24,18 @@ async function getShop(context, channelId, shopId) {
25
24
  if (response.ok) {
26
25
  let store = await response.json();
27
26
  let mappedStore = {
28
- accessKey: ((_b = (_a = store.shop) === null || _a === void 0 ? void 0 : _a.credential) === null || _b === void 0 ? void 0 : _b.consumer_key) || '',
29
- accessSecret: ((_d = (_c = store.shop) === null || _c === void 0 ? void 0 : _c.credential) === null || _d === void 0 ? void 0 : _d.consumer_secret) || '',
30
- storeURL: (_f = (_e = store.shop) === null || _e === void 0 ? void 0 : _e.credential) === null || _f === void 0 ? void 0 : _f.store_url,
27
+ accessKey: store.shop?.credential?.consumer_key || '',
28
+ accessSecret: store.shop?.credential?.consumer_secret || '',
29
+ storeURL: store.shop?.credential?.store_url,
31
30
  platform: constants_1.PLATFORM[`${store.shop.org_prefix}`],
32
- accessToken: (_h = (_g = store.shop) === null || _g === void 0 ? void 0 : _g.credential) === null || _h === void 0 ? void 0 : _h.access_token,
33
- channelShopId: (_j = store.shop) === null || _j === void 0 ? void 0 : _j.channel_shop_id,
34
- storeId: (_l = (_k = store.shop) === null || _k === void 0 ? void 0 : _k.credential) === null || _l === void 0 ? void 0 : _l.store_url
31
+ accessToken: store.shop?.credential?.access_token,
32
+ channelShopId: store.shop?.channel_shop_id,
33
+ storeId: store.shop?.credential?.store_url
35
34
  };
36
35
  return mappedStore;
37
36
  }
38
37
  else {
39
- (0, integration_base_1.createPayloadLog)(shopId, tokenCraftUrl, `channel_id=${channelId}&shop_id=${shopId}`, (response === null || response === void 0 ? void 0 : response.statusText) || 500, {
38
+ (0, integration_base_1.createPayloadLog)(shopId, tokenCraftUrl, `channel_id=${channelId}&shop_id=${shopId}`, response?.statusText || 500, {
40
39
  state: { domain: null }
41
40
  });
42
41
  }
@@ -53,7 +52,7 @@ async function getShops(channelId) {
53
52
  }
54
53
  });
55
54
  if (!channelResponse.ok) {
56
- (0, integration_base_1.createPayloadLog)(channelId, getShopsTokenCraftUrl, `channel_id=${channelId}`, (channelResponse === null || channelResponse === void 0 ? void 0 : channelResponse.statusText) || 500, {
55
+ (0, integration_base_1.createPayloadLog)(channelId, getShopsTokenCraftUrl, `channel_id=${channelId}`, channelResponse?.statusText || 500, {
57
56
  state: { domain: null }
58
57
  });
59
58
  throw new Error(channelResponse);
@@ -1 +1 @@
1
- {"version":3,"file":"tokencraft-util.js","sourceRoot":"","sources":["../../server/utils/tokencraft-util.ts"],"names":[],"mappings":";;AAMA,0BAgCC;AAED,4BAqBC;;AA7DD,oEAA8B;AAE9B,6CAA4C;AAC5C,4CAAuC;AACvC,uEAAmE;AAE5D,KAAK,U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,CAAA;AAC5B,CAAC","sourcesContent":["import fetch from 'node-fetch'\n\nimport { config } from '@things-factory/env'\nimport { PLATFORM } from '../constants'\nimport { createPayloadLog } from '@things-factory/integration-base'\n\nexport async function getShop(context: any, channelId: string, shopId: string) {\n const sellercraftChannelIntegrationConfig = config.get('sellercraftChannelIntegrationConfig', {})\n const { tokenCraftApiKey: apiKey, tokenCraftUrl } = sellercraftChannelIntegrationConfig\n const xApiKey = context.headers['x-api-key']\n\n if (apiKey !== xApiKey) context.throw(400, 'api key validation failed')\n\n var fullPath = `${tokenCraftUrl}?channel_id=${channelId}&shop_id=${shopId}`\n const response: any = await fetch(fullPath, {\n method: 'get',\n headers: {\n 'Content-Type': 'application/json',\n 'x-api-key': apiKey\n }\n })\n if (response.ok) {\n let store = await response.json()\n let mappedStore: any = {\n accessKey: store.shop?.credential?.consumer_key || '',\n accessSecret: store.shop?.credential?.consumer_secret || '',\n storeURL: store.shop?.credential?.store_url,\n platform: PLATFORM[`${store.shop.org_prefix}`],\n accessToken: store.shop?.credential?.access_token,\n channelShopId: store.shop?.channel_shop_id,\n storeId: store.shop?.credential?.store_url\n }\n return mappedStore\n } else {\n createPayloadLog(shopId, tokenCraftUrl, `channel_id=${channelId}&shop_id=${shopId}`, response?.statusText || 500, {\n state: { domain: null }\n })\n }\n}\n\nexport async function getShops(channelId: string) {\n const sellercraftChannelIntegrationConfig = config.get('sellercraftChannelIntegrationConfig', {})\n const { tokenCraftApiKey: apiKey, getShopsTokenCraftUrl } = sellercraftChannelIntegrationConfig\n\n var channelsFullPath = getShopsTokenCraftUrl + '?channel_id=' + channelId\n const channelResponse: any = await fetch(channelsFullPath, {\n method: 'get',\n headers: {\n 'Content-Type': 'application/json',\n 'x-api-key': apiKey\n }\n })\n\n if (!channelResponse.ok) {\n createPayloadLog(channelId, getShopsTokenCraftUrl, `channel_id=${channelId}`, channelResponse?.statusText || 500, {\n state: { domain: null }\n })\n throw new Error(channelResponse)\n }\n var shopsResponse = await channelResponse.json()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,CAAC,IAAI,EAAE,CAAA;IAChD,OAAO,aAAa,CAAC,KAAK,CAAA;AAC5B,CAAC","sourcesContent":["import fetch from 'node-fetch'\n\nimport { config } from '@things-factory/env'\nimport { PLATFORM } from '../constants'\nimport { createPayloadLog } from '@things-factory/integration-base'\n\nexport async function getShop(context: any, channelId: string, shopId: string) {\n const sellercraftChannelIntegrationConfig = config.get('sellercraftChannelIntegrationConfig', {})\n const { tokenCraftApiKey: apiKey, tokenCraftUrl } = sellercraftChannelIntegrationConfig\n const xApiKey = context.headers['x-api-key']\n\n if (apiKey !== xApiKey) context.throw(400, 'api key validation failed')\n\n var fullPath = `${tokenCraftUrl}?channel_id=${channelId}&shop_id=${shopId}`\n const response: any = await fetch(fullPath, {\n method: 'get',\n headers: {\n 'Content-Type': 'application/json',\n 'x-api-key': apiKey\n }\n })\n if (response.ok) {\n let store = await response.json()\n let mappedStore: any = {\n accessKey: store.shop?.credential?.consumer_key || '',\n accessSecret: store.shop?.credential?.consumer_secret || '',\n storeURL: store.shop?.credential?.store_url,\n platform: PLATFORM[`${store.shop.org_prefix}`],\n accessToken: store.shop?.credential?.access_token,\n channelShopId: store.shop?.channel_shop_id,\n storeId: store.shop?.credential?.store_url\n }\n return mappedStore\n } else {\n createPayloadLog(shopId, tokenCraftUrl, `channel_id=${channelId}&shop_id=${shopId}`, response?.statusText || 500, {\n state: { domain: null }\n })\n }\n}\n\nexport async function getShops(channelId: string) {\n const sellercraftChannelIntegrationConfig = config.get('sellercraftChannelIntegrationConfig', {})\n const { tokenCraftApiKey: apiKey, getShopsTokenCraftUrl } = sellercraftChannelIntegrationConfig\n\n var channelsFullPath = getShopsTokenCraftUrl + '?channel_id=' + channelId\n const channelResponse: any = await fetch(channelsFullPath, {\n method: 'get',\n headers: {\n 'Content-Type': 'application/json',\n 'x-api-key': apiKey\n }\n })\n\n if (!channelResponse.ok) {\n createPayloadLog(channelId, getShopsTokenCraftUrl, `channel_id=${channelId}`, channelResponse?.statusText || 500, {\n state: { domain: null }\n })\n throw new Error(channelResponse)\n }\n var shopsResponse = await channelResponse.json()\n return shopsResponse.shops\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@things-factory/integration-sellercraft",
3
- "version": "9.0.0-beta.79",
3
+ "version": "9.0.0-beta.80",
4
4
  "main": "dist-server/index.js",
5
5
  "browser": "client/index.js",
6
6
  "things-factory": true,
@@ -31,8 +31,8 @@
31
31
  "@things-factory/code-ui": "^9.0.0-beta.76",
32
32
  "@things-factory/context-ui": "^9.0.0-beta.71",
33
33
  "@things-factory/i18n-base": "^9.0.0-beta.76",
34
- "@things-factory/integration-marketplace": "^9.0.0-beta.79",
35
- "@things-factory/integration-ui": "^9.0.0-beta.79",
34
+ "@things-factory/integration-marketplace": "^9.0.0-beta.80",
35
+ "@things-factory/integration-ui": "^9.0.0-beta.80",
36
36
  "@things-factory/more-ui": "^9.0.0-beta.71",
37
37
  "@things-factory/resource-ui": "^9.0.0-beta.76",
38
38
  "@things-factory/setting-ui": "^9.0.0-beta.76",
@@ -49,5 +49,5 @@
49
49
  "nock": "^13.0.2",
50
50
  "should": "^13.2.3"
51
51
  },
52
- "gitHead": "e652dcabaaadd49880ce8ebe0b617a8d902c7aa5"
52
+ "gitHead": "d50b01b1c4d13c639a5e04f787c62b1a9daf9ade"
53
53
  }