ordering-ui-react-native 0.21.63 → 0.21.64-release

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 (163) hide show
  1. package/package.json +6 -7
  2. package/src/DeliveryApp.tsx +43 -1
  3. package/src/components/BusinessesListing/index.tsx +1 -1
  4. package/src/components/PaymentOptionsWebView/index.tsx +1 -0
  5. package/src/components/StripeMethodForm/index.tsx +6 -4
  6. package/src/components/VerifyPhone/styles.tsx +1 -2
  7. package/src/types/index.tsx +3 -1
  8. package/themes/business/index.tsx +4 -0
  9. package/themes/business/src/components/AcceptOrRejectOrder/index.tsx +9 -6
  10. package/themes/business/src/components/AcceptOrRejectOrder/styles.tsx +1 -0
  11. package/themes/business/src/components/Chat/index.tsx +3 -1
  12. package/themes/business/src/components/DriverMap/index.tsx +36 -23
  13. package/themes/business/src/components/GoogleMap/index.tsx +15 -8
  14. package/themes/business/src/components/Home/index.tsx +5 -1
  15. package/themes/business/src/components/LanguageSelector/index.tsx +1 -2
  16. package/themes/business/src/components/LanguageSelector/lang_country.json +515 -70
  17. package/themes/business/src/components/LogoutButton/index.tsx +1 -1
  18. package/themes/business/src/components/MapView/index.tsx +30 -15
  19. package/themes/business/src/components/NewOrderNotification/index.tsx +76 -26
  20. package/themes/business/src/components/OrderDetails/Business.tsx +63 -7
  21. package/themes/business/src/components/OrderDetails/Delivery.tsx +36 -21
  22. package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +107 -56
  23. package/themes/business/src/components/OrderDetails/OrderHeaderComponent.tsx +61 -35
  24. package/themes/business/src/components/OrderDetails/styles.tsx +29 -3
  25. package/themes/business/src/components/OrderDetails/usePrinterCommands.tsx +220 -0
  26. package/themes/business/src/components/OrderSummary/index.tsx +240 -76
  27. package/themes/business/src/components/OrdersListManager/index.tsx +9 -1
  28. package/themes/business/src/components/OrdersOption/index.tsx +249 -126
  29. package/themes/business/src/components/PhoneInputNumber/index.tsx +8 -5
  30. package/themes/business/src/components/PreviousMessages/index.tsx +12 -0
  31. package/themes/business/src/components/PreviousOrders/OrderItem.tsx +29 -19
  32. package/themes/business/src/components/PreviousOrders/index.tsx +5 -3
  33. package/themes/business/src/components/PrinterEdition/index.tsx +363 -0
  34. package/themes/business/src/components/PrinterEdition/styles.tsx +61 -0
  35. package/themes/business/src/components/PrinterSettings/index.tsx +267 -0
  36. package/themes/business/src/components/PrinterSettings/styles.tsx +30 -0
  37. package/themes/business/src/components/ProductItemAccordion/index.tsx +2 -2
  38. package/themes/business/src/components/ReviewCustomer/index.tsx +2 -0
  39. package/themes/business/src/components/Sessions/index.tsx +187 -0
  40. package/themes/business/src/components/Sessions/styles.tsx +20 -0
  41. package/themes/business/src/components/StoresList/index.tsx +2 -2
  42. package/themes/business/src/components/UserFormDetails/index.tsx +111 -107
  43. package/themes/business/src/components/UserProfileForm/index.tsx +106 -54
  44. package/themes/business/src/components/WebsocketStatus/index.tsx +2 -2
  45. package/themes/business/src/components/shared/OInput.tsx +2 -0
  46. package/themes/business/src/components/shared/OTextarea.tsx +8 -9
  47. package/themes/business/src/hooks/useLocation.tsx +5 -4
  48. package/themes/business/src/types/index.tsx +23 -5
  49. package/themes/business/src/utils/index.tsx +19 -1
  50. package/themes/doordash/src/components/BusinessesListing/index.tsx +1 -1
  51. package/themes/doordash/src/components/LoginForm/index.tsx +1 -2
  52. package/themes/instacart/src/components/BusinessesListing/index.tsx +1 -1
  53. package/themes/kiosk/src/components/Checkout/index.tsx +6 -0
  54. package/themes/kiosk/src/components/NavBar/index.tsx +14 -14
  55. package/themes/kiosk/src/components/OptionCard/index.tsx +1 -1
  56. package/themes/kiosk/src/components/OrderTypeCardSelector/index.tsx +8 -10
  57. package/themes/kiosk/src/components/shared/OButton.tsx +5 -18
  58. package/themes/original/index.tsx +13 -1
  59. package/themes/original/src/components/AddressDetails/index.tsx +20 -10
  60. package/themes/original/src/components/AddressForm/index.tsx +32 -17
  61. package/themes/original/src/components/AddressList/index.tsx +8 -7
  62. package/themes/original/src/components/AnalyticsSegment/index.tsx +6 -6
  63. package/themes/original/src/components/AppleLogin/index.tsx +4 -4
  64. package/themes/original/src/components/BusinessBasicInformation/index.tsx +6 -9
  65. package/themes/original/src/components/BusinessController/index.tsx +14 -9
  66. package/themes/original/src/components/BusinessController/styles.tsx +8 -7
  67. package/themes/original/src/components/BusinessItemAccordion/index.tsx +15 -7
  68. package/themes/original/src/components/BusinessListingSearch/BusinessSearchFooter.tsx +2 -3
  69. package/themes/original/src/components/BusinessListingSearch/BusinessSearchHeader.tsx +1 -3
  70. package/themes/original/src/components/BusinessListingSearch/index.tsx +1 -2
  71. package/themes/original/src/components/BusinessPreorder/index.tsx +20 -15
  72. package/themes/original/src/components/BusinessProductsList/SubcategoriesComponent/index.tsx +5 -5
  73. package/themes/original/src/components/BusinessProductsList/index.tsx +3 -3
  74. package/themes/original/src/components/BusinessProductsList/styles.tsx +0 -3
  75. package/themes/original/src/components/BusinessProductsListing/index.tsx +28 -13
  76. package/themes/original/src/components/BusinessTypeFilter/index.tsx +9 -8
  77. package/themes/original/src/components/BusinessesListing/Layout/Appointment/index.tsx +2 -1
  78. package/themes/original/src/components/BusinessesListing/Layout/Original/index.tsx +1 -1
  79. package/themes/original/src/components/BusinessesListing/Layout/Original/styles.tsx +1 -1
  80. package/themes/original/src/components/BusinessesListing/index.tsx +0 -1
  81. package/themes/original/src/components/Cart/index.tsx +26 -9
  82. package/themes/original/src/components/CartContent/index.tsx +60 -45
  83. package/themes/original/src/components/Checkout/index.tsx +94 -62
  84. package/themes/original/src/components/CitiesControl/index.tsx +0 -3
  85. package/themes/original/src/components/CouponControl/index.tsx +1 -3
  86. package/themes/original/src/components/DriverTips/index.tsx +1 -3
  87. package/themes/original/src/components/Favorite/index.tsx +1 -5
  88. package/themes/original/src/components/FavoriteList/index.tsx +0 -1
  89. package/themes/original/src/components/ForgotPasswordForm/index.tsx +5 -7
  90. package/themes/original/src/components/GiftCard/GiftCardOrdersList/index.tsx +64 -0
  91. package/themes/original/src/components/GiftCard/GiftCardOrdersList/styles.tsx +8 -0
  92. package/themes/original/src/components/GiftCard/GiftCardUI/index.tsx +15 -17
  93. package/themes/original/src/components/GiftCard/PurchaseGiftCard/index.tsx +3 -7
  94. package/themes/original/src/components/GiftCard/RedeemGiftCard/index.tsx +24 -32
  95. package/themes/original/src/components/GiftCard/SendGiftCard/index.tsx +9 -11
  96. package/themes/original/src/components/GiftCard/SingleGiftCard/index.tsx +101 -0
  97. package/themes/original/src/components/GiftCard/SingleGiftCard/styles.tsx +4 -0
  98. package/themes/original/src/components/GiftCard/VerticalGiftCardOrdersLayout/index.tsx +82 -0
  99. package/themes/original/src/components/GiftCard/VerticalGiftCardOrdersLayout/styles.tsx +9 -0
  100. package/themes/original/src/components/GoogleMap/index.tsx +39 -18
  101. package/themes/original/src/components/Help/index.tsx +2 -0
  102. package/themes/original/src/components/HighestRatedBusinesses/index.tsx +2 -2
  103. package/themes/original/src/components/Home/index.tsx +2 -10
  104. package/themes/original/src/components/LoginForm/Otp/index.tsx +4 -19
  105. package/themes/original/src/components/LoginForm/index.tsx +4 -7
  106. package/themes/original/src/components/MessageListing/index.tsx +1 -0
  107. package/themes/original/src/components/Messages/index.tsx +8 -7
  108. package/themes/original/src/components/MomentOption/index.tsx +13 -2
  109. package/themes/original/src/components/MultiCartsPaymethodsAndWallets/index.tsx +7 -3
  110. package/themes/original/src/components/MultiCheckout/index.tsx +123 -62
  111. package/themes/original/src/components/MultiCheckout/styles.tsx +17 -0
  112. package/themes/original/src/components/MultiOrdersDetails/index.tsx +20 -14
  113. package/themes/original/src/components/MyOrders/index.tsx +21 -26
  114. package/themes/original/src/components/NavBar/index.tsx +4 -2
  115. package/themes/original/src/components/NetworkError/index.tsx +0 -5
  116. package/themes/original/src/components/NotFoundSource/index.tsx +0 -3
  117. package/themes/original/src/components/OrderDetails/OrderHistory.tsx +5 -7
  118. package/themes/original/src/components/OrderDetails/index.tsx +5 -7
  119. package/themes/original/src/components/OrderDetails/styles.tsx +0 -1
  120. package/themes/original/src/components/OrderProgress/index.tsx +22 -3
  121. package/themes/original/src/components/OrderTypeSelector/index.tsx +7 -6
  122. package/themes/original/src/components/OrdersOption/index.tsx +2 -4
  123. package/themes/original/src/components/PaymentOptionCard/index.tsx +4 -2
  124. package/themes/original/src/components/PaymentOptionStripe/index.tsx +0 -5
  125. package/themes/original/src/components/PaymentOptionWallet/index.tsx +56 -56
  126. package/themes/original/src/components/PaymentOptions/index.tsx +47 -6
  127. package/themes/original/src/components/PlaceSpot/index.tsx +1 -3
  128. package/themes/original/src/components/PreviousOrders/index.tsx +1 -2
  129. package/themes/original/src/components/ProductForm/ActionButton.tsx +16 -19
  130. package/themes/original/src/components/ProductForm/index.tsx +120 -109
  131. package/themes/original/src/components/ProductItemAccordion/index.tsx +55 -49
  132. package/themes/original/src/components/ProductItemAccordion/styles.tsx +3 -4
  133. package/themes/original/src/components/ProductOptionSubOption/index.tsx +112 -91
  134. package/themes/original/src/components/ProfessionalProfile/index.tsx +4 -5
  135. package/themes/original/src/components/Promotions/index.tsx +6 -9
  136. package/themes/original/src/components/ReviewDriver/index.tsx +1 -1
  137. package/themes/original/src/components/ReviewOrder/index.tsx +2 -2
  138. package/themes/original/src/components/ReviewProducts/index.tsx +1 -1
  139. package/themes/original/src/components/ReviewTrigger/index.tsx +2 -2
  140. package/themes/original/src/components/ServiceForm/index.tsx +52 -54
  141. package/themes/original/src/components/Sessions/index.tsx +3 -3
  142. package/themes/original/src/components/SignupForm/index.tsx +65 -67
  143. package/themes/original/src/components/SingleOrderCard/index.tsx +1 -2
  144. package/themes/original/src/components/SingleProductCard/index.tsx +5 -6
  145. package/themes/original/src/components/SingleProductCard/styles.tsx +0 -3
  146. package/themes/original/src/components/StripeCardForm/index.tsx +0 -3
  147. package/themes/original/src/components/StripeCardsList/index.tsx +12 -36
  148. package/themes/original/src/components/StripeElementsForm/index.tsx +78 -59
  149. package/themes/original/src/components/StripeElementsForm/naked.tsx +48 -1
  150. package/themes/original/src/components/StripeRedirectForm/index.tsx +0 -3
  151. package/themes/original/src/components/UpsellingProducts/UpsellingContent.tsx +10 -7
  152. package/themes/original/src/components/UpsellingProducts/UpsellingLayout.tsx +8 -3
  153. package/themes/original/src/components/UserFormDetails/index.tsx +83 -84
  154. package/themes/original/src/components/UserProfile/index.tsx +11 -2
  155. package/themes/original/src/components/Wallets/index.tsx +7 -4
  156. package/themes/original/src/components/WebsocketStatus/index.tsx +169 -0
  157. package/themes/original/src/components/WebsocketStatus/styles.tsx +28 -0
  158. package/themes/original/src/components/shared/OAlert.tsx +2 -1
  159. package/themes/original/src/components/shared/OButton.tsx +8 -7
  160. package/themes/original/src/components/shared/OInput.tsx +1 -4
  161. package/themes/original/src/types/index.tsx +5 -1
  162. package/themes/original/src/utils/index.tsx +12 -1
  163. package/themes/uber-eats/src/components/BusinessesListing/index.tsx +1 -1
@@ -0,0 +1,220 @@
1
+ import { useConfig, useUtils, useLanguage} from 'ordering-components/native'
2
+
3
+ import { verifyDecimals, getProductPrice } from '../../utils';
4
+
5
+ /**
6
+ * Hook to create commands for star micronics printer using PassPRNT library
7
+ * @returns array of strings
8
+ */
9
+
10
+ export const usePrinterCommands = () => {
11
+ const [, t] = useLanguage()
12
+ const [{ configs }] = useConfig();
13
+ const [{ parsePrice, parseNumber, parseDate }] = useUtils();
14
+
15
+ const deliveryStatus: any = {
16
+ 1: t('DELIVERY', 'Delivery'),
17
+ 2: t('PICK_UP', 'Pick up'),
18
+ 3: t('EAT_IN', 'Eat In'),
19
+ 4: t('CURBSIDE', 'Curbside'),
20
+ 5: t('DRIVER_THRU', 'Driver thru'),
21
+ };
22
+
23
+ const walletName: any = {
24
+ cash: {
25
+ name: t('CASH_WALLET', 'Cash Wallet')
26
+ },
27
+ credit_point: {
28
+ name: t('POINTS_WALLET', 'Points Wallet')
29
+ }
30
+ }
31
+
32
+ const percentTip = (order: any) =>
33
+ parseInt(configs?.driver_tip_type?.value, 10) === 2 &&
34
+ !parseInt(configs?.driver_tip_use_custom?.value, 10) &&
35
+ verifyDecimals(order?.summary?.driver_tip, parseNumber);
36
+
37
+ const handlePaymethodsListString = (order: any) => {
38
+ const paymethodsList = order?.payment_events?.filter((item: any) => item.event === 'payment').map((paymethod: any) => {
39
+ return paymethod?.wallet_event
40
+ ? walletName[paymethod?.wallet_event?.wallet?.type]?.name
41
+ : paymethod?.paymethod?.gateway && paymethod?.paymethod?.gateway === 'cash' && order?.cash > 0
42
+ ? `${t(paymethod?.paymethod?.gateway?.toUpperCase(), paymethod?.paymethod?.name)} (${t('CASH_CHANGE_OF', 'Change of :amount:').replace(':amount:', parsePrice(order?.cash))})`
43
+ : paymethod?.paymethod?.gateway
44
+ ? t(paymethod?.paymethod?.gateway?.toUpperCase(), paymethod?.paymethod?.name)
45
+ : t(order?.paymethod?.gateway?.toUpperCase(), order?.paymethod?.name)
46
+ })
47
+ return paymethodsList.join(', ')
48
+ }
49
+
50
+ const paymethodsLength = (order: any) => order?.payment_events?.filter((item: any) => item.event === 'payment')?.length
51
+
52
+ const customerName = (order: any) => `${order?.customer?.name ?? ''} ${order?.customer?.middle_name ?? ''} ${order?.customer?.lastname ?? ''} ${order?.customer?.second_lastname ?? ''}`?.replace(' ', ' ')?.trim() ?? ''
53
+
54
+ const deliveryDate = (order: any) => {
55
+ const dateString = order?.delivery_datetime_utc ?? order?.delivery_datetime
56
+ const currentDate = new Date();
57
+ const receivedDate: any = new Date(order?.delivery_datetime);
58
+
59
+ const formattedDate = receivedDate <= currentDate
60
+ ? `${t('ASAP_ABBREVIATION', 'ASAP')}(${parseDate(dateString, { utc: !!order?.delivery_datetime_utc })})`
61
+ : parseDate(dateString, { utc: !!order?.delivery_datetime_utc })
62
+ return formattedDate
63
+ }
64
+
65
+ const generateProductsText = (order: any, { endLine }: any) => {
66
+ const list: any = []
67
+
68
+ if (order?.products.length) {
69
+ order?.products.map((product: any) => {
70
+ list.push(`${product?.quantity} ${product?.name} \t ${parsePrice(product.total ?? getProductPrice(product))}${endLine}`)
71
+
72
+ if (product?.ingredients?.length) {
73
+ list.push({ text: `\t ${t('INGREDIENTS', 'Ingredients')}:${endLine}`, props: { fontSize: 10 } })
74
+ product?.ingredients?.map((ingredient: any) => {
75
+ list.push({ text: `\t ${t('NO', 'No')} ${ingredient.name}${endLine}` , fontSize: 10 })
76
+ })
77
+ }
78
+
79
+ product.options?.map((option: any) => {
80
+ list.push({ text: `\t ${option.name}${endLine}`, props: { fontSize: 10 } })
81
+
82
+ option.suboptions?.map((suboption: any) => {
83
+ const { quantity, name, position, price } = suboption
84
+ const pos = position && position !== 'whole' ? `(${t(position.toUpperCase(), position)})` : ''
85
+ const string = name !== 'No'
86
+ ? pos
87
+ ? `${quantity} x ${name} ${pos} +${parsePrice(price)}`
88
+ : `${quantity} x ${name} +${parsePrice(price)}`
89
+ : 'No'
90
+
91
+ list.push({ text: `\t\t ${string}${endLine}`, props: { fontSize: 10 } })
92
+ })
93
+ })
94
+
95
+ if (product.comment) {
96
+ list.push({ text: `\t ${t('COMMENT', 'Comment')}${endLine}`, props: { fontSize: 10 } })
97
+ list.push({ text: `\t\t ${product.comment}${endLine}`, props: { fontSize: 10 } })
98
+ }
99
+
100
+ list.push('_separator_')
101
+ })
102
+ }
103
+
104
+ return list
105
+ }
106
+
107
+ const paymethodsList = (order: any, { endLine }: any) => {
108
+ const list: any = []
109
+
110
+ if (order?.payment_events?.length > 0) {
111
+ order?.payment_events.map((event: any) => {
112
+ const payment = event?.wallet_event
113
+ ? walletName[event?.wallet_event?.wallet?.type]?.name
114
+ : t(event?.paymethod?.name?.toUpperCase()?.replace(/ /g, '_'), event?.paymethod?.name)
115
+
116
+ const amount = (event?.paymethod?.gateway === 'cash' && order?.cash)
117
+ ? parsePrice(order?.cash, { currency: order?.currency })
118
+ : `-${parsePrice(event?.amount, { currency: order?.currency })}`
119
+
120
+ list.push(`${payment} \t ${amount}${endLine}`)
121
+ })
122
+ }
123
+
124
+ return list
125
+ }
126
+
127
+ const replaceChars = (string: string) => {
128
+ const accents: any = {
129
+ 'á': 'a',
130
+ 'é': 'e',
131
+ 'í': 'i',
132
+ 'ó': 'o',
133
+ 'ú': 'u',
134
+ 'Á': 'A',
135
+ 'É': 'E',
136
+ 'Í': 'I',
137
+ 'Ó': 'O',
138
+ 'Ú': 'U',
139
+ 'ü': 'u',
140
+ 'Ü': 'U',
141
+ 'ñ': 'n',
142
+ 'Ñ': 'N',
143
+ "'": '',
144
+ "’": '',
145
+ "`": '',
146
+ };
147
+ return string.replace(/[áéíóúÁÉÍÓÚüÜñÑ'’`]/g, (match: any) => accents[match])
148
+ }
149
+
150
+ const generateCommands = (order: any, printMode: string = 'append') => {
151
+ let commands: any = [];
152
+
153
+ const isAppendMode = printMode === 'append'
154
+ const jumpLine = isAppendMode ? '\n' : ' '
155
+ const endLine = isAppendMode ? '\n' : ''
156
+
157
+ const textProps = { fontSize: 12 }
158
+
159
+ const appends: any = [
160
+ { text: `${t('ORDER_NO', 'Order No.')} ${order.id}${endLine}`, props: { fontSize: 16 } },
161
+ jumpLine,
162
+ `${order.orderStatus}${endLine}`,
163
+ { text: `${t('ORDER_TYPE', 'Order Type')}: ${deliveryStatus[order?.delivery_type]}${endLine}`, props: { fontSize: 14 } },
164
+ { text: `${t(`PAYMENT_METHOD${paymethodsLength(order) > 1 ? 'S' : ''}`, `Payment method${paymethodsLength(order) > 1 ? 's' : ''}`)}: ${handlePaymethodsListString(order)}${endLine}`, props: { fontSize: 14 } },
165
+ `${!!order?.delivery_option ? `${t('DELIVERY_PREFERENCE', 'Delivery Preference')}: ${t(order?.delivery_option?.name?.toUpperCase()?.replace(/ /g, '_'), order?.delivery_option?.name)}${endLine}` : ''}`,
166
+ `${t('DELIVERY_DATE', 'Delivery Date')}: ${deliveryDate(order)}${endLine}`,
167
+ '_separator_',
168
+ { text: `${t('CUSTOMER_DETAILS', 'Customer details')}${endLine}`, props: { fontSize: 14 } },
169
+ `${t('FULL_NAME', 'Full Name')}: ${customerName(order)}${endLine}`,
170
+ `${t('EMAIL', 'Email')}: ${order?.customer?.email}${endLine}`,
171
+ `${!!order?.customer?.cellphone ? `${t('MOBILE_PHONE', 'Mobile Phone')}: ${order?.customer?.cellphone}${endLine}` : ''}`,
172
+ `${!!order?.customer?.phone ? `${t('MOBILE_PHONE', 'Mobile Phone')}: ${order?.customer?.phone}${endLine}` : ''}`,
173
+ `${t('FULL_ADDRESS', 'Full Addres')}: ${order?.customer?.address}${endLine}`,
174
+ `${!!order?.customer?.internal_number ? `${t('INTERNAL_NUMBER', 'Internal Number')}: ${order?.customer?.internal_number}${endLine}` : ''}`,
175
+ `${!!order?.customer?.zipcode ? `${t('ZIPCODE', 'Zipcode')}: ${order?.customer?.zipcode}${endLine}` : ''}`,
176
+ '_separator_',
177
+ { text: `${t('BUSINESS_DETAILS', 'Business details')}${endLine}`, props: { fontSize: 14 } },
178
+ `${order?.business?.name}${endLine}`,
179
+ `${order?.business?.email}${endLine}`,
180
+ `${!!order?.business?.cellphone ? `${t('BUSINESS_PHONE', 'Business Phone')}: ${order?.business?.cellphone}${endLine}` : ''}`,
181
+ `${!!order?.business?.phone ? `${t('BUSINESS_PHONE', 'Business Phone')}: ${order?.business?.phone}${endLine}` : ''}`,
182
+ `${t('ADDRESS', 'Address')}: ${order?.business?.address}${endLine}`,
183
+ `${!!order?.business?.address_notes ? `${t('SPECIAL_ADDRESS', 'Special Address')}: ${order?.business?.address_notes}${endLine}` : ''}`,
184
+ '_separator_',
185
+ { text: `${t('ORDER_DETAILS', 'Order Details')}${endLine}`, props: { fontSize: 14 } },
186
+ `${!!order?.comment ? `${t('ORDER_COMMENT', 'Order Comment')}: ${order?.comment}${endLine}` : ''}`,
187
+ ...generateProductsText(order, { endLine }),
188
+ `${t('SUBTOTAL', 'Subtotal')} \t\t ${parsePrice(order.tax_type === 1 ? (order?.summary?.subtotal + order?.summary?.tax) ?? 0 : order?.summary?.subtotal ?? 0)}${endLine}`,
189
+ `${order?.summary?.discount > 0 ? `${order?.offer_type === 1 ? `${t('DISCOUNT', 'Discount')} (${verifyDecimals(order?.offer_rate, parsePrice)}%)${endLine}` : t('DISCOUNT', 'Discount')} \t\t ${parsePrice(order?.summary?.discount)}${endLine}` : ''}`,
190
+ `${order?.tax_type !== 1 ? `${t('TAX', 'Tax')} (${verifyDecimals(order?.summary?.tax_rate, parseNumber)}%) \t\t ${parsePrice(order?.summary?.tax ?? 0)}${endLine}` : ''}`,
191
+ `${order?.summary?.delivery_price > 0 && order.delivery_type !== 2 ? `${t('DELIVERY_FEE', 'Delivery Fee')} \t\t ${parsePrice(order?.summary?.delivery_price ?? 0)}${endLine}` : ''}`,
192
+ `${(order?.summary?.driver_tip > 0 || order?.driver_tip > 0) && order.delivery_type !== 2 ? `${t('DRIVER_TIP', 'Driver tip')} ${percentTip(order) ? `(${percentTip(order)}%)` : ''} \t\t ${parsePrice(order?.summary?.driver_tip ?? 0)}${endLine}` : ''}`,
193
+ `${order?.summary?.service_fee > 0 ? `${t('SERVICE_FEE', 'Service Fee')} (${verifyDecimals(order?.summary?.service_fee, parseNumber)}%) \t\t ${parsePrice(order?.summary?.service_fee ?? 0)}${endLine}` : ''}`,
194
+ '_separator_',
195
+ `${t('TOTAL', 'Total')} \t\t ${parsePrice(order?.summary?.total ?? 0)}${endLine}`,
196
+ jumpLine,
197
+ `${order?.payment_events?.length > 0 ? `${t('PAYMENTS', 'Payments')}${endLine}` : ''}`,
198
+ ...paymethodsList(order, { endLine }),
199
+ jumpLine,
200
+ jumpLine,
201
+ ]
202
+
203
+ commands = [
204
+ ...commands,
205
+ ...appends.map((append: any) => {
206
+ return append === '_separator_'
207
+ ? { [printMode]: `---------------------------------------${endLine}` }
208
+ : {
209
+ [printMode]: replaceChars(append?.text ?? append),
210
+ ...textProps,
211
+ ...append?.props
212
+ }
213
+ })
214
+ ]
215
+
216
+ return commands
217
+ }
218
+
219
+ return { generateCommands }
220
+ }