antelope-cli 1.2.3 → 1.2.5

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 (37) hide show
  1. package/ansible/onboarding-ca/README.md +105 -105
  2. package/ansible/onboarding-ca/onboard-ca.yml +43 -51
  3. package/ansible/onboarding-ca/requirements.yml +8 -8
  4. package/ansible/onboarding-ca/roles/onboard_ca/defaults/main.yml +77 -49
  5. package/ansible/onboarding-ca/roles/onboard_ca/meta/main.yml +10 -10
  6. package/ansible/onboarding-ca/roles/onboard_ca/tasks/main.yml +311 -193
  7. package/ansible/onboarding-ca/roles/onboard_ca/tasks/per_branch.yml +114 -107
  8. package/ansible/onboarding-ca/roles/onboard_ca/vars/main.yml +9 -9
  9. package/ansible/onboarding-crm/README.md +107 -0
  10. package/ansible/onboarding-crm/onboard-crm.yml +57 -0
  11. package/ansible/onboarding-crm/requirements.yml +8 -0
  12. package/ansible/onboarding-crm/roles/onboard_crm/defaults/main.yml +98 -0
  13. package/ansible/onboarding-crm/roles/onboard_crm/meta/main.yml +10 -0
  14. package/ansible/onboarding-crm/roles/onboard_crm/tasks/main.yml +357 -0
  15. package/ansible/onboarding-crm/roles/onboard_crm/tasks/per_branch.yml +138 -0
  16. package/ansible/onboarding-crm/roles/onboard_crm/vars/main.yml +9 -0
  17. package/index.js +12 -12
  18. package/onboarding/brand.js +21 -21
  19. package/onboarding/createConfig.js +71 -71
  20. package/onboarding/favicon.js +24 -24
  21. package/onboarding/index.js +62 -62
  22. package/onboarding/logo.js +16 -16
  23. package/onboarding/themes.js +92 -92
  24. package/onboarding/translations.js +41 -41
  25. package/onboarding/variablesColors.js +58 -58
  26. package/onboarding-ca/brand.js +13 -13
  27. package/onboarding-ca/index.js +94 -94
  28. package/onboarding-ca/riskDisclaimer.js +27 -27
  29. package/onboarding-ca/scss.js +24 -24
  30. package/onboarding-ca/templates/risk-disclaimer.html +12 -12
  31. package/onboarding-crm/brand.js +22 -22
  32. package/onboarding-crm/brandLogos.js +31 -0
  33. package/onboarding-crm/createConfig.js +47 -40
  34. package/onboarding-crm/index.js +181 -171
  35. package/onboarding-crm/themes.js +92 -92
  36. package/onboarding-crm/variablesColors.js +53 -53
  37. package/package.json +30 -30
@@ -1,71 +1,71 @@
1
- const fs = require('fs');
2
- const brandModule = require('./brand.js');
3
- const chalk = require('chalk');
4
- const configsFilePath = 'src/configs/configs.ts';
5
-
6
- async function start(rl) {
7
- try {
8
- const configFile = configsFilePath;
9
- // Get User FCMSenderId and type
10
- let { FCMSenderId, type } = await promptForValues(rl);
11
- // Making sure the type is all caps
12
- type = type.toUpperCase();
13
- // Update brand state
14
- brandModule.updateBrand({ FCMSenderId, type });
15
- // Generate new config with new values
16
- const newConfigContent = updateConfigFile();
17
- // Write to file
18
- return new Promise((resolve, reject) => {
19
- fs.writeFile(configFile, newConfigContent, 'utf8', (error) => {
20
- if (error) {
21
- reject(error);
22
- } else {
23
- console.log(chalk.cyan('configs.ts file updated successfully!'));
24
- resolve(null);
25
- }
26
- });
27
- });
28
- } catch (e) {
29
- console.error(e);
30
- return start(rl);
31
- }
32
- }
33
-
34
- const updateConfigFile = () => {
35
- const brand = brandModule.getBrand();
36
- return `export const configs: WebCrmConfig = {
37
- baseUrl: 'https://dev-apicrm.antelopesystem.com/SignalsCRM/',
38
- appId: 0,
39
- type: '${brand.type}',
40
- defaultLanguage: 'en',
41
- gaTrackingID: 'UA-70456753-2',
42
- colorTheme: 'theme-${brand.connectedBrandName}',
43
- templateTheme: 'theme-template-${brand.connectedBrandName}',
44
- title: '${brand.brandName}',
45
- favicon: '${brand.favicon}',
46
- affiliatesApiUrl: '',
47
- FCMSenderId: '${brand.FCMSenderId}',
48
- brandAssetsFolder: '${brand.connectedBrandName}',
49
- };`;
50
- };
51
- const promptForValues = (rl) => {
52
- return new Promise((resolve, reject) => {
53
- try {
54
- rl.question(
55
- 'Enter the FCMSenderId value (see https://xsites.atlassian.net/wiki/spaces/IKB/pages/777650347/Onboarding+Branding+Manual+for+devs#Firebase): ',
56
- (FCMSenderId) => {
57
- rl.question(
58
- 'Enter the type value (allowed values: CORP_FL, IB_FL, CORP_AFF_FL, CORP_AFF_IB_PORTAL, CORP_AFF_MSQ): ',
59
- (type) => {
60
- resolve({ FCMSenderId, type });
61
- }
62
- );
63
- }
64
- );
65
- } catch (error) {
66
- reject(error);
67
- }
68
- });
69
- };
70
-
71
- module.exports = { start };
1
+ const fs = require('fs');
2
+ const brandModule = require('./brand.js');
3
+ const chalk = require('chalk');
4
+ const configsFilePath = 'src/configs/configs.ts';
5
+
6
+ async function start(rl) {
7
+ try {
8
+ const configFile = configsFilePath;
9
+ // Get User FCMSenderId and type
10
+ let { FCMSenderId, type } = await promptForValues(rl);
11
+ // Making sure the type is all caps
12
+ type = type.toUpperCase();
13
+ // Update brand state
14
+ brandModule.updateBrand({ FCMSenderId, type });
15
+ // Generate new config with new values
16
+ const newConfigContent = updateConfigFile();
17
+ // Write to file
18
+ return new Promise((resolve, reject) => {
19
+ fs.writeFile(configFile, newConfigContent, 'utf8', (error) => {
20
+ if (error) {
21
+ reject(error);
22
+ } else {
23
+ console.log(chalk.cyan('configs.ts file updated successfully!'));
24
+ resolve(null);
25
+ }
26
+ });
27
+ });
28
+ } catch (e) {
29
+ console.error(e);
30
+ return start(rl);
31
+ }
32
+ }
33
+
34
+ const updateConfigFile = () => {
35
+ const brand = brandModule.getBrand();
36
+ return `export const configs: WebCrmConfig = {
37
+ baseUrl: 'https://dev-apicrm.antelopesystem.com/SignalsCRM/',
38
+ appId: 0,
39
+ type: '${brand.type}',
40
+ defaultLanguage: 'en',
41
+ gaTrackingID: 'UA-70456753-2',
42
+ colorTheme: 'theme-${brand.connectedBrandName}',
43
+ templateTheme: 'theme-template-${brand.connectedBrandName}',
44
+ title: '${brand.brandName}',
45
+ favicon: '${brand.favicon}',
46
+ affiliatesApiUrl: '',
47
+ FCMSenderId: '${brand.FCMSenderId}',
48
+ brandAssetsFolder: '${brand.connectedBrandName}',
49
+ };`;
50
+ };
51
+ const promptForValues = (rl) => {
52
+ return new Promise((resolve, reject) => {
53
+ try {
54
+ rl.question(
55
+ 'Enter the FCMSenderId value (see https://xsites.atlassian.net/wiki/spaces/IKB/pages/777650347/Onboarding+Branding+Manual+for+devs#Firebase): ',
56
+ (FCMSenderId) => {
57
+ rl.question(
58
+ 'Enter the type value (allowed values: CORP_FL, IB_FL, CORP_AFF_FL, CORP_AFF_IB_PORTAL, CORP_AFF_MSQ): ',
59
+ (type) => {
60
+ resolve({ FCMSenderId, type });
61
+ }
62
+ );
63
+ }
64
+ );
65
+ } catch (error) {
66
+ reject(error);
67
+ }
68
+ });
69
+ };
70
+
71
+ module.exports = { start };
@@ -1,24 +1,24 @@
1
- const fs = require('fs');
2
- const brandModule = require('./brand.js');
3
- const chalk = require('chalk');
4
-
5
- async function start(rl) {
6
- try {
7
- const imagePath = await promptUser('Please provide the url to your favicon image: ', rl);
8
- console.log(chalk.cyan(imagePath));
9
- brandModule.updateBrand({favicon: imagePath})
10
- console.log(chalk.cyan(`Favicon images generated successfully!`));
11
- } catch (error) {
12
- console.error(`Error generating favicon images: ${error}`);
13
- }
14
- }
15
-
16
- function promptUser(message, rl) {
17
- return new Promise((resolve) => {
18
- rl.question(message, (input) => {
19
- resolve(input);
20
- });
21
- });
22
- }
23
-
24
- module.exports = { start };
1
+ const fs = require('fs');
2
+ const brandModule = require('./brand.js');
3
+ const chalk = require('chalk');
4
+
5
+ async function start(rl) {
6
+ try {
7
+ const imagePath = await promptUser('Please provide the url to your favicon image: ', rl);
8
+ console.log(chalk.cyan(imagePath));
9
+ brandModule.updateBrand({favicon: imagePath})
10
+ console.log(chalk.cyan(`Favicon images generated successfully!`));
11
+ } catch (error) {
12
+ console.error(`Error generating favicon images: ${error}`);
13
+ }
14
+ }
15
+
16
+ function promptUser(message, rl) {
17
+ return new Promise((resolve) => {
18
+ rl.question(message, (input) => {
19
+ resolve(input);
20
+ });
21
+ });
22
+ }
23
+
24
+ module.exports = { start };
@@ -1,62 +1,62 @@
1
- const readline = require('readline');
2
- const variableColors = require('./variablesColors.js');
3
- const themes = require('./themes.js');
4
- const favicon = require('./favicon.js');
5
- const logo = require('./logo.js');
6
- const translations = require('./translations.js');
7
- const config = require('./createConfig.js');
8
- const chalk = require('chalk');
9
- const { exec } = require('child_process');
10
-
11
- const rl = readline.createInterface({
12
- input: process.stdin,
13
- output: process.stdout
14
- });
15
-
16
- const finishOnboarding = () => {
17
- console.log(chalk.green('\nOnboarding completed!'));
18
- rl.question('Start the application? (y/n) ', (result) => {
19
- if (result.toLowerCase() === 'y') {
20
- rl.close();
21
- const startProcess = exec('npm start');
22
-
23
- startProcess.stdout.on('data', (data) => {
24
- console.log(data);
25
- });
26
-
27
- startProcess.stderr.on('data', (data) => {
28
- console.error(data);
29
- });
30
-
31
- startProcess.on('close', (code) => {
32
- console.log(`Child process exited with code ${code}`);
33
- });
34
- } else {
35
- rl.close();
36
- }
37
- });
38
- };
39
-
40
- const startOnBoarding = async () => {
41
- console.log(chalk.underline(chalk.cyan("Welcome to Antelope's on-boarding bot \n")));
42
- try {
43
- console.log(chalk.bold(chalk.yellow('\nStep 1: Add to variables-colors.scss')));
44
- await variableColors.start(rl);
45
- console.log(chalk.bold(chalk.yellow('\nStep 2: Adding the logo')));
46
- await logo.start(rl);
47
- console.log(chalk.bold(chalk.yellow('\nStep 3: Add to themes.scss')));
48
- await themes.start(rl);
49
- console.log(chalk.bold(chalk.yellow('\nStep 4: Create favicon package')));
50
- await favicon.start(rl);
51
- console.log(chalk.bold(chalk.yellow('\nStep 5: Adding translations')));
52
- await translations.start(rl);
53
- console.log(chalk.bold(chalk.yellow('\nStep 6: Editing the config file')));
54
- await config.start(rl);
55
- finishOnboarding();
56
- } catch (err) {
57
- console.error(chalk.red(err) + '\n Please delete files and code added by this fail session.');
58
- rl.close();
59
- }
60
- };
61
-
62
- startOnBoarding();
1
+ const readline = require('readline');
2
+ const variableColors = require('./variablesColors.js');
3
+ const themes = require('./themes.js');
4
+ const favicon = require('./favicon.js');
5
+ const logo = require('./logo.js');
6
+ const translations = require('./translations.js');
7
+ const config = require('./createConfig.js');
8
+ const chalk = require('chalk');
9
+ const { exec } = require('child_process');
10
+
11
+ const rl = readline.createInterface({
12
+ input: process.stdin,
13
+ output: process.stdout
14
+ });
15
+
16
+ const finishOnboarding = () => {
17
+ console.log(chalk.green('\nOnboarding completed!'));
18
+ rl.question('Start the application? (y/n) ', (result) => {
19
+ if (result.toLowerCase() === 'y') {
20
+ rl.close();
21
+ const startProcess = exec('npm start');
22
+
23
+ startProcess.stdout.on('data', (data) => {
24
+ console.log(data);
25
+ });
26
+
27
+ startProcess.stderr.on('data', (data) => {
28
+ console.error(data);
29
+ });
30
+
31
+ startProcess.on('close', (code) => {
32
+ console.log(`Child process exited with code ${code}`);
33
+ });
34
+ } else {
35
+ rl.close();
36
+ }
37
+ });
38
+ };
39
+
40
+ const startOnBoarding = async () => {
41
+ console.log(chalk.underline(chalk.cyan("Welcome to Antelope's on-boarding bot \n")));
42
+ try {
43
+ console.log(chalk.bold(chalk.yellow('\nStep 1: Add to variables-colors.scss')));
44
+ await variableColors.start(rl);
45
+ console.log(chalk.bold(chalk.yellow('\nStep 2: Adding the logo')));
46
+ await logo.start(rl);
47
+ console.log(chalk.bold(chalk.yellow('\nStep 3: Add to themes.scss')));
48
+ await themes.start(rl);
49
+ console.log(chalk.bold(chalk.yellow('\nStep 4: Create favicon package')));
50
+ await favicon.start(rl);
51
+ console.log(chalk.bold(chalk.yellow('\nStep 5: Adding translations')));
52
+ await translations.start(rl);
53
+ console.log(chalk.bold(chalk.yellow('\nStep 6: Editing the config file')));
54
+ await config.start(rl);
55
+ finishOnboarding();
56
+ } catch (err) {
57
+ console.error(chalk.red(err) + '\n Please delete files and code added by this fail session.');
58
+ rl.close();
59
+ }
60
+ };
61
+
62
+ startOnBoarding();
@@ -1,16 +1,16 @@
1
- const chalk = require('chalk');
2
- const brandModule = require('./brand.js');
3
-
4
-
5
-
6
- function start(rl) {
7
- return new Promise((resolve, reject) => {
8
- rl.question('Please enter the URL to the logo image suitable for a black background:\n', (url) => {
9
- console.log(chalk.cyan('Logo saved successfully!'));
10
- brandModule.updateBrand({logo: url});
11
- resolve(null);
12
- });
13
- });
14
- }
15
-
16
- module.exports = { start };
1
+ const chalk = require('chalk');
2
+ const brandModule = require('./brand.js');
3
+
4
+
5
+
6
+ function start(rl) {
7
+ return new Promise((resolve, reject) => {
8
+ rl.question('Please enter the URL to the logo image suitable for a black background:\n', (url) => {
9
+ console.log(chalk.cyan('Logo saved successfully!'));
10
+ brandModule.updateBrand({logo: url});
11
+ resolve(null);
12
+ });
13
+ });
14
+ }
15
+
16
+ module.exports = { start };
@@ -1,92 +1,92 @@
1
- const fs = require('fs');
2
- const brandModule = require('./brand.js');
3
- const chalk = require('chalk');
4
- const themesPath = 'src/ng1/assets/css/sass/materialism/themes.scss';
5
-
6
- function addColorToMap(mapName, key, value, data) {
7
- const mapRegex = new RegExp(`\\$${mapName}:\\s*\\(([\\s\\S]*?)\\)`);
8
- const match = data.match(mapRegex);
9
- if (match) {
10
- const mapContent = match[1];
11
- const newMapContent = `$${mapName}: (${mapContent},\n '${key}': ${value})`;
12
- data = data.replace(mapRegex, newMapContent);
13
- } else {
14
- throw new Error(`Error: Could not find ${mapName} map in the file`);
15
- }
16
- return data;
17
- }
18
-
19
- function start(rl) {
20
- const brand = brandModule.getBrand();
21
- return new Promise((resolve, reject) => {
22
- try {
23
- const themeVar = `
24
- .theme-template-${brand.connectedBrandName} {
25
- #logo {
26
- display: inline-block;
27
- width: 240px;
28
- height: 120px;
29
- background: url('${brand.logo}') no-repeat center center;
30
- background-size: contain;
31
- }
32
- .navbar-toggle-container {
33
- background: #222C38;
34
-
35
- .icon-bar {
36
- background: #fff !important;
37
- }
38
- }
39
- .sidebar {
40
- background: #222C38;
41
- color: #ffffff;
42
-
43
- ul a,
44
- i {
45
- color: #ffffff;
46
- }
47
-
48
- .brand-logo,
49
- .brand-logo-text {
50
- display: none;
51
- }
52
- .user-logged-in:after {
53
- background: #26303C;
54
- }
55
- }
56
- }
57
- \n`;
58
- fs.readFile(themesPath, 'utf8', (err, data) => {
59
- if (err) {
60
- reject(err);
61
- } else {
62
- data = addColorToMap(
63
- 'theme-colors',
64
- brand.connectedBrandName,
65
- brand.color ? `$${brand.connectedBrandName}` : '$corp',
66
- data
67
- );
68
- data = addColorToMap(
69
- 'theme-secondary-colors',
70
- brand.connectedBrandName,
71
- brand.color ? `'${brand.connectedBrandName}'` : "'corp'",
72
- data
73
- );
74
- const insertionPoint = data.lastIndexOf('@each $color-name');
75
- const newFileContent = data.slice(0, insertionPoint) + themeVar + data.slice(insertionPoint);
76
- fs.writeFile(themesPath, newFileContent, 'utf8', (error) => {
77
- if (error) {
78
- reject(error);
79
- } else {
80
- console.log(chalk.cyan('themes.scss file updated successfully!'));
81
- resolve(null);
82
- }
83
- });
84
- }
85
- });
86
- } catch (error) {
87
- console.error(error);
88
- }
89
- });
90
- }
91
-
92
- module.exports = { start };
1
+ const fs = require('fs');
2
+ const brandModule = require('./brand.js');
3
+ const chalk = require('chalk');
4
+ const themesPath = 'src/ng1/assets/css/sass/materialism/themes.scss';
5
+
6
+ function addColorToMap(mapName, key, value, data) {
7
+ const mapRegex = new RegExp(`\\$${mapName}:\\s*\\(([\\s\\S]*?)\\)`);
8
+ const match = data.match(mapRegex);
9
+ if (match) {
10
+ const mapContent = match[1];
11
+ const newMapContent = `$${mapName}: (${mapContent},\n '${key}': ${value})`;
12
+ data = data.replace(mapRegex, newMapContent);
13
+ } else {
14
+ throw new Error(`Error: Could not find ${mapName} map in the file`);
15
+ }
16
+ return data;
17
+ }
18
+
19
+ function start(rl) {
20
+ const brand = brandModule.getBrand();
21
+ return new Promise((resolve, reject) => {
22
+ try {
23
+ const themeVar = `
24
+ .theme-template-${brand.connectedBrandName} {
25
+ #logo {
26
+ display: inline-block;
27
+ width: 240px;
28
+ height: 120px;
29
+ background: url('${brand.logo}') no-repeat center center;
30
+ background-size: contain;
31
+ }
32
+ .navbar-toggle-container {
33
+ background: #222C38;
34
+
35
+ .icon-bar {
36
+ background: #fff !important;
37
+ }
38
+ }
39
+ .sidebar {
40
+ background: #222C38;
41
+ color: #ffffff;
42
+
43
+ ul a,
44
+ i {
45
+ color: #ffffff;
46
+ }
47
+
48
+ .brand-logo,
49
+ .brand-logo-text {
50
+ display: none;
51
+ }
52
+ .user-logged-in:after {
53
+ background: #26303C;
54
+ }
55
+ }
56
+ }
57
+ \n`;
58
+ fs.readFile(themesPath, 'utf8', (err, data) => {
59
+ if (err) {
60
+ reject(err);
61
+ } else {
62
+ data = addColorToMap(
63
+ 'theme-colors',
64
+ brand.connectedBrandName,
65
+ brand.color ? `$${brand.connectedBrandName}` : '$corp',
66
+ data
67
+ );
68
+ data = addColorToMap(
69
+ 'theme-secondary-colors',
70
+ brand.connectedBrandName,
71
+ brand.color ? `'${brand.connectedBrandName}'` : "'corp'",
72
+ data
73
+ );
74
+ const insertionPoint = data.lastIndexOf('@each $color-name');
75
+ const newFileContent = data.slice(0, insertionPoint) + themeVar + data.slice(insertionPoint);
76
+ fs.writeFile(themesPath, newFileContent, 'utf8', (error) => {
77
+ if (error) {
78
+ reject(error);
79
+ } else {
80
+ console.log(chalk.cyan('themes.scss file updated successfully!'));
81
+ resolve(null);
82
+ }
83
+ });
84
+ }
85
+ });
86
+ } catch (error) {
87
+ console.error(error);
88
+ }
89
+ });
90
+ }
91
+
92
+ module.exports = { start };
@@ -1,41 +1,41 @@
1
- const fs = require('fs');
2
- const chalk = require('chalk');
3
- const brandModule = require('./brand.js');
4
- const path = require('path');
5
- function createTranslationsFolder(translationsDirectory) {
6
- const folderPath = path.join(translationsDirectory, 'languages');
7
-
8
- if (!fs.existsSync(folderPath)) {
9
- fs.mkdirSync(folderPath, { recursive: true });
10
- }
11
-
12
- return folderPath;
13
- }
14
-
15
- function createLanguageFiles(languages, folderPath) {
16
- languages.forEach((language) => {
17
- const filePath = path.join(folderPath, `${language}.json`);
18
- fs.writeFileSync(filePath, '{}', 'utf8');
19
- });
20
- }
21
-
22
- function start(rl) {
23
- const brand = brandModule.getBrand();
24
- const translationsDir = `src/assets/brands/${brand.connectedBrandName}`;
25
- return new Promise((resolve, reject) => {
26
- try {
27
- rl.question('Enter the languages (2-letter codes) separated by commas:\n', (languagesInput) => {
28
- const languages = languagesInput.trim().split(',');
29
- brandModule.updateBrand({ languages });
30
- const folderPath = createTranslationsFolder(translationsDir);
31
- createLanguageFiles(languages, folderPath);
32
- console.log(chalk.cyan('Translations added successfully!'));
33
- resolve(null);
34
- });
35
- } catch (error) {
36
- reject(error + '\n Please add the translations manually.');
37
- }
38
- });
39
- }
40
-
41
- module.exports = { start };
1
+ const fs = require('fs');
2
+ const chalk = require('chalk');
3
+ const brandModule = require('./brand.js');
4
+ const path = require('path');
5
+ function createTranslationsFolder(translationsDirectory) {
6
+ const folderPath = path.join(translationsDirectory, 'languages');
7
+
8
+ if (!fs.existsSync(folderPath)) {
9
+ fs.mkdirSync(folderPath, { recursive: true });
10
+ }
11
+
12
+ return folderPath;
13
+ }
14
+
15
+ function createLanguageFiles(languages, folderPath) {
16
+ languages.forEach((language) => {
17
+ const filePath = path.join(folderPath, `${language}.json`);
18
+ fs.writeFileSync(filePath, '{}', 'utf8');
19
+ });
20
+ }
21
+
22
+ function start(rl) {
23
+ const brand = brandModule.getBrand();
24
+ const translationsDir = `src/assets/brands/${brand.connectedBrandName}`;
25
+ return new Promise((resolve, reject) => {
26
+ try {
27
+ rl.question('Enter the languages (2-letter codes) separated by commas:\n', (languagesInput) => {
28
+ const languages = languagesInput.trim().split(',');
29
+ brandModule.updateBrand({ languages });
30
+ const folderPath = createTranslationsFolder(translationsDir);
31
+ createLanguageFiles(languages, folderPath);
32
+ console.log(chalk.cyan('Translations added successfully!'));
33
+ resolve(null);
34
+ });
35
+ } catch (error) {
36
+ reject(error + '\n Please add the translations manually.');
37
+ }
38
+ });
39
+ }
40
+
41
+ module.exports = { start };