ts-glitter 13.8.666 → 13.8.668

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 CHANGED
@@ -64,7 +64,7 @@ export class Entry {
64
64
  }
65
65
  window.renderClock = (_a = window.renderClock) !== null && _a !== void 0 ? _a : clockF();
66
66
  console.log(`Entry-time:`, window.renderClock.stop());
67
- glitter.share.editerVersion = 'V_13.8.666';
67
+ glitter.share.editerVersion = 'V_13.8.668';
68
68
  glitter.share.start = new Date();
69
69
  const vm = {
70
70
  appConfig: [],
@@ -163,7 +163,8 @@ export class Entry {
163
163
  if (glitter.getUrlParameter('type') === 'editor') {
164
164
  const dialog = new ShareDialog(glitter);
165
165
  dialog.dataLoading({ visible: true, text: '後台載入中' });
166
- Entry.toBackendEditor(glitter, () => { });
166
+ Entry.toBackendEditor(glitter, () => {
167
+ });
167
168
  }
168
169
  else if (glitter.getUrlParameter('type') === 'htmlEditor') {
169
170
  Entry.toHtmlEditor(glitter, vm, () => {
@@ -202,7 +203,8 @@ export class Entry {
202
203
  }
203
204
  }
204
205
  static toBackendEditor(glitter, callback) {
205
- if (localStorage.getItem('on-pos') === 'true') {
206
+ if ((localStorage.getItem('on-pos') === 'true') && glitter.getUrlParameter('page') !== 'pos') {
207
+ localStorage.removeItem('on-pos');
206
208
  location.href = glitter.root_path + 'pos?app-id=t_1725992531001';
207
209
  }
208
210
  glitter.addStyle(`
@@ -296,7 +298,9 @@ export class Entry {
296
298
  {
297
299
  src: 'https://kit.fontawesome.com/cccedec0f8.js',
298
300
  },
299
- ], () => { }, () => { });
301
+ ], () => {
302
+ }, () => {
303
+ });
300
304
  glitter.addStyle(`
301
305
  @media (prefers-reduced-motion: no-preference) {
302
306
  :root {
@@ -330,7 +334,9 @@ export class Entry {
330
334
  src: `${glitter.htmlGenerate.configureCDN(glitter.htmlGenerate.resourceHook(dd.js))}`,
331
335
  type: 'module',
332
336
  };
333
- }), () => { }, () => { }, [{ key: 'async', value: 'true' }]);
337
+ }), () => {
338
+ }, () => {
339
+ }, [{ key: 'async', value: 'true' }]);
334
340
  glitter.htmlGenerate.loadScript(glitter, window.parent.editerData.setting
335
341
  .filter((dd) => {
336
342
  return ['widget', 'container', 'code'].indexOf(dd.type) === -1;
@@ -394,7 +400,8 @@ export class Entry {
394
400
  .map((dd) => {
395
401
  return {
396
402
  src: `${glitter.htmlGenerate.configureCDN(glitter.htmlGenerate.resourceHook(dd.js))}`,
397
- callback: () => { },
403
+ callback: () => {
404
+ },
398
405
  };
399
406
  }));
400
407
  function authPass() {
@@ -503,6 +510,35 @@ export class Entry {
503
510
  static globalStyle(glitter, dd) {
504
511
  return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
505
512
  var _a, _b;
513
+ function loopVersion() {
514
+ ApiPageConfig.getGlitterVersion().then((res) => {
515
+ console.log('glitterVersion:', res.response.result);
516
+ if (!glitter.share.editerVersion.includes(res.response.result)) {
517
+ const dialog = new ShareDialog(glitter);
518
+ dialog.checkYesOrNot({
519
+ text: '新版本已發佈,是否進行更新?',
520
+ callback: (response) => {
521
+ if (response) {
522
+ location.reload();
523
+ }
524
+ else {
525
+ setTimeout(() => {
526
+ loopVersion();
527
+ }, 1000 * 300);
528
+ }
529
+ }
530
+ });
531
+ }
532
+ else {
533
+ setTimeout(() => {
534
+ loopVersion();
535
+ }, 1000 * 300);
536
+ }
537
+ });
538
+ }
539
+ if (glitter.getUrlParameter('type') === 'editor' || glitter.getUrlParameter('page') === 'pos') {
540
+ loopVersion();
541
+ }
506
542
  let countI = dd.response.data.initialList.length;
507
543
  const vm = {
508
544
  get count() {
package/lowcode/Entry.ts CHANGED
@@ -1,11 +1,11 @@
1
1
  'use strict';
2
- import { Glitter } from './glitterBundle/Glitter.js';
3
- import { config } from './config.js';
4
- import { ApiPageConfig } from './api/pageConfig.js';
5
- import { BaseApi } from './glitterBundle/api/base.js';
6
- import { GlobalUser } from './glitter-base/global/global-user.js';
7
- import { EditorConfig } from './editor-config.js';
8
- import { ShareDialog } from './glitterBundle/dialog/ShareDialog.js';
2
+ import {Glitter} from './glitterBundle/Glitter.js';
3
+ import {config} from './config.js';
4
+ import {ApiPageConfig} from './api/pageConfig.js';
5
+ import {BaseApi} from './glitterBundle/api/base.js';
6
+ import {GlobalUser} from './glitter-base/global/global-user.js';
7
+ import {EditorConfig} from './editor-config.js';
8
+ import {ShareDialog} from './glitterBundle/dialog/ShareDialog.js';
9
9
 
10
10
  export class Entry {
11
11
  public static onCreate(glitter: Glitter) {
@@ -64,7 +64,7 @@ export class Entry {
64
64
  }
65
65
  (window as any).renderClock = (window as any).renderClock ?? clockF();
66
66
  console.log(`Entry-time:`, (window as any).renderClock.stop());
67
- glitter.share.editerVersion = 'V_13.8.666';
67
+ glitter.share.editerVersion = 'V_13.8.668';
68
68
  glitter.share.start = new Date();
69
69
  const vm: {
70
70
  appConfig: any;
@@ -83,14 +83,14 @@ export class Entry {
83
83
  Entry.resourceInitial(glitter, vm, async (dd) => {
84
84
  glitter.addStyle(`
85
85
  ${
86
- parseInt((window.parent as any).glitter.share.bottom_inset, 10)
87
- ? `
86
+ parseInt((window.parent as any).glitter.share.bottom_inset, 10)
87
+ ? `
88
88
  .update-bar-container {
89
89
  padding-bottom: ${(window.parent as any).glitter.share.bottom_inset}px !important;
90
90
  }
91
91
  `
92
- : ``
93
- }
92
+ : ``
93
+ }
94
94
 
95
95
  .editorParent .editorChild {
96
96
  display: none;
@@ -171,9 +171,10 @@ export class Entry {
171
171
  await Entry.globalStyle(glitter, dd);
172
172
  if (glitter.getUrlParameter('type') === 'editor') {
173
173
  const dialog = new ShareDialog(glitter);
174
- dialog.dataLoading({ visible: true, text: '後台載入中' });
174
+ dialog.dataLoading({visible: true, text: '後台載入中'});
175
175
  // 頁面編輯器
176
- Entry.toBackendEditor(glitter, () => {});
176
+ Entry.toBackendEditor(glitter, () => {
177
+ });
177
178
  } else if (glitter.getUrlParameter('type') === 'htmlEditor') {
178
179
  // Iframe預覽區塊
179
180
  Entry.toHtmlEditor(glitter, vm, () => {
@@ -215,7 +216,8 @@ export class Entry {
215
216
 
216
217
  // 跳轉至頁面編輯器
217
218
  public static toBackendEditor(glitter: Glitter, callback: () => void) {
218
- if (localStorage.getItem('on-pos') === 'true') {
219
+ if ((localStorage.getItem('on-pos') === 'true') && glitter.getUrlParameter('page')!=='pos') {
220
+ localStorage.removeItem('on-pos')
219
221
  location.href = glitter.root_path + 'pos?app-id=t_1725992531001';
220
222
  }
221
223
  glitter.addStyle(`
@@ -324,8 +326,10 @@ export class Entry {
324
326
  src: 'https://kit.fontawesome.com/cccedec0f8.js',
325
327
  },
326
328
  ],
327
- () => {},
328
- () => {}
329
+ () => {
330
+ },
331
+ () => {
332
+ }
329
333
  );
330
334
  glitter.addStyle(`
331
335
  @media (prefers-reduced-motion: no-preference) {
@@ -366,9 +370,11 @@ export class Entry {
366
370
  type: 'module',
367
371
  };
368
372
  }),
369
- () => {},
370
- () => {},
371
- [{ key: 'async', value: 'true' }]
373
+ () => {
374
+ },
375
+ () => {
376
+ },
377
+ [{key: 'async', value: 'true'}]
372
378
  );
373
379
 
374
380
  // Preload page script
@@ -389,7 +395,7 @@ export class Entry {
389
395
  return eval(evals);
390
396
  };
391
397
  setTimeout(() => {
392
- (window.parent as any).glitter.share.loading_dialog.dataLoading({ text: '', visible: false });
398
+ (window.parent as any).glitter.share.loading_dialog.dataLoading({text: '', visible: false});
393
399
  }, 2000);
394
400
  glitter.htmlGenerate.setHome({
395
401
  app_config: vm.appConfig,
@@ -444,7 +450,8 @@ export class Entry {
444
450
  .map((dd: any) => {
445
451
  return {
446
452
  src: `${glitter.htmlGenerate.configureCDN(glitter.htmlGenerate.resourceHook(dd.js))}`,
447
- callback: () => {},
453
+ callback: () => {
454
+ },
448
455
  };
449
456
  })
450
457
  );
@@ -511,11 +518,11 @@ export class Entry {
511
518
  glitter.addStyle(`
512
519
  @charset "UTF-8";
513
520
  ${glitter.share.font_theme
514
- .map((dd: any) => {
515
- glitter.share.initial_fonts.push(dd.value);
516
- return `@import url('https://fonts.googleapis.com/css2?family=${dd.value}&display=swap');`;
517
- })
518
- .join('\n')}
521
+ .map((dd: any) => {
522
+ glitter.share.initial_fonts.push(dd.value);
523
+ return `@import url('https://fonts.googleapis.com/css2?family=${dd.value}&display=swap');`;
524
+ })
525
+ .join('\n')}
519
526
  body {
520
527
  font-family: '${glitter.share.font_theme[0].value}' !important;
521
528
  font-optical-sizing: auto;
@@ -563,20 +570,36 @@ export class Entry {
563
570
  // 載入全域資源
564
571
  public static globalStyle(glitter: Glitter, dd: any) {
565
572
  return new Promise(async (resolve, reject) => {
566
- // Initial Global style
567
- // if (glitter.getUrlParameter("type") !== 'editor') {
568
- // for (const data of (dd.response.data.initialStyleSheet ?? [])) {
569
- // try {
570
- // if (data.type === 'script') {
571
- // glitter.addStyleLink(data.src.link)
572
- // } else {
573
- // glitter.addStyle(data.src.official)
574
- // }
575
- // } catch (e) {
576
- // console.error(e)
577
- // }
578
- // }
579
- // }
573
+ //定期確認版本號碼
574
+ function loopVersion() {
575
+ ApiPageConfig.getGlitterVersion().then((res) => {
576
+ console.log('glitterVersion:', res.response.result);
577
+ if (!glitter.share.editerVersion.includes(res.response.result)) {
578
+ const dialog = new ShareDialog(glitter)
579
+ dialog.checkYesOrNot({
580
+ text: '新版本已發佈,是否進行更新?',
581
+ callback: (response) => {
582
+ if (response) {
583
+ location.reload()
584
+ }else{
585
+ setTimeout(() => {
586
+ loopVersion()
587
+ }, 1000 * 300)
588
+ }
589
+ }
590
+ })
591
+ }else{
592
+ setTimeout(() => {
593
+ loopVersion()
594
+ }, 1000 * 300)
595
+ }
596
+
597
+ })
598
+ }
599
+ if (glitter.getUrlParameter('type')==='editor' || glitter.getUrlParameter('page')==='pos'){
600
+ loopVersion()
601
+ }
602
+
580
603
  let countI = dd.response.data.initialList.length;
581
604
  const vm = {
582
605
  // @ts-ignore
@@ -635,6 +658,8 @@ export class Entry {
635
658
  glitter.setUrlParameter('page', 'login');
636
659
  }
637
660
  }
661
+
662
+
638
663
  }
639
664
 
640
665
  let clockF = () => {
@@ -28,6 +28,16 @@ export class ApiPageConfig {
28
28
  }
29
29
  });
30
30
  }
31
+ static getGlitterVersion() {
32
+ return BaseApi.create({
33
+ "url": config.url + `/api/v1/app/version?library=ts-glitter`,
34
+ "type": "GET",
35
+ "timeout": 0,
36
+ "headers": {
37
+ "Content-Type": "application/json"
38
+ }
39
+ });
40
+ }
31
41
  static getTemplateList() {
32
42
  return BaseApi.create({
33
43
  "url": config.url + `/api/v1/app/template?template_from=all`,
@@ -25,6 +25,17 @@ export class ApiPageConfig {
25
25
  })
26
26
  }
27
27
 
28
+ public static getGlitterVersion() {
29
+ return BaseApi.create({
30
+ "url": config.url + `/api/v1/app/version?library=ts-glitter`,
31
+ "type": "GET",
32
+ "timeout": 0,
33
+ "headers": {
34
+ "Content-Type": "application/json"
35
+ }
36
+ })
37
+ }
38
+
28
39
  public static getTemplateList() {
29
40
  return BaseApi.create({
30
41
  "url": config.url + `/api/v1/app/template?template_from=all`,
@@ -156,7 +156,6 @@ height: 51px;
156
156
  }
157
157
  static main(gvc) {
158
158
  const glitter = gvc.glitter;
159
- localStorage.setItem('on-pos', 'true');
160
159
  gvc.glitter.runJsInterFace("pos-device", {}, (res) => {
161
160
  PayConfig.deviceType = res.deviceType === 'neostra' ? 'pos' : 'web';
162
161
  if (PayConfig.deviceType === 'pos') {
@@ -184,7 +184,6 @@ height: 51px;
184
184
 
185
185
  public static main(gvc: GVC) {
186
186
  const glitter = gvc.glitter
187
- localStorage.setItem('on-pos', 'true')
188
187
  // https://unpkg.com/html5-qrcode/minified/html5-qrcode.min.js
189
188
  //設定裝置類型
190
189
  gvc.glitter.runJsInterFace("pos-device", {}, (res) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ts-glitter",
3
- "version": "13.8.666",
3
+ "version": "13.8.668",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {