ts-glitter 21.9.6 → 21.9.7

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.
Files changed (38) hide show
  1. package/lowcode/Entry.js +1 -1
  2. package/lowcode/Entry.ts +1 -1
  3. package/lowcode/backend-manager/bg-blog.js +2 -0
  4. package/lowcode/backend-manager/bg-blog.ts +4 -0
  5. package/lowcode/backend-manager/bg-product.js +3 -3
  6. package/lowcode/backend-manager/bg-product.ts +3 -3
  7. package/lowcode/backend-manager/bg-widget.js +15 -11
  8. package/lowcode/backend-manager/bg-widget.ts +30 -21
  9. package/lowcode/cms-plugin/menus-setting.js +389 -141
  10. package/lowcode/cms-plugin/menus-setting.ts +519 -228
  11. package/lowcode/cms-plugin/shopping-collections.js +5 -38
  12. package/lowcode/cms-plugin/shopping-collections.ts +5 -47
  13. package/lowcode/jspage/function-page/setting_editor.js +0 -27
  14. package/lowcode/jspage/function-page/setting_editor.ts +27 -27
  15. package/lowcode/public-components/footer/footer-01.js +183 -158
  16. package/lowcode/public-components/footer/footer-01.ts +275 -256
  17. package/lowcode/public-components/footer/footer-02.js +83 -63
  18. package/lowcode/public-components/footer/footer-02.ts +160 -145
  19. package/lowcode/public-components/footer/footer-03.js +78 -60
  20. package/lowcode/public-components/footer/footer-03.ts +149 -137
  21. package/lowcode/public-components/headers/sy-02.js +17 -2
  22. package/lowcode/public-components/headers/sy-02.ts +18 -6
  23. package/lowcode/public-components/headers/sy-03.js +18 -4
  24. package/lowcode/public-components/headers/sy-03.ts +26 -15
  25. package/lowcode/public-components/headers/sy-04.js +18 -4
  26. package/lowcode/public-components/headers/sy-04.ts +26 -15
  27. package/lowcode/public-components/headers/sy-05.js +93 -68
  28. package/lowcode/public-components/headers/sy-05.ts +174 -151
  29. package/lowcode/public-components/product/pd-class.js +27 -8
  30. package/lowcode/public-components/product/pd-class.ts +60 -35
  31. package/package.json +1 -1
  32. package/src/api-public/services/shopee.js +17 -7
  33. package/src/api-public/services/user.js +17 -7
  34. package/src/index.js +17 -7
  35. package/src/services/app.js +17 -7
  36. package/src/services/app.js.map +1 -1
  37. package/src/services/backend-service.js +17 -7
  38. package/src/services/backend-service.js.map +1 -1
@@ -1,9 +1,19 @@
1
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
+ return new (P || (P = Promise))(function (resolve, reject) {
4
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
8
+ });
9
+ };
1
10
  import { Color } from '../public/color.js';
2
11
  import { ApiUser } from '../../glitter-base/route/user.js';
3
12
  import { Language } from '../../glitter-base/global/language.js';
4
13
  import { LanguageView } from '../public/language-view.js';
5
14
  import { FooterInitial } from './footer-initial.js';
6
15
  import { Footer } from '../../app-component/footer.js';
16
+ import { PdClass } from '../product/pd-class.js';
7
17
  const html = String.raw;
8
18
  export class Footer02 {
9
19
  static main(gvc, widget, subData) {
@@ -86,66 +96,74 @@ export class Footer02 {
86
96
  color: ${colors.content};
87
97
  }
88
98
  `);
89
- return html ` <footer class="f-bgr border-top">
90
- <div class="border-gray-700 pt-4 pt-md-0">
91
- <div class="container px-0">
92
- <div class="row py-sm-5 f-container">
93
- <div class="col ${document.body.clientWidth > 768 ? '' : 'row'} f-content-container">
94
- ${(() => {
99
+ return html ` <!-- Footer 02 -->
100
+ <footer class="f-bgr border-top">
101
+ <div class="border-gray-700 pt-4 pt-md-0">
102
+ <div class="container px-0">
103
+ <div class="row py-sm-5 f-container">
104
+ <div class="col ${document.body.clientWidth > 768 ? '' : 'row'} f-content-container">
105
+ ${(() => {
95
106
  try {
96
107
  return gvc.bindView((() => {
97
108
  const id = gvc.glitter.getUUID();
98
109
  let loading = true;
99
110
  return {
100
111
  bind: id,
101
- view: () => {
112
+ view: () => __awaiter(this, void 0, void 0, function* () {
102
113
  if (loading) {
103
114
  return '';
104
115
  }
105
116
  else {
117
+ const userData = yield ApiUser.getUserData(gvc.glitter.share.GlobalUser.token, 'me');
106
118
  return footer.list
107
119
  .map((data) => {
120
+ if (!PdClass.menuVisibleVerify(userData, data)) {
121
+ return '';
122
+ }
108
123
  return html ` <div class="${document.body.clientWidth > 768 ? '' : 'col-12'} mt-2">
109
- <h6
110
- class="heading-xxs mb-3 f-title"
111
- onclick="${gvc.event(() => {
124
+ <h6
125
+ class="heading-xxs mb-3 f-title"
126
+ onclick="${gvc.event(() => {
112
127
  if (data.link) {
113
128
  gvc.glitter.href = data.link;
114
129
  }
115
130
  })}"
116
- >
117
- ${data.title}
118
- </h6>
119
- <ul class="list-unstyled mb-7 f-ul">
120
- ${data.items
131
+ >
132
+ ${data.title}
133
+ </h6>
134
+ <ul class="list-unstyled mb-7 f-ul">
135
+ ${data.items
121
136
  .map(chi => {
137
+ if (!PdClass.menuVisibleVerify(userData, chi)) {
138
+ return '';
139
+ }
122
140
  return html ` <li
123
- class="f-li"
124
- style="${chi.link ? 'cursor: pointer;' : ''}"
125
- onclick="${gvc.event(() => {
141
+ class="f-li"
142
+ style="${chi.link ? 'cursor: pointer;' : ''}"
143
+ onclick="${gvc.event(() => {
126
144
  if (chi.link) {
127
145
  gvc.glitter.href = chi.link;
128
146
  }
129
147
  })}"
130
- >
131
- <a
132
- class="f-aclass"
133
- title="${chi.title}"
134
- onclick="${gvc.event((e, event) => {
148
+ >
149
+ <a
150
+ class="f-aclass"
151
+ title="${chi.title}"
152
+ onclick="${gvc.event((e, event) => {
135
153
  event.preventDefault();
136
154
  })}"
137
- href="${chi.link}"
138
- >${chi.title}</a
139
- >
140
- </li>`;
155
+ href="${chi.link}"
156
+ >${chi.title}</a
157
+ >
158
+ </li>`;
141
159
  })
142
160
  .join('')}
143
- </ul>
144
- </div>`;
161
+ </ul>
162
+ </div>`;
145
163
  })
146
164
  .join('');
147
165
  }
148
- },
166
+ }),
149
167
  divCreate: {
150
168
  class: document.body.clientWidth > 768 ? 'd-flex gap-5' : '',
151
169
  },
@@ -167,38 +185,40 @@ export class Footer02 {
167
185
  return '';
168
186
  }
169
187
  })()}
170
- </div>
171
- ${(window.store_info.language_setting.support.length > 1 ||
188
+ </div>
189
+ ${(window.store_info.language_setting.support.length > 1 ||
172
190
  window.store_info.multi_currency) &&
173
191
  document.body.clientWidth < 800
174
192
  ? html ` <div class="col-12 d-flex justify-content-center mb-3">
175
- ${LanguageView.selectLanguage(gvc, colors)}
176
- </div>`
193
+ ${LanguageView.selectLanguage(gvc, colors)}
194
+ </div>`
177
195
  : ``}
178
- <div class="col-12 col-md-3 col-lg-6 f-title-container d-flex flex-column ms-auto">
179
- ${(window.store_info.language_setting.support.length > 1 ||
196
+ <div class="col-12 col-md-3 col-lg-6 f-title-container d-flex flex-column ms-auto">
197
+ ${(window.store_info.language_setting.support.length > 1 ||
180
198
  window.store_info.multi_currency) &&
181
199
  document.body.clientWidth >= 800
182
200
  ? html ` <div class="d-flex justify-content-end mb-3">
183
- ${LanguageView.selectLanguage(gvc, colors)}
184
- </div>`
201
+ ${LanguageView.selectLanguage(gvc, colors)}
202
+ </div>`
185
203
  : ``}
186
- <div
187
- class="d-flex gap-2 p-0 pb-3 justify-content-${document.body.clientWidth > 768 ? 'end' : 'center'}"
188
- >
189
- ${(() => {
204
+ <div
205
+ class="d-flex gap-2 p-0 pb-3 justify-content-${document.body.clientWidth > 768
206
+ ? 'end'
207
+ : 'center'}"
208
+ >
209
+ ${(() => {
190
210
  try {
191
211
  return formData.kkk.link
192
212
  .map((item) => {
193
213
  return html ` <div class="f-icon-div">
194
- <div
195
- onclick="${gvc.event(() => {
214
+ <div
215
+ onclick="${gvc.event(() => {
196
216
  gvc.glitter.href = item.link;
197
217
  })}"
198
- >
199
- <img
200
- class="f-icon-image"
201
- src="${(() => {
218
+ >
219
+ <img
220
+ class="f-icon-image"
221
+ src="${(() => {
202
222
  switch (item.type) {
203
223
  case 'fb':
204
224
  return 'https://d3jnmi1tfjgtti.cloudfront.net/file/234285319/1722847285395-img_facebook.svg';
@@ -214,9 +234,9 @@ export class Footer02 {
214
234
  return '';
215
235
  }
216
236
  })()}"
217
- />
218
- </div>
219
- </div>`;
237
+ />
238
+ </div>
239
+ </div>`;
220
240
  })
221
241
  .join('');
222
242
  }
@@ -224,24 +244,24 @@ export class Footer02 {
224
244
  return '';
225
245
  }
226
246
  })()}
227
- </div>
228
- <div class="d-none d-sm-block f-intro text-end">
229
- ${formData.intro ? formData.intro.replace(/\n/g, '<br/>') : ''}
247
+ </div>
248
+ <div class="d-none d-sm-block f-intro text-end">
249
+ ${formData.intro ? formData.intro.replace(/\n/g, '<br/>') : ''}
250
+ </div>
230
251
  </div>
231
252
  </div>
232
253
  </div>
233
254
  </div>
234
- </div>
235
- <div class="py-6">
236
- <div class="container">
237
- <div class="row">
238
- <div class="col text-center">
239
- <p class="my-2 f-copyright">${(_a = formData.note) !== null && _a !== void 0 ? _a : ''}</p>
255
+ <div class="py-6">
256
+ <div class="container">
257
+ <div class="row">
258
+ <div class="col text-center">
259
+ <p class="my-2 f-copyright">${(_a = formData.note) !== null && _a !== void 0 ? _a : ''}</p>
260
+ </div>
240
261
  </div>
241
262
  </div>
242
263
  </div>
243
- </div>
244
- </footer>`;
264
+ </footer>`;
245
265
  },
246
266
  mobile: () => {
247
267
  return Footer.main({
@@ -249,7 +269,7 @@ export class Footer02 {
249
269
  formData: {},
250
270
  key: '',
251
271
  widget: widget,
252
- callback: () => { }
272
+ callback: () => { },
253
273
  });
254
274
  },
255
275
  gvc: gvc,
@@ -5,6 +5,7 @@ import { Language } from '../../glitter-base/global/language.js';
5
5
  import { LanguageView } from '../public/language-view.js';
6
6
  import { FooterInitial } from './footer-initial.js';
7
7
  import { Footer } from '../../app-component/footer.js';
8
+ import { PdClass } from '../product/pd-class.js';
8
9
 
9
10
  const html = String.raw;
10
11
 
@@ -101,170 +102,184 @@ export class Footer02 {
101
102
  }
102
103
  `);
103
104
 
104
- return html` <footer class="f-bgr border-top">
105
- <div class="border-gray-700 pt-4 pt-md-0">
106
- <div class="container px-0">
107
- <div class="row py-sm-5 f-container">
108
- <div class="col ${document.body.clientWidth > 768 ? '' : 'row'} f-content-container">
109
- ${(() => {
110
- try {
111
- return gvc.bindView(
112
- (() => {
113
- const id = gvc.glitter.getUUID();
114
- let loading = true;
115
- return {
116
- bind: id,
117
- view: () => {
118
- if (loading) {
119
- return '';
120
- } else {
121
- return footer.list
122
- .map((data: FooterItem) => {
123
- return html` <div class="${document.body.clientWidth > 768 ? '' : 'col-12'} mt-2">
124
- <h6
125
- class="heading-xxs mb-3 f-title"
126
- onclick="${gvc.event(() => {
127
- if (data.link) {
128
- gvc.glitter.href = data.link;
129
- }
130
- })}"
131
- >
132
- ${data.title}
133
- </h6>
134
- <ul class="list-unstyled mb-7 f-ul">
135
- ${data.items
136
- .map(chi => {
137
- return html` <li
138
- class="f-li"
139
- style="${chi.link ? 'cursor: pointer;' : ''}"
140
- onclick="${gvc.event(() => {
141
- if (chi.link) {
142
- gvc.glitter.href = chi.link;
143
- }
144
- })}"
145
- >
146
- <a
147
- class="f-aclass"
148
- title="${chi.title}"
149
- onclick="${gvc.event((e, event) => {
150
- event.preventDefault();
151
- })}"
152
- href="${chi.link}"
153
- >${chi.title}</a
154
- >
155
- </li>`;
156
- })
157
- .join('')}
158
- </ul>
159
- </div>`;
160
- })
161
- .join('');
162
- }
163
- },
164
- divCreate: {
165
- class: document.body.clientWidth > 768 ? 'd-flex gap-5' : '',
166
- },
167
- onCreate: () => {
168
- if (loading) {
169
- ApiUser.getPublicConfig(widget.formData.menu_refer || 'footer-setting', 'manager').then(data => {
170
- if (data.result && data.response.value) {
171
- footer.list = data.response.value[Language.getLanguage()];
172
- }
173
- loading = false;
174
- gvc.notifyDataChange(id);
175
- });
176
- }
177
- },
178
- };
179
- })()
180
- );
181
- } catch (error) {
182
- return '';
183
- }
184
- })()}
185
- </div>
186
- ${((window as any).store_info.language_setting.support.length > 1 ||
187
- (window as any).store_info.multi_currency) &&
188
- document.body.clientWidth < 800
189
- ? html` <div class="col-12 d-flex justify-content-center mb-3">
190
- ${LanguageView.selectLanguage(gvc, colors)}
191
- </div>`
192
- : ``}
193
- <div class="col-12 col-md-3 col-lg-6 f-title-container d-flex flex-column ms-auto">
194
- ${((window as any).store_info.language_setting.support.length > 1 ||
195
- (window as any).store_info.multi_currency) &&
196
- document.body.clientWidth >= 800
197
- ? html` <div class="d-flex justify-content-end mb-3">
198
- ${LanguageView.selectLanguage(gvc, colors)}
199
- </div>`
200
- : ``}
201
- <div
202
- class="d-flex gap-2 p-0 pb-3 justify-content-${document.body.clientWidth > 768 ? 'end' : 'center'}"
203
- >
105
+ return html` <!-- Footer 02 -->
106
+ <footer class="f-bgr border-top">
107
+ <div class="border-gray-700 pt-4 pt-md-0">
108
+ <div class="container px-0">
109
+ <div class="row py-sm-5 f-container">
110
+ <div class="col ${document.body.clientWidth > 768 ? '' : 'row'} f-content-container">
204
111
  ${(() => {
205
112
  try {
206
- return formData.kkk.link
207
- .map((item: { link: string; type: string }) => {
208
- return html` <div class="f-icon-div">
209
- <div
210
- onclick="${gvc.event(() => {
211
- gvc.glitter.href = item.link;
212
- })}"
213
- >
214
- <img
215
- class="f-icon-image"
216
- src="${(() => {
217
- switch (item.type) {
218
- case 'fb':
219
- return 'https://d3jnmi1tfjgtti.cloudfront.net/file/234285319/1722847285395-img_facebook.svg';
220
- case 'youtube':
221
- return 'https://d3jnmi1tfjgtti.cloudfront.net/file/234285319/1722847654029-771382_channel_circle_logo_media_social_icon.png';
222
- case 'twitter':
223
- return 'https://d3jnmi1tfjgtti.cloudfront.net/file/234285319/1722847853494-m2i8K9K9N4b1G6H7.png';
224
- case 'ig':
225
- return 'https://d3jnmi1tfjgtti.cloudfront.net/file/234285319/1722847430108-social.png';
226
- case 'line':
227
- return 'https://d3jnmi1tfjgtti.cloudfront.net/file/234285319/1722847342584-img_line.svg';
228
- default:
113
+ return gvc.bindView(
114
+ (() => {
115
+ const id = gvc.glitter.getUUID();
116
+ let loading = true;
117
+ return {
118
+ bind: id,
119
+ view: async () => {
120
+ if (loading) {
121
+ return '';
122
+ } else {
123
+ const userData = await ApiUser.getUserData(gvc.glitter.share.GlobalUser.token, 'me');
124
+
125
+ return footer.list
126
+ .map((data: FooterItem) => {
127
+ if (!PdClass.menuVisibleVerify(userData, data)) {
229
128
  return '';
129
+ }
130
+ return html` <div class="${document.body.clientWidth > 768 ? '' : 'col-12'} mt-2">
131
+ <h6
132
+ class="heading-xxs mb-3 f-title"
133
+ onclick="${gvc.event(() => {
134
+ if (data.link) {
135
+ gvc.glitter.href = data.link;
136
+ }
137
+ })}"
138
+ >
139
+ ${data.title}
140
+ </h6>
141
+ <ul class="list-unstyled mb-7 f-ul">
142
+ ${data.items
143
+ .map(chi => {
144
+ if (!PdClass.menuVisibleVerify(userData, chi)) {
145
+ return '';
146
+ }
147
+ return html` <li
148
+ class="f-li"
149
+ style="${chi.link ? 'cursor: pointer;' : ''}"
150
+ onclick="${gvc.event(() => {
151
+ if (chi.link) {
152
+ gvc.glitter.href = chi.link;
153
+ }
154
+ })}"
155
+ >
156
+ <a
157
+ class="f-aclass"
158
+ title="${chi.title}"
159
+ onclick="${gvc.event((e, event) => {
160
+ event.preventDefault();
161
+ })}"
162
+ href="${chi.link}"
163
+ >${chi.title}</a
164
+ >
165
+ </li>`;
166
+ })
167
+ .join('')}
168
+ </ul>
169
+ </div>`;
170
+ })
171
+ .join('');
172
+ }
173
+ },
174
+ divCreate: {
175
+ class: document.body.clientWidth > 768 ? 'd-flex gap-5' : '',
176
+ },
177
+ onCreate: () => {
178
+ if (loading) {
179
+ ApiUser.getPublicConfig(
180
+ widget.formData.menu_refer || 'footer-setting',
181
+ 'manager'
182
+ ).then(data => {
183
+ if (data.result && data.response.value) {
184
+ footer.list = data.response.value[Language.getLanguage()];
230
185
  }
231
- })()}"
232
- />
233
- </div>
234
- </div>`;
235
- })
236
- .join('');
186
+ loading = false;
187
+ gvc.notifyDataChange(id);
188
+ });
189
+ }
190
+ },
191
+ };
192
+ })()
193
+ );
237
194
  } catch (error) {
238
195
  return '';
239
196
  }
240
197
  })()}
241
198
  </div>
242
- <div class="d-none d-sm-block f-intro text-end">
243
- ${formData.intro ? formData.intro.replace(/\n/g, '<br/>') : ''}
199
+ ${((window as any).store_info.language_setting.support.length > 1 ||
200
+ (window as any).store_info.multi_currency) &&
201
+ document.body.clientWidth < 800
202
+ ? html` <div class="col-12 d-flex justify-content-center mb-3">
203
+ ${LanguageView.selectLanguage(gvc, colors)}
204
+ </div>`
205
+ : ``}
206
+ <div class="col-12 col-md-3 col-lg-6 f-title-container d-flex flex-column ms-auto">
207
+ ${((window as any).store_info.language_setting.support.length > 1 ||
208
+ (window as any).store_info.multi_currency) &&
209
+ document.body.clientWidth >= 800
210
+ ? html` <div class="d-flex justify-content-end mb-3">
211
+ ${LanguageView.selectLanguage(gvc, colors)}
212
+ </div>`
213
+ : ``}
214
+ <div
215
+ class="d-flex gap-2 p-0 pb-3 justify-content-${document.body.clientWidth > 768
216
+ ? 'end'
217
+ : 'center'}"
218
+ >
219
+ ${(() => {
220
+ try {
221
+ return formData.kkk.link
222
+ .map((item: { link: string; type: string }) => {
223
+ return html` <div class="f-icon-div">
224
+ <div
225
+ onclick="${gvc.event(() => {
226
+ gvc.glitter.href = item.link;
227
+ })}"
228
+ >
229
+ <img
230
+ class="f-icon-image"
231
+ src="${(() => {
232
+ switch (item.type) {
233
+ case 'fb':
234
+ return 'https://d3jnmi1tfjgtti.cloudfront.net/file/234285319/1722847285395-img_facebook.svg';
235
+ case 'youtube':
236
+ return 'https://d3jnmi1tfjgtti.cloudfront.net/file/234285319/1722847654029-771382_channel_circle_logo_media_social_icon.png';
237
+ case 'twitter':
238
+ return 'https://d3jnmi1tfjgtti.cloudfront.net/file/234285319/1722847853494-m2i8K9K9N4b1G6H7.png';
239
+ case 'ig':
240
+ return 'https://d3jnmi1tfjgtti.cloudfront.net/file/234285319/1722847430108-social.png';
241
+ case 'line':
242
+ return 'https://d3jnmi1tfjgtti.cloudfront.net/file/234285319/1722847342584-img_line.svg';
243
+ default:
244
+ return '';
245
+ }
246
+ })()}"
247
+ />
248
+ </div>
249
+ </div>`;
250
+ })
251
+ .join('');
252
+ } catch (error) {
253
+ return '';
254
+ }
255
+ })()}
256
+ </div>
257
+ <div class="d-none d-sm-block f-intro text-end">
258
+ ${formData.intro ? formData.intro.replace(/\n/g, '<br/>') : ''}
259
+ </div>
244
260
  </div>
245
261
  </div>
246
262
  </div>
247
263
  </div>
248
- </div>
249
- <div class="py-6">
250
- <div class="container">
251
- <div class="row">
252
- <div class="col text-center">
253
- <p class="my-2 f-copyright">${formData.note ?? ''}</p>
264
+ <div class="py-6">
265
+ <div class="container">
266
+ <div class="row">
267
+ <div class="col text-center">
268
+ <p class="my-2 f-copyright">${formData.note ?? ''}</p>
269
+ </div>
254
270
  </div>
255
271
  </div>
256
272
  </div>
257
- </div>
258
- </footer>`;
273
+ </footer>`;
259
274
  },
260
275
  mobile: () => {
261
276
  return Footer.main({
262
- gvc:gvc,
263
- formData:{},
264
- key:'',
265
- widget:widget,
266
- callback:()=>{}
267
- })
277
+ gvc: gvc,
278
+ formData: {},
279
+ key: '',
280
+ widget: widget,
281
+ callback: () => {},
282
+ });
268
283
  },
269
284
  gvc: gvc,
270
285
  });