@optima-chat/commerce-cli 1.7.2 → 1.7.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 (181) hide show
  1. package/.claude/settings.local.json +70 -0
  2. package/README.md +7 -7
  3. package/dist/commands/address/create.d.ts +3 -0
  4. package/dist/commands/address/create.d.ts.map +1 -0
  5. package/dist/commands/address/create.js +122 -0
  6. package/dist/commands/address/create.js.map +1 -0
  7. package/dist/commands/address/delete.d.ts +3 -0
  8. package/dist/commands/address/delete.d.ts.map +1 -0
  9. package/dist/commands/address/delete.js +50 -0
  10. package/dist/commands/address/delete.js.map +1 -0
  11. package/dist/commands/address/get.d.ts +3 -0
  12. package/dist/commands/address/get.d.ts.map +1 -0
  13. package/dist/commands/address/get.js +50 -0
  14. package/dist/commands/address/get.js.map +1 -0
  15. package/dist/commands/address/index.d.ts +3 -0
  16. package/dist/commands/address/index.d.ts.map +1 -0
  17. package/dist/commands/address/index.js +16 -0
  18. package/dist/commands/address/index.js.map +1 -0
  19. package/dist/commands/address/list.d.ts +3 -0
  20. package/dist/commands/address/list.d.ts.map +1 -0
  21. package/dist/commands/address/list.js +34 -0
  22. package/dist/commands/address/list.js.map +1 -0
  23. package/dist/commands/address/set-default.d.ts +3 -0
  24. package/dist/commands/address/set-default.d.ts.map +1 -0
  25. package/dist/commands/address/set-default.js +34 -0
  26. package/dist/commands/address/set-default.js.map +1 -0
  27. package/dist/commands/address/update.d.ts +3 -0
  28. package/dist/commands/address/update.d.ts.map +1 -0
  29. package/dist/commands/address/update.js +120 -0
  30. package/dist/commands/address/update.js.map +1 -0
  31. package/dist/commands/auth/login.js +1 -1
  32. package/dist/commands/auth/login.js.map +1 -1
  33. package/dist/commands/auth/switch.d.ts +3 -0
  34. package/dist/commands/auth/switch.d.ts.map +1 -0
  35. package/dist/commands/auth/switch.js +111 -0
  36. package/dist/commands/auth/switch.js.map +1 -0
  37. package/dist/commands/auth/test-refresh.d.ts +3 -0
  38. package/dist/commands/auth/test-refresh.d.ts.map +1 -0
  39. package/dist/commands/auth/test-refresh.js +43 -0
  40. package/dist/commands/auth/test-refresh.js.map +1 -0
  41. package/dist/commands/auth/whoami.d.ts.map +1 -1
  42. package/dist/commands/auth/whoami.js +5 -5
  43. package/dist/commands/auth/whoami.js.map +1 -1
  44. package/dist/commands/category/create.d.ts +3 -0
  45. package/dist/commands/category/create.d.ts.map +1 -0
  46. package/dist/commands/category/create.js +142 -0
  47. package/dist/commands/category/create.js.map +1 -0
  48. package/dist/commands/category/delete.d.ts +3 -0
  49. package/dist/commands/category/delete.d.ts.map +1 -0
  50. package/dist/commands/category/delete.js +98 -0
  51. package/dist/commands/category/delete.js.map +1 -0
  52. package/dist/commands/category/get.d.ts +3 -0
  53. package/dist/commands/category/get.d.ts.map +1 -0
  54. package/dist/commands/category/get.js +74 -0
  55. package/dist/commands/category/get.js.map +1 -0
  56. package/dist/commands/category/index.d.ts +3 -0
  57. package/dist/commands/category/index.d.ts.map +1 -0
  58. package/dist/commands/category/index.js +14 -0
  59. package/dist/commands/category/index.js.map +1 -0
  60. package/dist/commands/category/list.d.ts +3 -0
  61. package/dist/commands/category/list.d.ts.map +1 -0
  62. package/dist/commands/category/list.js +77 -0
  63. package/dist/commands/category/list.js.map +1 -0
  64. package/dist/commands/category/update.d.ts +3 -0
  65. package/dist/commands/category/update.d.ts.map +1 -0
  66. package/dist/commands/category/update.js +104 -0
  67. package/dist/commands/category/update.js.map +1 -0
  68. package/dist/commands/cleanup.d.ts +3 -0
  69. package/dist/commands/cleanup.d.ts.map +1 -0
  70. package/dist/commands/cleanup.js +100 -0
  71. package/dist/commands/cleanup.js.map +1 -0
  72. package/dist/commands/i18n/category/create.d.ts +3 -0
  73. package/dist/commands/i18n/category/create.d.ts.map +1 -0
  74. package/dist/commands/i18n/category/create.js +113 -0
  75. package/dist/commands/i18n/category/create.js.map +1 -0
  76. package/dist/commands/i18n/category/delete.d.ts +3 -0
  77. package/dist/commands/i18n/category/delete.d.ts.map +1 -0
  78. package/dist/commands/i18n/category/delete.js +63 -0
  79. package/dist/commands/i18n/category/delete.js.map +1 -0
  80. package/dist/commands/i18n/category/get.d.ts +3 -0
  81. package/dist/commands/i18n/category/get.d.ts.map +1 -0
  82. package/dist/commands/i18n/category/get.js +56 -0
  83. package/dist/commands/i18n/category/get.js.map +1 -0
  84. package/dist/commands/i18n/category/index.d.ts +3 -0
  85. package/dist/commands/i18n/category/index.d.ts.map +1 -0
  86. package/dist/commands/i18n/category/index.js +14 -0
  87. package/dist/commands/i18n/category/index.js.map +1 -0
  88. package/dist/commands/i18n/category/list.d.ts +3 -0
  89. package/dist/commands/i18n/category/list.d.ts.map +1 -0
  90. package/dist/commands/i18n/category/list.js +72 -0
  91. package/dist/commands/i18n/category/list.js.map +1 -0
  92. package/dist/commands/i18n/category/update.d.ts +3 -0
  93. package/dist/commands/i18n/category/update.d.ts.map +1 -0
  94. package/dist/commands/i18n/category/update.js +68 -0
  95. package/dist/commands/i18n/category/update.js.map +1 -0
  96. package/dist/commands/i18n/merchant/get.d.ts +3 -0
  97. package/dist/commands/i18n/merchant/get.d.ts.map +1 -0
  98. package/dist/commands/i18n/merchant/get.js +30 -0
  99. package/dist/commands/i18n/merchant/get.js.map +1 -0
  100. package/dist/commands/section/create.d.ts +3 -0
  101. package/dist/commands/section/create.d.ts.map +1 -0
  102. package/dist/commands/section/create.js +218 -0
  103. package/dist/commands/section/create.js.map +1 -0
  104. package/dist/commands/section/delete.d.ts +3 -0
  105. package/dist/commands/section/delete.d.ts.map +1 -0
  106. package/dist/commands/section/delete.js +86 -0
  107. package/dist/commands/section/delete.js.map +1 -0
  108. package/dist/commands/section/hide.d.ts +3 -0
  109. package/dist/commands/section/hide.d.ts.map +1 -0
  110. package/dist/commands/section/hide.js +82 -0
  111. package/dist/commands/section/hide.js.map +1 -0
  112. package/dist/commands/section/index.d.ts +4 -0
  113. package/dist/commands/section/index.d.ts.map +1 -0
  114. package/dist/commands/section/index.js +23 -0
  115. package/dist/commands/section/index.js.map +1 -0
  116. package/dist/commands/section/list.d.ts +3 -0
  117. package/dist/commands/section/list.d.ts.map +1 -0
  118. package/dist/commands/section/list.js +164 -0
  119. package/dist/commands/section/list.js.map +1 -0
  120. package/dist/commands/section/product/create.d.ts +3 -0
  121. package/dist/commands/section/product/create.d.ts.map +1 -0
  122. package/dist/commands/section/product/create.js +208 -0
  123. package/dist/commands/section/product/create.js.map +1 -0
  124. package/dist/commands/section/product/delete.d.ts +3 -0
  125. package/dist/commands/section/product/delete.d.ts.map +1 -0
  126. package/dist/commands/section/product/delete.js +85 -0
  127. package/dist/commands/section/product/delete.js.map +1 -0
  128. package/dist/commands/section/product/hide.d.ts +3 -0
  129. package/dist/commands/section/product/hide.d.ts.map +1 -0
  130. package/dist/commands/section/product/hide.js +78 -0
  131. package/dist/commands/section/product/hide.js.map +1 -0
  132. package/dist/commands/section/product/index.d.ts +4 -0
  133. package/dist/commands/section/product/index.d.ts.map +1 -0
  134. package/dist/commands/section/product/index.js +17 -0
  135. package/dist/commands/section/product/index.js.map +1 -0
  136. package/dist/commands/section/product/list.d.ts +3 -0
  137. package/dist/commands/section/product/list.d.ts.map +1 -0
  138. package/dist/commands/section/product/list.js +157 -0
  139. package/dist/commands/section/product/list.js.map +1 -0
  140. package/dist/commands/section/product/reorder.d.ts +3 -0
  141. package/dist/commands/section/product/reorder.d.ts.map +1 -0
  142. package/dist/commands/section/product/reorder.js +110 -0
  143. package/dist/commands/section/product/reorder.js.map +1 -0
  144. package/dist/commands/section/product/update.d.ts +3 -0
  145. package/dist/commands/section/product/update.d.ts.map +1 -0
  146. package/dist/commands/section/product/update.js +127 -0
  147. package/dist/commands/section/product/update.js.map +1 -0
  148. package/dist/commands/section/reorder.d.ts +3 -0
  149. package/dist/commands/section/reorder.d.ts.map +1 -0
  150. package/dist/commands/section/reorder.js +111 -0
  151. package/dist/commands/section/reorder.js.map +1 -0
  152. package/dist/commands/section/translation/delete.d.ts +3 -0
  153. package/dist/commands/section/translation/delete.d.ts.map +1 -0
  154. package/dist/commands/section/translation/delete.js +97 -0
  155. package/dist/commands/section/translation/delete.js.map +1 -0
  156. package/dist/commands/section/translation/index.d.ts +4 -0
  157. package/dist/commands/section/translation/index.d.ts.map +1 -0
  158. package/dist/commands/section/translation/index.js +11 -0
  159. package/dist/commands/section/translation/index.js.map +1 -0
  160. package/dist/commands/section/translation/list.d.ts +3 -0
  161. package/dist/commands/section/translation/list.d.ts.map +1 -0
  162. package/dist/commands/section/translation/list.js +104 -0
  163. package/dist/commands/section/translation/list.js.map +1 -0
  164. package/dist/commands/section/translation/set.d.ts +3 -0
  165. package/dist/commands/section/translation/set.d.ts.map +1 -0
  166. package/dist/commands/section/translation/set.js +151 -0
  167. package/dist/commands/section/translation/set.js.map +1 -0
  168. package/dist/commands/section/update.d.ts +3 -0
  169. package/dist/commands/section/update.d.ts.map +1 -0
  170. package/dist/commands/section/update.js +137 -0
  171. package/dist/commands/section/update.js.map +1 -0
  172. package/dist/commands/test/health.js +2 -2
  173. package/dist/commands/test/health.js.map +1 -1
  174. package/dist/commands/variant/get.d.ts +3 -0
  175. package/dist/commands/variant/get.d.ts.map +1 -0
  176. package/dist/commands/variant/get.js +41 -0
  177. package/dist/commands/variant/get.js.map +1 -0
  178. package/dist/index.js +0 -0
  179. package/dist/utils/config.js +3 -3
  180. package/dist/utils/config.js.map +1 -1
  181. package/package.json +1 -1
@@ -0,0 +1,86 @@
1
+ import { Command } from 'commander';
2
+ import chalk from 'chalk';
3
+ import inquirer from 'inquirer';
4
+ import { commerceApi } from '../../api/rest/commerce.js';
5
+ import { handleError, createApiError, ValidationError } from '../../utils/error.js';
6
+ import { output } from '../../utils/output.js';
7
+ import { addEnhancedHelp } from '../../utils/helpText.js';
8
+ import { isInteractiveEnvironment } from '../../utils/interactive.js';
9
+ const cmd = new Command('delete')
10
+ .description('Delete a product page section customization (merchant-level)')
11
+ .argument('<handle>', 'Section handle to delete')
12
+ .option('-y, --yes', 'Skip confirmation prompt')
13
+ .action(async (handle, options) => {
14
+ try {
15
+ await deleteSection(handle, options);
16
+ }
17
+ catch (error) {
18
+ handleError(error);
19
+ }
20
+ });
21
+ addEnhancedHelp(cmd, {
22
+ examples: [
23
+ '# Delete with confirmation prompt',
24
+ '$ commerce section delete care',
25
+ '',
26
+ '# Delete without confirmation',
27
+ '$ commerce section delete care --yes',
28
+ ],
29
+ output: {
30
+ example: JSON.stringify({
31
+ success: true,
32
+ message: '区块自定义已删除',
33
+ }, null, 2),
34
+ },
35
+ relatedCommands: [
36
+ { command: 'section list', description: 'View customizations' },
37
+ { command: 'section create', description: 'Create a customization' },
38
+ { command: 'section hide', description: 'Hide a section instead of deleting' },
39
+ ],
40
+ notes: [
41
+ 'This deletes the merchant customization, not the system default',
42
+ 'After deletion, the section will revert to system default (if exists)',
43
+ 'Use --yes to skip confirmation in non-interactive environments',
44
+ ],
45
+ });
46
+ export const deleteSectionCommand = cmd;
47
+ async function deleteSection(handle, options) {
48
+ // 非交互模式下必须指定 --yes
49
+ if (!isInteractiveEnvironment() && !options.yes) {
50
+ throw new ValidationError('非交互模式下需要 --yes 确认删除操作', 'yes');
51
+ }
52
+ // 交互模式下显示确认提示
53
+ if (isInteractiveEnvironment() && !options.yes) {
54
+ const { confirm } = await inquirer.prompt([
55
+ {
56
+ type: 'confirm',
57
+ name: 'confirm',
58
+ message: `确定要删除区块 "${handle}" 的自定义吗?删除后将恢复为系统默认(如有)。`,
59
+ default: false,
60
+ },
61
+ ]);
62
+ if (!confirm) {
63
+ console.log(chalk.yellow('已取消删除操作'));
64
+ return;
65
+ }
66
+ }
67
+ const spinner = output.spinner('正在删除区块自定义...');
68
+ try {
69
+ await commerceApi.productSections.merchant.delete(handle);
70
+ spinner.succeed('区块自定义已删除!');
71
+ if (output.isJson()) {
72
+ output.success({ handle }, '区块自定义已删除');
73
+ }
74
+ else {
75
+ console.log();
76
+ console.log(chalk.green(`✓ 区块 "${handle}" 的自定义已删除`));
77
+ console.log(chalk.gray('提示: 如果是系统默认区块,将恢复为系统默认内容'));
78
+ console.log();
79
+ }
80
+ }
81
+ catch (error) {
82
+ spinner.fail('删除区块失败');
83
+ throw createApiError(error);
84
+ }
85
+ }
86
+ //# sourceMappingURL=delete.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"delete.js","sourceRoot":"","sources":["../../../src/commands/section/delete.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,QAAQ,MAAM,UAAU,CAAC;AAChC,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AACzD,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACpF,OAAO,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAC/C,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,EAAE,wBAAwB,EAAE,MAAM,4BAA4B,CAAC;AAMtE,MAAM,GAAG,GAAG,IAAI,OAAO,CAAC,QAAQ,CAAC;KAC9B,WAAW,CAAC,8DAA8D,CAAC;KAC3E,QAAQ,CAAC,UAAU,EAAE,0BAA0B,CAAC;KAChD,MAAM,CAAC,WAAW,EAAE,0BAA0B,CAAC;KAC/C,MAAM,CAAC,KAAK,EAAE,MAAc,EAAE,OAAsB,EAAE,EAAE;IACvD,IAAI,CAAC;QACH,MAAM,aAAa,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACvC,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,WAAW,CAAC,KAAK,CAAC,CAAC;IACrB,CAAC;AACH,CAAC,CAAC,CAAC;AAEL,eAAe,CAAC,GAAG,EAAE;IACnB,QAAQ,EAAE;QACR,mCAAmC;QACnC,gCAAgC;QAChC,EAAE;QACF,+BAA+B;QAC/B,sCAAsC;KACvC;IACD,MAAM,EAAE;QACN,OAAO,EAAE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AC,MAAM,CAAC,MAAM,CAAC,CAAC;QAC1D,OAAO,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC;QAE7B,IAAI,MAAM,CAAC,MAAM,EAAE,EAAE,CAAC;YACpB,MAAM,CAAC,OAAO,CAAC,EAAE,MAAM,EAAE,EAAE,UAAU,CAAC,CAAC;QACzC,CAAC;aAAM,CAAC;YACN,OAAO,CAAC,GAAG,EAAE,CAAC;YACd,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,SAAS,MAAM,WAAW,CAAC,CAAC,CAAC;YACrD,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,0BAA0B,CAAC,CAAC,CAAC;YACpD,OAAO,CAAC,GAAG,EAAE,CAAC;QAChB,CAAC;IACH,CAAC;IAAC,OAAO,KAAU,EAAE,CAAC;QACpB,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QACvB,MAAM,cAAc,CAAC,KAAK,CAAC,CAAC;IAC9B,CAAC;AACH,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { Command } from 'commander';
2
+ export declare const hideSectionCommand: Command;
3
+ //# sourceMappingURL=hide.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hide.d.ts","sourceRoot":"","sources":["../../../src/commands/section/hide.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AA6DpC,eAAO,MAAM,kBAAkB,SAAM,CAAC"}
@@ -0,0 +1,82 @@
1
+ import { Command } from 'commander';
2
+ import chalk from 'chalk';
3
+ import { commerceApi } from '../../api/rest/commerce.js';
4
+ import { handleError, createApiError } from '../../utils/error.js';
5
+ import { output } from '../../utils/output.js';
6
+ import { addEnhancedHelp } from '../../utils/helpText.js';
7
+ const cmd = new Command('hide')
8
+ .description('Hide a product page section (merchant-level)')
9
+ .argument('<handle>', 'Section handle to hide')
10
+ .action(async (handle) => {
11
+ try {
12
+ await hideSection(handle);
13
+ }
14
+ catch (error) {
15
+ handleError(error);
16
+ }
17
+ });
18
+ addEnhancedHelp(cmd, {
19
+ examples: [
20
+ '# Hide the eco-friendly section for all products',
21
+ '$ commerce section hide eco-friendly',
22
+ '',
23
+ '# Hide the return policy section',
24
+ '$ commerce section hide return',
25
+ ],
26
+ output: {
27
+ example: JSON.stringify({
28
+ success: true,
29
+ data: {
30
+ id: 'customization-uuid',
31
+ merchant_id: 'merchant-uuid',
32
+ handle: 'eco-friendly',
33
+ operation_type: 'hidden',
34
+ type: 'collapsible',
35
+ position: 7,
36
+ content: '',
37
+ tab_group: null,
38
+ created_at: '2025-11-27T00:00:00Z',
39
+ updated_at: '2025-11-27T00:00:00Z',
40
+ },
41
+ message: '区块已隐藏',
42
+ }, null, 2),
43
+ },
44
+ relatedCommands: [
45
+ { command: 'section list --resolved', description: 'View all sections (shows hidden status)' },
46
+ { command: 'section delete', description: 'Delete customization to unhide' },
47
+ { command: 'section product hide', description: 'Hide for specific product only' },
48
+ ],
49
+ notes: [
50
+ 'This is a shortcut for: section create --handle <handle> --operation-type hidden',
51
+ 'Hidden sections will not appear on any product page',
52
+ 'To unhide, delete the customization with: section delete <handle>',
53
+ 'System default sections: highlights, details, guarantee, care, shipping-policies, return, eco-friendly',
54
+ ],
55
+ });
56
+ export const hideSectionCommand = cmd;
57
+ async function hideSection(handle) {
58
+ const spinner = output.spinner('正在隐藏区块...');
59
+ try {
60
+ const result = await commerceApi.productSections.merchant.hide(handle);
61
+ spinner.succeed('区块已隐藏!');
62
+ if (output.isJson()) {
63
+ output.success(result, '区块已隐藏');
64
+ }
65
+ else {
66
+ console.log();
67
+ console.log(chalk.green(`✓ 区块 "${handle}" 已隐藏`));
68
+ console.log();
69
+ console.log(chalk.gray('ID: ') + chalk.cyan(result.id));
70
+ console.log(chalk.gray('Handle: ') + chalk.white(result.handle));
71
+ console.log(chalk.gray('操作类型: ') + chalk.white(result.operation_type));
72
+ console.log();
73
+ console.log(chalk.gray('提示: 要取消隐藏,使用 commerce section delete ' + handle));
74
+ console.log();
75
+ }
76
+ }
77
+ catch (error) {
78
+ spinner.fail('隐藏区块失败');
79
+ throw createApiError(error);
80
+ }
81
+ }
82
+ //# sourceMappingURL=hide.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hide.js","sourceRoot":"","sources":["../../../src/commands/section/hide.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AACzD,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACnE,OAAO,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAC/C,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAE1D,MAAM,GAAG,GAAG,IAAI,OAAO,CAAC,MAAM,CAAC;KAC5B,WAAW,CAAC,8CAA8C,CAAC;KAC3D,QAAQ,CAAC,UAAU,EAAE,wBAAwB,CAAC;KAC9C,MAAM,CAAC,KAAK,EAAE,MAAc,EAAE,EAAE;IAC/B,IAAI,CAAC;QACH,MAAM,WAAW,CAAC,MAAM,CAAC,CAAC;IAC5B,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,WAAW,CAAC,KAAK,CAAC,CAAC;IACrB,CAAC;AACH,CAAC,CAAC,CAAC;AAEL,eAAe,CAAC,GAAG,EAAE;IACnB,QAAQ,EAAE;QACR,kDAAkD;QAClD,sCAAsC;QACtC,EAAE;QACF,kCAAkC;QAClC,gCAAgC;KACjC;IACD,MAAM,EAAE;QACN,OAAO,EAAE,IAAI,CAAC,SAAS,CACrB;YACE,OAAO,EAAE,IAAI;YACb,IAAI,EAAE;gBACJ,EAAE,EAAE,oBAAoB;gBACxB,WAAW,EAAE,eAAe;gBAC5B,MAAM,EAAE,cAAc;gBACtB,cAAc,EAAE,QAAQ;gBACxB,IAAI,EAAE,aAA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,EAAE,CAAC,CAAC,CAAC;YACxD,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,UAAU,CAAC,GAAG,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC;YACjE,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,cAAc,CAAC,CAAC,CAAC;YACvE,OAAO,CAAC,GAAG,EAAE,CAAC;YACd,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,uCAAuC,GAAG,MAAM,CAAC,CAAC,CAAC;YAC1E,OAAO,CAAC,GAAG,EAAE,CAAC;QAChB,CAAC;IACH,CAAC;IAAC,OAAO,KAAU,EAAE,CAAC;QACpB,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QACvB,MAAM,cAAc,CAAC,KAAK,CAAC,CAAC;IAC9B,CAAC;AACH,CAAC"}
@@ -0,0 +1,4 @@
1
+ import { Command } from 'commander';
2
+ declare const sectionCommand: Command;
3
+ export { sectionCommand };
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/commands/section/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAUpC,QAAA,MAAM,cAAc,SACoF,CAAC;AAczG,OAAO,EAAE,cAAc,EAAE,CAAC"}
@@ -0,0 +1,23 @@
1
+ import { Command } from 'commander';
2
+ import { listSectionsCommand } from './list.js';
3
+ import { createSectionCommand } from './create.js';
4
+ import { updateSectionCommand } from './update.js';
5
+ import { deleteSectionCommand } from './delete.js';
6
+ import { hideSectionCommand } from './hide.js';
7
+ import { reorderSectionsCommand } from './reorder.js';
8
+ import { productCommand } from './product/index.js';
9
+ import { translationCommand } from './translation/index.js';
10
+ const sectionCommand = new Command('section')
11
+ .description('Product page section management with 3-layer inheritance (System → Merchant → Product)');
12
+ // 商户级命令
13
+ sectionCommand.addCommand(listSectionsCommand);
14
+ sectionCommand.addCommand(createSectionCommand);
15
+ sectionCommand.addCommand(updateSectionCommand);
16
+ sectionCommand.addCommand(deleteSectionCommand);
17
+ sectionCommand.addCommand(hideSectionCommand);
18
+ sectionCommand.addCommand(reorderSectionsCommand);
19
+ // 子命令组
20
+ sectionCommand.addCommand(productCommand);
21
+ sectionCommand.addCommand(translationCommand);
22
+ export { sectionCommand };
23
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/commands/section/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,mBAAmB,EAAE,MAAM,WAAW,CAAC;AAChD,OAAO,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AACnD,OAAO,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AACnD,OAAO,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AACnD,OAAO,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAC;AAC/C,OAAO,EAAE,sBAAsB,EAAE,MAAM,cAAc,CAAC;AACtD,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAE5D,MAAM,cAAc,GAAG,IAAI,OAAO,CAAC,SAAS,CAAC;KAC1C,WAAW,CAAC,wFAAwF,CAAC,CAAC;AAEzG,QAAQ;AACR,cAAc,CAAC,UAAU,CAAC,mBAAmB,CAAC,CAAC;AAC/C,cAAc,CAAC,UAAU,CAAC,oBAAoB,CAAC,CAAC;AAChD,cAAc,CAAC,UAAU,CAAC,oBAAoB,CAAC,CAAC;AAChD,cAAc,CAAC,UAAU,CAAC,oBAAoB,CAAC,CAAC;AAChD,cAAc,CAAC,UAAU,CAAC,kBAAkB,CAAC,CAAC;AAC9C,cAAc,CAAC,UAAU,CAAC,sBAAsB,CAAC,CAAC;AAElD,OAAO;AACP,cAAc,CAAC,UAAU,CAAC,cAAc,CAAC,CAAC;AAC1C,cAAc,CAAC,UAAU,CAAC,kBAAkB,CAAC,CAAC;AAE9C,OAAO,EAAE,cAAc,EAAE,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { Command } from 'commander';
2
+ export declare const listSectionsCommand: Command;
3
+ //# sourceMappingURL=list.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"list.d.ts","sourceRoot":"","sources":["../../../src/commands/section/list.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AA8EpC,eAAO,MAAM,mBAAmB,SAAM,CAAC"}
@@ -0,0 +1,164 @@
1
+ import { Command } from 'commander';
2
+ import chalk from 'chalk';
3
+ import { commerceApi } from '../../api/rest/commerce.js';
4
+ import { handleError, createApiError } from '../../utils/error.js';
5
+ import { output } from '../../utils/output.js';
6
+ import { addEnhancedHelp } from '../../utils/helpText.js';
7
+ const cmd = new Command('list')
8
+ .description('List product page sections (merchant-level)')
9
+ .option('--resolved', 'Show merged view with System + Merchant layers (recommended)')
10
+ .action(async (options) => {
11
+ try {
12
+ await listSections(options);
13
+ }
14
+ catch (error) {
15
+ handleError(error);
16
+ }
17
+ });
18
+ addEnhancedHelp(cmd, {
19
+ examples: [
20
+ '# List merchant customizations only (usually empty for new merchants)',
21
+ '$ commerce section list',
22
+ '',
23
+ '# List merged view with all sections (recommended)',
24
+ '$ commerce section list --resolved',
25
+ ],
26
+ output: {
27
+ example: JSON.stringify({
28
+ success: true,
29
+ data: {
30
+ sections: [
31
+ {
32
+ handle: 'highlights',
33
+ source: 'system',
34
+ type: 'static',
35
+ position: 1,
36
+ is_hidden: false,
37
+ content: '',
38
+ translations: {
39
+ 'en-US': { title: 'Highlights', content: '' },
40
+ 'zh-CN': { title: '产品亮点', content: '' },
41
+ },
42
+ },
43
+ {
44
+ handle: 'care',
45
+ source: 'merchant',
46
+ type: 'collapsible',
47
+ position: 4,
48
+ is_hidden: false,
49
+ content: 'Custom care instructions...',
50
+ translations: {},
51
+ },
52
+ ],
53
+ available_languages: ['en-US', 'zh-CN', 'ja-JP'],
54
+ },
55
+ }, null, 2),
56
+ },
57
+ relatedCommands: [
58
+ { command: 'section create', description: 'Create/override a section' },
59
+ { command: 'section product list', description: 'List product-level sections' },
60
+ { command: 'section hide', description: 'Hide a section' },
61
+ ],
62
+ notes: [
63
+ 'Without --resolved: shows only merchant customizations (may be empty)',
64
+ 'With --resolved: shows System + Merchant merged view (recommended for daily use)',
65
+ 'source field indicates origin: system | merchant',
66
+ 'is_hidden indicates if section is hidden from product pages',
67
+ ],
68
+ });
69
+ export const listSectionsCommand = cmd;
70
+ async function listSections(options) {
71
+ const spinner = output.spinner('正在获取商品页区块配置...');
72
+ try {
73
+ if (options.resolved) {
74
+ // 获取合并后的视图
75
+ const result = await commerceApi.productSections.merchant.listResolved();
76
+ spinner.succeed('区块配置获取成功');
77
+ if (!result.sections || result.sections.length === 0) {
78
+ if (output.isJson()) {
79
+ output.success({ sections: [], available_languages: result.available_languages || [] }, '暂无区块配置');
80
+ }
81
+ else {
82
+ console.log(chalk.yellow('\n暂无区块配置\n'));
83
+ }
84
+ return;
85
+ }
86
+ if (output.isJson()) {
87
+ output.success(result);
88
+ }
89
+ else {
90
+ console.log();
91
+ console.log(chalk.bold('商品页区块配置(合并视图):\n'));
92
+ result.sections.forEach((section, index) => {
93
+ const sourceColor = section.source === 'system' ? chalk.gray : chalk.cyan;
94
+ const hiddenBadge = section.is_hidden ? chalk.red(' [已隐藏]') : '';
95
+ console.log(chalk.white(`${index + 1}. ${section.handle}`) + hiddenBadge);
96
+ console.log(chalk.gray(` 来源: `) + sourceColor(section.source));
97
+ console.log(chalk.gray(` 类型: ${section.type}`));
98
+ console.log(chalk.gray(` 位置: ${section.position}`));
99
+ if (section.tab_group) {
100
+ console.log(chalk.gray(` Tab分组: ${section.tab_group}`));
101
+ }
102
+ if (section.content) {
103
+ const preview = section.content.length > 50 ? section.content.substring(0, 50) + '...' : section.content;
104
+ console.log(chalk.gray(` 内容: ${preview}`));
105
+ }
106
+ const langCount = Object.keys(section.translations || {}).length;
107
+ if (langCount > 0) {
108
+ console.log(chalk.gray(` 翻译: ${langCount} 种语言`));
109
+ }
110
+ console.log();
111
+ });
112
+ console.log(chalk.gray(`共 ${result.sections.length} 个区块`));
113
+ if (result.available_languages && result.available_languages.length > 0) {
114
+ console.log(chalk.gray(`支持语言: ${result.available_languages.join(', ')}`));
115
+ }
116
+ console.log();
117
+ }
118
+ }
119
+ else {
120
+ // 仅获取商户自定义
121
+ const sections = await commerceApi.productSections.merchant.list();
122
+ spinner.succeed('商户自定义获取成功');
123
+ if (!sections || sections.length === 0) {
124
+ if (output.isJson()) {
125
+ output.success({ sections: [] }, '暂无商户自定义(提示: 使用 --resolved 查看完整视图)');
126
+ }
127
+ else {
128
+ console.log(chalk.yellow('\n暂无商户自定义'));
129
+ console.log(chalk.gray('提示: 使用 --resolved 查看 System + Merchant 合并后的完整视图\n'));
130
+ }
131
+ return;
132
+ }
133
+ if (output.isJson()) {
134
+ output.success({ sections });
135
+ }
136
+ else {
137
+ console.log();
138
+ console.log(chalk.bold('商户自定义区块:\n'));
139
+ sections.forEach((section, index) => {
140
+ console.log(chalk.cyan(`${index + 1}. ${section.handle}`));
141
+ console.log(chalk.gray(` ID: ${section.id}`));
142
+ console.log(chalk.gray(` 操作类型: ${section.operation_type}`));
143
+ console.log(chalk.gray(` 区块类型: ${section.type}`));
144
+ console.log(chalk.gray(` 位置: ${section.position}`));
145
+ if (section.tab_group) {
146
+ console.log(chalk.gray(` Tab分组: ${section.tab_group}`));
147
+ }
148
+ if (section.content) {
149
+ const preview = section.content.length > 50 ? section.content.substring(0, 50) + '...' : section.content;
150
+ console.log(chalk.gray(` 内容: ${preview}`));
151
+ }
152
+ console.log();
153
+ });
154
+ console.log(chalk.gray(`共 ${sections.length} 个自定义`));
155
+ console.log(chalk.gray('提示: 使用 --resolved 查看完整的合并视图\n'));
156
+ }
157
+ }
158
+ }
159
+ catch (error) {
160
+ spinner.fail('获取区块配置失败');
161
+ throw createApiError(error);
162
+ }
163
+ }
164
+ //# sourceMappingURL=list.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"list.js","sourceRoot":"","sources":["../../../src/commands/section/list.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AACzD,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACnE,OAAO,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAC/C,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAM1D,MAAM,GAAG,GAAG,IAAI,OAAO,CAAC,MAAM,CAAC;KAC5B,WAAW,CAAC,6CAA6C,CAAC;KAC1D,MAAM,CAAC,YAAY,EAAE,8DAA8D,CAAC;KACpF,MAAM,CAAC,KAAK,EAAE,OAAoB,EAAE,EAAE;IACrC,IAAI,CAAC;QACH,MAAM,YAAY,CAAC,OAAO,CAAC,CAAC;IAC9B,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,WAAW,CAAC,KAAK,CAAC,CAAC;IACrB,CAAC;AACH,CAAC,CAAC,CAAC;AAEL,eAAe,CAAC,GAAG,EAAE;IACnB,QAAQ,EAAE;QACR,uEAAuE;QACvE,yBAAyB;QACzB,EAAE;QACF,oDAAoD;QACpD,oCAAoC;KACrC;IACD,MAAM,EAAE;QACN,OAAO,EAAE,IAAI,CAAC,SAAS,CACrB;YACE,OAAO,EAAE,IAAI;YACb,IAAI,EAAE;gBACJ,QAAQ,EAAE;oBACR;wBACE,MAAM,EAAE,YAAY;wBACpB,MAAM,EA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AG,CAAC,KAAK,CAAC,IAAI,CAAC,+BAA+B,CAAC,CAAC,CAAC;YAC3D,CAAC;QACH,CAAC;IACH,CAAC;IAAC,OAAO,KAAU,EAAE,CAAC;QACpB,OAAO,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QACzB,MAAM,cAAc,CAAC,KAAK,CAAC,CAAC;IAC9B,CAAC;AACH,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { Command } from 'commander';
2
+ export declare const createProductSectionCommand: Command;
3
+ //# sourceMappingURL=create.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create.d.ts","sourceRoot":"","sources":["../../../../src/commands/section/product/create.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAkFpC,eAAO,MAAM,2BAA2B,SAAM,CAAC"}
@@ -0,0 +1,208 @@
1
+ import { Command } from 'commander';
2
+ import chalk from 'chalk';
3
+ import inquirer from 'inquirer';
4
+ import { commerceApi } from '../../../api/rest/commerce.js';
5
+ import { handleError, createApiError, ValidationError } from '../../../utils/error.js';
6
+ import { output } from '../../../utils/output.js';
7
+ import { addEnhancedHelp } from '../../../utils/helpText.js';
8
+ import { isInteractiveEnvironment } from '../../../utils/interactive.js';
9
+ const cmd = new Command('create')
10
+ .description('Create or override a product page section (product-level)')
11
+ .argument('<product-id>', 'Product ID')
12
+ .option('--handle <handle>', 'Section handle/identifier (required)')
13
+ .option('--operation-type <type>', 'Operation type: override | new | hidden (required)')
14
+ .option('--type <type>', 'Section type: collapsible | static (required for override/new)')
15
+ .option('--position <n>', 'Display position (required for override/new)')
16
+ .option('--content <text>', 'Section content in Markdown (required for override/new)')
17
+ .option('--tab-group <group>', 'Tab group name (optional)')
18
+ .option('--inherit-translations', 'Inherit translations from parent layer')
19
+ .action(async (productId, options) => {
20
+ try {
21
+ await createProductSection(productId, options);
22
+ }
23
+ catch (error) {
24
+ handleError(error);
25
+ }
26
+ });
27
+ addEnhancedHelp(cmd, {
28
+ examples: [
29
+ '# Override care section for a specific product',
30
+ '$ commerce section product create prod-123 --handle care --operation-type override \\',
31
+ ' --type collapsible --position 4 --content "This silk product requires dry cleaning."',
32
+ '',
33
+ '# Create a product-specific section',
34
+ '$ commerce section product create prod-123 --handle ingredients --operation-type new \\',
35
+ ' --type collapsible --position 5 --content "100% organic cotton"',
36
+ '',
37
+ '# Hide a section for this product only',
38
+ '$ commerce section product create prod-123 --handle eco-friendly --operation-type hidden',
39
+ ],
40
+ output: {
41
+ example: JSON.stringify({
42
+ success: true,
43
+ data: {
44
+ id: 'override-uuid',
45
+ product_id: 'prod-123',
46
+ handle: 'care',
47
+ operation_type: 'override',
48
+ type: 'collapsible',
49
+ position: 4,
50
+ content: 'This silk product requires dry cleaning.',
51
+ tab_group: null,
52
+ },
53
+ message: '商品区块创建成功',
54
+ }, null, 2),
55
+ },
56
+ relatedCommands: [
57
+ { command: 'section product list --resolved', description: 'View product sections' },
58
+ { command: 'section create', description: 'Create merchant-level section (affects all products)' },
59
+ { command: 'section product hide', description: 'Quick hide a section' },
60
+ ],
61
+ notes: [
62
+ 'Product-level overrides have highest priority (Product > Merchant > System)',
63
+ 'Use this for product-specific customizations only',
64
+ 'For changes affecting all products, use merchant-level: section create',
65
+ ],
66
+ });
67
+ export const createProductSectionCommand = cmd;
68
+ async function createProductSection(productId, options) {
69
+ let { handle, operationType, type, position, content, tabGroup, inheritTranslations } = options;
70
+ // 非交互模式下验证必需参数
71
+ if (!isInteractiveEnvironment()) {
72
+ if (!handle || handle.trim().length === 0) {
73
+ throw new ValidationError('缺少必需参数: --handle (区块标识符)', 'handle');
74
+ }
75
+ if (!operationType || operationType.trim().length === 0) {
76
+ throw new ValidationError('缺少必需参数: --operation-type (操作类型: override | new | hidden)', 'operation_type');
77
+ }
78
+ if (operationType !== 'hidden') {
79
+ if (!type || type.trim().length === 0) {
80
+ throw new ValidationError('缺少必需参数: --type (区块类型: collapsible | static)', 'type');
81
+ }
82
+ if (!position) {
83
+ throw new ValidationError('缺少必需参数: --position (显示位置)', 'position');
84
+ }
85
+ if (!content || content.trim().length === 0) {
86
+ throw new ValidationError('缺少必需参数: --content (区块内容)', 'content');
87
+ }
88
+ }
89
+ }
90
+ else {
91
+ // 交互模式
92
+ const answers = await inquirer.prompt([
93
+ {
94
+ type: 'input',
95
+ name: 'handle',
96
+ message: '区块标识符 (handle):',
97
+ when: !handle,
98
+ validate: (input) => (input.trim().length > 0 ? true : '标识符不能为空'),
99
+ },
100
+ {
101
+ type: 'list',
102
+ name: 'operationType',
103
+ message: '操作类型:',
104
+ choices: [
105
+ { name: 'override - 覆盖上层配置', value: 'override' },
106
+ { name: 'new - 创建商品专属区块', value: 'new' },
107
+ { name: 'hidden - 隐藏区块', value: 'hidden' },
108
+ ],
109
+ when: !operationType,
110
+ },
111
+ ]);
112
+ handle = handle || answers.handle;
113
+ operationType = operationType || answers.operationType;
114
+ if (operationType !== 'hidden') {
115
+ const moreAnswers = await inquirer.prompt([
116
+ {
117
+ type: 'list',
118
+ name: 'type',
119
+ message: '区块类型:',
120
+ choices: [
121
+ { name: 'collapsible - 可折叠', value: 'collapsible' },
122
+ { name: 'static - 静态', value: 'static' },
123
+ ],
124
+ when: !type,
125
+ },
126
+ {
127
+ type: 'number',
128
+ name: 'position',
129
+ message: '显示位置 (1-10):',
130
+ when: !position,
131
+ validate: (input) => (input > 0 ? true : '位置必须大于0'),
132
+ },
133
+ {
134
+ type: 'editor',
135
+ name: 'content',
136
+ message: '区块内容 (Markdown):',
137
+ when: !content,
138
+ },
139
+ ]);
140
+ type = type || moreAnswers.type;
141
+ position = position || moreAnswers.position?.toString();
142
+ content = content || moreAnswers.content;
143
+ }
144
+ }
145
+ // 验证 operationType
146
+ const validOperationTypes = ['override', 'new', 'hidden'];
147
+ if (!validOperationTypes.includes(operationType)) {
148
+ throw new ValidationError(`无效的操作类型: ${operationType}。有效值: ${validOperationTypes.join(', ')}`, 'operation_type');
149
+ }
150
+ // 验证 type
151
+ if (operationType !== 'hidden') {
152
+ const validTypes = ['collapsible', 'static'];
153
+ if (!validTypes.includes(type)) {
154
+ throw new ValidationError(`无效的区块类型: ${type}。有效值: ${validTypes.join(', ')}`, 'type');
155
+ }
156
+ }
157
+ const spinner = output.spinner('正在创建商品区块...');
158
+ try {
159
+ const data = {
160
+ handle: handle,
161
+ operation_type: operationType,
162
+ };
163
+ if (operationType !== 'hidden') {
164
+ data.type = type;
165
+ data.position = parseInt(position, 10);
166
+ data.content = content;
167
+ }
168
+ if (tabGroup !== undefined) {
169
+ data.tab_group = tabGroup || null;
170
+ }
171
+ if (inheritTranslations !== undefined) {
172
+ data.inherit_translations = inheritTranslations;
173
+ }
174
+ const result = await commerceApi.productSections.product.create(productId, data);
175
+ spinner.succeed('商品区块创建成功!');
176
+ if (output.isJson()) {
177
+ output.success(result, '商品区块创建成功');
178
+ }
179
+ else {
180
+ console.log();
181
+ console.log(chalk.green('✓ 商品区块创建成功!'));
182
+ console.log();
183
+ console.log(chalk.gray('ID: ') + chalk.cyan(result.id));
184
+ console.log(chalk.gray('商品ID: ') + chalk.white(result.product_id));
185
+ console.log(chalk.gray('Handle: ') + chalk.white(result.handle));
186
+ console.log(chalk.gray('操作类型: ') + chalk.white(result.operation_type));
187
+ if (result.type) {
188
+ console.log(chalk.gray('区块类型: ') + chalk.white(result.type));
189
+ }
190
+ if (result.position !== undefined) {
191
+ console.log(chalk.gray('位置: ') + chalk.white(result.position.toString()));
192
+ }
193
+ if (result.tab_group) {
194
+ console.log(chalk.gray('Tab分组: ') + chalk.white(result.tab_group));
195
+ }
196
+ if (result.content) {
197
+ const preview = result.content.length > 100 ? result.content.substring(0, 100) + '...' : result.content;
198
+ console.log(chalk.gray('内容: ') + chalk.white(preview));
199
+ }
200
+ console.log();
201
+ }
202
+ }
203
+ catch (error) {
204
+ spinner.fail('创建商品区块失败');
205
+ throw createApiError(error);
206
+ }
207
+ }
208
+ //# sourceMappingURL=create.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create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