@fluid-app/portal-sdk 0.1.99 → 0.1.100

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.
@@ -36,6 +36,7 @@ import "./use-account-clients-Dsqx0mKw.mjs";
36
36
  import "./ScreenHeaderContext-CrdfLGKk.mjs";
37
37
  import "./use-fluid-api-CaSYWFuj.mjs";
38
38
  import "./use-current-user-BMI-LR9t.mjs";
39
+ import "./AppNavigationContext-Du3Qq0yc.mjs";
39
40
  import "./dist-NMbUD0qE.mjs";
40
41
  import "./es-BCKjXBqj.mjs";
41
42
  import "./dist-oYNtEpKP.mjs";
@@ -37,6 +37,7 @@ import "./ScreenHeaderContext-CrdfLGKk.mjs";
37
37
  import "./use-fluid-api-CaSYWFuj.mjs";
38
38
  import "./use-current-user-BMI-LR9t.mjs";
39
39
  import { n as shareablesScreenPropertySchema, t as ShareablesScreen } from "./ShareablesScreen-Cy7w85IH.mjs";
40
+ import "./AppNavigationContext-Du3Qq0yc.mjs";
40
41
  import "./dist-NMbUD0qE.mjs";
41
42
  import "./es-BCKjXBqj.mjs";
42
43
  import "./dist-oYNtEpKP.mjs";
package/dist/index.cjs CHANGED
@@ -41,7 +41,7 @@ const require_use_current_user = require("./use-current-user-LLJ1GtNB.cjs");
41
41
  const require_ShareablesScreen = require("./ShareablesScreen-CVT7u2hN.cjs");
42
42
  const require_CustomersScreen = require("./CustomersScreen-9f10-_AZ.cjs");
43
43
  const require_AppNavigationContext = require("./AppNavigationContext-Agp0UkCQ.cjs");
44
- const require_MessagingScreen = require("./MessagingScreen-B9CCsimy.cjs");
44
+ const require_MessagingScreen = require("./MessagingScreen-Cgx3jwpr.cjs");
45
45
  const require_ProfileScreen = require("./ProfileScreen-DtmReqa8.cjs");
46
46
  require("./dist-DRVtlgQ1.cjs");
47
47
  require("./es-DlWO6buB.cjs");
@@ -3002,7 +3002,7 @@ function AccountManageLayout({ children }) {
3002
3002
  const ProfileScreen$1 = (0, react.lazy)(() => Promise.resolve().then(() => require("./ProfileScreen-B46jd4Ic.cjs")).then((m) => ({ default: m.ProfileScreen })));
3003
3003
  const OrdersScreen$1 = (0, react.lazy)(() => Promise.resolve().then(() => require("./OrdersScreen-DCzYEgsP.cjs")).then((m) => ({ default: m.OrdersScreen })));
3004
3004
  const SubscriptionsScreen$1 = (0, react.lazy)(() => Promise.resolve().then(() => require("./SubscriptionsScreen-BqOb2kYR.cjs")).then((m) => ({ default: m.SubscriptionsScreen })));
3005
- const MessagingScreen$1 = (0, react.lazy)(() => Promise.resolve().then(() => require("./MessagingScreen-5jw8KSLQ.cjs")).then((m) => ({ default: m.MessagingScreen })));
3005
+ const MessagingScreen$1 = (0, react.lazy)(() => Promise.resolve().then(() => require("./MessagingScreen-CGS7aG1A.cjs")).then((m) => ({ default: m.MessagingScreen })));
3006
3006
  const ContactsScreen$1 = (0, react.lazy)(() => Promise.resolve().then(() => require("./ContactsScreen-D4WQ59ib.cjs")).then((m) => ({ default: m.ContactsScreen })));
3007
3007
  const ShopScreen$1 = (0, react.lazy)(() => Promise.resolve().then(() => require("./ShopScreen-wYtLEGXo.cjs")).then((m) => ({ default: m.ShopScreen })));
3008
3008
  const CustomersScreen$1 = (0, react.lazy)(() => Promise.resolve().then(() => require("./CustomersScreen-9f10-_AZ.cjs")).then((n) => n.CustomersScreen_exports).then((m) => ({ default: m.CustomersScreen })));
@@ -4469,7 +4469,7 @@ function useContact(_contactId) {
4469
4469
  //#region src/screens/index.ts
4470
4470
  const screenPropertySchemas = {
4471
4471
  ProfileScreen: () => Promise.resolve().then(() => require("./ProfileScreen-B46jd4Ic.cjs")).then((m) => m.profileScreenPropertySchema),
4472
- MessagingScreen: () => Promise.resolve().then(() => require("./MessagingScreen-5jw8KSLQ.cjs")).then((m) => m.messagingScreenPropertySchema),
4472
+ MessagingScreen: () => Promise.resolve().then(() => require("./MessagingScreen-CGS7aG1A.cjs")).then((m) => m.messagingScreenPropertySchema),
4473
4473
  ContactsScreen: () => Promise.resolve().then(() => require("./ContactsScreen-D4WQ59ib.cjs")).then((m) => m.contactsScreenPropertySchema),
4474
4474
  OrdersScreen: () => Promise.resolve().then(() => require("./OrdersScreen-DCzYEgsP.cjs")).then((m) => m.ordersScreenPropertySchema),
4475
4475
  SubscriptionsScreen: () => Promise.resolve().then(() => require("./SubscriptionsScreen-BqOb2kYR.cjs")).then((m) => m.subscriptionsScreenPropertySchema),
package/dist/index.d.cts CHANGED
@@ -3080,16 +3080,365 @@ declare function AuthError({
3080
3080
  */
3081
3081
  declare function AuthLoading(): React.JSX.Element;
3082
3082
  //#endregion
3083
- //#region ../../messaging/api-client/src/client.d.ts
3084
- /**
3085
- * Configuration for the messaging API client.
3086
- * The consuming app provides auth headers and base URL.
3087
- */
3088
- interface MessagingApiConfig {
3089
- baseUrl: string;
3090
- getHeaders: () => Record<string, string> | Promise<Record<string, string>>;
3091
- onAuthError?: () => void;
3083
+ //#region ../../messaging/core/src/types.d.ts
3084
+ /**
3085
+ * Domain types for the messaging package.
3086
+ *
3087
+ * These are owned by messaging-core and represent the contract that
3088
+ * any API adapter (current client, future BFF) must satisfy.
3089
+ * Consuming packages import from here — never from the API client directly.
3090
+ */
3091
+ interface PaginationObject {
3092
+ pagination: {
3093
+ current: number;
3094
+ previous: number | null;
3095
+ next: number | null;
3096
+ per_page: number;
3097
+ pages: number;
3098
+ count: number;
3099
+ };
3100
+ }
3101
+ type Paginated<T> = [PaginationObject, {
3102
+ items: T[];
3103
+ }];
3104
+ interface AttachmentMetadata {
3105
+ width?: number;
3106
+ height?: number;
3107
+ }
3108
+ interface Attachment {
3109
+ id: number;
3110
+ url: string;
3111
+ filename: string;
3112
+ kind: string;
3113
+ image_url: string | null;
3114
+ image_path: string | null;
3115
+ content_type: string | null;
3116
+ attachable_type: string | null;
3117
+ attachable_id: number | null;
3118
+ thumbnail_url: string | null;
3119
+ metadata: AttachmentMetadata | null;
3120
+ content_size: number | null;
3121
+ }
3122
+ interface MessageAttachmentInput {
3123
+ url: string;
3124
+ filename: string;
3125
+ kind: string;
3126
+ content_type?: string;
3127
+ content_size?: number;
3128
+ metadata?: AttachmentMetadata;
3129
+ }
3130
+ interface LinkPreview {
3131
+ url: string;
3132
+ title?: string | null;
3133
+ description?: string | null;
3134
+ images?: string[];
3135
+ videos?: string[];
3136
+ favicon?: string | null;
3137
+ error?: string | null;
3138
+ original_url?: string | null;
3139
+ }
3140
+ interface InfoMessageRecipient {
3141
+ id: number;
3142
+ first_name: string;
3143
+ last_name: string;
3092
3144
  }
3145
+ interface DefaultMessageMetadata {
3146
+ links: LinkPreview[];
3147
+ client_message_id?: string | number | null;
3148
+ }
3149
+ interface SystemConversationUpdateMetadata {
3150
+ name: string;
3151
+ previous_name: string;
3152
+ client_message_id?: string | number | null;
3153
+ links?: LinkPreview[];
3154
+ }
3155
+ interface SystemConversationCreatedMetadata {
3156
+ conversation_name: string;
3157
+ description?: string;
3158
+ member_count: number;
3159
+ auto_add_recipients: boolean;
3160
+ client_message_id?: string | number | null;
3161
+ links?: LinkPreview[];
3162
+ }
3163
+ interface SystemRecipientActionMetadata {
3164
+ recipient_ids_added?: number[];
3165
+ recipient_ids_removed?: number[];
3166
+ recipient_ids_left?: number[];
3167
+ recipient_ids_joined?: number[];
3168
+ recipient_added?: InfoMessageRecipient[];
3169
+ recipient_removed?: InfoMessageRecipient[];
3170
+ recipient_left?: InfoMessageRecipient[];
3171
+ recipient_joined?: InfoMessageRecipient[];
3172
+ client_message_id?: string | number | null;
3173
+ links?: LinkPreview[];
3174
+ }
3175
+ interface InfoMessageMetadataShape {
3176
+ recipient_added?: InfoMessageRecipient[];
3177
+ recipient_ids_added?: number[];
3178
+ recipient_removed?: InfoMessageRecipient[];
3179
+ recipient_ids_removed?: number[];
3180
+ links?: LinkPreview[];
3181
+ client_message_id?: string | number | null;
3182
+ }
3183
+ type MessageMetadata = DefaultMessageMetadata | null | SystemConversationUpdateMetadata | SystemConversationCreatedMetadata | SystemRecipientActionMetadata | InfoMessageMetadataShape;
3184
+ interface Recipient {
3185
+ id: number;
3186
+ first_name: string;
3187
+ last_name: string;
3188
+ avatar_url: string | null;
3189
+ image_url: string | null;
3190
+ receivable_id: number;
3191
+ receivable_type: "Contact" | "UserCompany";
3192
+ discarded_at: string | null;
3193
+ left_conversation_at: string | null;
3194
+ blocked: boolean | null;
3195
+ country_name: string | null;
3196
+ pro_user: boolean;
3197
+ avatar_background: string | null;
3198
+ email?: string | null;
3199
+ phone?: string | null;
3200
+ status?: "online" | "offline" | "away";
3201
+ last_online?: string | null;
3202
+ "conversation_messaging_enabled?"?: boolean;
3203
+ }
3204
+ interface ReducedRecipient {
3205
+ id: number;
3206
+ first_name: string;
3207
+ last_name: string;
3208
+ image_url: string | null;
3209
+ discarded_at: string | null;
3210
+ blocked: boolean | null;
3211
+ blocker: boolean | null;
3212
+ avatar_background: string | null;
3213
+ seen_at?: string | null;
3214
+ email?: string | null;
3215
+ phone?: string | null;
3216
+ pro_user?: boolean;
3217
+ }
3218
+ interface SlimmedRecipient {
3219
+ id: number;
3220
+ first_name: string;
3221
+ last_name: string;
3222
+ discarded_at: string | null;
3223
+ blocked: boolean | null;
3224
+ avatar_background: string | null;
3225
+ email?: string | null;
3226
+ phone?: string | null;
3227
+ removed_at?: string | null;
3228
+ }
3229
+ interface WithContactRecipient {
3230
+ id: number;
3231
+ email?: string | null;
3232
+ phone?: string | null;
3233
+ first_name?: string | null;
3234
+ last_name?: string | null;
3235
+ image_url: string | null;
3236
+ receivable_id: number;
3237
+ receivable_type: "Contact";
3238
+ }
3239
+ interface RecipientSearchCount {
3240
+ meta: {
3241
+ count: number;
3242
+ };
3243
+ }
3244
+ type FluidMessage = {
3245
+ id: number;
3246
+ body: string;
3247
+ type: string;
3248
+ created_at: string;
3249
+ updated_at?: string | null;
3250
+ deleted_at?: string | null;
3251
+ edited_at?: string | null;
3252
+ conversation_id: number;
3253
+ status: string;
3254
+ attachments: Attachment[];
3255
+ reaction_stats: Record<string, number> | null;
3256
+ reaction?: string | null;
3257
+ metadata?: MessageMetadata;
3258
+ emoji_only_count?: number;
3259
+ mentioned_recipients: SlimmedRecipient[];
3260
+ sent_at?: string;
3261
+ pinned?: boolean;
3262
+ scheduled_at?: string;
3263
+ replied_to_message?: ({
3264
+ id: number;
3265
+ } & Record<string, unknown>) | null;
3266
+ sender_recipient: ReducedRecipient;
3267
+ seen_by: unknown;
3268
+ seen_by_count: unknown;
3269
+ };
3270
+ interface MessagePinResponse {
3271
+ message: string;
3272
+ pinned: boolean;
3273
+ }
3274
+ interface BaseConversation {
3275
+ id: number;
3276
+ name: string;
3277
+ description: string | null;
3278
+ kind: string | null;
3279
+ type: string;
3280
+ status: string;
3281
+ created_at: string;
3282
+ pinned: boolean;
3283
+ unread_messages_count?: number | null;
3284
+ "sms_enabled?": boolean;
3285
+ draft_message: DraftMessage | null;
3286
+ "email_enabled?": boolean;
3287
+ conversation_type: string;
3288
+ "messaging_enabled?": boolean;
3289
+ broadcasting: boolean | null;
3290
+ total_recipients: number;
3291
+ unread?: boolean | null;
3292
+ image_url: string | null;
3293
+ auto_add_recipients?: boolean | null;
3294
+ muted?: boolean | null;
3295
+ announcing?: boolean | null;
3296
+ scheduled_messages_count?: number | null;
3297
+ avatar_background_color: string | null;
3298
+ avatar_emoji: string | null;
3299
+ avatar_url: string | null;
3300
+ pinned_messages_count?: number | null;
3301
+ recipients: Recipient[];
3302
+ creator: ReducedRecipient | null;
3303
+ }
3304
+ interface EmailConversation extends BaseConversation {
3305
+ type: "EmailConversation";
3306
+ kind: null;
3307
+ "sms_enabled?": false;
3308
+ "email_enabled?": true;
3309
+ broadcasting: null;
3310
+ }
3311
+ interface ChannelConversation extends BaseConversation {
3312
+ type: "ChannelConversation";
3313
+ kind: "channel";
3314
+ "sms_enabled?": false;
3315
+ "email_enabled?": false;
3316
+ }
3317
+ interface GroupConversation extends BaseConversation {
3318
+ type: "GroupConversation";
3319
+ kind: "group";
3320
+ "sms_enabled?": false;
3321
+ "email_enabled?": false;
3322
+ broadcasting: null;
3323
+ }
3324
+ interface SmsConversation extends BaseConversation {
3325
+ type: "SmsConversation";
3326
+ kind: null;
3327
+ "sms_enabled?": true;
3328
+ "email_enabled?": false;
3329
+ broadcasting: null;
3330
+ }
3331
+ interface DirectConversation extends BaseConversation {
3332
+ type: "DirectConversation";
3333
+ kind: "direct";
3334
+ "sms_enabled?": false;
3335
+ "email_enabled?": false;
3336
+ broadcasting: null;
3337
+ }
3338
+ interface BotConversation extends BaseConversation {
3339
+ type: "BotConversation";
3340
+ kind: "direct";
3341
+ "sms_enabled?": false;
3342
+ "email_enabled?": false;
3343
+ broadcasting: null;
3344
+ }
3345
+ interface DownlineConversation extends BaseConversation {
3346
+ type: "DownlineConversation";
3347
+ kind: "downline";
3348
+ "sms_enabled?": false;
3349
+ "email_enabled?": false;
3350
+ broadcasting: null;
3351
+ }
3352
+ type Conversation$1 = EmailConversation | ChannelConversation | GroupConversation | SmsConversation | DirectConversation | BotConversation | DownlineConversation;
3353
+ type ListConversationsInput = {
3354
+ status?: "open" | "closed";
3355
+ kind?: "direct" | "group" | "channel";
3356
+ pinned?: boolean;
3357
+ per_page?: number;
3358
+ page?: number;
3359
+ template?: string;
3360
+ search?: string;
3361
+ filterrific?: Record<string, unknown>;
3362
+ } | undefined;
3363
+ type ConversationCreateInput = {
3364
+ conversation: {
3365
+ kind?: string;
3366
+ type?: string;
3367
+ name?: string;
3368
+ description?: string | null;
3369
+ broadcasting?: boolean;
3370
+ filter?: Record<string, unknown>;
3371
+ auto_add_recipients?: boolean;
3372
+ };
3373
+ recipients?: {
3374
+ id?: number;
3375
+ uid?: number;
3376
+ email?: string;
3377
+ phone?: string;
3378
+ first_name?: string;
3379
+ last_name?: string;
3380
+ image_url?: string;
3381
+ }[];
3382
+ };
3383
+ type FindConversationInput = {
3384
+ contact_id: number;
3385
+ conversation_type: "ChannelConversation" | "DirectConversation" | "GroupConversation" | "SmsConversation" | "EmailConversation" | "channel" | "direct" | "group";
3386
+ };
3387
+ type CreateMessageInput = {
3388
+ message: {
3389
+ body?: string;
3390
+ theme?: string;
3391
+ subject?: string;
3392
+ type?: string;
3393
+ attachments_attributes?: MessageAttachmentInput[];
3394
+ };
3395
+ client_message_id?: string | number;
3396
+ };
3397
+ type ScheduledMessageInput = {
3398
+ scheduled_message: {
3399
+ body?: string;
3400
+ theme?: string;
3401
+ scheduled_at: string;
3402
+ attachments_attributes?: MessageAttachmentInput[];
3403
+ type?: string;
3404
+ };
3405
+ };
3406
+ type SaveDraftInput = {
3407
+ draft_message: {
3408
+ body?: string | null;
3409
+ replied_to_id?: number | null;
3410
+ attachments_attributes?: (MessageAttachmentInput & {
3411
+ id?: number;
3412
+ _destroy?: boolean;
3413
+ })[];
3414
+ };
3415
+ };
3416
+ interface DraftMessage {
3417
+ id: number;
3418
+ body: string | null;
3419
+ created_at: string;
3420
+ updated_at: string;
3421
+ scheduled_at: string | null;
3422
+ metadata?: unknown;
3423
+ replied_to_message: ({
3424
+ id: number;
3425
+ } & Record<string, unknown>) | null;
3426
+ mentioned_recipients: ({
3427
+ id: number;
3428
+ } & Record<string, unknown>)[];
3429
+ attachments: Attachment[];
3430
+ sender_recipient?: ReducedRecipient;
3431
+ conversation?: {
3432
+ id: number;
3433
+ name: string | null;
3434
+ } & Record<string, unknown>;
3435
+ }
3436
+ type ListConnectedRecipientsInput = {
3437
+ kind?: "external" | "sms" | "email" | "internal";
3438
+ filterrific?: Record<string, unknown>;
3439
+ per_page?: number;
3440
+ page?: number;
3441
+ };
3093
3442
  //#endregion
3094
3443
  //#region ../../messaging/core/src/auth-types.d.ts
3095
3444
  interface MessagingAuthContext {
@@ -3137,12 +3486,83 @@ type FileUploader = {
3137
3486
  };
3138
3487
  };
3139
3488
  //#endregion
3489
+ //#region ../../messaging/core/src/messaging-api.d.ts
3490
+ /**
3491
+ * Interface defining all messaging API operations that core hooks need.
3492
+ * Each app provides an implementation via {@link MessagingApiProvider},
3493
+ * decoupling shared packages from concrete API clients.
3494
+ */
3495
+ interface MessagingApi {
3496
+ listConversations(input?: ListConversationsInput): Promise<Paginated<Conversation$1>>;
3497
+ getConversation(conversationId: number): Promise<Conversation$1>;
3498
+ findConversation(input: FindConversationInput): Promise<Conversation$1>;
3499
+ createConversation(input: ConversationCreateInput): Promise<Conversation$1>;
3500
+ getAnnouncementChannel(): Promise<Conversation$1>;
3501
+ listMessages(conversationId: number, input?: {
3502
+ preview?: boolean;
3503
+ message_id?: number;
3504
+ after?: number;
3505
+ before?: number;
3506
+ sorted_by?: string;
3507
+ per_page?: number;
3508
+ page?: number;
3509
+ }): Promise<Paginated<FluidMessage>>;
3510
+ createMessage(conversationId: number, input: CreateMessageInput): Promise<FluidMessage>;
3511
+ replyToMessage(conversationId: number, messageId: number, input: CreateMessageInput): Promise<FluidMessage>;
3512
+ reactToMessage(conversationId: number, input: {
3513
+ message_id: number;
3514
+ reaction: string;
3515
+ }): Promise<string>;
3516
+ unreactToMessage(conversationId: number, input: {
3517
+ message_id: number;
3518
+ }): Promise<string>;
3519
+ pinMessage(conversationId: number, messageId: number): Promise<MessagePinResponse>;
3520
+ unpinMessage(conversationId: number, messageId: number): Promise<MessagePinResponse>;
3521
+ listPinnedMessages(conversationId: number, input?: {
3522
+ sorted_by?: string;
3523
+ per_page?: number;
3524
+ page?: number;
3525
+ }): Promise<Paginated<FluidMessage>>;
3526
+ listScheduledMessages(conversationId: number, input?: {
3527
+ per_page?: number;
3528
+ page?: number;
3529
+ }): Promise<Paginated<FluidMessage>>;
3530
+ createScheduledMessage(conversationId: number, input: ScheduledMessageInput): Promise<FluidMessage>;
3531
+ updateScheduledMessage(conversationId: number, id: number, input: ScheduledMessageInput): Promise<FluidMessage>;
3532
+ destroyScheduledMessage(conversationId: number, id: number): Promise<{
3533
+ success: boolean;
3534
+ message: string;
3535
+ }>;
3536
+ listMyScheduledMessages(input?: {
3537
+ per_page?: number;
3538
+ page?: number;
3539
+ }): Promise<Paginated<DraftMessage>>;
3540
+ saveDraft(conversationId: number, input: SaveDraftInput): Promise<DraftMessage | Record<string, never>>;
3541
+ destroyDraft(conversationId: number): Promise<unknown>;
3542
+ searchRecipientsCount(input: {
3543
+ filter: Record<string, unknown>;
3544
+ }): Promise<RecipientSearchCount>;
3545
+ listConnectedRecipients(input: ListConnectedRecipientsInput): Promise<Paginated<Recipient | WithContactRecipient>>;
3546
+ }
3547
+ //#endregion
3140
3548
  //#region src/messaging/use-messaging-auth.d.ts
3141
3549
  declare function useMessagingAuth(): MessagingAuthContext;
3142
3550
  //#endregion
3551
+ //#region ../../messaging/api-client/src/client.d.ts
3552
+ /**
3553
+ * Configuration for the messaging API client.
3554
+ * The consuming app provides auth headers and base URL.
3555
+ */
3556
+ interface MessagingApiConfig {
3557
+ baseUrl: string;
3558
+ getHeaders: () => Record<string, string> | Promise<Record<string, string>>;
3559
+ onAuthError?: () => void;
3560
+ }
3561
+ //#endregion
3143
3562
  //#region src/messaging/use-messaging-config.d.ts
3144
3563
  interface MessagingConfig {
3145
3564
  readonly apiConfig: MessagingApiConfig;
3565
+ readonly messagingApi: MessagingApi;
3146
3566
  readonly websocketUrl: string;
3147
3567
  readonly token: string | null;
3148
3568
  }