@tech4good/angular-schematics 13.6.0 → 13.8.0

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 (109) hide show
  1. package/README.md +3 -2
  2. package/package.json +1 -1
  3. package/src/component/files/__name@dasherize__/__name@dasherize__.component.ts.template +8 -8
  4. package/src/container/files/__name@dasherize__/+state/__name@dasherize__.actions.ts.template +3 -2
  5. package/src/container/files/__name@dasherize__/+state/__name@dasherize__.effects.ts.template +6 -5
  6. package/src/container/files/__name@dasherize__/+state/__name@dasherize__.selectors.ts.template +2 -2
  7. package/src/container/files/__name@dasherize__/__name@dasherize__.component.ts.template +25 -14
  8. package/src/container/index.js +13 -2
  9. package/src/container/index.js.map +1 -1
  10. package/src/entity/files/__name@dasherize__/__name@dasherize__.actions.ts.template +9 -30
  11. package/src/entity/files/__name@dasherize__/__name@dasherize__.effects.ts.template +23 -24
  12. package/src/init/files/CHANGELOG.md.template +10 -0
  13. package/src/init/files/README.md.template +24 -0
  14. package/src/init/files/package.json.template +4 -2
  15. package/src/init/files/src/app/admin/admin-routing.module.ts.template +17 -0
  16. package/src/init/files/src/app/admin/admin.module.spec.ts.template +13 -0
  17. package/src/init/files/src/app/admin/admin.module.ts.template +28 -0
  18. package/src/init/files/src/app/admin/waitlist/+state/waitlist.actions.ts.template +23 -0
  19. package/src/init/files/src/app/admin/waitlist/+state/waitlist.effects.ts.template +50 -0
  20. package/src/init/files/src/app/admin/waitlist/+state/waitlist.selectors.ts.template +39 -0
  21. package/src/init/files/src/app/admin/waitlist/+state/waitlist.state.ts.template +13 -0
  22. package/src/init/files/src/app/admin/waitlist/waitlist.animations.ts.template +4 -0
  23. package/src/init/files/src/app/admin/waitlist/waitlist.component.html.template +30 -0
  24. package/src/init/files/src/app/admin/waitlist/waitlist.component.scss.template +14 -0
  25. package/src/init/files/src/app/admin/waitlist/waitlist.component.spec.ts.template +25 -0
  26. package/src/init/files/src/app/admin/waitlist/waitlist.component.ts.template +136 -0
  27. package/src/init/files/src/app/app-routing.module.ts.template +13 -5
  28. package/src/init/files/src/app/core/analytics/log.service.ts.template +89 -4
  29. package/src/init/files/src/app/core/analytics/time-analytics.service.ts.template +204 -69
  30. package/src/init/files/src/app/core/auth/auth.guard.ts.template +85 -0
  31. package/src/init/files/src/app/core/core.module.ts.template +4 -0
  32. package/src/init/files/src/app/core/firebase/firebase.service.ts.template +4 -4
  33. package/src/init/files/src/app/core/local-storage/local-storage.service.ts.template +47 -0
  34. package/src/init/files/src/app/core/local-storage/session-local-storage.service.ts.template +67 -0
  35. package/src/init/files/src/app/core/local-storage/session.service.ts.template +48 -0
  36. package/src/init/files/src/app/core/store/app-state/app-state.actions.ts.template +270 -0
  37. package/src/init/files/src/app/core/store/app-state/app-state.effects.ts.template +131 -0
  38. package/src/init/files/src/app/core/store/app-state/app-state.model.ts.template +8 -0
  39. package/src/init/files/src/app/core/store/app-state/app-state.reducer.spec.ts.template +13 -0
  40. package/src/init/files/src/app/core/store/app-state/app-state.reducer.ts.template +51 -0
  41. package/src/init/files/src/app/core/store/app-state/app-state.service.ts.template +50 -0
  42. package/src/init/files/src/app/core/store/app.effects.ts.template +10 -2
  43. package/src/init/files/src/app/core/store/app.reducer.ts.template +6 -0
  44. package/src/init/files/src/app/core/store/app.selectors.ts.template +12 -0
  45. package/src/init/files/src/app/core/store/auth/auth.actions.ts.template +3 -1
  46. package/src/init/files/src/app/core/store/auth/auth.effects.ts.template +27 -31
  47. package/src/init/files/src/app/core/store/auth/auth.reducer.ts.template +1 -1
  48. package/src/init/files/src/app/core/store/auth/auth.selectors.ts.template +5 -1
  49. package/src/init/files/src/app/core/store/cached-load-connections.service.ts.template +9 -8
  50. package/src/init/files/src/app/core/store/user/user.model.ts.template +14 -0
  51. package/src/init/files/src/app/core/store/user-context/user-context.actions.ts.template +270 -0
  52. package/src/init/files/src/app/core/store/user-context/user-context.effects.ts.template +131 -0
  53. package/src/init/files/src/app/core/store/user-context/user-context.model.ts.template +13 -0
  54. package/src/init/files/src/app/core/store/user-context/user-context.reducer.spec.ts.template +13 -0
  55. package/src/init/files/src/app/core/store/user-context/user-context.reducer.ts.template +51 -0
  56. package/src/init/files/src/app/core/store/user-context/user-context.service.ts.template +50 -0
  57. package/src/init/files/src/app/general/general-routing.module.ts.template +6 -2
  58. package/src/init/files/src/app/general/general.module.ts.template +8 -2
  59. package/src/init/files/src/app/general/home/+state/home.actions.ts.template +26 -0
  60. package/src/init/files/src/app/general/home/+state/home.effects.ts.template +48 -0
  61. package/src/init/files/src/app/general/home/+state/home.model.ts.template +0 -0
  62. package/src/init/files/src/app/general/home/+state/home.selectors.ts.template +20 -0
  63. package/src/init/files/src/app/general/home/+state/home.state.ts.template +13 -0
  64. package/src/init/files/src/app/general/home/home.animations.ts.template +4 -0
  65. package/src/init/files/src/app/general/home/home.component.html.template +5 -0
  66. package/src/init/files/src/app/general/home/home.component.scss.template +5 -0
  67. package/src/init/files/src/app/general/{e404/e404.component.spec.ts.template → home/home.component.spec.ts.template} +6 -6
  68. package/src/init/files/src/app/general/home/home.component.ts.template +88 -0
  69. package/src/init/files/src/app/general/landing/+state/landing.actions.ts.template +26 -0
  70. package/src/init/files/src/app/general/landing/+state/landing.effects.ts.template +48 -0
  71. package/src/init/files/src/app/general/landing/+state/landing.model.ts.template +0 -0
  72. package/src/init/files/src/app/general/landing/+state/landing.selectors.ts.template +20 -0
  73. package/src/init/files/src/app/general/landing/+state/landing.state.ts.template +13 -0
  74. package/src/init/files/src/app/general/landing/landing.animations.ts.template +4 -0
  75. package/src/init/files/src/app/general/landing/landing.component.html.template +3 -0
  76. package/src/init/files/src/app/general/landing/landing.component.scss.template +13 -0
  77. package/src/init/files/src/app/general/landing/landing.component.spec.ts.template +25 -0
  78. package/src/init/files/src/app/general/landing/landing.component.ts.template +98 -0
  79. package/src/init/files/src/app/general/login/login.component.html.template +5 -5
  80. package/src/init/files/src/app/general/login/login.component.ts.template +12 -4
  81. package/src/init/files/src/app/onboarding/consent/+state/consent.actions.ts.template +23 -0
  82. package/src/init/files/src/app/onboarding/consent/+state/consent.effects.ts.template +47 -0
  83. package/src/init/files/src/app/onboarding/consent/+state/consent.model.ts.template +0 -0
  84. package/src/init/files/src/app/onboarding/consent/+state/consent.selectors.ts.template +20 -0
  85. package/src/init/files/src/app/onboarding/consent/+state/consent.state.ts.template +13 -0
  86. package/src/init/files/src/app/onboarding/consent/consent.animations.ts.template +4 -0
  87. package/src/init/files/src/app/onboarding/consent/consent.component.html.template +61 -0
  88. package/src/init/files/src/app/onboarding/consent/consent.component.scss.template +77 -0
  89. package/src/init/files/src/app/onboarding/consent/consent.component.spec.ts.template +25 -0
  90. package/src/init/files/src/app/onboarding/consent/consent.component.ts.template +152 -0
  91. package/src/init/files/src/app/onboarding/onboarding-routing.module.ts.template +19 -0
  92. package/src/init/files/src/app/onboarding/onboarding.module.spec.ts.template +13 -0
  93. package/src/init/files/src/app/onboarding/onboarding.module.ts.template +32 -0
  94. package/src/init/files/src/app/onboarding/waiting/+state/waiting.actions.ts.template +26 -0
  95. package/src/init/files/src/app/onboarding/waiting/+state/waiting.effects.ts.template +52 -0
  96. package/src/init/files/src/app/onboarding/waiting/+state/waiting.model.ts.template +9 -0
  97. package/src/init/files/src/app/onboarding/waiting/+state/waiting.selectors.ts.template +42 -0
  98. package/src/init/files/src/app/onboarding/waiting/+state/waiting.state.ts.template +13 -0
  99. package/src/init/files/src/app/onboarding/waiting/waiting.animations.ts.template +4 -0
  100. package/src/init/files/src/app/onboarding/waiting/waiting.component.html.template +57 -0
  101. package/src/init/files/src/app/onboarding/waiting/waiting.component.scss.template +99 -0
  102. package/src/init/files/src/app/onboarding/waiting/waiting.component.spec.ts.template +25 -0
  103. package/src/init/files/src/app/onboarding/waiting/waiting.component.ts.template +279 -0
  104. package/src/init/files/src/app/shared/shared.module.ts.template +3 -0
  105. package/src/init/files/src/index.html.template +0 -3
  106. package/src/module/files/__name@dasherize__/__name@dasherize__-routing.module.ts.template +2 -0
  107. package/src/init/files/src/app/general/e404/e404.component.html.template +0 -1
  108. package/src/init/files/src/app/general/e404/e404.component.ts.template +0 -28
  109. /package/src/init/files/src/app/{general/e404/e404.component.scss.template → admin/waitlist/+state/waitlist.model.ts.template} +0 -0
@@ -0,0 +1,13 @@
1
+ import { Injectable } from '@angular/core';
2
+
3
+ import { BehaviorSubject } from 'rxjs';
4
+
5
+ @Injectable({
6
+ providedIn: 'root',
7
+ })
8
+ export class WaitlistState {
9
+ // --------------- LOCAL UI STATE ----------------------
10
+
11
+ constructor(
12
+ ) { }
13
+ }
@@ -0,0 +1,4 @@
1
+ import { trigger, group, query, animateChild, state, style, animate, transition } from '@angular/animations';
2
+
3
+ export const WaitlistAnimations = [
4
+ ];
@@ -0,0 +1,30 @@
1
+ <div class="waitlist-container">
2
+ <table id="waitlist-table" mat-table [dataSource]="waitingUsers$" class="mat-elevation-z8">
3
+
4
+ <!-- Author Column -->
5
+ <ng-container matColumnDef="userName">
6
+ <th mat-header-cell *matHeaderCellDef> Name </th>
7
+ <td mat-cell *matCellDef="let user">{{user.name}}</td>
8
+ </ng-container>
9
+
10
+ <!-- Access Status Column -->
11
+ <ng-container matColumnDef="accessState">
12
+ <th mat-header-cell *matHeaderCellDef> Access State </th>
13
+ <td mat-cell *matCellDef="let user">{{ user.accessState }}</td>
14
+ </ng-container>
15
+
16
+ <!-- Update Column -->
17
+ <ng-container matColumnDef="update">
18
+ <th mat-header-cell *matHeaderCellDef> Update Status </th>
19
+ <td mat-cell *matCellDef="let user">
20
+ <span class="update-btn" [matMenuTriggerFor]="menu" aria-label="Update state button">[Update Button]</span>
21
+ <mat-menu #menu="matMenu">
22
+ <button mat-menu-item (click)="updateState$.next({ user, state: option })" *ngFor="let option of accessOptions">{{ option }}</button>
23
+ </mat-menu>
24
+ </td>
25
+ </ng-container>
26
+
27
+ <tr mat-header-row *matHeaderRowDef="displayedColumns; sticky: true"></tr>
28
+ <tr mat-row *matRowDef="let row; columns: displayedColumns;"></tr>
29
+ </table>
30
+ </div>
@@ -0,0 +1,14 @@
1
+ :host {
2
+ display: block;
3
+ .waitlist-container {
4
+ width: 100%;
5
+
6
+ #waitlist-table {
7
+ width: 100%;
8
+
9
+ .update-btn {
10
+ cursor: pointer;
11
+ }
12
+ }
13
+ }
14
+ }
@@ -0,0 +1,25 @@
1
+ import { waitForAsync, ComponentFixture, TestBed } from '@angular/core/testing';
2
+
3
+ import { WaitlistComponent } from './waitlist.component';
4
+
5
+ describe('WaitlistComponent', () => {
6
+ let component: WaitlistComponent;
7
+ let fixture: ComponentFixture<WaitlistComponent>;
8
+
9
+ beforeEach(waitForAsync(() => {
10
+ TestBed.configureTestingModule({
11
+ declarations: [WaitlistComponent],
12
+ })
13
+ .compileComponents();
14
+ }));
15
+
16
+ beforeEach(() => {
17
+ fixture = TestBed.createComponent(WaitlistComponent);
18
+ component = fixture.componentInstance;
19
+ fixture.detectChanges();
20
+ });
21
+
22
+ it('should create', () => {
23
+ expect(component).toBeTruthy();
24
+ });
25
+ });
@@ -0,0 +1,136 @@
1
+ import { Component, OnInit, OnDestroy, ChangeDetectionStrategy } from '@angular/core';
2
+ import { WaitlistAnimations } from './waitlist.animations';
3
+ import { ParamMap, ActivatedRoute } from '@angular/router';
4
+ import { Store, select } from '@ngrx/store';
5
+ import * as fromStore from '../../core/store/app.reducer';
6
+ import * as fromAuth from '../../core/store/auth/auth.reducer';
7
+ import { FirebaseService } from '../../core/firebase/firebase.service';
8
+ import { Observable, Subject, BehaviorSubject, combineLatest } from 'rxjs';
9
+ import { withLatestFrom, take, takeUntil } from 'rxjs/operators';
10
+
11
+ import { WaitlistState } from './+state/waitlist.state';
12
+ import { WaitlistSelectors } from './+state/waitlist.selectors';
13
+
14
+ import { LoadData, Cleanup } from './+state/waitlist.actions';
15
+ import { ActionFlow, RouterNavigate, ActionSet } from '../../core/store/app.actions';
16
+
17
+ import { User, AccessState } from '../../core/store/user/user.model';
18
+ import { ShowSnackbar } from '../../core/snackbar/snackbar.actions';
19
+ import { UpdateUser, UserActionTypes } from '../../core/store/user/user.actions';
20
+
21
+ @Component({
22
+ selector: 'app-waitlist',
23
+ templateUrl: './waitlist.component.html',
24
+ styleUrls: ['./waitlist.component.scss'],
25
+ changeDetection: ChangeDetectionStrategy.OnPush,
26
+ animations: WaitlistAnimations,
27
+ })
28
+ export class WaitlistComponent implements OnInit, OnDestroy {
29
+ // --------------- ROUTE PARAMS & CURRENT USER ---------
30
+
31
+
32
+ // --------------- LOCAL AND GLOBAL STATE --------------
33
+
34
+ /** Access options for menu sorted alphabetically. */
35
+ accessOptions = Object.keys(AccessState)
36
+ .map((k) => AccessState[k])
37
+ .sort((a, b) => {
38
+ if (a > b) {
39
+ return 1;
40
+ } else if (a < b) {
41
+ return -1;
42
+ } else {
43
+ return 0;
44
+ }
45
+ });
46
+
47
+ /** Columns to display in the table */
48
+ displayedColumns = ['userName', 'accessState', 'update'];
49
+
50
+ // --------------- DB ENTITY DATA ----------------------
51
+
52
+ /** Container id for selectors and loading. */
53
+ containerId: string = this.db.createId();
54
+
55
+ /** Get array of all waiting users. */
56
+ waitingUsers$: Observable<User[]> = this.selectors.selectWaitingUsers(this.containerId);
57
+
58
+ // --------------- DATA BINDING ------------------------
59
+
60
+
61
+ // --------------- EVENT BINDING -----------------------
62
+
63
+ /** Event stream for updating user accessState. */
64
+ updateState$: Subject<{ user: User, state: AccessState }> = new Subject<{ user: User, state: AccessState }>();
65
+
66
+
67
+ // --------------- HELPER FUNCTIONS AND OTHER ----------
68
+
69
+ /** Unsubscribe observable for subscriptions. */
70
+ unsubscribe$: Subject<void> = new Subject();
71
+
72
+ constructor(
73
+ private state: WaitlistState,
74
+ private route: ActivatedRoute,
75
+ private selectors: WaitlistSelectors,
76
+ private store: Store<fromStore.State>,
77
+ private db: FirebaseService,
78
+ ) {
79
+ }
80
+
81
+ ngOnInit() {
82
+ // --------------- EVENT HANDLING ----------------------
83
+
84
+ this.updateState$.pipe(
85
+ takeUntil(this.unsubscribe$),
86
+ ).subscribe(({ user, state }) => {
87
+ const actionSets: ActionSet[] = [{
88
+ action: new UpdateUser(user.__id, {
89
+ accessState: state,
90
+ }, this.containerId),
91
+ responseActionTypes: {
92
+ success: UserActionTypes.UPDATE_SUCCESS,
93
+ failure: UserActionTypes.UPDATE_FAIL,
94
+ },
95
+ }];
96
+
97
+ this.store.dispatch(
98
+ new ActionFlow({
99
+ actionSets,
100
+ successActionFn: (actionSetResponses) => {
101
+ return [
102
+ new ShowSnackbar({
103
+ message: `Updated ${user.name}'s accessState to ${state}`,
104
+ config: { duration: 3000 },
105
+ }),
106
+ ];
107
+ },
108
+ failActionFn: (actionSetResponses) => {
109
+ return [
110
+ new ShowSnackbar({
111
+ message: 'Failed to submit response',
112
+ config: { duration: 3000 },
113
+ }),
114
+ ];
115
+ },
116
+ }),
117
+ );
118
+ });
119
+
120
+
121
+ // --------------- LOAD DATA ---------------------------
122
+
123
+ // Once everything is set up, load the data for the role.
124
+ this.store.dispatch( new LoadData(this.containerId) );
125
+ }
126
+
127
+ ngOnDestroy() {
128
+ // Unsubscribe subscriptions.
129
+ this.unsubscribe$.next();
130
+ this.unsubscribe$.complete();
131
+
132
+ // Unsubscribe from firebase connection from load and free up memoized selector values.
133
+ this.store.dispatch( new Cleanup(this.containerId) );
134
+ this.selectors.cleanup(this.containerId);
135
+ }
136
+ }
@@ -1,18 +1,26 @@
1
1
  import { NgModule } from '@angular/core';
2
- import { Routes, RouterModule } from '@angular/router';
2
+ import { Routes, RouterModule, PreloadAllModules } from '@angular/router';
3
+ import { AuthGuard } from './core/auth/auth.guard';
3
4
 
4
5
  // Containers
5
6
  import { LoginComponent } from './general/login/login.component';
7
+ import { LandingComponent } from './general/landing/landing.component';
6
8
 
9
+ // Our general approach is to load the GeneralModule eagerly and everything lazily (but with preloading)
7
10
  const appRoutes: Routes = [
8
- // Replace when a default route is set up
9
- { path: '', redirectTo: 'login', pathMatch: 'full' },
10
- { path: '**', redirectTo: '404', pathMatch: 'full' },
11
+ { path: 'admin', loadChildren: () => import('./admin/admin.module').then((mod) => mod.AdminModule) },
12
+ { path: 'onboarding', loadChildren: () => import('./onboarding/onboarding.module').then((mod) => mod.OnboardingModule) },
13
+ { path: '', component: LandingComponent, canActivate: [AuthGuard] },
14
+ { path: '**', redirectTo: '', pathMatch: 'full' },
11
15
  ];
12
16
 
13
17
  @NgModule({
14
18
  imports: [
15
- RouterModule.forRoot(appRoutes, { useHash: true }),
19
+ RouterModule.forRoot(appRoutes, {
20
+ useHash: true,
21
+ relativeLinkResolution: 'legacy',
22
+ preloadingStrategy: PreloadAllModules,
23
+ }),
16
24
  ],
17
25
  exports: [RouterModule],
18
26
  })
@@ -1,9 +1,12 @@
1
1
  import { Injectable } from '@angular/core';
2
2
  import { LoggingAngularFirestore } from '../setup/firebase-setup';
3
3
  import { isDevMode } from '@angular/core';
4
+ import { environment } from '../../../environments/environment';
4
5
 
5
6
  interface LogData {
6
- __userId: string;
7
+ __userId?: string;
8
+ __sessionId?: string;
9
+ __deviceId?: string;
7
10
  route: string;
8
11
  startTime: number;
9
12
  time: Array<{
@@ -25,11 +28,93 @@ export class LogService {
25
28
  ) {
26
29
  }
27
30
 
28
- rawLog(data: LogData, logType: string = 'logs') {
31
+ rawLog(data: LogData, logType: string = 'logs', logId?: string) {
32
+ // If no logId supplied, then create one
33
+ if (!logId) {
34
+ logId = this.log.createId();
35
+ }
36
+
29
37
  if (!isDevMode()) {
30
- this.log.collection(`/${logType}`).add(data);
38
+ // Note that we are intentionally overriding logs with same id.
39
+ // This allows for making sure the same log doesn't get stored twice,
40
+ // e.g. for storing things in localStorage and saving next time we load
41
+ // the browser
42
+ this.log.doc(`/${logType}/${logId}`).set(data);
31
43
  } else if (this.LOG_IN_DEV) {
32
- console.log(data);
44
+ console.log('LOGGING', logId, data);
45
+ }
46
+ }
47
+
48
+ rawLogOnBeaconEvent(data: LogData, logType: string = 'logs', logId?: string) {
49
+ // If no logId supplied, then create one
50
+ if (!logId) {
51
+ logId = this.log.createId();
52
+ }
53
+
54
+ if (data !== null) {
55
+ if (!isDevMode()) {
56
+ navigator.sendBeacon(
57
+ `https://firestore.googleapis.com/v1/projects/${environment.firebaseLogs.projectId}/databases/(default)/documents:commit`,
58
+ this.reformatLogForBeacon(data, logType, logId),
59
+ );
60
+ } else if (this.LOG_IN_DEV) {
61
+ console.log('BEACON LOGGING', logId, data);
62
+ }
63
+ }
64
+ }
65
+
66
+ reformatLogForBeacon(data: LogData, logType, logId) {
67
+ // Converts JSON objects to Firestore's REST API Document format
68
+ // from: https://stackoverflow.com/questions/62246410/how-to-convert-a-firestore-document-to-plain-json-and-vice-versa/62304377#62304377
69
+ const jsonToDocument = (value) => {
70
+ if (!value) {
71
+ return { 'nullValue': null };
72
+ } else if (!isNaN(value) && !(value && value.constructor === Array)) { // edit, checking if not an array since empty arrays pass the isNan test
73
+ if (value.toString().indexOf('.') != -1) {
74
+ return { 'doubleValue': value };
75
+ } else {
76
+ return { 'integerValue': value };
77
+ }
78
+ } else if (value === 'true' || value === 'false' || typeof value === 'boolean') {
79
+ return { 'booleanValue': value };
80
+ } else if (typeof value === 'string') { // edit: removed check for Date that was before String check (see below)
81
+ return { 'stringValue': value };
82
+ } else if (value && value.constructor === Array) {
83
+ return { 'arrayValue': { values: value.map((v) => jsonToDocument(v)) } };
84
+ } else if (typeof value === 'object') {
85
+ const obj = {};
86
+ for (const o in value) {
87
+ if (Object.prototype.hasOwnProperty.call(value, o)) {
88
+ obj[o] = jsonToDocument(value[o]);
89
+ }
90
+ }
91
+ return { 'mapValue': { fields: obj } };
92
+ }
93
+ };
94
+
95
+ if (data !== null) {
96
+ const wrappedData = {
97
+ writes: [
98
+ {
99
+ update: {
100
+ name: `projects/${environment.firebaseLogs.projectId}/databases/(default)/documents/${logType}/${logId}`,
101
+ fields: {
102
+ ...jsonToDocument(data).mapValue.fields,
103
+ },
104
+ },
105
+ },
106
+ ],
107
+ };
108
+
109
+ // console.log('WRAPPED_DATA', wrappedData);
110
+
111
+ const preparedData = new Blob([JSON.stringify(wrappedData, null, 2)], {
112
+ type: 'application/json',
113
+ });
114
+
115
+ return preparedData;
116
+ } else {
117
+ return null;
33
118
  }
34
119
  }
35
120
  }