@authing/vue-ui-components 3.0.27 → 3.0.30

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.
@@ -0,0 +1,8 @@
1
+ import AuthingGuard from './src/index.vue'
2
+ import '@authing/native-js-ui-components/lib/index.min.css'
3
+
4
+ AuthingGuard.install = (app) => {
5
+ app.component(AuthingGuard.name, AuthingGuard)
6
+ }
7
+
8
+ export default AuthingGuard
@@ -1,5 +1,5 @@
1
1
  <template>
2
- <div id="authing_guard_container"></div>
2
+ <div id="authing_guard_container" />
3
3
  </template>
4
4
 
5
5
  <script>
@@ -13,20 +13,8 @@ import {
13
13
  LoginMethods,
14
14
  RegisterMethods,
15
15
  } from "@authing/native-js-ui-components";
16
- import "@authing/native-js-ui-components/lib/index.min.css";
17
16
 
18
- export {
19
- getAuthClient,
20
- initAuthClient,
21
- GuardMode,
22
- GuardScenes,
23
- LoginMethods,
24
- RegisterMethods,
25
- };
26
-
27
- const format = (a, b) => {
28
- return !a || a === "false" ? b : true;
29
- };
17
+ export { getAuthClient, initAuthClient, GuardMode, GuardScenes, LoginMethods, RegisterMethods };
30
18
 
31
19
  const callbackEvent = ["before-login", "before-register"];
32
20
 
@@ -84,6 +72,7 @@ export default {
84
72
  return {
85
73
  localVisible: false,
86
74
  $guard: null,
75
+ guarConfig: {},
87
76
  };
88
77
  },
89
78
  watch: {
@@ -109,40 +98,40 @@ export default {
109
98
  },
110
99
  },
111
100
  },
101
+ computed: {
102
+ mergeConfig: function () {
103
+ return {
104
+ ...this.config,
105
+ appId: this.appId,
106
+ mode: this.mode ?? this.config?.mode,
107
+ autoRegister: this.autoRegister ?? this.config?.autoRegister,
108
+ isSSO: this.isSSO ?? this.config?.isSSO,
109
+ clickCloseable: this.clickCloseable ?? this.config?.clickCloseable,
110
+ escCloseable: this.escCloseable ?? this.config?.escCloseable,
111
+ };
112
+ },
113
+ },
112
114
  mounted() {
113
- this.config = this.config || {};
114
- this.config.mode = this.mode ? this.mode : this.config.mode;
115
- this.config.autoRegister = this.autoRegister
116
- ? this.autoRegister
117
- : this.config.autoRegister;
118
- this.config.isSSO = this.isSSO ? this.isSSO : this.config.isSSO;
119
- this.config.clickCloseable = this.clickCloseable
120
- ? this.clickCloseable
121
- : this.config.clickCloseable;
122
- this.config.escCloseable = this.escCloseable
123
- ? this.escCloseable
124
- : this.config.escCloseable;
115
+ // this.guarConfig = this.config || {};
116
+ // this.guarConfig.mode = this.mode ? this.mode : this.config.mode;
117
+ // this.guarConfig.autoRegister = this.autoRegister ? this.autoRegister : this.config.autoRegister;
118
+ // this.guarConfig.isSSO = this.isSSO ? this.isSSO : this.config.isSSO;
119
+ // this.guarConfig.clickCloseable = this.clickCloseable ? this.clickCloseable : this.config.clickCloseable;
120
+ // this.guarConfig.escCloseable = this.escCloseable ? this.escCloseable : this.config.escCloseable;
125
121
 
126
122
  // this.config.autoRegister = format(this.autoRegister, this.config.autoRegister)
127
123
  // this.config.isSSO = format(this.isSSO, this.config.isSSO)
128
124
  // this.config.clickCloseable = format(this.clickCloseable, this.config.clickCloseable)
129
125
  // this.config.escCloseable = format(this.escCloseable, this.config.escCloseable)
130
126
 
131
- const guard = new NativeAuthingGuard(
132
- this.appId,
133
- this.config,
134
- this.tenantId
135
- );
127
+ const guard = new NativeAuthingGuard(this.appId, this.mergeConfig, this.tenantId);
136
128
 
137
129
  const evts = Object.values(GuardEventsCamelToKebabMap);
138
- const kebabToCamelMap = Object.entries(GuardEventsCamelToKebabMap).reduce(
139
- (acc, [camel, kebab]) => {
140
- return Object.assign({}, acc, {
141
- [kebab]: camel,
142
- });
143
- },
144
- {}
145
- );
130
+ const kebabToCamelMap = Object.entries(GuardEventsCamelToKebabMap).reduce((acc, [camel, kebab]) => {
131
+ return Object.assign({}, acc, {
132
+ [kebab]: camel,
133
+ });
134
+ }, {});
146
135
 
147
136
  const listeners = evts.reduce((acc, evtName) => {
148
137
  return Object.assign({}, acc, {
@@ -0,0 +1,8 @@
1
+ import Guard from './src/index.vue'
2
+ import '@authing/native-js-ui-components/lib/index.min.css'
3
+
4
+ Guard.install = (app) => {
5
+ app.component(Guard.name, Guard)
6
+ }
7
+
8
+ export default Guard
@@ -1,5 +1,5 @@
1
1
  <template>
2
- <div id="authing_guard_container"></div>
2
+ <div id="authing_guard_container" />
3
3
  </template>
4
4
 
5
5
  <script>
@@ -17,10 +17,6 @@ import { Guard as NativeGuard } from "@authing/native-js-ui-components/lib/index
17
17
 
18
18
  export { getAuthClient, initAuthClient, GuardMode, GuardScenes, LoginMethods, RegisterMethods };
19
19
 
20
- const format = (a, b) => {
21
- return !a || a === "false" ? b : true;
22
- };
23
-
24
20
  const callbackEvent = ["before-login", "before-register"];
25
21
 
26
22
  export default {
@@ -73,6 +69,7 @@ export default {
73
69
  return {
74
70
  localVisible: false,
75
71
  $guard: null,
72
+ guarConfig: {},
76
73
  };
77
74
  },
78
75
  watch: {
@@ -98,20 +95,28 @@ export default {
98
95
  },
99
96
  },
100
97
  },
98
+ computed: {
99
+ mergeConfig: function () {
100
+ return {
101
+ ...this.config,
102
+ appId: this.appId,
103
+ mode: this.mode ?? this.config?.mode,
104
+ autoRegister: this.autoRegister ?? this.config?.autoRegister,
105
+ isSSO: this.isSSO ?? this.config?.isSSO,
106
+ clickCloseable: this.clickCloseable ?? this.config?.clickCloseable,
107
+ escCloseable: this.escCloseable ?? this.config?.escCloseable,
108
+ };
109
+ },
110
+ },
101
111
  mounted() {
102
- this.config = this.config || {};
103
- this.config.mode = this.mode ? this.mode : this.config.mode;
104
- this.config.autoRegister = this.autoRegister ? this.autoRegister : this.config.autoRegister;
105
- this.config.isSSO = this.isSSO ? this.isSSO : this.config.isSSO;
106
- this.config.clickCloseable = this.clickCloseable ? this.clickCloseable : this.config.clickCloseable;
107
- this.config.escCloseable = this.escCloseable ? this.escCloseable : this.config.escCloseable;
108
-
109
- // this.config.autoRegister = format(this.autoRegister, this.config.autoRegister)
110
- // this.config.isSSO = format(this.isSSO, this.config.isSSO)
111
- // this.config.clickCloseable = format(this.clickCloseable, this.config.clickCloseable)
112
- // this.config.escCloseable = format(this.escCloseable, this.config.escCloseable)
112
+ // this.guarConfig = this.config || {};
113
+ // this.guarConfig.mode = this.mode ? this.mode : this.config.mode;
114
+ // this.guarConfig.autoRegister = this.autoRegister ? this.autoRegister : this.config.autoRegister;
115
+ // this.guarConfig.isSSO = this.isSSO ? this.isSSO : this.config.isSSO;
116
+ // this.guarConfig.clickCloseable = this.clickCloseable ? this.clickCloseable : this.config.clickCloseable;
117
+ // this.guarConfig.escCloseable = this.escCloseable ? this.escCloseable : this.config.escCloseable;
113
118
 
114
- const guard = new NativeGuard(this.appId, this.config);
119
+ const guard = new NativeGuard(this.appId, this.mergeConfig);
115
120
 
116
121
  const evts = Object.values(GuardEventsCamelToKebabMap);
117
122
  const kebabToCamelMap = Object.entries(GuardEventsCamelToKebabMap).reduce((acc, [camel, kebab]) => {
@@ -0,0 +1,25 @@
1
+ import AuthingGuard from './AuthingGuard'
2
+ import Guard from './Guard'
3
+ import '@authing/native-js-ui-components/lib/index.min.css'
4
+
5
+ const components = [
6
+ AuthingGuard,
7
+ Guard
8
+ ]
9
+ // 全局注册
10
+ const install = (app) => {
11
+ components.forEach(component => {
12
+ app.component(component.name, component)
13
+ })
14
+ }
15
+
16
+ // 局部注册
17
+ export {
18
+ install,
19
+ Guard,
20
+ AuthingGuard
21
+ }
22
+
23
+ export default {
24
+ install
25
+ }