@tabres/react 1.0.19 → 1.0.22

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.
Files changed (179) hide show
  1. package/dist/components/PublicMenu/OrderDrawer/OrderDrawerDetails.d.ts +2 -2
  2. package/dist/components/PublicMenu/ProductVariants/ProductVariants.d.ts +1 -1
  3. package/dist/constants/constants/env.d.ts +1 -1
  4. package/dist/constants/env.d.ts +1 -1
  5. package/dist/index.d.ts +0 -1
  6. package/dist/index.esm.js +1 -1
  7. package/dist/index.esm.js.map +1 -1
  8. package/dist/index.js +1 -1
  9. package/dist/index.js.map +1 -1
  10. package/dist/models/constants/env.d.ts +1 -1
  11. package/dist/models/index.esm.js.map +1 -1
  12. package/dist/models/index.js.map +1 -1
  13. package/dist/models/modules/addon/models.d.ts +7 -0
  14. package/dist/models/modules/customer/services.d.ts +3 -1
  15. package/dist/models/modules/order/constants.d.ts +2 -5
  16. package/dist/models/modules/order/hooks.d.ts +3 -7
  17. package/dist/models/modules/order/models.d.ts +55 -18
  18. package/dist/models/modules/order/services.d.ts +2 -1
  19. package/dist/models/modules/order/utils/item-price.d.ts +3 -0
  20. package/dist/models/modules/order/utils.d.ts +3 -19
  21. package/dist/models/modules/product/models.d.ts +13 -1
  22. package/dist/models/modules/product/utils/listing-price.d.ts +9 -0
  23. package/dist/models/modules/product/utils/order-price.d.ts +11 -0
  24. package/dist/models/modules/product/utils.d.ts +2 -42
  25. package/dist/models/services/api/client.d.ts +3 -0
  26. package/dist/modules/addon/models.d.ts +7 -0
  27. package/dist/modules/addon/utils.d.ts +0 -9
  28. package/dist/modules/customer/services.d.ts +3 -1
  29. package/dist/modules/order/constants.d.ts +2 -5
  30. package/dist/modules/order/hooks.d.ts +3 -7
  31. package/dist/modules/order/hooks.price.test.d.ts +1 -0
  32. package/dist/modules/order/models.d.ts +55 -18
  33. package/dist/modules/order/preview.d.ts +8 -0
  34. package/dist/modules/order/preview.test.d.ts +1 -0
  35. package/dist/modules/order/services.d.ts +2 -1
  36. package/dist/modules/order/utils/item-price.d.ts +3 -0
  37. package/dist/modules/order/utils/item-price.test.d.ts +1 -0
  38. package/dist/modules/order/utils.d.ts +3 -19
  39. package/dist/modules/product/models.d.ts +13 -1
  40. package/dist/modules/product/utils/listing-price.d.ts +9 -0
  41. package/dist/modules/product/utils/listing-price.test.d.ts +1 -0
  42. package/dist/modules/product/utils/order-price.d.ts +11 -0
  43. package/dist/modules/product/utils/order-price.test.d.ts +1 -0
  44. package/dist/modules/product/utils.d.ts +2 -42
  45. package/dist/services/api/client.d.ts +3 -0
  46. package/dist/styles/ui.css +1 -1
  47. package/dist/styles/ui.css.map +1 -1
  48. package/dist/utils/components/PublicMenu/OrderMethods/OrderMethods.types.d.ts +9 -0
  49. package/dist/utils/components/PublicMenu/ProductsGridItem/ProductsGridItem.types.d.ts +13 -0
  50. package/dist/utils/constants/env.d.ts +1 -0
  51. package/dist/utils/hooks/translation.d.ts +5 -0
  52. package/dist/utils/index.esm.js +1 -1
  53. package/dist/utils/index.esm.js.map +1 -1
  54. package/dist/utils/index.js +1 -1
  55. package/dist/utils/index.js.map +1 -1
  56. package/dist/utils/models/index.d.ts +16 -0
  57. package/dist/utils/modules/addon/models.d.ts +7 -0
  58. package/dist/utils/modules/addon/utils.d.ts +0 -9
  59. package/dist/utils/modules/branch/hooks.d.ts +16 -0
  60. package/dist/utils/modules/branch/utils.d.ts +7 -0
  61. package/dist/utils/modules/business/constants.d.ts +2 -0
  62. package/dist/utils/modules/business/hooks.d.ts +15 -0
  63. package/dist/utils/modules/common/services.d.ts +1 -0
  64. package/dist/utils/modules/customer/hooks.d.ts +5 -0
  65. package/dist/utils/modules/customer/services.d.ts +11 -0
  66. package/dist/utils/modules/menu/hooks.d.ts +1 -0
  67. package/dist/utils/modules/menu/index.d.ts +3 -0
  68. package/dist/utils/modules/order/constants.d.ts +2 -5
  69. package/dist/utils/modules/order/hooks.d.ts +14 -0
  70. package/dist/utils/modules/order/index.d.ts +5 -0
  71. package/dist/utils/modules/order/models.d.ts +55 -18
  72. package/dist/utils/modules/order/services.d.ts +5 -0
  73. package/dist/utils/modules/order/utils/item-price.d.ts +3 -0
  74. package/dist/utils/modules/order/utils.d.ts +3 -19
  75. package/dist/utils/modules/product/hooks.d.ts +9 -0
  76. package/dist/utils/modules/product/index.d.ts +3 -0
  77. package/dist/utils/modules/product/models.d.ts +13 -1
  78. package/dist/utils/modules/product/utils/listing-price.d.ts +9 -0
  79. package/dist/utils/modules/product/utils/order-price.d.ts +11 -0
  80. package/dist/utils/modules/product/utils.d.ts +3 -43
  81. package/dist/utils/modules/store/hooks.d.ts +6 -0
  82. package/dist/utils/modules/table/hooks.d.ts +4 -0
  83. package/dist/utils/modules/view/hooks.d.ts +2 -0
  84. package/dist/utils/modules/view/index.d.ts +4 -0
  85. package/dist/utils/modules/view/models.d.ts +7 -0
  86. package/dist/utils/modules/view/services.d.ts +2 -0
  87. package/dist/utils/services/api/client.d.ts +3 -0
  88. package/dist/utils/services/translation/index.d.ts +3 -0
  89. package/dist/utils/services/translation/locales/az/auth.d.ts +7 -0
  90. package/dist/utils/services/translation/locales/az/branch.d.ts +14 -0
  91. package/dist/utils/services/translation/locales/az/common.d.ts +6 -0
  92. package/dist/utils/services/translation/locales/az/customer.d.ts +17 -0
  93. package/dist/utils/services/translation/locales/az/error.d.ts +20 -0
  94. package/dist/utils/services/translation/locales/az/events.d.ts +8 -0
  95. package/dist/utils/services/translation/locales/az/index.d.ts +149 -0
  96. package/dist/utils/services/translation/locales/az/order.d.ts +47 -0
  97. package/dist/utils/services/translation/locales/az/pricing.d.ts +35 -0
  98. package/dist/utils/services/translation/locales/en/auth.d.ts +2 -0
  99. package/dist/utils/services/translation/locales/en/branch.d.ts +10 -0
  100. package/dist/utils/services/translation/locales/en/common.d.ts +2 -0
  101. package/dist/utils/services/translation/locales/en/customer.d.ts +2 -0
  102. package/dist/utils/services/translation/locales/en/error.d.ts +17 -0
  103. package/dist/utils/services/translation/locales/en/events.d.ts +2 -0
  104. package/dist/utils/services/translation/locales/en/index.d.ts +34 -0
  105. package/dist/utils/services/translation/locales/en/order.d.ts +2 -0
  106. package/dist/utils/services/translation/locales/en/pricing.d.ts +2 -0
  107. package/dist/utils/services/translation/locales/et/auth.d.ts +7 -0
  108. package/dist/utils/services/translation/locales/et/branch.d.ts +13 -0
  109. package/dist/utils/services/translation/locales/et/common.d.ts +6 -0
  110. package/dist/utils/services/translation/locales/et/customer.d.ts +17 -0
  111. package/dist/utils/services/translation/locales/et/error.d.ts +20 -0
  112. package/dist/utils/services/translation/locales/et/events.d.ts +8 -0
  113. package/dist/utils/services/translation/locales/et/index.d.ts +147 -0
  114. package/dist/utils/services/translation/locales/et/order.d.ts +46 -0
  115. package/dist/utils/services/translation/locales/et/pricing.d.ts +35 -0
  116. package/dist/utils/services/translation/locales/hr/auth.d.ts +7 -0
  117. package/dist/utils/services/translation/locales/hr/branch.d.ts +14 -0
  118. package/dist/utils/services/translation/locales/hr/common.d.ts +6 -0
  119. package/dist/utils/services/translation/locales/hr/customer.d.ts +17 -0
  120. package/dist/utils/services/translation/locales/hr/error.d.ts +20 -0
  121. package/dist/utils/services/translation/locales/hr/events.d.ts +8 -0
  122. package/dist/utils/services/translation/locales/hr/index.d.ts +149 -0
  123. package/dist/utils/services/translation/locales/hr/order.d.ts +47 -0
  124. package/dist/utils/services/translation/locales/hr/pricing.d.ts +35 -0
  125. package/dist/utils/services/translation/locales/index.d.ts +1212 -0
  126. package/dist/utils/services/translation/locales/nl/auth.d.ts +7 -0
  127. package/dist/utils/services/translation/locales/nl/branch.d.ts +13 -0
  128. package/dist/utils/services/translation/locales/nl/common.d.ts +6 -0
  129. package/dist/utils/services/translation/locales/nl/customer.d.ts +17 -0
  130. package/dist/utils/services/translation/locales/nl/error.d.ts +20 -0
  131. package/dist/utils/services/translation/locales/nl/events.d.ts +8 -0
  132. package/dist/utils/services/translation/locales/nl/index.d.ts +147 -0
  133. package/dist/utils/services/translation/locales/nl/order.d.ts +46 -0
  134. package/dist/utils/services/translation/locales/nl/pricing.d.ts +35 -0
  135. package/dist/utils/services/translation/locales/pl/auth.d.ts +7 -0
  136. package/dist/utils/services/translation/locales/pl/branch.d.ts +14 -0
  137. package/dist/utils/services/translation/locales/pl/common.d.ts +6 -0
  138. package/dist/utils/services/translation/locales/pl/customer.d.ts +17 -0
  139. package/dist/utils/services/translation/locales/pl/error.d.ts +20 -0
  140. package/dist/utils/services/translation/locales/pl/events.d.ts +8 -0
  141. package/dist/utils/services/translation/locales/pl/index.d.ts +149 -0
  142. package/dist/utils/services/translation/locales/pl/order.d.ts +47 -0
  143. package/dist/utils/services/translation/locales/pl/pricing.d.ts +35 -0
  144. package/dist/utils/services/translation/locales/pt/auth.d.ts +7 -0
  145. package/dist/utils/services/translation/locales/pt/branch.d.ts +14 -0
  146. package/dist/utils/services/translation/locales/pt/common.d.ts +6 -0
  147. package/dist/utils/services/translation/locales/pt/customer.d.ts +17 -0
  148. package/dist/utils/services/translation/locales/pt/error.d.ts +20 -0
  149. package/dist/utils/services/translation/locales/pt/events.d.ts +8 -0
  150. package/dist/utils/services/translation/locales/pt/index.d.ts +149 -0
  151. package/dist/utils/services/translation/locales/pt/order.d.ts +47 -0
  152. package/dist/utils/services/translation/locales/pt/pricing.d.ts +35 -0
  153. package/dist/utils/services/translation/locales/ru/auth.d.ts +7 -0
  154. package/dist/utils/services/translation/locales/ru/branch.d.ts +13 -0
  155. package/dist/utils/services/translation/locales/ru/common.d.ts +6 -0
  156. package/dist/utils/services/translation/locales/ru/customer.d.ts +17 -0
  157. package/dist/utils/services/translation/locales/ru/error.d.ts +20 -0
  158. package/dist/utils/services/translation/locales/ru/events.d.ts +8 -0
  159. package/dist/utils/services/translation/locales/ru/index.d.ts +147 -0
  160. package/dist/utils/services/translation/locales/ru/order.d.ts +46 -0
  161. package/dist/utils/services/translation/locales/ru/pricing.d.ts +35 -0
  162. package/dist/utils/services/translation/locales/tr/auth.d.ts +7 -0
  163. package/dist/utils/services/translation/locales/tr/branch.d.ts +13 -0
  164. package/dist/utils/services/translation/locales/tr/common.d.ts +6 -0
  165. package/dist/utils/services/translation/locales/tr/customer.d.ts +17 -0
  166. package/dist/utils/services/translation/locales/tr/error.d.ts +20 -0
  167. package/dist/utils/services/translation/locales/tr/events.d.ts +8 -0
  168. package/dist/utils/services/translation/locales/tr/index.d.ts +147 -0
  169. package/dist/utils/services/translation/locales/tr/order.d.ts +46 -0
  170. package/dist/utils/services/translation/locales/tr/pricing.d.ts +35 -0
  171. package/dist/utils/store/index.d.ts +7 -0
  172. package/dist/utils/store/order.d.ts +42 -0
  173. package/package.json +1 -1
  174. package/dist/components/Pricing/Pricing.d.ts +0 -11
  175. package/dist/components/Pricing/PricingPlanAmount.d.ts +0 -9
  176. package/dist/components/Pricing/index.d.ts +0 -1
  177. package/dist/models/modules/addon/utils.d.ts +0 -14
  178. package/dist/models/services/api/index.d.ts +0 -5
  179. package/dist/services/api/index.d.ts +0 -5
@@ -1,13 +1,10 @@
1
- import { OrderStep, PaymentMethod } from "./models";
1
+ import { OrderPreviewState, OrderStep, PaymentMethod } from "./models";
2
2
  export declare const initialOrder: {
3
3
  orderType: any;
4
- totalPriceWithTax: number;
5
- totalPriceWithoutTax: number;
6
- totalTax: number;
7
- vat: number;
8
4
  paymentMethod: PaymentMethod;
9
5
  };
10
6
  export declare const ORDER_STEPS: OrderStep[];
7
+ export declare const initialPreviewState: OrderPreviewState;
11
8
  export declare enum OrderErrors {
12
9
  FIELD_REQUIRED_ERROR = "This field is required",
13
10
  TABLE_NOT_SELECTED = "Please select a table",
@@ -1,6 +1,6 @@
1
- import { Order, OrderFormattedPriceDetails, OrderItem, OrderPayload, OrderPriceDetails, SelectedAddons } from "./models";
2
- export declare const useOrderPriceDetails: () => OrderPriceDetails;
3
- export declare const useOrderFormattedPriceDetails: () => OrderFormattedPriceDetails;
1
+ import { Order, OrderPayload, SelectedAddons } from "./models";
2
+ export declare const useOrderTotalRawPriceWithTax: () => number;
3
+ export declare const useOrderTotalPriceWithTax: () => string;
4
4
  export declare const usePrepareOrder: (existingOrderData?: Partial<Order>) => OrderPayload;
5
5
  export declare const useTotalOrderItemsCount: () => number;
6
6
  export declare const useProductQuantityInOrder: ({ productId, variantId, selectedAddons, }: {
@@ -9,10 +9,6 @@ export declare const useProductQuantityInOrder: ({ productId, variantId, selecte
9
9
  selectedAddons: SelectedAddons;
10
10
  }) => number;
11
11
  export declare const useProductQuantityInOrderWithAllVariants: (productId: number) => number;
12
- export declare const useOrderItemPrice: (item: OrderItem) => {
13
- totalPrice: number;
14
- formattedTotalPrice: string;
15
- };
16
12
  export declare const useDeliveryDistanceError: () => string | null;
17
13
  export declare const useDeliveryAmountError: () => string | null;
18
14
  export declare const useOrderErrorInDetails: () => string | null;
@@ -0,0 +1 @@
1
+ import "@testing-library/jest-dom";
@@ -31,6 +31,7 @@ export declare enum PaymentMethod {
31
31
  }
32
32
  export interface OrderAddonOption {
33
33
  optionId: number;
34
+ /** Gross unit price (listingPrice from the menu listing). */
34
35
  price: number;
35
36
  }
36
37
  export interface OrderAddon {
@@ -44,6 +45,7 @@ export interface SelectedAddons {
44
45
  export interface OrderItemVariant {
45
46
  id?: number;
46
47
  variantId: number;
48
+ /** Gross unit price (listingPrice from the menu listing). */
47
49
  price: number;
48
50
  }
49
51
  export interface OrderItem {
@@ -51,12 +53,16 @@ export interface OrderItem {
51
53
  productId: number;
52
54
  orderId?: number;
53
55
  quantity: number;
54
- price: number;
56
+ /**
57
+ * Gross unit price (listingPrice) at the moment the line was added. The
58
+ * server recomputes authoritative totals on create/preview; this value is
59
+ * what the cart UI displays.
60
+ */
61
+ price?: number;
55
62
  variant?: OrderItemVariant;
56
63
  addons: OrderAddon[];
57
64
  note?: string;
58
65
  status?: OrderItemStatus;
59
- vat?: number;
60
66
  isPaid?: boolean;
61
67
  sellUnitType: productModels.SellUnitType;
62
68
  }
@@ -68,20 +74,13 @@ export interface Order {
68
74
  tableId?: number;
69
75
  employeeId?: number;
70
76
  orderType: OrderType;
71
- totalPriceWithTax: number;
72
- totalPriceWithTaxAndFees?: number;
73
- totalPriceWithoutTax: number;
74
- totalTax: number;
75
77
  items: OrderItem[];
76
78
  status?: OrderStatus;
77
- vat?: number;
78
79
  paymentMethod?: PaymentMethod;
79
80
  note?: string;
80
81
  createdAt?: number;
81
82
  updatedAt?: number;
82
83
  customer?: customerModels.Customer;
83
- deliveryFee?: number;
84
- serviceFee?: number;
85
84
  currency?: string;
86
85
  trackingId?: string;
87
86
  }
@@ -98,15 +97,53 @@ export interface OrderPayload extends Order {
98
97
  customerId: number;
99
98
  language?: string;
100
99
  }
101
- export type OrderPriceDetails = {
100
+ export interface CalculatePreviewItemRequest {
101
+ orderItemsId: string;
102
+ productId: number;
103
+ quantity: number;
104
+ variant?: {
105
+ variantId: number;
106
+ };
107
+ addons?: Array<{
108
+ addonId: number;
109
+ options: Array<{
110
+ optionId: number;
111
+ }>;
112
+ }>;
113
+ }
114
+ export interface CalculatePreviewRequest {
115
+ businessId?: number;
116
+ branchId: number;
117
+ orderType: OrderType;
118
+ items: CalculatePreviewItemRequest[];
119
+ }
120
+ export interface CalculatePreviewTax {
121
+ branchTaxId: number;
122
+ name: Record<string, string>;
123
+ rate: number;
124
+ type: "percentage" | "fixed";
125
+ addToListingPrice: boolean;
126
+ amount: number;
127
+ }
128
+ export interface CalculatePreviewLine {
129
+ orderItemsId: string;
130
+ productId: number;
131
+ quantity: number;
132
+ price: number;
133
+ taxes: CalculatePreviewTax[];
134
+ }
135
+ export interface CalculatePreviewResponse {
136
+ totalPriceWithoutTax: number;
102
137
  totalPriceWithTax: number;
103
138
  totalPriceWithTaxAndFees: number;
104
- totalPriceWithoutTax: number;
105
139
  totalTax: number;
106
- };
107
- export type OrderFormattedPriceDetails = {
108
- totalPriceWithTax: string;
109
- totalPriceWithTaxAndFees: string;
110
- totalPriceWithoutTax: string;
111
- totalTax: string;
112
- };
140
+ deliveryFee: number;
141
+ serviceFee: number;
142
+ items: CalculatePreviewLine[];
143
+ taxes: CalculatePreviewTax[];
144
+ }
145
+ export interface OrderPreviewState {
146
+ data: CalculatePreviewResponse | null;
147
+ isLoading: boolean;
148
+ error: string | null;
149
+ }
@@ -0,0 +1,8 @@
1
+ import { ReactNode } from "react";
2
+ import { OrderPreviewState } from "./models";
3
+ type ProviderProps = {
4
+ children: ReactNode;
5
+ };
6
+ export declare const OrderPreviewProvider: ({ children }: ProviderProps) => import("react/jsx-runtime").JSX.Element;
7
+ export declare const useOrderPreview: () => OrderPreviewState;
8
+ export {};
@@ -0,0 +1 @@
1
+ import "@testing-library/jest-dom";
@@ -1,4 +1,5 @@
1
- import { OrderPayload } from "./models";
1
+ import { CalculatePreviewRequest, CalculatePreviewResponse, OrderPayload } from "./models";
2
2
  export declare const createOrder: (order: OrderPayload) => Promise<{
3
3
  trackingId: string;
4
4
  }>;
5
+ export declare const calculate: (payload: CalculatePreviewRequest, signal?: AbortSignal) => Promise<CalculatePreviewResponse>;
@@ -0,0 +1,3 @@
1
+ import { OrderItem } from "../models";
2
+ export declare const getOrderItemListingRawPrice: (orderItem: OrderItem) => number;
3
+ export declare const getOrderItemListingPrice: (orderItem: OrderItem, currency: string, language: string) => string;
@@ -0,0 +1 @@
1
+ export {};
@@ -1,29 +1,13 @@
1
1
  import { IconType } from "@sorocraft/ui";
2
- import { Order, OrderAddon, OrderItem, OrderStatus, OrderType, SelectedAddons } from "./models";
2
+ import { CalculatePreviewResponse, Order, OrderAddon, OrderItem, OrderStatus, OrderType, SelectedAddons } from "./models";
3
3
  import * as addonModels from "../addon/models";
4
4
  import * as branchModels from "../branch/models";
5
5
  import { OrderErrors } from "./constants";
6
- export declare const calculatSingleAddonTotalPrice: (addon: OrderAddon) => number;
7
- export declare function calculateTotalAddonPrice(addons?: OrderAddon[], quantity?: number): number;
8
- export declare const getOrderPrice: (order: Order, currency: string, language: string) => {
9
- totalWithoutTax: number;
10
- totalWithoutTaxFormatted: string;
11
- totalTax: number;
12
- totalTaxFormatted: string;
13
- totalWithTax: number;
14
- totalWithTaxFormatted: string;
15
- };
16
6
  export declare const generateOrderItemsId: (productId: number, variantId: number | null, selectedAddons?: SelectedAddons) => string;
17
- export declare const getOrderItemPrice: (orderItem: OrderItem) => {
18
- totalGross: number;
19
- totalNet: number;
20
- totalTax: number;
21
- itemGrossPrice: number;
22
- itemNetPrice: number;
23
- itemTax: number;
24
- };
25
7
  export declare const getSelectedAddonsFromOrderItems: (item: OrderItem) => SelectedAddons;
26
8
  export declare const getStatusIcon: (status: OrderStatus) => IconType;
27
9
  export declare const buildSelectedAddonsPayload: (productAddons?: addonModels.MenuAddon[], selectedAddons?: SelectedAddons) => OrderAddon[];
28
10
  export declare const getDefaultOrderType: (settings: branchModels.BranchSettings, isOpen: boolean, isDelivering: boolean) => OrderType | null;
11
+ export declare const isValidPreviewResponse: (data: unknown) => data is CalculatePreviewResponse;
29
12
  export declare const getOrderErrorMessages: (field: keyof Order) => OrderErrors;
13
+ export * from "./utils/item-price";
@@ -5,7 +5,13 @@ export interface LocalizedContent {
5
5
  }
6
6
  export interface ProductVariant {
7
7
  id?: number;
8
+ /** Net price (tax-exclusive) — server-of-record value. */
8
9
  price: number;
10
+ /**
11
+ * Gross price for menu display: net price plus any branch taxes flagged
12
+ * `addToListingPrice`. Equals `price` when no branch context is supplied.
13
+ */
14
+ listingPrice: number;
9
15
  /** Title keyed by language code, e.g. { en: "Large", az: "Böyük" }. */
10
16
  title: Record<string, string>;
11
17
  productId?: number;
@@ -14,8 +20,14 @@ export interface ProductVariant {
14
20
  export interface Product {
15
21
  id: number;
16
22
  categoryId: number;
17
- vat?: number;
23
+ /** Net price (tax-exclusive). Nullable when the product has no own price (variant-only). */
18
24
  price: number;
25
+ /**
26
+ * Gross price for menu display: net price plus any branch taxes flagged
27
+ * `addToListingPrice`. Equals `price` when no branch context is supplied,
28
+ * and is null when `price` itself is null.
29
+ */
30
+ listingPrice?: number | null;
19
31
  volume?: string;
20
32
  image160?: string;
21
33
  image580?: string;
@@ -0,0 +1,9 @@
1
+ import { Product, ProductVariant } from "../models";
2
+ import { MenuAddonOption } from "src/models";
3
+ export declare const getUnitListingPrice: (item: {
4
+ price?: number | null;
5
+ listingPrice?: number | null;
6
+ }) => number;
7
+ export declare const getProductListingPrice: (product: Product, currency: string, language: string) => string;
8
+ export declare const getVariantListingPrice: (variant: ProductVariant, currency: string, language: string) => string;
9
+ export declare const getOptionListingPrice: (option: MenuAddonOption, currency: string, language: string) => string;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,11 @@
1
+ import * as orderModels from "src/modules/order/models";
2
+ import { Product } from "../models";
3
+ export declare const getAllSelectedOptionsListingPrice: (product: Pick<Product, "addons">, selectedAddons?: orderModels.SelectedAddons) => number;
4
+ export declare const getProductOrderPrice: ({ product, quantity, language, currency, variantId, selectedAddons, }: {
5
+ product: Product;
6
+ quantity: number;
7
+ language: string;
8
+ currency: string;
9
+ variantId?: number;
10
+ selectedAddons?: Record<number, number | number[]>;
11
+ }) => string;
@@ -0,0 +1 @@
1
+ export {};
@@ -1,50 +1,8 @@
1
1
  import { LocalizedContent, Product, ProductVariant, SellUnitType } from "./models";
2
2
  import { MenuAddon } from "src/modules/addon/models";
3
- import * as orderModels from "src/modules/order/models";
4
- export declare const calculateTotalPrice: (price?: number, quantity?: number, vat?: number) => number;
5
3
  export declare const getProductTranslation: (product: Pick<Product, "translations">, language: string) => LocalizedContent;
6
- export declare const getProductRawPrice: (product: Pick<Product, "price" | "vat">, quantity?: number) => number;
7
- export declare const getProductPrice: (product: Pick<Product, "price" | "vat">, currency: string, language: string, quantity?: number) => {
8
- totalPrice: number;
9
- formattedTotalPrice: string;
10
- };
11
4
  export declare const getProductVariant: (product: Pick<Product, "variants">, variantId: number) => ProductVariant;
12
- export declare const getSelectedOptionsTotalPrice: (product: Product, selectedAddons: orderModels.SelectedAddons, quantity: number) => number;
13
- export declare const getProductVariantRawPrice: (variantId: number, product: Pick<Product, "variants" | "vat">, quantity?: number) => number;
14
- export declare const getProductVariantPrice: ({ variantId, currency, language, product, quantity, }: {
15
- variantId: number;
16
- currency?: string;
17
- language?: string;
18
- product: Pick<Product, "variants" | "vat">;
19
- quantity?: number;
20
- }) => {
21
- totalPrice: number;
22
- formattedTotalPrice: string;
23
- };
24
5
  export declare const getProductVariantTranslation: (variant: ProductVariant, language: string) => string;
25
- export declare const getProductOrderRawPrice: ({ product, variantId, quantity, selectedAddons, noVat, }: {
26
- product: Product;
27
- variantId: number | null;
28
- quantity: number;
29
- selectedAddons: orderModels.SelectedAddons;
30
- noVat?: boolean;
31
- }) => {
32
- price: number;
33
- optionsPrice: number;
34
- total: number;
35
- };
36
- export declare const getProductOrderPrice: ({ product, variantId, quantity, currency, language, selectedAddons, noVat, }: {
37
- product: Product;
38
- variantId: number | null;
39
- quantity: number;
40
- currency: string;
41
- language: string;
42
- selectedAddons: orderModels.SelectedAddons;
43
- noVat?: boolean;
44
- }) => {
45
- totalPrice: number;
46
- formattedTotalPrice: string;
47
- };
48
6
  export declare const getProductAddon: (product: Product, addonId: number) => MenuAddon;
49
7
  export declare const getPriceSuffix: (sellUnitType: SellUnitType) => "" | " / kg" | " / l";
50
8
  export declare const getProductSellUnitShortCuts: (sellUnitType: SellUnitType) => {
@@ -183,3 +141,5 @@ export declare const getProductSellUnitShortCuts: (sellUnitType: SellUnitType) =
183
141
  "10l"?: undefined;
184
142
  "20l"?: undefined;
185
143
  };
144
+ export * from "./utils/listing-price";
145
+ export * from "./utils/order-price";
@@ -0,0 +1,3 @@
1
+ import { HttpClient } from "@sorocraft/js-utils";
2
+ declare const httpClient: HttpClient;
3
+ export default httpClient;