@optima-chat/commerce-cli 1.7.6 → 1.8.0

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 (158) hide show
  1. package/dist/api/rest/base.d.ts.map +1 -1
  2. package/dist/api/rest/base.js +1 -0
  3. package/dist/api/rest/base.js.map +1 -1
  4. package/dist/api/rest/commerce.d.ts +176 -22
  5. package/dist/api/rest/commerce.d.ts.map +1 -1
  6. package/dist/api/rest/commerce.js +133 -23
  7. package/dist/api/rest/commerce.js.map +1 -1
  8. package/dist/commands/collection/create.d.ts.map +1 -1
  9. package/dist/commands/collection/create.js +39 -1
  10. package/dist/commands/collection/create.js.map +1 -1
  11. package/dist/commands/collection/update.d.ts.map +1 -1
  12. package/dist/commands/collection/update.js +47 -6
  13. package/dist/commands/collection/update.js.map +1 -1
  14. package/dist/commands/easyship/couriers.d.ts +3 -0
  15. package/dist/commands/easyship/couriers.d.ts.map +1 -0
  16. package/dist/commands/easyship/couriers.js +103 -0
  17. package/dist/commands/easyship/couriers.js.map +1 -0
  18. package/dist/commands/easyship/create-shipment.d.ts +3 -0
  19. package/dist/commands/easyship/create-shipment.d.ts.map +1 -0
  20. package/dist/commands/easyship/create-shipment.js +102 -0
  21. package/dist/commands/easyship/create-shipment.js.map +1 -0
  22. package/dist/commands/easyship/get-origin.d.ts +3 -0
  23. package/dist/commands/easyship/get-origin.d.ts.map +1 -0
  24. package/dist/commands/easyship/get-origin.js +111 -0
  25. package/dist/commands/easyship/get-origin.js.map +1 -0
  26. package/dist/commands/easyship/index.d.ts +3 -0
  27. package/dist/commands/easyship/index.d.ts.map +1 -0
  28. package/dist/commands/easyship/index.js +18 -0
  29. package/dist/commands/easyship/index.js.map +1 -0
  30. package/dist/commands/easyship/track.d.ts +3 -0
  31. package/dist/commands/easyship/track.d.ts.map +1 -0
  32. package/dist/commands/easyship/track.js +141 -0
  33. package/dist/commands/easyship/track.js.map +1 -0
  34. package/dist/commands/easyship/update-origin.d.ts +3 -0
  35. package/dist/commands/easyship/update-origin.d.ts.map +1 -0
  36. package/dist/commands/easyship/update-origin.js +228 -0
  37. package/dist/commands/easyship/update-origin.js.map +1 -0
  38. package/dist/commands/easyship/validate-address.d.ts +3 -0
  39. package/dist/commands/easyship/validate-address.d.ts.map +1 -0
  40. package/dist/commands/easyship/validate-address.js +119 -0
  41. package/dist/commands/easyship/validate-address.js.map +1 -0
  42. package/dist/commands/easyship/validate-origin.d.ts +3 -0
  43. package/dist/commands/easyship/validate-origin.d.ts.map +1 -0
  44. package/dist/commands/easyship/validate-origin.js +119 -0
  45. package/dist/commands/easyship/validate-origin.js.map +1 -0
  46. package/dist/commands/homepage/delete-config.d.ts +3 -0
  47. package/dist/commands/homepage/delete-config.d.ts.map +1 -0
  48. package/dist/commands/homepage/delete-config.js +94 -0
  49. package/dist/commands/homepage/delete-config.js.map +1 -0
  50. package/dist/commands/homepage/get-config.d.ts +3 -0
  51. package/dist/commands/homepage/get-config.d.ts.map +1 -0
  52. package/dist/commands/homepage/get-config.js +95 -0
  53. package/dist/commands/homepage/get-config.js.map +1 -0
  54. package/dist/commands/homepage/index.d.ts.map +1 -1
  55. package/dist/commands/homepage/index.js +9 -0
  56. package/dist/commands/homepage/index.js.map +1 -1
  57. package/dist/commands/homepage/list-templates.d.ts +3 -0
  58. package/dist/commands/homepage/list-templates.d.ts.map +1 -0
  59. package/dist/commands/homepage/list-templates.js +113 -0
  60. package/dist/commands/homepage/list-templates.js.map +1 -0
  61. package/dist/commands/homepage/switch-template.d.ts +3 -0
  62. package/dist/commands/homepage/switch-template.d.ts.map +1 -0
  63. package/dist/commands/homepage/switch-template.js +129 -0
  64. package/dist/commands/homepage/switch-template.js.map +1 -0
  65. package/dist/commands/order/index.d.ts.map +1 -1
  66. package/dist/commands/order/index.js +5 -1
  67. package/dist/commands/order/index.js.map +1 -1
  68. package/dist/commands/order/list.d.ts.map +1 -1
  69. package/dist/commands/order/list.js +30 -3
  70. package/dist/commands/order/list.js.map +1 -1
  71. package/dist/commands/order/ship.d.ts.map +1 -1
  72. package/dist/commands/order/ship.js +29 -1
  73. package/dist/commands/order/ship.js.map +1 -1
  74. package/dist/commands/order/shipping-history.d.ts +3 -0
  75. package/dist/commands/order/shipping-history.d.ts.map +1 -0
  76. package/dist/commands/order/shipping-history.js +120 -0
  77. package/dist/commands/order/shipping-history.js.map +1 -0
  78. package/dist/commands/order/update-shipping-status.d.ts +3 -0
  79. package/dist/commands/order/update-shipping-status.d.ts.map +1 -0
  80. package/dist/commands/order/update-shipping-status.js +164 -0
  81. package/dist/commands/order/update-shipping-status.js.map +1 -0
  82. package/dist/commands/product/create.d.ts.map +1 -1
  83. package/dist/commands/product/create.js +53 -1
  84. package/dist/commands/product/create.js.map +1 -1
  85. package/dist/commands/product/index.d.ts.map +1 -1
  86. package/dist/commands/product/index.js +4 -0
  87. package/dist/commands/product/index.js.map +1 -1
  88. package/dist/commands/product/list.d.ts.map +1 -1
  89. package/dist/commands/product/list.js +30 -4
  90. package/dist/commands/product/list.js.map +1 -1
  91. package/dist/commands/product/remove-images.d.ts +3 -0
  92. package/dist/commands/product/remove-images.d.ts.map +1 -0
  93. package/dist/commands/product/remove-images.js +109 -0
  94. package/dist/commands/product/remove-images.js.map +1 -0
  95. package/dist/commands/product/reorder-images.d.ts +3 -0
  96. package/dist/commands/product/reorder-images.d.ts.map +1 -0
  97. package/dist/commands/product/reorder-images.js +113 -0
  98. package/dist/commands/product/reorder-images.js.map +1 -0
  99. package/dist/commands/product/update.d.ts.map +1 -1
  100. package/dist/commands/product/update.js +57 -1
  101. package/dist/commands/product/update.js.map +1 -1
  102. package/dist/commands/shipping/countries.d.ts +3 -0
  103. package/dist/commands/shipping/countries.d.ts.map +1 -0
  104. package/dist/commands/shipping/countries.js +87 -0
  105. package/dist/commands/shipping/countries.js.map +1 -0
  106. package/dist/commands/shipping/get-mode.d.ts +3 -0
  107. package/dist/commands/shipping/get-mode.d.ts.map +1 -0
  108. package/dist/commands/shipping/get-mode.js +84 -0
  109. package/dist/commands/shipping/get-mode.js.map +1 -0
  110. package/dist/commands/shipping/index.d.ts.map +1 -1
  111. package/dist/commands/shipping/index.js +7 -5
  112. package/dist/commands/shipping/index.js.map +1 -1
  113. package/dist/commands/shipping/update-mode.d.ts +3 -0
  114. package/dist/commands/shipping/update-mode.d.ts.map +1 -0
  115. package/dist/commands/shipping/update-mode.js +117 -0
  116. package/dist/commands/shipping/update-mode.js.map +1 -0
  117. package/dist/commands/shipping-zone/create.d.ts.map +1 -1
  118. package/dist/commands/shipping-zone/create.js +53 -9
  119. package/dist/commands/shipping-zone/create.js.map +1 -1
  120. package/dist/commands/shipping-zone/delete-rate.d.ts +3 -0
  121. package/dist/commands/shipping-zone/delete-rate.d.ts.map +1 -0
  122. package/dist/commands/shipping-zone/delete-rate.js +103 -0
  123. package/dist/commands/shipping-zone/delete-rate.js.map +1 -0
  124. package/dist/commands/shipping-zone/get.d.ts +3 -0
  125. package/dist/commands/shipping-zone/get.d.ts.map +1 -0
  126. package/dist/commands/shipping-zone/get.js +121 -0
  127. package/dist/commands/shipping-zone/get.js.map +1 -0
  128. package/dist/commands/shipping-zone/index.d.ts.map +1 -1
  129. package/dist/commands/shipping-zone/index.js +9 -1
  130. package/dist/commands/shipping-zone/index.js.map +1 -1
  131. package/dist/commands/shipping-zone/update-rate.d.ts +3 -0
  132. package/dist/commands/shipping-zone/update-rate.d.ts.map +1 -0
  133. package/dist/commands/shipping-zone/update-rate.js +149 -0
  134. package/dist/commands/shipping-zone/update-rate.js.map +1 -0
  135. package/dist/commands/shipping-zone/update.d.ts +3 -0
  136. package/dist/commands/shipping-zone/update.d.ts.map +1 -0
  137. package/dist/commands/shipping-zone/update.js +117 -0
  138. package/dist/commands/shipping-zone/update.js.map +1 -0
  139. package/dist/commands/variant/index.d.ts.map +1 -1
  140. package/dist/commands/variant/index.js +2 -0
  141. package/dist/commands/variant/index.js.map +1 -1
  142. package/dist/commands/variant/search.d.ts +3 -0
  143. package/dist/commands/variant/search.d.ts.map +1 -0
  144. package/dist/commands/variant/search.js +107 -0
  145. package/dist/commands/variant/search.js.map +1 -0
  146. package/dist/index.js +2 -0
  147. package/dist/index.js.map +1 -1
  148. package/dist/utils/config.js +4 -4
  149. package/dist/utils/config.js.map +1 -1
  150. package/package.json +1 -1
  151. package/dist/commands/shipping/history.d.ts +0 -3
  152. package/dist/commands/shipping/history.d.ts.map +0 -1
  153. package/dist/commands/shipping/history.js +0 -111
  154. package/dist/commands/shipping/history.js.map +0 -1
  155. package/dist/commands/shipping/update-status.d.ts +0 -3
  156. package/dist/commands/shipping/update-status.d.ts.map +0 -1
  157. package/dist/commands/shipping/update-status.js +0 -138
  158. package/dist/commands/shipping/update-status.js.map +0 -1
@@ -0,0 +1,95 @@
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('get-config')
8
+ .description('Get current active homepage configuration')
9
+ .action(async () => {
10
+ try {
11
+ await getConfig();
12
+ }
13
+ catch (error) {
14
+ handleError(error);
15
+ }
16
+ });
17
+ addEnhancedHelp(cmd, {
18
+ examples: [
19
+ '# Get current homepage configuration',
20
+ '$ commerce homepage get-config',
21
+ '',
22
+ '# Get configuration with JSON output',
23
+ '$ commerce homepage get-config --json',
24
+ ],
25
+ output: {
26
+ example: JSON.stringify({
27
+ success: true,
28
+ data: {
29
+ id: 'config-123',
30
+ version: 1,
31
+ sections_count: 4,
32
+ sections: [
33
+ { id: 'section-1', type: 'banner', position: 0 },
34
+ { id: 'section-2', type: 'collections', position: 1 },
35
+ ],
36
+ created_at: '2024-01-15T10:00:00Z',
37
+ updated_at: '2024-01-20T15:30:00Z',
38
+ },
39
+ }, null, 2),
40
+ },
41
+ relatedCommands: [
42
+ { command: 'homepage list', description: 'List all sections' },
43
+ { command: 'homepage switch-template', description: 'Switch to a template' },
44
+ { command: 'homepage list-templates', description: 'List available templates' },
45
+ ],
46
+ notes: [
47
+ 'Returns the complete homepage configuration with all sections',
48
+ 'Includes section count, version, and timestamps',
49
+ 'Use homepage list for detailed section info',
50
+ ],
51
+ });
52
+ export const getConfigCommand = cmd;
53
+ async function getConfig() {
54
+ const spinner = output.spinner('Getting homepage configuration...');
55
+ try {
56
+ const config = await commerceApi.homepage.getConfig();
57
+ spinner.succeed('Homepage configuration retrieved');
58
+ if (output.isJson()) {
59
+ output.success(config, 'Homepage configuration retrieved');
60
+ }
61
+ else {
62
+ console.log();
63
+ console.log(chalk.bold('Homepage Configuration:'));
64
+ console.log();
65
+ console.log(chalk.gray('Config ID: ') + chalk.white(config.id || 'N/A'));
66
+ console.log(chalk.gray('Version: ') + chalk.white(config.version || 'N/A'));
67
+ console.log(chalk.gray('Sections Count: ') + chalk.cyan(config.sections_count || config.sections?.length || 0));
68
+ console.log(chalk.gray('Created: ') + chalk.white(config.created_at || 'N/A'));
69
+ console.log(chalk.gray('Updated: ') + chalk.white(config.updated_at || 'N/A'));
70
+ console.log();
71
+ if (config.sections && config.sections.length > 0) {
72
+ console.log(chalk.bold('Sections:'));
73
+ console.log();
74
+ config.sections.forEach((section, index) => {
75
+ const typeColors = {
76
+ banner: chalk.magenta(section.type),
77
+ collections: chalk.blue(section.type),
78
+ collection_products: chalk.green(section.type),
79
+ featured: chalk.yellow(section.type),
80
+ };
81
+ console.log(chalk.gray(` ${index + 1}. `) +
82
+ (typeColors[section.type] || chalk.white(section.type)) +
83
+ chalk.gray(' - ') +
84
+ chalk.white(section.title || section.id));
85
+ });
86
+ console.log();
87
+ }
88
+ }
89
+ }
90
+ catch (error) {
91
+ spinner.fail('Failed to get homepage configuration');
92
+ throw createApiError(error);
93
+ }
94
+ }
95
+ //# sourceMappingURL=get-config.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-config.js","sourceRoot":"","sources":["../../../src/commands/homepage/get-config.ts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AAC,KAAK,CAAC;wBACjB,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,IAAI,OAAO,CAAC,EAAE,CAAC,CAC3C,CAAC;gBACJ,CAAC,CAAC,CAAC;gBACH,OAAO,CAAC,GAAG,EAAE,CAAC;YAChB,CAAC;QACH,CAAC;IACH,CAAC;IAAC,OAAO,KAAU,EAAE,CAAC;QACpB,OAAO,CAAC,IAAI,CAAC,sCAAsC,CAAC,CAAC;QACrD,MAAM,cAAc,CAAC,KAAK,CAAC,CAAC;IAC9B,CAAC;AACH,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/commands/homepage/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAYpC,QAAA,MAAM,QAAQ,SAAgF,CAAC;AAgB/F,eAAe,QAAQ,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/commands/homepage/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAgBpC,QAAA,MAAM,QAAQ,SAAgF,CAAC;AAsB/F,eAAe,QAAQ,CAAC"}
@@ -9,7 +9,16 @@ import { updateImagesCommand } from './update-images.js';
9
9
  import { updateCollectionsCommand } from './update-collections.js';
10
10
  import { updateTargetCommand } from './update-target.js';
11
11
  import { patchSettingsCommand } from './patch-settings.js';
12
+ import { getConfigCommand } from './get-config.js';
13
+ import { switchTemplateCommand } from './switch-template.js';
14
+ import { listTemplatesCommand } from './list-templates.js';
15
+ import { deleteConfigCommand } from './delete-config.js';
12
16
  const homepage = new Command('homepage').description('Manage homepage configuration sections');
17
+ // 配置和模板命令
18
+ homepage.addCommand(getConfigCommand);
19
+ homepage.addCommand(listTemplatesCommand);
20
+ homepage.addCommand(switchTemplateCommand);
21
+ homepage.addCommand(deleteConfigCommand);
13
22
  // 基础 CRUD 命令
14
23
  homepage.addCommand(listSectionsCommand);
15
24
  homepage.addCommand(createSectionCommand);
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/commands/homepage/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,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAC7C,OAAO,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AACnD,OAAO,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AACnD,OAAO,EAAE,sBAAsB,EAAE,MAAM,cAAc,CAAC;AACtD,OAAO,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AACzD,OAAO,EAAE,wBAAwB,EAAE,MAAM,yBAAyB,CAAC;AACnE,OAAO,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AACzD,OAAO,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAE3D,MAAM,QAAQ,GAAG,IAAI,OAAO,CAAC,UAAU,CAAC,CAAC,WAAW,CAAC,wCAAwC,CAAC,CAAC;AAE/F,aAAa;AACb,QAAQ,CAAC,UAAU,CAAC,mBAAmB,CAAC,CAAC;AACzC,QAAQ,CAAC,UAAU,CAAC,oBAAoB,CAAC,CAAC;AAC1C,QAAQ,CAAC,UAAU,CAAC,iBAAiB,CAAC,CAAC;AACvC,QAAQ,CAAC,UAAU,CAAC,oBAAoB,CAAC,CAAC;AAC1C,QAAQ,CAAC,UAAU,CAAC,oBAAoB,CAAC,CAAC;AAC1C,QAAQ,CAAC,UAAU,CAAC,sBAAsB,CAAC,CAAC;AAE5C,iBAAiB;AACjB,QAAQ,CAAC,UAAU,CAAC,mBAAmB,CAAC,CAAC;AACzC,QAAQ,CAAC,UAAU,CAAC,wBAAwB,CAAC,CAAC;AAC9C,Q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C,CAAC;AAC3C,QAAQ,CAAC,UAAU,CAAC,mBAAmB,CAAC,CAAC;AAEzC,aAAa;AACb,QAAQ,CAAC,UAAU,CAAC,mBAAmB,CAAC,CAAC;AACzC,QAAQ,CAAC,UAAU,CAAC,oBAAoB,CAAC,CAAC;AAC1C,QAAQ,CAAC,UAAU,CAAC,iBAAiB,CAAC,CAAC;AACvC,QAAQ,CAAC,UAAU,CAAC,oBAAoB,CAAC,CAAC;AAC1C,QAAQ,CAAC,UAAU,CAAC,oBAAoB,CAAC,CAAC;AAC1C,QAAQ,CAAC,UAAU,CAAC,sBAAsB,CAAC,CAAC;AAE5C,iBAAiB;AACjB,QAAQ,CAAC,UAAU,CAAC,mBAAmB,CAAC,CAAC;AACzC,QAAQ,CAAC,UAAU,CAAC,wBAAwB,CAAC,CAAC;AAC9C,QAAQ,CAAC,UAAU,CAAC,mBAAmB,CAAC,CAAC;AACzC,QAAQ,CAAC,UAAU,CAAC,oBAAoB,CAAC,CAAC;AAE1C,eAAe,QAAQ,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { Command } from 'commander';
2
+ export declare const listTemplatesCommand: Command;
3
+ //# sourceMappingURL=list-templates.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"list-templates.d.ts","sourceRoot":"","sources":["../../../src/commands/homepage/list-templates.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAyEpC,eAAO,MAAM,oBAAoB,SAAM,CAAC"}
@@ -0,0 +1,113 @@
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-templates')
8
+ .description('List all available homepage templates')
9
+ .action(async () => {
10
+ try {
11
+ await listTemplates();
12
+ }
13
+ catch (error) {
14
+ handleError(error);
15
+ }
16
+ });
17
+ addEnhancedHelp(cmd, {
18
+ examples: [
19
+ '# List available templates',
20
+ '$ commerce homepage list-templates',
21
+ '',
22
+ '# List templates with JSON output',
23
+ '$ commerce homepage list-templates --json',
24
+ ],
25
+ output: {
26
+ example: JSON.stringify({
27
+ success: true,
28
+ data: {
29
+ templates: [
30
+ {
31
+ key: 'minimal',
32
+ name: 'Minimal',
33
+ description: 'A clean, minimal layout with 4 sections',
34
+ sections: [
35
+ { type: 'banner', title: 'Hero Banner' },
36
+ { type: 'collections', title: 'Featured Collections' },
37
+ { type: 'collection_products', title: 'New Arrivals' },
38
+ { type: 'featured', title: 'Featured Product' },
39
+ ],
40
+ },
41
+ {
42
+ key: 'standard',
43
+ name: 'Standard',
44
+ description: 'Full-featured layout with 6 sections',
45
+ sections: [
46
+ { type: 'banner', title: 'Hero Banner' },
47
+ { type: 'collections', title: 'Shop by Category' },
48
+ { type: 'collection_products', title: 'Best Sellers' },
49
+ { type: 'featured', title: 'Featured Product' },
50
+ { type: 'collection_products', title: 'New Arrivals' },
51
+ { type: 'featured', title: 'Sale Highlight' },
52
+ ],
53
+ },
54
+ ],
55
+ },
56
+ }, null, 2),
57
+ },
58
+ relatedCommands: [
59
+ { command: 'homepage switch-template', description: 'Switch to a template' },
60
+ { command: 'homepage get-config', description: 'View current configuration' },
61
+ ],
62
+ notes: [
63
+ 'This is a public endpoint (no authentication required)',
64
+ 'Templates provide quick homepage setup with predefined sections',
65
+ 'Use switch-template to apply a template',
66
+ ],
67
+ });
68
+ export const listTemplatesCommand = cmd;
69
+ async function listTemplates() {
70
+ const spinner = output.spinner('Getting available templates...');
71
+ try {
72
+ const result = await commerceApi.homepage.listTemplates();
73
+ spinner.succeed('Templates retrieved');
74
+ const templates = result.templates || [];
75
+ if (templates.length === 0) {
76
+ if (output.isJson()) {
77
+ output.success({ templates: [] }, 'No templates available');
78
+ }
79
+ else {
80
+ console.log(chalk.yellow('\nNo templates available\n'));
81
+ }
82
+ return;
83
+ }
84
+ if (output.isJson()) {
85
+ output.success(result, `Retrieved ${templates.length} templates`);
86
+ }
87
+ else {
88
+ console.log();
89
+ console.log(chalk.bold('Available Templates:'));
90
+ console.log();
91
+ templates.forEach((template, index) => {
92
+ console.log(chalk.cyan(`${index + 1}. ${template.name}`) + chalk.gray(` (key: ${template.key})`));
93
+ if (template.description) {
94
+ console.log(chalk.gray(` ${template.description}`));
95
+ }
96
+ // API 返回 sections_count 而不是 sections 数组
97
+ const sectionsCount = template.sections_count || template.sections?.length || 0;
98
+ console.log(chalk.gray(` Sections: ${sectionsCount}`));
99
+ if (template.recommended_for && template.recommended_for.length > 0) {
100
+ console.log(chalk.gray(` Recommended for: ${template.recommended_for.join(', ')}`));
101
+ }
102
+ console.log();
103
+ });
104
+ console.log(chalk.gray(`Use: commerce homepage switch-template --template-key <key>`));
105
+ console.log();
106
+ }
107
+ }
108
+ catch (error) {
109
+ spinner.fail('Failed to get templates');
110
+ throw createApiError(error);
111
+ }
112
+ }
113
+ //# sourceMappingURL=list-templates.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"list-templates.js","sourceRoot":"","sources":["../../../src/commands/homepage/list-templates.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,gBAAgB,CAAC;KACtC,WAAW,CAAC,uCAAuC,CAAC;KACpD,MAAM,CAAC,KAAK,IAAI,EAAE;IACjB,IAAI,CAAC;QACH,MAAM,aAAa,EAAE,CAAC;IACxB,CAAC;IAAC,OAAO,K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@ -0,0 +1,3 @@
1
+ import { Command } from 'commander';
2
+ export declare const switchTemplateCommand: Command;
3
+ //# sourceMappingURL=switch-template.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"switch-template.d.ts","sourceRoot":"","sources":["../../../src/commands/homepage/switch-template.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAsEpC,eAAO,MAAM,qBAAqB,SAAM,CAAC"}
@@ -0,0 +1,129 @@
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('switch-template')
10
+ .description('Switch to a predefined homepage template')
11
+ .option('--template-key <key>', 'Template key (minimal|standard)')
12
+ .option('--yes', 'Skip confirmation prompt')
13
+ .action(async (options) => {
14
+ try {
15
+ await switchTemplate(options);
16
+ }
17
+ catch (error) {
18
+ handleError(error);
19
+ }
20
+ });
21
+ addEnhancedHelp(cmd, {
22
+ examples: [
23
+ '# Switch to minimal template',
24
+ '$ commerce homepage switch-template --template-key minimal',
25
+ '',
26
+ '# Switch to standard template without confirmation',
27
+ '$ commerce homepage switch-template --template-key standard --yes',
28
+ '',
29
+ '# Interactive mode (prompts for template)',
30
+ '$ commerce homepage switch-template',
31
+ ],
32
+ output: {
33
+ example: JSON.stringify({
34
+ success: true,
35
+ data: {
36
+ id: 'config-123',
37
+ version: 2,
38
+ sections_count: 4,
39
+ sections: [
40
+ { id: 'section-1', type: 'banner', position: 0 },
41
+ { id: 'section-2', type: 'collections', position: 1 },
42
+ { id: 'section-3', type: 'collection_products', position: 2 },
43
+ { id: 'section-4', type: 'featured', position: 3 },
44
+ ],
45
+ },
46
+ message: "Switched to 'minimal' template",
47
+ }, null, 2),
48
+ },
49
+ relatedCommands: [
50
+ { command: 'homepage list-templates', description: 'List available templates' },
51
+ { command: 'homepage get-config', description: 'View current configuration' },
52
+ { command: 'homepage list', description: 'List all sections' },
53
+ ],
54
+ notes: [
55
+ 'Available templates: minimal (4 sections), standard (6 sections)',
56
+ 'Switching templates creates new sections and deactivates old ones',
57
+ 'Use --yes to skip confirmation in scripts/CI',
58
+ ],
59
+ });
60
+ export const switchTemplateCommand = cmd;
61
+ async function switchTemplate(options) {
62
+ let templateKey = options.templateKey;
63
+ // Validate template key
64
+ if (templateKey && !['minimal', 'standard'].includes(templateKey)) {
65
+ throw new ValidationError("Template key must be 'minimal' or 'standard'", 'template-key');
66
+ }
67
+ // Interactive mode: prompt for template if not provided
68
+ if (!templateKey && isInteractiveEnvironment()) {
69
+ const answers = await inquirer.prompt([
70
+ {
71
+ type: 'list',
72
+ name: 'templateKey',
73
+ message: 'Select template:',
74
+ choices: [
75
+ { name: 'minimal - 4 sections (banner, collections, products, featured)', value: 'minimal' },
76
+ { name: 'standard - 6 sections (full layout)', value: 'standard' },
77
+ ],
78
+ },
79
+ ]);
80
+ templateKey = answers.templateKey;
81
+ }
82
+ if (!templateKey) {
83
+ throw new ValidationError('Template key is required (--template-key minimal|standard)', 'template-key');
84
+ }
85
+ console.log(chalk.cyan(`\nSwitching to '${templateKey}' template\n`));
86
+ // Confirmation prompt
87
+ if (!options.yes && isInteractiveEnvironment()) {
88
+ const { confirm } = await inquirer.prompt([
89
+ {
90
+ type: 'confirm',
91
+ name: 'confirm',
92
+ message: 'This will replace your current homepage sections. Continue?',
93
+ default: false,
94
+ },
95
+ ]);
96
+ if (!confirm) {
97
+ console.log(chalk.yellow('Operation cancelled'));
98
+ return;
99
+ }
100
+ }
101
+ const spinner = output.spinner(`Switching to '${templateKey}' template...`);
102
+ try {
103
+ const config = await commerceApi.homepage.switchTemplate(templateKey);
104
+ spinner.succeed(`Switched to '${templateKey}' template`);
105
+ if (output.isJson()) {
106
+ output.success(config, `Switched to '${templateKey}' template`);
107
+ }
108
+ else {
109
+ console.log();
110
+ console.log(chalk.green(`✓ Successfully switched to '${templateKey}' template`));
111
+ console.log();
112
+ console.log(chalk.gray('Config ID: ') + chalk.white(config.id || 'N/A'));
113
+ console.log(chalk.gray('Sections Count: ') + chalk.cyan(config.sections_count || config.sections?.length || 0));
114
+ console.log();
115
+ if (config.sections && config.sections.length > 0) {
116
+ console.log(chalk.bold('New Sections:'));
117
+ config.sections.forEach((section, index) => {
118
+ console.log(chalk.gray(` ${index + 1}. `) + chalk.white(section.type) + chalk.gray(` - ${section.title || section.id}`));
119
+ });
120
+ console.log();
121
+ }
122
+ }
123
+ }
124
+ catch (error) {
125
+ spinner.fail('Failed to switch template');
126
+ throw createApiError(error);
127
+ }
128
+ }
129
+ //# sourceMappingURL=switch-template.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"switch-template.js","sourceRoot":"","sources":["../../../src/commands/homepage/switch-template.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;AAOtE,MAAM,GAAG,GAAG,IAAI,OAAO,CAAC,iBAAiB,CAAC;KACvC,WAAW,CAAC,0CAA0C,CAAC;KACvD,MAAM,CAAC,sBAAsB,EAAE,iCAAiC,CAAC;KACjE,MAAM,CAAC,OAAO,EAAE,0BAA0B,CAAC;KAC3C,MAAM,CAAC,KAAK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AAC;gBAClD,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC,CAAC;gBACzC,MAAM,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,OAAO,EAAE,KAAK,EAAE,EAAE;oBACzC,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,KAAK,GAAG,CAAC,IAAI,CAAC,GAAG,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,GAAG,KAAK,CAAC,IAAI,CAAC,MAAM,OAAO,CAAC,KAAK,IAAI,OAAO,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC;gBAC5H,CAAC,CAAC,CAAC;gBACH,OAAO,CAAC,GAAG,EAAE,CAAC;YAChB,CAAC;QACH,CAAC;IACH,CAAC;IAAC,OAAO,KAAU,EAAE,CAAC;QACpB,OAAO,CAAC,IAAI,CAAC,2BAA2B,CAAC,CAAC;QAC1C,MAAM,cAAc,CAAC,KAAK,CAAC,CAAC;IAC9B,CAAC;AACH,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/commands/order/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAQpC,eAAO,MAAM,YAAY,SAOU,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/commands/order/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAUpC,eAAO,MAAM,YAAY,SASY,CAAC"}
@@ -5,12 +5,16 @@ import { shipOrderCommand } from './ship.js';
5
5
  import { completeOrderCommand } from './complete.js';
6
6
  import { cancelOrderCommand } from './cancel.js';
7
7
  import { markDeliveredCommand } from './mark-delivered.js';
8
+ import { updateShippingStatusCommand } from './update-shipping-status.js';
9
+ import { shippingHistoryCommand } from './shipping-history.js';
8
10
  export const orderCommand = new Command('order')
9
11
  .description('订单管理')
10
12
  .addCommand(listOrdersCommand)
11
13
  .addCommand(getOrderCommand)
12
14
  .addCommand(shipOrderCommand)
15
+ .addCommand(updateShippingStatusCommand)
16
+ .addCommand(markDeliveredCommand)
13
17
  .addCommand(completeOrderCommand)
14
18
  .addCommand(cancelOrderCommand)
15
- .addCommand(markDeliveredCommand);
19
+ .addCommand(shippingHistoryCommand);
16
20
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/commands/order/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAC9C,OAAO,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAC3C,OAAO,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAC7C,OAAO,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;AACrD,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AACjD,OAAO,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAE3D,MAAM,CAAC,MAAM,YAAY,GAAG,IAAI,OAAO,CAAC,OAAO,CAAC;KAC7C,WAAW,CAAC,MAAM,CAAC;KACnB,UAAU,CAAC,iBAAiB,CAAC;KAC7B,UAAU,CAAC,eAAe,CAAC;KAC3B,UAAU,CAAC,gBAAgB,CAAC;KAC5B,UAAU,CAAC,oBAAoB,CAAC;KAChC,UAAU,CAAC,kBAAkB,CAAC;KAC9B,UAAU,CAAC,oBAAoB,CAAC,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/commands/order/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAC9C,OAAO,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAC3C,OAAO,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAC7C,OAAO,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;AACrD,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AACjD,OAAO,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAC3D,OAAO,EAAE,2BAA2B,EAAE,MAAM,6BAA6B,CAAC;AAC1E,OAAO,EAAE,sBAAsB,EAAE,MAAM,uBAAuB,CAAC;AAE/D,MAAM,CAAC,MAAM,YAAY,GAAG,IAAI,OAAO,CAAC,OAAO,CAAC;KAC7C,WAAW,CAAC,MAAM,CAAC;KACnB,UAAU,CAAC,iBAAiB,CAAC;KAC7B,UAAU,CAAC,eAAe,CAAC;KAC3B,UAAU,CAAC,gBAAgB,CAAC;KAC5B,UAAU,CAAC,2BAA2B,CAAC;KACvC,UAAU,CAAC,oBAAoB,CAAC;KAChC,UAAU,CAAC,oBAAoB,CAAC;KAChC,UAAU,CAAC,kBAAkB,CAAC;KAC9B,UAAU,CAAC,sBAAsB,CAAC,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"list.d.ts","sourceRoot":"","sources":["../../../src/commands/order/list.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAmFpC,eAAO,MAAM,iBAAiB,SAAM,CAAC"}
1
+ {"version":3,"file":"list.d.ts","sourceRoot":"","sources":["../../../src/commands/order/list.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAU,MAAM,WAAW,CAAC;AA8G5C,eAAO,MAAM,iBAAiB,SAAM,CAAC"}
@@ -1,4 +1,4 @@
1
- import { Command } from 'commander';
1
+ import { Command, Option } from 'commander';
2
2
  import chalk from 'chalk';
3
3
  import { commerceApi } from '../../api/rest/commerce.js';
4
4
  import { handleError, createApiError } from '../../utils/error.js';
@@ -9,9 +9,15 @@ const cmd = new Command('list')
9
9
  .description('List orders with pagination and filtering options')
10
10
  .option('-l, --limit <number>', 'Orders per page (default: 20)', '20')
11
11
  .option('-o, --offset <number>', 'Offset for pagination (default: 0)', '0')
12
- .option('-s, --status <string>', 'Filter by status: pending|paid|processing|shipped|delivered|completed|cancelled|refunded')
12
+ .addOption(new Option('-s, --status <status>', 'Filter by order status')
13
+ .choices(['pending', 'paid', 'processing', 'shipped', 'delivered', 'completed', 'cancelled', 'refunded']))
13
14
  .option('--start-date <date>', 'Start date (YYYY-MM-DD)')
14
15
  .option('--end-date <date>', 'End date (YYYY-MM-DD)')
16
+ .option('--search <keyword>', 'Search by order number, customer email, name, or shipping contact')
17
+ .addOption(new Option('--sort-by <field>', 'Sort by field')
18
+ .choices(['created_at', 'amount_total', 'order_number', 'status', 'updated_at', 'customer_email', 'customer_name']))
19
+ .addOption(new Option('--sort-order <order>', 'Sort order (default: desc)')
20
+ .choices(['asc', 'desc']))
15
21
  .action(async (options) => {
16
22
  try {
17
23
  await listOrders(options);
@@ -28,11 +34,21 @@ addEnhancedHelp(cmd, {
28
34
  '# Filter by status to find orders to ship',
29
35
  '$ commerce order list --status paid',
30
36
  '',
37
+ '# Search by order number or customer email',
38
+ '$ commerce order list --search "ORD-123"',
39
+ '$ commerce order list --search "customer@example.com"',
40
+ '',
41
+ '# Sort by amount (highest first)',
42
+ '$ commerce order list --sort-by amount_total --sort-order desc',
43
+ '',
44
+ '# Sort by date (oldest first)',
45
+ '$ commerce order list --sort-by created_at --sort-order asc',
46
+ '',
31
47
  '# List recent orders with date range',
32
48
  '$ commerce order list --start-date 2024-01-01 --end-date 2024-01-31',
33
49
  '',
34
50
  '# Combine filters',
35
- '$ commerce order list --status shipped --limit 50 --json',
51
+ '$ commerce order list --status shipped --sort-by created_at --limit 50 --json',
36
52
  ],
37
53
  output: {
38
54
  example: JSON.stringify({
@@ -65,6 +81,8 @@ addEnhancedHelp(cmd, {
65
81
  'Status workflow: pending → paid → processing → shipped → delivered → completed',
66
82
  'Use --status paid to find orders ready to ship',
67
83
  'Date range is inclusive (includes both start and end dates)',
84
+ 'Search looks in order number, customer email, customer name, and shipping contact',
85
+ 'Sort fields: created_at, amount_total, order_number, status, updated_at, customer_email, customer_name',
68
86
  ],
69
87
  });
70
88
  export const listOrdersCommand = cmd;
@@ -84,6 +102,15 @@ async function listOrders(options) {
84
102
  if (options.endDate) {
85
103
  params.end_date = options.endDate;
86
104
  }
105
+ if (options.search) {
106
+ params.search = options.search;
107
+ }
108
+ if (options.sortBy) {
109
+ params.sort_by = options.sortBy;
110
+ }
111
+ if (options.sortOrder) {
112
+ params.sort_order = options.sortOrder;
113
+ }
87
114
  const result = await commerceApi.orders.list(params);
88
115
  spinner.succeed('订单列表获取成功');
89
116
  if (!result.orders || result.orders.length === 0) {
@@ -1 +1 @@
1
- {"version":3,"file":"list.js","sourceRoot":"","sources":["../../../src/commands/order/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,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAC/C,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAU1D,MAAM,GAAG,GAAG,IAAI,OAAO,CAAC,MAAM,CAAC;KAC5B,WAAW,CAAC,mDAAmD,CAAC;KAChE,MAAM,CAAC,sBAAsB,EAAE,+BAA+B,EAAE,IAAI,CAAC;KACrE,MAAM,CAAC,uBAAuB,EAAE,oCAAoC,EAAE,GAAG,CAAC;KAC1E,MAAM,CAAC,uBAAuB,EAAE,0FAA0F,CAAC;KAC3H,MAAM,CAAC,qBAAqB,EAAE,yBAAyB,CAAC;KACxD,MAAM,CAAC,mBAAmB,EAAE,uBAAuB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AE,MAAM,WAAW,CAAC;AAkEpC,eAAO,MAAM,gBAAgB,SAAM,CAAC"}
1
+ {"version":3,"file":"ship.d.ts","sourceRoot":"","sources":["../../../src/commands/order/ship.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAwFpC,eAAO,MAAM,gBAAgB,SAAM,CAAC"}
@@ -12,6 +12,8 @@ const cmd = new Command('ship')
12
12
  .option('--id <uuid>', 'Order ID (required)')
13
13
  .option('-t, --tracking <string>', 'Tracking number (optional)')
14
14
  .option('-c, --carrier <string>', 'Carrier name (optional)')
15
+ .option('--tracking-url <url>', 'Full tracking URL (optional)')
16
+ .option('--note <string>', 'Shipping note (optional)')
15
17
  .action(async (options) => {
16
18
  try {
17
19
  await shipOrder(options);
@@ -28,6 +30,20 @@ addEnhancedHelp(cmd, {
28
30
  ' --tracking DHL1234567890 \\',
29
31
  ' --carrier DHL',
30
32
  '',
33
+ '# Ship with full tracking URL',
34
+ '$ commerce order ship \\',
35
+ ' --id abc-123-def \\',
36
+ ' --tracking DHL1234567890 \\',
37
+ ' --carrier DHL \\',
38
+ ' --tracking-url "https://www.dhl.com/track?num=DHL1234567890"',
39
+ '',
40
+ '# Ship with a note',
41
+ '$ commerce order ship \\',
42
+ ' --id abc-123-def \\',
43
+ ' --tracking UPS123 \\',
44
+ ' --carrier UPS \\',
45
+ ' --note "Shipped via express delivery"',
46
+ '',
31
47
  '# Find orders to ship, then ship',
32
48
  '$ commerce order list --status paid',
33
49
  '$ commerce order ship --id <order_id> --tracking UPS123 --carrier UPS',
@@ -40,6 +56,8 @@ addEnhancedHelp(cmd, {
40
56
  status: 'shipped',
41
57
  tracking_number: 'DHL1234567890',
42
58
  carrier: 'DHL',
59
+ tracking_url: 'https://www.dhl.com/track?num=DHL1234567890',
60
+ note: 'Shipped via express delivery',
43
61
  shipped_at: 'timestamp'
44
62
  },
45
63
  message: 'Order shipped successfully'
@@ -54,6 +72,8 @@ addEnhancedHelp(cmd, {
54
72
  'Order must be in \'paid\' or \'processing\' status to ship',
55
73
  'Tracking number will be sent to customer via email',
56
74
  'Common carriers: DHL, UPS, FedEx, USPS, China Post',
75
+ 'Use --tracking-url to provide a direct link for customers to track their package',
76
+ 'Use --note to add internal shipping notes (not sent to customer)',
57
77
  ]
58
78
  });
59
79
  export const shipOrderCommand = cmd;
@@ -93,6 +113,12 @@ async function shipOrder(options) {
93
113
  if (carrier) {
94
114
  shipData.carrier = carrier;
95
115
  }
116
+ if (options.trackingUrl) {
117
+ shipData.tracking_url = options.trackingUrl;
118
+ }
119
+ if (options.note) {
120
+ shipData.note = options.note;
121
+ }
96
122
  const order = await commerceApi.orders.ship(orderId, shipData);
97
123
  spinner.succeed('订单已标记为发货!');
98
124
  if (output.isJson()) {
@@ -100,7 +126,9 @@ async function shipOrder(options) {
100
126
  order_id: order.id || order.order_id,
101
127
  status: order.status,
102
128
  tracking_number: trackingNumber,
103
- carrier: carrier
129
+ carrier: carrier,
130
+ tracking_url: options.trackingUrl,
131
+ note: options.note
104
132
  });
105
133
  }
106
134
  else {