@commercelayer/cli-plugin-triggers 3.13.1 → 3.14.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 (60) hide show
  1. package/README.md +486 -3
  2. package/lib/commands/buy_x_pay_y_promotion/disable.d.ts +9 -0
  3. package/lib/commands/buy_x_pay_y_promotion/disable.js +21 -0
  4. package/lib/commands/buy_x_pay_y_promotion/enable.d.ts +9 -0
  5. package/lib/commands/buy_x_pay_y_promotion/enable.js +21 -0
  6. package/lib/commands/buy_x_pay_y_promotion/index.d.ts +9 -0
  7. package/lib/commands/buy_x_pay_y_promotion/index.js +38 -0
  8. package/lib/commands/external_promotion/disable.d.ts +9 -0
  9. package/lib/commands/external_promotion/disable.js +21 -0
  10. package/lib/commands/external_promotion/enable.d.ts +9 -0
  11. package/lib/commands/external_promotion/enable.js +21 -0
  12. package/lib/commands/external_promotion/index.d.ts +9 -0
  13. package/lib/commands/external_promotion/index.js +38 -0
  14. package/lib/commands/fixed_amount_promotion/disable.d.ts +9 -0
  15. package/lib/commands/fixed_amount_promotion/disable.js +21 -0
  16. package/lib/commands/fixed_amount_promotion/enable.d.ts +9 -0
  17. package/lib/commands/fixed_amount_promotion/enable.js +21 -0
  18. package/lib/commands/fixed_amount_promotion/index.d.ts +9 -0
  19. package/lib/commands/fixed_amount_promotion/index.js +38 -0
  20. package/lib/commands/fixed_price_promotion/disable.d.ts +9 -0
  21. package/lib/commands/fixed_price_promotion/disable.js +21 -0
  22. package/lib/commands/fixed_price_promotion/enable.d.ts +9 -0
  23. package/lib/commands/fixed_price_promotion/enable.js +21 -0
  24. package/lib/commands/fixed_price_promotion/index.d.ts +9 -0
  25. package/lib/commands/fixed_price_promotion/index.js +38 -0
  26. package/lib/commands/free_gift_promotion/disable.d.ts +9 -0
  27. package/lib/commands/free_gift_promotion/disable.js +21 -0
  28. package/lib/commands/free_gift_promotion/enable.d.ts +9 -0
  29. package/lib/commands/free_gift_promotion/enable.js +21 -0
  30. package/lib/commands/free_gift_promotion/index.d.ts +9 -0
  31. package/lib/commands/free_gift_promotion/index.js +38 -0
  32. package/lib/commands/free_shipping_promotion/disable.d.ts +9 -0
  33. package/lib/commands/free_shipping_promotion/disable.js +21 -0
  34. package/lib/commands/free_shipping_promotion/enable.d.ts +9 -0
  35. package/lib/commands/free_shipping_promotion/enable.js +21 -0
  36. package/lib/commands/free_shipping_promotion/index.d.ts +9 -0
  37. package/lib/commands/free_shipping_promotion/index.js +38 -0
  38. package/lib/commands/percentage_discount_promotion/disable.d.ts +9 -0
  39. package/lib/commands/percentage_discount_promotion/disable.js +21 -0
  40. package/lib/commands/percentage_discount_promotion/enable.d.ts +9 -0
  41. package/lib/commands/percentage_discount_promotion/enable.js +21 -0
  42. package/lib/commands/percentage_discount_promotion/index.d.ts +9 -0
  43. package/lib/commands/percentage_discount_promotion/index.js +38 -0
  44. package/lib/triggers/buy_x_pay_y_promotions.d.ts +3 -0
  45. package/lib/triggers/buy_x_pay_y_promotions.js +15 -0
  46. package/lib/triggers/external_promotions.d.ts +3 -0
  47. package/lib/triggers/external_promotions.js +15 -0
  48. package/lib/triggers/fixed_amount_promotions.d.ts +3 -0
  49. package/lib/triggers/fixed_amount_promotions.js +15 -0
  50. package/lib/triggers/fixed_price_promotions.d.ts +3 -0
  51. package/lib/triggers/fixed_price_promotions.js +15 -0
  52. package/lib/triggers/free_gift_promotions.d.ts +3 -0
  53. package/lib/triggers/free_gift_promotions.js +15 -0
  54. package/lib/triggers/free_shipping_promotions.d.ts +3 -0
  55. package/lib/triggers/free_shipping_promotions.js +15 -0
  56. package/lib/triggers/orders.js +1 -1
  57. package/lib/triggers/percentage_discount_promotions.d.ts +3 -0
  58. package/lib/triggers/percentage_discount_promotions.js +15 -0
  59. package/oclif.manifest.json +1535 -23
  60. package/package.json +15 -15
@@ -0,0 +1,38 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ const base_1 = tslib_1.__importDefault(require("../../base"));
5
+ const exec_1 = tslib_1.__importDefault(require("../../exec"));
6
+ const inquirer_1 = tslib_1.__importDefault(require("inquirer"));
7
+ const cli_core_1 = require("@commercelayer/cli-core");
8
+ const percentage_discount_promotions_1 = require("../../triggers/percentage_discount_promotions");
9
+ const promptAction = async (id) => {
10
+ const answers = await inquirer_1.default.prompt([{
11
+ type: 'list',
12
+ name: 'trigger',
13
+ message: `Select an action to execute on percentage discount promotion ${cli_core_1.clColor.api.id(id)}:`,
14
+ choices: Object.keys(percentage_discount_promotions_1.triggers).sort().map(a => {
15
+ return { name: a, value: a };
16
+ }),
17
+ loop: false,
18
+ pageSize: 10,
19
+ }]);
20
+ return answers.trigger;
21
+ };
22
+ class PercentageDiscountPromotionIndex extends base_1.default {
23
+ async run() {
24
+ const { args, flags } = await this.parse(PercentageDiscountPromotionIndex);
25
+ const id = args.id;
26
+ const action = await promptAction(id);
27
+ const fields = [];
28
+ const res = await (0, exec_1.default)('percentage_discount_promotions', id, action, flags, fields);
29
+ this.log();
30
+ this.printOutput(res, flags);
31
+ this.successMessage('percentage discount promotion', action, res.id);
32
+ return res;
33
+ }
34
+ }
35
+ PercentageDiscountPromotionIndex.description = 'execute an action on a resource of type percentage_discount_promotions';
36
+ PercentageDiscountPromotionIndex.flags = {};
37
+ PercentageDiscountPromotionIndex.args = Object.assign({}, base_1.default.args);
38
+ exports.default = PercentageDiscountPromotionIndex;
@@ -0,0 +1,3 @@
1
+ import type { Trigger } from '../common';
2
+ export declare const triggers: Record<string, Trigger>;
3
+ export type ActionType = 'disable' | 'enable';
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.triggers = void 0;
4
+ exports.triggers = {
5
+ disable: {
6
+ action: 'disable',
7
+ trigger: '_disable',
8
+ description: 'Send this attribute if you want to mark the promotion as disabled.',
9
+ },
10
+ enable: {
11
+ action: 'enable',
12
+ trigger: '_enable',
13
+ description: 'Send this attribute if you want to mark the promotion as enabled.',
14
+ },
15
+ };
@@ -0,0 +1,3 @@
1
+ import type { Trigger } from '../common';
2
+ export declare const triggers: Record<string, Trigger>;
3
+ export type ActionType = 'disable' | 'enable';
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.triggers = void 0;
4
+ exports.triggers = {
5
+ disable: {
6
+ action: 'disable',
7
+ trigger: '_disable',
8
+ description: 'Send this attribute if you want to mark the promotion as disabled.',
9
+ },
10
+ enable: {
11
+ action: 'enable',
12
+ trigger: '_enable',
13
+ description: 'Send this attribute if you want to mark the promotion as enabled.',
14
+ },
15
+ };
@@ -0,0 +1,3 @@
1
+ import type { Trigger } from '../common';
2
+ export declare const triggers: Record<string, Trigger>;
3
+ export type ActionType = 'disable' | 'enable';
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.triggers = void 0;
4
+ exports.triggers = {
5
+ disable: {
6
+ action: 'disable',
7
+ trigger: '_disable',
8
+ description: 'Send this attribute if you want to mark the promotion as disabled.',
9
+ },
10
+ enable: {
11
+ action: 'enable',
12
+ trigger: '_enable',
13
+ description: 'Send this attribute if you want to mark the promotion as enabled.',
14
+ },
15
+ };
@@ -0,0 +1,3 @@
1
+ import type { Trigger } from '../common';
2
+ export declare const triggers: Record<string, Trigger>;
3
+ export type ActionType = 'disable' | 'enable';
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.triggers = void 0;
4
+ exports.triggers = {
5
+ disable: {
6
+ action: 'disable',
7
+ trigger: '_disable',
8
+ description: 'Send this attribute if you want to mark the promotion as disabled.',
9
+ },
10
+ enable: {
11
+ action: 'enable',
12
+ trigger: '_enable',
13
+ description: 'Send this attribute if you want to mark the promotion as enabled.',
14
+ },
15
+ };
@@ -0,0 +1,3 @@
1
+ import type { Trigger } from '../common';
2
+ export declare const triggers: Record<string, Trigger>;
3
+ export type ActionType = 'disable' | 'enable';
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.triggers = void 0;
4
+ exports.triggers = {
5
+ disable: {
6
+ action: 'disable',
7
+ trigger: '_disable',
8
+ description: 'Send this attribute if you want to mark the promotion as disabled.',
9
+ },
10
+ enable: {
11
+ action: 'enable',
12
+ trigger: '_enable',
13
+ description: 'Send this attribute if you want to mark the promotion as enabled.',
14
+ },
15
+ };
@@ -0,0 +1,3 @@
1
+ import type { Trigger } from '../common';
2
+ export declare const triggers: Record<string, Trigger>;
3
+ export type ActionType = 'disable' | 'enable';
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.triggers = void 0;
4
+ exports.triggers = {
5
+ disable: {
6
+ action: 'disable',
7
+ trigger: '_disable',
8
+ description: 'Send this attribute if you want to mark the promotion as disabled.',
9
+ },
10
+ enable: {
11
+ action: 'enable',
12
+ trigger: '_enable',
13
+ description: 'Send this attribute if you want to mark the promotion as enabled.',
14
+ },
15
+ };
@@ -125,7 +125,7 @@ exports.triggers = {
125
125
  create_subscriptions: {
126
126
  action: 'create_subscriptions',
127
127
  trigger: '_create_subscriptions',
128
- description: 'Send this attribute if you want to create order subscriptions from the recurring line items upon/after placing the order. Subscriptions are generated according to associated subscription model strategy.',
128
+ description: 'Send this attribute upon/after placing the order if you want to create order subscriptions from the line items that have a frequency.',
129
129
  },
130
130
  start_editing: {
131
131
  action: 'start_editing',
@@ -0,0 +1,3 @@
1
+ import type { Trigger } from '../common';
2
+ export declare const triggers: Record<string, Trigger>;
3
+ export type ActionType = 'disable' | 'enable';
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.triggers = void 0;
4
+ exports.triggers = {
5
+ disable: {
6
+ action: 'disable',
7
+ trigger: '_disable',
8
+ description: 'Send this attribute if you want to mark the promotion as disabled.',
9
+ },
10
+ enable: {
11
+ action: 'enable',
12
+ trigger: '_enable',
13
+ description: 'Send this attribute if you want to mark the promotion as enabled.',
14
+ },
15
+ };