@plasmicpkgs/commerce-swell 0.0.74 → 0.0.77

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.
@@ -1,18 +1,21 @@
1
- /// <reference types="lodash" />
2
- import type { HookFetcherContext, MutationHookContext } from '@plasmicpkgs/commerce';
3
- import { CartType } from '@plasmicpkgs/commerce';
4
- import { UpdateItemHook } from '../types/cart';
1
+ import type { HookFetcherContext, MutationHookContext } from "@plasmicpkgs/commerce";
2
+ import { CartType } from "@plasmicpkgs/commerce";
3
+ import { UpdateItemHook } from "../types/cart";
5
4
  declare const _default: <T extends CartType.LineItem | undefined = undefined>(ctx?: {
6
5
  item?: T | undefined;
7
6
  wait?: number | undefined;
8
- }) => import("lodash").DebouncedFunc<(input: (CartType.CartItemBody & {
7
+ }) => ((input: (CartType.CartItemBody & {
9
8
  id: string;
10
9
  }) | Partial<CartType.CartItemBody & {
11
10
  id: string;
12
- }>) => Promise<CartType.Cart | null | undefined>>;
11
+ }>) => Promise<CartType.Cart | null | undefined>) & {
12
+ clear(): void;
13
+ } & {
14
+ flush(): void;
15
+ };
13
16
  export default _default;
14
17
  declare type LineItem = CartType.LineItem;
15
- export declare type UpdateItemActionInput<T = any> = T extends LineItem ? Partial<UpdateItemHook['actionInput']> : UpdateItemHook['actionInput'];
18
+ export declare type UpdateItemActionInput<T = any> = T extends LineItem ? Partial<UpdateItemHook["actionInput"]> : UpdateItemHook["actionInput"];
16
19
  export declare const handler: {
17
20
  fetchOptions: {
18
21
  query: string;
@@ -22,5 +25,9 @@ export declare const handler: {
22
25
  useHook: ({ fetch }: MutationHookContext<UpdateItemHook>) => <T extends CartType.LineItem | undefined = undefined>(ctx?: {
23
26
  item?: T | undefined;
24
27
  wait?: number | undefined;
25
- }) => import("lodash").DebouncedFunc<(input: UpdateItemActionInput) => Promise<CartType.Cart | null | undefined>>;
28
+ }) => ((input: UpdateItemActionInput) => Promise<CartType.Cart | null | undefined>) & {
29
+ clear(): void;
30
+ } & {
31
+ flush(): void;
32
+ };
26
33
  };
@@ -10,8 +10,7 @@ var React__default = _interopDefault(React);
10
10
  var commerce = require('@plasmicpkgs/commerce');
11
11
  var swell = _interopDefault(require('swell-js'));
12
12
  var Cookies = _interopDefault(require('js-cookie'));
13
- var debounce = _interopDefault(require('lodash/debounce'));
14
- var isNil = _interopDefault(require('lodash-es/isNil'));
13
+ var debounce = _interopDefault(require('debounce'));
15
14
 
16
15
  /*
17
16
  Forked from https://github.com/vercel/commerce/tree/main/packages/swell/src
@@ -1431,8 +1430,8 @@ var handler$2 = {
1431
1430
 
1432
1431
  var handler$3 = {
1433
1432
  fetchOptions: {
1434
- query: 'cart',
1435
- method: 'updateItem'
1433
+ query: "cart",
1434
+ method: "updateItem"
1436
1435
  },
1437
1436
  fetcher: function fetcher(_ref) {
1438
1437
  return _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee() {
@@ -1473,7 +1472,7 @@ var handler$3 = {
1473
1472
  }
1474
1473
 
1475
1474
  throw new commerce.ValidationError({
1476
- message: 'The item quantity has to be a valid integer'
1475
+ message: "The item quantity has to be a valid integer"
1477
1476
  });
1478
1477
 
1479
1478
  case 8:
@@ -1530,7 +1529,7 @@ var handler$3 = {
1530
1529
  }
1531
1530
 
1532
1531
  throw new commerce.ValidationError({
1533
- message: 'Invalid input used for this operation'
1532
+ message: "Invalid input used for this operation"
1534
1533
  });
1535
1534
 
1536
1535
  case 6:
@@ -1585,7 +1584,7 @@ function ensure(x, msg) {
1585
1584
  var ensureNoNilFields = function ensureNoNilFields(o) {
1586
1585
  return Object.fromEntries(Object.entries(o).filter(function (_ref) {
1587
1586
  var v = _ref[1];
1588
- return !isNil(v);
1587
+ return v != null;
1589
1588
  }));
1590
1589
  };
1591
1590