ts-glitter 20.0.8 → 20.1.0
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/lib/glitterBundle/GlitterInitial.ts +1 -1
- package/lowcode/Entry.js +179 -173
- package/lowcode/Entry.ts +192 -185
- package/lowcode/application-config.js +11 -0
- package/lowcode/application-config.ts +14 -0
- package/lowcode/glitterBundle/GlitterInitial.js +1 -1
- package/lowcode/glitterBundle/GlitterInitial.ts +1 -1
- package/lowcode/index.html +2782 -215
- package/lowcode/official_view_component/official/component.js +9 -1
- package/lowcode/official_view_component/official/component.ts +9 -2
- package/lowcode/public-components/checkout/index.js +54 -23
- package/lowcode/public-components/checkout/index.ts +96 -66
- package/lowcode/src/glitterBundle/GlitterInitial.js +1 -1
- package/lowcode/src/glitterBundle/GlitterInitial.ts +1 -1
- package/package.json +1 -1
- package/src/app-project/ios/proshake.xcodeproj/project.xcworkspace/xcuserdata/jianzhi.wang.xcuserdatad/UserInterfaceState.xcuserstate +0 -0
|
@@ -175,7 +175,7 @@ function traverseHTML(element: any) {
|
|
|
175
175
|
|
|
176
176
|
if ((window as any).GL !== undefined) {
|
|
177
177
|
glitter.deviceType = glitter.deviceTypeEnum.Android;
|
|
178
|
-
} else if (navigator.userAgent
|
|
178
|
+
} else if (navigator.userAgent.includes('iosGlitter')) {
|
|
179
179
|
glitter.deviceType = glitter.deviceTypeEnum.Ios;
|
|
180
180
|
}
|
|
181
181
|
listenElementChange(`#glitterPage`)
|
package/lowcode/Entry.js
CHANGED
|
@@ -21,118 +21,103 @@ import { ApiUser } from './glitter-base/route/user.js';
|
|
|
21
21
|
import { ApplicationConfig } from './application-config.js';
|
|
22
22
|
export class Entry {
|
|
23
23
|
static onCreate(glitter) {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
glitter.
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
});
|
|
40
|
-
}
|
|
41
|
-
if (glitter.getUrlParameter('EndCheckout') === '1') {
|
|
42
|
-
try {
|
|
43
|
-
const lineItemIds = JSON.parse(localStorage.getItem('clear_cart_items'));
|
|
44
|
-
const cartKeys = [ApiCart.cartPrefix, ApiCart.buyItNow, ApiCart.globalCart];
|
|
45
|
-
for (let i = 0; i < localStorage.length; i++) {
|
|
46
|
-
const key = localStorage.key(i);
|
|
47
|
-
if (key && cartKeys.some(cartKey => key === null || key === void 0 ? void 0 : key.includes(cartKey))) {
|
|
48
|
-
const formatKey = key === null || key === void 0 ? void 0 : key.replace(window.appName, '');
|
|
49
|
-
const cart = new ApiCart(formatKey);
|
|
50
|
-
cart.setCart(cartItem => {
|
|
51
|
-
cartItem.line_items = cartItem.line_items.filter(item => !lineItemIds.includes(item.id));
|
|
52
|
-
});
|
|
24
|
+
function next() {
|
|
25
|
+
var _a, _b;
|
|
26
|
+
if (glitter.getUrlParameter('EndCheckout') === '1') {
|
|
27
|
+
try {
|
|
28
|
+
const lineItemIds = JSON.parse(localStorage.getItem('clear_cart_items'));
|
|
29
|
+
const cartKeys = [ApiCart.cartPrefix, ApiCart.buyItNow, ApiCart.globalCart];
|
|
30
|
+
for (let i = 0; i < localStorage.length; i++) {
|
|
31
|
+
const key = localStorage.key(i);
|
|
32
|
+
if (key && cartKeys.some(cartKey => key === null || key === void 0 ? void 0 : key.includes(cartKey))) {
|
|
33
|
+
const formatKey = key === null || key === void 0 ? void 0 : key.replace(window.appName, '');
|
|
34
|
+
const cart = new ApiCart(formatKey);
|
|
35
|
+
cart.setCart(cartItem => {
|
|
36
|
+
cartItem.line_items = cartItem.line_items.filter(item => !lineItemIds.includes(item.id));
|
|
37
|
+
});
|
|
38
|
+
}
|
|
53
39
|
}
|
|
40
|
+
localStorage.removeItem('clear_cart_items');
|
|
54
41
|
}
|
|
55
|
-
|
|
42
|
+
catch (e) { }
|
|
56
43
|
}
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
try {
|
|
64
|
-
if (document.querySelector(`${location.hash}`)) {
|
|
65
|
-
location.href = `${location.hash}`;
|
|
66
|
-
clearInterval(hashLoop);
|
|
67
|
-
const clock2 = glitter.ut.clock();
|
|
68
|
-
const interVal = setInterval(() => {
|
|
44
|
+
glitter.share.ApiCart = ApiCart;
|
|
45
|
+
glitter.share.ApiUser = ApiUser;
|
|
46
|
+
const clock = glitter.ut.clock();
|
|
47
|
+
const hashLoop = setInterval(() => {
|
|
48
|
+
try {
|
|
49
|
+
if (document.querySelector(`${location.hash}`)) {
|
|
69
50
|
location.href = `${location.hash}`;
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
51
|
+
clearInterval(hashLoop);
|
|
52
|
+
const clock2 = glitter.ut.clock();
|
|
53
|
+
const interVal = setInterval(() => {
|
|
54
|
+
location.href = `${location.hash}`;
|
|
55
|
+
if (clock2.stop() > 2000) {
|
|
56
|
+
clearInterval(interVal);
|
|
57
|
+
}
|
|
58
|
+
}, 100);
|
|
59
|
+
}
|
|
60
|
+
else if (clock.stop() > 5000) {
|
|
61
|
+
clearInterval(hashLoop);
|
|
62
|
+
}
|
|
74
63
|
}
|
|
75
|
-
|
|
64
|
+
catch (e) {
|
|
76
65
|
clearInterval(hashLoop);
|
|
77
66
|
}
|
|
67
|
+
}, 100);
|
|
68
|
+
window.store_info.web_type = (_a = window.store_info.web_type) !== null && _a !== void 0 ? _a : ['shop'];
|
|
69
|
+
const shopp = localStorage.getItem('shopee');
|
|
70
|
+
if (shopp) {
|
|
71
|
+
localStorage.removeItem('shopee');
|
|
72
|
+
localStorage.setItem('shopeeCode', JSON.stringify({
|
|
73
|
+
code: glitter.getUrlParameter('code'),
|
|
74
|
+
shop_id: glitter.getUrlParameter('shop_id'),
|
|
75
|
+
}));
|
|
76
|
+
location.href = shopp;
|
|
77
|
+
return;
|
|
78
78
|
}
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
localStorage.removeItem('shopee');
|
|
87
|
-
localStorage.setItem('shopeeCode', JSON.stringify({
|
|
88
|
-
code: glitter.getUrlParameter('code'),
|
|
89
|
-
shop_id: glitter.getUrlParameter('shop_id'),
|
|
90
|
-
}));
|
|
91
|
-
location.href = shopp;
|
|
92
|
-
return;
|
|
93
|
-
}
|
|
94
|
-
if (window.language !== Language.getLanguage()) {
|
|
95
|
-
const url = new URL(`${glitter.root_path}${Language.getLanguageLinkPrefix()}${window.glitter_page}${new URL(location.href).search}`);
|
|
96
|
-
if (glitter.getUrlParameter('appName')) {
|
|
97
|
-
url.searchParams.set('appName', glitter.getUrlParameter('appName'));
|
|
79
|
+
if (window.language !== Language.getLanguage()) {
|
|
80
|
+
const url = new URL(`${glitter.root_path}${Language.getLanguageLinkPrefix()}${window.glitter_page}${new URL(location.href).search}`);
|
|
81
|
+
if (glitter.getUrlParameter('appName')) {
|
|
82
|
+
url.searchParams.set('appName', glitter.getUrlParameter('appName'));
|
|
83
|
+
}
|
|
84
|
+
location.href = url.href;
|
|
85
|
+
return;
|
|
98
86
|
}
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
if (typeof hashCode[dd] === 'string') {
|
|
114
|
-
try {
|
|
115
|
-
hashCode[dd] = new Function(`return {
|
|
87
|
+
glitter.share.reload = (page, app_name) => {
|
|
88
|
+
window.appName = app_name || window.appName;
|
|
89
|
+
window.glitter_page = page;
|
|
90
|
+
location.reload();
|
|
91
|
+
};
|
|
92
|
+
glitter.share.updated_form_data = {};
|
|
93
|
+
glitter.share.top_inset = 0;
|
|
94
|
+
glitter.share.bottom_inset = 0;
|
|
95
|
+
glitter.share.reload_code_hash = function () {
|
|
96
|
+
const hashCode = window.preloadData.eval_code_hash || {};
|
|
97
|
+
Object.keys(hashCode).map(dd => {
|
|
98
|
+
if (typeof hashCode[dd] === 'string') {
|
|
99
|
+
try {
|
|
100
|
+
hashCode[dd] = new Function(`return {
|
|
116
101
|
execute:(gvc,widget,object,subData,element,window,document,glitter,$)=>{
|
|
117
102
|
return (() => { ${hashCode[dd]} })()
|
|
118
103
|
}
|
|
119
104
|
}`)().execute;
|
|
105
|
+
}
|
|
106
|
+
catch (e) {
|
|
107
|
+
console.error(`reload_code_hash error: ` + e);
|
|
108
|
+
}
|
|
120
109
|
}
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
Entry.checkRedirectPage(glitter);
|
|
133
|
-
}
|
|
134
|
-
glitter.share.logID = glitter.getUUID();
|
|
135
|
-
glitter.addStyle(`
|
|
110
|
+
});
|
|
111
|
+
};
|
|
112
|
+
glitter.share.reload_code_hash();
|
|
113
|
+
glitter.share.editor_util = { baseApi: BaseApi };
|
|
114
|
+
glitter.page = window.glitter_page;
|
|
115
|
+
glitter.share.GlobalUser = GlobalUser;
|
|
116
|
+
if (glitter.getUrlParameter('page') !== 'backend_manager') {
|
|
117
|
+
Entry.checkRedirectPage(glitter);
|
|
118
|
+
}
|
|
119
|
+
glitter.share.logID = glitter.getUUID();
|
|
120
|
+
glitter.addStyle(`
|
|
136
121
|
@media (prefers-reduced-motion: no-preference) {
|
|
137
122
|
:root {
|
|
138
123
|
scroll-behavior: auto !important;
|
|
@@ -145,29 +130,29 @@ export class Entry {
|
|
|
145
130
|
left: -1000px !important;
|
|
146
131
|
}
|
|
147
132
|
`);
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
133
|
+
if (glitter.getUrlParameter('appName')) {
|
|
134
|
+
window.appName = glitter.getUrlParameter('appName');
|
|
135
|
+
}
|
|
136
|
+
window.renderClock = (_b = window.renderClock) !== null && _b !== void 0 ? _b : createClock();
|
|
137
|
+
console.log(`Entry-time:`, window.renderClock.stop());
|
|
138
|
+
glitter.share.editerVersion = 'V_20.1.0';
|
|
139
|
+
glitter.share.start = new Date();
|
|
140
|
+
const vm = { appConfig: [] };
|
|
141
|
+
window.saasConfig = {
|
|
142
|
+
config: (window.config = config),
|
|
143
|
+
api: ApiPageConfig,
|
|
144
|
+
appConfig: undefined,
|
|
145
|
+
};
|
|
146
|
+
config.token = GlobalUser.saas_token;
|
|
147
|
+
Entry.resourceInitial(glitter, vm, (dd) => __awaiter(this, void 0, void 0, function* () {
|
|
148
|
+
glitter.addStyle(`
|
|
164
149
|
${parseInt(window.parent.glitter.share.bottom_inset, 10)
|
|
165
|
-
|
|
150
|
+
? `
|
|
166
151
|
.update-bar-container {
|
|
167
152
|
padding-bottom: ${window.parent.glitter.share.bottom_inset}px !important;
|
|
168
153
|
}
|
|
169
154
|
`
|
|
170
|
-
|
|
155
|
+
: ``}
|
|
171
156
|
|
|
172
157
|
.editorParent .editorChild {
|
|
173
158
|
display: none;
|
|
@@ -245,70 +230,91 @@ export class Entry {
|
|
|
245
230
|
list-style: none;
|
|
246
231
|
}
|
|
247
232
|
`);
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
}
|
|
254
|
-
else if (glitter.getUrlParameter('type') === 'htmlEditor') {
|
|
255
|
-
Entry.toHtmlEditor(glitter, vm, () => Entry.checkIframe(glitter));
|
|
256
|
-
}
|
|
257
|
-
else if (glitter.getUrlParameter('page') === 'backend_manager') {
|
|
258
|
-
if (!GlobalUser.token) {
|
|
259
|
-
glitter.setUrlParameter('page', 'login');
|
|
260
|
-
location.reload();
|
|
233
|
+
yield Entry.globalStyle(glitter, dd);
|
|
234
|
+
if (glitter.getUrlParameter('type') === 'editor') {
|
|
235
|
+
const dialog = new ShareDialog(glitter);
|
|
236
|
+
dialog.dataLoading({ visible: true, text: '後台載入中' });
|
|
237
|
+
Entry.toBackendEditor(glitter, () => { });
|
|
261
238
|
}
|
|
262
|
-
else {
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
239
|
+
else if (glitter.getUrlParameter('type') === 'htmlEditor') {
|
|
240
|
+
Entry.toHtmlEditor(glitter, vm, () => Entry.checkIframe(glitter));
|
|
241
|
+
}
|
|
242
|
+
else if (glitter.getUrlParameter('page') === 'backend_manager') {
|
|
243
|
+
if (!GlobalUser.token) {
|
|
244
|
+
glitter.setUrlParameter('page', 'login');
|
|
245
|
+
location.reload();
|
|
246
|
+
}
|
|
247
|
+
else {
|
|
248
|
+
try {
|
|
249
|
+
const appList = (yield ApiPageConfig.getAppList(undefined, GlobalUser.token)).response.result;
|
|
250
|
+
localStorage.setItem('select_item', '0');
|
|
251
|
+
if (appList.length === 0) {
|
|
252
|
+
glitter.getModule(new URL('./view-model/saas-view-model.js', location.href).href, SaasViewModel => {
|
|
253
|
+
glitter.innerDialog(gvc => {
|
|
254
|
+
return gvc.bindView(() => {
|
|
255
|
+
return {
|
|
256
|
+
bind: gvc.glitter.getUUID(),
|
|
257
|
+
view: () => SaasViewModel.createShop(gvc, true),
|
|
258
|
+
};
|
|
259
|
+
});
|
|
260
|
+
}, 'change_app');
|
|
261
|
+
});
|
|
282
262
|
}
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
263
|
+
else {
|
|
264
|
+
let appName = appList[0].appName;
|
|
265
|
+
if (appList.find((dd) => dd.appName === localStorage.getItem('select_app_name'))) {
|
|
266
|
+
appName = localStorage.getItem('select_app_name');
|
|
267
|
+
}
|
|
268
|
+
glitter.setUrlParameter('page', 'index');
|
|
269
|
+
glitter.setUrlParameter('type', 'editor');
|
|
270
|
+
glitter.setUrlParameter('appName', appName);
|
|
271
|
+
glitter.setUrlParameter('function', 'backend-manger');
|
|
272
|
+
location.reload();
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
catch (e) {
|
|
276
|
+
console.error(e);
|
|
277
|
+
glitter.setUrlParameter('page', 'login');
|
|
287
278
|
location.reload();
|
|
288
279
|
}
|
|
289
280
|
}
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
281
|
+
}
|
|
282
|
+
else {
|
|
283
|
+
Entry.toNormalRender(glitter, vm, () => Entry.checkIframe(glitter));
|
|
284
|
+
}
|
|
285
|
+
}));
|
|
286
|
+
glitter.share.LanguageApi = Language;
|
|
287
|
+
glitter.share.plan_text = () => GlobalUser.getPlan().title;
|
|
288
|
+
window.addEventListener('resize', () => {
|
|
289
|
+
const width = window.innerWidth;
|
|
290
|
+
const height = window.innerHeight;
|
|
291
|
+
for (const b of document.querySelectorAll(`.glitter-dialog`)) {
|
|
292
|
+
b.style.height = `${height}px`;
|
|
293
|
+
b.style.minHeight = `${height}px`;
|
|
294
|
+
}
|
|
295
|
+
console.log(`視窗大小變化: 寬度=${width}px, 高度=${height}px`);
|
|
296
|
+
});
|
|
297
|
+
}
|
|
298
|
+
if (window.parent.glitter.getUrlParameter('device') === 'mobile') {
|
|
299
|
+
glitter.share.is_application = true;
|
|
300
|
+
next();
|
|
301
|
+
}
|
|
302
|
+
else {
|
|
303
|
+
glitter.runJsInterFace('is_application', {}, res => {
|
|
304
|
+
glitter.share.is_application = res.is_application;
|
|
305
|
+
if (glitter.share.is_application) {
|
|
306
|
+
ApplicationConfig.is_application = res.is_application;
|
|
307
|
+
ApplicationConfig.bundle_id = res.bundle_id;
|
|
308
|
+
ApplicationConfig.device_type = res.device_type;
|
|
309
|
+
ApplicationConfig.initial(glitter);
|
|
310
|
+
if (res.redirect) {
|
|
311
|
+
location.href = res.redirect;
|
|
294
312
|
}
|
|
313
|
+
window.is_application = true;
|
|
295
314
|
}
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
}
|
|
300
|
-
}));
|
|
301
|
-
glitter.share.LanguageApi = Language;
|
|
302
|
-
glitter.share.plan_text = () => GlobalUser.getPlan().title;
|
|
303
|
-
window.addEventListener('resize', () => {
|
|
304
|
-
const width = window.innerWidth;
|
|
305
|
-
const height = window.innerHeight;
|
|
306
|
-
for (const b of document.querySelectorAll(`.glitter-dialog`)) {
|
|
307
|
-
b.style.height = `${height}px`;
|
|
308
|
-
b.style.minHeight = `${height}px`;
|
|
309
|
-
}
|
|
310
|
-
console.log(`視窗大小變化: 寬度=${width}px, 高度=${height}px`);
|
|
311
|
-
});
|
|
315
|
+
next();
|
|
316
|
+
});
|
|
317
|
+
}
|
|
312
318
|
}
|
|
313
319
|
static checkIframe(glitter) {
|
|
314
320
|
if (glitter.getUrlParameter('isIframe') === 'true') {
|