@plasmicpkgs/commerce 0.0.52 → 0.0.55

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.
@@ -1119,7 +1119,7 @@ var FetcherError = /*#__PURE__*/function (_CommerceError2) {
1119
1119
  return FetcherError;
1120
1120
  }(CommerceError);
1121
1121
 
1122
- var useData = function useData(options, input, fetcherFn, swrOptions) {
1122
+ var useData = function useData(options, input, fetcherFn, swrOptions, provider) {
1123
1123
  var hookInput = Array.isArray(input) ? input : Object.entries(input);
1124
1124
 
1125
1125
  var fetcher = /*#__PURE__*/function () {
@@ -1151,7 +1151,8 @@ var useData = function useData(options, input, fetcherFn, swrOptions) {
1151
1151
  obj[hookInput[i][0]] = val;
1152
1152
  return obj;
1153
1153
  }, {}),
1154
- fetch: fetcherFn
1154
+ fetch: fetcherFn,
1155
+ provider: provider
1155
1156
  });
1156
1157
 
1157
1158
  case 4:
@@ -1203,7 +1204,7 @@ var useData = function useData(options, input, fetcherFn, swrOptions) {
1203
1204
 
1204
1205
  /*
1205
1206
  Forked from https://github.com/vercel/commerce/tree/main/packages/commerce/src
1206
- Changes: None
1207
+ Changes: Add provider to useSWRHook and useMutationHook
1207
1208
  */
1208
1209
  function useFetcher() {
1209
1210
  var _providerRef$current$;
@@ -1214,20 +1215,27 @@ function useFetcher() {
1214
1215
 
1215
1216
  return (_providerRef$current$ = providerRef.current.fetcher) != null ? _providerRef$current$ : fetcherRef.current;
1216
1217
  }
1217
- function useHook(fn) {
1218
+ function useProvider() {
1218
1219
  var _useCommerce2 = useCommerce(),
1219
1220
  providerRef = _useCommerce2.providerRef;
1220
1221
 
1222
+ return providerRef.current;
1223
+ }
1224
+ function useHook(fn) {
1225
+ var _useCommerce3 = useCommerce(),
1226
+ providerRef = _useCommerce3.providerRef;
1227
+
1221
1228
  var provider = providerRef.current;
1222
1229
  return fn(provider);
1223
1230
  }
1224
1231
  function useSWRHook(hook) {
1225
1232
  var fetcher = useFetcher();
1233
+ var provider = useProvider();
1226
1234
  return hook.useHook({
1227
1235
  useData: function useData$1(ctx) {
1228
1236
  var _ctx$input;
1229
1237
 
1230
- var response = useData(hook, (_ctx$input = ctx == null ? void 0 : ctx.input) != null ? _ctx$input : [], fetcher, ctx == null ? void 0 : ctx.swrOptions);
1238
+ var response = useData(hook, (_ctx$input = ctx == null ? void 0 : ctx.input) != null ? _ctx$input : [], fetcher, ctx == null ? void 0 : ctx.swrOptions, provider);
1231
1239
 
1232
1240
  return response;
1233
1241
  }
@@ -1235,6 +1243,7 @@ function useSWRHook(hook) {
1235
1243
  }
1236
1244
  function useMutationHook(hook) {
1237
1245
  var fetcher = useFetcher();
1246
+ var provider = useProvider();
1238
1247
  return hook.useHook({
1239
1248
  fetch: React.useCallback(function (_temp) {
1240
1249
  var _ref = _temp === void 0 ? {} : _temp,
@@ -1243,7 +1252,8 @@ function useMutationHook(hook) {
1243
1252
  return hook.fetcher({
1244
1253
  input: input,
1245
1254
  options: hook.fetchOptions,
1246
- fetch: fetcher
1255
+ fetch: fetcher,
1256
+ provider: provider
1247
1257
  });
1248
1258
  }, [fetcher, hook.fetchOptions])
1249
1259
  });
@@ -1638,7 +1648,8 @@ var categoryCollectionMeta = {
1638
1648
  maxWidth: "100%"
1639
1649
  },
1640
1650
  importPath: "@plasmicpkgs/commerce",
1641
- importName: "CategoryCollection"
1651
+ importName: "CategoryCollection",
1652
+ providesData: true
1642
1653
  };
1643
1654
  function CategoryCollection(props) {
1644
1655
  var _categories$findIndex;
@@ -2439,6 +2450,7 @@ function registerProductQuantity(loader, customProductQuantityMeta) {
2439
2450
  var productSliderMeta = {
2440
2451
  name: "plasmic-commerce-product-slider",
2441
2452
  displayName: "Product Slider",
2453
+ providesData: true,
2442
2454
  props: {
2443
2455
  thumbsVisible: {
2444
2456
  type: "number",