@sentecacommerce-theme/lib 0.12.97 → 0.12.98

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.
@@ -10,6 +10,7 @@ var _utils = require("../../utils");
10
10
  var _getSDKConfig = require("../getSDKConfig");
11
11
  var _utils1 = require("./utils");
12
12
  var _promoCode = require("../../api.v2/core/misc/promo-code");
13
+ var _ = require("../..");
13
14
  function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
14
15
  try {
15
16
  var info = gen[key](arg);
@@ -122,6 +123,7 @@ var MyCartApiFactory = function() {
122
123
  }(),
123
124
  useGet: function() {
124
125
  var queryCache = (0, _reactQuery).useQueryCache();
126
+ var isLoading = (0, _).useIsAuthenticated().isLoading;
125
127
  return (0, _reactQuery).useQuery(myCartCacheKeys.useGet, _asyncToGenerator(_regeneratorRuntime.default.mark(function _callee() {
126
128
  var data;
127
129
  return _regeneratorRuntime.default.wrap(function _callee$(_ctx) {
@@ -140,12 +142,14 @@ var MyCartApiFactory = function() {
140
142
  }
141
143
  }, _callee);
142
144
  })), {
145
+ enabled: !isLoading,
143
146
  retry: false,
144
- refetchOnMount: false,
147
+ refetchOnMount: true,
145
148
  refetchOnWindowFocus: false
146
149
  });
147
150
  },
148
151
  useGetCompact: function() {
152
+ var isLoading = (0, _).useIsAuthenticated().isLoading;
149
153
  return (0, _reactQuery).useQuery(myCartCacheKeys.useGetCompact, _asyncToGenerator(_regeneratorRuntime.default.mark(function _callee() {
150
154
  var compactBasket;
151
155
  return _regeneratorRuntime.default.wrap(function _callee$(_ctx) {
@@ -158,7 +162,9 @@ var MyCartApiFactory = function() {
158
162
  return _ctx.stop();
159
163
  }
160
164
  }, _callee);
161
- })));
165
+ })), {
166
+ enabled: !isLoading
167
+ });
162
168
  },
163
169
  useIsExisting: function(productId, variantId, collapseKey) {
164
170
  return (0, _reactQuery).useQuery([
@@ -6,6 +6,7 @@ import { readFromLocalStorage, writeToLocalStorage, getTranslatableField } from
6
6
  import { getSDKConfig } from '../getSDKConfig';
7
7
  import { syncResponse, getLineItemId, onMutate } from './utils';
8
8
  import { queryKey as promoCodeQueryKey } from '../../api.v2/core/misc/promo-code';
9
+ import { useIsAuthenticated } from '../..';
9
10
  function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
10
11
  try {
11
12
  var info = gen[key](arg);
@@ -110,6 +111,7 @@ export var MyCartApiFactory = function() {
110
111
  }(),
111
112
  useGet: function() {
112
113
  var queryCache = useQueryCache();
114
+ var isLoading = useIsAuthenticated().isLoading;
113
115
  return useQuery(myCartCacheKeys.useGet, _asyncToGenerator(regeneratorRuntime.mark(function _callee() {
114
116
  var data;
115
117
  return regeneratorRuntime.wrap(function _callee$(_ctx) {
@@ -128,12 +130,14 @@ export var MyCartApiFactory = function() {
128
130
  }
129
131
  }, _callee);
130
132
  })), {
133
+ enabled: !isLoading,
131
134
  retry: false,
132
- refetchOnMount: false,
135
+ refetchOnMount: true,
133
136
  refetchOnWindowFocus: false
134
137
  });
135
138
  },
136
139
  useGetCompact: function() {
140
+ var isLoading = useIsAuthenticated().isLoading;
137
141
  return useQuery(myCartCacheKeys.useGetCompact, _asyncToGenerator(regeneratorRuntime.mark(function _callee() {
138
142
  var compactBasket;
139
143
  return regeneratorRuntime.wrap(function _callee$(_ctx) {
@@ -146,7 +150,9 @@ export var MyCartApiFactory = function() {
146
150
  return _ctx.stop();
147
151
  }
148
152
  }, _callee);
149
- })));
153
+ })), {
154
+ enabled: !isLoading
155
+ });
150
156
  },
151
157
  useIsExisting: function(productId, variantId, collapseKey) {
152
158
  return useQuery([
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@sentecacommerce-theme/lib",
3
3
  "sideEffects": false,
4
- "version": "0.12.97",
4
+ "version": "0.12.98",
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": "d71d565067baef7c428849d6ccd7280f74d9fcf3",
34
+ "gitHead": "c8ab0c563b3746b6d65c89957e3635c831163988",
35
35
  "peerDependencies": {
36
36
  "react-query": "^2.26.2"
37
37
  },
38
38
  "dependencies": {
39
- "@sentecacommerce-theme/base": "^0.12.97",
40
- "@sentecacommerce-theme/cms": "^0.12.97",
39
+ "@sentecacommerce-theme/base": "^0.12.98",
40
+ "@sentecacommerce-theme/cms": "^0.12.98",
41
41
  "@sentecacommerce/sdk": "2.0.161",
42
42
  "body-scroll-lock": "^3.1.5",
43
43
  "copy-to-clipboard": "^3.3.1",