@ofidj/generator-fidj 1.0.0 → 1.0.3

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 (161) hide show
  1. package/README.md +136 -57
  2. package/bin/create-fidj.cjs +62 -0
  3. package/generators/app/index.js +100 -189
  4. package/generators/app/templates/typescript/README.md +82 -0
  5. package/generators/app/templates/typescript/app.config.json +14 -0
  6. package/generators/app/templates/typescript/gitignore +5 -0
  7. package/generators/app/templates/typescript/package.json +25 -0
  8. package/generators/app/templates/typescript/public/fidj-logo.png +0 -0
  9. package/generators/app/templates/typescript/public/fonts/IBMPlexMono-400-latin-ext.woff2 +0 -0
  10. package/generators/app/templates/typescript/public/fonts/IBMPlexMono-400-latin.woff2 +0 -0
  11. package/generators/app/templates/typescript/public/fonts/IBMPlexMono-500-latin-ext.woff2 +0 -0
  12. package/generators/app/templates/typescript/public/fonts/IBMPlexMono-500-latin.woff2 +0 -0
  13. package/generators/app/templates/typescript/public/fonts/IBMPlexSans-400_600-latin-ext.woff2 +0 -0
  14. package/generators/app/templates/typescript/public/fonts/IBMPlexSans-400_600-latin.woff2 +0 -0
  15. package/generators/app/templates/typescript/public/fonts/InstrumentSerif-400-latin-ext.woff2 +0 -0
  16. package/generators/app/templates/typescript/public/fonts/InstrumentSerif-400-latin.woff2 +0 -0
  17. package/generators/app/templates/typescript/public/index.html +16 -0
  18. package/generators/app/templates/typescript/scripts/build.mjs +49 -0
  19. package/generators/app/templates/typescript/scripts/privacy-check.mjs +21 -0
  20. package/generators/app/templates/typescript/scripts/render-content.mjs +14 -0
  21. package/generators/app/templates/typescript/server/data-store.ts +123 -0
  22. package/generators/app/templates/typescript/server/index.ts +338 -0
  23. package/generators/app/templates/typescript/server/privacy-adapter.ts +21 -0
  24. package/generators/app/templates/typescript/src/content.ts +491 -0
  25. package/generators/app/templates/typescript/src/fonts.css +92 -0
  26. package/generators/app/templates/typescript/src/main.ts +251 -0
  27. package/generators/app/templates/typescript/src/service-agreement.ts +40 -0
  28. package/generators/app/templates/typescript/src/style.css +916 -0
  29. package/generators/app/templates/typescript/src/tokens.css +56 -0
  30. package/generators/app/templates/typescript/test/server.test.mjs +287 -0
  31. package/generators/app/templates/typescript/tsconfig.json +15 -0
  32. package/lib/app-module.cjs +64 -0
  33. package/lib/scaffold.cjs +214 -0
  34. package/package.json +15 -13
  35. package/generators/app/templates/app2018/.travis.yml +0 -35
  36. package/generators/app/templates/app2018/LICENSE +0 -21
  37. package/generators/app/templates/app2018/Procfile +0 -1
  38. package/generators/app/templates/app2018/README.md +0 -49
  39. package/generators/app/templates/app2018/config.xml +0 -91
  40. package/generators/app/templates/app2018/gulpfile.js +0 -63
  41. package/generators/app/templates/app2018/ionic.config.json +0 -9
  42. package/generators/app/templates/app2018/package.json +0 -90
  43. package/generators/app/templates/app2018/platforms/README.md +0 -1
  44. package/generators/app/templates/app2018/resources/README.md +0 -6
  45. package/generators/app/templates/app2018/resources/icon.png +0 -0
  46. package/generators/app/templates/app2018/resources/marketing-01-ipad.png +0 -0
  47. package/generators/app/templates/app2018/resources/marketing-01-iphone.png +0 -0
  48. package/generators/app/templates/app2018/resources/marketing-02-ipad.png +0 -0
  49. package/generators/app/templates/app2018/resources/marketing-02-iphone.png +0 -0
  50. package/generators/app/templates/app2018/resources/marketing-03-ipad.png +0 -0
  51. package/generators/app/templates/app2018/resources/marketing-03-iphone.png +0 -0
  52. package/generators/app/templates/app2018/resources/marketing.json +0 -19
  53. package/generators/app/templates/app2018/resources/splash.png +0 -0
  54. package/generators/app/templates/app2018/src/app/app.component.ts +0 -88
  55. package/generators/app/templates/app2018/src/app/app.html +0 -19
  56. package/generators/app/templates/app2018/src/app/app.module.ts +0 -40
  57. package/generators/app/templates/app2018/src/app/app.scss +0 -16
  58. package/generators/app/templates/app2018/src/app/main.ts +0 -5
  59. package/generators/app/templates/app2018/src/app/shared/card.model.ts +0 -10
  60. package/generators/app/templates/app2018/src/app/shared/profile.service.ts +0 -46
  61. package/generators/app/templates/app2018/src/app/shared/shared.module.ts +0 -35
  62. package/generators/app/templates/app2018/src/app/shared/storage.service.ts +0 -11
  63. package/generators/app/templates/app2018/src/app/shared/version.const.ts +0 -5
  64. package/generators/app/templates/app2018/src/assets/icon/favicon.ico +0 -0
  65. package/generators/app/templates/app2018/src/assets/imgs/gg.png +0 -0
  66. package/generators/app/templates/app2018/src/assets/imgs/github.png +0 -0
  67. package/generators/app/templates/app2018/src/assets/imgs/login.svg +0 -5668
  68. package/generators/app/templates/app2018/src/assets/imgs/logo.png +0 -0
  69. package/generators/app/templates/app2018/src/index.html +0 -49
  70. package/generators/app/templates/app2018/src/manifest.json +0 -13
  71. package/generators/app/templates/app2018/src/pages/home/home.html +0 -56
  72. package/generators/app/templates/app2018/src/pages/home/home.scss +0 -3
  73. package/generators/app/templates/app2018/src/pages/home/home.ts +0 -126
  74. package/generators/app/templates/app2018/src/pages/login/login.html +0 -56
  75. package/generators/app/templates/app2018/src/pages/login/login.scss +0 -44
  76. package/generators/app/templates/app2018/src/pages/login/login.ts +0 -59
  77. package/generators/app/templates/app2018/src/pages/profile/profile.html +0 -33
  78. package/generators/app/templates/app2018/src/pages/profile/profile.scss +0 -3
  79. package/generators/app/templates/app2018/src/pages/profile/profile.ts +0 -36
  80. package/generators/app/templates/app2018/src/service-worker.js +0 -31
  81. package/generators/app/templates/app2018/src/theme/variables.scss +0 -88
  82. package/generators/app/templates/app2018/tests/karma.unit-tests.conf.js +0 -84
  83. package/generators/app/templates/app2018/tests/unit/app.test.js +0 -10
  84. package/generators/app/templates/app2018/tsconfig.json +0 -28
  85. package/generators/app/templates/app2018/tslint.json +0 -8
  86. package/generators/app/templates/app2018/web.js +0 -21
  87. package/generators/app/templates/app2021/.travis.yml +0 -32
  88. package/generators/app/templates/app2021/LICENSE +0 -21
  89. package/generators/app/templates/app2021/Procfile +0 -1
  90. package/generators/app/templates/app2021/README.md +0 -45
  91. package/generators/app/templates/app2021/angular.json +0 -188
  92. package/generators/app/templates/app2021/browserslist +0 -12
  93. package/generators/app/templates/app2021/ionic.config.json +0 -9
  94. package/generators/app/templates/app2021/karma.conf.js +0 -31
  95. package/generators/app/templates/app2021/package-lock.json +0 -5
  96. package/generators/app/templates/app2021/package.json +0 -77
  97. package/generators/app/templates/app2021/platforms/README.md +0 -1
  98. package/generators/app/templates/app2021/resources/README.md +0 -6
  99. package/generators/app/templates/app2021/resources/icon.png +0 -0
  100. package/generators/app/templates/app2021/resources/marketing-01-ipad.png +0 -0
  101. package/generators/app/templates/app2021/resources/marketing-01-iphone.png +0 -0
  102. package/generators/app/templates/app2021/resources/marketing-02-ipad.png +0 -0
  103. package/generators/app/templates/app2021/resources/marketing-02-iphone.png +0 -0
  104. package/generators/app/templates/app2021/resources/marketing-03-ipad.png +0 -0
  105. package/generators/app/templates/app2021/resources/marketing-03-iphone.png +0 -0
  106. package/generators/app/templates/app2021/resources/marketing.json +0 -19
  107. package/generators/app/templates/app2021/resources/splash.png +0 -0
  108. package/generators/app/templates/app2021/src/app/app-routing.module.ts +0 -25
  109. package/generators/app/templates/app2021/src/app/app.component.html +0 -3
  110. package/generators/app/templates/app2021/src/app/app.component.scss +0 -0
  111. package/generators/app/templates/app2021/src/app/app.component.spec.ts +0 -50
  112. package/generators/app/templates/app2021/src/app/app.component.ts +0 -28
  113. package/generators/app/templates/app2021/src/app/app.module.ts +0 -24
  114. package/generators/app/templates/app2021/src/app/content/content-routing.module.ts +0 -16
  115. package/generators/app/templates/app2021/src/app/content/content.module.ts +0 -20
  116. package/generators/app/templates/app2021/src/app/content/content.page.html +0 -31
  117. package/generators/app/templates/app2021/src/app/content/content.page.scss +0 -0
  118. package/generators/app/templates/app2021/src/app/content/content.page.ts +0 -26
  119. package/generators/app/templates/app2021/src/app/explore-container/explore-container.component.html +0 -4
  120. package/generators/app/templates/app2021/src/app/explore-container/explore-container.component.scss +0 -4
  121. package/generators/app/templates/app2021/src/app/explore-container/explore-container.component.spec.ts +0 -24
  122. package/generators/app/templates/app2021/src/app/explore-container/explore-container.component.ts +0 -16
  123. package/generators/app/templates/app2021/src/app/explore-container/explore-container.module.ts +0 -14
  124. package/generators/app/templates/app2021/src/app/my/my-routing.module.ts +0 -36
  125. package/generators/app/templates/app2021/src/app/my/my.module.ts +0 -19
  126. package/generators/app/templates/app2021/src/app/my/my.page.html +0 -15
  127. package/generators/app/templates/app2021/src/app/my/my.page.scss +0 -1
  128. package/generators/app/templates/app2021/src/app/my/my.page.spec.ts +0 -26
  129. package/generators/app/templates/app2021/src/app/my/my.page.ts +0 -25
  130. package/generators/app/templates/app2021/src/app/profile/profile-routing.module.ts +0 -16
  131. package/generators/app/templates/app2021/src/app/profile/profile.module.ts +0 -20
  132. package/generators/app/templates/app2021/src/app/profile/profile.page.html +0 -49
  133. package/generators/app/templates/app2021/src/app/profile/profile.page.scss +0 -0
  134. package/generators/app/templates/app2021/src/app/profile/profile.page.spec.ts +0 -25
  135. package/generators/app/templates/app2021/src/app/profile/profile.page.ts +0 -44
  136. package/generators/app/templates/app2021/src/app/shared/const.ts +0 -3
  137. package/generators/app/templates/app2021/src/app/signin/signin-routing.module.ts +0 -16
  138. package/generators/app/templates/app2021/src/app/signin/signin.module.ts +0 -18
  139. package/generators/app/templates/app2021/src/app/signin/signin.page.html +0 -53
  140. package/generators/app/templates/app2021/src/app/signin/signin.page.scss +0 -36
  141. package/generators/app/templates/app2021/src/app/signin/signin.page.ts +0 -69
  142. package/generators/app/templates/app2021/src/assets/icon/favicon.png +0 -0
  143. package/generators/app/templates/app2021/src/assets/shapes.svg +0 -1
  144. package/generators/app/templates/app2021/src/environments/environment.prod.ts +0 -3
  145. package/generators/app/templates/app2021/src/environments/environment.ts +0 -16
  146. package/generators/app/templates/app2021/src/global.scss +0 -26
  147. package/generators/app/templates/app2021/src/index.html +0 -26
  148. package/generators/app/templates/app2021/src/main.ts +0 -12
  149. package/generators/app/templates/app2021/src/polyfills.ts +0 -67
  150. package/generators/app/templates/app2021/src/test.ts +0 -20
  151. package/generators/app/templates/app2021/src/theme/variables.scss +0 -232
  152. package/generators/app/templates/app2021/src/zone-flags.ts +0 -5
  153. package/generators/app/templates/app2021/tests/protractor.conf.js +0 -36
  154. package/generators/app/templates/app2021/tests/src/app.e2e-spec.ts +0 -14
  155. package/generators/app/templates/app2021/tests/src/app.po.ts +0 -11
  156. package/generators/app/templates/app2021/tests/tsconfig.json +0 -13
  157. package/generators/app/templates/app2021/tsconfig.app.json +0 -18
  158. package/generators/app/templates/app2021/tsconfig.json +0 -23
  159. package/generators/app/templates/app2021/tsconfig.spec.json +0 -18
  160. package/generators/app/templates/app2021/tslint.json +0 -149
  161. package/generators/app/templates/app2021/web.js +0 -21
@@ -1,50 +0,0 @@
1
- import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
2
- import { TestBed, async } from '@angular/core/testing';
3
-
4
- import { Platform } from '@ionic/angular';
5
- import { SplashScreen } from '@ionic-native/splash-screen/ngx';
6
- import { StatusBar } from '@ionic-native/status-bar/ngx';
7
-
8
- import { AppComponent } from './app.component';
9
-
10
- describe('AppComponent', () => {
11
-
12
- let statusBarSpy;
13
- let splashScreenSpy;
14
- let platformReadySpy;
15
- let platformSpy;
16
-
17
- beforeEach(async(() => {
18
- statusBarSpy = jasmine.createSpyObj('StatusBar', ['styleDefault']);
19
- splashScreenSpy = jasmine.createSpyObj('SplashScreen', ['hide']);
20
- platformReadySpy = Promise.resolve();
21
- platformSpy = jasmine.createSpyObj('Platform', { ready: platformReadySpy });
22
-
23
- TestBed.configureTestingModule({
24
- declarations: [AppComponent],
25
- schemas: [CUSTOM_ELEMENTS_SCHEMA],
26
- providers: [
27
- { provide: StatusBar, useValue: statusBarSpy },
28
- { provide: SplashScreen, useValue: splashScreenSpy },
29
- { provide: Platform, useValue: platformSpy },
30
- ],
31
- }).compileComponents();
32
- }));
33
-
34
- it('should create the app', () => {
35
- const fixture = TestBed.createComponent(AppComponent);
36
- const app = fixture.debugElement.componentInstance;
37
- expect(app).toBeTruthy();
38
- });
39
-
40
- it('should initialize the app', async () => {
41
- TestBed.createComponent(AppComponent);
42
- expect(platformSpy.ready).toHaveBeenCalled();
43
- await platformReadySpy;
44
- expect(statusBarSpy.styleDefault).toHaveBeenCalled();
45
- expect(splashScreenSpy.hide).toHaveBeenCalled();
46
- });
47
-
48
- // TODO: add more tests!
49
-
50
- });
@@ -1,28 +0,0 @@
1
- import {Component} from '@angular/core';
2
- import {Platform} from '@ionic/angular';
3
- import {SplashScreen} from '@ionic-native/splash-screen/ngx';
4
- import {StatusBar} from '@ionic-native/status-bar/ngx';
5
- import {FidjService} from 'fidj';
6
-
7
- @Component({
8
- selector: 'app-root',
9
- templateUrl: 'app.component.html',
10
- styleUrls: ['app.component.scss']
11
- })
12
- export class AppComponent {
13
- constructor(
14
- private platform: Platform,
15
- private splashScreen: SplashScreen,
16
- private statusBar: StatusBar,
17
- private fidjService: FidjService
18
- ) {
19
- this.initializeApp();
20
- }
21
-
22
- async initializeApp() {
23
- await this.platform.ready();
24
- await this.fidjService.init('<%= appId %>' <%= appOptions %>);
25
- this.statusBar.styleDefault();
26
- this.splashScreen.hide();
27
- }
28
- }
@@ -1,24 +0,0 @@
1
- import { NgModule } from '@angular/core';
2
- import { BrowserModule } from '@angular/platform-browser';
3
- import { RouteReuseStrategy } from '@angular/router';
4
-
5
- import { IonicModule, IonicRouteStrategy } from '@ionic/angular';
6
- import { SplashScreen } from '@ionic-native/splash-screen/ngx';
7
- import { StatusBar } from '@ionic-native/status-bar/ngx';
8
-
9
- import { AppRoutingModule } from './app-routing.module';
10
- import { AppComponent } from './app.component';
11
- import {FidjModule} from "fidj";
12
-
13
- @NgModule({
14
- declarations: [AppComponent],
15
- entryComponents: [],
16
- imports: [BrowserModule, IonicModule.forRoot(), AppRoutingModule, FidjModule],
17
- providers: [
18
- StatusBar,
19
- SplashScreen,
20
- { provide: RouteReuseStrategy, useClass: IonicRouteStrategy }
21
- ],
22
- bootstrap: [AppComponent]
23
- })
24
- export class AppModule {}
@@ -1,16 +0,0 @@
1
- import { NgModule } from '@angular/core';
2
- import { RouterModule, Routes } from '@angular/router';
3
- import { ContentPage } from './content.page';
4
-
5
- const routes: Routes = [
6
- {
7
- path: '',
8
- component: ContentPage,
9
- }
10
- ];
11
-
12
- @NgModule({
13
- imports: [RouterModule.forChild(routes)],
14
- exports: [RouterModule]
15
- })
16
- export class ContentPageRoutingModule {}
@@ -1,20 +0,0 @@
1
- import { IonicModule } from '@ionic/angular';
2
- import { NgModule } from '@angular/core';
3
- import { CommonModule } from '@angular/common';
4
- import { FormsModule } from '@angular/forms';
5
- import { ContentPage } from './content.page';
6
- import { ExploreContainerComponentModule } from '../explore-container/explore-container.module';
7
-
8
- import { ContentPageRoutingModule } from './content-routing.module';
9
-
10
- @NgModule({
11
- imports: [
12
- IonicModule,
13
- CommonModule,
14
- FormsModule,
15
- ExploreContainerComponentModule,
16
- ContentPageRoutingModule
17
- ],
18
- declarations: [ContentPage]
19
- })
20
- export class ContentPageModule {}
@@ -1,31 +0,0 @@
1
- <ion-header [translucent]="true">
2
- <ion-toolbar>
3
- <ion-title>
4
- <img src="assets/icon/favicon.png" height="15em"> Home
5
- </ion-title>
6
- </ion-toolbar>
7
- </ion-header>
8
-
9
- <ion-content [fullscreen]="true">
10
- <!-- Default Refresher -->
11
- <ion-refresher slot="fixed" (ionRefresh)="refresh($event)">
12
- <ion-refresher-content></ion-refresher-content>
13
- </ion-refresher>
14
-
15
- <ion-header collapse="condense">
16
- <ion-toolbar>
17
- <ion-title size="large">Home</ion-title>
18
- </ion-toolbar>
19
- </ion-header>
20
-
21
- <ion-grid>
22
- <ion-row>
23
- <ion-col size-md="8" offset-md="2" size-sm="12">
24
-
25
- <app-explore-container content="<%= appContent %>"></app-explore-container>
26
-
27
- </ion-col>
28
- </ion-row>
29
- </ion-grid>
30
-
31
- </ion-content>
@@ -1,26 +0,0 @@
1
- import {Component} from '@angular/core';
2
- import {Router} from '@angular/router';
3
- import {EndpointInterface, FidjService} from 'fidj';
4
-
5
- @Component({
6
- selector: 'app-content',
7
- templateUrl: 'content.page.html',
8
- styleUrls: ['content.page.scss']
9
- })
10
- export class ContentPage {
11
-
12
- constructor(
13
- private router: Router,
14
- private fidjService: FidjService) {
15
-
16
- this.refresh(null);
17
- }
18
-
19
- async refresh(event) {
20
-
21
- if (event) {
22
- event.target.complete();
23
- }
24
- }
25
-
26
- }
@@ -1,4 +0,0 @@
1
- <div id="container">
2
- <strong>{{ name }}</strong>
3
- <div [innerHtml]="content"></div>
4
- </div>
@@ -1,4 +0,0 @@
1
- #container {
2
- text-align: center;
3
- padding-top:100px;
4
- }
@@ -1,24 +0,0 @@
1
- import { async, ComponentFixture, TestBed } from '@angular/core/testing';
2
- import { IonicModule } from '@ionic/angular';
3
-
4
- import { ExploreContainerComponent } from './explore-container.component';
5
-
6
- describe('ExploreContainerComponent', () => {
7
- let component: ExploreContainerComponent;
8
- let fixture: ComponentFixture<ExploreContainerComponent>;
9
-
10
- beforeEach(async(() => {
11
- TestBed.configureTestingModule({
12
- declarations: [ ExploreContainerComponent ],
13
- imports: [IonicModule.forRoot()]
14
- }).compileComponents();
15
-
16
- fixture = TestBed.createComponent(ExploreContainerComponent);
17
- component = fixture.componentInstance;
18
- fixture.detectChanges();
19
- }));
20
-
21
- it('should create', () => {
22
- expect(component).toBeTruthy();
23
- });
24
- });
@@ -1,16 +0,0 @@
1
- import { Component, OnInit, Input } from '@angular/core';
2
-
3
- @Component({
4
- selector: 'app-explore-container',
5
- templateUrl: './explore-container.component.html',
6
- styleUrls: ['./explore-container.component.scss'],
7
- })
8
- export class ExploreContainerComponent implements OnInit {
9
- @Input() name: string;
10
- @Input() content: string;
11
-
12
- constructor() { }
13
-
14
- ngOnInit() {}
15
-
16
- }
@@ -1,14 +0,0 @@
1
- import { NgModule } from '@angular/core';
2
- import { CommonModule } from '@angular/common';
3
- import { FormsModule } from '@angular/forms';
4
-
5
- import { IonicModule } from '@ionic/angular';
6
-
7
- import { ExploreContainerComponent } from './explore-container.component';
8
-
9
- @NgModule({
10
- imports: [ CommonModule, FormsModule, IonicModule],
11
- declarations: [ExploreContainerComponent],
12
- exports: [ExploreContainerComponent]
13
- })
14
- export class ExploreContainerComponentModule {}
@@ -1,36 +0,0 @@
1
- import { NgModule } from '@angular/core';
2
- import { RouterModule, Routes } from '@angular/router';
3
- import { MyPage } from './my.page';
4
-
5
- const routes: Routes = [
6
- {
7
- path: '',
8
- component: MyPage,
9
- children: [
10
- {
11
- path: 'content',
12
- loadChildren: () => import('../content/content.module').then(m => m.ContentPageModule)
13
- },
14
- {
15
- path: 'profile',
16
- loadChildren: () => import('../profile/profile.module').then(m => m.ProfilePageModule)
17
- },
18
- {
19
- path: '',
20
- redirectTo: '/my/content',
21
- pathMatch: 'full'
22
- }
23
- ]
24
- },
25
- {
26
- path: '',
27
- redirectTo: '/my/content',
28
- pathMatch: 'full'
29
- }
30
- ];
31
-
32
- @NgModule({
33
- imports: [RouterModule.forChild(routes)],
34
- exports: [RouterModule]
35
- })
36
- export class MyPageRoutingModule {}
@@ -1,19 +0,0 @@
1
- import { IonicModule } from '@ionic/angular';
2
- import { NgModule } from '@angular/core';
3
- import { CommonModule } from '@angular/common';
4
- import { FormsModule } from '@angular/forms';
5
-
6
- import { MyPageRoutingModule } from './my-routing.module';
7
-
8
- import { MyPage } from './my.page';
9
-
10
- @NgModule({
11
- imports: [
12
- IonicModule,
13
- CommonModule,
14
- FormsModule,
15
- MyPageRoutingModule
16
- ],
17
- declarations: [MyPage]
18
- })
19
- export class MyPageModule {}
@@ -1,15 +0,0 @@
1
- <ion-tabs>
2
- <ion-tab-bar slot="bottom">
3
-
4
- <ion-tab-button tab="content">
5
- <ion-icon name="leaf-outline"></ion-icon>
6
- <ion-label>Content</ion-label>
7
- </ion-tab-button>
8
-
9
- <ion-tab-button tab="profile">
10
- <ion-icon name="person-circle-outline"></ion-icon>
11
- <ion-label>Profile</ion-label>
12
- </ion-tab-button>
13
-
14
- </ion-tab-bar>
15
- </ion-tabs>
@@ -1,26 +0,0 @@
1
- import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
2
- import { async, ComponentFixture, TestBed } from '@angular/core/testing';
3
-
4
- import { MyPage } from './my.page';
5
-
6
- describe('MyPage', () => {
7
- let component: MyPage;
8
- let fixture: ComponentFixture<MyPage>;
9
-
10
- beforeEach(async(() => {
11
- TestBed.configureTestingModule({
12
- declarations: [MyPage],
13
- schemas: [CUSTOM_ELEMENTS_SCHEMA],
14
- }).compileComponents();
15
- }));
16
-
17
- beforeEach(() => {
18
- fixture = TestBed.createComponent(MyPage);
19
- component = fixture.componentInstance;
20
- fixture.detectChanges();
21
- });
22
-
23
- it('should create', () => {
24
- expect(component).toBeTruthy();
25
- });
26
- });
@@ -1,25 +0,0 @@
1
- import { Component } from '@angular/core';
2
- import {Router} from '@angular/router';
3
- import { FidjService } from 'fidj';
4
-
5
- @Component({
6
- selector: 'app-my',
7
- templateUrl: 'my.page.html',
8
- styleUrls: ['my.page.scss']
9
- })
10
- export class MyPage {
11
-
12
- constructor(
13
- private router: Router,
14
- private fidjService: FidjService) {}
15
-
16
-
17
- ngOnInit() {
18
- if (this.fidjService.isLoggedIn()) {
19
- } else {
20
- console.log('not logged in');
21
- return this.router.navigateByUrl('/signin');
22
- }
23
- }
24
-
25
- }
@@ -1,16 +0,0 @@
1
- import { NgModule } from '@angular/core';
2
- import { RouterModule, Routes } from '@angular/router';
3
- import { ProfilePage } from './profile.page';
4
-
5
- const routes: Routes = [
6
- {
7
- path: '',
8
- component: ProfilePage,
9
- }
10
- ];
11
-
12
- @NgModule({
13
- imports: [RouterModule.forChild(routes)],
14
- exports: [RouterModule]
15
- })
16
- export class ProfilePageRoutingModule {}
@@ -1,20 +0,0 @@
1
- import { IonicModule } from '@ionic/angular';
2
- import { NgModule } from '@angular/core';
3
- import { CommonModule } from '@angular/common';
4
- import { FormsModule } from '@angular/forms';
5
- import { ProfilePage } from './profile.page';
6
- import { ExploreContainerComponentModule } from '../explore-container/explore-container.module';
7
-
8
- import { ProfilePageRoutingModule } from './profile-routing.module';
9
-
10
- @NgModule({
11
- imports: [
12
- IonicModule,
13
- CommonModule,
14
- FormsModule,
15
- ExploreContainerComponentModule,
16
- ProfilePageRoutingModule
17
- ],
18
- declarations: [ProfilePage]
19
- })
20
- export class ProfilePageModule {}
@@ -1,49 +0,0 @@
1
- <ion-header [translucent]="true">
2
- <ion-toolbar>
3
- <ion-title>
4
- <img src="assets/icon/favicon.png" height="15em"> My profile
5
- </ion-title>
6
- </ion-toolbar>
7
- </ion-header>
8
-
9
- <ion-content [fullscreen]="true">
10
- <!-- Default Refresher -->
11
- <ion-refresher slot="fixed" (ionRefresh)="refresh($event)">
12
- <ion-refresher-content></ion-refresher-content>
13
- </ion-refresher>
14
-
15
- <ion-header collapse="condense">
16
- <ion-toolbar>
17
- <ion-title size="large">Profile</ion-title>
18
- </ion-toolbar>
19
- </ion-header>
20
-
21
- <form #profileForm="ngForm">
22
- <ion-grid>
23
- <ion-row>
24
- <ion-col size-md="8" offset-md="2" size-sm="12">
25
- <ion-row>
26
- <ion-col>
27
- <ion-item>
28
- <ion-label>User</ion-label>
29
- <ion-input id="profileUsername"
30
- [(ngModel)]="profileUsername" name="profileUsername" disabled></ion-input>
31
- </ion-item>
32
- <ion-item>
33
- <pre><small>App is using <a href="https://fidj.ovh">Fidj service</a> that take care of GDPR concerns.</small></pre>
34
- </ion-item>
35
- </ion-col>
36
- </ion-row>
37
-
38
- <ion-row>
39
- <ion-col>
40
- <ion-button color="danger" expand="block" (click)="logout()">Logout</ion-button>
41
- </ion-col>
42
- </ion-row>
43
-
44
- </ion-col>
45
- </ion-row>
46
- </ion-grid>
47
- </form>
48
-
49
- </ion-content>
@@ -1,25 +0,0 @@
1
- import { async, ComponentFixture, TestBed } from '@angular/core/testing';
2
- import { IonicModule } from '@ionic/angular';
3
- import { ExploreContainerComponentModule } from '../explore-container/explore-container.module';
4
-
5
- import { ProfilePage } from './profile.page';
6
-
7
- describe('ProfilePage', () => {
8
- let component: ProfilePage;
9
- let fixture: ComponentFixture<ProfilePage>;
10
-
11
- beforeEach(async(() => {
12
- TestBed.configureTestingModule({
13
- declarations: [ProfilePage],
14
- imports: [IonicModule.forRoot(), ExploreContainerComponentModule]
15
- }).compileComponents();
16
-
17
- fixture = TestBed.createComponent(ProfilePage);
18
- component = fixture.componentInstance;
19
- fixture.detectChanges();
20
- }));
21
-
22
- it('should create', () => {
23
- expect(component).toBeTruthy();
24
- });
25
- });
@@ -1,44 +0,0 @@
1
- import {Component} from '@angular/core';
2
- import {Router} from '@angular/router';
3
- import {Base64, FidjService} from 'fidj';
4
-
5
- @Component({
6
- selector: 'app-profile',
7
- templateUrl: 'profile.page.html',
8
- styleUrls: ['profile.page.scss']
9
- })
10
- export class ProfilePage {
11
-
12
- public profileUsername: string;
13
-
14
- constructor(
15
- private router: Router,
16
- private fidjService: FidjService) {
17
- this.refresh(null);
18
- }
19
-
20
- async refresh(event) {
21
- try {
22
- const idToken = await this.fidjService.getIdToken();
23
- const payload = idToken.split('.')[1];
24
- const payloadInfo = JSON.parse(Base64.decode(payload));
25
- console.log(typeof payloadInfo, payloadInfo.name);
26
- this.profileUsername = payloadInfo.name;
27
- } catch (error) {
28
- console.warn(error);
29
- if (error.code === 401 || error.code === 403) {
30
- await this.logout();
31
- }
32
- }
33
-
34
- if (event) {
35
- event.target.complete();
36
- }
37
- }
38
-
39
- async logout() {
40
- await this.fidjService.logout();
41
- await this.router.navigateByUrl('/');
42
- }
43
-
44
- }
@@ -1,16 +0,0 @@
1
- import { NgModule } from '@angular/core';
2
- import { RouterModule, Routes } from '@angular/router';
3
- import { SigninPage } from './signin.page';
4
-
5
- const routes: Routes = [
6
- {
7
- path: '',
8
- component: SigninPage,
9
- },
10
- ];
11
-
12
- @NgModule({
13
- imports: [RouterModule.forChild(routes)],
14
- exports: [RouterModule]
15
- })
16
- export class SigninPageRoutingModule {}
@@ -1,18 +0,0 @@
1
- import {IonicModule} from '@ionic/angular';
2
- import {NgModule} from '@angular/core';
3
- import {CommonModule} from '@angular/common';
4
- import {FormsModule} from '@angular/forms';
5
- import {SigninPage} from './signin.page';
6
- import {SigninPageRoutingModule} from "./signin-routing.module";
7
-
8
- @NgModule({
9
- imports: [
10
- IonicModule,
11
- CommonModule,
12
- FormsModule,
13
- SigninPageRoutingModule
14
- ],
15
- declarations: [SigninPage]
16
- })
17
- export class SigninPageModule {
18
- }
@@ -1,53 +0,0 @@
1
- <ion-content>
2
- <ion-grid>
3
- <ion-row>
4
- <ion-col size-md="8" offset-md="2" size-sm="12">
5
- <ion-card>
6
- <ion-card-header>
7
- <h1><%= appName %> </h1>
8
- <p><%= appWelcome %></p>
9
- </ion-card-header>
10
- <ion-card-content>
11
- <form #heroForm="ngForm" (ngSubmit)="login(userLoginEmail, userLoginPassword)"
12
- (keyup.enter)="login(userLoginEmail, userLoginPassword)">
13
- <ion-item [hidden]="!loginError">
14
- <ion-label color="danger">{{loginError}}</ion-label>
15
- </ion-item>
16
- <ion-item>
17
- <ion-input
18
- id="userLoginEmail"
19
- type="text" placeholder="valid.email@required.com" required
20
- [(ngModel)]="userLoginEmail" name="userLoginEmail"
21
- pattern=".{1,}@[_a-z0-9A-Z]+(\.[a-z0-9A-Z]+)+"
22
- ></ion-input>
23
- </ion-item>
24
- <ion-item>
25
- <ion-input
26
- id="userLoginPassword"
27
- type="password" placeholder="password"
28
- [(ngModel)]="userLoginPassword" name="userLoginPassword"
29
- required></ion-input>
30
- </ion-item>
31
-
32
- <div style="padding-top:20px">
33
- <ion-button color="medium"
34
- id="userLoginButton"
35
- (click)="login(userLoginEmail, userLoginPassword)"
36
- [disabled]="!userLoginEmail || !heroForm.form.valid || !userLoginPassword">
37
- Login
38
- </ion-button>
39
- <ion-button color="medium" fill="clear"
40
- (click)="loginAsDemo()">
41
- Enter anonymously
42
- </ion-button>
43
- </div>
44
- </form>
45
- </ion-card-content>
46
- </ion-card>
47
- </ion-col>
48
- </ion-row>
49
- </ion-grid>
50
-
51
- <span style="float:right;font-size:10px;">version: <%= appVersion %></span>
52
-
53
- </ion-content>