@tech4good/angular-schematics 17.0.4 → 18.0.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.
- package/README.md +8 -0
- package/package.json +4 -4
- package/src/collection.json +0 -16
- package/src/component/files/__name@dasherize__/__name@dasherize__.component.ts.template +22 -8
- package/src/component/index.js +2 -45
- package/src/component/index.js.map +1 -1
- package/src/component/schema.json +0 -5
- package/src/entity/files/__name@dasherize__/__name@dasherize__.mock.ts.template +12 -0
- package/src/entity/files/__name@dasherize__/__name@dasherize__.model.ts.template +1 -0
- package/src/entity/files/__name@dasherize__/__name@dasherize__.store.ts.template +41 -0
- package/src/entity/index.js +29 -50
- package/src/entity/index.js.map +1 -1
- package/src/init/files/.firebaserc.template +8 -0
- package/src/init/files/README.md.template +6 -6
- package/src/init/files/angular.json.template +18 -11
- package/src/init/files/package.json.template +29 -30
- package/src/init/files/src/app/admin/{waitlist/waitlist.animations.ts.template → admin-panel/admin-panel.animations.ts.template} +1 -1
- package/src/init/files/src/app/admin/{waitlist/waitlist.component.html.template → admin-panel/admin-panel.component.html.template} +3 -3
- package/src/init/files/src/app/admin/{waitlist/waitlist.component.scss.template → admin-panel/admin-panel.component.scss.template} +1 -1
- package/src/init/files/src/app/admin/admin-panel/admin-panel.component.spec.ts.template +25 -0
- package/src/init/files/src/app/admin/admin-panel/admin-panel.component.ts.template +99 -0
- package/src/init/files/src/app/app.component.html.template +1 -0
- package/src/init/files/src/app/app.component.ts.template +14 -8
- package/src/init/files/src/app/app.config.ts.template +63 -0
- package/src/init/files/src/app/app.routes.ts.template +32 -0
- package/src/init/files/src/app/core/analytics/log.service.ts.template +122 -89
- package/src/init/files/src/app/core/analytics/time-analytics.service.ts.template +9 -17
- package/src/init/files/src/app/core/auth/auth.guard.ts.template +25 -22
- package/src/init/files/src/app/core/firebase/cached-listeners.service.ts.template +291 -0
- package/src/init/files/src/app/core/firebase/database.service.ts.template +56 -0
- package/src/init/files/src/app/core/firebase/firebase.mock.service.ts.template +276 -0
- package/src/init/files/src/app/core/firebase/firebase.service.ts.template +265 -215
- package/src/init/files/src/app/core/local-storage/session.service.ts.template +3 -4
- package/src/init/files/src/app/core/store/app.model.ts.template +19 -0
- package/src/init/files/src/app/core/store/app.store.ts.template +1074 -0
- package/src/init/files/src/app/core/store/auth/auth.mock.ts.template +20 -0
- package/src/init/files/src/app/core/store/auth/auth.store.ts.template +136 -0
- package/src/init/files/src/app/core/store/batch-write.firebase.service.ts.template +58 -0
- package/src/init/files/src/app/core/store/batch-write.mock.service.ts.template +105 -0
- package/src/init/files/src/app/core/store/batch-write.service.ts.template +126 -0
- package/src/init/files/src/app/core/store/user/user.mock.ts.template +24 -0
- package/src/init/files/src/app/core/store/user/user.model.ts.template +1 -1
- package/src/init/files/src/app/core/store/user/user.store.ts.template +41 -0
- package/src/init/files/src/app/core/store/user-context/user-context.mock.ts.template +24 -0
- package/src/init/files/src/app/core/store/user-context/user-context.model.ts.template +1 -0
- package/src/init/files/src/app/core/store/user-context/user-context.store.ts.template +41 -0
- package/src/init/files/src/app/core/utils/rand.utils.ts.template +13 -0
- package/src/init/files/src/app/{onboarding → first-time}/consent/consent.component.html.template +8 -13
- package/src/init/files/src/app/first-time/consent/consent.component.ts.template +90 -0
- package/src/init/files/src/app/first-time/early-access/early-access.animations.ts.template +4 -0
- package/src/init/files/src/app/first-time/early-access/early-access.component.html.template +69 -0
- package/src/init/files/src/app/{onboarding/waiting/waiting.component.scss.template → first-time/early-access/early-access.component.scss.template} +1 -1
- package/src/init/files/src/app/first-time/early-access/early-access.component.spec.ts.template +25 -0
- package/src/init/files/src/app/first-time/early-access/early-access.component.ts.template +194 -0
- package/src/init/files/src/app/first-time/early-access/early-access.model.ts.template +7 -0
- package/src/init/files/src/app/{general → first-time}/landing/landing.component.html.template +1 -1
- package/src/init/files/src/app/first-time/landing/landing.component.ts.template +44 -0
- package/src/init/files/src/app/first-time/login/login.component.html.template +10 -0
- package/src/init/files/src/app/first-time/login/login.component.ts.template +45 -0
- package/src/init/files/src/app/first-time/onboarding/onboarding.animations.ts.template +4 -0
- package/src/init/files/src/app/first-time/onboarding/onboarding.component.html.template +2 -0
- package/src/init/files/src/app/first-time/onboarding/onboarding.component.scss.template +5 -0
- package/src/init/files/src/app/{admin/waitlist/waitlist.component.spec.ts.template → first-time/onboarding/onboarding.component.spec.ts.template} +6 -6
- package/src/init/files/src/app/first-time/onboarding/onboarding.component.ts.template +41 -0
- package/src/init/files/src/app/main/home/home.component.html.template +5 -0
- package/src/init/files/src/app/main/home/home.component.ts.template +51 -0
- package/src/init/files/src/app/shared/navbar/navbar.component.html.template +15 -0
- package/src/init/files/src/app/shared/navbar/navbar.component.scss.template +43 -0
- package/src/init/files/src/app/shared/navbar/navbar.component.spec.ts.template +25 -0
- package/src/init/files/src/app/shared/navbar/navbar.component.ts.template +40 -0
- package/src/init/files/src/app/shared/redeployment-warning/redeployment-warning.component.html.template +9 -0
- package/src/init/files/src/app/shared/{components/redeployment-warning → redeployment-warning}/redeployment-warning.component.ts.template +17 -6
- package/src/init/files/src/app/shared/{components/redeployment-warning → redeployment-warning}/redeployment-warning.service.ts.template +2 -2
- package/src/init/files/src/assets/images/close-x.svg +3 -0
- package/src/init/files/src/environments/environment.ts.template +1 -0
- package/src/init/files/src/index.html.template +1 -1
- package/src/init/files/tsconfig.json.template +0 -1
- package/src/container/files/__name@dasherize__/+state/__name@dasherize__.actions.ts.template +0 -26
- package/src/container/files/__name@dasherize__/+state/__name@dasherize__.effects.ts.template +0 -48
- package/src/container/files/__name@dasherize__/+state/__name@dasherize__.model.ts.template +0 -0
- package/src/container/files/__name@dasherize__/+state/__name@dasherize__.selectors.ts.template +0 -20
- package/src/container/files/__name@dasherize__/+state/__name@dasherize__.state.ts.template +0 -13
- package/src/container/files/__name@dasherize__/__name@dasherize__.animations.ts.template +0 -4
- package/src/container/files/__name@dasherize__/__name@dasherize__.component.html.template +0 -3
- package/src/container/files/__name@dasherize__/__name@dasherize__.component.scss.template +0 -5
- package/src/container/files/__name@dasherize__/__name@dasherize__.component.spec.ts.template +0 -25
- package/src/container/files/__name@dasherize__/__name@dasherize__.component.ts.template +0 -90
- package/src/container/index.d.ts +0 -2
- package/src/container/index.js +0 -127
- package/src/container/index.js.map +0 -1
- package/src/container/index_spec.d.ts +0 -1
- package/src/container/index_spec.js +0 -23
- package/src/container/index_spec.js.map +0 -1
- package/src/container/schema.json +0 -50
- package/src/entity/files/__name@dasherize__/__name@dasherize__.actions.ts.template +0 -249
- package/src/entity/files/__name@dasherize__/__name@dasherize__.effects.ts.template +0 -131
- package/src/entity/files/__name@dasherize__/__name@dasherize__.reducer.spec.ts.template +0 -13
- package/src/entity/files/__name@dasherize__/__name@dasherize__.reducer.ts.template +0 -51
- package/src/entity/files/__name@dasherize__/__name@dasherize__.service.ts.template +0 -50
- package/src/entity-in-example/files/__name@dasherize__/__name@dasherize__.actions.ts.template +0 -270
- package/src/entity-in-example/files/__name@dasherize__/__name@dasherize__.effects.ts.template +0 -131
- package/src/entity-in-example/files/__name@dasherize__/__name@dasherize__.model.ts.template +0 -3
- package/src/entity-in-example/files/__name@dasherize__/__name@dasherize__.reducer.spec.ts.template +0 -13
- package/src/entity-in-example/files/__name@dasherize__/__name@dasherize__.reducer.ts.template +0 -51
- package/src/entity-in-example/files/__name@dasherize__/__name@dasherize__.service.ts.template +0 -50
- package/src/entity-in-example/index.d.ts +0 -2
- package/src/entity-in-example/index.js +0 -141
- package/src/entity-in-example/index.js.map +0 -1
- package/src/entity-in-example/index_spec.d.ts +0 -1
- package/src/entity-in-example/index_spec.js +0 -23
- package/src/entity-in-example/index_spec.js.map +0 -1
- package/src/entity-in-example/schema.json +0 -45
- package/src/init/files/CHANGELOG.md.template +0 -10
- package/src/init/files/src/app/admin/admin-routing.module.ts.template +0 -17
- package/src/init/files/src/app/admin/admin.module.spec.ts.template +0 -13
- package/src/init/files/src/app/admin/admin.module.ts.template +0 -28
- package/src/init/files/src/app/admin/waitlist/+state/waitlist.actions.ts.template +0 -23
- package/src/init/files/src/app/admin/waitlist/+state/waitlist.effects.ts.template +0 -50
- package/src/init/files/src/app/admin/waitlist/+state/waitlist.model.ts.template +0 -0
- package/src/init/files/src/app/admin/waitlist/+state/waitlist.selectors.ts.template +0 -39
- package/src/init/files/src/app/admin/waitlist/+state/waitlist.state.ts.template +0 -13
- package/src/init/files/src/app/admin/waitlist/waitlist.component.ts.template +0 -141
- package/src/init/files/src/app/app-routing.module.ts.template +0 -26
- package/src/init/files/src/app/app.module.ts.template +0 -34
- package/src/init/files/src/app/core/core.module.ts.template +0 -75
- package/src/init/files/src/app/core/setup/firebase-setup.ts.template +0 -25
- package/src/init/files/src/app/core/setup/module-import-guard.ts.template +0 -5
- package/src/init/files/src/app/core/snackbar/snackbar.actions.ts.template +0 -24
- package/src/init/files/src/app/core/snackbar/snackbar.effects.ts.template +0 -41
- package/src/init/files/src/app/core/store/app-state/app-state.actions.ts.template +0 -249
- package/src/init/files/src/app/core/store/app-state/app-state.effects.ts.template +0 -131
- package/src/init/files/src/app/core/store/app-state/app-state.model.ts.template +0 -8
- package/src/init/files/src/app/core/store/app-state/app-state.reducer.spec.ts.template +0 -13
- package/src/init/files/src/app/core/store/app-state/app-state.reducer.ts.template +0 -51
- package/src/init/files/src/app/core/store/app-state/app-state.service.ts.template +0 -50
- package/src/init/files/src/app/core/store/app.actions.ts.template +0 -92
- package/src/init/files/src/app/core/store/app.effects.ts.template +0 -175
- package/src/init/files/src/app/core/store/app.reducer.ts.template +0 -36
- package/src/init/files/src/app/core/store/app.selectors.ts.template +0 -42
- package/src/init/files/src/app/core/store/auth/auth.actions.ts.template +0 -77
- package/src/init/files/src/app/core/store/auth/auth.effects.ts.template +0 -163
- package/src/init/files/src/app/core/store/auth/auth.reducer.spec.ts.template +0 -13
- package/src/init/files/src/app/core/store/auth/auth.reducer.ts.template +0 -26
- package/src/init/files/src/app/core/store/auth/auth.selectors.ts.template +0 -25
- package/src/init/files/src/app/core/store/cached-load-connections.service.ts.template +0 -405
- package/src/init/files/src/app/core/store/cached-selectors.service.ts.template +0 -376
- package/src/init/files/src/app/core/store/effects.helpers.ts.template +0 -66
- package/src/init/files/src/app/core/store/user/user.actions.ts.template +0 -248
- package/src/init/files/src/app/core/store/user/user.effects.ts.template +0 -148
- package/src/init/files/src/app/core/store/user/user.reducer.spec.ts.template +0 -13
- package/src/init/files/src/app/core/store/user/user.reducer.ts.template +0 -50
- package/src/init/files/src/app/core/store/user/user.service.ts.template +0 -50
- package/src/init/files/src/app/core/store/user-context/user-context.actions.ts.template +0 -248
- package/src/init/files/src/app/core/store/user-context/user-context.effects.ts.template +0 -131
- package/src/init/files/src/app/core/store/user-context/user-context.reducer.spec.ts.template +0 -13
- package/src/init/files/src/app/core/store/user-context/user-context.reducer.ts.template +0 -51
- package/src/init/files/src/app/core/store/user-context/user-context.service.ts.template +0 -50
- package/src/init/files/src/app/core/utils/string-case.utils.ts.template +0 -96
- package/src/init/files/src/app/general/general-routing.module.ts.template +0 -25
- package/src/init/files/src/app/general/general.module.spec.ts.template +0 -13
- package/src/init/files/src/app/general/general.module.ts.template +0 -36
- package/src/init/files/src/app/general/home/+state/home.actions.ts.template +0 -26
- package/src/init/files/src/app/general/home/+state/home.effects.ts.template +0 -48
- package/src/init/files/src/app/general/home/+state/home.model.ts.template +0 -0
- package/src/init/files/src/app/general/home/+state/home.selectors.ts.template +0 -20
- package/src/init/files/src/app/general/home/+state/home.state.ts.template +0 -13
- package/src/init/files/src/app/general/home/home.component.html.template +0 -5
- package/src/init/files/src/app/general/home/home.component.ts.template +0 -88
- package/src/init/files/src/app/general/landing/+state/landing.actions.ts.template +0 -26
- package/src/init/files/src/app/general/landing/+state/landing.effects.ts.template +0 -48
- package/src/init/files/src/app/general/landing/+state/landing.model.ts.template +0 -0
- package/src/init/files/src/app/general/landing/+state/landing.selectors.ts.template +0 -20
- package/src/init/files/src/app/general/landing/+state/landing.state.ts.template +0 -13
- package/src/init/files/src/app/general/landing/landing.component.ts.template +0 -98
- package/src/init/files/src/app/general/login/login.component.html.template +0 -11
- package/src/init/files/src/app/general/login/login.component.ts.template +0 -80
- package/src/init/files/src/app/onboarding/consent/+state/consent.actions.ts.template +0 -23
- package/src/init/files/src/app/onboarding/consent/+state/consent.effects.ts.template +0 -47
- package/src/init/files/src/app/onboarding/consent/+state/consent.model.ts.template +0 -0
- package/src/init/files/src/app/onboarding/consent/+state/consent.selectors.ts.template +0 -20
- package/src/init/files/src/app/onboarding/consent/+state/consent.state.ts.template +0 -13
- package/src/init/files/src/app/onboarding/consent/consent.component.ts.template +0 -151
- package/src/init/files/src/app/onboarding/onboarding-routing.module.ts.template +0 -19
- package/src/init/files/src/app/onboarding/onboarding.module.spec.ts.template +0 -13
- package/src/init/files/src/app/onboarding/onboarding.module.ts.template +0 -32
- package/src/init/files/src/app/onboarding/waiting/+state/waiting.actions.ts.template +0 -26
- package/src/init/files/src/app/onboarding/waiting/+state/waiting.effects.ts.template +0 -52
- package/src/init/files/src/app/onboarding/waiting/+state/waiting.model.ts.template +0 -9
- package/src/init/files/src/app/onboarding/waiting/+state/waiting.selectors.ts.template +0 -42
- package/src/init/files/src/app/onboarding/waiting/+state/waiting.state.ts.template +0 -13
- package/src/init/files/src/app/onboarding/waiting/waiting.animations.ts.template +0 -4
- package/src/init/files/src/app/onboarding/waiting/waiting.component.html.template +0 -57
- package/src/init/files/src/app/onboarding/waiting/waiting.component.spec.ts.template +0 -25
- package/src/init/files/src/app/onboarding/waiting/waiting.component.ts.template +0 -281
- package/src/init/files/src/app/shared/components/redeployment-warning/redeployment-warning.component.html.template +0 -10
- package/src/init/files/src/app/shared/shared.module.ts.template +0 -87
- package/src/init/files/src/main.ts.template +0 -12
- package/src/module/files/__name@dasherize__/__name@dasherize__-routing.module.ts.template +0 -15
- package/src/module/files/__name@dasherize__/__name@dasherize__.module.spec.ts.template +0 -13
- package/src/module/files/__name@dasherize__/__name@dasherize__.module.ts.template +0 -24
- package/src/module/index.d.ts +0 -2
- package/src/module/index.js +0 -97
- package/src/module/index.js.map +0 -1
- package/src/module/index_spec.d.ts +0 -1
- package/src/module/index_spec.js +0 -23
- package/src/module/index_spec.js.map +0 -1
- package/src/module/schema.json +0 -38
- /package/src/init/files/src/app/{onboarding → first-time}/consent/consent.animations.ts.template +0 -0
- /package/src/init/files/src/app/{onboarding → first-time}/consent/consent.component.scss.template +0 -0
- /package/src/init/files/src/app/{onboarding → first-time}/consent/consent.component.spec.ts.template +0 -0
- /package/src/init/files/src/app/{general → first-time}/landing/landing.animations.ts.template +0 -0
- /package/src/init/files/src/app/{general → first-time}/landing/landing.component.scss.template +0 -0
- /package/src/init/files/src/app/{general → first-time}/landing/landing.component.spec.ts.template +0 -0
- /package/src/init/files/src/app/{general → first-time}/login/login.component.scss.template +0 -0
- /package/src/init/files/src/app/{general → first-time}/login/login.component.spec.ts.template +0 -0
- /package/src/init/files/src/app/{general → main}/home/home.animations.ts.template +0 -0
- /package/src/init/files/src/app/{general → main}/home/home.component.scss.template +0 -0
- /package/src/init/files/src/app/{general → main}/home/home.component.spec.ts.template +0 -0
- /package/src/init/files/src/app/shared/{components/redeployment-warning → redeployment-warning}/redeployment-warning.component.scss.template +0 -0
- /package/src/init/files/src/app/shared/{components/redeployment-warning → redeployment-warning}/redeployment-warning.component.spec.ts.template +0 -0
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
<div class="waiting-container" *ngIf="waitlistData$ | async as data">
|
|
2
|
-
<ng-container *ngIf="{ loading: loading$ | async } as state">
|
|
3
|
-
<!-- Core questions on motivation and desired value -->
|
|
4
|
-
<ng-container *ngIf="data.currentUser.accessState === AccessState.SUBMIT_INTEREST && !state.loading">
|
|
5
|
-
<h1>Hello and Welcome!</h1>
|
|
6
|
-
<form #checkForm="ngForm" (ngSubmit)="submitInterest$.next()">
|
|
7
|
-
<div class="form-field-group">
|
|
8
|
-
<mat-label class="question">Which of the following best describe your background and interest in {{ appName }}?</mat-label>
|
|
9
|
-
<div class="checkbox-group" [formGroup]="backgroundSelections">
|
|
10
|
-
<mat-checkbox [formControlName]="option.fieldName" [aria-label]="option.ariaLabel" *ngFor="let option of backgroundAndInterestsOptions">{{ option.label }}</mat-checkbox>
|
|
11
|
-
</div>
|
|
12
|
-
</div>
|
|
13
|
-
<div class="form-field-group" [formGroup]="backgroundSelections" *ngIf="backgroundSelections.value.other">
|
|
14
|
-
<mat-label class="question">How would you describe your background and interest in {{ appName }}?</mat-label>
|
|
15
|
-
<mat-form-field class="background-other" appearance="fill">
|
|
16
|
-
<mat-label>Your background and interest</mat-label>
|
|
17
|
-
<input matInput [(ngModel)]="backgroundOther" name="backgroundOther" required [ngModelOptions]="{standalone: true}">
|
|
18
|
-
</mat-form-field>
|
|
19
|
-
</div>
|
|
20
|
-
<div class="form-field-group">
|
|
21
|
-
<mat-label class="question">What do you hope to experience or get out of an application for {{ appArea }}?</mat-label>
|
|
22
|
-
<mat-form-field class="desired-value" appearance="fill">
|
|
23
|
-
<mat-label>Your ideal experience or outcomes</mat-label>
|
|
24
|
-
<textarea #text matInput [(ngModel)]="desiredValue" name="desiredValue" required></textarea>
|
|
25
|
-
<mat-hint *ngIf="text.value?.length < 100">You've shared {{text.value?.length || 0}} characters. If you could say a little more and explain why, that'd be helpful! 🙏</mat-hint>
|
|
26
|
-
</mat-form-field>
|
|
27
|
-
</div>
|
|
28
|
-
<button type="submit" class="btn continue-btn" [disabled]="!checkForm.form.valid">
|
|
29
|
-
Submit and Continue
|
|
30
|
-
<img src="https://icongr.am/feather/arrow-right.svg?size=20&color=B2B6C7">
|
|
31
|
-
</button>
|
|
32
|
-
</form>
|
|
33
|
-
</ng-container>
|
|
34
|
-
<!-- Questions to develop a richer understanding of context: goals and needs, barriers, partial solutions, motivators, influencers, environmental context -->
|
|
35
|
-
<ng-container *ngIf="data.currentUser.accessState === AccessState.SUBMIT_DETAILED && !state.loading">
|
|
36
|
-
<h1>Help us understand your unique context and needs</h1>
|
|
37
|
-
<form #checkForm2="ngForm" (ngSubmit)="submitDetailed$.next()">
|
|
38
|
-
<div class="form-field-group">
|
|
39
|
-
<mat-label class="question">[Insert some questions that can help develop a richer understanding of context, e.g. around goals and needs, barriers, partial solutions, motivators, influencers, environmental context, etc.]</mat-label>
|
|
40
|
-
</div>
|
|
41
|
-
<button type="submit" class="btn continue-btn" [disabled]="!checkForm2.form.valid">
|
|
42
|
-
Submit and Continue
|
|
43
|
-
<img src="https://icongr.am/feather/arrow-right.svg?size=20&color=B2B6C7">
|
|
44
|
-
</button>
|
|
45
|
-
</form>
|
|
46
|
-
</ng-container>
|
|
47
|
-
<!-- Waiting list position and path for going getting access early -->
|
|
48
|
-
<ng-container *ngIf="data.currentUser.accessState === AccessState.WAITING && !state.loading">
|
|
49
|
-
<h1>You are <span class="your-position">{{ nth(data.currentUser.positionNumber) }}</span> on the waitlist</h1>
|
|
50
|
-
<p>Thanks for signing up! We're hand-reviewing your response and personally onboarding our first 100 users to ensure that we can give you a delightful experience. We'll be in touch soon 😊</p>
|
|
51
|
-
<p>Also, we haven't had the chance to implement a formal referral system yet, but if you would love to get off the waitlist faster and can help us reach others, email {{ outreachLeadName }} at <a [href]="'mailto:' + outreachLeadEmail">{{ outreachLeadEmail }}</a> and let's talk about getting you early access!</p>
|
|
52
|
-
</ng-container>
|
|
53
|
-
<div class="loading-container" *ngIf="state.loading">
|
|
54
|
-
Submitting... <mat-spinner [diameter]="20" [strokeWidth]="2"></mat-spinner>
|
|
55
|
-
</div>
|
|
56
|
-
</ng-container>
|
|
57
|
-
</div>
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { waitForAsync, ComponentFixture, TestBed } from '@angular/core/testing';
|
|
2
|
-
|
|
3
|
-
import { WaitingComponent } from './waiting.component';
|
|
4
|
-
|
|
5
|
-
describe('WaitingComponent', () => {
|
|
6
|
-
let component: WaitingComponent;
|
|
7
|
-
let fixture: ComponentFixture<WaitingComponent>;
|
|
8
|
-
|
|
9
|
-
beforeEach(waitForAsync(() => {
|
|
10
|
-
TestBed.configureTestingModule({
|
|
11
|
-
declarations: [WaitingComponent],
|
|
12
|
-
})
|
|
13
|
-
.compileComponents();
|
|
14
|
-
}));
|
|
15
|
-
|
|
16
|
-
beforeEach(() => {
|
|
17
|
-
fixture = TestBed.createComponent(WaitingComponent);
|
|
18
|
-
component = fixture.componentInstance;
|
|
19
|
-
fixture.detectChanges();
|
|
20
|
-
});
|
|
21
|
-
|
|
22
|
-
it('should create', () => {
|
|
23
|
-
expect(component).toBeTruthy();
|
|
24
|
-
});
|
|
25
|
-
});
|
|
@@ -1,281 +0,0 @@
|
|
|
1
|
-
import { Component, OnInit, OnDestroy, ChangeDetectionStrategy } from '@angular/core';
|
|
2
|
-
import { WaitingAnimations } from './waiting.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, filter, take, takeUntil } from 'rxjs/operators';
|
|
10
|
-
|
|
11
|
-
import { WaitingState } from './+state/waiting.state';
|
|
12
|
-
import { WaitlistData } from './+state/waiting.model';
|
|
13
|
-
import { WaitingSelectors } from './+state/waiting.selectors';
|
|
14
|
-
|
|
15
|
-
import { LoadData, Cleanup } from './+state/waiting.actions';
|
|
16
|
-
import { ActionFlow, RouterNavigate, ActionSet } from '../../core/store/app.actions';
|
|
17
|
-
import { ShowSnackbar } from '../../core/snackbar/snackbar.actions';
|
|
18
|
-
|
|
19
|
-
import { User, AccessState } from '../../core/store/user/user.model';
|
|
20
|
-
import { UpdateUser, UserActionTypes } from '../../core/store/user/user.actions';
|
|
21
|
-
import { UserContext } from '../../core/store/user-context/user-context.model';
|
|
22
|
-
import { UpdateUserContext, AddUserContext, UserContextActionTypes } from '../../core/store/user-context/user-context.actions';
|
|
23
|
-
import { AppState } from '../../core/store/app-state/app-state.model';
|
|
24
|
-
import { UpdateAppState, AddAppState, AppStateActionTypes } from '../../core/store/app-state/app-state.actions';
|
|
25
|
-
|
|
26
|
-
import { Timestamp } from 'firebase/firestore';
|
|
27
|
-
import { FormBuilder } from '@angular/forms';
|
|
28
|
-
|
|
29
|
-
@Component({
|
|
30
|
-
selector: 'app-waiting',
|
|
31
|
-
templateUrl: './waiting.component.html',
|
|
32
|
-
styleUrls: ['./waiting.component.scss'],
|
|
33
|
-
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
34
|
-
animations: WaitingAnimations,
|
|
35
|
-
})
|
|
36
|
-
export class WaitingComponent implements OnInit, OnDestroy {
|
|
37
|
-
// --------------- ROUTE PARAMS & CURRENT USER ---------
|
|
38
|
-
|
|
39
|
-
/** The currently signed in user. */
|
|
40
|
-
currentUser$: Observable<User> = this.store.pipe(
|
|
41
|
-
select(fromAuth.selectUser),
|
|
42
|
-
filter((user) => user !== null), // null indicates LoadAuth hasn't been processed
|
|
43
|
-
);
|
|
44
|
-
|
|
45
|
-
// --------------- LOCAL AND GLOBAL STATE --------------
|
|
46
|
-
|
|
47
|
-
// this allows the template to use the enum
|
|
48
|
-
AccessState = AccessState;
|
|
49
|
-
|
|
50
|
-
// Template constants
|
|
51
|
-
appName = 'APP_NAME [Causeway]';
|
|
52
|
-
appArea = 'APP_AREA [learning web development]';
|
|
53
|
-
backgroundAndInterestsOptions = [
|
|
54
|
-
{ fieldName: 'option1', label: 'OPTION_1 [Student trying to get hands-on experience]', ariaLabel: 'OPTION_1_ARIA' },
|
|
55
|
-
{ fieldName: 'option2', label: 'OPTION_2 [Educator exploring new ways to teach]', ariaLabel: 'OPTION_2_ARIA' },
|
|
56
|
-
{ fieldName: 'option3', label: 'OPTION_3 [Professional wanting to contribute to a cause]', ariaLabel: 'OPTION_3_ARIA' },
|
|
57
|
-
{ fieldName: 'other', label: 'Other (none are a perfect fit)', ariaLabel: 'Other' },
|
|
58
|
-
];
|
|
59
|
-
outreachLeadName = 'OUTREACH_LEAD_NAME [FirstName LastName]';
|
|
60
|
-
outreachLeadEmail = 'OUTREACH_LEAD_EMAIL [email@ucsc.edu]';
|
|
61
|
-
|
|
62
|
-
// Form variables
|
|
63
|
-
desiredValue = '';
|
|
64
|
-
backgroundOther = '';
|
|
65
|
-
backgroundSelections = this.form.group({
|
|
66
|
-
option1: false,
|
|
67
|
-
option2: false,
|
|
68
|
-
option3: false,
|
|
69
|
-
other: false,
|
|
70
|
-
});
|
|
71
|
-
|
|
72
|
-
// --------------- DB ENTITY DATA ----------------------
|
|
73
|
-
|
|
74
|
-
/** Container id for selectors and loading. */
|
|
75
|
-
containerId: string = this.db.createId();
|
|
76
|
-
|
|
77
|
-
/** Waitlist data from app-state, user, and user-context. */
|
|
78
|
-
waitlistData$: Observable<WaitlistData> = this.selectors.getWaitlistData(this.currentUser$, this.containerId);
|
|
79
|
-
|
|
80
|
-
// --------------- DATA BINDING ------------------------
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
// --------------- EVENT BINDING -----------------------
|
|
84
|
-
|
|
85
|
-
/** Event stream for submitting interest. */
|
|
86
|
-
submitInterest$: Subject<void> = new Subject<void>();
|
|
87
|
-
|
|
88
|
-
/** Event stream for submitting detailed context. */
|
|
89
|
-
submitDetailed$: Subject<void> = new Subject<void>();
|
|
90
|
-
|
|
91
|
-
// --------------- HELPER FUNCTIONS AND OTHER ----------
|
|
92
|
-
|
|
93
|
-
/** Function for adding the appropriate suffix. */
|
|
94
|
-
nth(n: number) {
|
|
95
|
-
switch (n % 10) {
|
|
96
|
-
case 1: return `${n}st`;
|
|
97
|
-
case 2: return `${n}nd`;
|
|
98
|
-
case 3: return `${n}rd`;
|
|
99
|
-
default: return `${n}th`;
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
/** Get all options that were selected. */
|
|
104
|
-
getSelections(): string[] {
|
|
105
|
-
return Object.keys(this.backgroundSelections.value).filter((key) => this.backgroundSelections.value[key]);
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
/** Loading indicator. */
|
|
109
|
-
loading$: BehaviorSubject<boolean> = new BehaviorSubject<boolean>(false);
|
|
110
|
-
|
|
111
|
-
/** Unsubscribe observable for subscriptions. */
|
|
112
|
-
unsubscribe$: Subject<void> = new Subject();
|
|
113
|
-
|
|
114
|
-
constructor(
|
|
115
|
-
private state: WaitingState,
|
|
116
|
-
private route: ActivatedRoute,
|
|
117
|
-
private selectors: WaitingSelectors,
|
|
118
|
-
private store: Store<fromStore.State>,
|
|
119
|
-
private db: FirebaseService,
|
|
120
|
-
private form: FormBuilder,
|
|
121
|
-
) {
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
ngOnInit() {
|
|
125
|
-
// --------------- EVENT HANDLING ----------------------
|
|
126
|
-
|
|
127
|
-
this.submitInterest$.pipe(
|
|
128
|
-
withLatestFrom(this.waitlistData$),
|
|
129
|
-
takeUntil(this.unsubscribe$),
|
|
130
|
-
).subscribe(([_, waitlistData]) => {
|
|
131
|
-
const actionSets: ActionSet[] = [{
|
|
132
|
-
action: new UpdateUser(waitlistData.currentUser.__id, {
|
|
133
|
-
accessState: AccessState.SUBMIT_DETAILED,
|
|
134
|
-
}, this.containerId),
|
|
135
|
-
responseActionTypes: {
|
|
136
|
-
success: UserActionTypes.UPDATE_SUCCESS,
|
|
137
|
-
failure: UserActionTypes.UPDATE_FAIL,
|
|
138
|
-
},
|
|
139
|
-
}];
|
|
140
|
-
|
|
141
|
-
if (waitlistData.userContext) {
|
|
142
|
-
actionSets.push({
|
|
143
|
-
action: new UpdateUserContext(waitlistData.userContext.__id, {
|
|
144
|
-
background: {
|
|
145
|
-
selections: this.getSelections(),
|
|
146
|
-
...(this.backgroundOther ? { other: this.backgroundOther } : { }),
|
|
147
|
-
},
|
|
148
|
-
desiredValue: this.desiredValue,
|
|
149
|
-
}, this.containerId),
|
|
150
|
-
responseActionTypes: {
|
|
151
|
-
success: UserContextActionTypes.UPDATE_SUCCESS,
|
|
152
|
-
failure: UserContextActionTypes.UPDATE_FAIL,
|
|
153
|
-
},
|
|
154
|
-
});
|
|
155
|
-
} else {
|
|
156
|
-
actionSets.push({
|
|
157
|
-
action: new AddUserContext({
|
|
158
|
-
__id: this.db.createId(),
|
|
159
|
-
__userId: waitlistData.currentUser.__id,
|
|
160
|
-
background: {
|
|
161
|
-
selections: this.getSelections(),
|
|
162
|
-
...(this.backgroundOther ? { other: this.backgroundOther } : { }),
|
|
163
|
-
},
|
|
164
|
-
desiredValue: this.desiredValue,
|
|
165
|
-
}, this.containerId),
|
|
166
|
-
responseActionTypes: {
|
|
167
|
-
success: UserContextActionTypes.ADD_SUCCESS,
|
|
168
|
-
failure: UserContextActionTypes.ADD_FAIL,
|
|
169
|
-
},
|
|
170
|
-
});
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
this.store.dispatch(
|
|
174
|
-
new ActionFlow({
|
|
175
|
-
actionSets,
|
|
176
|
-
loading$: this.loading$,
|
|
177
|
-
successActionFn: (actionSetResponses) => {
|
|
178
|
-
return [];
|
|
179
|
-
},
|
|
180
|
-
failActionFn: (actionSetResponses) => {
|
|
181
|
-
return [
|
|
182
|
-
new ShowSnackbar({
|
|
183
|
-
message: 'Failed to submit response',
|
|
184
|
-
config: { duration: 3000 },
|
|
185
|
-
}),
|
|
186
|
-
];
|
|
187
|
-
},
|
|
188
|
-
}),
|
|
189
|
-
);
|
|
190
|
-
});
|
|
191
|
-
|
|
192
|
-
this.submitDetailed$.pipe(
|
|
193
|
-
withLatestFrom(this.waitlistData$),
|
|
194
|
-
takeUntil(this.unsubscribe$),
|
|
195
|
-
).subscribe(([_, waitlistData]) => {
|
|
196
|
-
// TODO: Need to implement a cloud function to update all position numbers
|
|
197
|
-
// when we take someone off the waitlist (decrement everyone who joined after them)
|
|
198
|
-
const actionSets: ActionSet[] = [{
|
|
199
|
-
action: new UpdateUser(waitlistData.currentUser.__id, {
|
|
200
|
-
accessState: AccessState.WAITING,
|
|
201
|
-
positionNumber: waitlistData.appState ? waitlistData.appState._totalWaiting + 1 : 1,
|
|
202
|
-
joinedWaitlistAt: Timestamp.fromDate(new Date()),
|
|
203
|
-
}, this.containerId),
|
|
204
|
-
responseActionTypes: {
|
|
205
|
-
success: UserActionTypes.UPDATE_SUCCESS,
|
|
206
|
-
failure: UserActionTypes.UPDATE_FAIL,
|
|
207
|
-
},
|
|
208
|
-
}, {
|
|
209
|
-
action: new UpdateUserContext(waitlistData.userContext.__id, {
|
|
210
|
-
// Add relevant fields from detailed responses
|
|
211
|
-
}, this.containerId),
|
|
212
|
-
responseActionTypes: {
|
|
213
|
-
success: UserContextActionTypes.UPDATE_SUCCESS,
|
|
214
|
-
failure: UserContextActionTypes.UPDATE_FAIL,
|
|
215
|
-
},
|
|
216
|
-
}];
|
|
217
|
-
|
|
218
|
-
if (waitlistData.appState) {
|
|
219
|
-
actionSets.push({
|
|
220
|
-
action: new UpdateAppState(waitlistData.appState.__id, {
|
|
221
|
-
_totalWaiting: waitlistData.appState._totalWaiting + 1,
|
|
222
|
-
}, this.containerId),
|
|
223
|
-
responseActionTypes: {
|
|
224
|
-
success: AppStateActionTypes.UPDATE_SUCCESS,
|
|
225
|
-
failure: AppStateActionTypes.UPDATE_FAIL,
|
|
226
|
-
},
|
|
227
|
-
});
|
|
228
|
-
} else {
|
|
229
|
-
actionSets.push({
|
|
230
|
-
action: new AddAppState({
|
|
231
|
-
__id: 'app',
|
|
232
|
-
_totalWaiting: 1,
|
|
233
|
-
}, this.containerId),
|
|
234
|
-
responseActionTypes: {
|
|
235
|
-
success: AppStateActionTypes.ADD_SUCCESS,
|
|
236
|
-
failure: AppStateActionTypes.ADD_FAIL,
|
|
237
|
-
},
|
|
238
|
-
});
|
|
239
|
-
}
|
|
240
|
-
|
|
241
|
-
this.store.dispatch(
|
|
242
|
-
new ActionFlow({
|
|
243
|
-
actionSets,
|
|
244
|
-
loading$: this.loading$,
|
|
245
|
-
successActionFn: (actionSetResponses) => {
|
|
246
|
-
return [];
|
|
247
|
-
},
|
|
248
|
-
failActionFn: (actionSetResponses) => {
|
|
249
|
-
return [
|
|
250
|
-
new ShowSnackbar({
|
|
251
|
-
message: 'Failed to submit response',
|
|
252
|
-
config: { duration: 3000 },
|
|
253
|
-
}),
|
|
254
|
-
];
|
|
255
|
-
},
|
|
256
|
-
}),
|
|
257
|
-
);
|
|
258
|
-
});
|
|
259
|
-
|
|
260
|
-
// --------------- LOAD DATA ---------------------------
|
|
261
|
-
|
|
262
|
-
// Once everything is set up, load the data for the role.
|
|
263
|
-
this.currentUser$.pipe(
|
|
264
|
-
takeUntil(this.unsubscribe$),
|
|
265
|
-
).subscribe((currentUser) => {
|
|
266
|
-
this.store.dispatch(
|
|
267
|
-
new LoadData({ currentUser }, this.containerId),
|
|
268
|
-
);
|
|
269
|
-
});
|
|
270
|
-
}
|
|
271
|
-
|
|
272
|
-
ngOnDestroy() {
|
|
273
|
-
// Unsubscribe subscriptions.
|
|
274
|
-
this.unsubscribe$.next();
|
|
275
|
-
this.unsubscribe$.complete();
|
|
276
|
-
|
|
277
|
-
// Unsubscribe from firebase connection from load and free up memoized selector values.
|
|
278
|
-
this.store.dispatch( new Cleanup(this.containerId) );
|
|
279
|
-
this.selectors.cleanup(this.containerId);
|
|
280
|
-
}
|
|
281
|
-
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
<div
|
|
2
|
-
class="warning-container"
|
|
3
|
-
*ngIf="showRedeploymentWarning"
|
|
4
|
-
>
|
|
5
|
-
<div class="header">
|
|
6
|
-
<div class="title">This version is out of date!</div>
|
|
7
|
-
<img (click)="close()" src="/assets/img/close-x.svg" />
|
|
8
|
-
</div>
|
|
9
|
-
<button (click)="update()" class="update">Update Now</button>
|
|
10
|
-
</div>
|
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
import { NgModule } from '@angular/core';
|
|
2
|
-
import { CommonModule } from '@angular/common';
|
|
3
|
-
import { RouterModule } from '@angular/router';
|
|
4
|
-
import { FormsModule } from '@angular/forms';
|
|
5
|
-
import { ReactiveFormsModule } from '@angular/forms';
|
|
6
|
-
import { EffectsModule } from '@ngrx/effects';
|
|
7
|
-
|
|
8
|
-
// External Modules
|
|
9
|
-
import { MatMenuModule } from '@angular/material/menu';
|
|
10
|
-
import { MatTabsModule } from '@angular/material/tabs';
|
|
11
|
-
import { MatInputModule } from '@angular/material/input';
|
|
12
|
-
import { MatButtonModule } from '@angular/material/button';
|
|
13
|
-
import { MatFormFieldModule } from '@angular/material/form-field';
|
|
14
|
-
import { MatSelectModule } from '@angular/material/select';
|
|
15
|
-
import { MatSnackBarModule } from '@angular/material/snack-bar';
|
|
16
|
-
import { MatRadioModule } from '@angular/material/radio';
|
|
17
|
-
import { MatCheckboxModule } from '@angular/material/checkbox';
|
|
18
|
-
import { MatDialogModule } from '@angular/material/dialog';
|
|
19
|
-
import { MatTooltipModule } from '@angular/material/tooltip';
|
|
20
|
-
import { MatExpansionModule } from '@angular/material/expansion';
|
|
21
|
-
import { MatTableModule } from '@angular/material/table';
|
|
22
|
-
import { MatProgressSpinnerModule } from '@angular/material/progress-spinner';
|
|
23
|
-
|
|
24
|
-
// Containers
|
|
25
|
-
|
|
26
|
-
// Components
|
|
27
|
-
import { RedeploymentWarningComponent } from './components/redeployment-warning/redeployment-warning.component';
|
|
28
|
-
|
|
29
|
-
// Pipes
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
@NgModule({
|
|
33
|
-
imports: [
|
|
34
|
-
CommonModule,
|
|
35
|
-
RouterModule,
|
|
36
|
-
FormsModule,
|
|
37
|
-
ReactiveFormsModule,
|
|
38
|
-
// External Modules
|
|
39
|
-
MatMenuModule,
|
|
40
|
-
MatTabsModule,
|
|
41
|
-
MatInputModule,
|
|
42
|
-
MatFormFieldModule,
|
|
43
|
-
MatSelectModule,
|
|
44
|
-
MatSnackBarModule,
|
|
45
|
-
MatButtonModule,
|
|
46
|
-
MatCheckboxModule,
|
|
47
|
-
MatTableModule,
|
|
48
|
-
MatDialogModule,
|
|
49
|
-
MatTooltipModule,
|
|
50
|
-
MatExpansionModule,
|
|
51
|
-
MatProgressSpinnerModule,
|
|
52
|
-
MatRadioModule,
|
|
53
|
-
EffectsModule.forFeature([
|
|
54
|
-
]),
|
|
55
|
-
],
|
|
56
|
-
declarations: [
|
|
57
|
-
// Containers
|
|
58
|
-
// Components
|
|
59
|
-
RedeploymentWarningComponent,
|
|
60
|
-
// Pipes
|
|
61
|
-
],
|
|
62
|
-
exports: [
|
|
63
|
-
RouterModule,
|
|
64
|
-
FormsModule,
|
|
65
|
-
ReactiveFormsModule,
|
|
66
|
-
// External Modules
|
|
67
|
-
MatMenuModule,
|
|
68
|
-
MatTabsModule,
|
|
69
|
-
MatInputModule,
|
|
70
|
-
MatFormFieldModule,
|
|
71
|
-
MatSelectModule,
|
|
72
|
-
MatSnackBarModule,
|
|
73
|
-
MatCheckboxModule,
|
|
74
|
-
MatTableModule,
|
|
75
|
-
MatDialogModule,
|
|
76
|
-
MatTooltipModule,
|
|
77
|
-
MatButtonModule,
|
|
78
|
-
MatExpansionModule,
|
|
79
|
-
MatProgressSpinnerModule,
|
|
80
|
-
MatRadioModule,
|
|
81
|
-
// Containers
|
|
82
|
-
// Components
|
|
83
|
-
RedeploymentWarningComponent,
|
|
84
|
-
// Pipes
|
|
85
|
-
],
|
|
86
|
-
})
|
|
87
|
-
export class SharedModule { }
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { enableProdMode } from '@angular/core';
|
|
2
|
-
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
|
|
3
|
-
|
|
4
|
-
import { AppModule } from './app/app.module';
|
|
5
|
-
import { environment } from './environments/environment';
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
if (environment.production) {
|
|
9
|
-
enableProdMode();
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
platformBrowserDynamic().bootstrapModule(AppModule);
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { NgModule } from '@angular/core';
|
|
2
|
-
import { Routes, RouterModule } from '@angular/router';
|
|
3
|
-
import { AuthGuard } from '../core/auth/auth.guard';
|
|
4
|
-
|
|
5
|
-
// Containers
|
|
6
|
-
|
|
7
|
-
const routes: Routes = [
|
|
8
|
-
{ path: '', redirectTo: '/landing', pathMatch: 'full' },
|
|
9
|
-
];
|
|
10
|
-
|
|
11
|
-
@NgModule({
|
|
12
|
-
imports: [RouterModule.forChild(routes)],
|
|
13
|
-
exports: [RouterModule],
|
|
14
|
-
})
|
|
15
|
-
export class <%= classify(name) %>RoutingModule { }
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { <%= classify(name) %>Module } from './<%= dasherize(name) %>.module';
|
|
2
|
-
|
|
3
|
-
describe('<%= classify(name) %>Module', () => {
|
|
4
|
-
let <%= camelize(name) %>Module: <%= classify(name) %>Module;
|
|
5
|
-
|
|
6
|
-
beforeEach(() => {
|
|
7
|
-
<%= camelize(name) %>Module = new <%= classify(name) %>Module();
|
|
8
|
-
});
|
|
9
|
-
|
|
10
|
-
it('should create an instance', () => {
|
|
11
|
-
expect(<%= camelize(name) %>Module).toBeTruthy();
|
|
12
|
-
});
|
|
13
|
-
});
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { NgModule } from '@angular/core';
|
|
2
|
-
import { CommonModule } from '@angular/common';
|
|
3
|
-
import { EffectsModule } from '@ngrx/effects';
|
|
4
|
-
import { SharedModule } from '../shared/shared.module';
|
|
5
|
-
import { <%= classify(name) %>RoutingModule } from './<%= dasherize(name) %>-routing.module';
|
|
6
|
-
|
|
7
|
-
// Containers
|
|
8
|
-
|
|
9
|
-
// Components
|
|
10
|
-
|
|
11
|
-
@NgModule({
|
|
12
|
-
imports: [
|
|
13
|
-
CommonModule,
|
|
14
|
-
SharedModule,
|
|
15
|
-
<%= classify(name) %>RoutingModule,
|
|
16
|
-
EffectsModule.forFeature([
|
|
17
|
-
]),
|
|
18
|
-
],
|
|
19
|
-
declarations: [
|
|
20
|
-
// Containers
|
|
21
|
-
// Components
|
|
22
|
-
],
|
|
23
|
-
})
|
|
24
|
-
export class <%= classify(name) %>Module { }
|
package/src/module/index.d.ts
DELETED
package/src/module/index.js
DELETED
|
@@ -1,97 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.module = void 0;
|
|
13
|
-
const schematics_1 = require("@angular-devkit/schematics");
|
|
14
|
-
const change_1 = require("@schematics/angular/utility/change");
|
|
15
|
-
const find_module_1 = require("@schematics/angular/utility/find-module");
|
|
16
|
-
const parse_name_1 = require("@schematics/angular/utility/parse-name");
|
|
17
|
-
const workspace_1 = require("@schematics/angular/utility/workspace");
|
|
18
|
-
const core_1 = require("@angular-devkit/core");
|
|
19
|
-
const statements_adder_1 = require("../shared/statements-adder");
|
|
20
|
-
function addInserts(options) {
|
|
21
|
-
return (host, context) => {
|
|
22
|
-
const classifiedName = core_1.strings.classify(options.name);
|
|
23
|
-
const dasherizedName = core_1.strings.dasherize(options.name);
|
|
24
|
-
const modulePath = '//src/app/' +
|
|
25
|
-
core_1.strings.dasherize(options.name) + '/' +
|
|
26
|
-
core_1.strings.dasherize(options.name) + '.module';
|
|
27
|
-
context.logger.info(`modulePath: ${modulePath}`);
|
|
28
|
-
if (!options.lazyLoading) {
|
|
29
|
-
// Add app module changes if not lazy loaded
|
|
30
|
-
const appModulePath = '//src/app/app.module.ts';
|
|
31
|
-
const appModuleText = (0, statements_adder_1.getSourceText)(host, appModulePath);
|
|
32
|
-
context.logger.info(`appModulePath: ${appModulePath}`);
|
|
33
|
-
const appModuleToModulePath = (0, find_module_1.buildRelativePath)(appModulePath, modulePath);
|
|
34
|
-
let insertChanges = (0, statements_adder_1.simpleInsert)(appModuleText, appModulePath, [
|
|
35
|
-
'// Feature Modules',
|
|
36
|
-
'// Feature Modules'
|
|
37
|
-
], [
|
|
38
|
-
`import { ${classifiedName}Module } from '${appModuleToModulePath}';`,
|
|
39
|
-
` ${classifiedName}Module,`
|
|
40
|
-
]);
|
|
41
|
-
const declarationRecorder = host.beginUpdate(appModulePath);
|
|
42
|
-
for (const change of insertChanges) {
|
|
43
|
-
if (change instanceof change_1.InsertChange) {
|
|
44
|
-
declarationRecorder.insertLeft(change.pos, change.toAdd);
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
host.commitUpdate(declarationRecorder);
|
|
48
|
-
}
|
|
49
|
-
else {
|
|
50
|
-
// Add app-routing module changes if lazy loaded
|
|
51
|
-
const appRoutingModulePath = '//src/app/app-routing.module.ts';
|
|
52
|
-
const appRoutingModuleText = (0, statements_adder_1.getSourceText)(host, appRoutingModulePath);
|
|
53
|
-
const appRoutingModuleToModulePath = (0, find_module_1.buildRelativePath)(appRoutingModulePath, modulePath);
|
|
54
|
-
context.logger.info(`appRoutingModuleToModulePath: ${appRoutingModuleToModulePath}`);
|
|
55
|
-
let insertChanges = (0, statements_adder_1.simpleInsert)(appRoutingModuleText, appRoutingModulePath, [
|
|
56
|
-
'const appRoutes: Routes = ['
|
|
57
|
-
], [
|
|
58
|
-
` { path: '${dasherizedName}', loadChildren: () => import('${appRoutingModuleToModulePath}').then((mod) => mod.${classifiedName}Module) },`
|
|
59
|
-
]);
|
|
60
|
-
context.logger.info(`insertChanges: ${insertChanges}`);
|
|
61
|
-
const declarationRecorder = host.beginUpdate(appRoutingModulePath);
|
|
62
|
-
for (const change of insertChanges) {
|
|
63
|
-
if (change instanceof change_1.InsertChange) {
|
|
64
|
-
declarationRecorder.insertLeft(change.pos, change.toAdd);
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
host.commitUpdate(declarationRecorder);
|
|
68
|
-
}
|
|
69
|
-
return host;
|
|
70
|
-
};
|
|
71
|
-
}
|
|
72
|
-
function module(options) {
|
|
73
|
-
return (tree, context) => __awaiter(this, void 0, void 0, function* () {
|
|
74
|
-
context.logger.info("Starting module generation");
|
|
75
|
-
const workspace = yield (0, workspace_1.getWorkspace)(tree);
|
|
76
|
-
const project = workspace.projects.get(options.project);
|
|
77
|
-
if (!project) {
|
|
78
|
-
throw new schematics_1.SchematicsException(`Project "${options.project}" does not exist.`);
|
|
79
|
-
}
|
|
80
|
-
if (options.path === undefined) {
|
|
81
|
-
options.path = (0, workspace_1.buildDefaultPath)(project);
|
|
82
|
-
}
|
|
83
|
-
const parsedPath = (0, parse_name_1.parseName)(options.path, options.name);
|
|
84
|
-
options.name = parsedPath.name;
|
|
85
|
-
options.path = parsedPath.path;
|
|
86
|
-
const templateSource = (0, schematics_1.apply)((0, schematics_1.url)('./files'), [
|
|
87
|
-
(0, schematics_1.applyTemplates)(Object.assign(Object.assign({}, core_1.strings), options)),
|
|
88
|
-
(0, schematics_1.move)(parsedPath.path),
|
|
89
|
-
]);
|
|
90
|
-
return (0, schematics_1.chain)([
|
|
91
|
-
addInserts(options),
|
|
92
|
-
(0, schematics_1.mergeWith)(templateSource)
|
|
93
|
-
]);
|
|
94
|
-
});
|
|
95
|
-
}
|
|
96
|
-
exports.module = module;
|
|
97
|
-
//# sourceMappingURL=index.js.map
|
package/src/module/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"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"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/src/module/index_spec.js
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
const schematics_1 = require("@angular-devkit/schematics");
|
|
13
|
-
const testing_1 = require("@angular-devkit/schematics/testing");
|
|
14
|
-
const path = require("path");
|
|
15
|
-
const collectionPath = path.join(__dirname, '../collection.json');
|
|
16
|
-
describe('module', () => {
|
|
17
|
-
it('works', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
18
|
-
const runner = new testing_1.SchematicTestRunner('schematics', collectionPath);
|
|
19
|
-
const tree = yield runner.runSchematic('module', {}, schematics_1.Tree.empty());
|
|
20
|
-
expect(tree.files).toEqual([]);
|
|
21
|
-
}));
|
|
22
|
-
});
|
|
23
|
-
//# sourceMappingURL=index_spec.js.map
|