antelope-cli 1.2.4 → 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.
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  # Pinned published antelope-cli version that provides the `onboarding-ca` command.
3
- antelope_cli_version: "1.2.3"
3
+ antelope_cli_version: "1.2.4"
4
4
 
5
5
  # Where web-client-area is cloned on the control node.
6
6
  work_dir: "/tmp/onboard-ca/web-client-area"
@@ -49,9 +49,6 @@
49
49
  - name: languages
50
50
  prompt: "Languages — 2-letter codes, comma-separated (e.g. en,ar)"
51
51
  private: false
52
- - name: fcm_sender_id
53
- prompt: "Firebase FCMSenderId"
54
- private: false
55
52
  - name: jira_key_crm_branding
56
53
  prompt: "Jira key (e.g. ATLP-47067)"
57
54
  private: false
@@ -1,29 +1,28 @@
1
1
  ---
2
2
  # Pinned published antelope-cli version that provides the `onboarding-crm` command.
3
- antelope_cli_version: "1.2.3"
3
+ antelope_cli_version: "1.2.4"
4
4
 
5
5
  # Where web-crm is cloned on the control node.
6
6
  work_dir: "/tmp/onboard-crm/web-crm"
7
7
 
8
8
  # --- CRM brand inputs (map to the `onboarding-crm` CLI flags) ------------------------
9
- # antelope_id => --brand_id (Antelope unique ID / connectedBrandName; keys every file the CLI writes)
10
- # brand_name, languages, fcm_sender_id, crm_type are REQUIRED; logo_url/favicon_url/base_url derive.
11
- # color is optional (blank => the CLI's $corp palette).
12
- #
13
- # favicon_url and base_url default to the SAME derivations as the deployment config
14
- # (xsites-devops ansible-deployment-new/roles/consul/templates/crm.json.j2), so the values
15
- # match what gets seeded into Consul. They resolve from the brand vars (antelope_id,
16
- # brand_name, crm_server_url) in the create_brand context; the standalone playbook's prompts
17
- # override them. crm_type is a per-brand value (not defaulted anywhere — set it in brand_vars
18
- # or -e). logo_url has no derivation in that template — must be provided explicitly.
9
+ # antelope_id => --brand_id (connectedBrandName; keys theme/folder/devBrandName/favicon in configs.ts).
10
+ # REQUIRED: antelope_id, brand_name, crm_type, logo_url, languages. base_url + affiliates_api_url
11
+ # derive from the brand vars in create_brand; pass -e for a standalone run. configs.ts favicon is
12
+ # DERIVED by the CLI (logos-<id>/favicon-<name>.png) and FCMSenderId is always '' (both placeholders).
19
13
  antelope_id: ""
20
- color: "" # --color hex, e.g. "#1a2b3c"; blank => default palette
21
- logo_url: "https://logos-{{ antelope_id }}.s3.eu-west-1.amazonaws.com/logo-{{ brand_name }}.png" # derived like favicon_url; override with -e
14
+ color: "" # --color hex; blank => default palette
15
+ logo_url: "https://logos-{{ antelope_id }}.s3.eu-west-1.amazonaws.com/logo-{{ brand_name }}.png" # brand-logos.json entry; override with -e
22
16
  languages: "" # --languages: CSV "en,ar" or a YAML list [en, ar]
23
- fcm_sender_id: "" # --fcm_sender_id (Firebase) blank in crm.json.j2 but the CLI requires it
24
- crm_type: "" # --type: one of allowed_crm_types below (per-brand; set in brand_vars)
25
- favicon_url: "https://logos-{{ antelope_id }}.s3.eu-west-1.amazonaws.com/favicon-{{ brand_name }}.png"
17
+ crm_type: "" # --type: one of allowed_crm_types (per-brand; from group_vars derivation)
18
+ # baseUrl uses the BE/CRM domain; affiliatesApiUrl uses the FE/CA domain (fe_server_url_list.0).
26
19
  base_url: "{{ ('https://' ~ crm_server_url ~ '/SignalsCRM/') if (crm_server_url | default('') | length > 0) else '' }}"
20
+ affiliates_api_url: "{{ fe_server_url_list.0 | default('') }}"
21
+ arctic_brand: false # --arctic_brand => configs.ts isArcticBrand
22
+ # Consul KV key the generated configs.ts is PUT to (the env CRM config). Needs a consul_token
23
+ # with write on this path. brand_name = the Consul namespace segment (e.g. Antelope/excelttra/crm_env).
24
+ crm_env_consul_key: "Antelope/{{ brand_name }}/crm_env"
25
+ manage_consul_crm_env: true
27
26
  # Kept in sync with ALLOWED_TYPES in antelope-cli/onboarding-crm/index.js.
28
27
  allowed_crm_types:
29
28
  - CORP_FL
@@ -75,16 +75,13 @@
75
75
  - brand_name is defined and (brand_name | length) > 0
76
76
  - jira_key_crm_branding is defined and (jira_key_crm_branding | length) > 0
77
77
  - logo_url is defined and (logo_url | length) > 0
78
- - favicon_url is defined and (favicon_url | length) > 0
79
78
  - languages is defined and (languages | length) > 0
80
- - fcm_sender_id is defined and (fcm_sender_id | length) > 0
81
79
  - crm_type is defined and (crm_type | length) > 0
82
80
  - crm_type in allowed_crm_types
83
81
  - bitbucket_token is defined and (bitbucket_token | length) > 0
84
82
  - bitbucket_email is defined and (bitbucket_email | length) > 0
85
83
  fail_msg: >-
86
- Required: antelope_id, brand_name, jira_key_crm_branding, logo_url, favicon_url, languages,
87
- fcm_sender_id, crm_type (one of {{ allowed_crm_types | join(', ') }}), bitbucket_email.
84
+ Required: antelope_id, brand_name, jira_key_crm_branding, logo_url, languages, crm_type (one of {{ allowed_crm_types | join(', ') }}), bitbucket_email.
88
85
  bitbucket_token must be provided (via --extra-vars / prompt) or resolvable from 1Password
89
86
  item '{{ onepassword_bitbucket_item }}' field '{{ onepassword_bitbucket_field }}' (op signin).
90
87
 
@@ -322,3 +319,39 @@
322
319
  - name: Summary of pull requests
323
320
  ansible.builtin.debug:
324
321
  msg: "{{ pr_results | default([]) }}"
322
+
323
+ # --- Consul: publish the generated configs.ts to the brand's crm_env KV --------------
324
+ # configs.ts is gitignored (not committed) — it is the env's CRM config, so push it to Consul
325
+ # (Antelope/<brand>/crm_env) in addition to the PR body. Non-fatal: warns if the token lacks write.
326
+ - name: Read generated configs.ts for Consul crm_env
327
+ when: manage_consul_crm_env | default(true) | bool
328
+ ansible.builtin.slurp:
329
+ src: "{{ work_dir }}/src/configs/configs.ts"
330
+ register: crm_configs_ts_final
331
+ failed_when: false
332
+
333
+ - name: Update Consul crm_env with the generated configs.ts
334
+ when:
335
+ - manage_consul_crm_env | default(true) | bool
336
+ - crm_configs_ts_final is not skipped
337
+ - (crm_configs_ts_final.content | default('') | length) > 0
338
+ - (consul_token | default('') | length) > 0
339
+ ansible.builtin.uri:
340
+ url: "{{ consul_url }}/v1/kv/{{ crm_env_consul_key }}"
341
+ method: PUT
342
+ headers:
343
+ X-Consul-Token: "{{ consul_token }}"
344
+ body: "{{ crm_configs_ts_final.content | b64decode }}"
345
+ status_code: [200]
346
+ register: consul_crm_env_put
347
+ failed_when: false
348
+ no_log: false
349
+
350
+ - name: Confirm the Consul crm_env update
351
+ when: manage_consul_crm_env | default(true) | bool and (consul_crm_env_put is defined)
352
+ ansible.builtin.debug:
353
+ msg: >-
354
+ {{ 'Updated Consul ' ~ crm_env_consul_key
355
+ if (consul_crm_env_put.status | default(0)) == 200
356
+ else 'Consul crm_env NOT updated (HTTP ' ~ (consul_crm_env_put.status | default('n/a'))
357
+ ~ ') - token may lack write on ' ~ crm_env_consul_key }}
@@ -48,10 +48,10 @@
48
48
  '--brand_id', antelope_id_norm,
49
49
  '--brand_name', brand_name,
50
50
  '--logo_url', logo_url,
51
- '--favicon_url', favicon_url,
52
51
  '--languages', languages_csv,
53
- '--fcm_sender_id', (fcm_sender_id | string),
54
- '--type', crm_type]
52
+ '--type', crm_type,
53
+ '--affiliates_api_url', affiliates_api_url,
54
+ '--arctic_brand', (arctic_brand | default(false) | string | lower)]
55
55
  + (['--color', color] if (color | default('') | length) > 0 else [])
56
56
  + (['--base_url', base_url] if (base_url | default('') | length) > 0 else []) }}
57
57
  chdir: "{{ work_dir }}"
@@ -59,6 +59,23 @@
59
59
  CI: "true"
60
60
  changed_when: true
61
61
 
62
+ - name: "[{{ dest_branch }}] Read generated configs.ts (gitignored) for the PR body / Consul"
63
+ ansible.builtin.slurp:
64
+ src: "{{ work_dir }}/src/configs/configs.ts"
65
+ register: crm_configs_ts
66
+ failed_when: false
67
+
68
+ - name: "[{{ dest_branch }}] Compose PR description (ticket + configs.ts for Consul copy-paste)"
69
+ ansible.builtin.set_fact:
70
+ pr_description: |-
71
+ {{ jira_key_crm_branding }}: On-Boarding {{ brand_name }} CRM Branding
72
+
73
+ configs.ts — copy into Consul `{{ crm_env_consul_key }}`:
74
+
75
+ ```ts
76
+ {{ crm_configs_ts.content | default('') | b64decode }}
77
+ ```
78
+
62
79
  - name: "[{{ dest_branch }}] Stage changes"
63
80
  ansible.builtin.command:
64
81
  cmd: git add -A
@@ -97,7 +114,7 @@
97
114
  body_format: json
98
115
  body:
99
116
  title: "{{ jira_key_crm_branding }}: On-Boarding {{ brand_name }} CRM Branding"
100
- description: "{{ jira_key_crm_branding }}: On-Boarding {{ brand_name }} CRM Branding"
117
+ description: "{{ pr_description }}"
101
118
  source:
102
119
  branch:
103
120
  name: "{{ source_branch }}"
@@ -5,8 +5,8 @@ let brand = {
5
5
  color: '',
6
6
  logo: '',
7
7
  languages: null,
8
- favicon: '',
9
- FCMSenderId: '',
8
+ affiliatesApiUrl: '',
9
+ isArcticBrand: false,
10
10
  type: '',
11
11
  baseUrl: ''
12
12
  };
@@ -21,20 +21,27 @@ function start() {
21
21
 
22
22
  const updateConfigFile = () => {
23
23
  const brand = brandModule.getBrand();
24
+ const id = brand.connectedBrandName;
24
25
  return `export const configs: WebCrmConfig = {
25
- baseUrl: '${brand.baseUrl}',
26
- appId: 0,
27
- type: '${brand.type}',
28
- defaultLanguage: 'en',
29
- gaTrackingID: 'UA-70456753-2',
30
- colorTheme: 'theme-${brand.connectedBrandName}',
31
- templateTheme: 'theme-template-${brand.connectedBrandName}',
32
- title: '${brand.brandName}',
33
- favicon: '${brand.favicon}',
34
- logo: '${brand.logo}',
35
- FCMSenderId: '${brand.FCMSenderId}',
36
- brandAssetsFolder: '${brand.connectedBrandName}'
37
- };`;
26
+ baseUrl: '${brand.baseUrl}',
27
+ affiliatesApiUrl: '${brand.affiliatesApiUrl}',
28
+ appId: 0,
29
+ type: '${brand.type}',
30
+ title: '${brand.brandName} CRM',
31
+ colorTheme: 'theme-${id}',
32
+ templateTheme: 'theme-template-${id}',
33
+ brandAssetsFolder: '${id}',
34
+ devBrandName: '${id}',
35
+ favicon: 'https://logos-${id}.s3.eu-west-1.amazonaws.com/favicon-${brand.brandName}.png',
36
+ gaTrackingID: 'UA-70456753-2',
37
+ FCMSenderId: '',
38
+ isFnsStatusActive: true,
39
+ showTradingInfo: true,
40
+ CrmAvailableCurrencies: ['USD'],
41
+ showNewClientCard: true,
42
+ newAppSubdomain: 'ant-crm',
43
+ isArcticBrand: ${brand.isArcticBrand ? 'true' : 'false'}
44
+ };`;
38
45
  };
39
46
 
40
47
  module.exports = { start };
@@ -29,10 +29,14 @@ Options:
29
29
  --color <hex> Brand hex color, e.g. "#1a2b3c". Empty => default palette ($corp)
30
30
  --logo_url <url> Logo image URL (black background) (required)
31
31
  --languages <csv> 2-letter language codes, comma-separated, e.g. "en,ar" (required)
32
- --favicon_url <url> Favicon image URL configs.ts favicon (required)
33
- --fcm_sender_id <id> Firebase FCMSenderId configs.ts (required)
32
+ --affiliates_api_url configs.ts affiliatesApiUrl the FE host, e.g. "apife.<ca-domain>"
33
+ (apife.excelttra.com). Not derivable from base_url (that's the BE domain).
34
+ --arctic_brand <t|f> configs.ts isArcticBrand. Default: false
34
35
  --type <type> One of: ${ALLOWED_TYPES.join(', ')} → configs.ts (required)
35
36
  --base_url <url> configs.ts baseUrl. Default: ${DEFAULT_BASE_URL}
37
+
38
+ Note: configs.ts favicon is DERIVED (logos-<id>/favicon-<name>.png) and FCMSenderId is always '';
39
+ both are placeholders that get hand-edited per brand. configs.ts is gitignored (Consul copy-paste).
36
40
  -h, --help Show this help
37
41
 
38
42
  Run from the root of a web-crm checkout — files are written relative to the current directory.
@@ -44,8 +48,8 @@ const FLAGS = {
44
48
  '--color': 'color',
45
49
  '--logo_url': 'logo',
46
50
  '--languages': 'languages',
47
- '--favicon_url': 'favicon',
48
- '--fcm_sender_id': 'fcmSenderId',
51
+ '--affiliates_api_url': 'affiliatesApiUrl',
52
+ '--arctic_brand': 'arcticBrand',
49
53
  '--type': 'type',
50
54
  '--base_url': 'baseUrl'
51
55
  };
@@ -97,9 +101,7 @@ async function run() {
97
101
  : (interactive ? await ask(rl, `Please set a color for "${connectedBrandName}", use hex value, leave empty for default.\n`) : '');
98
102
 
99
103
  const logo = await resolve(opts, 'logo', 'Please enter the URL to the logo image suitable for a black background:\n', interactive, rl);
100
- const favicon = await resolve(opts, 'favicon', 'Please provide the url to your favicon image:\n', interactive, rl);
101
104
  const languagesInput = await resolve(opts, 'languages', 'Enter the languages (2-letter codes) separated by commas:\n', interactive, rl);
102
- const fcmSenderId = await resolve(opts, 'fcmSenderId', 'Enter the FCMSenderId value (see https://xsites.atlassian.net/wiki/spaces/IKB/pages/777650347/Onboarding+Branding+Manual+for+devs#Firebase): ', interactive, rl);
103
105
  const typeInput = await resolve(opts, 'type', `Enter the type value (allowed values: ${ALLOWED_TYPES.join(', ')}): `, interactive, rl);
104
106
 
105
107
  // baseUrl is optional (defaults to the dev URL).
@@ -107,14 +109,18 @@ async function run() {
107
109
  ? opts.baseUrl
108
110
  : (interactive ? (await ask(rl, `Enter the configs.ts baseUrl (leave empty for ${DEFAULT_BASE_URL}):\n`)) || DEFAULT_BASE_URL : DEFAULT_BASE_URL);
109
111
 
112
+ // affiliatesApiUrl (FE host, e.g. apife.<ca-domain>) → configs.ts. Explicit input; NOT
113
+ // derivable from baseUrl (baseUrl is the BE/CRM domain). configs.ts favicon is derived
114
+ // from the id + brand_name; FCMSenderId is always ''. isArcticBrand defaults false.
115
+ const affiliatesApiUrl = opts.affiliatesApiUrl || '';
116
+ const isArcticBrand = String(opts.arcticBrand).toLowerCase() === 'true';
117
+
110
118
  // Validate required fields.
111
119
  const missing = [];
112
120
  if (!connectedBrandName) missing.push('--brand_id');
113
121
  if (!brandName) missing.push('--brand_name');
114
122
  if (!logo) missing.push('--logo_url');
115
- if (!favicon) missing.push('--favicon_url');
116
123
  if (!languagesInput) missing.push('--languages');
117
- if (!fcmSenderId) missing.push('--fcm_sender_id');
118
124
  if (!typeInput) missing.push('--type');
119
125
  if (missing.length) {
120
126
  console.error(chalk.red(`Error: missing required value(s): ${missing.join(', ')}`));
@@ -144,8 +150,8 @@ async function run() {
144
150
  color: color || '',
145
151
  logo,
146
152
  languages,
147
- favicon,
148
- FCMSenderId: fcmSenderId,
153
+ affiliatesApiUrl,
154
+ isArcticBrand,
149
155
  type,
150
156
  baseUrl
151
157
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "antelope-cli",
3
- "version": "1.2.4",
3
+ "version": "1.2.5",
4
4
  "description": "CLI-Tool for automating processes for Antelope-Systems ",
5
5
  "main": "index.js",
6
6
  "bin": {