@authing/ng-ui-components 4.3.1 → 4.3.8

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/karma.conf.js ADDED
@@ -0,0 +1,32 @@
1
+ // Karma configuration file, see link for more information
2
+ // https://karma-runner.github.io/1.0/config/configuration-file.html
3
+
4
+ module.exports = function (config) {
5
+ config.set({
6
+ basePath: '',
7
+ frameworks: ['jasmine', '@angular-devkit/build-angular'],
8
+ plugins: [
9
+ require('karma-jasmine'),
10
+ require('karma-chrome-launcher'),
11
+ require('karma-jasmine-html-reporter'),
12
+ require('karma-coverage-istanbul-reporter'),
13
+ require('@angular-devkit/build-angular/plugins/karma'),
14
+ ],
15
+ client: {
16
+ clearContext: false, // leave Jasmine Spec Runner output visible in browser
17
+ },
18
+ coverageIstanbulReporter: {
19
+ dir: require('path').join(__dirname, '../../coverage/ng-ui-components'),
20
+ reports: ['html', 'lcovonly', 'text-summary'],
21
+ fixWebpackSourcePaths: true,
22
+ },
23
+ reporters: ['progress', 'kjhtml'],
24
+ port: 9876,
25
+ colors: true,
26
+ logLevel: config.LOG_INFO,
27
+ autoWatch: true,
28
+ browsers: ['Chrome'],
29
+ singleRun: false,
30
+ restartOnFileChange: true,
31
+ })
32
+ }
@@ -0,0 +1,8 @@
1
+ {
2
+ "$schema": "../../node_modules/ng-packagr/ng-package.schema.json",
3
+ "dest": "../../dist/ng-ui-components",
4
+ "lib": {
5
+ "entryFile": "src/public-api.ts"
6
+ },
7
+ "whitelistedNonPeerDependencies": ["@authing/native-js-ui-components"]
8
+ }
package/package.json CHANGED
@@ -1,26 +1,19 @@
1
1
  {
2
2
  "name": "@authing/ng-ui-components",
3
- "version": "4.3.1",
4
- "main": "bundles/authing-ng-ui-components.umd.js",
3
+ "version": "4.3.8",
4
+ "main": "src/public-api.ts",
5
5
  "types": "./authing-ng-ui-components.d.ts",
6
6
  "peerDependencies": {
7
7
  "@angular/common": ">=10.2.0",
8
8
  "@angular/core": ">=10.2.0"
9
9
  },
10
10
  "dependencies": {
11
- "@authing/native-js-ui-components": "^4.3.1",
11
+ "@authing/native-js-ui-components": "4.3.8",
12
12
  "tslib": "^2.0.0"
13
13
  },
14
14
  "publishConfig": {
15
15
  "access": "public",
16
16
  "directory": "../../dist/ng-ui-components",
17
17
  "registry": "https://registry.npmjs.org"
18
- },
19
- "module": "fesm2015/authing-ng-ui-components.js",
20
- "es2015": "fesm2015/authing-ng-ui-components.js",
21
- "esm2015": "esm2015/authing-ng-ui-components.js",
22
- "fesm2015": "fesm2015/authing-ng-ui-components.js",
23
- "typings": "authing-ng-ui-components.d.ts",
24
- "metadata": "authing-ng-ui-components.metadata.json",
25
- "sideEffects": false
18
+ }
26
19
  }
@@ -0,0 +1 @@
1
+ @import "~@authing/native-js-ui-components/lib/index.min";
@@ -0,0 +1,24 @@
1
+ import { ComponentFixture, TestBed } from '@angular/core/testing';
2
+
3
+ import { GuardComponent } from './guard.component';
4
+
5
+ describe('GuardComponent', () => {
6
+ let component: GuardComponent;
7
+ let fixture: ComponentFixture<GuardComponent>;
8
+
9
+ beforeEach(async () => {
10
+ await TestBed.configureTestingModule({
11
+ declarations: [GuardComponent],
12
+ }).compileComponents();
13
+ });
14
+
15
+ beforeEach(() => {
16
+ fixture = TestBed.createComponent(GuardComponent);
17
+ component = fixture.componentInstance;
18
+ fixture.detectChanges();
19
+ });
20
+
21
+ it('should create', () => {
22
+ expect(component).toBeTruthy();
23
+ });
24
+ });
@@ -0,0 +1,115 @@
1
+ import {
2
+ OnInit,
3
+ Output,
4
+ Component,
5
+ EventEmitter,
6
+ ViewEncapsulation,
7
+ Input,
8
+ OnChanges,
9
+ } from '@angular/core';
10
+
11
+ import {
12
+ AuthenticationClient,
13
+ Guard as NativeGuard,
14
+ GuardEvents,
15
+ GuardLocalConfig,
16
+ } from '@authing/native-js-ui-components';
17
+
18
+ @Component({
19
+ selector: 'guard',
20
+ template: `<div id="guard_container"></div>`,
21
+ styles: [],
22
+ styleUrls: ['./guard.component.scss'],
23
+ encapsulation: ViewEncapsulation.None,
24
+ })
25
+ export class GuardComponent implements OnInit, OnChanges {
26
+ constructor() {}
27
+
28
+ @Input() guard!: NativeGuard;
29
+ @Input() appId?: string;
30
+ @Input() visible?: boolean;
31
+ @Input() tenantId?: string;
32
+ @Input() authClient?: AuthenticationClient;
33
+ @Input() config?: Partial<GuardLocalConfig>;
34
+
35
+ @Output() onLoad = new EventEmitter<
36
+ Parameters<Required<GuardEvents>['onLoad']>
37
+ >();
38
+ @Output() onLoadError = new EventEmitter<
39
+ Parameters<Required<GuardEvents>['onLoadError']>
40
+ >();
41
+ @Output() onLogin = new EventEmitter<
42
+ Parameters<Required<GuardEvents>['onLogin']>
43
+ >();
44
+ @Output() onLoginError = new EventEmitter<
45
+ Parameters<Required<GuardEvents>['onLoginError']>
46
+ >();
47
+ @Output() onRegister = new EventEmitter<
48
+ Parameters<Required<GuardEvents>['onRegister']>
49
+ >();
50
+ @Output() onRegisterError = new EventEmitter<
51
+ Parameters<Required<GuardEvents>['onRegisterError']>
52
+ >();
53
+ @Output() onEmailSend = new EventEmitter<
54
+ Parameters<Required<GuardEvents>['onEmailSend']>
55
+ >();
56
+ @Output() onEmailSendError = new EventEmitter<
57
+ Parameters<Required<GuardEvents>['onEmailSendError']>
58
+ >();
59
+ @Output() onPhoneSend = new EventEmitter<
60
+ Parameters<Required<GuardEvents>['onPhoneSend']>
61
+ >();
62
+ @Output() onPhoneSendError = new EventEmitter<
63
+ Parameters<Required<GuardEvents>['onPhoneSendError']>
64
+ >();
65
+ @Output() onPwdReset = new EventEmitter<
66
+ Parameters<Required<GuardEvents>['onPwdReset']>
67
+ >();
68
+ @Output() onPwdResetError = new EventEmitter<
69
+ Parameters<Required<GuardEvents>['onPwdResetError']>
70
+ >();
71
+ @Output() onClose = new EventEmitter<
72
+ Parameters<Required<GuardEvents>['onClose']>
73
+ >();
74
+
75
+ @Output() onLangChange = new EventEmitter<
76
+ Parameters<Required<GuardEvents>['onLangChange']>
77
+ >();
78
+ ngAfterViewInit() {
79
+ // @ts-ignore
80
+
81
+ this.guard = new NativeGuard({
82
+ appId: this.appId,
83
+ config: this.config,
84
+ tenantId: this.tenantId,
85
+ authClient: this.authClient,
86
+ });
87
+
88
+ this.guard.on('load', (...rest) => this.onLoad.emit(rest));
89
+ this.guard.on('load-error', (...rest) => this.onLoadError.emit(rest));
90
+ this.guard.on('login', (...rest) => this.onLogin.emit(rest));
91
+ this.guard.on('login-error', (...rest) => this.onLoginError.emit(rest));
92
+ this.guard.on('register', (...rest) => this.onRegister.emit(rest));
93
+ this.guard.on('register-error', (...rest) =>
94
+ this.onRegisterError.emit(rest)
95
+ );
96
+ this.guard.on('close', (...rest) => this.onClose.emit(rest));
97
+ this.guard.on('lang-change', (...rest) => this.onLangChange.emit(rest));
98
+
99
+ if (this.visible === true) {
100
+ this.guard.show();
101
+ }
102
+ }
103
+
104
+ ngOnInit(): void {}
105
+
106
+ ngOnChanges() {
107
+ if (this.visible !== undefined && this.guard) {
108
+ if (this.visible) {
109
+ this.guard?.show();
110
+ } else {
111
+ this.guard?.hide();
112
+ }
113
+ }
114
+ }
115
+ }
@@ -0,0 +1,11 @@
1
+ import { NgModule } from '@angular/core';
2
+ import { GuardComponent } from './guard.component';
3
+
4
+ @NgModule({
5
+ declarations: [GuardComponent],
6
+ imports: [],
7
+ exports: [GuardComponent],
8
+ })
9
+ export class GuardModule {
10
+ constructor() {}
11
+ }
@@ -0,0 +1,16 @@
1
+ import { TestBed } from '@angular/core/testing';
2
+
3
+ import { GuardService } from './guard.service';
4
+
5
+ describe('GuardService', () => {
6
+ let service: GuardService;
7
+
8
+ beforeEach(() => {
9
+ TestBed.configureTestingModule({});
10
+ service = TestBed.inject(GuardService);
11
+ });
12
+
13
+ it('should be created', () => {
14
+ expect(service).toBeTruthy();
15
+ });
16
+ });
@@ -0,0 +1,8 @@
1
+ import { Injectable } from '@angular/core';
2
+
3
+ @Injectable({
4
+ providedIn: 'root',
5
+ })
6
+ export class GuardService {
7
+ constructor() {}
8
+ }
@@ -1,6 +1,21 @@
1
- import { User, GuardMode, GuardModuleType, LoginMethods, CommonMessage, RegisterMethods, AuthenticationClient } from '@authing/native-js-ui-components';
1
+ /*
2
+ * Public API Surface of authing-guard
3
+ */
4
+
5
+ import {
6
+ User,
7
+ GuardMode,
8
+ GuardModuleType,
9
+ LoginMethods,
10
+ CommonMessage,
11
+ RegisterMethods,
12
+ AuthenticationClient,
13
+ } from '@authing/native-js-ui-components';
14
+
2
15
  export * from './lib/Guard/guard.service';
3
16
  export * from './lib/Guard/guard.component';
4
17
  export * from './lib/Guard/guard.module';
18
+
5
19
  export type { CommonMessage, AuthenticationClient, User };
20
+
6
21
  export { GuardMode, GuardModuleType, LoginMethods, RegisterMethods };
package/src/test.ts ADDED
@@ -0,0 +1,26 @@
1
+ // This file is required by karma.conf.js and loads recursively all the .spec and framework files
2
+
3
+ import 'zone.js/dist/zone';
4
+ import 'zone.js/dist/zone-testing';
5
+ import { getTestBed } from '@angular/core/testing';
6
+ import {
7
+ BrowserDynamicTestingModule,
8
+ platformBrowserDynamicTesting
9
+ } from '@angular/platform-browser-dynamic/testing';
10
+
11
+ declare const require: {
12
+ context(path: string, deep?: boolean, filter?: RegExp): {
13
+ keys(): string[];
14
+ <T>(id: string): T;
15
+ };
16
+ };
17
+
18
+ // First, initialize the Angular testing environment.
19
+ getTestBed().initTestEnvironment(
20
+ BrowserDynamicTestingModule,
21
+ platformBrowserDynamicTesting()
22
+ );
23
+ // Then we find all the tests.
24
+ const context = require.context('./', true, /\.spec\.ts$/);
25
+ // And load the modules.
26
+ context.keys().map(context);
@@ -0,0 +1,25 @@
1
+ /* To learn more about this file see: https://angular.io/config/tsconfig. */
2
+ {
3
+ "extends": "../../tsconfig.json",
4
+ "compilerOptions": {
5
+ "outDir": "../../out-tsc/lib",
6
+ "target": "es2015",
7
+ "declaration": true,
8
+ "declarationMap": true,
9
+ "inlineSources": true,
10
+ "types": [],
11
+ "lib": [
12
+ "dom",
13
+ "es2018"
14
+ ]
15
+ },
16
+ "angularCompilerOptions": {
17
+ "skipTemplateCodegen": true,
18
+ "strictMetadataEmit": true,
19
+ "enableResourceInlining": true
20
+ },
21
+ "exclude": [
22
+ "src/test.ts",
23
+ "**/*.spec.ts"
24
+ ]
25
+ }
@@ -0,0 +1,10 @@
1
+ /* To learn more about this file see: https://angular.io/config/tsconfig. */
2
+ {
3
+ "extends": "./tsconfig.lib.json",
4
+ "compilerOptions": {
5
+ "declarationMap": false
6
+ },
7
+ "angularCompilerOptions": {
8
+ "enableIvy": false
9
+ }
10
+ }
@@ -0,0 +1,17 @@
1
+ /* To learn more about this file see: https://angular.io/config/tsconfig. */
2
+ {
3
+ "extends": "../../tsconfig.json",
4
+ "compilerOptions": {
5
+ "outDir": "../../out-tsc/spec",
6
+ "types": [
7
+ "jasmine"
8
+ ]
9
+ },
10
+ "files": [
11
+ "src/test.ts"
12
+ ],
13
+ "include": [
14
+ "**/*.spec.ts",
15
+ "**/*.d.ts"
16
+ ]
17
+ }
package/tslint.json ADDED
@@ -0,0 +1,17 @@
1
+ {
2
+ "extends": "../../tslint.json",
3
+ "rules": {
4
+ "directive-selector": [
5
+ true,
6
+ "attribute",
7
+ "lib",
8
+ "camelCase"
9
+ ],
10
+ "component-selector": [
11
+ true,
12
+ "element",
13
+ "lib",
14
+ "kebab-case"
15
+ ]
16
+ }
17
+ }
package/LICENSE DELETED
@@ -1,21 +0,0 @@
1
- MIT License
2
-
3
- Copyright (c) 2019-present Authing
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
@@ -1,4 +0,0 @@
1
- /**
2
- * Generated bundle index. Do not edit.
3
- */
4
- export * from './public-api';