@tachybase/plugin-auth-dingtalk 1.3.16 → 1.3.18

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 +1 @@
1
- (function(e,t){typeof exports=="object"&&typeof module!="undefined"?t(exports,require("@tachybase/client"),require("@tachybase/module-auth/client"),require("react/jsx-runtime"),require("react"),require("@ant-design/icons"),require("antd"),require("react-router-dom")):typeof define=="function"&&define.amd?define(["exports","@tachybase/client","@tachybase/module-auth/client","react/jsx-runtime","react","@ant-design/icons","antd","react-router-dom"],t):(e=typeof globalThis!="undefined"?globalThis:e||self,t(e["@tachybase/plugin-auth-dingtalk"]={},e["@tachybase/client"],e["@tachybase/module-auth"],e.jsxRuntime,e.react,e["@ant-design/icons"],e.antd,e["react-router-dom"]))})(this,function(e,t,a,n,i,g,s,u){"use strict";var x=(e,t,a)=>new Promise((n,i)=>{var g=r=>{try{u(a.next(r))}catch(d){i(d)}},s=r=>{try{u(a.throw(r))}catch(d){i(d)}},u=r=>r.done?n(r.value):Promise.resolve(r.value).then(g,s);u((a=a.apply(e,t)).next())});const r="dingtalk",d="dingtalk";function S(){return t.useTranslation([d,"core"],{nsMode:"fallback"})}const q=()=>{const{t:o}=S(),c=t.useApp(),m=i.useMemo(()=>c.getApiUrl("dingtalk:redirect"),[c]),l=f=>{navigator.clipboard.writeText(f),s.message.success(o("Copied"))};return n.jsxs("div",{children:[n.jsx(t.SchemaComponent,{scope:{t:o},schema:{type:"object",properties:{public:{type:"object",properties:{autoSignup:{"x-decorator":"FormItem",type:"boolean",title:'{{t("Sign up automatically when the user does not exist")}}',"x-component":"Checkbox",default:!0}}},dingtalk:{type:"object",properties:{clientId:{"x-decorator":"FormItem","x-component":"Input",type:"string",required:!0,title:'{{t("Client ID")}}'},clientSecret:{"x-decorator":"FormItem","x-component":"Input",type:"string",required:!0,title:'{{t("Client Secret")}}'}}}}}}),n.jsxs("div",{children:[n.jsxs(s.Typography.Title,{level:5,style:{fontSize:"14px"},children:[o("Redirect URL"),n.jsx("span",{style:{marginLeft:"2px"},children:":"})]}),n.jsx(s.Input,{value:m,disabled:!0,addonBefore:n.jsx(g.CopyOutlined,{onClick:()=>l(m)})})]})]})},C=({authenticator:o})=>{const[c,m]=i.useState(),{t:l}=S(),f=t.useAPIClient(),I=u.useLocation(),y=new URLSearchParams(I.search),j=y.get("redirect");i.useEffect(()=>{c&&(window.location.href=c)},[c]),i.useEffect(()=>{const p=y.get("authenticator"),h=y.get("error");if(p===o.name&&h){s.message.error(l(h));return}});const v=()=>x(this,null,function*(){var k,T;const p=yield f.request({method:"post",url:"dingtalk:getAuthUrl",headers:{"X-Authenticator":o.name},data:{redirect:j}}),h=(T=(k=p==null?void 0:p.data)==null?void 0:k.data)==null?void 0:T.url;h&&m(h)});return n.jsx(s.Button,{block:!0,icon:n.jsx(g.LoginOutlined,{}),shape:"round",onClick:v,children:o.title?l(o.title):l("Sign in via DingTalk")})};class b extends t.Plugin{load(){return x(this,null,function*(){this.app.pm.get(a).registerType(r,{components:{SignInButton:C,AdminSettingsForm:q}})})}}e.PluginDingding=b,e.default=b,Object.defineProperties(e,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
1
+ (function(e,t){typeof exports=="object"&&typeof module!="undefined"?t(exports,require("@tachybase/client"),require("@tachybase/module-auth/client"),require("react/jsx-runtime"),require("react"),require("@ant-design/icons"),require("antd"),require("react-router-dom")):typeof define=="function"&&define.amd?define(["exports","@tachybase/client","@tachybase/module-auth/client","react/jsx-runtime","react","@ant-design/icons","antd","react-router-dom"],t):(e=typeof globalThis!="undefined"?globalThis:e||self,t(e["@tachybase/plugin-auth-dingtalk"]={},e["@tachybase/client"],e["@tachybase/module-auth"],e.jsxRuntime,e.react,e["@ant-design/icons"],e.antd,e["react-router-dom"]))})(this,function(e,t,a,n,i,g,s,u){"use strict";var x=(e,t,a)=>new Promise((n,i)=>{var g=r=>{try{u(a.next(r))}catch(d){i(d)}},s=r=>{try{u(a.throw(r))}catch(d){i(d)}},u=r=>r.done?n(r.value):Promise.resolve(r.value).then(g,s);u((a=a.apply(e,t)).next())});const r="dingtalk",d="dingtalk";function S(){return t.useTranslation([d,"core"],{nsMode:"fallback"})}const q=()=>{const{t:o}=S(),c=t.useApp(),m=i.useMemo(()=>c.getApiUrl("dingtalk:redirect"),[c]),l=f=>{navigator.clipboard.writeText(f),s.message.success(o("Copied"))};return n.jsxs("div",{children:[n.jsx(t.SchemaComponent,{scope:{t:o},schema:{type:"object",properties:{public:{type:"object",properties:{autoSignup:{"x-decorator":"FormItem",type:"boolean",title:'{{t("Sign up automatically when the user does not exist")}}',"x-component":"Checkbox",default:!0}}},dingtalk:{type:"object",properties:{clientId:{"x-decorator":"FormItem","x-component":"Input",type:"string",required:!0,title:'{{t("Client ID")}}'},clientSecret:{"x-decorator":"FormItem","x-component":"Input",type:"string",required:!0,title:'{{t("Client Secret")}}'}}}}}}),n.jsxs("div",{children:[n.jsxs(s.Typography.Title,{level:5,style:{fontSize:"14px"},children:[o("Redirect URL"),n.jsx("span",{style:{marginLeft:"2px"},children:":"})]}),n.jsx(s.Input,{value:m,disabled:!0,addonBefore:n.jsx(g.CopyOutlined,{onClick:()=>l(m)})})]})]})},C=({authenticator:o})=>{const[c,m]=i.useState(),{t:l}=S(),f=t.useAPIClient(),I=u.useLocation(),y=new URLSearchParams(I.search),j=y.get("redirect");i.useEffect(()=>{c&&(window.location.href=c)},[c]),i.useEffect(()=>{const p=y.get("authenticator"),h=y.get("error");if(p===o.name&&h){s.message.error(l(h));return}});const v=()=>x(null,null,function*(){var k,T;const p=yield f.request({method:"post",url:"dingtalk:getAuthUrl",headers:{"X-Authenticator":o.name},data:{redirect:j}}),h=(T=(k=p==null?void 0:p.data)==null?void 0:k.data)==null?void 0:T.url;h&&m(h)});return n.jsx(s.Button,{block:!0,icon:n.jsx(g.LoginOutlined,{}),shape:"round",onClick:v,children:o.title?l(o.title):l("Sign in via DingTalk")})};class b extends t.Plugin{load(){return x(this,null,function*(){this.app.pm.get(a).registerType(r,{components:{SignInButton:C,AdminSettingsForm:q}})})}}e.PluginDingding=b,e.default=b,Object.defineProperties(e,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
@@ -1,11 +1,11 @@
1
1
  module.exports = {
2
2
  "react": "18.3.1",
3
- "@tachybase/client": "1.3.16",
3
+ "@tachybase/client": "1.3.18",
4
4
  "@ant-design/icons": "5.5.2",
5
5
  "antd": "5.22.5",
6
6
  "react-router-dom": "6.28.1",
7
- "@tachybase/module-auth": "1.3.16",
8
- "@tachybase/auth": "1.3.16",
9
- "@tachybase/server": "1.3.16",
10
- "@tachybase/actions": "1.3.16"
7
+ "@tachybase/module-auth": "1.3.18",
8
+ "@tachybase/auth": "1.3.18",
9
+ "@tachybase/server": "1.3.18",
10
+ "@tachybase/actions": "1.3.18"
11
11
  };
package/dist/index.js CHANGED
@@ -26,12 +26,12 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
26
26
  mod
27
27
  ));
28
28
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
- var src_exports = {};
30
- __export(src_exports, {
29
+ var index_exports = {};
30
+ __export(index_exports, {
31
31
  default: () => import_server.default
32
32
  });
33
- module.exports = __toCommonJS(src_exports);
34
- __reExport(src_exports, require("./server"), module.exports);
33
+ module.exports = __toCommonJS(index_exports);
34
+ __reExport(index_exports, require("./server"), module.exports);
35
35
  var import_server = __toESM(require("./server"));
36
36
  // Annotate the CommonJS export names for ESM import in node:
37
37
  0 && (module.exports = {