@pubinfo/module-auth 2.0.8 → 2.0.9

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.
@@ -1,19 +1,21 @@
1
- function e(e) {
2
- let { clientId: t, redirectUri: n } = e;
3
- return {
4
- id: "4A",
5
- name: "4A登录",
6
- type: "oauth",
7
- authorization: {
8
- url: "http://134.108.76.137:7001/index",
9
- params: {
10
- response_type: "code",
11
- client_id: t,
12
- redirect_uri: n
13
- }
14
- },
15
- callbackUrl: "/bs/loginBy4a",
16
- ...e
17
- };
1
+ function i(e) {
2
+ const { clientId: r, redirectUri: t } = e;
3
+ return {
4
+ id: "4A",
5
+ name: "4A登录",
6
+ type: "oauth",
7
+ authorization: {
8
+ url: "http://134.108.76.137:7001/index",
9
+ params: {
10
+ response_type: "code",
11
+ client_id: r,
12
+ redirect_uri: t
13
+ }
14
+ },
15
+ callbackUrl: "/bs/loginBy4a",
16
+ ...e
17
+ };
18
18
  }
19
- export { e as default };
19
+ export {
20
+ i as default
21
+ };
@@ -1,10 +1,12 @@
1
- function e(e) {
2
- let { authorize: t } = e;
3
- return {
4
- id: "credentials",
5
- name: "凭证登录",
6
- type: "custom",
7
- authorization: t
8
- };
1
+ function a(t) {
2
+ const { authorize: e } = t;
3
+ return {
4
+ id: "credentials",
5
+ name: "凭证登录",
6
+ type: "custom",
7
+ authorization: e
8
+ };
9
9
  }
10
- export { e as default };
10
+ export {
11
+ a as default
12
+ };
@@ -1,45 +1,49 @@
1
- function e(e) {
2
- let { clientId: t, redirectUri: n } = e, r = {
3
- redirect: {
4
- url: "https://openplatform-pro.ding.zj.gov.cn/oauth2/auth.htm",
5
- params: {
6
- response_type: "code",
7
- client_id: t,
8
- redirect_uri: n,
9
- scope: "get_user_info",
10
- authType: "QRCODE"
11
- }
12
- },
13
- embed: {
14
- url: "https://login-pro.ding.zj.gov.cn/oauth2/auth.htm",
15
- params: {
16
- response_type: "code",
17
- client_id: t,
18
- redirect_uri: n,
19
- scope: "get_user_info",
20
- authType: "QRCODE",
21
- embedMode: "true"
22
- }
23
- }
24
- }, i = (e, t) => {
25
- let n = document.getElementById(t.id);
26
- if (!n) throw Error(`未找到id为${t.id}的DOM元素`);
27
- let r = document.createElement("iframe");
28
- r.src = e, r.width = "200", r.height = "200", document.appendChild(r), window.addEventListener("message", (e) => {
29
- if (t.redirectUri) {
30
- let n = new URL(t.redirectUri);
31
- n.search = new URLSearchParams(e.data).toString(), window.location.href = n.toString();
32
- }
33
- });
34
- };
35
- return {
36
- id: "ding-zj",
37
- name: "浙政钉登录",
38
- type: "oauth",
39
- authorization: r[e.mode],
40
- callbackUrl: "/bs/loginByDingZJ",
41
- initQRCode: e.mode === "embed" ? i : void 0,
42
- ...e
43
- };
1
+ function m(e) {
2
+ const { clientId: i, redirectUri: n } = e, a = {
3
+ /** 跳转外部页面 */
4
+ redirect: {
5
+ url: "https://openplatform-pro.ding.zj.gov.cn/oauth2/auth.htm",
6
+ params: {
7
+ response_type: "code",
8
+ client_id: i,
9
+ redirect_uri: n,
10
+ scope: "get_user_info",
11
+ authType: "QRCODE"
12
+ }
13
+ },
14
+ /** 内嵌二维码 */
15
+ embed: {
16
+ url: "https://login-pro.ding.zj.gov.cn/oauth2/auth.htm",
17
+ params: {
18
+ response_type: "code",
19
+ client_id: i,
20
+ redirect_uri: n,
21
+ scope: "get_user_info",
22
+ authType: "QRCODE",
23
+ embedMode: "true"
24
+ }
25
+ }
26
+ }, o = (c, t) => {
27
+ if (!document.getElementById(t.id))
28
+ throw new Error(`未找到id为${t.id}的DOM元素`);
29
+ const r = document.createElement("iframe");
30
+ r.src = c, r.width = "200", r.height = "200", document.appendChild(r), window.addEventListener("message", (u) => {
31
+ if (t.redirectUri) {
32
+ const d = new URL(t.redirectUri);
33
+ d.search = new URLSearchParams(u.data).toString(), window.location.href = d.toString();
34
+ }
35
+ });
36
+ };
37
+ return {
38
+ id: "ding-zj",
39
+ name: "浙政钉登录",
40
+ type: "oauth",
41
+ authorization: a[e.mode],
42
+ callbackUrl: "/bs/loginByDingZJ",
43
+ initQRCode: e.mode === "embed" ? o : void 0,
44
+ ...e
45
+ };
44
46
  }
45
- export { e as default };
47
+ export {
48
+ m as default
49
+ };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@pubinfo/module-auth",
3
3
  "type": "module",
4
- "version": "2.0.8",
4
+ "version": "2.0.9",
5
5
  "exports": {
6
6
  ".": {
7
7
  "types": "./dist/index.d.ts",
@@ -23,10 +23,10 @@
23
23
  "node": "^20.19.0 || >=22.12.0"
24
24
  },
25
25
  "peerDependencies": {
26
- "pubinfo": "2.0.8"
26
+ "pubinfo": "2.0.9"
27
27
  },
28
28
  "devDependencies": {
29
- "pubinfo": "2.0.8"
29
+ "pubinfo": "2.0.9"
30
30
  },
31
31
  "scripts": {
32
32
  "dev": "pubinfo build --watch",