@pisell/pisellos 2.3.122 → 2.3.123
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/dist/modules/Order/index.d.ts +1 -1
- package/dist/modules/Order/types.d.ts +1 -0
- package/dist/modules/Order/utils.js +4 -0
- package/dist/server/modules/order/types.d.ts +1 -0
- package/dist/server/utils/small-ticket.js +25 -15
- package/dist/solution/BookingByStep/index.d.ts +1 -1
- package/lib/model/strategy/adapter/promotion/index.js +46 -1
- package/lib/modules/Order/index.d.ts +1 -1
- package/lib/modules/Order/types.d.ts +1 -0
- package/lib/modules/Order/utils.js +4 -0
- package/lib/server/modules/order/types.d.ts +1 -0
- package/lib/server/utils/small-ticket.js +25 -14
- package/lib/solution/BookingByStep/index.d.ts +1 -1
- package/package.json +1 -1
|
@@ -567,7 +567,7 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
|
|
|
567
567
|
generateIdempotencyToken(): string;
|
|
568
568
|
syncPaymentsToOrder<T = any>(params: SyncPaymentsToOrderParams): Promise<SyncPaymentsToOrderResult<T>>;
|
|
569
569
|
createOrder(params: CommitOrderParams['query']): {
|
|
570
|
-
type: "
|
|
570
|
+
type: "virtual" | "appointment_booking";
|
|
571
571
|
platform: string;
|
|
572
572
|
sales_channel: string;
|
|
573
573
|
order_sales_channel: string;
|
|
@@ -58,6 +58,10 @@ export function normalizePointCardSnapshotItem(value) {
|
|
|
58
58
|
if (productId !== undefined) {
|
|
59
59
|
snapshot.product_id = productId;
|
|
60
60
|
}
|
|
61
|
+
var code = normalizeSnapshotScalar(value.code);
|
|
62
|
+
if (code !== undefined) {
|
|
63
|
+
snapshot.code = String(code).trim();
|
|
64
|
+
}
|
|
61
65
|
return snapshot;
|
|
62
66
|
}
|
|
63
67
|
export function buildPointCardSnapshotFromWalletPassList(value) {
|
|
@@ -803,7 +803,9 @@ function normalizeExistingCombinations(combinations, locale, currencySymbol) {
|
|
|
803
803
|
options: rawOptions
|
|
804
804
|
});
|
|
805
805
|
var nestedCombinations = Array.isArray(combination.combinations) ? normalizeExistingCombinations(combination.combinations, locale, currencySymbol) : [];
|
|
806
|
+
var productTitle = getBundleProductTitleSource(combination, locale);
|
|
806
807
|
var snapshot = _objectSpread({}, combination);
|
|
808
|
+
delete snapshot.product_title;
|
|
807
809
|
delete snapshot.product_note;
|
|
808
810
|
delete snapshot.note;
|
|
809
811
|
delete snapshot.combinations;
|
|
@@ -823,7 +825,9 @@ function normalizeExistingCombinations(combinations, locale, currencySymbol) {
|
|
|
823
825
|
originalPrice: unitPrice
|
|
824
826
|
});
|
|
825
827
|
var shouldIncludeBasePrice = normalizedOptions.length > 0 || nestedCombinations.length > 0 || hasProductDiscount(combination, extensionList);
|
|
826
|
-
return _objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread({}, snapshot),
|
|
828
|
+
return _objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread({}, snapshot), productTitle ? {
|
|
829
|
+
product_title: productTitle
|
|
830
|
+
} : {}), {}, {
|
|
827
831
|
product_quantity: quantity,
|
|
828
832
|
total_selling_price: formatCalculatedMoney(new Decimal(toMoneyNumber(unitPrice)).mul(quantity), currencySymbol)
|
|
829
833
|
}, shouldIncludeBasePrice ? {
|
|
@@ -896,18 +900,18 @@ function resolveBundleProductTitle(params) {
|
|
|
896
900
|
productMap = params.productMap,
|
|
897
901
|
locale = params.locale,
|
|
898
902
|
parentProduct = params.parentProduct;
|
|
899
|
-
var ownTitle =
|
|
903
|
+
var ownTitle = getBundleProductTitleSource(bundle, locale);
|
|
900
904
|
if (ownTitle) return ownTitle;
|
|
901
905
|
var parentBundleItem = resolveBundleItemFromParentProduct({
|
|
902
906
|
bundle: bundle,
|
|
903
907
|
parentProduct: parentProduct
|
|
904
908
|
});
|
|
905
|
-
var parentBundleTitle = parentBundleItem ?
|
|
909
|
+
var parentBundleTitle = parentBundleItem ? getBundleProductTitleSource(parentBundleItem, locale) : '';
|
|
906
910
|
if (parentBundleTitle) return parentBundleTitle;
|
|
907
911
|
var productId = (_ref31 = (_ref32 = (_bundle$bundle_produc = bundle.bundle_product_id) !== null && _bundle$bundle_produc !== void 0 ? _bundle$bundle_produc : bundle._bundle_product_id) !== null && _ref32 !== void 0 ? _ref32 : bundle.product_id) !== null && _ref31 !== void 0 ? _ref31 : bundle.id;
|
|
908
912
|
var fallbackProduct = resolveProductFromMap(productId, productMap);
|
|
909
913
|
if (!fallbackProduct) return '';
|
|
910
|
-
return
|
|
914
|
+
return getBundleProductTitleSource(fallbackProduct, locale);
|
|
911
915
|
}
|
|
912
916
|
function resolveProductFromMap(productId, productMap) {
|
|
913
917
|
if (productId === undefined || productId === null || productId === '') return null;
|
|
@@ -990,7 +994,11 @@ function resolveVariantItem(group, itemPositionId) {
|
|
|
990
994
|
}
|
|
991
995
|
function getProductTitleSource(source, locale) {
|
|
992
996
|
if (!source || _typeof(source) !== 'object') return '';
|
|
993
|
-
return resolveTitleValue(source.product_title, locale) || resolveTitleValue(source.title, locale) || resolveTitleValue(source.name, locale);
|
|
997
|
+
return resolveTitleValue(source.product_title, locale) || resolveTitleValue(source.title_i18n, locale) || resolveTitleValue(source.title, locale) || resolveTitleValue(source.name, locale);
|
|
998
|
+
}
|
|
999
|
+
function getBundleProductTitleSource(source, locale) {
|
|
1000
|
+
if (!source || _typeof(source) !== 'object') return '';
|
|
1001
|
+
return resolveTitleValue(source.bundle_title, locale) || resolveTitleValue(source.trans_title, locale) || resolveTitleValue(source.title_i18n, locale) || resolveTitleValue(source.product_title, locale) || resolveTitleValue(source.title, locale) || resolveTitleValue(source.name, locale);
|
|
994
1002
|
}
|
|
995
1003
|
function resolveTitleValue(value, locale) {
|
|
996
1004
|
var _ref35, _ref36, _ref37, _ref38, _value$locale;
|
|
@@ -1894,7 +1902,7 @@ function buildPointCardSnapshotAssets(params) {
|
|
|
1894
1902
|
codes: []
|
|
1895
1903
|
})) return [];
|
|
1896
1904
|
var rows = [{
|
|
1897
|
-
item: stringify(pointCard.product_name).trim() || label(params.locale, 'pointCard'),
|
|
1905
|
+
item: appendMaskedCardCode(stringify(pointCard.product_name).trim() || label(params.locale, 'pointCard'), pointCard.code),
|
|
1898
1906
|
value: ''
|
|
1899
1907
|
}];
|
|
1900
1908
|
var remainingPoints = getPointCardSnapshotRemainingPoints(pointCard);
|
|
@@ -2394,9 +2402,14 @@ function isPointCardPayment(payment) {
|
|
|
2394
2402
|
return code === 'POINTCARD' || type === 'point_card';
|
|
2395
2403
|
}
|
|
2396
2404
|
function maskMachineCode(code) {
|
|
2397
|
-
var text = stringify(code);
|
|
2398
|
-
if (text
|
|
2399
|
-
|
|
2405
|
+
var text = stringify(code).trim();
|
|
2406
|
+
if (!text) return '';
|
|
2407
|
+
if (text.length <= 6) return '*'.repeat(text.length);
|
|
2408
|
+
return "".concat(text.slice(0, 2), "****").concat(text.slice(-4));
|
|
2409
|
+
}
|
|
2410
|
+
function appendMaskedCardCode(name, code) {
|
|
2411
|
+
var maskedCode = maskMachineCode(code);
|
|
2412
|
+
return maskedCode ? "".concat(name, "(").concat(maskedCode, ")") : name;
|
|
2400
2413
|
}
|
|
2401
2414
|
function trimDecimal(value) {
|
|
2402
2415
|
return value.toDecimalPlaces(2).toFixed(2).replace(/\.?0+$/, '');
|
|
@@ -2405,16 +2418,13 @@ function getFundRecordPaymentName(payment, locale) {
|
|
|
2405
2418
|
var fundRecord = getFundRecord(payment);
|
|
2406
2419
|
if (!fundRecord) return '';
|
|
2407
2420
|
var name = getLocalizedValue(fundRecord.wallet_pass_name, locale);
|
|
2408
|
-
|
|
2409
|
-
if (!name && !code) return '';
|
|
2410
|
-
if (!code) return name;
|
|
2421
|
+
if (!name && !maskMachineCode(fundRecord.code)) return '';
|
|
2411
2422
|
var fallbackName = getLocalizedValue(payment.name || payment.title || payment.payment_method_name || payment.method_name || payment.code, locale);
|
|
2412
|
-
return
|
|
2423
|
+
return appendMaskedCardCode(name || fallbackName, fundRecord.code);
|
|
2413
2424
|
}
|
|
2414
2425
|
function appendMachineCodeToName(name, payment) {
|
|
2415
2426
|
var fundRecord = getFundRecord(payment);
|
|
2416
|
-
|
|
2417
|
-
return "".concat(name, "(").concat(maskMachineCode(fundRecord.code), ")");
|
|
2427
|
+
return appendMaskedCardCode(name, fundRecord === null || fundRecord === void 0 ? void 0 : fundRecord.code);
|
|
2418
2428
|
}
|
|
2419
2429
|
function paymentMethodName(payment, locale) {
|
|
2420
2430
|
var fundRecordName = getFundRecordPaymentName(payment, locale);
|
|
@@ -326,7 +326,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
|
|
|
326
326
|
date: string;
|
|
327
327
|
status: string;
|
|
328
328
|
week: string;
|
|
329
|
-
weekNum: 0 |
|
|
329
|
+
weekNum: 0 | 1 | 2 | 5 | 4 | 3 | 6;
|
|
330
330
|
}[]>;
|
|
331
331
|
submitTimeSlot(timeSlots: TimeSliceItem): void;
|
|
332
332
|
private getScheduleDataByIds;
|
|
@@ -1 +1,46 @@
|
|
|
1
|
-
"use strict";
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
Object.defineProperty(exports, "BUY_X_GET_Y_FREE_STRATEGY", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function () {
|
|
9
|
+
return _examples.BUY_X_GET_Y_FREE_STRATEGY;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
Object.defineProperty(exports, "ITEM_REWARD_STRATEGY", {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
get: function () {
|
|
15
|
+
return _examples.ITEM_REWARD_STRATEGY;
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
Object.defineProperty(exports, "PromotionAdapter", {
|
|
19
|
+
enumerable: true,
|
|
20
|
+
get: function () {
|
|
21
|
+
return _adapter.PromotionAdapter;
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
Object.defineProperty(exports, "PromotionEvaluator", {
|
|
25
|
+
enumerable: true,
|
|
26
|
+
get: function () {
|
|
27
|
+
return _evaluator.PromotionEvaluator;
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
Object.defineProperty(exports, "X_ITEMS_FOR_Y_PRICE_STRATEGY", {
|
|
31
|
+
enumerable: true,
|
|
32
|
+
get: function () {
|
|
33
|
+
return _examples.X_ITEMS_FOR_Y_PRICE_STRATEGY;
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
Object.defineProperty(exports, "default", {
|
|
37
|
+
enumerable: true,
|
|
38
|
+
get: function () {
|
|
39
|
+
return _adapter.default;
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
var _evaluator = require("./evaluator");
|
|
43
|
+
var _adapter = _interopRequireWildcard(require("./adapter"));
|
|
44
|
+
var _examples = require("./examples");
|
|
45
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
46
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
@@ -567,7 +567,7 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
|
|
|
567
567
|
generateIdempotencyToken(): string;
|
|
568
568
|
syncPaymentsToOrder<T = any>(params: SyncPaymentsToOrderParams): Promise<SyncPaymentsToOrderResult<T>>;
|
|
569
569
|
createOrder(params: CommitOrderParams['query']): {
|
|
570
|
-
type: "
|
|
570
|
+
type: "virtual" | "appointment_booking";
|
|
571
571
|
platform: string;
|
|
572
572
|
sales_channel: string;
|
|
573
573
|
order_sales_channel: string;
|
|
@@ -163,6 +163,10 @@ function normalizePointCardSnapshotItem(value) {
|
|
|
163
163
|
if (productId !== undefined) {
|
|
164
164
|
snapshot.product_id = productId;
|
|
165
165
|
}
|
|
166
|
+
const code = normalizeSnapshotScalar(value.code);
|
|
167
|
+
if (code !== undefined) {
|
|
168
|
+
snapshot.code = String(code).trim();
|
|
169
|
+
}
|
|
166
170
|
return snapshot;
|
|
167
171
|
}
|
|
168
172
|
function buildPointCardSnapshotFromWalletPassList(value) {
|
|
@@ -774,9 +774,11 @@ function normalizeExistingCombinations(combinations, locale, currencySymbol) {
|
|
|
774
774
|
options: rawOptions
|
|
775
775
|
});
|
|
776
776
|
const nestedCombinations = Array.isArray(combination.combinations) ? normalizeExistingCombinations(combination.combinations, locale, currencySymbol) : [];
|
|
777
|
+
const productTitle = getBundleProductTitleSource(combination, locale);
|
|
777
778
|
const snapshot = {
|
|
778
779
|
...combination
|
|
779
780
|
};
|
|
781
|
+
delete snapshot.product_title;
|
|
780
782
|
delete snapshot.product_note;
|
|
781
783
|
delete snapshot.note;
|
|
782
784
|
delete snapshot.combinations;
|
|
@@ -796,6 +798,9 @@ function normalizeExistingCombinations(combinations, locale, currencySymbol) {
|
|
|
796
798
|
const shouldIncludeBasePrice = normalizedOptions.length > 0 || nestedCombinations.length > 0 || hasProductDiscount(combination, extensionList);
|
|
797
799
|
return {
|
|
798
800
|
...snapshot,
|
|
801
|
+
...(productTitle ? {
|
|
802
|
+
product_title: productTitle
|
|
803
|
+
} : {}),
|
|
799
804
|
product_quantity: quantity,
|
|
800
805
|
total_selling_price: formatCalculatedMoney(new _decimal.default(toMoneyNumber(unitPrice)).mul(quantity), currencySymbol),
|
|
801
806
|
...(shouldIncludeBasePrice ? {
|
|
@@ -864,18 +869,18 @@ function resolveBundleProductTitle(params) {
|
|
|
864
869
|
locale,
|
|
865
870
|
parentProduct
|
|
866
871
|
} = params;
|
|
867
|
-
const ownTitle =
|
|
872
|
+
const ownTitle = getBundleProductTitleSource(bundle, locale);
|
|
868
873
|
if (ownTitle) return ownTitle;
|
|
869
874
|
const parentBundleItem = resolveBundleItemFromParentProduct({
|
|
870
875
|
bundle,
|
|
871
876
|
parentProduct
|
|
872
877
|
});
|
|
873
|
-
const parentBundleTitle = parentBundleItem ?
|
|
878
|
+
const parentBundleTitle = parentBundleItem ? getBundleProductTitleSource(parentBundleItem, locale) : '';
|
|
874
879
|
if (parentBundleTitle) return parentBundleTitle;
|
|
875
880
|
const productId = bundle.bundle_product_id ?? bundle._bundle_product_id ?? bundle.product_id ?? bundle.id;
|
|
876
881
|
const fallbackProduct = resolveProductFromMap(productId, productMap);
|
|
877
882
|
if (!fallbackProduct) return '';
|
|
878
|
-
return
|
|
883
|
+
return getBundleProductTitleSource(fallbackProduct, locale);
|
|
879
884
|
}
|
|
880
885
|
function resolveProductFromMap(productId, productMap) {
|
|
881
886
|
if (productId === undefined || productId === null || productId === '') return null;
|
|
@@ -947,7 +952,11 @@ function resolveVariantItem(group, itemPositionId) {
|
|
|
947
952
|
}
|
|
948
953
|
function getProductTitleSource(source, locale) {
|
|
949
954
|
if (!source || typeof source !== 'object') return '';
|
|
950
|
-
return resolveTitleValue(source.product_title, locale) || resolveTitleValue(source.title, locale) || resolveTitleValue(source.name, locale);
|
|
955
|
+
return resolveTitleValue(source.product_title, locale) || resolveTitleValue(source.title_i18n, locale) || resolveTitleValue(source.title, locale) || resolveTitleValue(source.name, locale);
|
|
956
|
+
}
|
|
957
|
+
function getBundleProductTitleSource(source, locale) {
|
|
958
|
+
if (!source || typeof source !== 'object') return '';
|
|
959
|
+
return resolveTitleValue(source.bundle_title, locale) || resolveTitleValue(source.trans_title, locale) || resolveTitleValue(source.title_i18n, locale) || resolveTitleValue(source.product_title, locale) || resolveTitleValue(source.title, locale) || resolveTitleValue(source.name, locale);
|
|
951
960
|
}
|
|
952
961
|
function resolveTitleValue(value, locale) {
|
|
953
962
|
if (value === undefined || value === null) return '';
|
|
@@ -1698,7 +1707,7 @@ function buildPointCardSnapshotAssets(params) {
|
|
|
1698
1707
|
codes: []
|
|
1699
1708
|
})) return [];
|
|
1700
1709
|
const rows = [{
|
|
1701
|
-
item: stringify(pointCard.product_name).trim() || label(params.locale, 'pointCard'),
|
|
1710
|
+
item: appendMaskedCardCode(stringify(pointCard.product_name).trim() || label(params.locale, 'pointCard'), pointCard.code),
|
|
1702
1711
|
value: ''
|
|
1703
1712
|
}];
|
|
1704
1713
|
const remainingPoints = getPointCardSnapshotRemainingPoints(pointCard);
|
|
@@ -2170,9 +2179,14 @@ function isPointCardPayment(payment) {
|
|
|
2170
2179
|
return code === 'POINTCARD' || type === 'point_card';
|
|
2171
2180
|
}
|
|
2172
2181
|
function maskMachineCode(code) {
|
|
2173
|
-
const text = stringify(code);
|
|
2174
|
-
if (text
|
|
2175
|
-
|
|
2182
|
+
const text = stringify(code).trim();
|
|
2183
|
+
if (!text) return '';
|
|
2184
|
+
if (text.length <= 6) return '*'.repeat(text.length);
|
|
2185
|
+
return `${text.slice(0, 2)}****${text.slice(-4)}`;
|
|
2186
|
+
}
|
|
2187
|
+
function appendMaskedCardCode(name, code) {
|
|
2188
|
+
const maskedCode = maskMachineCode(code);
|
|
2189
|
+
return maskedCode ? `${name}(${maskedCode})` : name;
|
|
2176
2190
|
}
|
|
2177
2191
|
function trimDecimal(value) {
|
|
2178
2192
|
return value.toDecimalPlaces(2).toFixed(2).replace(/\.?0+$/, '');
|
|
@@ -2181,16 +2195,13 @@ function getFundRecordPaymentName(payment, locale) {
|
|
|
2181
2195
|
const fundRecord = getFundRecord(payment);
|
|
2182
2196
|
if (!fundRecord) return '';
|
|
2183
2197
|
const name = getLocalizedValue(fundRecord.wallet_pass_name, locale);
|
|
2184
|
-
|
|
2185
|
-
if (!name && !code) return '';
|
|
2186
|
-
if (!code) return name;
|
|
2198
|
+
if (!name && !maskMachineCode(fundRecord.code)) return '';
|
|
2187
2199
|
const fallbackName = getLocalizedValue(payment.name || payment.title || payment.payment_method_name || payment.method_name || payment.code, locale);
|
|
2188
|
-
return
|
|
2200
|
+
return appendMaskedCardCode(name || fallbackName, fundRecord.code);
|
|
2189
2201
|
}
|
|
2190
2202
|
function appendMachineCodeToName(name, payment) {
|
|
2191
2203
|
const fundRecord = getFundRecord(payment);
|
|
2192
|
-
|
|
2193
|
-
return `${name}(${maskMachineCode(fundRecord.code)})`;
|
|
2204
|
+
return appendMaskedCardCode(name, fundRecord?.code);
|
|
2194
2205
|
}
|
|
2195
2206
|
function paymentMethodName(payment, locale) {
|
|
2196
2207
|
const fundRecordName = getFundRecordPaymentName(payment, locale);
|
|
@@ -326,7 +326,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
|
|
|
326
326
|
date: string;
|
|
327
327
|
status: string;
|
|
328
328
|
week: string;
|
|
329
|
-
weekNum: 0 |
|
|
329
|
+
weekNum: 0 | 1 | 2 | 5 | 4 | 3 | 6;
|
|
330
330
|
}[]>;
|
|
331
331
|
submitTimeSlot(timeSlots: TimeSliceItem): void;
|
|
332
332
|
private getScheduleDataByIds;
|