@sentecacommerce-theme/lib 0.13.20 → 0.13.21-alpha.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.
@@ -53,18 +53,18 @@ var getSDKConfig = function() {
53
53
  exports.getSDKConfig = getSDKConfig;
54
54
  var getOptions = function() {
55
55
  var options = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
56
+ var ref;
57
+ var basePath = process.env.NEXT_PUBLIC_PROXY_URL + ((ref = options === null || options === void 0 ? void 0 : options.basePath) !== null && ref !== void 0 ? ref : '/platform');
56
58
  if (!(0, _utils).canUseDOM()) {
57
59
  // eslint-disable-next-line @typescript-eslint/no-var-requires
58
60
  var nodeFetch = require('node-fetch');
59
- var ref;
60
61
  return _objectSpread({}, options, {
61
- basePath: process.env.PLATFORM_HOST + ((ref = options === null || options === void 0 ? void 0 : options.basePath) !== null && ref !== void 0 ? ref : '/api'),
62
+ basePath: basePath,
62
63
  fetchApi: nodeFetch
63
64
  }, process.env.sdkConfig || {});
64
65
  } else {
65
- var ref2;
66
66
  return _objectSpread({}, options, {
67
- basePath: (ref2 = options === null || options === void 0 ? void 0 : options.basePath) !== null && ref2 !== void 0 ? ref2 : '/api',
67
+ basePath: basePath,
68
68
  token: _jsCookie.default.get(_utils.AUTH_TOKEN_KEY) || _jsCookie.default.get(_utils.ANONYMOUS_TOKEN_KEY) || process.env.API_KEY || process.env.apiKey,
69
69
  fetchApi: window.fetch.bind(window)
70
70
  }, process.env.sdkConfig || {});
@@ -226,7 +226,7 @@ exports.createMappedAttributes = createMappedAttributes;
226
226
  var processAvailabilityPerStore = function(availabilities) {
227
227
  var ref;
228
228
  return (ref = availabilities === null || availabilities === void 0 ? void 0 : availabilities.filter(function(x) {
229
- return !x.isPhysical;
229
+ return x.availableQuantity > 0;
230
230
  })) === null || ref === void 0 ? void 0 : ref.map(function(param) {
231
231
  var acceptsBackorders = param.acceptsBackorders, stockLocationName = param.stockLocationName, restockableInDays = param.restockableInDays, availableQuantity = param.availableQuantity;
232
232
  return {
@@ -40,17 +40,14 @@ function _interopRequireDefault(obj) {
40
40
  }
41
41
  var fetchRedirectByFrom = function() {
42
42
  var _ref = _asyncToGenerator(_regeneratorRuntime.default.mark(function _callee(from) {
43
- var redirectUrl;
44
43
  return _regeneratorRuntime.default.wrap(function _callee$(_ctx) {
45
44
  while(1)switch(_ctx.prev = _ctx.next){
46
45
  case 0:
47
46
  _ctx.next = 2;
48
47
  return (0, _sdk).RedirectsGetByFrom(from);
49
48
  case 2:
50
- redirectUrl = _ctx.sent;
51
- redirectUrl.to = encodeURI(redirectUrl.to);
52
- return _ctx.abrupt("return", redirectUrl);
53
- case 5:
49
+ return _ctx.abrupt("return", _ctx.sent);
50
+ case 3:
54
51
  case "end":
55
52
  return _ctx.stop();
56
53
  }
@@ -1,6 +1,6 @@
1
1
  import { Configuration, HttpClient } from '@sentecacommerce/sdk';
2
2
  import Cookies from 'js-cookie';
3
- import { ANONYMOUS_TOKEN_KEY, AUTH_TOKEN_KEY, getLocaleFromPath, canUseDOM } from '../utils';
3
+ import { ANONYMOUS_TOKEN_KEY, AUTH_TOKEN_KEY, canUseDOM, getLocaleFromPath } from '../utils';
4
4
  function _defineProperty(obj, key, value) {
5
5
  if (key in obj) {
6
6
  Object.defineProperty(obj, key, {
@@ -43,18 +43,18 @@ export var getSDKConfig = function() {
43
43
  };
44
44
  export var getOptions = function() {
45
45
  var options = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
46
+ var ref;
47
+ var basePath = process.env.NEXT_PUBLIC_PROXY_URL + ((ref = options === null || options === void 0 ? void 0 : options.basePath) !== null && ref !== void 0 ? ref : '/platform');
46
48
  if (!canUseDOM()) {
47
49
  // eslint-disable-next-line @typescript-eslint/no-var-requires
48
50
  var nodeFetch = require('node-fetch');
49
- var ref;
50
51
  return _objectSpread({}, options, {
51
- basePath: process.env.PLATFORM_HOST + ((ref = options === null || options === void 0 ? void 0 : options.basePath) !== null && ref !== void 0 ? ref : '/api'),
52
+ basePath: basePath,
52
53
  fetchApi: nodeFetch
53
54
  }, process.env.sdkConfig || {});
54
55
  } else {
55
- var ref2;
56
56
  return _objectSpread({}, options, {
57
- basePath: (ref2 = options === null || options === void 0 ? void 0 : options.basePath) !== null && ref2 !== void 0 ? ref2 : '/api',
57
+ basePath: basePath,
58
58
  token: Cookies.get(AUTH_TOKEN_KEY) || Cookies.get(ANONYMOUS_TOKEN_KEY) || process.env.API_KEY || process.env.apiKey,
59
59
  fetchApi: window.fetch.bind(window)
60
60
  }, process.env.sdkConfig || {});
@@ -230,7 +230,7 @@ export var createMappedAttributes = function(currentVariant) {
230
230
  export var processAvailabilityPerStore = function(availabilities) {
231
231
  var ref;
232
232
  return (ref = availabilities === null || availabilities === void 0 ? void 0 : availabilities.filter(function(x) {
233
- return !x.isPhysical;
233
+ return x.availableQuantity > 0;
234
234
  })) === null || ref === void 0 ? void 0 : ref.map(function(param) {
235
235
  var acceptsBackorders = param.acceptsBackorders, stockLocationName = param.stockLocationName, restockableInDays = param.restockableInDays, availableQuantity = param.availableQuantity;
236
236
  return {
@@ -31,17 +31,14 @@ function _asyncToGenerator(fn) {
31
31
  }
32
32
  export var fetchRedirectByFrom = function() {
33
33
  var _ref = _asyncToGenerator(regeneratorRuntime.mark(function _callee(from) {
34
- var redirectUrl;
35
34
  return regeneratorRuntime.wrap(function _callee$(_ctx) {
36
35
  while(1)switch(_ctx.prev = _ctx.next){
37
36
  case 0:
38
37
  _ctx.next = 2;
39
38
  return RedirectsGetByFrom(from);
40
39
  case 2:
41
- redirectUrl = _ctx.sent;
42
- redirectUrl.to = encodeURI(redirectUrl.to);
43
- return _ctx.abrupt("return", redirectUrl);
44
- case 5:
40
+ return _ctx.abrupt("return", _ctx.sent);
41
+ case 3:
45
42
  case "end":
46
43
  return _ctx.stop();
47
44
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@sentecacommerce-theme/lib",
3
3
  "sideEffects": false,
4
- "version": "0.13.20",
4
+ "version": "0.13.21-alpha.0+1eaf982",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",
7
7
  "types": "dist/types/index.d.ts",
@@ -31,13 +31,13 @@
31
31
  "watch:cjs": "swc src --out-dir dist/cjs -w",
32
32
  "watch:esm": "swc src --out-dir dist/esm --no-swcrc -w"
33
33
  },
34
- "gitHead": "180efa3c715ce270c82969af7a8ecbd6176286f6",
34
+ "gitHead": "1eaf9822c6a7e00f5e893efbe7b4d74adac6ead9",
35
35
  "peerDependencies": {
36
36
  "react-query": "^2.26.2"
37
37
  },
38
38
  "dependencies": {
39
- "@sentecacommerce-theme/base": "^0.13.20",
40
- "@sentecacommerce-theme/cms": "^0.13.20",
39
+ "@sentecacommerce-theme/base": "^0.13.21-alpha.0+1eaf982",
40
+ "@sentecacommerce-theme/cms": "^0.13.21-alpha.0+1eaf982",
41
41
  "@sentecacommerce/sdk": "2.0.175",
42
42
  "body-scroll-lock": "^3.1.5",
43
43
  "copy-to-clipboard": "^3.3.1",