@salesforce/b2c-cli 1.15.0 → 1.16.1

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 (92) hide show
  1. package/dist/commands/cip/report/bot-traffic-share.d.ts +42 -0
  2. package/dist/commands/cip/report/bot-traffic-share.js +24 -0
  3. package/dist/commands/cip/report/bot-traffic-share.js.map +1 -0
  4. package/dist/commands/cip/report/checkout-funnel-dropoff.d.ts +42 -0
  5. package/dist/commands/cip/report/checkout-funnel-dropoff.js +24 -0
  6. package/dist/commands/cip/report/checkout-funnel-dropoff.js.map +1 -0
  7. package/dist/commands/cip/report/controller-error-rate-trend.d.ts +42 -0
  8. package/dist/commands/cip/report/controller-error-rate-trend.js +24 -0
  9. package/dist/commands/cip/report/controller-error-rate-trend.js.map +1 -0
  10. package/dist/commands/cip/report/controller-health-scorecard.d.ts +42 -0
  11. package/dist/commands/cip/report/controller-health-scorecard.js +24 -0
  12. package/dist/commands/cip/report/controller-health-scorecard.js.map +1 -0
  13. package/dist/commands/cip/report/customer-registration-trends.d.ts +4 -2
  14. package/dist/commands/cip/report/customer-registration-trends.js +8 -6
  15. package/dist/commands/cip/report/customer-registration-trends.js.map +1 -1
  16. package/dist/commands/cip/report/discount-depth-breakdown.d.ts +42 -0
  17. package/dist/commands/cip/report/discount-depth-breakdown.js +24 -0
  18. package/dist/commands/cip/report/discount-depth-breakdown.js.map +1 -0
  19. package/dist/commands/cip/report/inventory-stockout-by-location.d.ts +42 -0
  20. package/dist/commands/cip/report/inventory-stockout-by-location.js +24 -0
  21. package/dist/commands/cip/report/inventory-stockout-by-location.js.map +1 -0
  22. package/dist/commands/cip/report/list.d.ts +29 -0
  23. package/dist/commands/cip/report/list.js +89 -0
  24. package/dist/commands/cip/report/list.js.map +1 -0
  25. package/dist/commands/cip/report/new-vs-returning-buyer-revenue.d.ts +42 -0
  26. package/dist/commands/cip/report/new-vs-returning-buyer-revenue.js +24 -0
  27. package/dist/commands/cip/report/new-vs-returning-buyer-revenue.js.map +1 -0
  28. package/dist/commands/cip/report/ocapi-client-usage.d.ts +42 -0
  29. package/dist/commands/cip/report/ocapi-client-usage.js +24 -0
  30. package/dist/commands/cip/report/ocapi-client-usage.js.map +1 -0
  31. package/dist/commands/cip/report/ocapi-requests.d.ts +4 -2
  32. package/dist/commands/cip/report/ocapi-requests.js +8 -6
  33. package/dist/commands/cip/report/ocapi-requests.js.map +1 -1
  34. package/dist/commands/cip/report/payment-method-performance.d.ts +4 -2
  35. package/dist/commands/cip/report/payment-method-performance.js +8 -6
  36. package/dist/commands/cip/report/payment-method-performance.js.map +1 -1
  37. package/dist/commands/cip/report/product-co-purchase-analysis.d.ts +4 -2
  38. package/dist/commands/cip/report/product-co-purchase-analysis.js +8 -6
  39. package/dist/commands/cip/report/product-co-purchase-analysis.js.map +1 -1
  40. package/dist/commands/cip/report/promotion-discount-analysis.d.ts +4 -1
  41. package/dist/commands/cip/report/promotion-discount-analysis.js +8 -4
  42. package/dist/commands/cip/report/promotion-discount-analysis.js.map +1 -1
  43. package/dist/commands/cip/report/promotion-roi-leaderboard.d.ts +42 -0
  44. package/dist/commands/cip/report/promotion-roi-leaderboard.js +24 -0
  45. package/dist/commands/cip/report/promotion-roi-leaderboard.js.map +1 -0
  46. package/dist/commands/cip/report/recommender-effectiveness.d.ts +42 -0
  47. package/dist/commands/cip/report/recommender-effectiveness.js +24 -0
  48. package/dist/commands/cip/report/recommender-effectiveness.js.map +1 -0
  49. package/dist/commands/cip/report/remote-include-performance.d.ts +42 -0
  50. package/dist/commands/cip/report/remote-include-performance.js +24 -0
  51. package/dist/commands/cip/report/remote-include-performance.js.map +1 -0
  52. package/dist/commands/cip/report/revenue-by-channel.d.ts +42 -0
  53. package/dist/commands/cip/report/revenue-by-channel.js +24 -0
  54. package/dist/commands/cip/report/revenue-by-channel.js.map +1 -0
  55. package/dist/commands/cip/report/sales-analytics.d.ts +4 -2
  56. package/dist/commands/cip/report/sales-analytics.js +8 -6
  57. package/dist/commands/cip/report/sales-analytics.js.map +1 -1
  58. package/dist/commands/cip/report/sales-summary.d.ts +4 -2
  59. package/dist/commands/cip/report/sales-summary.js +8 -6
  60. package/dist/commands/cip/report/sales-summary.js.map +1 -1
  61. package/dist/commands/cip/report/scapi-cache-hit-ratio.d.ts +42 -0
  62. package/dist/commands/cip/report/scapi-cache-hit-ratio.js +24 -0
  63. package/dist/commands/cip/report/scapi-cache-hit-ratio.js.map +1 -0
  64. package/dist/commands/cip/report/scapi-error-rate-by-status.d.ts +42 -0
  65. package/dist/commands/cip/report/scapi-error-rate-by-status.js +24 -0
  66. package/dist/commands/cip/report/scapi-error-rate-by-status.js.map +1 -0
  67. package/dist/commands/cip/report/scapi-latency-distribution.d.ts +42 -0
  68. package/dist/commands/cip/report/scapi-latency-distribution.js +24 -0
  69. package/dist/commands/cip/report/scapi-latency-distribution.js.map +1 -0
  70. package/dist/commands/cip/report/scapi-traffic-latency.d.ts +42 -0
  71. package/dist/commands/cip/report/scapi-traffic-latency.js +24 -0
  72. package/dist/commands/cip/report/scapi-traffic-latency.js.map +1 -0
  73. package/dist/commands/cip/report/search-query-performance.d.ts +4 -3
  74. package/dist/commands/cip/report/search-query-performance.js +8 -19
  75. package/dist/commands/cip/report/search-query-performance.js.map +1 -1
  76. package/dist/commands/cip/report/top-referrers.d.ts +4 -3
  77. package/dist/commands/cip/report/top-referrers.js +8 -7
  78. package/dist/commands/cip/report/top-referrers.js.map +1 -1
  79. package/dist/commands/cip/report/top-selling-products.d.ts +4 -2
  80. package/dist/commands/cip/report/top-selling-products.js +8 -6
  81. package/dist/commands/cip/report/top-selling-products.js.map +1 -1
  82. package/dist/commands/cip/report/zero-result-searches.d.ts +42 -0
  83. package/dist/commands/cip/report/zero-result-searches.js +24 -0
  84. package/dist/commands/cip/report/zero-result-searches.js.map +1 -0
  85. package/dist/utils/cip/report-command.d.ts +7 -1
  86. package/dist/utils/cip/report-command.js +36 -0
  87. package/dist/utils/cip/report-command.js.map +1 -1
  88. package/dist/utils/cip/report-flags.d.ts +17 -2
  89. package/dist/utils/cip/report-flags.js +70 -0
  90. package/dist/utils/cip/report-flags.js.map +1 -1
  91. package/oclif.manifest.json +13657 -7251
  92. package/package.json +5 -5
@@ -1,10 +1,12 @@
1
1
  import { CipReportCommand } from '../../../utils/cip/report-command.js';
2
+ /**
3
+ * `b2c cip report search-query-performance` — flags are auto-derived from the catalog
4
+ * definition; param parsing/validation lives in {@link CipReportCommand} and the SDK.
5
+ */
2
6
  export default class CipReportSearchQueryPerformance extends CipReportCommand<typeof CipReportSearchQueryPerformance> {
3
7
  static description: string;
4
8
  static enableJsonFlag: boolean;
5
9
  static flags: {
6
- 'has-results': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
7
- 'site-id': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
8
10
  describe: import("@oclif/core/interfaces").BooleanFlag<boolean>;
9
11
  sql: import("@oclif/core/interfaces").BooleanFlag<boolean>;
10
12
  'cip-host': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
@@ -37,5 +39,4 @@ export default class CipReportSearchQueryPerformance extends CipReportCommand<ty
37
39
  'extra-headers': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
38
40
  };
39
41
  protected readonly reportName = "search-query-performance";
40
- protected getReportParams(): Record<string, string>;
41
42
  }
@@ -3,33 +3,22 @@
3
3
  * SPDX-License-Identifier: Apache-2
4
4
  * For full license text, see the license.txt file in the repo root or http://www.apache.org/licenses/LICENSE-2.0
5
5
  */
6
- import { Flags } from '@oclif/core';
7
6
  import { withDocs } from '../../../i18n/index.js';
8
7
  import { CipReportCommand } from '../../../utils/cip/report-command.js';
9
- import { createSiteIdFlag } from '../../../utils/cip/report-flags.js';
8
+ import { buildReportFlags, requireReport } from '../../../utils/cip/report-flags.js';
9
+ const REPORT_NAME = 'search-query-performance';
10
+ /**
11
+ * `b2c cip report search-query-performance` — flags are auto-derived from the catalog
12
+ * definition; param parsing/validation lives in {@link CipReportCommand} and the SDK.
13
+ */
10
14
  export default class CipReportSearchQueryPerformance extends CipReportCommand {
11
15
  static description = withDocs('Identify search terms driving revenue and conversion', '/cli/cip.html#b2c-cip-report-search-query-performance');
12
16
  static enableJsonFlag = true;
13
17
  static flags = {
14
18
  ...CipReportCommand.baseFlags,
15
19
  ...CipReportCommand.reportFlags,
16
- 'has-results': Flags.string({
17
- description: 'Filter by result-bearing searches',
18
- helpGroup: 'QUERY',
19
- options: ['false', 'true'],
20
- required: false,
21
- }),
22
- 'site-id': createSiteIdFlag(),
20
+ ...buildReportFlags(requireReport(REPORT_NAME)),
23
21
  };
24
- reportName = 'search-query-performance';
25
- getReportParams() {
26
- if (!this.flags['has-results']) {
27
- this.error('--has-results is required for this report. Use true or false.');
28
- }
29
- return {
30
- ...this.getBaseReportParams(),
31
- hasResults: this.flags['has-results'],
32
- };
33
- }
22
+ reportName = REPORT_NAME;
34
23
  }
35
24
  //# sourceMappingURL=search-query-performance.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"search-query-performance.js","sourceRoot":"","sources":["../../../../src/commands/cip/report/search-query-performance.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAC,KAAK,EAAC,MAAM,aAAa,CAAC;AAClC,OAAO,EAAC,QAAQ,EAAC,MAAM,wBAAwB,CAAC;AAChD,OAAO,EAAC,gBAAgB,EAAC,MAAM,sCAAsC,CAAC;AACtE,OAAO,EAAC,gBAAgB,EAAC,MAAM,oCAAoC,CAAC;AAEpE,MAAM,CAAC,OAAO,OAAO,+BAAgC,SAAQ,gBAAwD;IACnH,MAAM,CAAC,WAAW,GAAG,QAAQ,CAC3B,sDAAsD,EACtD,uDAAuD,CACxD,CAAC;IAEF,MAAM,CAAC,cAAc,GAAG,IAAI,CAAC;IAE7B,MAAM,CAAC,KAAK,GAAG;QACb,GAAG,gBAAgB,CAAC,SAAS;QAC7B,GAAG,gBAAgB,CAAC,WAAW;QAC/B,aAAa,EAAE,KAAK,CAAC,MAAM,CAAC;YAC1B,WAAW,EAAE,mCAAmC;YAChD,SAAS,EAAE,OAAO;YAClB,OAAO,EAAE,CAAC,OAAO,EAAE,MAAM,CAAC;YAC1B,QAAQ,EAAE,KAAK;SAChB,CAAC;QACF,SAAS,EAAE,gBAAgB,EAAE;KAC9B,CAAC;IAEiB,UAAU,GAAG,0BAA0B,CAAC;IAEjD,eAAe;QACvB,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,aAAa,CAAC,EAAE,CAAC;YAC/B,IAAI,CAAC,KAAK,CAAC,+DAA+D,CAAC,CAAC;QAC9E,CAAC;QAED,OAAO;YACL,GAAG,IAAI,CAAC,mBAAmB,EAAE;YAC7B,UAAU,EAAE,IAAI,CAAC,KAAK,CAAC,aAAa,CAAC;SACtC,CAAC;IACJ,CAAC"}
1
+ {"version":3,"file":"search-query-performance.js","sourceRoot":"","sources":["../../../../src/commands/cip/report/search-query-performance.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAC,QAAQ,EAAC,MAAM,wBAAwB,CAAC;AAChD,OAAO,EAAC,gBAAgB,EAAC,MAAM,sCAAsC,CAAC;AACtE,OAAO,EAAC,gBAAgB,EAAE,aAAa,EAAC,MAAM,oCAAoC,CAAC;AAEnF,MAAM,WAAW,GAAG,0BAA0B,CAAC;AAE/C;;;GAGG;AACH,MAAM,CAAC,OAAO,OAAO,+BAAgC,SAAQ,gBAAwD;IACnH,MAAM,CAAC,WAAW,GAAG,QAAQ,CAC3B,sDAAsD,EACtD,uDAAuD,CACxD,CAAC;IAEF,MAAM,CAAC,cAAc,GAAG,IAAI,CAAC;IAE7B,MAAM,CAAC,KAAK,GAAG;QACb,GAAG,gBAAgB,CAAC,SAAS;QAC7B,GAAG,gBAAgB,CAAC,WAAW;QAC/B,GAAG,gBAAgB,CAAC,aAAa,CAAC,WAAW,CAAC,CAAC;KAChD,CAAC;IAEiB,UAAU,GAAG,WAAW,CAAC"}
@@ -1,10 +1,12 @@
1
1
  import { CipReportCommand } from '../../../utils/cip/report-command.js';
2
+ /**
3
+ * `b2c cip report top-referrers` — flags are auto-derived from the catalog
4
+ * definition; param parsing/validation lives in {@link CipReportCommand} and the SDK.
5
+ */
2
6
  export default class CipReportTopReferrers extends CipReportCommand<typeof CipReportTopReferrers> {
3
7
  static description: string;
4
8
  static enableJsonFlag: boolean;
5
9
  static flags: {
6
- limit: import("@oclif/core/interfaces").OptionFlag<number | undefined, import("@oclif/core/interfaces").CustomOptions>;
7
- 'site-id': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
8
10
  describe: import("@oclif/core/interfaces").BooleanFlag<boolean>;
9
11
  sql: import("@oclif/core/interfaces").BooleanFlag<boolean>;
10
12
  'cip-host': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
@@ -37,5 +39,4 @@ export default class CipReportTopReferrers extends CipReportCommand<typeof CipRe
37
39
  'extra-headers': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
38
40
  };
39
41
  protected readonly reportName = "top-referrers";
40
- protected getReportParams(): Record<string, string>;
41
42
  }
@@ -5,19 +5,20 @@
5
5
  */
6
6
  import { withDocs } from '../../../i18n/index.js';
7
7
  import { CipReportCommand } from '../../../utils/cip/report-command.js';
8
- import { createLimitFlag, createSiteIdFlag } from '../../../utils/cip/report-flags.js';
8
+ import { buildReportFlags, requireReport } from '../../../utils/cip/report-flags.js';
9
+ const REPORT_NAME = 'top-referrers';
10
+ /**
11
+ * `b2c cip report top-referrers` — flags are auto-derived from the catalog
12
+ * definition; param parsing/validation lives in {@link CipReportCommand} and the SDK.
13
+ */
9
14
  export default class CipReportTopReferrers extends CipReportCommand {
10
15
  static description = withDocs('Identify top traffic referrers and visit share', '/cli/cip.html#b2c-cip-report-top-referrers');
11
16
  static enableJsonFlag = true;
12
17
  static flags = {
13
18
  ...CipReportCommand.baseFlags,
14
19
  ...CipReportCommand.reportFlags,
15
- limit: createLimitFlag(),
16
- 'site-id': createSiteIdFlag(),
20
+ ...buildReportFlags(requireReport(REPORT_NAME)),
17
21
  };
18
- reportName = 'top-referrers';
19
- getReportParams() {
20
- return this.getBaseReportParams();
21
- }
22
+ reportName = REPORT_NAME;
22
23
  }
23
24
  //# sourceMappingURL=top-referrers.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"top-referrers.js","sourceRoot":"","sources":["../../../../src/commands/cip/report/top-referrers.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAC,QAAQ,EAAC,MAAM,wBAAwB,CAAC;AAChD,OAAO,EAAC,gBAAgB,EAAC,MAAM,sCAAsC,CAAC;AACtE,OAAO,EAAC,eAAe,EAAE,gBAAgB,EAAC,MAAM,oCAAoC,CAAC;AAErF,MAAM,CAAC,OAAO,OAAO,qBAAsB,SAAQ,gBAA8C;IAC/F,MAAM,CAAC,WAAW,GAAG,QAAQ,CAC3B,gDAAgD,EAChD,4CAA4C,CAC7C,CAAC;IAEF,MAAM,CAAC,cAAc,GAAG,IAAI,CAAC;IAE7B,MAAM,CAAC,KAAK,GAAG;QACb,GAAG,gBAAgB,CAAC,SAAS;QAC7B,GAAG,gBAAgB,CAAC,WAAW;QAC/B,KAAK,EAAE,eAAe,EAAE;QACxB,SAAS,EAAE,gBAAgB,EAAE;KAC9B,CAAC;IAEiB,UAAU,GAAG,eAAe,CAAC;IAEtC,eAAe;QACvB,OAAO,IAAI,CAAC,mBAAmB,EAAE,CAAC;IACpC,CAAC"}
1
+ {"version":3,"file":"top-referrers.js","sourceRoot":"","sources":["../../../../src/commands/cip/report/top-referrers.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAC,QAAQ,EAAC,MAAM,wBAAwB,CAAC;AAChD,OAAO,EAAC,gBAAgB,EAAC,MAAM,sCAAsC,CAAC;AACtE,OAAO,EAAC,gBAAgB,EAAE,aAAa,EAAC,MAAM,oCAAoC,CAAC;AAEnF,MAAM,WAAW,GAAG,eAAe,CAAC;AAEpC;;;GAGG;AACH,MAAM,CAAC,OAAO,OAAO,qBAAsB,SAAQ,gBAA8C;IAC/F,MAAM,CAAC,WAAW,GAAG,QAAQ,CAC3B,gDAAgD,EAChD,4CAA4C,CAC7C,CAAC;IAEF,MAAM,CAAC,cAAc,GAAG,IAAI,CAAC;IAE7B,MAAM,CAAC,KAAK,GAAG;QACb,GAAG,gBAAgB,CAAC,SAAS;QAC7B,GAAG,gBAAgB,CAAC,WAAW;QAC/B,GAAG,gBAAgB,CAAC,aAAa,CAAC,WAAW,CAAC,CAAC;KAChD,CAAC;IAEiB,UAAU,GAAG,WAAW,CAAC"}
@@ -1,9 +1,12 @@
1
1
  import { CipReportCommand } from '../../../utils/cip/report-command.js';
2
+ /**
3
+ * `b2c cip report top-selling-products` — flags are auto-derived from the catalog
4
+ * definition; param parsing/validation lives in {@link CipReportCommand} and the SDK.
5
+ */
2
6
  export default class CipReportTopSellingProducts extends CipReportCommand<typeof CipReportTopSellingProducts> {
3
7
  static description: string;
4
8
  static enableJsonFlag: boolean;
5
9
  static flags: {
6
- 'site-id': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
7
10
  describe: import("@oclif/core/interfaces").BooleanFlag<boolean>;
8
11
  sql: import("@oclif/core/interfaces").BooleanFlag<boolean>;
9
12
  'cip-host': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
@@ -36,5 +39,4 @@ export default class CipReportTopSellingProducts extends CipReportCommand<typeof
36
39
  'extra-headers': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
37
40
  };
38
41
  protected readonly reportName = "top-selling-products";
39
- protected getReportParams(): Record<string, string>;
40
42
  }
@@ -5,18 +5,20 @@
5
5
  */
6
6
  import { withDocs } from '../../../i18n/index.js';
7
7
  import { CipReportCommand } from '../../../utils/cip/report-command.js';
8
- import { createSiteIdFlag } from '../../../utils/cip/report-flags.js';
8
+ import { buildReportFlags, requireReport } from '../../../utils/cip/report-flags.js';
9
+ const REPORT_NAME = 'top-selling-products';
10
+ /**
11
+ * `b2c cip report top-selling-products` — flags are auto-derived from the catalog
12
+ * definition; param parsing/validation lives in {@link CipReportCommand} and the SDK.
13
+ */
9
14
  export default class CipReportTopSellingProducts extends CipReportCommand {
10
15
  static description = withDocs('Identify top selling products across channels', '/cli/cip.html#b2c-cip-report-top-selling-products');
11
16
  static enableJsonFlag = true;
12
17
  static flags = {
13
18
  ...CipReportCommand.baseFlags,
14
19
  ...CipReportCommand.reportFlags,
15
- 'site-id': createSiteIdFlag(),
20
+ ...buildReportFlags(requireReport(REPORT_NAME)),
16
21
  };
17
- reportName = 'top-selling-products';
18
- getReportParams() {
19
- return this.getBaseReportParams();
20
- }
22
+ reportName = REPORT_NAME;
21
23
  }
22
24
  //# sourceMappingURL=top-selling-products.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"top-selling-products.js","sourceRoot":"","sources":["../../../../src/commands/cip/report/top-selling-products.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAC,QAAQ,EAAC,MAAM,wBAAwB,CAAC;AAChD,OAAO,EAAC,gBAAgB,EAAC,MAAM,sCAAsC,CAAC;AACtE,OAAO,EAAC,gBAAgB,EAAC,MAAM,oCAAoC,CAAC;AAEpE,MAAM,CAAC,OAAO,OAAO,2BAA4B,SAAQ,gBAAoD;IAC3G,MAAM,CAAC,WAAW,GAAG,QAAQ,CAC3B,+CAA+C,EAC/C,mDAAmD,CACpD,CAAC;IAEF,MAAM,CAAC,cAAc,GAAG,IAAI,CAAC;IAE7B,MAAM,CAAC,KAAK,GAAG;QACb,GAAG,gBAAgB,CAAC,SAAS;QAC7B,GAAG,gBAAgB,CAAC,WAAW;QAC/B,SAAS,EAAE,gBAAgB,EAAE;KAC9B,CAAC;IAEiB,UAAU,GAAG,sBAAsB,CAAC;IAE7C,eAAe;QACvB,OAAO,IAAI,CAAC,mBAAmB,EAAE,CAAC;IACpC,CAAC"}
1
+ {"version":3,"file":"top-selling-products.js","sourceRoot":"","sources":["../../../../src/commands/cip/report/top-selling-products.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAC,QAAQ,EAAC,MAAM,wBAAwB,CAAC;AAChD,OAAO,EAAC,gBAAgB,EAAC,MAAM,sCAAsC,CAAC;AACtE,OAAO,EAAC,gBAAgB,EAAE,aAAa,EAAC,MAAM,oCAAoC,CAAC;AAEnF,MAAM,WAAW,GAAG,sBAAsB,CAAC;AAE3C;;;GAGG;AACH,MAAM,CAAC,OAAO,OAAO,2BAA4B,SAAQ,gBAAoD;IAC3G,MAAM,CAAC,WAAW,GAAG,QAAQ,CAC3B,+CAA+C,EAC/C,mDAAmD,CACpD,CAAC;IAEF,MAAM,CAAC,cAAc,GAAG,IAAI,CAAC;IAE7B,MAAM,CAAC,KAAK,GAAG;QACb,GAAG,gBAAgB,CAAC,SAAS;QAC7B,GAAG,gBAAgB,CAAC,WAAW;QAC/B,GAAG,gBAAgB,CAAC,aAAa,CAAC,WAAW,CAAC,CAAC;KAChD,CAAC;IAEiB,UAAU,GAAG,WAAW,CAAC"}
@@ -0,0 +1,42 @@
1
+ import { CipReportCommand } from '../../../utils/cip/report-command.js';
2
+ /**
3
+ * `b2c cip report zero-result-searches` — flags are auto-derived from the catalog
4
+ * definition; param parsing/validation lives in {@link CipReportCommand} and the SDK.
5
+ */
6
+ export default class CipReportZeroResultSearches extends CipReportCommand<typeof CipReportZeroResultSearches> {
7
+ static description: string;
8
+ static enableJsonFlag: boolean;
9
+ static flags: {
10
+ describe: import("@oclif/core/interfaces").BooleanFlag<boolean>;
11
+ sql: import("@oclif/core/interfaces").BooleanFlag<boolean>;
12
+ 'cip-host': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
13
+ staging: import("@oclif/core/interfaces").BooleanFlag<boolean>;
14
+ from: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
15
+ to: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
16
+ format: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
17
+ 'fetch-size': import("@oclif/core/interfaces").OptionFlag<number, import("@oclif/core/interfaces").CustomOptions>;
18
+ 'client-id': import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
19
+ 'client-secret': import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
20
+ 'auth-scope': import("@oclif/core/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/interfaces").CustomOptions>;
21
+ 'short-code': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
22
+ 'tenant-id': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
23
+ 'auth-methods': import("@oclif/core/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/interfaces").CustomOptions>;
24
+ 'user-auth': import("@oclif/core/interfaces").BooleanFlag<boolean>;
25
+ 'account-manager-host': import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
26
+ 'jwt-cert': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
27
+ 'jwt-key': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
28
+ 'jwt-passphrase': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
29
+ 'log-level': import("@oclif/core/interfaces").OptionFlag<"trace" | "debug" | "info" | "warn" | "error" | "silent" | undefined, import("@oclif/core/interfaces").CustomOptions>;
30
+ debug: import("@oclif/core/interfaces").BooleanFlag<boolean>;
31
+ json: import("@oclif/core/interfaces").BooleanFlag<boolean>;
32
+ jsonl: import("@oclif/core/interfaces").BooleanFlag<boolean>;
33
+ lang: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
34
+ config: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
35
+ instance: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
36
+ 'project-directory': import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
37
+ 'extra-query': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
38
+ 'extra-body': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
39
+ 'extra-headers': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
40
+ };
41
+ protected readonly reportName = "zero-result-searches";
42
+ }
@@ -0,0 +1,24 @@
1
+ /*
2
+ * Copyright (c) 2025, Salesforce, Inc.
3
+ * SPDX-License-Identifier: Apache-2
4
+ * For full license text, see the license.txt file in the repo root or http://www.apache.org/licenses/LICENSE-2.0
5
+ */
6
+ import { withDocs } from '../../../i18n/index.js';
7
+ import { CipReportCommand } from '../../../utils/cip/report-command.js';
8
+ import { buildReportFlags, requireReport } from '../../../utils/cip/report-flags.js';
9
+ const REPORT_NAME = 'zero-result-searches';
10
+ /**
11
+ * `b2c cip report zero-result-searches` — flags are auto-derived from the catalog
12
+ * definition; param parsing/validation lives in {@link CipReportCommand} and the SDK.
13
+ */
14
+ export default class CipReportZeroResultSearches extends CipReportCommand {
15
+ static description = withDocs('Surface search terms that most often return zero results and the demand lost to them', '/cli/cip.html#b2c-cip-report-zero-result-searches');
16
+ static enableJsonFlag = true;
17
+ static flags = {
18
+ ...CipReportCommand.baseFlags,
19
+ ...CipReportCommand.reportFlags,
20
+ ...buildReportFlags(requireReport(REPORT_NAME)),
21
+ };
22
+ reportName = REPORT_NAME;
23
+ }
24
+ //# sourceMappingURL=zero-result-searches.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"zero-result-searches.js","sourceRoot":"","sources":["../../../../src/commands/cip/report/zero-result-searches.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAC,QAAQ,EAAC,MAAM,wBAAwB,CAAC;AAChD,OAAO,EAAC,gBAAgB,EAAC,MAAM,sCAAsC,CAAC;AACtE,OAAO,EAAC,gBAAgB,EAAE,aAAa,EAAC,MAAM,oCAAoC,CAAC;AAEnF,MAAM,WAAW,GAAG,sBAAsB,CAAC;AAE3C;;;GAGG;AACH,MAAM,CAAC,OAAO,OAAO,2BAA4B,SAAQ,gBAAoD;IAC3G,MAAM,CAAC,WAAW,GAAG,QAAQ,CAC3B,sFAAsF,EACtF,mDAAmD,CACpD,CAAC;IAEF,MAAM,CAAC,cAAc,GAAG,IAAI,CAAC;IAE7B,MAAM,CAAC,KAAK,GAAG;QACb,GAAG,gBAAgB,CAAC,SAAS;QAC7B,GAAG,gBAAgB,CAAC,WAAW;QAC/B,GAAG,gBAAgB,CAAC,aAAa,CAAC,WAAW,CAAC,CAAC;KAChD,CAAC;IAEiB,UAAU,GAAG,WAAW,CAAC"}
@@ -24,7 +24,13 @@ export declare abstract class CipReportCommand<T extends typeof Command> extends
24
24
  };
25
25
  protected abstract readonly reportName: string;
26
26
  protected getBaseReportParams(): Record<string, string>;
27
- protected abstract getReportParams(): Record<string, string>;
27
+ /**
28
+ * Derives report params generically from the report's catalog definition by
29
+ * reading each parameter's kebab-cased flag. Subclasses normally do not need to
30
+ * override this; the SDK validates and escapes the values when building SQL.
31
+ * `from`/`to`/`siteId`/`limit` are handled by {@link getBaseReportParams}.
32
+ */
33
+ protected getReportParams(): Record<string, string>;
28
34
  run(): Promise<CipReportDescribeOutput | CipReportQueryOutput | CipReportSqlOutput>;
29
35
  private describeReport;
30
36
  private getReportDefinition;
@@ -7,6 +7,7 @@ import { Command, Flags } from '@oclif/core';
7
7
  import { buildCipReportSql, executeCipReport, getCipReportByName, } from '@salesforce/b2c-tooling-sdk';
8
8
  import { CipCommand } from './command.js';
9
9
  import { renderTable, writeCsv, writeJson } from './format.js';
10
+ import { paramNameToFlag } from './report-flags.js';
10
11
  import { ux } from '@oclif/core';
11
12
  function camelToKebab(str) {
12
13
  return str.replaceAll(/[A-Z]/gu, (match) => `-${match.toLowerCase()}`);
@@ -44,6 +45,41 @@ export class CipReportCommand extends CipCommand {
44
45
  }
45
46
  return params;
46
47
  }
48
+ /**
49
+ * Derives report params generically from the report's catalog definition by
50
+ * reading each parameter's kebab-cased flag. Subclasses normally do not need to
51
+ * override this; the SDK validates and escapes the values when building SQL.
52
+ * `from`/`to`/`siteId`/`limit` are handled by {@link getBaseReportParams}.
53
+ */
54
+ getReportParams() {
55
+ const params = this.getBaseReportParams();
56
+ const report = getCipReportByName(this.reportName);
57
+ if (!report) {
58
+ return params;
59
+ }
60
+ const flags = this.flags;
61
+ for (const parameter of report.parameters) {
62
+ if (['from', 'limit', 'siteId', 'to'].includes(parameter.name)) {
63
+ continue;
64
+ }
65
+ const value = flags[paramNameToFlag(parameter.name)];
66
+ if (Array.isArray(value)) {
67
+ if (value.length > 0) {
68
+ params[parameter.name] = value.map(String).join(',');
69
+ }
70
+ }
71
+ else if (typeof value === 'number') {
72
+ params[parameter.name] = String(value);
73
+ }
74
+ else if (typeof value === 'string' && value.length > 0) {
75
+ params[parameter.name] = value;
76
+ }
77
+ else if (typeof value === 'boolean') {
78
+ params[parameter.name] = String(value);
79
+ }
80
+ }
81
+ return params;
82
+ }
47
83
  async run() {
48
84
  this.validateCipAuthMethods();
49
85
  const report = this.getReportDefinition();
@@ -1 +1 @@
1
- {"version":3,"file":"report-command.js","sourceRoot":"","sources":["../../../src/utils/cip/report-command.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAC,OAAO,E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W,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;IAC7B,CAAC;IAEO,4BAA4B,CAAC,MAA8B;QACjE,MAAM,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC;QAC7B,IAAI,CAAC,MAAM,EAAE,CAAC;YACZ,OAAO;QACT,CAAC;QAED,IAAI,CAAC,0BAA0B,CAAC,MAAM,CAAC,EAAE,CAAC;YACxC,IAAI,CAAC,IAAI,CACP,eAAe,MAAM,oGAAoG,CAC1H,CAAC;QACJ,CAAC;IACH,CAAC"}
@@ -1,3 +1,5 @@
1
+ import { type Interfaces } from '@oclif/core';
2
+ import { type CipReportDefinition } from '@salesforce/b2c-tooling-sdk';
1
3
  interface SiteIdFlagOptions {
2
4
  required?: boolean;
3
5
  }
@@ -5,6 +7,19 @@ interface LimitFlagOptions {
5
7
  max?: number;
6
8
  min?: number;
7
9
  }
8
- export declare function createSiteIdFlag(options?: SiteIdFlagOptions): import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
9
- export declare function createLimitFlag(options?: LimitFlagOptions): import("@oclif/core/interfaces").OptionFlag<number | undefined, import("@oclif/core/interfaces").CustomOptions>;
10
+ /** Converts a camelCase report parameter name to its kebab-case CLI flag name. */
11
+ export declare function paramNameToFlag(name: string): string;
12
+ export declare function createSiteIdFlag(options?: SiteIdFlagOptions): Interfaces.OptionFlag<string | undefined, Interfaces.CustomOptions>;
13
+ export declare function createLimitFlag(options?: LimitFlagOptions): Interfaces.OptionFlag<number | undefined, Interfaces.CustomOptions>;
14
+ /**
15
+ * Builds the oclif flag map for a report's own parameters from its catalog
16
+ * definition, excluding `from`/`to` which are handled by the base command. `siteId`
17
+ * is mapped to the shared `--site-id` flag. Returns flags keyed by kebab-cased name.
18
+ */
19
+ export declare function buildReportFlags(report: CipReportDefinition): Interfaces.FlagInput;
20
+ /**
21
+ * Resolves a report definition by name or throws — used by per-command files at
22
+ * module load to fail loudly if a report name does not exist in the catalog.
23
+ */
24
+ export declare function requireReport(reportName: string): CipReportDefinition;
10
25
  export {};
@@ -4,6 +4,11 @@
4
4
  * For full license text, see the license.txt file in the repo root or http://www.apache.org/licenses/LICENSE-2.0
5
5
  */
6
6
  import { Flags } from '@oclif/core';
7
+ import { getCipReportByName } from '@salesforce/b2c-tooling-sdk';
8
+ /** Converts a camelCase report parameter name to its kebab-case CLI flag name. */
9
+ export function paramNameToFlag(name) {
10
+ return name.replaceAll(/[A-Z]/gu, (match) => `-${match.toLowerCase()}`);
11
+ }
7
12
  export function createSiteIdFlag(options = {}) {
8
13
  return Flags.string({
9
14
  description: 'Site ID parameter for CIP report filters',
@@ -20,4 +25,69 @@ export function createLimitFlag(options = {}) {
20
25
  required: false,
21
26
  });
22
27
  }
28
+ /**
29
+ * Maps a single report parameter definition to an oclif flag.
30
+ *
31
+ * `from`/`to` are intentionally skipped because they are already provided by
32
+ * {@link CipCommand.baseFlags}; callers should exclude them. Number params become
33
+ * range-checked integer flags, enum params become string flags with `options`, and
34
+ * `multiple` params accept repeated values.
35
+ */
36
+ function paramToFlag(parameter) {
37
+ // Report params are intentionally NOT marked oclif-required even when the catalog
38
+ // marks them required: the SDK's validateReportParams enforces required-ness when
39
+ // building SQL, and `--describe` / metadata flows must run without supplying them.
40
+ // Making them oclif-required would break `cip report <name> --describe`.
41
+ const common = {
42
+ description: parameter.description,
43
+ helpGroup: 'QUERY',
44
+ required: false,
45
+ };
46
+ if (parameter.type === 'number') {
47
+ return Flags.integer({
48
+ ...common,
49
+ ...(parameter.min === undefined ? {} : { min: parameter.min }),
50
+ ...(parameter.max === undefined ? {} : { max: parameter.max }),
51
+ });
52
+ }
53
+ // string / boolean / date all surface as string flags; the SDK validates and
54
+ // escapes the value when building SQL. Enum params constrain to their options.
55
+ const options = parameter.options && parameter.options.length > 0 ? parameter.options : undefined;
56
+ if (parameter.multiple) {
57
+ return Flags.string({ ...common, multiple: true, ...(options ? { options } : {}) });
58
+ }
59
+ return Flags.string({ ...common, ...(options ? { options } : {}) });
60
+ }
61
+ /**
62
+ * Builds the oclif flag map for a report's own parameters from its catalog
63
+ * definition, excluding `from`/`to` which are handled by the base command. `siteId`
64
+ * is mapped to the shared `--site-id` flag. Returns flags keyed by kebab-cased name.
65
+ */
66
+ export function buildReportFlags(report) {
67
+ const flags = {};
68
+ for (const parameter of report.parameters) {
69
+ if (parameter.name === 'from' || parameter.name === 'to') {
70
+ continue;
71
+ }
72
+ if (parameter.name === 'siteId') {
73
+ // Not oclif-required; the SDK validates required-ness at SQL-build time so
74
+ // `--describe` works without a site id (matches the historical behavior).
75
+ flags['site-id'] = createSiteIdFlag({ required: false });
76
+ continue;
77
+ }
78
+ flags[paramNameToFlag(parameter.name)] = paramToFlag(parameter);
79
+ }
80
+ return flags;
81
+ }
82
+ /**
83
+ * Resolves a report definition by name or throws — used by per-command files at
84
+ * module load to fail loudly if a report name does not exist in the catalog.
85
+ */
86
+ export function requireReport(reportName) {
87
+ const report = getCipReportByName(reportName);
88
+ if (!report) {
89
+ throw new Error(`Unknown CIP report referenced by command: ${reportName}`);
90
+ }
91
+ return report;
92
+ }
23
93
  //# sourceMappingURL=report-flags.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"report-flags.js","sourceRoot":"","sources":["../../../src/utils/cip/report-flags.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAC,KAAK,EAAC,MAAM,aAAa,CAAC;AAWlC,MAAM,UAAU,gBAAgB,CAAC,UAA6B,EAAE;IAC9D,OAAO,KAAK,CAAC,MAAM,CAAC;QAClB,WAAW,EAAE,0CAA0C;QACvD,SAAS,EAAE,OAAO;QAClB,QAAQ,EAAE,OAAO,CAAC,QAAQ,IAAI,KAAK;KACpC,CAAC,CAAC;AACL,CAAC;AAED,MAAM,UAAU,eAAe,CAAC,UAA4B,EAAE;IAC5D,OAAO,KAAK,CAAC,OAAO,CAAC;QACnB,WAAW,EAAE,wBAAwB;QACrC,SAAS,EAAE,OAAO;QAClB,GAAG,EAAE,OAAO,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