@transcommerce/cwm-shared 1.1.40 → 1.1.42
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/fesm2022/transcommerce-cwm-shared.mjs +387 -280
- package/fesm2022/transcommerce-cwm-shared.mjs.map +1 -1
- package/lib/factories/msal-interceptor-config.factory.d.ts +3 -1
- package/lib/factories/msal.guard.config.factory.d.ts +3 -1
- package/lib/factories/msal.instance.factory.d.ts +3 -1
- package/lib/models/config/auth-config.d.ts +2 -0
- package/lib/models/config/configuration.d.ts +3 -0
- package/lib/models/config/subscription-config.d.ts +1 -2
- package/lib/models/subscription.d.ts +2 -5
- package/lib/services/base-api.service.d.ts +2 -1
- package/lib/services/class-logger.service.d.ts +6 -2
- package/lib/services/ibase-api.service.d.ts +1 -0
- package/lib/services/inventory-api.service.d.ts +1 -1
- package/lib/services/subscription-api.service.d.ts +13 -0
- package/package.json +1 -1
- package/public-api.d.ts +1 -1
- package/lib/services/customer-api.service.d.ts +0 -11
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { Component, Injectable, Pipe, NgModule } from '@angular/core';
|
|
2
|
+
import { Component, Injectable, InjectionToken, Pipe, NgModule, Inject } from '@angular/core';
|
|
3
3
|
import * as i1 from '@angular/router';
|
|
4
4
|
import * as i2 from '@angular/forms';
|
|
5
5
|
import { FormsModule } from '@angular/forms';
|
|
6
6
|
import { InteractionType, PublicClientApplication, LogLevel } from '@azure/msal-browser';
|
|
7
7
|
import * as i2$1 from '@angular/common/http';
|
|
8
8
|
import { HttpResponseBase, HttpResponse, HttpErrorResponse, HttpHeaders, HttpStatusCode } from '@angular/common/http';
|
|
9
|
-
import { CommonModule } from '@angular/common';
|
|
9
|
+
import { CommonModule, DOCUMENT } from '@angular/common';
|
|
10
10
|
export * from '@angular/common';
|
|
11
11
|
import { MsalModule } from '@azure/msal-angular';
|
|
12
12
|
export * from '@azure/msal-angular';
|
|
@@ -113,79 +113,245 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.18", ngImpo
|
|
|
113
113
|
args: [{ selector: 'cwm-page-not-found', standalone: false, template: "<p>\n Page Not Found\n</p>\n" }]
|
|
114
114
|
}] });
|
|
115
115
|
|
|
116
|
-
|
|
117
|
-
|
|
116
|
+
/*
|
|
117
|
+
* A simple generic LIFO stack.
|
|
118
|
+
*
|
|
119
|
+
* Example:
|
|
120
|
+
* ```ts
|
|
121
|
+
* const s = new Stack<number>();
|
|
122
|
+
* s.push(1);
|
|
123
|
+
* s.push(2);
|
|
124
|
+
* console.log(s.pop());
|
|
125
|
+
* @typeParam T - Type of items stored in the stack.
|
|
126
|
+
* ```
|
|
127
|
+
*/
|
|
128
|
+
class Stack {
|
|
129
|
+
items = [];
|
|
130
|
+
/*
|
|
131
|
+
Pushes an item onto the top of the stack.
|
|
132
|
+
@param item - Item to push.
|
|
133
|
+
*/
|
|
134
|
+
push(item) { this.items.push(item); }
|
|
135
|
+
/*
|
|
136
|
+
Removes and returns the item at the top of the stack.
|
|
137
|
+
@returns The popped item, or undefined if the stack is empty.
|
|
138
|
+
*/
|
|
139
|
+
pop() { return this.items.pop(); }
|
|
140
|
+
/*
|
|
141
|
+
Returns the item at the top without removing it.
|
|
142
|
+
@returns The top item, or undefined if the stack is empty.
|
|
143
|
+
*/
|
|
144
|
+
peek() { return this.items[this.items.length - 1]; }
|
|
145
|
+
/*
|
|
146
|
+
Number of items currently in the stack.
|
|
147
|
+
*/
|
|
148
|
+
get size() { return this.items.length; }
|
|
149
|
+
/*
|
|
150
|
+
Returns a string representation of all items currently in the stack.
|
|
151
|
+
*/
|
|
152
|
+
toString() { return this.items.toString(); }
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
/*
|
|
156
|
+
* The ClassLoggerService is really just a wrapper around the existing console logging functionality
|
|
157
|
+
* It is not intended to be used as a singleton service, but rather to be instantiated for each class that needs logging.
|
|
158
|
+
* For that reason, it is registered with DI as a plain Injectable service, not a Root Injectable service.
|
|
159
|
+
* The four main reasons for using this service are:
|
|
160
|
+
* 1. The abstraction layer will allow us to pick a different logging endpoint if needed
|
|
161
|
+
* 2. This service allows you to specify what level of verbosity you want this service to log with
|
|
162
|
+
* 3. Has logic to log classname, method entry, and method exit points automagically
|
|
163
|
+
* 4. Keeps track of the call stack and can group nested method calls if collapseGroups is set to true
|
|
164
|
+
*/
|
|
165
|
+
class ClassLoggerService {
|
|
166
|
+
/*
|
|
167
|
+
* Determines what level of verbosity you want this service to log with.
|
|
168
|
+
* This can be set to 'None', 'Error', 'Warn', 'Info', 'Debug', or 'Trace'.
|
|
169
|
+
*/
|
|
170
|
+
logLevel = 'Trace';
|
|
171
|
+
/*
|
|
172
|
+
* Determine if method entry and exit points should be logged in collapsed groups
|
|
173
|
+
*/
|
|
174
|
+
collapseGroups = true;
|
|
175
|
+
/*
|
|
176
|
+
* This is the encapsulated value for the class name.
|
|
177
|
+
*/
|
|
178
|
+
_className = "";
|
|
179
|
+
/*
|
|
180
|
+
* Gets the class name.
|
|
181
|
+
* @returns The class name
|
|
182
|
+
*/
|
|
183
|
+
get className() {
|
|
184
|
+
return this._className;
|
|
185
|
+
}
|
|
186
|
+
/*
|
|
187
|
+
* Sets the class name and logs the method name as the constructor.
|
|
188
|
+
* @param value The class name to set.
|
|
189
|
+
*/
|
|
190
|
+
set className(value) {
|
|
191
|
+
this._className = value;
|
|
192
|
+
this.methodName = "constructor()";
|
|
193
|
+
}
|
|
194
|
+
/* This will contain an encapsulated call stack with all the method names from this class that got to this method.
|
|
195
|
+
* The top of the stack will be the method that called the current method and so on down the call stack
|
|
196
|
+
*/
|
|
197
|
+
callStack = new Stack();
|
|
198
|
+
/*
|
|
199
|
+
* @returns The method name that is currently being executed for the top of the call stack.
|
|
200
|
+
*/
|
|
201
|
+
get methodName() {
|
|
202
|
+
return this.callStack.peek() ?? "";
|
|
203
|
+
}
|
|
204
|
+
/*
|
|
205
|
+
* This sets the method name that is currently being executed for the top of the call stack amd logs the method entry point.
|
|
206
|
+
* @param value The method name to set.
|
|
207
|
+
*/
|
|
208
|
+
set methodName(value) {
|
|
209
|
+
if (this.logLevel === 'None') {
|
|
210
|
+
return;
|
|
211
|
+
}
|
|
212
|
+
if (value === "") {
|
|
213
|
+
this.endOfMethod();
|
|
214
|
+
}
|
|
215
|
+
else {
|
|
216
|
+
this.callStack.push(value);
|
|
217
|
+
if (this.collapseGroups)
|
|
218
|
+
console.groupCollapsed(this.targetName);
|
|
219
|
+
else
|
|
220
|
+
console.group(this.targetName);
|
|
221
|
+
console.time(this.targetName);
|
|
222
|
+
this.trace("Start of method");
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
/*
|
|
226
|
+
* This is used to signal the end of a method and logs the method exit point.
|
|
227
|
+
* It also pops the current method off the top of the call stack
|
|
228
|
+
*/
|
|
229
|
+
endOfMethod() {
|
|
230
|
+
this.trace("End of method");
|
|
231
|
+
console.groupEnd();
|
|
232
|
+
console.timeEnd(this.targetName);
|
|
233
|
+
this.callStack.pop();
|
|
234
|
+
}
|
|
235
|
+
/*
|
|
236
|
+
* @ returns The class name and method name if available, otherwise the class name alone.
|
|
237
|
+
*/
|
|
238
|
+
get targetName() {
|
|
239
|
+
if (this.methodName === "")
|
|
240
|
+
return this.className;
|
|
241
|
+
else
|
|
242
|
+
return `${this.className}.${this.methodName}`;
|
|
243
|
+
}
|
|
244
|
+
/*
|
|
245
|
+
* Prefix used for all log messages.
|
|
246
|
+
* @ returns The date and time of the log message, the class name, and the method name.
|
|
247
|
+
*/
|
|
248
|
+
get prefix() {
|
|
249
|
+
return `${new Date().toLocaleString()} ${this.targetName}> `;
|
|
250
|
+
}
|
|
251
|
+
/*
|
|
252
|
+
* This will write a log for the verbosity level of Error only
|
|
253
|
+
* This includes verbosity levels of Error, Warning, Information, Debug, and Trace.
|
|
254
|
+
* @param message The message to log.
|
|
255
|
+
* @param optionalParams Optional parameters to include in the log message.
|
|
256
|
+
*/
|
|
257
|
+
error(message, ...optionalParams) {
|
|
258
|
+
if (this.logLevel === 'Error' || this.logLevel === 'Warn' || this.logLevel === 'Info' || this.logLevel === 'Debug' || this.logLevel === 'Trace') {
|
|
259
|
+
console.error(`${this.prefix} Error: ${message}`, optionalParams);
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
/*
|
|
263
|
+
* Limited level of logging for warnings.
|
|
264
|
+
* This includes verbosity levels of Warning, Information, Debug, and Trace.
|
|
265
|
+
* @param message The message to log.
|
|
266
|
+
* @param optionalParams Optional parameters to include in the log message.
|
|
267
|
+
*/
|
|
268
|
+
warn(message, ...optionalParams) {
|
|
269
|
+
if (this.logLevel === 'Warn' || this.logLevel === 'Info' || this.logLevel === 'Debug' || this.logLevel === 'Trace') {
|
|
270
|
+
console.warn(`${this.prefix} Warning: ${message}`, optionalParams);
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
/*
|
|
274
|
+
* Default log level.
|
|
275
|
+
* This includes verbosity levels of Information, Debug, and Trace.
|
|
276
|
+
* This is used to provide general information about app flow but shouldn't contain values.
|
|
277
|
+
* @param message The message to log.
|
|
278
|
+
* @param optionalParams Optional parameters to include in the log message.
|
|
279
|
+
*/
|
|
280
|
+
info(message, ...optionalParams) {
|
|
281
|
+
if (this.logLevel === 'Info' || this.logLevel === 'Debug' || this.logLevel === 'Trace') {
|
|
282
|
+
console.info(`${this.prefix} Information: ${message}`, optionalParams);
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
/*
|
|
286
|
+
* Useful for debugging,
|
|
287
|
+
* This includes verbosity levels of Debug and Trace.
|
|
288
|
+
* If actual values are put in the logs, this should be chosen; they may need to be sanitized
|
|
289
|
+
* @param message The message to log.
|
|
290
|
+
* @param optionalParams Optional parameters to include in the log message.
|
|
291
|
+
*/
|
|
292
|
+
debug(message, ...optionalParams) {
|
|
293
|
+
if (this.logLevel === 'Debug' || this.logLevel === 'Trace') {
|
|
294
|
+
console.debug(`${this.prefix} Debug: ${message}`, optionalParams);
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
/*
|
|
298
|
+
*The highest verbosity should log a crazy number of records.
|
|
299
|
+
* This includes verbosity level Trace. they may need to be sanitized
|
|
300
|
+
* @param message The message to log.
|
|
301
|
+
* @param optionalParams Optional parameters to include in the log message.
|
|
302
|
+
*/
|
|
303
|
+
trace(message, ...optionalParams) {
|
|
304
|
+
if (this.logLevel === 'Trace') {
|
|
305
|
+
console.log(`${this.prefix} Trace: ${message}`, optionalParams);
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.18", ngImport: i0, type: ClassLoggerService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
309
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.18", ngImport: i0, type: ClassLoggerService });
|
|
310
|
+
}
|
|
311
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.18", ngImport: i0, type: ClassLoggerService, decorators: [{
|
|
312
|
+
type: Injectable
|
|
313
|
+
}] });
|
|
314
|
+
|
|
315
|
+
function msalGuardConfigFactory(authConfig, injector) {
|
|
316
|
+
const logService = injector ? injector.get(ClassLoggerService, null) : null;
|
|
317
|
+
if (logService) {
|
|
318
|
+
//logService.className = 'AppModule';
|
|
319
|
+
logService.methodName = 'msalGuardConfigFactory';
|
|
320
|
+
logService.info(`msalGuardConfigFactory: using clientId=${authConfig.clientId}`);
|
|
321
|
+
}
|
|
322
|
+
else {
|
|
323
|
+
console.info('msalGuardConfigFactory: auth clientId=', authConfig.clientId);
|
|
324
|
+
}
|
|
325
|
+
const scopes = authConfig && authConfig.scopes ? (Array.isArray(authConfig.scopes) ? authConfig.scopes : authConfig.scopes.split(',').map(s => s.trim())) : ['user.read'];
|
|
326
|
+
const msalGuardConfiguration = {
|
|
118
327
|
interactionType: InteractionType.Redirect,
|
|
119
328
|
authRequest: {
|
|
120
|
-
scopes:
|
|
329
|
+
scopes: scopes,
|
|
330
|
+
prompt: authConfig.prompt
|
|
121
331
|
},
|
|
122
332
|
};
|
|
333
|
+
if (logService)
|
|
334
|
+
logService.methodName = "";
|
|
335
|
+
return msalGuardConfiguration;
|
|
123
336
|
}
|
|
124
337
|
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
}
|
|
131
|
-
// Safe getter for runtime authConfig. Accessing the config at module-eval time
|
|
132
|
-
// can fail if the global `authConfig` script in `index.html` hasn't been injected or
|
|
133
|
-
// loaded yet. This helper reads from window.authConfig (set in index.html) or falls
|
|
134
|
-
// back to the AuthService helper if available, and logs a clear error instead of
|
|
135
|
-
// letting the application throw a TypeError.
|
|
136
|
-
function getAuthConfigSafe() {
|
|
137
|
-
try {
|
|
138
|
-
const winAny = window;
|
|
139
|
-
const cfg = winAny.authConfig ?? (getAuthConfig ? getAuthConfig() : undefined);
|
|
140
|
-
if (!cfg) {
|
|
141
|
-
// Provide a helpful console error and return a minimal object to avoid runtime crashes.
|
|
142
|
-
// The app will still not be authenticated correctly until the real config is available.
|
|
143
|
-
console.error('authConfig is not available on window and AuthService.getAuthConfig() returned no value. Ensure the inline authConfig script in index.html is present and executes before the app bundle., using default cfg:');
|
|
144
|
-
return {
|
|
145
|
-
logLevel: "Info",
|
|
146
|
-
clientId: "af1486e0-a27f-4c8d-8503-0752d90ce72d",
|
|
147
|
-
tenantId: "445012c4-563a-4795-84d0-f7473a3197e0",
|
|
148
|
-
authority: "https://login.microsoft.com/445012c4-563a-4795-84d0-f7473a3197e0",
|
|
149
|
-
scopes: "openid,email,profile",
|
|
150
|
-
redirect_uri: window.location.origin,
|
|
151
|
-
logout_redirect_uri: window.location.origin + '/logout',
|
|
152
|
-
prompt: "login",
|
|
153
|
-
configConnectString: "Endpoint=https://cheap-weed-menus-appconfig.azconfig.io;Id=7F0m;Secret=7X8pkinp53tA8d4o2LfGUMHBWo54o68jYUSS7JcOnyQmh2lDXetkJQQJ99BEAC8vTInIcYexAAACAZAC2P1s"
|
|
154
|
-
};
|
|
155
|
-
}
|
|
156
|
-
return cfg;
|
|
338
|
+
function msalInstanceFactory(authConfig, injector) {
|
|
339
|
+
const logService = injector ? injector.get(ClassLoggerService, null) : null;
|
|
340
|
+
if (logService) {
|
|
341
|
+
logService.className = 'AppModule';
|
|
342
|
+
logService.methodName = 'msalInstanceFactory';
|
|
157
343
|
}
|
|
158
|
-
|
|
159
|
-
console.error('Error while reading authConfig, using default cfg:', e);
|
|
160
|
-
return {
|
|
161
|
-
logLevel: "Info",
|
|
162
|
-
clientId: "af1486e0-a27f-4c8d-8503-0752d90ce72d",
|
|
163
|
-
tenantId: "445012c4-563a-4795-84d0-f7473a3197e0",
|
|
164
|
-
authority: "https://login.microsoft.com/445012c4-563a-4795-84d0-f7473a3197e0",
|
|
165
|
-
scopes: "openid,email,profile",
|
|
166
|
-
redirect_uri: window.location.origin,
|
|
167
|
-
logout_redirect_uri: window.location.origin + '/logout',
|
|
168
|
-
prompt: "login",
|
|
169
|
-
configConnectString: "Endpoint=https://cheap-weed-menus-appconfig.azconfig.io;Id=7F0m;Secret=7X8pkinp53tA8d4o2LfGUMHBWo54o68jYUSS7JcOnyQmh2lDXetkJQQJ99BEAC8vTInIcYexAAACAZAC2P1s"
|
|
170
|
-
};
|
|
171
|
-
}
|
|
172
|
-
}
|
|
173
|
-
// -----------------------------------------
|
|
174
|
-
// Runtime factories for MSAL (avoid module-eval-time access to window)
|
|
175
|
-
// -----------------------------------------
|
|
176
|
-
function msalInstanceFactory() {
|
|
177
|
-
const cfg = getAuthConfigSafe();
|
|
178
|
-
return new PublicClientApplication({
|
|
344
|
+
const publicClientApplication = new PublicClientApplication({
|
|
179
345
|
auth: {
|
|
180
|
-
clientId:
|
|
181
|
-
authority:
|
|
182
|
-
redirectUri:
|
|
183
|
-
postLogoutRedirectUri:
|
|
346
|
+
clientId: authConfig.clientId,
|
|
347
|
+
authority: authConfig.authority,
|
|
348
|
+
redirectUri: authConfig.redirect_uri,
|
|
349
|
+
postLogoutRedirectUri: authConfig.logout_redirect_uri
|
|
184
350
|
},
|
|
185
351
|
cache: {
|
|
186
352
|
cacheLocation: 'localStorage',
|
|
187
353
|
temporaryCacheLocation: 'sessionStorage',
|
|
188
|
-
storeAuthStateInCookie:
|
|
354
|
+
storeAuthStateInCookie: window.navigator.userAgent.indexOf('MSIE ') > -1 || window.navigator.userAgent.indexOf('Trident/') > -1,
|
|
189
355
|
secureCookies: true,
|
|
190
356
|
cacheMigrationEnabled: true,
|
|
191
357
|
claimsBasedCachingEnabled: true
|
|
@@ -193,12 +359,55 @@ function msalInstanceFactory() {
|
|
|
193
359
|
system: {
|
|
194
360
|
tokenRenewalOffsetSeconds: 30,
|
|
195
361
|
preventCorsPreflight: false,
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
362
|
+
// Build loggerCallback as a local const so linters recognize it's used
|
|
363
|
+
// and to make it easier to test or replace in unit tests.
|
|
364
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
365
|
+
loggerOptions: (() => {
|
|
366
|
+
const loggerCallback = (level, message, _containsPii) => {
|
|
367
|
+
if (logService) {
|
|
368
|
+
switch (level) {
|
|
369
|
+
case LogLevel.Error:
|
|
370
|
+
logService.error(message);
|
|
371
|
+
break;
|
|
372
|
+
case LogLevel.Warning:
|
|
373
|
+
logService.warn(message);
|
|
374
|
+
break;
|
|
375
|
+
case LogLevel.Info:
|
|
376
|
+
logService.info(message);
|
|
377
|
+
break;
|
|
378
|
+
case LogLevel.Verbose:
|
|
379
|
+
logService.debug(message);
|
|
380
|
+
break;
|
|
381
|
+
default:
|
|
382
|
+
logService.trace(message);
|
|
383
|
+
}
|
|
384
|
+
}
|
|
385
|
+
else {
|
|
386
|
+
switch (level) {
|
|
387
|
+
case LogLevel.Error:
|
|
388
|
+
console.error(message);
|
|
389
|
+
break;
|
|
390
|
+
case LogLevel.Warning:
|
|
391
|
+
console.warn(message);
|
|
392
|
+
break;
|
|
393
|
+
case LogLevel.Info:
|
|
394
|
+
console.info(message);
|
|
395
|
+
break;
|
|
396
|
+
case LogLevel.Verbose:
|
|
397
|
+
console.debug(message);
|
|
398
|
+
break;
|
|
399
|
+
default:
|
|
400
|
+
console.log(message);
|
|
401
|
+
}
|
|
402
|
+
}
|
|
403
|
+
};
|
|
404
|
+
return {
|
|
405
|
+
loggerCallback,
|
|
406
|
+
piiLoggingEnabled: authConfig.showPii,
|
|
407
|
+
logLevel: LogLevel.Verbose,
|
|
408
|
+
correlationId: "ff88c00e-fd95-49c6-8203-5b2b62a4eb2f"
|
|
409
|
+
};
|
|
410
|
+
})(),
|
|
202
411
|
windowHashTimeout: 1000,
|
|
203
412
|
iframeHashTimeout: 1000,
|
|
204
413
|
loadFrameTimeout: 1000,
|
|
@@ -208,26 +417,46 @@ function msalInstanceFactory() {
|
|
|
208
417
|
allowRedirectInIframe: false,
|
|
209
418
|
allowNativeBroker: false,
|
|
210
419
|
nativeBrokerHandshakeTimeout: 500,
|
|
211
|
-
pollIntervalMilliseconds: 30
|
|
420
|
+
pollIntervalMilliseconds: 30
|
|
212
421
|
},
|
|
213
422
|
telemetry: {
|
|
214
423
|
application: {
|
|
215
424
|
appName: "cwm-digital-menu",
|
|
216
|
-
appVersion: "1.
|
|
425
|
+
appVersion: "1.1.33"
|
|
217
426
|
},
|
|
218
427
|
}
|
|
219
428
|
});
|
|
429
|
+
if (logService) {
|
|
430
|
+
logService.debug(`returning publicClientApplication`, publicClientApplication);
|
|
431
|
+
logService.methodName = '';
|
|
432
|
+
}
|
|
433
|
+
return publicClientApplication;
|
|
220
434
|
}
|
|
221
435
|
|
|
222
|
-
function msalInterceptorConfigFactory() {
|
|
223
|
-
|
|
436
|
+
function msalInterceptorConfigFactory(authConfig, injector) {
|
|
437
|
+
const logService = injector ? injector.get(ClassLoggerService, null) : null;
|
|
438
|
+
if (logService) {
|
|
439
|
+
logService.className = 'AppModule';
|
|
440
|
+
logService.methodName = 'msalInterceptorConfigFactory';
|
|
441
|
+
logService.info(`msalInterceptorConfigFactory: using clientId=${authConfig.clientId}`);
|
|
442
|
+
}
|
|
443
|
+
else {
|
|
444
|
+
console.info('msalInterceptorConfigFactory: auth clientId=', authConfig.clientId);
|
|
445
|
+
}
|
|
446
|
+
const msalInterceptorConfiguration = {
|
|
224
447
|
interactionType: InteractionType.Redirect,
|
|
225
448
|
protectedResourceMap: new Map([
|
|
226
449
|
['https://graph.microsoft.com/v1.0/me', ['user.read']],
|
|
227
|
-
['https://graph.microsoft.com/v1.0/me/photo/$value', ['user.read']]
|
|
228
|
-
[window.location.origin + '/api/inventory?', [
|
|
450
|
+
['https://graph.microsoft.com/v1.0/me/photo/$value', ['user.read']]
|
|
451
|
+
//[window.location.origin + '/api/inventory?', ['Inventory.Read']],
|
|
452
|
+
//[window.location.origin + '/inventory', ['Inventory.Read']],
|
|
453
|
+
//[window.location.origin + '/AddCustomer', ['User.ReadWrite']],
|
|
454
|
+
//[window.location.origin + '/subscription', ['Subscription.Add']],
|
|
229
455
|
])
|
|
230
456
|
};
|
|
457
|
+
if (logService)
|
|
458
|
+
logService.methodName = "";
|
|
459
|
+
return msalInterceptorConfiguration;
|
|
231
460
|
}
|
|
232
461
|
|
|
233
462
|
/* eslint-disable no-useless-catch */
|
|
@@ -349,45 +578,6 @@ function isTokenValid(input) {
|
|
|
349
578
|
return exp ? Math.floor(Date.now() / 1000) < exp : false;
|
|
350
579
|
}
|
|
351
580
|
|
|
352
|
-
/*
|
|
353
|
-
* A simple generic LIFO stack.
|
|
354
|
-
*
|
|
355
|
-
* Example:
|
|
356
|
-
* ```ts
|
|
357
|
-
* const s = new Stack<number>();
|
|
358
|
-
* s.push(1);
|
|
359
|
-
* s.push(2);
|
|
360
|
-
* console.log(s.pop());
|
|
361
|
-
* @typeParam T - Type of items stored in the stack.
|
|
362
|
-
* ```
|
|
363
|
-
*/
|
|
364
|
-
class Stack {
|
|
365
|
-
items = [];
|
|
366
|
-
/*
|
|
367
|
-
Pushes an item onto the top of the stack.
|
|
368
|
-
@param item - Item to push.
|
|
369
|
-
*/
|
|
370
|
-
push(item) { this.items.push(item); }
|
|
371
|
-
/*
|
|
372
|
-
Removes and returns the item at the top of the stack.
|
|
373
|
-
@returns The popped item, or undefined if the stack is empty.
|
|
374
|
-
*/
|
|
375
|
-
pop() { return this.items.pop(); }
|
|
376
|
-
/*
|
|
377
|
-
Returns the item at the top without removing it.
|
|
378
|
-
@returns The top item, or undefined if the stack is empty.
|
|
379
|
-
*/
|
|
380
|
-
peek() { return this.items[this.items.length - 1]; }
|
|
381
|
-
/*
|
|
382
|
-
Number of items currently in the stack.
|
|
383
|
-
*/
|
|
384
|
-
get size() { return this.items.length; }
|
|
385
|
-
/*
|
|
386
|
-
Returns a string representation of all items currently in the stack.
|
|
387
|
-
*/
|
|
388
|
-
toString() { return this.items.toString(); }
|
|
389
|
-
}
|
|
390
|
-
|
|
391
581
|
class TimeSpanOverflowError extends Error {
|
|
392
582
|
}
|
|
393
583
|
|
|
@@ -1015,10 +1205,10 @@ const DEFAULT_API_CONFIG = {
|
|
|
1015
1205
|
};
|
|
1016
1206
|
|
|
1017
1207
|
const DEFAULT_AUTH_CONFIG = {
|
|
1018
|
-
logLevel: "
|
|
1208
|
+
logLevel: "Trace",
|
|
1019
1209
|
clientId: "af1486e0-a27f-4c8d-8503-0752d90ce72d",
|
|
1020
|
-
tenantId: "
|
|
1021
|
-
authority: "https://
|
|
1210
|
+
tenantId: "445012c4-563a-4795-84d0-f7473a3197e0",
|
|
1211
|
+
authority: "https://login.microsoft.com/445012c4-563a-4795-84d0-f7473a3197e0",
|
|
1022
1212
|
scopes: "openid,email,profile",
|
|
1023
1213
|
redirect_uri: window.location.origin,
|
|
1024
1214
|
logout_redirect_uri: window.location.origin + '/logout',
|
|
@@ -1027,6 +1217,7 @@ const DEFAULT_AUTH_CONFIG = {
|
|
|
1027
1217
|
showPii: true,
|
|
1028
1218
|
configConnectString: "Endpoint=https://cheap-weed-menus-appconfig.azconfig.io;Id=7F0m;Secret=7X8pkinp53tA8d4o2LfGUMHBWo54o68jYUSS7JcOnyQmh2lDXetkJQQJ99BEAC8vTInIcYexAAACAZAC2P1s"
|
|
1029
1219
|
};
|
|
1220
|
+
const AUTH_CONFIG = new InjectionToken('AUTH_CONFIG');
|
|
1030
1221
|
|
|
1031
1222
|
const DEFAULT_CAROUSEL_CONFIG = {
|
|
1032
1223
|
"slidesToShow": 3,
|
|
@@ -1054,22 +1245,24 @@ const DEFAULT_SLIDE = {
|
|
|
1054
1245
|
"backgroundColor": "white"
|
|
1055
1246
|
};
|
|
1056
1247
|
|
|
1248
|
+
const DEFAULT_SUBSCRIPTION_CONFIG = {
|
|
1249
|
+
amount: 0.01,
|
|
1250
|
+
days: 30,
|
|
1251
|
+
totalOccurrences: 12,
|
|
1252
|
+
trialOccurrences: 0
|
|
1253
|
+
};
|
|
1254
|
+
|
|
1255
|
+
const DEFAULT_COMPANY_NAME = 'Test Weed Dispensary';
|
|
1057
1256
|
const DEFAULT_CONFIGURATION = {
|
|
1058
|
-
companyName:
|
|
1257
|
+
companyName: DEFAULT_COMPANY_NAME,
|
|
1059
1258
|
authConfig: DEFAULT_AUTH_CONFIG,
|
|
1060
1259
|
apiConfig: DEFAULT_API_CONFIG,
|
|
1260
|
+
subscriptionConfig: DEFAULT_SUBSCRIPTION_CONFIG,
|
|
1061
1261
|
menuBoardConfig: DEFAULT_MENU_BOARD_CONFIG,
|
|
1062
1262
|
footerCarouselConfig: DEFAULT_CAROUSEL_CONFIG,
|
|
1063
1263
|
footerCarouselSlideConfig: [DEFAULT_SLIDE]
|
|
1064
1264
|
};
|
|
1065
1265
|
|
|
1066
|
-
const DEFAULT_SUBSCRIPTION_CONFIG = {
|
|
1067
|
-
amount: 0.01,
|
|
1068
|
-
days: 30,
|
|
1069
|
-
totalOccurrences: 12,
|
|
1070
|
-
trialOccurrences: 0
|
|
1071
|
-
};
|
|
1072
|
-
|
|
1073
1266
|
var CardTypes;
|
|
1074
1267
|
(function (CardTypes) {
|
|
1075
1268
|
CardTypes["Amex"] = "Amex";
|
|
@@ -27097,117 +27290,6 @@ const MockProfile = DEFAULT_PROFILE;
|
|
|
27097
27290
|
|
|
27098
27291
|
const MockCustomer = DEFAULT_CUSTOMER;
|
|
27099
27292
|
|
|
27100
|
-
/*
|
|
27101
|
-
* The ClassLoggerService is really just a wrapper around the existing console logging functionality
|
|
27102
|
-
* It is not intended to be used as a singleton service, but rather to be instantiated for each class that needs logging.
|
|
27103
|
-
* For that reason, it is registered with DI as a plain Injectable service, not a Root Injectable service.
|
|
27104
|
-
* The four main reasons for using this service are:
|
|
27105
|
-
* 1. The abstraction layer will allow us to pick a different logging endpoint if needed
|
|
27106
|
-
* 2. This service allows you to specify what level of verbosity you want this service to log with
|
|
27107
|
-
* 3. Has logic to log classname, method entry, and method exit points automagically
|
|
27108
|
-
* 4. Keeps track of the call stack and can group nested method calls if collapseGroups is set to true
|
|
27109
|
-
*/
|
|
27110
|
-
class ClassLoggerService {
|
|
27111
|
-
// Determines what level of verbosity you want this service to log with.
|
|
27112
|
-
// This can be set to 'None', 'Error', 'Warn', 'Info', 'Debug', or 'Trace'.
|
|
27113
|
-
logLevel = 'Info';
|
|
27114
|
-
// Determine if method entry and exit points should be logged in collapsed groups
|
|
27115
|
-
collapseGroups = true;
|
|
27116
|
-
// This will contain the class name.
|
|
27117
|
-
_className = "";
|
|
27118
|
-
// Gets the class name
|
|
27119
|
-
get className() {
|
|
27120
|
-
return this._className;
|
|
27121
|
-
}
|
|
27122
|
-
// Sets the class name and logs the method name as the constructor.
|
|
27123
|
-
set className(value) {
|
|
27124
|
-
this._className = value;
|
|
27125
|
-
this.methodName = "constructor()";
|
|
27126
|
-
}
|
|
27127
|
-
// This will contain the call stack of all the method names from this class that got ua to this method.
|
|
27128
|
-
// The top of the stack will be the method that called the current method, and so on down the call stack
|
|
27129
|
-
callStack = new Stack();
|
|
27130
|
-
// This gets the method name that is currently being executed for the top of the call stack.
|
|
27131
|
-
get methodName() {
|
|
27132
|
-
return this.callStack.peek() ?? "";
|
|
27133
|
-
}
|
|
27134
|
-
// This sets the method name that is currently being executed for the top of the call stack amd logs the method entry point.
|
|
27135
|
-
set methodName(value) {
|
|
27136
|
-
if (this.logLevel === 'None') {
|
|
27137
|
-
return;
|
|
27138
|
-
}
|
|
27139
|
-
if (value === "") {
|
|
27140
|
-
this.endOfMethod();
|
|
27141
|
-
}
|
|
27142
|
-
else {
|
|
27143
|
-
this.callStack.push(value);
|
|
27144
|
-
if (this.collapseGroups)
|
|
27145
|
-
console.groupCollapsed(this.targetName);
|
|
27146
|
-
else
|
|
27147
|
-
console.group(this.targetName);
|
|
27148
|
-
console.time(this.targetName);
|
|
27149
|
-
this.trace("Start of method");
|
|
27150
|
-
}
|
|
27151
|
-
}
|
|
27152
|
-
// This is used to signal the end of a method and logs the method exit point.
|
|
27153
|
-
// It also pops the current method off the top of the call stack
|
|
27154
|
-
endOfMethod() {
|
|
27155
|
-
this.trace("End of method");
|
|
27156
|
-
console.groupEnd();
|
|
27157
|
-
console.timeEnd(this.targetName);
|
|
27158
|
-
this.callStack.pop();
|
|
27159
|
-
}
|
|
27160
|
-
// This will contain the class name and method name.
|
|
27161
|
-
get targetName() {
|
|
27162
|
-
if (this.methodName === "")
|
|
27163
|
-
return this.className;
|
|
27164
|
-
else
|
|
27165
|
-
return `${this.className}.${this.methodName}`;
|
|
27166
|
-
}
|
|
27167
|
-
// Prefix used for all log messages.
|
|
27168
|
-
// It contains the date and time of the log message, the class name, and the method name.
|
|
27169
|
-
get prefix() {
|
|
27170
|
-
return `${new Date().toLocaleString()} ${this.targetName}> `;
|
|
27171
|
-
}
|
|
27172
|
-
// This will only contain Errors
|
|
27173
|
-
error(message, ...optionalParams) {
|
|
27174
|
-
if (this.logLevel === 'Error') {
|
|
27175
|
-
console.error(`${this.prefix} Error: ${message}`, optionalParams);
|
|
27176
|
-
}
|
|
27177
|
-
}
|
|
27178
|
-
// This will Warnings and Errors
|
|
27179
|
-
warn(message, ...optionalParams) {
|
|
27180
|
-
if (this.logLevel === 'Warn' || this.logLevel === 'Error') {
|
|
27181
|
-
console.warn(`${this.prefix} Warning: ${message}`, optionalParams);
|
|
27182
|
-
}
|
|
27183
|
-
}
|
|
27184
|
-
// Default log level. This will contain Information, Warnings, and Error.
|
|
27185
|
-
// This is used to provide general information about app flow but shouldn't contain values.
|
|
27186
|
-
info(message, ...optionalParams) {
|
|
27187
|
-
if (this.logLevel === 'Info' || this.logLevel === 'Warn' || this.logLevel === 'Error') {
|
|
27188
|
-
console.info(`${this.prefix} Information: ${message}`, optionalParams);
|
|
27189
|
-
}
|
|
27190
|
-
}
|
|
27191
|
-
// Useful for debugging, This will contain Debug, Information, Warnings, and Error.
|
|
27192
|
-
// If actual values are put in the logs, this should be chosen; they may need to be sanitized
|
|
27193
|
-
debug(message, ...optionalParams) {
|
|
27194
|
-
if (this.logLevel === 'Debug' || this.logLevel === 'Info' || this.logLevel === 'Warn' || this.logLevel === 'Error') {
|
|
27195
|
-
console.debug(`${this.prefix} Debug: ${message}`, optionalParams);
|
|
27196
|
-
}
|
|
27197
|
-
}
|
|
27198
|
-
// The highest verbosity should log a crazy number of records. This will contain Trace, Debug, Information, Warnings, and Error (Any level other than None). they may need to be sanitized
|
|
27199
|
-
trace(message, ...optionalParams) {
|
|
27200
|
-
if (this.logLevel != 'None') {
|
|
27201
|
-
console.log(`${this.prefix} Trace: ${message}`, optionalParams);
|
|
27202
|
-
}
|
|
27203
|
-
}
|
|
27204
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.18", ngImport: i0, type: ClassLoggerService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
27205
|
-
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.18", ngImport: i0, type: ClassLoggerService });
|
|
27206
|
-
}
|
|
27207
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.18", ngImport: i0, type: ClassLoggerService, decorators: [{
|
|
27208
|
-
type: Injectable
|
|
27209
|
-
}] });
|
|
27210
|
-
|
|
27211
27293
|
class ConfigService {
|
|
27212
27294
|
logger;
|
|
27213
27295
|
mockData = false;
|
|
@@ -27225,27 +27307,27 @@ class ConfigService {
|
|
|
27225
27307
|
this.logger.className = "ConfigService";
|
|
27226
27308
|
this.configConnectString = "Endpoint=https://cheap-weed-menus-appconfig.azconfig.io;Id=tyjA;Secret=1FgL95lHkXViZX4Qf2GcRqn26mhTYDVYany8ToXpTnO68AzrdUUEJQQJ99AHAC8vTInIcYexAAACAZACsteF";
|
|
27227
27309
|
this.configClient = new AppConfigurationClient(this.configConnectString);
|
|
27228
|
-
this.logger.
|
|
27310
|
+
this.logger.debug("Config Client", this.configClient);
|
|
27229
27311
|
this.logger.methodName = "";
|
|
27230
27312
|
}
|
|
27231
27313
|
async getConfigurationSettingAsync(key, label) {
|
|
27232
27314
|
this.logger.methodName = "getConfigurationSettingAsync()";
|
|
27233
27315
|
let setting = {};
|
|
27234
|
-
this.logger.
|
|
27316
|
+
this.logger.debug("Get Configuration Setting for Key/Label requested", key, label);
|
|
27235
27317
|
if (this.mockData || this.configCache != undefined) {
|
|
27236
27318
|
if (this.configCache == undefined) {
|
|
27237
|
-
this.configCache =
|
|
27238
|
-
this.logger.
|
|
27319
|
+
this.configCache = DEFAULT_CONFIGURATION;
|
|
27320
|
+
this.logger.debug("Configuration Cache was undefined and Mock Data Enabled. Mock Config will be cached and used for this and all subsequent calls", this.configCache);
|
|
27239
27321
|
}
|
|
27240
27322
|
setting.key = key;
|
|
27241
27323
|
setting.value = JSON.stringify(this.configCache);
|
|
27242
27324
|
if (this.mockData)
|
|
27243
|
-
this.logger.
|
|
27325
|
+
this.logger.debug("Mock Data Enabled, Skipping getConfigurationSetting() and using Mock Config from the Configuration Cache", this.configCache);
|
|
27244
27326
|
else
|
|
27245
|
-
this.logger.
|
|
27327
|
+
this.logger.debug("Configuration Cache was available, skipping getConfigurationSetting() and using Cached Configuration", this.configCache);
|
|
27246
27328
|
}
|
|
27247
27329
|
else if (this.configCache == undefined) {
|
|
27248
|
-
this.logger.
|
|
27330
|
+
this.logger.debug("Configuration Cache was undefined and Mock Data disabled. Getting Configuration Setting Key/Label. Configuration will be cached and used for this and all subsequent calls", key, label);
|
|
27249
27331
|
setting = await this.configClient.getConfigurationSetting({ key: key, label: label.replace(".", "") });
|
|
27250
27332
|
}
|
|
27251
27333
|
return setting.value;
|
|
@@ -27263,15 +27345,15 @@ class ConfigService {
|
|
|
27263
27345
|
value: setting,
|
|
27264
27346
|
contentType: contentType,
|
|
27265
27347
|
};
|
|
27266
|
-
this.logger.
|
|
27348
|
+
this.logger.debug("Calling configClient.setConfigurationSetting", configurationSetting);
|
|
27267
27349
|
await this.configClient.setConfigurationSetting(configurationSetting);
|
|
27268
27350
|
this.logger.methodName = "";
|
|
27269
27351
|
}
|
|
27270
27352
|
async getConfigAsync(company) {
|
|
27271
27353
|
this.logger.methodName = "getConfigAsync()";
|
|
27272
27354
|
if (this.mockData) {
|
|
27273
|
-
this.configCache =
|
|
27274
|
-
this.logger.
|
|
27355
|
+
this.configCache = DEFAULT_CONFIGURATION;
|
|
27356
|
+
this.logger.debug("Mock Data Enabled, Using Mock Config", this.configCache);
|
|
27275
27357
|
}
|
|
27276
27358
|
else if (this.configCache == undefined) {
|
|
27277
27359
|
this.logger.info("Config Cache was undefined. Loading Configuration from Azure App Configuration");
|
|
@@ -27280,7 +27362,7 @@ class ConfigService {
|
|
|
27280
27362
|
this.logger.debug("Loaded and Cached Configuration from Azure App Configuration", this.configCache);
|
|
27281
27363
|
}
|
|
27282
27364
|
else {
|
|
27283
|
-
this.logger.
|
|
27365
|
+
this.logger.debug("Using Cached Configuration", this.configCache);
|
|
27284
27366
|
}
|
|
27285
27367
|
const config = this.configCache;
|
|
27286
27368
|
this.logger.methodName = "";
|
|
@@ -27290,7 +27372,7 @@ class ConfigService {
|
|
|
27290
27372
|
this.logger.methodName = "saveConfigAsync()";
|
|
27291
27373
|
// Update configuration cache
|
|
27292
27374
|
this.configCache = config;
|
|
27293
|
-
this.logger.
|
|
27375
|
+
this.logger.debug("Updated Config Cache", this.configCache);
|
|
27294
27376
|
if (this.mockData) {
|
|
27295
27377
|
this.logger.info("Mock Data Enabled, Skipping setConfigurationSettingAsync()");
|
|
27296
27378
|
this.logger.methodName = "";
|
|
@@ -27298,7 +27380,7 @@ class ConfigService {
|
|
|
27298
27380
|
}
|
|
27299
27381
|
this.logger.info("Saving Configuration to Azure App Configuration");
|
|
27300
27382
|
await this.setConfigurationSettingAsync("App.Config.Json", company, config, "JSON");
|
|
27301
|
-
this.logger.
|
|
27383
|
+
this.logger.info("Saved Configuration to Azure App Configuration");
|
|
27302
27384
|
this.logger.methodName = "";
|
|
27303
27385
|
}
|
|
27304
27386
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.18", ngImport: i0, type: ConfigService, deps: [{ token: ClassLoggerService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
@@ -27312,25 +27394,27 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.18", ngImpo
|
|
|
27312
27394
|
}], ctorParameters: () => [{ type: ClassLoggerService }] });
|
|
27313
27395
|
|
|
27314
27396
|
class BaseApiService {
|
|
27397
|
+
document;
|
|
27315
27398
|
configService;
|
|
27316
27399
|
httpClient;
|
|
27317
27400
|
logger;
|
|
27318
|
-
config;
|
|
27401
|
+
config = DEFAULT_API_CONFIG;
|
|
27319
27402
|
get apiBaseUrl() {
|
|
27320
27403
|
if (this.config)
|
|
27321
27404
|
return this.config.apiBaseUrl;
|
|
27322
27405
|
else
|
|
27323
|
-
return
|
|
27406
|
+
return this.document.location.origin;
|
|
27324
27407
|
}
|
|
27325
27408
|
get apiFullUrl() {
|
|
27326
27409
|
return this.apiBaseUrl;
|
|
27327
27410
|
}
|
|
27328
|
-
constructor(configService, httpClient, logger) {
|
|
27411
|
+
constructor(document, configService, httpClient, logger) {
|
|
27412
|
+
this.document = document;
|
|
27329
27413
|
this.configService = configService;
|
|
27330
27414
|
this.httpClient = httpClient;
|
|
27331
27415
|
this.logger = logger;
|
|
27332
27416
|
}
|
|
27333
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.18", ngImport: i0, type: BaseApiService, deps: [{ token: ConfigService }, { token: i2$1.HttpClient }, { token: ClassLoggerService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
27417
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.18", ngImport: i0, type: BaseApiService, deps: [{ token: DOCUMENT }, { token: ConfigService }, { token: i2$1.HttpClient }, { token: ClassLoggerService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
27334
27418
|
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.18", ngImport: i0, type: BaseApiService, providedIn: 'root' });
|
|
27335
27419
|
}
|
|
27336
27420
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.18", ngImport: i0, type: BaseApiService, decorators: [{
|
|
@@ -27338,32 +27422,15 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.18", ngImpo
|
|
|
27338
27422
|
args: [{
|
|
27339
27423
|
providedIn: 'root'
|
|
27340
27424
|
}]
|
|
27341
|
-
}], ctorParameters: () => [{ type:
|
|
27342
|
-
|
|
27343
|
-
|
|
27344
|
-
|
|
27345
|
-
return this.apiBaseUrl + this.config?.addCustomerApiRoute;
|
|
27346
|
-
}
|
|
27347
|
-
async getCustomerAsync(customerId) { return; }
|
|
27348
|
-
async getCustomersAsync() { return; }
|
|
27349
|
-
async setCustomerAsync(companyName, customer) {
|
|
27350
|
-
this.config = (await this.configService.getConfigAsync(companyName)).apiConfig;
|
|
27351
|
-
return;
|
|
27352
|
-
}
|
|
27353
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.18", ngImport: i0, type: CustomerApiService, deps: null, target: i0.ɵɵFactoryTarget.Injectable });
|
|
27354
|
-
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.18", ngImport: i0, type: CustomerApiService, providedIn: 'root' });
|
|
27355
|
-
}
|
|
27356
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.18", ngImport: i0, type: CustomerApiService, decorators: [{
|
|
27357
|
-
type: Injectable,
|
|
27358
|
-
args: [{
|
|
27359
|
-
providedIn: 'root'
|
|
27360
|
-
}]
|
|
27361
|
-
}] });
|
|
27425
|
+
}], ctorParameters: () => [{ type: Document, decorators: [{
|
|
27426
|
+
type: Inject,
|
|
27427
|
+
args: [DOCUMENT]
|
|
27428
|
+
}] }, { type: ConfigService }, { type: i2$1.HttpClient }, { type: ClassLoggerService }] });
|
|
27362
27429
|
|
|
27363
27430
|
class InventoryApiService extends BaseApiService {
|
|
27364
27431
|
useMockData = false;
|
|
27365
|
-
constructor(configService, httpClient, logger) {
|
|
27366
|
-
super(configService, httpClient, logger);
|
|
27432
|
+
constructor(document, configService, httpClient, logger) {
|
|
27433
|
+
super(document, configService, httpClient, logger);
|
|
27367
27434
|
logger.className = "InventoryApiService";
|
|
27368
27435
|
}
|
|
27369
27436
|
get httpHeaders() {
|
|
@@ -27373,7 +27440,7 @@ class InventoryApiService extends BaseApiService {
|
|
|
27373
27440
|
.set('locationId', this.config?.locationId);
|
|
27374
27441
|
}
|
|
27375
27442
|
get apiFullUrl() {
|
|
27376
|
-
return this.apiBaseUrl + (this.config ??
|
|
27443
|
+
return this.apiBaseUrl + (this.config ?? DEFAULT_API_CONFIG).getInventoryApiRoute;
|
|
27377
27444
|
}
|
|
27378
27445
|
async getProductsAsync(companyName) {
|
|
27379
27446
|
this.logger.methodName = "getProductsAsync()";
|
|
@@ -27416,7 +27483,7 @@ class InventoryApiService extends BaseApiService {
|
|
|
27416
27483
|
return productsByAllCategories;
|
|
27417
27484
|
}
|
|
27418
27485
|
;
|
|
27419
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.18", ngImport: i0, type: InventoryApiService, deps: [{ token: ConfigService }, { token: i2$1.HttpClient }, { token: ClassLoggerService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
27486
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.18", ngImport: i0, type: InventoryApiService, deps: [{ token: DOCUMENT }, { token: ConfigService }, { token: i2$1.HttpClient }, { token: ClassLoggerService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
27420
27487
|
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.18", ngImport: i0, type: InventoryApiService, providedIn: 'root' });
|
|
27421
27488
|
}
|
|
27422
27489
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.18", ngImport: i0, type: InventoryApiService, decorators: [{
|
|
@@ -27424,7 +27491,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.18", ngImpo
|
|
|
27424
27491
|
args: [{
|
|
27425
27492
|
providedIn: 'root'
|
|
27426
27493
|
}]
|
|
27427
|
-
}], ctorParameters: () => [{ type:
|
|
27494
|
+
}], ctorParameters: () => [{ type: Document, decorators: [{
|
|
27495
|
+
type: Inject,
|
|
27496
|
+
args: [DOCUMENT]
|
|
27497
|
+
}] }, { type: ConfigService }, { type: i2$1.HttpClient }, { type: ClassLoggerService }] });
|
|
27428
27498
|
|
|
27429
27499
|
/**
|
|
27430
27500
|
* Provides a wrapper for accessing the web storage API and synchronizing session storage across tabs/windows.
|
|
@@ -27809,13 +27879,50 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.18", ngImpo
|
|
|
27809
27879
|
}]
|
|
27810
27880
|
}] });
|
|
27811
27881
|
|
|
27882
|
+
class SubscriptionApiService extends BaseApiService {
|
|
27883
|
+
constructor(document, configService, httpClient, logger) {
|
|
27884
|
+
super(document, configService, httpClient, logger);
|
|
27885
|
+
logger.className = "SubscriptionApiService";
|
|
27886
|
+
}
|
|
27887
|
+
get apiFullUrl() {
|
|
27888
|
+
return `${this.apiBaseUrl}${(this.config ?? DEFAULT_API_CONFIG).addSubscriptionApiRoute}`;
|
|
27889
|
+
}
|
|
27890
|
+
async addSubscriptionAsync(request) {
|
|
27891
|
+
try {
|
|
27892
|
+
this.logger.methodName = 'addSubscriptionAsync';
|
|
27893
|
+
this.logger.debug(`Calling AddSubscription API at ${this.apiFullUrl}`);
|
|
27894
|
+
await firstValueFrom(this.httpClient.post(this.apiFullUrl, request));
|
|
27895
|
+
this.logger.info('Successfully added subscription');
|
|
27896
|
+
}
|
|
27897
|
+
catch (error) {
|
|
27898
|
+
this.logger.error('Error adding subscription', error);
|
|
27899
|
+
throw error;
|
|
27900
|
+
}
|
|
27901
|
+
finally {
|
|
27902
|
+
this.logger.endOfMethod();
|
|
27903
|
+
}
|
|
27904
|
+
}
|
|
27905
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.18", ngImport: i0, type: SubscriptionApiService, deps: [{ token: DOCUMENT }, { token: ConfigService }, { token: i2$1.HttpClient }, { token: ClassLoggerService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
27906
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.18", ngImport: i0, type: SubscriptionApiService, providedIn: 'root' });
|
|
27907
|
+
}
|
|
27908
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.18", ngImport: i0, type: SubscriptionApiService, decorators: [{
|
|
27909
|
+
type: Injectable,
|
|
27910
|
+
args: [{
|
|
27911
|
+
providedIn: 'root'
|
|
27912
|
+
}]
|
|
27913
|
+
}], ctorParameters: () => [{ type: Document, decorators: [{
|
|
27914
|
+
type: Inject,
|
|
27915
|
+
args: [DOCUMENT]
|
|
27916
|
+
}] }, { type: ConfigService }, { type: i2$1.HttpClient }, { type: ClassLoggerService }] });
|
|
27917
|
+
|
|
27812
27918
|
// ================================================
|
|
27813
27919
|
// Export every type you want this module to expose
|
|
27814
27920
|
// ================================================
|
|
27921
|
+
// Components
|
|
27815
27922
|
|
|
27816
27923
|
/**
|
|
27817
27924
|
* Generated bundle index. Do not edit.
|
|
27818
27925
|
*/
|
|
27819
27926
|
|
|
27820
|
-
export { BaseApiService, CardTypes, Category, ClassLoggerService, ConfigService, Customer,
|
|
27927
|
+
export { AUTH_CONFIG, BaseApiService, CardTypes, Category, ClassLoggerService, ConfigService, Customer, CwmSharedModule, DEFAULT_API_CONFIG, DEFAULT_AUTH_CONFIG, DEFAULT_CAROUSEL_CONFIG, DEFAULT_COMPANY_NAME, DEFAULT_CONFIGURATION, DEFAULT_CUSTOMER, DEFAULT_INVENTORY_API_RESPONSE, DEFAULT_MENU_BOARD_CONFIG, DEFAULT_PROFILE, DEFAULT_SLIDE, DEFAULT_SUBSCRIPTION_CONFIG, DbKeys, ExternalNavigationComponent, InventoryApiService, Justifications, LocalStorageService, LogService, LoggingVerbosity, MockConfig, MockCustomer, MockInventoryApiResponse, MockProfile, NamedColors, NavigateToRouteComponent, OnElementStyle, PageNotFoundComponent, Product, Profile, SafeHtmlPipe, Stack, SubscriptionApiService, TimeSpan, TimeSpanOverflowError, UserTypes, Utilities, decodeToken, doWithLock, isTokenValid, msalGuardConfigFactory, msalInstanceFactory, msalInterceptorConfigFactory, waitFor };
|
|
27821
27928
|
//# sourceMappingURL=transcommerce-cwm-shared.mjs.map
|