@orderingstack/ordering-types 1.0.10 → 1.0.12

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.
@@ -36,7 +36,7 @@ export interface ILanguage {
36
36
  key: string;
37
37
  icon: any;
38
38
  }
39
- export declare type StringBoolean = "true" | "false";
39
+ export type StringBoolean = "true" | "false";
40
40
  export declare enum EProductKind {
41
41
  GROUP = "3e/group",
42
42
  PRODUCT = "3e/product",
@@ -51,13 +51,13 @@ export declare enum EProductKindBucket {
51
51
  GROUP = "group",
52
52
  PRODUCT = "product"
53
53
  }
54
- export declare type TLiterals = {
54
+ export type TLiterals = {
55
55
  name: string;
56
56
  fiscal?: string;
57
57
  "target-product-id"?: string;
58
58
  description?: string;
59
59
  };
60
- export declare type TMedia = {
60
+ export type TMedia = {
61
61
  url: string;
62
62
  name: string;
63
63
  };
@@ -101,7 +101,7 @@ export interface IProduct {
101
101
  attrs?: Record<string, string | boolean>;
102
102
  }
103
103
  export interface IProductState {
104
- selected: IProductStateFilter;
104
+ selected: IProductStateSelected;
105
105
  filter: IProductStateFilter;
106
106
  }
107
107
  export interface IProductStateFilter {
@@ -117,6 +117,10 @@ export interface IProductStateSelected {
117
117
  export interface IProductEmit {
118
118
  [id: string]: string;
119
119
  }
120
+ export interface ICategory {
121
+ id: string;
122
+ name: string;
123
+ }
120
124
  export interface IProductFilter {
121
125
  [fltCtx: string]: string[];
122
126
  }
@@ -413,8 +417,8 @@ export declare enum EOrderProductKind {
413
417
  export interface IProductLiterals {
414
418
  [propName: string]: any;
415
419
  }
416
- declare type TWeekDay = "MON" | "TUE" | "WED" | "THU" | "FRI" | "SAT" | "SUN";
417
- export declare type TSaleChannelWeek = Partial<Record<TWeekDay, {
420
+ type TWeekDay = "MON" | "TUE" | "WED" | "THU" | "FRI" | "SAT" | "SUN";
421
+ export type TSaleChannelWeek = Partial<Record<TWeekDay, {
418
422
  from: string;
419
423
  to: string;
420
424
  }[]>>;
@@ -1,6 +1,7 @@
1
1
  import React, { ReactElement } from "react";
2
- import { IProduct, IOrder } from "./index";
2
+ import { UseFormRegisterReturn } from "react-hook-form";
3
3
  import { UseTransitionProps } from "react-spring";
4
+ import { IProduct, IOrder, IProductStateSelected, IProductStateFilter } from "./index";
4
5
  import { IOrderLine } from "./index";
5
6
  export declare enum EPaymentStatus {
6
7
  UNINITIALIZED = "UNINITIALIZED",
@@ -19,24 +20,24 @@ export declare enum EPaymentStatus {
19
20
  * @
20
21
  */
21
22
  export interface ITheme {
22
- '--color-primary': string;
23
- '--color-primary-light': string;
24
- '--color-primary-dark': string;
25
- '--color-secondary': string;
26
- '--color-grey-light': string;
27
- '--color-red': string;
28
- '--color-red-light': string;
29
- '--fontFamily': string;
30
- '--fontFamily-upper': string;
31
- '--color-background': string;
32
- '--color-btn-primary': string;
33
- '--color-btn-secondary': string;
34
- '--color-btn-disabled': string;
35
- '--font-color-btn-primary': string;
36
- '--font-color-btn-secondary': string;
37
- '--font-color-btn-disabled': string;
38
- '--font-color-bg-primary': string;
39
- '--product-tile-border-color': string;
23
+ "--color-primary": string;
24
+ "--color-primary-light": string;
25
+ "--color-primary-dark": string;
26
+ "--color-secondary": string;
27
+ "--color-grey-light": string;
28
+ "--color-red": string;
29
+ "--color-red-light": string;
30
+ "--fontFamily": string;
31
+ "--fontFamily-upper": string;
32
+ "--color-background": string;
33
+ "--color-btn-primary": string;
34
+ "--color-btn-secondary": string;
35
+ "--color-btn-disabled": string;
36
+ "--font-color-btn-primary": string;
37
+ "--font-color-btn-secondary": string;
38
+ "--font-color-btn-disabled": string;
39
+ "--font-color-bg-primary": string;
40
+ "--product-tile-border-color": string;
40
41
  [property: string]: string;
41
42
  }
42
43
  export interface IMenuProps {
@@ -56,7 +57,7 @@ export interface IMenuProps {
56
57
  availabilityCheckInterval?: number;
57
58
  cols?: number;
58
59
  colsLg?: number;
59
- stacking: 'vertical' | 'horizontal';
60
+ stacking: "vertical" | "horizontal";
60
61
  transitionProps?: UseTransitionProps;
61
62
  onMenuCategoryViewed?: (category: IProduct) => void;
62
63
  goToCheckout: () => void;
@@ -81,3 +82,70 @@ export interface IMenuCategorySectionProps {
81
82
  colsLg?: number;
82
83
  MenuTile?: React.FC<IMenuTileProps>;
83
84
  }
85
+ export interface IProductConfiguratorProps {
86
+ product: IProduct;
87
+ components: IProductConfiguratorComponents;
88
+ isOpen?: boolean;
89
+ showDebugState?: boolean;
90
+ lang?: string;
91
+ handleAddToCart: (data: IAddToCartData) => void;
92
+ handleGoBack: () => void;
93
+ handleClose?: () => void;
94
+ }
95
+ export interface IAddToCartData {
96
+ price: string;
97
+ quantity: number;
98
+ selected: IProductStateSelected;
99
+ filter: IProductStateFilter;
100
+ }
101
+ export interface IProductConfiguratorComponents {
102
+ MenuProductRootUI?: React.FC<IMenuProductRootUIProps>;
103
+ MenuItemsUI?: React.FC<IMenuItemsUIProps>;
104
+ MenuOptionsUI?: React.FC<IMenuOptionsUIProps>;
105
+ MenuProductUI?: React.FC<IMenuProductUIProps>;
106
+ }
107
+ export interface IMenuProductRootUIProps {
108
+ product: IProduct;
109
+ countedProductPrice: number;
110
+ productQuantity: number;
111
+ showDebugState?: boolean;
112
+ children: ReactElement;
113
+ isOpen?: boolean;
114
+ increaseProductQuantity: () => void;
115
+ decreaseProductQuantity: () => void;
116
+ handleOnSubmit: () => void;
117
+ handleGoBack: () => void;
118
+ handleClose?: () => void;
119
+ }
120
+ export interface IMenuOptionsUIProps {
121
+ optionsItem: IProduct;
122
+ parentSelCtx: string;
123
+ selected: IProductStateSelected;
124
+ isOnSubmitted: boolean;
125
+ actualQtyCnt: number;
126
+ actualSelCnt: number;
127
+ children: ReactElement;
128
+ }
129
+ export interface IMenuProductUIProps {
130
+ product: IProduct;
131
+ nestedLvl: number;
132
+ registerProps: UseFormRegisterReturn;
133
+ inputId: string;
134
+ radioInputValue: string;
135
+ isRadio: boolean;
136
+ isCheckbox: boolean;
137
+ isCounter: boolean;
138
+ isDecrementEnabled: boolean;
139
+ isIncrementEnabled: boolean;
140
+ isChecked: boolean;
141
+ isCheckboxEnabled: boolean;
142
+ counterValue: number;
143
+ handleCounterIncrementQty: () => void;
144
+ handleCounterDecrementQty: () => void;
145
+ children: ReactElement;
146
+ }
147
+ export interface IMenuItemsUIProps {
148
+ productItems: IProduct[];
149
+ parentProduct: IProduct;
150
+ renderMenuItem: (item: IProduct) => ReactElement;
151
+ }
@@ -36,7 +36,7 @@ export interface ILanguage {
36
36
  key: string;
37
37
  icon: any;
38
38
  }
39
- export declare type StringBoolean = "true" | "false";
39
+ export type StringBoolean = "true" | "false";
40
40
  export declare enum EProductKind {
41
41
  GROUP = "3e/group",
42
42
  PRODUCT = "3e/product",
@@ -51,13 +51,13 @@ export declare enum EProductKindBucket {
51
51
  GROUP = "group",
52
52
  PRODUCT = "product"
53
53
  }
54
- export declare type TLiterals = {
54
+ export type TLiterals = {
55
55
  name: string;
56
56
  fiscal?: string;
57
57
  "target-product-id"?: string;
58
58
  description?: string;
59
59
  };
60
- export declare type TMedia = {
60
+ export type TMedia = {
61
61
  url: string;
62
62
  name: string;
63
63
  };
@@ -101,7 +101,7 @@ export interface IProduct {
101
101
  attrs?: Record<string, string | boolean>;
102
102
  }
103
103
  export interface IProductState {
104
- selected: IProductStateFilter;
104
+ selected: IProductStateSelected;
105
105
  filter: IProductStateFilter;
106
106
  }
107
107
  export interface IProductStateFilter {
@@ -117,6 +117,10 @@ export interface IProductStateSelected {
117
117
  export interface IProductEmit {
118
118
  [id: string]: string;
119
119
  }
120
+ export interface ICategory {
121
+ id: string;
122
+ name: string;
123
+ }
120
124
  export interface IProductFilter {
121
125
  [fltCtx: string]: string[];
122
126
  }
@@ -413,8 +417,8 @@ export declare enum EOrderProductKind {
413
417
  export interface IProductLiterals {
414
418
  [propName: string]: any;
415
419
  }
416
- declare type TWeekDay = "MON" | "TUE" | "WED" | "THU" | "FRI" | "SAT" | "SUN";
417
- export declare type TSaleChannelWeek = Partial<Record<TWeekDay, {
420
+ type TWeekDay = "MON" | "TUE" | "WED" | "THU" | "FRI" | "SAT" | "SUN";
421
+ export type TSaleChannelWeek = Partial<Record<TWeekDay, {
418
422
  from: string;
419
423
  to: string;
420
424
  }[]>>;
@@ -1,6 +1,7 @@
1
1
  import React, { ReactElement } from "react";
2
- import { IProduct, IOrder } from "./index";
2
+ import { UseFormRegisterReturn } from "react-hook-form";
3
3
  import { UseTransitionProps } from "react-spring";
4
+ import { IProduct, IOrder, IProductStateSelected, IProductStateFilter } from "./index";
4
5
  import { IOrderLine } from "./index";
5
6
  export declare enum EPaymentStatus {
6
7
  UNINITIALIZED = "UNINITIALIZED",
@@ -19,24 +20,24 @@ export declare enum EPaymentStatus {
19
20
  * @
20
21
  */
21
22
  export interface ITheme {
22
- '--color-primary': string;
23
- '--color-primary-light': string;
24
- '--color-primary-dark': string;
25
- '--color-secondary': string;
26
- '--color-grey-light': string;
27
- '--color-red': string;
28
- '--color-red-light': string;
29
- '--fontFamily': string;
30
- '--fontFamily-upper': string;
31
- '--color-background': string;
32
- '--color-btn-primary': string;
33
- '--color-btn-secondary': string;
34
- '--color-btn-disabled': string;
35
- '--font-color-btn-primary': string;
36
- '--font-color-btn-secondary': string;
37
- '--font-color-btn-disabled': string;
38
- '--font-color-bg-primary': string;
39
- '--product-tile-border-color': string;
23
+ "--color-primary": string;
24
+ "--color-primary-light": string;
25
+ "--color-primary-dark": string;
26
+ "--color-secondary": string;
27
+ "--color-grey-light": string;
28
+ "--color-red": string;
29
+ "--color-red-light": string;
30
+ "--fontFamily": string;
31
+ "--fontFamily-upper": string;
32
+ "--color-background": string;
33
+ "--color-btn-primary": string;
34
+ "--color-btn-secondary": string;
35
+ "--color-btn-disabled": string;
36
+ "--font-color-btn-primary": string;
37
+ "--font-color-btn-secondary": string;
38
+ "--font-color-btn-disabled": string;
39
+ "--font-color-bg-primary": string;
40
+ "--product-tile-border-color": string;
40
41
  [property: string]: string;
41
42
  }
42
43
  export interface IMenuProps {
@@ -56,7 +57,7 @@ export interface IMenuProps {
56
57
  availabilityCheckInterval?: number;
57
58
  cols?: number;
58
59
  colsLg?: number;
59
- stacking: 'vertical' | 'horizontal';
60
+ stacking: "vertical" | "horizontal";
60
61
  transitionProps?: UseTransitionProps;
61
62
  onMenuCategoryViewed?: (category: IProduct) => void;
62
63
  goToCheckout: () => void;
@@ -81,3 +82,70 @@ export interface IMenuCategorySectionProps {
81
82
  colsLg?: number;
82
83
  MenuTile?: React.FC<IMenuTileProps>;
83
84
  }
85
+ export interface IProductConfiguratorProps {
86
+ product: IProduct;
87
+ components: IProductConfiguratorComponents;
88
+ isOpen?: boolean;
89
+ showDebugState?: boolean;
90
+ lang?: string;
91
+ handleAddToCart: (data: IAddToCartData) => void;
92
+ handleGoBack: () => void;
93
+ handleClose?: () => void;
94
+ }
95
+ export interface IAddToCartData {
96
+ price: string;
97
+ quantity: number;
98
+ selected: IProductStateSelected;
99
+ filter: IProductStateFilter;
100
+ }
101
+ export interface IProductConfiguratorComponents {
102
+ MenuProductRootUI?: React.FC<IMenuProductRootUIProps>;
103
+ MenuItemsUI?: React.FC<IMenuItemsUIProps>;
104
+ MenuOptionsUI?: React.FC<IMenuOptionsUIProps>;
105
+ MenuProductUI?: React.FC<IMenuProductUIProps>;
106
+ }
107
+ export interface IMenuProductRootUIProps {
108
+ product: IProduct;
109
+ countedProductPrice: number;
110
+ productQuantity: number;
111
+ showDebugState?: boolean;
112
+ children: ReactElement;
113
+ isOpen?: boolean;
114
+ increaseProductQuantity: () => void;
115
+ decreaseProductQuantity: () => void;
116
+ handleOnSubmit: () => void;
117
+ handleGoBack: () => void;
118
+ handleClose?: () => void;
119
+ }
120
+ export interface IMenuOptionsUIProps {
121
+ optionsItem: IProduct;
122
+ parentSelCtx: string;
123
+ selected: IProductStateSelected;
124
+ isOnSubmitted: boolean;
125
+ actualQtyCnt: number;
126
+ actualSelCnt: number;
127
+ children: ReactElement;
128
+ }
129
+ export interface IMenuProductUIProps {
130
+ product: IProduct;
131
+ nestedLvl: number;
132
+ registerProps: UseFormRegisterReturn;
133
+ inputId: string;
134
+ radioInputValue: string;
135
+ isRadio: boolean;
136
+ isCheckbox: boolean;
137
+ isCounter: boolean;
138
+ isDecrementEnabled: boolean;
139
+ isIncrementEnabled: boolean;
140
+ isChecked: boolean;
141
+ isCheckboxEnabled: boolean;
142
+ counterValue: number;
143
+ handleCounterIncrementQty: () => void;
144
+ handleCounterDecrementQty: () => void;
145
+ children: ReactElement;
146
+ }
147
+ export interface IMenuItemsUIProps {
148
+ productItems: IProduct[];
149
+ parentProduct: IProduct;
150
+ renderMenuItem: (item: IProduct) => ReactElement;
151
+ }
package/package.json CHANGED
@@ -1,22 +1,23 @@
1
- {
2
- "name": "@orderingstack/ordering-types",
3
- "version": "1.0.10",
4
- "description": "Typescript types for @orderingstack",
5
- "types": "dist/esm/index.d.ts",
6
- "main": "dist/cjs/index.js",
7
- "module": "dist/esm/index.js",
8
- "files": [
9
- "dist/"
10
- ],
11
- "scripts": {
12
- "build": "tsc -p tsconfig.json && tsc -p tsconfig-cjs.json",
13
- "prepublishOnly": "npm run build"
14
- },
15
- "author": "Tomasz Rojek <tomasz.rojek@e3.pl>",
16
- "devDependencies": {
17
- "@types/react": "^18.0.26",
18
- "react": "^18.2.0",
19
- "react-spring": "^9.6.1",
20
- "typescript": "next"
21
- }
22
- }
1
+ {
2
+ "name": "@orderingstack/ordering-types",
3
+ "version": "1.0.12",
4
+ "description": "Typescript types for @orderingstack",
5
+ "types": "dist/esm/index.d.ts",
6
+ "main": "dist/cjs/index.js",
7
+ "module": "dist/esm/index.js",
8
+ "files": [
9
+ "dist/"
10
+ ],
11
+ "scripts": {
12
+ "build": "tsc -p tsconfig.json && tsc -p tsconfig-cjs.json",
13
+ "prepublishOnly": "npm run build"
14
+ },
15
+ "author": "Tomasz Rojek <tomasz.rojek@e3.pl>",
16
+ "devDependencies": {
17
+ "@types/react": "^18.0.26",
18
+ "react": "^18.2.0",
19
+ "react-hook-form": "^7.42.0",
20
+ "react-spring": "^9.6.1",
21
+ "typescript": "next"
22
+ }
23
+ }