@leapdev/app-platform 0.1.0-beta.3 → 0.1.0-beta.4

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 (142) hide show
  1. package/.eslintrc.json +25 -0
  2. package/package.json +15 -15
  3. package/project.json +27 -0
  4. package/src/index.ts +44 -0
  5. package/src/lib/app-platform.ts +270 -0
  6. package/src/lib/environment/environment.dictionary.ts +28 -0
  7. package/src/lib/environment/environment.ts +44 -0
  8. package/src/lib/environment/{index.d.ts → index.ts} +2 -2
  9. package/src/lib/environment/leap/env.dev.au.config.ts +33 -0
  10. package/src/lib/environment/leap/env.live.au.config.ts +32 -0
  11. package/src/lib/environment/leap/env.live.ca.config.ts +32 -0
  12. package/src/lib/environment/leap/env.live.nz.config.ts +32 -0
  13. package/src/lib/environment/leap/env.live.uk.config.ts +32 -0
  14. package/src/lib/environment/leap/env.live.us.config.ts +32 -0
  15. package/src/lib/environment/leap/env.liveb.au.config.ts +32 -0
  16. package/src/lib/environment/leap/env.test.au.config.ts +33 -0
  17. package/src/lib/environment/leap/env.test.ca.config.ts +33 -0
  18. package/src/lib/environment/leap/env.test.nz.config.ts +33 -0
  19. package/src/lib/environment/leap/env.test.uk.config.ts +33 -0
  20. package/src/lib/environment/leap/env.test.us.config.ts +33 -0
  21. package/src/lib/functions/helpers.ts +100 -0
  22. package/src/lib/functions/xml.ts +41 -0
  23. package/src/lib/models/calc-api.model.ts +74 -0
  24. package/src/lib/models/constants/index.ts +29 -0
  25. package/src/lib/models/{index.d.ts → index.ts} +1 -1
  26. package/src/lib/models/leap-events.model.ts +79 -0
  27. package/src/lib/models/leap.model.ts +78 -0
  28. package/src/lib/models/signalr.model.ts +22 -0
  29. package/src/lib/services/auth/auth.service.ts +219 -0
  30. package/src/lib/services/calc-api/calc-api-service.interface.ts +12 -0
  31. package/src/lib/services/calc-api/calc-word.service.ts +117 -0
  32. package/src/lib/services/calc-api/promise-helper.function.ts +26 -0
  33. package/src/lib/services/custom-xml-part.service.ts +340 -0
  34. package/src/lib/services/document/document.service.ts +33 -0
  35. package/src/lib/services/{index.d.ts → index.ts} +10 -5
  36. package/src/lib/services/leap-events.service.ts +489 -0
  37. package/src/lib/services/logger/logger.service.ts +42 -0
  38. package/src/lib/services/signalr/signalr.service.ts +88 -0
  39. package/tsconfig.json +20 -0
  40. package/tsconfig.lib.json +12 -0
  41. package/src/index.d.ts +0 -25
  42. package/src/index.js +0 -42
  43. package/src/index.js.map +0 -1
  44. package/src/lib/app-platform.d.ts +0 -37
  45. package/src/lib/app-platform.js +0 -231
  46. package/src/lib/app-platform.js.map +0 -1
  47. package/src/lib/environment/environment.d.ts +0 -37
  48. package/src/lib/environment/environment.dictionary.d.ts +0 -4
  49. package/src/lib/environment/environment.dictionary.js +0 -30
  50. package/src/lib/environment/environment.dictionary.js.map +0 -1
  51. package/src/lib/environment/environment.js +0 -17
  52. package/src/lib/environment/environment.js.map +0 -1
  53. package/src/lib/environment/index.js +0 -9
  54. package/src/lib/environment/index.js.map +0 -1
  55. package/src/lib/environment/leap/env.dev.au.config.d.ts +0 -32
  56. package/src/lib/environment/leap/env.dev.au.config.js +0 -36
  57. package/src/lib/environment/leap/env.dev.au.config.js.map +0 -1
  58. package/src/lib/environment/leap/env.live.au.config.d.ts +0 -32
  59. package/src/lib/environment/leap/env.live.au.config.js +0 -36
  60. package/src/lib/environment/leap/env.live.au.config.js.map +0 -1
  61. package/src/lib/environment/leap/env.live.ca.config.d.ts +0 -32
  62. package/src/lib/environment/leap/env.live.ca.config.js +0 -36
  63. package/src/lib/environment/leap/env.live.ca.config.js.map +0 -1
  64. package/src/lib/environment/leap/env.live.nz.config.d.ts +0 -32
  65. package/src/lib/environment/leap/env.live.nz.config.js +0 -36
  66. package/src/lib/environment/leap/env.live.nz.config.js.map +0 -1
  67. package/src/lib/environment/leap/env.live.uk.config.d.ts +0 -32
  68. package/src/lib/environment/leap/env.live.uk.config.js +0 -36
  69. package/src/lib/environment/leap/env.live.uk.config.js.map +0 -1
  70. package/src/lib/environment/leap/env.live.us.config.d.ts +0 -32
  71. package/src/lib/environment/leap/env.live.us.config.js +0 -36
  72. package/src/lib/environment/leap/env.live.us.config.js.map +0 -1
  73. package/src/lib/environment/leap/env.liveb.au.config.d.ts +0 -32
  74. package/src/lib/environment/leap/env.liveb.au.config.js +0 -36
  75. package/src/lib/environment/leap/env.liveb.au.config.js.map +0 -1
  76. package/src/lib/environment/leap/env.test.au.config.d.ts +0 -32
  77. package/src/lib/environment/leap/env.test.au.config.js +0 -36
  78. package/src/lib/environment/leap/env.test.au.config.js.map +0 -1
  79. package/src/lib/environment/leap/env.test.ca.config.d.ts +0 -32
  80. package/src/lib/environment/leap/env.test.ca.config.js +0 -36
  81. package/src/lib/environment/leap/env.test.ca.config.js.map +0 -1
  82. package/src/lib/environment/leap/env.test.nz.config.d.ts +0 -32
  83. package/src/lib/environment/leap/env.test.nz.config.js +0 -36
  84. package/src/lib/environment/leap/env.test.nz.config.js.map +0 -1
  85. package/src/lib/environment/leap/env.test.uk.config.d.ts +0 -32
  86. package/src/lib/environment/leap/env.test.uk.config.js +0 -36
  87. package/src/lib/environment/leap/env.test.uk.config.js.map +0 -1
  88. package/src/lib/environment/leap/env.test.us.config.d.ts +0 -32
  89. package/src/lib/environment/leap/env.test.us.config.js +0 -36
  90. package/src/lib/environment/leap/env.test.us.config.js.map +0 -1
  91. package/src/lib/functions/helpers.d.ts +0 -5
  92. package/src/lib/functions/helpers.js +0 -95
  93. package/src/lib/functions/helpers.js.map +0 -1
  94. package/src/lib/functions/xml.d.ts +0 -2
  95. package/src/lib/functions/xml.js +0 -41
  96. package/src/lib/functions/xml.js.map +0 -1
  97. package/src/lib/models/calc-api.model.d.ts +0 -57
  98. package/src/lib/models/calc-api.model.js +0 -39
  99. package/src/lib/models/calc-api.model.js.map +0 -1
  100. package/src/lib/models/constants/index.d.ts +0 -28
  101. package/src/lib/models/constants/index.js +0 -32
  102. package/src/lib/models/constants/index.js.map +0 -1
  103. package/src/lib/models/index.js +0 -5
  104. package/src/lib/models/index.js.map +0 -1
  105. package/src/lib/models/leap-events.model.d.ts +0 -56
  106. package/src/lib/models/leap-events.model.js +0 -71
  107. package/src/lib/models/leap-events.model.js.map +0 -1
  108. package/src/lib/models/leap.model.d.ts +0 -63
  109. package/src/lib/models/leap.model.js +0 -29
  110. package/src/lib/models/leap.model.js.map +0 -1
  111. package/src/lib/models/signalr.model.d.ts +0 -21
  112. package/src/lib/models/signalr.model.js +0 -3
  113. package/src/lib/models/signalr.model.js.map +0 -1
  114. package/src/lib/services/auth/auth.service.d.ts +0 -13
  115. package/src/lib/services/auth/auth.service.js +0 -185
  116. package/src/lib/services/auth/auth.service.js.map +0 -1
  117. package/src/lib/services/calc-api/calc-api-service.interface.d.ts +0 -6
  118. package/src/lib/services/calc-api/calc-api-service.interface.js +0 -3
  119. package/src/lib/services/calc-api/calc-api-service.interface.js.map +0 -1
  120. package/src/lib/services/calc-api/calc-word.service.d.ts +0 -12
  121. package/src/lib/services/calc-api/calc-word.service.js +0 -99
  122. package/src/lib/services/calc-api/calc-word.service.js.map +0 -1
  123. package/src/lib/services/calc-api/promise-helper.function.d.ts +0 -2
  124. package/src/lib/services/calc-api/promise-helper.function.js +0 -32
  125. package/src/lib/services/calc-api/promise-helper.function.js.map +0 -1
  126. package/src/lib/services/custom-xml-part.service.d.ts +0 -5
  127. package/src/lib/services/custom-xml-part.service.js +0 -269
  128. package/src/lib/services/custom-xml-part.service.js.map +0 -1
  129. package/src/lib/services/document/document.service.d.ts +0 -16
  130. package/src/lib/services/document/document.service.js +0 -32
  131. package/src/lib/services/document/document.service.js.map +0 -1
  132. package/src/lib/services/index.js +0 -9
  133. package/src/lib/services/index.js.map +0 -1
  134. package/src/lib/services/leap-events.service.d.ts +0 -26
  135. package/src/lib/services/leap-events.service.js +0 -357
  136. package/src/lib/services/leap-events.service.js.map +0 -1
  137. package/src/lib/services/logger/logger.service.d.ts +0 -10
  138. package/src/lib/services/logger/logger.service.js +0 -39
  139. package/src/lib/services/logger/logger.service.js.map +0 -1
  140. package/src/lib/services/signalr/signalr.service.d.ts +0 -9
  141. package/src/lib/services/signalr/signalr.service.js +0 -93
  142. package/src/lib/services/signalr/signalr.service.js.map +0 -1
package/.eslintrc.json ADDED
@@ -0,0 +1,25 @@
1
+ {
2
+ "extends": ["../../.eslintrc.json"],
3
+ "ignorePatterns": ["!**/*"],
4
+ "overrides": [
5
+ {
6
+ "files": ["*.ts", "*.tsx", "*.js", "*.jsx"],
7
+ "rules": {}
8
+ },
9
+ {
10
+ "files": ["*.ts", "*.tsx"],
11
+ "rules": {}
12
+ },
13
+ {
14
+ "files": ["*.js", "*.jsx"],
15
+ "rules": {}
16
+ },
17
+ {
18
+ "files": ["*.json"],
19
+ "parser": "jsonc-eslint-parser",
20
+ "rules": {
21
+ "@nx/dependency-checks": "error"
22
+ }
23
+ }
24
+ ]
25
+ }
package/package.json CHANGED
@@ -1,15 +1,15 @@
1
- {
2
- "name": "@leapdev/app-platform",
3
- "version": "0.1.0-beta.3",
4
- "dependencies": {
5
- "tslib": "^2.3.0",
6
- "vkbeautify": "^0.99.3",
7
- "xml2js": "^0.6.2",
8
- "os-browserify": "^0.3.0",
9
- "loglevel": "^1.6.3",
10
- "rxjs": "7.8.0"
11
- },
12
- "type": "commonjs",
13
- "main": "./src/index.js",
14
- "typings": "./src/index.d.ts"
15
- }
1
+ {
2
+ "name": "@leapdev/app-platform",
3
+ "version": "0.1.0-beta.4",
4
+ "dependencies": {
5
+ "tslib": "^2.3.0",
6
+ "vkbeautify": "^0.99.3",
7
+ "xml2js": "^0.6.2",
8
+ "os-browserify": "^0.3.0",
9
+ "loglevel": "^1.6.3",
10
+ "rxjs": "7.8.0"
11
+ },
12
+ "type": "commonjs",
13
+ "main": "./src/index.js",
14
+ "typings": "./src/index.d.ts"
15
+ }
package/project.json ADDED
@@ -0,0 +1,27 @@
1
+ {
2
+ "name": "app-platform",
3
+ "$schema": "../../node_modules/nx/schemas/project-schema.json",
4
+ "sourceRoot": "packages/app-platform/src",
5
+ "projectType": "library",
6
+ "targets": {
7
+ "build": {
8
+ "executor": "@nx/js:tsc",
9
+ "outputs": ["{options.outputPath}"],
10
+ "options": {
11
+ "outputPath": "dist/packages/app-platform",
12
+ "main": "packages/app-platform/src/index.ts",
13
+ "tsConfig": "packages/app-platform/tsconfig.lib.json",
14
+ "assets": ["packages/app-platform/*.md"]
15
+ }
16
+ },
17
+ "publish": {
18
+ "command": "node tools/scripts/publish.mjs app-platform {args.ver} {args.tag}",
19
+ "dependsOn": ["build"]
20
+ },
21
+ "lint": {
22
+ "executor": "@nx/eslint:lint",
23
+ "outputs": ["{options.outputFile}"]
24
+ }
25
+ },
26
+ "tags": []
27
+ }
package/src/index.ts ADDED
@@ -0,0 +1,44 @@
1
+ export * from './lib/environment';
2
+ export * from './lib/models';
3
+ export * from './lib/services';
4
+
5
+ import { AppPlatform } from './lib/app-platform';
6
+ import { EvaluatePathsRequest } from './lib/models';
7
+
8
+ const appPlatform = new AppPlatform();
9
+
10
+ export const initAppPlatform = () => {
11
+ return appPlatform.init();
12
+ };
13
+
14
+ export const getDocumentData = () => {
15
+ return appPlatform.getDocumentData();
16
+ };
17
+
18
+ export const evaluatePaths = (request: EvaluatePathsRequest) => {
19
+ return appPlatform.evaluatePaths(request);
20
+ };
21
+
22
+ export const createDocument = (params: {
23
+ precedentId: string;
24
+ body: string;
25
+ closeExisting?: boolean;
26
+ }) => {
27
+ return appPlatform.createDocument(params);
28
+ };
29
+
30
+ export const getLEAPTokenViaSignalR = (forceRefresh?: boolean) => {
31
+ return appPlatform.getLEAPTokenViaSignalR(forceRefresh);
32
+ };
33
+
34
+ export const getLEAPUserViaSignalR = () => {
35
+ return appPlatform.getLEAPUserViaSignalR();
36
+ };
37
+
38
+ export const getInitDataViaSignalR = () => {
39
+ return appPlatform.getInitDataViaSignalR();
40
+ };
41
+
42
+ export const connectSignalR = (params: { clientId: string }) => {
43
+ return appPlatform.connectToSignalR(params);
44
+ };
@@ -0,0 +1,270 @@
1
+ import { EvaluatePathsRequest, EvaluatePathsResponse } from './models';
2
+ import { constants } from './models/constants';
3
+ import {
4
+ LeapEvent,
5
+ LeapEventAction,
6
+ LeapEventType,
7
+ } from './models/leap-events.model';
8
+ import { LeapDocumentData, LEAPUser } from './models/leap.model';
9
+ import { SignalRInitData } from './models/signalr.model';
10
+ import { CalcWordService, DocumentService, LoggerService } from './services';
11
+ import { AuthService } from './services/auth/auth.service';
12
+ import { timeout } from './services/calc-api/promise-helper.function';
13
+ import { getDataByNamespace } from './services/custom-xml-part.service';
14
+ import { LeapEventsService } from './services/leap-events.service';
15
+ import { SignalRService } from './services/signalr/signalr.service';
16
+
17
+ export class AppPlatform {
18
+ private leapEventsService: LeapEventsService;
19
+ private loggerService: LoggerService;
20
+ private calcWordService: CalcWordService;
21
+ private documentService: DocumentService;
22
+ private signalRService: SignalRService;
23
+ private _openViaLEAP: boolean = false;
24
+ #authService: AuthService | null = null;
25
+ #signalRInitData: SignalRInitData | null = null;
26
+
27
+ constructor() {
28
+ this.loggerService = new LoggerService(false);
29
+ this.leapEventsService = new LeapEventsService();
30
+ this.calcWordService = new CalcWordService(
31
+ this.leapEventsService,
32
+ this.loggerService
33
+ );
34
+ this.documentService = new DocumentService(
35
+ this.leapEventsService,
36
+ this.loggerService
37
+ );
38
+ this.signalRService = new SignalRService();
39
+ }
40
+
41
+ public async init(): Promise<{done: boolean; openViaLEAP: boolean}> {
42
+ try {
43
+ const data = await this.getWordCustomPart();
44
+ if (data) {
45
+ this._openViaLEAP = true;
46
+ this.loggerService.log(
47
+ `[INIT] Setup LEAP Events and set token in custom xml part`
48
+ );
49
+ await this.setupLeapEvents();
50
+ await this.setTokenInCustomXml();
51
+ return { done: true, openViaLEAP: true };
52
+ } else {
53
+ this.loggerService.log(`[INIT] Document not open via LEAP`);
54
+ this._openViaLEAP = false;
55
+ return { done: true, openViaLEAP: false };
56
+ }
57
+ } catch (_) {
58
+ return { done: false, openViaLEAP: false };
59
+ }
60
+ }
61
+
62
+ public async connectToSignalR(params: { clientId: string }): Promise<boolean> {
63
+ const { clientId } = params;
64
+ await this.signalRService.connectToSignalR();
65
+ this.#signalRInitData = await this.signalRService.getInitData({ clientId });
66
+ if (this.#signalRInitData) {
67
+ const { code, codeChallenge, environment } = this.#signalRInitData;
68
+ this.#authService = new AuthService({
69
+ code,
70
+ codeVerifier: codeChallenge,
71
+ clientId,
72
+ env: environment,
73
+ });
74
+ const done = await this.#authService.init();
75
+ return done;
76
+ } else {
77
+ return false;
78
+ }
79
+ }
80
+
81
+ public getLEAPTokenViaSignalR(forceRefresh?: boolean): Promise<string> {
82
+ if (this.#authService) {
83
+ return this.#authService.getRefreshedAccessToken(forceRefresh);
84
+ } else {
85
+ return new Promise((resolve) => resolve(''));
86
+ }
87
+ }
88
+
89
+ public getLEAPUserViaSignalR(): Promise<LEAPUser | undefined> {
90
+ if (this.#authService) {
91
+ const user = this.#authService.getLEAPUser();
92
+ return new Promise((resolve) => resolve(user));
93
+ } else {
94
+ return new Promise((resolve) => resolve(undefined));
95
+ }
96
+ }
97
+
98
+ public getInitDataViaSignalR(): Promise<Omit<
99
+ SignalRInitData,
100
+ 'code' | 'codeChallenge'
101
+ > | null> {
102
+ return new Promise((resolve) => {
103
+ if (this.#signalRInitData) {
104
+ const data: Omit<SignalRInitData, 'code' | 'codeChallenge'> = {
105
+ contentModeEnabled: this.#signalRInitData.contentModeEnabled,
106
+ country: this.#signalRInitData.country,
107
+ countryCode: this.#signalRInitData.countryCode,
108
+ hostType: this.#signalRInitData.hostType,
109
+ hostVersion: this.#signalRInitData.hostVersion,
110
+ environment: this.#signalRInitData.environment,
111
+ firmId: this.#signalRInitData.firmId,
112
+ staffId: this.#signalRInitData.staffId,
113
+ userId: this.#signalRInitData.userId,
114
+ userName: this.#signalRInitData.userName,
115
+ };
116
+ resolve(data);
117
+ } else {
118
+ resolve(null);
119
+ }
120
+ });
121
+ }
122
+
123
+ public async getDocumentData(): Promise<LeapDocumentData | null> {
124
+ try {
125
+ if (!this._openViaLEAP) {
126
+ this.loggerService.log(`[getDocumentData] Document not open via LEAP`);
127
+ return null;
128
+ }
129
+ //todo don't use any in getDataByNamespace's response
130
+ const data = await getDataByNamespace(
131
+ constants.LeapDocumentDataNamespace
132
+ );
133
+ if (data) {
134
+ return data as LeapDocumentData;
135
+ }
136
+ return null;
137
+ } catch (error) {
138
+ this.loggerService.error(`[ERROR] Get Document Data: ${error}`);
139
+ return null;
140
+ }
141
+ }
142
+
143
+ public async evaluatePaths(
144
+ request: EvaluatePathsRequest
145
+ ): Promise<Array<EvaluatePathsResponse> | null> {
146
+ try {
147
+ if (!this._openViaLEAP) {
148
+ this.loggerService.log(`[evaluatePaths] Document not open via LEAP`);
149
+ return null;
150
+ }
151
+ const data = await this.calcWordService.evaluatePaths(request);
152
+ if (data) {
153
+ return data;
154
+ }
155
+ return null;
156
+ } catch (error) {
157
+ this.loggerService.error(`[ERROR] Evaluate Paths: ${error}`);
158
+ return null;
159
+ }
160
+ }
161
+
162
+ public async createDocument(params: {
163
+ precedentId: string;
164
+ body: string;
165
+ closeExisting?: boolean;
166
+ }) {
167
+ if (!this._openViaLEAP) {
168
+ this.loggerService.log(`[createDocument] Document not open via LEAP`);
169
+ return null;
170
+ }
171
+ return this.documentService.createDocument(params);
172
+ }
173
+
174
+ private async setupLeapEvents(): Promise<void> {
175
+ try {
176
+ await this.leapEventsService.addHandler(
177
+ Office.EventType.NodeInserted,
178
+ (result: Office.NodeInsertedEventArgs) => {
179
+ this.leapEventsService.handleCustomXmlPartNodeEvent(
180
+ Office.EventType.NodeInserted,
181
+ result
182
+ );
183
+ }
184
+ );
185
+ } catch (error) {
186
+ this.loggerService.error(`[SetupLeapEvents] Failed: ${error}`);
187
+ }
188
+ }
189
+
190
+ private setTokenInCustomXml(): Promise<void> {
191
+ let subscriptionId: string;
192
+ return new Promise((resolve, reject) => {
193
+ Promise.resolve(() => {
194
+ this.loggerService.log(`[LEAP Event] WordApp_GetToken`);
195
+ })
196
+ .then(() => {
197
+ const id = new Date().getTime().toString();
198
+ return this.leapEventsService.addEvent({
199
+ id,
200
+ correlationId: null,
201
+ eventType: LeapEventType.WordAppEvent,
202
+ action: LeapEventAction.WordApp_GetToken,
203
+ data: null,
204
+ });
205
+ })
206
+ .then((event) => {
207
+ this.loggerService.log('[LEAP Event] WordApp_GetToken request sent');
208
+
209
+ // Subscribe
210
+ const leapEventResponseHandlerPromise = new Promise<Array<any>>(
211
+ (innerResolve, innerReject) => {
212
+ subscriptionId = this.leapEventsService.subscribe(
213
+ event.id,
214
+ LeapEventType.WordAppEventResponse,
215
+ LeapEventAction.WordApp_GetTokenResponse,
216
+ (leapEvent: LeapEvent) =>
217
+ this.leapEventsService.handleLeapEventResponse<Array<any>>(
218
+ leapEvent,
219
+ { resolve: innerResolve, reject: innerReject }
220
+ )
221
+ );
222
+ }
223
+ );
224
+
225
+ return timeout(leapEventResponseHandlerPromise, 1000);
226
+ })
227
+ .then(() => {
228
+ // Return result
229
+ resolve();
230
+ })
231
+ .catch((error: any) => {
232
+ this.loggerService.error(
233
+ `[LEAP Event] WordApp_GetToken request failed: ${error}`
234
+ );
235
+ reject(error);
236
+ })
237
+ .then(() => {
238
+ // Unsubscribe
239
+ return this.leapEventsService.unsubscribe(subscriptionId);
240
+ })
241
+ .then((unsubscribeSuccess: boolean) => {
242
+ if (unsubscribeSuccess === true) {
243
+ this.loggerService.log(
244
+ `[LEAP Event] WordApp_GetToken request successfully unsubscribed ${subscriptionId}`
245
+ );
246
+ } else {
247
+ this.loggerService.warn(
248
+ `[LEAP Event] WordApp_GetToken request failed to unsubscribe from ${subscriptionId}`
249
+ );
250
+ }
251
+ });
252
+ });
253
+ }
254
+
255
+ private async getWordCustomPart(): Promise<{ LEAP_GUID: string } | null> {
256
+ try {
257
+ const data = await getDataByNamespace(
258
+ constants.LeapWordCustomPartNamespace,
259
+ 0
260
+ );
261
+ if (data) {
262
+ return data;
263
+ }
264
+ return null;
265
+ } catch (error) {
266
+ this.loggerService.error(`[ERROR] Get WordCustomPart: ${error}`);
267
+ return null;
268
+ }
269
+ }
270
+ }
@@ -0,0 +1,28 @@
1
+ import { leap_dev_au } from './leap/env.dev.au.config';
2
+ import { leap_test_au } from './leap/env.test.au.config';
3
+ import { leap_live_au } from './leap/env.live.au.config';
4
+ import { leap_liveb_au } from './leap/env.liveb.au.config';
5
+ import { leap_test_nz } from './leap/env.test.nz.config';
6
+ import { leap_live_nz } from './leap/env.live.nz.config';
7
+ import { leap_test_us } from './leap/env.test.us.config';
8
+ import { leap_live_us } from './leap/env.live.us.config';
9
+ import { leap_test_ca } from './leap/env.test.ca.config';
10
+ import { leap_live_ca } from './leap/env.live.ca.config';
11
+ import { leap_test_uk } from './leap/env.test.uk.config';
12
+ import { leap_live_uk } from './leap/env.live.uk.config';
13
+ import { Environment } from './environment';
14
+
15
+ export const environment_dictionary: { [key: string]: Environment } = {
16
+ leap_dev_au,
17
+ leap_test_au,
18
+ leap_live_au,
19
+ leap_liveb_au,
20
+ leap_test_nz,
21
+ leap_live_nz,
22
+ leap_test_uk,
23
+ leap_live_uk,
24
+ leap_test_us,
25
+ leap_live_us,
26
+ leap_test_ca,
27
+ leap_live_ca,
28
+ };
@@ -0,0 +1,44 @@
1
+ export abstract class Environment {
2
+ abstract envName: string; // Default
3
+ abstract brand: string;
4
+ abstract region: string;
5
+ abstract production: boolean;
6
+ abstract imports: any[];
7
+ abstract keys: {
8
+ pnSubscribe: string;
9
+ };
10
+ abstract authApi: {
11
+ baseUrl: string;
12
+ clientId: string;
13
+ redirectPath: string;
14
+ };
15
+ abstract automation: string;
16
+ abstract docsApi: string;
17
+ abstract schemaApi: string;
18
+ abstract leapDesignApi: {
19
+ baseUrl: string;
20
+ projectId: string;
21
+ };
22
+ abstract calcApi: {
23
+ remote: string;
24
+ local?: string;
25
+ };
26
+ abstract docBuilderApi: {
27
+ remote: string;
28
+ local?: string;
29
+ };
30
+ abstract pubSubApi: string;
31
+ abstract pubSubNotificationPublishKey: string;
32
+ }
33
+
34
+ export class LeapEnvironment {
35
+ static config: Environment = {} as Environment;
36
+
37
+ static getConfig(): Environment {
38
+ return this.config;
39
+ }
40
+
41
+ static setConfig(newConfig: Environment): void {
42
+ this.config = newConfig;
43
+ }
44
+ }
@@ -1,2 +1,2 @@
1
- export { Environment, LeapEnvironment } from './environment';
2
- export { environment_dictionary } from './environment.dictionary';
1
+ export { Environment, LeapEnvironment } from './environment';
2
+ export { environment_dictionary } from './environment.dictionary';
@@ -0,0 +1,33 @@
1
+ export const leap_dev_au = {
2
+ envName: 'dev',
3
+ brand: 'LEAP',
4
+ region: 'au',
5
+ production: false,
6
+ imports: [],
7
+ keys: {
8
+ pnSubscribe: 'sub-a456f002-0095-11e2-9638-9581afc33ebf',
9
+ },
10
+ authApi: {
11
+ baseUrl: 'https://auth.dev.leap.services',
12
+ clientId: 'OBIUNINUL9DBSR8F',
13
+ redirectPath: 'index.html',
14
+ },
15
+ automation: 'https://office-automation-api-dev.leapaws.com.au',
16
+ docsApi: 'https://api-docs-dev.leapaws.com.au',
17
+ schemaApi: 'https://schema-api.dev.leap.services',
18
+ leapDesignApi: {
19
+ baseUrl: 'https://leapdesign.leapaws.com.au',
20
+ projectId: 'Test',
21
+ },
22
+ calcApi: {
23
+ remote: 'https://leapcalc.dev.leap.services',
24
+ local: 'http://localhost:9091',
25
+ },
26
+ docBuilderApi: {
27
+ remote: 'https://doc-builder-dev.leapaws.com.au',
28
+ local: 'http://localhost:9092',
29
+ },
30
+ pubSubApi: 'https://leap-pubsub.dev.leapaws.com.au',
31
+ pubSubNotificationPublishKey:
32
+ 'AOG98zJZyz2akUiK2JID4xK-pvN8PfXz7NYYgwyA3gw5AzFuRMrvqw==',
33
+ };
@@ -0,0 +1,32 @@
1
+ export const leap_live_au = {
2
+ envName: 'live',
3
+ brand: 'LEAP',
4
+ region: 'au',
5
+ production: true,
6
+ imports: [],
7
+ keys: {
8
+ pnSubscribe: 'sub-a456f002-0095-11e2-9638-9581afc33ebf',
9
+ },
10
+ authApi: {
11
+ baseUrl: 'https://auth.leap.services',
12
+ clientId: 'XKGMO3JQNSZOYDK2',
13
+ redirectPath: 'index.html',
14
+ },
15
+ automation: 'https://office-automation-api-live.leapaws.com.au',
16
+ docsApi: 'https://api-docs.leapaws.com.au',
17
+ schemaApi: 'https://schema-api-au-live.leap.services',
18
+ leapDesignApi: {
19
+ baseUrl: 'https://leapdesign.leapaws.com.au',
20
+ projectId: 'Live',
21
+ },
22
+ calcApi: {
23
+ remote: 'https://leapcalc-au-live.leap.services',
24
+ local: 'http://localhost:9091',
25
+ },
26
+ docBuilderApi: {
27
+ remote: 'https://doc-builder.leapaws.com.au',
28
+ local: 'http://localhost:9092',
29
+ },
30
+ pubSubApi: '',
31
+ pubSubNotificationPublishKey: '',
32
+ };
@@ -0,0 +1,32 @@
1
+ export const leap_live_ca = {
2
+ envName: 'live',
3
+ brand: 'LEAP',
4
+ region: 'ca',
5
+ production: true,
6
+ imports: [],
7
+ keys: {
8
+ pnSubscribe: 'sub-a456f002-0095-11e2-9638-9581afc33ebf',
9
+ },
10
+ authApi: {
11
+ baseUrl: 'https://auth.leap.services',
12
+ clientId: 'XKGMO3JQNSZOYDK2',
13
+ redirectPath: 'index.html',
14
+ },
15
+ automation: 'https://office-automation-api.leapaws.ca',
16
+ docsApi: 'https://api-docs.leapaws.ca',
17
+ schemaApi: 'https://schema-api.ca.leap.services',
18
+ leapDesignApi: {
19
+ baseUrl: 'https://leapdesign.leapaws.ca',
20
+ projectId: 'Live',
21
+ },
22
+ calcApi: {
23
+ remote: 'https://leapcalc.ca.leap.services',
24
+ local: 'http://localhost:9091',
25
+ },
26
+ docBuilderApi: {
27
+ remote: 'https://doc-builder.leapaws.ca',
28
+ local: 'http://localhost:9092',
29
+ },
30
+ pubSubApi: '',
31
+ pubSubNotificationPublishKey: '',
32
+ };
@@ -0,0 +1,32 @@
1
+ export const leap_live_nz = {
2
+ envName: 'live',
3
+ brand: 'LEAP',
4
+ region: 'au',
5
+ production: true,
6
+ imports: [],
7
+ keys: {
8
+ pnSubscribe: 'sub-a456f002-0095-11e2-9638-9581afc33ebf',
9
+ },
10
+ authApi: {
11
+ baseUrl: 'https://auth.leap.services',
12
+ clientId: 'XKGMO3JQNSZOYDK2',
13
+ redirectPath: 'index.html',
14
+ },
15
+ automation: 'https://office-automation-api-live.leapaws.com.au',
16
+ docsApi: 'https://api-docs.leapaws.com.au',
17
+ schemaApi: 'https://schema-api-au-live.leap.services',
18
+ leapDesignApi: {
19
+ baseUrl: 'https://leapdesign.leapaws.com.au',
20
+ projectId: 'Live',
21
+ },
22
+ calcApi: {
23
+ remote: 'https://leapcalc-au-live.leap.services',
24
+ local: 'http://localhost:9091',
25
+ },
26
+ docBuilderApi: {
27
+ remote: 'https://doc-builder.leapaws.com.au',
28
+ local: 'http://localhost:9092',
29
+ },
30
+ pubSubApi: '',
31
+ pubSubNotificationPublishKey: '',
32
+ };
@@ -0,0 +1,32 @@
1
+ export const leap_live_uk = {
2
+ envName: 'live',
3
+ brand: 'LEAP',
4
+ region: 'uk',
5
+ production: true,
6
+ imports: [],
7
+ keys: {
8
+ pnSubscribe: 'sub-a456f002-0095-11e2-9638-9581afc33ebf',
9
+ },
10
+ authApi: {
11
+ baseUrl: 'https://auth.leap.services',
12
+ clientId: 'XKGMO3JQNSZOYDK2',
13
+ redirectPath: 'index.html',
14
+ },
15
+ automation: 'https://office-automation-api-live.leapaws.co.uk',
16
+ docsApi: 'https://api-docs.leapaws.co.uk',
17
+ schemaApi: 'https://schema-api-uk-live.leap.services',
18
+ leapDesignApi: {
19
+ baseUrl: 'https://leapdesign.leapaws.co.uk',
20
+ projectId: 'Live',
21
+ },
22
+ calcApi: {
23
+ remote: 'https://leapcalc-uk-live.leap.services',
24
+ local: 'http://localhost:9091',
25
+ },
26
+ docBuilderApi: {
27
+ remote: 'https://doc-builder.leapaws.co.uk',
28
+ local: 'http://localhost:9092',
29
+ },
30
+ pubSubApi: '',
31
+ pubSubNotificationPublishKey: '',
32
+ };
@@ -0,0 +1,32 @@
1
+ export const leap_live_us = {
2
+ envName: 'live',
3
+ brand: 'LEAP',
4
+ region: 'us',
5
+ production: true,
6
+ imports: [],
7
+ keys: {
8
+ pnSubscribe: 'sub-a456f002-0095-11e2-9638-9581afc33ebf',
9
+ },
10
+ authApi: {
11
+ baseUrl: 'https://auth.leap.services',
12
+ clientId: 'XKGMO3JQNSZOYDK2',
13
+ redirectPath: 'index.html',
14
+ },
15
+ automation: 'https://office-automation-api-live.leapaws.com',
16
+ docsApi: 'https://api-docs.leapaws.com',
17
+ schemaApi: 'https://schema-api-us-live.leap.services',
18
+ leapDesignApi: {
19
+ baseUrl: 'https://leapdesign.leapaws.com',
20
+ projectId: 'Live',
21
+ },
22
+ calcApi: {
23
+ remote: 'https://leapcalc-us-live.leap.services',
24
+ local: 'http://localhost:9091',
25
+ },
26
+ docBuilderApi: {
27
+ remote: 'https://doc-builder.leapaws.com',
28
+ local: 'http://localhost:9092',
29
+ },
30
+ pubSubApi: '',
31
+ pubSubNotificationPublishKey: '',
32
+ };