@pisell/private-materials 6.6.60 → 6.6.61
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/build/lowcode/assets-daily.json +11 -11
- package/build/lowcode/assets-dev.json +2 -2
- package/build/lowcode/assets-prod.json +11 -11
- package/build/lowcode/index.js +1 -1
- package/build/lowcode/meta.js +2 -2
- package/build/lowcode/preview.js +8 -8
- package/build/lowcode/render/default/view.css +1 -1
- package/build/lowcode/render/default/view.js +10 -10
- package/build/lowcode/view.css +1 -1
- package/build/lowcode/view.js +10 -10
- package/es/components/booking/components/footer/amount.js +3 -4
- package/es/components/booking/components/footer/utils.js +82 -85
- package/es/components/booking/components/voucher/index.js +1 -1
- package/es/components/booking/dashboard/index.d.ts +5 -0
- package/es/components/booking/dashboard/index.js +9 -6
- package/es/components/booking/info/service2/Group/utils.js +30 -1
- package/es/components/booking/info2/service/editService/index.js +6 -49
- package/es/components/booking/info2/service/editService/utils.d.ts +0 -1
- package/es/components/booking/info2/service/editService/utils.js +0 -16
- package/es/components/booking/payments/index.js +1 -1
- package/es/components/checkout/hooks/useWalletPass.js +23 -15
- package/es/components/eftposPay/hooks.d.ts +1 -1
- package/es/components/eftposPay/store/index.d.ts +2 -2
- package/es/components/index.d.ts +2 -1
- package/es/components/index.js +2 -1
- package/es/components/pisellCashCounting/PisellCashCounting.d.ts +5 -0
- package/es/components/pisellCashCounting/PisellCashCounting.js +121 -0
- package/es/components/pisellCashCounting/PisellCashCounting.less +263 -0
- package/es/components/pisellCashCounting/components/CashCountingModal/index.d.ts +20 -0
- package/es/components/pisellCashCounting/components/CashCountingModal/index.js +250 -0
- package/es/components/pisellCashCounting/components/CashCountingModal/index.less +279 -0
- package/es/components/pisellCashCounting/hooks.d.ts +21 -0
- package/es/components/pisellCashCounting/hooks.js +193 -0
- package/es/components/pisellCashCounting/index.d.ts +2 -0
- package/es/components/pisellCashCounting/index.js +1 -0
- package/es/components/pisellCashCounting/locales.d.ts +118 -0
- package/es/components/pisellCashCounting/locales.js +117 -0
- package/es/components/pisellCashCounting/types.d.ts +85 -0
- package/es/components/pisellCashCounting/types.js +1 -0
- package/es/components/pisellCashCounting/utils.d.ts +10 -0
- package/es/components/pisellCashCounting/utils.js +40 -0
- package/es/components/ticketBooking/components/addServiceVariant/addService.js +0 -1
- package/es/components/ticketBooking/components/bookingDataPanel/bookingDashboard/index.d.ts +2 -0
- package/es/components/ticketBooking/components/bookingDataPanel/bookingDashboard/index.js +5 -2
- package/es/components/ticketBooking/components/bookingDataPanel/index.d.ts +2 -0
- package/es/components/ticketBooking/components/bookingDataPanel/index.js +5 -2
- package/es/components/ticketBooking/components/bookingDataPanel/pisellFloatingPanel/index.js +2 -1
- package/es/components/ticketBooking/components/ticketBooking/index.js +156 -37
- package/es/components/ticketBooking/index.js +7 -1
- package/es/hooks/useResponsive.d.ts +8 -0
- package/es/hooks/useResponsive.js +43 -0
- package/es/hooks/useThemeTokens.d.ts +7 -0
- package/es/hooks/useThemeTokens.js +20 -0
- package/es/index.d.ts +1 -0
- package/es/index.js +2 -1
- package/es/pro/Login2.0/components/phoneValidation.js +65 -58
- package/es/pro/NumericStepper/index.d.ts +75 -0
- package/es/pro/NumericStepper/index.js +301 -0
- package/es/pro/NumericStepper/index.less +364 -0
- package/es/pro/keyboards/index.d.ts +2 -0
- package/es/pro/keyboards/index.js +1 -0
- package/es/pro/keyboards/locales.d.ts +38 -0
- package/es/pro/keyboards/locales.js +57 -0
- package/es/pro/keyboards/numberKeyboard/index.d.ts +16 -0
- package/es/pro/keyboards/numberKeyboard/index.js +523 -0
- package/es/pro/keyboards/numberKeyboard/index.less +59 -0
- package/es/pro/keyboards/numberKeyboard/types.d.ts +63 -0
- package/es/pro/keyboards/numberKeyboard/types.js +1 -0
- package/es/pro/pisellPriceKeyboardModal/PisellPriceKeyboardModal.js +3 -1
- package/es/pro/pisellPriceKeyboardModal/types.d.ts +2 -0
- package/lib/components/booking/components/footer/amount.js +3 -3
- package/lib/components/booking/components/footer/utils.js +11 -15
- package/lib/components/booking/components/voucher/index.js +1 -1
- package/lib/components/booking/dashboard/index.d.ts +5 -0
- package/lib/components/booking/dashboard/index.js +6 -5
- package/lib/components/booking/info/service2/Group/utils.js +42 -3
- package/lib/components/booking/info2/service/editService/index.js +5 -39
- package/lib/components/booking/info2/service/editService/utils.d.ts +0 -1
- package/lib/components/booking/info2/service/editService/utils.js +0 -16
- package/lib/components/booking/payments/index.js +1 -1
- package/lib/components/checkout/hooks/useWalletPass.js +23 -16
- package/lib/components/eftposPay/hooks.d.ts +1 -1
- package/lib/components/eftposPay/store/index.d.ts +2 -2
- package/lib/components/index.d.ts +2 -1
- package/lib/components/index.js +3 -0
- package/lib/components/pisellCashCounting/PisellCashCounting.d.ts +5 -0
- package/lib/components/pisellCashCounting/PisellCashCounting.js +168 -0
- package/lib/components/pisellCashCounting/PisellCashCounting.less +263 -0
- package/lib/components/pisellCashCounting/components/CashCountingModal/index.d.ts +20 -0
- package/lib/components/pisellCashCounting/components/CashCountingModal/index.js +171 -0
- package/lib/components/pisellCashCounting/components/CashCountingModal/index.less +279 -0
- package/lib/components/pisellCashCounting/hooks.d.ts +21 -0
- package/lib/components/pisellCashCounting/hooks.js +189 -0
- package/lib/components/pisellCashCounting/index.d.ts +2 -0
- package/lib/components/pisellCashCounting/index.js +35 -0
- package/lib/components/pisellCashCounting/locales.d.ts +118 -0
- package/lib/components/pisellCashCounting/locales.js +141 -0
- package/lib/components/pisellCashCounting/types.d.ts +85 -0
- package/lib/components/pisellCashCounting/types.js +17 -0
- package/lib/components/pisellCashCounting/utils.d.ts +10 -0
- package/lib/components/pisellCashCounting/utils.js +59 -0
- package/lib/components/ticketBooking/components/addServiceVariant/addService.js +0 -1
- package/lib/components/ticketBooking/components/bookingDataPanel/bookingDashboard/index.d.ts +2 -0
- package/lib/components/ticketBooking/components/bookingDataPanel/bookingDashboard/index.js +3 -2
- package/lib/components/ticketBooking/components/bookingDataPanel/index.d.ts +2 -0
- package/lib/components/ticketBooking/components/bookingDataPanel/index.js +10 -3
- package/lib/components/ticketBooking/components/bookingDataPanel/pisellFloatingPanel/index.js +10 -1
- package/lib/components/ticketBooking/components/ticketBooking/index.js +114 -14
- package/lib/components/ticketBooking/index.js +11 -1
- package/lib/hooks/useResponsive.d.ts +8 -0
- package/lib/hooks/useResponsive.js +48 -0
- package/lib/hooks/useThemeTokens.d.ts +7 -0
- package/lib/hooks/useThemeTokens.js +40 -0
- package/lib/index.d.ts +1 -0
- package/lib/index.js +3 -0
- package/lib/pro/Login2.0/components/phoneValidation.js +4 -2
- package/lib/pro/NumericStepper/index.d.ts +75 -0
- package/lib/pro/NumericStepper/index.js +338 -0
- package/lib/pro/NumericStepper/index.less +364 -0
- package/lib/pro/keyboards/index.d.ts +2 -0
- package/lib/pro/keyboards/index.js +39 -0
- package/lib/pro/keyboards/locales.d.ts +38 -0
- package/lib/pro/keyboards/locales.js +61 -0
- package/lib/pro/keyboards/numberKeyboard/index.d.ts +16 -0
- package/lib/pro/keyboards/numberKeyboard/index.js +400 -0
- package/lib/pro/keyboards/numberKeyboard/index.less +59 -0
- package/lib/pro/keyboards/numberKeyboard/types.d.ts +63 -0
- package/lib/pro/keyboards/numberKeyboard/types.js +17 -0
- package/lib/pro/pisellPriceKeyboardModal/PisellPriceKeyboardModal.js +3 -1
- package/lib/pro/pisellPriceKeyboardModal/types.d.ts +2 -0
- package/lowcode/pisell-cash-counting/meta.ts +167 -0
- package/lowcode/pisell-cash-counting/snippets.ts +13 -0
- package/package.json +4 -4
|
@@ -0,0 +1,279 @@
|
|
|
1
|
+
.pisell-private-cash-counting-modal {
|
|
2
|
+
&__modal-wrap {
|
|
3
|
+
.pisell-lowcode-modal-footer {
|
|
4
|
+
background: rgb(249, 250, 251);
|
|
5
|
+
padding: 12px 16px !important;
|
|
6
|
+
}
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
&__modal {
|
|
10
|
+
display: flex;
|
|
11
|
+
flex-direction: column;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
&__modal-header {
|
|
15
|
+
display: flex;
|
|
16
|
+
align-items: center;
|
|
17
|
+
gap: 10px;
|
|
18
|
+
|
|
19
|
+
&__modal-header-icon {
|
|
20
|
+
font-size: 20px;
|
|
21
|
+
color: #667085;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
&__modal-intro {
|
|
26
|
+
padding: 10px 16px;
|
|
27
|
+
background: #FFF2C2;
|
|
28
|
+
color: #995522;
|
|
29
|
+
border-radius: 6px;
|
|
30
|
+
display: flex;
|
|
31
|
+
gap: 8px;
|
|
32
|
+
font-weight: 600;
|
|
33
|
+
font-size: 14px;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
&__subtitle {
|
|
37
|
+
color: #667085;
|
|
38
|
+
font-size: 14px;
|
|
39
|
+
line-height: 20px;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
&__currency {
|
|
43
|
+
display: inline-flex;
|
|
44
|
+
align-items: center;
|
|
45
|
+
min-height: 28px;
|
|
46
|
+
margin-top: 12px;
|
|
47
|
+
padding: 4px 10px;
|
|
48
|
+
border-radius: 999px;
|
|
49
|
+
background: #f2f4f7;
|
|
50
|
+
color: #344054;
|
|
51
|
+
font-size: 13px;
|
|
52
|
+
font-weight: 600;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
&__scroll {
|
|
56
|
+
flex: 1;
|
|
57
|
+
overflow-y: auto;
|
|
58
|
+
display: flex;
|
|
59
|
+
flex-direction: row;
|
|
60
|
+
gap: 16px;
|
|
61
|
+
padding: 0;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
&__empty {
|
|
65
|
+
display: flex;
|
|
66
|
+
align-items: center;
|
|
67
|
+
justify-content: center;
|
|
68
|
+
min-height: 220px;
|
|
69
|
+
color: #98a2b3;
|
|
70
|
+
font-size: 14px;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
&__section {
|
|
74
|
+
padding: 16px;
|
|
75
|
+
flex: 1;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
&__section+&__section {
|
|
79
|
+
|
|
80
|
+
border-top: none;
|
|
81
|
+
padding-bottom: 16px;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
&__section-header {
|
|
85
|
+
display: flex;
|
|
86
|
+
align-items: center;
|
|
87
|
+
justify-content: space-between;
|
|
88
|
+
gap: 16px;
|
|
89
|
+
margin-bottom: 16px;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
&__section-title {
|
|
93
|
+
display: flex;
|
|
94
|
+
align-items: center;
|
|
95
|
+
gap: 8px;
|
|
96
|
+
color: #667085;
|
|
97
|
+
font-size: 14px;
|
|
98
|
+
font-weight: 700;
|
|
99
|
+
letter-spacing: 0.04em;
|
|
100
|
+
text-transform: uppercase;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
&__dot {
|
|
104
|
+
width: 8px;
|
|
105
|
+
height: 8px;
|
|
106
|
+
border-radius: 50%;
|
|
107
|
+
background: #635bff;
|
|
108
|
+
|
|
109
|
+
&--coin {
|
|
110
|
+
background: #f59e0b;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
&__section-subtotal {
|
|
115
|
+
display: flex;
|
|
116
|
+
align-items: center;
|
|
117
|
+
gap: 10px;
|
|
118
|
+
color: #667085;
|
|
119
|
+
font-size: 14px;
|
|
120
|
+
|
|
121
|
+
strong {
|
|
122
|
+
color: #101828;
|
|
123
|
+
font-size: 15px;
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
&__denomination-list {
|
|
128
|
+
display: flex;
|
|
129
|
+
flex-direction: column;
|
|
130
|
+
gap: 16px;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
&__denomination-row {
|
|
134
|
+
// display: grid;
|
|
135
|
+
// grid-template-columns: 94px minmax(220px, 1fr) minmax(94px, 1fr);
|
|
136
|
+
align-items: center;
|
|
137
|
+
gap: 16px;
|
|
138
|
+
display: flex;
|
|
139
|
+
justify-content: space-between;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
&__denomination-label {
|
|
143
|
+
display: inline-flex;
|
|
144
|
+
align-items: center;
|
|
145
|
+
justify-content: center;
|
|
146
|
+
min-width: 94px;
|
|
147
|
+
height: 32px;
|
|
148
|
+
padding: 0 12px;
|
|
149
|
+
border-radius: 6px;
|
|
150
|
+
background: #dbeafe;
|
|
151
|
+
color: #175cd3;
|
|
152
|
+
font-size: 14px;
|
|
153
|
+
font-weight: 700;
|
|
154
|
+
|
|
155
|
+
&--coin {
|
|
156
|
+
background: #fef3c7;
|
|
157
|
+
color: #92400e;
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
&__denomination-left {
|
|
162
|
+
display: flex;
|
|
163
|
+
align-items: center;
|
|
164
|
+
gap: 16px;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
&__stepper {
|
|
168
|
+
&.numeric-stepper {
|
|
169
|
+
gap: 8px;
|
|
170
|
+
grid-template-columns: auto auto auto;
|
|
171
|
+
justify-content: flex-start;
|
|
172
|
+
width: auto;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
.numeric-stepper-button {
|
|
176
|
+
width: 40px;
|
|
177
|
+
height: 32px;
|
|
178
|
+
border-radius: 6px;
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
.numeric-stepper-display {
|
|
182
|
+
width: 70px;
|
|
183
|
+
height: 32px;
|
|
184
|
+
max-width: 70px;
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
&__row-amount {
|
|
189
|
+
justify-self: end;
|
|
190
|
+
color: #98a2b3;
|
|
191
|
+
font-size: 15px;
|
|
192
|
+
font-weight: 700;
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
&__footer {
|
|
196
|
+
width: 100%;
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
&__summary {
|
|
200
|
+
padding-bottom: 4px;
|
|
201
|
+
border-bottom: 1px dashed #d0d5dd;
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
&__summary-row,
|
|
205
|
+
&__total-row {
|
|
206
|
+
display: flex;
|
|
207
|
+
align-items: center;
|
|
208
|
+
justify-content: space-between;
|
|
209
|
+
gap: 16px;
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
&__summary-row {
|
|
213
|
+
color: #667085;
|
|
214
|
+
font-size: 15px;
|
|
215
|
+
|
|
216
|
+
+.pisell-private-cash-counting__summary-row {
|
|
217
|
+
margin-top: 10px;
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
strong {
|
|
221
|
+
color: #101828;
|
|
222
|
+
font-size: 16px;
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
&__total-row {
|
|
227
|
+
margin-top: 4px;
|
|
228
|
+
color: #101828;
|
|
229
|
+
font-size: 18px;
|
|
230
|
+
font-weight: 700;
|
|
231
|
+
|
|
232
|
+
strong {
|
|
233
|
+
font-size: 34px;
|
|
234
|
+
line-height: 40px;
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
&__actions {
|
|
239
|
+
display: grid;
|
|
240
|
+
grid-template-columns: 1fr 1fr 1fr;
|
|
241
|
+
gap: 12px;
|
|
242
|
+
margin-top: 12px;
|
|
243
|
+
|
|
244
|
+
.pisell-lowcode-btn {
|
|
245
|
+
margin: 0;
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
&__scroll-column {
|
|
250
|
+
padding: 0 0 10px;
|
|
251
|
+
flex-direction: column;
|
|
252
|
+
gap: 0;
|
|
253
|
+
|
|
254
|
+
.numeric-stepper-button {
|
|
255
|
+
width: 66px!important;
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
.numeric-stepper-display {
|
|
259
|
+
width: 100px!important;
|
|
260
|
+
max-width: 100px!important;
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
&__scroll-mobile {
|
|
265
|
+
.numeric-stepper-button {
|
|
266
|
+
width: 32px!important;
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
.numeric-stepper-display {
|
|
270
|
+
width: 60px!important;
|
|
271
|
+
max-width: 60px!important;
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
&__scroll-column &__section+&__section {
|
|
276
|
+
border-top: 1px solid #f2f4f7;
|
|
277
|
+
padding-bottom: 0;
|
|
278
|
+
}
|
|
279
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { CashCountingConfirmPayload, PisellCashCountingProps } from './types';
|
|
2
|
+
import type { PisellCashCountingModalRef } from './components/CashCountingModal/index';
|
|
3
|
+
export declare function usePisellCashCounting({ value, defaultValue, currencyCode, currencySymbol, amountPrecision, denominations, disabled, countDisabled, onChange, onCountConfirm, onCountCancel, }: PisellCashCountingProps): {
|
|
4
|
+
modalRef: import("react").RefObject<PisellCashCountingModalRef>;
|
|
5
|
+
triggerRef: import("react").RefObject<HTMLDivElement>;
|
|
6
|
+
keyboardOpen: boolean;
|
|
7
|
+
setKeyboardOpen: import("react").Dispatch<import("react").SetStateAction<boolean>>;
|
|
8
|
+
currencyDenominations: import("./types").CurrencyDenominationConfig[];
|
|
9
|
+
decimalPlaces: number;
|
|
10
|
+
symbol: any;
|
|
11
|
+
currencyCode: any;
|
|
12
|
+
currentValue: string;
|
|
13
|
+
handleAmountChange: (nextValue: string | number) => void;
|
|
14
|
+
handleKeyboardClose: () => void;
|
|
15
|
+
openCountModal: () => void;
|
|
16
|
+
handleCountCancel: () => void;
|
|
17
|
+
handleCountConfirm: (payload: CashCountingConfirmPayload) => void;
|
|
18
|
+
manualCountMismatchOpen: boolean;
|
|
19
|
+
confirmUseCountedTotal: () => void;
|
|
20
|
+
confirmKeepManualAmount: () => void;
|
|
21
|
+
};
|
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
24
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
|
+
mod
|
|
26
|
+
));
|
|
27
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
|
+
|
|
29
|
+
// src/components/pisellCashCounting/hooks.ts
|
|
30
|
+
var hooks_exports = {};
|
|
31
|
+
__export(hooks_exports, {
|
|
32
|
+
usePisellCashCounting: () => usePisellCashCounting
|
|
33
|
+
});
|
|
34
|
+
module.exports = __toCommonJS(hooks_exports);
|
|
35
|
+
var import_react = require("react");
|
|
36
|
+
var import_antd = require("antd");
|
|
37
|
+
var import_utils = require("@pisell/utils");
|
|
38
|
+
var import_utils2 = require("./utils");
|
|
39
|
+
var import_useEngineContext = __toESM(require("../../hooks/useEngineContext"));
|
|
40
|
+
function usePisellCashCounting({
|
|
41
|
+
value,
|
|
42
|
+
defaultValue = "",
|
|
43
|
+
currencyCode,
|
|
44
|
+
currencySymbol,
|
|
45
|
+
amountPrecision,
|
|
46
|
+
denominations = [],
|
|
47
|
+
disabled = false,
|
|
48
|
+
countDisabled = false,
|
|
49
|
+
onChange,
|
|
50
|
+
onCountConfirm,
|
|
51
|
+
onCountCancel
|
|
52
|
+
}) {
|
|
53
|
+
var _a, _b, _c, _d;
|
|
54
|
+
const context = (0, import_useEngineContext.default)();
|
|
55
|
+
const { store } = ((_a = context.appHelper) == null ? void 0 : _a.utils) || {};
|
|
56
|
+
const modalRef = (0, import_react.useRef)(null);
|
|
57
|
+
const triggerRef = (0, import_react.useRef)(null);
|
|
58
|
+
const [keyboardOpen, setKeyboardOpen] = (0, import_react.useState)(false);
|
|
59
|
+
const [internalValue, setInternalValue] = (0, import_react.useState)(defaultValue);
|
|
60
|
+
const [confirmedQuantities, setConfirmedQuantities] = (0, import_react.useState)({});
|
|
61
|
+
const countedResultRef = (0, import_react.useRef)(null);
|
|
62
|
+
const manualInputValueRef = (0, import_react.useRef)(null);
|
|
63
|
+
const [manualCountMismatchOpen, setManualCountMismatchOpen] = (0, import_react.useState)(false);
|
|
64
|
+
const globalConfig = (0, import_react.useMemo)(() => {
|
|
65
|
+
var _a2, _b2;
|
|
66
|
+
const global = ((_b2 = (_a2 = store == null ? void 0 : store.getState) == null ? void 0 : _a2.call(store)) == null ? void 0 : _b2.global) || {};
|
|
67
|
+
return {
|
|
68
|
+
symbol: (global == null ? void 0 : global.symbol) || "$",
|
|
69
|
+
currency_code: (global == null ? void 0 : global.currency_code) || "AUD"
|
|
70
|
+
};
|
|
71
|
+
}, [(_c = (_b = store == null ? void 0 : store.getState) == null ? void 0 : _b.call(store)) == null ? void 0 : _c.global]);
|
|
72
|
+
const _currencyCode = (0, import_react.useMemo)(() => {
|
|
73
|
+
return currencyCode || (globalConfig == null ? void 0 : globalConfig.currency_code);
|
|
74
|
+
}, [currencyCode, globalConfig == null ? void 0 : globalConfig.currency_code]);
|
|
75
|
+
const currencyDenominations = (0, import_react.useMemo)(() => {
|
|
76
|
+
return (0, import_utils2.getEffectiveDenominationsForCurrency)(denominations, _currencyCode);
|
|
77
|
+
}, [_currencyCode, denominations]);
|
|
78
|
+
const decimalPlaces = (0, import_react.useMemo)(() => {
|
|
79
|
+
var _a2;
|
|
80
|
+
if (typeof amountPrecision === "number") {
|
|
81
|
+
return amountPrecision;
|
|
82
|
+
}
|
|
83
|
+
return ((_a2 = currencyDenominations[0]) == null ? void 0 : _a2.decimal_places) ?? 2;
|
|
84
|
+
}, [amountPrecision, (_d = currencyDenominations[0]) == null ? void 0 : _d.decimal_places]);
|
|
85
|
+
const symbolValue = (0, import_react.useMemo)(() => {
|
|
86
|
+
if (currencySymbol) {
|
|
87
|
+
return currencySymbol;
|
|
88
|
+
}
|
|
89
|
+
return globalConfig == null ? void 0 : globalConfig.symbol;
|
|
90
|
+
}, [currencySymbol, globalConfig == null ? void 0 : globalConfig.symbol]);
|
|
91
|
+
const currentValue = (0, import_react.useMemo)(
|
|
92
|
+
() => String(value ?? internalValue),
|
|
93
|
+
[value, internalValue]
|
|
94
|
+
);
|
|
95
|
+
const updateAmount = (0, import_react.useCallback)(
|
|
96
|
+
(nextValue, source) => {
|
|
97
|
+
if (value === void 0) {
|
|
98
|
+
setInternalValue(nextValue);
|
|
99
|
+
}
|
|
100
|
+
if (typeof onChange === "function") {
|
|
101
|
+
onChange(nextValue, { source });
|
|
102
|
+
}
|
|
103
|
+
},
|
|
104
|
+
[decimalPlaces, onChange, value]
|
|
105
|
+
);
|
|
106
|
+
const handleAmountChange = (0, import_react.useCallback)(
|
|
107
|
+
(nextValue) => {
|
|
108
|
+
manualInputValueRef.current = nextValue;
|
|
109
|
+
updateAmount(String(nextValue), "manual");
|
|
110
|
+
},
|
|
111
|
+
[updateAmount]
|
|
112
|
+
);
|
|
113
|
+
const handleKeyboardClose = (0, import_react.useCallback)(
|
|
114
|
+
() => {
|
|
115
|
+
var _a2;
|
|
116
|
+
setKeyboardOpen(false);
|
|
117
|
+
if (((_a2 = countedResultRef.current) == null ? void 0 : _a2.amount) && Number(countedResultRef.current.amount) !== Number(manualInputValueRef.current)) {
|
|
118
|
+
setManualCountMismatchOpen(true);
|
|
119
|
+
}
|
|
120
|
+
},
|
|
121
|
+
[setManualCountMismatchOpen]
|
|
122
|
+
);
|
|
123
|
+
const confirmUseCountedTotal = (0, import_react.useCallback)(() => {
|
|
124
|
+
var _a2;
|
|
125
|
+
updateAmount(((_a2 = countedResultRef.current) == null ? void 0 : _a2.amount) ?? "", "count");
|
|
126
|
+
setManualCountMismatchOpen(false);
|
|
127
|
+
}, [updateAmount]);
|
|
128
|
+
const confirmKeepManualAmount = (0, import_react.useCallback)(() => {
|
|
129
|
+
countedResultRef.current = null;
|
|
130
|
+
setConfirmedQuantities({});
|
|
131
|
+
updateAmount(manualInputValueRef.current ?? "", "manual");
|
|
132
|
+
setManualCountMismatchOpen(false);
|
|
133
|
+
}, [updateAmount]);
|
|
134
|
+
const openCountModal = (0, import_react.useCallback)(() => {
|
|
135
|
+
var _a2;
|
|
136
|
+
if (disabled || countDisabled) {
|
|
137
|
+
return;
|
|
138
|
+
}
|
|
139
|
+
if (currencyDenominations.length === 0) {
|
|
140
|
+
import_antd.message.warning(
|
|
141
|
+
import_utils.locales.getText("pisell-cash-counting.no-country-config")
|
|
142
|
+
);
|
|
143
|
+
return;
|
|
144
|
+
}
|
|
145
|
+
const initialQuantities = {
|
|
146
|
+
...(0, import_utils2.buildEmptyQuantities)(currencyDenominations),
|
|
147
|
+
...confirmedQuantities
|
|
148
|
+
};
|
|
149
|
+
setKeyboardOpen(false);
|
|
150
|
+
(_a2 = modalRef.current) == null ? void 0 : _a2.open({ initialQuantities });
|
|
151
|
+
}, [confirmedQuantities, countDisabled, currencyDenominations, disabled]);
|
|
152
|
+
const handleCountCancel = (0, import_react.useCallback)(() => {
|
|
153
|
+
onCountCancel == null ? void 0 : onCountCancel();
|
|
154
|
+
}, [onCountCancel]);
|
|
155
|
+
const handleCountConfirm = (0, import_react.useCallback)(
|
|
156
|
+
(payload) => {
|
|
157
|
+
countedResultRef.current = payload;
|
|
158
|
+
setConfirmedQuantities(payload.quantities);
|
|
159
|
+
updateAmount(payload.amount, "count");
|
|
160
|
+
if (typeof onCountConfirm === "function") {
|
|
161
|
+
onCountConfirm(payload);
|
|
162
|
+
}
|
|
163
|
+
},
|
|
164
|
+
[onCountConfirm, updateAmount]
|
|
165
|
+
);
|
|
166
|
+
return {
|
|
167
|
+
modalRef,
|
|
168
|
+
triggerRef,
|
|
169
|
+
keyboardOpen,
|
|
170
|
+
setKeyboardOpen,
|
|
171
|
+
currencyDenominations,
|
|
172
|
+
decimalPlaces,
|
|
173
|
+
symbol: symbolValue,
|
|
174
|
+
currencyCode: _currencyCode,
|
|
175
|
+
currentValue,
|
|
176
|
+
handleAmountChange,
|
|
177
|
+
handleKeyboardClose,
|
|
178
|
+
openCountModal,
|
|
179
|
+
handleCountCancel,
|
|
180
|
+
handleCountConfirm,
|
|
181
|
+
manualCountMismatchOpen,
|
|
182
|
+
confirmUseCountedTotal,
|
|
183
|
+
confirmKeepManualAmount
|
|
184
|
+
};
|
|
185
|
+
}
|
|
186
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
187
|
+
0 && (module.exports = {
|
|
188
|
+
usePisellCashCounting
|
|
189
|
+
});
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
24
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
|
+
mod
|
|
26
|
+
));
|
|
27
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
|
+
|
|
29
|
+
// src/components/pisellCashCounting/index.tsx
|
|
30
|
+
var pisellCashCounting_exports = {};
|
|
31
|
+
__export(pisellCashCounting_exports, {
|
|
32
|
+
default: () => import_PisellCashCounting.default
|
|
33
|
+
});
|
|
34
|
+
module.exports = __toCommonJS(pisellCashCounting_exports);
|
|
35
|
+
var import_PisellCashCounting = __toESM(require("./PisellCashCounting"));
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
declare const _default: {
|
|
2
|
+
en: {
|
|
3
|
+
'pisell-cash-counting.countCash': string;
|
|
4
|
+
'pisell-cash-counting.subtitle': string;
|
|
5
|
+
'pisell-cash-counting.currency': string;
|
|
6
|
+
'pisell-cash-counting.bills': string;
|
|
7
|
+
'pisell-cash-counting.coins': string;
|
|
8
|
+
'pisell-cash-counting.billsSubtotal': string;
|
|
9
|
+
'pisell-cash-counting.coinsSubtotal': string;
|
|
10
|
+
'pisell-cash-counting.subtotal': string;
|
|
11
|
+
'pisell-cash-counting.total': string;
|
|
12
|
+
'pisell-cash-counting.clearAll': string;
|
|
13
|
+
'pisell-cash-counting.cancel': string;
|
|
14
|
+
'pisell-cash-counting.confirm': string;
|
|
15
|
+
'pisell-cash-counting.placeholder': string;
|
|
16
|
+
'pisell-cash-counting.empty': string;
|
|
17
|
+
'pisell-cash-counting.no-country-config': string;
|
|
18
|
+
'pisell-cash-counting.manual-vs-count-message-title': string;
|
|
19
|
+
'pisell-cash-counting.manual-vs-count-message': string;
|
|
20
|
+
'pisell-cash-counting.use-count-total': string;
|
|
21
|
+
'pisell-cash-counting.keep-manual-amount': string;
|
|
22
|
+
'pisell2.customise-item.save': string;
|
|
23
|
+
'pisell2.booking.info.text.clear': string;
|
|
24
|
+
};
|
|
25
|
+
'zh-CN': {
|
|
26
|
+
'pisell-cash-counting.countCash': string;
|
|
27
|
+
'pisell-cash-counting.subtitle': string;
|
|
28
|
+
'pisell-cash-counting.currency': string;
|
|
29
|
+
'pisell-cash-counting.bills': string;
|
|
30
|
+
'pisell-cash-counting.coins': string;
|
|
31
|
+
'pisell-cash-counting.billsSubtotal': string;
|
|
32
|
+
'pisell-cash-counting.coinsSubtotal': string;
|
|
33
|
+
'pisell-cash-counting.subtotal': string;
|
|
34
|
+
'pisell-cash-counting.total': string;
|
|
35
|
+
'pisell-cash-counting.clearAll': string;
|
|
36
|
+
'pisell-cash-counting.cancel': string;
|
|
37
|
+
'pisell-cash-counting.confirm': string;
|
|
38
|
+
'pisell-cash-counting.placeholder': string;
|
|
39
|
+
'pisell-cash-counting.empty': string;
|
|
40
|
+
'pisell-cash-counting.no-country-config': string;
|
|
41
|
+
'pisell-cash-counting.manual-vs-count-message-title': string;
|
|
42
|
+
'pisell-cash-counting.manual-vs-count-message': string;
|
|
43
|
+
'pisell-cash-counting.use-count-total': string;
|
|
44
|
+
'pisell-cash-counting.keep-manual-amount': string;
|
|
45
|
+
'pisell2.customise-item.save': string;
|
|
46
|
+
'pisell2.booking.info.text.clear': string;
|
|
47
|
+
};
|
|
48
|
+
'zh-HK': {
|
|
49
|
+
'pisell-cash-counting.countCash': string;
|
|
50
|
+
'pisell-cash-counting.subtitle': string;
|
|
51
|
+
'pisell-cash-counting.currency': string;
|
|
52
|
+
'pisell-cash-counting.bills': string;
|
|
53
|
+
'pisell-cash-counting.coins': string;
|
|
54
|
+
'pisell-cash-counting.billsSubtotal': string;
|
|
55
|
+
'pisell-cash-counting.coinsSubtotal': string;
|
|
56
|
+
'pisell-cash-counting.subtotal': string;
|
|
57
|
+
'pisell-cash-counting.total': string;
|
|
58
|
+
'pisell-cash-counting.clearAll': string;
|
|
59
|
+
'pisell-cash-counting.cancel': string;
|
|
60
|
+
'pisell-cash-counting.confirm': string;
|
|
61
|
+
'pisell-cash-counting.placeholder': string;
|
|
62
|
+
'pisell-cash-counting.empty': string;
|
|
63
|
+
'pisell-cash-counting.no-country-config': string;
|
|
64
|
+
'pisell-cash-counting.manual-vs-count-message-title': string;
|
|
65
|
+
'pisell-cash-counting.manual-vs-count-message': string;
|
|
66
|
+
'pisell-cash-counting.use-count-total': string;
|
|
67
|
+
'pisell-cash-counting.keep-manual-amount': string;
|
|
68
|
+
'pisell2.customise-item.save': string;
|
|
69
|
+
'pisell2.booking.info.text.clear': string;
|
|
70
|
+
};
|
|
71
|
+
ja: {
|
|
72
|
+
'pisell-cash-counting.countCash': string;
|
|
73
|
+
'pisell-cash-counting.subtitle': string;
|
|
74
|
+
'pisell-cash-counting.currency': string;
|
|
75
|
+
'pisell-cash-counting.bills': string;
|
|
76
|
+
'pisell-cash-counting.coins': string;
|
|
77
|
+
'pisell-cash-counting.billsSubtotal': string;
|
|
78
|
+
'pisell-cash-counting.coinsSubtotal': string;
|
|
79
|
+
'pisell-cash-counting.subtotal': string;
|
|
80
|
+
'pisell-cash-counting.total': string;
|
|
81
|
+
'pisell-cash-counting.clearAll': string;
|
|
82
|
+
'pisell-cash-counting.cancel': string;
|
|
83
|
+
'pisell-cash-counting.confirm': string;
|
|
84
|
+
'pisell-cash-counting.placeholder': string;
|
|
85
|
+
'pisell-cash-counting.empty': string;
|
|
86
|
+
'pisell-cash-counting.no-country-config': string;
|
|
87
|
+
'pisell-cash-counting.manual-vs-count-message-title': string;
|
|
88
|
+
'pisell-cash-counting.manual-vs-count-message': string;
|
|
89
|
+
'pisell-cash-counting.use-count-total': string;
|
|
90
|
+
'pisell-cash-counting.keep-manual-amount': string;
|
|
91
|
+
'pisell2.customise-item.save': string;
|
|
92
|
+
'pisell2.booking.info.text.clear': string;
|
|
93
|
+
};
|
|
94
|
+
pt: {
|
|
95
|
+
'pisell-cash-counting.countCash': string;
|
|
96
|
+
'pisell-cash-counting.subtitle': string;
|
|
97
|
+
'pisell-cash-counting.currency': string;
|
|
98
|
+
'pisell-cash-counting.bills': string;
|
|
99
|
+
'pisell-cash-counting.coins': string;
|
|
100
|
+
'pisell-cash-counting.billsSubtotal': string;
|
|
101
|
+
'pisell-cash-counting.coinsSubtotal': string;
|
|
102
|
+
'pisell-cash-counting.subtotal': string;
|
|
103
|
+
'pisell-cash-counting.total': string;
|
|
104
|
+
'pisell-cash-counting.clearAll': string;
|
|
105
|
+
'pisell-cash-counting.cancel': string;
|
|
106
|
+
'pisell-cash-counting.confirm': string;
|
|
107
|
+
'pisell-cash-counting.placeholder': string;
|
|
108
|
+
'pisell-cash-counting.empty': string;
|
|
109
|
+
'pisell-cash-counting.no-country-config': string;
|
|
110
|
+
'pisell-cash-counting.manual-vs-count-message-title': string;
|
|
111
|
+
'pisell-cash-counting.manual-vs-count-message': string;
|
|
112
|
+
'pisell-cash-counting.use-count-total': string;
|
|
113
|
+
'pisell-cash-counting.keep-manual-amount': string;
|
|
114
|
+
'pisell2.customise-item.save': string;
|
|
115
|
+
'pisell2.booking.info.text.clear': string;
|
|
116
|
+
};
|
|
117
|
+
};
|
|
118
|
+
export default _default;
|