@yeclimeric/nocobase-plugin-dingtalk 1.9.1 → 1.9.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/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  ## 更新日志
2
2
 
3
+ ### 20260918
4
+
5
+ - 修复 emailDomain 多域名分割正则(字符串误用为正则,导致多域名配置失效)
6
+ - 收窄 ACL 权限:仅对未登录用户开放 getAuthUrl / redirectAuth 登录接口
7
+ - 接入客户端国际化(usePluginTranslation),新增 en-US 语言包,配置表单与按钮文案改为取词
8
+ - 删除未被引用的钉钉 API Explorer 代码生成遗留脚本 dingTalkUtil.js
9
+
3
10
  ### 20240723
4
11
 
5
12
  - 支持钉钉第三方登录
package/README.md CHANGED
@@ -5,10 +5,9 @@
5
5
  - nocobase插件,支持钉钉登录
6
6
 
7
7
  ## 说明
8
- ### 版本对应
9
- - 前两位版本号与nocobase主版本号保持一致,第三位为构建版本号。
10
- - 建议使用与nocobase相同版本号的插件
11
8
 
12
- 使用的老版本的钉钉接口,后续会逐步的升级完善
9
+ ### 版本
10
+
11
+ - 前两位版本号与nocobase主版本号保持一致,建议使用与nocobase相同版本号的插件
13
12
 
14
- fork from https://github.com/ruanjf/nocobase-plugins
13
+ 使用的老版本的钉钉接口,后续会逐步的升级完善
@@ -7,4 +7,4 @@
7
7
  * For more information, please refer to: https://www.nocobase.com/agreement.
8
8
  */
9
9
 
10
- !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("react"),require("@nocobase/plugin-auth/client"),require("@nocobase/client"),require("@ant-design/icons"),require("antd")):"function"==typeof define&&define.amd?define("@yeclimeric/nocobase-plugin-dingtalk",["react","@nocobase/plugin-auth/client","@nocobase/client","@ant-design/icons","antd"],t):"object"==typeof exports?exports["@yeclimeric/nocobase-plugin-dingtalk"]=t(require("react"),require("@nocobase/plugin-auth/client"),require("@nocobase/client"),require("@ant-design/icons"),require("antd")):e["@yeclimeric/nocobase-plugin-dingtalk"]=t(e.react,e["@nocobase/plugin-auth/client"],e["@nocobase/client"],e["@ant-design/icons"],e.antd)}(self,function(e,t,n,r,o){return function(){"use strict";var i={482:function(e){e.exports=r},772:function(e){e.exports=n},689:function(e){e.exports=t},721:function(e){e.exports=o},156:function(t){t.exports=e}},u={};function a(e){var t=u[e];if(void 0!==t)return t.exports;var n=u[e]={exports:{}};return i[e](n,n.exports,a),n.exports}a.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return a.d(t,{a:t}),t},a.d=function(e,t){for(var n in t)a.o(t,n)&&!a.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},a.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},a.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var c={};return!function(){a.r(c),a.d(c,{NocobasePluginDingTalkClient:function(){return w},default:function(){return S}});var e=a(772),t=a(689),n=a.n(t),r=a(156),o=a.n(r),i=a(721),u=a(482);function l(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function s(e,t,n,r,o,i,u){try{var a=e[i](u),c=a.value}catch(e){n(e);return}a.done?t(c):Promise.resolve(c).then(r,o)}var f=function(t){var n,a,c,f=(n=(0,r.useState)(!1),function(e){if(Array.isArray(e))return e}(n)||function(e,t){var n,r,o=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=o){var i=[],u=!0,a=!1;try{for(o=o.call(e);!(u=(n=o.next()).done)&&(i.push(n.value),i.length!==t);u=!0);}catch(e){a=!0,r=e}finally{try{u||null==o.return||o.return()}finally{if(a)throw r}}return i}}(n,2)||function(e,t){if(e){if("string"==typeof e)return l(e,2);var n=Object.prototype.toString.call(e).slice(8,-1);if("Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n)return Array.from(n);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return l(e,t)}}(n,2)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),p=f[0],y=f[1],b=(0,e.useResource)("community-ding-talk"),d=(a=function(){var e;return function(e,t){var n,r,o,i,u={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){var c=[i,a];if(n)throw TypeError("Generator is already executing.");for(;u;)try{if(n=1,r&&(o=2&c[0]?r.return:c[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,c[1])).done)return o;switch(r=0,o&&(c=[2&c[0],o.value]),c[0]){case 0:case 1:o=c;break;case 4:return u.label++,{value:c[1],done:!1};case 5:u.label++,r=c[1],c=[0];continue;case 7:c=u.ops.pop(),u.trys.pop();continue;default:if(!(o=(o=u.trys).length>0&&o[o.length-1])&&(6===c[0]||2===c[0])){u=0;continue}if(3===c[0]&&(!o||c[1]>o[0]&&c[1]<o[3])){u.label=c[1];break}if(6===c[0]&&u.label<o[1]){u.label=o[1],o=c;break}if(o&&u.label<o[2]){u.label=o[2],u.ops.push(c);break}o[2]&&u.ops.pop(),u.trys.pop();continue}c=t.call(e,u)}catch(e){c=[6,e],r=0}finally{n=o=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}}(this,function(n){switch(n.label){case 0:y(!0),n.label=1;case 1:return n.trys.push([1,,3,4]),[4,b.getAuthUrl({values:{authenticator:t.authenticator.name,redirect:new URLSearchParams(location.search?location.search.substring(1):"").get("redirect")||""}})];case 2:return console.log("uu",e=n.sent(),e.data),location.href=e.data.data,[3,4];case 3:return setTimeout(function(){y(!1)},1e3),[7];case 4:return[2]}})},c=function(){var e=this,t=arguments;return new Promise(function(n,r){var o=a.apply(e,t);function i(e){s(o,n,r,i,u,"next",e)}function u(e){s(o,n,r,i,u,"throw",e)}i(void 0)})},function(){return c.apply(this,arguments)});return o().createElement(i.Button,{loading:p,disabled:p,icon:o().createElement(u.DingtalkOutlined,null),style:{width:"100%"},onClick:d},t.authenticator.title||t.authenticator.name)},p=function(t){return console.log("aaa",t),o().createElement(e.SchemaComponent,{schema:{type:"object",properties:{communityDingTalkAuth:{type:"void",properties:{public:{type:"object",properties:{autoSignup:{"x-decorator":"FormItem",type:"boolean",title:"用户不存在时自动注册",required:!1,"x-component":"Checkbox"}}},internal:{type:"object",properties:{userCheckType:{"x-decorator":"FormItem",type:"string",title:"用户验证方式",required:!0,"x-component":"Select","x-component-props":{options:[{value:"orgEmail",label:"企业邮箱"},{value:"personalEmail",label:"个人邮箱"},{value:"mobile",label:"手机号"}]}},emailDomain:{"x-decorator":"FormItem",type:"string",title:"邮箱域名,多个使用英文逗号分隔",required:!0,"x-component":"Input"},appKey:{"x-decorator":"FormItem",type:"string",title:"应用ID",required:!0,"x-component":"Input"},appSecret:{"x-decorator":"FormItem",type:"string",title:"应用秘钥",required:!0,"x-component":"Password"}}}}}}}})};function y(e,t,n,r,o,i,u){try{var a=e[i](u),c=a.value}catch(e){n(e);return}a.done?t(c):Promise.resolve(c).then(r,o)}function b(e){return function(){var t=this,n=arguments;return new Promise(function(r,o){var i=e.apply(t,n);function u(e){y(i,r,o,u,a,"next",e)}function a(e){y(i,r,o,u,a,"throw",e)}u(void 0)})}}function d(e,t,n){return(d=g()?Reflect.construct:function(e,t,n){var r=[null];r.push.apply(r,t);var o=new(Function.bind.apply(e,r));return n&&m(o,n.prototype),o}).apply(null,arguments)}function h(e){return(h=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function m(e,t){return(m=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function v(e){var t="function"==typeof Map?new Map:void 0;return(v=function(e){if(null===e||-1===Function.toString.call(e).indexOf("[native code]"))return e;if("function"!=typeof e)throw TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,n)}function n(){return d(e,arguments,h(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),m(n,e)})(e)}function g(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(g=function(){return!!e})()}function x(e,t){var n,r,o,i,u={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){var c=[i,a];if(n)throw TypeError("Generator is already executing.");for(;u;)try{if(n=1,r&&(o=2&c[0]?r.return:c[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,c[1])).done)return o;switch(r=0,o&&(c=[2&c[0],o.value]),c[0]){case 0:case 1:o=c;break;case 4:return u.label++,{value:c[1],done:!1};case 5:u.label++,r=c[1],c=[0];continue;case 7:c=u.ops.pop(),u.trys.pop();continue;default:if(!(o=(o=u.trys).length>0&&o[o.length-1])&&(6===c[0]||2===c[0])){u=0;continue}if(3===c[0]&&(!o||c[1]>o[0]&&c[1]<o[3])){u.label=c[1];break}if(6===c[0]&&u.label<o[1]){u.label=o[1],o=c;break}if(o&&u.label<o[2]){u.label=o[2],u.ops.push(c);break}o[2]&&u.ops.pop(),u.trys.pop();continue}c=t.call(e,u)}catch(e){c=[6,e],r=0}finally{n=o=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}}var w=function(e){var t;if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function");function r(){var e,t;if(!(this instanceof r))throw TypeError("Cannot call a class as a function");return e=r,t=arguments,e=h(e),function(e,t){var n;if(t&&("object"==((n=t)&&"undefined"!=typeof Symbol&&n.constructor===Symbol?"symbol":typeof n)||"function"==typeof t))return t;if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(this,g()?Reflect.construct(e,t||[],h(this).constructor):e.apply(this,t))}return r.prototype=Object.create(e&&e.prototype,{constructor:{value:r,writable:!0,configurable:!0}}),e&&m(r,e),t=[{key:"afterAdd",value:function(){return b(function(){return x(this,function(e){return[2]})})()}},{key:"beforeLoad",value:function(){return b(function(){return x(this,function(e){return[2]})})()}},{key:"load",value:function(){var e=this;return b(function(){return x(this,function(t){return e.app.pm.get(n()).registerType("community-ding-talk-auth",{components:{SignInButton:f,AdminSettingsForm:p}}),[2]})})()}}],function(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(r.prototype,t),r}(v(e.Plugin)),S=w}(),c}()});
10
+ !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("react"),require("@nocobase/plugin-auth/client"),require("@nocobase/client"),require("@ant-design/icons"),require("antd"),require("react-i18next")):"function"==typeof define&&define.amd?define("@yeclimeric/nocobase-plugin-dingtalk",["react","@nocobase/plugin-auth/client","@nocobase/client","@ant-design/icons","antd","react-i18next"],t):"object"==typeof exports?exports["@yeclimeric/nocobase-plugin-dingtalk"]=t(require("react"),require("@nocobase/plugin-auth/client"),require("@nocobase/client"),require("@ant-design/icons"),require("antd"),require("react-i18next")):e["@yeclimeric/nocobase-plugin-dingtalk"]=t(e.react,e["@nocobase/plugin-auth/client"],e["@nocobase/client"],e["@ant-design/icons"],e.antd,e["react-i18next"])}(self,function(e,t,n,r,o,i){return function(){"use strict";var a={482:function(e){e.exports=r},772:function(e){e.exports=n},689:function(e){e.exports=t},721:function(e){e.exports=o},156:function(t){t.exports=e},238:function(e){e.exports=i}},u={};function c(e){var t=u[e];if(void 0!==t)return t.exports;var n=u[e]={exports:{}};return a[e](n,n.exports,c),n.exports}c.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return c.d(t,{a:t}),t},c.d=function(e,t){for(var n in t)c.o(t,n)&&!c.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},c.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},c.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var l={};return!function(){c.r(l),c.d(l,{NocobasePluginDingTalkClient:function(){return A},default:function(){return j}});var e=c(772),t=c(689),n=c.n(t),r=c(156),o=c.n(r),i=c(721),a=c(482),u=c(238),s="community-ding-talk";function p(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function f(e,t,n,r,o,i,a){try{var u=e[i](a),c=u.value}catch(e){n(e);return}u.done?t(c):Promise.resolve(c).then(r,o)}var d=function(t){var n,u,c,l=(n=(0,r.useState)(!1),function(e){if(Array.isArray(e))return e}(n)||function(e,t){var n,r,o=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=o){var i=[],a=!0,u=!1;try{for(o=o.call(e);!(a=(n=o.next()).done)&&(i.push(n.value),i.length!==t);a=!0);}catch(e){u=!0,r=e}finally{try{a||null==o.return||o.return()}finally{if(u)throw r}}return i}}(n,2)||function(e,t){if(e){if("string"==typeof e)return p(e,2);var n=Object.prototype.toString.call(e).slice(8,-1);if("Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n)return Array.from(n);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return p(e,t)}}(n,2)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),s=l[0],d=l[1],y=(0,e.useResource)("community-ding-talk"),m=(u=function(){var e;return function(e,t){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function u(i){return function(u){var c=[i,u];if(n)throw TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(o=2&c[0]?r.return:c[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,c[1])).done)return o;switch(r=0,o&&(c=[2&c[0],o.value]),c[0]){case 0:case 1:o=c;break;case 4:return a.label++,{value:c[1],done:!1};case 5:a.label++,r=c[1],c=[0];continue;case 7:c=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===c[0]||2===c[0])){a=0;continue}if(3===c[0]&&(!o||c[1]>o[0]&&c[1]<o[3])){a.label=c[1];break}if(6===c[0]&&a.label<o[1]){a.label=o[1],o=c;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(c);break}o[2]&&a.ops.pop(),a.trys.pop();continue}c=t.call(e,a)}catch(e){c=[6,e],r=0}finally{n=o=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}}(this,function(n){switch(n.label){case 0:d(!0),n.label=1;case 1:return n.trys.push([1,,3,4]),[4,y.getAuthUrl({values:{authenticator:t.authenticator.name,redirect:new URLSearchParams(location.search?location.search.substring(1):"").get("redirect")||""}})];case 2:return e=n.sent(),location.href=e.data.data,[3,4];case 3:return setTimeout(function(){d(!1)},1e3),[7];case 4:return[2]}})},c=function(){var e=this,t=arguments;return new Promise(function(n,r){var o=u.apply(e,t);function i(e){f(o,n,r,i,a,"next",e)}function a(e){f(o,n,r,i,a,"throw",e)}i(void 0)})},function(){return c.apply(this,arguments)});return o().createElement(i.Button,{loading:s,disabled:s,icon:o().createElement(a.DingtalkOutlined,null),style:{width:"100%"},onClick:m},t.authenticator.title||t.authenticator.name)},y=function(t){var n=(0,u.useTranslation)(s).t;return o().createElement(e.SchemaComponent,{schema:{type:"object",properties:{communityDingTalkAuth:{type:"void",properties:{public:{type:"object",properties:{autoSignup:{"x-decorator":"FormItem",type:"boolean",title:n("Auto sign up when user does not exist"),required:!1,"x-component":"Checkbox"}}},internal:{type:"object",properties:{userCheckType:{"x-decorator":"FormItem",type:"string",title:n("User verification method"),required:!0,"x-component":"Select","x-component-props":{options:[{value:"orgEmail",label:n("Organization email")},{value:"personalEmail",label:n("Personal email")},{value:"mobile",label:n("Mobile")}]}},emailDomain:{"x-decorator":"FormItem",type:"string",title:n("Email domains, separated by commas"),required:!0,"x-component":"Input"},appKey:{"x-decorator":"FormItem",type:"string",title:n("App ID"),required:!0,"x-component":"Input"},appSecret:{"x-decorator":"FormItem",type:"string",title:n("App Secret"),required:!0,"x-component":"Password"}}}}}}}})},m={"User will be registered automatically if not exists.":"用户不存在时将自动注册。","Sign up automatically when the user does not exist":"用户不存在时自动注册","Auto sign up when user does not exist":"用户不存在时自动注册","User verification method":"用户验证方式","Email domains, separated by commas":"邮箱域名,多个使用英文逗号分隔","App ID":"应用ID","App Secret":"应用秘钥","Organization email":"企业邮箱","Personal email":"个人邮箱",Mobile:"手机号"},b={"User will be registered automatically if not exists.":"User will be registered automatically if not exists.","Sign up automatically when the user does not exist":"Sign up automatically when the user does not exist","Auto sign up when user does not exist":"Auto sign up when user does not exist","User verification method":"User verification method","Email domains, separated by commas":"Email domains, separated by commas","App ID":"App ID","App Secret":"App Secret","Organization email":"Organization email","Personal email":"Personal email",Mobile:"Mobile"};function h(e,t,n,r,o,i,a){try{var u=e[i](a),c=u.value}catch(e){n(e);return}u.done?t(c):Promise.resolve(c).then(r,o)}function v(e){return function(){var t=this,n=arguments;return new Promise(function(r,o){var i=e.apply(t,n);function a(e){h(i,r,o,a,u,"next",e)}function u(e){h(i,r,o,a,u,"throw",e)}a(void 0)})}}function g(e,t,n){return(g=O()?Reflect.construct:function(e,t,n){var r=[null];r.push.apply(r,t);var o=new(Function.bind.apply(e,r));return n&&w(o,n.prototype),o}).apply(null,arguments)}function x(e){return(x=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function w(e,t){return(w=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function S(e){var t="function"==typeof Map?new Map:void 0;return(S=function(e){if(null===e||-1===Function.toString.call(e).indexOf("[native code]"))return e;if("function"!=typeof e)throw TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,n)}function n(){return g(e,arguments,x(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),w(n,e)})(e)}function O(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(O=function(){return!!e})()}function k(e,t){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function u(i){return function(u){var c=[i,u];if(n)throw TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(o=2&c[0]?r.return:c[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,c[1])).done)return o;switch(r=0,o&&(c=[2&c[0],o.value]),c[0]){case 0:case 1:o=c;break;case 4:return a.label++,{value:c[1],done:!1};case 5:a.label++,r=c[1],c=[0];continue;case 7:c=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===c[0]||2===c[0])){a=0;continue}if(3===c[0]&&(!o||c[1]>o[0]&&c[1]<o[3])){a.label=c[1];break}if(6===c[0]&&a.label<o[1]){a.label=o[1],o=c;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(c);break}o[2]&&a.ops.pop(),a.trys.pop();continue}c=t.call(e,a)}catch(e){c=[6,e],r=0}finally{n=o=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}}var A=function(e){var t;if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function");function r(){var e,t;if(!(this instanceof r))throw TypeError("Cannot call a class as a function");return e=r,t=arguments,e=x(e),function(e,t){var n;if(t&&("object"==((n=t)&&"undefined"!=typeof Symbol&&n.constructor===Symbol?"symbol":typeof n)||"function"==typeof t))return t;if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(this,O()?Reflect.construct(e,t||[],x(this).constructor):e.apply(this,t))}return r.prototype=Object.create(e&&e.prototype,{constructor:{value:r,writable:!0,configurable:!0}}),e&&w(r,e),t=[{key:"afterAdd",value:function(){return v(function(){return k(this,function(e){return[2]})})()}},{key:"beforeLoad",value:function(){return v(function(){return k(this,function(e){return[2]})})()}},{key:"load",value:function(){var e=this;return v(function(){return k(this,function(t){return e.app.pm.get(n()).registerType("community-ding-talk-auth",{components:{SignInButton:d,AdminSettingsForm:y}}),e.app.i18n.addResourceBundle("zh-CN",s,m,!0,!0),e.app.i18n.addResourceBundle("en-US",s,b,!0,!0),[2]})})()}}],function(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(r.prototype,t),r}(S(e.Plugin)),j=A}(),l}()});
@@ -0,0 +1,13 @@
1
+ declare const _default: {
2
+ 'User will be registered automatically if not exists.': string;
3
+ 'Sign up automatically when the user does not exist': string;
4
+ 'Auto sign up when user does not exist': string;
5
+ 'User verification method': string;
6
+ 'Email domains, separated by commas': string;
7
+ 'App ID': string;
8
+ 'App Secret': string;
9
+ 'Organization email': string;
10
+ 'Personal email': string;
11
+ Mobile: string;
12
+ };
13
+ export default _default;
@@ -0,0 +1,43 @@
1
+ /**
2
+ * This file is part of the NocoBase (R) project.
3
+ * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
+ * Authors: NocoBase Team.
5
+ *
6
+ * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
+ * For more information, please refer to: https://www.nocobase.com/agreement.
8
+ */
9
+
10
+ var __defProp = Object.defineProperty;
11
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
12
+ var __getOwnPropNames = Object.getOwnPropertyNames;
13
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
14
+ var __export = (target, all) => {
15
+ for (var name in all)
16
+ __defProp(target, name, { get: all[name], enumerable: true });
17
+ };
18
+ var __copyProps = (to, from, except, desc) => {
19
+ if (from && typeof from === "object" || typeof from === "function") {
20
+ for (let key of __getOwnPropNames(from))
21
+ if (!__hasOwnProp.call(to, key) && key !== except)
22
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
23
+ }
24
+ return to;
25
+ };
26
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
27
+ var en_US_exports = {};
28
+ __export(en_US_exports, {
29
+ default: () => en_US_default
30
+ });
31
+ module.exports = __toCommonJS(en_US_exports);
32
+ var en_US_default = {
33
+ "User will be registered automatically if not exists.": "User will be registered automatically if not exists.",
34
+ "Sign up automatically when the user does not exist": "Sign up automatically when the user does not exist",
35
+ "Auto sign up when user does not exist": "Auto sign up when user does not exist",
36
+ "User verification method": "User verification method",
37
+ "Email domains, separated by commas": "Email domains, separated by commas",
38
+ "App ID": "App ID",
39
+ "App Secret": "App Secret",
40
+ "Organization email": "Organization email",
41
+ "Personal email": "Personal email",
42
+ "Mobile": "Mobile"
43
+ };
@@ -1,5 +1,13 @@
1
1
  declare const _default: {
2
2
  'User will be registered automatically if not exists.': string;
3
3
  'Sign up automatically when the user does not exist': string;
4
+ 'Auto sign up when user does not exist': string;
5
+ 'User verification method': string;
6
+ 'Email domains, separated by commas': string;
7
+ 'App ID': string;
8
+ 'App Secret': string;
9
+ 'Organization email': string;
10
+ 'Personal email': string;
11
+ Mobile: string;
4
12
  };
5
13
  export default _default;
@@ -31,5 +31,13 @@ __export(zh_CN_exports, {
31
31
  module.exports = __toCommonJS(zh_CN_exports);
32
32
  var zh_CN_default = {
33
33
  "User will be registered automatically if not exists.": "\u7528\u6237\u4E0D\u5B58\u5728\u65F6\u5C06\u81EA\u52A8\u6CE8\u518C\u3002",
34
- "Sign up automatically when the user does not exist": "\u7528\u6237\u4E0D\u5B58\u5728\u65F6\u81EA\u52A8\u6CE8\u518C"
34
+ "Sign up automatically when the user does not exist": "\u7528\u6237\u4E0D\u5B58\u5728\u65F6\u81EA\u52A8\u6CE8\u518C",
35
+ "Auto sign up when user does not exist": "\u7528\u6237\u4E0D\u5B58\u5728\u65F6\u81EA\u52A8\u6CE8\u518C",
36
+ "User verification method": "\u7528\u6237\u9A8C\u8BC1\u65B9\u5F0F",
37
+ "Email domains, separated by commas": "\u90AE\u7BB1\u57DF\u540D\uFF0C\u591A\u4E2A\u4F7F\u7528\u82F1\u6587\u9017\u53F7\u5206\u9694",
38
+ "App ID": "\u5E94\u7528ID",
39
+ "App Secret": "\u5E94\u7528\u79D8\u94A5",
40
+ "Organization email": "\u4F01\u4E1A\u90AE\u7BB1",
41
+ "Personal email": "\u4E2A\u4EBA\u90AE\u7BB1",
42
+ "Mobile": "\u624B\u673A\u53F7"
35
43
  };
@@ -44,7 +44,7 @@ class DingTalkAuth extends import_auth.BaseAuth {
44
44
  ...this.#authConfigOptions,
45
45
  internal: {
46
46
  userCheckType: this.#authConfigOptions.internal.userCheckType,
47
- emailDomains: ((_a = config.options.internal.emailDomain) == null ? void 0 : _a.split("s*,s*")) || []
47
+ emailDomains: ((_a = config.options.internal.emailDomain) == null ? void 0 : _a.split(/\s*,\s*/)) || []
48
48
  }
49
49
  };
50
50
  }
@@ -48,7 +48,7 @@ class NocobasePluginDingTalkServer extends import_server.Plugin {
48
48
  name: import_constants.ResoureName,
49
49
  actions: import_dingTalkActions.dingTalkActions
50
50
  });
51
- this.app.acl.allow(import_constants.ResoureName, "*");
51
+ this.app.acl.allow(import_constants.ResoureName, ["getAuthUrl", "redirectAuth"], "public");
52
52
  }
53
53
  async install() {
54
54
  }
package/package.json CHANGED
@@ -1,12 +1,13 @@
1
1
  {
2
2
  "name": "@yeclimeric/nocobase-plugin-dingtalk",
3
- "version": "1.9.1",
3
+ "version": "1.9.2",
4
4
  "displayName": "DingTalk",
5
5
  "displayName.zh-CN": "钉钉登录",
6
6
  "description": "Integrated DingTalk login function",
7
7
  "description.zh-CN": "集成钉钉登录功能",
8
8
  "keywords": [
9
9
  "plugin",
10
+ "插件",
10
11
  "钉钉",
11
12
  "dingding",
12
13
  "dingtalk",
@@ -27,4 +28,4 @@
27
28
  "@nocobase/server": "1.x",
28
29
  "@nocobase/test": "1.x"
29
30
  }
30
- }
31
+ }
@@ -1,66 +0,0 @@
1
- /**
2
- * This file is part of the NocoBase (R) project.
3
- * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
- * Authors: NocoBase Team.
5
- *
6
- * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
- * For more information, please refer to: https://www.nocobase.com/agreement.
8
- */
9
-
10
- const typeMap = {
11
- "LONG": "number",
12
- "STRING": "string"
13
- };
14
- function apiToType(res) {
15
- const reqBody = res.data.params.filter((a) => a.position === "BODY").map((a) => {
16
- var _a;
17
- return {
18
- name: a.name,
19
- desc: ((_a = a.desc) == null ? void 0 : _a.replaceAll("\n", " ")) || "",
20
- required: a.required,
21
- type: typeMap[a.type] || "any"
22
- };
23
- });
24
- const resBody = res.data.rspParams.map((a) => {
25
- var _a;
26
- return {
27
- name: a.name,
28
- desc: ((_a = a.desc) == null ? void 0 : _a.replaceAll("\n", " ")) || "",
29
- required: a.required,
30
- type: typeMap[a.type] || "any"
31
- };
32
- });
33
- const type = `
34
- export type Req = {
35
- ${reqBody.map((a) => ` /** ${a.desc} */
36
- ${a.name}${a.required ? "" : "?"}: ${a.type};`).join("\n")}
37
- }
38
- export type Res = {
39
- ${resBody.map((a) => ` /** ${a.desc} */
40
- ${a.name}${a.required ? "" : "?"}: ${a.type};`).join("\n")}
41
- }
42
- async userAccessToken(taskId: number, projectId?: number) {
43
- return api.doRequest<null>('POST', \`{baseUrl}/v1.0/oauth2/userAccessToken\`, null, {
44
- clientId: this.#appKey,
45
- clientSecret: this.#appSecret,
46
- });
47
- },
48
- `;
49
- return type;
50
- }
51
- async function genApiDetail(uuid, devType = "org") {
52
- const fd = new FormData();
53
- fd.append("uuid", uuid);
54
- fd.append("devType", devType);
55
- const res = await fetch("https://open-dev.dingtalk.com/openapi/explorer/getApiDetail", {
56
- "headers": {},
57
- "body": fd,
58
- "method": "POST"
59
- });
60
- const data = await res.json();
61
- return data;
62
- }
63
- (async () => {
64
- const res = await genApiDetail("dingtalk.oapi.v2.user.get");
65
- console.log(apiToType(res));
66
- })();