isometrik-plugin-chat-sdk 1.0.1 → 1.0.2
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/cjs/{MessageSearch-f5b72462.js → MessageSearch-a73ca677.js} +82 -11
- package/dist/cjs/MessageSearch-a73ca677.js.map +1 -0
- package/dist/cjs/{WebChat-2329244b.js → WebChat-11c06cb9.js} +428 -37
- package/dist/cjs/WebChat-11c06cb9.js.map +1 -0
- package/dist/cjs/audio-bubble_8.cjs.entry.js +1 -1
- package/dist/cjs/chat-app.cjs.entry.js +2 -2
- package/dist/cjs/theme-provider_2.cjs.entry.js +2 -2
- package/dist/collection/api/social-accounts.js +77 -9
- package/dist/collection/components/my-component/web-chat/WebChat.js +19 -14
- package/dist/collection/components/my-component/web-chat/WebChat.js.map +1 -1
- package/dist/collection/stories/Components/InstagramAccounts/InstagramAccountsPanel.js +412 -22
- package/dist/esm/{MessageSearch-4010486c.js → MessageSearch-69b3a0f3.js} +79 -11
- package/dist/esm/MessageSearch-69b3a0f3.js.map +1 -0
- package/dist/esm/{WebChat-95518d72.js → WebChat-372df148.js} +428 -37
- package/dist/esm/WebChat-372df148.js.map +1 -0
- package/dist/esm/audio-bubble_8.entry.js +2 -2
- package/dist/esm/chat-app.entry.js +2 -2
- package/dist/esm/theme-provider_2.entry.js +2 -2
- package/dist/isometrik-webchat/isometrik-webchat.esm.js +1 -1
- package/dist/isometrik-webchat/{p-d7e335cb.entry.js → p-56fbdbc3.entry.js} +2 -2
- package/dist/isometrik-webchat/{p-35f143c9.entry.js → p-8456ee94.entry.js} +2 -2
- package/dist/isometrik-webchat/{p-55355714.js → p-9058d82c.js} +17 -17
- package/dist/isometrik-webchat/p-9058d82c.js.map +1 -0
- package/dist/isometrik-webchat/p-9588b7ec.js +780 -0
- package/dist/isometrik-webchat/p-9588b7ec.js.map +1 -0
- package/dist/isometrik-webchat/{p-675c105e.entry.js → p-e66e5e61.entry.js} +2 -2
- package/package.json +1 -1
- package/readme.md +5 -5
- package/dist/cjs/MessageSearch-f5b72462.js.map +0 -1
- package/dist/cjs/WebChat-2329244b.js.map +0 -1
- package/dist/esm/MessageSearch-4010486c.js.map +0 -1
- package/dist/esm/WebChat-95518d72.js.map +0 -1
- package/dist/isometrik-webchat/p-55355714.js.map +0 -1
- package/dist/isometrik-webchat/p-e954c29f.js +0 -591
- package/dist/isometrik-webchat/p-e954c29f.js.map +0 -1
- /package/dist/isometrik-webchat/{p-d7e335cb.entry.js.map → p-56fbdbc3.entry.js.map} +0 -0
- /package/dist/isometrik-webchat/{p-35f143c9.entry.js.map → p-8456ee94.entry.js.map} +0 -0
- /package/dist/isometrik-webchat/{p-675c105e.entry.js.map → p-e66e5e61.entry.js.map} +0 -0
|
@@ -1093,7 +1093,7 @@ const openSocialAuthPopup = (authUrl) =>
|
|
|
1093
1093
|
}, 400);
|
|
1094
1094
|
});
|
|
1095
1095
|
|
|
1096
|
-
/** POST /chat/social/connect */
|
|
1096
|
+
/** POST /chat/social/connect — Instagram OAuth (authUrl) or LinkedIn credentials */
|
|
1097
1097
|
const connectSocialAccount = async ({
|
|
1098
1098
|
baseUrl,
|
|
1099
1099
|
appSecret,
|
|
@@ -1101,24 +1101,86 @@ const connectSocialAccount = async ({
|
|
|
1101
1101
|
platform = 'instagram',
|
|
1102
1102
|
redirectUrl,
|
|
1103
1103
|
loginMethod = 'instagram_login',
|
|
1104
|
+
username,
|
|
1105
|
+
password,
|
|
1106
|
+
agentUserId,
|
|
1104
1107
|
} = {}) => {
|
|
1105
1108
|
const creds = getCreds({ baseUrl, appSecret, licenseKey });
|
|
1109
|
+
const body =
|
|
1110
|
+
platform === 'linkedin'
|
|
1111
|
+
? {
|
|
1112
|
+
platform: 'linkedin',
|
|
1113
|
+
username,
|
|
1114
|
+
password,
|
|
1115
|
+
agentUserId: agentUserId || CHAT_CREDS.isometrikUserId,
|
|
1116
|
+
}
|
|
1117
|
+
: {
|
|
1118
|
+
platform,
|
|
1119
|
+
redirectUrl: redirectUrl || getSocialRedirectUrl(),
|
|
1120
|
+
loginMethod,
|
|
1121
|
+
};
|
|
1122
|
+
|
|
1106
1123
|
const response = await fetch(`${creds.baseUrl}/chat/social/connect`, {
|
|
1124
|
+
method: 'POST',
|
|
1125
|
+
headers: getHeaders(creds.appSecret, creds.licenseKey),
|
|
1126
|
+
body: JSON.stringify(body),
|
|
1127
|
+
});
|
|
1128
|
+
const data = await response.json();
|
|
1129
|
+
if (!response.ok) {
|
|
1130
|
+
throw new Error(data.message || 'Failed to connect social account');
|
|
1131
|
+
}
|
|
1132
|
+
return data;
|
|
1133
|
+
};
|
|
1134
|
+
|
|
1135
|
+
/** POST /chat/social/connect/checkpoint — LinkedIn OTP / 2FA */
|
|
1136
|
+
const submitSocialConnectCheckpoint = async ({
|
|
1137
|
+
baseUrl,
|
|
1138
|
+
appSecret,
|
|
1139
|
+
licenseKey,
|
|
1140
|
+
platform = 'linkedin',
|
|
1141
|
+
accountId,
|
|
1142
|
+
code,
|
|
1143
|
+
agentUserId,
|
|
1144
|
+
} = {}) => {
|
|
1145
|
+
const creds = getCreds({ baseUrl, appSecret, licenseKey });
|
|
1146
|
+
const response = await fetch(`${creds.baseUrl}/chat/social/connect/checkpoint`, {
|
|
1107
1147
|
method: 'POST',
|
|
1108
1148
|
headers: getHeaders(creds.appSecret, creds.licenseKey),
|
|
1109
1149
|
body: JSON.stringify({
|
|
1110
1150
|
platform,
|
|
1111
|
-
|
|
1112
|
-
|
|
1151
|
+
accountId,
|
|
1152
|
+
code,
|
|
1153
|
+
agentUserId: agentUserId || CHAT_CREDS.isometrikUserId,
|
|
1113
1154
|
}),
|
|
1114
1155
|
});
|
|
1115
1156
|
const data = await response.json();
|
|
1116
1157
|
if (!response.ok) {
|
|
1117
|
-
throw new Error(data.message || 'Failed to
|
|
1158
|
+
throw new Error(data.message || 'Failed to complete social checkpoint');
|
|
1118
1159
|
}
|
|
1119
1160
|
return data;
|
|
1120
1161
|
};
|
|
1121
1162
|
|
|
1163
|
+
/** True when connect response still needs OTP / 2FA. */
|
|
1164
|
+
const isSocialCheckpointRequired = (data = {}) => {
|
|
1165
|
+
if (!data || typeof data !== 'object') return false;
|
|
1166
|
+
const status = String(data.status || data.checkpointStatus || '').toLowerCase();
|
|
1167
|
+
if (status.includes('checkpoint') || status === 'pending' || status === 'otp_required') {
|
|
1168
|
+
return true;
|
|
1169
|
+
}
|
|
1170
|
+
if (data.checkpoint || data.checkpointType || data.checkpointRequired) return true;
|
|
1171
|
+
if (data.object === 'Checkpoint' || data.object === 'checkpoint') return true;
|
|
1172
|
+
return false;
|
|
1173
|
+
};
|
|
1174
|
+
|
|
1175
|
+
const getSocialAccountIdFromConnect = (data = {}) =>
|
|
1176
|
+
data?.accountId ||
|
|
1177
|
+
data?.zernioAccountId ||
|
|
1178
|
+
data?.unipileAccountId ||
|
|
1179
|
+
data?.checkpoint?.account_id ||
|
|
1180
|
+
data?.checkpoint?.accountId ||
|
|
1181
|
+
data?.data?.accountId ||
|
|
1182
|
+
'';
|
|
1183
|
+
|
|
1122
1184
|
/** POST /chat/social/connect/callback — zernioAccountId from GET /chat/social/accounts */
|
|
1123
1185
|
const connectSocialAccountCallback = async ({
|
|
1124
1186
|
baseUrl,
|
|
@@ -1162,24 +1224,30 @@ const connectSocialAccountCallback = async ({
|
|
|
1162
1224
|
return data;
|
|
1163
1225
|
};
|
|
1164
1226
|
|
|
1165
|
-
/** True when at least one
|
|
1166
|
-
const
|
|
1227
|
+
/** True when at least one social account is actively linked. */
|
|
1228
|
+
const hasConnectedSocialAccounts = (accounts = []) =>
|
|
1167
1229
|
(accounts || []).some(
|
|
1168
1230
|
(account) =>
|
|
1169
1231
|
account &&
|
|
1170
|
-
(account.zernioAccountId || account.accountId) &&
|
|
1232
|
+
(account.zernioAccountId || account.accountId || account.unipileAccountId) &&
|
|
1171
1233
|
account.status === 'connected'
|
|
1172
1234
|
);
|
|
1173
1235
|
|
|
1174
1236
|
/** Only accounts that are actively connected (API keeps disconnected rows). */
|
|
1175
|
-
const
|
|
1237
|
+
const getConnectedSocialAccounts = (accounts = []) =>
|
|
1176
1238
|
(accounts || []).filter(
|
|
1177
1239
|
(account) =>
|
|
1178
1240
|
account &&
|
|
1179
|
-
(account.zernioAccountId || account.accountId) &&
|
|
1241
|
+
(account.zernioAccountId || account.accountId || account.unipileAccountId) &&
|
|
1180
1242
|
account.status === 'connected'
|
|
1181
1243
|
);
|
|
1182
1244
|
|
|
1245
|
+
/** @deprecated use hasConnectedSocialAccounts */
|
|
1246
|
+
const hasConnectedInstagramAccounts = hasConnectedSocialAccounts;
|
|
1247
|
+
|
|
1248
|
+
/** @deprecated use getConnectedSocialAccounts */
|
|
1249
|
+
const getConnectedInstagramAccounts = getConnectedSocialAccounts;
|
|
1250
|
+
|
|
1183
1251
|
/** GET /chat/social/accounts?platform=... */
|
|
1184
1252
|
const getSocialAccounts = async ({
|
|
1185
1253
|
baseUrl,
|
|
@@ -5870,6 +5938,6 @@ height:100%;
|
|
|
5870
5938
|
|
|
5871
5939
|
customElements.define('message-search', MesssageSearch);
|
|
5872
5940
|
|
|
5873
|
-
export { ProfilePage as P, getSocialAccounts as a, connectSocialAccount as b, connectSocialAccountCallback as c, deleteSocialAccount as d, getSocialRedirectUrl as e,
|
|
5941
|
+
export { ProfilePage as P, getSocialAccounts as a, connectSocialAccount as b, connectSocialAccountCallback as c, deleteSocialAccount as d, getSocialRedirectUrl as e, getSocialAccountIdFromConnect as f, getConnectedSocialAccounts as g, createStore as h, isSocialCheckpointRequired as i, hasConnectedInstagramAccounts as j, clearSocialCallbackParamsFromUrl as k, groupMembersStore as l, conversationStore as m, notifyOpenerIfSocialPopupCallback as n, openSocialAuthPopup as o, parseSocialCallbackParams as p, formatUnixTimestamp as q, submitSocialConnectCheckpoint as s };
|
|
5874
5942
|
|
|
5875
|
-
//# sourceMappingURL=MessageSearch-
|
|
5943
|
+
//# sourceMappingURL=MessageSearch-69b3a0f3.js.map
|