@posiwise/common-services 0.2.23 → 0.2.25
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/package.json
CHANGED
|
@@ -495,9 +495,18 @@ declare class UserService {
|
|
|
495
495
|
private readonly toast;
|
|
496
496
|
private readonly endpoint;
|
|
497
497
|
private isTosModalOpen;
|
|
498
|
+
private isSecondaryPaymentModalOpen;
|
|
498
499
|
constructor(api: MainApiHttpService, store: Store<AppState>, router: Router, appConfigService: AppConfigService, profileService: ProfileService, toast: CustomToastService);
|
|
499
500
|
getUserState(): Observable<UserState>;
|
|
500
501
|
getUserInfo(): Observable<User>;
|
|
502
|
+
/**
|
|
503
|
+
* Hard-gate the user when their active product requires a Braintree
|
|
504
|
+
* (secondary) payment method and they don't have one registered yet.
|
|
505
|
+
* Pattern mirrors checkAndHandleTosAcceptance — a non-dismissable
|
|
506
|
+
* SweetAlert2 modal that takes the user to the update-payment route.
|
|
507
|
+
* See main-api ticket #922.
|
|
508
|
+
*/
|
|
509
|
+
private checkAndHandleSecondaryPayment;
|
|
501
510
|
/**
|
|
502
511
|
* Ensure the current user has accepted the latest Terms of Service for this domain.
|
|
503
512
|
* If the domain has a newer TOS version than the user's accepted timestamp, a blocking
|
|
@@ -581,6 +590,13 @@ declare class AuthService {
|
|
|
581
590
|
storeToken(token: string): rxjs.Observable<boolean>;
|
|
582
591
|
storePlatform(plat: string): rxjs.Observable<void>;
|
|
583
592
|
logout(): rxjs.Observable<any>;
|
|
593
|
+
/**
|
|
594
|
+
* Wipe every `pw-brain.*` localStorage key on logout so the next user
|
|
595
|
+
* on a shared browser doesn't inherit the previous user's chat thread
|
|
596
|
+
* (ticket #4167). Best-effort: private-browsing / quota throws are
|
|
597
|
+
* swallowed so logout never breaks.
|
|
598
|
+
*/
|
|
599
|
+
private clearBrainChatStorage;
|
|
584
600
|
/**
|
|
585
601
|
* Clear all authentication tokens
|
|
586
602
|
*/
|
|
@@ -729,7 +745,7 @@ declare class SubscriptionService {
|
|
|
729
745
|
getEnrolledSubscription(id: number, paging?: Paging): rxjs.Observable<any>;
|
|
730
746
|
removeEnrolledSubscription(id: number, user_id: number): rxjs.Observable<any>;
|
|
731
747
|
toggleAdmin(id: number, data: any): rxjs.Observable<any>;
|
|
732
|
-
updateSubscriptionAPIKey(id: number): rxjs.Observable<any>;
|
|
748
|
+
updateSubscriptionAPIKey(id: number, productId: number): rxjs.Observable<any>;
|
|
733
749
|
refreshApiTokens(id: number): rxjs.Observable<any>;
|
|
734
750
|
addFullLogo(id: number, data: any): rxjs.Observable<any>;
|
|
735
751
|
addSquaredLogo(id: number, data: any): rxjs.Observable<any>;
|
|
@@ -737,6 +753,9 @@ declare class SubscriptionService {
|
|
|
737
753
|
updateCardDetails(data: {
|
|
738
754
|
[key: string]: string;
|
|
739
755
|
}, subscription_id: number): rxjs.Observable<any>;
|
|
756
|
+
getPaymentMethods(subscriptionId: number): rxjs.Observable<any>;
|
|
757
|
+
getBraintreeClientToken(subscriptionId: number): rxjs.Observable<any>;
|
|
758
|
+
registerBraintreePaymentMethod(subscriptionId: number, paymentMethodNonce: string): rxjs.Observable<any>;
|
|
740
759
|
getEnterpriseInsight(subscriptionId: number, starting_at?: string, ending_at?: string): rxjs.Observable<any>;
|
|
741
760
|
postSubscriptionCredential(data: any): rxjs.Observable<any>;
|
|
742
761
|
editSubscriptionCredential(id: number, data: any): rxjs.Observable<any>;
|
|
@@ -1015,6 +1034,116 @@ declare class McpJsonRpcService {
|
|
|
1015
1034
|
static ɵprov: i0.ɵɵInjectableDeclaration<McpJsonRpcService>;
|
|
1016
1035
|
}
|
|
1017
1036
|
|
|
1037
|
+
/**
|
|
1038
|
+
* Posiwise Brain MCP orchestrator client (ticket #36).
|
|
1039
|
+
*
|
|
1040
|
+
* Wraps `POST /brain-api/v1/mcp/{execute,interpret,confirm}`. Frees the chat
|
|
1041
|
+
* UI from JSON-RPC plumbing and the `McpJsonRpcService` direct-to-main-api
|
|
1042
|
+
* pattern, which bypasses Bedrock interpretation + the per-user allowlist.
|
|
1043
|
+
*
|
|
1044
|
+
* Auth: the orchestrator authenticates user requests by calling main-api's
|
|
1045
|
+
* `/api/auth/token` from server side. The frontend MUST forward the three
|
|
1046
|
+
* user-token headers (`x-api-user-token`, `x-api-user-id`, `x-api-client-id`)
|
|
1047
|
+
* so the orchestrator can identify the caller. The platform's
|
|
1048
|
+
* `CustomAuthInterceptor` does NOT set these — it sets `Authorization:
|
|
1049
|
+
* pw-gateway` + `x-auth-token` — so we attach them explicitly per request,
|
|
1050
|
+
* mirroring `McpJsonRpcService.pickApiCredentials`.
|
|
1051
|
+
*
|
|
1052
|
+
* Conversation continuity: every response echoes a `conversation_id`. The
|
|
1053
|
+
* UI persists it in localStorage and replays it on subsequent calls so
|
|
1054
|
+
* Bedrock keeps chat context across the three endpoints.
|
|
1055
|
+
*/
|
|
1056
|
+
interface MCPExecuteRequest {
|
|
1057
|
+
message: string;
|
|
1058
|
+
workspace_context?: Record<string, unknown>;
|
|
1059
|
+
conversation_id?: string;
|
|
1060
|
+
}
|
|
1061
|
+
type MCPInterpretRequest = MCPExecuteRequest;
|
|
1062
|
+
interface MCPConfirmRequest {
|
|
1063
|
+
confirmation_token: string;
|
|
1064
|
+
idempotency_key?: string;
|
|
1065
|
+
tool_arguments?: Record<string, unknown>;
|
|
1066
|
+
conversation_id?: string;
|
|
1067
|
+
}
|
|
1068
|
+
type MCPRiskLevel = 'low' | 'medium' | 'high' | 'critical';
|
|
1069
|
+
type MCPResultStatus = 'success' | 'error' | 'blocked';
|
|
1070
|
+
interface MCPActionPlan {
|
|
1071
|
+
intent: string;
|
|
1072
|
+
target_service: string;
|
|
1073
|
+
target_tool: string;
|
|
1074
|
+
tool_arguments: Record<string, unknown>;
|
|
1075
|
+
risk_level: MCPRiskLevel;
|
|
1076
|
+
needs_confirmation: boolean;
|
|
1077
|
+
summary?: string | null;
|
|
1078
|
+
}
|
|
1079
|
+
interface MCPFieldDiff {
|
|
1080
|
+
[field: string]: {
|
|
1081
|
+
before: unknown;
|
|
1082
|
+
after: unknown;
|
|
1083
|
+
};
|
|
1084
|
+
}
|
|
1085
|
+
interface MCPExecuteResponse {
|
|
1086
|
+
request_id: string;
|
|
1087
|
+
result_status: MCPResultStatus;
|
|
1088
|
+
needs_confirmation: boolean;
|
|
1089
|
+
confirmation_token?: string | null;
|
|
1090
|
+
risk_level?: MCPRiskLevel | null;
|
|
1091
|
+
summary?: string | null;
|
|
1092
|
+
response?: string | null;
|
|
1093
|
+
tool_result?: Record<string, unknown> | null;
|
|
1094
|
+
interpreted_intent?: string | null;
|
|
1095
|
+
target_service?: string | null;
|
|
1096
|
+
target_tool?: string | null;
|
|
1097
|
+
reason?: string | null;
|
|
1098
|
+
conversation_id?: string | null;
|
|
1099
|
+
diff?: MCPFieldDiff | null;
|
|
1100
|
+
}
|
|
1101
|
+
interface MCPInterpretResponse {
|
|
1102
|
+
request_id: string;
|
|
1103
|
+
plan: MCPActionPlan | null;
|
|
1104
|
+
allowlist_match: boolean;
|
|
1105
|
+
reason_blocked?: string | null;
|
|
1106
|
+
conversation_id?: string | null;
|
|
1107
|
+
}
|
|
1108
|
+
declare class MCPOrchestratorService {
|
|
1109
|
+
private readonly http;
|
|
1110
|
+
private readonly appConfigService;
|
|
1111
|
+
private readonly store;
|
|
1112
|
+
/**
|
|
1113
|
+
* Dev base — `BRAIN_API_PREFIX` = '/brain-api/v1/'. In prod the
|
|
1114
|
+
* orchestrator is reached via the API-gateway public hostname; we read
|
|
1115
|
+
* it from `links.brain_api` in app config (same convention as
|
|
1116
|
+
* `BrainApiHttpService`).
|
|
1117
|
+
*/
|
|
1118
|
+
constructor(http: HttpClient, appConfigService: AppConfigService, store: Store<AppState>);
|
|
1119
|
+
execute(body: MCPExecuteRequest): Observable<MCPExecuteResponse>;
|
|
1120
|
+
interpret(body: MCPInterpretRequest): Observable<MCPInterpretResponse>;
|
|
1121
|
+
confirm(body: MCPConfirmRequest): Observable<MCPExecuteResponse>;
|
|
1122
|
+
private post;
|
|
1123
|
+
/**
|
|
1124
|
+
* Pull `(token, userId, clientId?)` for the active session.
|
|
1125
|
+
*
|
|
1126
|
+
* `clientId` comes from `PermissionService.selectedSubscription` — the
|
|
1127
|
+
* canonical "currently-active subscription" on this frontend, set when
|
|
1128
|
+
* the user picks/lands on a subscription. Every other place in the
|
|
1129
|
+
* codebase that needs subscription context (mailbox, chatbox, search,
|
|
1130
|
+
* dashboard, admin lists) reads from the same static. Without it,
|
|
1131
|
+
* downstream MCP tools that require subscription scope (e.g.
|
|
1132
|
+
* `cloudolive-api.count_reconciled_account_inputs`) reject the call
|
|
1133
|
+
* with `McpError: This tool requires subscription context. Please
|
|
1134
|
+
* provide api_client_id parameter`.
|
|
1135
|
+
*
|
|
1136
|
+
* `api_client_id` does NOT live on the `User` interface — it's a
|
|
1137
|
+
* property of `Subscription` (`subscription.interface.ts`). Reading
|
|
1138
|
+
* from the user object would always return `undefined` and silently
|
|
1139
|
+
* drop the header.
|
|
1140
|
+
*/
|
|
1141
|
+
private pickApiCredentials;
|
|
1142
|
+
private buildHeaders;
|
|
1143
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<MCPOrchestratorService, never>;
|
|
1144
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<MCPOrchestratorService>;
|
|
1145
|
+
}
|
|
1146
|
+
|
|
1018
1147
|
declare class WebsocketService {
|
|
1019
1148
|
private readonly appConfigService;
|
|
1020
1149
|
private readonly authService;
|
|
@@ -1205,5 +1334,5 @@ declare class BrainApiService {
|
|
|
1205
1334
|
static ɵprov: i0.ɵɵInjectableDeclaration<BrainApiService>;
|
|
1206
1335
|
}
|
|
1207
1336
|
|
|
1208
|
-
export { AbTestService, AhoyService, AuthService, BaseHttpService, BrainApiHttpService, BrainApiService, CommonService, CommonServicesModule, CustomPreloadingStrategy, CustomToastService, DashboardService, DataService, FeatureFlagService, FormHelperService, GeoService, GoogleAnalyticsService, GroupService, HopscotchService, IntegrationsApiHttpService, LinkService, LocalStorage, LogoCacheService, MailBoxService, MainApiHttpService, McpJsonRpcService, NgbDateCustomParserFormatter, NotificationService, NumberPickerService, PermissionService, PrimeNgHelper, ProductService, ProfileService, QualificationService, ScriptLoaderService, SecureTokenStorageService, SentryErrorHandler, SeoService, SubscriptionService, TagService, TipsService, UserEffects, UserService, ValidationService, WebsocketService, WindowService };
|
|
1209
|
-
export type { McpJsonRpcError, McpJsonRpcRequest, McpJsonRpcResponse, McpToolDefinition, McpToolsListResult };
|
|
1337
|
+
export { AbTestService, AhoyService, AuthService, BaseHttpService, BrainApiHttpService, BrainApiService, CommonService, CommonServicesModule, CustomPreloadingStrategy, CustomToastService, DashboardService, DataService, FeatureFlagService, FormHelperService, GeoService, GoogleAnalyticsService, GroupService, HopscotchService, IntegrationsApiHttpService, LinkService, LocalStorage, LogoCacheService, MCPOrchestratorService, MailBoxService, MainApiHttpService, McpJsonRpcService, NgbDateCustomParserFormatter, NotificationService, NumberPickerService, PermissionService, PrimeNgHelper, ProductService, ProfileService, QualificationService, ScriptLoaderService, SecureTokenStorageService, SentryErrorHandler, SeoService, SubscriptionService, TagService, TipsService, UserEffects, UserService, ValidationService, WebsocketService, WindowService };
|
|
1338
|
+
export type { MCPActionPlan, MCPConfirmRequest, MCPExecuteRequest, MCPExecuteResponse, MCPFieldDiff, MCPInterpretRequest, MCPInterpretResponse, MCPResultStatus, MCPRiskLevel, McpJsonRpcError, McpJsonRpcRequest, McpJsonRpcResponse, McpToolDefinition, McpToolsListResult };
|