@authing/vue-ui-components 3.1.31 → 4.0.0-alpha.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
@@ -5,7 +5,7 @@
5
5
  "lib",
6
6
  "components"
7
7
  ],
8
- "version": "3.1.31",
8
+ "version": "4.0.0-alpha.2",
9
9
  "keywords": [
10
10
  "vue",
11
11
  "vuejs",
@@ -18,7 +18,7 @@
18
18
  "demo:serve": "vue-cli-service serve",
19
19
  "demo:build": "vue-cli-service build",
20
20
  "demo:lint": "vue-cli-service lint",
21
- "lint": "eslint --ext .js,.vue src/",
21
+ "lint": "eslint --ext .js,.vue components/",
22
22
  "dev": "nodemon --exec 'npm run build:es' --watch src -e js,vue,styl",
23
23
  "build:lib": "npm run clean && rollup -c config/rollup.config.js --environment NODE_ENV:production",
24
24
  "build:browser": "rollup --config configs/rollup.config.browser.js",
@@ -35,7 +35,7 @@
35
35
  "registry": "https://registry.npmjs.org"
36
36
  },
37
37
  "dependencies": {
38
- "@authing/native-js-ui-components": "^3.1.31"
38
+ "@authing/native-js-ui-components": "^4.0.0-alpha.2"
39
39
  },
40
40
  "devDependencies": {
41
41
  "@babel/core": "^7.0.0",
@@ -61,7 +61,6 @@
61
61
  "jest": "26.6.3",
62
62
  "jest-serializer-vue": "^2.0.2",
63
63
  "jest-transform-stub": "^2.0.0",
64
- "node-sass": "^6.0.1",
65
64
  "postcss": "^8.3.11",
66
65
  "postcss-import": "^14.0.2",
67
66
  "postcss-minify": "^1.1.0",
@@ -97,5 +96,6 @@
97
96
  "browserslist": [
98
97
  "> 10%",
99
98
  "last 2 versions"
100
- ]
99
+ ],
100
+ "gitHead": "27cf2be38df858ccc3697a09c0d7294de9b54d4a"
101
101
  }
@@ -1,8 +0,0 @@
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,150 +0,0 @@
1
- <template>
2
- <div id="authing_guard_container" />
3
- </template>
4
-
5
- <script>
6
- import { AuthingGuard as NativeAuthingGuard, GuardEventsCamelToKebabMap } from "@authing/native-js-ui-components";
7
-
8
- import "@authing/native-js-ui-components/lib/index.min.css";
9
-
10
- const callbackEvent = ["before-login", "before-register"];
11
-
12
- export default {
13
- name: "AuthingGuard",
14
- props: {
15
- appId: {
16
- type: String,
17
- required: true,
18
- },
19
- tenantId: {
20
- type: String,
21
- required: false,
22
- },
23
- config: {
24
- type: Object,
25
- required: false,
26
- },
27
- visible: {
28
- type: Boolean,
29
- default: false,
30
- },
31
- mode: {
32
- type: String,
33
- required: false, // normal(全屏) modal(弹窗)
34
- },
35
- autoRegister: {
36
- type: Boolean,
37
- required: false,
38
- },
39
- isSSO: {
40
- type: Boolean,
41
- required: false,
42
- },
43
- clickCloseable: {
44
- type: Boolean,
45
- default: true,
46
- required: false,
47
- },
48
- escCloseable: {
49
- type: Boolean,
50
- default: true,
51
- required: false,
52
- },
53
- onBeforeLogin: {
54
- type: Function,
55
- required: false,
56
- },
57
- onBeforeRegister: {
58
- type: Function,
59
- required: false,
60
- },
61
- },
62
- data() {
63
- return {
64
- localVisible: false,
65
- guardInstance: null,
66
- guarConfig: {},
67
- };
68
- },
69
- watch: {
70
- visible: {
71
- immediate: true,
72
- handler(val) {
73
- if (val !== this.localVisible) {
74
- this.localVisible = val;
75
- }
76
- },
77
- },
78
- localVisible: {
79
- handler(val) {
80
- if (val !== this.visible) {
81
- this.$emit("visible", val);
82
- }
83
-
84
- if (val) {
85
- this.show();
86
- } else {
87
- this.hide();
88
- }
89
- },
90
- },
91
- },
92
- computed: {
93
- mergeConfig: function () {
94
- return {
95
- ...this.config,
96
- appId: this.appId,
97
- mode: this.mode ?? this.config?.mode,
98
- autoRegister: this.autoRegister ?? this.config?.autoRegister,
99
- isSSO: this.isSSO ?? this.config?.isSSO,
100
- clickCloseable: this.clickCloseable ?? this.config?.clickCloseable,
101
- escCloseable: this.escCloseable ?? this.config?.escCloseable,
102
- };
103
- },
104
- },
105
- mounted() {
106
- this.guardInstance = new NativeAuthingGuard(this.appId, this.mergeConfig, this.tenantId);
107
-
108
- const evts = Object.values(GuardEventsCamelToKebabMap);
109
- const kebabToCamelMap = Object.entries(GuardEventsCamelToKebabMap).reduce((acc, [camel, kebab]) => {
110
- return Object.assign({}, acc, {
111
- [kebab]: camel,
112
- });
113
- }, {});
114
-
115
- const listeners = evts.reduce((acc, evtName) => {
116
- return Object.assign({}, acc, {
117
- [evtName]: (...rest) => {
118
- if (evtName === "close") {
119
- this.localVisible = false;
120
- }
121
- if (!callbackEvent.includes(evtName)) {
122
- this.$emit(evtName, ...rest);
123
- } else {
124
- const camelEvtName = kebabToCamelMap[evtName];
125
-
126
- if (this[camelEvtName]) {
127
- return this[camelEvtName](...rest);
128
- }
129
- return true;
130
- }
131
- },
132
- });
133
- }, {});
134
-
135
- evts.forEach((evtName) => this.guardInstance.on(evtName, listeners[evtName]));
136
-
137
- if (this.localVisible) {
138
- this.guardInstance.show();
139
- }
140
- },
141
- methods: {
142
- show() {
143
- this.guardInstance.show();
144
- },
145
- hide() {
146
- this.guardInstance.hide();
147
- },
148
- },
149
- };
150
- </script>