mitra-interactions-sdk 1.0.46 → 1.0.47
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/index.d.mts +19 -1
- package/dist/index.d.ts +19 -1
- package/dist/index.js +34 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +33 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -500,6 +500,8 @@ interface MitraInstance {
|
|
|
500
500
|
setProfileActions(options: SetProfileActionsOptions): Promise<SetProfilePermissionResponse>;
|
|
501
501
|
setProfileScreens(options: SetProfileScreensOptions): Promise<SetProfilePermissionResponse>;
|
|
502
502
|
setProfileServerFunctions(options: SetProfileServerFunctionsOptions): Promise<SetProfilePermissionResponse>;
|
|
503
|
+
openChat(): void;
|
|
504
|
+
closeChat(): void;
|
|
503
505
|
}
|
|
504
506
|
declare function createMitraInstance(initialConfig: Partial<MitraConfig>): MitraInstance;
|
|
505
507
|
|
|
@@ -535,6 +537,22 @@ declare function resolveProjectId(projectId?: number): number;
|
|
|
535
537
|
*/
|
|
536
538
|
declare function stopTracking(): void;
|
|
537
539
|
|
|
540
|
+
/**
|
|
541
|
+
* Mitra Interactions SDK - Chat Integration
|
|
542
|
+
*
|
|
543
|
+
* Integrates with the __mitraChat object injected by the build-proxy
|
|
544
|
+
* in published apps. Chat is initialized automatically by configureSdkMitra().
|
|
545
|
+
*/
|
|
546
|
+
/**
|
|
547
|
+
* Opens the Mitra Chat sidebar.
|
|
548
|
+
* If chat is still loading, polls until ready (max 15s).
|
|
549
|
+
*/
|
|
550
|
+
declare function openChatMitra(): void;
|
|
551
|
+
/**
|
|
552
|
+
* Closes the Mitra Chat sidebar.
|
|
553
|
+
*/
|
|
554
|
+
declare function closeChatMitra(): void;
|
|
555
|
+
|
|
538
556
|
/**
|
|
539
557
|
* Mitra Interactions SDK - Autenticação
|
|
540
558
|
*
|
|
@@ -725,4 +743,4 @@ declare function setProfileScreensMitra(options: SetProfileScreensOptions): Prom
|
|
|
725
743
|
*/
|
|
726
744
|
declare function setProfileServerFunctionsMitra(options: SetProfileServerFunctionsOptions): Promise<SetProfilePermissionResponse>;
|
|
727
745
|
|
|
728
|
-
export { type CallIntegrationOptions, type CallIntegrationResponse, type CreateProfileOptions, type CreateProfileResponse, type CreateRecordOptions, type CreateRecordsBatchOptions, type DeleteProfileOptions, type DeleteProfileResponse, type DeleteRecordOptions, type EmailLoginOptions, type EmailResendCodeOptions, type EmailSignupOptions, type EmailVerifyCodeOptions, type ExecuteDataLoaderOptions, type ExecuteDataLoaderResponse, type ExecuteDbActionOptions, type ExecuteDbActionResponse, type ExecuteServerFunctionAsyncOptions, type ExecuteServerFunctionAsyncResponse, type ExecuteServerFunctionOptions, type ExecuteServerFunctionResponse, type GetProfileDetailsOptions, type GetProfileDetailsResponse, type GetRecordOptions, type GetVariableOptions, type GetVariableResponse, type IntegrationResponse, type ListIntegrationsOptions, type ListProfilesOptions, type ListProfilesResponse, type ListRecordsOptions, type ListRecordsResponse, type ListVariablesOptions, type ListVariablesResponse, type LoginOptions, type LoginResponse, type MitraConfig, type MitraInstance, type PatchRecordOptions, type ProfileTableRef, type RunActionOptions, type RunActionResponse, type SetFileStatusOptions, type SetFileStatusResponse, type SetProfileActionsOptions, type SetProfileDmlTablesOptions, type SetProfilePermissionResponse, type SetProfileScreensOptions, type SetProfileSelectTablesOptions, type SetProfileServerFunctionsOptions, type SetProfileUsersOptions, type SetVariableOptions, type SetVariableResponse, type StopServerFunctionExecutionOptions, type StopServerFunctionExecutionResponse, type UpdateProfileOptions, type UpdateProfileResponse, type UpdateRecordOptions, type UploadFileOptions, type UploadFileResponse, callIntegrationMitra, configureSdkMitra, createMitraInstance, createProfileMitra, createRecordMitra, createRecordsBatchMitra, deleteProfileMitra, deleteRecordMitra, emailLoginMitra, emailResendCodeMitra, emailSignupMitra, emailVerifyCodeMitra, executeDataLoaderMitra, executeDbActionMitra, executeServerFunctionAsyncMitra, executeServerFunctionMitra, getConfig, getProfileDetailsMitra, getRecordMitra, getVariableMitra, listIntegrationsMitra, listProfilesMitra, listRecordsMitra, listVariablesMitra, loginMitra, loginWithEmailMitra, loginWithGoogleMitra, loginWithMicrosoftMitra, patchRecordMitra, refreshTokenSilently, resolveProjectId, runActionMitra, setFileStatusMitra, setProfileActionsMitra, setProfileDmlTablesMitra, setProfileScreensMitra, setProfileSelectTablesMitra, setProfileServerFunctionsMitra, setProfileUsersMitra, setVariableMitra, stopServerFunctionExecutionMitra, stopTracking, updateProfileMitra, updateRecordMitra, uploadFileLoadableMitra, uploadFilePublicMitra };
|
|
746
|
+
export { type CallIntegrationOptions, type CallIntegrationResponse, type CreateProfileOptions, type CreateProfileResponse, type CreateRecordOptions, type CreateRecordsBatchOptions, type DeleteProfileOptions, type DeleteProfileResponse, type DeleteRecordOptions, type EmailLoginOptions, type EmailResendCodeOptions, type EmailSignupOptions, type EmailVerifyCodeOptions, type ExecuteDataLoaderOptions, type ExecuteDataLoaderResponse, type ExecuteDbActionOptions, type ExecuteDbActionResponse, type ExecuteServerFunctionAsyncOptions, type ExecuteServerFunctionAsyncResponse, type ExecuteServerFunctionOptions, type ExecuteServerFunctionResponse, type GetProfileDetailsOptions, type GetProfileDetailsResponse, type GetRecordOptions, type GetVariableOptions, type GetVariableResponse, type IntegrationResponse, type ListIntegrationsOptions, type ListProfilesOptions, type ListProfilesResponse, type ListRecordsOptions, type ListRecordsResponse, type ListVariablesOptions, type ListVariablesResponse, type LoginOptions, type LoginResponse, type MitraConfig, type MitraInstance, type PatchRecordOptions, type ProfileTableRef, type RunActionOptions, type RunActionResponse, type SetFileStatusOptions, type SetFileStatusResponse, type SetProfileActionsOptions, type SetProfileDmlTablesOptions, type SetProfilePermissionResponse, type SetProfileScreensOptions, type SetProfileSelectTablesOptions, type SetProfileServerFunctionsOptions, type SetProfileUsersOptions, type SetVariableOptions, type SetVariableResponse, type StopServerFunctionExecutionOptions, type StopServerFunctionExecutionResponse, type UpdateProfileOptions, type UpdateProfileResponse, type UpdateRecordOptions, type UploadFileOptions, type UploadFileResponse, callIntegrationMitra, closeChatMitra, configureSdkMitra, createMitraInstance, createProfileMitra, createRecordMitra, createRecordsBatchMitra, deleteProfileMitra, deleteRecordMitra, emailLoginMitra, emailResendCodeMitra, emailSignupMitra, emailVerifyCodeMitra, executeDataLoaderMitra, executeDbActionMitra, executeServerFunctionAsyncMitra, executeServerFunctionMitra, getConfig, getProfileDetailsMitra, getRecordMitra, getVariableMitra, listIntegrationsMitra, listProfilesMitra, listRecordsMitra, listVariablesMitra, loginMitra, loginWithEmailMitra, loginWithGoogleMitra, loginWithMicrosoftMitra, openChatMitra, patchRecordMitra, refreshTokenSilently, resolveProjectId, runActionMitra, setFileStatusMitra, setProfileActionsMitra, setProfileDmlTablesMitra, setProfileScreensMitra, setProfileSelectTablesMitra, setProfileServerFunctionsMitra, setProfileUsersMitra, setVariableMitra, stopServerFunctionExecutionMitra, stopTracking, updateProfileMitra, updateRecordMitra, uploadFileLoadableMitra, uploadFilePublicMitra };
|
package/dist/index.d.ts
CHANGED
|
@@ -500,6 +500,8 @@ interface MitraInstance {
|
|
|
500
500
|
setProfileActions(options: SetProfileActionsOptions): Promise<SetProfilePermissionResponse>;
|
|
501
501
|
setProfileScreens(options: SetProfileScreensOptions): Promise<SetProfilePermissionResponse>;
|
|
502
502
|
setProfileServerFunctions(options: SetProfileServerFunctionsOptions): Promise<SetProfilePermissionResponse>;
|
|
503
|
+
openChat(): void;
|
|
504
|
+
closeChat(): void;
|
|
503
505
|
}
|
|
504
506
|
declare function createMitraInstance(initialConfig: Partial<MitraConfig>): MitraInstance;
|
|
505
507
|
|
|
@@ -535,6 +537,22 @@ declare function resolveProjectId(projectId?: number): number;
|
|
|
535
537
|
*/
|
|
536
538
|
declare function stopTracking(): void;
|
|
537
539
|
|
|
540
|
+
/**
|
|
541
|
+
* Mitra Interactions SDK - Chat Integration
|
|
542
|
+
*
|
|
543
|
+
* Integrates with the __mitraChat object injected by the build-proxy
|
|
544
|
+
* in published apps. Chat is initialized automatically by configureSdkMitra().
|
|
545
|
+
*/
|
|
546
|
+
/**
|
|
547
|
+
* Opens the Mitra Chat sidebar.
|
|
548
|
+
* If chat is still loading, polls until ready (max 15s).
|
|
549
|
+
*/
|
|
550
|
+
declare function openChatMitra(): void;
|
|
551
|
+
/**
|
|
552
|
+
* Closes the Mitra Chat sidebar.
|
|
553
|
+
*/
|
|
554
|
+
declare function closeChatMitra(): void;
|
|
555
|
+
|
|
538
556
|
/**
|
|
539
557
|
* Mitra Interactions SDK - Autenticação
|
|
540
558
|
*
|
|
@@ -725,4 +743,4 @@ declare function setProfileScreensMitra(options: SetProfileScreensOptions): Prom
|
|
|
725
743
|
*/
|
|
726
744
|
declare function setProfileServerFunctionsMitra(options: SetProfileServerFunctionsOptions): Promise<SetProfilePermissionResponse>;
|
|
727
745
|
|
|
728
|
-
export { type CallIntegrationOptions, type CallIntegrationResponse, type CreateProfileOptions, type CreateProfileResponse, type CreateRecordOptions, type CreateRecordsBatchOptions, type DeleteProfileOptions, type DeleteProfileResponse, type DeleteRecordOptions, type EmailLoginOptions, type EmailResendCodeOptions, type EmailSignupOptions, type EmailVerifyCodeOptions, type ExecuteDataLoaderOptions, type ExecuteDataLoaderResponse, type ExecuteDbActionOptions, type ExecuteDbActionResponse, type ExecuteServerFunctionAsyncOptions, type ExecuteServerFunctionAsyncResponse, type ExecuteServerFunctionOptions, type ExecuteServerFunctionResponse, type GetProfileDetailsOptions, type GetProfileDetailsResponse, type GetRecordOptions, type GetVariableOptions, type GetVariableResponse, type IntegrationResponse, type ListIntegrationsOptions, type ListProfilesOptions, type ListProfilesResponse, type ListRecordsOptions, type ListRecordsResponse, type ListVariablesOptions, type ListVariablesResponse, type LoginOptions, type LoginResponse, type MitraConfig, type MitraInstance, type PatchRecordOptions, type ProfileTableRef, type RunActionOptions, type RunActionResponse, type SetFileStatusOptions, type SetFileStatusResponse, type SetProfileActionsOptions, type SetProfileDmlTablesOptions, type SetProfilePermissionResponse, type SetProfileScreensOptions, type SetProfileSelectTablesOptions, type SetProfileServerFunctionsOptions, type SetProfileUsersOptions, type SetVariableOptions, type SetVariableResponse, type StopServerFunctionExecutionOptions, type StopServerFunctionExecutionResponse, type UpdateProfileOptions, type UpdateProfileResponse, type UpdateRecordOptions, type UploadFileOptions, type UploadFileResponse, callIntegrationMitra, configureSdkMitra, createMitraInstance, createProfileMitra, createRecordMitra, createRecordsBatchMitra, deleteProfileMitra, deleteRecordMitra, emailLoginMitra, emailResendCodeMitra, emailSignupMitra, emailVerifyCodeMitra, executeDataLoaderMitra, executeDbActionMitra, executeServerFunctionAsyncMitra, executeServerFunctionMitra, getConfig, getProfileDetailsMitra, getRecordMitra, getVariableMitra, listIntegrationsMitra, listProfilesMitra, listRecordsMitra, listVariablesMitra, loginMitra, loginWithEmailMitra, loginWithGoogleMitra, loginWithMicrosoftMitra, patchRecordMitra, refreshTokenSilently, resolveProjectId, runActionMitra, setFileStatusMitra, setProfileActionsMitra, setProfileDmlTablesMitra, setProfileScreensMitra, setProfileSelectTablesMitra, setProfileServerFunctionsMitra, setProfileUsersMitra, setVariableMitra, stopServerFunctionExecutionMitra, stopTracking, updateProfileMitra, updateRecordMitra, uploadFileLoadableMitra, uploadFilePublicMitra };
|
|
746
|
+
export { type CallIntegrationOptions, type CallIntegrationResponse, type CreateProfileOptions, type CreateProfileResponse, type CreateRecordOptions, type CreateRecordsBatchOptions, type DeleteProfileOptions, type DeleteProfileResponse, type DeleteRecordOptions, type EmailLoginOptions, type EmailResendCodeOptions, type EmailSignupOptions, type EmailVerifyCodeOptions, type ExecuteDataLoaderOptions, type ExecuteDataLoaderResponse, type ExecuteDbActionOptions, type ExecuteDbActionResponse, type ExecuteServerFunctionAsyncOptions, type ExecuteServerFunctionAsyncResponse, type ExecuteServerFunctionOptions, type ExecuteServerFunctionResponse, type GetProfileDetailsOptions, type GetProfileDetailsResponse, type GetRecordOptions, type GetVariableOptions, type GetVariableResponse, type IntegrationResponse, type ListIntegrationsOptions, type ListProfilesOptions, type ListProfilesResponse, type ListRecordsOptions, type ListRecordsResponse, type ListVariablesOptions, type ListVariablesResponse, type LoginOptions, type LoginResponse, type MitraConfig, type MitraInstance, type PatchRecordOptions, type ProfileTableRef, type RunActionOptions, type RunActionResponse, type SetFileStatusOptions, type SetFileStatusResponse, type SetProfileActionsOptions, type SetProfileDmlTablesOptions, type SetProfilePermissionResponse, type SetProfileScreensOptions, type SetProfileSelectTablesOptions, type SetProfileServerFunctionsOptions, type SetProfileUsersOptions, type SetVariableOptions, type SetVariableResponse, type StopServerFunctionExecutionOptions, type StopServerFunctionExecutionResponse, type UpdateProfileOptions, type UpdateProfileResponse, type UpdateRecordOptions, type UploadFileOptions, type UploadFileResponse, callIntegrationMitra, closeChatMitra, configureSdkMitra, createMitraInstance, createProfileMitra, createRecordMitra, createRecordsBatchMitra, deleteProfileMitra, deleteRecordMitra, emailLoginMitra, emailResendCodeMitra, emailSignupMitra, emailVerifyCodeMitra, executeDataLoaderMitra, executeDbActionMitra, executeServerFunctionAsyncMitra, executeServerFunctionMitra, getConfig, getProfileDetailsMitra, getRecordMitra, getVariableMitra, listIntegrationsMitra, listProfilesMitra, listRecordsMitra, listVariablesMitra, loginMitra, loginWithEmailMitra, loginWithGoogleMitra, loginWithMicrosoftMitra, openChatMitra, patchRecordMitra, refreshTokenSilently, resolveProjectId, runActionMitra, setFileStatusMitra, setProfileActionsMitra, setProfileDmlTablesMitra, setProfileScreensMitra, setProfileSelectTablesMitra, setProfileServerFunctionsMitra, setProfileUsersMitra, setVariableMitra, stopServerFunctionExecutionMitra, stopTracking, updateProfileMitra, updateRecordMitra, uploadFileLoadableMitra, uploadFilePublicMitra };
|
package/dist/index.js
CHANGED
|
@@ -248,6 +248,29 @@ async function emailLoginMitra(options) {
|
|
|
248
248
|
return response;
|
|
249
249
|
}
|
|
250
250
|
|
|
251
|
+
// src/chat.ts
|
|
252
|
+
function openChatMitra() {
|
|
253
|
+
if (typeof window === "undefined") return;
|
|
254
|
+
const chat = window.__mitraChat;
|
|
255
|
+
if (!chat) return;
|
|
256
|
+
if (chat.isReady) {
|
|
257
|
+
chat.open();
|
|
258
|
+
} else {
|
|
259
|
+
const iv = setInterval(() => {
|
|
260
|
+
if (chat.isReady) {
|
|
261
|
+
clearInterval(iv);
|
|
262
|
+
chat.open();
|
|
263
|
+
}
|
|
264
|
+
}, 200);
|
|
265
|
+
setTimeout(() => clearInterval(iv), 15e3);
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
function closeChatMitra() {
|
|
269
|
+
var _a;
|
|
270
|
+
if (typeof window === "undefined") return;
|
|
271
|
+
(_a = window.__mitraChat) == null ? void 0 : _a.close();
|
|
272
|
+
}
|
|
273
|
+
|
|
251
274
|
// src/instance.ts
|
|
252
275
|
function formatToken(token) {
|
|
253
276
|
return token.startsWith("Bearer ") ? token : `Bearer ${token}`;
|
|
@@ -549,6 +572,13 @@ function createMitraInstance(initialConfig) {
|
|
|
549
572
|
return request("POST", "/interactions/profiles/serverFunctions", {
|
|
550
573
|
body: { projectId: resolveProjectId2(options.projectId), profileId: options.profileId, serverFunctionIds: options.serverFunctionIds }
|
|
551
574
|
});
|
|
575
|
+
},
|
|
576
|
+
// Chat
|
|
577
|
+
openChat() {
|
|
578
|
+
openChatMitra();
|
|
579
|
+
},
|
|
580
|
+
closeChat() {
|
|
581
|
+
closeChatMitra();
|
|
552
582
|
}
|
|
553
583
|
};
|
|
554
584
|
return instance;
|
|
@@ -645,6 +675,8 @@ function configureSdkMitra(config) {
|
|
|
645
675
|
};
|
|
646
676
|
if (config.token && typeof window !== "undefined") {
|
|
647
677
|
startTracking();
|
|
678
|
+
const chat = window.__mitraChat;
|
|
679
|
+
if (chat) chat.init(config.token);
|
|
648
680
|
}
|
|
649
681
|
return createMitraInstance(config);
|
|
650
682
|
}
|
|
@@ -1069,6 +1101,7 @@ async function setProfileServerFunctionsMitra(options) {
|
|
|
1069
1101
|
}
|
|
1070
1102
|
|
|
1071
1103
|
exports.callIntegrationMitra = callIntegrationMitra;
|
|
1104
|
+
exports.closeChatMitra = closeChatMitra;
|
|
1072
1105
|
exports.configureSdkMitra = configureSdkMitra;
|
|
1073
1106
|
exports.createMitraInstance = createMitraInstance;
|
|
1074
1107
|
exports.createProfileMitra = createProfileMitra;
|
|
@@ -1096,6 +1129,7 @@ exports.loginMitra = loginMitra;
|
|
|
1096
1129
|
exports.loginWithEmailMitra = loginWithEmailMitra;
|
|
1097
1130
|
exports.loginWithGoogleMitra = loginWithGoogleMitra;
|
|
1098
1131
|
exports.loginWithMicrosoftMitra = loginWithMicrosoftMitra;
|
|
1132
|
+
exports.openChatMitra = openChatMitra;
|
|
1099
1133
|
exports.patchRecordMitra = patchRecordMitra;
|
|
1100
1134
|
exports.refreshTokenSilently = refreshTokenSilently;
|
|
1101
1135
|
exports.resolveProjectId = resolveProjectId;
|