@buz-extensions/buz 1.0.0-beta.3 → 1.0.0-beta.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/index.ts +23 -12
- package/package.json +1 -1
package/index.ts
CHANGED
|
@@ -85,20 +85,31 @@ export const buzChannelPlugin = {
|
|
|
85
85
|
resolveSessionTarget: ({ id }: any) => id,
|
|
86
86
|
},
|
|
87
87
|
setupWizard: {
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
88
|
+
channel: "buz",
|
|
89
|
+
status: {
|
|
90
|
+
configuredLabel: "configured",
|
|
91
|
+
unconfiguredLabel: "needs server + secret",
|
|
92
|
+
configuredHint: "configured",
|
|
93
|
+
unconfiguredHint: "needs server + secret",
|
|
94
|
+
configuredScore: 1,
|
|
95
|
+
unconfiguredScore: 0,
|
|
96
|
+
resolveConfigured: ({ cfg }: any) => {
|
|
97
|
+
const channelConfig = cfg?.channels?.["buz"];
|
|
98
|
+
const accounts = channelConfig?.accounts || {};
|
|
99
|
+
return Object.values(accounts).some((acc: any) =>
|
|
100
|
+
acc?.serverAddress && acc?.secretKey
|
|
101
|
+
) || (channelConfig?.serverAddress && channelConfig?.secretKey);
|
|
94
102
|
},
|
|
95
|
-
{
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
label: "Secret Key",
|
|
99
|
-
placeholder: "Enter your IM Secret Key",
|
|
103
|
+
resolveStatusLines: ({ cfg, configured }: any) => {
|
|
104
|
+
const accountCount = Object.keys(cfg?.channels?.["buz"]?.accounts || {}).length;
|
|
105
|
+
return [`buz: ${configured ? "configured" : "needs server + secret"}`, `Accounts: ${accountCount || 0}`];
|
|
100
106
|
},
|
|
101
|
-
|
|
107
|
+
},
|
|
108
|
+
credentials: [],
|
|
109
|
+
finalize: async ({ cfg, accountId, credentialValues, prompter }: any) => {
|
|
110
|
+
// buz uses setup adapter for configuration
|
|
111
|
+
return { cfg };
|
|
112
|
+
},
|
|
102
113
|
},
|
|
103
114
|
setup: {
|
|
104
115
|
validateInput: async (params: any) => {
|