@bitblit/ngx-acute-common 5.0.512-alpha → 5.0.515-alpha

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 (84) hide show
  1. package/lib/build/ngx-acute-common-info.d.ts +5 -0
  2. package/lib/components/dialogs/alert/alert.component.d.ts +9 -0
  3. package/lib/components/dialogs/block-ui/block-ui.component.d.ts +9 -0
  4. package/lib/index.d.ts +18 -0
  5. package/{src/model/google-analytics-config.ts → lib/model/google-analytics-config.d.ts} +2 -2
  6. package/lib/my-angular-library.cjs.js +2 -2
  7. package/lib/my-angular-library.cjs.js.map +1 -0
  8. package/lib/my-angular-library.esm.js +2 -2
  9. package/lib/my-angular-library.esm.js.map +1 -0
  10. package/lib/my-angular-library.umd.js +2 -2
  11. package/lib/my-angular-library.umd.js.map +1 -0
  12. package/lib/pipes/capitalize.pipe.d.ts +4 -0
  13. package/lib/pipes/dollar-formatted.pipe.d.ts +4 -0
  14. package/lib/pipes/map-values.pipe.d.ts +4 -0
  15. package/lib/pipes/number-with-commas.pipe.d.ts +4 -0
  16. package/lib/pipes/order-by.pipe.d.ts +5 -0
  17. package/lib/pipes/percent-formatted.pipe.d.ts +4 -0
  18. package/lib/pipes/plural.pipe.d.ts +4 -0
  19. package/lib/pipes/round.pipe.d.ts +4 -0
  20. package/lib/pipes/time-ago-formatted.pipe.d.ts +4 -0
  21. package/lib/pipes/timing.pipe.d.ts +5 -0
  22. package/lib/services/google-analytics.service.d.ts +9 -0
  23. package/lib/services/graphql-query.service.d.ts +14 -0
  24. package/lib/services/local-storage.service.d.ts +8 -0
  25. package/lib/services/window-ref.service.d.ts +3 -0
  26. package/package.json +11 -4
  27. package/artifacts/coverage/base.css +0 -224
  28. package/artifacts/coverage/block-navigation.js +0 -87
  29. package/artifacts/coverage/clover.xml +0 -1565
  30. package/artifacts/coverage/coverage-final.json +0 -40
  31. package/artifacts/coverage/favicon.png +0 -0
  32. package/artifacts/coverage/index.html +0 -236
  33. package/artifacts/coverage/modules/acute-common/src/build/index.html +0 -116
  34. package/artifacts/coverage/modules/acute-common/src/build/ngx-acute-common-info.ts.html +0 -142
  35. package/artifacts/coverage/modules/acute-common/src/components/dialogs/alert/alert.component.ts.html +0 -184
  36. package/artifacts/coverage/modules/acute-common/src/components/dialogs/alert/index.html +0 -116
  37. package/artifacts/coverage/modules/acute-common/src/components/dialogs/block-ui/block-ui.component.ts.html +0 -271
  38. package/artifacts/coverage/modules/acute-common/src/components/dialogs/block-ui/index.html +0 -116
  39. package/artifacts/coverage/modules/acute-common/src/pipes/capitalize.pipe.ts.html +0 -118
  40. package/artifacts/coverage/modules/acute-common/src/pipes/dollar-formatted.pipe.ts.html +0 -124
  41. package/artifacts/coverage/modules/acute-common/src/pipes/index.html +0 -251
  42. package/artifacts/coverage/modules/acute-common/src/pipes/map-values.pipe.ts.html +0 -142
  43. package/artifacts/coverage/modules/acute-common/src/pipes/number-with-commas.pipe.ts.html +0 -112
  44. package/artifacts/coverage/modules/acute-common/src/pipes/order-by.pipe.ts.html +0 -259
  45. package/artifacts/coverage/modules/acute-common/src/pipes/percent-formatted.pipe.ts.html +0 -112
  46. package/artifacts/coverage/modules/acute-common/src/pipes/plural.pipe.ts.html +0 -127
  47. package/artifacts/coverage/modules/acute-common/src/pipes/round.pipe.ts.html +0 -112
  48. package/artifacts/coverage/modules/acute-common/src/pipes/time-ago-formatted.pipe.ts.html +0 -115
  49. package/artifacts/coverage/modules/acute-common/src/pipes/timing.pipe.ts.html +0 -139
  50. package/artifacts/coverage/modules/acute-common/src/services/google-analytics.service.ts.html +0 -280
  51. package/artifacts/coverage/modules/acute-common/src/services/graphql-query.service.ts.html +0 -394
  52. package/artifacts/coverage/modules/acute-common/src/services/index.html +0 -161
  53. package/artifacts/coverage/modules/acute-common/src/services/local-storage.service.ts.html +0 -235
  54. package/artifacts/coverage/modules/acute-common/src/services/window-ref.service.ts.html +0 -160
  55. package/artifacts/coverage/prettify.css +0 -1
  56. package/artifacts/coverage/prettify.js +0 -2
  57. package/artifacts/coverage/sort-arrow-sprite.png +0 -0
  58. package/artifacts/coverage/sorter.js +0 -196
  59. package/rollup.config.mjs +0 -58
  60. package/src/build/ngx-acute-common-info.ts +0 -19
  61. package/src/components/dialogs/alert/alert.component.ts +0 -33
  62. package/src/components/dialogs/block-ui/block-ui.component.html +0 -9
  63. package/src/components/dialogs/block-ui/block-ui.component.spec.ts +0 -24
  64. package/src/components/dialogs/block-ui/block-ui.component.ts +0 -62
  65. package/src/index.ts +0 -2
  66. package/src/pipes/capitalize.pipe.ts +0 -11
  67. package/src/pipes/dollar-formatted.pipe.ts +0 -13
  68. package/src/pipes/map-values.pipe.ts +0 -19
  69. package/src/pipes/number-with-commas.pipe.ts +0 -9
  70. package/src/pipes/order-by.pipe.ts +0 -58
  71. package/src/pipes/percent-formatted.pipe.ts +0 -9
  72. package/src/pipes/plural.pipe.ts +0 -14
  73. package/src/pipes/round.pipe.ts +0 -9
  74. package/src/pipes/time-ago-formatted.pipe.ts +0 -10
  75. package/src/pipes/timing.pipe.ts +0 -18
  76. package/src/services/google-analytics.service.spec.ts +0 -17
  77. package/src/services/google-analytics.service.ts +0 -65
  78. package/src/services/graphql-query.service.spec.ts +0 -17
  79. package/src/services/graphql-query.service.ts +0 -103
  80. package/src/services/local-storage.service.spec.ts +0 -17
  81. package/src/services/local-storage.service.ts +0 -50
  82. package/src/services/window-ref.service.spec.ts +0 -17
  83. package/src/services/window-ref.service.ts +0 -25
  84. package/tsconfig.json +0 -10
package/rollup.config.mjs DELETED
@@ -1,58 +0,0 @@
1
- import resolve from '@rollup/plugin-node-resolve';
2
- import commonjs from '@rollup/plugin-commonjs';
3
- import typescript from 'rollup-plugin-typescript2';
4
- import angular from 'rollup-plugin-angular';
5
- import terser from '@rollup/plugin-terser';
6
- import json from '@rollup/plugin-json';
7
- import pkg from './package.json' assert { type: 'json' };
8
-
9
- export default {
10
- input: 'src/index.ts', // Entry point for your library
11
- output: [
12
- {
13
- file: pkg.main, // Output for CommonJS
14
- format: 'cjs',
15
- sourcemap: true,
16
- },
17
- {
18
- file: pkg.module, // Output for ESModule
19
- format: 'es',
20
- sourcemap: true,
21
- },
22
- {
23
- file: pkg.browser, // UMD output for browsers
24
- format: 'umd',
25
- name: 'AcuteCommon',
26
- globals: {
27
- '@angular/core': 'ng.core',
28
- '@angular/common': 'ng.common',
29
- '@angular/forms': 'ng.forms',
30
- '@angular/animations': 'ng.animations',
31
- 'rxjs': 'rxjs',
32
- },
33
- sourcemap: true,
34
- }
35
- ],
36
- external: ['@angular/core', '@angular/common', "@angular/compiler",
37
- "@angular/forms",
38
- "@angular/platform-browser",
39
- "@angular/platform-browser-dynamic",
40
- "@angular/router",
41
- "@bitblit/ratchet-common",
42
- "primeflex",
43
- "primeicons",
44
- "primeng",
45
- "zone.js",'rxjs'], // Externals, you don’t bundle Angular and RxJS
46
- plugins: [
47
- resolve({
48
- browser: true, // Resolves third-party libraries in node_modules
49
- }),
50
- json(),
51
- commonjs(), // Convert CommonJS modules to ES6
52
- angular(), // Handles Angular HTML templates and styles
53
- typescript({ // Compile TypeScript
54
- tsconfig: './tsconfig.json',
55
- }),
56
- terser(), // Minify the bundle
57
- ]
58
- };
@@ -1,19 +0,0 @@
1
- import { BuildInformation } from '@bitblit/ratchet-common/build/build-information';
2
-
3
- export class NgxAcuteCommonInfo {
4
- // Empty constructor prevents instantiation
5
- // eslint-disable-next-line @typescript-eslint/no-empty-function
6
- private constructor() {}
7
-
8
- public static buildInformation(): BuildInformation {
9
- const val: BuildInformation = {
10
- version: 'LOCAL-SNAPSHOT',
11
- hash: 'LOCAL-HASH',
12
- branch: 'LOCAL-BRANCH',
13
- tag: 'LOCAL-TAG',
14
- timeBuiltISO: 'LOCAL-TIME-ISO',
15
- notes: 'LOCAL-NOTES',
16
- };
17
- return val;
18
- }
19
- }
@@ -1,33 +0,0 @@
1
- import {Component} from '@angular/core';
2
- import {DialogService, DynamicDialogConfig, DynamicDialogRef} from 'primeng/dynamicdialog';
3
- import {Logger} from '@bitblit/ratchet-common/logger/logger';
4
- import {BehaviorSubject} from 'rxjs';
5
- import {AsyncPipe} from "@angular/common";
6
-
7
- @Component({
8
- selector: 'ngx-acute-common-alert',
9
- template: '<div><pre>{{cfg.data.message | async}}</pre></div>',
10
- standalone: true,
11
- imports: [AsyncPipe]
12
- })
13
- export class AlertComponent {
14
- constructor(
15
- private dialogService: DialogService,
16
- public cfg: DynamicDialogConfig,
17
- protected ref: DynamicDialogRef,
18
- ) {
19
- Logger.info('Creating with %j', this.cfg);
20
- }
21
-
22
- public static showAlert(dialogSvc: DialogService, message: BehaviorSubject<string> | string, title: string = 'Alert'): DynamicDialogRef {
23
- const dlg: DynamicDialogRef = dialogSvc.open(AlertComponent, {
24
- //disableClose: true,
25
- //autoFocus: true,
26
- data: {
27
- message: message instanceof BehaviorSubject ? message : new BehaviorSubject<string>(message),
28
- },
29
- header: title,
30
- });
31
- return dlg;
32
- }
33
- }
@@ -1,9 +0,0 @@
1
- <div>
2
- <div style="display: flex; flex-direction: column; justify-content: center">
3
- <h4>{{cfg.data.message | async}}</h4>
4
- <p-progressSpinner styleClass="w-2rem h-2rem" strokeWidth="5" fill="var(--surface-ground)" animationDuration=".8s"></p-progressSpinner>
5
- <div *ngIf="cfg.data.subMessage">
6
- {{cfg.data.subMessage}}
7
- </div>
8
- </div>
9
- </div>
@@ -1,24 +0,0 @@
1
- import { ComponentFixture, TestBed } from '@angular/core/testing';
2
- import { beforeEach, describe, expect, test } from 'vitest';
3
-
4
- import {BlockUiComponent} from "./block-ui.component";
5
-
6
- describe('BlockUiComponent', () => {
7
- let component: BlockUiComponent;
8
- let fixture: ComponentFixture<BlockUiComponent>;
9
-
10
- beforeEach(async () => {
11
- await TestBed.configureTestingModule({
12
- imports: [BlockUiComponent]
13
- })
14
- .compileComponents();
15
-
16
- fixture = TestBed.createComponent(BlockUiComponent);
17
- component = fixture.componentInstance;
18
- fixture.detectChanges();
19
- });
20
-
21
- test.skip('should create', () => {
22
- expect(component).toBeTruthy();
23
- });
24
- });
@@ -1,62 +0,0 @@
1
- import {Component} from '@angular/core';
2
- import {DialogService, DynamicDialogConfig, DynamicDialogRef} from 'primeng/dynamicdialog';
3
- import {BehaviorSubject} from 'rxjs';
4
- import {Logger} from '@bitblit/ratchet-common/logger/logger';
5
- import {AsyncPipe, NgIf} from "@angular/common";
6
- import {ProgressSpinnerModule} from "primeng/progressspinner";
7
-
8
- @Component({
9
- selector: 'ngx-acute-common-block-ui',
10
- templateUrl: './block-ui.component.html',
11
- standalone: true,
12
- imports: [NgIf, AsyncPipe, ProgressSpinnerModule]
13
- })
14
- export class BlockUiComponent {
15
- constructor(
16
- private dialogService: DialogService,
17
- public cfg: DynamicDialogConfig,
18
- ) {}
19
-
20
- public static createUiBlock(
21
- dialogService: DialogService,
22
- message: BehaviorSubject<string> | string = 'Please wait...',
23
- subMessage?: string,
24
- ): DynamicDialogRef {
25
- const dlg: DynamicDialogRef = dialogService.open(BlockUiComponent, {
26
- closable: false,
27
- modal: true,
28
- data: {
29
- message: message instanceof BehaviorSubject ? message : new BehaviorSubject<string>(message),
30
- subMessage: subMessage,
31
- },
32
- });
33
- return dlg;
34
- }
35
-
36
- public static async runPromiseWithUiBlock<T>(
37
- dialogService: DialogService,
38
- prom: Promise<T>,
39
- message: BehaviorSubject<string> | string = 'Please wait...',
40
- subMessage?: string,
41
- ): Promise<T> {
42
- const dlg = dialogService.open(BlockUiComponent, {
43
- closable: false,
44
- modal: true,
45
- data: {
46
- message: message instanceof BehaviorSubject ? message : new BehaviorSubject<string>(message),
47
- subMessage: subMessage,
48
- },
49
- });
50
-
51
- try {
52
- const rval: T = await prom;
53
- dlg?.close(rval); // If it is still open, close it
54
- Logger.info('Blockui - Received %j - closing blocker ui and returning', rval);
55
- return rval;
56
- } catch (err) {
57
- Logger.error('Caught error inside block ui dialog : %s - rethrowing', err, err);
58
- dlg?.close(); // If it is still open, close it
59
- throw err;
60
- }
61
- }
62
- }
package/src/index.ts DELETED
@@ -1,2 +0,0 @@
1
- export * from './build/ngx-acute-common-info';
2
- export * from './components/dialogs/alert/alert.component'
@@ -1,11 +0,0 @@
1
- import { Pipe, PipeTransform } from '@angular/core';
2
-
3
- @Pipe({ name: 'acuteCapitalize' , standalone: true})
4
- export class CapitalizePipe implements PipeTransform {
5
-
6
- transform(input: string): string {
7
- return input && input.length
8
- ? (input.charAt(0).toUpperCase() + input.slice(1).toLowerCase())
9
- : input;
10
- }
11
- }
@@ -1,13 +0,0 @@
1
- import { Pipe, PipeTransform } from '@angular/core';
2
- import {CurrencyRatchet} from "@bitblit/ratchet-common/lang/currency-ratchet";
3
-
4
- @Pipe({ name: 'acuteDollars', standalone: true })
5
- export class DollarFormattedPipe implements PipeTransform {
6
- transform(input: number): string {
7
- const rval: string =
8
- input === null || input === undefined
9
- ? 'Null'
10
- : CurrencyRatchet.dollarFormat(input)
11
- return rval;
12
- }
13
- }
@@ -1,19 +0,0 @@
1
- import { Pipe, PipeTransform } from '@angular/core';
2
- import { Logger } from '@bitblit/ratchet-common/logger/logger';
3
-
4
- @Pipe({ name: 'acuteMapValues', standalone: true })
5
- export class MapValuesPipe implements PipeTransform {
6
- transform(value: any, args?: any[]): any[] {
7
- const returnArray = [];
8
-
9
- for (const k of Object.keys(value)) {
10
- returnArray.push({
11
- key: k,
12
- val: value[k],
13
- });
14
- }
15
-
16
- Logger.info('Map values : %j : %j', returnArray, args);
17
- return returnArray;
18
- }
19
- }
@@ -1,9 +0,0 @@
1
- import { Pipe, PipeTransform } from '@angular/core';
2
-
3
- @Pipe({ name: 'acuteNumberWithCommas' , standalone: true})
4
- export class NumberWithCommasPipe implements PipeTransform {
5
-
6
- transform(input: number): string {
7
- return new Intl.NumberFormat().format(input);
8
- }
9
- }
@@ -1,58 +0,0 @@
1
- import { Pipe, PipeTransform } from '@angular/core';
2
-
3
- @Pipe({ name: 'acuteOrderBy', pure: false, standalone: true })
4
- export class OrderByPipe implements PipeTransform {
5
- static _orderByComparator(a: any, b: any): number {
6
- if (isNaN(parseFloat(a)) || !isFinite(a) || isNaN(parseFloat(b)) || !isFinite(b)) {
7
- //Isn't a number so lowercase the string to properly compare
8
- if (String(a).toLowerCase() < String(b).toLowerCase()) return -1;
9
- if (String(a).toLowerCase() > String(b).toLowerCase()) return 1;
10
- } else {
11
- //Parse strings as numbers to compare properly
12
- if (parseFloat(a) < parseFloat(b)) return -1;
13
- if (parseFloat(a) > parseFloat(b)) return 1;
14
- }
15
-
16
- return 0; //equal each other
17
- }
18
-
19
- transform(input: any, [config = '+']): any {
20
- if (!Array.isArray(input)) return input;
21
-
22
- if (!Array.isArray(config) || (Array.isArray(config) && config.length == 1)) {
23
- const propertyToCheck: string = !Array.isArray(config) ? config : config[0];
24
- const desc = propertyToCheck.substr(0, 1) == '-';
25
-
26
- //Basic array
27
- if (!propertyToCheck || propertyToCheck == '-' || propertyToCheck == '+') {
28
- return !desc ? input.sort() : input.sort().reverse();
29
- } else {
30
- const property: string =
31
- propertyToCheck.substr(0, 1) == '+' || propertyToCheck.substr(0, 1) == '-' ? propertyToCheck.substr(1) : propertyToCheck;
32
-
33
- return input.sort(function (a: any, b: any) {
34
- return !desc
35
- ? OrderByPipe._orderByComparator(a[property], b[property])
36
- : -OrderByPipe._orderByComparator(a[property], b[property]);
37
- });
38
- }
39
- } else {
40
- //Loop over property of the array in order and sort
41
- return input.sort(function (a: any, b: any) {
42
- for (let i: number = 0; i < config.length; i++) {
43
- const desc = config[i].substr(0, 1) == '-';
44
- const property = config[i].substr(0, 1) == '+' || config[i].substr(0, 1) == '-' ? config[i].substr(1) : config[i];
45
-
46
- const comparison = !desc
47
- ? OrderByPipe._orderByComparator(a[property], b[property])
48
- : -OrderByPipe._orderByComparator(a[property], b[property]);
49
-
50
- //Don't return 0 yet in case of needing to sort by next property
51
- if (comparison != 0) return comparison;
52
- }
53
-
54
- return 0; //equal each other
55
- });
56
- }
57
- }
58
- }
@@ -1,9 +0,0 @@
1
- import { Pipe, PipeTransform } from '@angular/core';
2
- import {NumberRatchet} from "@bitblit/ratchet-common/lang/number-ratchet";
3
-
4
- @Pipe({ name: 'acutePercent' , standalone: true })
5
- export class PercentFormattedPipe implements PipeTransform {
6
- transform(input: number): string {
7
- return NumberRatchet.pctFormatted(input);
8
- }
9
- }
@@ -1,14 +0,0 @@
1
- import { Pipe, PipeTransform } from '@angular/core';
2
-
3
- @Pipe({ name: 'acutePlural' , standalone: true})
4
- export class PluralPipe implements PipeTransform {
5
-
6
- transform(input: number, label: string, pluralLabel: string = ''): string {
7
- input = input || 0;
8
- return input === 1
9
- ? `${input} ${label}`
10
- : pluralLabel
11
- ? `${input} ${pluralLabel}`
12
- : `${input} ${label}s`;
13
- }
14
- }
@@ -1,9 +0,0 @@
1
- import { Pipe, PipeTransform } from '@angular/core';
2
-
3
- @Pipe({ name: 'acuteRound' , standalone: true})
4
- export class RoundPipe implements PipeTransform {
5
-
6
- transform(input: number): number {
7
- return Math.round(input);
8
- }
9
- }
@@ -1,10 +0,0 @@
1
- import {Pipe, PipeTransform} from '@angular/core';
2
- import {DurationRatchet} from "@bitblit/ratchet-common/lang/duration-ratchet";
3
- import {NumberRatchet} from "@bitblit/ratchet-common/lang/number-ratchet";
4
-
5
- @Pipe({ name: 'acuteTimeAgo' , standalone: true})
6
- export class TimeAgoFormattedPipe implements PipeTransform {
7
- transform(input: number): string {
8
- return DurationRatchet.formatMsDuration(new Date().getTime() - NumberRatchet.safeNumber(input));
9
- }
10
- }
@@ -1,18 +0,0 @@
1
- import { Pipe, PipeTransform } from '@angular/core';
2
-
3
- @Pipe({ name: 'acuteTiming' , standalone: true})
4
- export class TimingPipe implements PipeTransform {
5
- transform(time: number): string {
6
- if (time) {
7
- const minutes = Math.floor(time / 60);
8
- const seconds = Math.floor(time % 60);
9
- return `${this.initZero(minutes)}${minutes}:${this.initZero(seconds)}${seconds}`;
10
- }
11
-
12
- return '00:00';
13
- }
14
-
15
- private initZero(time: number): string {
16
- return time < 10 ? '0' : '';
17
- }
18
- }
@@ -1,17 +0,0 @@
1
- import { TestBed } from '@angular/core/testing';
2
- import { beforeEach, describe, expect, test } from 'vitest';
3
-
4
- import {GraphqlQueryService} from "./graphql-query.service";
5
-
6
- describe('GraphqlQueryService', () => {
7
- let service: GraphqlQueryService;
8
-
9
- beforeEach(() => {
10
- TestBed.configureTestingModule({});
11
- service = TestBed.inject(GraphqlQueryService);
12
- });
13
-
14
- test.skip('should be created', () => {
15
- expect(service).toBeTruthy();
16
- });
17
- });
@@ -1,65 +0,0 @@
1
- import { Injectable } from '@angular/core';
2
- import { NavigationEnd, Router } from '@angular/router';
3
- import { Logger } from '@bitblit/ratchet-common/logger/logger';
4
-
5
- // eslint-disable-next-line @typescript-eslint/ban-types
6
- declare let gtag: Function;
7
-
8
- @Injectable({
9
- providedIn: 'root',
10
- })
11
- // See : https://lumin8media.com/blog/add-google-analytics-angular
12
- export class GoogleAnalyticsService {
13
- private static readonly IS_PROD: boolean = true;
14
-
15
- constructor(private router: Router) {}
16
-
17
- public initialize() {
18
- this.onRouteChange();
19
-
20
- // dynamically add analytics scripts to document head
21
- try {
22
- const url:string = 'https://www.googletagmanager.com/gtag/js?id=';
23
- const gTagScript = document.createElement('script');
24
- gTagScript.async = true;
25
- const tagId: string = GoogleAnalyticsService.IS_PROD ? 'G-7D5BBK4K8X' : null;
26
- gTagScript.src = `${url}${tagId}`;
27
- document.head.appendChild(gTagScript);
28
-
29
- const dataLayerScript = document.createElement('script');
30
- dataLayerScript.innerHTML = `
31
- window.dataLayer = window.dataLayer || [];
32
- function gtag(){dataLayer.push(arguments);}
33
- gtag('js', new Date());
34
- gtag('config', '${tagId}', {'send_page_view': false});`;
35
- document.head.appendChild(dataLayerScript);
36
- } catch (e) {
37
- Logger.error('Error adding Google Analytics', e, e);
38
- }
39
- }
40
-
41
- // track visited routes
42
- private onRouteChange() {
43
- const tagId: string = GoogleAnalyticsService.IS_PROD ? 'G-7D5BBK4K8X' : null;
44
-
45
- this.router.events.subscribe((event) => {
46
- if (event instanceof NavigationEnd) {
47
- gtag('config', tagId, {
48
- page_path: event.urlAfterRedirects,
49
- });
50
-
51
- Logger.info('Sending Google Analytics tracking for: ', event.urlAfterRedirects);
52
- Logger.info('Google Analytics property ID: ', tagId);
53
- }
54
- });
55
- }
56
-
57
- // use gtag.js to send Google Analytics Events
58
- public event(action: string, eventCategory?: string, eventLabel?: string, value?: string) {
59
- gtag('event', action, {
60
- ...(eventCategory && { event_category: eventCategory }),
61
- ...(eventLabel && { event_label: eventLabel }),
62
- ...(value && { value: value }),
63
- });
64
- }
65
- }
@@ -1,17 +0,0 @@
1
- import { TestBed } from '@angular/core/testing';
2
- import { beforeEach, describe, expect, test } from 'vitest';
3
-
4
- import {GraphqlQueryService} from "./graphql-query.service";
5
-
6
- describe('GraphqlQueryService', () => {
7
- let service: GraphqlQueryService;
8
-
9
- beforeEach(() => {
10
- TestBed.configureTestingModule({});
11
- service = TestBed.inject(GraphqlQueryService);
12
- });
13
-
14
- test.skip('should be created', () => {
15
- expect(service).toBeTruthy();
16
- });
17
- });
@@ -1,103 +0,0 @@
1
- import { Injectable } from '@angular/core';
2
- import { DialogService } from 'primeng/dynamicdialog';
3
- import { MessageService } from 'primeng/api';
4
- import { Logger } from '@bitblit/ratchet-common/logger/logger';
5
- import { GraphqlRatchet } from '@bitblit/ratchet-graphql/graphql/graphql-ratchet';
6
- import { BlockUiComponent } from "../components/dialogs/block-ui/block-ui.component";
7
- import {AuthorizationStyle} from "@bitblit/ratchet-graphql/graphql/authorization-style";
8
-
9
- @Injectable({providedIn: 'root'})
10
- export class GraphqlQueryService {
11
- constructor(
12
- private graphqlRatchet: GraphqlRatchet,
13
- private dialogService: DialogService,
14
- private messageService: MessageService,
15
- ) {}
16
-
17
- public async executeQuery<T>(queryName: string, variables: any, authStyle: AuthorizationStyle = AuthorizationStyle.TokenRequired
18
- ): Promise<T | null> {
19
- let rval: T | null = null;
20
- this.messageService.add({ severity: 'info', summary: 'Running query', detail: queryName, life: 3000 });
21
-
22
- Logger.info('eq: %j -: %s --: %s ---: %j', queryName, variables);
23
-
24
- try {
25
- rval = await this.graphqlRatchet.executeQuery<T>(queryName, variables, authStyle);
26
- } catch (err) {
27
- Logger.error('Fail : %s', err);
28
- } finally {
29
- this.messageService.clear();
30
- }
31
- return rval;
32
- }
33
-
34
- public async executeQueryWithBlock<T>(
35
- blockMessage: string,
36
- queryName: string,
37
- variables: any,
38
- authStyle: AuthorizationStyle = AuthorizationStyle.TokenRequired
39
- ): Promise<T | null> {
40
- let rval: T | null = null;
41
- this.messageService.add({ severity: 'info', summary: 'Running query', detail: queryName, life: 3000 });
42
-
43
- Logger.info('eqb: %j -: %s --: %s ---: %j', blockMessage, queryName, variables);
44
-
45
- try {
46
- rval = await BlockUiComponent.runPromiseWithUiBlock<T>(
47
- this.dialogService,
48
- this.graphqlRatchet.executeQuery<T>(queryName, variables, authStyle),
49
- blockMessage,
50
- );
51
- } catch (err) {
52
- Logger.error('Fail : %s', err);
53
- } finally {
54
- this.messageService.clear();
55
- }
56
-
57
- return rval;
58
- }
59
-
60
-
61
- public async executeMutate<T>(queryName: string, variables: any, authStyle: AuthorizationStyle = AuthorizationStyle.TokenRequired
62
- ): Promise<T | null> {
63
- let rval: T | null = null;
64
- this.messageService.add({ severity: 'info', summary: 'Running query', detail: queryName, life: 3000 });
65
-
66
- Logger.info('eq: %j -: %s --: %s ---: %j', queryName, variables);
67
-
68
- try {
69
- rval = await this.graphqlRatchet.executeMutate<T>(queryName, variables, authStyle);
70
- } catch (err) {
71
- Logger.error('Fail : %s', err);
72
- } finally {
73
- this.messageService.clear();
74
- }
75
-
76
- return rval;
77
- }
78
-
79
- public async executeMutateWithBlock<T>(
80
- blockMessage: string,
81
- queryName: string,
82
- variables: any,
83
- authStyle: AuthorizationStyle = AuthorizationStyle.TokenRequired
84
-
85
- ): Promise<T | null> {
86
- let rval: T | null = null;
87
- this.messageService.add({ severity: 'info', summary: 'Running query', detail: queryName, life: 3000 });
88
-
89
- try {
90
- rval = await BlockUiComponent.runPromiseWithUiBlock<T>(
91
- this.dialogService,
92
- this.graphqlRatchet.executeMutate<T>(queryName, variables, authStyle),
93
- blockMessage,
94
- );
95
- } catch (err) {
96
- Logger.error('Fail : %s', err);
97
- } finally {
98
- this.messageService.clear();
99
- }
100
-
101
- return rval;
102
- }
103
- }
@@ -1,17 +0,0 @@
1
- import { TestBed } from '@angular/core/testing';
2
- import { beforeEach, describe, expect, test } from 'vitest';
3
-
4
- import {LocalStorageService} from "./local-storage.service";
5
-
6
- describe('LocalStorageService', () => {
7
- let service: LocalStorageService<any>;
8
-
9
- beforeEach(() => {
10
- TestBed.configureTestingModule({});
11
- service = TestBed.inject(LocalStorageService);
12
- });
13
-
14
- test.skip('should be created', () => {
15
- expect(service).toBeTruthy();
16
- });
17
- });
@@ -1,50 +0,0 @@
1
- import { Injectable } from '@angular/core';
2
- import { Logger } from '@bitblit/ratchet-common/logger/logger';
3
-
4
-
5
- export function storageFinder(): Storage | null {
6
- if (typeof window !== 'undefined') {
7
- if (typeof window.localStorage !=='undefined') {
8
- return window.localStorage;
9
- }
10
- }
11
- return null;
12
- }
13
-
14
- @Injectable({providedIn: 'root'})
15
- export class LocalStorageService<T> {
16
- private static readonly APP_NAME: string = 'Scribe';
17
-
18
- public get storageReady(): boolean {
19
- return !!storageFinder();
20
- }
21
-
22
- public clear(): void {
23
- this.update({ } as T );
24
- }
25
-
26
- public update(value: T): T {
27
- if (this.storageReady) {
28
- const toSave: T = value || ({} as T);
29
- const saveString: string = JSON.stringify(toSave);
30
- Logger.info('Updating storage to %s', saveString);
31
- localStorage.setItem(LocalStorageService.APP_NAME, saveString);
32
- return toSave;
33
- } else {
34
- Logger.info('Skipping update - storage not ready : %j', value);
35
- return {} as T;
36
- }
37
- }
38
-
39
- fetch(): T {
40
- if (this.storageReady) {
41
- const loadString: string = localStorage.getItem(LocalStorageService.APP_NAME) || '{}';
42
- const rval: T = JSON.parse(loadString) as T;
43
- return rval;
44
- } else {
45
- Logger.info('Skipping fetch - storage not ready');
46
- return {} as T;
47
- }
48
- }
49
-
50
- }