ts-glitter 21.7.6 → 21.7.8
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/lowcode/Entry.js +1 -1
- package/lowcode/Entry.ts +1 -1
- package/lowcode/backend-manager/bg-blog.js +1 -6
- package/lowcode/backend-manager/bg-blog.ts +1 -11
- package/lowcode/backend-manager/bg-dialog.js +176 -0
- package/lowcode/backend-manager/bg-dialog.ts +230 -0
- package/lowcode/backend-manager/bg-product.js +1 -3
- package/lowcode/backend-manager/bg-product.ts +1 -5
- package/lowcode/cms-plugin/module/delivery-html.js +56 -5
- package/lowcode/cms-plugin/module/delivery-html.ts +69 -14
- package/lowcode/cms-plugin/shopping-discount-setting.js +234 -1468
- package/lowcode/cms-plugin/shopping-discount-setting.ts +302 -1732
- package/lowcode/jslib/lottie-player.js +143 -39
- package/lowcode/public-components/product/pd-card-01.js +1 -1
- package/lowcode/public-components/product/pd-card-01.ts +5 -8
- package/lowcode/public-components/product/pd-card-02.js +3 -2
- package/lowcode/public-components/product/pd-card-02.ts +7 -10
- package/lowcode/public-components/product/pd-card-03.js +3 -2
- package/lowcode/public-components/product/pd-card-03.ts +7 -9
- package/package.json +1 -1
- package/src/api-public/services/checkout-event.js +45 -33
- package/src/api-public/services/checkout-event.js.map +5 -1
- package/src/api-public/services/checkout-event.ts +3 -1
- package/src/api-public/services/financial-serviceV2.js +17 -7
- package/src/api-public/services/financial-serviceV2.js.map +1 -1
- package/src/api-public/services/monitor.d.ts +0 -1
- package/src/api-public/services/shopee.js +17 -7
- package/src/api-public/services/shopee.js.map +1 -1
- package/src/api-public/services/shopping.js +3 -3
- package/src/api-public/services/shopping.js.map +1 -1
- package/src/api-public/services/shopping.ts +3 -5
- package/src/api-public/services/user.js +17 -7
- package/src/api-public/services/user.js.map +5 -1
- package/src/app-project/serverless/src/index.js +17 -7
- package/src/app-project/serverless/src/index.js.map +1 -1
- package/src/app-project/serverless/src/modules/CryptoJS.js +17 -7
- package/src/app-project/serverless/src/modules/CryptoJS.js.map +1 -1
- package/src/app-project/serverless/src/modules/ssh.js +17 -7
- package/src/app-project/serverless/src/modules/ssh.js.map +1 -1
- package/src/index.js +3 -3
- package/src/modules/CryptoJS.js +17 -7
- package/src/modules/CryptoJS.js.map +1 -1
- package/src/modules/database.d.ts +1 -1
- package/src/modules/ssh.js +17 -7
- package/src/modules/ssh.js.map +1 -1
- package/src/modules/tool.d.ts +4 -4
- package/src/modules/tool.js +1 -2
- package/src/modules/tool.js.map +1 -1
- package/src/services/app.js +17 -7
- package/src/services/app.js.map +1 -1
|
@@ -6,7 +6,6 @@ export class ProductCard01 {
|
|
|
6
6
|
static main(gvc, widget, subData) {
|
|
7
7
|
var _a, _b;
|
|
8
8
|
const glitter = gvc.glitter;
|
|
9
|
-
const wishId = glitter.getUUID();
|
|
10
9
|
const prod = typeof subData.content !== 'object' ? subData : subData.content;
|
|
11
10
|
const titleFontColor = (_a = glitter.share.globalValue['theme_color.0.title']) !== null && _a !== void 0 ? _a : '#333333';
|
|
12
11
|
let label = {};
|
|
@@ -222,6 +221,7 @@ export class ProductCard01 {
|
|
|
222
221
|
const isSoldOut = isAllUnderstocking && stockTotal === 0;
|
|
223
222
|
return html `<div
|
|
224
223
|
class="w-100 h-100 p-3 add-cart-text"
|
|
224
|
+
style="${isSoldOut ? 'background-color: #aeaeae' : ''}"
|
|
225
225
|
onclick="${gvc.event((_, event) => {
|
|
226
226
|
event.stopPropagation();
|
|
227
227
|
if (!isSoldOut) {
|
|
@@ -1,7 +1,4 @@
|
|
|
1
1
|
import { GVC } from '../../glitterBundle/GVController.js';
|
|
2
|
-
import { ApiShop } from '../../glitter-base/route/shopping.js';
|
|
3
|
-
import { GlobalUser } from '../../glitter-base/global/global-user.js';
|
|
4
|
-
import { CheckInput } from '../../modules/checkInput.js';
|
|
5
2
|
import { PdClass } from './pd-class.js';
|
|
6
3
|
import { ApiUser } from '../../glitter-base/route/user.js';
|
|
7
4
|
import { Language } from '../../glitter-base/global/language.js';
|
|
@@ -13,7 +10,6 @@ export class ProductCard01 {
|
|
|
13
10
|
|
|
14
11
|
static main(gvc: GVC, widget: any, subData: any) {
|
|
15
12
|
const glitter = gvc.glitter;
|
|
16
|
-
const wishId = glitter.getUUID();
|
|
17
13
|
const prod = typeof subData.content !== 'object' ? subData : subData.content;
|
|
18
14
|
const titleFontColor = glitter.share.globalValue['theme_color.0.title'] ?? '#333333';
|
|
19
15
|
let label: any = {};
|
|
@@ -172,15 +168,15 @@ export class ProductCard01 {
|
|
|
172
168
|
return html` <div
|
|
173
169
|
class="card mb-7 card-border"
|
|
174
170
|
onclick="${gvc.event(() => {
|
|
175
|
-
if(PdClass.isShoppingPage()){
|
|
171
|
+
if (PdClass.isShoppingPage()) {
|
|
176
172
|
PdClass.addCartAction({
|
|
177
173
|
gvc: gvc,
|
|
178
174
|
titleFontColor: titleFontColor,
|
|
179
175
|
prod: prod,
|
|
180
176
|
vm: vm,
|
|
181
|
-
})
|
|
182
|
-
}else{
|
|
183
|
-
PdClass.changePage(prod, gvc)
|
|
177
|
+
});
|
|
178
|
+
} else {
|
|
179
|
+
PdClass.changePage(prod, gvc);
|
|
184
180
|
}
|
|
185
181
|
})}"
|
|
186
182
|
>
|
|
@@ -240,6 +236,7 @@ export class ProductCard01 {
|
|
|
240
236
|
|
|
241
237
|
return html`<div
|
|
242
238
|
class="w-100 h-100 p-3 add-cart-text"
|
|
239
|
+
style="${isSoldOut ? 'background-color: #aeaeae' : ''}"
|
|
243
240
|
onclick="${gvc.event((_, event) => {
|
|
244
241
|
event.stopPropagation();
|
|
245
242
|
|
|
@@ -5,7 +5,6 @@ export class ProductCard02 {
|
|
|
5
5
|
static main(gvc, widget, subData) {
|
|
6
6
|
var _a, _b, _c, _d;
|
|
7
7
|
const glitter = gvc.glitter;
|
|
8
|
-
const wishId = glitter.getUUID();
|
|
9
8
|
const prod = typeof subData.content !== 'object' ? subData : subData.content;
|
|
10
9
|
let label = {};
|
|
11
10
|
let loading = false;
|
|
@@ -235,7 +234,9 @@ export class ProductCard02 {
|
|
|
235
234
|
const isSoldOut = isAllUnderstocking && stockTotal === 0;
|
|
236
235
|
return html `<div
|
|
237
236
|
class="w-100 h-100 p-3 add-cart-text"
|
|
238
|
-
style="border-radius: 50%; color: ${borderButtonText}; border: 1px solid ${borderButtonBgr};
|
|
237
|
+
style="border-radius: 50%; color: ${borderButtonText}; border: 1px solid ${borderButtonBgr}; ${isSoldOut
|
|
238
|
+
? 'background-color: #d5d5d5'
|
|
239
|
+
: ''}"
|
|
239
240
|
onclick="${gvc.event((_, event) => {
|
|
240
241
|
event.stopPropagation();
|
|
241
242
|
if (!isSoldOut) {
|
|
@@ -1,10 +1,6 @@
|
|
|
1
1
|
import { GVC } from '../../glitterBundle/GVController.js';
|
|
2
|
-
import { ApiShop } from '../../glitter-base/route/shopping.js';
|
|
3
|
-
import { GlobalUser } from '../../glitter-base/global/global-user.js';
|
|
4
|
-
import { CheckInput } from '../../modules/checkInput.js';
|
|
5
2
|
import { PdClass } from './pd-class.js';
|
|
6
3
|
import { ApiUser } from '../../glitter-base/route/user.js';
|
|
7
|
-
import { Language } from '../../glitter-base/global/language.js';
|
|
8
4
|
|
|
9
5
|
const html = String.raw;
|
|
10
6
|
|
|
@@ -13,7 +9,6 @@ export class ProductCard02 {
|
|
|
13
9
|
|
|
14
10
|
static main(gvc: GVC, widget: any, subData: any) {
|
|
15
11
|
const glitter = gvc.glitter;
|
|
16
|
-
const wishId = glitter.getUUID();
|
|
17
12
|
const prod = typeof subData.content !== 'object' ? subData : subData.content;
|
|
18
13
|
let label: any = {};
|
|
19
14
|
let loading = false;
|
|
@@ -162,15 +157,15 @@ export class ProductCard02 {
|
|
|
162
157
|
class="card mb-7 card-border"
|
|
163
158
|
style="cursor: pointer"
|
|
164
159
|
onclick="${gvc.event(() => {
|
|
165
|
-
if(PdClass.isShoppingPage()){
|
|
160
|
+
if (PdClass.isShoppingPage()) {
|
|
166
161
|
PdClass.addCartAction({
|
|
167
162
|
gvc: gvc,
|
|
168
163
|
titleFontColor: titleFontColor,
|
|
169
164
|
prod: prod,
|
|
170
165
|
vm: vm,
|
|
171
|
-
})
|
|
172
|
-
}else{
|
|
173
|
-
PdClass.changePage(prod, gvc)
|
|
166
|
+
});
|
|
167
|
+
} else {
|
|
168
|
+
PdClass.changePage(prod, gvc);
|
|
174
169
|
}
|
|
175
170
|
})}"
|
|
176
171
|
>
|
|
@@ -256,7 +251,9 @@ export class ProductCard02 {
|
|
|
256
251
|
|
|
257
252
|
return html`<div
|
|
258
253
|
class="w-100 h-100 p-3 add-cart-text"
|
|
259
|
-
style="border-radius: 50%; color: ${borderButtonText}; border: 1px solid ${borderButtonBgr};
|
|
254
|
+
style="border-radius: 50%; color: ${borderButtonText}; border: 1px solid ${borderButtonBgr}; ${isSoldOut
|
|
255
|
+
? 'background-color: #d5d5d5'
|
|
256
|
+
: ''}"
|
|
260
257
|
onclick="${gvc.event((_, event) => {
|
|
261
258
|
event.stopPropagation();
|
|
262
259
|
|
|
@@ -7,7 +7,6 @@ export class ProductCard03 {
|
|
|
7
7
|
static main(gvc, widget, subData) {
|
|
8
8
|
var _a, _b, _c, _d;
|
|
9
9
|
const glitter = gvc.glitter;
|
|
10
|
-
const wishId = glitter.getUUID();
|
|
11
10
|
const prod = typeof subData.content !== 'object' ? subData : subData.content;
|
|
12
11
|
let label = {};
|
|
13
12
|
let loading = false;
|
|
@@ -241,7 +240,9 @@ export class ProductCard03 {
|
|
|
241
240
|
const isSoldOut = isAllUnderstocking && stockTotal === 0;
|
|
242
241
|
return html `<div
|
|
243
242
|
class="w-100 h-100 p-3 add-cart-text"
|
|
244
|
-
style="color: ${borderButtonText}; border: 1px solid ${borderButtonBgr};
|
|
243
|
+
style="color: ${borderButtonText}; border: 1px solid ${borderButtonBgr}; ${isSoldOut
|
|
244
|
+
? 'background-color: #d5d5d5'
|
|
245
|
+
: ''}"
|
|
245
246
|
onclick="${gvc.event((_, event) => {
|
|
246
247
|
event.stopPropagation();
|
|
247
248
|
if (!isSoldOut) {
|
|
@@ -1,7 +1,4 @@
|
|
|
1
1
|
import { GVC } from '../../glitterBundle/GVController.js';
|
|
2
|
-
import { ApiShop } from '../../glitter-base/route/shopping.js';
|
|
3
|
-
import { GlobalUser } from '../../glitter-base/global/global-user.js';
|
|
4
|
-
import { CheckInput } from '../../modules/checkInput.js';
|
|
5
2
|
import { PdClass } from './pd-class.js';
|
|
6
3
|
import { ApiUser } from '../../glitter-base/route/user.js';
|
|
7
4
|
import { Language } from '../../glitter-base/global/language.js';
|
|
@@ -14,7 +11,6 @@ export class ProductCard03 {
|
|
|
14
11
|
|
|
15
12
|
static main(gvc: GVC, widget: any, subData: any) {
|
|
16
13
|
const glitter = gvc.glitter;
|
|
17
|
-
const wishId = glitter.getUUID();
|
|
18
14
|
const prod = typeof subData.content !== 'object' ? subData : subData.content;
|
|
19
15
|
let label: any = {};
|
|
20
16
|
let loading = false;
|
|
@@ -167,15 +163,15 @@ export class ProductCard03 {
|
|
|
167
163
|
class="card mb-7 card-border"
|
|
168
164
|
style="cursor: pointer"
|
|
169
165
|
onclick="${gvc.event(() => {
|
|
170
|
-
if(PdClass.isShoppingPage()){
|
|
166
|
+
if (PdClass.isShoppingPage()) {
|
|
171
167
|
PdClass.addCartAction({
|
|
172
168
|
gvc: gvc,
|
|
173
169
|
titleFontColor: titleFontColor,
|
|
174
170
|
prod: prod,
|
|
175
171
|
vm: vm,
|
|
176
|
-
})
|
|
177
|
-
}else{
|
|
178
|
-
PdClass.changePage(prod, gvc)
|
|
172
|
+
});
|
|
173
|
+
} else {
|
|
174
|
+
PdClass.changePage(prod, gvc);
|
|
179
175
|
}
|
|
180
176
|
})}"
|
|
181
177
|
>
|
|
@@ -262,7 +258,9 @@ export class ProductCard03 {
|
|
|
262
258
|
|
|
263
259
|
return html`<div
|
|
264
260
|
class="w-100 h-100 p-3 add-cart-text"
|
|
265
|
-
style="color: ${borderButtonText}; border: 1px solid ${borderButtonBgr};
|
|
261
|
+
style="color: ${borderButtonText}; border: 1px solid ${borderButtonBgr}; ${isSoldOut
|
|
262
|
+
? 'background-color: #d5d5d5'
|
|
263
|
+
: ''}"
|
|
266
264
|
onclick="${gvc.event((_, event) => {
|
|
267
265
|
event.stopPropagation();
|
|
268
266
|
|
package/package.json
CHANGED
|
@@ -15,13 +15,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
15
15
|
}) : function(o, v) {
|
|
16
16
|
o["default"] = v;
|
|
17
17
|
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
};
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
25
35
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
36
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
37
|
};
|
|
@@ -59,7 +69,7 @@ class CheckoutEvent {
|
|
|
59
69
|
return JSON.parse(JSON.stringify((0, glitter_finance_js_1.onlinePayArray)()));
|
|
60
70
|
}
|
|
61
71
|
async toCheckout(data, type = 'add', replace_order_id) {
|
|
62
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15;
|
|
72
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16;
|
|
63
73
|
try {
|
|
64
74
|
const utTimer = new ut_timer_js_1.UtTimer('TO-CHECKOUT');
|
|
65
75
|
const checkPoint = utTimer.checkPoint;
|
|
@@ -155,15 +165,17 @@ class CheckoutEvent {
|
|
|
155
165
|
checkPoint('check user auth');
|
|
156
166
|
const userData = await getUserDataAsync(type, this.token, data);
|
|
157
167
|
if (data.customer_info) {
|
|
158
|
-
const newCustomerInfo = await userClass.getUserData(data.email || data.customer_info.email, 'email_or_phone')
|
|
168
|
+
const newCustomerInfo = (_f = (await userClass.getUserData(data.email || data.customer_info.email, 'email_or_phone'))) !== null && _f !== void 0 ? _f : {
|
|
169
|
+
userData: {}
|
|
170
|
+
};
|
|
159
171
|
data.customer_info = Object.assign(Object.assign({}, data.customer_info), newCustomerInfo.userData);
|
|
160
172
|
}
|
|
161
|
-
data.email = ((
|
|
173
|
+
data.email = ((_g = userData === null || userData === void 0 ? void 0 : userData.userData) === null || _g === void 0 ? void 0 : _g.email) || ((_h = userData === null || userData === void 0 ? void 0 : userData.userData) === null || _h === void 0 ? void 0 : _h.phone) || '';
|
|
162
174
|
if (!data.email || data.email === 'no-email') {
|
|
163
175
|
data.email =
|
|
164
|
-
((
|
|
176
|
+
((_j = data.user_info) === null || _j === void 0 ? void 0 : _j.email) && data.user_info.email !== 'no-email'
|
|
165
177
|
? data.user_info.email
|
|
166
|
-
: ((
|
|
178
|
+
: ((_k = data.user_info) === null || _k === void 0 ? void 0 : _k.phone) || '';
|
|
167
179
|
}
|
|
168
180
|
if (!data.email && type !== 'preview') {
|
|
169
181
|
data.email = 'no-email';
|
|
@@ -210,14 +222,14 @@ class CheckoutEvent {
|
|
|
210
222
|
return form;
|
|
211
223
|
})).then(dataArray => dataArray)
|
|
212
224
|
: [];
|
|
213
|
-
shipment_setting.support = (
|
|
214
|
-
const languageInfo = (
|
|
225
|
+
shipment_setting.support = (_l = shipment_setting.support) !== null && _l !== void 0 ? _l : [];
|
|
226
|
+
const languageInfo = (_o = (_m = shipment_setting.language_data) === null || _m === void 0 ? void 0 : _m[data.language]) === null || _o === void 0 ? void 0 : _o.info;
|
|
215
227
|
shipment_setting.info = languageInfo !== null && languageInfo !== void 0 ? languageInfo : shipment_setting.info;
|
|
216
228
|
const carData = {
|
|
217
229
|
customer_info: data.customer_info || {},
|
|
218
230
|
lineItems: [],
|
|
219
231
|
total: 0,
|
|
220
|
-
email: (
|
|
232
|
+
email: (_r = (_p = data.email) !== null && _p !== void 0 ? _p : (_q = data.user_info) === null || _q === void 0 ? void 0 : _q.email) !== null && _r !== void 0 ? _r : '',
|
|
221
233
|
user_info: data.user_info,
|
|
222
234
|
shipment_fee: 0,
|
|
223
235
|
rebate: 0,
|
|
@@ -231,7 +243,7 @@ class CheckoutEvent {
|
|
|
231
243
|
name: dd.title,
|
|
232
244
|
value: dd.value,
|
|
233
245
|
})),
|
|
234
|
-
...((
|
|
246
|
+
...((_s = shipment_setting.custom_delivery) !== null && _s !== void 0 ? _s : []).map((dd) => ({
|
|
235
247
|
form: dd.form,
|
|
236
248
|
name: dd.name,
|
|
237
249
|
value: dd.id,
|
|
@@ -239,8 +251,8 @@ class CheckoutEvent {
|
|
|
239
251
|
})),
|
|
240
252
|
].filter(option => shipment_setting.support.includes(option.value)),
|
|
241
253
|
use_wallet: 0,
|
|
242
|
-
method: (
|
|
243
|
-
user_email: (
|
|
254
|
+
method: (_t = data.user_info) === null || _t === void 0 ? void 0 : _t.method,
|
|
255
|
+
user_email: (_x = (_v = (_u = userData === null || userData === void 0 ? void 0 : userData.account) !== null && _u !== void 0 ? _u : data.email) !== null && _v !== void 0 ? _v : (_w = data.user_info) === null || _w === void 0 ? void 0 : _w.email) !== null && _x !== void 0 ? _x : '',
|
|
244
256
|
useRebateInfo: { point: 0 },
|
|
245
257
|
custom_form_format: data.custom_form_format,
|
|
246
258
|
custom_form_data: data.custom_form_data,
|
|
@@ -256,7 +268,7 @@ class CheckoutEvent {
|
|
|
256
268
|
fbp: data.fbp,
|
|
257
269
|
editRecord: [],
|
|
258
270
|
};
|
|
259
|
-
if (!((
|
|
271
|
+
if (!((_y = data.user_info) === null || _y === void 0 ? void 0 : _y.name) && userData && userData.userData) {
|
|
260
272
|
const { name, phone } = userData.userData;
|
|
261
273
|
carData.user_info = Object.assign(Object.assign({}, carData.user_info), { name,
|
|
262
274
|
phone });
|
|
@@ -537,7 +549,7 @@ class CheckoutEvent {
|
|
|
537
549
|
const cartTokenSQL = `
|
|
538
550
|
SELECT cart_token
|
|
539
551
|
FROM \`${this.app}\`.t_checkout
|
|
540
|
-
WHERE email IN (${[-99, (
|
|
552
|
+
WHERE email IN (${[-99, (_z = userData === null || userData === void 0 ? void 0 : userData.userData) === null || _z === void 0 ? void 0 : _z.email, (_0 = userData === null || userData === void 0 ? void 0 : userData.userData) === null || _0 === void 0 ? void 0 : _0.phone]
|
|
541
553
|
.filter(Boolean)
|
|
542
554
|
.map(item => database_js_1.default.escape(item))
|
|
543
555
|
.join(',')})
|
|
@@ -552,7 +564,7 @@ class CheckoutEvent {
|
|
|
552
564
|
const purchaseHistory = new Map();
|
|
553
565
|
for (const history of soldHistory) {
|
|
554
566
|
const pid = Number(history.product_id);
|
|
555
|
-
purchaseHistory.set(pid, ((
|
|
567
|
+
purchaseHistory.set(pid, ((_1 = purchaseHistory.get(pid)) !== null && _1 !== void 0 ? _1 : 0) + history.count);
|
|
556
568
|
}
|
|
557
569
|
for (const item of data.line_items) {
|
|
558
570
|
if (maxProductMap.has(item.id)) {
|
|
@@ -561,13 +573,13 @@ class CheckoutEvent {
|
|
|
561
573
|
}
|
|
562
574
|
}
|
|
563
575
|
checkPoint('set max product');
|
|
564
|
-
carData.select_shipment_setting = ((
|
|
576
|
+
carData.select_shipment_setting = ((_2 = data === null || data === void 0 ? void 0 : data.user_info) === null || _2 === void 0 ? void 0 : _2.shipment)
|
|
565
577
|
? await userClass.getConfigV2({
|
|
566
578
|
key: 'shipment_config_' + data.user_info.shipment,
|
|
567
579
|
user_id: 'manager',
|
|
568
580
|
})
|
|
569
581
|
: {};
|
|
570
|
-
const freeShipmnetNum = (
|
|
582
|
+
const freeShipmnetNum = (_5 = (_4 = (_3 = carData.select_shipment_setting) === null || _3 === void 0 ? void 0 : _3.cartSetting) === null || _4 === void 0 ? void 0 : _4.freeShipmnetTarget) !== null && _5 !== void 0 ? _5 : 0;
|
|
571
583
|
const isFreeShipment = freeShipmnetNum > 0 && carData.total >= freeShipmnetNum;
|
|
572
584
|
carData.shipment_fee = isFreeShipment
|
|
573
585
|
? 0
|
|
@@ -625,7 +637,7 @@ class CheckoutEvent {
|
|
|
625
637
|
await this.shopping.checkVoucher(carData);
|
|
626
638
|
checkPoint('check voucher');
|
|
627
639
|
let can_add_gift = [];
|
|
628
|
-
(
|
|
640
|
+
(_6 = carData.voucherList) === null || _6 === void 0 ? void 0 : _6.filter(dd => dd.reBackType === 'giveaway').forEach(dd => can_add_gift.push(dd.add_on_products));
|
|
629
641
|
gift_product.forEach(dd => {
|
|
630
642
|
const max_count = can_add_gift.filter(d1 => d1.includes(dd.id)).length;
|
|
631
643
|
if (max_count) {
|
|
@@ -637,7 +649,7 @@ class CheckoutEvent {
|
|
|
637
649
|
}
|
|
638
650
|
});
|
|
639
651
|
for (const giveawayData of carData.voucherList.filter(dd => dd.reBackType === 'giveaway')) {
|
|
640
|
-
if (!((
|
|
652
|
+
if (!((_7 = giveawayData.add_on_products) === null || _7 === void 0 ? void 0 : _7.length))
|
|
641
653
|
continue;
|
|
642
654
|
const productPromises = giveawayData.add_on_products
|
|
643
655
|
.map(async (id) => {
|
|
@@ -665,7 +677,7 @@ class CheckoutEvent {
|
|
|
665
677
|
appName: this.app,
|
|
666
678
|
key: 'glitter_finance',
|
|
667
679
|
});
|
|
668
|
-
const keyData = (
|
|
680
|
+
const keyData = (_8 = configData[0]) === null || _8 === void 0 ? void 0 : _8.value;
|
|
669
681
|
if (keyData) {
|
|
670
682
|
carData.payment_info_custom = keyData.payment_info_custom;
|
|
671
683
|
}
|
|
@@ -695,10 +707,10 @@ class CheckoutEvent {
|
|
|
695
707
|
}
|
|
696
708
|
});
|
|
697
709
|
checkPoint('set payment');
|
|
698
|
-
keyData.cash_on_delivery = (
|
|
710
|
+
keyData.cash_on_delivery = (_9 = keyData.cash_on_delivery) !== null && _9 !== void 0 ? _9 : { shipmentSupport: [] };
|
|
699
711
|
carData.payment_info_line_pay = keyData.payment_info_line_pay;
|
|
700
712
|
carData.payment_info_atm = keyData.payment_info_atm;
|
|
701
|
-
keyData.cash_on_delivery.shipmentSupport = (
|
|
713
|
+
keyData.cash_on_delivery.shipmentSupport = (_10 = keyData.cash_on_delivery.shipmentSupport) !== null && _10 !== void 0 ? _10 : [];
|
|
702
714
|
await this.setPaymentSetting({ carData: carData, checkoutPayment: checkoutPayment, keyData: keyData });
|
|
703
715
|
let subtotal = 0;
|
|
704
716
|
carData.lineItems.map(item => {
|
|
@@ -720,7 +732,7 @@ class CheckoutEvent {
|
|
|
720
732
|
const excludedValuesByTotal = new Set(['UNIMARTC2C', 'FAMIC2C', 'HILIFEC2C', 'OKMARTC2C']);
|
|
721
733
|
const excludedValuesByWeight = new Set(['normal', 'black_cat']);
|
|
722
734
|
const logisticsGroupResult = await userClass.getConfig({ key: 'logistics_group', user_id: 'manager' });
|
|
723
|
-
const logisticsGroup = (
|
|
735
|
+
const logisticsGroup = (_12 = (_11 = logisticsGroupResult[0]) === null || _11 === void 0 ? void 0 : _11.value) !== null && _12 !== void 0 ? _12 : [];
|
|
724
736
|
const isExcludedByTotal = (dd) => {
|
|
725
737
|
return carData.total > 20000 && excludedValuesByTotal.has(dd.value);
|
|
726
738
|
};
|
|
@@ -826,7 +838,7 @@ class CheckoutEvent {
|
|
|
826
838
|
carData.discount = data.discount;
|
|
827
839
|
carData.voucherList = [tempVoucher];
|
|
828
840
|
carData.customer_info = data.customer_info;
|
|
829
|
-
carData.total = (
|
|
841
|
+
carData.total = (_13 = data.total) !== null && _13 !== void 0 ? _13 : 0;
|
|
830
842
|
carData.rebate = tempVoucher.rebate_total;
|
|
831
843
|
if (tempVoucher.reBackType == 'shipment_free' || type == 'split') {
|
|
832
844
|
carData.shipment_fee = 0;
|
|
@@ -871,7 +883,7 @@ class CheckoutEvent {
|
|
|
871
883
|
if (checkOutType === 'POS' && Array.isArray(data.voucherList)) {
|
|
872
884
|
const manualVoucher = data.voucherList.find((item) => item.id === 0);
|
|
873
885
|
if (manualVoucher) {
|
|
874
|
-
manualVoucher.discount = (
|
|
886
|
+
manualVoucher.discount = (_14 = manualVoucher.discount_total) !== null && _14 !== void 0 ? _14 : 0;
|
|
875
887
|
carData.total -= manualVoucher.discount;
|
|
876
888
|
carData.discount += manualVoucher.discount;
|
|
877
889
|
carData.voucherList.push(manualVoucher);
|
|
@@ -911,7 +923,7 @@ class CheckoutEvent {
|
|
|
911
923
|
await trans.commit();
|
|
912
924
|
await trans.release();
|
|
913
925
|
await Promise.all(saveStockArray.map(dd => dd()));
|
|
914
|
-
await this.shopping.releaseCheckout((
|
|
926
|
+
await this.shopping.releaseCheckout((_15 = data.pay_status) !== null && _15 !== void 0 ? _15 : 0, carData.orderID);
|
|
915
927
|
checkPoint('release pos checkout');
|
|
916
928
|
for (const email of new Set([carData.customer_info, carData.user_info].map(dd => {
|
|
917
929
|
return dd && dd.email;
|
|
@@ -965,7 +977,7 @@ class CheckoutEvent {
|
|
|
965
977
|
appName: this.app,
|
|
966
978
|
key: 'glitter_finance',
|
|
967
979
|
}))[0].value;
|
|
968
|
-
let kd = (
|
|
980
|
+
let kd = (_16 = keyData[carData.customer_info.payment_select]) !== null && _16 !== void 0 ? _16 : {
|
|
969
981
|
ReturnURL: '',
|
|
970
982
|
NotifyURL: '',
|
|
971
983
|
};
|