@haus-storefront-react/order-lines 0.0.7 → 0.0.9

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.
package/index.js CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-Ce7xqKjB.js");exports.OrderLines=e.OrderLines;exports.createOrderLinesScope=e.createOrderLinesScope;exports.useOrderLinesProps=e.useOrderLinesProps;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-BAdId_Jl.js");exports.OrderLines=e.OrderLines;exports.createOrderLinesScope=e.createOrderLinesScope;exports.useOrderLinesProps=e.useOrderLinesProps;
package/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { O as s, a, u as o } from "./index-7xbm4Bku.mjs";
1
+ import { O as s, a, u as o } from "./index-DOrtHXSk.mjs";
2
2
  export {
3
3
  s as OrderLines,
4
4
  a as createOrderLinesScope,
@@ -23,6 +23,9 @@ interface OrderLinesRootProps {
23
23
  orderCode?: string;
24
24
  adjustable?: boolean;
25
25
  removable?: boolean;
26
+ callbacks?: {
27
+ preAdjust?: (orderLineId: string, quantity: number) => Promise<void>;
28
+ };
26
29
  }
27
30
  interface OrderLineItemProps {
28
31
  children?: React.ReactNode;
@@ -89,7 +92,7 @@ export declare const OrderLines: {
89
92
  * @param props.children - Render prop that receives order lines data and functions
90
93
  */
91
94
  Root: {
92
- ({ children, orderCode, adjustable, removable, __scopeOrderLines, }: ScopedProps<OrderLinesRootProps>): import("react/jsx-runtime").JSX.Element;
95
+ ({ children, orderCode, adjustable, removable, callbacks, __scopeOrderLines, }: ScopedProps<OrderLinesRootProps>): import("react/jsx-runtime").JSX.Element;
93
96
  displayName: string;
94
97
  };
95
98
  /**
@@ -1,6 +1,6 @@
1
1
  import { Maybe, Order, OrderLine } from '@haus-storefront-react/shared-types';
2
+ import { ButtonHTMLAttributes, InputHTMLAttributes } from 'react';
2
3
  import { UseQueryResult } from '@tanstack/react-query';
3
- import { WebButtonProps, NativeButtonProps, WebInputProps, NativeInputProps } from '@haus-storefront-react/common-utils';
4
4
  export type UseOrderLinesResult = UseQueryResult<Maybe<Order>, Error> & {
5
5
  orderLines: OrderLine[] | undefined;
6
6
  adjustOrderLine: (orderLineId: string, quantity: number) => Promise<unknown>;
@@ -9,10 +9,10 @@ export type UseOrderLinesResult = UseQueryResult<Maybe<Order>, Error> & {
9
9
  removeError: Error | null;
10
10
  isAdjusting: boolean;
11
11
  isRemoving: boolean;
12
- getRemoveProps: (orderLineId: string, props?: object) => WebButtonProps | NativeButtonProps;
13
- getAdjustProps: (orderLineId: string, props?: object) => WebInputProps | NativeInputProps;
14
- getDecrementProps: (orderLineId: string, props?: object) => WebButtonProps | NativeButtonProps;
15
- getIncrementProps: (orderLineId: string, props?: object) => WebButtonProps | NativeButtonProps;
12
+ getRemoveProps: (props?: Partial<ButtonHTMLAttributes<HTMLButtonElement>>) => ButtonHTMLAttributes<HTMLButtonElement>;
13
+ getAdjustProps: (props?: Partial<InputHTMLAttributes<HTMLInputElement>>) => InputHTMLAttributes<HTMLInputElement>;
14
+ getDecrementProps: (props?: Partial<ButtonHTMLAttributes<HTMLButtonElement>>) => ButtonHTMLAttributes<HTMLButtonElement>;
15
+ getIncrementProps: (props?: Partial<ButtonHTMLAttributes<HTMLButtonElement>>) => ButtonHTMLAttributes<HTMLButtonElement>;
16
16
  };
17
17
  interface UseOrderLinesOptions {
18
18
  orderCode?: string;
@@ -22,6 +22,9 @@ interface UseOrderLinesOptions {
22
22
  min?: number;
23
23
  max?: number;
24
24
  step?: number;
25
+ callbacks?: {
26
+ preAdjust?: (orderLineId: string, quantity: number) => Promise<void>;
27
+ };
25
28
  }
26
- export declare const useOrderLinesProps: ({ orderCode, adjustable, removable, fetchActiveOrder, min, max, step, }?: UseOrderLinesOptions) => UseOrderLinesResult;
29
+ export declare const useOrderLinesProps: ({ orderCode, adjustable, removable, fetchActiveOrder, min, max, step, callbacks, }?: UseOrderLinesOptions) => UseOrderLinesResult;
27
30
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@haus-storefront-react/order-lines",
3
- "version": "0.0.7",
3
+ "version": "0.0.9",
4
4
  "main": "./index.js",
5
5
  "types": "./index.d.ts",
6
6
  "exports": {
@@ -11,10 +11,10 @@
11
11
  }
12
12
  },
13
13
  "dependencies": {
14
- "@haus-storefront-react/common-ui": "0.0.7",
15
- "@haus-storefront-react/common-utils": "0.0.7",
16
- "@haus-storefront-react/core": "0.0.7",
17
- "@haus-storefront-react/hooks": "0.0.7",
18
- "@haus-storefront-react/shared-types": "0.0.7"
14
+ "@haus-storefront-react/common-ui": "0.0.9",
15
+ "@haus-storefront-react/common-utils": "0.0.9",
16
+ "@haus-storefront-react/core": "0.0.9",
17
+ "@haus-storefront-react/hooks": "0.0.9",
18
+ "@haus-storefront-react/shared-types": "0.0.9"
19
19
  }
20
20
  }