@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.
- package/README.md +486 -3
- package/lib/commands/buy_x_pay_y_promotion/disable.d.ts +9 -0
- package/lib/commands/buy_x_pay_y_promotion/disable.js +21 -0
- package/lib/commands/buy_x_pay_y_promotion/enable.d.ts +9 -0
- package/lib/commands/buy_x_pay_y_promotion/enable.js +21 -0
- package/lib/commands/buy_x_pay_y_promotion/index.d.ts +9 -0
- package/lib/commands/buy_x_pay_y_promotion/index.js +38 -0
- package/lib/commands/external_promotion/disable.d.ts +9 -0
- package/lib/commands/external_promotion/disable.js +21 -0
- package/lib/commands/external_promotion/enable.d.ts +9 -0
- package/lib/commands/external_promotion/enable.js +21 -0
- package/lib/commands/external_promotion/index.d.ts +9 -0
- package/lib/commands/external_promotion/index.js +38 -0
- package/lib/commands/fixed_amount_promotion/disable.d.ts +9 -0
- package/lib/commands/fixed_amount_promotion/disable.js +21 -0
- package/lib/commands/fixed_amount_promotion/enable.d.ts +9 -0
- package/lib/commands/fixed_amount_promotion/enable.js +21 -0
- package/lib/commands/fixed_amount_promotion/index.d.ts +9 -0
- package/lib/commands/fixed_amount_promotion/index.js +38 -0
- package/lib/commands/fixed_price_promotion/disable.d.ts +9 -0
- package/lib/commands/fixed_price_promotion/disable.js +21 -0
- package/lib/commands/fixed_price_promotion/enable.d.ts +9 -0
- package/lib/commands/fixed_price_promotion/enable.js +21 -0
- package/lib/commands/fixed_price_promotion/index.d.ts +9 -0
- package/lib/commands/fixed_price_promotion/index.js +38 -0
- package/lib/commands/free_gift_promotion/disable.d.ts +9 -0
- package/lib/commands/free_gift_promotion/disable.js +21 -0
- package/lib/commands/free_gift_promotion/enable.d.ts +9 -0
- package/lib/commands/free_gift_promotion/enable.js +21 -0
- package/lib/commands/free_gift_promotion/index.d.ts +9 -0
- package/lib/commands/free_gift_promotion/index.js +38 -0
- package/lib/commands/free_shipping_promotion/disable.d.ts +9 -0
- package/lib/commands/free_shipping_promotion/disable.js +21 -0
- package/lib/commands/free_shipping_promotion/enable.d.ts +9 -0
- package/lib/commands/free_shipping_promotion/enable.js +21 -0
- package/lib/commands/free_shipping_promotion/index.d.ts +9 -0
- package/lib/commands/free_shipping_promotion/index.js +38 -0
- package/lib/commands/percentage_discount_promotion/disable.d.ts +9 -0
- package/lib/commands/percentage_discount_promotion/disable.js +21 -0
- package/lib/commands/percentage_discount_promotion/enable.d.ts +9 -0
- package/lib/commands/percentage_discount_promotion/enable.js +21 -0
- package/lib/commands/percentage_discount_promotion/index.d.ts +9 -0
- package/lib/commands/percentage_discount_promotion/index.js +38 -0
- package/lib/triggers/buy_x_pay_y_promotions.d.ts +3 -0
- package/lib/triggers/buy_x_pay_y_promotions.js +15 -0
- package/lib/triggers/external_promotions.d.ts +3 -0
- package/lib/triggers/external_promotions.js +15 -0
- package/lib/triggers/fixed_amount_promotions.d.ts +3 -0
- package/lib/triggers/fixed_amount_promotions.js +15 -0
- package/lib/triggers/fixed_price_promotions.d.ts +3 -0
- package/lib/triggers/fixed_price_promotions.js +15 -0
- package/lib/triggers/free_gift_promotions.d.ts +3 -0
- package/lib/triggers/free_gift_promotions.js +15 -0
- package/lib/triggers/free_shipping_promotions.d.ts +3 -0
- package/lib/triggers/free_shipping_promotions.js +15 -0
- package/lib/triggers/orders.js +1 -1
- package/lib/triggers/percentage_discount_promotions.d.ts +3 -0
- package/lib/triggers/percentage_discount_promotions.js +15 -0
- package/oclif.manifest.json +1535 -23
- 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,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,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,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,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,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,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
|
+
};
|
package/lib/triggers/orders.js
CHANGED
|
@@ -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
|
|
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,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
|
+
};
|