@pisell/pisellos 2.3.37 → 2.3.39

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 (169) hide show
  1. package/dist/modules/Discount/index.d.ts +1 -0
  2. package/dist/modules/Discount/index.js +40 -11
  3. package/dist/modules/Discount/types.d.ts +1 -0
  4. package/dist/modules/Holder/index.d.ts +48 -0
  5. package/dist/modules/Holder/index.js +640 -0
  6. package/dist/modules/Holder/types.d.ts +123 -0
  7. package/dist/modules/Holder/types.js +1 -0
  8. package/dist/modules/Holder/utils.d.ts +13 -0
  9. package/dist/modules/Holder/utils.js +34 -0
  10. package/dist/modules/OpenData/index.js +2 -2
  11. package/dist/modules/Order/index.d.ts +11 -28
  12. package/dist/modules/Order/index.js +513 -747
  13. package/dist/modules/Order/types.d.ts +10 -33
  14. package/dist/modules/Order/utils/orderCollectionIdentity.js +2 -7
  15. package/dist/modules/Order/utils.d.ts +10 -0
  16. package/dist/modules/Order/utils.js +40 -11
  17. package/dist/modules/Payment/index.d.ts +0 -2
  18. package/dist/modules/Payment/index.js +49 -78
  19. package/dist/modules/Payment/types.d.ts +24 -26
  20. package/dist/modules/Payment/types.js +0 -2
  21. package/dist/modules/Product/types.d.ts +1 -0
  22. package/dist/modules/ProductList/index.js +33 -14
  23. package/dist/modules/Quotation/index.d.ts +1 -1
  24. package/dist/modules/Quotation/index.js +2 -2
  25. package/dist/modules/ResourcePlanner/index.d.ts +24 -0
  26. package/dist/modules/ResourcePlanner/index.js +181 -0
  27. package/dist/modules/ResourcePlanner/planner.d.ts +14 -0
  28. package/dist/modules/ResourcePlanner/planner.js +1069 -0
  29. package/dist/modules/ResourcePlanner/types.d.ts +227 -0
  30. package/dist/modules/ResourcePlanner/types.js +1 -0
  31. package/dist/modules/Rules/index.js +48 -15
  32. package/dist/modules/SalesSummary/index.js +12 -13
  33. package/dist/modules/ScanOrderLogger/index.d.ts +2 -0
  34. package/dist/modules/ScanOrderLogger/index.js +15 -2
  35. package/dist/modules/ScanOrderLogger/providers/feishu.js +45 -27
  36. package/dist/modules/ScanOrderLogger/types.d.ts +1 -0
  37. package/dist/modules/Schedule/index.d.ts +3 -1
  38. package/dist/modules/Schedule/index.js +21 -16
  39. package/dist/modules/Summary/utils.js +38 -13
  40. package/dist/modules/index.d.ts +2 -0
  41. package/dist/modules/index.js +3 -1
  42. package/dist/plugins/window.d.ts +1 -0
  43. package/dist/server/index.d.ts +14 -16
  44. package/dist/server/index.js +1162 -1943
  45. package/dist/server/modules/order/index.d.ts +4 -49
  46. package/dist/server/modules/order/index.js +695 -1574
  47. package/dist/server/modules/order/types.d.ts +3 -11
  48. package/dist/server/modules/order/types.js +1 -1
  49. package/dist/solution/BaseSales/index.d.ts +10 -33
  50. package/dist/solution/BaseSales/index.js +385 -676
  51. package/dist/solution/BaseSales/utils/parseSalesResponse.d.ts +1 -6
  52. package/dist/solution/BookingByStep/index.d.ts +17 -2
  53. package/dist/solution/BookingByStep/index.js +294 -215
  54. package/dist/solution/BookingByStep/types.d.ts +2 -1
  55. package/dist/solution/BookingByStep/types.js +3 -1
  56. package/dist/solution/BookingByStep/utils/capacity.js +17 -1
  57. package/dist/solution/BookingByStep/utils/timeslots.d.ts +3 -1
  58. package/dist/solution/BookingByStep/utils/timeslots.js +19 -12
  59. package/dist/solution/BookingTicket/index.js +1 -2
  60. package/dist/solution/Sales/index.d.ts +0 -1
  61. package/dist/solution/Sales/index.js +2 -10
  62. package/dist/solution/ScanOrder/index.d.ts +26 -14
  63. package/dist/solution/ScanOrder/index.js +1140 -737
  64. package/dist/solution/ScanOrder/types.d.ts +21 -1
  65. package/dist/solution/ScanOrder/utils.d.ts +8 -0
  66. package/dist/solution/ScanOrder/utils.js +66 -25
  67. package/dist/solution/ShopDiscount/index.d.ts +1 -0
  68. package/dist/solution/ShopDiscount/index.js +125 -87
  69. package/dist/solution/UnifiedBookingSales/index.d.ts +183 -0
  70. package/dist/solution/UnifiedBookingSales/index.js +1871 -0
  71. package/dist/solution/UnifiedBookingSales/types.d.ts +143 -0
  72. package/dist/solution/UnifiedBookingSales/types.js +11 -0
  73. package/dist/solution/VenueBooking/index.d.ts +39 -11
  74. package/dist/solution/VenueBooking/index.js +1177 -850
  75. package/dist/solution/VenueBooking/types.d.ts +3 -0
  76. package/dist/solution/VenueBooking/utils/resource.js +1 -0
  77. package/dist/solution/VenueBooking/utils/slotMerge.d.ts +4 -4
  78. package/dist/solution/VenueBooking/utils/slotMerge.js +10 -5
  79. package/dist/solution/index.d.ts +1 -0
  80. package/dist/solution/index.js +2 -1
  81. package/dist/types/index.d.ts +1 -0
  82. package/lib/modules/Discount/index.d.ts +1 -0
  83. package/lib/modules/Discount/index.js +9 -0
  84. package/lib/modules/Discount/types.d.ts +1 -0
  85. package/lib/modules/Holder/index.d.ts +48 -0
  86. package/lib/modules/Holder/index.js +402 -0
  87. package/lib/modules/Holder/types.d.ts +123 -0
  88. package/lib/modules/Holder/types.js +17 -0
  89. package/lib/modules/Holder/utils.d.ts +13 -0
  90. package/lib/modules/Holder/utils.js +71 -0
  91. package/lib/modules/OpenData/index.js +1 -1
  92. package/lib/modules/Order/index.d.ts +11 -28
  93. package/lib/modules/Order/index.js +83 -187
  94. package/lib/modules/Order/types.d.ts +10 -33
  95. package/lib/modules/Order/utils/orderCollectionIdentity.js +0 -3
  96. package/lib/modules/Order/utils.d.ts +10 -0
  97. package/lib/modules/Order/utils.js +39 -10
  98. package/lib/modules/Payment/index.d.ts +0 -2
  99. package/lib/modules/Payment/index.js +12 -33
  100. package/lib/modules/Payment/types.d.ts +24 -26
  101. package/lib/modules/Product/types.d.ts +1 -0
  102. package/lib/modules/ProductList/index.js +40 -31
  103. package/lib/modules/Quotation/index.d.ts +1 -1
  104. package/lib/modules/Quotation/index.js +2 -2
  105. package/lib/modules/ResourcePlanner/index.d.ts +24 -0
  106. package/lib/modules/ResourcePlanner/index.js +148 -0
  107. package/lib/modules/ResourcePlanner/planner.d.ts +14 -0
  108. package/lib/modules/ResourcePlanner/planner.js +933 -0
  109. package/lib/modules/ResourcePlanner/types.d.ts +227 -0
  110. package/lib/modules/ResourcePlanner/types.js +17 -0
  111. package/lib/modules/Rules/index.js +34 -18
  112. package/lib/modules/SalesSummary/index.js +6 -7
  113. package/lib/modules/ScanOrderLogger/index.d.ts +2 -0
  114. package/lib/modules/ScanOrderLogger/index.js +13 -1
  115. package/lib/modules/ScanOrderLogger/providers/feishu.js +15 -6
  116. package/lib/modules/ScanOrderLogger/types.d.ts +1 -0
  117. package/lib/modules/Schedule/index.d.ts +3 -1
  118. package/lib/modules/Schedule/index.js +10 -8
  119. package/lib/modules/Summary/utils.js +21 -1
  120. package/lib/modules/index.d.ts +2 -0
  121. package/lib/modules/index.js +5 -1
  122. package/lib/plugins/window.d.ts +1 -0
  123. package/lib/server/index.d.ts +14 -16
  124. package/lib/server/index.js +88 -678
  125. package/lib/server/modules/order/index.d.ts +4 -49
  126. package/lib/server/modules/order/index.js +66 -657
  127. package/lib/server/modules/order/types.d.ts +3 -11
  128. package/lib/solution/BaseSales/index.d.ts +10 -33
  129. package/lib/solution/BaseSales/index.js +33 -201
  130. package/lib/solution/BaseSales/utils/parseSalesResponse.d.ts +1 -6
  131. package/lib/solution/BookingByStep/index.d.ts +17 -2
  132. package/lib/solution/BookingByStep/index.js +60 -18
  133. package/lib/solution/BookingByStep/types.d.ts +2 -1
  134. package/lib/solution/BookingByStep/types.js +5 -0
  135. package/lib/solution/BookingByStep/utils/capacity.js +20 -1
  136. package/lib/solution/BookingByStep/utils/timeslots.d.ts +3 -1
  137. package/lib/solution/BookingByStep/utils/timeslots.js +19 -11
  138. package/lib/solution/BookingTicket/index.js +1 -2
  139. package/lib/solution/Sales/index.d.ts +0 -1
  140. package/lib/solution/Sales/index.js +3 -5
  141. package/lib/solution/ScanOrder/index.d.ts +26 -14
  142. package/lib/solution/ScanOrder/index.js +449 -182
  143. package/lib/solution/ScanOrder/types.d.ts +21 -1
  144. package/lib/solution/ScanOrder/utils.d.ts +8 -0
  145. package/lib/solution/ScanOrder/utils.js +31 -0
  146. package/lib/solution/ShopDiscount/index.d.ts +1 -0
  147. package/lib/solution/ShopDiscount/index.js +14 -0
  148. package/lib/solution/UnifiedBookingSales/index.d.ts +183 -0
  149. package/lib/solution/UnifiedBookingSales/index.js +1076 -0
  150. package/lib/solution/UnifiedBookingSales/types.d.ts +143 -0
  151. package/lib/solution/UnifiedBookingSales/types.js +33 -0
  152. package/lib/solution/VenueBooking/index.d.ts +39 -11
  153. package/lib/solution/VenueBooking/index.js +328 -115
  154. package/lib/solution/VenueBooking/types.d.ts +3 -0
  155. package/lib/solution/VenueBooking/utils/resource.js +1 -0
  156. package/lib/solution/VenueBooking/utils/slotMerge.d.ts +4 -4
  157. package/lib/solution/VenueBooking/utils/slotMerge.js +6 -4
  158. package/lib/solution/index.d.ts +1 -0
  159. package/lib/solution/index.js +3 -1
  160. package/lib/types/index.d.ts +1 -0
  161. package/package.json +2 -2
  162. package/dist/modules/Order/payment-utils.d.ts +0 -26
  163. package/dist/modules/Order/payment-utils.js +0 -225
  164. package/dist/utils/payment-number.d.ts +0 -9
  165. package/dist/utils/payment-number.js +0 -69
  166. package/lib/modules/Order/payment-utils.d.ts +0 -26
  167. package/lib/modules/Order/payment-utils.js +0 -224
  168. package/lib/utils/payment-number.d.ts +0 -9
  169. package/lib/utils/payment-number.js +0 -64
@@ -1,224 +0,0 @@
1
- var __defProp = Object.defineProperty;
2
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
- var __getOwnPropNames = Object.getOwnPropertyNames;
4
- var __hasOwnProp = Object.prototype.hasOwnProperty;
5
- var __export = (target, all) => {
6
- for (var name in all)
7
- __defProp(target, name, { get: all[name], enumerable: true });
8
- };
9
- var __copyProps = (to, from, except, desc) => {
10
- if (from && typeof from === "object" || typeof from === "function") {
11
- for (let key of __getOwnPropNames(from))
12
- if (!__hasOwnProp.call(to, key) && key !== except)
13
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
- }
15
- return to;
16
- };
17
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
-
19
- // src/modules/Order/payment-utils.ts
20
- var payment_utils_exports = {};
21
- __export(payment_utils_exports, {
22
- ensureOrderPaymentNumber: () => ensureOrderPaymentNumber,
23
- getOrderPaymentIdentityKeys: () => getOrderPaymentIdentityKeys,
24
- hasOrderPaymentIdentityOverlap: () => hasOrderPaymentIdentityOverlap,
25
- isIdentifiedPendingOrderPayment: () => isIdentifiedPendingOrderPayment,
26
- isPendingOrderPayment: () => isPendingOrderPayment,
27
- mergeOrderPaymentListsByIdentity: () => mergeOrderPaymentListsByIdentity,
28
- mergeOrderPaymentRecord: () => mergeOrderPaymentRecord,
29
- mergeOrderPaymentSnapshot: () => mergeOrderPaymentSnapshot,
30
- mergeOrderPaymentTransactions: () => mergeOrderPaymentTransactions,
31
- resolveOrderPaymentIdentity: () => resolveOrderPaymentIdentity
32
- });
33
- module.exports = __toCommonJS(payment_utils_exports);
34
- var PAYMENT_IDENTITY_TYPES = [
35
- "payment_number",
36
- "order_payment_id",
37
- "unique_payment_number"
38
- ];
39
- function normalizePaymentIdentityValue(value) {
40
- if (value === void 0 || value === null || value === "")
41
- return null;
42
- return String(value);
43
- }
44
- function getPaymentIdentityValue(payment, type) {
45
- var _a;
46
- if (type === "unique_payment_number") {
47
- return (_a = payment == null ? void 0 : payment.metadata) == null ? void 0 : _a.unique_payment_number;
48
- }
49
- return payment == null ? void 0 : payment[type];
50
- }
51
- function getOrderPaymentIdentityKeys(payment) {
52
- const record = payment;
53
- if (!record)
54
- return [];
55
- return PAYMENT_IDENTITY_TYPES.flatMap((type) => {
56
- const value = normalizePaymentIdentityValue(getPaymentIdentityValue(record, type));
57
- return value === null ? [] : [`${type}:${value}`];
58
- });
59
- }
60
- function isPendingOrderPayment(payment) {
61
- const record = payment;
62
- return String((record == null ? void 0 : record.status) || "").toLowerCase() === "payment_pending";
63
- }
64
- function isIdentifiedPendingOrderPayment(payment) {
65
- return isPendingOrderPayment(payment) && getOrderPaymentIdentityKeys(payment).length > 0;
66
- }
67
- function hasOrderPaymentIdentityOverlap(left, right) {
68
- const leftKeys = new Set(getOrderPaymentIdentityKeys(left));
69
- if (leftKeys.size === 0)
70
- return false;
71
- return getOrderPaymentIdentityKeys(right).some((key) => leftKeys.has(key));
72
- }
73
- function resolveOrderPaymentIdentity(payments, identity, mode = "payment_number") {
74
- const target = String(identity);
75
- const identityTypes = mode === "payment_number" ? ["payment_number"] : PAYMENT_IDENTITY_TYPES;
76
- const matchesByIndex = /* @__PURE__ */ new Map();
77
- for (const type of identityTypes) {
78
- (payments || []).forEach((payment, index) => {
79
- const value = normalizePaymentIdentityValue(getPaymentIdentityValue(payment, type));
80
- if (value === target && !matchesByIndex.has(index)) {
81
- matchesByIndex.set(index, { index, payment, matchedBy: type });
82
- }
83
- });
84
- }
85
- const matches = [...matchesByIndex.values()];
86
- if (matches.length > 1) {
87
- throw new Error(`支付项身份存在歧义: ${target}`);
88
- }
89
- return matches[0] || null;
90
- }
91
- function ensureOrderPaymentNumber(payment, devicePrefix, createPaymentNumber) {
92
- const existing = normalizePaymentIdentityValue(payment.payment_number);
93
- if (existing)
94
- return { ...payment, payment_number: existing };
95
- const uuid = normalizePaymentIdentityValue(payment.uuid) || createPaymentNumber();
96
- const prefix = normalizePaymentIdentityValue(devicePrefix) || "LOCAL";
97
- return { ...payment, payment_number: `${prefix}_${uuid}` };
98
- }
99
- function mergeOrderPaymentTransactions(current, incoming) {
100
- const records = /* @__PURE__ */ new Map();
101
- const append = (value) => {
102
- if (!Array.isArray(value))
103
- return;
104
- value.forEach((item) => {
105
- const number = item && typeof item === "object" ? String(item.number || "") : "";
106
- const status = item && typeof item === "object" ? item.status : void 0;
107
- if (!number || status !== "success" && status !== "fail")
108
- return;
109
- const previous = records.get(number);
110
- if ((previous == null ? void 0 : previous.status) === "success" && status === "fail")
111
- return;
112
- records.set(number, { number, status });
113
- });
114
- };
115
- append(current);
116
- append(incoming);
117
- return [...records.values()];
118
- }
119
- function mergeOrderPaymentRecord(payment, updates) {
120
- const currentMetadata = payment.metadata || {};
121
- const incomingMetadata = updates.metadata || {};
122
- const transactions = mergeOrderPaymentTransactions(
123
- currentMetadata.transactions,
124
- incomingMetadata.transactions
125
- );
126
- const currentPaid = payment.status === "paid";
127
- const nextStatus = currentPaid && updates.status !== "paid" ? "paid" : updates.status ?? payment.status;
128
- return {
129
- ...payment,
130
- ...updates,
131
- status: nextStatus,
132
- updated_at: updates.updated_at ?? payment.updated_at,
133
- metadata: {
134
- ...currentMetadata,
135
- ...incomingMetadata,
136
- ...transactions.length > 0 || Array.isArray(incomingMetadata.transactions) ? { transactions } : {}
137
- }
138
- };
139
- }
140
- function mergeOrderPaymentSnapshot(current, incoming) {
141
- const currentMetadata = current.metadata || {};
142
- const incomingMetadata = incoming.metadata || {};
143
- const currentUniquePaymentNumber = normalizePaymentIdentityValue(
144
- currentMetadata.unique_payment_number
145
- );
146
- const incomingUniquePaymentNumber = normalizePaymentIdentityValue(
147
- incomingMetadata.unique_payment_number
148
- );
149
- const incomingOrderPaymentId = normalizePaymentIdentityValue(
150
- incoming.order_payment_id
151
- );
152
- const incomingFallbackPrefix = incomingOrderPaymentId ? `os-fallback:payment:order-payment:${incomingOrderPaymentId}` : null;
153
- const incomingUsesDerivedUniquePaymentNumber = Boolean(
154
- incomingUniquePaymentNumber && incomingFallbackPrefix && (incomingUniquePaymentNumber === incomingFallbackPrefix || incomingUniquePaymentNumber.startsWith(`${incomingFallbackPrefix}:conflict:`))
155
- );
156
- const transactions = mergeOrderPaymentTransactions(
157
- currentMetadata.transactions,
158
- incomingMetadata.transactions
159
- );
160
- return {
161
- ...current,
162
- ...incoming,
163
- order_payment_id: normalizePaymentIdentityValue(incoming.order_payment_id) !== null ? incoming.order_payment_id : current.order_payment_id,
164
- payment_number: incoming.payment_number || current.payment_number,
165
- metadata: {
166
- ...currentMetadata,
167
- ...incomingMetadata,
168
- ...incomingUsesDerivedUniquePaymentNumber && currentUniquePaymentNumber ? { unique_payment_number: currentUniquePaymentNumber } : {},
169
- ...transactions.length > 0 ? { transactions } : {}
170
- }
171
- };
172
- }
173
- function compactOrderPaymentList(payments) {
174
- const result = [];
175
- for (const payment of payments) {
176
- const matchingIndexes = result.flatMap((existing, index) => hasOrderPaymentIdentityOverlap(existing, payment) ? [index] : []);
177
- if (matchingIndexes.length === 0) {
178
- result.push(mergeOrderPaymentSnapshot({}, payment));
179
- continue;
180
- }
181
- const firstIndex = matchingIndexes[0];
182
- let merged = result[firstIndex];
183
- for (const index of matchingIndexes.slice(1)) {
184
- merged = mergeOrderPaymentSnapshot(merged, result[index]);
185
- }
186
- result[firstIndex] = mergeOrderPaymentSnapshot(merged, payment);
187
- for (const index of matchingIndexes.slice(1).sort((a, b) => b - a)) {
188
- result.splice(index, 1);
189
- }
190
- }
191
- return result;
192
- }
193
- function mergeOrderPaymentListsByIdentity(existing, incoming, options = {}) {
194
- const existingList = compactOrderPaymentList([...existing || []]);
195
- const incomingList = compactOrderPaymentList([...incoming || []]);
196
- if (options.preserveUnmatchedExisting) {
197
- return compactOrderPaymentList([...existingList, ...incomingList]);
198
- }
199
- const mergedIncoming = incomingList.map((incomingPayment) => {
200
- const matchingExisting = existingList.filter((existingPayment) => hasOrderPaymentIdentityOverlap(existingPayment, incomingPayment));
201
- return matchingExisting.reduce(
202
- (merged, existingPayment) => mergeOrderPaymentSnapshot(existingPayment, merged),
203
- incomingPayment
204
- );
205
- });
206
- const preservedExisting = options.preserveUnmatchedExistingWhen ? existingList.filter((existingPayment) => {
207
- var _a;
208
- return !incomingList.some((incomingPayment) => hasOrderPaymentIdentityOverlap(existingPayment, incomingPayment)) && ((_a = options.preserveUnmatchedExistingWhen) == null ? void 0 : _a.call(options, existingPayment));
209
- }) : [];
210
- return compactOrderPaymentList([...mergedIncoming, ...preservedExisting]);
211
- }
212
- // Annotate the CommonJS export names for ESM import in node:
213
- 0 && (module.exports = {
214
- ensureOrderPaymentNumber,
215
- getOrderPaymentIdentityKeys,
216
- hasOrderPaymentIdentityOverlap,
217
- isIdentifiedPendingOrderPayment,
218
- isPendingOrderPayment,
219
- mergeOrderPaymentListsByIdentity,
220
- mergeOrderPaymentRecord,
221
- mergeOrderPaymentSnapshot,
222
- mergeOrderPaymentTransactions,
223
- resolveOrderPaymentIdentity
224
- });
@@ -1,9 +0,0 @@
1
- export type PaymentNumberAppDataGetter = (key: string) => unknown;
2
- /**
3
- * Resolve the synchronous fallback without caching runtime device data.
4
- */
5
- export declare function resolvePaymentNumberDevicePrefixFromDeviceId(getAppData: PaymentNumberAppDataGetter): string;
6
- /**
7
- * Resolve the latest device segment when a new payment number is generated.
8
- */
9
- export declare function resolvePaymentNumberDevicePrefix(getAppData: PaymentNumberAppDataGetter): Promise<string>;
@@ -1,64 +0,0 @@
1
- var __defProp = Object.defineProperty;
2
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
- var __getOwnPropNames = Object.getOwnPropertyNames;
4
- var __hasOwnProp = Object.prototype.hasOwnProperty;
5
- var __export = (target, all) => {
6
- for (var name in all)
7
- __defProp(target, name, { get: all[name], enumerable: true });
8
- };
9
- var __copyProps = (to, from, except, desc) => {
10
- if (from && typeof from === "object" || typeof from === "function") {
11
- for (let key of __getOwnPropNames(from))
12
- if (!__hasOwnProp.call(to, key) && key !== except)
13
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
- }
15
- return to;
16
- };
17
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
-
19
- // src/utils/payment-number.ts
20
- var payment_number_exports = {};
21
- __export(payment_number_exports, {
22
- resolvePaymentNumberDevicePrefix: () => resolvePaymentNumberDevicePrefix,
23
- resolvePaymentNumberDevicePrefixFromDeviceId: () => resolvePaymentNumberDevicePrefixFromDeviceId
24
- });
25
- module.exports = __toCommonJS(payment_number_exports);
26
- function normalizeNonEmptyString(value) {
27
- if (value === void 0 || value === null)
28
- return null;
29
- if (typeof value !== "string" && typeof value !== "number")
30
- return null;
31
- if (typeof value === "number" && !Number.isFinite(value))
32
- return null;
33
- const normalized = String(value).trim();
34
- return normalized || null;
35
- }
36
- function resolvePaymentNumberDevicePrefixFromDeviceId(getAppData) {
37
- try {
38
- const deviceId = normalizeNonEmptyString(getAppData("device_id"));
39
- if (deviceId && deviceId !== "0")
40
- return deviceId.slice(-2);
41
- } catch {
42
- }
43
- return "LOCAL";
44
- }
45
- async function resolvePaymentNumberDevicePrefix(getAppData) {
46
- try {
47
- const getAsyncIotDeviceInfo = getAppData("async_iot_device_info");
48
- if (typeof getAsyncIotDeviceInfo === "function") {
49
- const info = await getAsyncIotDeviceInfo();
50
- const shortNumber = normalizeNonEmptyString(
51
- info == null ? void 0 : info.short_number
52
- );
53
- if (shortNumber && shortNumber !== "0")
54
- return shortNumber;
55
- }
56
- } catch {
57
- }
58
- return resolvePaymentNumberDevicePrefixFromDeviceId(getAppData);
59
- }
60
- // Annotate the CommonJS export names for ESM import in node:
61
- 0 && (module.exports = {
62
- resolvePaymentNumberDevicePrefix,
63
- resolvePaymentNumberDevicePrefixFromDeviceId
64
- });