@authing/vue-ui-components 3.1.13 → 3.1.15
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/components/Guard/src/index.vue +34 -9
- package/lib/index.min.css +1 -1
- package/lib/index.min.js +18 -5
- package/package.json +4 -4
|
@@ -1,21 +1,28 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<div id="authing_guard_container"
|
|
2
|
+
<div id="authing_guard_container"></div>
|
|
3
3
|
</template>
|
|
4
4
|
|
|
5
5
|
<script>
|
|
6
6
|
import {
|
|
7
7
|
getAuthClient,
|
|
8
8
|
initAuthClient,
|
|
9
|
-
GuardEventsCamelToKebabMap,
|
|
10
9
|
GuardMode,
|
|
11
10
|
GuardScenes,
|
|
12
11
|
LoginMethods,
|
|
13
12
|
RegisterMethods,
|
|
13
|
+
Guard as NativeGuard,
|
|
14
|
+
GuardEventsCamelToKebabMapping,
|
|
14
15
|
} from "@authing/native-js-ui-components";
|
|
15
16
|
import "@authing/native-js-ui-components/lib/index.min.css";
|
|
16
|
-
import { Guard as NativeGuard } from "@authing/native-js-ui-components/lib/index.min.js";
|
|
17
17
|
|
|
18
|
-
export {
|
|
18
|
+
export {
|
|
19
|
+
getAuthClient,
|
|
20
|
+
initAuthClient,
|
|
21
|
+
GuardMode,
|
|
22
|
+
GuardScenes,
|
|
23
|
+
LoginMethods,
|
|
24
|
+
RegisterMethods,
|
|
25
|
+
};
|
|
19
26
|
|
|
20
27
|
const callbackEvent = ["before-login", "before-register"];
|
|
21
28
|
|
|
@@ -24,12 +31,21 @@ export default {
|
|
|
24
31
|
props: {
|
|
25
32
|
appId: {
|
|
26
33
|
type: String,
|
|
27
|
-
required:
|
|
34
|
+
required: false,
|
|
28
35
|
},
|
|
36
|
+
tenantId: {
|
|
37
|
+
type: String,
|
|
38
|
+
required: false,
|
|
39
|
+
},
|
|
40
|
+
|
|
29
41
|
config: {
|
|
30
42
|
type: Object,
|
|
31
43
|
required: false,
|
|
32
44
|
},
|
|
45
|
+
authClient: {
|
|
46
|
+
type: Object,
|
|
47
|
+
required: false,
|
|
48
|
+
},
|
|
33
49
|
visible: {
|
|
34
50
|
type: Boolean,
|
|
35
51
|
default: false,
|
|
@@ -109,10 +125,17 @@ export default {
|
|
|
109
125
|
},
|
|
110
126
|
},
|
|
111
127
|
mounted() {
|
|
112
|
-
this.guardInstance = new NativeGuard(
|
|
128
|
+
this.guardInstance = new NativeGuard({
|
|
129
|
+
appId: this.appId,
|
|
130
|
+
tenantId: this.tenantId,
|
|
131
|
+
config: this.mergeConfig,
|
|
132
|
+
authClient: this.authClient,
|
|
133
|
+
});
|
|
113
134
|
|
|
114
|
-
const evts = Object.values(
|
|
115
|
-
const kebabToCamelMap = Object.entries(
|
|
135
|
+
const evts = Object.values(GuardEventsCamelToKebabMapping);
|
|
136
|
+
const kebabToCamelMap = Object.entries(
|
|
137
|
+
GuardEventsCamelToKebabMapping
|
|
138
|
+
).reduce((acc, [camel, kebab]) => {
|
|
116
139
|
return Object.assign({}, acc, {
|
|
117
140
|
[kebab]: camel,
|
|
118
141
|
});
|
|
@@ -138,7 +161,9 @@ export default {
|
|
|
138
161
|
});
|
|
139
162
|
}, {});
|
|
140
163
|
|
|
141
|
-
evts.forEach((evtName) =>
|
|
164
|
+
evts.forEach((evtName) =>
|
|
165
|
+
this.guardInstance.on(evtName, listeners[evtName])
|
|
166
|
+
);
|
|
142
167
|
|
|
143
168
|
if (this.localVisible) {
|
|
144
169
|
this.guardInstance.show();
|