ts-glitter 13.2.2 → 13.2.4
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 +14 -38
- package/lowcode/Entry.ts +23 -41
- package/lowcode/backend-manager/bg-customer-message.js +12 -3
- package/lowcode/backend-manager/bg-customer-message.ts +29 -14
- package/lowcode/backend-manager/bg-guide.js +197 -31
- package/lowcode/backend-manager/bg-guide.ts +281 -75
- package/lowcode/backend-manager/bg-widget.js +1 -1
- package/lowcode/backend-manager/bg-widget.ts +1 -1
- package/lowcode/glitter-base/route/shopping.js +11 -0
- package/lowcode/glitter-base/route/shopping.ts +11 -0
- package/lowcode/jspage/editor.js +75 -6
- package/lowcode/jspage/editor.ts +75 -8
- package/lowcode/jspage/main.js +11 -5
- package/lowcode/jspage/main.ts +13 -5
- package/lowcode/view-model/saas-view-model.js +1 -1
- package/lowcode/view-model/saas-view-model.ts +1 -1
- package/package.json +1 -1
- package/src/api-public/controllers/fb-message.js +0 -1
- package/src/api-public/controllers/fb-message.js.map +1 -1
- package/src/api-public/controllers/fb-message.ts +0 -1
- package/src/api-public/services/chat.js +0 -1
- package/src/api-public/services/chat.js.map +5 -1
- package/src/api-public/services/chat.ts +0 -1
- package/src/api-public/services/fb-message.d.ts +2 -0
- package/src/api-public/services/fb-message.js +183 -31
- package/src/api-public/services/fb-message.js.map +1 -1
- package/src/api-public/services/fb-message.ts +202 -38
- package/src/api-public/services/line-message.d.ts +1 -0
- package/image_cropped.jpg +0 -0
- package/image_cropped.png +0 -0
package/lowcode/Entry.js
CHANGED
|
@@ -8,7 +8,6 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
8
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
|
-
import { ApiUser } from './api/user.js';
|
|
12
11
|
import { config } from './config.js';
|
|
13
12
|
import { ApiPageConfig } from './api/pageConfig.js';
|
|
14
13
|
import { BaseApi } from './glitterBundle/api/base.js';
|
|
@@ -57,7 +56,7 @@ export class Entry {
|
|
|
57
56
|
}
|
|
58
57
|
window.renderClock = (_a = window.renderClock) !== null && _a !== void 0 ? _a : clockF();
|
|
59
58
|
console.log(`Entry-time:`, window.renderClock.stop());
|
|
60
|
-
glitter.share.editerVersion = "V_13.2.
|
|
59
|
+
glitter.share.editerVersion = "V_13.2.4";
|
|
61
60
|
glitter.share.start = (new Date());
|
|
62
61
|
const vm = {
|
|
63
62
|
appConfig: [],
|
|
@@ -262,46 +261,23 @@ export class Entry {
|
|
|
262
261
|
}
|
|
263
262
|
}));
|
|
264
263
|
}
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
const url = new URL(glitter.location.href);
|
|
276
|
-
location.href = `${url.origin}/glitter/?page=signin`;
|
|
277
|
-
}
|
|
278
|
-
});
|
|
279
|
-
}
|
|
280
|
-
else {
|
|
281
|
-
if (!GlobalUser.saas_token) {
|
|
264
|
+
BaseApi.create({
|
|
265
|
+
url: config.url + `/api/v1/user/checkToken`,
|
|
266
|
+
type: 'GET',
|
|
267
|
+
timeout: 0,
|
|
268
|
+
headers: {
|
|
269
|
+
'Content-Type': 'application/json',
|
|
270
|
+
Authorization: GlobalUser.saas_token,
|
|
271
|
+
},
|
|
272
|
+
}).then((d2) => {
|
|
273
|
+
if (!d2.result) {
|
|
282
274
|
const url = new URL(glitter.location.href);
|
|
283
|
-
location.href = `${url.origin}/
|
|
275
|
+
location.href = `${url.origin}/${window.glitterBase}/login`;
|
|
284
276
|
}
|
|
285
277
|
else {
|
|
286
|
-
|
|
287
|
-
url: config.url + `/api/v1/user/checkToken`,
|
|
288
|
-
type: 'GET',
|
|
289
|
-
timeout: 0,
|
|
290
|
-
headers: {
|
|
291
|
-
'Content-Type': 'application/json',
|
|
292
|
-
Authorization: GlobalUser.saas_token,
|
|
293
|
-
},
|
|
294
|
-
}).then((d2) => {
|
|
295
|
-
if (!d2.result) {
|
|
296
|
-
const url = new URL(glitter.location.href);
|
|
297
|
-
location.href = `${url.origin}/glitter/?page=signin`;
|
|
298
|
-
}
|
|
299
|
-
else {
|
|
300
|
-
toNext();
|
|
301
|
-
}
|
|
302
|
-
});
|
|
278
|
+
toNext();
|
|
303
279
|
}
|
|
304
|
-
}
|
|
280
|
+
});
|
|
305
281
|
}
|
|
306
282
|
static toHtmlEditor(glitter, vm, callback) {
|
|
307
283
|
var _a;
|
package/lowcode/Entry.ts
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
import {Glitter} from './glitterBundle/Glitter.js';
|
|
3
|
-
import {ApiUser} from './api/user.js';
|
|
4
3
|
import {config} from './config.js';
|
|
5
4
|
import {ApiPageConfig} from './api/pageConfig.js';
|
|
6
5
|
import {BaseApi} from './glitterBundle/api/base.js';
|
|
7
6
|
import {GlobalUser} from './glitter-base/global/global-user.js';
|
|
8
7
|
import {EditorConfig} from './editor-config.js';
|
|
9
8
|
import {ShareDialog} from "./glitterBundle/dialog/ShareDialog.js";
|
|
9
|
+
import {ApiUser} from "./glitter-base/route/user.js";
|
|
10
10
|
|
|
11
11
|
export class Entry {
|
|
12
12
|
public static onCreate(glitter: Glitter) {
|
|
13
|
-
glitter.share.top_inset=0
|
|
14
|
-
glitter.share.bottom_inset=0
|
|
13
|
+
glitter.share.top_inset = 0
|
|
14
|
+
glitter.share.bottom_inset = 0
|
|
15
15
|
glitter.share.reload_code_hash = function () {
|
|
16
16
|
const hashCode = (window as any).preloadData.eval_code_hash || {};
|
|
17
17
|
Object.keys(hashCode).map((dd, index) => {
|
|
@@ -56,7 +56,7 @@ export class Entry {
|
|
|
56
56
|
}
|
|
57
57
|
(window as any).renderClock = (window as any).renderClock ?? clockF();
|
|
58
58
|
console.log(`Entry-time:`, (window as any).renderClock.stop());
|
|
59
|
-
glitter.share.editerVersion = "V_13.2.
|
|
59
|
+
glitter.share.editerVersion = "V_13.2.4";
|
|
60
60
|
glitter.share.start = (new Date());
|
|
61
61
|
const vm: {
|
|
62
62
|
appConfig: any;
|
|
@@ -73,11 +73,11 @@ export class Entry {
|
|
|
73
73
|
// 資源初始化
|
|
74
74
|
Entry.resourceInitial(glitter, vm, async (dd) => {
|
|
75
75
|
glitter.addStyle(`
|
|
76
|
-
${(parseInt((window.parent as any).glitter.share.bottom_inset,10)) ? `
|
|
76
|
+
${(parseInt((window.parent as any).glitter.share.bottom_inset, 10)) ? `
|
|
77
77
|
.update-bar-container {
|
|
78
78
|
padding-bottom:${(window.parent as any).glitter.share.bottom_inset}px !important;
|
|
79
79
|
}
|
|
80
|
-
|
|
80
|
+
` : ``}
|
|
81
81
|
|
|
82
82
|
.editorParent .editorChild {
|
|
83
83
|
display: none;
|
|
@@ -161,8 +161,8 @@ export class Entry {
|
|
|
161
161
|
// 載入全域資源
|
|
162
162
|
await Entry.globalStyle(glitter, dd);
|
|
163
163
|
if (glitter.getUrlParameter('type') === 'editor') {
|
|
164
|
-
const dialog=new ShareDialog(glitter)
|
|
165
|
-
dialog.dataLoading({visible:true,text:'後台載入中'})
|
|
164
|
+
const dialog = new ShareDialog(glitter)
|
|
165
|
+
dialog.dataLoading({visible: true, text: '後台載入中'})
|
|
166
166
|
// 頁面編輯器
|
|
167
167
|
Entry.toBackendEditor(glitter, () => {
|
|
168
168
|
});
|
|
@@ -210,6 +210,8 @@ export class Entry {
|
|
|
210
210
|
if (!glitter.getUrlParameter('function')) {
|
|
211
211
|
glitter.setUrlParameter('function', 'backend-manger');
|
|
212
212
|
}
|
|
213
|
+
|
|
214
|
+
|
|
213
215
|
glitter.addStyle(`
|
|
214
216
|
@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+TC:wght@100..900&family=Noto+Sans:ital,wght@0,100..900;1,100..900&display=swap');
|
|
215
217
|
@media (prefers-reduced-motion: no-preference) {
|
|
@@ -282,42 +284,22 @@ export class Entry {
|
|
|
282
284
|
});
|
|
283
285
|
}
|
|
284
286
|
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
location.href = `${url.origin}/glitter/?page=signin`;
|
|
296
|
-
}
|
|
297
|
-
});
|
|
298
|
-
} else {
|
|
299
|
-
if (!GlobalUser.saas_token) {
|
|
287
|
+
BaseApi.create({
|
|
288
|
+
url: config.url + `/api/v1/user/checkToken`,
|
|
289
|
+
type: 'GET',
|
|
290
|
+
timeout: 0,
|
|
291
|
+
headers: {
|
|
292
|
+
'Content-Type': 'application/json',
|
|
293
|
+
Authorization: GlobalUser.saas_token,
|
|
294
|
+
},
|
|
295
|
+
}).then((d2) => {
|
|
296
|
+
if (!d2.result) {
|
|
300
297
|
const url = new URL(glitter.location.href);
|
|
301
|
-
location.href = `${url.origin}/
|
|
298
|
+
location.href = `${url.origin}/${(window as any).glitterBase}/login`;
|
|
302
299
|
} else {
|
|
303
|
-
|
|
304
|
-
url: config.url + `/api/v1/user/checkToken`,
|
|
305
|
-
type: 'GET',
|
|
306
|
-
timeout: 0,
|
|
307
|
-
headers: {
|
|
308
|
-
'Content-Type': 'application/json',
|
|
309
|
-
Authorization: GlobalUser.saas_token,
|
|
310
|
-
},
|
|
311
|
-
}).then((d2) => {
|
|
312
|
-
if (!d2.result) {
|
|
313
|
-
const url = new URL(glitter.location.href);
|
|
314
|
-
location.href = `${url.origin}/glitter/?page=signin`;
|
|
315
|
-
} else {
|
|
316
|
-
toNext();
|
|
317
|
-
}
|
|
318
|
-
});
|
|
300
|
+
toNext();
|
|
319
301
|
}
|
|
320
|
-
}
|
|
302
|
+
});
|
|
321
303
|
}
|
|
322
304
|
|
|
323
305
|
// 跳轉至頁面編輯器Iframe顯示
|
|
@@ -113,9 +113,18 @@ export class BgCustomerMessage {
|
|
|
113
113
|
class="rounded-circle border"
|
|
114
114
|
style="background: white;border-radius: 50%;width: 40px;height: 40px;" width="40"
|
|
115
115
|
alt="Albert Flores">
|
|
116
|
-
<div class="d-flex
|
|
117
|
-
<h6 class="mb-0 text-white
|
|
118
|
-
|
|
116
|
+
<div class="d-flex px-1 text-white align-items-center" style="gap:8px;">
|
|
117
|
+
<h6 class="mb-0 text-white " style="">一站式客服整合系統</h6>
|
|
118
|
+
${BgWidget.questionButton(gvc.event(() => {
|
|
119
|
+
BgWidget.dialog({
|
|
120
|
+
gvc,
|
|
121
|
+
title: '提示',
|
|
122
|
+
innerHTML: () => {
|
|
123
|
+
return BgWidget.alertInfo([`<div class="fs-6 fw-500" style="white-space: normal;word-break: break-all;">請前往第三方整合設定,以同步Line與Facebook官方訊息。為確保訊息同步,請統一透過SHOPNEX後台發送訊息。</div>`].join('')) + ` <img class="w-100" src="https://d3jnmi1tfjgtti.cloudfront.net/file/122538856/Screenshot 2024-10-22 at 4.58.00 PM.jpg">`;
|
|
124
|
+
},
|
|
125
|
+
width: 200
|
|
126
|
+
});
|
|
127
|
+
}))}
|
|
119
128
|
</div>
|
|
120
129
|
<div class="flex-fill" style="flex: 1;"></div>
|
|
121
130
|
<i class="fa-regular fa-circle-xmark text-white fs-3 " aria-hidden="true"
|
|
@@ -129,9 +129,20 @@ export class BgCustomerMessage {
|
|
|
129
129
|
class="rounded-circle border"
|
|
130
130
|
style="background: white;border-radius: 50%;width: 40px;height: 40px;" width="40"
|
|
131
131
|
alt="Albert Flores">
|
|
132
|
-
<div class="d-flex
|
|
133
|
-
<h6 class="mb-0 text-white
|
|
134
|
-
|
|
132
|
+
<div class="d-flex px-1 text-white align-items-center" style="gap:8px;">
|
|
133
|
+
<h6 class="mb-0 text-white " style="">一站式客服整合系統</h6>
|
|
134
|
+
${BgWidget.questionButton(
|
|
135
|
+
gvc.event(() => {
|
|
136
|
+
BgWidget.dialog({
|
|
137
|
+
gvc,
|
|
138
|
+
title: '提示',
|
|
139
|
+
innerHTML: () => {
|
|
140
|
+
return BgWidget.alertInfo([`<div class="fs-6 fw-500" style="white-space: normal;word-break: break-all;">請前往第三方整合設定,以同步Line與Facebook官方訊息。為確保訊息同步,請統一透過SHOPNEX後台發送訊息。</div>`].join(''))+` <img class="w-100" src="https://d3jnmi1tfjgtti.cloudfront.net/file/122538856/Screenshot 2024-10-22 at 4.58.00 PM.jpg">`
|
|
141
|
+
},
|
|
142
|
+
width: 200
|
|
143
|
+
});
|
|
144
|
+
})
|
|
145
|
+
)}
|
|
135
146
|
</div>
|
|
136
147
|
<div class="flex-fill" style="flex: 1;"></div>
|
|
137
148
|
<i class="fa-regular fa-circle-xmark text-white fs-3 " aria-hidden="true"
|
|
@@ -692,7 +703,8 @@ export class BgCustomerMessage {
|
|
|
692
703
|
const listId = gvc.glitter.getUUID();
|
|
693
704
|
let chatData: any = undefined;
|
|
694
705
|
let unRead: any = undefined;
|
|
695
|
-
|
|
706
|
+
|
|
707
|
+
function loadData() {
|
|
696
708
|
Chat.getChatRoom({
|
|
697
709
|
page: 0,
|
|
698
710
|
limit: 1000,
|
|
@@ -707,11 +719,13 @@ export class BgCustomerMessage {
|
|
|
707
719
|
});
|
|
708
720
|
});
|
|
709
721
|
}
|
|
722
|
+
|
|
710
723
|
let socket: any = undefined
|
|
711
724
|
const url = new URL((window as any).glitterBackend)
|
|
712
725
|
let vm = {
|
|
713
726
|
close: false
|
|
714
727
|
}
|
|
728
|
+
|
|
715
729
|
function connect() {
|
|
716
730
|
socket = (location.href.includes('https://')) ? new WebSocket(`wss://${url.hostname}/websocket`) : new WebSocket(`ws://${url.hostname}:9003`);
|
|
717
731
|
socket.addEventListener('open', function (event: any) {
|
|
@@ -726,7 +740,7 @@ export class BgCustomerMessage {
|
|
|
726
740
|
console.log(`update_message_count`)
|
|
727
741
|
const data = JSON.parse(event.data)
|
|
728
742
|
if (data.type === 'update_message_count') {
|
|
729
|
-
vm.close=true
|
|
743
|
+
vm.close = true
|
|
730
744
|
socket && socket.close()
|
|
731
745
|
loadData()
|
|
732
746
|
}
|
|
@@ -739,6 +753,7 @@ export class BgCustomerMessage {
|
|
|
739
753
|
}
|
|
740
754
|
});
|
|
741
755
|
}
|
|
756
|
+
|
|
742
757
|
loadData()
|
|
743
758
|
|
|
744
759
|
return {
|
|
@@ -764,7 +779,7 @@ export class BgCustomerMessage {
|
|
|
764
779
|
dd.topMessage.text = dd.topMessage?.text ?? "圖片內容";
|
|
765
780
|
dd.user_data = dd.user_data ?? {}
|
|
766
781
|
if (dd.topMessage && dd.chat_id !== 'manager-preview') {
|
|
767
|
-
console.log(`unRead==>`,unRead)
|
|
782
|
+
console.log(`unRead==>`, unRead)
|
|
768
783
|
const unReadCount = unRead.filter((d2: any) => {
|
|
769
784
|
return dd.chat_id === d2.chat_id;
|
|
770
785
|
}).length;
|
|
@@ -891,15 +906,15 @@ export class BgCustomerMessage {
|
|
|
891
906
|
}
|
|
892
907
|
},
|
|
893
908
|
divCreate: {},
|
|
894
|
-
onCreate:()=>{
|
|
895
|
-
setTimeout(()=>{
|
|
896
|
-
vm.close=false
|
|
909
|
+
onCreate: () => {
|
|
910
|
+
setTimeout(() => {
|
|
911
|
+
vm.close = false
|
|
897
912
|
connect()
|
|
898
|
-
},50)
|
|
913
|
+
}, 50)
|
|
899
914
|
|
|
900
915
|
},
|
|
901
|
-
onDestroy:()=>{
|
|
902
|
-
vm.close=true
|
|
916
|
+
onDestroy: () => {
|
|
917
|
+
vm.close = true
|
|
903
918
|
socket && socket.close()
|
|
904
919
|
}
|
|
905
920
|
};
|
|
@@ -1184,9 +1199,9 @@ export class BgCustomerMessage {
|
|
|
1184
1199
|
document.querySelector(`#message-lines`).innerHTML += BgCustomerMessage.message_line(data, cf, vm.data.length - 1, vm, gvc);
|
|
1185
1200
|
if (st + ofs >= sh - 50) {
|
|
1186
1201
|
element.scrollTop = element.scrollHeight;
|
|
1187
|
-
setTimeout(()=>{
|
|
1202
|
+
setTimeout(() => {
|
|
1188
1203
|
element.scrollTop = element.scrollHeight;
|
|
1189
|
-
},1000)
|
|
1204
|
+
}, 1000)
|
|
1190
1205
|
}
|
|
1191
1206
|
}
|
|
1192
1207
|
});
|