@gloablehive/ipad-wechat-plugin 1.0.2 → 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 -8
- package/package.json +1 -1
- package/src/channel.ts +32 -9
package/dist/src/channel.js
CHANGED
|
@@ -78,21 +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 {
|
|
89
|
-
enabled: hasCredentials,
|
|
90
|
-
configured: hasCredentials,
|
|
91
|
-
tokenStatus: hasCredentials ? "available" : "missing",
|
|
92
|
-
};
|
|
86
|
+
applyAccountConfig: (params) => {
|
|
87
|
+
const { cfg, accountId, input } = params;
|
|
88
|
+
return cfg;
|
|
93
89
|
},
|
|
94
90
|
},
|
|
95
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
|
+
},
|
|
96
118
|
security: {
|
|
97
119
|
dm: {
|
|
98
120
|
channelKey: "ipad-wechat",
|
package/package.json
CHANGED
package/src/channel.ts
CHANGED
|
@@ -114,22 +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 {
|
|
125
|
-
enabled: hasCredentials,
|
|
126
|
-
configured: hasCredentials,
|
|
127
|
-
tokenStatus: hasCredentials ? "available" : "missing",
|
|
128
|
-
};
|
|
122
|
+
applyAccountConfig: (params: any) => {
|
|
123
|
+
const { cfg, accountId, input } = params;
|
|
124
|
+
return cfg;
|
|
129
125
|
},
|
|
130
|
-
}
|
|
126
|
+
},
|
|
131
127
|
}) as any,
|
|
132
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
|
+
|
|
133
156
|
security: {
|
|
134
157
|
dm: {
|
|
135
158
|
channelKey: "ipad-wechat",
|