@twilio/create-flex-plugin 5.0.9-beta.0 → 5.1.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.
- package/dist/lib/cli.d.ts +1 -0
- package/dist/lib/cli.js +10 -0
- package/dist/lib/cli.js.map +1 -1
- package/dist/lib/commands.d.ts +1 -1
- package/dist/lib/commands.js +24 -10
- package/dist/lib/commands.js.map +1 -1
- package/dist/lib/create-flex-plugin.d.ts +1 -0
- package/dist/lib/create-flex-plugin.js +13 -9
- package/dist/lib/create-flex-plugin.js.map +1 -1
- package/package.json +5 -5
- package/templates/js2/package.json +20 -0
- package/templates/js2/src/DemoPlugin.js +23 -0
- package/templates/js2/src/components/CustomTaskList/CustomTaskList.jsx +24 -0
- package/templates/js2/src/components/__tests__/CustomTaskList.spec.jsx +28 -0
- package/templates/js2/src/index.js +5 -0
- package/templates/ts2/package.json +21 -0
- package/templates/ts2/src/DemoPlugin.tsx +24 -0
- package/templates/ts2/src/components/CustomTaskList/CustomTaskList.tsx +26 -0
- package/templates/ts2/src/components/__tests__/CustomTaskList.spec.tsx +28 -0
- package/templates/ts2/src/index.ts +5 -0
- package/templates/ts2/tsconfig.json +36 -0
package/dist/lib/cli.d.ts
CHANGED
package/dist/lib/cli.js
CHANGED
|
@@ -121,6 +121,16 @@ var CLI = /** @class */ (function () {
|
|
|
121
121
|
version: {
|
|
122
122
|
alias: 'v',
|
|
123
123
|
},
|
|
124
|
+
flexui1: {
|
|
125
|
+
type: 'boolean',
|
|
126
|
+
describe: 'Creates a plugin compatible with Flex UI major version 1.0',
|
|
127
|
+
conflicts: 'flexui2',
|
|
128
|
+
},
|
|
129
|
+
flexui2: {
|
|
130
|
+
type: 'boolean',
|
|
131
|
+
describe: 'Creates a plugin compatible with Flex UI major version 2.0',
|
|
132
|
+
conflicts: 'flexui1',
|
|
133
|
+
},
|
|
124
134
|
};
|
|
125
135
|
return CLI;
|
|
126
136
|
}());
|
package/dist/lib/cli.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../../src/lib/cli.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,gDAA6C;AAC7C,yDAAuE;AAEvE,2DAA6E;AAE7E,IAAM,KAAK,GAAG,gCAAe,CAC3B,0CAA0C,EAC1C,EAAE,EACF,YAAY,EACZ,4BAA4B,CAC7B,CAAC;
|
|
1
|
+
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../../src/lib/cli.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,gDAA6C;AAC7C,yDAAuE;AAEvE,2DAA6E;AAE7E,IAAM,KAAK,GAAG,gCAAe,CAC3B,0CAA0C,EAC1C,EAAE,EACF,YAAY,EACZ,4BAA4B,CAC7B,CAAC;AAmBF;IA6DE,aAAY,GAAY;QAAxB,iBAIC;QAEM,UAAK,GAAG;YAAO,cAAiB;iBAAjB,UAAiB,EAAjB,qBAAiB,EAAjB,IAAiB;gBAAjB,yBAAiB;;;;;;;;4BAC/B,IAAI,GAAiB,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;4BAEnD,qBAAM,uBAAM,CAAC;oCAAY,sBAAA,qCAAgB,CAAC,IAA2B,CAAC,EAAA;yCAAA,CAAC,EAAA;;4BAAvE,SAAuE,CAAC;4BACxE,qBAAI,CAAC,CAAC,CAAC,CAAC;;;;;SACT,CAAC;QAEM,SAAI,GAAG;YACb,8DAA8D;YAC9D,KAAI,CAAC,MAAM,CAAC,KAAK,CAAM,WAAW,EAAE,KAAK,EAAE,GAAG,CAAC,KAAK,CAAC,CAAC;QACxD,CAAC,CAAC;QAfA,IAAI,CAAC,MAAM,GAAG,eAAK,CAAC,EAAE,EAAE,GAAG,CAAuB,CAAC;QAEnD,IAAI,CAAC,IAAI,EAAE,CAAC;IACd,CAAC;IAhEa,eAAW,GAAG,KAAK,CAAC;IAEpB,SAAK,GAA+B;QAChD,UAAU,EAAE;YACV,KAAK,EAAE,GAAG;YACV,IAAI,EAAE,SAAS;YACf,QAAQ,EAAE,6BAA6B;YACvC,OAAO,EAAE,KAAK;SACf;QACD,QAAQ,EAAE;YACR,KAAK,EAAE,GAAG;YACV,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,0CAA0C;YACpD,OAAO,EAAE,EAAE;SACZ;QACD,UAAU,EAAE;YACV,KAAK,EAAE,GAAG;YACV,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,uCAAuC;YACjD,OAAO,EAAE,EAAE;SACZ;QACD,UAAU,EAAE;YACV,KAAK,EAAE,GAAG;YACV,IAAI,EAAE,SAAS;YACf,OAAO,EAAE,KAAK;YACd,QAAQ,EAAE,qCAAqC;SAChD;QACD,OAAO,EAAE;YACP,KAAK,EAAE,GAAG;YACV,IAAI,EAAE,SAAS;YACf,OAAO,EAAE,KAAK;YACd,QAAQ,EAAE,2BAA2B;SACtC;QACD,IAAI,EAAE;YACJ,KAAK,EAAE,GAAG;YACV,IAAI,EAAE,SAAS;YACf,OAAO,EAAE,KAAK;YACd,QAAQ,EAAE,qCAAqC;SAChD;QACD,IAAI,EAAE;YACJ,KAAK,EAAE,GAAG;YACV,WAAW,EAAE,KAAK;SACnB;QACD,OAAO,EAAE;YACP,KAAK,EAAE,GAAG;SACX;QACD,OAAO,EAAE;YACP,IAAI,EAAE,SAAS;YACf,QAAQ,EAAE,4DAA4D;YACtE,SAAS,EAAE,SAAS;SACrB;QACD,OAAO,EAAE;YACP,IAAI,EAAE,SAAS;YACf,QAAQ,EAAE,4DAA4D;YACtE,SAAS,EAAE,SAAS;SACrB;KACF,CAAC;IAqBJ,UAAC;CAAA,AA9ED,IA8EC;kBA9EoB,GAAG"}
|
package/dist/lib/commands.d.ts
CHANGED
|
@@ -12,7 +12,7 @@ export declare const installDependencies: (config: FlexPluginArguments) => Promi
|
|
|
12
12
|
* @param config {FlexPluginArguments} the plugin configuration
|
|
13
13
|
* @return {FlexPluginArguments} the updated configuration
|
|
14
14
|
*/
|
|
15
|
-
export declare const setupConfiguration: (config: FlexPluginArguments) => FlexPluginArguments
|
|
15
|
+
export declare const setupConfiguration: (config: FlexPluginArguments) => Promise<FlexPluginArguments>;
|
|
16
16
|
/**
|
|
17
17
|
* Downloads content from GitHub
|
|
18
18
|
*
|
package/dist/lib/commands.js
CHANGED
|
@@ -59,6 +59,7 @@ exports.downloadFromGitHub = exports.setupConfiguration = exports.installDepende
|
|
|
59
59
|
var fs_1 = require("@twilio/flex-dev-utils/dist/fs");
|
|
60
60
|
var spawn_1 = require("@twilio/flex-dev-utils/dist/spawn");
|
|
61
61
|
var lodash_1 = require("@twilio/flex-dev-utils/dist/lodash");
|
|
62
|
+
var flex_dev_utils_1 = require("@twilio/flex-dev-utils");
|
|
62
63
|
var github = __importStar(require("../utils/github"));
|
|
63
64
|
// eslint-disable-next-line @typescript-eslint/no-var-requires, global-require, @typescript-eslint/no-require-imports
|
|
64
65
|
var pkg = require(fs_1.findUp(__filename, 'package.json'));
|
|
@@ -96,16 +97,29 @@ exports.installDependencies = installDependencies;
|
|
|
96
97
|
* @param config {FlexPluginArguments} the plugin configuration
|
|
97
98
|
* @return {FlexPluginArguments} the updated configuration
|
|
98
99
|
*/
|
|
99
|
-
var setupConfiguration = function (config) {
|
|
100
|
-
var name
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
100
|
+
var setupConfiguration = function (config) { return __awaiter(void 0, void 0, void 0, function () {
|
|
101
|
+
var name, _a;
|
|
102
|
+
return __generator(this, function (_b) {
|
|
103
|
+
switch (_b.label) {
|
|
104
|
+
case 0:
|
|
105
|
+
name = config.name || '';
|
|
106
|
+
config.pluginClassName = lodash_1.upperFirst(lodash_1.camelCase(name)).replace('Plugin', '') + "Plugin";
|
|
107
|
+
config.pluginNamespace = name.toLowerCase().replace('plugin-', '');
|
|
108
|
+
config.runtimeUrl = config.runtimeUrl || 'http://localhost:3000';
|
|
109
|
+
config.targetDirectory = fs_1.resolveCwd(name);
|
|
110
|
+
config.flexSdkVersion = pkg.devDependencies['@twilio/flex-ui'];
|
|
111
|
+
config.pluginScriptsVersion = pkg.devDependencies['@twilio/flex-plugin-scripts'];
|
|
112
|
+
config.flexui2 = config.flexui2 || false;
|
|
113
|
+
if (!config.flexui2) return [3 /*break*/, 2];
|
|
114
|
+
_a = config;
|
|
115
|
+
return [4 /*yield*/, flex_dev_utils_1.packages.getLatestFlexUIVersion(2)];
|
|
116
|
+
case 1:
|
|
117
|
+
_a.flexSdkVersion = _b.sent();
|
|
118
|
+
_b.label = 2;
|
|
119
|
+
case 2: return [2 /*return*/, config];
|
|
120
|
+
}
|
|
121
|
+
});
|
|
122
|
+
}); };
|
|
109
123
|
exports.setupConfiguration = setupConfiguration;
|
|
110
124
|
/**
|
|
111
125
|
* Downloads content from GitHub
|
package/dist/lib/commands.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"commands.js","sourceRoot":"","sources":["../../src/lib/commands.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,qDAAoE;AACpE,2DAA0D;AAC1D,6DAA2E;
|
|
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,WAAM,CAAC,UAAU,EAAE,cAAc,CAAC,CAAC,CAAC;AAExD;;;;;GAKG;AACI,IAAM,mBAAmB,GAAG,UA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jF,MAAM,CAAC,OAAO,GAAG,MAAM,CAAC,OAAO,IAAI,KAAK,CAAC;qBAGrC,MAAM,CAAC,OAAO,EAAd,wBAAc;gBAChB,KAAA,MAAM,CAAA;gBAAkB,qBAAM,yBAAQ,CAAC,sBAAsB,CAAC,CAAC,CAAC,EAAA;;gBAAhE,GAAO,cAAc,GAAG,SAAwC,CAAC;;oBAGnE,sBAAO,MAAM,EAAC;;;KACf,CAAC;AAjBW,QAAA,kBAAkB,sBAiB7B;AAEF;;;;;GAKG;AACI,IAAM,kBAAkB,GAAG,UAAO,GAAW,EAAE,GAAW;;;;oBAClD,qBAAM,MAAM,CAAC,cAAc,CAAC,GAAG,CAAC,EAAA;;gBAAvC,IAAI,GAAG,SAAgC;gBAE7C,sBAAO,MAAM,CAAC,YAAY,CAAC,IAAI,EAAE,GAAG,CAAC,EAAC;;;KACvC,CAAC;AAJW,QAAA,kBAAkB,sBAI7B"}
|
|
@@ -52,6 +52,8 @@ var templatesRootDir = path_1.resolve(__dirname, '../../templates');
|
|
|
52
52
|
var templateCorePath = path_1.resolve(templatesRootDir, 'core');
|
|
53
53
|
var templateJsPath = path_1.resolve(templatesRootDir, 'js');
|
|
54
54
|
var templateTsPath = path_1.resolve(templatesRootDir, 'ts');
|
|
55
|
+
var templateJs2Path = path_1.resolve(templatesRootDir, 'js2');
|
|
56
|
+
var templateTs2Path = path_1.resolve(templatesRootDir, 'ts2');
|
|
55
57
|
/**
|
|
56
58
|
* Runs the NPM Installation
|
|
57
59
|
* @param config {FlexPluginArguments} the configuration
|
|
@@ -91,9 +93,9 @@ var _scaffold = function (config) { return __awaiter(void 0, void 0, void 0, fun
|
|
|
91
93
|
case 1:
|
|
92
94
|
// This copies the core such as public/
|
|
93
95
|
_a.sent();
|
|
94
|
-
srcPath = templateJsPath;
|
|
96
|
+
srcPath = config.flexui2 ? templateJs2Path : templateJsPath;
|
|
95
97
|
if (config.typescript) {
|
|
96
|
-
srcPath = templateTsPath;
|
|
98
|
+
srcPath = config.flexui2 ? templateTs2Path : templateTsPath;
|
|
97
99
|
}
|
|
98
100
|
if (!config.template) return [3 /*break*/, 3];
|
|
99
101
|
dirObject = tmp_1.dirSync();
|
|
@@ -138,29 +140,31 @@ var createFlexPlugin = function (config) { return __awaiter(void 0, void 0, void
|
|
|
138
140
|
case 0: return [4 /*yield*/, validators_1.default(config)];
|
|
139
141
|
case 1:
|
|
140
142
|
config = _b.sent();
|
|
141
|
-
|
|
143
|
+
return [4 /*yield*/, commands_1.setupConfiguration(config)];
|
|
144
|
+
case 2:
|
|
145
|
+
config = _b.sent();
|
|
142
146
|
// Check folder does not exist
|
|
143
147
|
if (fs_1.default.existsSync(config.targetDirectory)) {
|
|
144
148
|
throw new flex_dev_utils_1.FlexPluginError(flex_dev_utils_1.singleLineString("Path " + flex_dev_utils_1.logger.coloredStrings.link(config.targetDirectory) + " already exists;", 'please remove it and try again.'));
|
|
145
149
|
}
|
|
146
150
|
return [4 /*yield*/, exports._scaffold(config)];
|
|
147
|
-
case
|
|
151
|
+
case 3:
|
|
148
152
|
// Setup the directories
|
|
149
153
|
if (!(_b.sent())) {
|
|
150
154
|
throw new flex_dev_utils_1.FlexPluginError('Failed to scaffold project');
|
|
151
155
|
}
|
|
152
156
|
// Add new plugin to .twilio-cli/flex/plugins.json
|
|
153
157
|
return [4 /*yield*/, fs_2.checkPluginConfigurationExists(config.name, config.targetDirectory)];
|
|
154
|
-
case
|
|
158
|
+
case 4:
|
|
155
159
|
// Add new plugin to .twilio-cli/flex/plugins.json
|
|
156
160
|
_b.sent();
|
|
157
161
|
_a = config.install;
|
|
158
|
-
if (!_a) return [3 /*break*/,
|
|
162
|
+
if (!_a) return [3 /*break*/, 6];
|
|
159
163
|
return [4 /*yield*/, exports._install(config)];
|
|
160
|
-
case 4:
|
|
161
|
-
_a = !(_b.sent());
|
|
162
|
-
_b.label = 5;
|
|
163
164
|
case 5:
|
|
165
|
+
_a = !(_b.sent());
|
|
166
|
+
_b.label = 6;
|
|
167
|
+
case 6:
|
|
164
168
|
// Install NPM dependencies
|
|
165
169
|
if (_a) {
|
|
166
170
|
flex_dev_utils_1.logger.error('Failed to install dependencies. Please run `npm install` manually.');
|
|
@@ -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,yDAA6F;AAC7F,qDAAiG;AACjG,2BAAuE;AAEvE,uCAAyF;AAEzF,wEAAkD;AAClD,mEAA2C;AAE3C,IAAM,gBAAgB,GAAG,cAAO,CAAC,SAAS,EAAE,iBAAiB,CAAC,CAAC;AAC/D,IAAM,gBAAgB,GAAG,cAAO,CAAC,gBAAgB,EAAE,MAAM,CAAC,CAAC;AAC3D,IAAM,cAAc,GAAG,cAAO,CAAC,gBAAgB,EAAE,IAAI,CAAC,CAAC;AACvD,IAAM,cAAc,GAAG,cAAO,CAAC,gBAAgB,EAAE,IAAI,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"create-flex-plugin.js","sourceRoot":"","sources":["../../src/lib/create-flex-plugin.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,0CAAoB;AACpB,6BAAqC;AAErC,yDAA6F;AAC7F,qDAAiG;AACjG,2BAAuE;AAEvE,uCAAyF;AAEzF,wEAAkD;AAClD,mEAA2C;AAE3C,IAAM,gBAAgB,GAAG,cAAO,CAAC,SAAS,EAAE,iBAAiB,CAAC,CAAC;AAC/D,IAAM,gBAAgB,GAAG,cAAO,CAAC,gBAAgB,EAAE,MAAM,CAAC,CAAC;AAC3D,IAAM,cAAc,GAAG,cAAO,CAAC,gBAAgB,EAAE,IAAI,CAAC,CAAC;AACvD,IAAM,cAAc,GAAG,cAAO,CAAC,gBAAgB,EAAE,IAAI,CAAC,CAAC;AACvD,IAAM,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,CAAC;iBACzD;gBAED,kDAAkD;gBAClD,qBAAM,mCAA8B,CAAC,MAAM,CAAC,IAAI,EAAE,MAAM,CAAC,eAAe,CAAC,EAAA;;gBADzE,kDAAkD;gBAClD,SAAyE,CAAC;gBAGtE,KAAA,MAAM,CAAC,OAAO,CAAA;yBAAd,wBAAc;gBAAM,qBAAM,gBAAQ,CAAC,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,sBAAY,CAAC,MAAM,CAAC,CAAC;;;;KACtB,CAAC;AA7BW,QAAA,gBAAgB,oBA6B3B;AAEF,kBAAe,wBAAgB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@twilio/create-flex-plugin",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.1.1",
|
|
4
4
|
"description": "Toolkit to create a new Twilio Flex plugin",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"flex",
|
|
@@ -42,14 +42,14 @@
|
|
|
42
42
|
"test:watch": "cd ../.. && jest packages/create-flex-plugin --watch --color"
|
|
43
43
|
},
|
|
44
44
|
"dependencies": {
|
|
45
|
-
"@twilio/flex-dev-utils": "5.
|
|
45
|
+
"@twilio/flex-dev-utils": "5.1.1",
|
|
46
46
|
"esm": "^3.2.25",
|
|
47
47
|
"tmp": "^0.2.1",
|
|
48
48
|
"yargs": "^16.2.0"
|
|
49
49
|
},
|
|
50
50
|
"devDependencies": {
|
|
51
|
-
"@twilio/flex-plugin": "5.
|
|
52
|
-
"@twilio/flex-plugin-scripts": "5.
|
|
51
|
+
"@twilio/flex-plugin": "5.1.1",
|
|
52
|
+
"@twilio/flex-plugin-scripts": "5.1.1",
|
|
53
53
|
"@twilio/flex-ui": "^1",
|
|
54
54
|
"@types/tmp": "^0.2.1",
|
|
55
55
|
"@types/yargs": "^16.0.4"
|
|
@@ -57,5 +57,5 @@
|
|
|
57
57
|
"publishConfig": {
|
|
58
58
|
"access": "public"
|
|
59
59
|
},
|
|
60
|
-
"gitHead": "
|
|
60
|
+
"gitHead": "9da631d0a10a085a3dc243e5569536e746c12784"
|
|
61
61
|
}
|
|
@@ -0,0 +1,20 @@
|
|
|
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
|
+
"flex-plugin-scripts": "{{pluginScriptsVersion}}",
|
|
10
|
+
"react": "17.0.2",
|
|
11
|
+
"react-dom": "17.0.2",
|
|
12
|
+
"prop-types": "^15.7.2",
|
|
13
|
+
"@twilio-paste/core": "^10.14.0",
|
|
14
|
+
"@twilio-paste/icons": "^5.7.0"
|
|
15
|
+
},
|
|
16
|
+
"devDependencies": {
|
|
17
|
+
"@twilio/flex-ui": "{{flexSdkVersion}}",
|
|
18
|
+
"react-test-renderer": "17.0.2"
|
|
19
|
+
}
|
|
20
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { FlexPlugin } from '@twilio/flex-plugin';
|
|
3
|
+
|
|
4
|
+
import CustomTaskList from './components/CustomTaskList/CustomTaskList';
|
|
5
|
+
|
|
6
|
+
const PLUGIN_NAME = '{{pluginClassName}}';
|
|
7
|
+
|
|
8
|
+
export default class {{pluginClassName}} extends FlexPlugin {
|
|
9
|
+
constructor() {
|
|
10
|
+
super(PLUGIN_NAME);
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* This code is run when your plugin is being started
|
|
15
|
+
* Use this to modify any UI components or attach to the actions framework
|
|
16
|
+
*
|
|
17
|
+
* @param flex { typeof import('@twilio/flex-ui') }
|
|
18
|
+
*/
|
|
19
|
+
async init(flex) {
|
|
20
|
+
const options = { sortOrder: -1 };
|
|
21
|
+
flex.AgentDesktopView.Panel1.Content.add(<CustomTaskList key="{{pluginClassName}}-component" />, options);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import React, { useState } from 'react';
|
|
2
|
+
|
|
3
|
+
import { Alert } from '@twilio-paste/core/alert';
|
|
4
|
+
import { Theme } from '@twilio-paste/core/theme';
|
|
5
|
+
import { Text } from '@twilio-paste/core/text';
|
|
6
|
+
|
|
7
|
+
const CustomTaskList = () => {
|
|
8
|
+
const [isOpen, setIsOpen] = useState(true);
|
|
9
|
+
if (!isOpen) {
|
|
10
|
+
return null;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
const dismiss = () => setIsOpen(false);
|
|
14
|
+
|
|
15
|
+
return (
|
|
16
|
+
<Theme.Provider theme="default">
|
|
17
|
+
<Alert onDismiss={dismiss} variant="neutral">
|
|
18
|
+
<Text>This is a dismissible demo component.</Text>
|
|
19
|
+
</Alert>
|
|
20
|
+
</Theme.Provider>
|
|
21
|
+
);
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
export default CustomTaskList;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { create, act} from 'react-test-renderer';
|
|
3
|
+
import { Text } from '@twilio-paste/core/text';
|
|
4
|
+
import { Alert } from '@twilio-paste/core/alert';
|
|
5
|
+
|
|
6
|
+
import CustomTaskList from '../CustomTaskList/CustomTaskList';
|
|
7
|
+
|
|
8
|
+
describe('CustomTaskList', () => {
|
|
9
|
+
it('should load and display dismissable component', () => {
|
|
10
|
+
const renderer = create(<CustomTaskList />);
|
|
11
|
+
const root = renderer.root;
|
|
12
|
+
|
|
13
|
+
const element = root.findByType(Alert).findByType(Text);
|
|
14
|
+
expect(element.props.children).toEqual('This is a dismissible demo component.');
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
it('should dismiss component', () => {
|
|
18
|
+
const renderer = create(<CustomTaskList />);
|
|
19
|
+
const root = renderer.root;
|
|
20
|
+
|
|
21
|
+
const element = root.findByType(Alert).findByType(Text);
|
|
22
|
+
expect(element.props.children).toEqual('This is a dismissible demo component.');
|
|
23
|
+
|
|
24
|
+
// dismiss on click
|
|
25
|
+
act(root.findByType(Alert).props.onDismiss);
|
|
26
|
+
expect(root.findAllByType(Alert).length).toEqual(0);
|
|
27
|
+
});
|
|
28
|
+
});
|
|
@@ -0,0 +1,21 @@
|
|
|
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
|
+
"flex-plugin-scripts": "{{pluginScriptsVersion}}",
|
|
10
|
+
"react": "17.0.2",
|
|
11
|
+
"react-dom": "17.0.2",
|
|
12
|
+
"prop-types": "^15.7.2",
|
|
13
|
+
"@twilio-paste/core": "^10.14.0",
|
|
14
|
+
"@twilio-paste/icons": "^5.7.0"
|
|
15
|
+
},
|
|
16
|
+
"devDependencies": {
|
|
17
|
+
"@twilio/flex-ui": "{{flexSdkVersion}}",
|
|
18
|
+
"react-test-renderer": "17.0.2",
|
|
19
|
+
"typescript": "^4"
|
|
20
|
+
}
|
|
21
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import * as Flex from '@twilio/flex-ui';
|
|
3
|
+
import { FlexPlugin } from '@twilio/flex-plugin';
|
|
4
|
+
|
|
5
|
+
import CustomTaskList from './components/CustomTaskList/CustomTaskList';
|
|
6
|
+
|
|
7
|
+
const PLUGIN_NAME = '{{pluginClassName}}';
|
|
8
|
+
|
|
9
|
+
export default class {{pluginClassName}} extends FlexPlugin {
|
|
10
|
+
constructor() {
|
|
11
|
+
super(PLUGIN_NAME);
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* This code is run when your plugin is being started
|
|
16
|
+
* Use this to modify any UI components or attach to the actions framework
|
|
17
|
+
*
|
|
18
|
+
* @param flex { typeof Flex }
|
|
19
|
+
*/
|
|
20
|
+
async init(flex: typeof Flex): Promise<void> {
|
|
21
|
+
const options: Flex.ContentFragmentProps = { sortOrder: -1 };
|
|
22
|
+
flex.AgentDesktopView.Panel1.Content.add(<CustomTaskList key="{{pluginClassName}}-component" />, options);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import React, { useState } from 'react';
|
|
2
|
+
|
|
3
|
+
import { Alert } from '@twilio-paste/core/alert';
|
|
4
|
+
import { Theme } from '@twilio-paste/core/theme';
|
|
5
|
+
import { Text } from '@twilio-paste/core/text';
|
|
6
|
+
|
|
7
|
+
const CustomTaskList = (): JSX.Element | null => {
|
|
8
|
+
const [isOpen, setIsOpen] = useState(true);
|
|
9
|
+
if (!isOpen) {
|
|
10
|
+
return null;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
const dismiss = () => setIsOpen(false);
|
|
14
|
+
|
|
15
|
+
return (
|
|
16
|
+
<Theme.Provider theme="default">
|
|
17
|
+
<Alert onDismiss={dismiss} variant="neutral">
|
|
18
|
+
<Text as="span">This is a dismissible demo component.</Text>
|
|
19
|
+
</Alert>
|
|
20
|
+
</Theme.Provider>
|
|
21
|
+
);
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
CustomTaskList.displayName = 'foo';
|
|
25
|
+
|
|
26
|
+
export default CustomTaskList;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { create, act} from 'react-test-renderer';
|
|
3
|
+
import { Text } from '@twilio-paste/core/text';
|
|
4
|
+
import { Alert } from '@twilio-paste/core/alert';
|
|
5
|
+
|
|
6
|
+
import CustomTaskList from '../CustomTaskList/CustomTaskList';
|
|
7
|
+
|
|
8
|
+
describe('CustomTaskList', () => {
|
|
9
|
+
it('should load and display dismissable component', () => {
|
|
10
|
+
const renderer = create(<CustomTaskList />);
|
|
11
|
+
const root = renderer.root;
|
|
12
|
+
|
|
13
|
+
const element = root.findByType(Alert).findByType(Text);
|
|
14
|
+
expect(element.props.children).toEqual('This is a dismissible demo component.');
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
it('should dismiss component', () => {
|
|
18
|
+
const renderer = create(<CustomTaskList />);
|
|
19
|
+
const root = renderer.root;
|
|
20
|
+
|
|
21
|
+
const element = root.findByType(Alert).findByType(Text);
|
|
22
|
+
expect(element.props.children).toEqual('This is a dismissible demo component.');
|
|
23
|
+
|
|
24
|
+
// dismiss on click
|
|
25
|
+
act(root.findByType(Alert).props.onDismiss);
|
|
26
|
+
expect(root.findAllByType(Alert).length).toEqual(0);
|
|
27
|
+
});
|
|
28
|
+
});
|
|
@@ -0,0 +1,36 @@
|
|
|
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
|
+
}
|