@posiwise/app-config-service 0.0.108 → 0.0.109

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,5 +1,6 @@
1
1
  import * as i0 from "@angular/core";
2
- import { Injectable } from "@angular/core";
2
+ import { Inject, Injectable, InjectionToken, Optional, PLATFORM_ID } from "@angular/core";
3
+ import { isPlatformServer } from "@angular/common";
3
4
  import isEmpty from "lodash/isEmpty";
4
5
  import merge from "lodash/merge";
5
6
  import { BehaviorSubject, of, throwError } from "rxjs";
@@ -7,6 +8,95 @@ import { distinctUntilChanged } from "rxjs/operators";
7
8
  import { getDomain } from "tldts";
8
9
  import * as i1 from "@angular/common/http";
9
10
  import * as i2 from "@angular/router";
11
+ const SERVER_DOMAIN_CONFIG = new InjectionToken("SERVER_DOMAIN_CONFIG");
12
+ function buildServerStubConfig(environment) {
13
+ return {
14
+ ...environment,
15
+ url: "/",
16
+ domain_id: 0,
17
+ crm: {
18
+ source_id: 0,
19
+ subscription_id: 0
20
+ },
21
+ master_subscription: {
22
+ subscription_id: 0,
23
+ product_id: 0
24
+ },
25
+ trial: {
26
+ crm_source_id: 0,
27
+ pdf_source_id: 0,
28
+ subscription_id: 0,
29
+ product_id: 0
30
+ },
31
+ freemium: {
32
+ crm_source_id: 0,
33
+ pdf_source_id: 0,
34
+ subscription_id: 0,
35
+ product_id: 0
36
+ },
37
+ cs: {
38
+ crm_source_id: 0,
39
+ pdf_source_id: 0,
40
+ subscription_id: 0,
41
+ product_id: 0
42
+ },
43
+ coming_soon: {
44
+ crm_source_id: 0,
45
+ pdf_source_id: 0,
46
+ subscription_id: 0,
47
+ product_id: 0
48
+ },
49
+ integrations: {
50
+ google_api_key: "",
51
+ google_analytics: "",
52
+ captcha_key_V2: "",
53
+ captcha_key_V3: "",
54
+ fb_app_id: "",
55
+ crisp_code: "",
56
+ hubspot_code: "",
57
+ drift_code: ""
58
+ },
59
+ company: {
60
+ name: "",
61
+ title: "",
62
+ email: "",
63
+ street: "",
64
+ description: "",
65
+ keywords: "",
66
+ logos: { main: { url: "" } }
67
+ },
68
+ social: {
69
+ youtube_url: "",
70
+ linkedin_url: "",
71
+ facebook_url: "",
72
+ twitter_url: "",
73
+ instagram_url: ""
74
+ },
75
+ color_codes: {},
76
+ pages_config: {
77
+ ab_tests: [],
78
+ resources: {
79
+ resources_tagline: "",
80
+ resources_image: { url: "" }
81
+ },
82
+ contact_us: { hubspot: [] },
83
+ landing_page: {},
84
+ login: {},
85
+ register: {},
86
+ trial: {},
87
+ cs: {},
88
+ coming_soon: {},
89
+ join: {},
90
+ about_us: {}
91
+ },
92
+ twitter_seo: {},
93
+ links: { frontend_link: "" },
94
+ main_app_title: "",
95
+ main_tos_id: null,
96
+ social_login_enabled: false,
97
+ oauth_login: null
98
+ };
99
+ }
10
100
  const IV_BYTES = 12;
11
101
  function base64ToBytes(base64) {
12
102
  const binary = atob(base64);
@@ -32,9 +122,11 @@ async function decryptWindowConfig(encrypted, keyString) {
32
122
  return new TextDecoder().decode(plaintext);
33
123
  }
34
124
  var AppConfigService = class AppConfigService {
35
- constructor(api, router) {
125
+ constructor(api, router, platformId, serverConfig) {
36
126
  this.api = api;
37
127
  this.router = router;
128
+ this.platformId = platformId;
129
+ this.serverConfig = serverConfig;
38
130
  this.appConfigSubject$ = new BehaviorSubject({
39
131
  integrations: { google_api_key: "" },
40
132
  social_login_enabled: false,
@@ -44,93 +136,13 @@ var AppConfigService = class AppConfigService {
44
136
  }
45
137
  load(environment) {
46
138
  return new Promise((resolve) => {
47
- if (typeof window === "undefined") {
48
- this.appConfigSubject$.next({
49
- ...environment,
50
- url: "/",
51
- domain_id: 0,
52
- crm: {
53
- source_id: 0,
54
- subscription_id: 0
55
- },
56
- master_subscription: {
57
- subscription_id: 0,
58
- product_id: 0
59
- },
60
- trial: {
61
- crm_source_id: 0,
62
- pdf_source_id: 0,
63
- subscription_id: 0,
64
- product_id: 0
65
- },
66
- freemium: {
67
- crm_source_id: 0,
68
- pdf_source_id: 0,
69
- subscription_id: 0,
70
- product_id: 0
71
- },
72
- cs: {
73
- crm_source_id: 0,
74
- pdf_source_id: 0,
75
- subscription_id: 0,
76
- product_id: 0
77
- },
78
- coming_soon: {
79
- crm_source_id: 0,
80
- pdf_source_id: 0,
81
- subscription_id: 0,
82
- product_id: 0
83
- },
84
- integrations: {
85
- google_api_key: "",
86
- google_analytics: "",
87
- captcha_key_V2: "",
88
- captcha_key_V3: "",
89
- fb_app_id: "",
90
- crisp_code: "",
91
- hubspot_code: "",
92
- drift_code: ""
93
- },
94
- company: {
95
- name: "",
96
- title: "",
97
- email: "",
98
- street: "",
99
- description: "",
100
- keywords: "",
101
- logos: { main: { url: "" } }
102
- },
103
- social: {
104
- youtube_url: "",
105
- linkedin_url: "",
106
- facebook_url: "",
107
- twitter_url: "",
108
- instagram_url: ""
109
- },
110
- color_codes: {},
111
- pages_config: {
112
- ab_tests: [],
113
- resources: {
114
- resources_tagline: "",
115
- resources_image: { url: "" }
116
- },
117
- contact_us: { hubspot: [] },
118
- landing_page: {},
119
- login: {},
120
- register: {},
121
- trial: {},
122
- cs: {},
123
- coming_soon: {},
124
- join: {},
125
- about_us: {}
126
- },
127
- twitter_seo: {},
128
- links: { frontend_link: "" },
129
- main_app_title: "",
130
- main_tos_id: null,
131
- social_login_enabled: false,
132
- oauth_login: null
133
- });
139
+ if (this.isServerRender()) {
140
+ const config = {
141
+ ...buildServerStubConfig(environment),
142
+ ...this.serverConfig
143
+ };
144
+ this.googleApiKey = config.integrations?.google_api_key;
145
+ this.appConfigSubject$.next(config);
134
146
  return resolve(true);
135
147
  }
136
148
  const domainName = getDomain(window.location.host, { allowPrivateDomains: true }) || window.location.host;
@@ -191,23 +203,37 @@ var AppConfigService = class AppConfigService {
191
203
  });
192
204
  });
193
205
  }
206
+ isServerRender() {
207
+ return this.platformId !== void 0 && isPlatformServer(this.platformId) || typeof window === "undefined";
208
+ }
194
209
  getGoogleApiKey() {
195
210
  return this.googleApiKey;
196
211
  }
197
212
  static {
198
213
  this.ɵfac = i0.ɵɵngDeclareFactory({
199
214
  minVersion: "12.0.0",
200
- version: "22.2.0",
215
+ version: "22.2.3",
201
216
  ngImport: i0,
202
217
  type: AppConfigService,
203
- deps: [{ token: i1.HttpClient }, { token: i2.Router }],
218
+ deps: [
219
+ { token: i1.HttpClient },
220
+ { token: i2.Router },
221
+ {
222
+ token: PLATFORM_ID,
223
+ optional: true
224
+ },
225
+ {
226
+ token: SERVER_DOMAIN_CONFIG,
227
+ optional: true
228
+ }
229
+ ],
204
230
  target: i0.ɵɵFactoryTarget.Injectable
205
231
  });
206
232
  }
207
233
  static {
208
234
  this.ɵprov = i0.ɵɵngDeclareInjectable({
209
235
  minVersion: "12.0.0",
210
- version: "22.2.0",
236
+ version: "22.2.3",
211
237
  ngImport: i0,
212
238
  type: AppConfigService
213
239
  });
@@ -215,11 +241,28 @@ var AppConfigService = class AppConfigService {
215
241
  };
216
242
  i0.ɵɵngDeclareClassMetadata({
217
243
  minVersion: "12.0.0",
218
- version: "22.2.0",
244
+ version: "22.2.3",
219
245
  ngImport: i0,
220
246
  type: AppConfigService,
221
247
  decorators: [{ type: Injectable }],
222
- ctorParameters: () => [{ type: i1.HttpClient }, { type: i2.Router }]
248
+ ctorParameters: () => [
249
+ { type: i1.HttpClient },
250
+ { type: i2.Router },
251
+ {
252
+ type: void 0,
253
+ decorators: [{ type: Optional }, {
254
+ type: Inject,
255
+ args: [PLATFORM_ID]
256
+ }]
257
+ },
258
+ {
259
+ type: void 0,
260
+ decorators: [{ type: Optional }, {
261
+ type: Inject,
262
+ args: [SERVER_DOMAIN_CONFIG]
263
+ }]
264
+ }
265
+ ]
223
266
  });
224
267
  var AppConfigServiceStub = class AppConfigServiceStub extends AppConfigService {
225
268
  constructor() {
@@ -359,7 +402,7 @@ var AppConfigServiceStub = class AppConfigServiceStub extends AppConfigService {
359
402
  static {
360
403
  this.ɵfac = i0.ɵɵngDeclareFactory({
361
404
  minVersion: "12.0.0",
362
- version: "22.2.0",
405
+ version: "22.2.3",
363
406
  ngImport: i0,
364
407
  type: AppConfigServiceStub,
365
408
  deps: null,
@@ -369,7 +412,7 @@ var AppConfigServiceStub = class AppConfigServiceStub extends AppConfigService {
369
412
  static {
370
413
  this.ɵprov = i0.ɵɵngDeclareInjectable({
371
414
  minVersion: "12.0.0",
372
- version: "22.2.0",
415
+ version: "22.2.3",
373
416
  ngImport: i0,
374
417
  type: AppConfigServiceStub
375
418
  });
@@ -377,11 +420,11 @@ var AppConfigServiceStub = class AppConfigServiceStub extends AppConfigService {
377
420
  };
378
421
  i0.ɵɵngDeclareClassMetadata({
379
422
  minVersion: "12.0.0",
380
- version: "22.2.0",
423
+ version: "22.2.3",
381
424
  ngImport: i0,
382
425
  type: AppConfigServiceStub,
383
426
  decorators: [{ type: Injectable }]
384
427
  });
385
- export { AppConfigService, AppConfigServiceStub };
428
+ export { AppConfigService, AppConfigServiceStub, SERVER_DOMAIN_CONFIG };
386
429
 
387
430
  //# sourceMappingURL=posiwise-app-config-service.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"posiwise-app-config-service.mjs","names":[],"sources":["../../../../libs/app-config-service/src/lib/window-config-crypto.ts","../../../../libs/app-config-service/src/lib/app-config.service.ts","../../../../libs/app-config-service/src/lib/app-config.service.stub.ts"],"sourcesContent":["// #4218: browser-side decrypt for the window.config payload.\n//\n// Replaces `AES.decrypt(config, key)` from `crypto-js` (upstream discontinued).\n// AES-256-GCM via the WebCrypto Subtle API. The matching Node encrypt lives\n// in `config/cicd/window-config-crypto.cjs` and uses the same algorithm +\n// payload layout (base64 of IV(12 bytes) || ciphertext || authTag).\n//\n// Key derivation mirrors the encrypt side: SHA-256 of the key string yields\n// the 32-byte AES-256 key, so callers keep passing the same per-boot random\n// hex string (or legacy env override) they passed to crypto-js.\n\nconst IV_BYTES = 12;\n\nfunction base64ToBytes(base64: string): Uint8Array {\n const binary = atob(base64);\n const bytes = new Uint8Array(binary.length);\n for (let i = 0; i < binary.length; i++) {\n bytes[i] = binary.charCodeAt(i);\n }\n return bytes;\n}\n\nasync function deriveKey(keyString: string, usages: ('encrypt' | 'decrypt')[]): Promise<CryptoKey> {\n const material = new TextEncoder().encode(keyString);\n const digest = await window.crypto.subtle.digest('SHA-256', material);\n return window.crypto.subtle.importKey('raw', digest, { name: 'AES-GCM' }, false, usages);\n}\n\nfunction bytesToBase64(bytes: Uint8Array): string {\n // fromCharCode is required here (not fromCodePoint) — we're mapping\n // individual bytes (0-255) to the corresponding Latin-1 characters that\n // btoa expects, NOT interpreting them as Unicode code points.\n let binary = '';\n for (const b of bytes) binary += String.fromCharCode(b);\n return btoa(binary);\n}\n\n/**\n * Encrypt `plaintext` under `keyString`, returning the same base64 payload\n * layout the Node encrypt side produces. Exported for tests + prospective\n * browser-only callers; production traffic only uses `decryptWindowConfig`.\n */\nexport async function encryptWindowConfig(plaintext: string, keyString: string): Promise<string> {\n const key = await deriveKey(keyString, ['encrypt']);\n const iv = window.crypto.getRandomValues(new Uint8Array(IV_BYTES));\n const ciphertext = await window.crypto.subtle.encrypt(\n { name: 'AES-GCM', iv },\n key,\n new TextEncoder().encode(plaintext)\n );\n const payload = new Uint8Array(IV_BYTES + ciphertext.byteLength);\n payload.set(iv, 0);\n payload.set(new Uint8Array(ciphertext), IV_BYTES);\n return bytesToBase64(payload);\n}\n\n/**\n * Decrypt `encrypted` (base64 of IV || ciphertext || authTag) under `keyString`.\n * Throws on wrong key, tampered payload, or malformed input — callers must\n * catch and route to their error path (the current callsite navigates to\n * /error-page and clears window.config).\n */\nexport async function decryptWindowConfig(encrypted: string, keyString: string): Promise<string> {\n const payload = base64ToBytes(encrypted);\n if (payload.length <= IV_BYTES) {\n throw new Error('window.config payload too short');\n }\n const iv = payload.slice(0, IV_BYTES);\n const ciphertext = payload.slice(IV_BYTES);\n const key = await deriveKey(keyString, ['decrypt']);\n const plaintext = await window.crypto.subtle.decrypt({ name: 'AES-GCM', iv }, key, ciphertext);\n return new TextDecoder().decode(plaintext);\n}\n","import { HttpClient } from '@angular/common/http';\nimport { Injectable } from '@angular/core';\nimport { Router } from '@angular/router';\n\nimport { OAuthLogin } from '@posiwise/common-utilities';\n\nimport isEmpty from 'lodash/isEmpty';\nimport merge from 'lodash/merge';\n// Removed PSL import - using native JavaScript instead\nimport { BehaviorSubject, of, throwError } from 'rxjs';\nimport { distinctUntilChanged } from 'rxjs/operators';\nimport { getDomain } from 'tldts';\n\nimport { ApiResponse, DecryptedData } from './app-config.interface';\nimport { decryptWindowConfig } from './window-config-crypto';\n\ndeclare const window: Window & {\n config?: string;\n config_key?: string;\n oauth_login?: OAuthLogin;\n};\n\n@Injectable()\nexport class AppConfigService {\n private decryptedData;\n private googleApiKey: string;\n\n protected appConfigSubject$ = new BehaviorSubject<DecryptedData>({\n integrations: {\n google_api_key: ''\n },\n social_login_enabled: false, // Default value\n oauth_login: null // Default value\n });\n\n appConfig$ = this.appConfigSubject$.asObservable().pipe(distinctUntilChanged());\n\n constructor(\n private readonly api: HttpClient,\n private readonly router: Router\n ) {}\n\n load(environment) {\n return new Promise(resolve => {\n // SSR/prerender: no window available. Resolve with environment\n // defaults; the client-side hydration leg re-runs this with the\n // real window.config injected by server_cicd.js.\n if (typeof window === 'undefined') {\n // SSR/prerender: emit a shape-complete stub so components\n // that read config fields at class-field initializer time\n // (e.g. `this.appConfig.crm.source_id`) don't null-deref\n // during render. The client-hydration leg re-runs load()\n // with the real window.config, replacing every field.\n this.appConfigSubject$.next({\n ...environment,\n url: '/',\n domain_id: 0,\n crm: { source_id: 0, subscription_id: 0 },\n master_subscription: {\n subscription_id: 0,\n product_id: 0\n },\n trial: {\n crm_source_id: 0,\n pdf_source_id: 0,\n subscription_id: 0,\n product_id: 0\n },\n freemium: {\n crm_source_id: 0,\n pdf_source_id: 0,\n subscription_id: 0,\n product_id: 0\n },\n cs: {\n crm_source_id: 0,\n pdf_source_id: 0,\n subscription_id: 0,\n product_id: 0\n },\n coming_soon: {\n crm_source_id: 0,\n pdf_source_id: 0,\n subscription_id: 0,\n product_id: 0\n },\n integrations: {\n google_api_key: '',\n google_analytics: '',\n captcha_key_V2: '',\n captcha_key_V3: '',\n fb_app_id: '',\n crisp_code: '',\n hubspot_code: '',\n drift_code: ''\n },\n company: {\n name: '',\n title: '',\n email: '',\n street: '',\n description: '',\n keywords: '',\n logos: { main: { url: '' } }\n },\n social: {\n youtube_url: '',\n linkedin_url: '',\n facebook_url: '',\n twitter_url: '',\n instagram_url: ''\n },\n color_codes: {},\n pages_config: {\n ab_tests: [],\n resources: {\n resources_tagline: '',\n resources_image: { url: '' }\n },\n contact_us: { hubspot: [] },\n landing_page: {},\n login: {},\n register: {},\n trial: {},\n cs: {},\n coming_soon: {},\n join: {},\n about_us: {}\n },\n twitter_seo: {},\n links: { frontend_link: '' },\n main_app_title: '',\n main_tos_id: null,\n social_login_enabled: false,\n oauth_login: null\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n } as any);\n return resolve(true);\n }\n // Parse domain using native JavaScript instead of PSL\n const domainName =\n getDomain(window.location.host, { allowPrivateDomains: true }) ||\n window.location.host;\n\n if (environment.production) {\n // in case of production, the config is rendered from server_cicd.js which\n // embeds window.config = config from node\n\n let isTimeout = false; // Store the timeout ID\n\n // Wait for window.config to be available\n const waitForConfig = () => {\n if (window.config) {\n // Clear any pending timeout\n isTimeout = true;\n\n // Config is ready, continue with existing logic\n of({}).subscribe(async () => {\n const { config } = window;\n\n if (!config) {\n this.router.navigate(['/error-page'], {\n state: {\n message: 'Missing window.config during app initialization'\n }\n });\n return resolve(false);\n }\n\n // Decrypt configs. The key is injected at runtime by\n // server_cicd.js in the same inline script as\n // window.config (#4179 — the key no longer ships in\n // the JS bundle). environment.metadata_encryption_key\n // remains as a transition fallback for consumers whose\n // serving layer hasn't been updated yet.\n // #4218: decrypt is now AES-256-GCM via WebCrypto\n // (previously crypto-js AES-CBC, upstream discontinued).\n // subtle.decrypt returns a Promise so the callback is\n // async; wrong key / tampered payload / malformed input\n // all reject and land in the catch below.\n const decryptionKey =\n window.config_key || environment.metadata_encryption_key;\n try {\n const plaintext = await decryptWindowConfig(config, decryptionKey);\n this.decryptedData = JSON.parse(plaintext);\n } catch {\n // Wrong key / tampered payload → route to the\n // error page instead of dying inside the subscribe\n // with a white screen.\n this.decryptedData = null;\n } finally {\n // security: never leave the key on the global scope\n delete window.config_key;\n }\n\n if (isEmpty(this.decryptedData)) {\n this.router.navigate(['/error-page'], {\n state: { message: 'This domain seems to be misconfigured' }\n });\n } else {\n this.googleApiKey = this.decryptedData.integrations.google_api_key;\n this.decryptedData = { ...environment, ...this.decryptedData };\n // security: make sure we clean the config after reading it\n delete window.config;\n\n if (this.decryptedData?.social_login_enabled) {\n window['oauth_login'] = this.decryptedData['oauth_login'];\n }\n this.appConfigSubject$.next(this.decryptedData);\n window['main_tos_id'] = this.decryptedData?.main_tos_id;\n localStorage.setItem(\n 'company_title',\n this.decryptedData?.company?.title\n );\n }\n resolve(true);\n });\n } else if (!isTimeout) {\n // Store the timeout ID so we can clear it later\n setTimeout(waitForConfig, 100);\n }\n };\n\n // Start waiting for config\n waitForConfig();\n } else {\n this.api\n .get<ApiResponse>(`/main-api/v1/domains/metadata?host_name=${domainName}`)\n .subscribe({\n next: (data: ApiResponse) => {\n if (data?.type === 'warning') {\n this.router.navigate(['/error-page'], {\n state: { message: 'This domain seems to be misconfigured' }\n });\n } else {\n const config = merge(environment, data);\n if (config?.social_login_enabled) {\n window['oauth_login'] = config['oauth_login'];\n }\n this.googleApiKey = config.integrations.google_api_key;\n this.appConfigSubject$.next(config);\n window['main_tos_id'] = config?.main_tos_id;\n localStorage.setItem('company_title', config?.company?.title);\n }\n resolve(true);\n },\n error: () => {\n return throwError(() => new Error('metadata is not called'));\n }\n });\n }\n });\n }\n\n getGoogleApiKey(): string {\n return this.googleApiKey;\n }\n}\n","import { Injectable } from '@angular/core';\n\nimport { AppConfigService } from './app-config.service';\n\n@Injectable()\nexport class AppConfigServiceStub extends AppConfigService {\n commonConfigFields = {\n join_message: null,\n product_id: 1,\n image: {\n url: 'https://posiwise-dev.s3.us-east-2.amazonaws.com/dev/public/default_shard/domain_pictures/3/cs_image-default_shard_2022-02-17-newimg-power.png'\n },\n image2: {\n url: 'https://posiwise-dev.s3.us-east-2.amazonaws.com/dev/public/default_shard/domain_pictures/3/cs_image2-default_shard_2022-02-17-white-label-2b.png'\n },\n image_bg: {\n url: 'https://posiwise-dev.s3.us-east-2.amazonaws.com/dev/public/default_shard/domain_pictures/3/cs_image_bg-default_shard_2022-02-17-banner-bg.jpg'\n },\n image_bg2: {\n url: 'https://posiwise-dev.s3.us-east-2.amazonaws.com/dev/public/default_shard/domain_pictures/3/cs_image_bg2-default_shard_2022-02-17-contact-us-bg.jpg'\n },\n video_url: 'https://www.youtube.com/embed/R7Vk219zbhA',\n book_demo_url: null,\n source_id: null,\n pdf_source_id: null,\n pdf_image: {\n url: 'https://posiwise-dev.s3.us-east-2.amazonaws.com/dev/public/default_shard/domain_pictures/3/cs_pdf_image-default_shard_2022-02-21-downloadpdfbook.png'\n },\n pdf_download_text:\n \"The rise of SaaS billings in today's marketplace means there has never been a more important time for MSPs to optimise cloud contract management. Download our best practice tips to manage your client contracts efficiently and with zero revenue leakage.\",\n cta_iframe:\n '\"\\\\u003ciframe src=\\\\\"https://my.upflowy.com/0jx-cloudolive?mode=standalone\\\\\"\\\\u003e\\\\u003c/iframe\\\\u003e\"',\n cs_cta_iframe:\n '\"\\\\u003ciframe src=\\\\\"https://my.upflowy.com/0jx-cloudolive?mode=standalone\\\\\"\\\\u003e\\\\u003c/iframe\\\\u003e\"',\n trial_cta_iframe:\n '\"\\\\u003ciframe src=\\\\\"https://my.upflowy.com/0jx-cloudolive?mode=standalone\\\\\"\\\\u003e\\\\u003c/iframe\\\\u003e\"'\n };\n\n config = {\n links: {\n frontend_link: 'https://www.dev.posiwise.com',\n socket_link: 'wss://main-websocket.dev.posiwise.com/',\n main_api: 'https://api-gateway.dev.posiwise.com/main-api/v1/',\n products_api: 'https://api-gateway.dev.posiwise.com/products-api/v1/',\n integrations_api: 'https://api-gateway.dev.posiwise.com/integrations-api/v1/',\n cloudolive_api: 'https://api-gateway.dev.posiwise.com/cloudolive-api/v1/',\n // Dedicated WS host for the Brain chat push socket (#45). main-api\n // surfaces it as `links.mcp_socket_link`, sourced from\n // `endpoints.brain_api.websocket_url`.\n mcp_socket_link: 'https://brain-api-websocket.dev.posiwise.com/brain-api/v1/'\n },\n url: '/',\n company: {\n number: '55 732 191 094',\n name: 'PosiWise',\n keywords: 'Innovation,Technology,ProofOfConcet,MVP,Business,Demo,Website,MobileApp,API',\n street: 'Rue des Hirondelles 15 - 1000 Brussels - Belgium',\n city: 'Brussels',\n city_code: '1000',\n state: 'Belgium',\n phone_number: '+32 (0)478 68 21 00',\n description:\n 'PosiWise - Creating positive changes in the world through innovation and wise investments.',\n email: 'info@posiwise.com',\n website: 'https://www.posiwise.com',\n blog_product_key: 'Dashboard_Demo1',\n logos: {\n header_squared_main: {\n url: null,\n version_200x200: {\n url: null\n },\n version_100x100: {\n url: null\n },\n version_50x50: {\n url: null\n }\n },\n header_squared_dark: {\n url: null,\n version_200x200: {\n url: null\n },\n version_100x100: {\n url: null\n },\n version_50x50: {\n url: null\n }\n },\n header_squared_contrast: {\n url: null,\n version_200x200: {\n url: null\n },\n version_100x100: {\n url: null\n },\n version_50x50: {\n url: null\n }\n },\n main: {\n url: 'https://posiwise-dev.s3.us-east-2.amazonaws.com/dev/public/default_shard/domain_pictures/3/logo_main-default_shard_2022-02-17-logo_main_dark-default_shard_2022-02-13-logo_text_big.png'\n },\n main_dark: {\n url: 'https://posiwise-dev.s3.us-east-2.amazonaws.com/dev/public/default_shard/domain_pictures/3/logo_main_dark-default_shard_2022-02-17-logo_main_dark-default_shard_2022-02-13-logo_text_big__1_.png',\n version_100x100: {\n url: 'https://posiwise-dev.s3.us-east-2.amazonaws.com/dev/public/default_shard/domain_pictures/3/version_100x100_logo_main_dark-default_shard_2022-02-17-logo_main_dark-default_shard_2022-02-13-logo_text_big__1_.png'\n }\n },\n main_contrast: {\n url: 'https://posiwise-dev.s3.us-east-2.amazonaws.com/dev/public/default_shard/domain_pictures/3/logo_main_contrast-default_shard_2022-02-17-logo_main_dark-default_shard_2022-02-13-logo_text_big__1_.png'\n }\n }\n },\n main_app_title:\n 'PosiWise - Creating positive changes in the world through innovation and wise investments.',\n favicon_path: 'favicon.ico',\n twitter_seo: { card: 'summary', site: '@posiwise', creator: '@posiwise' },\n color_codes: {\n first: '#f006c4',\n second: '#0fed28',\n third: '#fe8c14',\n titles: '#45d292',\n text: '#222',\n tabs_bg: '#0ceedd',\n tabs_text: '#FFFFFF',\n sidebar_bg: '#212529',\n sidebar_text: '#f70917'\n },\n social: {\n linkedin_url: 'https://www.linkedin.com',\n twitter_url: 'https://twitter.com',\n facebook_url: 'https://www.facebook.com',\n youtube_url: 'https://www.youtube.com/embed/5eV0uXjRxRs'\n },\n can_register_through_main_page: true,\n is_product_domain: true,\n social_login_enabled: true,\n main_tos_id: 1,\n crm: { subscription_id: 1, source_id: 1, product_id: 7 },\n master_subscription: { subscription_id: 1, product_id: 7 },\n signup_config: {\n coming_soon: {\n ...this.commonConfigFields\n },\n freemium: {\n ...this.commonConfigFields\n },\n trial: {\n ...this.commonConfigFields\n }\n },\n integrations: {\n sentry_config: { dsn: '' },\n drift_code: '',\n fb_app_id: '',\n captcha_key: '',\n captcha_key_V2: '',\n google_analytics: '',\n google_api_key: ''\n },\n oauth_login: {\n google: {\n client_id: ''\n },\n facebook: { client_id: '' },\n linkedin: { client_id: '' }\n }\n };\n\n override load() {\n return new Promise(resolve => {\n this.appConfigSubject$.next(this.config);\n\n resolve(true);\n });\n }\n}\n"],"mappings":";;;;;;;;;AAWA,MAAM,WAAW;AAEjB,SAAS,cAAc,QAAc;CACjC,MAAM,SAAS,KAAK,MAAM;CAC1B,MAAM,QAAQ,IAAI,WAAW,OAAO,MAAM;CAC1C,KAAK,IAAI,IAAI,GAAG,IAAI,OAA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AE;IACzB,UAAU,EAAE,WAAW,GAAE;GAC5B;EACJ;CASJ;CAPY,OAAI;EACT,OAAO,IAAI,SAAQ,YAAU;GACzB,KAAK,kBAAkB,KAAK,KAAK,MAAM;GAEvC,QAAQ,IAAI;EAChB,CAAC;CACL;CA9KS;EAAA,KAAA,OAAA,GAAA,mBAAA;GAAA,YAAA;GAAA,SAAA;GAAA,UAAA;GAAA,MAAA;GAAoB,MAAA;GAAA,QAAA,GAAA,gBAAA;EAAA,CAAA;CAAA;CAApB;EAAA,KAAA,QAAA,GAAA,sBAAA;GAAA,YAAA;GAAA,SAAA;GAAA,UAAA;GAAA,MAAA;EAAoB,CAAA;CAAA;;AAApB,GAAA,yBAAA;CAAA,YAAA;CAAA,SAAA;CAAA,UAAA;CAAA,MAAA;CAAoB,YAAA,CAAA,EADhC,MAAA,WAAA,CAAA"}
1
+ {"version":3,"file":"posiwise-app-config-service.mjs","names":[],"sources":["../../../../libs/app-config-service/src/lib/server-domain-config.ts","../../../../libs/app-config-service/src/lib/server-stub-config.ts","../../../../libs/app-config-service/src/lib/window-config-crypto.ts","../../../../libs/app-config-service/src/lib/app-config.service.ts","../../../../libs/app-config-service/src/lib/app-config.service.stub.ts"],"sourcesContent":["import { InjectionToken } from '@angular/core';\n\nimport { DecryptedData } from './app-config.interface';\n\n/**\n * Domain metadata for a server render (SSR/prerender).\n *\n * In the browser, server_cicd.js delivers the config as an encrypted window.config.\n * A server render has no window, so the renderer passes the same metadata here\n * instead, as plain data that never leaves the build process.\n */\nexport const SERVER_DOMAIN_CONFIG = new InjectionToken<Partial<DecryptedData>>(\n 'SERVER_DOMAIN_CONFIG'\n);\n","import { DecryptedData } from './app-config.interface';\n\n/**\n * Shape-complete config for a server render that has no domain metadata.\n *\n * Components read config fields at class-field initializer time\n * (e.g. `this.appConfig.crm.source_id`), so every nested object they touch must\n * exist or the render null-derefs. The browser's load() replaces every field.\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport function buildServerStubConfig(environment: any): DecryptedData {\n return {\n ...environment,\n url: '/',\n domain_id: 0,\n crm: { source_id: 0, subscription_id: 0 },\n master_subscription: {\n subscription_id: 0,\n product_id: 0\n },\n trial: {\n crm_source_id: 0,\n pdf_source_id: 0,\n subscription_id: 0,\n product_id: 0\n },\n freemium: {\n crm_source_id: 0,\n pdf_source_id: 0,\n subscription_id: 0,\n product_id: 0\n },\n cs: {\n crm_source_id: 0,\n pdf_source_id: 0,\n subscription_id: 0,\n product_id: 0\n },\n coming_soon: {\n crm_source_id: 0,\n pdf_source_id: 0,\n subscription_id: 0,\n product_id: 0\n },\n integrations: {\n google_api_key: '',\n google_analytics: '',\n captcha_key_V2: '',\n captcha_key_V3: '',\n fb_app_id: '',\n crisp_code: '',\n hubspot_code: '',\n drift_code: ''\n },\n company: {\n name: '',\n title: '',\n email: '',\n street: '',\n description: '',\n keywords: '',\n logos: { main: { url: '' } }\n },\n social: {\n youtube_url: '',\n linkedin_url: '',\n facebook_url: '',\n twitter_url: '',\n instagram_url: ''\n },\n color_codes: {},\n pages_config: {\n ab_tests: [],\n resources: {\n resources_tagline: '',\n resources_image: { url: '' }\n },\n contact_us: { hubspot: [] },\n landing_page: {},\n login: {},\n register: {},\n trial: {},\n cs: {},\n coming_soon: {},\n join: {},\n about_us: {}\n },\n twitter_seo: {},\n links: { frontend_link: '' },\n main_app_title: '',\n main_tos_id: null,\n social_login_enabled: false,\n oauth_login: null\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n } as any;\n}\n","// #4218: browser-side decrypt for the window.config payload.\n//\n// Replaces `AES.decrypt(config, key)` from `crypto-js` (upstream discontinued).\n// AES-256-GCM via the WebCrypto Subtle API. The matching Node encrypt lives\n// in `config/cicd/window-config-crypto.cjs` and uses the same algorithm +\n// payload layout (base64 of IV(12 bytes) || ciphertext || authTag).\n//\n// Key derivation mirrors the encrypt side: SHA-256 of the key string yields\n// the 32-byte AES-256 key, so callers keep passing the same per-boot random\n// hex string (or legacy env override) they passed to crypto-js.\n\nconst IV_BYTES = 12;\n\nfunction base64ToBytes(base64: string): Uint8Array {\n const binary = atob(base64);\n const bytes = new Uint8Array(binary.length);\n for (let i = 0; i < binary.length; i++) {\n bytes[i] = binary.charCodeAt(i);\n }\n return bytes;\n}\n\nasync function deriveKey(keyString: string, usages: ('encrypt' | 'decrypt')[]): Promise<CryptoKey> {\n const material = new TextEncoder().encode(keyString);\n const digest = await window.crypto.subtle.digest('SHA-256', material);\n return window.crypto.subtle.importKey('raw', digest, { name: 'AES-GCM' }, false, usages);\n}\n\nfunction bytesToBase64(bytes: Uint8Array): string {\n // fromCharCode is required here (not fromCodePoint) — we're mapping\n // individual bytes (0-255) to the corresponding Latin-1 characters that\n // btoa expects, NOT interpreting them as Unicode code points.\n let binary = '';\n for (const b of bytes) binary += String.fromCharCode(b);\n return btoa(binary);\n}\n\n/**\n * Encrypt `plaintext` under `keyString`, returning the same base64 payload\n * layout the Node encrypt side produces. Exported for tests + prospective\n * browser-only callers; production traffic only uses `decryptWindowConfig`.\n */\nexport async function encryptWindowConfig(plaintext: string, keyString: string): Promise<string> {\n const key = await deriveKey(keyString, ['encrypt']);\n const iv = window.crypto.getRandomValues(new Uint8Array(IV_BYTES));\n const ciphertext = await window.crypto.subtle.encrypt(\n { name: 'AES-GCM', iv },\n key,\n new TextEncoder().encode(plaintext)\n );\n const payload = new Uint8Array(IV_BYTES + ciphertext.byteLength);\n payload.set(iv, 0);\n payload.set(new Uint8Array(ciphertext), IV_BYTES);\n return bytesToBase64(payload);\n}\n\n/**\n * Decrypt `encrypted` (base64 of IV || ciphertext || authTag) under `keyString`.\n * Throws on wrong key, tampered payload, or malformed input — callers must\n * catch and route to their error path (the current callsite navigates to\n * /error-page and clears window.config).\n */\nexport async function decryptWindowConfig(encrypted: string, keyString: string): Promise<string> {\n const payload = base64ToBytes(encrypted);\n if (payload.length <= IV_BYTES) {\n throw new Error('window.config payload too short');\n }\n const iv = payload.slice(0, IV_BYTES);\n const ciphertext = payload.slice(IV_BYTES);\n const key = await deriveKey(keyString, ['decrypt']);\n const plaintext = await window.crypto.subtle.decrypt({ name: 'AES-GCM', iv }, key, ciphertext);\n return new TextDecoder().decode(plaintext);\n}\n","import { isPlatformServer } from '@angular/common';\nimport { HttpClient } from '@angular/common/http';\nimport { Inject, Injectable, Optional, PLATFORM_ID } from '@angular/core';\nimport { Router } from '@angular/router';\n\nimport { OAuthLogin } from '@posiwise/common-utilities';\n\nimport isEmpty from 'lodash/isEmpty';\nimport merge from 'lodash/merge';\n// Removed PSL import - using native JavaScript instead\nimport { BehaviorSubject, of, throwError } from 'rxjs';\nimport { distinctUntilChanged } from 'rxjs/operators';\nimport { getDomain } from 'tldts';\n\nimport { ApiResponse, DecryptedData } from './app-config.interface';\nimport { SERVER_DOMAIN_CONFIG } from './server-domain-config';\nimport { buildServerStubConfig } from './server-stub-config';\nimport { decryptWindowConfig } from './window-config-crypto';\n\ndeclare const window: Window & {\n config?: string;\n config_key?: string;\n oauth_login?: OAuthLogin;\n};\n\n@Injectable()\nexport class AppConfigService {\n private decryptedData;\n private googleApiKey: string;\n\n protected appConfigSubject$ = new BehaviorSubject<DecryptedData>({\n integrations: {\n google_api_key: ''\n },\n social_login_enabled: false, // Default value\n oauth_login: null // Default value\n });\n\n appConfig$ = this.appConfigSubject$.asObservable().pipe(distinctUntilChanged());\n\n constructor(\n private readonly api: HttpClient,\n private readonly router: Router,\n @Optional() @Inject(PLATFORM_ID) private readonly platformId?: object,\n @Optional()\n @Inject(SERVER_DOMAIN_CONFIG)\n private readonly serverConfig?: Partial<DecryptedData> | null\n ) {}\n\n load(environment) {\n return new Promise(resolve => {\n // Server render (SSR/prerender): there is no window, no localStorage and\n // no injected window.config. Use the domain metadata the renderer\n // provided via SERVER_DOMAIN_CONFIG over a shape-complete stub; the\n // browser re-runs load() during hydration with the real window.config.\n if (this.isServerRender()) {\n const config = { ...buildServerStubConfig(environment), ...this.serverConfig };\n this.googleApiKey = config.integrations?.google_api_key;\n this.appConfigSubject$.next(config);\n return resolve(true);\n }\n // Parse domain using native JavaScript instead of PSL\n const domainName =\n getDomain(window.location.host, { allowPrivateDomains: true }) ||\n window.location.host;\n\n if (environment.production) {\n // in case of production, the config is rendered from server_cicd.js which\n // embeds window.config = config from node\n\n let isTimeout = false; // Store the timeout ID\n\n // Wait for window.config to be available\n const waitForConfig = () => {\n if (window.config) {\n // Clear any pending timeout\n isTimeout = true;\n\n // Config is ready, continue with existing logic\n of({}).subscribe(async () => {\n const { config } = window;\n\n if (!config) {\n this.router.navigate(['/error-page'], {\n state: {\n message: 'Missing window.config during app initialization'\n }\n });\n return resolve(false);\n }\n\n // Decrypt configs. The key is injected at runtime by\n // server_cicd.js in the same inline script as\n // window.config (#4179 — the key no longer ships in\n // the JS bundle). environment.metadata_encryption_key\n // remains as a transition fallback for consumers whose\n // serving layer hasn't been updated yet.\n // #4218: decrypt is now AES-256-GCM via WebCrypto\n // (previously crypto-js AES-CBC, upstream discontinued).\n // subtle.decrypt returns a Promise so the callback is\n // async; wrong key / tampered payload / malformed input\n // all reject and land in the catch below.\n const decryptionKey =\n window.config_key || environment.metadata_encryption_key;\n try {\n const plaintext = await decryptWindowConfig(config, decryptionKey);\n this.decryptedData = JSON.parse(plaintext);\n } catch {\n // Wrong key / tampered payload → route to the\n // error page instead of dying inside the subscribe\n // with a white screen.\n this.decryptedData = null;\n } finally {\n // security: never leave the key on the global scope\n delete window.config_key;\n }\n\n if (isEmpty(this.decryptedData)) {\n this.router.navigate(['/error-page'], {\n state: { message: 'This domain seems to be misconfigured' }\n });\n } else {\n this.googleApiKey = this.decryptedData.integrations.google_api_key;\n this.decryptedData = { ...environment, ...this.decryptedData };\n // security: make sure we clean the config after reading it\n delete window.config;\n\n if (this.decryptedData?.social_login_enabled) {\n window['oauth_login'] = this.decryptedData['oauth_login'];\n }\n this.appConfigSubject$.next(this.decryptedData);\n window['main_tos_id'] = this.decryptedData?.main_tos_id;\n localStorage.setItem(\n 'company_title',\n this.decryptedData?.company?.title\n );\n }\n resolve(true);\n });\n } else if (!isTimeout) {\n // Store the timeout ID so we can clear it later\n setTimeout(waitForConfig, 100);\n }\n };\n\n // Start waiting for config\n waitForConfig();\n } else {\n this.api\n .get<ApiResponse>(`/main-api/v1/domains/metadata?host_name=${domainName}`)\n .subscribe({\n next: (data: ApiResponse) => {\n if (data?.type === 'warning') {\n this.router.navigate(['/error-page'], {\n state: { message: 'This domain seems to be misconfigured' }\n });\n } else {\n const config = merge(environment, data);\n if (config?.social_login_enabled) {\n window['oauth_login'] = config['oauth_login'];\n }\n this.googleApiKey = config.integrations.google_api_key;\n this.appConfigSubject$.next(config);\n window['main_tos_id'] = config?.main_tos_id;\n localStorage.setItem('company_title', config?.company?.title);\n }\n resolve(true);\n },\n error: () => {\n return throwError(() => new Error('metadata is not called'));\n }\n });\n }\n });\n }\n\n /** True on platform-server; also true where no window exists (e.g. a bare `new` in a spec). */\n private isServerRender(): boolean {\n return (\n (this.platformId !== undefined && isPlatformServer(this.platformId)) ||\n typeof window === 'undefined'\n );\n }\n\n getGoogleApiKey(): string {\n return this.googleApiKey;\n }\n}\n","import { Injectable } from '@angular/core';\n\nimport { AppConfigService } from './app-config.service';\n\n@Injectable()\nexport class AppConfigServiceStub extends AppConfigService {\n commonConfigFields = {\n join_message: null,\n product_id: 1,\n image: {\n url: 'https://posiwise-dev.s3.us-east-2.amazonaws.com/dev/public/default_shard/domain_pictures/3/cs_image-default_shard_2022-02-17-newimg-power.png'\n },\n image2: {\n url: 'https://posiwise-dev.s3.us-east-2.amazonaws.com/dev/public/default_shard/domain_pictures/3/cs_image2-default_shard_2022-02-17-white-label-2b.png'\n },\n image_bg: {\n url: 'https://posiwise-dev.s3.us-east-2.amazonaws.com/dev/public/default_shard/domain_pictures/3/cs_image_bg-default_shard_2022-02-17-banner-bg.jpg'\n },\n image_bg2: {\n url: 'https://posiwise-dev.s3.us-east-2.amazonaws.com/dev/public/default_shard/domain_pictures/3/cs_image_bg2-default_shard_2022-02-17-contact-us-bg.jpg'\n },\n video_url: 'https://www.youtube.com/embed/R7Vk219zbhA',\n book_demo_url: null,\n source_id: null,\n pdf_source_id: null,\n pdf_image: {\n url: 'https://posiwise-dev.s3.us-east-2.amazonaws.com/dev/public/default_shard/domain_pictures/3/cs_pdf_image-default_shard_2022-02-21-downloadpdfbook.png'\n },\n pdf_download_text:\n \"The rise of SaaS billings in today's marketplace means there has never been a more important time for MSPs to optimise cloud contract management. Download our best practice tips to manage your client contracts efficiently and with zero revenue leakage.\",\n cta_iframe:\n '\"\\\\u003ciframe src=\\\\\"https://my.upflowy.com/0jx-cloudolive?mode=standalone\\\\\"\\\\u003e\\\\u003c/iframe\\\\u003e\"',\n cs_cta_iframe:\n '\"\\\\u003ciframe src=\\\\\"https://my.upflowy.com/0jx-cloudolive?mode=standalone\\\\\"\\\\u003e\\\\u003c/iframe\\\\u003e\"',\n trial_cta_iframe:\n '\"\\\\u003ciframe src=\\\\\"https://my.upflowy.com/0jx-cloudolive?mode=standalone\\\\\"\\\\u003e\\\\u003c/iframe\\\\u003e\"'\n };\n\n config = {\n links: {\n frontend_link: 'https://www.dev.posiwise.com',\n socket_link: 'wss://main-websocket.dev.posiwise.com/',\n main_api: 'https://api-gateway.dev.posiwise.com/main-api/v1/',\n products_api: 'https://api-gateway.dev.posiwise.com/products-api/v1/',\n integrations_api: 'https://api-gateway.dev.posiwise.com/integrations-api/v1/',\n cloudolive_api: 'https://api-gateway.dev.posiwise.com/cloudolive-api/v1/',\n // Dedicated WS host for the Brain chat push socket (#45). main-api\n // surfaces it as `links.mcp_socket_link`, sourced from\n // `endpoints.brain_api.websocket_url`.\n mcp_socket_link: 'https://brain-api-websocket.dev.posiwise.com/brain-api/v1/'\n },\n url: '/',\n company: {\n number: '55 732 191 094',\n name: 'PosiWise',\n keywords: 'Innovation,Technology,ProofOfConcet,MVP,Business,Demo,Website,MobileApp,API',\n street: 'Rue des Hirondelles 15 - 1000 Brussels - Belgium',\n city: 'Brussels',\n city_code: '1000',\n state: 'Belgium',\n phone_number: '+32 (0)478 68 21 00',\n description:\n 'PosiWise - Creating positive changes in the world through innovation and wise investments.',\n email: 'info@posiwise.com',\n website: 'https://www.posiwise.com',\n blog_product_key: 'Dashboard_Demo1',\n logos: {\n header_squared_main: {\n url: null,\n version_200x200: {\n url: null\n },\n version_100x100: {\n url: null\n },\n version_50x50: {\n url: null\n }\n },\n header_squared_dark: {\n url: null,\n version_200x200: {\n url: null\n },\n version_100x100: {\n url: null\n },\n version_50x50: {\n url: null\n }\n },\n header_squared_contrast: {\n url: null,\n version_200x200: {\n url: null\n },\n version_100x100: {\n url: null\n },\n version_50x50: {\n url: null\n }\n },\n main: {\n url: 'https://posiwise-dev.s3.us-east-2.amazonaws.com/dev/public/default_shard/domain_pictures/3/logo_main-default_shard_2022-02-17-logo_main_dark-default_shard_2022-02-13-logo_text_big.png'\n },\n main_dark: {\n url: 'https://posiwise-dev.s3.us-east-2.amazonaws.com/dev/public/default_shard/domain_pictures/3/logo_main_dark-default_shard_2022-02-17-logo_main_dark-default_shard_2022-02-13-logo_text_big__1_.png',\n version_100x100: {\n url: 'https://posiwise-dev.s3.us-east-2.amazonaws.com/dev/public/default_shard/domain_pictures/3/version_100x100_logo_main_dark-default_shard_2022-02-17-logo_main_dark-default_shard_2022-02-13-logo_text_big__1_.png'\n }\n },\n main_contrast: {\n url: 'https://posiwise-dev.s3.us-east-2.amazonaws.com/dev/public/default_shard/domain_pictures/3/logo_main_contrast-default_shard_2022-02-17-logo_main_dark-default_shard_2022-02-13-logo_text_big__1_.png'\n }\n }\n },\n main_app_title:\n 'PosiWise - Creating positive changes in the world through innovation and wise investments.',\n favicon_path: 'favicon.ico',\n twitter_seo: { card: 'summary', site: '@posiwise', creator: '@posiwise' },\n color_codes: {\n first: '#f006c4',\n second: '#0fed28',\n third: '#fe8c14',\n titles: '#45d292',\n text: '#222',\n tabs_bg: '#0ceedd',\n tabs_text: '#FFFFFF',\n sidebar_bg: '#212529',\n sidebar_text: '#f70917'\n },\n social: {\n linkedin_url: 'https://www.linkedin.com',\n twitter_url: 'https://twitter.com',\n facebook_url: 'https://www.facebook.com',\n youtube_url: 'https://www.youtube.com/embed/5eV0uXjRxRs'\n },\n can_register_through_main_page: true,\n is_product_domain: true,\n social_login_enabled: true,\n main_tos_id: 1,\n crm: { subscription_id: 1, source_id: 1, product_id: 7 },\n master_subscription: { subscription_id: 1, product_id: 7 },\n signup_config: {\n coming_soon: {\n ...this.commonConfigFields\n },\n freemium: {\n ...this.commonConfigFields\n },\n trial: {\n ...this.commonConfigFields\n }\n },\n integrations: {\n sentry_config: { dsn: '' },\n drift_code: '',\n fb_app_id: '',\n captcha_key: '',\n captcha_key_V2: '',\n google_analytics: '',\n google_api_key: ''\n },\n oauth_login: {\n google: {\n client_id: ''\n },\n facebook: { client_id: '' },\n linkedin: { client_id: '' }\n }\n };\n\n override load() {\n return new Promise(resolve => {\n this.appConfigSubject$.next(this.config);\n\n resolve(true);\n });\n }\n}\n"],"mappings":";;;;;;;;;;AAWA,MAAa,uBAAuB,IAAI,eACpC,sBAAsB;ACF1B,SAAgB,sBAAsB,aAAgB;CAClD,OAAO;EACH,GAAG;EACH,KAAK;EACL,WAAW;EACX,KAAK;GAAE,WAAW;GAAG,iBAAiB;EAAC;EACvC,qBAAqB;GACjB,iBAAiB;GACjB,YAAY;EACf;EACD,OAAO;GACH,eAAe;GACf,eAAe;GACf,iBAAiB;GACjB,YAAY;EACf;EACD,UAAU;GACN,eAAe;GACf,eAAe;GACf,iBAAiB;GACjB,YAAY;EACf;EACD,IAAI;GACA,eAAe;GACf,eAAe;GACf,iBAAiB;GACjB,YAAY;EACf;EACD,aAAa;GACT,eAAe;GACf,eAAe;GACf,iBAAiB;GACjB,YAAY;EACf;EACD,cAAc;GACV,gBAAgB;GAChB,kBAAkB;GAClB,gBAAgB;GAChB,gBAAgB;GAChB,WAAW;GACX,YAAY;GACZ,cAAc;GACd,YAAY;EACf;EACD,SAAS;GACL,MAAM;GACN,OAAO;GACP,OAAO;GACP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;IACX,aAAa;IACb,gBAAgB;IAChB,kBAAkB;IAClB,gBAAgB;GACnB;GACD,aAAa;IACT,QAAQ,EACJ,WAAW,GACd;IACD,UAAU,EAAE,WAAW,GAAE;IACzB,UAAU,EAAE,WAAW,GAAE;GAC5B;EACJ;CASJ;CAPY,OAAI;EACT,OAAO,IAAI,SAAQ,YAAU;GACzB,KAAK,kBAAkB,KAAK,KAAK,MAAM;GAEvC,QAAQ,IAAI;EAChB,CAAC;CACL;CA9KS;EAAA,KAAA,OAAA,GAAA,mBAAA;GAAA,YAAA;GAAA,SAAA;GAAA,UAAA;GAAA,MAAA;GAAoB,MAAA;GAAA,QAAA,GAAA,gBAAA;EAAA,CAAA;CAAA;CAApB;EAAA,KAAA,QAAA,GAAA,sBAAA;GAAA,YAAA;GAAA,SAAA;GAAA,UAAA;GAAA,MAAA;EAAoB,CAAA;CAAA;;AAApB,GAAA,yBAAA;CAAA,YAAA;CAAA,SAAA;CAAA,UAAA;CAAA,MAAA;CAAoB,YAAA,CAAA,EADhC,MAAA,WAAA,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@posiwise/app-config-service",
3
- "version": "0.0.108",
3
+ "version": "0.0.109",
4
4
  "peerDependencies": {
5
5
  "@angular/common": "^22.2.0",
6
6
  "@angular/core": "^22.2.0"
@@ -2,6 +2,7 @@ import { HttpClient } from "@angular/common/http";
2
2
  import { Router } from "@angular/router";
3
3
  import { BehaviorSubject } from "rxjs";
4
4
  import * as i0 from "@angular/core";
5
+ import { InjectionToken } from "@angular/core";
5
6
  interface Company {
6
7
  logos?: {
7
8
  main?: {
@@ -13,6 +14,7 @@ interface Company {
13
14
  state?: string;
14
15
  street?: string;
15
16
  email?: string;
17
+ support_email?: string;
16
18
  city?: string;
17
19
  city_code?: string;
18
20
  }
@@ -98,14 +100,22 @@ interface ApiResponse {
98
100
  export declare class AppConfigService {
99
101
  private readonly api;
100
102
  private readonly router;
103
+ private readonly platformId?;
104
+ private readonly serverConfig?;
101
105
  private decryptedData;
102
106
  private googleApiKey;
103
107
  protected appConfigSubject$: BehaviorSubject<DecryptedData>;
104
108
  appConfig$: import("rxjs").Observable<DecryptedData>;
105
- constructor(api: HttpClient, router: Router);
109
+ constructor(api: HttpClient, router: Router, platformId?: object, serverConfig?: Partial<DecryptedData> | null);
106
110
  load(environment: any): Promise<unknown>;
111
+ /** True on platform-server; also true where no window exists (e.g. a bare `new` in a spec). */
112
+ private isServerRender;
107
113
  getGoogleApiKey(): string;
108
- static ɵfac: i0.ɵɵFactoryDeclaration<AppConfigService, never>;
114
+ static ɵfac: i0.ɵɵFactoryDeclaration<AppConfigService, [null, null, {
115
+ optional: true;
116
+ }, {
117
+ optional: true;
118
+ }]>;
109
119
  static ɵprov: i0.ɵɵInjectableDeclaration<any>;
110
120
  }
111
121
  export declare class AppConfigServiceStub extends AppConfigService {
@@ -357,4 +367,12 @@ export declare class AppConfigServiceStub extends AppConfigService {
357
367
  load(): Promise<unknown>;
358
368
  static ɵfac: i0.ɵɵFactoryDeclaration<AppConfigServiceStub, never>;
359
369
  static ɵprov: i0.ɵɵInjectableDeclaration<any>;
360
- }
370
+ }
371
+ /**
372
+ * Domain metadata for a server render (SSR/prerender).
373
+ *
374
+ * In the browser, server_cicd.js delivers the config as an encrypted window.config.
375
+ * A server render has no window, so the renderer passes the same metadata here
376
+ * instead, as plain data that never leaves the build process.
377
+ */
378
+ export declare const SERVER_DOMAIN_CONFIG: InjectionToken<Partial<DecryptedData>>;