@gloablehive/ipad-wechat-plugin 1.0.3 → 1.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/src/channel.js +30 -19
- package/package.json +1 -1
- package/src/channel.ts +32 -20
package/dist/src/channel.js
CHANGED
|
@@ -78,32 +78,43 @@ export const ipadWeChatPlugin = createChatChannelPlugin({
|
|
|
78
78
|
supportsEditing: false,
|
|
79
79
|
supportsDeleting: false,
|
|
80
80
|
},
|
|
81
|
+
// Setup adapter - for initial configuration
|
|
81
82
|
setup: {
|
|
82
83
|
resolveAccountId: (params) => {
|
|
83
84
|
return resolveAccount(params.cfg, params.accountId)?.accountId || "";
|
|
84
85
|
},
|
|
85
|
-
|
|
86
|
-
const
|
|
87
|
-
|
|
88
|
-
return [section.wechatAccountId];
|
|
89
|
-
}
|
|
90
|
-
return ["default"];
|
|
91
|
-
},
|
|
92
|
-
defaultAccountId: (cfg) => {
|
|
93
|
-
const section = cfg.channels?.["ipad-wechat"];
|
|
94
|
-
return section?.wechatAccountId || "default";
|
|
95
|
-
},
|
|
96
|
-
inspectAccount(cfg, accountId) {
|
|
97
|
-
const section = cfg.channels?.["ipad-wechat"];
|
|
98
|
-
const hasCredentials = Boolean(section?.appKey && section?.appSecret && section?.guid);
|
|
99
|
-
return {
|
|
100
|
-
enabled: hasCredentials,
|
|
101
|
-
configured: hasCredentials,
|
|
102
|
-
tokenStatus: hasCredentials ? "available" : "missing",
|
|
103
|
-
};
|
|
86
|
+
applyAccountConfig: (params) => {
|
|
87
|
+
const { cfg, accountId, input } = params;
|
|
88
|
+
return cfg;
|
|
104
89
|
},
|
|
105
90
|
},
|
|
106
91
|
}),
|
|
92
|
+
// Config adapter - for runtime account management
|
|
93
|
+
config: {
|
|
94
|
+
listAccountIds: (cfg) => {
|
|
95
|
+
const section = cfg.channels?.["ipad-wechat"];
|
|
96
|
+
if (section?.wechatAccountId) {
|
|
97
|
+
return [section.wechatAccountId];
|
|
98
|
+
}
|
|
99
|
+
return ["default"];
|
|
100
|
+
},
|
|
101
|
+
resolveAccount: (cfg, accountId) => {
|
|
102
|
+
return resolveAccount(cfg, accountId);
|
|
103
|
+
},
|
|
104
|
+
defaultAccountId: (cfg) => {
|
|
105
|
+
const section = cfg.channels?.["ipad-wechat"];
|
|
106
|
+
return section?.wechatAccountId || "default";
|
|
107
|
+
},
|
|
108
|
+
inspectAccount: (cfg, accountId) => {
|
|
109
|
+
const section = cfg.channels?.["ipad-wechat"];
|
|
110
|
+
const hasCredentials = Boolean(section?.appKey && section?.appSecret && section?.guid);
|
|
111
|
+
return {
|
|
112
|
+
enabled: hasCredentials,
|
|
113
|
+
configured: hasCredentials,
|
|
114
|
+
tokenStatus: hasCredentials ? "available" : "missing",
|
|
115
|
+
};
|
|
116
|
+
},
|
|
117
|
+
},
|
|
107
118
|
security: {
|
|
108
119
|
dm: {
|
|
109
120
|
channelKey: "ipad-wechat",
|
package/package.json
CHANGED
package/src/channel.ts
CHANGED
|
@@ -114,33 +114,45 @@ export const ipadWeChatPlugin = createChatChannelPlugin<IPadWeChatResolvedAccoun
|
|
|
114
114
|
supportsEditing: false,
|
|
115
115
|
supportsDeleting: false,
|
|
116
116
|
} as any,
|
|
117
|
+
// Setup adapter - for initial configuration
|
|
117
118
|
setup: {
|
|
118
119
|
resolveAccountId: (params: any) => {
|
|
119
120
|
return resolveAccount(params.cfg, params.accountId)?.accountId || "";
|
|
120
121
|
},
|
|
121
|
-
|
|
122
|
-
const
|
|
123
|
-
|
|
124
|
-
return [section.wechatAccountId];
|
|
125
|
-
}
|
|
126
|
-
return ["default"];
|
|
127
|
-
},
|
|
128
|
-
defaultAccountId: (cfg: any) => {
|
|
129
|
-
const section = (cfg.channels as Record<string, any>)?.["ipad-wechat"];
|
|
130
|
-
return section?.wechatAccountId || "default";
|
|
122
|
+
applyAccountConfig: (params: any) => {
|
|
123
|
+
const { cfg, accountId, input } = params;
|
|
124
|
+
return cfg;
|
|
131
125
|
},
|
|
132
|
-
|
|
133
|
-
const section = (cfg.channels as Record<string, any>)?.["ipad-wechat"];
|
|
134
|
-
const hasCredentials = Boolean(section?.appKey && section?.appSecret && section?.guid);
|
|
135
|
-
return {
|
|
136
|
-
enabled: hasCredentials,
|
|
137
|
-
configured: hasCredentials,
|
|
138
|
-
tokenStatus: hasCredentials ? "available" : "missing",
|
|
139
|
-
};
|
|
140
|
-
},
|
|
141
|
-
} as any,
|
|
126
|
+
},
|
|
142
127
|
}) as any,
|
|
143
128
|
|
|
129
|
+
// Config adapter - for runtime account management
|
|
130
|
+
config: {
|
|
131
|
+
listAccountIds: (cfg: any) => {
|
|
132
|
+
const section = (cfg.channels as Record<string, any>)?.["ipad-wechat"];
|
|
133
|
+
if (section?.wechatAccountId) {
|
|
134
|
+
return [section.wechatAccountId];
|
|
135
|
+
}
|
|
136
|
+
return ["default"];
|
|
137
|
+
},
|
|
138
|
+
resolveAccount: (cfg: any, accountId?: string | null) => {
|
|
139
|
+
return resolveAccount(cfg, accountId);
|
|
140
|
+
},
|
|
141
|
+
defaultAccountId: (cfg: any) => {
|
|
142
|
+
const section = (cfg.channels as Record<string, any>)?.["ipad-wechat"];
|
|
143
|
+
return section?.wechatAccountId || "default";
|
|
144
|
+
},
|
|
145
|
+
inspectAccount: (cfg: any, accountId?: string | null) => {
|
|
146
|
+
const section = (cfg.channels as Record<string, any>)?.["ipad-wechat"];
|
|
147
|
+
const hasCredentials = Boolean(section?.appKey && section?.appSecret && section?.guid);
|
|
148
|
+
return {
|
|
149
|
+
enabled: hasCredentials,
|
|
150
|
+
configured: hasCredentials,
|
|
151
|
+
tokenStatus: hasCredentials ? "available" : "missing",
|
|
152
|
+
};
|
|
153
|
+
},
|
|
154
|
+
} as any,
|
|
155
|
+
|
|
144
156
|
security: {
|
|
145
157
|
dm: {
|
|
146
158
|
channelKey: "ipad-wechat",
|