ts-glitter 21.5.2 → 21.5.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.
Files changed (89) hide show
  1. package/lowcode/Entry.js +1 -1
  2. package/lowcode/Entry.ts +1 -1
  3. package/lowcode/cms-plugin/account-info.js +79 -67
  4. package/lowcode/cms-plugin/account-info.ts +327 -311
  5. package/lowcode/cms-plugin/information/information-module.ts +3 -1
  6. package/lowcode/cms-plugin/list-header-option.js +1 -0
  7. package/lowcode/cms-plugin/list-header-option.ts +1 -0
  8. package/lowcode/cms-plugin/shopping-information.js +468 -0
  9. package/lowcode/cms-plugin/shopping-information.ts +557 -0
  10. package/lowcode/cms-plugin/shopping-market-shopee.js +283 -231
  11. package/lowcode/cms-plugin/shopping-market-shopee.ts +401 -361
  12. package/lowcode/cms-plugin/shopping-order-manager.js +16 -4
  13. package/lowcode/cms-plugin/shopping-order-manager.ts +18 -3
  14. package/lowcode/glitter-base/global/language.js +4 -1
  15. package/lowcode/glitter-base/global/language.ts +4 -2
  16. package/lowcode/glitter-base/route/shopee.js +48 -11
  17. package/lowcode/glitter-base/route/shopee.ts +119 -80
  18. package/lowcode/glitterBundle/plugins/html-render.js +121 -90
  19. package/lowcode/glitterBundle/plugins/html-render.ts +367 -318
  20. package/lowcode/modules/image-library.js +2 -3
  21. package/lowcode/modules/image-library.ts +21 -7
  22. package/lowcode/public-components/checkout/index.js +90 -41
  23. package/lowcode/public-components/checkout/index.ts +101 -49
  24. package/lowcode/public-components/footer/footer-initial.js +11 -2
  25. package/lowcode/public-components/footer/footer-initial.ts +29 -18
  26. package/lowcode/public-components/headers/header-class.js +47 -35
  27. package/lowcode/public-components/headers/header-class.ts +54 -38
  28. package/lowcode/public-components/headers/sy-02.js +1 -1
  29. package/lowcode/public-components/headers/sy-02.ts +1 -1
  30. package/lowcode/public-components/headers/sy-03.js +1 -1
  31. package/lowcode/public-components/headers/sy-03.ts +1 -1
  32. package/lowcode/public-components/headers/sy-04.js +1 -1
  33. package/lowcode/public-components/headers/sy-04.ts +1 -1
  34. package/lowcode/public-components/headers/sy-05.js +1 -2
  35. package/lowcode/public-components/headers/sy-05.ts +1 -1
  36. package/lowcode/public-components/layout-plugin/social-links-01.js +122 -3
  37. package/lowcode/public-components/layout-plugin/social-links-01.ts +135 -10
  38. package/lowcode/public-components/product/pd-card-01.js +23 -14
  39. package/lowcode/public-components/product/pd-card-01.ts +25 -14
  40. package/lowcode/public-components/product/pd-card-02.js +23 -16
  41. package/lowcode/public-components/product/pd-card-02.ts +25 -16
  42. package/lowcode/public-components/product/pd-card-03.js +25 -16
  43. package/lowcode/public-components/product/pd-card-03.ts +27 -16
  44. package/lowcode/public-components/product/pd-class.js +1 -1
  45. package/lowcode/public-components/product/pd-class.ts +1 -1
  46. package/lowcode/public-components/terms-related/index.js +13 -2
  47. package/lowcode/public-components/terms-related/index.ts +15 -2
  48. package/lowcode/public-components/user-manager/um-class.js +490 -501
  49. package/lowcode/public-components/user-manager/um-class.ts +872 -882
  50. package/lowcode/public-components/user-manager/um-info.js +41 -40
  51. package/lowcode/public-components/user-manager/um-info.ts +54 -56
  52. package/lowcode/public-components/user-manager/um-login.js +10 -13
  53. package/lowcode/public-components/user-manager/um-login.ts +15 -23
  54. package/lowcode/public-components/user-manager/um-orderlist.js +60 -51
  55. package/lowcode/public-components/user-manager/um-orderlist.ts +289 -275
  56. package/lowcode/public-components/user-manager/um-rebate.js +104 -82
  57. package/lowcode/public-components/user-manager/um-rebate.ts +294 -267
  58. package/lowcode/public-components/user-manager/um-receive.js +582 -0
  59. package/lowcode/public-components/user-manager/um-receive.ts +599 -0
  60. package/lowcode/public-components/user-manager/um-wishlist.js +72 -68
  61. package/lowcode/public-components/user-manager/um-wishlist.ts +240 -230
  62. package/package.json +1 -1
  63. package/src/api-public/controllers/shopee.js +17 -0
  64. package/src/api-public/controllers/shopee.js.map +1 -1
  65. package/src/api-public/controllers/shopee.ts +32 -0
  66. package/src/api-public/services/monitor.d.ts +1 -0
  67. package/src/api-public/services/post.js +17 -7
  68. package/src/api-public/services/post.js.map +1 -1
  69. package/src/api-public/services/rebate.js +2 -11
  70. package/src/api-public/services/rebate.js.map +1 -1
  71. package/src/api-public/services/rebate.ts +5 -12
  72. package/src/api-public/services/shopee.d.ts +23 -2
  73. package/src/api-public/services/shopee.js +230 -111
  74. package/src/api-public/services/shopee.js.map +1 -1
  75. package/src/api-public/services/shopee.ts +1012 -838
  76. package/src/api-public/services/user.js +2 -2
  77. package/src/api-public/services/user.js.map +1 -1
  78. package/src/api-public/services/user.ts +3 -3
  79. package/src/index.js +17 -7
  80. package/src/index.js.map +1 -1
  81. package/src/modules/tool.d.ts +4 -4
  82. package/src/modules/tool.js +2 -1
  83. package/src/modules/tool.js.map +1 -1
  84. package/src/services/backend-service.js +17 -7
  85. package/src/services/backend-service.js.map +1 -1
  86. package/src/services/template.d.ts +1 -1
  87. package/src/services/template.js +24 -18
  88. package/src/services/template.js.map +1 -1
  89. package/src/services/template.ts +34 -37
@@ -10,892 +10,882 @@ const html = String.raw;
10
10
  const css = String.raw;
11
11
 
12
12
  export class UmClass {
13
- static style_components={
14
- blueNote(text: string, event: string = '', style: string = ''): string {
15
- return html`<span
16
- style="color: #4D86DB; font-size: 14px; font-weight: 400; cursor:pointer; overflow-wrap: break-word; ${style}"
17
- onclick="${event}"
18
- >${text}</span
19
- >`;
20
- }
21
- }
22
- static nav(gvc: GVC) {
23
-
24
- const glitter = gvc.glitter;
25
- this.addStyle(gvc);
26
- const vm = {
27
- id: gvc.glitter.getUUID(),
28
- loading: true,
29
- pageName: glitter.getUrlParameter('page'),
30
- };
31
-
32
- let changePage = (index: string, type: 'page' | 'home', subData: any) => {
33
- };
34
- gvc.glitter.getModule(new URL('./official_event/page/change-page.js', gvc.glitter.root_path).href, (cl) => {
35
- changePage = cl.changePage;
36
- });
37
-
38
- return gvc.bindView({
39
- bind: vm.id,
40
- view: () => {
41
- if (vm.loading) {
42
- return '';
43
- } else {
44
- glitter.share.rebateConfig.title = CheckInput.isEmpty(glitter.share.rebateConfig.title) ? Language.text('shopping_credit') : glitter.share.rebateConfig.title;
45
- const buttonHTML = [
46
- {
47
- key: 'account_userinfo',
48
- title: Language.text('account'),
49
- },
50
- {
51
- key: 'voucher-list',
52
- title: Language.text('my_coupons'),
53
- },
54
- {
55
- key: 'rebate',
56
- title: `${Language.text('my')}${glitter.share.rebateConfig.title}`,
57
- },
58
- {
59
- key: 'order_list',
60
- title: Language.text('order_history'),
61
- },
62
- {
63
- key: 'wishlist',
64
- title: Language.text('wishlist'),
65
- },
66
- {
67
- key: 'reset_password',
68
- title: Language.text('reset_password'),
69
- },
70
- {
71
- key: 'logout',
72
- title: Language.text('logout'),
73
- },
74
- ]
75
- .map((item) => {
76
- if (item.key == 'wishlist' && (window as any).store_info.wishlist == false) {
77
- return '';
78
- }
79
- return html`
80
- <div
81
- class="option px-2 d-flex justify-content-center um-nav-btn ${vm.pageName === item.key ? 'um-nav-btn-active' : ''}"
82
- onclick="${gvc.event(async () => {
83
- if (item.key === 'reset_password') {
84
- const dialog = new ShareDialog(gvc.glitter);
85
- dialog.dataLoading({ visible: true });
86
- const userData: any = await UmClass.getUserData(gvc);
87
- dialog.dataLoading({ visible: false });
88
- UmClass.dialog({
89
- gvc: gvc,
90
- title: Language.text('reset_password_event'),
91
- tag: '',
92
- innerHTML: (gvc: GVC) => {
93
- let update_vm = {
94
- verify_code: '',
95
- pwd: '',
96
- };
97
- let get_verify_timer = 0;
98
- let repeat_pwd = '';
99
- return [
100
- html`
101
- <div class="tx_normal fw-normal mb-1">
102
- ${Language.text('password')}
103
- </div>`,
104
- html`<input
105
- class="bgw-input"
106
- type="password"
107
- placeholder="${Language.text('please_enter_password')}"
108
- oninput="${gvc.event((e) => {
109
- update_vm.pwd = e.value;
110
- })}"
111
- value="${update_vm.pwd}"
112
- />`,
113
- html`
114
- <div class="tx_normal fw-normal mt-2 mb-1">
115
- ${Language.text('confirm_password')}
116
- </div>`,
117
- html`<input
118
- class="bgw-input mb-2"
119
- type="password"
120
- placeholder="${Language.text('please_enter_password_again')}"
121
- oninput="${gvc.event((e) => {
122
- repeat_pwd = e.value;
123
- })}"
124
- value="${repeat_pwd}"
125
- />`,
126
- gvc.bindView(() => {
127
- const id = gvc.glitter.getUUID();
128
- return {
129
- bind: id,
130
- view: () => {
131
- return html`${Language.text('reset_password_verification_code')}
132
- ${UmClass.style_components.blueNote(
133
- get_verify_timer
134
- ? `${Language.text('verification_code_sent_to')}『${userData.userData.email}』`
135
- : Language.text('get_verification_code'),
136
- gvc.event(() => {
137
- if (!get_verify_timer) {
138
- const dialog = new ShareDialog(gvc.glitter);
139
- dialog.dataLoading({ visible: true });
140
- ApiUser.emailVerify(userData.userData.email, (window as any).appName).then(async (r) => {
141
- dialog.dataLoading({ visible: false });
142
- get_verify_timer = 60;
143
- gvc.notifyDataChange(id);
144
- });
145
- }
146
- }),
147
- )}`;
148
- },
149
- divCreate: {
150
- class: `d-flex flex-column`,
151
- style: `gap:3px;`,
152
- },
153
- onCreate: () => {
154
- if (get_verify_timer > 0) {
155
- get_verify_timer--;
156
- setTimeout(() => {
157
- gvc.notifyDataChange(id);
158
- }, 1000);
159
- }
160
- },
161
- };
162
- }),
163
- html`<input
164
- class="bgw-input mt-2 mb-4"
165
- type="text"
166
- placeholder="${Language.text('please_enter_verification_code')}"
167
- oninput="${gvc.event((e, event) => {
168
- update_vm.verify_code = e.value;
169
- })}"
170
- value="${update_vm.verify_code}"
171
- />`,
172
- html`
173
- <div
174
- class="d-flex align-items-center justify-content-end pt-2 border-top mx-n3">
175
- <div
176
- class="um-nav-btn um-nav-btn-active d-flex align-items-center justify-content-center"
177
- style="cursor:pointer;"
178
- type="button"
179
- onclick="${gvc.event(() => {
180
- if (update_vm.pwd.length < 8) {
181
- dialog.errorMessage({ text: Language.text('password_min_length') });
182
- return;
183
- }
184
- if (repeat_pwd !== update_vm.pwd) {
185
- dialog.errorMessage({ text: Language.text('please_confirm_password_again') });
186
- return;
187
- }
188
- dialog.dataLoading({ visible: true });
189
- ApiUser.updateUserData({
190
- userData: update_vm,
191
- }).then((res) => {
192
- dialog.dataLoading({ visible: false });
193
- if (!res.result && res.response.data.msg === 'email-verify-false') {
194
- dialog.errorMessage({ text: Language.text('email_verification_code_incorrect') });
195
- } else if (!res.result && res.response.data.msg === 'phone-verify-false') {
196
- dialog.errorMessage({ text: Language.text('sms_verification_code_incorrect') });
197
- } else if (!res.result && res.response.data.msg === 'phone-exists') {
198
- dialog.errorMessage({ text: Language.text('phone_number_already_exists') });
199
- } else if (!res.result && res.response.data.msg === 'email-exists') {
200
- dialog.errorMessage({ text: Language.text('email_already_exists') });
201
- } else if (!res.result) {
202
- dialog.errorMessage({ text: Language.text('update_exception') });
203
- } else {
204
- dialog.successMessage({ text: Language.text('change_success') });
205
- gvc.closeDialog();
206
- }
207
- });
208
- })}"
209
- >
210
- <span
211
- class="tx_700_white">${Language.text('confirm_reset')}</span>
212
- </div>
213
- </div>`,
214
- ].join('');
215
- },
216
- });
217
- } else if (item.key === 'logout') {
218
- GlobalUser.token = '';
219
- changePage('index', 'home', {});
220
- } else {
221
- changePage(item.key, 'page', {});
222
- }
223
- })}"
224
- >
225
- ${item.title}
226
- </div>
227
- `;
228
- })
229
- .join('');
230
-
231
- return html`
232
- <div class="account-section">
233
- <div class="section-title mb-4 mt-0 pt-lg-3 um-nav-title px-2">
234
- ${Language.text('my_profile')}
235
- </div>
236
- ${document.body.clientWidth > 768
237
- ? html`
238
- <div class="mx-auto mt-3 um-nav-container">
239
- <div class="account-options d-flex gap-3">${buttonHTML}</div>
240
- </div>`
241
- : html`
242
- <div class="account-navigation w-100">
243
- <nav class="nav-links mb-3 mb-md-0">
244
- <div
245
- class="nav-options d-flex flex-wrap um-nav-mobile-tags-container px-0">
246
- ${buttonHTML}
247
- </div>
248
- </nav>
249
- </div>`}
250
- </div>`;
251
- }
13
+ static style_components = {
14
+ blueNote(text: string, event: string = '', style: string = ''): string {
15
+ return html`<span
16
+ style="color: #4D86DB; font-size: 14px; font-weight: 400; cursor:pointer; overflow-wrap: break-word; ${style}"
17
+ onclick="${event}"
18
+ >${text}</span
19
+ >`;
20
+ },
21
+ };
22
+ static nav(gvc: GVC) {
23
+ const glitter = gvc.glitter;
24
+ this.addStyle(gvc);
25
+ const vm = {
26
+ id: gvc.glitter.getUUID(),
27
+ loading: true,
28
+ pageName: glitter.getUrlParameter('page'),
29
+ };
30
+
31
+ let changePage = (index: string, type: 'page' | 'home', subData: any) => {};
32
+ gvc.glitter.getModule(new URL('./official_event/page/change-page.js', gvc.glitter.root_path).href, cl => {
33
+ changePage = cl.changePage;
34
+ });
35
+
36
+ return gvc.bindView({
37
+ bind: vm.id,
38
+ view: () => {
39
+ if (vm.loading) {
40
+ return '';
41
+ } else {
42
+ glitter.share.rebateConfig.title = CheckInput.isEmpty(glitter.share.rebateConfig.title)
43
+ ? Language.text('shopping_credit')
44
+ : glitter.share.rebateConfig.title;
45
+ const buttonHTML = [
46
+ {
47
+ key: 'account_userinfo',
48
+ title: Language.text('account'),
252
49
  },
253
- divCreate: {},
254
- onCreate: () => {
255
- if (vm.loading) {
256
- UmClass.getRebateInfo().then((data) => {
257
- glitter.share.rebateConfig = data;
258
- vm.loading = false;
259
- gvc.notifyDataChange(vm.id);
260
- });
261
- }
50
+ {
51
+ key: 'voucher-list',
52
+ title: Language.text('my_coupons'),
262
53
  },
263
- });
264
- }
265
-
266
- static spinner(obj?: {
267
- container?: {
268
- class?: string;
269
- style?: string;
270
- };
271
- circle?: {
272
- visible?: boolean;
273
- width?: number;
274
- borderSize?: number;
275
- };
276
- text?: {
277
- value?: string;
278
- visible?: boolean;
279
- fontSize?: number;
280
- };
281
- }) {
282
- const container = {
283
- class: `${obj?.container?.class ?? ''}`,
284
- style: `margin-top: 2rem ;${obj?.container?.style}`,
285
- };
286
- const circleAttr = {
287
- visible: obj?.circle?.visible === false ? false : true,
288
- width: obj?.circle?.width ?? 20,
289
- borderSize: obj?.circle?.borderSize ?? 16,
290
- };
291
- const textAttr = {
292
- value: obj?.text?.value ?? Language.text('loading'),
293
- visible: obj?.text?.visible === false ? false : true,
294
- fontSize: obj?.text?.fontSize ?? 16,
295
- };
296
- return html`
297
- <div class="d-flex align-items-center justify-content-center flex-column w-100 mx-auto ${container.class}"
298
- style="${container.style}">
299
- <div
300
- class="spinner-border ${circleAttr.visible ? '' : 'd-none'}"
301
- style="font-size: ${circleAttr.borderSize}px; width: ${circleAttr.width}px; height: ${circleAttr.width}px;"
302
- role="status"
303
- ></div>
304
- <span class="mt-3 ${textAttr.visible ? '' : 'd-none'}"
305
- style="font-size: ${textAttr.fontSize}px;">${textAttr.value}</span>
306
- </div>`;
307
- }
308
-
309
- static dialog(obj: { gvc: GVC; tag: string; title?: string; innerHTML: (gvc: GVC) => string; width?: number }) {
310
- return obj.gvc.glitter.innerDialog((gvc: GVC) => {
311
- return html`
54
+ {
55
+ key: 'rebate',
56
+ title: `${Language.text('my')}${glitter.share.rebateConfig.title}`,
57
+ },
58
+ {
59
+ key: 'order_list',
60
+ title: Language.text('order_history'),
61
+ },
62
+ {
63
+ key: 'wishlist',
64
+ title: Language.text('wishlist'),
65
+ },
66
+ {
67
+ key: 'reset_password',
68
+ title: Language.text('reset_password'),
69
+ },
70
+ {
71
+ key: 'logout',
72
+ title: Language.text('logout'),
73
+ },
74
+ ]
75
+ .map(item => {
76
+ if (item.key == 'wishlist' && (window as any).store_info.wishlist == false) {
77
+ return '';
78
+ }
79
+ return html`
312
80
  <div
313
- class="bg-white shadow rounded-3"
314
- style="overflow-y: auto; ${document.body.clientWidth > 768 ? `width: ${obj.width || 600}px;` : `width: ${obj.width ? `${obj.width}px` : `90vw`}; max-width: 92.5vw;`}"
315
- >
316
- <div class="bg-white shadow rounded-3" style="width: 100%; overflow-y: auto; position: relative;">
317
- <div class="w-100 d-flex align-items-center p-3 border-bottom"
318
- style="position: sticky; top: 0; background: #fff;">
319
- <div style="font-size: 16px; font-weight: 700; color: #292218;">${obj.title ?? ''}</div>
320
- <div class="flex-fill"></div>
321
- <i
322
- class="fa-regular fa-circle-xmark fs-5 text-dark"
323
- style="cursor: pointer"
81
+ class="option px-2 d-flex justify-content-center um-nav-btn ${vm.pageName === item.key
82
+ ? 'um-nav-btn-active'
83
+ : ''}"
84
+ onclick="${gvc.event(async () => {
85
+ if (item.key === 'reset_password') {
86
+ const dialog = new ShareDialog(gvc.glitter);
87
+ dialog.dataLoading({ visible: true });
88
+ const userData: any = await UmClass.getUserData(gvc);
89
+ dialog.dataLoading({ visible: false });
90
+ UmClass.dialog({
91
+ gvc: gvc,
92
+ title: Language.text('reset_password_event'),
93
+ tag: '',
94
+ innerHTML: (gvc: GVC) => {
95
+ let update_vm = {
96
+ verify_code: '',
97
+ pwd: '',
98
+ };
99
+ let get_verify_timer = 0;
100
+ let repeat_pwd = '';
101
+ return [
102
+ html` <div class="tx_normal fw-normal mb-1">${Language.text('password')}</div>`,
103
+ html`<input
104
+ class="bgw-input"
105
+ type="password"
106
+ placeholder="${Language.text('please_enter_password')}"
107
+ oninput="${gvc.event(e => {
108
+ update_vm.pwd = e.value;
109
+ })}"
110
+ value="${update_vm.pwd}"
111
+ />`,
112
+ html` <div class="tx_normal fw-normal mt-2 mb-1">
113
+ ${Language.text('confirm_password')}
114
+ </div>`,
115
+ html`<input
116
+ class="bgw-input mb-2"
117
+ type="password"
118
+ placeholder="${Language.text('please_enter_password_again')}"
119
+ oninput="${gvc.event(e => {
120
+ repeat_pwd = e.value;
121
+ })}"
122
+ value="${repeat_pwd}"
123
+ />`,
124
+ gvc.bindView(() => {
125
+ const id = gvc.glitter.getUUID();
126
+ return {
127
+ bind: id,
128
+ view: () => {
129
+ return html`${Language.text('reset_password_verification_code')}
130
+ ${UmClass.style_components.blueNote(
131
+ get_verify_timer
132
+ ? `${Language.text('verification_code_sent_to')}『${userData.userData.email}』`
133
+ : Language.text('get_verification_code'),
134
+ gvc.event(() => {
135
+ if (!get_verify_timer) {
136
+ const dialog = new ShareDialog(gvc.glitter);
137
+ dialog.dataLoading({ visible: true });
138
+ ApiUser.emailVerify(userData.userData.email, (window as any).appName).then(
139
+ async r => {
140
+ dialog.dataLoading({ visible: false });
141
+ get_verify_timer = 60;
142
+ gvc.notifyDataChange(id);
143
+ }
144
+ );
145
+ }
146
+ })
147
+ )}`;
148
+ },
149
+ divCreate: {
150
+ class: `d-flex flex-column`,
151
+ style: `gap:3px;`,
152
+ },
153
+ onCreate: () => {
154
+ if (get_verify_timer > 0) {
155
+ get_verify_timer--;
156
+ setTimeout(() => {
157
+ gvc.notifyDataChange(id);
158
+ }, 1000);
159
+ }
160
+ },
161
+ };
162
+ }),
163
+ html`<input
164
+ class="bgw-input mt-2 mb-4"
165
+ type="text"
166
+ placeholder="${Language.text('please_enter_verification_code')}"
167
+ oninput="${gvc.event((e, event) => {
168
+ update_vm.verify_code = e.value;
169
+ })}"
170
+ value="${update_vm.verify_code}"
171
+ />`,
172
+ html` <div class="d-flex align-items-center justify-content-end pt-2 border-top mx-n3">
173
+ <div
174
+ class="um-nav-btn um-nav-btn-active d-flex align-items-center justify-content-center"
175
+ style="cursor:pointer;"
176
+ type="button"
324
177
  onclick="${gvc.event(() => {
325
- gvc.closeDialog();
178
+ if (update_vm.pwd.length < 8) {
179
+ dialog.errorMessage({ text: Language.text('password_min_length') });
180
+ return;
181
+ }
182
+ if (repeat_pwd !== update_vm.pwd) {
183
+ dialog.errorMessage({ text: Language.text('please_confirm_password_again') });
184
+ return;
185
+ }
186
+ dialog.dataLoading({ visible: true });
187
+ ApiUser.updateUserData({
188
+ userData: update_vm,
189
+ }).then(res => {
190
+ dialog.dataLoading({ visible: false });
191
+ if (!res.result && res.response.data.msg === 'email-verify-false') {
192
+ dialog.errorMessage({ text: Language.text('email_verification_code_incorrect') });
193
+ } else if (!res.result && res.response.data.msg === 'phone-verify-false') {
194
+ dialog.errorMessage({ text: Language.text('sms_verification_code_incorrect') });
195
+ } else if (!res.result && res.response.data.msg === 'phone-exists') {
196
+ dialog.errorMessage({ text: Language.text('phone_number_already_exists') });
197
+ } else if (!res.result && res.response.data.msg === 'email-exists') {
198
+ dialog.errorMessage({ text: Language.text('email_already_exists') });
199
+ } else if (!res.result) {
200
+ dialog.errorMessage({ text: Language.text('update_exception') });
201
+ } else {
202
+ dialog.successMessage({ text: Language.text('change_success') });
203
+ gvc.closeDialog();
204
+ }
205
+ });
326
206
  })}"
327
- ></i>
328
- </div>
329
- <div class="c_dialog">
330
- <div class="c_dialog_body">
331
- <div class="c_dialog_main"
332
- style="gap: 24px; height: auto; max-height: 500px; padding: 12px 20px;">
333
- ${obj.innerHTML(gvc)}
334
- </div>
335
- </div>
336
- </div>
337
- </div>
338
- </div>`;
339
- }, obj.tag);
340
- }
341
-
342
- static async getRebateInfo() {
343
- return new Promise((resolve) => {
344
- ApiWallet.getRebateConfig({
345
- type: 'me',
346
- }).then(async (res) => {
347
- if (res.result && res.response.data) {
348
- resolve(res.response.data);
349
- } else {
350
- resolve({});
351
- }
352
- });
353
- });
354
- }
355
-
356
- static async getUserData(gvc: GVC) {
357
- return new Promise(async (resolve, reject) => {
358
- gvc.glitter.share.GlobalUser.userInfo = undefined;
359
- (gvc.glitter.ut.queue as any)['api-get-user_data'] = undefined;
360
-
361
- if (!gvc.glitter.share.GlobalUser.token) {
362
- gvc.glitter.share.GlobalUser.token = '';
363
- resolve(false);
364
- return;
365
- }
366
-
367
- gvc.glitter.ut.setQueue(
368
- 'api-get-user_data',
369
- async (callback: any) => {
370
- callback(await ApiUser.getUserData(gvc.glitter.share.GlobalUser.token, 'me'));
371
- },
372
- (r: any) => {
373
- try {
374
- if (!r.result) {
375
- gvc.glitter.share.GlobalUser.token = '';
376
- resolve(false);
377
- (gvc.glitter.ut.queue as any)['api-get-user_data'] = undefined;
378
- } else {
379
- gvc.glitter.share.GlobalUser.userInfo = r.response;
380
- gvc.glitter.share.GlobalUser.updateUserData = JSON.parse(JSON.stringify(r.response));
381
- resolve(gvc.glitter.share.GlobalUser.userInfo);
382
- }
383
- } catch (e) {
384
- resolve(false);
385
- (gvc.glitter.ut.queue as any)['api-get-user_data'] = undefined;
207
+ >
208
+ <span class="tx_700_white">${Language.text('confirm_reset')}</span>
209
+ </div>
210
+ </div>`,
211
+ ].join('');
212
+ },
213
+ });
214
+ } else if (item.key === 'logout') {
215
+ GlobalUser.token = '';
216
+ changePage('index', 'home', {});
217
+ } else {
218
+ changePage(item.key, 'page', {});
386
219
  }
387
- },
388
- );
389
- }).then((data) => {
390
- return data;
391
- });
392
- }
393
-
394
- static addStyle(gvc: GVC) {
395
- const globalValue = gvc.glitter.share.globalValue;
396
- const titleFontColor = globalValue['theme_color.0.title'] ?? '#333333';
397
- const contentColor = globalValue['theme_color.0.content'] ?? '#333333';
398
- const borderButtonBgr = globalValue['theme_color.0.border-button-bg'] ?? '#fff';
399
- const borderButtonText = globalValue['theme_color.0.border-button-text'] ?? '#333333';
400
- const solidButtonBgr = globalValue['theme_color.0.solid-button-bg'] ?? '#292218';
401
- const solidButtonText = globalValue['theme_color.0.solid-button-text'] ?? '#000000';
402
-
403
- gvc.addStyle(`
404
-
405
- .um-nav-title {
406
- font-weight: 700;
407
- font-size: 36px;
408
- color: ${titleFontColor};
409
- }
410
-
411
- .um-nav-btn {
412
- white-space: nowrap;
413
- text-align: center;
414
- align-items: center;
415
- border-radius: 22px;
416
- height: 44px;
417
- cursor: pointer;
418
- font-size: 16px;
419
- min-width: 31%;
420
- max-width: 180px;
421
- background: #ffffff;
422
- border: 2px solid ${borderButtonBgr};
423
- color: ${borderButtonText};
424
- }
425
-
426
- .um-nav-btn.um-nav-btn-active {
427
- background: ${borderButtonBgr};
428
- color: #ffffff;
429
- font-weight: 600;
430
- }
431
-
432
- .um-nav-mobile-tags-container {
433
- gap: 10px;
434
- overflow-x: auto;
435
- align-items: center;
436
- }
437
-
438
- .um-solid-btn {
439
- background: ${solidButtonBgr};
440
- color: ${solidButtonText};
441
- cursor: pointer;
442
- display: flex;
443
- width: 100px;
444
- padding: 7px;
445
- justify-content: center;
446
- align-items: center;
447
- gap: 10px;
448
- border-radius: 5px;
449
- }
450
-
451
- .um-info-title {
452
- color: ${titleFontColor};
453
- font-size: 28px;
454
- }
455
-
456
- .um-info-insignia {
457
- border-radius: 20px;
458
- height: 32px;
459
- padding: 8px 16px;
460
- font-size: 14px;
461
- display: inline-block;
462
- font-weight: 600;
463
- line-height: 1;
464
- text-align: center;
465
- white-space: nowrap;
466
- vertical-align: baseline;
467
- background: #7e7e7e;
468
- color: #fff;
469
- }
470
-
471
- .um-info-note {
472
- color: #393939;
473
- font-size: 16px;
474
- }
475
-
476
- .um-info-event {
477
- color: #3564c0;
478
- font-size: 16px;
479
- cursor: pointer;
480
- }
481
-
482
- .um-title {
483
- text-align: start;
484
- font-size: 16px;
485
- font-weight: 700;
486
- line-height: 25.2px;
487
- word-wrap: break-word;
488
- color: ${titleFontColor};
489
- }
490
-
491
- .um-content {
492
- text-align: start;
493
- font-size: 14px;
494
- font-weight: 400;
495
- line-height: 25.2px;
496
- word-wrap: break-word;
497
- color: ${contentColor};
498
- }
499
-
500
- .um-linebar-container {
501
- flex-direction: column;
502
- justify-content: flex-start;
503
- align-items: flex-start;
504
- gap: 8px;
505
- display: flex;
506
- }
507
-
508
- .um-text-danger {
509
- color: #aa4b4b;
510
- }
511
-
512
- .um-linebar {
513
- border-radius: 40px;
514
- flex-direction: column;
515
- justify-content: flex-start;
516
- align-items: flex-start;
517
- display: flex;
518
- position: relative;
519
- overflow: hidden;
520
- }
521
-
522
- .um-linebar-behind {
523
- position: absolute;
524
- width: 100%;
525
- height: 100%;
526
- opacity: 0.4;
527
- background: ${solidButtonBgr};
528
- }
529
-
530
- .um-linebar-fill {
531
- padding: 10px;
532
- border-radius: 10px;
533
- height: 100%;
534
- }
535
-
536
- .bgw-input {
537
- width: 100%;
538
- height: 40px;
539
- padding: 0px 18px;
540
- border-radius: 10px;
541
- appearance: none;
542
- border: 1px solid ${borderButtonBgr};
543
- }
544
-
545
- .bgw-input[type='date'] {
546
- color: black;
547
- }
548
-
549
- .bgw-input[type='date']::before {
550
- content: attr(data-placeholder);
551
- position: absolute;
552
- color: #8d8d8d;
553
- pointer-events: none;
554
- font-size: 15px;
555
- }
556
-
557
- .bgw-input:focus {
558
- outline: 0;
559
- }
560
-
561
- .bgw-input-readonly:focus-visible {
562
- outline: 0;
563
- }
564
-
565
- .um-rb-bgr {
566
- background: whitesmoke;
567
- justify-content: space-between;
568
- gap: 18px;
569
- }
570
-
571
- .um-rb-amount {
572
- display: flex;
573
- align-items: center;
574
- font-size: 32px;
575
- line-height: 32px;
576
- }
577
-
578
- .um-container {
579
- display: flex;
580
- justify-content: center;
581
- margin: 2rem auto;
582
- width: 100%;
583
- }
584
-
585
- .um-th-bar {
586
- justify-content: space-around;
587
- align-items: center;
588
- height: 40px;
589
- }
590
-
591
- .um-th {
592
- text-align: start;
593
- font-size: 18px;
594
- font-style: normal;
595
- font-weight: 700;
596
- color: ${titleFontColor};
597
- }
598
-
599
- .um-td-bar {
600
- justify-content: space-around;
601
- align-items: center;
602
- height: 40px;
603
- border-bottom: 1px solid #e2d6cd;
604
- }
605
-
606
- .um-td {
607
- text-align: start;
608
- font-size: 18px;
609
- font-style: normal;
610
- font-weight: 400;
611
- color: ${titleFontColor};
612
- }
613
-
614
- .um-mobile-area {
615
- padding: 28px;
616
- margin-top: 12px;
617
- background: #ffffff;
618
- border-radius: 20px;
619
- overflow: hidden;
620
- justify-content: center;
621
- align-items: flex-start;
622
- display: flex;
623
- flex-direction: column;
624
- gap: 12px;
625
- border: 1px solid ${titleFontColor};
626
- }
627
-
628
- .um-mobile-text {
629
- text-align: start;
630
- font-size: 16px;
631
- font-weight: 400;
632
- line-height: 22.4px;
633
- letter-spacing: 0.64px;
634
- word-wrap: break-word;
635
- color: ${titleFontColor};
636
- }
637
-
638
- .um-img-bgr {
639
- padding-bottom: 100%;
640
- background-size: cover;
641
- background-position: center;
642
- background-repeat: no-repeat;
643
- }
644
-
645
- .um-card-title {
646
- font-weight: 600;
647
- color: ${titleFontColor};
648
- }
649
-
650
- .um-icon-container {
651
- position: absolute;
652
- right: 10px;
653
- top: 10px;
654
- width: 40px;
655
- height: 40px;
656
- border-radius: 50%;
657
- background: white;
658
- color: black;
659
- display: flex;
660
- align-items: center;
661
- justify-content: center;
662
- }
663
-
664
- .card-sale-price {
665
- font-family: 'Noto Sans';
666
- font-style: normal;
667
- line-height: normal;
668
- font-size: 16px;
669
- opacity: 0.9;
670
- color: #322b25;
671
- }
672
-
673
- .card-cost-price {
674
- font-family: 'Noto Sans';
675
- color: #d45151;
676
- font-style: normal;
677
- font-weight: 400;
678
- line-height: normal;
679
- font-size: 14px;
680
- margin-right: 4px;
681
- }
682
- .gray-line {
683
- border-bottom: 1px solid #dddddd;
684
- padding-bottom: 6px;
685
- margin-bottom: 6px;
686
- }
687
- .um-insignia {
688
- border-radius: 0.5rem;
689
- height: 26px;
690
- padding: 6px 8px;
691
- font-size: 14px;
692
- display: inline-block;
693
- font-weight: 500;
694
- line-height: 1;
695
- text-align: center;
696
- white-space: nowrap;
697
- vertical-align: baseline;
698
- }
699
- .um-insignia-secondary {
700
- background: #8d8d8d;
701
- color: #ffffff;
702
- }
703
-
704
- @media (min-width: 576px) {
705
- .um-container {
706
- max-width: 540px;
707
- }
708
- }
709
-
710
- @media (min-width: 768px) {
711
- .um-container {
712
- max-width: 720px;
713
- }
714
-
715
- .um-nav-btn {
716
- min-width: 110px;
717
- font-size: 14px;
718
- height: 40px;
719
- }
720
-
721
- .um-nav-title {
722
- font-size: 30px;
723
- }
724
-
725
- .um-rb-amount {
726
- font-size: 36px;
727
- line-height: 36px;
728
- }
729
- }
730
-
731
- @media (min-width: 992px) {
732
- .um-container {
733
- max-width: 800px;
734
- }
735
- }
736
-
737
- @media (min-width: 1200px) {
738
- .um-container {
739
- max-width: 860px;
740
- }
741
- }
742
-
743
- @media (min-width: 1400px) {
744
- .um-container {
745
- max-width: 960px;
746
- }
747
- }
748
- `);
749
- }
750
-
751
- static jumpAlert(obj: {
752
- gvc: GVC;
753
- text: string;
754
- justify: 'top' | 'bottom';
755
- align: 'left' | 'center' | 'right';
756
- timeout?: number;
757
- width?: number
758
- }) {
759
- const className = 'um-class';
760
- const fixedStyle = (() => {
761
- let style = '';
762
- if (obj.justify === 'top') {
763
- style += `top: 90px;`;
764
- } else if (obj.justify === 'bottom') {
765
- style += `bottom: 24px;`;
766
- }
767
- if (obj.align === 'left') {
768
- style += `left: 12px;`;
769
- } else if (obj.align === 'center') {
770
- style += `left: 50%; right: 50%;`;
771
- } else if (obj.align === 'right') {
772
- style += `right: 12px;`;
773
- }
774
- return style;
775
- })();
776
- const transX = obj.align === 'center' ? '-50%' : '0';
777
-
778
- obj.gvc.addStyle(`
779
- .bounce-effect-${className} {
780
- animation: bounce 0.5s alternate;
781
- animation-iteration-count: 2;
782
- position: fixed;
783
- ${fixedStyle}
784
- background-color: #393939;
785
- opacity: 0.85;
786
- color: white;
787
- padding: 10px;
788
- border-radius: 8px;
789
- width: ${obj.width ?? 120}px;
790
- text-align: center;
791
- z-index: 100001;
792
- transform: translateX(${transX});
793
- }
794
-
795
- @keyframes bounce {
796
- 0% {
797
- transform: translate(${transX}, 0);
798
- }
799
- 100% {
800
- transform: translate(${transX}, -6px);
801
- }
802
- }
803
- `);
804
-
805
- const htmlString = html`
806
- <div class="bounce-effect-${className}">${obj.text}</div>`;
807
- obj.gvc.glitter.document.body.insertAdjacentHTML('beforeend', htmlString);
808
- setTimeout(() => {
809
- const element = document.querySelector(`.bounce-effect-${className}`) as HTMLElement;
810
- if (element) {
811
- element.remove();
812
- }
813
- }, obj.timeout ?? 2000);
814
- }
815
-
816
- static validImageBox(obj: {
817
- gvc: GVC;
818
- image: string;
819
- width: number;
820
- height?: number;
821
- class?: string;
822
- style?: string
823
- }) {
824
- const imageVM = {
825
- id: obj.gvc.glitter.getUUID(),
826
- loading: true,
827
- url: 'https://d3jnmi1tfjgtti.cloudfront.net/file/234285319/1722936949034-default_image.jpg',
828
- };
829
- const wh = `
830
- display: flex;
831
- min-width: ${obj.width}px;
832
- min-height: ${obj.height ?? obj.width}px;
833
- max-width: ${obj.width}px;
834
- max-height: ${obj.height ?? obj.width}px;
835
- object-fit: cover;
836
- object-position: center;
837
- `;
838
- return obj.gvc.bindView({
839
- bind: imageVM.id,
840
- view: () => {
841
- if (imageVM.loading) {
842
- return obj.gvc.bindView(() => {
843
- return {
844
- bind: obj.gvc.glitter.getUUID(),
845
- view: () => {
846
- return UmClass.spinner({
847
- container: { class: 'mt-0' },
848
- text: { visible: false },
849
- });
850
- },
851
- divCreate: {
852
- style: `${wh}${obj.style ?? ''}`,
853
- class: obj.class ?? '',
854
- },
855
- };
856
- });
857
- } else {
858
- return obj.gvc.bindView(() => {
859
- return {
860
- bind: obj.gvc.glitter.getUUID(),
861
- view: () => {
862
- return '';
863
- },
864
- divCreate: {
865
- elem: 'img',
866
- style: `${wh}${obj.style ?? ''}`,
867
- class: obj.class ?? '',
868
- option: [
869
- {
870
- key: 'src',
871
- value: imageVM.url,
872
- },
873
- ],
874
- },
875
- };
876
- });
877
- }
878
- },
879
- onCreate: () => {
880
- function isImageUrlValid(url: string): Promise<boolean> {
881
- return new Promise((resolve) => {
882
- const img = new Image();
883
- img.onload = () => resolve(true);
884
- img.onerror = () => resolve(false);
885
- img.src = url;
886
- });
887
- }
888
-
889
- if (imageVM.loading) {
890
- isImageUrlValid(obj.image).then((isValid) => {
891
- if (isValid) {
892
- imageVM.url = obj.image;
893
- }
894
- imageVM.loading = false;
895
- obj.gvc.notifyDataChange(imageVM.id);
896
- });
897
- }
898
- },
899
- });
900
- }
220
+ })}"
221
+ >
222
+ ${item.title}
223
+ </div>
224
+ `;
225
+ })
226
+ .join('');
227
+
228
+ return html` <div class="account-section">
229
+ <div class="section-title mb-4 mt-0 pt-lg-3 um-nav-title px-2">${Language.text('my_profile')}</div>
230
+ ${document.body.clientWidth > 768
231
+ ? html` <div class="mx-auto mt-3 um-nav-container">
232
+ <div class="account-options d-flex gap-3">${buttonHTML}</div>
233
+ </div>`
234
+ : html` <div class="account-navigation w-100">
235
+ <nav class="nav-links mb-3 mb-md-0">
236
+ <div class="nav-options d-flex flex-wrap um-nav-mobile-tags-container px-0">${buttonHTML}</div>
237
+ </nav>
238
+ </div>`}
239
+ </div>`;
240
+ }
241
+ },
242
+ onCreate: () => {
243
+ if (vm.loading) {
244
+ UmClass.getRebateInfo().then(data => {
245
+ glitter.share.rebateConfig = data;
246
+ vm.loading = false;
247
+ gvc.notifyDataChange(vm.id);
248
+ });
249
+ }
250
+ },
251
+ });
252
+ }
253
+
254
+ static spinner(obj?: {
255
+ container?: {
256
+ class?: string;
257
+ style?: string;
258
+ };
259
+ circle?: {
260
+ visible?: boolean;
261
+ width?: number;
262
+ borderSize?: number;
263
+ };
264
+ text?: {
265
+ value?: string;
266
+ visible?: boolean;
267
+ fontSize?: number;
268
+ };
269
+ }) {
270
+ const container = {
271
+ class: `${obj?.container?.class ?? ''}`,
272
+ style: `margin-top: 2rem ;${obj?.container?.style}`,
273
+ };
274
+ const circleAttr = {
275
+ visible: obj?.circle?.visible === false ? false : true,
276
+ width: obj?.circle?.width ?? 20,
277
+ borderSize: obj?.circle?.borderSize ?? 16,
278
+ };
279
+ const textAttr = {
280
+ value: obj?.text?.value ?? Language.text('loading'),
281
+ visible: obj?.text?.visible === false ? false : true,
282
+ fontSize: obj?.text?.fontSize ?? 16,
283
+ };
284
+ return html` <div
285
+ class="d-flex align-items-center justify-content-center flex-column w-100 mx-auto ${container.class}"
286
+ style="${container.style}"
287
+ >
288
+ <div
289
+ class="spinner-border ${circleAttr.visible ? '' : 'd-none'}"
290
+ style="font-size: ${circleAttr.borderSize}px; width: ${circleAttr.width}px; height: ${circleAttr.width}px;"
291
+ role="status"
292
+ ></div>
293
+ <span class="mt-3 ${textAttr.visible ? '' : 'd-none'}" style="font-size: ${textAttr.fontSize}px;"
294
+ >${textAttr.value}</span
295
+ >
296
+ </div>`;
297
+ }
298
+
299
+ static dialog(obj: { gvc: GVC; tag: string; title?: string; innerHTML: (gvc: GVC) => string; width?: number }) {
300
+ return obj.gvc.glitter.innerDialog((gvc: GVC) => {
301
+ return html` <div
302
+ class="bg-white shadow rounded-3"
303
+ style="overflow-y: auto; ${document.body.clientWidth > 768
304
+ ? `width: ${obj.width || 600}px;`
305
+ : `width: ${obj.width ? `${obj.width}px` : `90vw`}; max-width: 92.5vw;`}"
306
+ >
307
+ <div class="bg-white shadow rounded-3" style="width: 100%; overflow-y: auto; position: relative;">
308
+ <div
309
+ class="w-100 d-flex align-items-center p-3 border-bottom"
310
+ style="position: sticky; top: 0; background: #fff;"
311
+ >
312
+ <div style="font-size: 16px; font-weight: 700; color: #292218;">${obj.title ?? ''}</div>
313
+ <div class="flex-fill"></div>
314
+ <i
315
+ class="fa-regular fa-circle-xmark fs-5 text-dark"
316
+ style="cursor: pointer"
317
+ onclick="${gvc.event(() => {
318
+ gvc.closeDialog();
319
+ })}"
320
+ ></i>
321
+ </div>
322
+ <div class="c_dialog">
323
+ <div class="c_dialog_body">
324
+ <div class="c_dialog_main" style="gap: 24px; height: auto; max-height: 500px; padding: 12px 20px;">
325
+ ${obj.innerHTML(gvc)}
326
+ </div>
327
+ </div>
328
+ </div>
329
+ </div>
330
+ </div>`;
331
+ }, obj.tag);
332
+ }
333
+
334
+ static async getRebateInfo() {
335
+ return new Promise(resolve => {
336
+ ApiWallet.getRebateConfig({
337
+ type: 'me',
338
+ }).then(async res => {
339
+ if (res.result && res.response.data) {
340
+ resolve(res.response.data);
341
+ } else {
342
+ resolve({});
343
+ }
344
+ });
345
+ });
346
+ }
347
+
348
+ static async getUserData(gvc: GVC) {
349
+ return new Promise(async (resolve, reject) => {
350
+ gvc.glitter.share.GlobalUser.userInfo = undefined;
351
+ (gvc.glitter.ut.queue as any)['api-get-user_data'] = undefined;
352
+
353
+ if (!gvc.glitter.share.GlobalUser.token) {
354
+ gvc.glitter.share.GlobalUser.token = '';
355
+ resolve(false);
356
+ return;
357
+ }
358
+
359
+ gvc.glitter.ut.setQueue(
360
+ 'api-get-user_data',
361
+ async (callback: any) => {
362
+ callback(await ApiUser.getUserData(gvc.glitter.share.GlobalUser.token, 'me'));
363
+ },
364
+ (r: any) => {
365
+ try {
366
+ if (!r.result) {
367
+ gvc.glitter.share.GlobalUser.token = '';
368
+ resolve(false);
369
+ (gvc.glitter.ut.queue as any)['api-get-user_data'] = undefined;
370
+ } else {
371
+ gvc.glitter.share.GlobalUser.userInfo = r.response;
372
+ gvc.glitter.share.GlobalUser.updateUserData = JSON.parse(JSON.stringify(r.response));
373
+ resolve(gvc.glitter.share.GlobalUser.userInfo);
374
+ }
375
+ } catch (e) {
376
+ resolve(false);
377
+ (gvc.glitter.ut.queue as any)['api-get-user_data'] = undefined;
378
+ }
379
+ }
380
+ );
381
+ }).then(data => {
382
+ return data;
383
+ });
384
+ }
385
+
386
+ static addStyle(gvc: GVC) {
387
+ const globalValue = gvc.glitter.share.globalValue;
388
+ const titleFontColor = globalValue['theme_color.0.title'] ?? '#333333';
389
+ const contentColor = globalValue['theme_color.0.content'] ?? '#333333';
390
+ const borderButtonBgr = globalValue['theme_color.0.border-button-bg'] ?? '#fff';
391
+ const borderButtonText = globalValue['theme_color.0.border-button-text'] ?? '#333333';
392
+ const solidButtonBgr = globalValue['theme_color.0.solid-button-bg'] ?? '#292218';
393
+ const solidButtonText = globalValue['theme_color.0.solid-button-text'] ?? '#000000';
394
+
395
+ gvc.addStyle(`
396
+ .um-nav-title {
397
+ font-weight: 700;
398
+ font-size: 36px;
399
+ color: ${titleFontColor};
400
+ }
401
+
402
+ .um-nav-btn {
403
+ white-space: nowrap;
404
+ text-align: center;
405
+ align-items: center;
406
+ border-radius: 22px;
407
+ height: 44px;
408
+ cursor: pointer;
409
+ font-size: 16px;
410
+ min-width: 31%;
411
+ max-width: 180px;
412
+ background: #ffffff;
413
+ border: 2px solid ${borderButtonBgr};
414
+ color: ${borderButtonText};
415
+ }
416
+
417
+ .um-nav-btn.um-nav-btn-active {
418
+ background: ${borderButtonBgr};
419
+ color: #ffffff;
420
+ font-weight: 600;
421
+ }
422
+
423
+ .um-nav-mobile-tags-container {
424
+ gap: 10px;
425
+ overflow-x: auto;
426
+ align-items: center;
427
+ }
428
+
429
+ .um-solid-btn {
430
+ background: ${solidButtonBgr};
431
+ color: ${solidButtonText};
432
+ cursor: pointer;
433
+ display: flex;
434
+ width: 100px;
435
+ padding: 7px;
436
+ justify-content: center;
437
+ align-items: center;
438
+ gap: 10px;
439
+ border-radius: 5px;
440
+ }
441
+
442
+ .um-info-title {
443
+ color: ${titleFontColor};
444
+ font-size: 28px;
445
+ }
446
+
447
+ .um-info-insignia {
448
+ border-radius: 20px;
449
+ height: 32px;
450
+ padding: 8px 16px;
451
+ font-size: 14px;
452
+ display: inline-block;
453
+ font-weight: 600;
454
+ line-height: 1;
455
+ text-align: center;
456
+ white-space: nowrap;
457
+ vertical-align: baseline;
458
+ background: #7e7e7e;
459
+ color: #fff;
460
+ }
461
+
462
+ .um-info-note {
463
+ color: #393939;
464
+ font-size: 16px;
465
+ }
466
+
467
+ .um-info-event {
468
+ color: #3564c0;
469
+ font-size: 16px;
470
+ cursor: pointer;
471
+ }
472
+
473
+ .um-title {
474
+ text-align: start;
475
+ font-size: 16px;
476
+ font-weight: 700;
477
+ line-height: 25.2px;
478
+ word-wrap: break-word;
479
+ color: ${titleFontColor};
480
+ }
481
+
482
+ .um-content {
483
+ text-align: start;
484
+ font-size: 14px;
485
+ font-weight: 400;
486
+ line-height: 25.2px;
487
+ word-wrap: break-word;
488
+ color: ${contentColor};
489
+ }
490
+
491
+ .um-linebar-container {
492
+ flex-direction: column;
493
+ justify-content: flex-start;
494
+ align-items: flex-start;
495
+ gap: 8px;
496
+ display: flex;
497
+ }
498
+
499
+ .um-text-danger {
500
+ color: #aa4b4b;
501
+ }
502
+
503
+ .um-linebar {
504
+ border-radius: 40px;
505
+ flex-direction: column;
506
+ justify-content: flex-start;
507
+ align-items: flex-start;
508
+ display: flex;
509
+ position: relative;
510
+ overflow: hidden;
511
+ }
512
+
513
+ .um-linebar-behind {
514
+ position: absolute;
515
+ width: 100%;
516
+ height: 100%;
517
+ opacity: 0.4;
518
+ background: ${solidButtonBgr};
519
+ }
520
+
521
+ .um-linebar-fill {
522
+ padding: 10px;
523
+ border-radius: 10px;
524
+ height: 100%;
525
+ }
526
+
527
+ .bgw-input {
528
+ width: 100%;
529
+ height: 40px;
530
+ padding: 0px 18px;
531
+ border-radius: 10px;
532
+ appearance: none;
533
+ border: 1px solid ${borderButtonBgr};
534
+ }
535
+
536
+ .bgw-input[type='date'] {
537
+ color: black;
538
+ }
539
+
540
+ .bgw-input[type='date']::before {
541
+ content: attr(data-placeholder);
542
+ position: absolute;
543
+ color: #8d8d8d;
544
+ pointer-events: none;
545
+ font-size: 15px;
546
+ }
547
+
548
+ .bgw-input:focus {
549
+ outline: 0;
550
+ }
551
+
552
+ .bgw-input-readonly:focus-visible {
553
+ outline: 0;
554
+ }
555
+
556
+ .um-rb-bgr {
557
+ background: whitesmoke;
558
+ justify-content: space-between;
559
+ gap: 18px;
560
+ }
561
+
562
+ .um-rb-amount {
563
+ display: flex;
564
+ align-items: center;
565
+ font-size: 32px;
566
+ line-height: 32px;
567
+ }
568
+
569
+ .um-container {
570
+ display: flex;
571
+ justify-content: center;
572
+ margin: 2rem auto;
573
+ width: 100%;
574
+ }
575
+
576
+ .um-th-bar {
577
+ justify-content: space-around;
578
+ align-items: center;
579
+ height: 40px;
580
+ }
581
+
582
+ .um-th {
583
+ text-align: start;
584
+ font-size: 18px;
585
+ font-style: normal;
586
+ font-weight: 700;
587
+ color: ${titleFontColor};
588
+ }
589
+
590
+ .um-td-bar {
591
+ justify-content: space-around;
592
+ align-items: center;
593
+ height: 40px;
594
+ border-bottom: 1px solid #e2d6cd;
595
+ }
596
+
597
+ .um-td {
598
+ text-align: start;
599
+ font-size: 18px;
600
+ font-style: normal;
601
+ font-weight: 400;
602
+ color: ${titleFontColor};
603
+ }
604
+
605
+ .um-mobile-area {
606
+ padding: 28px;
607
+ margin-top: 12px;
608
+ background: #ffffff;
609
+ border-radius: 20px;
610
+ overflow: hidden;
611
+ justify-content: center;
612
+ align-items: flex-start;
613
+ display: flex;
614
+ flex-direction: column;
615
+ gap: 12px;
616
+ border: 1px solid ${titleFontColor};
617
+ }
618
+
619
+ .um-mobile-text {
620
+ text-align: start;
621
+ font-size: 16px;
622
+ font-weight: 400;
623
+ line-height: 22.4px;
624
+ letter-spacing: 0.64px;
625
+ word-wrap: break-word;
626
+ color: ${titleFontColor};
627
+ }
628
+
629
+ .um-img-bgr {
630
+ padding-bottom: 100%;
631
+ background-size: cover;
632
+ background-position: center;
633
+ background-repeat: no-repeat;
634
+ }
635
+
636
+ .um-card-title {
637
+ font-weight: 600;
638
+ color: ${titleFontColor};
639
+ }
640
+
641
+ .um-icon-container {
642
+ position: absolute;
643
+ right: 10px;
644
+ top: 10px;
645
+ width: 40px;
646
+ height: 40px;
647
+ border-radius: 50%;
648
+ background: white;
649
+ color: black;
650
+ display: flex;
651
+ align-items: center;
652
+ justify-content: center;
653
+ }
654
+
655
+ .card-sale-price {
656
+ font-family: 'Noto Sans';
657
+ font-style: normal;
658
+ line-height: normal;
659
+ font-size: 16px;
660
+ opacity: 0.9;
661
+ color: #322b25;
662
+ }
663
+
664
+ .card-cost-price {
665
+ font-family: 'Noto Sans';
666
+ color: #d45151;
667
+ font-style: normal;
668
+ font-weight: 400;
669
+ line-height: normal;
670
+ font-size: 14px;
671
+ margin-right: 4px;
672
+ }
673
+ .gray-line {
674
+ border-bottom: 1px solid #dddddd;
675
+ padding-bottom: 6px;
676
+ margin-bottom: 6px;
677
+ }
678
+ .um-insignia {
679
+ border-radius: 0.5rem;
680
+ height: 26px;
681
+ padding: 6px 8px;
682
+ font-size: 14px;
683
+ display: inline-block;
684
+ font-weight: 500;
685
+ line-height: 1;
686
+ text-align: center;
687
+ white-space: nowrap;
688
+ vertical-align: baseline;
689
+ }
690
+ .um-insignia-secondary {
691
+ background: #8d8d8d;
692
+ color: #ffffff;
693
+ }
694
+
695
+ @media (min-width: 576px) {
696
+ .um-container {
697
+ max-width: 540px;
698
+ }
699
+ }
700
+
701
+ @media (min-width: 768px) {
702
+ .um-container {
703
+ max-width: 720px;
704
+ }
705
+
706
+ .um-nav-btn {
707
+ min-width: 110px;
708
+ font-size: 14px;
709
+ height: 40px;
710
+ }
711
+
712
+ .um-nav-title {
713
+ font-size: 30px;
714
+ }
715
+
716
+ .um-rb-amount {
717
+ font-size: 36px;
718
+ line-height: 36px;
719
+ }
720
+ }
721
+
722
+ @media (min-width: 992px) {
723
+ .um-container {
724
+ max-width: 800px;
725
+ }
726
+ }
727
+
728
+ @media (min-width: 1200px) {
729
+ .um-container {
730
+ max-width: 860px;
731
+ }
732
+ }
733
+
734
+ @media (min-width: 1400px) {
735
+ .um-container {
736
+ max-width: 960px;
737
+ }
738
+ }
739
+ `);
740
+ }
741
+
742
+ static jumpAlert(obj: {
743
+ gvc: GVC;
744
+ text: string;
745
+ justify: 'top' | 'bottom';
746
+ align: 'left' | 'center' | 'right';
747
+ timeout?: number;
748
+ width?: number;
749
+ }) {
750
+ const className = 'um-class';
751
+ const fixedStyle = (() => {
752
+ let style = '';
753
+ if (obj.justify === 'top') {
754
+ style += `top: 90px;`;
755
+ } else if (obj.justify === 'bottom') {
756
+ style += `bottom: 24px;`;
757
+ }
758
+ if (obj.align === 'left') {
759
+ style += `left: 12px;`;
760
+ } else if (obj.align === 'center') {
761
+ style += `left: 50%; right: 50%;`;
762
+ } else if (obj.align === 'right') {
763
+ style += `right: 12px;`;
764
+ }
765
+ return style;
766
+ })();
767
+ const transX = obj.align === 'center' ? '-50%' : '0';
768
+
769
+ obj.gvc.addStyle(`
770
+ .bounce-effect-${className} {
771
+ animation: bounce 0.5s alternate;
772
+ animation-iteration-count: 2;
773
+ position: fixed;
774
+ ${fixedStyle}
775
+ background-color: #393939;
776
+ opacity: 0.85;
777
+ color: white;
778
+ padding: 10px;
779
+ border-radius: 8px;
780
+ width: ${obj.width ?? 120}px;
781
+ text-align: center;
782
+ z-index: 100001;
783
+ transform: translateX(${transX});
784
+ }
785
+
786
+ @keyframes bounce {
787
+ 0% {
788
+ transform: translate(${transX}, 0);
789
+ }
790
+ 100% {
791
+ transform: translate(${transX}, -6px);
792
+ }
793
+ }
794
+ `);
795
+
796
+ const htmlString = html` <div class="bounce-effect-${className}">${obj.text}</div>`;
797
+ obj.gvc.glitter.document.body.insertAdjacentHTML('beforeend', htmlString);
798
+ setTimeout(() => {
799
+ const element = document.querySelector(`.bounce-effect-${className}`) as HTMLElement;
800
+ if (element) {
801
+ element.remove();
802
+ }
803
+ }, obj.timeout ?? 2000);
804
+ }
805
+
806
+ static validImageBox(obj: {
807
+ gvc: GVC;
808
+ image: string;
809
+ width: number;
810
+ height?: number;
811
+ class?: string;
812
+ style?: string;
813
+ }) {
814
+ const imageVM = {
815
+ id: obj.gvc.glitter.getUUID(),
816
+ loading: true,
817
+ url: 'https://d3jnmi1tfjgtti.cloudfront.net/file/234285319/1722936949034-default_image.jpg',
818
+ };
819
+ const wh = `
820
+ display: flex;
821
+ min-width: ${obj.width}px;
822
+ min-height: ${obj.height ?? obj.width}px;
823
+ max-width: ${obj.width}px;
824
+ max-height: ${obj.height ?? obj.width}px;
825
+ object-fit: cover;
826
+ object-position: center;
827
+ `;
828
+ return obj.gvc.bindView({
829
+ bind: imageVM.id,
830
+ view: () => {
831
+ if (imageVM.loading) {
832
+ return obj.gvc.bindView(() => {
833
+ return {
834
+ bind: obj.gvc.glitter.getUUID(),
835
+ view: () => {
836
+ return UmClass.spinner({
837
+ container: { class: 'mt-0' },
838
+ text: { visible: false },
839
+ });
840
+ },
841
+ divCreate: {
842
+ style: `${wh}${obj.style ?? ''}`,
843
+ class: obj.class ?? '',
844
+ },
845
+ };
846
+ });
847
+ } else {
848
+ return obj.gvc.bindView(() => {
849
+ return {
850
+ bind: obj.gvc.glitter.getUUID(),
851
+ view: () => {
852
+ return '';
853
+ },
854
+ divCreate: {
855
+ elem: 'img',
856
+ style: `${wh}${obj.style ?? ''}`,
857
+ class: obj.class ?? '',
858
+ option: [
859
+ {
860
+ key: 'src',
861
+ value: imageVM.url,
862
+ },
863
+ ],
864
+ },
865
+ };
866
+ });
867
+ }
868
+ },
869
+ onCreate: () => {
870
+ function isImageUrlValid(url: string): Promise<boolean> {
871
+ return new Promise(resolve => {
872
+ const img = new Image();
873
+ img.onload = () => resolve(true);
874
+ img.onerror = () => resolve(false);
875
+ img.src = url;
876
+ });
877
+ }
878
+
879
+ if (imageVM.loading) {
880
+ isImageUrlValid(obj.image).then(isValid => {
881
+ if (isValid) {
882
+ imageVM.url = obj.image;
883
+ }
884
+ imageVM.loading = false;
885
+ obj.gvc.notifyDataChange(imageVM.id);
886
+ });
887
+ }
888
+ },
889
+ });
890
+ }
901
891
  }