@tachybase/plugin-wechat-official-account 0.23.8

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.
@@ -0,0 +1,14 @@
1
+
2
+ 
3
+ > @tachybase/plugin-wechat-official-account@0.23.2 build /Users/seal/Documents/projects/tachybase/packages/plugin-prototype-wechat-official-account
4
+ > tachybase-build --no-dts @tachybase/plugin-wechat-official-account
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/plugin-wechat-official-account: plugin-prototype-wechat-official-account build start
8
+ @tachybase/plugin-wechat-official-account: build plugin client
9
+ @tachybase/plugin-wechat-official-account: build plugin server source
10
+ @tachybase/plugin-wechat-official-account: delete server files
11
+ @tachybase/plugin-wechat-official-account: build plugin server dependencies
12
+ @tachybase/plugin-wechat-official-account: These packages xml2js will be bundled to dist/node_modules. These packages @tachybase/module-auth, @tachybase/server, axios, sequelize, @tachybase/actions will be exclude.
13
+ @tachybase/plugin-wechat-official-account: write external version
14
+
package/README.md ADDED
@@ -0,0 +1 @@
1
+ # @samples/plugin-replace-page
package/client.d.ts ADDED
@@ -0,0 +1,2 @@
1
+ export * from './dist/client';
2
+ export { default } from './dist/client';
package/client.js ADDED
@@ -0,0 +1 @@
1
+ module.exports = require('./dist/client/index.js');
@@ -0,0 +1,5 @@
1
+ import React from 'react';
2
+ export declare const AdminSettingsForm: () => React.JSX.Element;
3
+ export declare const SignInButton: ({ authenticator }: {
4
+ authenticator: any;
5
+ }) => React.JSX.Element;
@@ -0,0 +1,5 @@
1
+ import { Plugin } from '@tachybase/client';
2
+ export declare class PluginWeCahtOfficialAccount extends Plugin {
3
+ load(): Promise<void>;
4
+ }
5
+ export default PluginWeCahtOfficialAccount;
@@ -0,0 +1 @@
1
+ (function(e,o){typeof exports=="object"&&typeof module!="undefined"?o(exports,require("@tachybase/client"),require("@tachybase/module-auth/client"),require("react/jsx-runtime"),require("react"),require("@ant-design/icons"),require("antd"),require("react-router-dom")):typeof define=="function"&&define.amd?define(["exports","@tachybase/client","@tachybase/module-auth/client","react/jsx-runtime","react","@ant-design/icons","antd","react-router-dom"],o):(e=typeof globalThis!="undefined"?globalThis:e||self,o(e["@tachybase/plugin-wechat-official-account"]={},e["@tachybase/client"],e["@tachybase/module-auth"],e.jsxRuntime,e.react,e["@ant-design/icons"],e.antd,e["react-router-dom"]))})(this,function(e,o,c,t,a,h,r,d){"use strict";var g=(e,o,c)=>new Promise((t,a)=>{var h=n=>{try{d(c.next(n))}catch(l){a(l)}},r=n=>{try{d(c.throw(n))}catch(l){a(l)}},d=n=>n.done?t(n.value):Promise.resolve(n.value).then(h,r);d((c=c.apply(e,o)).next())});const n="微信公众号",l="微信公众号";function C(){return o.useTranslation([l,"core"],{nsMode:"fallback"})}const v=()=>{const{t:s}=C();o.useApp();const i="https://lu.dev.daoyoucloud.com/api/wechat@handleOAuthCallback",b=m=>{navigator.clipboard.writeText(m),r.message.success(s("Copied"))};return t.jsxs("div",{children:[t.jsx(o.SchemaComponent,{scope:{t:s},schema:{type:"object",properties:{public:{type:"object",properties:{autoSignup:{"x-decorator":"FormItem",type:"boolean",title:'{{t("Sign up automatically when the user does not exist")}}',"x-component":"Checkbox",default:!0}}},wechat:{type:"object",properties:{appId:{"x-decorator":"FormItem","x-component":"Input",type:"string",required:!0,title:'{{t("WeChat AppID")}}'},appSecret:{"x-decorator":"FormItem","x-component":"Input",type:"string",required:!0,title:'{{t("WeChat AppSecret")}}'}}}}}}),t.jsxs("div",{children:[t.jsxs(r.Typography.Title,{level:5,style:{fontSize:"14px"},children:[s("Redirect URL"),":"]}),t.jsx(r.Input,{value:i,disabled:!0,addonBefore:t.jsx(h.CopyOutlined,{onClick:()=>b(i)})})]})]})},A=({authenticator:s})=>{const[i,b]=a.useState(),[m,x]=a.useState(!1),[I,T]=a.useState(""),[q,w]=a.useState(!1),{t:y}=C(),j=o.useAPIClient(),L=d.useLocation(),f=new URLSearchParams(L.search),P=f.get("redirect");a.useEffect(()=>{i&&(window.location.href=i)},[i]),a.useEffect(()=>{const u=f.get("authenticator"),p=f.get("error");u===s.name&&p&&r.message.error(y(p))},[s.name,y,f]);const k=()=>g(this,null,function*(){w(!0);try{const{data:u}=yield j.request({method:"post",url:"https://lu.dev.daoyoucloud.com/api/wechat@generateQrCode",headers:{"X-Authenticator":s.name},data:{redirect:P}});console.log("data.data.data.url:",u.data.data.url);const p=u.data.data.url;p?(T(p),x(!0)):console.error("未能生成二维码URL")}catch(u){r.message.error(y("Failed to generate QR code")),console.error("二维码生成失败:",u)}finally{w(!1)}});return t.jsxs(t.Fragment,{children:[t.jsx(r.Button,{block:!0,icon:t.jsx(h.LoginOutlined,{}),shape:"round",onClick:k,loading:q,children:s.title||"WeChat 公众号登录"}),t.jsx(r.Modal,{title:"Scan QR Code to Login",style:{textAlign:"center"},visible:m,footer:null,onCancel:()=>x(!1),children:q?t.jsx(r.Spin,{}):t.jsx("img",{src:I,alt:"QR Code",style:{width:"100%"}})})]})};class S extends o.Plugin{load(){return g(this,null,function*(){this.app.pm.get(c).registerType(n,{components:{SignInButton:A,AdminSettingsForm:v}})})}}e.PluginWeCahtOfficialAccount=S,e.default=S,Object.defineProperties(e,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
@@ -0,0 +1 @@
1
+ export declare function useTranslation(): import("react-i18next").UseTranslationResponse<[string, string], undefined>;
@@ -0,0 +1,2 @@
1
+ export declare const authType = "\u5FAE\u4FE1\u516C\u4F17\u53F7";
2
+ export declare const namespace = "\u5FAE\u4FE1\u516C\u4F17\u53F7";
@@ -0,0 +1,30 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+ var constants_exports = {};
19
+ __export(constants_exports, {
20
+ authType: () => authType,
21
+ namespace: () => namespace
22
+ });
23
+ module.exports = __toCommonJS(constants_exports);
24
+ const authType = "\u5FAE\u4FE1\u516C\u4F17\u53F7";
25
+ const namespace = "\u5FAE\u4FE1\u516C\u4F17\u53F7";
26
+ // Annotate the CommonJS export names for ESM import in node:
27
+ 0 && (module.exports = {
28
+ authType,
29
+ namespace
30
+ });
@@ -0,0 +1,12 @@
1
+ module.exports = {
2
+ "react": "18.3.1",
3
+ "@tachybase/client": "0.23.8",
4
+ "@ant-design/icons": "5.5.2",
5
+ "antd": "5.22.5",
6
+ "react-router-dom": "6.28.1",
7
+ "@tachybase/module-auth": "0.23.8",
8
+ "@tachybase/server": "0.23.8",
9
+ "axios": "1.7.9",
10
+ "sequelize": "6.37.5",
11
+ "@tachybase/actions": "0.23.8"
12
+ };
@@ -0,0 +1,2 @@
1
+ export * from './server';
2
+ export { default } from './server';
package/dist/index.js ADDED
@@ -0,0 +1,39 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __export = (target, all) => {
8
+ for (var name in all)
9
+ __defProp(target, name, { get: all[name], enumerable: true });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from))
14
+ if (!__hasOwnProp.call(to, key) && key !== except)
15
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
+ }
17
+ return to;
18
+ };
19
+ var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+ var src_exports = {};
30
+ __export(src_exports, {
31
+ default: () => import_server.default
32
+ });
33
+ module.exports = __toCommonJS(src_exports);
34
+ __reExport(src_exports, require("./server"), module.exports);
35
+ var import_server = __toESM(require("./server"));
36
+ // Annotate the CommonJS export names for ESM import in node:
37
+ 0 && (module.exports = {
38
+ ...require("./server")
39
+ });
@@ -0,0 +1,19 @@
1
+ Copyright 2010, 2011, 2012, 2013. All rights reserved.
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ of this software and associated documentation files (the "Software"), to
5
+ deal in the Software without restriction, including without limitation the
6
+ rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
7
+ sell copies of the Software, and to permit persons to whom the Software is
8
+ furnished to do so, subject to the following conditions:
9
+
10
+ The above copyright notice and this permission notice shall be included in
11
+ all copies or substantial portions of the Software.
12
+
13
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
18
+ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
19
+ IN THE SOFTWARE.
@@ -0,0 +1,12 @@
1
+ // Generated by CoffeeScript 1.12.7
2
+ (function() {
3
+ "use strict";
4
+ exports.stripBOM = function(str) {
5
+ if (str[0] === '\uFEFF') {
6
+ return str.substring(1);
7
+ } else {
8
+ return str;
9
+ }
10
+ };
11
+
12
+ }).call(this);
@@ -0,0 +1,127 @@
1
+ // Generated by CoffeeScript 1.12.7
2
+ (function() {
3
+ "use strict";
4
+ var builder, defaults, escapeCDATA, requiresCDATA, wrapCDATA,
5
+ hasProp = {}.hasOwnProperty;
6
+
7
+ builder = require('xmlbuilder');
8
+
9
+ defaults = require('./defaults').defaults;
10
+
11
+ requiresCDATA = function(entry) {
12
+ return typeof entry === "string" && (entry.indexOf('&') >= 0 || entry.indexOf('>') >= 0 || entry.indexOf('<') >= 0);
13
+ };
14
+
15
+ wrapCDATA = function(entry) {
16
+ return "<![CDATA[" + (escapeCDATA(entry)) + "]]>";
17
+ };
18
+
19
+ escapeCDATA = function(entry) {
20
+ return entry.replace(']]>', ']]]]><![CDATA[>');
21
+ };
22
+
23
+ exports.Builder = (function() {
24
+ function Builder(opts) {
25
+ var key, ref, value;
26
+ this.options = {};
27
+ ref = defaults["0.2"];
28
+ for (key in ref) {
29
+ if (!hasProp.call(ref, key)) continue;
30
+ value = ref[key];
31
+ this.options[key] = value;
32
+ }
33
+ for (key in opts) {
34
+ if (!hasProp.call(opts, key)) continue;
35
+ value = opts[key];
36
+ this.options[key] = value;
37
+ }
38
+ }
39
+
40
+ Builder.prototype.buildObject = function(rootObj) {
41
+ var attrkey, charkey, render, rootElement, rootName;
42
+ attrkey = this.options.attrkey;
43
+ charkey = this.options.charkey;
44
+ if ((Object.keys(rootObj).length === 1) && (this.options.rootName === defaults['0.2'].rootName)) {
45
+ rootName = Object.keys(rootObj)[0];
46
+ rootObj = rootObj[rootName];
47
+ } else {
48
+ rootName = this.options.rootName;
49
+ }
50
+ render = (function(_this) {
51
+ return function(element, obj) {
52
+ var attr, child, entry, index, key, value;
53
+ if (typeof obj !== 'object') {
54
+ if (_this.options.cdata && requiresCDATA(obj)) {
55
+ element.raw(wrapCDATA(obj));
56
+ } else {
57
+ element.txt(obj);
58
+ }
59
+ } else if (Array.isArray(obj)) {
60
+ for (index in obj) {
61
+ if (!hasProp.call(obj, index)) continue;
62
+ child = obj[index];
63
+ for (key in child) {
64
+ entry = child[key];
65
+ element = render(element.ele(key), entry).up();
66
+ }
67
+ }
68
+ } else {
69
+ for (key in obj) {
70
+ if (!hasProp.call(obj, key)) continue;
71
+ child = obj[key];
72
+ if (key === attrkey) {
73
+ if (typeof child === "object") {
74
+ for (attr in child) {
75
+ value = child[attr];
76
+ element = element.att(attr, value);
77
+ }
78
+ }
79
+ } else if (key === charkey) {
80
+ if (_this.options.cdata && requiresCDATA(child)) {
81
+ element = element.raw(wrapCDATA(child));
82
+ } else {
83
+ element = element.txt(child);
84
+ }
85
+ } else if (Array.isArray(child)) {
86
+ for (index in child) {
87
+ if (!hasProp.call(child, index)) continue;
88
+ entry = child[index];
89
+ if (typeof entry === 'string') {
90
+ if (_this.options.cdata && requiresCDATA(entry)) {
91
+ element = element.ele(key).raw(wrapCDATA(entry)).up();
92
+ } else {
93
+ element = element.ele(key, entry).up();
94
+ }
95
+ } else {
96
+ element = render(element.ele(key), entry).up();
97
+ }
98
+ }
99
+ } else if (typeof child === "object") {
100
+ element = render(element.ele(key), child).up();
101
+ } else {
102
+ if (typeof child === 'string' && _this.options.cdata && requiresCDATA(child)) {
103
+ element = element.ele(key).raw(wrapCDATA(child)).up();
104
+ } else {
105
+ if (child == null) {
106
+ child = '';
107
+ }
108
+ element = element.ele(key, child.toString()).up();
109
+ }
110
+ }
111
+ }
112
+ }
113
+ return element;
114
+ };
115
+ })(this);
116
+ rootElement = builder.create(rootName, this.options.xmldec, this.options.doctype, {
117
+ headless: this.options.headless,
118
+ allowSurrogateChars: this.options.allowSurrogateChars
119
+ });
120
+ return render(rootElement, rootObj).end(this.options.renderOpts);
121
+ };
122
+
123
+ return Builder;
124
+
125
+ })();
126
+
127
+ }).call(this);
@@ -0,0 +1,72 @@
1
+ // Generated by CoffeeScript 1.12.7
2
+ (function() {
3
+ exports.defaults = {
4
+ "0.1": {
5
+ explicitCharkey: false,
6
+ trim: true,
7
+ normalize: true,
8
+ normalizeTags: false,
9
+ attrkey: "@",
10
+ charkey: "#",
11
+ explicitArray: false,
12
+ ignoreAttrs: false,
13
+ mergeAttrs: false,
14
+ explicitRoot: false,
15
+ validator: null,
16
+ xmlns: false,
17
+ explicitChildren: false,
18
+ childkey: '@@',
19
+ charsAsChildren: false,
20
+ includeWhiteChars: false,
21
+ async: false,
22
+ strict: true,
23
+ attrNameProcessors: null,
24
+ attrValueProcessors: null,
25
+ tagNameProcessors: null,
26
+ valueProcessors: null,
27
+ emptyTag: ''
28
+ },
29
+ "0.2": {
30
+ explicitCharkey: false,
31
+ trim: false,
32
+ normalize: false,
33
+ normalizeTags: false,
34
+ attrkey: "$",
35
+ charkey: "_",
36
+ explicitArray: true,
37
+ ignoreAttrs: false,
38
+ mergeAttrs: false,
39
+ explicitRoot: true,
40
+ validator: null,
41
+ xmlns: false,
42
+ explicitChildren: false,
43
+ preserveChildrenOrder: false,
44
+ childkey: '$$',
45
+ charsAsChildren: false,
46
+ includeWhiteChars: false,
47
+ async: false,
48
+ strict: true,
49
+ attrNameProcessors: null,
50
+ attrValueProcessors: null,
51
+ tagNameProcessors: null,
52
+ valueProcessors: null,
53
+ rootName: 'root',
54
+ xmldec: {
55
+ 'version': '1.0',
56
+ 'encoding': 'UTF-8',
57
+ 'standalone': true
58
+ },
59
+ doctype: null,
60
+ renderOpts: {
61
+ 'pretty': true,
62
+ 'indent': ' ',
63
+ 'newline': '\n'
64
+ },
65
+ headless: false,
66
+ chunkSize: 10000,
67
+ emptyTag: '',
68
+ cdata: false
69
+ }
70
+ };
71
+
72
+ }).call(this);