@tachybase/module-message 0.23.8 → 0.23.16

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,8 +1,8 @@
1
- (function(c,t){typeof exports=="object"&&typeof module!="undefined"?t(exports,require("@tachybase/client"),require("@tachybase/utils/client"),require("react/jsx-runtime"),require("react"),require("@tachybase/schema"),require("antd"),require("@tachybase/components"),require("@tachybase/module-workflow/client"),require("lodash"),require("@ant-design/icons"),require("react-router-dom")):typeof define=="function"&&define.amd?define(["exports","@tachybase/client","@tachybase/utils/client","react/jsx-runtime","react","@tachybase/schema","antd","@tachybase/components","@tachybase/module-workflow/client","lodash","@ant-design/icons","react-router-dom"],t):(c=typeof globalThis!="undefined"?globalThis:c||self,t(c["@tachybase/module-message"]={},c["@tachybase/client"],c["@tachybase/utils"],c.jsxRuntime,c.react,c["@tachybase/schema"],c.antd,c["@tachybase/components"],c["@tachybase/module-workflow"],c.lodash,c["@ant-design/icons"],c["react-router-dom"]))})(this,function(c,t,m,r,C,I,M,T,g,k,ee,te){"use strict";var Ct=Object.defineProperty,St=Object.defineProperties;var ft=Object.getOwnPropertyDescriptors;var W=Object.getOwnPropertySymbols;var bt=Object.prototype.hasOwnProperty,wt=Object.prototype.propertyIsEnumerable;var z=(c,t,m)=>t in c?Ct(c,t,{enumerable:!0,configurable:!0,writable:!0,value:m}):c[t]=m,f=(c,t)=>{for(var m in t||(t={}))bt.call(t,m)&&z(c,m,t[m]);if(W)for(var m of W(t))wt.call(t,m)&&z(c,m,t[m]);return c},A=(c,t)=>St(c,ft(t));var b=(c,t,m)=>z(c,typeof t!="symbol"?t+"":t,m);var x=(c,t,m)=>new Promise((r,C)=>{var I=g=>{try{T(m.next(g))}catch(k){C(k)}},M=g=>{try{T(m.throw(g))}catch(k){C(k)}},T=g=>g.done?r(g.value):Promise.resolve(g.value).then(I,M);T((m=m.apply(c,t)).next())});const _="message-instruction",y="message",oe="messages",ne="messages-update-badge-count",se="site-message",re="sms",ae=({children:e})=>{const o=t.useApp(),n=t.useCompile(),s=t.usePlugin(N),i=C.useMemo(()=>Array.from(s.channels.getValues()),[s]).map(a=>{var l,d;return a.send||((d=(l=a.useAction)==null?void 0:l.call(a))==null?void 0:d.send)}).filter(Boolean);return C.useEffect(()=>{I.autorun(()=>{if(o.ws.connected){const a={type:"signIn",payload:{token:o.apiClient.auth.getToken()}};o.ws.send(JSON.stringify(a))}})},[]),C.useEffect(()=>{o.ws.on("message",a=>{const l=JSON.parse(a.data);if((l==null?void 0:l.type)===oe){const d=l.payload.message,u=n(d.title),w=n(d.content),v={title:u,content:w};i.forEach(S=>S==null?void 0:S(v))}})},[]),r.jsx(r.Fragment,{children:e})};class B{constructor(){b(this,"name");b(this,"title")}}const V=()=>{const{i18n:e}=t.useApp();return{t:(n,s={})=>e.t(n,f({ns:[y,"core"]},s))}},h=e=>t.tval(e,{ns:[y,"core"]});function F(e){return t.i18n.t(e,{ns:[y,"core"]})}const K=se;class ie extends B{constructor(){super(...arguments);b(this,"name",K);b(this,"title",F("In-App Notifications"))}useAction(){const n=t.useApp();return{send:p=>{const{title:i,content:a}=p;n.notification.info({key:i,message:`${i}${a?":"+a:""}`,duration:10})}}}}class ce extends t.Plugin{load(){return x(this,null,function*(){this.app.pm.get(N).registerChannel(K,ie)})}}const $=re;class pe extends B{constructor(){super(...arguments);b(this,"name",$);b(this,"title",F("Text Message Alerts"))}}class le extends t.Plugin{load(){return x(this,null,function*(){this.app.pm.get(N).registerChannel($,pe)})}}class de extends t.Plugin{afterAdd(){return x(this,null,function*(){yield this.app.pm.add(ce),yield this.app.pm.add(le)})}load(){return x(this,null,function*(){this.app.use(ae)})}}const O="messages_providers",q={dumpRules:{group:"third-party"},name:O,shared:!0,fields:[{type:"string",name:"id",primaryKey:!0,interface:"input",uiSchema:{title:'{{t("ID")}}',type:"string","x-component":"Input",required:!0}},{type:"string",name:"title",interface:"input",uiSchema:{title:'{{t("Title")}}',type:"string","x-component":"Input",required:!0}},{type:"string",name:"type",interface:"select",uiSchema:{title:`{{t("Provider type", { ns: "${y}" })}}`,type:"string","x-component":"Select",required:!0,enum:[{label:`{{t("Aliyun SMS", { ns: "${y}" })}}`,value:"sms-aliyun"},{label:`{{t("Tencent SMS", { ns: "${y}" })}}`,value:"sms-tencent"}]}},{type:"jsonb",name:"options"},{type:"radio",name:"default",interface:"checkbox",uiSchema:{title:'{{t("Default")}}',type:"boolean","x-component":"Checkbox"}}]},me={type:"void",name:"NotificationProviders","x-component":M.Card,"x-component-props":{bordered:!1},properties:{tableCard:{type:"void",name:"tableCard","x-decorator":"ResourceActionProvider","x-decorator-props":{collection:q,resourceName:O,request:{resource:O,action:"list",params:{pageSize:50,sort:["-default","id"],appends:[]}}},"x-component":"CollectionProvider_deprecated","x-component-props":{collection:q},properties:{actions:{type:"void","x-component":"ActionBar","x-component-props":{style:{marginBottom:16}},properties:{filter:{type:"void",title:'{{ t("Filter") }}',"x-action":"filter","x-designer":"Filter.Action.Designer","x-component":"Filter.Action","x-use-component-props":"useFilterActionProps","x-component-props":{icon:"FilterOutlined"},"x-align":"left"},refresher:{type:"void",title:'{{ t("Refresh") }}',"x-action":"refresh","x-component":"Action","x-use-component-props":"useRefreshActionProps","x-designer":"Action.Designer","x-component-props":{icon:"ReloadOutlined"},"x-align":"right"},delete:{type:"void",title:'{{t("Delete")}}',"x-component":"Action","x-component-props":{icon:"DeleteOutlined",useAction:"{{ cm.useBulkDestroyAction }}",confirm:{title:"{{t('Delete')}}",content:"{{t('Are you sure you want to delete it?')}}"}}},create:{type:"void",title:'{{t("Add new")}}',"x-component":"Action","x-component-props":{type:"primary",icon:"PlusOutlined"},properties:{drawer:{type:"void","x-component":"Action.Drawer","x-decorator":"Form","x-decorator-props":{useValues(e){const o=t.useActionContext();return t.useRequest(()=>Promise.resolve({data:{name:`s_${I.uid()}`}}),A(f({},e),{refreshDeps:[o.visible]}))}},title:'{{t("Add new")}}',properties:{id:{"x-component":"CollectionField","x-decorator":"FormItem",description:'{{t("Identifier for program usage. Support letters, numbers and underscores, must start with an letter.")}}'},title:{"x-component":"CollectionField","x-decorator":"FormItem"},type:{"x-component":"CollectionField","x-decorator":"FormItem"},options:{type:"object","x-component":"ProviderOptions"},default:{"x-component":"CollectionField","x-decorator":"FormItem"},footer:{type:"void","x-component":"Action.Drawer.Footer",properties:{cancel:{title:'{{t("Cancel")}}',"x-component":"Action","x-component-props":{useAction:"{{ cm.useCancelAction }}"}},submit:{title:'{{t("Submit")}}',"x-component":"Action","x-component-props":{type:"primary",useAction:"{{ cm.useCreateAction }}"}}}}}}}}}},table:{type:"void","x-uid":"input","x-component":"Table.Void","x-component-props":{rowKey:"id",rowSelection:{type:"checkbox"},useDataSource:"{{ cm.useDataSourceFromRAC }}"},properties:{id:{type:"void","x-decorator":"Table.Column.Decorator","x-component":"Table.Column",properties:{id:{type:"string","x-component":"CollectionField","x-read-pretty":!0}}},title:{type:"void","x-decorator":"Table.Column.Decorator","x-component":"Table.Column",properties:{title:{type:"string","x-component":"CollectionField","x-read-pretty":!0}}},type:{type:"void","x-decorator":"Table.Column.Decorator","x-component":"Table.Column",properties:{type:{type:"string","x-component":"CollectionField","x-read-pretty":!0}}},default:{type:"void","x-decorator":"Table.Column.Decorator","x-component":"Table.Column",properties:{default:{type:"boolean","x-component":"CollectionField","x-read-pretty":!0}}},actions:{type:"void",title:'{{t("Actions")}}',"x-component":"Table.Column",properties:{actions:{type:"void","x-component":"Space","x-component-props":{split:"|"},properties:{update:{type:"void",title:'{{t("Edit")}}',"x-component":"Action.Link","x-component-props":{type:"primary"},properties:{drawer:{type:"void","x-component":"Action.Drawer","x-decorator":"Form","x-decorator-props":{useValues:"{{ cm.useValuesFromRecord }}"},title:'{{t("Edit")}}',properties:{id:{"x-component":"CollectionField","x-decorator":"FormItem"},title:{"x-component":"CollectionField","x-decorator":"FormItem"},type:{"x-component":"CollectionField","x-decorator":"FormItem","x-disabled":!0},options:{type:"object","x-component":"ProviderOptions"},default:{"x-component":"CollectionField","x-decorator":"FormItem"},footer:{type:"void","x-component":"Action.Drawer.Footer",properties:{cancel:{title:'{{t("Cancel")}}',"x-component":"Action","x-component-props":{useAction:"{{ cm.useCancelAction }}"}},submit:{title:'{{t("Submit")}}',"x-component":"Action","x-component-props":{type:"primary",useAction:"{{ cm.useUpdateAction }}"}}}}}}}},delete:{type:"void",title:'{{ t("Delete") }}',"x-component":"Action.Link","x-component-props":{confirm:{title:"{{t('Delete record')}}",content:"{{t('Are you sure you want to delete it?')}}"},useAction:"{{cm.useDestroyAction}}"}}}}}}}}}}}},ue={type:"object",properties:{accessKeyId:{title:`{{t("Access Key ID", { ns: "${y}" })}}`,type:"string","x-decorator":"FormItem","x-component":"Input"},accessKeySecret:{title:`{{t("Access Key Secret", { ns: "${y}" })}}`,type:"string","x-decorator":"FormItem","x-component":"Password"},endpoint:{title:`{{t("Endpoint", { ns: "${y}" })}}`,type:"string","x-decorator":"FormItem","x-component":"Input"},sign:{title:`{{t("Sign", { ns: "${y}" })}}`,type:"string","x-decorator":"FormItem","x-component":"Input"},template:{title:`{{t("Template code", { ns: "${y}" })}}`,type:"string","x-decorator":"FormItem","x-component":"Input"}}},xe={type:"object",properties:{secretId:{title:`{{t("Secret Id", { ns: "${y}" })}}`,type:"string","x-decorator":"FormItem","x-component":"Input"},secretKey:{title:`{{t("Secret Key", { ns: "${y}" })}}`,type:"string","x-decorator":"FormItem","x-component":"Password"},region:{title:`{{t("Region", { ns: "${y}" })}}`,type:"string","x-decorator":"FormItem","x-component":"Input"},endpoint:{title:`{{t("Endpoint", { ns: "${y}" })}}`,type:"string","x-decorator":"FormItem","x-component":"Input",default:"sms.tencentcloudapi.com"},SignName:{title:`{{t("Sign name", { ns: "${y}" })}}`,type:"string","x-decorator":"FormItem","x-component":"Input"},SmsSdkAppId:{title:`{{t("Sms sdk app id", { ns: "${y}" })}}`,type:"string","x-decorator":"FormItem","x-component":"Input"},TemplateId:{title:`{{t("Template Id", { ns: "${y}" })}}`,type:"string","x-decorator":"FormItem","x-component":"Input"}}},L=new m.Registry,U="sms-aliyun",ge="sms-tencent";L.register(U,ue),L.register(ge,xe);const he=U,ye=I.observer(e=>{const o=I.useForm(),n=I.useField(),[s,p]=C.useState(new I.Schema({}));return C.useEffect(()=>{o.clearFormGraph("options.*"),p(new I.Schema(L.get(o.values.type)||{}))},[o.values.type]),r.jsx(T.FormLayout,{layout:"vertical",children:r.jsx(I.RecursionField,{basePath:n.address,onlyRenderProperties:!0,schema:s},o.values.type||he)})},{displayName:"ProviderOptions"}),Ce=()=>r.jsx(t.SchemaComponent,{schema:me,components:{ProviderOptions:ye}}),Se="notification-providers";class fe extends t.Plugin{load(){return x(this,null,function*(){this.app.systemSettingsManager.add(`system-services.${Se}`,{icon:"CheckCircleOutlined",title:`{{t("Notification providers", { ns: "${y}" })}}`,aclSnippet:"pm.message.providers",Component:Ce})})}}const be=()=>{const e=t.usePlugin(N),o=Array.from(e.channels.getValues());return r.jsx(M.Card,{children:o.map(n=>r.jsx(we,{channel:n},n.name))})},we=e=>{var v,S;const{channel:o}=e,{name:n,title:s}=o,p=t.useAPIClient(),{t:i}=V(),{message:a}=M.App.useApp(),l=t.useCurrentUserContext(),d=((S=(v=l==null?void 0:l.data)==null?void 0:v.data)==null?void 0:S.subPrefs)||{},u=d[n]||{},w=D=>x(this,null,function*(){var Q;const Z=yield p.resource("users").updateProfile({values:{subPrefs:A(f({},d),{[n]:{enable:D}})}});Z.status===200&&a.success(i("Edited successfully")),l.mutate({data:f(f({},(Q=l==null?void 0:l.data)==null?void 0:Q.data),Z.data.data[0])})});return r.jsxs("p",{children:[s,r.jsx(M.Switch,{checked:u.enable,onChange:w})]})};class ve extends t.Plugin{load(){return x(this,null,function*(){this.userSettingsManager.add("sub-manager",{title:F("Subscription management"),icon:"BellOutlined",Component:be})})}}class Ae extends t.Plugin{afterAdd(){return x(this,null,function*(){yield this.app.pm.add(de),yield this.app.pm.add(fe),yield this.app.pm.add(ve)})}}const Ie=()=>{var d;const{workflow:e}=g.useFlowContext(),[o,n]=t.parseCollectionName((d=e.config)==null?void 0:d.collection),s=t.useSchemaInitializerItem(),{insert:p}=t.useSchemaInitializer(),{getTemplateSchemaByMode:i}=t.useSchemaTemplateManager(),a=t.useRecordCollectionDataSourceItems("FormItem"),l=w=>x(this,[w],function*({item:u}){const v=u.template?yield i(u):null,S=t.createReadPrettyFormBlockSchema({actionInitializers:null,resource:n,collection:n,dataSource:o,template:v,settings:"blockSettings:details"});k.unset(S,["x-acl-action","x-acl-action-props"]);const[D]=Object.keys(S.properties);k.set(S.properties[D],"x-use-component-props","usePropsShowDetail"),p(S)});return r.jsx(t.SchemaInitializerItem,A(f({},s),{onClick:l,items:a}))};function Me(){var l;const e=t.usePlugin(g),{workflow:o}=g.useFlowContext(),n=g.useTrigger(),s=g.useContextNode(),p=g.useAvailableUpstreams(s),i=[(l=n.useInitializers)==null?void 0:l.call(n,o.config)].filter(Boolean),a=p.map(d=>{var w;const u=e.instructions.get(d.type);return(w=u==null?void 0:u.useInitializers)==null?void 0:w.call(u,d)}).filter(Boolean);return[...i,...a.length?[{name:"nodes",type:"subMenu",title:'{{t("Node result", { ns: "workflow" })}}',children:a}]:[]].filter(Boolean)}const ke=({app:e})=>{const n=e.schemaInitializerManager.get("page:addBlock").items;return new t.SchemaInitializer({name:"InitializerBlockMessage",title:"{{t('Add block')}}",wrap:t.gridRowColWrap,items:[{name:"messageCard",type:"itemGroup",title:h("Trigger data"),children:[{name:"detail",type:"item",title:'{{t("Details")}}',Component:Ie}]},{name:"dataBlocks",type:"itemGroup",title:h("Workflow Data blocks"),checkChildrenLength:!0,useChildren:Me},...n]})};class Pe extends t.Plugin{load(){return x(this,null,function*(){const o=ke({app:this.app});this.app.schemaInitializerManager.add(o)})}}function Te(e){const{value:o,onChange:n}=e,s=t.useAPIClient(),p=C.useCallback(l=>{},[]),{data:i,loading:a}=t.useRequest(()=>x(this,null,function*(){return yield De({srcId:o,onChange:n,apiClient:s})}));return{schemaData:i,loading:a,handleSchemaChange:p}}function De(s){return x(this,arguments,function*({srcId:e,onChange:o,apiClient:n}){const p=e!=null?e:m.uid(),i=Ne(p);if(e){const a=yield Fe({apiClient:n,srcId:e});if(a["x-uid"]===e)return a}else yield Ee({apiClient:n,schema:i}),o(p);return i})}function Ne(e){return{type:"void",name:e,"x-uid":e,"x-component":"Grid","x-initializer":"InitializerBlockMessage",properties:{}}}function Fe(n){return x(this,arguments,function*({apiClient:e,srcId:o}){var i;const{data:s}=yield e.request({url:`uiSchemas:getJsonSchema/${o}`});return(i=s.data)!=null?i:{}})}function Ee(n){return x(this,arguments,function*({apiClient:e,schema:o}){yield e.resource("uiSchemas").insert({values:o})})}const Be=e=>{const{schemaData:o,loading:n,handleSchemaChange:s}=Te(e);return n?r.jsx(M.Spin,{}):r.jsx(t.SchemaComponent,{schema:o,scope:{usePropsShowDetail:()=>({})},memoized:!0,onChange:s})},Ve={actionStyle:t.css`
1
+ (function(c,e){typeof exports=="object"&&typeof module!="undefined"?e(exports,require("@tachybase/client"),require("@tachybase/utils/client"),require("react/jsx-runtime"),require("react"),require("@tachybase/schema"),require("antd"),require("@tachybase/components"),require("@tachybase/module-workflow/client"),require("lodash"),require("@ant-design/icons"),require("react-router-dom")):typeof define=="function"&&define.amd?define(["exports","@tachybase/client","@tachybase/utils/client","react/jsx-runtime","react","@tachybase/schema","antd","@tachybase/components","@tachybase/module-workflow/client","lodash","@ant-design/icons","react-router-dom"],e):(c=typeof globalThis!="undefined"?globalThis:c||self,e(c["@tachybase/module-message"]={},c["@tachybase/client"],c["@tachybase/utils"],c.jsxRuntime,c.react,c["@tachybase/schema"],c.antd,c["@tachybase/components"],c["@tachybase/module-workflow"],c.lodash,c["@ant-design/icons"],c["react-router-dom"]))})(this,function(c,e,x,r,C,I,M,T,g,k,ee,te){"use strict";var xt=Object.defineProperty,gt=Object.defineProperties;var ht=Object.getOwnPropertyDescriptors;var W=Object.getOwnPropertySymbols;var yt=Object.prototype.hasOwnProperty,Ct=Object.prototype.propertyIsEnumerable;var z=(c,e,x)=>e in c?xt(c,e,{enumerable:!0,configurable:!0,writable:!0,value:x}):c[e]=x,f=(c,e)=>{for(var x in e||(e={}))yt.call(e,x)&&z(c,x,e[x]);if(W)for(var x of W(e))Ct.call(e,x)&&z(c,x,e[x]);return c},v=(c,e)=>gt(c,ht(e));var b=(c,e,x)=>z(c,typeof e!="symbol"?e+"":e,x);var u=(c,e,x)=>new Promise((r,C)=>{var I=g=>{try{T(x.next(g))}catch(k){C(k)}},M=g=>{try{T(x.throw(g))}catch(k){C(k)}},T=g=>g.done?r(g.value):Promise.resolve(g.value).then(I,M);T((x=x.apply(c,e)).next())});const _="message-instruction",h="message",oe="messages",ne="messages-update-badge-count",se="site-message",re="sms",ae=({children:t})=>{const o=e.useApp(),n=e.useCompile(),s=e.usePlugin(N),i=C.useMemo(()=>Array.from(s.channels.getValues()),[s]).map(a=>{var l,d;return a.send||((d=(l=a.useAction)==null?void 0:l.call(a))==null?void 0:d.send)}).filter(Boolean);return C.useEffect(()=>{I.autorun(()=>{if(o.ws.connected){const a={type:"signIn",payload:{token:o.apiClient.auth.getToken()}};o.ws.send(JSON.stringify(a))}})},[]),C.useEffect(()=>{o.ws.on("message",a=>{const l=JSON.parse(a.data);if((l==null?void 0:l.type)===oe){const d=l.payload.message,m=n(d.title),w=n(d.content),A={title:m,content:w};i.forEach(S=>S==null?void 0:S(A))}})},[]),r.jsx(r.Fragment,{children:t})};class B{constructor(){b(this,"name");b(this,"title")}}const V=()=>{const{i18n:t}=e.useApp();return{t:(n,s={})=>t.t(n,f({ns:[h,"core"]},s))}},y=t=>e.tval(t,{ns:[h,"core"]});function F(t){return e.i18n.t(t,{ns:[h,"core"]})}const K=se;class ie extends B{constructor(){super(...arguments);b(this,"name",K);b(this,"title",F("In-App Notifications"))}useAction(){const n=e.useApp();return{send:p=>{const{title:i,content:a}=p;n.notification.info({key:i,message:`${i}${a?":"+a:""}`,duration:10})}}}}class ce extends e.Plugin{load(){return u(this,null,function*(){this.app.pm.get(N).registerChannel(K,ie)})}}const $=re;class pe extends B{constructor(){super(...arguments);b(this,"name",$);b(this,"title",F("Text Message Alerts"))}}class le extends e.Plugin{load(){return u(this,null,function*(){this.app.pm.get(N).registerChannel($,pe)})}}class de extends e.Plugin{afterAdd(){return u(this,null,function*(){yield this.app.pm.add(ce),yield this.app.pm.add(le)})}load(){return u(this,null,function*(){this.app.use(ae)})}}const O="messages_providers",q={dumpRules:{group:"third-party"},name:O,shared:!0,fields:[{type:"string",name:"id",primaryKey:!0,interface:"input",uiSchema:{title:'{{t("ID")}}',type:"string","x-component":"Input",required:!0}},{type:"string",name:"title",interface:"input",uiSchema:{title:'{{t("Title")}}',type:"string","x-component":"Input",required:!0}},{type:"string",name:"type",interface:"select",uiSchema:{title:`{{t("Provider type", { ns: "${h}" })}}`,type:"string","x-component":"Select",required:!0,enum:[{label:`{{t("Aliyun SMS", { ns: "${h}" })}}`,value:"sms-aliyun"},{label:`{{t("Tencent SMS", { ns: "${h}" })}}`,value:"sms-tencent"}]}},{type:"jsonb",name:"options"},{type:"radio",name:"default",interface:"checkbox",uiSchema:{title:'{{t("Default")}}',type:"boolean","x-component":"Checkbox"}}]},me={type:"void",name:"NotificationProviders","x-component":M.Card,"x-component-props":{bordered:!1},properties:{tableCard:{type:"void",name:"tableCard","x-decorator":"ResourceActionProvider","x-decorator-props":{collection:q,resourceName:O,request:{resource:O,action:"list",params:{pageSize:50,sort:["-default","id"],appends:[]}}},"x-component":"CollectionProvider_deprecated","x-component-props":{collection:q},properties:{actions:{type:"void","x-component":"ActionBar","x-component-props":{style:{marginBottom:16}},properties:{filter:{type:"void",title:'{{ t("Filter") }}',"x-action":"filter","x-designer":"Filter.Action.Designer","x-component":"Filter.Action","x-use-component-props":"useFilterActionProps","x-component-props":{icon:"FilterOutlined"},"x-align":"left"},refresher:{type:"void",title:'{{ t("Refresh") }}',"x-action":"refresh","x-component":"Action","x-use-component-props":"useRefreshActionProps","x-designer":"Action.Designer","x-component-props":{icon:"ReloadOutlined"},"x-align":"right"},delete:{type:"void",title:'{{t("Delete")}}',"x-component":"Action","x-component-props":{icon:"DeleteOutlined",useAction:"{{ cm.useBulkDestroyAction }}",confirm:{title:"{{t('Delete')}}",content:"{{t('Are you sure you want to delete it?')}}"}}},create:{type:"void",title:'{{t("Add new")}}',"x-component":"Action","x-component-props":{type:"primary",icon:"PlusOutlined"},properties:{drawer:{type:"void","x-component":"Action.Drawer","x-decorator":"Form","x-decorator-props":{useValues(t){const o=e.useActionContext();return e.useRequest(()=>Promise.resolve({data:{name:`s_${I.uid()}`}}),v(f({},t),{refreshDeps:[o.visible]}))}},title:'{{t("Add new")}}',properties:{id:{"x-component":"CollectionField","x-decorator":"FormItem",description:'{{t("Identifier for program usage. Support letters, numbers and underscores, must start with an letter.")}}'},title:{"x-component":"CollectionField","x-decorator":"FormItem"},type:{"x-component":"CollectionField","x-decorator":"FormItem"},options:{type:"object","x-component":"ProviderOptions"},default:{"x-component":"CollectionField","x-decorator":"FormItem"},footer:{type:"void","x-component":"Action.Drawer.Footer",properties:{cancel:{title:'{{t("Cancel")}}',"x-component":"Action","x-component-props":{useAction:"{{ cm.useCancelAction }}"}},submit:{title:'{{t("Submit")}}',"x-component":"Action","x-component-props":{type:"primary",useAction:"{{ cm.useCreateAction }}"}}}}}}}}}},table:{type:"void","x-uid":"input","x-component":"Table.Void","x-component-props":{rowKey:"id",rowSelection:{type:"checkbox"},useDataSource:"{{ cm.useDataSourceFromRAC }}"},properties:{id:{type:"void","x-decorator":"Table.Column.Decorator","x-component":"Table.Column",properties:{id:{type:"string","x-component":"CollectionField","x-read-pretty":!0}}},title:{type:"void","x-decorator":"Table.Column.Decorator","x-component":"Table.Column",properties:{title:{type:"string","x-component":"CollectionField","x-read-pretty":!0}}},type:{type:"void","x-decorator":"Table.Column.Decorator","x-component":"Table.Column",properties:{type:{type:"string","x-component":"CollectionField","x-read-pretty":!0}}},default:{type:"void","x-decorator":"Table.Column.Decorator","x-component":"Table.Column",properties:{default:{type:"boolean","x-component":"CollectionField","x-read-pretty":!0}}},actions:{type:"void",title:'{{t("Actions")}}',"x-component":"Table.Column",properties:{actions:{type:"void","x-component":"Space","x-component-props":{split:"|"},properties:{update:{type:"void",title:'{{t("Edit")}}',"x-component":"Action.Link","x-component-props":{type:"primary"},properties:{drawer:{type:"void","x-component":"Action.Drawer","x-decorator":"Form","x-decorator-props":{useValues:"{{ cm.useValuesFromRecord }}"},title:'{{t("Edit")}}',properties:{id:{"x-component":"CollectionField","x-decorator":"FormItem"},title:{"x-component":"CollectionField","x-decorator":"FormItem"},type:{"x-component":"CollectionField","x-decorator":"FormItem","x-disabled":!0},options:{type:"object","x-component":"ProviderOptions"},default:{"x-component":"CollectionField","x-decorator":"FormItem"},footer:{type:"void","x-component":"Action.Drawer.Footer",properties:{cancel:{title:'{{t("Cancel")}}',"x-component":"Action","x-component-props":{useAction:"{{ cm.useCancelAction }}"}},submit:{title:'{{t("Submit")}}',"x-component":"Action","x-component-props":{type:"primary",useAction:"{{ cm.useUpdateAction }}"}}}}}}}},delete:{type:"void",title:'{{ t("Delete") }}',"x-component":"Action.Link","x-component-props":{confirm:{title:"{{t('Delete record')}}",content:"{{t('Are you sure you want to delete it?')}}"},useAction:"{{cm.useDestroyAction}}"}}}}}}}}}}}},ue={type:"object",properties:{accessKeyId:{title:`{{t("Access Key ID", { ns: "${h}" })}}`,type:"string","x-decorator":"FormItem","x-component":"Input"},accessKeySecret:{title:`{{t("Access Key Secret", { ns: "${h}" })}}`,type:"string","x-decorator":"FormItem","x-component":"Password"},endpoint:{title:`{{t("Endpoint", { ns: "${h}" })}}`,type:"string","x-decorator":"FormItem","x-component":"Input"},sign:{title:`{{t("Sign", { ns: "${h}" })}}`,type:"string","x-decorator":"FormItem","x-component":"Input"},template:{title:`{{t("Template code", { ns: "${h}" })}}`,type:"string","x-decorator":"FormItem","x-component":"Input"}}},xe={type:"object",properties:{secretId:{title:`{{t("Secret Id", { ns: "${h}" })}}`,type:"string","x-decorator":"FormItem","x-component":"Input"},secretKey:{title:`{{t("Secret Key", { ns: "${h}" })}}`,type:"string","x-decorator":"FormItem","x-component":"Password"},region:{title:`{{t("Region", { ns: "${h}" })}}`,type:"string","x-decorator":"FormItem","x-component":"Input"},endpoint:{title:`{{t("Endpoint", { ns: "${h}" })}}`,type:"string","x-decorator":"FormItem","x-component":"Input",default:"sms.tencentcloudapi.com"},SignName:{title:`{{t("Sign name", { ns: "${h}" })}}`,type:"string","x-decorator":"FormItem","x-component":"Input"},SmsSdkAppId:{title:`{{t("Sms sdk app id", { ns: "${h}" })}}`,type:"string","x-decorator":"FormItem","x-component":"Input"},TemplateId:{title:`{{t("Template Id", { ns: "${h}" })}}`,type:"string","x-decorator":"FormItem","x-component":"Input"}}},L=new x.Registry,U="sms-aliyun",ge="sms-tencent";L.register(U,ue),L.register(ge,xe);const he=U,ye=I.observer(t=>{const o=I.useForm(),n=I.useField(),[s,p]=C.useState(new I.Schema({}));return C.useEffect(()=>{o.clearFormGraph("options.*"),p(new I.Schema(L.get(o.values.type)||{}))},[o.values.type]),r.jsx(T.FormLayout,{layout:"vertical",children:r.jsx(I.RecursionField,{basePath:n.address,onlyRenderProperties:!0,schema:s},o.values.type||he)})},{displayName:"ProviderOptions"}),Ce=()=>r.jsx(e.SchemaComponent,{schema:me,components:{ProviderOptions:ye}}),Se="notification-providers";class fe extends e.Plugin{load(){return u(this,null,function*(){this.app.systemSettingsManager.add(`system-services.${Se}`,{icon:"CheckCircleOutlined",title:`{{t("Notification providers", { ns: "${h}" })}}`,aclSnippet:"pm.message.providers",Component:Ce})})}}const be=()=>{const t=e.usePlugin(N),o=Array.from(t.channels.getValues());return r.jsx(M.Card,{children:o.map(n=>r.jsx(we,{channel:n},n.name))})},we=t=>{var A,S;const{channel:o}=t,{name:n,title:s}=o,p=e.useAPIClient(),{t:i}=V(),{message:a}=M.App.useApp(),l=e.useCurrentUserContext(),d=((S=(A=l==null?void 0:l.data)==null?void 0:A.data)==null?void 0:S.subPrefs)||{},m=d[n]||{},w=D=>u(this,null,function*(){var Q;const Z=yield p.resource("users").updateProfile({values:{subPrefs:v(f({},d),{[n]:{enable:D}})}});Z.status===200&&a.success(i("Edited successfully")),l.mutate({data:f(f({},(Q=l==null?void 0:l.data)==null?void 0:Q.data),Z.data.data[0])})});return r.jsxs("p",{children:[s,r.jsx(M.Switch,{checked:m.enable,onChange:w})]})};class Ae extends e.Plugin{load(){return u(this,null,function*(){this.userSettingsManager.add("sub-manager",{title:F("Subscription management"),icon:"BellOutlined",Component:be})})}}class ve extends e.Plugin{afterAdd(){return u(this,null,function*(){yield this.app.pm.add(de),yield this.app.pm.add(fe),yield this.app.pm.add(Ae)})}}const Ie=()=>{var d;const{workflow:t}=g.useFlowContext(),[o,n]=e.parseCollectionName((d=t.config)==null?void 0:d.collection),s=e.useSchemaInitializerItem(),{insert:p}=e.useSchemaInitializer(),{getTemplateSchemaByMode:i}=e.useSchemaTemplateManager(),a=e.useRecordCollectionDataSourceItems("FormItem"),l=w=>u(this,[w],function*({item:m}){const A=m.template?yield i(m):null,S=e.createReadPrettyFormBlockSchema({actionInitializers:null,resource:n,collection:n,dataSource:o,template:A,settings:"blockSettings:details"});k.unset(S,["x-acl-action","x-acl-action-props"]);const[D]=Object.keys(S.properties);k.set(S.properties[D],"x-use-component-props","usePropsShowDetail"),p(S)});return r.jsx(e.SchemaInitializerItem,v(f({},s),{onClick:l,items:a}))};function Me(){var l;const t=e.usePlugin(g),{workflow:o}=g.useFlowContext(),n=g.useTrigger(),s=g.useContextNode(),p=g.useAvailableUpstreams(s),i=[(l=n.useInitializers)==null?void 0:l.call(n,o.config)].filter(Boolean),a=p.map(d=>{var w;const m=t.instructions.get(d.type);return(w=m==null?void 0:m.useInitializers)==null?void 0:w.call(m,d)}).filter(Boolean);return[...i,...a.length?[{name:"nodes",type:"subMenu",title:'{{t("Node result", { ns: "workflow" })}}',children:a}]:[]].filter(Boolean)}const ke=({app:t})=>{const n=t.schemaInitializerManager.get("page:addBlock").items;return new e.SchemaInitializer({name:"InitializerBlockMessage",title:"{{t('Add block')}}",wrap:e.gridRowColWrap,items:[{name:"messageCard",type:"itemGroup",title:y("Trigger data"),children:[{name:"detail",type:"item",title:'{{t("Details")}}',Component:Ie}]},{name:"dataBlocks",type:"itemGroup",title:y("Workflow Data blocks"),checkChildrenLength:!0,useChildren:Me},...n]})};class Pe extends e.Plugin{load(){return u(this,null,function*(){const o=ke({app:this.app});this.app.schemaInitializerManager.add(o)})}}function Te(t){const{value:o,onChange:n}=t,s=e.useAPIClient(),p=C.useCallback(l=>{},[]),{data:i,loading:a}=e.useRequest(()=>u(this,null,function*(){return yield De({srcId:o,onChange:n,apiClient:s})}));return{schemaData:i,loading:a,handleSchemaChange:p}}function De(s){return u(this,arguments,function*({srcId:t,onChange:o,apiClient:n}){const p=t!=null?t:x.uid(),i=Ne(p);if(t){const a=yield Fe({apiClient:n,srcId:t});if(a["x-uid"]===t)return a}else yield Ee({apiClient:n,schema:i}),o(p);return i})}function Ne(t){return{type:"void",name:t,"x-uid":t,"x-component":"Grid","x-initializer":"InitializerBlockMessage",properties:{}}}function Fe(n){return u(this,arguments,function*({apiClient:t,srcId:o}){var i;const{data:s}=yield t.request({url:`uiSchemas:getJsonSchema/${o}`});return(i=s.data)!=null?i:{}})}function Ee(n){return u(this,arguments,function*({apiClient:t,schema:o}){yield t.resource("uiSchemas").insert({values:o})})}const Be=t=>{const{schemaData:o,loading:n,handleSchemaChange:s}=Te(t);return n?r.jsx(M.Spin,{}):r.jsx(e.SchemaComponent,{schema:o,scope:{usePropsShowDetail:()=>({})},memoized:!0,onChange:s})},Ve={actionStyle:e.css`
2
2
  .ant-drawer-body {
3
3
  background: var(--tb-box-bg);
4
4
  }
5
- `},Oe={name:"drawer",type:"void",title:h("The interface of show message detail"),"x-component":"Action.Drawer","x-component-props":{className:Ve.actionStyle},properties:{showMessageDetail:{type:"string","x-component":"ViewMessageDetail"}}},j=()=>{const e=C.useContext(t.SchemaComponentContext),[,o]=C.useState(m.uid()),{workflow:n}=g.useFlowContext(),s=C.useMemo(()=>A(f({},e),{refresh:()=>o(m.uid()),designable:!n.executed}),[e,n.executed]);return r.jsx(t.SchemaComponentContext.Provider,{value:s,children:r.jsx(t.SchemaComponent,{schema:Oe,components:{ViewMessageDetail:Be}})})};t.createStyles({});const G={ArrayItemsStyle:t.css`
5
+ `},Oe={name:"drawer",type:"void",title:y("The interface of show message detail"),"x-component":"Action.Drawer","x-component-props":{className:Ve.actionStyle},properties:{showMessageDetail:{type:"string","x-component":"ViewMessageDetail"}}},j=()=>{const t=C.useContext(e.SchemaComponentContext),[,o]=C.useState(x.uid()),{workflow:n}=g.useFlowContext(),s=C.useMemo(()=>v(f({},t),{refresh:()=>o(x.uid()),designable:!n.executed}),[t,n.executed]);return r.jsx(e.SchemaComponentContext.Provider,{value:s,children:r.jsx(e.SchemaComponent,{schema:Oe,components:{ViewMessageDetail:Be}})})};e.createStyles({});const G={ArrayItemsStyle:e.css`
6
6
  &[disabled] {
7
7
  > .ant-formily-array-base-addition {
8
8
  display: none;
@@ -11,7 +11,7 @@
11
11
  display: none;
12
12
  }
13
13
  }
14
- `,SpaceStyle:t.css`
14
+ `,SpaceStyle:e.css`
15
15
  width: 100%;
16
16
  &.ant-space.ant-space-horizontal {
17
17
  flex-wrap: nowrap;
@@ -19,7 +19,7 @@
19
19
  > .ant-space-item:nth-child(2) {
20
20
  flex-grow: 1;
21
21
  }
22
- `};class Le extends g.Instruction{constructor(){super(...arguments);b(this,"title",h("Site Messages"));b(this,"type",_);b(this,"group",g.BuiltinGroupType.EXTENDED);b(this,"icon","SiteMessage");b(this,"color","#1eca0a");b(this,"description",h("In the workflow, notification messages can be viewed by the notified person in the notification center."));b(this,"components",{ArrayItems:T.ArrayItems,SelectNotifiedPerson:g.SelectNotifiedPerson,AdditionNotifiedPerson:g.AdditionNotifiedPerson,ConfigButtonMessage:g.ConfigButtonMessage,WorkflowVariableCodeMirror:g.WorkflowVariableCodeMirror,MessageDetail:j,ViewShowMessage:j});b(this,"fieldset",{notifiedPerson:{type:"array",title:h("The Notified Person"),"x-decorator":"FormItem","x-component":"ArrayItems","x-component-props":{className:G.ArrayItemsStyle},items:{type:"void","x-component":"Space","x-component-props":{className:G.SpaceStyle},properties:{sort:{type:"void","x-decorator":"FormItem","x-component":"ArrayItems.SortHandle"},input:{type:"string","x-decorator":"FormItem","x-component":"SelectNotifiedPerson"},remove:{type:"void","x-decorator":"FormItem","x-component":"ArrayItems.Remove"}}},properties:{add:{type:"void",title:h("Add Notified Person"),"x-component":"AdditionNotifiedPerson"}}},title:{type:"string",title:h("Title"),"x-decorator":"FormItem","x-component":"WorkflowVariableCodeMirror","x-component-props":{changeOnSelect:!0,height:100,options:H()}},content:{type:"string",title:h("Content"),"x-decorator":"FormItem","x-component":"WorkflowVariableCodeMirror","x-component-props":{changeOnSelect:!0,options:H()}},showMessageDetail:{type:"void",title:h("Show message detail"),"x-decorator":"FormItem","x-component":"ConfigButtonMessage",properties:{showNoticeDetail:{type:"void","x-component":"ViewShowMessage"}}}})}useCurrentFormVariables(n,s){const p=t.useCompile(),{fieldNames:i}=s;return Object.entries(this.fieldset).map(([d,u])=>({[i.label]:p(u==null?void 0:u.title)||d,[i.value]:`${d}`}))}}function H(){return[{label:h("Message variables"),value:"$messageVariables",children:[{label:h("The Notified Person"),value:"notifiedPerson",children:[{label:'{{t("Nickname")}}',value:"nickname"}]}]}]}class ze extends t.Plugin{afterAdd(){return x(this,null,function*(){yield this.app.pm.add(Pe)})}load(){return x(this,null,function*(){this.pm.get(g).registerInstruction(_,Le)})}}const P=e=>`{{t("${e}", ${JSON.stringify({ns:[y,"core"]})})}}`,E="messages",_e={dumpRules:"required",name:E,title:P("Site Messages"),sortable:!0,createdBy:!0,updatedBy:!0,logging:!0,fields:[{name:"id",type:"bigInt",autoIncrement:!0,primaryKey:!0,allowNull:!1,interface:"id"},{name:"createdAt",interface:"createdAt",type:"date",field:"createdAt",uiSchema:{type:"datetime",title:'{{t("Created at")}}',"x-component":"DatePicker","x-component-props":{showTime:!0},"x-read-pretty":!0}},{name:"title",interface:"input",type:"string",allowNull:!1,unique:!1,uiSchema:{type:"string",title:P("Title"),"x-component":"Input",required:!0}},{name:"content",interface:"input",type:"string",allowNull:!1,unique:!1,uiSchema:{type:"string",title:P("Content"),"x-component":"Input",required:!0}},{name:"collectionName",interface:"input",type:"string"},{name:"jsonContent",interface:"input",type:"jsonb",uiSchema:{type:"array",title:P("Content"),"x-component":"ShowJsonContent","x-component-props":{style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}}}},{type:"jsonb",name:"snapshot",defaultValue:{}},{name:"read",type:"boolean",interface:"checkbox",defaultValue:!1,description:P("Read"),uiSchema:{"x-component-props":{showUnchecked:!0},type:"boolean","x-component":"Checkbox",title:P("Read")}},{name:"userId",type:"bigInt",interface:"integer",isForeignKey:!0,uiSchema:{type:"number",title:"userId","x-component":"InputNumber","x-read-pretty":!0}},{name:"user",foreignKey:"userId",onDelete:"CASCADE",type:"belongsTo",interface:"m2o",uiSchema:{"x-component":"AssociationField","x-component-props":{multiple:!1,fieldNames:{label:"id",value:"id"}},title:P("User")},target:"users",targetKey:"id"},{name:"schema",type:"belongsTo",target:"uiSchemas",targetKey:"x-uid",foreignKey:"schemaName",constraints:!1}]},Ke=e=>{const{collection:o,params:n={filter:{}},action:s="list",children:p}=e,i=t.useCollectionRecordData(),a={collection:o,resource:o,action:s,params:A(f({pageSize:20,sort:["-createdAt"]},n),{filter:i!=null&&i.id?f({dataKey:`${i.id}`},n.filter):f({},n.filter)}),rowKey:"id",showIndex:!0,dragSort:!1};return r.jsx(t.ExtendCollectionsProvider,{collections:[_e],children:r.jsx(t.TableBlockProvider,A(f({name:o},a),{children:p}))})};function $e(e){const{onClick:o}=e,n=t.useAPIClient(),{refresh:s}=t.useDataBlockRequest(),p=t.useCollectionRecordData(),{id:i,read:a}=p,l=()=>x(this,null,function*(){o==null||o(),i&&!a&&(yield n.resource("messages").update({filter:{id:i},values:{read:!0}}),s())});return A(f({},e),{onClick:l})}const J=C.createContext(null),qe=J.Provider;function Ue(){return C.useContext(J)}function je(){const{snapshot:e}=Ue(),{form:o}=t.useFormBlockContext();return C.useEffect(()=>{o.setValues(e||{})},[o,e]),{form:o}}const Ge=e=>{const{message:o}=e;return r.jsx(qe,{value:o,children:e.children})},He=e=>{const{id:o,schemaName:n}=e;return{name:`messages-content-${o}`,type:"void","x-component":"Tabs",properties:{tab1:{type:"void",title:h("Details"),"x-component":"Tabs.TabPane",properties:{schemaName:{type:"void","x-decorator":"ProviderSchemaComponentContext","x-decorator-props":{designable:!1},"x-component":"RemoteSchemaComponent","x-component-props":{uid:n,noForm:!0}}}}}}},Je=e=>{const{designable:o,children:n}=e,s=t.useSchemaComponentContext();return r.jsx(t.SchemaComponentContext.Provider,{value:A(f({},s),{designable:o}),children:n})},Ye=e=>{const{message:o}=e,n=He(o);return r.jsx(t.SchemaComponent,{schema:n,components:{ProviderSchemaComponentContext:Je,RemoteSchemaComponent:t.RemoteSchemaComponent}})},Re=()=>{const e=t.useCollectionRecordData();return r.jsx(Ge,{message:e,children:r.jsx(Ye,{message:e})})},Xe=e=>{const{record:o,popoverComponent:n,popoverComponentProps:s}=e;return{name:`view-${o.id}`,type:"void",title:'{{t("View", {"ns":["messages","client"]})}}',"x-action":"view","x-decorator":"ACLActionProvider","x-component":"Action.Link","x-component-props":{openMode:"drawer"},"x-use-component-props":"usePropsCheckLink",properties:{drawer:{type:"void",title:'{{t("View record", {"ns":["messages","client"]})}}',"x-component":n,"x-component-props":f({className:"tb-action-popup"},s),properties:{checkContent:{"x-component":"CheckContent"}}}}}},Ze=e=>{const{popoverComponent:o="Action.Drawer",popoverComponentProps:n={}}=e,s=t.useCollectionRecordData(),p=Xe({record:s,popoverComponent:o,popoverComponentProps:n});return r.jsx(t.SchemaComponent,{schema:p,components:{CheckContent:Re},scope:{usePropsCheckLink:$e,usePropsShowDetail:je}})},Qe=t.createStyles(({css:e})=>({columnShowJSON:e`
22
+ `};class Le extends g.Instruction{constructor(){super(...arguments);b(this,"title",y("Site Messages"));b(this,"type",_);b(this,"group",g.BuiltinGroupType.EXTENDED);b(this,"icon","SiteMessage");b(this,"color","#1eca0a");b(this,"description",y("In the workflow, notification messages can be viewed by the notified person in the notification center."));b(this,"components",{ArrayItems:T.ArrayItems,SelectNotifiedPerson:g.SelectNotifiedPerson,AdditionNotifiedPerson:g.AdditionNotifiedPerson,ConfigButtonMessage:g.ConfigButtonMessage,WorkflowVariableCodeMirror:g.WorkflowVariableCodeMirror,MessageDetail:j,ViewShowMessage:j});b(this,"fieldset",{notifiedPerson:{type:"array",title:y("The Notified Person"),"x-decorator":"FormItem","x-component":"ArrayItems","x-component-props":{className:G.ArrayItemsStyle},items:{type:"void","x-component":"Space","x-component-props":{className:G.SpaceStyle},properties:{sort:{type:"void","x-decorator":"FormItem","x-component":"ArrayItems.SortHandle"},input:{type:"string","x-decorator":"FormItem","x-component":"SelectNotifiedPerson"},remove:{type:"void","x-decorator":"FormItem","x-component":"ArrayItems.Remove"}}},properties:{add:{type:"void",title:y("Add Notified Person"),"x-component":"AdditionNotifiedPerson"}}},title:{type:"string",title:y("Title"),"x-decorator":"FormItem","x-component":"WorkflowVariableCodeMirror","x-component-props":{changeOnSelect:!0,height:100,options:H()}},content:{type:"string",title:y("Content"),"x-decorator":"FormItem","x-component":"WorkflowVariableCodeMirror","x-component-props":{changeOnSelect:!0,options:H()}},showMessageDetail:{type:"void",title:y("Show message detail"),"x-decorator":"FormItem","x-component":"ConfigButtonMessage",properties:{showNoticeDetail:{type:"void","x-component":"ViewShowMessage"}}}})}useCurrentFormVariables(n,s){const p=e.useCompile(),{fieldNames:i}=s;return Object.entries(this.fieldset).map(([d,m])=>({[i.label]:p(m==null?void 0:m.title)||d,[i.value]:`${d}`}))}}function H(){return[{label:y("Message variables"),value:"$messageVariables",children:[{label:y("The Notified Person"),value:"notifiedPerson",children:[{label:'{{t("Nickname")}}',value:"nickname"}]}]}]}class ze extends e.Plugin{afterAdd(){return u(this,null,function*(){yield this.app.pm.add(Pe)})}load(){return u(this,null,function*(){this.pm.get(g).registerInstruction(_,Le)})}}const P=t=>`{{t("${t}", ${JSON.stringify({ns:[h,"core"]})})}}`,E="messages",_e={dumpRules:"required",name:E,title:P("Site Messages"),sortable:!0,createdBy:!0,updatedBy:!0,logging:!0,fields:[{name:"id",type:"bigInt",autoIncrement:!0,primaryKey:!0,allowNull:!1,interface:"id"},{name:"createdAt",interface:"createdAt",type:"date",field:"createdAt",uiSchema:{type:"datetime",title:'{{t("Created at")}}',"x-component":"DatePicker","x-component-props":{showTime:!0},"x-read-pretty":!0}},{name:"title",interface:"input",type:"string",allowNull:!1,unique:!1,uiSchema:{type:"string",title:P("Title"),"x-component":"Input",required:!0}},{name:"content",interface:"input",type:"string",allowNull:!1,unique:!1,uiSchema:{type:"string",title:P("Content"),"x-component":"Input",required:!0}},{name:"collectionName",interface:"input",type:"string"},{name:"jsonContent",interface:"input",type:"jsonb",uiSchema:{type:"array",title:P("Content"),"x-component":"ShowJsonContent","x-component-props":{style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}}}},{type:"jsonb",name:"snapshot",defaultValue:{}},{name:"read",type:"boolean",interface:"checkbox",defaultValue:!1,description:P("Read"),uiSchema:{"x-component-props":{showUnchecked:!0},type:"boolean","x-component":"Checkbox",title:P("Read")}},{name:"userId",type:"bigInt",interface:"integer",isForeignKey:!0,uiSchema:{type:"number",title:"userId","x-component":"InputNumber","x-read-pretty":!0}},{name:"user",foreignKey:"userId",onDelete:"CASCADE",type:"belongsTo",interface:"m2o",uiSchema:{"x-component":"AssociationField","x-component-props":{multiple:!1,fieldNames:{label:"id",value:"id"}},title:P("User")},target:"users",targetKey:"id"},{name:"schema",type:"belongsTo",target:"uiSchemas",targetKey:"x-uid",foreignKey:"schemaName",constraints:!1}]},Ke=t=>{const{collection:o,params:n={filter:{}},action:s="list",children:p}=t,i=e.useCollectionRecordData(),a={collection:o,resource:o,action:s,params:v(f({pageSize:20,sort:["-createdAt"]},n),{filter:i!=null&&i.id?f({dataKey:`${i.id}`},n.filter):f({},n.filter)}),rowKey:"id",showIndex:!0,dragSort:!1};return r.jsx(e.ExtendCollectionsProvider,{collections:[_e],children:r.jsx(e.TableBlockProvider,v(f({name:o},a),{children:p}))})};function $e(t){const{onClick:o}=t,n=e.useAPIClient(),{refresh:s}=e.useDataBlockRequest(),p=e.useCollectionRecordData(),{id:i,read:a}=p,l=()=>u(this,null,function*(){o==null||o(),i&&!a&&(yield n.resource("messages").update({filter:{id:i},values:{read:!0}}),s())});return v(f({},t),{onClick:l})}const J=C.createContext(null),qe=J.Provider;function Ue(){return C.useContext(J)}function je(){const{snapshot:t}=Ue(),{form:o}=e.useFormBlockContext();return C.useEffect(()=>{o.setValues(t||{})},[o,t]),{form:o}}const Ge=t=>{const{record:o}=t,n=e.useSchemaComponentContext(),{schemaName:s}=o;return r.jsx(qe,{value:o,children:r.jsx(e.SchemaComponentContext.Provider,{value:v(f({},n),{designable:!1}),children:r.jsx(e.RemoteSchemaComponent,{uid:s,noForm:!0})})})},He=t=>{const{record:o}=t;return{name:`view-${o.id}`,type:"void",title:'{{t("View", {"ns":["messages","client"]})}}',"x-action":"view","x-decorator":"ACLActionProvider","x-component":"Action.Link","x-component-props":{openMode:"drawer"},"x-use-component-props":"usePropsCheckLink",properties:{drawer:{type:"void",title:'{{t("View record", {"ns":["messages","client"]})}}',"x-component":"Action.Drawer","x-component-props":{className:"tb-action-popup"},properties:{checkContent:{type:"void","x-component":"ViewCheckContent","x-component-props":{record:o}}}}}}},Je=()=>{const t=e.useCollectionRecordData(),o=He({record:t});return r.jsx(e.SchemaComponent,{schema:o,components:{ViewCheckContent:Ge},scope:{usePropsCheckLink:$e,usePropsShowDetail:je}})},Ye=e.createStyles(({css:t})=>({columnShowJSON:t`
23
23
  text-align: left;
24
24
  .json-item {
25
25
  display: flex;
@@ -41,4 +41,4 @@
41
41
  text-overflow: ellipsis;
42
42
  }
43
43
  }
44
- `})),We=e=>{const{value:o}=e,n=t.useCollectionRecordData(),s=t.useCollectionManager(),p=t.useCompile(),{styles:i}=Qe(),{collectionName:a}=n,l=C.useMemo(()=>Object.entries(o||{}).map(([d,u])=>{var S,D;const w=s.getCollectionField(`${a}.${d}`),v=Object.prototype.toString.call(u)==="[object Object]"?u==null?void 0:u.name:u;return tt(v)?{label:p(((S=w==null?void 0:w.uiSchema)==null?void 0:S.title)||d),value:ot(v)}:{label:p(((D=w==null?void 0:w.uiSchema)==null?void 0:D.title)||d),value:v}}),[]);return r.jsx("div",{className:i.columnShowJSON,children:l.map(d=>r.jsxs("div",{className:"json-item",children:[r.jsxs("div",{className:"item-label",children:[`${d.label}:`,"   "]}),r.jsx("div",{className:"item-value",children:d.value})]},d.label))})},et=/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}Z$/;function tt(e=""){return et.test(e)}function ot(e){return m.dayjs.utc(e).local().format("YYYY-MM-DD HH:mm:ss")}const nt=()=>{const{t:e}=V(),o=t.useCollectionRecordData(),{schemaName:n}=o||{},s=`${location.origin}/r/${n}`;return r.jsx("a",{href:s,target:"_blank",children:e("External link")})},st=e=>{const{record:o}=e;return{name:`delete-${o.id}`,type:"void",title:'{{ t("Delete") }}',"x-action":"destroy","x-component":"Action.Link","x-use-component-props":"useDestroyActionProps","x-component-props":{icon:"DeleteOutlined",confirm:{title:"{{t('Delete record')}}",content:"{{t('Are you sure you want to delete it?')}}"}},"x-action-settings":{triggerWorkflows:[]},"x-decorator":"ACLActionProvider"}},rt=e=>{const o=t.useCollectionRecordData(),n=st({record:o});return r.jsx(t.SchemaComponent,{schema:n})},at={type:"void",name:"schemaTableMessages",properties:{actions:{type:"void","x-component":"ActionBar","x-component-props":{style:{marginBottom:"var(--tb-spacing)"}},properties:{filter:{type:"void",title:'{{ t("Filter") }}',"x-action":"filter","x-component":"Filter.Action","x-component-props":{icon:"FilterOutlined"},"x-use-component-props":"useFilterActionProps","x-align":"left"},refresher:{type:"void",title:'{{ t("Refresh") }}',"x-action":"refresh","x-component":"Action","x-use-component-props":"useRefreshActionProps","x-component-props":{icon:"ReloadOutlined"},"x-align":"right"},delete:{type:"void",title:'{{ t("Delete") }}',"x-action":"destroy","x-component":"Action","x-decorator":"ACLActionProvider","x-acl-action-props":{skipScopeCheck:!0},"x-use-component-props":"useBulkDestroyActionProps","x-component-props":{icon:"DeleteOutlined",confirm:{title:"{{t('Delete record')}}",content:"{{t('Are you sure you want to delete it?')}}"}},"x-acl-action":"messages:destroy","x-align":"right"},setHaveReaded:{type:"void",title:h("Mark as read"),"x-action":"customize:bulkUpdate","x-action-settings":{assignedValues:{read:!0},updateMode:"selected",onSuccess:{manualClose:!0,redirecting:!1,successMessage:'{{t("Updated successfully")}}'}},"x-component":"Action","x-use-component-props":"useCustomizeBulkUpdateActionProps","x-component-props":{icon:"InboxOutlined"},"x-align":"right"},setAllHaveReaded:{type:"void",title:h("Mark all as read"),"x-component":"Action","x-use-component-props":"useCustomizeBulkUpdateActionProps","x-component-props":{icon:"InboxOutlined"},"x-action":"customize:bulkUpdate","x-action-settings":{assignedValues:{read:!0},updateMode:"all",onSuccess:{manualClose:!0,redirecting:!1,successMessage:'{{t("Updated successfully")}}'}},"x-align":"right"}}},table:{type:"array","x-component":"TableV2","x-component-props":{rowKey:"id",rowSelection:{type:"checkbox"}},"x-use-component-props":"useTableBlockProps",properties:{actions:{type:"void",title:'{{ t("Actions") }}',"x-action-column":"actions","x-decorator":"TableV2.Column.ActionBar","x-component":"TableV2.Column","x-component-props":{width:50,align:"center"},"x-designer":"TableV2.ActionColumnDesigner","x-initializer":"MessageTable:configureItemActions",properties:{actionList:{type:"void","x-decorator":"DndContext","x-component":"Space","x-component-props":{split:"|"},properties:{checkLink:{"x-component":"ViewCheckLink"},delete:{"x-component":"ViewDeleteLink"}}}}},read:{type:"void",title:h("Read"),"x-decorator":"TableV2.Column.Decorator","x-component":"TableV2.Column","x-component-props":{width:20,align:"center"},properties:{read:{type:"boolean","x-component":"CollectionField","x-read-pretty":!0,"x-component-props":{showUnchecked:!0}}}},createdAt:{type:"void",title:h("Created at"),"x-decorator":"TableV2.Column.Decorator","x-component":"TableV2.Column","x-component-props":{width:100,align:"center"},properties:{createdAt:{type:"string","x-component":"CollectionField","x-read-pretty":!0}}},title:{type:"void",title:h("Title"),"x-decorator":"TableV2.Column.Decorator","x-component":"TableV2.Column","x-component-props":{width:100,align:"center"},properties:{title:{type:"string","x-component":"CollectionField","x-read-pretty":!0}}},content:{type:"void",title:h("Content"),"x-decorator":"TableV2.Column.Decorator","x-component":"TableV2.Column","x-component-props":{width:100,align:"center"},properties:{content:{type:"string","x-component":"CollectionField","x-read-pretty":!0}}},jsonContent:{type:"void",title:h("Summary"),"x-decorator":"TableV2.Column.Decorator","x-component":"TableV2.Column","x-component-props":{width:350,align:"center"},properties:{jsonContent:{type:"string","x-component":"ColumnShowJSON"}}},url:{type:"void",title:h("URL"),"x-decorator":"TableV2.Column.Decorator","x-component":"TableV2.Column","x-component-props":{width:100,align:"center"},properties:{url:{type:"string","x-component":"ColumnShowURL"}}}}}}},it=()=>r.jsx(t.SchemaComponent,{schema:at,components:{ViewCheckLink:Ze,ViewDeleteLink:rt,ColumnShowURL:nt,ColumnShowJSON:We}}),Y=e=>{const{params:o}=e||{},n=m.uid();return{name:n,type:"void","x-uid":n,"x-decorator":"Messages-ProviderCollectionMessages","x-decorator-props":{collection:E,action:"list",params:o},"x-component":"CardItem","x-acl-action":"messages:list","x-toolbar":"BlockSchemaToolbar","x-settings":"blockSettings:table",properties:{block:{type:"void","x-component":"Messages-ViewTableMessages"}}}},ct=()=>{const e=t.useSchemaInitializerItem(),{insert:o}=t.useSchemaInitializer(),n=()=>{const s=Y();o(s)};return r.jsx(t.SchemaInitializerItem,A(f({},e),{onClick:n}))},R="otherBlocks.messages",X={name:"messageBlock",type:"item",title:t.tval("Site Messages"),icon:"BellOutlined",Component:"Messages-ViewBlockInitItem",collection:E,params:{appends:[]}};class pt extends t.Plugin{load(){return x(this,null,function*(){this.app.addComponents({"Messages-ViewBlockInitItem":ct}),this.app.schemaInitializerManager.get("page:addBlock").add(R,X),this.app.schemaInitializerManager.get("popup:common:addBlock").add(R,X)})}}const lt=e=>{const o=Y(e);return r.jsx(t.SchemaComponent,{schema:o})},dt={type:"void",properties:{page:{type:"void","x-component":"Page",title:F("Site Messages"),properties:{messages:{type:"void","x-component":"ViewTableMessagesWrapper"}}}}},mt=()=>{const e=t.useSchemaComponentContext();return r.jsx(t.SchemaComponentContext.Provider,{value:A(f({},e),{designable:!1}),children:r.jsx(t.SchemaComponent,{schema:dt,components:{ViewTableMessagesWrapper:lt}})})};class ut extends t.Plugin{load(){return x(this,null,function*(){this.addRouters()})}addRouters(){this.app.router.add("app.messages",{path:"messages",Component:mt})}}function xt(e=0){var d;const o=t.useAPIClient(),n=t.useCurrentUserContext(),s=(d=n==null?void 0:n.data)==null?void 0:d.data,[p,i]=C.useState(e),a=()=>x(this,null,function*(){var v,S;const u=yield o.request({resource:E,action:"count",params:{filter:{read:!1,userId:s==null?void 0:s.id}}}),w=(S=(v=u==null?void 0:u.data)==null?void 0:v.data)!=null?S:0;i(w)}),l=C.useMemo(()=>k.debounce(a,300),[a]);return t.useNoticeSub(ne,()=>{l()}),C.useEffect(()=>{a()},[]),{badgeCount:p}}const gt=()=>{const e=te.useNavigate(),{token:o}=t.useToken(),{t:n}=V(),{badgeCount:s}=xt(),p=()=>e("/admin/messages");return r.jsx(M.Tooltip,{title:n("Site Messages"),children:r.jsx(M.Badge,{count:s,overflowCount:99,offset:["-10%","40%"],size:"small",children:r.jsx(M.Button,{icon:r.jsx(ee.BellOutlined,{style:{color:o.colorTextHeaderMenu}}),title:n("Site Messages"),onClick:p})})})},ht=e=>r.jsx(t.PinnedPluginListProvider,{items:{nl:{order:220,component:"NotificationLink",pin:!0,isPublic:!0}},children:r.jsx(t.SchemaComponentOptions,{components:{NotificationLink:gt},children:e.children})});class yt extends t.Plugin{afterAdd(){return x(this,null,function*(){this.app.use(ht),yield this.app.pm.add(ut),yield this.app.pm.add(pt)})}load(){return x(this,null,function*(){this.app.addComponents({"Messages-ProviderCollectionMessages":Ke,"Messages-ViewTableMessages":it}),this.app.addScopes({useSubmit:()=>({run(){return x(this,null,function*(){})}})})})}}class N extends t.Plugin{constructor(){super(...arguments);b(this,"channels",new m.Registry)}registerChannel(n,s){if(typeof s=="function")this.channels.register(n,new s);else if(s instanceof B)this.channels.register(n,s);else throw new TypeError("invalid channel type to register")}afterAdd(){return x(this,null,function*(){yield this.app.pm.add(Ae),yield this.app.pm.add(ze),yield this.app.pm.add(yt)})}}c.default=N,Object.defineProperties(c,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
44
+ `})),Re=t=>{const{value:o}=t,n=e.useCollectionRecordData(),s=e.useCollectionManager(),p=e.useCompile(),{styles:i}=Ye(),{collectionName:a}=n,l=C.useMemo(()=>Object.entries(o||{}).map(([d,m])=>{var S,D;const w=s.getCollectionField(`${a}.${d}`),A=Object.prototype.toString.call(m)==="[object Object]"?m==null?void 0:m.name:m;return Ze(A)?{label:p(((S=w==null?void 0:w.uiSchema)==null?void 0:S.title)||d),value:Qe(A)}:{label:p(((D=w==null?void 0:w.uiSchema)==null?void 0:D.title)||d),value:A}}),[]);return r.jsx("div",{className:i.columnShowJSON,children:l.map(d=>r.jsxs("div",{className:"json-item",children:[r.jsxs("div",{className:"item-label",children:[`${d.label}:`,"   "]}),r.jsx("div",{className:"item-value",children:d.value})]},d.label))})},Xe=/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}Z$/;function Ze(t=""){return Xe.test(t)}function Qe(t){return x.dayjs.utc(t).local().format("YYYY-MM-DD HH:mm:ss")}const We=()=>{const{t}=V(),o=e.useCollectionRecordData(),{schemaName:n}=o||{},s=`${location.origin}/r/${n}`;return r.jsx("a",{href:s,target:"_blank",children:t("External link")})},et=t=>{const{record:o}=t;return{name:`delete-${o.id}`,type:"void",title:'{{ t("Delete") }}',"x-action":"destroy","x-component":"Action.Link","x-use-component-props":"useDestroyActionProps","x-component-props":{icon:"DeleteOutlined",confirm:{title:"{{t('Delete record')}}",content:"{{t('Are you sure you want to delete it?')}}"}},"x-action-settings":{triggerWorkflows:[]},"x-decorator":"ACLActionProvider"}},tt=t=>{const o=e.useCollectionRecordData(),n=et({record:o});return r.jsx(e.SchemaComponent,{schema:n})},ot={type:"void",name:"schemaTableMessages",properties:{actions:{type:"void","x-component":"ActionBar","x-component-props":{style:{marginBottom:"var(--tb-spacing)"}},properties:{filter:{type:"void",title:'{{ t("Filter") }}',"x-action":"filter","x-component":"Filter.Action","x-component-props":{icon:"FilterOutlined"},"x-use-component-props":"useFilterActionProps","x-align":"left"},refresher:{type:"void",title:'{{ t("Refresh") }}',"x-action":"refresh","x-component":"Action","x-use-component-props":"useRefreshActionProps","x-component-props":{icon:"ReloadOutlined"},"x-align":"right"},delete:{type:"void",title:'{{ t("Delete") }}',"x-action":"destroy","x-component":"Action","x-decorator":"ACLActionProvider","x-acl-action-props":{skipScopeCheck:!0},"x-use-component-props":"useBulkDestroyActionProps","x-component-props":{icon:"DeleteOutlined",confirm:{title:"{{t('Delete record')}}",content:"{{t('Are you sure you want to delete it?')}}"}},"x-acl-action":"messages:destroy","x-align":"right"},setHaveReaded:{type:"void",title:y("Mark as read"),"x-action":"customize:bulkUpdate","x-action-settings":{assignedValues:{read:!0},updateMode:"selected",onSuccess:{manualClose:!0,redirecting:!1,successMessage:'{{t("Updated successfully")}}'}},"x-component":"Action","x-use-component-props":"useCustomizeBulkUpdateActionProps","x-component-props":{icon:"InboxOutlined"},"x-align":"right"},setAllHaveReaded:{type:"void",title:y("Mark all as read"),"x-component":"Action","x-use-component-props":"useCustomizeBulkUpdateActionProps","x-component-props":{icon:"InboxOutlined"},"x-action":"customize:bulkUpdate","x-action-settings":{assignedValues:{read:!0},updateMode:"all",onSuccess:{manualClose:!0,redirecting:!1,successMessage:'{{t("Updated successfully")}}'}},"x-align":"right"}}},table:{type:"array","x-component":"TableV2","x-component-props":{rowKey:"id",rowSelection:{type:"checkbox"}},"x-use-component-props":"useTableBlockProps",properties:{actions:{type:"void",title:'{{ t("Actions") }}',"x-action-column":"actions","x-decorator":"TableV2.Column.ActionBar","x-component":"TableV2.Column","x-component-props":{width:50,align:"center"},"x-designer":"TableV2.ActionColumnDesigner","x-initializer":"MessageTable:configureItemActions",properties:{actionList:{type:"void","x-decorator":"DndContext","x-component":"Space","x-component-props":{split:"|"},properties:{checkLink:{"x-component":"ViewCheckLink"},delete:{"x-component":"ViewDeleteLink"}}}}},read:{type:"void",title:y("Read"),"x-decorator":"TableV2.Column.Decorator","x-component":"TableV2.Column","x-component-props":{width:20,align:"center"},properties:{read:{type:"boolean","x-component":"CollectionField","x-read-pretty":!0,"x-component-props":{showUnchecked:!0}}}},createdAt:{type:"void",title:y("Created at"),"x-decorator":"TableV2.Column.Decorator","x-component":"TableV2.Column","x-component-props":{width:100,align:"center"},properties:{createdAt:{type:"string","x-component":"CollectionField","x-read-pretty":!0}}},title:{type:"void",title:y("Title"),"x-decorator":"TableV2.Column.Decorator","x-component":"TableV2.Column","x-component-props":{width:100,align:"center"},properties:{title:{type:"string","x-component":"CollectionField","x-read-pretty":!0}}},content:{type:"void",title:y("Content"),"x-decorator":"TableV2.Column.Decorator","x-component":"TableV2.Column","x-component-props":{width:100,align:"center"},properties:{content:{type:"string","x-component":"CollectionField","x-read-pretty":!0}}},jsonContent:{type:"void",title:y("Summary"),"x-decorator":"TableV2.Column.Decorator","x-component":"TableV2.Column","x-component-props":{width:350,align:"center"},properties:{jsonContent:{type:"string","x-component":"ColumnShowJSON"}}},url:{type:"void",title:y("URL"),"x-decorator":"TableV2.Column.Decorator","x-component":"TableV2.Column","x-component-props":{width:100,align:"center"},properties:{url:{type:"string","x-component":"ColumnShowURL"}}}}}}},nt=()=>r.jsx(e.SchemaComponent,{schema:ot,components:{ViewCheckLink:Je,ViewDeleteLink:tt,ColumnShowURL:We,ColumnShowJSON:Re}}),Y=t=>{const{params:o}=t||{};return{type:"void",name:"message-table","x-uid":"message-table","x-decorator":"Messages-ProviderCollectionMessages","x-decorator-props":{collection:E,action:"list",params:o},"x-component":"CardItem","x-acl-action":"messages:list","x-toolbar":"BlockSchemaToolbar","x-settings":"blockSettings:table",properties:{block:{type:"void","x-component":"Messages-ViewTableMessages"}}}},st=()=>{const t=e.useSchemaInitializerItem(),{insert:o}=e.useSchemaInitializer(),n=()=>{const s=Y();o(s)};return r.jsx(e.SchemaInitializerItem,v(f({},t),{onClick:n}))},R="otherBlocks.messages",X={name:"messageBlock",type:"item",title:e.tval("Site Messages"),icon:"BellOutlined",Component:"Messages-ViewBlockInitItem",collection:E,params:{appends:[]}};class rt extends e.Plugin{load(){return u(this,null,function*(){this.app.addComponents({"Messages-ViewBlockInitItem":st}),this.app.schemaInitializerManager.get("page:addBlock").add(R,X),this.app.schemaInitializerManager.get("popup:common:addBlock").add(R,X)})}}const at=t=>{const o=Y(t);return r.jsx(e.SchemaComponent,{memoized:!0,schema:o})},it={type:"void",properties:{page:{type:"void","x-component":"Page",title:F("Site Messages"),properties:{messages:{type:"void","x-component":"ViewTableMessagesWrapper"}}}}},ct=()=>{const t=e.useSchemaComponentContext();return r.jsx(e.SchemaComponentContext.Provider,{value:v(f({},t),{designable:!1}),children:r.jsx(e.SchemaComponent,{schema:it,components:{ViewTableMessagesWrapper:at}})})};class pt extends e.Plugin{load(){return u(this,null,function*(){this.addRouters()})}addRouters(){this.app.router.add("app.messages",{path:"messages",Component:ct})}}function lt(t=0){var d;const o=e.useAPIClient(),n=e.useCurrentUserContext(),s=(d=n==null?void 0:n.data)==null?void 0:d.data,[p,i]=C.useState(t),a=()=>u(this,null,function*(){var A,S;const m=yield o.request({resource:E,action:"count",params:{filter:{read:!1,userId:s==null?void 0:s.id}}}),w=(S=(A=m==null?void 0:m.data)==null?void 0:A.data)!=null?S:0;i(w)}),l=C.useMemo(()=>k.debounce(a,300),[a]);return e.useNoticeSub(ne,()=>{l()}),C.useEffect(()=>{a()},[]),{badgeCount:p}}const dt=()=>{const t=te.useNavigate(),{token:o}=e.useToken(),{t:n}=V(),{badgeCount:s}=lt(),p=()=>t("/admin/messages");return r.jsx(M.Tooltip,{title:n("Site Messages"),children:r.jsx(M.Badge,{count:s,overflowCount:99,offset:["-10%","40%"],size:"small",children:r.jsx(M.Button,{icon:r.jsx(ee.BellOutlined,{style:{color:o.colorTextHeaderMenu}}),title:n("Site Messages"),onClick:p})})})},mt=t=>r.jsx(e.PinnedPluginListProvider,{items:{nl:{order:220,component:"NotificationLink",pin:!0,isPublic:!0}},children:r.jsx(e.SchemaComponentOptions,{components:{NotificationLink:dt},children:t.children})});class ut extends e.Plugin{afterAdd(){return u(this,null,function*(){this.app.use(mt),yield this.app.pm.add(pt),yield this.app.pm.add(rt)})}load(){return u(this,null,function*(){this.app.addComponents({"Messages-ProviderCollectionMessages":Ke,"Messages-ViewTableMessages":nt}),this.app.addScopes({useSubmit:()=>({run(){return u(this,null,function*(){})}})})})}}class N extends e.Plugin{constructor(){super(...arguments);b(this,"channels",new x.Registry)}registerChannel(n,s){if(typeof s=="function")this.channels.register(n,new s);else if(s instanceof B)this.channels.register(n,s);else throw new TypeError("invalid channel type to register")}afterAdd(){return u(this,null,function*(){yield this.app.pm.add(ve),yield this.app.pm.add(ze),yield this.app.pm.add(ut)})}}c.default=N,Object.defineProperties(c,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
@@ -13,11 +13,17 @@ export declare const getSchemaCheckLink: (params: any) => {
13
13
  drawer: {
14
14
  type: string;
15
15
  title: string;
16
- 'x-component': any;
17
- 'x-component-props': any;
16
+ 'x-component': string;
17
+ 'x-component-props': {
18
+ className: string;
19
+ };
18
20
  properties: {
19
21
  checkContent: {
22
+ type: string;
20
23
  'x-component': string;
24
+ 'x-component-props': {
25
+ record: any;
26
+ };
21
27
  };
22
28
  };
23
29
  };
@@ -1,2 +1,2 @@
1
1
  import React from 'react';
2
- export declare const ViewCheckLink: (props: any) => React.JSX.Element;
2
+ export declare const ViewCheckLink: () => React.JSX.Element;
@@ -1,6 +1,6 @@
1
1
  export declare const getSchemaTableMessagesWrapper: (props?: any) => {
2
- name: string;
3
2
  type: string;
3
+ name: string;
4
4
  'x-uid': string;
5
5
  'x-decorator': string;
6
6
  'x-decorator-props': {
@@ -1,14 +1,14 @@
1
1
  module.exports = {
2
- "@tachybase/client": "0.23.8",
3
- "@tachybase/utils": "0.23.8",
4
- "@tachybase/database": "0.23.8",
5
- "@tachybase/server": "0.23.8",
6
- "@tachybase/module-workflow": "0.23.8",
2
+ "@tachybase/client": "0.23.16",
3
+ "@tachybase/utils": "0.23.16",
4
+ "@tachybase/database": "0.23.16",
5
+ "@tachybase/server": "0.23.16",
6
+ "@tachybase/module-workflow": "0.23.16",
7
7
  "jsonwebtoken": "8.5.1",
8
- "@tachybase/components": "0.23.8",
8
+ "@tachybase/components": "0.23.16",
9
9
  "react": "18.3.1",
10
- "@tachybase/actions": "0.23.8",
11
- "@tachybase/schema": "0.23.8",
10
+ "@tachybase/actions": "0.23.16",
11
+ "@tachybase/schema": "0.23.16",
12
12
  "antd": "5.22.5",
13
13
  "lodash": "4.17.21",
14
14
  "@ant-design/icons": "5.3.7",
@@ -1 +1 @@
1
- {"name":"@alicloud/dysmsapi20170525","version":"2.0.24","description":"","main":"dist/client.js","scripts":{"test":"mocha --reporter spec --timeout 3000 test/*.test.js","test-cov":"nyc -e .ts -r=html -r=text -r=lcov npm run test","build":"tsc","prepublishOnly":"tsc"},"author":"Alibaba Cloud SDK","license":"Apache-2.0","devDependencies":{"@types/node":"^12.12.26","nyc":"^15.0.0","source-map-support":"^0.5.16","ts-node":"^8.6.2","typescript":"^3.7.5"},"dependencies":{"@alicloud/tea-typescript":"^1.7.1","@alicloud/tea-util":"^1.4.7","@alicloud/openapi-client":"^0.4.4","@alicloud/openapi-util":"^0.3.1","@alicloud/endpoint-util":"^0.0.1"},"files":["dist","src"],"_lastModified":"2024-12-22T16:07:41.039Z"}
1
+ {"name":"@alicloud/dysmsapi20170525","version":"2.0.24","description":"","main":"dist/client.js","scripts":{"test":"mocha --reporter spec --timeout 3000 test/*.test.js","test-cov":"nyc -e .ts -r=html -r=text -r=lcov npm run test","build":"tsc","prepublishOnly":"tsc"},"author":"Alibaba Cloud SDK","license":"Apache-2.0","devDependencies":{"@types/node":"^12.12.26","nyc":"^15.0.0","source-map-support":"^0.5.16","ts-node":"^8.6.2","typescript":"^3.7.5"},"dependencies":{"@alicloud/tea-typescript":"^1.7.1","@alicloud/tea-util":"^1.4.7","@alicloud/openapi-client":"^0.4.4","@alicloud/openapi-util":"^0.3.1","@alicloud/endpoint-util":"^0.0.1"},"files":["dist","src"],"_lastModified":"2024-12-26T07:41:29.106Z"}
@@ -1 +1 @@
1
- {"name":"@alicloud/openapi-client","version":"0.4.12","description":"","main":"dist/client.js","scripts":{"test":"mocha -r ts-node/register -r source-map-support/register test/**/*.spec.ts --timeout=10000","test-cov":"nyc -e .ts -r=html -r=text -r=lcov npm run test","build":"tsc","prepublishOnly":"tsc"},"author":"","license":"ISC","devDependencies":{"@types/mocha":"^5.2.7","mocha":"^6.2.0","@types/node":"^12.12.26","nyc":"^15.0.0","source-map-support":"^0.5.16","ts-node":"^8.6.2","typescript":"^3.7.5","@alicloud/gateway-pop":"0.0.6"},"dependencies":{"@alicloud/tea-typescript":"^1.7.1","@alicloud/tea-util":"^1.4.9","@alicloud/credentials":"^2.3.1","@alicloud/openapi-util":"^0.3.2","@alicloud/gateway-spi":"^0.0.8","@alicloud/tea-xml":"0.0.3"},"files":["dist","src"],"repository":"git@github.com:aliyun/darabonba-openapi.git","_lastModified":"2024-12-22T16:07:41.420Z"}
1
+ {"name":"@alicloud/openapi-client","version":"0.4.12","description":"","main":"dist/client.js","scripts":{"test":"mocha -r ts-node/register -r source-map-support/register test/**/*.spec.ts --timeout=10000","test-cov":"nyc -e .ts -r=html -r=text -r=lcov npm run test","build":"tsc","prepublishOnly":"tsc"},"author":"","license":"ISC","devDependencies":{"@types/mocha":"^5.2.7","mocha":"^6.2.0","@types/node":"^12.12.26","nyc":"^15.0.0","source-map-support":"^0.5.16","ts-node":"^8.6.2","typescript":"^3.7.5","@alicloud/gateway-pop":"0.0.6"},"dependencies":{"@alicloud/tea-typescript":"^1.7.1","@alicloud/tea-util":"^1.4.9","@alicloud/credentials":"^2.3.1","@alicloud/openapi-util":"^0.3.2","@alicloud/gateway-spi":"^0.0.8","@alicloud/tea-xml":"0.0.3"},"files":["dist","src"],"repository":"git@github.com:aliyun/darabonba-openapi.git","_lastModified":"2024-12-26T07:41:29.712Z"}
@@ -1 +1 @@
1
- {"name":"@alicloud/tea-util","version":"1.4.9","description":"","main":"dist/client.js","scripts":{"test":"mocha -r ts-node/register -r source-map-support/register test/**/*.spec.ts","test-cov":"nyc -e .ts -r=html -r=text -r=lcov npm run test","build":"tsc","prepublishOnly":"tsc"},"author":"Jackson Tian","license":"Apache-2.0","devDependencies":{"@types/mocha":"^7.0.1","@types/node":"^12.12.26","mocha":"^7.0.1","nyc":"^15.0.0","source-map-support":"^0.5.16","ts-node":"^8.6.2","typescript":"^3.7.5"},"dependencies":{"@alicloud/tea-typescript":"^1.5.1","kitx":"^2.0.0"},"files":["dist","src"],"repository":"git@github.com:aliyun/tea-util.git","_lastModified":"2024-12-22T16:07:41.497Z"}
1
+ {"name":"@alicloud/tea-util","version":"1.4.9","description":"","main":"dist/client.js","scripts":{"test":"mocha -r ts-node/register -r source-map-support/register test/**/*.spec.ts","test-cov":"nyc -e .ts -r=html -r=text -r=lcov npm run test","build":"tsc","prepublishOnly":"tsc"},"author":"Jackson Tian","license":"Apache-2.0","devDependencies":{"@types/mocha":"^7.0.1","@types/node":"^12.12.26","mocha":"^7.0.1","nyc":"^15.0.0","source-map-support":"^0.5.16","ts-node":"^8.6.2","typescript":"^3.7.5"},"dependencies":{"@alicloud/tea-typescript":"^1.5.1","kitx":"^2.0.0"},"files":["dist","src"],"repository":"git@github.com:aliyun/tea-util.git","_lastModified":"2024-12-26T07:41:29.817Z"}
@@ -6,9 +6,9 @@ case `uname` in
6
6
  esac
7
7
 
8
8
  if [ -z "$NODE_PATH" ]; then
9
- export NODE_PATH="/Users/seal/Documents/projects/tachybase/node_modules/.pnpm/uuid@9.0.1/node_modules/uuid/dist/bin/node_modules:/Users/seal/Documents/projects/tachybase/node_modules/.pnpm/uuid@9.0.1/node_modules/uuid/dist/node_modules:/Users/seal/Documents/projects/tachybase/node_modules/.pnpm/uuid@9.0.1/node_modules/uuid/node_modules:/Users/seal/Documents/projects/tachybase/node_modules/.pnpm/uuid@9.0.1/node_modules:/Users/seal/Documents/projects/tachybase/node_modules/.pnpm/node_modules"
9
+ export NODE_PATH="/home/runner/work/tachybase/tachybase/node_modules/.pnpm/uuid@9.0.1/node_modules/uuid/dist/bin/node_modules:/home/runner/work/tachybase/tachybase/node_modules/.pnpm/uuid@9.0.1/node_modules/uuid/dist/node_modules:/home/runner/work/tachybase/tachybase/node_modules/.pnpm/uuid@9.0.1/node_modules/uuid/node_modules:/home/runner/work/tachybase/tachybase/node_modules/.pnpm/uuid@9.0.1/node_modules:/home/runner/work/tachybase/tachybase/node_modules/.pnpm/node_modules"
10
10
  else
11
- export NODE_PATH="/Users/seal/Documents/projects/tachybase/node_modules/.pnpm/uuid@9.0.1/node_modules/uuid/dist/bin/node_modules:/Users/seal/Documents/projects/tachybase/node_modules/.pnpm/uuid@9.0.1/node_modules/uuid/dist/node_modules:/Users/seal/Documents/projects/tachybase/node_modules/.pnpm/uuid@9.0.1/node_modules/uuid/node_modules:/Users/seal/Documents/projects/tachybase/node_modules/.pnpm/uuid@9.0.1/node_modules:/Users/seal/Documents/projects/tachybase/node_modules/.pnpm/node_modules:$NODE_PATH"
11
+ export NODE_PATH="/home/runner/work/tachybase/tachybase/node_modules/.pnpm/uuid@9.0.1/node_modules/uuid/dist/bin/node_modules:/home/runner/work/tachybase/tachybase/node_modules/.pnpm/uuid@9.0.1/node_modules/uuid/dist/node_modules:/home/runner/work/tachybase/tachybase/node_modules/.pnpm/uuid@9.0.1/node_modules/uuid/node_modules:/home/runner/work/tachybase/tachybase/node_modules/.pnpm/uuid@9.0.1/node_modules:/home/runner/work/tachybase/tachybase/node_modules/.pnpm/node_modules:$NODE_PATH"
12
12
  fi
13
13
  if [ -x "$basedir/node" ]; then
14
14
  exec "$basedir/node" "$basedir/../../../../../uuid@9.0.1/node_modules/uuid/dist/bin/uuid" "$@"
@@ -1 +1 @@
1
- {"name":"tencentcloud-sdk-nodejs","version":"4.0.996","description":"腾讯云 API NODEJS SDK","main":"tencentcloud/index.js","scripts":{"test":"mocha -t 10000","build":"tsc","prettier":"prettier --config prettier.config.js --write 'src/**/*.{tsx,ts,jsx,js,css,json,vue}'"},"engines":{"node":">=10"},"keywords":["tencentcloudapi","tencentcloud","qcloud","sdk","js","nodejs"],"author":"tencentcloudapi","license":"Apache-2.0","dependencies":{"form-data":"^3.0.0","get-stream":"^6.0.0","https-proxy-agent":"^5.0.0","is-stream":"^2.0.0","json-bigint":"^1.0.0","node-fetch":"^2.2.0","tslib":"1.13.0","uuid":"^9.0.1"},"directories":{"example":"examples","lib":"lib"},"repository":{"type":"git","url":"https://github.com/tencentcloud/tencentcloud-sdk-nodejs"},"devDependencies":{"@types/form-data":"^2.5.0","@types/json-bigint":"^1.0.1","@types/node":"^14.0.26","@types/node-fetch":"^2.5.7","@types/uuid":"^9.0.8","@typescript-eslint/eslint-plugin":"^2.34.0","@typescript-eslint/parser":"^2.34.0","babel-eslint":"^10.0.2","chai":"^4.2.0","eslint":"^6.8.0","eslint-plugin-react":"^7.17.0","mocha":"^8.1.1","prettier":"^2.3.0","ts-node":"^8.10.2","typescript":"^3.9.7"},"_lastModified":"2024-12-22T16:07:44.734Z"}
1
+ {"name":"tencentcloud-sdk-nodejs","version":"4.0.996","description":"腾讯云 API NODEJS SDK","main":"tencentcloud/index.js","scripts":{"test":"mocha -t 10000","build":"tsc","prettier":"prettier --config prettier.config.js --write 'src/**/*.{tsx,ts,jsx,js,css,json,vue}'"},"engines":{"node":">=10"},"keywords":["tencentcloudapi","tencentcloud","qcloud","sdk","js","nodejs"],"author":"tencentcloudapi","license":"Apache-2.0","dependencies":{"form-data":"^3.0.0","get-stream":"^6.0.0","https-proxy-agent":"^5.0.0","is-stream":"^2.0.0","json-bigint":"^1.0.0","node-fetch":"^2.2.0","tslib":"1.13.0","uuid":"^9.0.1"},"directories":{"example":"examples","lib":"lib"},"repository":{"type":"git","url":"https://github.com/tencentcloud/tencentcloud-sdk-nodejs"},"devDependencies":{"@types/form-data":"^2.5.0","@types/json-bigint":"^1.0.1","@types/node":"^14.0.26","@types/node-fetch":"^2.5.7","@types/uuid":"^9.0.8","@typescript-eslint/eslint-plugin":"^2.34.0","@typescript-eslint/parser":"^2.34.0","babel-eslint":"^10.0.2","chai":"^4.2.0","eslint":"^6.8.0","eslint-plugin-react":"^7.17.0","mocha":"^8.1.1","prettier":"^2.3.0","ts-node":"^8.10.2","typescript":"^3.9.7"},"_lastModified":"2024-12-26T07:41:33.943Z"}
@@ -1 +1 @@
1
- {"name":"ws","version":"8.18.0","description":"Simple to use, blazing fast and thoroughly tested websocket client and server for Node.js","keywords":["HyBi","Push","RFC-6455","WebSocket","WebSockets","real-time"],"homepage":"https://github.com/websockets/ws","bugs":"https://github.com/websockets/ws/issues","repository":{"type":"git","url":"git+https://github.com/websockets/ws.git"},"author":"Einar Otto Stangvik <einaros@gmail.com> (http://2x.io)","license":"MIT","main":"index.js","exports":{".":{"browser":"./browser.js","import":"./wrapper.mjs","require":"./index.js"},"./package.json":"./package.json"},"browser":"browser.js","engines":{"node":">=10.0.0"},"files":["browser.js","index.js","lib/*.js","wrapper.mjs"],"scripts":{"test":"nyc --reporter=lcov --reporter=text mocha --throw-deprecation test/*.test.js","integration":"mocha --throw-deprecation test/*.integration.js","lint":"eslint . && prettier --check --ignore-path .gitignore \"**/*.{json,md,yaml,yml}\""},"peerDependencies":{"bufferutil":"^4.0.1","utf-8-validate":">=5.0.2"},"peerDependenciesMeta":{"bufferutil":{"optional":true},"utf-8-validate":{"optional":true}},"devDependencies":{"benchmark":"^2.1.4","bufferutil":"^4.0.1","eslint":"^9.0.0","eslint-config-prettier":"^9.0.0","eslint-plugin-prettier":"^5.0.0","globals":"^15.0.0","mocha":"^8.4.0","nyc":"^15.0.0","prettier":"^3.0.0","utf-8-validate":"^6.0.0"},"_lastModified":"2024-12-22T16:07:40.554Z"}
1
+ {"name":"ws","version":"8.18.0","description":"Simple to use, blazing fast and thoroughly tested websocket client and server for Node.js","keywords":["HyBi","Push","RFC-6455","WebSocket","WebSockets","real-time"],"homepage":"https://github.com/websockets/ws","bugs":"https://github.com/websockets/ws/issues","repository":{"type":"git","url":"git+https://github.com/websockets/ws.git"},"author":"Einar Otto Stangvik <einaros@gmail.com> (http://2x.io)","license":"MIT","main":"index.js","exports":{".":{"browser":"./browser.js","import":"./wrapper.mjs","require":"./index.js"},"./package.json":"./package.json"},"browser":"browser.js","engines":{"node":">=10.0.0"},"files":["browser.js","index.js","lib/*.js","wrapper.mjs"],"scripts":{"test":"nyc --reporter=lcov --reporter=text mocha --throw-deprecation test/*.test.js","integration":"mocha --throw-deprecation test/*.integration.js","lint":"eslint . && prettier --check --ignore-path .gitignore \"**/*.{json,md,yaml,yml}\""},"peerDependencies":{"bufferutil":"^4.0.1","utf-8-validate":">=5.0.2"},"peerDependenciesMeta":{"bufferutil":{"optional":true},"utf-8-validate":{"optional":true}},"devDependencies":{"benchmark":"^2.1.4","bufferutil":"^4.0.1","eslint":"^9.0.0","eslint-config-prettier":"^9.0.0","eslint-plugin-prettier":"^5.0.0","globals":"^15.0.0","mocha":"^8.4.0","nyc":"^15.0.0","prettier":"^3.0.0","utf-8-validate":"^6.0.0"},"_lastModified":"2024-12-26T07:41:28.335Z"}
package/package.json CHANGED
@@ -1,8 +1,9 @@
1
1
  {
2
2
  "name": "@tachybase/module-message",
3
- "version": "0.23.8",
3
+ "version": "0.23.16",
4
4
  "main": "dist/server/index.js",
5
- "dependencies": {
5
+ "dependencies": {},
6
+ "devDependencies": {
6
7
  "@alicloud/dysmsapi20170525": "2.0.24",
7
8
  "@alicloud/openapi-client": "0.4.12",
8
9
  "@alicloud/tea-util": "1.4.9",
@@ -15,17 +16,17 @@
15
16
  "react-router-dom": "6.28.1",
16
17
  "tencentcloud-sdk-nodejs": "^4.0.996",
17
18
  "ws": "^8.18.0",
18
- "@tachybase/actions": "0.23.8",
19
- "@tachybase/utils": "0.23.8",
20
- "@tachybase/components": "0.23.8"
19
+ "@tachybase/actions": "0.23.16",
20
+ "@tachybase/utils": "0.23.16",
21
+ "@tachybase/components": "0.23.16"
21
22
  },
22
23
  "peerDependencies": {
23
- "@tachybase/client": "0.23.8",
24
- "@tachybase/database": "0.23.8",
25
- "@tachybase/module-workflow": "0.23.8",
26
- "@tachybase/schema": "0.23.8",
27
- "@tachybase/server": "0.23.8",
28
- "@tachybase/test": "0.23.8"
24
+ "@tachybase/client": "0.23.16",
25
+ "@tachybase/database": "0.23.16",
26
+ "@tachybase/schema": "0.23.16",
27
+ "@tachybase/module-workflow": "0.23.16",
28
+ "@tachybase/server": "0.23.16",
29
+ "@tachybase/test": "0.23.16"
29
30
  },
30
31
  "scripts": {
31
32
  "build": "tachybase-build --no-dts @tachybase/module-message"
@@ -1,14 +0,0 @@
1
-
2
- 
3
- > @tachybase/module-message@0.23.2 build /Users/seal/Documents/projects/tachybase/packages/module-message
4
- > tachybase-build --no-dts @tachybase/module-message
5
-
6
- The CJS build of Vite's Node API is deprecated. See https://vitejs.dev/guide/troubleshooting.html#vite-cjs-node-api-deprecated for more details.
7
- @tachybase/module-message: module-message build start
8
- @tachybase/module-message: build plugin client
9
- @tachybase/module-message: build plugin server source
10
- @tachybase/module-message: delete server files
11
- @tachybase/module-message: build plugin server dependencies
12
- @tachybase/module-message: These packages ws, @alicloud/dysmsapi20170525, @alicloud/openapi-client, @alicloud/tea-util, tencentcloud-sdk-nodejs will be bundled to dist/node_modules. These packages @tachybase/database, @tachybase/server, @tachybase/module-workflow, @tachybase/utils, jsonwebtoken, @tachybase/actions will be exclude.
13
- @tachybase/module-message: write external version
14
-
@@ -1,2 +0,0 @@
1
- import React from 'react';
2
- export declare const CheckContent: () => React.JSX.Element;
@@ -1,2 +0,0 @@
1
- import React from 'react';
2
- export declare const ProviderCheckContent: (props: any) => React.JSX.Element;
@@ -1,26 +0,0 @@
1
- export declare const getSchemaCheckContent: (message: any) => {
2
- name: string;
3
- type: string;
4
- 'x-component': string;
5
- properties: {
6
- tab1: {
7
- type: string;
8
- title: string;
9
- 'x-component': string;
10
- properties: {
11
- schemaName: {
12
- type: string;
13
- 'x-decorator': string;
14
- 'x-decorator-props': {
15
- designable: boolean;
16
- };
17
- 'x-component': string;
18
- 'x-component-props': {
19
- uid: any;
20
- noForm: boolean;
21
- };
22
- };
23
- };
24
- };
25
- };
26
- };
@@ -1,2 +0,0 @@
1
- import React from 'react';
2
- export declare const ProviderSchemaComponentContext: (props: any) => React.JSX.Element;