mitra-interactions-sdk 1.0.45 → 1.0.46-beta.1

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 CHANGED
@@ -494,6 +494,8 @@ interface MitraInstance {
494
494
  setProfileActions(options: SetProfileActionsOptions): Promise<SetProfilePermissionResponse>;
495
495
  setProfileScreens(options: SetProfileScreensOptions): Promise<SetProfilePermissionResponse>;
496
496
  setProfileServerFunctions(options: SetProfileServerFunctionsOptions): Promise<SetProfilePermissionResponse>;
497
+ openChat(): void;
498
+ closeChat(): void;
497
499
  }
498
500
  declare function createMitraInstance(initialConfig: Partial<MitraConfig>): MitraInstance;
499
501
 
@@ -529,6 +531,22 @@ declare function resolveProjectId(projectId?: number): number;
529
531
  */
530
532
  declare function stopTracking(): void;
531
533
 
534
+ /**
535
+ * Mitra Interactions SDK - Chat Integration
536
+ *
537
+ * Integrates with the __mitraChat object injected by the build-proxy
538
+ * in published apps. Provides openMitraChat() and closeMitraChat().
539
+ */
540
+ /**
541
+ * Opens the Mitra Chat sidebar.
542
+ * If chat is not ready, initializes with the configured token and waits for connection.
543
+ */
544
+ declare function openChatMitra(): void;
545
+ /**
546
+ * Closes the Mitra Chat sidebar.
547
+ */
548
+ declare function closeChatMitra(): void;
549
+
532
550
  /**
533
551
  * Mitra Interactions SDK - Autenticação
534
552
  *
@@ -719,4 +737,4 @@ declare function setProfileScreensMitra(options: SetProfileScreensOptions): Prom
719
737
  */
720
738
  declare function setProfileServerFunctionsMitra(options: SetProfileServerFunctionsOptions): Promise<SetProfilePermissionResponse>;
721
739
 
722
- 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 };
740
+ 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
@@ -494,6 +494,8 @@ interface MitraInstance {
494
494
  setProfileActions(options: SetProfileActionsOptions): Promise<SetProfilePermissionResponse>;
495
495
  setProfileScreens(options: SetProfileScreensOptions): Promise<SetProfilePermissionResponse>;
496
496
  setProfileServerFunctions(options: SetProfileServerFunctionsOptions): Promise<SetProfilePermissionResponse>;
497
+ openChat(): void;
498
+ closeChat(): void;
497
499
  }
498
500
  declare function createMitraInstance(initialConfig: Partial<MitraConfig>): MitraInstance;
499
501
 
@@ -529,6 +531,22 @@ declare function resolveProjectId(projectId?: number): number;
529
531
  */
530
532
  declare function stopTracking(): void;
531
533
 
534
+ /**
535
+ * Mitra Interactions SDK - Chat Integration
536
+ *
537
+ * Integrates with the __mitraChat object injected by the build-proxy
538
+ * in published apps. Provides openMitraChat() and closeMitraChat().
539
+ */
540
+ /**
541
+ * Opens the Mitra Chat sidebar.
542
+ * If chat is not ready, initializes with the configured token and waits for connection.
543
+ */
544
+ declare function openChatMitra(): void;
545
+ /**
546
+ * Closes the Mitra Chat sidebar.
547
+ */
548
+ declare function closeChatMitra(): void;
549
+
532
550
  /**
533
551
  * Mitra Interactions SDK - Autenticação
534
552
  *
@@ -719,4 +737,4 @@ declare function setProfileScreensMitra(options: SetProfileScreensOptions): Prom
719
737
  */
720
738
  declare function setProfileServerFunctionsMitra(options: SetProfileServerFunctionsOptions): Promise<SetProfilePermissionResponse>;
721
739
 
722
- 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 };
740
+ 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,31 @@ 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
+ const token = isConfigured() ? getConfig().token : void 0;
258
+ if (token) chat.init(token);
259
+ const iv = setInterval(() => {
260
+ if (chat.isReady) {
261
+ clearInterval(iv);
262
+ chat.open();
263
+ }
264
+ }, 200);
265
+ setTimeout(() => clearInterval(iv), 15e3);
266
+ return;
267
+ }
268
+ chat.open();
269
+ }
270
+ function closeChatMitra() {
271
+ var _a;
272
+ if (typeof window === "undefined") return;
273
+ (_a = window.__mitraChat) == null ? void 0 : _a.close();
274
+ }
275
+
251
276
  // src/instance.ts
252
277
  function formatToken(token) {
253
278
  return token.startsWith("Bearer ") ? token : `Bearer ${token}`;
@@ -549,6 +574,13 @@ function createMitraInstance(initialConfig) {
549
574
  return request("POST", "/interactions/profiles/serverFunctions", {
550
575
  body: { projectId: resolveProjectId2(options.projectId), profileId: options.profileId, serverFunctionIds: options.serverFunctionIds }
551
576
  });
577
+ },
578
+ // Chat
579
+ openChat() {
580
+ openChatMitra();
581
+ },
582
+ closeChat() {
583
+ closeChatMitra();
552
584
  }
553
585
  };
554
586
  return instance;
@@ -1067,6 +1099,7 @@ async function setProfileServerFunctionsMitra(options) {
1067
1099
  }
1068
1100
 
1069
1101
  exports.callIntegrationMitra = callIntegrationMitra;
1102
+ exports.closeChatMitra = closeChatMitra;
1070
1103
  exports.configureSdkMitra = configureSdkMitra;
1071
1104
  exports.createMitraInstance = createMitraInstance;
1072
1105
  exports.createProfileMitra = createProfileMitra;
@@ -1094,6 +1127,7 @@ exports.loginMitra = loginMitra;
1094
1127
  exports.loginWithEmailMitra = loginWithEmailMitra;
1095
1128
  exports.loginWithGoogleMitra = loginWithGoogleMitra;
1096
1129
  exports.loginWithMicrosoftMitra = loginWithMicrosoftMitra;
1130
+ exports.openChatMitra = openChatMitra;
1097
1131
  exports.patchRecordMitra = patchRecordMitra;
1098
1132
  exports.refreshTokenSilently = refreshTokenSilently;
1099
1133
  exports.resolveProjectId = resolveProjectId;