@twilio/create-flex-plugin 7.1.2 → 7.1.3-alpha.202609291943
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/dist/lib/cli.d.ts +6 -0
- package/dist/lib/cli.js +28 -11
- package/dist/lib/cli.js.map +1 -1
- package/dist/lib/commands.js +10 -11
- package/dist/lib/commands.js.map +1 -1
- package/dist/lib/create-flex-plugin.d.ts +0 -1
- package/dist/lib/create-flex-plugin.js +23 -25
- package/dist/lib/create-flex-plugin.js.map +1 -1
- package/dist/prints/finalMessage.d.ts +1 -1
- package/dist/prints/finalMessage.js +5 -5
- package/dist/prints/finalMessage.js.map +1 -1
- package/dist/utils/github.js +13 -13
- package/dist/utils/github.js.map +1 -1
- package/dist/utils/validators.js +7 -7
- package/dist/utils/validators.js.map +1 -1
- package/package.json +5 -7
- package/templates/js2/package.json +1 -0
- package/templates/ts2/package.json +1 -0
- package/templates/ts2/tsconfig.json +2 -1
- package/templates/js/package.json +0 -19
- package/templates/js/src/DemoPlugin.js +0 -43
- package/templates/js/src/components/CustomTaskList/CustomTaskList.Container.js +0 -15
- package/templates/js/src/components/CustomTaskList/CustomTaskList.Styles.js +0 -14
- package/templates/js/src/components/CustomTaskList/CustomTaskList.jsx +0 -29
- package/templates/js/src/components/__tests__/CustomTaskListComponent.spec.jsx +0 -15
- package/templates/js/src/index.js +0 -5
- package/templates/js/src/states/CustomTaskListState.js +0 -24
- package/templates/js/src/states/index.js +0 -11
- package/templates/ts/package.json +0 -20
- package/templates/ts/src/DemoPlugin.tsx +0 -43
- package/templates/ts/src/components/CustomTaskList/CustomTaskList.Container.ts +0 -24
- package/templates/ts/src/components/CustomTaskList/CustomTaskList.Styles.ts +0 -14
- package/templates/ts/src/components/CustomTaskList/CustomTaskList.tsx +0 -31
- package/templates/ts/src/components/__tests__/CustomTaskListComponent.spec.tsx +0 -15
- package/templates/ts/src/index.ts +0 -5
- package/templates/ts/src/states/CustomTaskListState.ts +0 -30
- package/templates/ts/src/states/index.ts +0 -26
- package/templates/ts/tsconfig.json +0 -36
package/dist/lib/cli.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Options } from 'yargs';
|
|
2
|
+
export declare const FLEX_UI_1_EOL: string;
|
|
2
3
|
export interface CLIArguments {
|
|
3
4
|
accountSid?: string;
|
|
4
5
|
a?: string;
|
|
@@ -16,6 +17,11 @@ export interface CLIArguments {
|
|
|
16
17
|
flexui2?: boolean;
|
|
17
18
|
flexui1?: boolean;
|
|
18
19
|
}
|
|
20
|
+
/**
|
|
21
|
+
* Rejects Flex UI 1.x, which is end of life. `argv` is optional because yargs
|
|
22
|
+
* returns undefined when it exits on a validation failure.
|
|
23
|
+
*/
|
|
24
|
+
export declare const assertFlexUiSupported: (argv?: CLIArguments) => void;
|
|
19
25
|
export default class CLI {
|
|
20
26
|
static description: string;
|
|
21
27
|
static flags: {
|
package/dist/lib/cli.js
CHANGED
|
@@ -14,7 +14,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
14
14
|
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
15
|
function step(op) {
|
|
16
16
|
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
-
while (_) try {
|
|
17
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
18
18
|
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
19
19
|
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
20
|
switch (op[0]) {
|
|
@@ -39,10 +39,22 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
39
39
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
40
40
|
};
|
|
41
41
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
42
|
+
exports.assertFlexUiSupported = exports.FLEX_UI_1_EOL = void 0;
|
|
42
43
|
var yargs_1 = __importDefault(require("yargs"));
|
|
43
44
|
var flex_dev_utils_1 = require("@twilio/flex-dev-utils");
|
|
44
45
|
var create_flex_plugin_1 = require("./create-flex-plugin");
|
|
45
|
-
var usage = flex_dev_utils_1.multilineString('Creates a new Twilio Flex Plugin project', '', 'Arguments:', 'name\tName of your plugin.');
|
|
46
|
+
var usage = (0, flex_dev_utils_1.multilineString)('Creates a new Twilio Flex Plugin project', '', 'Arguments:', 'name\tName of your plugin.');
|
|
47
|
+
exports.FLEX_UI_1_EOL = (0, flex_dev_utils_1.multilineString)('Flex UI 1.x has reached end of life and plugins can no longer be created for it.', 'New plugins target Flex UI 2.', '', 'To migrate an existing Flex UI 1 plugin, run:', ' twilio flex:plugins:upgrade-plugin');
|
|
48
|
+
/**
|
|
49
|
+
* Rejects Flex UI 1.x, which is end of life. `argv` is optional because yargs
|
|
50
|
+
* returns undefined when it exits on a validation failure.
|
|
51
|
+
*/
|
|
52
|
+
var assertFlexUiSupported = function (argv) {
|
|
53
|
+
if (argv === null || argv === void 0 ? void 0 : argv.flexui1) {
|
|
54
|
+
throw new flex_dev_utils_1.FlexPluginError(exports.FLEX_UI_1_EOL);
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
exports.assertFlexUiSupported = assertFlexUiSupported;
|
|
46
58
|
var CLI = /** @class */ (function () {
|
|
47
59
|
function CLI(cwd) {
|
|
48
60
|
var _this = this;
|
|
@@ -58,12 +70,15 @@ var CLI = /** @class */ (function () {
|
|
|
58
70
|
switch (_a.label) {
|
|
59
71
|
case 0:
|
|
60
72
|
argv = this.parser.parse(args);
|
|
61
|
-
return [4 /*yield*/, flex_dev_utils_1.runner(function () { return __awaiter(_this, void 0, void 0, function () {
|
|
62
|
-
return
|
|
63
|
-
|
|
73
|
+
return [4 /*yield*/, (0, flex_dev_utils_1.runner)(function () { return __awaiter(_this, void 0, void 0, function () {
|
|
74
|
+
return __generator(this, function (_a) {
|
|
75
|
+
(0, exports.assertFlexUiSupported)(argv);
|
|
76
|
+
return [2 /*return*/, (0, create_flex_plugin_1.createFlexPlugin)(argv)];
|
|
77
|
+
});
|
|
78
|
+
}); })];
|
|
64
79
|
case 1:
|
|
65
80
|
_a.sent();
|
|
66
|
-
flex_dev_utils_1.exit(0);
|
|
81
|
+
(0, flex_dev_utils_1.exit)(0);
|
|
67
82
|
return [2 /*return*/];
|
|
68
83
|
}
|
|
69
84
|
});
|
|
@@ -73,7 +88,7 @@ var CLI = /** @class */ (function () {
|
|
|
73
88
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
74
89
|
_this.parser.usage('$0 <name>', usage, CLI.flags);
|
|
75
90
|
};
|
|
76
|
-
this.parser = yargs_1.default([], cwd);
|
|
91
|
+
this.parser = (0, yargs_1.default)([], cwd);
|
|
77
92
|
this.init();
|
|
78
93
|
}
|
|
79
94
|
CLI.description = usage;
|
|
@@ -121,15 +136,17 @@ var CLI = /** @class */ (function () {
|
|
|
121
136
|
version: {
|
|
122
137
|
alias: 'v',
|
|
123
138
|
},
|
|
139
|
+
/*
|
|
140
|
+
* Still registered so that `--flexui1` fails with the message below rather than
|
|
141
|
+
* yargs' generic "Unknown argument"; Flex UI 1 is EOL and cannot be scaffolded.
|
|
142
|
+
*/
|
|
124
143
|
flexui1: {
|
|
125
144
|
type: 'boolean',
|
|
126
|
-
describe: '
|
|
127
|
-
conflicts: 'flexui2',
|
|
145
|
+
describe: 'No longer supported - Flex UI 1.x is end of life',
|
|
128
146
|
},
|
|
129
147
|
flexui2: {
|
|
130
148
|
type: 'boolean',
|
|
131
|
-
describe: 'Creates a plugin compatible with Flex UI major version 2.0',
|
|
132
|
-
conflicts: 'flexui1',
|
|
149
|
+
describe: 'Creates a plugin compatible with Flex UI major version 2.0 (the only supported version)',
|
|
133
150
|
},
|
|
134
151
|
};
|
|
135
152
|
return CLI;
|
package/dist/lib/cli.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../../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ApFoB,GAAG"}
|
package/dist/lib/commands.js
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
3
|
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
5
9
|
}) : (function(o, m, k, k2) {
|
|
6
10
|
if (k2 === undefined) k2 = k;
|
|
7
11
|
o[k2] = m[k];
|
|
@@ -33,7 +37,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
33
37
|
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
34
38
|
function step(op) {
|
|
35
39
|
if (f) throw new TypeError("Generator is already executing.");
|
|
36
|
-
while (_) try {
|
|
40
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
37
41
|
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
38
42
|
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
39
43
|
switch (op[0]) {
|
|
@@ -62,7 +66,7 @@ var lodash_1 = require("@twilio/flex-dev-utils/dist/lodash");
|
|
|
62
66
|
var flex_dev_utils_1 = require("@twilio/flex-dev-utils");
|
|
63
67
|
var github = __importStar(require("../utils/github"));
|
|
64
68
|
// eslint-disable-next-line @typescript-eslint/no-var-requires, global-require, @typescript-eslint/no-require-imports
|
|
65
|
-
var pkg = require(fs_1.findUp(__filename, 'package.json'));
|
|
69
|
+
var pkg = require((0, fs_1.findUp)(__filename, 'package.json'));
|
|
66
70
|
/**
|
|
67
71
|
* Install dependencies
|
|
68
72
|
*
|
|
@@ -80,7 +84,7 @@ var installDependencies = function (config) { return __awaiter(void 0, void 0, v
|
|
|
80
84
|
cwd: config.targetDirectory,
|
|
81
85
|
shell: process.env.SHELL,
|
|
82
86
|
};
|
|
83
|
-
return [4 /*yield*/, spawn_1.spawn(shellCmd, args, options)];
|
|
87
|
+
return [4 /*yield*/, (0, spawn_1.spawn)(shellCmd, args, options)];
|
|
84
88
|
case 1:
|
|
85
89
|
_a = _b.sent(), stdout = _a.stdout, exitCode = _a.exitCode, stderr = _a.stderr;
|
|
86
90
|
if (exitCode === 1) {
|
|
@@ -103,10 +107,10 @@ var setupConfiguration = function (config) { return __awaiter(void 0, void 0, vo
|
|
|
103
107
|
switch (_b.label) {
|
|
104
108
|
case 0:
|
|
105
109
|
name = config.name || '';
|
|
106
|
-
config.pluginClassName = lodash_1.upperFirst(lodash_1.camelCase(name)).replace('Plugin', '')
|
|
110
|
+
config.pluginClassName = "".concat((0, lodash_1.upperFirst)((0, lodash_1.camelCase)(name)).replace('Plugin', ''), "Plugin");
|
|
107
111
|
config.pluginNamespace = name.toLowerCase().replace('plugin-', '');
|
|
108
112
|
config.runtimeUrl = config.runtimeUrl || 'http://localhost:3000';
|
|
109
|
-
config.targetDirectory = fs_1.resolveCwd(name);
|
|
113
|
+
config.targetDirectory = (0, fs_1.resolveCwd)(name);
|
|
110
114
|
_a = config;
|
|
111
115
|
return [4 /*yield*/, flex_dev_utils_1.packages.getLatestFlexUIVersion(2)];
|
|
112
116
|
case 1:
|
|
@@ -114,11 +118,6 @@ var setupConfiguration = function (config) { return __awaiter(void 0, void 0, vo
|
|
|
114
118
|
config.pluginScriptsVersion = pkg.devDependencies['@twilio/flex-plugin-scripts'];
|
|
115
119
|
config.flexPluginVersion = pkg.devDependencies['@twilio/flex-plugin'];
|
|
116
120
|
config.flexui2 = config.flexui2 || true;
|
|
117
|
-
config.flexui1 = config.flexui1 || false;
|
|
118
|
-
// Upgrade to latest Flex UI Version for 1.0 if selected
|
|
119
|
-
if (config.flexui1) {
|
|
120
|
-
config.flexSdkVersion = pkg.devDependencies['@twilio/flex-ui'];
|
|
121
|
-
}
|
|
122
121
|
return [2 /*return*/, config];
|
|
123
122
|
}
|
|
124
123
|
});
|
package/dist/lib/commands.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"commands.js","sourceRoot":"","sources":["../../src/lib/commands.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"commands.js","sourceRoot":"","sources":["../../src/lib/commands.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,qDAAoE;AACpE,2DAA0D;AAC1D,6DAA2E;AAC3E,yDAAkD;AAElD,sDAA0C;AAG1C,qHAAqH;AACrH,IAAM,GAAG,GAAG,OAAO,CAAC,IAAA,WAAM,EAAC,UAAU,EAAE,cAAc,CAAC,CAAC,CAAC;AAExD;;;;;GAKG;AACI,IAAM,mBAAmB,GAAG,UAAO,MAA2B;;;;;gBAC7D,QAAQ,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,KAAK,CAAC;gBACxC,IAAI,GAAG,CAAC,SAAS,CAAC,CAAC;gBACnB,OAAO,GAAG;oBACd,GAAG,EAAE,MAAM,CAAC,eAAe;oBAC3B,KAAK,EAAE,OAAO,CAAC,GAAG,CAAC,KAAK;iBACzB,CAAC;gBAEmC,qBAAM,IAAA,aAAK,EAAC,QAAQ,EAAE,IAAI,EAAE,OAAO,CAAC,EAAA;;gBAAnE,KAA+B,SAAoC,EAAjE,MAAM,YAAA,EAAE,QAAQ,cAAA,EAAE,MAAM,YAAA;gBAEhC,IAAI,QAAQ,KAAK,CAAC,EAAE;oBAClB,MAAM,IAAI,KAAK,CAAC,MAAM,CAAC,CAAC;iBACzB;gBAED,sBAAO,MAAM,EAAC;;;KACf,CAAC;AAfW,QAAA,mBAAmB,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@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
14
14
|
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
15
|
function step(op) {
|
|
16
16
|
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
-
while (_) try {
|
|
17
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
18
18
|
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
19
19
|
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
20
|
switch (op[0]) {
|
|
@@ -48,12 +48,10 @@ var tmp_1 = require("tmp");
|
|
|
48
48
|
var commands_1 = require("./commands");
|
|
49
49
|
var finalMessage_1 = __importDefault(require("../prints/finalMessage"));
|
|
50
50
|
var validators_1 = __importDefault(require("../utils/validators"));
|
|
51
|
-
var templatesRootDir = path_1.resolve(__dirname, '../../templates');
|
|
52
|
-
var templateCorePath = path_1.resolve(templatesRootDir, 'core');
|
|
53
|
-
var
|
|
54
|
-
var
|
|
55
|
-
var templateJs2Path = path_1.resolve(templatesRootDir, 'js2');
|
|
56
|
-
var templateTs2Path = path_1.resolve(templatesRootDir, 'ts2');
|
|
51
|
+
var templatesRootDir = (0, path_1.resolve)(__dirname, '../../templates');
|
|
52
|
+
var templateCorePath = (0, path_1.resolve)(templatesRootDir, 'core');
|
|
53
|
+
var templateJs2Path = (0, path_1.resolve)(templatesRootDir, 'js2');
|
|
54
|
+
var templateTs2Path = (0, path_1.resolve)(templatesRootDir, 'ts2');
|
|
57
55
|
/**
|
|
58
56
|
* Runs the NPM Installation
|
|
59
57
|
* @param config {FlexPluginArguments} the configuration
|
|
@@ -61,10 +59,10 @@ var templateTs2Path = path_1.resolve(templatesRootDir, 'ts2');
|
|
|
61
59
|
*/
|
|
62
60
|
var _install = function (config) { return __awaiter(void 0, void 0, void 0, function () {
|
|
63
61
|
return __generator(this, function (_a) {
|
|
64
|
-
return [2 /*return*/, flex_dev_utils_1.progress('Installing dependencies', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
62
|
+
return [2 /*return*/, (0, flex_dev_utils_1.progress)('Installing dependencies', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
65
63
|
return __generator(this, function (_a) {
|
|
66
64
|
switch (_a.label) {
|
|
67
|
-
case 0: return [4 /*yield*/, commands_1.installDependencies(config)];
|
|
65
|
+
case 0: return [4 /*yield*/, (0, commands_1.installDependencies)(config)];
|
|
68
66
|
case 1:
|
|
69
67
|
_a.sent();
|
|
70
68
|
return [2 /*return*/, true];
|
|
@@ -83,37 +81,37 @@ exports._install = _install;
|
|
|
83
81
|
var _scaffold = function (config) { return __awaiter(void 0, void 0, void 0, function () {
|
|
84
82
|
var dirObject, promise, cleanUp;
|
|
85
83
|
return __generator(this, function (_a) {
|
|
86
|
-
promise = flex_dev_utils_1.progress('Creating project directory', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
84
|
+
promise = (0, flex_dev_utils_1.progress)('Creating project directory', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
87
85
|
var srcPath, ext;
|
|
88
86
|
return __generator(this, function (_a) {
|
|
89
87
|
switch (_a.label) {
|
|
90
88
|
case 0:
|
|
91
89
|
// This copies the core such as public/
|
|
92
|
-
return [4 /*yield*/, fs_2.copyTemplateDir(templateCorePath, config.targetDirectory, config)];
|
|
90
|
+
return [4 /*yield*/, (0, fs_2.copyTemplateDir)(templateCorePath, config.targetDirectory, config)];
|
|
93
91
|
case 1:
|
|
94
92
|
// This copies the core such as public/
|
|
95
93
|
_a.sent();
|
|
96
|
-
srcPath =
|
|
94
|
+
srcPath = templateJs2Path;
|
|
97
95
|
if (config.typescript) {
|
|
98
|
-
srcPath =
|
|
96
|
+
srcPath = templateTs2Path;
|
|
99
97
|
}
|
|
100
98
|
if (!config.template) return [3 /*break*/, 3];
|
|
101
|
-
dirObject = tmp_1.dirSync();
|
|
102
|
-
return [4 /*yield*/, commands_1.downloadFromGitHub(config.template, dirObject.name)];
|
|
99
|
+
dirObject = (0, tmp_1.dirSync)();
|
|
100
|
+
return [4 /*yield*/, (0, commands_1.downloadFromGitHub)(config.template, dirObject.name)];
|
|
103
101
|
case 2:
|
|
104
102
|
_a.sent();
|
|
105
103
|
srcPath = dirObject.name;
|
|
106
104
|
_a.label = 3;
|
|
107
105
|
case 3:
|
|
108
106
|
// This copies the src/ directory
|
|
109
|
-
return [4 /*yield*/, fs_2.copyTemplateDir(srcPath, config.targetDirectory, config)];
|
|
107
|
+
return [4 /*yield*/, (0, fs_2.copyTemplateDir)(srcPath, config.targetDirectory, config)];
|
|
110
108
|
case 4:
|
|
111
109
|
// This copies the src/ directory
|
|
112
110
|
_a.sent();
|
|
113
111
|
// Rename plugins
|
|
114
112
|
if (!dirObject) {
|
|
115
113
|
ext = config.typescript ? 'tsx' : 'js';
|
|
116
|
-
fs_1.default.renameSync(path_1.join(config.targetDirectory, "src/DemoPlugin."
|
|
114
|
+
fs_1.default.renameSync((0, path_1.join)(config.targetDirectory, "src/DemoPlugin.".concat(ext)), (0, path_1.join)(config.targetDirectory, "src/".concat(config.pluginClassName, ".").concat(ext)));
|
|
117
115
|
}
|
|
118
116
|
return [2 /*return*/, true];
|
|
119
117
|
}
|
|
@@ -159,30 +157,30 @@ var createFlexPlugin = function (config) { return __awaiter(void 0, void 0, void
|
|
|
159
157
|
switch (_b.label) {
|
|
160
158
|
case 0:
|
|
161
159
|
start = performance.now();
|
|
162
|
-
return [4 /*yield*/, validators_1.default(config)];
|
|
160
|
+
return [4 /*yield*/, (0, validators_1.default)(config)];
|
|
163
161
|
case 1:
|
|
164
162
|
config = _b.sent();
|
|
165
|
-
return [4 /*yield*/, commands_1.setupConfiguration(config)];
|
|
163
|
+
return [4 /*yield*/, (0, commands_1.setupConfiguration)(config)];
|
|
166
164
|
case 2:
|
|
167
165
|
config = _b.sent();
|
|
168
166
|
// Check folder does not exist
|
|
169
167
|
if (fs_1.default.existsSync(config.targetDirectory)) {
|
|
170
|
-
throw new flex_dev_utils_1.FlexPluginError(flex_dev_utils_1.singleLineString("Path "
|
|
168
|
+
throw new flex_dev_utils_1.FlexPluginError((0, flex_dev_utils_1.singleLineString)("Path ".concat(flex_dev_utils_1.logger.coloredStrings.link(config.targetDirectory), " already exists;"), 'please remove it and try again.'));
|
|
171
169
|
}
|
|
172
|
-
return [4 /*yield*/, exports._scaffold(config)];
|
|
170
|
+
return [4 /*yield*/, (0, exports._scaffold)(config)];
|
|
173
171
|
case 3:
|
|
174
172
|
// Setup the directories
|
|
175
173
|
if (!(_b.sent())) {
|
|
176
174
|
throw new flex_dev_utils_1.FlexPluginError('Failed to scaffold project');
|
|
177
175
|
}
|
|
178
176
|
// Add new plugin to .twilio-cli/flex/plugins.json
|
|
179
|
-
return [4 /*yield*/, fs_2.checkPluginConfigurationExists(config.name, config.targetDirectory)];
|
|
177
|
+
return [4 /*yield*/, (0, fs_2.checkPluginConfigurationExists)(config.name, config.targetDirectory)];
|
|
180
178
|
case 4:
|
|
181
179
|
// Add new plugin to .twilio-cli/flex/plugins.json
|
|
182
180
|
_b.sent();
|
|
183
181
|
_a = config.install;
|
|
184
182
|
if (!_a) return [3 /*break*/, 6];
|
|
185
|
-
return [4 /*yield*/, exports._install(config)];
|
|
183
|
+
return [4 /*yield*/, (0, exports._install)(config)];
|
|
186
184
|
case 5:
|
|
187
185
|
_a = !(_b.sent());
|
|
188
186
|
_b.label = 6;
|
|
@@ -192,9 +190,9 @@ var createFlexPlugin = function (config) { return __awaiter(void 0, void 0, void
|
|
|
192
190
|
flex_dev_utils_1.logger.error('Failed to install dependencies. Please run `npm install` manually.');
|
|
193
191
|
config.install = false;
|
|
194
192
|
}
|
|
195
|
-
finalMessage_1.default(config);
|
|
193
|
+
(0, finalMessage_1.default)(config);
|
|
196
194
|
end = performance.now();
|
|
197
|
-
exports.track(end - start, config);
|
|
195
|
+
(0, exports.track)(end - start, config);
|
|
198
196
|
return [2 /*return*/];
|
|
199
197
|
}
|
|
200
198
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-flex-plugin.js","sourceRoot":"","sources":["../../src/lib/create-flex-plugin.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,0CAAoB;AACpB,6BAAqC;AAErC,yDAOgC;AAChC,qDAAiG;AACjG,2BAAuE;AAEvE,uCAAyF;AAEzF,wEAAkD;AAClD,mEAA2C;AAE3C,IAAM,gBAAgB,GAAG,cAAO,
|
|
1
|
+
{"version":3,"file":"create-flex-plugin.js","sourceRoot":"","sources":["../../src/lib/create-flex-plugin.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,0CAAoB;AACpB,6BAAqC;AAErC,yDAOgC;AAChC,qDAAiG;AACjG,2BAAuE;AAEvE,uCAAyF;AAEzF,wEAAkD;AAClD,mEAA2C;AAE3C,IAAM,gBAAgB,GAAG,IAAA,cAAO,EAAC,SAAS,EAAE,iBAAiB,CAAC,CAAC;AAC/D,IAAM,gBAAgB,GAAG,IAAA,cAAO,EAAC,gBAAgB,EAAE,MAAM,CAAC,CAAC;AAC3D,IAAM,eAAe,GAAG,IAAA,cAAO,EAAC,gBAAgB,EAAE,KAAK,CAAC,CAAC;AACzD,IAAM,eAAe,GAAG,IAAA,cAAO,EAAC,gBAAgB,EAAE,KAAK,CAAC,CAAC;AAazD;;;;GAIG;AACI,IAAM,QAAQ,GAAG,UAAO,MAA2B;;QACxD,sBAAO,IAAA,yBAAQ,EAAC,yBAAyB,EAAE;;;gCACzC,qBAAM,IAAA,8BAAmB,EAAC,MAAM,CAAC,EAAA;;4BAAjC,SAAiC,CAAC;4BAElC,sBAAO,IAAI,EAAC;;;iBACb,CAAC,EAAC;;KACJ,CAAC;AANW,QAAA,QAAQ,YAMnB;AAEF;;;;;GAKG;AACI,IAAM,SAAS,GAAG,UAAO,MAA2B;;;QAGnD,OA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AM,IAAA,iBAAS,EAAC,MAAM,CAAC,EAAA;;gBAD7B,wBAAwB;gBACxB,IAAI,CAAC,CAAC,SAAuB,CAAC,EAAE;oBAC9B,MAAM,IAAI,gCAAe,CAAC,4BAA4B,CAAC,CAAC;iBACzD;gBAED,kDAAkD;gBAClD,qBAAM,IAAA,mCAA8B,EAAC,MAAM,CAAC,IAAI,EAAE,MAAM,CAAC,eAAe,CAAC,EAAA;;gBADzE,kDAAkD;gBAClD,SAAyE,CAAC;gBAGtE,KAAA,MAAM,CAAC,OAAO,CAAA;yBAAd,wBAAc;gBAAM,qBAAM,IAAA,gBAAQ,EAAC,MAAM,CAAC,EAAA;;gBAAxB,KAAA,CAAC,CAAC,SAAsB,CAAC,CAAA;;;gBAD/C,2BAA2B;gBAC3B,QAAiD;oBAC/C,uBAAM,CAAC,KAAK,CAAC,oEAAoE,CAAC,CAAC;oBACnF,MAAM,CAAC,OAAO,GAAG,KAAK,CAAC;iBACxB;gBAED,IAAA,sBAAY,EAAC,MAAM,CAAC,CAAC;gBACf,GAAG,GAAG,WAAW,CAAC,GAAG,EAAE,CAAC;gBAC9B,IAAA,aAAK,EAAC,GAAG,GAAG,KAAK,EAAE,MAAM,CAAC,CAAC;;;;KAC5B,CAAC;AAhCW,QAAA,gBAAgB,oBAgC3B;AAEF,kBAAe,wBAAgB,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { FlexPluginArguments } from '../lib/create-flex-plugin';
|
|
2
|
-
declare const _default: (config: FlexPluginArguments) => void;
|
|
3
2
|
/**
|
|
4
3
|
* Prints the final message after the successful creation of a new project
|
|
5
4
|
* @param config
|
|
6
5
|
*/
|
|
6
|
+
declare const _default: (config: FlexPluginArguments) => void;
|
|
7
7
|
export default _default;
|
|
@@ -8,11 +8,11 @@ var headline = flex_dev_utils_1.logger.coloredStrings.headline;
|
|
|
8
8
|
*/
|
|
9
9
|
exports.default = (function (config) {
|
|
10
10
|
var installCommand = config.yarn ? 'yarn install' : 'npm install';
|
|
11
|
-
var setupMessage = flex_dev_utils_1.multilineString(""
|
|
12
|
-
var devMessage = flex_dev_utils_1.multilineString(""
|
|
13
|
-
var buildMessage = flex_dev_utils_1.multilineString(""
|
|
14
|
-
var deployMessage = flex_dev_utils_1.multilineString(""
|
|
15
|
-
var message = flex_dev_utils_1.multilineString("Your Twilio Flex Plugin project has been successfully created!", (config.install ? '' : "\n\n "
|
|
11
|
+
var setupMessage = (0, flex_dev_utils_1.multilineString)("".concat(headline('Setup:')), "$ cd ".concat(config.name, "/"), "$ ".concat(installCommand));
|
|
12
|
+
var devMessage = (0, flex_dev_utils_1.multilineString)("".concat(headline('Development:')), "$ cd ".concat(config.name, "/"), "$ twilio flex:plugins:start");
|
|
13
|
+
var buildMessage = (0, flex_dev_utils_1.multilineString)("".concat(headline('Build Command:')), "$ cd ".concat(config.name, "/"), "$ twilio flex:plugins:build");
|
|
14
|
+
var deployMessage = (0, flex_dev_utils_1.multilineString)("".concat(headline('Deploy Command:')), "$ cd ".concat(config.name, "/"), "$ twilio flex:plugins:deploy");
|
|
15
|
+
var message = (0, flex_dev_utils_1.multilineString)("Your Twilio Flex Plugin project has been successfully created!", "".concat(config.install ? '' : "\n\n ".concat(setupMessage), "\n"), "".concat(devMessage, "\n"), "".concat(buildMessage, "\n"), "".concat(deployMessage, "\n"), 'For more info check the README.md file or go to:', '➡ https://www.twilio.com/docs/flex');
|
|
16
16
|
var columns = (process.stdout.columns || 100) - 14;
|
|
17
17
|
message = flex_dev_utils_1.logger.wrap(message, columns, { hard: true });
|
|
18
18
|
flex_dev_utils_1.boxen.info(message, false);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"finalMessage.js","sourceRoot":"","sources":["../../src/prints/finalMessage.ts"],"names":[],"mappings":";;AAAA,yDAAwE;AAIhE,IAAA,QAAQ,GAAK,uBAAM,CAAC,cAAc,SAA1B,CAA2B;AAE3C;;;GAGG;AACH,mBAAe,UAAC,MAA2B;IACzC,IAAM,c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I,EACpB,kDAAkD,EAClD,oCAAoC,CACrC,CAAC;IAEF,IAAM,OAAO,GAAG,CAAC,OAAO,CAAC,MAAM,CAAC,OAAO,IAAI,GAAG,CAAC,GAAG,EAAE,CAAC;IACrD,OAAO,GAAG,uBAAM,CAAC,IAAI,CAAC,OAAO,EAAE,OAAO,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;IAExD,sBAAK,CAAC,IAAI,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;AAC7B,CAAC,EAAC"}
|
package/dist/utils/github.js
CHANGED
|
@@ -14,7 +14,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
14
14
|
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
15
|
function step(op) {
|
|
16
16
|
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
-
while (_) try {
|
|
17
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
18
18
|
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
19
19
|
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
20
|
switch (op[0]) {
|
|
@@ -57,9 +57,9 @@ exports.ERROR_BRANCH_MASTER_MAIN = 'Could not find branch main or master on GitH
|
|
|
57
57
|
* @private
|
|
58
58
|
*/
|
|
59
59
|
var _getBaseRegex = function (info, hasTemplateDir) {
|
|
60
|
-
var baseRegex = "/"
|
|
60
|
+
var baseRegex = "/".concat(info.owner, "/").concat(info.repo, "/").concat(info.ref, "/");
|
|
61
61
|
if (hasTemplateDir) {
|
|
62
|
-
return baseRegex
|
|
62
|
+
return "".concat(baseRegex, "template/");
|
|
63
63
|
}
|
|
64
64
|
return baseRegex;
|
|
65
65
|
};
|
|
@@ -72,7 +72,7 @@ exports._getBaseRegex = _getBaseRegex;
|
|
|
72
72
|
var _hasTemplateDir = function (info) { return __awaiter(void 0, void 0, void 0, function () {
|
|
73
73
|
var url;
|
|
74
74
|
return __generator(this, function (_a) {
|
|
75
|
-
url = "https://api.github.com/repos/"
|
|
75
|
+
url = "https://api.github.com/repos/".concat(info.owner, "/").concat(info.repo, "/contents?ref=").concat(info.ref);
|
|
76
76
|
return [2 /*return*/, flex_dev_utils_1.HttpClient.get(url).then(function (contents) {
|
|
77
77
|
return contents.some(function (content) { return content.name === 'template' && content.type === 'dir'; });
|
|
78
78
|
})];
|
|
@@ -111,18 +111,18 @@ var _downloadDir = function (url, dir, baseRegex) { return __awaiter(void 0, voi
|
|
|
111
111
|
var regex, relativePath, output;
|
|
112
112
|
return __generator(this, function (_a) {
|
|
113
113
|
if (content.type === GitHubContentType.Dir) {
|
|
114
|
-
return [2 /*return*/, exports._downloadDir(content.url, dir, baseRegex)];
|
|
114
|
+
return [2 /*return*/, (0, exports._downloadDir)(content.url, dir, baseRegex)];
|
|
115
115
|
}
|
|
116
116
|
if (content.type !== GitHubContentType.File) {
|
|
117
|
-
throw new Error("Unexpected content type "
|
|
117
|
+
throw new Error("Unexpected content type ".concat(content.type));
|
|
118
118
|
}
|
|
119
|
-
regex = new RegExp(baseRegex
|
|
119
|
+
regex = new RegExp("".concat(baseRegex, "(.+)\\??"));
|
|
120
120
|
relativePath = content.download_url.match(regex);
|
|
121
121
|
if (!relativePath || relativePath.length !== 2) {
|
|
122
122
|
throw new Error('Received invalid URL template');
|
|
123
123
|
}
|
|
124
124
|
output = path_1.default.resolve(dir, relativePath[1]);
|
|
125
|
-
return [2 /*return*/, exports._downloadFile(content.download_url, output)];
|
|
125
|
+
return [2 /*return*/, (0, exports._downloadFile)(content.download_url, output)];
|
|
126
126
|
});
|
|
127
127
|
}); });
|
|
128
128
|
return [4 /*yield*/, Promise.all(promises)];
|
|
@@ -156,7 +156,7 @@ var parseGitHubUrl = function (url) { return __awaiter(void 0, void 0, void 0, f
|
|
|
156
156
|
ref: matches[4] || 'master',
|
|
157
157
|
};
|
|
158
158
|
if (!(info.ref === 'master' || info.ref === 'main')) return [3 /*break*/, 2];
|
|
159
|
-
return [4 /*yield*/, flex_dev_utils_1.HttpClient.get("https://api.github.com/repos/"
|
|
159
|
+
return [4 /*yield*/, flex_dev_utils_1.HttpClient.get("https://api.github.com/repos/".concat(info.owner, "/").concat(info.repo, "/branches"))];
|
|
160
160
|
case 1:
|
|
161
161
|
branches = _a.sent();
|
|
162
162
|
hasMaster = branches.find(function (branch) { return branch.name === 'master'; });
|
|
@@ -187,13 +187,13 @@ var downloadRepo = function (info, dir) { return __awaiter(void 0, void 0, void
|
|
|
187
187
|
var hasTemplateDir, url;
|
|
188
188
|
return __generator(this, function (_a) {
|
|
189
189
|
switch (_a.label) {
|
|
190
|
-
case 0: return [4 /*yield*/, exports._hasTemplateDir(info)];
|
|
190
|
+
case 0: return [4 /*yield*/, (0, exports._hasTemplateDir)(info)];
|
|
191
191
|
case 1:
|
|
192
192
|
hasTemplateDir = _a.sent();
|
|
193
193
|
url = hasTemplateDir
|
|
194
|
-
? "https://api.github.com/repos/"
|
|
195
|
-
: "https://api.github.com/repos/"
|
|
196
|
-
return [2 /*return*/, exports._downloadDir(url, dir, exports._getBaseRegex(info, hasTemplateDir))];
|
|
194
|
+
? "https://api.github.com/repos/".concat(info.owner, "/").concat(info.repo, "/contents/template?ref=").concat(info.ref)
|
|
195
|
+
: "https://api.github.com/repos/".concat(info.owner, "/").concat(info.repo, "/contents?ref=").concat(info.ref);
|
|
196
|
+
return [2 /*return*/, (0, exports._downloadDir)(url, dir, (0, exports._getBaseRegex)(info, hasTemplateDir))];
|
|
197
197
|
}
|
|
198
198
|
});
|
|
199
199
|
}); };
|
package/dist/utils/github.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"github.js","sourceRoot":"","sources":["../../src/utils/github.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,8BAA8B;AAC9B,8CAAwB;AAExB,yDAAoD;A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AAsB,CAAC,CAAC;gBAElE,IAAI,OAAO,EAAE;oBACX,IAAI,CAAC,GAAG,GAAG,MAAM,CAAC;iBACnB;qBAAM,IAAI,SAAS,EAAE;oBACpB,IAAI,CAAC,GAAG,GAAG,QAAQ,CAAC;iBACrB;qBAAM;oBACL,MAAM,IAAI,KAAK,CAAC,gCAAwB,CAAC,CAAC;iBAC3C;;oBAGH,sBAAO,IAAI,EAAC;;;KACb,CAAC;AA/BW,QAAA,cAAc,kBA+BzB;AAEF;;;;;;GAMG;AACI,IAAM,YAAY,GAAG,UAAO,IAAgB,EAAE,GAAW;;;;oBACvC,qBAAM,IAAA,uBAAe,EAAC,IAAI,CAAC,EAAA;;gBAA5C,cAAc,GAAG,SAA2B;gBAE5C,GAAG,GAAG,cAAc;oBACxB,CAAC,CAAC,uCAAgC,IAAI,CAAC,KAAK,cAAI,IAAI,CAAC,IAAI,oCAA0B,IAAI,CAAC,GAAG,CAAE;oBAC7F,CAAC,CAAC,uCAAgC,IAAI,CAAC,KAAK,cAAI,IAAI,CAAC,IAAI,2BAAiB,IAAI,CAAC,GAAG,CAAE,CAAC;gBAEvF,sBAAO,IAAA,oBAAY,EAAC,GAAG,EAAE,GAAG,EAAE,IAAA,qBAAa,EAAC,IAAI,EAAE,cAAc,CAAC,CAAC,EAAC;;;KACpE,CAAC;AARW,QAAA,YAAY,gBAQvB"}
|
package/dist/utils/validators.js
CHANGED
|
@@ -14,7 +14,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
14
14
|
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
15
|
function step(op) {
|
|
16
16
|
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
-
while (_) try {
|
|
17
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
18
18
|
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
19
19
|
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
20
|
switch (op[0]) {
|
|
@@ -46,7 +46,7 @@ var validators_1 = require("@twilio/flex-dev-utils/dist/validators");
|
|
|
46
46
|
*/
|
|
47
47
|
var _promptForAccountSid = function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
48
48
|
return __generator(this, function (_a) {
|
|
49
|
-
return [2 /*return*/, flex_dev_utils_1.prompt({
|
|
49
|
+
return [2 /*return*/, (0, flex_dev_utils_1.prompt)({
|
|
50
50
|
type: 'input',
|
|
51
51
|
name: 'accountSid',
|
|
52
52
|
message: 'Twilio Flex Account SID',
|
|
@@ -61,7 +61,7 @@ exports._promptForAccountSid = _promptForAccountSid;
|
|
|
61
61
|
*/
|
|
62
62
|
var _promptForTemplateUrl = function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
63
63
|
return __generator(this, function (_a) {
|
|
64
|
-
return [2 /*return*/, flex_dev_utils_1.prompt({
|
|
64
|
+
return [2 /*return*/, (0, flex_dev_utils_1.prompt)({
|
|
65
65
|
type: 'input',
|
|
66
66
|
name: 'template',
|
|
67
67
|
message: 'Template URL',
|
|
@@ -82,16 +82,16 @@ var validate = function (config) { return __awaiter(void 0, void 0, void 0, func
|
|
|
82
82
|
switch (_c.label) {
|
|
83
83
|
case 0:
|
|
84
84
|
config.name = config.name || '';
|
|
85
|
-
if (!(config.accountSid && !sids_1.isSidOfType(config.accountSid, sids_1.SidPrefix.AccountSid))) return [3 /*break*/, 2];
|
|
85
|
+
if (!(config.accountSid && !(0, sids_1.isSidOfType)(config.accountSid, sids_1.SidPrefix.AccountSid))) return [3 /*break*/, 2];
|
|
86
86
|
_a = config;
|
|
87
|
-
return [4 /*yield*/, exports._promptForAccountSid()];
|
|
87
|
+
return [4 /*yield*/, (0, exports._promptForAccountSid)()];
|
|
88
88
|
case 1:
|
|
89
89
|
_a.accountSid = _c.sent();
|
|
90
90
|
_c.label = 2;
|
|
91
91
|
case 2:
|
|
92
|
-
if (!(config.template && !validators_1.isValidUrl(config.template))) return [3 /*break*/, 4];
|
|
92
|
+
if (!(config.template && !(0, validators_1.isValidUrl)(config.template))) return [3 /*break*/, 4];
|
|
93
93
|
_b = config;
|
|
94
|
-
return [4 /*yield*/, exports._promptForTemplateUrl()];
|
|
94
|
+
return [4 /*yield*/, (0, exports._promptForTemplateUrl)()];
|
|
95
95
|
case 3:
|
|
96
96
|
_b.template = _c.sent();
|
|
97
97
|
_c.label = 4;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validators.js","sourceRoot":"","sources":["../../src/utils/validators.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,yDAAgD;AAChD,yDAA0E;AAC1E,qEAA2G;AAI3G;;;GAGG;AACI,IAAM,oBAAoB,GAAG;;QAClC,sBAAO,uBAAM,
|
|
1
|
+
{"version":3,"file":"validators.js","sourceRoot":"","sources":["../../src/utils/validators.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,yDAAgD;AAChD,yDAA0E;AAC1E,qEAA2G;AAI3G;;;GAGG;AACI,IAAM,oBAAoB,GAAG;;QAClC,sBAAO,IAAA,uBAAM,EAAC;gBACZ,IAAI,EAAE,OAAO;gBACb,IAAI,EAAE,YAAY;gBAClB,OAAO,EAAE,yBAAyB;gBAClC,QAAQ,EAAE,+BAAkB;aAC7B,CAAC,EAAC;;KACJ,CAAC;AAPW,QAAA,oBAAoB,wBAO/B;AAEF;;;GAGG;AACI,IAAM,qBAAqB,GAAG;;QACnC,sBAAO,IAAA,uBAAM,EAAC;gBACZ,IAAI,EAAE,OAAO;gBACb,IAAI,EAAE,UAAU;gBAChB,OAAO,EAAE,cAAc;gBACvB,QAAQ,EAAE,8BAAiB;aAC5B,CAAC,EAAC;;KACJ,CAAC;AAPW,QAAA,qBAAqB,yBAOhC;AAEF;;;;;GAKG;AACH,IAAM,QAAQ,GAAG,UAAO,MAA2B;;;;;gBACjD,MAAM,CAAC,IAAI,GAAG,MAAM,CAAC,IAAI,IAAI,EAAE,CAAC;qBAE5B,CAAA,MAAM,CAAC,UAAU,IAAI,CAAC,IAAA,kBAAW,EAAC,MAAM,CAAC,UAAU,EAAE,gBAAS,CAAC,UAAU,CAAC,CAAA,EAA1E,wBAA0E;gBAC5E,KAAA,MAAM,CAAA;gBAAc,qBAAM,IAAA,4BAAoB,GAAE,EAAA;;gBAAhD,GAAO,UAAU,GAAG,SAA4B,CAAC;;;qBAG/C,CAAA,MAAM,CAAC,QAAQ,IAAI,CAAC,IAAA,uBAAU,EAAC,MAAM,CAAC,QAAQ,CAAC,CAAA,EAA/C,wBAA+C;gBACjD,KAAA,MAAM,CAAA;gBAAY,qBAAM,IAAA,6BAAqB,GAAE,EAAA;;gBAA/C,GAAO,QAAQ,GAAG,SAA6B,CAAC;;oBAGlD,sBAAO,MAAM,EAAC;;;KACf,CAAC;AAEF,kBAAe,QAAQ,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@twilio/create-flex-plugin",
|
|
3
|
-
"version": "7.1.
|
|
3
|
+
"version": "7.1.3-alpha.202609291943",
|
|
4
4
|
"description": "Toolkit to create a new Twilio Flex plugin",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"flex",
|
|
@@ -42,20 +42,18 @@
|
|
|
42
42
|
"test:watch": "cd ../.. && jest packages/create-flex-plugin --watch --color"
|
|
43
43
|
},
|
|
44
44
|
"dependencies": {
|
|
45
|
-
"@twilio/flex-dev-utils": "7.1.
|
|
45
|
+
"@twilio/flex-dev-utils": "7.1.3-alpha.202609291943",
|
|
46
46
|
"esm-wallaby": "^3.2.30",
|
|
47
47
|
"tmp": "^0.2.1",
|
|
48
48
|
"yargs": "^16.2.0"
|
|
49
49
|
},
|
|
50
50
|
"devDependencies": {
|
|
51
|
-
"@twilio/flex-plugin": "7.1.
|
|
52
|
-
"@twilio/flex-plugin-scripts": "7.1.
|
|
53
|
-
"@twilio/flex-ui": "^1",
|
|
51
|
+
"@twilio/flex-plugin": "7.1.3-alpha.202609291943",
|
|
52
|
+
"@twilio/flex-plugin-scripts": "7.1.3-alpha.202609291943",
|
|
54
53
|
"@types/tmp": "^0.2.1",
|
|
55
54
|
"@types/yargs": "^16.0.4"
|
|
56
55
|
},
|
|
57
56
|
"publishConfig": {
|
|
58
57
|
"access": "public"
|
|
59
|
-
}
|
|
60
|
-
"gitHead": "970b13c50ecb557cdc1e5aaa03a8e6d8f5c8ae02"
|
|
58
|
+
}
|
|
61
59
|
}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "{{name}}",
|
|
3
|
-
"version": "0.0.0",
|
|
4
|
-
"private": true,
|
|
5
|
-
"scripts": {
|
|
6
|
-
"postinstall": "flex-plugin pre-script-check"
|
|
7
|
-
},
|
|
8
|
-
"dependencies": {
|
|
9
|
-
"@twilio/flex-plugin": "{{flexPluginVersion}}",
|
|
10
|
-
"react": "16.5.2",
|
|
11
|
-
"react-dom": "16.5.2",
|
|
12
|
-
"react-emotion": "9.2.12"
|
|
13
|
-
},
|
|
14
|
-
"devDependencies": {
|
|
15
|
-
"@twilio/flex-plugin-scripts": "{{pluginScriptsVersion}}",
|
|
16
|
-
"@twilio/flex-ui": "{{flexSdkVersion}}",
|
|
17
|
-
"react-test-renderer": "16.5.2"
|
|
18
|
-
}
|
|
19
|
-
}
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { VERSION } from '@twilio/flex-ui';
|
|
3
|
-
import { FlexPlugin } from '@twilio/flex-plugin';
|
|
4
|
-
|
|
5
|
-
import CustomTaskListContainer from './components/CustomTaskList/CustomTaskList.Container';
|
|
6
|
-
import reducers, { namespace } from './states';
|
|
7
|
-
|
|
8
|
-
const PLUGIN_NAME = '{{pluginClassName}}';
|
|
9
|
-
|
|
10
|
-
export default class {{pluginClassName}} extends FlexPlugin {
|
|
11
|
-
constructor() {
|
|
12
|
-
super(PLUGIN_NAME);
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* This code is run when your plugin is being started
|
|
17
|
-
* Use this to modify any UI components or attach to the actions framework
|
|
18
|
-
*
|
|
19
|
-
* @param flex { typeof import('@twilio/flex-ui') }
|
|
20
|
-
* @param manager { import('@twilio/flex-ui').Manager }
|
|
21
|
-
*/
|
|
22
|
-
async init(flex, manager) {
|
|
23
|
-
this.registerReducers(manager);
|
|
24
|
-
|
|
25
|
-
const options = { sortOrder: -1 };
|
|
26
|
-
flex.AgentDesktopView.Panel1.Content.add(<CustomTaskListContainer key="{{pluginClassName}}-component" />, options);
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
/**
|
|
30
|
-
* Registers the plugin reducers
|
|
31
|
-
*
|
|
32
|
-
* @param manager { Flex.Manager }
|
|
33
|
-
*/
|
|
34
|
-
registerReducers(manager) {
|
|
35
|
-
if (!manager.store.addReducer) {
|
|
36
|
-
// eslint-disable-next-line
|
|
37
|
-
console.error(`You need FlexUI > 1.9.0 to use built-in redux; you are currently on ${VERSION}`);
|
|
38
|
-
return;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
manager.store.addReducer(namespace, reducers);
|
|
42
|
-
}
|
|
43
|
-
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { connect } from 'react-redux';
|
|
2
|
-
import { bindActionCreators } from 'redux';
|
|
3
|
-
|
|
4
|
-
import { Actions } from '../../states/CustomTaskListState';
|
|
5
|
-
import CustomTaskList from './CustomTaskList';
|
|
6
|
-
|
|
7
|
-
const mapStateToProps = (state) => ({
|
|
8
|
-
isOpen: state['{{pluginNamespace}}'].customTaskList.isOpen,
|
|
9
|
-
});
|
|
10
|
-
|
|
11
|
-
const mapDispatchToProps = (dispatch) => ({
|
|
12
|
-
dismissBar: bindActionCreators(Actions.dismissBar, dispatch),
|
|
13
|
-
});
|
|
14
|
-
|
|
15
|
-
export default connect(mapStateToProps, mapDispatchToProps)(CustomTaskList);
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
3
|
-
|
|
4
|
-
import { CustomTaskListComponentStyles } from './CustomTaskList.Styles';
|
|
5
|
-
|
|
6
|
-
// It is recommended to keep components stateless and use redux for managing states
|
|
7
|
-
const CustomTaskList = (props) => {
|
|
8
|
-
if (!props.isOpen) {
|
|
9
|
-
return null;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
return (
|
|
13
|
-
<CustomTaskListComponentStyles>
|
|
14
|
-
This is a dismissible demo component
|
|
15
|
-
<i className="accented" onClick={props.dismissBar} aria-hidden="true">
|
|
16
|
-
close
|
|
17
|
-
</i>
|
|
18
|
-
</CustomTaskListComponentStyles>
|
|
19
|
-
);
|
|
20
|
-
};
|
|
21
|
-
|
|
22
|
-
CustomTaskList.displayName = 'CustomTaskList';
|
|
23
|
-
|
|
24
|
-
CustomTaskList.propTypes = {
|
|
25
|
-
isOpen: PropTypes.bool.isRequired,
|
|
26
|
-
dismissBar: PropTypes.func.isRequired,
|
|
27
|
-
};
|
|
28
|
-
|
|
29
|
-
export default CustomTaskList;
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { shallow } from 'enzyme';
|
|
3
|
-
|
|
4
|
-
import CustomTaskList from '../CustomTaskList/CustomTaskList';
|
|
5
|
-
|
|
6
|
-
describe('CustomTaskListComponent', () => {
|
|
7
|
-
it('should render demo component', () => {
|
|
8
|
-
const props = {
|
|
9
|
-
isOpen: true,
|
|
10
|
-
dismissBar: () => undefined,
|
|
11
|
-
};
|
|
12
|
-
const wrapper = shallow(<CustomTaskList {...props} />);
|
|
13
|
-
expect(wrapper.render().text()).toMatch('This is a dismissible demo component');
|
|
14
|
-
});
|
|
15
|
-
});
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
const ACTION_DISMISS_BAR = 'DISMISS_BAR';
|
|
2
|
-
|
|
3
|
-
const initialState = {
|
|
4
|
-
isOpen: true,
|
|
5
|
-
};
|
|
6
|
-
|
|
7
|
-
export class Actions {
|
|
8
|
-
static dismissBar = () => ({ type: ACTION_DISMISS_BAR });
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
export function reduce(state = initialState, action) {
|
|
12
|
-
// eslint-disable-next-line sonarjs/no-small-switch
|
|
13
|
-
switch (action.type) {
|
|
14
|
-
case ACTION_DISMISS_BAR: {
|
|
15
|
-
return {
|
|
16
|
-
...state,
|
|
17
|
-
isOpen: false,
|
|
18
|
-
};
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
default:
|
|
22
|
-
return state;
|
|
23
|
-
}
|
|
24
|
-
}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { combineReducers } from 'redux';
|
|
2
|
-
|
|
3
|
-
import { reduce as CustomTaskListReducer } from './CustomTaskListState';
|
|
4
|
-
|
|
5
|
-
// Register your redux store under a unique namespace
|
|
6
|
-
export const namespace = '{{pluginNamespace}}';
|
|
7
|
-
|
|
8
|
-
// Combine the reducers
|
|
9
|
-
export default combineReducers({
|
|
10
|
-
customTaskList: CustomTaskListReducer,
|
|
11
|
-
});
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "{{name}}",
|
|
3
|
-
"version": "0.0.0",
|
|
4
|
-
"private": true,
|
|
5
|
-
"scripts": {
|
|
6
|
-
"postinstall": "flex-plugin pre-script-check"
|
|
7
|
-
},
|
|
8
|
-
"dependencies": {
|
|
9
|
-
"@twilio/flex-plugin": "{{flexPluginVersion}}",
|
|
10
|
-
"react": "16.5.2",
|
|
11
|
-
"react-dom": "16.5.2",
|
|
12
|
-
"react-emotion": "9.2.12"
|
|
13
|
-
},
|
|
14
|
-
"devDependencies": {
|
|
15
|
-
"@twilio/flex-plugin-scripts": "{{pluginScriptsVersion}}",
|
|
16
|
-
"@twilio/flex-ui": "{{flexSdkVersion}}",
|
|
17
|
-
"react-test-renderer": "16.5.2",
|
|
18
|
-
"typescript": "^4"
|
|
19
|
-
}
|
|
20
|
-
}
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import * as Flex from '@twilio/flex-ui';
|
|
3
|
-
import { FlexPlugin } from '@twilio/flex-plugin';
|
|
4
|
-
|
|
5
|
-
import CustomTaskListContainer from './components/CustomTaskList/CustomTaskList.Container';
|
|
6
|
-
import reducers, { namespace } from './states';
|
|
7
|
-
|
|
8
|
-
const PLUGIN_NAME = '{{pluginClassName}}';
|
|
9
|
-
|
|
10
|
-
export default class {{pluginClassName}} extends FlexPlugin {
|
|
11
|
-
constructor() {
|
|
12
|
-
super(PLUGIN_NAME);
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* This code is run when your plugin is being started
|
|
17
|
-
* Use this to modify any UI components or attach to the actions framework
|
|
18
|
-
*
|
|
19
|
-
* @param flex { typeof Flex }
|
|
20
|
-
* @param manager { Flex.Manager }
|
|
21
|
-
*/
|
|
22
|
-
async init(flex: typeof Flex, manager: Flex.Manager): Promise<void> {
|
|
23
|
-
this.registerReducers(manager);
|
|
24
|
-
|
|
25
|
-
const options: Flex.ContentFragmentProps = { sortOrder: -1 };
|
|
26
|
-
flex.AgentDesktopView.Panel1.Content.add(<CustomTaskListContainer key="{{pluginClassName}}-component" />, options);
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
/**
|
|
30
|
-
* Registers the plugin reducers
|
|
31
|
-
*
|
|
32
|
-
* @param manager { Flex.Manager }
|
|
33
|
-
*/
|
|
34
|
-
private registerReducers(manager: Flex.Manager) {
|
|
35
|
-
if (!manager.store.addReducer) {
|
|
36
|
-
// eslint-disable-next-line
|
|
37
|
-
console.error(`You need FlexUI > 1.9.0 to use built-in redux; you are currently on ${Flex.VERSION}`);
|
|
38
|
-
return;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
manager.store.addReducer(namespace, reducers);
|
|
42
|
-
}
|
|
43
|
-
}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { connect } from 'react-redux';
|
|
2
|
-
import { bindActionCreators, Dispatch } from 'redux';
|
|
3
|
-
|
|
4
|
-
import { AppState } from '../../states';
|
|
5
|
-
import { Actions } from '../../states/CustomTaskListState';
|
|
6
|
-
import CustomTaskList from './CustomTaskList';
|
|
7
|
-
|
|
8
|
-
export interface StateToProps {
|
|
9
|
-
isOpen: boolean;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
export interface DispatchToProps {
|
|
13
|
-
dismissBar: () => void;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
const mapStateToProps = (state: AppState): StateToProps => ({
|
|
17
|
-
isOpen: state['{{pluginNamespace}}'].customTaskList.isOpen,
|
|
18
|
-
});
|
|
19
|
-
|
|
20
|
-
const mapDispatchToProps = (dispatch: Dispatch<any>): DispatchToProps => ({
|
|
21
|
-
dismissBar: bindActionCreators(Actions.dismissBar, dispatch),
|
|
22
|
-
});
|
|
23
|
-
|
|
24
|
-
export default connect(mapStateToProps, mapDispatchToProps)(CustomTaskList);
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
|
|
3
|
-
import { CustomTaskListComponentStyles } from './CustomTaskList.Styles';
|
|
4
|
-
import { StateToProps, DispatchToProps } from './CustomTaskList.Container';
|
|
5
|
-
|
|
6
|
-
interface OwnProps {
|
|
7
|
-
// Props passed directly to the component
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
// Props should be a combination of StateToProps, DispatchToProps, and OwnProps
|
|
11
|
-
type Props = StateToProps & DispatchToProps & OwnProps;
|
|
12
|
-
|
|
13
|
-
// It is recommended to keep components stateless and use redux for managing states
|
|
14
|
-
const CustomTaskList: React.FunctionComponent<Props> = (props: Props) => {
|
|
15
|
-
if (!props.isOpen) {
|
|
16
|
-
return null;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
return (
|
|
20
|
-
<CustomTaskListComponentStyles>
|
|
21
|
-
This is a dismissible demo component
|
|
22
|
-
<i className="accented" onClick={props.dismissBar} aria-hidden="true">
|
|
23
|
-
close
|
|
24
|
-
</i>
|
|
25
|
-
</CustomTaskListComponentStyles>
|
|
26
|
-
);
|
|
27
|
-
};
|
|
28
|
-
|
|
29
|
-
CustomTaskList.displayName = 'foo';
|
|
30
|
-
|
|
31
|
-
export default CustomTaskList;
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { shallow } from 'enzyme';
|
|
3
|
-
|
|
4
|
-
import CustomTaskList from '../CustomTaskList/CustomTaskList';
|
|
5
|
-
|
|
6
|
-
describe('CustomTaskListComponent', () => {
|
|
7
|
-
it('should render demo component', () => {
|
|
8
|
-
const props = {
|
|
9
|
-
isOpen: true,
|
|
10
|
-
dismissBar: () => undefined,
|
|
11
|
-
};
|
|
12
|
-
const wrapper = shallow(<CustomTaskList {...props} />);
|
|
13
|
-
expect(wrapper.render().text()).toMatch('This is a dismissible demo component');
|
|
14
|
-
});
|
|
15
|
-
});
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { Action } from '.';
|
|
2
|
-
|
|
3
|
-
const ACTION_DISMISS_BAR = 'DISMISS_BAR';
|
|
4
|
-
|
|
5
|
-
export interface CustomTaskListState {
|
|
6
|
-
isOpen: boolean;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
const initialState: CustomTaskListState = {
|
|
10
|
-
isOpen: true,
|
|
11
|
-
};
|
|
12
|
-
|
|
13
|
-
export class Actions {
|
|
14
|
-
public static dismissBar = (): Action => ({ type: ACTION_DISMISS_BAR });
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
export function reduce(state: CustomTaskListState = initialState, action: Action): CustomTaskListState {
|
|
18
|
-
// eslint-disable-next-line sonarjs/no-small-switch
|
|
19
|
-
switch (action.type) {
|
|
20
|
-
case ACTION_DISMISS_BAR: {
|
|
21
|
-
return {
|
|
22
|
-
...state,
|
|
23
|
-
isOpen: false,
|
|
24
|
-
};
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
default:
|
|
28
|
-
return state;
|
|
29
|
-
}
|
|
30
|
-
}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { AppState as FlexAppState } from '@twilio/flex-ui';
|
|
2
|
-
import { combineReducers, Action as ReduxAction } from 'redux';
|
|
3
|
-
|
|
4
|
-
import { CustomTaskListState, reduce as CustomTaskListReducer } from './CustomTaskListState';
|
|
5
|
-
|
|
6
|
-
// Register your redux store under a unique namespace
|
|
7
|
-
export const namespace = '{{pluginNamespace}}';
|
|
8
|
-
|
|
9
|
-
// Extend this payload to be of type that your ReduxAction is
|
|
10
|
-
export interface Action extends ReduxAction {
|
|
11
|
-
payload?: any;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
// Register all component states under the namespace
|
|
15
|
-
export interface AppState {
|
|
16
|
-
flex: FlexAppState;
|
|
17
|
-
'{{pluginNamespace}}': {
|
|
18
|
-
customTaskList: CustomTaskListState;
|
|
19
|
-
// Other states
|
|
20
|
-
};
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
// Combine the reducers
|
|
24
|
-
export default combineReducers({
|
|
25
|
-
customTaskList: CustomTaskListReducer,
|
|
26
|
-
});
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"compilerOptions": {
|
|
3
|
-
"baseUrl": "src",
|
|
4
|
-
"rootDir": ".",
|
|
5
|
-
"outDir": "build",
|
|
6
|
-
"target": "es5",
|
|
7
|
-
"lib": [
|
|
8
|
-
"dom",
|
|
9
|
-
"dom.iterable",
|
|
10
|
-
"esnext"
|
|
11
|
-
],
|
|
12
|
-
"allowJs": true,
|
|
13
|
-
"skipLibCheck": true,
|
|
14
|
-
"esModuleInterop": true,
|
|
15
|
-
"allowSyntheticDefaultImports": true,
|
|
16
|
-
"strict": true,
|
|
17
|
-
"forceConsistentCasingInFileNames": true,
|
|
18
|
-
"module": "esnext",
|
|
19
|
-
"moduleResolution": "node",
|
|
20
|
-
"resolveJsonModule": true,
|
|
21
|
-
"isolatedModules": true,
|
|
22
|
-
"noEmit": true,
|
|
23
|
-
"jsx": "preserve",
|
|
24
|
-
"noUnusedLocals": false,
|
|
25
|
-
"noUnusedParameters": false
|
|
26
|
-
},
|
|
27
|
-
"include": [
|
|
28
|
-
"./src/**/*"
|
|
29
|
-
],
|
|
30
|
-
"exclude": [
|
|
31
|
-
"./**/*.test.ts",
|
|
32
|
-
"./**/*.test.tsx",
|
|
33
|
-
"./**/__mocks__/*.ts",
|
|
34
|
-
"./**/__mocks__/*.tsx"
|
|
35
|
-
]
|
|
36
|
-
}
|