openxiangda 1.0.122 → 1.0.124

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.
@@ -831,6 +831,50 @@ interface NotificationMessageRecord {
831
831
  interface SendNotificationResult {
832
832
  messages: NotificationMessageRecord[];
833
833
  }
834
+ type NotificationInboxReadStatus = "all" | "read" | "unread";
835
+ interface ListNotificationInboxParams {
836
+ appType?: string;
837
+ page?: number;
838
+ limit?: number;
839
+ readStatus?: NotificationInboxReadStatus;
840
+ keyword?: string;
841
+ templateCode?: string;
842
+ }
843
+ interface NotificationInboxMessage {
844
+ id: string;
845
+ messageId: string;
846
+ templateCode?: string;
847
+ templateName?: string;
848
+ recipientId: string;
849
+ channel: NotificationChannel | string;
850
+ status: string;
851
+ title: string;
852
+ content: string;
853
+ actionUrl?: string;
854
+ businessType?: string;
855
+ businessId?: string;
856
+ readAt?: string | Date;
857
+ unread: boolean;
858
+ sentAt?: string | Date;
859
+ createdAt: string | Date;
860
+ payload?: Record<string, unknown>;
861
+ [key: string]: unknown;
862
+ }
863
+ interface NotificationInboxListResult {
864
+ items: NotificationInboxMessage[];
865
+ total: number;
866
+ unreadCount: number;
867
+ page: number;
868
+ limit: number;
869
+ totalPages: number;
870
+ }
871
+ interface NotificationUnreadCountResult {
872
+ unreadCount: number;
873
+ }
874
+ interface MarkAllNotificationReadResult {
875
+ updatedCount: number;
876
+ readAt: string | Date;
877
+ }
834
878
  type ProcessApproveAction = "approved" | "rejected" | "returned";
835
879
  interface GetProcessInstanceParams {
836
880
  appType?: string;
@@ -1172,6 +1216,16 @@ interface PageSdk {
1172
1216
  batchSendByType<T = SendNotificationResult>(params: BatchSendNotificationByTypeParams): Promise<PageApiResponse<T>>;
1173
1217
  findConfig<T = NotificationTypeConfig | null>(notificationType: string, params?: FindNotificationConfigParams): Promise<PageApiResponse<T>>;
1174
1218
  previewTemplate<T = NotificationTemplatePreview>(params: PreviewNotificationTemplateParams): Promise<PageApiResponse<T>>;
1219
+ listInbox<T = NotificationInboxListResult>(params?: ListNotificationInboxParams): Promise<PageApiResponse<T>>;
1220
+ getUnreadCount<T = NotificationUnreadCountResult>(params?: {
1221
+ appType?: string;
1222
+ }): Promise<PageApiResponse<T>>;
1223
+ markRead<T = NotificationInboxMessage>(messageId: string, params?: {
1224
+ appType?: string;
1225
+ }): Promise<PageApiResponse<T>>;
1226
+ markAllRead<T = MarkAllNotificationReadResult>(params?: {
1227
+ appType?: string;
1228
+ }): Promise<PageApiResponse<T>>;
1175
1229
  };
1176
1230
  navigation: PageNavigationApi;
1177
1231
  ui: PageContext["ui"];
@@ -1651,6 +1705,12 @@ interface RuntimeRequestState<T> {
1651
1705
  }
1652
1706
  interface RuntimeReloadOptions {
1653
1707
  accessToken?: string | null;
1708
+ accessTokenOptions?: RuntimeAccessTokenOptions;
1709
+ }
1710
+ interface RuntimeAccessTokenOptions {
1711
+ scope?: "default" | "public";
1712
+ path?: string | null;
1713
+ clearIfToken?: string;
1654
1714
  }
1655
1715
  interface OpenXiangdaProviderProps {
1656
1716
  appType?: string;
@@ -1673,7 +1733,7 @@ interface OpenXiangdaRuntimeStore extends RuntimeRequestState<RuntimeBootstrap>
1673
1733
  fetchImpl: typeof fetch;
1674
1734
  baseFetchImpl: typeof fetch;
1675
1735
  reload: (options?: RuntimeReloadOptions) => Promise<void>;
1676
- setAccessToken: (accessToken?: string | null) => void;
1736
+ setAccessToken: (accessToken?: string | null, options?: RuntimeAccessTokenOptions) => void;
1677
1737
  }
1678
1738
  declare const OpenXiangdaProvider: React__default.FC<OpenXiangdaProviderProps>;
1679
1739
  declare const useOpenXiangda: () => OpenXiangdaRuntimeStore;
@@ -1686,7 +1746,7 @@ declare const useAppMenus: () => {
1686
1746
  fetchImpl: typeof fetch;
1687
1747
  baseFetchImpl: typeof fetch;
1688
1748
  reload: (options?: RuntimeReloadOptions) => Promise<void>;
1689
- setAccessToken: (accessToken?: string | null) => void;
1749
+ setAccessToken: (accessToken?: string | null, options?: RuntimeAccessTokenOptions) => void;
1690
1750
  loading: boolean;
1691
1751
  error: RuntimeRequestError | null;
1692
1752
  };
@@ -1697,7 +1757,7 @@ declare const usePermission: () => {
1697
1757
  fetchImpl: typeof fetch;
1698
1758
  baseFetchImpl: typeof fetch;
1699
1759
  reload: (options?: RuntimeReloadOptions) => Promise<void>;
1700
- setAccessToken: (accessToken?: string | null) => void;
1760
+ setAccessToken: (accessToken?: string | null, options?: RuntimeAccessTokenOptions) => void;
1701
1761
  loading: boolean;
1702
1762
  error: RuntimeRequestError | null;
1703
1763
  };
@@ -1767,4 +1827,4 @@ interface PublicAccessGateProps extends UsePublicAccessOptions {
1767
1827
  }
1768
1828
  declare const PublicAccessGate: React__default.FC<PublicAccessGateProps>;
1769
1829
 
1770
- export { type ApiPermissionListParams, type AppAuthClient, type AppFunctionConnectorApi, type AppFunctionContext, type AppFunctionDataViewApi, type AppFunctionFormApi, type AppFunctionFormGetByIdParams, type AppFunctionFormQueryParams, type AppFunctionFormWriteParams, type AppFunctionNotificationApi, type AppFunctionOperatorInfo, type AppFunctionPermissionContext, type AppFunctionRuntimeContext, type ApproveTaskParams, type AssignPermissionsParams, type AssignRolesParams, type AuthChallengePayload, AuthClientError, type AuthClientErrorOptions, type AuthClientOptions, type AuthErrorExtra, type AuthLogoutRedirectOptions, type AuthMethod, type AuthMethodType, type AuthTokenData, type AuthUser, type BatchAddUsersToRoleParams, type BatchSendNotificationByTypeParams, type ChangeUserRoleParams, type ConnectorCallParams, type ConnectorInvokeParams, type ConnectorInvokeResult, type ConnectorRequestBodyType, type ConnectorResponseType, type CreateApiPermissionParams, type CreateFormPermissionGroupDto, type CreatePagePermissionGroupDto, type CreateRoleParams, type CreateUiPermissionParams, type CreateUserParams, type CurrentUserDepartmentParents, type CustomPageEntryConfig, type CustomPageEntryMode, type DataManagementConfigParams, type DataManagementFilterState, type DataPermissionConditionDto, type DataPermissionDto, type DataPermissionRuleDto, type DataViewQueryParams, type DataViewQueryResult, type DataViewStatsParams, type DingTalkLoginInput, type ExecuteProcessOperationInput, type FieldAccessLevel, type FieldAccessPolicyDto, type FieldAccessPolicyItemDto, type FieldPermissionDto, type FindNotificationConfigParams, type FormAdvancedSearchParams, type FormChangeRecordParams, type FormCreateParams, type FormExportParams, type FormGetDetailParams, type FormImportParams, type FormPermissionGroup, type FormRemoveParams, type FormSearchParams, type FormUpdateParams, type FunctionInvokeParams, type FunctionInvokeResult, type GetParentDepartmentsOptions, type GetProcessInstanceParams, type GetUserRolesParams, type GuestLoginInput, type ImportExportRecordDownloadParams, type ImportExportRecordQuery, InitiatorApproverSelector, type InstanceStatus, type LoginMethodsResult, LoginPage, type LoginPageProps, type NotificationChannel, type NotificationChannelConfig, type NotificationChannelsConfig, type NotificationConfigLevel, type NotificationMessageRecord, type NotificationTemplate, type NotificationTemplatePreview, type NotificationTypeConfig, OpenXiangdaPageProvider, type OpenXiangdaPageProviderProps, OpenXiangdaProvider, type OpenXiangdaProviderProps, type PageApiPermissionRecord, type PageApiResponse, type PageAppInfo, type PageBinaryResponse, type PageBridgeApi, type PageContext, type PageDataManagementConfig, type PageDataSourceDescriptor, type PageDepartmentInfo, type PageDepartmentRecord, type PageHttpMethod, type PageInfo, type PageListResult, type PageMessageApi, type PageModalApi, type PageNavigationApi, type PageOffsetListResult, type PagePermissionGroup, type PagePermissionInfo, PageProvider, type PageQueryValue, type PageRequestOptions, type PageRoleRecord, type PageRouteInfo, type PageScope, type PageSdk, type PageSdkError, type PageSdkMeta, type PageTransportDownloadPayload, type PageTransportRequestPayload, type PageUiPermissionRecord, type PageUiPermissionType, type PageUserInfo, type PageUserRecord, type PageUserType, type PasswordLoginInput, PermissionBoundary, type PermissionBoundaryFallback, type PermissionBoundaryFallbackState, type PermissionBoundaryProps, type PhoneCodeInput, type PhoneCodeLoginInput, type PhoneCodeRegisterInput, type PhoneCodeSendResult, type PreviewNotificationTemplateParams, ProcessActionBar, type ProcessActionBarProps, type ProcessApproveAction, type ProcessCapabilities, type ProcessCapabilityOperation, type ProcessInstanceLookupParams, ProcessPreviewPanel, type ProcessPreviewPanelProps, ProcessTimeline, type ProcessTimelineProps, type PublicAccessClaim, type PublicAccessClient, PublicAccessClientError, type PublicAccessClientOptions, PublicAccessGate, type PublicAccessGateProps, type PublicAccessSessionData, type PublicAccessSessionInput, type QueryFormPermissionGroupDto, type QueryPagePermissionGroupDto, type RefreshInput, type ResolveLoginUrlInput, type ResolveProcessCapabilitiesParams, type RoleListParams, type RoleUsersParams, type RouteAccessResult, type RuntimeBootstrap, type RuntimeErrorSnapshot, type RuntimeErrorType, type RuntimeLogoutOptions, type RuntimeMenuItem, type RuntimePagePermissions, type RuntimeRedirectLoginOptions, type RuntimeRequestError, type RuntimeRequestState, type RuntimeResolveLoginOptions, type SaveDataManagementConfigParams, type SearchComponentName, type SearchExpression, type SearchFieldKey, type SearchGroup, type SearchLogic, type SearchOperator, type SearchRule, type SearchSortItem, type SearchSystemField, type SendNotificationByTypeParams, type SendNotificationResult, type SsoLoginUrlInput, type SsoLoginUrlResult, type SubFormRule, type SwitchAppRoleParams, type SwitchPlatformRoleParams, type TerminateProcessInstanceParams, type TriggerCallbackTaskParams, type UiPermissionListParams, type UpdateApiPermissionParams, type UpdateFormPermissionGroupDto, type UpdatePagePermissionGroupDto, type UpdateRoleParams, type UpdateUiPermissionParams, type UpdateUserParams, type UseAuthOptions, type UseCanAccessRouteInput, type UseLoginMethodsState, type UseProcessActionsOptions, type UseProcessActionsReturn, type UseProcessCapabilitiesOptions, type UseProcessCapabilitiesReturn, type UsePublicAccessOptions, type UsePublicAccessState, type UserListParams, type UserMenuPermissionsResponse, type ValidateUserParams, type ViewFieldPermissionValue, type ViewOperationPermission, type ViewPermissionSummary, type WorkflowApproveParams, type WorkflowCapabilityActionKey, type WorkflowDefinitionByFormParams, type WorkflowInitiatorSelectCandidatesParams, type WorkflowInitiatorSelectRequirementsParams, type WorkflowPreviewParams, type WorkflowResubmitInitiatorSelectRequirementsParams, type WorkflowResubmitParams, type WorkflowReturnParams, type WorkflowSaveTaskParams, type WorkflowStartFromExistingInstanceParams, type WorkflowTaskParams, type WorkflowTransferParams, type WorkflowWithdrawParams, createAuthClient, createPageSdk, createPublicAccessClient, createReactPage, getAuthErrorExtra, getAuthErrorReason, isAuthChallengeRequired, isAuthClientError, useAppMenus, useAuth, useCanAccessRoute, useCurrentUser, useDataSource, useFormViewPermissions, useLoginMethods, useMessage, useModal, useNavigation, useOpenXiangda, usePageContext, usePageProps, usePageRoute, usePageSdk, usePermission, useProcessActions, useProcessCapabilities, usePublicAccess, useRuntimeAuth, useRuntimeBootstrap };
1830
+ export { type ApiPermissionListParams, type AppAuthClient, type AppFunctionConnectorApi, type AppFunctionContext, type AppFunctionDataViewApi, type AppFunctionFormApi, type AppFunctionFormGetByIdParams, type AppFunctionFormQueryParams, type AppFunctionFormWriteParams, type AppFunctionNotificationApi, type AppFunctionOperatorInfo, type AppFunctionPermissionContext, type AppFunctionRuntimeContext, type ApproveTaskParams, type AssignPermissionsParams, type AssignRolesParams, type AuthChallengePayload, AuthClientError, type AuthClientErrorOptions, type AuthClientOptions, type AuthErrorExtra, type AuthLogoutRedirectOptions, type AuthMethod, type AuthMethodType, type AuthTokenData, type AuthUser, type BatchAddUsersToRoleParams, type BatchSendNotificationByTypeParams, type ChangeUserRoleParams, type ConnectorCallParams, type ConnectorInvokeParams, type ConnectorInvokeResult, type ConnectorRequestBodyType, type ConnectorResponseType, type CreateApiPermissionParams, type CreateFormPermissionGroupDto, type CreatePagePermissionGroupDto, type CreateRoleParams, type CreateUiPermissionParams, type CreateUserParams, type CurrentUserDepartmentParents, type CustomPageEntryConfig, type CustomPageEntryMode, type DataManagementConfigParams, type DataManagementFilterState, type DataPermissionConditionDto, type DataPermissionDto, type DataPermissionRuleDto, type DataViewQueryParams, type DataViewQueryResult, type DataViewStatsParams, type DingTalkLoginInput, type ExecuteProcessOperationInput, type FieldAccessLevel, type FieldAccessPolicyDto, type FieldAccessPolicyItemDto, type FieldPermissionDto, type FindNotificationConfigParams, type FormAdvancedSearchParams, type FormChangeRecordParams, type FormCreateParams, type FormExportParams, type FormGetDetailParams, type FormImportParams, type FormPermissionGroup, type FormRemoveParams, type FormSearchParams, type FormUpdateParams, type FunctionInvokeParams, type FunctionInvokeResult, type GetParentDepartmentsOptions, type GetProcessInstanceParams, type GetUserRolesParams, type GuestLoginInput, type ImportExportRecordDownloadParams, type ImportExportRecordQuery, InitiatorApproverSelector, type InstanceStatus, type ListNotificationInboxParams, type LoginMethodsResult, LoginPage, type LoginPageProps, type MarkAllNotificationReadResult, type NotificationChannel, type NotificationChannelConfig, type NotificationChannelsConfig, type NotificationConfigLevel, type NotificationInboxListResult, type NotificationInboxMessage, type NotificationInboxReadStatus, type NotificationMessageRecord, type NotificationTemplate, type NotificationTemplatePreview, type NotificationTypeConfig, type NotificationUnreadCountResult, OpenXiangdaPageProvider, type OpenXiangdaPageProviderProps, OpenXiangdaProvider, type OpenXiangdaProviderProps, type PageApiPermissionRecord, type PageApiResponse, type PageAppInfo, type PageBinaryResponse, type PageBridgeApi, type PageContext, type PageDataManagementConfig, type PageDataSourceDescriptor, type PageDepartmentInfo, type PageDepartmentRecord, type PageHttpMethod, type PageInfo, type PageListResult, type PageMessageApi, type PageModalApi, type PageNavigationApi, type PageOffsetListResult, type PagePermissionGroup, type PagePermissionInfo, PageProvider, type PageQueryValue, type PageRequestOptions, type PageRoleRecord, type PageRouteInfo, type PageScope, type PageSdk, type PageSdkError, type PageSdkMeta, type PageTransportDownloadPayload, type PageTransportRequestPayload, type PageUiPermissionRecord, type PageUiPermissionType, type PageUserInfo, type PageUserRecord, type PageUserType, type PasswordLoginInput, PermissionBoundary, type PermissionBoundaryFallback, type PermissionBoundaryFallbackState, type PermissionBoundaryProps, type PhoneCodeInput, type PhoneCodeLoginInput, type PhoneCodeRegisterInput, type PhoneCodeSendResult, type PreviewNotificationTemplateParams, ProcessActionBar, type ProcessActionBarProps, type ProcessApproveAction, type ProcessCapabilities, type ProcessCapabilityOperation, type ProcessInstanceLookupParams, ProcessPreviewPanel, type ProcessPreviewPanelProps, ProcessTimeline, type ProcessTimelineProps, type PublicAccessClaim, type PublicAccessClient, PublicAccessClientError, type PublicAccessClientOptions, PublicAccessGate, type PublicAccessGateProps, type PublicAccessSessionData, type PublicAccessSessionInput, type QueryFormPermissionGroupDto, type QueryPagePermissionGroupDto, type RefreshInput, type ResolveLoginUrlInput, type ResolveProcessCapabilitiesParams, type RoleListParams, type RoleUsersParams, type RouteAccessResult, type RuntimeBootstrap, type RuntimeErrorSnapshot, type RuntimeErrorType, type RuntimeLogoutOptions, type RuntimeMenuItem, type RuntimePagePermissions, type RuntimeRedirectLoginOptions, type RuntimeRequestError, type RuntimeRequestState, type RuntimeResolveLoginOptions, type SaveDataManagementConfigParams, type SearchComponentName, type SearchExpression, type SearchFieldKey, type SearchGroup, type SearchLogic, type SearchOperator, type SearchRule, type SearchSortItem, type SearchSystemField, type SendNotificationByTypeParams, type SendNotificationResult, type SsoLoginUrlInput, type SsoLoginUrlResult, type SubFormRule, type SwitchAppRoleParams, type SwitchPlatformRoleParams, type TerminateProcessInstanceParams, type TriggerCallbackTaskParams, type UiPermissionListParams, type UpdateApiPermissionParams, type UpdateFormPermissionGroupDto, type UpdatePagePermissionGroupDto, type UpdateRoleParams, type UpdateUiPermissionParams, type UpdateUserParams, type UseAuthOptions, type UseCanAccessRouteInput, type UseLoginMethodsState, type UseProcessActionsOptions, type UseProcessActionsReturn, type UseProcessCapabilitiesOptions, type UseProcessCapabilitiesReturn, type UsePublicAccessOptions, type UsePublicAccessState, type UserListParams, type UserMenuPermissionsResponse, type ValidateUserParams, type ViewFieldPermissionValue, type ViewOperationPermission, type ViewPermissionSummary, type WorkflowApproveParams, type WorkflowCapabilityActionKey, type WorkflowDefinitionByFormParams, type WorkflowInitiatorSelectCandidatesParams, type WorkflowInitiatorSelectRequirementsParams, type WorkflowPreviewParams, type WorkflowResubmitInitiatorSelectRequirementsParams, type WorkflowResubmitParams, type WorkflowReturnParams, type WorkflowSaveTaskParams, type WorkflowStartFromExistingInstanceParams, type WorkflowTaskParams, type WorkflowTransferParams, type WorkflowWithdrawParams, createAuthClient, createPageSdk, createPublicAccessClient, createReactPage, getAuthErrorExtra, getAuthErrorReason, isAuthChallengeRequired, isAuthClientError, useAppMenus, useAuth, useCanAccessRoute, useCurrentUser, useDataSource, useFormViewPermissions, useLoginMethods, useMessage, useModal, useNavigation, useOpenXiangda, usePageContext, usePageProps, usePageRoute, usePageSdk, usePermission, useProcessActions, useProcessCapabilities, usePublicAccess, useRuntimeAuth, useRuntimeBootstrap };
@@ -831,6 +831,50 @@ interface NotificationMessageRecord {
831
831
  interface SendNotificationResult {
832
832
  messages: NotificationMessageRecord[];
833
833
  }
834
+ type NotificationInboxReadStatus = "all" | "read" | "unread";
835
+ interface ListNotificationInboxParams {
836
+ appType?: string;
837
+ page?: number;
838
+ limit?: number;
839
+ readStatus?: NotificationInboxReadStatus;
840
+ keyword?: string;
841
+ templateCode?: string;
842
+ }
843
+ interface NotificationInboxMessage {
844
+ id: string;
845
+ messageId: string;
846
+ templateCode?: string;
847
+ templateName?: string;
848
+ recipientId: string;
849
+ channel: NotificationChannel | string;
850
+ status: string;
851
+ title: string;
852
+ content: string;
853
+ actionUrl?: string;
854
+ businessType?: string;
855
+ businessId?: string;
856
+ readAt?: string | Date;
857
+ unread: boolean;
858
+ sentAt?: string | Date;
859
+ createdAt: string | Date;
860
+ payload?: Record<string, unknown>;
861
+ [key: string]: unknown;
862
+ }
863
+ interface NotificationInboxListResult {
864
+ items: NotificationInboxMessage[];
865
+ total: number;
866
+ unreadCount: number;
867
+ page: number;
868
+ limit: number;
869
+ totalPages: number;
870
+ }
871
+ interface NotificationUnreadCountResult {
872
+ unreadCount: number;
873
+ }
874
+ interface MarkAllNotificationReadResult {
875
+ updatedCount: number;
876
+ readAt: string | Date;
877
+ }
834
878
  type ProcessApproveAction = "approved" | "rejected" | "returned";
835
879
  interface GetProcessInstanceParams {
836
880
  appType?: string;
@@ -1172,6 +1216,16 @@ interface PageSdk {
1172
1216
  batchSendByType<T = SendNotificationResult>(params: BatchSendNotificationByTypeParams): Promise<PageApiResponse<T>>;
1173
1217
  findConfig<T = NotificationTypeConfig | null>(notificationType: string, params?: FindNotificationConfigParams): Promise<PageApiResponse<T>>;
1174
1218
  previewTemplate<T = NotificationTemplatePreview>(params: PreviewNotificationTemplateParams): Promise<PageApiResponse<T>>;
1219
+ listInbox<T = NotificationInboxListResult>(params?: ListNotificationInboxParams): Promise<PageApiResponse<T>>;
1220
+ getUnreadCount<T = NotificationUnreadCountResult>(params?: {
1221
+ appType?: string;
1222
+ }): Promise<PageApiResponse<T>>;
1223
+ markRead<T = NotificationInboxMessage>(messageId: string, params?: {
1224
+ appType?: string;
1225
+ }): Promise<PageApiResponse<T>>;
1226
+ markAllRead<T = MarkAllNotificationReadResult>(params?: {
1227
+ appType?: string;
1228
+ }): Promise<PageApiResponse<T>>;
1175
1229
  };
1176
1230
  navigation: PageNavigationApi;
1177
1231
  ui: PageContext["ui"];
@@ -1651,6 +1705,12 @@ interface RuntimeRequestState<T> {
1651
1705
  }
1652
1706
  interface RuntimeReloadOptions {
1653
1707
  accessToken?: string | null;
1708
+ accessTokenOptions?: RuntimeAccessTokenOptions;
1709
+ }
1710
+ interface RuntimeAccessTokenOptions {
1711
+ scope?: "default" | "public";
1712
+ path?: string | null;
1713
+ clearIfToken?: string;
1654
1714
  }
1655
1715
  interface OpenXiangdaProviderProps {
1656
1716
  appType?: string;
@@ -1673,7 +1733,7 @@ interface OpenXiangdaRuntimeStore extends RuntimeRequestState<RuntimeBootstrap>
1673
1733
  fetchImpl: typeof fetch;
1674
1734
  baseFetchImpl: typeof fetch;
1675
1735
  reload: (options?: RuntimeReloadOptions) => Promise<void>;
1676
- setAccessToken: (accessToken?: string | null) => void;
1736
+ setAccessToken: (accessToken?: string | null, options?: RuntimeAccessTokenOptions) => void;
1677
1737
  }
1678
1738
  declare const OpenXiangdaProvider: React__default.FC<OpenXiangdaProviderProps>;
1679
1739
  declare const useOpenXiangda: () => OpenXiangdaRuntimeStore;
@@ -1686,7 +1746,7 @@ declare const useAppMenus: () => {
1686
1746
  fetchImpl: typeof fetch;
1687
1747
  baseFetchImpl: typeof fetch;
1688
1748
  reload: (options?: RuntimeReloadOptions) => Promise<void>;
1689
- setAccessToken: (accessToken?: string | null) => void;
1749
+ setAccessToken: (accessToken?: string | null, options?: RuntimeAccessTokenOptions) => void;
1690
1750
  loading: boolean;
1691
1751
  error: RuntimeRequestError | null;
1692
1752
  };
@@ -1697,7 +1757,7 @@ declare const usePermission: () => {
1697
1757
  fetchImpl: typeof fetch;
1698
1758
  baseFetchImpl: typeof fetch;
1699
1759
  reload: (options?: RuntimeReloadOptions) => Promise<void>;
1700
- setAccessToken: (accessToken?: string | null) => void;
1760
+ setAccessToken: (accessToken?: string | null, options?: RuntimeAccessTokenOptions) => void;
1701
1761
  loading: boolean;
1702
1762
  error: RuntimeRequestError | null;
1703
1763
  };
@@ -1767,4 +1827,4 @@ interface PublicAccessGateProps extends UsePublicAccessOptions {
1767
1827
  }
1768
1828
  declare const PublicAccessGate: React__default.FC<PublicAccessGateProps>;
1769
1829
 
1770
- export { type ApiPermissionListParams, type AppAuthClient, type AppFunctionConnectorApi, type AppFunctionContext, type AppFunctionDataViewApi, type AppFunctionFormApi, type AppFunctionFormGetByIdParams, type AppFunctionFormQueryParams, type AppFunctionFormWriteParams, type AppFunctionNotificationApi, type AppFunctionOperatorInfo, type AppFunctionPermissionContext, type AppFunctionRuntimeContext, type ApproveTaskParams, type AssignPermissionsParams, type AssignRolesParams, type AuthChallengePayload, AuthClientError, type AuthClientErrorOptions, type AuthClientOptions, type AuthErrorExtra, type AuthLogoutRedirectOptions, type AuthMethod, type AuthMethodType, type AuthTokenData, type AuthUser, type BatchAddUsersToRoleParams, type BatchSendNotificationByTypeParams, type ChangeUserRoleParams, type ConnectorCallParams, type ConnectorInvokeParams, type ConnectorInvokeResult, type ConnectorRequestBodyType, type ConnectorResponseType, type CreateApiPermissionParams, type CreateFormPermissionGroupDto, type CreatePagePermissionGroupDto, type CreateRoleParams, type CreateUiPermissionParams, type CreateUserParams, type CurrentUserDepartmentParents, type CustomPageEntryConfig, type CustomPageEntryMode, type DataManagementConfigParams, type DataManagementFilterState, type DataPermissionConditionDto, type DataPermissionDto, type DataPermissionRuleDto, type DataViewQueryParams, type DataViewQueryResult, type DataViewStatsParams, type DingTalkLoginInput, type ExecuteProcessOperationInput, type FieldAccessLevel, type FieldAccessPolicyDto, type FieldAccessPolicyItemDto, type FieldPermissionDto, type FindNotificationConfigParams, type FormAdvancedSearchParams, type FormChangeRecordParams, type FormCreateParams, type FormExportParams, type FormGetDetailParams, type FormImportParams, type FormPermissionGroup, type FormRemoveParams, type FormSearchParams, type FormUpdateParams, type FunctionInvokeParams, type FunctionInvokeResult, type GetParentDepartmentsOptions, type GetProcessInstanceParams, type GetUserRolesParams, type GuestLoginInput, type ImportExportRecordDownloadParams, type ImportExportRecordQuery, InitiatorApproverSelector, type InstanceStatus, type LoginMethodsResult, LoginPage, type LoginPageProps, type NotificationChannel, type NotificationChannelConfig, type NotificationChannelsConfig, type NotificationConfigLevel, type NotificationMessageRecord, type NotificationTemplate, type NotificationTemplatePreview, type NotificationTypeConfig, OpenXiangdaPageProvider, type OpenXiangdaPageProviderProps, OpenXiangdaProvider, type OpenXiangdaProviderProps, type PageApiPermissionRecord, type PageApiResponse, type PageAppInfo, type PageBinaryResponse, type PageBridgeApi, type PageContext, type PageDataManagementConfig, type PageDataSourceDescriptor, type PageDepartmentInfo, type PageDepartmentRecord, type PageHttpMethod, type PageInfo, type PageListResult, type PageMessageApi, type PageModalApi, type PageNavigationApi, type PageOffsetListResult, type PagePermissionGroup, type PagePermissionInfo, PageProvider, type PageQueryValue, type PageRequestOptions, type PageRoleRecord, type PageRouteInfo, type PageScope, type PageSdk, type PageSdkError, type PageSdkMeta, type PageTransportDownloadPayload, type PageTransportRequestPayload, type PageUiPermissionRecord, type PageUiPermissionType, type PageUserInfo, type PageUserRecord, type PageUserType, type PasswordLoginInput, PermissionBoundary, type PermissionBoundaryFallback, type PermissionBoundaryFallbackState, type PermissionBoundaryProps, type PhoneCodeInput, type PhoneCodeLoginInput, type PhoneCodeRegisterInput, type PhoneCodeSendResult, type PreviewNotificationTemplateParams, ProcessActionBar, type ProcessActionBarProps, type ProcessApproveAction, type ProcessCapabilities, type ProcessCapabilityOperation, type ProcessInstanceLookupParams, ProcessPreviewPanel, type ProcessPreviewPanelProps, ProcessTimeline, type ProcessTimelineProps, type PublicAccessClaim, type PublicAccessClient, PublicAccessClientError, type PublicAccessClientOptions, PublicAccessGate, type PublicAccessGateProps, type PublicAccessSessionData, type PublicAccessSessionInput, type QueryFormPermissionGroupDto, type QueryPagePermissionGroupDto, type RefreshInput, type ResolveLoginUrlInput, type ResolveProcessCapabilitiesParams, type RoleListParams, type RoleUsersParams, type RouteAccessResult, type RuntimeBootstrap, type RuntimeErrorSnapshot, type RuntimeErrorType, type RuntimeLogoutOptions, type RuntimeMenuItem, type RuntimePagePermissions, type RuntimeRedirectLoginOptions, type RuntimeRequestError, type RuntimeRequestState, type RuntimeResolveLoginOptions, type SaveDataManagementConfigParams, type SearchComponentName, type SearchExpression, type SearchFieldKey, type SearchGroup, type SearchLogic, type SearchOperator, type SearchRule, type SearchSortItem, type SearchSystemField, type SendNotificationByTypeParams, type SendNotificationResult, type SsoLoginUrlInput, type SsoLoginUrlResult, type SubFormRule, type SwitchAppRoleParams, type SwitchPlatformRoleParams, type TerminateProcessInstanceParams, type TriggerCallbackTaskParams, type UiPermissionListParams, type UpdateApiPermissionParams, type UpdateFormPermissionGroupDto, type UpdatePagePermissionGroupDto, type UpdateRoleParams, type UpdateUiPermissionParams, type UpdateUserParams, type UseAuthOptions, type UseCanAccessRouteInput, type UseLoginMethodsState, type UseProcessActionsOptions, type UseProcessActionsReturn, type UseProcessCapabilitiesOptions, type UseProcessCapabilitiesReturn, type UsePublicAccessOptions, type UsePublicAccessState, type UserListParams, type UserMenuPermissionsResponse, type ValidateUserParams, type ViewFieldPermissionValue, type ViewOperationPermission, type ViewPermissionSummary, type WorkflowApproveParams, type WorkflowCapabilityActionKey, type WorkflowDefinitionByFormParams, type WorkflowInitiatorSelectCandidatesParams, type WorkflowInitiatorSelectRequirementsParams, type WorkflowPreviewParams, type WorkflowResubmitInitiatorSelectRequirementsParams, type WorkflowResubmitParams, type WorkflowReturnParams, type WorkflowSaveTaskParams, type WorkflowStartFromExistingInstanceParams, type WorkflowTaskParams, type WorkflowTransferParams, type WorkflowWithdrawParams, createAuthClient, createPageSdk, createPublicAccessClient, createReactPage, getAuthErrorExtra, getAuthErrorReason, isAuthChallengeRequired, isAuthClientError, useAppMenus, useAuth, useCanAccessRoute, useCurrentUser, useDataSource, useFormViewPermissions, useLoginMethods, useMessage, useModal, useNavigation, useOpenXiangda, usePageContext, usePageProps, usePageRoute, usePageSdk, usePermission, useProcessActions, useProcessCapabilities, usePublicAccess, useRuntimeAuth, useRuntimeBootstrap };
1830
+ export { type ApiPermissionListParams, type AppAuthClient, type AppFunctionConnectorApi, type AppFunctionContext, type AppFunctionDataViewApi, type AppFunctionFormApi, type AppFunctionFormGetByIdParams, type AppFunctionFormQueryParams, type AppFunctionFormWriteParams, type AppFunctionNotificationApi, type AppFunctionOperatorInfo, type AppFunctionPermissionContext, type AppFunctionRuntimeContext, type ApproveTaskParams, type AssignPermissionsParams, type AssignRolesParams, type AuthChallengePayload, AuthClientError, type AuthClientErrorOptions, type AuthClientOptions, type AuthErrorExtra, type AuthLogoutRedirectOptions, type AuthMethod, type AuthMethodType, type AuthTokenData, type AuthUser, type BatchAddUsersToRoleParams, type BatchSendNotificationByTypeParams, type ChangeUserRoleParams, type ConnectorCallParams, type ConnectorInvokeParams, type ConnectorInvokeResult, type ConnectorRequestBodyType, type ConnectorResponseType, type CreateApiPermissionParams, type CreateFormPermissionGroupDto, type CreatePagePermissionGroupDto, type CreateRoleParams, type CreateUiPermissionParams, type CreateUserParams, type CurrentUserDepartmentParents, type CustomPageEntryConfig, type CustomPageEntryMode, type DataManagementConfigParams, type DataManagementFilterState, type DataPermissionConditionDto, type DataPermissionDto, type DataPermissionRuleDto, type DataViewQueryParams, type DataViewQueryResult, type DataViewStatsParams, type DingTalkLoginInput, type ExecuteProcessOperationInput, type FieldAccessLevel, type FieldAccessPolicyDto, type FieldAccessPolicyItemDto, type FieldPermissionDto, type FindNotificationConfigParams, type FormAdvancedSearchParams, type FormChangeRecordParams, type FormCreateParams, type FormExportParams, type FormGetDetailParams, type FormImportParams, type FormPermissionGroup, type FormRemoveParams, type FormSearchParams, type FormUpdateParams, type FunctionInvokeParams, type FunctionInvokeResult, type GetParentDepartmentsOptions, type GetProcessInstanceParams, type GetUserRolesParams, type GuestLoginInput, type ImportExportRecordDownloadParams, type ImportExportRecordQuery, InitiatorApproverSelector, type InstanceStatus, type ListNotificationInboxParams, type LoginMethodsResult, LoginPage, type LoginPageProps, type MarkAllNotificationReadResult, type NotificationChannel, type NotificationChannelConfig, type NotificationChannelsConfig, type NotificationConfigLevel, type NotificationInboxListResult, type NotificationInboxMessage, type NotificationInboxReadStatus, type NotificationMessageRecord, type NotificationTemplate, type NotificationTemplatePreview, type NotificationTypeConfig, type NotificationUnreadCountResult, OpenXiangdaPageProvider, type OpenXiangdaPageProviderProps, OpenXiangdaProvider, type OpenXiangdaProviderProps, type PageApiPermissionRecord, type PageApiResponse, type PageAppInfo, type PageBinaryResponse, type PageBridgeApi, type PageContext, type PageDataManagementConfig, type PageDataSourceDescriptor, type PageDepartmentInfo, type PageDepartmentRecord, type PageHttpMethod, type PageInfo, type PageListResult, type PageMessageApi, type PageModalApi, type PageNavigationApi, type PageOffsetListResult, type PagePermissionGroup, type PagePermissionInfo, PageProvider, type PageQueryValue, type PageRequestOptions, type PageRoleRecord, type PageRouteInfo, type PageScope, type PageSdk, type PageSdkError, type PageSdkMeta, type PageTransportDownloadPayload, type PageTransportRequestPayload, type PageUiPermissionRecord, type PageUiPermissionType, type PageUserInfo, type PageUserRecord, type PageUserType, type PasswordLoginInput, PermissionBoundary, type PermissionBoundaryFallback, type PermissionBoundaryFallbackState, type PermissionBoundaryProps, type PhoneCodeInput, type PhoneCodeLoginInput, type PhoneCodeRegisterInput, type PhoneCodeSendResult, type PreviewNotificationTemplateParams, ProcessActionBar, type ProcessActionBarProps, type ProcessApproveAction, type ProcessCapabilities, type ProcessCapabilityOperation, type ProcessInstanceLookupParams, ProcessPreviewPanel, type ProcessPreviewPanelProps, ProcessTimeline, type ProcessTimelineProps, type PublicAccessClaim, type PublicAccessClient, PublicAccessClientError, type PublicAccessClientOptions, PublicAccessGate, type PublicAccessGateProps, type PublicAccessSessionData, type PublicAccessSessionInput, type QueryFormPermissionGroupDto, type QueryPagePermissionGroupDto, type RefreshInput, type ResolveLoginUrlInput, type ResolveProcessCapabilitiesParams, type RoleListParams, type RoleUsersParams, type RouteAccessResult, type RuntimeBootstrap, type RuntimeErrorSnapshot, type RuntimeErrorType, type RuntimeLogoutOptions, type RuntimeMenuItem, type RuntimePagePermissions, type RuntimeRedirectLoginOptions, type RuntimeRequestError, type RuntimeRequestState, type RuntimeResolveLoginOptions, type SaveDataManagementConfigParams, type SearchComponentName, type SearchExpression, type SearchFieldKey, type SearchGroup, type SearchLogic, type SearchOperator, type SearchRule, type SearchSortItem, type SearchSystemField, type SendNotificationByTypeParams, type SendNotificationResult, type SsoLoginUrlInput, type SsoLoginUrlResult, type SubFormRule, type SwitchAppRoleParams, type SwitchPlatformRoleParams, type TerminateProcessInstanceParams, type TriggerCallbackTaskParams, type UiPermissionListParams, type UpdateApiPermissionParams, type UpdateFormPermissionGroupDto, type UpdatePagePermissionGroupDto, type UpdateRoleParams, type UpdateUiPermissionParams, type UpdateUserParams, type UseAuthOptions, type UseCanAccessRouteInput, type UseLoginMethodsState, type UseProcessActionsOptions, type UseProcessActionsReturn, type UseProcessCapabilitiesOptions, type UseProcessCapabilitiesReturn, type UsePublicAccessOptions, type UsePublicAccessState, type UserListParams, type UserMenuPermissionsResponse, type ValidateUserParams, type ViewFieldPermissionValue, type ViewOperationPermission, type ViewPermissionSummary, type WorkflowApproveParams, type WorkflowCapabilityActionKey, type WorkflowDefinitionByFormParams, type WorkflowInitiatorSelectCandidatesParams, type WorkflowInitiatorSelectRequirementsParams, type WorkflowPreviewParams, type WorkflowResubmitInitiatorSelectRequirementsParams, type WorkflowResubmitParams, type WorkflowReturnParams, type WorkflowSaveTaskParams, type WorkflowStartFromExistingInstanceParams, type WorkflowTaskParams, type WorkflowTransferParams, type WorkflowWithdrawParams, createAuthClient, createPageSdk, createPublicAccessClient, createReactPage, getAuthErrorExtra, getAuthErrorReason, isAuthChallengeRequired, isAuthClientError, useAppMenus, useAuth, useCanAccessRoute, useCurrentUser, useDataSource, useFormViewPermissions, useLoginMethods, useMessage, useModal, useNavigation, useOpenXiangda, usePageContext, usePageProps, usePageRoute, usePageSdk, usePermission, useProcessActions, useProcessCapabilities, usePublicAccess, useRuntimeAuth, useRuntimeBootstrap };
@@ -2913,6 +2913,45 @@ var createPageSdk = (context) => {
2913
2913
  ...params,
2914
2914
  appType: resolveAppType(context, params.appType)
2915
2915
  }
2916
+ }),
2917
+ listInbox: (params = {}) => request({
2918
+ path: buildOpenXiangdaAppPath(
2919
+ context,
2920
+ params.appType,
2921
+ "/notifications/inbox"
2922
+ ),
2923
+ method: "get",
2924
+ query: {
2925
+ page: params.page,
2926
+ limit: params.limit,
2927
+ readStatus: params.readStatus,
2928
+ keyword: params.keyword,
2929
+ templateCode: params.templateCode
2930
+ }
2931
+ }),
2932
+ getUnreadCount: (params = {}) => request({
2933
+ path: buildOpenXiangdaAppPath(
2934
+ context,
2935
+ params.appType,
2936
+ "/notifications/inbox/unread-count"
2937
+ ),
2938
+ method: "get"
2939
+ }),
2940
+ markRead: (messageId, params = {}) => request({
2941
+ path: buildOpenXiangdaAppPath(
2942
+ context,
2943
+ params.appType,
2944
+ `/notifications/inbox/${encodePathSegment(messageId)}/read`
2945
+ ),
2946
+ method: "post"
2947
+ }),
2948
+ markAllRead: (params = {}) => request({
2949
+ path: buildOpenXiangdaAppPath(
2950
+ context,
2951
+ params.appType,
2952
+ "/notifications/inbox/read-all"
2953
+ ),
2954
+ method: "post"
2916
2955
  })
2917
2956
  };
2918
2957
  const sdk = {
@@ -33697,10 +33736,18 @@ var OpenXiangdaProvider = ({
33697
33736
  const [accessToken, setAccessTokenState] = useState61(null);
33698
33737
  const accessTokenRef = useRef82(null);
33699
33738
  const setAccessToken = useCallback22(
33700
- (nextAccessToken) => {
33739
+ (nextAccessToken, options = {}) => {
33740
+ if (!nextAccessToken && options.clearIfToken && accessTokenRef.current?.token !== options.clearIfToken) {
33741
+ return;
33742
+ }
33701
33743
  const normalizedAccessToken = nextAccessToken || null;
33702
- accessTokenRef.current = normalizedAccessToken;
33703
- setAccessTokenState(normalizedAccessToken);
33744
+ const nextState = normalizedAccessToken ? {
33745
+ token: normalizedAccessToken,
33746
+ scope: options.scope || "default",
33747
+ path: options.path || null
33748
+ } : null;
33749
+ accessTokenRef.current = nextState;
33750
+ setAccessTokenState(nextState);
33704
33751
  },
33705
33752
  []
33706
33753
  );
@@ -33726,7 +33773,13 @@ var OpenXiangdaProvider = ({
33726
33773
  return;
33727
33774
  }
33728
33775
  setState((prev) => ({ ...prev, loading: true, error: null }));
33729
- const requestFetch = options.accessToken !== void 0 ? createAuthorizedFetch(resolvedFetch, options.accessToken || null) : createAuthorizedFetch(resolvedFetch, accessTokenRef.current);
33776
+ const requestFetch = options.accessToken !== void 0 ? createAuthorizedFetch(
33777
+ resolvedFetch,
33778
+ createAccessTokenState(
33779
+ options.accessToken || null,
33780
+ options.accessTokenOptions
33781
+ )
33782
+ ) : createAuthorizedFetch(resolvedFetch, accessTokenRef.current);
33730
33783
  try {
33731
33784
  const response = await requestFetch(
33732
33785
  buildServiceUrl2(
@@ -34136,9 +34189,11 @@ var buildServiceUrl2 = (servicePrefix, path) => {
34136
34189
  var createAuthorizedFetch = (baseFetch, accessToken) => {
34137
34190
  if (!accessToken) return baseFetch;
34138
34191
  return ((input, init = {}) => {
34192
+ const token = resolveAccessTokenForCurrentRoute(accessToken);
34193
+ if (!token) return baseFetch(input, init);
34139
34194
  const headers = new Headers(init.headers || {});
34140
34195
  if (!headers.has("authorization")) {
34141
- headers.set("authorization", `Bearer ${accessToken}`);
34196
+ headers.set("authorization", `Bearer ${token}`);
34142
34197
  }
34143
34198
  return baseFetch(input, {
34144
34199
  ...init,
@@ -34146,6 +34201,34 @@ var createAuthorizedFetch = (baseFetch, accessToken) => {
34146
34201
  });
34147
34202
  });
34148
34203
  };
34204
+ var createAccessTokenState = (accessToken, options = {}) => accessToken ? {
34205
+ token: accessToken,
34206
+ scope: options.scope || "default",
34207
+ path: options.path || null
34208
+ } : null;
34209
+ var resolveAccessTokenForCurrentRoute = (accessToken) => {
34210
+ if (accessToken.scope !== "public") return accessToken.token;
34211
+ const scopedPath = normalizeRoutePath(accessToken.path);
34212
+ const currentPath = normalizeRoutePath(getCurrentPathname());
34213
+ if (!scopedPath) {
34214
+ return isPublicRoutePath(currentPath) ? accessToken.token : null;
34215
+ }
34216
+ if (currentPath === scopedPath || isPublicRoutePath(currentPath) && currentPath.startsWith(`${scopedPath}/`)) {
34217
+ return accessToken.token;
34218
+ }
34219
+ return null;
34220
+ };
34221
+ var normalizeRoutePath = (path) => {
34222
+ const text = String(path || "").trim();
34223
+ if (!text) return "";
34224
+ try {
34225
+ const base = typeof window !== "undefined" ? window.location.origin : "http://localhost";
34226
+ return new URL(text, base).pathname.replace(/\/+$/, "") || "/";
34227
+ } catch {
34228
+ return text.split(/[?#]/, 1)[0].replace(/\/+$/, "") || "/";
34229
+ }
34230
+ };
34231
+ var isPublicRoutePath = (path) => /\/public(?:\/|$)/.test(path);
34149
34232
  var readJsonPayload = async (response) => {
34150
34233
  try {
34151
34234
  return await response.json();
@@ -34246,6 +34329,7 @@ var attachCallback = (loginUrl, callback) => {
34246
34329
  }
34247
34330
  };
34248
34331
  var getCurrentHref4 = () => typeof window === "undefined" ? "" : window.location.href;
34332
+ var getCurrentPathname = () => typeof window === "undefined" ? "" : window.location.pathname;
34249
34333
  var getCurrentHostname2 = () => typeof window === "undefined" ? "" : window.location.hostname;
34250
34334
  var getRuntimeEnv = (key) => {
34251
34335
  const env = typeof process !== "undefined" ? process.env : void 0;
@@ -34316,7 +34400,7 @@ var resolveAppTypeFromLocation = () => {
34316
34400
  };
34317
34401
 
34318
34402
  // packages/sdk/src/runtime/react/publicAccess.tsx
34319
- import { useCallback as useCallback23, useEffect as useEffect62, useMemo as useMemo43, useState as useState62 } from "react";
34403
+ import { useCallback as useCallback23, useEffect as useEffect62, useMemo as useMemo43, useRef as useRef83, useState as useState62 } from "react";
34320
34404
 
34321
34405
  // packages/sdk/src/runtime/core/publicAccess.ts
34322
34406
  var PublicAccessClientError = class extends Error {
@@ -34341,7 +34425,7 @@ var createPublicAccessClient = ({
34341
34425
  const request = async (input = {}) => {
34342
34426
  const body = {
34343
34427
  ...input,
34344
- path: input.path || getCurrentPathname(),
34428
+ path: input.path || getCurrentPathname2(),
34345
34429
  domain: input.domain || getCurrentDomain(),
34346
34430
  userAgent: input.userAgent || getCurrentUserAgent(),
34347
34431
  guestIdentifier: input.guestIdentifier || getOrCreatePublicGuestIdentifier(normalizedAppType)
@@ -34409,7 +34493,7 @@ var isSuccessCode6 = (code) => {
34409
34493
  const normalized = Number(code);
34410
34494
  return Number.isFinite(normalized) ? normalized === 0 || normalized >= 200 && normalized < 300 : false;
34411
34495
  };
34412
- var getCurrentPathname = () => typeof window === "undefined" ? void 0 : window.location.pathname;
34496
+ var getCurrentPathname2 = () => typeof window === "undefined" ? void 0 : window.location.pathname;
34413
34497
  var getCurrentDomain = () => typeof window === "undefined" ? void 0 : window.location.host;
34414
34498
  var getCurrentUserAgent = () => typeof navigator === "undefined" ? void 0 : navigator.userAgent;
34415
34499
  var getOrCreatePublicGuestIdentifier = (appType) => {
@@ -34452,6 +34536,8 @@ var usePublicAccess = (options = {}) => {
34452
34536
  const [session, setSession] = useState62(null);
34453
34537
  const [error, setError] = useState62(null);
34454
34538
  const [loading, setLoading] = useState62(Boolean(autoStart));
34539
+ const activeSessionRef = useRef83(null);
34540
+ const mountedRef = useRef83(true);
34455
34541
  const sessionInputKey = JSON.stringify(sessionInput);
34456
34542
  const stableSessionInput = useMemo43(() => sessionInput, [sessionInputKey]);
34457
34543
  const client = useMemo43(
@@ -34467,15 +34553,31 @@ var usePublicAccess = (options = {}) => {
34467
34553
  setLoading(true);
34468
34554
  setError(null);
34469
34555
  try {
34556
+ const resolvedPath = input.path || stableSessionInput.path || readPathFromLocation();
34470
34557
  const data = await client.startSession({
34471
34558
  ...stableSessionInput,
34472
34559
  ...input,
34473
34560
  ticket: input.ticket || stableSessionInput.ticket || readTicketFromLocation(),
34474
- path: input.path || stableSessionInput.path || readPathFromLocation()
34561
+ path: resolvedPath
34475
34562
  });
34563
+ if (!mountedRef.current) return data;
34564
+ activeSessionRef.current = {
34565
+ accessToken: data.accessToken,
34566
+ path: resolvedPath
34567
+ };
34476
34568
  setSession(data);
34477
- setAccessToken(data.accessToken);
34478
- await reloadRuntime({ accessToken: data.accessToken });
34569
+ setAccessToken(data.accessToken, {
34570
+ scope: "public",
34571
+ path: resolvedPath
34572
+ });
34573
+ await reloadRuntime({
34574
+ accessToken: data.accessToken,
34575
+ accessTokenOptions: {
34576
+ scope: "public",
34577
+ path: resolvedPath
34578
+ }
34579
+ });
34580
+ if (!mountedRef.current) return data;
34479
34581
  setLoading(false);
34480
34582
  return data;
34481
34583
  } catch (caught) {
@@ -34483,8 +34585,10 @@ var usePublicAccess = (options = {}) => {
34483
34585
  caught instanceof Error ? caught.message : "\u516C\u5F00\u8BBF\u95EE\u4F1A\u8BDD\u521B\u5EFA\u5931\u8D25",
34484
34586
  { payload: caught }
34485
34587
  );
34486
- setError(nextError);
34487
- setLoading(false);
34588
+ if (mountedRef.current) {
34589
+ setError(nextError);
34590
+ setLoading(false);
34591
+ }
34488
34592
  throw nextError;
34489
34593
  }
34490
34594
  },
@@ -34494,6 +34598,20 @@ var usePublicAccess = (options = {}) => {
34494
34598
  if (!autoStart) return;
34495
34599
  void startSession().catch(() => void 0);
34496
34600
  }, [autoStart, startSession]);
34601
+ useEffect62(
34602
+ () => {
34603
+ mountedRef.current = true;
34604
+ return () => {
34605
+ mountedRef.current = false;
34606
+ const activeSession = activeSessionRef.current;
34607
+ if (!activeSession) return;
34608
+ activeSessionRef.current = null;
34609
+ setAccessToken(null, { clearIfToken: activeSession.accessToken });
34610
+ void reloadRuntime({ accessToken: null });
34611
+ };
34612
+ },
34613
+ [reloadRuntime, setAccessToken]
34614
+ );
34497
34615
  return {
34498
34616
  loading,
34499
34617
  error,