@authing/vue-ui-components 2.4.52 → 2.4.55
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/lib/index.min.css +1 -1
- package/lib/index.min.js +1 -1
- package/package.json +3 -3
- package/src/components/AuthingGuard.vue +40 -36
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@authing/vue-ui-components",
|
|
3
3
|
"description": "Authing Vue UI components",
|
|
4
|
-
"version": "2.4.
|
|
4
|
+
"version": "2.4.55",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"vue",
|
|
7
7
|
"vuejs",
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
"registry": "https://registry.npmjs.org"
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@authing/native-js-ui-components": "^2.4.
|
|
36
|
+
"@authing/native-js-ui-components": "^2.4.55"
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|
|
39
39
|
"@babel/core": "^7.4.0",
|
|
@@ -79,5 +79,5 @@
|
|
|
79
79
|
"> 10%",
|
|
80
80
|
"last 2 versions"
|
|
81
81
|
],
|
|
82
|
-
"gitHead": "
|
|
82
|
+
"gitHead": "8c8162fd4a91c1d1376bf68d4592f90572cc3a7e"
|
|
83
83
|
}
|
|
@@ -12,24 +12,28 @@ import {
|
|
|
12
12
|
GuardScenes,
|
|
13
13
|
LoginMethods,
|
|
14
14
|
RegisterMethods,
|
|
15
|
-
} from
|
|
16
|
-
import
|
|
15
|
+
} from "@authing/native-js-ui-components";
|
|
16
|
+
import "@authing/native-js-ui-components/lib/index.min.css";
|
|
17
17
|
|
|
18
|
-
export { getAuthClient, initAuthClient, GuardMode, GuardScenes, LoginMethods, RegisterMethods }
|
|
18
|
+
export { getAuthClient, initAuthClient, GuardMode, GuardScenes, LoginMethods, RegisterMethods };
|
|
19
19
|
|
|
20
20
|
const format = (a, b) => {
|
|
21
|
-
return !a || a ===
|
|
22
|
-
}
|
|
21
|
+
return !a || a === "false" ? b : true;
|
|
22
|
+
};
|
|
23
23
|
|
|
24
|
-
const callbackEvent = [
|
|
24
|
+
const callbackEvent = ["before-login", "before-register"];
|
|
25
25
|
|
|
26
26
|
export default {
|
|
27
|
-
name:
|
|
27
|
+
name: "AuthingGuard",
|
|
28
28
|
props: {
|
|
29
29
|
appId: {
|
|
30
30
|
type: String,
|
|
31
31
|
required: true,
|
|
32
32
|
},
|
|
33
|
+
tenantId: {
|
|
34
|
+
type: String,
|
|
35
|
+
required: false,
|
|
36
|
+
},
|
|
33
37
|
config: {
|
|
34
38
|
type: Object,
|
|
35
39
|
required: false,
|
|
@@ -73,87 +77,87 @@ export default {
|
|
|
73
77
|
return {
|
|
74
78
|
localVisible: false,
|
|
75
79
|
$guard: null,
|
|
76
|
-
}
|
|
80
|
+
};
|
|
77
81
|
},
|
|
78
82
|
watch: {
|
|
79
83
|
visible: {
|
|
80
84
|
immediate: true,
|
|
81
85
|
handler(val) {
|
|
82
86
|
if (val !== this.localVisible) {
|
|
83
|
-
this.localVisible = val
|
|
87
|
+
this.localVisible = val;
|
|
84
88
|
}
|
|
85
89
|
},
|
|
86
90
|
},
|
|
87
91
|
localVisible: {
|
|
88
92
|
handler(val) {
|
|
89
93
|
if (val !== this.visible) {
|
|
90
|
-
this.$emit(
|
|
94
|
+
this.$emit("update:visible", val);
|
|
91
95
|
}
|
|
92
96
|
|
|
93
97
|
if (val) {
|
|
94
|
-
this.show()
|
|
98
|
+
this.show();
|
|
95
99
|
} else {
|
|
96
|
-
this.hide()
|
|
100
|
+
this.hide();
|
|
97
101
|
}
|
|
98
102
|
},
|
|
99
103
|
},
|
|
100
104
|
},
|
|
101
105
|
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
|
|
106
|
+
this.config = this.config || {};
|
|
107
|
+
this.config.mode = this.mode ? this.mode : this.config.mode;
|
|
108
|
+
this.config.autoRegister = this.autoRegister ? this.autoRegister : this.config.autoRegister;
|
|
109
|
+
this.config.isSSO = this.isSSO ? this.isSSO : this.config.isSSO;
|
|
110
|
+
this.config.clickCloseable = this.clickCloseable ? this.clickCloseable : this.config.clickCloseable;
|
|
111
|
+
this.config.escCloseable = this.escCloseable ? this.escCloseable : this.config.escCloseable;
|
|
108
112
|
|
|
109
113
|
// this.config.autoRegister = format(this.autoRegister, this.config.autoRegister)
|
|
110
114
|
// this.config.isSSO = format(this.isSSO, this.config.isSSO)
|
|
111
115
|
// this.config.clickCloseable = format(this.clickCloseable, this.config.clickCloseable)
|
|
112
116
|
// this.config.escCloseable = format(this.escCloseable, this.config.escCloseable)
|
|
113
117
|
|
|
114
|
-
const guard = new NativeAuthingGuard(this.appId, this.config)
|
|
118
|
+
const guard = new NativeAuthingGuard(this.appId, this.config, this.tenantId);
|
|
115
119
|
|
|
116
|
-
const evts = Object.values(GuardEventsCamelToKebabMap)
|
|
120
|
+
const evts = Object.values(GuardEventsCamelToKebabMap);
|
|
117
121
|
const kebabToCamelMap = Object.entries(GuardEventsCamelToKebabMap).reduce((acc, [camel, kebab]) => {
|
|
118
122
|
return Object.assign({}, acc, {
|
|
119
123
|
[kebab]: camel,
|
|
120
|
-
})
|
|
121
|
-
}, {})
|
|
124
|
+
});
|
|
125
|
+
}, {});
|
|
122
126
|
|
|
123
127
|
const listeners = evts.reduce((acc, evtName) => {
|
|
124
128
|
return Object.assign({}, acc, {
|
|
125
129
|
[evtName]: (...rest) => {
|
|
126
|
-
if (evtName ===
|
|
127
|
-
this.localVisible = false
|
|
130
|
+
if (evtName === "close") {
|
|
131
|
+
this.localVisible = false;
|
|
128
132
|
}
|
|
129
133
|
if (!callbackEvent.includes(evtName)) {
|
|
130
|
-
this.$emit(evtName, ...rest)
|
|
134
|
+
this.$emit(evtName, ...rest);
|
|
131
135
|
} else {
|
|
132
|
-
const camelEvtName = kebabToCamelMap[evtName]
|
|
136
|
+
const camelEvtName = kebabToCamelMap[evtName];
|
|
133
137
|
|
|
134
138
|
if (this[camelEvtName]) {
|
|
135
|
-
return this[camelEvtName](...rest)
|
|
139
|
+
return this[camelEvtName](...rest);
|
|
136
140
|
}
|
|
137
|
-
return true
|
|
141
|
+
return true;
|
|
138
142
|
}
|
|
139
143
|
},
|
|
140
|
-
})
|
|
141
|
-
}, {})
|
|
144
|
+
});
|
|
145
|
+
}, {});
|
|
142
146
|
|
|
143
|
-
evts.forEach((evtName) => guard.on(evtName, listeners[evtName]))
|
|
147
|
+
evts.forEach((evtName) => guard.on(evtName, listeners[evtName]));
|
|
144
148
|
|
|
145
149
|
if (this.localVisible) {
|
|
146
|
-
guard.show()
|
|
150
|
+
guard.show();
|
|
147
151
|
}
|
|
148
|
-
this.$guard = guard
|
|
152
|
+
this.$guard = guard;
|
|
149
153
|
},
|
|
150
154
|
methods: {
|
|
151
155
|
show() {
|
|
152
|
-
this.$guard.show()
|
|
156
|
+
this.$guard.show();
|
|
153
157
|
},
|
|
154
158
|
hide() {
|
|
155
|
-
this.$guard.hide()
|
|
159
|
+
this.$guard.hide();
|
|
156
160
|
},
|
|
157
161
|
},
|
|
158
|
-
}
|
|
162
|
+
};
|
|
159
163
|
</script>
|