ts-glitter 21.2.3 → 21.2.5

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 (40) hide show
  1. package/lowcode/Entry.js +1 -1
  2. package/lowcode/Entry.ts +1 -1
  3. package/lowcode/backend-manager/bg-blog.js +19 -21
  4. package/lowcode/backend-manager/bg-blog.ts +20 -21
  5. package/lowcode/backend-manager/bg-product.js +94 -99
  6. package/lowcode/backend-manager/bg-product.ts +104 -109
  7. package/lowcode/cms-plugin/pos-pages/payment-page.js +16 -6
  8. package/lowcode/cms-plugin/pos-pages/payment-page.ts +15 -2
  9. package/lowcode/cms-plugin/pos-pages/pos-function.js +102 -55
  10. package/lowcode/cms-plugin/pos-pages/pos-function.ts +111 -61
  11. package/lowcode/glitter-base/global/global-user.js +7 -5
  12. package/lowcode/glitter-base/global/global-user.ts +6 -4
  13. package/lowcode/public-components/checkout/index.js +5 -3
  14. package/lowcode/public-components/checkout/index.ts +8 -3
  15. package/package.json +1 -1
  16. package/src/api-public/controllers/shop.js +2 -1
  17. package/src/api-public/controllers/shop.js.map +1 -1
  18. package/src/api-public/controllers/shop.ts +2 -1
  19. package/src/api-public/controllers/user.js +2 -1
  20. package/src/api-public/controllers/user.js.map +1 -1
  21. package/src/api-public/controllers/user.ts +2 -1
  22. package/src/api-public/services/fb-api.js +3 -2
  23. package/src/api-public/services/fb-api.js.map +1 -1
  24. package/src/api-public/services/fb-api.ts +3 -2
  25. package/src/api-public/services/financial-service.d.ts +1 -0
  26. package/src/api-public/services/financial-service.js +52 -29
  27. package/src/api-public/services/financial-service.js.map +1 -1
  28. package/src/api-public/services/financial-service.ts +70 -33
  29. package/src/api-public/services/financial-serviceV2.js +7 -17
  30. package/src/api-public/services/financial-serviceV2.js.map +1 -1
  31. package/src/api-public/services/monitor.d.ts +1 -0
  32. package/src/api-public/services/monitor.js +5 -2
  33. package/src/api-public/services/monitor.js.map +1 -1
  34. package/src/api-public/services/monitor.ts +5 -2
  35. package/src/modules/firebase.js +83 -69
  36. package/src/modules/firebase.js.map +1 -1
  37. package/src/modules/firebase.ts +334 -292
  38. package/src/seo-config.js +1 -1
  39. package/src/seo-config.js.map +1 -1
  40. package/src/seo-config.ts +1 -1
package/lowcode/Entry.js CHANGED
@@ -146,7 +146,7 @@ export class Entry {
146
146
  }
147
147
  window.renderClock = (_b = window.renderClock) !== null && _b !== void 0 ? _b : createClock();
148
148
  console.log(`Entry-time:`, window.renderClock.stop());
149
- glitter.share.editerVersion = 'V_21.2.3';
149
+ glitter.share.editerVersion = 'V_21.2.5';
150
150
  glitter.share.start = new Date();
151
151
  const vm = { appConfig: [] };
152
152
  window.saasConfig = {
package/lowcode/Entry.ts CHANGED
@@ -150,7 +150,7 @@ export class Entry {
150
150
  }
151
151
  (window as any).renderClock = (window as any).renderClock ?? createClock();
152
152
  console.log(`Entry-time:`, (window as any).renderClock.stop());
153
- glitter.share.editerVersion = 'V_21.2.3';
153
+ glitter.share.editerVersion = 'V_21.2.5';
154
154
  glitter.share.start = new Date();
155
155
  const vm = { appConfig: [] };
156
156
  (window as any).saasConfig = {
@@ -1598,13 +1598,17 @@ function detail(gvc, cf, vm, cVm, page_tab) {
1598
1598
  return {
1599
1599
  bind: subVM.id,
1600
1600
  view: () => {
1601
+ var _a;
1602
+ var _b;
1601
1603
  if (subVM.loading) {
1602
1604
  return BgWidget.spinner();
1603
1605
  }
1606
+ (_a = (_b = vm.data.content).relative_data) !== null && _a !== void 0 ? _a : (_b.relative_data = []);
1607
+ const relativeCloneData = structuredClone(vm.data.content.relative_data);
1604
1608
  return html `
1605
1609
  <div class="d-flex flex-column p-2" style="gap: 18px;">
1606
1610
  <div
1607
- class="d-flex align-items-center gray-bottom-line-18 "
1611
+ class="d-flex align-items-center gray-bottom-line-18"
1608
1612
  style="gap: 24px; justify-content: space-between;"
1609
1613
  >
1610
1614
  <div class="form-check-label c_updown_label">
@@ -1613,29 +1617,23 @@ function detail(gvc, cf, vm, cVm, page_tab) {
1613
1617
  ${BgWidget.grayButton('選擇商品', gvc.event(() => {
1614
1618
  BgProduct.productsDialog({
1615
1619
  gvc: gvc,
1616
- default: vm.data.content.relative_data.map((dd) => {
1617
- return `${dd.product_id}-${dd.variant.spec.join('-')}`;
1618
- }),
1620
+ default: relativeCloneData.map((dd) => `${dd.product_id}-${dd.variant.spec.join('-')}`),
1619
1621
  with_variants: true,
1620
1622
  filter_visible: page_tab === 'hidden' ? 'false' : 'true',
1621
- callback: (value) => __awaiter(this, void 0, void 0, function* () {
1622
- var _a;
1623
- vm.data.content.relative_data =
1624
- (_a = vm.data.content.relative_data) !== null && _a !== void 0 ? _a : [];
1625
- vm.data.content.relative_data =
1626
- vm.data.content.relative_data.concat(value.map((dd) => {
1627
- return {
1628
- variant: {
1629
- spec: dd
1630
- .split('-')
1631
- .filter((_, index) => index > 0),
1632
- },
1633
- product_id: dd.split('-')[0],
1634
- };
1635
- }));
1623
+ callback: specArray => {
1624
+ vm.data.content.relative_data = specArray.map((spec) => {
1625
+ return {
1626
+ variant: {
1627
+ spec: spec
1628
+ .split('-')
1629
+ .filter((_, index) => index > 0),
1630
+ },
1631
+ product_id: spec.split('-')[0],
1632
+ };
1633
+ });
1636
1634
  subVM.loading = true;
1637
1635
  gvc.notifyDataChange(subVM.id);
1638
- }),
1636
+ },
1639
1637
  });
1640
1638
  }), { textStyle: 'font-weight: 400;' })}
1641
1639
  </div>
@@ -1646,7 +1644,7 @@ function detail(gvc, cf, vm, cVm, page_tab) {
1646
1644
  class="d-flex align-items-center form-check-label c_updown_label gap-3"
1647
1645
  >
1648
1646
  <span class="tx_normal" style="min-width: 20px;"
1649
- >${index + 1} .</span
1647
+ >${index + 1}.</span
1650
1648
  >
1651
1649
  ${BgWidget.validImageBox({
1652
1650
  gvc: gvc,
@@ -1801,10 +1801,14 @@ function detail(gvc: GVC, cf: any, vm: any, cVm: any, page_tab: 'page' | 'hidden
1801
1801
  if (subVM.loading) {
1802
1802
  return BgWidget.spinner();
1803
1803
  }
1804
+
1805
+ vm.data.content.relative_data ??= [];
1806
+ const relativeCloneData = structuredClone(vm.data.content.relative_data);
1807
+
1804
1808
  return html`
1805
1809
  <div class="d-flex flex-column p-2" style="gap: 18px;">
1806
1810
  <div
1807
- class="d-flex align-items-center gray-bottom-line-18 "
1811
+ class="d-flex align-items-center gray-bottom-line-18"
1808
1812
  style="gap: 24px; justify-content: space-between;"
1809
1813
  >
1810
1814
  <div class="form-check-label c_updown_label">
@@ -1815,27 +1819,22 @@ function detail(gvc: GVC, cf: any, vm: any, cVm: any, page_tab: 'page' | 'hidden
1815
1819
  gvc.event(() => {
1816
1820
  BgProduct.productsDialog({
1817
1821
  gvc: gvc,
1818
- default: vm.data.content.relative_data.map((dd: any) => {
1819
- return `${dd.product_id}-${dd.variant.spec.join('-')}`;
1820
- }),
1822
+ default: relativeCloneData.map(
1823
+ (dd: any) => `${dd.product_id}-${dd.variant.spec.join('-')}`
1824
+ ),
1821
1825
  with_variants: true,
1822
1826
  filter_visible: page_tab === 'hidden' ? 'false' : 'true',
1823
- callback: async value => {
1824
- vm.data.content.relative_data =
1825
- vm.data.content.relative_data ?? [];
1826
- vm.data.content.relative_data =
1827
- vm.data.content.relative_data.concat(
1828
- value.map((dd: any) => {
1829
- return {
1830
- variant: {
1831
- spec: dd
1832
- .split('-')
1833
- .filter((_: any, index: number) => index > 0),
1834
- },
1835
- product_id: dd.split('-')[0],
1836
- };
1837
- })
1838
- );
1827
+ callback: specArray => {
1828
+ vm.data.content.relative_data = specArray.map((spec: any) => {
1829
+ return {
1830
+ variant: {
1831
+ spec: spec
1832
+ .split('-')
1833
+ .filter((_: any, index: number) => index > 0),
1834
+ },
1835
+ product_id: spec.split('-')[0],
1836
+ };
1837
+ });
1839
1838
 
1840
1839
  subVM.loading = true;
1841
1840
  gvc.notifyDataChange(subVM.id);
@@ -1852,7 +1851,7 @@ function detail(gvc: GVC, cf: any, vm: any, cVm: any, page_tab: 'page' | 'hidden
1852
1851
  class="d-flex align-items-center form-check-label c_updown_label gap-3"
1853
1852
  >
1854
1853
  <span class="tx_normal" style="min-width: 20px;"
1855
- >${index + 1} .</span
1854
+ >${index + 1}.</span
1856
1855
  >
1857
1856
  ${BgWidget.validImageBox({
1858
1857
  gvc: gvc,
@@ -20,7 +20,7 @@ export class BgProduct {
20
20
  return window.parent.glitter.innerDialog((gvc) => {
21
21
  return html `
22
22
  <div class="bg-white shadow rounded-3">
23
- <div class="px-3" style="max-height: calc(100vh - 100px);overflow-y: auto;">
23
+ <div class="px-3" style="max-height: calc(100vh - 100px); overflow-y: auto;">
24
24
  ${StockList.main(gvc, {
25
25
  title: '選擇商品',
26
26
  select_data: add_items,
@@ -82,7 +82,7 @@ export class BgProduct {
82
82
  </div>
83
83
  <div class="c_dialog">
84
84
  <div class="c_dialog_body">
85
- <div class="c_dialog_main p-3" style="gap: 12px; min-height: 480px; max-height: 480px;">
85
+ <div class="c_dialog_main p-3" style="gap: 12px; min-height: 480px; max-height: 500px;">
86
86
  <div class="d-flex mb-2" style="gap: 6px;">
87
87
  ${BgWidget.selectFilter({
88
88
  gvc,
@@ -116,11 +116,8 @@ export class BgProduct {
116
116
  return !obj.filter || obj.filter(dd);
117
117
  })
118
118
  .map((opt, index) => {
119
- const id = gvc.glitter.getUUID();
120
- vm.ids.push({
121
- key: opt.key,
122
- id: id,
123
- });
119
+ const id = `ProductsDialog${index}`;
120
+ vm.ids.push({ key: opt.key, id: id });
124
121
  function call() {
125
122
  if (obj.single) {
126
123
  const tempArray = JSON.parse(JSON.stringify(obj.default));
@@ -147,102 +144,100 @@ export class BgProduct {
147
144
  }
148
145
  gvc.notifyDataChange(id);
149
146
  }
150
- return (gvc.bindView(() => {
151
- return {
152
- bind: id,
153
- view: () => {
154
- return html `<input
155
- class="form-check-input mt-0 ${vm.checkClass} cursor_pointer"
156
- type="checkbox"
157
- id="${opt.key}"
158
- name="radio_${vm.id}_${index}"
159
- onclick="${gvc.event(() => call())}"
160
- ${obj.default.includes(opt.key) ? 'checked' : ''}
161
- />
162
- <div class="d-flex align-items-center justify-content-between w-100">
163
- <div>
164
- <div
165
- class="d-flex align-items-center form-check-label c_updown_label gap-3"
166
- style="max-width: ${document.body.clientWidth > 768 ? 500 : 220}px;"
167
- >
168
- ${BgWidget.validImageBox({
169
- gvc: gvc,
170
- image: opt.image,
171
- width: 40,
172
- class: 'cursor_pointer',
173
- events: [
174
- {
175
- key: 'onclick',
176
- value: gvc.event(() => call()),
177
- },
178
- ],
179
- })}
180
- <div class="d-flex flex-column">
181
- <div
182
- class="tx_normal ${opt.note ? 'mb-1' : ''} d-flex gap-2 cursor_pointer"
183
- style="text-wrap: auto;"
184
- onclick="${gvc.event(() => call())}"
185
- >
186
- ${opt.value}
187
- </div>
188
- ${opt.sub_title
189
- ? html `
190
- <div class="fw-500" style="color: grey; font-size: 13px;">
191
- ${opt.sub_title}
192
- </div>
193
- `
194
- : ''}
147
+ return (gvc.bindView({
148
+ bind: id,
149
+ view: () => {
150
+ return html `<input
151
+ class="form-check-input mt-0 ${vm.checkClass} cursor_pointer"
152
+ type="checkbox"
153
+ id="${opt.key}"
154
+ name="radio_${vm.id}_${index}"
155
+ onclick="${gvc.event(() => call())}"
156
+ ${obj.default.includes(opt.key) ? 'checked' : ''}
157
+ />
158
+ <div class="d-flex align-items-center justify-content-between w-100">
159
+ <div>
160
+ <div
161
+ class="d-flex align-items-center form-check-label c_updown_label gap-3"
162
+ style="max-width: ${document.body.clientWidth > 768 ? 500 : 220}px;"
163
+ >
164
+ ${BgWidget.validImageBox({
165
+ gvc: gvc,
166
+ image: opt.image,
167
+ width: 40,
168
+ class: 'cursor_pointer',
169
+ events: [
170
+ {
171
+ key: 'onclick',
172
+ value: gvc.event(() => call()),
173
+ },
174
+ ],
175
+ })}
176
+ <div class="d-flex flex-column">
177
+ <div
178
+ class="tx_normal ${opt.note ? 'mb-1' : ''} d-flex gap-2 cursor_pointer"
179
+ style="text-wrap: auto;"
180
+ onclick="${gvc.event(() => call())}"
181
+ >
182
+ ${opt.value}
195
183
  </div>
184
+ ${opt.sub_title
185
+ ? html `
186
+ <div class="fw-500" style="color: grey; font-size: 13px;">
187
+ ${opt.sub_title}
188
+ </div>
189
+ `
190
+ : ''}
196
191
  </div>
197
- ${(() => {
198
- var _a, _b;
199
- const isVisibleProduct = opt.content.visible === 'false' && !obj.show_product_type
200
- ? BgWidget.warningInsignia('隱形商品', { size: 'sm' })
201
- : '';
202
- const productCategory = obj.show_product_type
203
- ? BgWidget.infoInsignia(ProductConfig.getName(opt.content), {
204
- size: 'sm',
205
- })
206
- : '';
207
- const collections = (_b = (_a = opt.content) === null || _a === void 0 ? void 0 : _a.collection) === null || _b === void 0 ? void 0 : _b.filter(Boolean).map((col) => BgWidget.normalInsignia(col, { size: 'sm' })).join('');
208
- const renderString = `${isVisibleProduct}${productCategory}${collections}`;
209
- return renderString
210
- ? html `<div class="d-flex flex-wrap gap-1 mt-2">${renderString}</div>`
211
- : '';
212
- })()}
213
192
  </div>
214
- <div class="text-end">
215
- <div class="tx_normal_14">
216
- ${(() => {
217
- const contentMap = {
218
- price: () => {
219
- var _a, _b;
220
- return html `$${parseInt(`${(_a = opt.content[vm.orderString || 'min_price']) !== null && _a !== void 0 ? _a : opt.content.variants[(_b = opt.variant_index) !== null && _b !== void 0 ? _b : 0].sale_price}`, 10).toLocaleString()}`;
221
- },
222
- stock: () => {
223
- var _a, _b;
224
- const variant = opt.content.variants[(_a = opt.variant_index) !== null && _a !== void 0 ? _a : 0];
225
- if (variant.show_understocking === 'false') {
226
- return '不追蹤庫存';
227
- }
228
- const n = Number(opt.content.variants[(_b = opt.variant_index) !== null && _b !== void 0 ? _b : 0].stock);
229
- return html `庫存 ${(isNaN(n) ? 0 : n).toLocaleString()} 個`;
230
- },
231
- };
232
- return (obj.right_element_type
233
- ? contentMap[obj.right_element_type]
234
- : contentMap.price)();
235
- })()}
236
- </div>
237
- ${opt.note ? html ` <div class="tx_gray_12">${opt.note}</div> ` : ''}
193
+ ${(() => {
194
+ var _a, _b;
195
+ const isVisibleProduct = opt.content.visible === 'false' && !obj.show_product_type
196
+ ? BgWidget.warningInsignia('隱形商品', { size: 'sm' })
197
+ : '';
198
+ const productCategory = obj.show_product_type
199
+ ? BgWidget.infoInsignia(ProductConfig.getName(opt.content), {
200
+ size: 'sm',
201
+ })
202
+ : '';
203
+ const collections = (_b = (_a = opt.content) === null || _a === void 0 ? void 0 : _a.collection) === null || _b === void 0 ? void 0 : _b.filter(Boolean).map((col) => BgWidget.normalInsignia(col, { size: 'sm' })).join('');
204
+ const renderString = `${isVisibleProduct}${productCategory}${collections}`;
205
+ return renderString
206
+ ? html `<div class="d-flex flex-wrap gap-1 mt-2">${renderString}</div>`
207
+ : '';
208
+ })()}
209
+ </div>
210
+ <div class="text-end">
211
+ <div class="tx_normal_14">
212
+ ${(() => {
213
+ const contentMap = {
214
+ price: () => {
215
+ var _a, _b;
216
+ return html `$${parseInt(`${(_a = opt.content[vm.orderString || 'min_price']) !== null && _a !== void 0 ? _a : opt.content.variants[(_b = opt.variant_index) !== null && _b !== void 0 ? _b : 0].sale_price}`, 10).toLocaleString()}`;
217
+ },
218
+ stock: () => {
219
+ var _a, _b;
220
+ const variant = opt.content.variants[(_a = opt.variant_index) !== null && _a !== void 0 ? _a : 0];
221
+ if (variant.show_understocking === 'false') {
222
+ return '不追蹤庫存';
223
+ }
224
+ const n = Number(opt.content.variants[(_b = opt.variant_index) !== null && _b !== void 0 ? _b : 0].stock);
225
+ return html `庫存 ${(isNaN(n) ? 0 : n).toLocaleString()} 個`;
226
+ },
227
+ };
228
+ return (obj.right_element_type
229
+ ? contentMap[obj.right_element_type]
230
+ : contentMap.price)();
231
+ })()}
238
232
  </div>
239
- </div>`;
240
- },
241
- divCreate: {
242
- class: 'd-flex align-items-center',
243
- style: `gap: ${document.body.clientWidth > 800 ? 24 : 12}px`,
244
- },
245
- };
233
+ ${opt.note ? html ` <div class="tx_gray_12">${opt.note}</div> ` : ''}
234
+ </div>
235
+ </div>`;
236
+ },
237
+ divCreate: {
238
+ class: 'd-flex align-items-center',
239
+ style: `gap: ${document.body.clientWidth > 800 ? 24 : 12}px`,
240
+ },
246
241
  }) + BgWidget.horizontalLine({ margin: 0.15 }));
247
242
  }))
248
243
  .trim() ||