@authing/vue-ui-components 3.0.0 → 3.0.12-rc.2

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/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": "3.0.0",
4
+ "version": "3.0.12-rc.2",
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": "^3.0.0"
36
+ "@authing/native-js-ui-components": "3.0.12"
37
37
  },
38
38
  "devDependencies": {
39
39
  "@babel/core": "^7.4.0",
@@ -78,6 +78,5 @@
78
78
  "browserslist": [
79
79
  "> 10%",
80
80
  "last 2 versions"
81
- ],
82
- "gitHead": "9056f23895fd3f0f6358a735605212246f8526f8"
83
- }
81
+ ]
82
+ }
@@ -15,14 +15,7 @@ import {
15
15
  } from "@authing/native-js-ui-components";
16
16
  import "@authing/native-js-ui-components/lib/index.min.css";
17
17
 
18
- export {
19
- getAuthClient,
20
- initAuthClient,
21
- GuardMode,
22
- GuardScenes,
23
- LoginMethods,
24
- RegisterMethods,
25
- };
18
+ export { getAuthClient, initAuthClient, GuardMode, GuardScenes, LoginMethods, RegisterMethods };
26
19
 
27
20
  const format = (a, b) => {
28
21
  return !a || a === "false" ? b : true;
@@ -108,16 +101,10 @@ export default {
108
101
  mounted() {
109
102
  this.config = this.config || {};
110
103
  this.config.mode = this.mode ? this.mode : this.config.mode;
111
- this.config.autoRegister = this.autoRegister
112
- ? this.autoRegister
113
- : this.config.autoRegister;
104
+ this.config.autoRegister = this.autoRegister ? this.autoRegister : this.config.autoRegister;
114
105
  this.config.isSSO = this.isSSO ? this.isSSO : this.config.isSSO;
115
- this.config.clickCloseable = this.clickCloseable
116
- ? this.clickCloseable
117
- : this.config.clickCloseable;
118
- this.config.escCloseable = this.escCloseable
119
- ? this.escCloseable
120
- : this.config.escCloseable;
106
+ this.config.clickCloseable = this.clickCloseable ? this.clickCloseable : this.config.clickCloseable;
107
+ this.config.escCloseable = this.escCloseable ? this.escCloseable : this.config.escCloseable;
121
108
 
122
109
  // this.config.autoRegister = format(this.autoRegister, this.config.autoRegister)
123
110
  // this.config.isSSO = format(this.isSSO, this.config.isSSO)
@@ -127,14 +114,11 @@ export default {
127
114
  const guard = new NativeGuard(this.appId, this.config);
128
115
 
129
116
  const evts = Object.values(GuardEventsCamelToKebabMap);
130
- const kebabToCamelMap = Object.entries(GuardEventsCamelToKebabMap).reduce(
131
- (acc, [camel, kebab]) => {
132
- return Object.assign({}, acc, {
133
- [kebab]: camel,
134
- });
135
- },
136
- {}
137
- );
117
+ const kebabToCamelMap = Object.entries(GuardEventsCamelToKebabMap).reduce((acc, [camel, kebab]) => {
118
+ return Object.assign({}, acc, {
119
+ [kebab]: camel,
120
+ });
121
+ }, {});
138
122
 
139
123
  const listeners = evts.reduce((acc, evtName) => {
140
124
  return Object.assign({}, acc, {
@@ -1,4 +1,12 @@
1
- import AuthingGuard from './AuthingGuard.vue'
1
+ import Guard from "./Guard.vue";
2
2
 
3
- export * from './AuthingGuard.vue'
4
- export { AuthingGuard }
3
+ import {
4
+ getAuthClient,
5
+ initAuthClient,
6
+ GuardMode,
7
+ GuardScenes,
8
+ LoginMethods,
9
+ RegisterMethods,
10
+ } from "@authing/native-js-ui-components";
11
+
12
+ export { Guard, getAuthClient, initAuthClient, GuardMode, GuardScenes, LoginMethods, RegisterMethods };
@@ -1,183 +0,0 @@
1
- <template>
2
- <div id="authing_guard_container"></div>
3
- </template>
4
-
5
- <script>
6
- import {
7
- getAuthClient,
8
- initAuthClient,
9
- AuthingGuard as NativeAuthingGuard,
10
- GuardEventsCamelToKebabMap,
11
- GuardMode,
12
- GuardScenes,
13
- LoginMethods,
14
- RegisterMethods,
15
- } from "@authing/native-js-ui-components";
16
- import "@authing/native-js-ui-components/lib/index.min.css";
17
-
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
- };
30
-
31
- const callbackEvent = ["before-login", "before-register"];
32
-
33
- export default {
34
- name: "AuthingGuard",
35
- props: {
36
- appId: {
37
- type: String,
38
- required: true,
39
- },
40
- tenantId: {
41
- type: String,
42
- required: false,
43
- },
44
- config: {
45
- type: Object,
46
- required: false,
47
- },
48
- visible: {
49
- type: Boolean,
50
- default: false,
51
- },
52
- mode: {
53
- type: String,
54
- required: false, // normal(全屏) modal(弹窗)
55
- },
56
- autoRegister: {
57
- type: Boolean,
58
- required: false,
59
- },
60
- isSSO: {
61
- type: Boolean,
62
- required: false,
63
- },
64
- clickCloseable: {
65
- type: Boolean,
66
- default: true,
67
- required: false,
68
- },
69
- escCloseable: {
70
- type: Boolean,
71
- default: true,
72
- required: false,
73
- },
74
- onBeforeLogin: {
75
- type: Function,
76
- required: false,
77
- },
78
- onBeforeRegister: {
79
- type: Function,
80
- required: false,
81
- },
82
- },
83
- data() {
84
- return {
85
- localVisible: false,
86
- $guard: null,
87
- };
88
- },
89
- watch: {
90
- visible: {
91
- immediate: true,
92
- handler(val) {
93
- if (val !== this.localVisible) {
94
- this.localVisible = val;
95
- }
96
- },
97
- },
98
- localVisible: {
99
- handler(val) {
100
- if (val !== this.visible) {
101
- this.$emit("update:visible", val);
102
- }
103
-
104
- if (val) {
105
- this.show();
106
- } else {
107
- this.hide();
108
- }
109
- },
110
- },
111
- },
112
- 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;
125
-
126
- // this.config.autoRegister = format(this.autoRegister, this.config.autoRegister)
127
- // this.config.isSSO = format(this.isSSO, this.config.isSSO)
128
- // this.config.clickCloseable = format(this.clickCloseable, this.config.clickCloseable)
129
- // this.config.escCloseable = format(this.escCloseable, this.config.escCloseable)
130
-
131
- const guard = new NativeAuthingGuard(
132
- this.appId,
133
- this.config,
134
- this.tenantId
135
- );
136
-
137
- 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
- );
146
-
147
- const listeners = evts.reduce((acc, evtName) => {
148
- return Object.assign({}, acc, {
149
- [evtName]: (...rest) => {
150
- if (evtName === "close") {
151
- this.localVisible = false;
152
- }
153
- if (!callbackEvent.includes(evtName)) {
154
- this.$emit(evtName, ...rest);
155
- } else {
156
- const camelEvtName = kebabToCamelMap[evtName];
157
-
158
- if (this[camelEvtName]) {
159
- return this[camelEvtName](...rest);
160
- }
161
- return true;
162
- }
163
- },
164
- });
165
- }, {});
166
-
167
- evts.forEach((evtName) => guard.on(evtName, listeners[evtName]));
168
-
169
- if (this.localVisible) {
170
- guard.show();
171
- }
172
- this.$guard = guard;
173
- },
174
- methods: {
175
- show() {
176
- this.$guard.show();
177
- },
178
- hide() {
179
- this.$guard.hide();
180
- },
181
- },
182
- };
183
- </script>