@fluid-app/portal-sdk 0.1.94 → 0.1.96
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/{ContactsScreen-CLt7Hlxg.mjs → ContactsScreen-CjpjEyvy.mjs} +407 -427
- package/dist/ContactsScreen-CjpjEyvy.mjs.map +1 -0
- package/dist/{ContactsScreen-C2rTH9Er.cjs → ContactsScreen-DEyVCqot.cjs} +5 -5
- package/dist/{ContactsScreen-u9-U9Myu.cjs → ContactsScreen-VUKuxFcj.cjs} +406 -426
- package/dist/ContactsScreen-VUKuxFcj.cjs.map +1 -0
- package/dist/{MessagingScreen-B9V9dTBn.mjs → MessagingScreen-BDuOpf7k.mjs} +3 -3
- package/dist/{MessagingScreen-2a1oJ9yj.cjs → MessagingScreen-C2QId8w5.cjs} +3 -3
- package/dist/{MessagingScreen-CcPPK1J6.mjs → MessagingScreen-Cg1qPb5E.mjs} +3 -3
- package/dist/{MessagingScreen-CcPPK1J6.mjs.map → MessagingScreen-Cg1qPb5E.mjs.map} +1 -1
- package/dist/{MessagingScreen-dJZWI4fa.cjs → MessagingScreen-UyuRUgcd.cjs} +3 -3
- package/dist/{MessagingScreen-dJZWI4fa.cjs.map → MessagingScreen-UyuRUgcd.cjs.map} +1 -1
- package/dist/{OrdersScreen-k0x7wLRV.cjs → OrdersScreen-BDeDhRmY.cjs} +4 -4
- package/dist/{OrdersScreen-k0x7wLRV.cjs.map → OrdersScreen-BDeDhRmY.cjs.map} +1 -1
- package/dist/{OrdersScreen-hzKwBSYF.mjs → OrdersScreen-Svoa_Tgo.mjs} +4 -4
- package/dist/{OrdersScreen-hzKwBSYF.mjs.map → OrdersScreen-Svoa_Tgo.mjs.map} +1 -1
- package/dist/{OrdersScreen-DRp79-k9.cjs → OrdersScreen-kg_SQsyH.cjs} +2 -2
- package/dist/{ProductsScreen-BxNldFw6.cjs → ProductsScreen-CcXrvhEt.cjs} +3 -3
- package/dist/{ProductsScreen-BxNldFw6.cjs.map → ProductsScreen-CcXrvhEt.cjs.map} +1 -1
- package/dist/{ProductsScreen-hdAragYJ.cjs → ProductsScreen-DhPXnjaT.cjs} +5 -5
- package/dist/{ProductsScreen-B54KA40V.mjs → ProductsScreen-qNXEgjC9.mjs} +3 -3
- package/dist/{ProductsScreen-B54KA40V.mjs.map → ProductsScreen-qNXEgjC9.mjs.map} +1 -1
- package/dist/{ProductsScreen-CJR_jRhn.mjs → ProductsScreen-zQJ1iQRR.mjs} +5 -6
- package/dist/{ProfileScreen-DRLPIEQT.cjs → ProfileScreen-2_nSQ-oq.cjs} +2 -2
- package/dist/{ProfileScreen-DRLPIEQT.cjs.map → ProfileScreen-2_nSQ-oq.cjs.map} +1 -1
- package/dist/{ProfileScreen-DtDAJ45D.cjs → ProfileScreen-CF8Acn81.cjs} +1 -1
- package/dist/{ProfileScreen-Btqo-rsk.mjs → ProfileScreen-DMpBY-TD.mjs} +2 -2
- package/dist/{ProfileScreen-Btqo-rsk.mjs.map → ProfileScreen-DMpBY-TD.mjs.map} +1 -1
- package/dist/{ShareablesScreen-EJidIq4N.cjs → ShareablesScreen-DggEBWBJ.cjs} +5 -5
- package/dist/{ShareablesScreen-DrAZ49Iv.cjs → ShareablesScreen-DjUvqq49.cjs} +3 -3
- package/dist/{ShareablesScreen-DrAZ49Iv.cjs.map → ShareablesScreen-DjUvqq49.cjs.map} +1 -1
- package/dist/{ShareablesScreen-CbhdHxOH.mjs → ShareablesScreen-DlOwqlbr.mjs} +5 -6
- package/dist/{ShareablesScreen-UBSyLEbL.mjs → ShareablesScreen-q3pSmRdU.mjs} +3 -3
- package/dist/{ShareablesScreen-UBSyLEbL.mjs.map → ShareablesScreen-q3pSmRdU.mjs.map} +1 -1
- package/dist/{ShopScreen-BUri9nlR.cjs → ShopScreen-BMidW8lK.cjs} +2 -2
- package/dist/{ShopScreen-BUri9nlR.cjs.map → ShopScreen-BMidW8lK.cjs.map} +1 -1
- package/dist/{ShopScreen-Dr44ppZ7.mjs → ShopScreen-oOHel7N7.mjs} +2 -2
- package/dist/{ShopScreen-Dr44ppZ7.mjs.map → ShopScreen-oOHel7N7.mjs.map} +1 -1
- package/dist/{ShopScreen-B-9Qito4.cjs → ShopScreen-qkJC3t_U.cjs} +1 -1
- package/dist/{SubscriptionsScreen-BMMKqvmT.cjs → SubscriptionsScreen-DGLo_agH.cjs} +39 -114
- package/dist/SubscriptionsScreen-DGLo_agH.cjs.map +1 -0
- package/dist/{SubscriptionsScreen-DymuNO2u.mjs → SubscriptionsScreen-DGfzLW1d.mjs} +40 -115
- package/dist/SubscriptionsScreen-DGfzLW1d.mjs.map +1 -0
- package/dist/{SubscriptionsScreen-Bi0KJRf9.cjs → SubscriptionsScreen-DPgOsgwI.cjs} +3 -3
- package/dist/{dist-DkYXiQQ1.cjs → dist-Ck9MGRmE.cjs} +2 -2
- package/dist/{dist-DkYXiQQ1.cjs.map → dist-Ck9MGRmE.cjs.map} +1 -1
- package/dist/{dist-BbS_7TvS.cjs → dist-DRVtlgQ1.cjs} +1 -1
- package/dist/{dist-BbS_7TvS.cjs.map → dist-DRVtlgQ1.cjs.map} +1 -1
- package/dist/{dist-CMGXkSgZ.mjs → dist-NMbUD0qE.mjs} +1 -1
- package/dist/{dist-CMGXkSgZ.mjs.map → dist-NMbUD0qE.mjs.map} +1 -1
- package/dist/{dist-B1HwSrso.mjs → dist-oYNtEpKP.mjs} +2 -2
- package/dist/{dist-B1HwSrso.mjs.map → dist-oYNtEpKP.mjs.map} +1 -1
- package/dist/{es-1KItbbYg.mjs → es-C77ihvEl.mjs} +1 -1
- package/dist/{es-1KItbbYg.mjs.map → es-C77ihvEl.mjs.map} +1 -1
- package/dist/{es-BSkb3AZk.cjs → es-DlWO6buB.cjs} +1 -1
- package/dist/{es-BSkb3AZk.cjs.map → es-DlWO6buB.cjs.map} +1 -1
- package/dist/index.cjs +31 -31
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +31 -31
- package/dist/{order-detail-9-MS70Zm.cjs → order-detail-B5KmsBKU.cjs} +1 -1
- package/dist/{order-detail-9-MS70Zm.cjs.map → order-detail-B5KmsBKU.cjs.map} +1 -1
- package/dist/{order-detail-CYkWN7-L.mjs → order-detail-BzbdcFnt.mjs} +1 -1
- package/dist/{order-detail-CYkWN7-L.mjs.map → order-detail-BzbdcFnt.mjs.map} +1 -1
- package/dist/{src-C7RYt83r.mjs → src-iiLozCqU.mjs} +4 -4
- package/dist/{src-C7RYt83r.mjs.map → src-iiLozCqU.mjs.map} +1 -1
- package/dist/{src-DdIO0lIo.cjs → src-vyacfB0K.cjs} +4 -4
- package/dist/{src-DdIO0lIo.cjs.map → src-vyacfB0K.cjs.map} +1 -1
- package/dist/{use-account-clients-CFfdmi36.cjs → use-account-clients-BrlAG2os.cjs} +108 -6
- package/dist/use-account-clients-BrlAG2os.cjs.map +1 -0
- package/dist/{use-account-clients-0kFq_8i7.mjs → use-account-clients-vOToQZNB.mjs} +107 -5
- package/dist/use-account-clients-vOToQZNB.mjs.map +1 -0
- package/dist/{use-customer-account-Be70QBp3.mjs → use-customer-account-Bufu7Mae.mjs} +2 -2
- package/dist/{use-customer-account-Be70QBp3.mjs.map → use-customer-account-Bufu7Mae.mjs.map} +1 -1
- package/dist/{use-customer-account-BH-hwjbg.cjs → use-customer-account-CeNalSBy.cjs} +2 -2
- package/dist/{use-customer-account-BH-hwjbg.cjs.map → use-customer-account-CeNalSBy.cjs.map} +1 -1
- package/package.json +15 -14
- package/dist/ContactsScreen-CLt7Hlxg.mjs.map +0 -1
- package/dist/ContactsScreen-u9-U9Myu.cjs.map +0 -1
- package/dist/SubscriptionsScreen-BMMKqvmT.cjs.map +0 -1
- package/dist/SubscriptionsScreen-DymuNO2u.mjs.map +0 -1
- package/dist/use-account-clients-0kFq_8i7.mjs.map +0 -1
- package/dist/use-account-clients-CFfdmi36.cjs.map +0 -1
- /package/dist/{src-B7j_mfeS.mjs → src-BakNjVTk.mjs} +0 -0
- /package/dist/{src-Bp-dRR29.cjs → src-C_kOrGdZ.cjs} +0 -0
|
@@ -3,10 +3,10 @@ import { St as createFetchClient, n as useFluidContext } from "./FluidProvider-N
|
|
|
3
3
|
import { t as parseApiErrors } from "./parse-api-errors-Dy2gL1eC.mjs";
|
|
4
4
|
import { $t as Avatar, A as SelectContent, C as SheetContent, Ct as CardContent, E as SheetTitle, Et as CardTitle, G as Label, I as Input, J as DropdownMenuItem, Jt as BreadcrumbLink, K as DropdownMenu, Kt as Breadcrumb, M as SelectTrigger, N as SelectValue, Qt as Badge, S as Sheet, T as SheetHeader, Tt as CardHeader, X as DropdownMenuSeparator, Xt as BreadcrumbPage, Y as DropdownMenuLabel, Yt as BreadcrumbList, Zt as BreadcrumbSeparator, an as AlertDialogContent, c as TabsList, cn as AlertDialogHeader, d as TableBody, dn as Button, en as AvatarFallback, et as DropdownMenuTrigger, f as TableCell, h as TableRow, i as TooltipTrigger, in as AlertDialogCancel, j as SelectItem, k as Select, l as TabsTrigger, m as TableHeader, n as TooltipContent, nn as AlertDialog, o as Tabs, on as AlertDialogDescription, p as TableHead, q as DropdownMenuContent, qt as BreadcrumbItem, r as TooltipProvider, rn as AlertDialogAction, s as TabsContent, sn as AlertDialogFooter, t as Tooltip, tn as AvatarImage, u as Table$1, un as AlertDialogTitle, vn as useZodForm, w as SheetFooter, x as Skeleton, xt as Card, y as fluidToast, yn as cn } from "./src-77nf0QPD.mjs";
|
|
5
5
|
import { n as useScreenHeaderActions, r as useScreenHeaderBreadcrumbs } from "./ScreenHeaderContext-NdrJ58Mg.mjs";
|
|
6
|
-
import { a as useEditor, n as Heading, o as Placeholder, r as EditorContent, t as StarterKit } from "./dist-
|
|
7
|
-
import { i as PaginationFooter } from "./order-detail-
|
|
8
|
-
import { n as TextAlign, t as Underline } from "./dist-
|
|
9
|
-
import { useCallback, useEffect, useImperativeHandle, useMemo, useRef, useState } from "react";
|
|
6
|
+
import { a as useEditor, n as Heading, o as Placeholder, r as EditorContent, t as StarterKit } from "./dist-NMbUD0qE.mjs";
|
|
7
|
+
import { i as PaginationFooter } from "./order-detail-BzbdcFnt.mjs";
|
|
8
|
+
import { n as TextAlign, t as Underline } from "./dist-oYNtEpKP.mjs";
|
|
9
|
+
import { createContext, useCallback, useContext, useEffect, useImperativeHandle, useMemo, useRef, useState } from "react";
|
|
10
10
|
import { keepPreviousData, useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
|
|
11
11
|
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
12
12
|
import { z } from "zod";
|
|
@@ -717,7 +717,7 @@ function ContactsTable({ listContacts, queryKeyPrefix, setSelectedContacts, setO
|
|
|
717
717
|
});
|
|
718
718
|
}
|
|
719
719
|
//#endregion
|
|
720
|
-
//#region ../../contacts/
|
|
720
|
+
//#region ../../contacts/core/src/query-keys.ts
|
|
721
721
|
const CONTACTS_QUERY_KEYS = {
|
|
722
722
|
all: (prefix) => [prefix],
|
|
723
723
|
list: (prefix) => [...CONTACTS_QUERY_KEYS.all(prefix), "list"],
|
|
@@ -727,6 +727,33 @@ const CONTACTS_QUERY_KEYS = {
|
|
|
727
727
|
id
|
|
728
728
|
]
|
|
729
729
|
};
|
|
730
|
+
const contactsKeys = {
|
|
731
|
+
activities: (contactId) => [
|
|
732
|
+
"portal-contacts",
|
|
733
|
+
"activities",
|
|
734
|
+
contactId
|
|
735
|
+
],
|
|
736
|
+
tasks: (contactId) => [
|
|
737
|
+
"portal-contacts",
|
|
738
|
+
"tasks",
|
|
739
|
+
contactId
|
|
740
|
+
],
|
|
741
|
+
notes: (contactId) => [
|
|
742
|
+
"portal-contacts",
|
|
743
|
+
"notes",
|
|
744
|
+
contactId
|
|
745
|
+
],
|
|
746
|
+
orders: (contactId) => [
|
|
747
|
+
"rep-contacts",
|
|
748
|
+
"orders",
|
|
749
|
+
contactId
|
|
750
|
+
],
|
|
751
|
+
subscriptionOrders: (contactId) => [
|
|
752
|
+
"rep-contacts",
|
|
753
|
+
"subscription-orders",
|
|
754
|
+
contactId
|
|
755
|
+
]
|
|
756
|
+
};
|
|
730
757
|
//#endregion
|
|
731
758
|
//#region ../../contacts/ui/src/shared/components/contacts/allContacts/contactsPage.tsx
|
|
732
759
|
function ContactsPage({ listContacts, deleteContacts, queryKeyPrefix, header, onEditContact, onRowClick, tableLayout }) {
|
|
@@ -1452,204 +1479,36 @@ function NotesSidebar({ notes, isLoading, onNavigateToNotes }) {
|
|
|
1452
1479
|
});
|
|
1453
1480
|
}
|
|
1454
1481
|
//#endregion
|
|
1455
|
-
//#region ../../
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
* @param params - params
|
|
1463
|
-
*/
|
|
1464
|
-
async function deleteUserNote(client, id, params) {
|
|
1465
|
-
return client.delete(`/api/users/v2025-06/notes/${id}`, { params });
|
|
1466
|
-
}
|
|
1467
|
-
/**
|
|
1468
|
-
* Update a note
|
|
1469
|
-
*
|
|
1470
|
-
*
|
|
1471
|
-
* @param client - Fetch client instance
|
|
1472
|
-
* @param id - id
|
|
1473
|
-
* @param body - body
|
|
1474
|
-
*/
|
|
1475
|
-
async function updateUserNote(client, id, body) {
|
|
1476
|
-
return client.patch(`/api/users/v2025-06/notes/${id}`, body);
|
|
1477
|
-
}
|
|
1478
|
-
//#endregion
|
|
1479
|
-
//#region ../../contacts/fluid-user-contacts-api-client/src/namespaces/users_contacts.ts
|
|
1480
|
-
/**
|
|
1481
|
-
* List activities for a contact
|
|
1482
|
-
*
|
|
1483
|
-
*
|
|
1484
|
-
* @param client - Fetch client instance
|
|
1485
|
-
* @param id - id
|
|
1486
|
-
* @param params? - params?
|
|
1487
|
-
*/
|
|
1488
|
-
async function listUserContactActivities(client, id, params) {
|
|
1489
|
-
return client.get(`/api/users/v2025-06/contacts/${id}/activities`, params);
|
|
1490
|
-
}
|
|
1491
|
-
/**
|
|
1492
|
-
* Bulk delete contacts
|
|
1493
|
-
*
|
|
1494
|
-
*
|
|
1495
|
-
* @param client - Fetch client instance
|
|
1496
|
-
* @param body - body
|
|
1497
|
-
*/
|
|
1498
|
-
async function bulkDeleteUserContacts(client, body) {
|
|
1499
|
-
return client.delete(`/api/users/v2025-06/contacts/bulk_delete`, { body });
|
|
1500
|
-
}
|
|
1501
|
-
/**
|
|
1502
|
-
* Create a contact
|
|
1503
|
-
*
|
|
1504
|
-
*
|
|
1505
|
-
* @param client - Fetch client instance
|
|
1506
|
-
* @param body - body
|
|
1507
|
-
*/
|
|
1508
|
-
async function createUserContact(client, body) {
|
|
1509
|
-
return client.post(`/api/users/v2025-06/contacts`, body);
|
|
1510
|
-
}
|
|
1511
|
-
/**
|
|
1512
|
-
* List user's contacts
|
|
1513
|
-
*
|
|
1514
|
-
*
|
|
1515
|
-
* @param client - Fetch client instance
|
|
1516
|
-
* @param params? - params?
|
|
1517
|
-
*/
|
|
1518
|
-
async function listUserContacts(client, params) {
|
|
1519
|
-
return client.get(`/api/users/v2025-06/contacts`, params);
|
|
1520
|
-
}
|
|
1521
|
-
/**
|
|
1522
|
-
* Delete a contact
|
|
1523
|
-
*
|
|
1524
|
-
*
|
|
1525
|
-
* @param client - Fetch client instance
|
|
1526
|
-
* @param id - id
|
|
1527
|
-
*/
|
|
1528
|
-
async function deleteUserContact(client, id) {
|
|
1529
|
-
return client.delete(`/api/users/v2025-06/contacts/${id}`);
|
|
1530
|
-
}
|
|
1531
|
-
/**
|
|
1532
|
-
* Get a contact
|
|
1533
|
-
*
|
|
1534
|
-
*
|
|
1535
|
-
* @param client - Fetch client instance
|
|
1536
|
-
* @param id - id
|
|
1537
|
-
*/
|
|
1538
|
-
async function getUserContact(client, id) {
|
|
1539
|
-
return client.get(`/api/users/v2025-06/contacts/${id}`);
|
|
1540
|
-
}
|
|
1541
|
-
/**
|
|
1542
|
-
* Update a contact
|
|
1543
|
-
*
|
|
1544
|
-
*
|
|
1545
|
-
* @param client - Fetch client instance
|
|
1546
|
-
* @param id - id
|
|
1547
|
-
* @param body - body
|
|
1548
|
-
*/
|
|
1549
|
-
async function updateUserContact(client, id, body) {
|
|
1550
|
-
return client.patch(`/api/users/v2025-06/contacts/${id}`, body);
|
|
1551
|
-
}
|
|
1552
|
-
/**
|
|
1553
|
-
* Create a note for a contact (deprecated)
|
|
1554
|
-
*
|
|
1555
|
-
*
|
|
1556
|
-
* @param client - Fetch client instance
|
|
1557
|
-
* @param id - id
|
|
1558
|
-
* @param body - body
|
|
1559
|
-
*/
|
|
1560
|
-
async function createUserContactNote(client, id, body) {
|
|
1561
|
-
return client.post(`/api/users/v2025-06/contacts/${id}/notes`, body);
|
|
1562
|
-
}
|
|
1563
|
-
/**
|
|
1564
|
-
* List notes for a contact
|
|
1565
|
-
*
|
|
1566
|
-
*
|
|
1567
|
-
* @param client - Fetch client instance
|
|
1568
|
-
* @param id - id
|
|
1569
|
-
*/
|
|
1570
|
-
async function listUserContactNotes(client, id) {
|
|
1571
|
-
return client.get(`/api/users/v2025-06/contacts/${id}/notes`);
|
|
1572
|
-
}
|
|
1573
|
-
/**
|
|
1574
|
-
* List orders for a contact
|
|
1575
|
-
*
|
|
1576
|
-
*
|
|
1577
|
-
* @param client - Fetch client instance
|
|
1578
|
-
* @param id - id
|
|
1579
|
-
* @param params? - params?
|
|
1580
|
-
*/
|
|
1581
|
-
async function listUserContactOrders(client, id, params) {
|
|
1582
|
-
return client.get(`/api/users/v2025-06/contacts/${id}/orders`, params);
|
|
1583
|
-
}
|
|
1584
|
-
/**
|
|
1585
|
-
* Mark contact's activities as read
|
|
1586
|
-
*
|
|
1587
|
-
*
|
|
1588
|
-
* @param client - Fetch client instance
|
|
1589
|
-
* @param id - id
|
|
1590
|
-
*/
|
|
1591
|
-
async function markUserContactRead(client, id) {
|
|
1592
|
-
return client.post(`/api/users/v2025-06/contacts/${id}/read`);
|
|
1593
|
-
}
|
|
1594
|
-
/**
|
|
1595
|
-
* List subscription orders for a contact
|
|
1596
|
-
*
|
|
1597
|
-
*
|
|
1598
|
-
* @param client - Fetch client instance
|
|
1599
|
-
* @param id - id
|
|
1600
|
-
* @param params? - params?
|
|
1601
|
-
*/
|
|
1602
|
-
async function listUserContactSubscriptionOrders(client, id, params) {
|
|
1603
|
-
return client.get(`/api/users/v2025-06/contacts/${id}/subscription_orders`, params);
|
|
1482
|
+
//#region ../../contacts/core/src/contacts-api-context.ts
|
|
1483
|
+
const ContactsApiContext = createContext(null);
|
|
1484
|
+
const ContactsApiProvider = ContactsApiContext.Provider;
|
|
1485
|
+
function useContactsDomainApi() {
|
|
1486
|
+
const api = useContext(ContactsApiContext);
|
|
1487
|
+
if (!api) throw new Error("useContactsDomainApi must be used within a ContactsApiProvider");
|
|
1488
|
+
return api;
|
|
1604
1489
|
}
|
|
1605
|
-
|
|
1606
|
-
|
|
1607
|
-
*
|
|
1608
|
-
*
|
|
1609
|
-
* @param client - Fetch client instance
|
|
1610
|
-
* @param id - id
|
|
1611
|
-
* @param body - body
|
|
1612
|
-
*/
|
|
1613
|
-
async function createUserContactTask(client, id, body) {
|
|
1614
|
-
return client.post(`/api/users/v2025-06/contacts/${id}/tasks`, body);
|
|
1490
|
+
function useContactsCrud() {
|
|
1491
|
+
return useContactsDomainApi().contacts;
|
|
1615
1492
|
}
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
*
|
|
1619
|
-
*
|
|
1620
|
-
* @param client - Fetch client instance
|
|
1621
|
-
* @param id - id
|
|
1622
|
-
*/
|
|
1623
|
-
async function listUserContactTasks(client, id) {
|
|
1624
|
-
return client.get(`/api/users/v2025-06/contacts/${id}/tasks`);
|
|
1493
|
+
function useNotesApi() {
|
|
1494
|
+
return useContactsDomainApi().notes;
|
|
1625
1495
|
}
|
|
1626
|
-
|
|
1627
|
-
|
|
1628
|
-
const CONTACT_NOTES_QUERY_KEY = (contactId) => [
|
|
1629
|
-
"portal-contacts",
|
|
1630
|
-
"notes",
|
|
1631
|
-
contactId
|
|
1632
|
-
];
|
|
1633
|
-
function useContactNotes(client, contactId) {
|
|
1634
|
-
return useQuery({
|
|
1635
|
-
queryKey: CONTACT_NOTES_QUERY_KEY(contactId),
|
|
1636
|
-
queryFn: () => listUserContactNotes(client, contactId),
|
|
1637
|
-
enabled: !!contactId,
|
|
1638
|
-
select: (data) => data.notes
|
|
1639
|
-
});
|
|
1496
|
+
function useTasksApi() {
|
|
1497
|
+
return useContactsDomainApi().tasks;
|
|
1640
1498
|
}
|
|
1641
1499
|
//#endregion
|
|
1642
1500
|
//#region ../../contacts/ui/src/portal/hooks/notes/use-delete-contact-note.ts
|
|
1643
|
-
function useDeleteContactNote(
|
|
1501
|
+
function useDeleteContactNote(contactId, options) {
|
|
1644
1502
|
const queryClient = useQueryClient();
|
|
1503
|
+
const api = useNotesApi();
|
|
1645
1504
|
return useMutation({
|
|
1646
|
-
mutationFn: (noteId) =>
|
|
1505
|
+
mutationFn: (noteId) => api.deleteNote(noteId, contactId),
|
|
1647
1506
|
onSuccess: () => {
|
|
1648
1507
|
fluidToast({
|
|
1649
1508
|
title: "Note deleted",
|
|
1650
1509
|
type: "success"
|
|
1651
1510
|
});
|
|
1652
|
-
queryClient.invalidateQueries({ queryKey:
|
|
1511
|
+
queryClient.invalidateQueries({ queryKey: contactsKeys.notes(contactId) });
|
|
1653
1512
|
options?.onSuccess?.();
|
|
1654
1513
|
},
|
|
1655
1514
|
onError: (error) => {
|
|
@@ -1663,19 +1522,17 @@ function useDeleteContactNote(client, contactId, options) {
|
|
|
1663
1522
|
}
|
|
1664
1523
|
//#endregion
|
|
1665
1524
|
//#region ../../contacts/ui/src/portal/hooks/notes/use-create-contact-note.ts
|
|
1666
|
-
function useCreateContactNote(
|
|
1525
|
+
function useCreateContactNote(contactId, options) {
|
|
1667
1526
|
const queryClient = useQueryClient();
|
|
1527
|
+
const api = useNotesApi();
|
|
1668
1528
|
return useMutation({
|
|
1669
|
-
mutationFn: (input) =>
|
|
1670
|
-
id: Number(contactId),
|
|
1671
|
-
note: input
|
|
1672
|
-
}),
|
|
1529
|
+
mutationFn: (input) => api.createNote(contactId, input),
|
|
1673
1530
|
onSuccess: () => {
|
|
1674
1531
|
fluidToast({
|
|
1675
1532
|
title: "Note created",
|
|
1676
1533
|
type: "success"
|
|
1677
1534
|
});
|
|
1678
|
-
queryClient.invalidateQueries({ queryKey:
|
|
1535
|
+
queryClient.invalidateQueries({ queryKey: contactsKeys.notes(contactId) });
|
|
1679
1536
|
options?.onSuccess?.();
|
|
1680
1537
|
},
|
|
1681
1538
|
onError: (error) => {
|
|
@@ -1689,20 +1546,17 @@ function useCreateContactNote(client, contactId, options) {
|
|
|
1689
1546
|
}
|
|
1690
1547
|
//#endregion
|
|
1691
1548
|
//#region ../../contacts/ui/src/portal/hooks/notes/use-update-contact-note.ts
|
|
1692
|
-
function useUpdateContactNote(
|
|
1549
|
+
function useUpdateContactNote(contactId, options) {
|
|
1693
1550
|
const queryClient = useQueryClient();
|
|
1551
|
+
const api = useNotesApi();
|
|
1694
1552
|
return useMutation({
|
|
1695
|
-
mutationFn: ({ noteId, input }) =>
|
|
1696
|
-
contact_id: Number(contactId),
|
|
1697
|
-
id: noteId,
|
|
1698
|
-
note: input
|
|
1699
|
-
}),
|
|
1553
|
+
mutationFn: ({ noteId, input }) => api.updateNote(noteId, contactId, input),
|
|
1700
1554
|
onSuccess: () => {
|
|
1701
1555
|
fluidToast({
|
|
1702
1556
|
title: "Note updated",
|
|
1703
1557
|
type: "success"
|
|
1704
1558
|
});
|
|
1705
|
-
queryClient.invalidateQueries({ queryKey:
|
|
1559
|
+
queryClient.invalidateQueries({ queryKey: contactsKeys.notes(contactId) });
|
|
1706
1560
|
options?.onSuccess?.();
|
|
1707
1561
|
},
|
|
1708
1562
|
onError: (error) => {
|
|
@@ -2218,14 +2072,13 @@ function NoteCard({ note, onEdit, onDelete }) {
|
|
|
2218
2072
|
]
|
|
2219
2073
|
});
|
|
2220
2074
|
}
|
|
2221
|
-
function NotesList({ notes, isLoading, contactId,
|
|
2075
|
+
function NotesList({ notes, isLoading, contactId, ref }) {
|
|
2222
2076
|
const [noteToDelete, setNoteToDelete] = useState(null);
|
|
2223
2077
|
const [modalOpen, setModalOpen] = useState(false);
|
|
2224
2078
|
const [editingNote, setEditingNote] = useState(null);
|
|
2225
|
-
const
|
|
2226
|
-
const
|
|
2227
|
-
const
|
|
2228
|
-
const updateNote = useUpdateContactNote(effectiveClient, contactId, { onSuccess: () => setEditingNote(null) });
|
|
2079
|
+
const deleteNote = useDeleteContactNote(contactId);
|
|
2080
|
+
const createNote = useCreateContactNote(contactId, { onSuccess: () => setModalOpen(false) });
|
|
2081
|
+
const updateNote = useUpdateContactNote(contactId, { onSuccess: () => setEditingNote(null) });
|
|
2229
2082
|
const openCreateModal = () => {
|
|
2230
2083
|
setEditingNote(null);
|
|
2231
2084
|
setModalOpen(true);
|
|
@@ -2647,54 +2500,14 @@ function ActivityFeed({ activities, isLoading, onMarkRead }) {
|
|
|
2647
2500
|
});
|
|
2648
2501
|
}
|
|
2649
2502
|
//#endregion
|
|
2650
|
-
//#region ../../tasks/fluid-user-tasks-api-client/src/namespaces/users_tasks.ts
|
|
2651
|
-
/**
|
|
2652
|
-
* Delete a task
|
|
2653
|
-
*
|
|
2654
|
-
*
|
|
2655
|
-
* @param client - Fetch client instance
|
|
2656
|
-
* @param id - id
|
|
2657
|
-
*/
|
|
2658
|
-
async function deleteUserTask(client, id) {
|
|
2659
|
-
return client.delete(`/api/users/v2025-06/tasks/${id}`);
|
|
2660
|
-
}
|
|
2661
|
-
/**
|
|
2662
|
-
* Update a task
|
|
2663
|
-
*
|
|
2664
|
-
*
|
|
2665
|
-
* @param client - Fetch client instance
|
|
2666
|
-
* @param id - id
|
|
2667
|
-
* @param body - body
|
|
2668
|
-
*/
|
|
2669
|
-
async function updateUserTask(client, id, body) {
|
|
2670
|
-
return client.patch(`/api/users/v2025-06/tasks/${id}`, body);
|
|
2671
|
-
}
|
|
2672
|
-
//#endregion
|
|
2673
|
-
//#region ../../contacts/ui/src/portal/hooks/contacts/use-contact-tasks.ts
|
|
2674
|
-
const CONTACT_TASKS_QUERY_KEY = (contactId) => [
|
|
2675
|
-
"portal-contacts",
|
|
2676
|
-
"tasks",
|
|
2677
|
-
contactId
|
|
2678
|
-
];
|
|
2679
|
-
function useContactTasks(client, contactId) {
|
|
2680
|
-
return useQuery({
|
|
2681
|
-
queryKey: CONTACT_TASKS_QUERY_KEY(contactId),
|
|
2682
|
-
queryFn: () => listUserContactTasks(client, contactId),
|
|
2683
|
-
enabled: !!contactId,
|
|
2684
|
-
select: (data) => data.tasks
|
|
2685
|
-
});
|
|
2686
|
-
}
|
|
2687
|
-
//#endregion
|
|
2688
2503
|
//#region ../../contacts/ui/src/portal/hooks/contacts/use-toggle-task-completion.ts
|
|
2689
|
-
function useToggleTaskCompletion(
|
|
2504
|
+
function useToggleTaskCompletion(contactId) {
|
|
2690
2505
|
const queryClient = useQueryClient();
|
|
2506
|
+
const api = useTasksApi();
|
|
2691
2507
|
return useMutation({
|
|
2692
|
-
mutationFn: ({ taskId, isCompleted }) =>
|
|
2693
|
-
id: taskId,
|
|
2694
|
-
task: { completed_at: isCompleted ? null : (/* @__PURE__ */ new Date()).toISOString() }
|
|
2695
|
-
}),
|
|
2508
|
+
mutationFn: ({ taskId, isCompleted }) => api.updateTask(taskId, { completed_at: isCompleted ? null : (/* @__PURE__ */ new Date()).toISOString() }),
|
|
2696
2509
|
onSuccess: () => {
|
|
2697
|
-
queryClient.invalidateQueries({ queryKey:
|
|
2510
|
+
queryClient.invalidateQueries({ queryKey: contactsKeys.tasks(contactId) });
|
|
2698
2511
|
},
|
|
2699
2512
|
onError: (error) => {
|
|
2700
2513
|
fluidToast({
|
|
@@ -2707,16 +2520,17 @@ function useToggleTaskCompletion(client, contactId) {
|
|
|
2707
2520
|
}
|
|
2708
2521
|
//#endregion
|
|
2709
2522
|
//#region ../../contacts/ui/src/portal/hooks/contacts/use-delete-contact-task.ts
|
|
2710
|
-
function useDeleteContactTask(
|
|
2523
|
+
function useDeleteContactTask(contactId, options) {
|
|
2711
2524
|
const queryClient = useQueryClient();
|
|
2525
|
+
const api = useTasksApi();
|
|
2712
2526
|
return useMutation({
|
|
2713
|
-
mutationFn: (taskId) =>
|
|
2527
|
+
mutationFn: (taskId) => api.deleteTask(taskId),
|
|
2714
2528
|
onSuccess: () => {
|
|
2715
2529
|
fluidToast({
|
|
2716
2530
|
title: "Task deleted",
|
|
2717
2531
|
type: "success"
|
|
2718
2532
|
});
|
|
2719
|
-
queryClient.invalidateQueries({ queryKey:
|
|
2533
|
+
queryClient.invalidateQueries({ queryKey: contactsKeys.tasks(contactId) });
|
|
2720
2534
|
options?.onSuccess?.();
|
|
2721
2535
|
},
|
|
2722
2536
|
onError: (error) => {
|
|
@@ -2730,19 +2544,17 @@ function useDeleteContactTask(client, contactId, options) {
|
|
|
2730
2544
|
}
|
|
2731
2545
|
//#endregion
|
|
2732
2546
|
//#region ../../contacts/ui/src/portal/hooks/contacts/use-create-contact-task.ts
|
|
2733
|
-
function useCreateContactTask(
|
|
2547
|
+
function useCreateContactTask(contactId, options) {
|
|
2734
2548
|
const queryClient = useQueryClient();
|
|
2549
|
+
const api = useTasksApi();
|
|
2735
2550
|
return useMutation({
|
|
2736
|
-
mutationFn: (input) =>
|
|
2737
|
-
id: Number(contactId),
|
|
2738
|
-
task: input
|
|
2739
|
-
}),
|
|
2551
|
+
mutationFn: (input) => api.createTask(contactId, input),
|
|
2740
2552
|
onSuccess: () => {
|
|
2741
2553
|
fluidToast({
|
|
2742
2554
|
title: "Task created",
|
|
2743
2555
|
type: "success"
|
|
2744
2556
|
});
|
|
2745
|
-
queryClient.invalidateQueries({ queryKey:
|
|
2557
|
+
queryClient.invalidateQueries({ queryKey: contactsKeys.tasks(contactId) });
|
|
2746
2558
|
options?.onSuccess?.();
|
|
2747
2559
|
},
|
|
2748
2560
|
onError: (error) => {
|
|
@@ -2756,19 +2568,17 @@ function useCreateContactTask(client, contactId, options) {
|
|
|
2756
2568
|
}
|
|
2757
2569
|
//#endregion
|
|
2758
2570
|
//#region ../../contacts/ui/src/portal/hooks/contacts/use-update-contact-task.ts
|
|
2759
|
-
function useUpdateContactTask(
|
|
2571
|
+
function useUpdateContactTask(contactId, options) {
|
|
2760
2572
|
const queryClient = useQueryClient();
|
|
2573
|
+
const api = useTasksApi();
|
|
2761
2574
|
return useMutation({
|
|
2762
|
-
mutationFn: ({ taskId, input }) =>
|
|
2763
|
-
id: taskId,
|
|
2764
|
-
task: input
|
|
2765
|
-
}),
|
|
2575
|
+
mutationFn: ({ taskId, input }) => api.updateTask(taskId, input),
|
|
2766
2576
|
onSuccess: () => {
|
|
2767
2577
|
fluidToast({
|
|
2768
2578
|
title: "Task updated",
|
|
2769
2579
|
type: "success"
|
|
2770
2580
|
});
|
|
2771
|
-
queryClient.invalidateQueries({ queryKey:
|
|
2581
|
+
queryClient.invalidateQueries({ queryKey: contactsKeys.tasks(contactId) });
|
|
2772
2582
|
options?.onSuccess?.();
|
|
2773
2583
|
},
|
|
2774
2584
|
onError: (error) => {
|
|
@@ -2926,15 +2736,14 @@ function TaskCard({ task, toggleCompletion, onEdit, onDeleteClick }) {
|
|
|
2926
2736
|
})
|
|
2927
2737
|
});
|
|
2928
2738
|
}
|
|
2929
|
-
function TaskList({ tasks, isLoading, contactId,
|
|
2739
|
+
function TaskList({ tasks, isLoading, contactId, ref }) {
|
|
2930
2740
|
const [taskToDelete, setTaskToDelete] = useState(null);
|
|
2931
2741
|
const [modalOpen, setModalOpen] = useState(false);
|
|
2932
2742
|
const [editingTask, setEditingTask] = useState(null);
|
|
2933
|
-
const
|
|
2934
|
-
const
|
|
2935
|
-
const
|
|
2936
|
-
const
|
|
2937
|
-
const updateTask = useUpdateContactTask(effectiveClient, contactId, { onSuccess: () => setEditingTask(null) });
|
|
2743
|
+
const toggleCompletion = useToggleTaskCompletion(contactId);
|
|
2744
|
+
const deleteTask = useDeleteContactTask(contactId, { onSuccess: () => setTaskToDelete(null) });
|
|
2745
|
+
const createTask = useCreateContactTask(contactId, { onSuccess: () => setModalOpen(false) });
|
|
2746
|
+
const updateTask = useUpdateContactTask(contactId, { onSuccess: () => setEditingTask(null) });
|
|
2938
2747
|
const openCreateModal = () => {
|
|
2939
2748
|
setEditingTask(null);
|
|
2940
2749
|
setModalOpen(true);
|
|
@@ -3043,29 +2852,45 @@ function TaskList({ tasks, isLoading, contactId, client, tasksClient, ref }) {
|
|
|
3043
2852
|
}
|
|
3044
2853
|
//#endregion
|
|
3045
2854
|
//#region ../../contacts/ui/src/portal/hooks/contacts/use-contact-activities.ts
|
|
3046
|
-
function useContactActivities(
|
|
2855
|
+
function useContactActivities(contactId, options) {
|
|
2856
|
+
const api = useContactsCrud();
|
|
3047
2857
|
return useQuery({
|
|
3048
|
-
queryKey:
|
|
3049
|
-
|
|
3050
|
-
"activities",
|
|
3051
|
-
contactId
|
|
3052
|
-
],
|
|
3053
|
-
queryFn: () => listUserContactActivities(client, contactId),
|
|
2858
|
+
queryKey: contactsKeys.activities(contactId),
|
|
2859
|
+
queryFn: () => api.listActivities(contactId),
|
|
3054
2860
|
enabled: options?.enabled !== false && !!contactId,
|
|
3055
2861
|
select: (data) => data.activities
|
|
3056
2862
|
});
|
|
3057
2863
|
}
|
|
3058
2864
|
//#endregion
|
|
2865
|
+
//#region ../../contacts/ui/src/portal/hooks/contacts/use-contact-tasks.ts
|
|
2866
|
+
function useContactTasks(contactId) {
|
|
2867
|
+
const api = useTasksApi();
|
|
2868
|
+
return useQuery({
|
|
2869
|
+
queryKey: contactsKeys.tasks(contactId),
|
|
2870
|
+
queryFn: () => api.listTasks(contactId),
|
|
2871
|
+
enabled: !!contactId,
|
|
2872
|
+
select: (data) => data.tasks
|
|
2873
|
+
});
|
|
2874
|
+
}
|
|
2875
|
+
//#endregion
|
|
2876
|
+
//#region ../../contacts/ui/src/portal/hooks/notes/use-contact-notes.ts
|
|
2877
|
+
function useContactNotes(contactId) {
|
|
2878
|
+
const api = useNotesApi();
|
|
2879
|
+
return useQuery({
|
|
2880
|
+
queryKey: contactsKeys.notes(contactId),
|
|
2881
|
+
queryFn: () => api.listNotes(contactId),
|
|
2882
|
+
enabled: !!contactId,
|
|
2883
|
+
select: (data) => data.notes
|
|
2884
|
+
});
|
|
2885
|
+
}
|
|
2886
|
+
//#endregion
|
|
3059
2887
|
//#region ../../contacts/ui/src/portal/hooks/contacts/use-mark-contact-read.ts
|
|
3060
|
-
function useMarkContactRead(
|
|
2888
|
+
function useMarkContactRead(contactId) {
|
|
3061
2889
|
const queryClient = useQueryClient();
|
|
3062
|
-
const
|
|
3063
|
-
|
|
3064
|
-
"activities",
|
|
3065
|
-
contactId
|
|
3066
|
-
];
|
|
2890
|
+
const api = useContactsCrud();
|
|
2891
|
+
const queryKey = contactsKeys.activities(contactId);
|
|
3067
2892
|
return useMutation({
|
|
3068
|
-
mutationFn: () =>
|
|
2893
|
+
mutationFn: () => api.markRead(contactId),
|
|
3069
2894
|
onMutate: () => {
|
|
3070
2895
|
const previous = queryClient.getQueryData(queryKey);
|
|
3071
2896
|
if (previous) {
|
|
@@ -3091,12 +2916,12 @@ function useMarkContactRead(client, contactId) {
|
|
|
3091
2916
|
//#endregion
|
|
3092
2917
|
//#region ../../contacts/ui/src/portal/components/contacts/rep-contact-detail-view.tsx
|
|
3093
2918
|
const DEFAULT_COUNTRY_OPTIONS = [];
|
|
3094
|
-
function RepContactDetailView({ contact, contactId,
|
|
2919
|
+
function RepContactDetailView({ contact, contactId, countryOptions = DEFAULT_COUNTRY_OPTIONS, ordersSlot, subscriptionsSlot }) {
|
|
3095
2920
|
const [activeTab, setActiveTab] = useState("activity");
|
|
3096
|
-
const { data: activities = [], isLoading: isLoadingActivities } = useContactActivities(
|
|
3097
|
-
const { data: tasks = [], isLoading: isLoadingTasks } = useContactTasks(
|
|
3098
|
-
const { data: notes = [], isLoading: isLoadingNotes } = useContactNotes(
|
|
3099
|
-
const markRead = useMarkContactRead(
|
|
2921
|
+
const { data: activities = [], isLoading: isLoadingActivities } = useContactActivities(contactId);
|
|
2922
|
+
const { data: tasks = [], isLoading: isLoadingTasks } = useContactTasks(contactId);
|
|
2923
|
+
const { data: notes = [], isLoading: isLoadingNotes } = useContactNotes(contactId);
|
|
2924
|
+
const markRead = useMarkContactRead(contactId);
|
|
3100
2925
|
const hasFiredRef = useRef(false);
|
|
3101
2926
|
const prevHasUnreadRef = useRef(false);
|
|
3102
2927
|
const openNoteModalRef = useRef(null);
|
|
@@ -3216,8 +3041,6 @@ function RepContactDetailView({ contact, contactId, client, notesClient, tasksCl
|
|
|
3216
3041
|
tasks,
|
|
3217
3042
|
isLoading: isLoadingTasks,
|
|
3218
3043
|
contactId,
|
|
3219
|
-
client,
|
|
3220
|
-
tasksClient,
|
|
3221
3044
|
ref: openTaskModalRef
|
|
3222
3045
|
})
|
|
3223
3046
|
}),
|
|
@@ -3228,8 +3051,6 @@ function RepContactDetailView({ contact, contactId, client, notesClient, tasksCl
|
|
|
3228
3051
|
notes,
|
|
3229
3052
|
isLoading: isLoadingNotes,
|
|
3230
3053
|
contactId,
|
|
3231
|
-
client,
|
|
3232
|
-
notesClient,
|
|
3233
3054
|
ref: openNoteModalRef
|
|
3234
3055
|
})
|
|
3235
3056
|
}),
|
|
@@ -3320,20 +3141,16 @@ function Pagination({ currentPage, totalPages, totalCount, onPageChange }) {
|
|
|
3320
3141
|
}
|
|
3321
3142
|
//#endregion
|
|
3322
3143
|
//#region ../../contacts/ui/src/portal/hooks/contacts/use-contact-orders.ts
|
|
3323
|
-
|
|
3324
|
-
|
|
3325
|
-
"orders",
|
|
3326
|
-
contactId
|
|
3327
|
-
];
|
|
3328
|
-
function useContactOrders(client, contactId, params) {
|
|
3144
|
+
function useContactOrders(contactId, params) {
|
|
3145
|
+
const api = useContactsCrud();
|
|
3329
3146
|
return useQuery({
|
|
3330
3147
|
queryKey: [
|
|
3331
|
-
...
|
|
3148
|
+
...contactsKeys.orders(contactId),
|
|
3332
3149
|
params?.page,
|
|
3333
3150
|
params?.per_page,
|
|
3334
3151
|
params?.status
|
|
3335
3152
|
],
|
|
3336
|
-
queryFn: () =>
|
|
3153
|
+
queryFn: () => api.listOrders(contactId, params),
|
|
3337
3154
|
enabled: !!contactId,
|
|
3338
3155
|
placeholderData: keepPreviousData
|
|
3339
3156
|
});
|
|
@@ -3515,10 +3332,10 @@ function OrderCard({ order }) {
|
|
|
3515
3332
|
})
|
|
3516
3333
|
});
|
|
3517
3334
|
}
|
|
3518
|
-
function ContactOrdersList({
|
|
3335
|
+
function ContactOrdersList({ contactId, pageSize = 10 }) {
|
|
3519
3336
|
const [page, setPage] = useState(1);
|
|
3520
3337
|
const [statusFilter, setStatusFilter] = useState(null);
|
|
3521
|
-
const { data, isLoading, isError, isFetching } = useContactOrders(
|
|
3338
|
+
const { data, isLoading, isError, isFetching } = useContactOrders(contactId, {
|
|
3522
3339
|
page,
|
|
3523
3340
|
per_page: pageSize,
|
|
3524
3341
|
...statusFilter ? { status: statusFilter } : {}
|
|
@@ -3604,20 +3421,16 @@ function ContactOrdersList({ client, contactId, pageSize = 10 }) {
|
|
|
3604
3421
|
}
|
|
3605
3422
|
//#endregion
|
|
3606
3423
|
//#region ../../contacts/ui/src/portal/hooks/contacts/use-contact-subscription-orders.ts
|
|
3607
|
-
|
|
3608
|
-
|
|
3609
|
-
"subscription-orders",
|
|
3610
|
-
contactId
|
|
3611
|
-
];
|
|
3612
|
-
function useContactSubscriptionOrders(client, contactId, params) {
|
|
3424
|
+
function useContactSubscriptionOrders(contactId, params) {
|
|
3425
|
+
const api = useContactsCrud();
|
|
3613
3426
|
return useQuery({
|
|
3614
3427
|
queryKey: [
|
|
3615
|
-
...
|
|
3428
|
+
...contactsKeys.subscriptionOrders(contactId),
|
|
3616
3429
|
params?.page,
|
|
3617
3430
|
params?.per_page,
|
|
3618
3431
|
params?.status
|
|
3619
3432
|
],
|
|
3620
|
-
queryFn: () =>
|
|
3433
|
+
queryFn: () => api.listSubscriptionOrders(contactId, params),
|
|
3621
3434
|
enabled: !!contactId,
|
|
3622
3435
|
placeholderData: keepPreviousData
|
|
3623
3436
|
});
|
|
@@ -3770,10 +3583,10 @@ function SubscriptionCard({ sub }) {
|
|
|
3770
3583
|
})
|
|
3771
3584
|
});
|
|
3772
3585
|
}
|
|
3773
|
-
function ContactSubscriptionOrdersList({
|
|
3586
|
+
function ContactSubscriptionOrdersList({ contactId, pageSize = 10 }) {
|
|
3774
3587
|
const [page, setPage] = useState(1);
|
|
3775
3588
|
const [statusFilter, setStatusFilter] = useState(null);
|
|
3776
|
-
const { data, isLoading, isError, isFetching } = useContactSubscriptionOrders(
|
|
3589
|
+
const { data, isLoading, isError, isFetching } = useContactSubscriptionOrders(contactId, {
|
|
3777
3590
|
page,
|
|
3778
3591
|
per_page: pageSize,
|
|
3779
3592
|
...statusFilter ? { status: statusFilter } : {}
|
|
@@ -3858,85 +3671,22 @@ function ContactSubscriptionOrdersList({ client, contactId, pageSize = 10 }) {
|
|
|
3858
3671
|
});
|
|
3859
3672
|
}
|
|
3860
3673
|
//#endregion
|
|
3861
|
-
//#region ../../contacts/fluid-company-contacts-api-client/src/namespaces/company_contacts.ts
|
|
3862
|
-
/**
|
|
3863
|
-
* Create a company contact
|
|
3864
|
-
*
|
|
3865
|
-
*
|
|
3866
|
-
* @param client - Fetch client instance
|
|
3867
|
-
* @param body - body
|
|
3868
|
-
*/
|
|
3869
|
-
async function createCompanyContact(client, body) {
|
|
3870
|
-
return client.post(`/api/company/contacts`, body);
|
|
3871
|
-
}
|
|
3872
|
-
/**
|
|
3873
|
-
* Delete a company contact
|
|
3874
|
-
*
|
|
3875
|
-
*
|
|
3876
|
-
* @param client - Fetch client instance
|
|
3877
|
-
* @param id - id
|
|
3878
|
-
*/
|
|
3879
|
-
async function deleteCompanyContact(client, id) {
|
|
3880
|
-
return client.delete(`/api/company/contacts/${id}`);
|
|
3881
|
-
}
|
|
3882
|
-
/**
|
|
3883
|
-
* Get a company contact
|
|
3884
|
-
*
|
|
3885
|
-
*
|
|
3886
|
-
* @param client - Fetch client instance
|
|
3887
|
-
* @param id - id
|
|
3888
|
-
*/
|
|
3889
|
-
async function getCompanyContact(client, id) {
|
|
3890
|
-
return client.get(`/api/company/contacts/${id}`);
|
|
3891
|
-
}
|
|
3892
|
-
/**
|
|
3893
|
-
* Update a company contact
|
|
3894
|
-
*
|
|
3895
|
-
*
|
|
3896
|
-
* @param client - Fetch client instance
|
|
3897
|
-
* @param id - id
|
|
3898
|
-
* @param body - body
|
|
3899
|
-
*/
|
|
3900
|
-
async function updateCompanyContact(client, id, body) {
|
|
3901
|
-
return client.patch(`/api/company/contacts/${id}`, body);
|
|
3902
|
-
}
|
|
3903
|
-
//#endregion
|
|
3904
|
-
//#region ../../contacts/ui/src/shared/utils/createContactApi.ts
|
|
3905
|
-
function createContactApi(config) {
|
|
3906
|
-
const { mode, client } = config;
|
|
3907
|
-
if (mode === "admin") return {
|
|
3908
|
-
getContact: (id) => getCompanyContact(client, id),
|
|
3909
|
-
createContact: (data) => createCompanyContact(client, { contact: data }),
|
|
3910
|
-
updateContact: (id, data) => updateCompanyContact(client, id, {
|
|
3911
|
-
id: Number(id),
|
|
3912
|
-
contact: data
|
|
3913
|
-
}),
|
|
3914
|
-
deleteContact: (id) => deleteCompanyContact(client, id)
|
|
3915
|
-
};
|
|
3916
|
-
return {
|
|
3917
|
-
getContact: (id) => getUserContact(client, id),
|
|
3918
|
-
createContact: (data) => createUserContact(client, { contact: data }),
|
|
3919
|
-
updateContact: (id, data) => updateUserContact(client, id, { contact: data }),
|
|
3920
|
-
deleteContact: (id) => deleteUserContact(client, id)
|
|
3921
|
-
};
|
|
3922
|
-
}
|
|
3923
|
-
//#endregion
|
|
3924
3674
|
//#region ../../contacts/ui/src/shared/hooks/useContactDetail.ts
|
|
3925
|
-
function useContactDetail(
|
|
3926
|
-
const
|
|
3675
|
+
function useContactDetail(contactId, queryKeyPrefix = "contacts") {
|
|
3676
|
+
const api = useContactsCrud();
|
|
3927
3677
|
return useQuery({
|
|
3928
3678
|
queryKey: CONTACTS_QUERY_KEYS.detail(queryKeyPrefix, contactId),
|
|
3929
|
-
queryFn: () => getContact(contactId),
|
|
3679
|
+
queryFn: () => api.getContact(contactId),
|
|
3930
3680
|
enabled: !!contactId
|
|
3931
3681
|
});
|
|
3932
3682
|
}
|
|
3933
3683
|
//#endregion
|
|
3934
3684
|
//#region ../../contacts/ui/src/shared/hooks/useUpdateContactMutation.ts
|
|
3935
|
-
function useUpdateContactMutation(
|
|
3685
|
+
function useUpdateContactMutation(contactId, queryKeyPrefix = "contacts", options) {
|
|
3936
3686
|
const queryClient = useQueryClient();
|
|
3937
|
-
const
|
|
3687
|
+
const api = useContactsCrud();
|
|
3938
3688
|
return useMutation({
|
|
3939
|
-
mutationFn: ({ id, data }) => updateContact(id, data),
|
|
3689
|
+
mutationFn: ({ id, data }) => api.updateContact(id, data),
|
|
3940
3690
|
onSuccess: () => {
|
|
3941
3691
|
fluidToast({
|
|
3942
3692
|
title: "Contact updated successfully",
|
|
@@ -3957,11 +3707,11 @@ function useUpdateContactMutation(config, contactId, queryKeyPrefix = "contacts"
|
|
|
3957
3707
|
}
|
|
3958
3708
|
//#endregion
|
|
3959
3709
|
//#region ../../contacts/ui/src/shared/hooks/useDeleteContactMutation.ts
|
|
3960
|
-
function useDeleteContactMutation(
|
|
3710
|
+
function useDeleteContactMutation(queryKeyPrefix = "contacts", options) {
|
|
3961
3711
|
const queryClient = useQueryClient();
|
|
3962
|
-
const
|
|
3712
|
+
const api = useContactsCrud();
|
|
3963
3713
|
return useMutation({
|
|
3964
|
-
mutationFn: (contactId) => deleteContact(contactId),
|
|
3714
|
+
mutationFn: (contactId) => api.deleteContact(contactId),
|
|
3965
3715
|
onSuccess: () => {
|
|
3966
3716
|
fluidToast({
|
|
3967
3717
|
title: "Contact deleted successfully",
|
|
@@ -4016,9 +3766,9 @@ const editContactFormSchema = createContactFormSchema.passthrough();
|
|
|
4016
3766
|
//#endregion
|
|
4017
3767
|
//#region ../../contacts/ui/src/shared/hooks/useContactDetailPage.ts
|
|
4018
3768
|
const mutableKeys = Object.keys(createContactFormSchema.shape);
|
|
4019
|
-
function useContactDetailPage(
|
|
3769
|
+
function useContactDetailPage(contactId, options) {
|
|
4020
3770
|
const queryKeyPrefix = options?.queryKeyPrefix ?? "contacts";
|
|
4021
|
-
const { data, isLoading } = useContactDetail(
|
|
3771
|
+
const { data, isLoading } = useContactDetail(contactId, queryKeyPrefix);
|
|
4022
3772
|
const { data: countries } = useQuery({
|
|
4023
3773
|
queryKey: ["countries"],
|
|
4024
3774
|
queryFn: options?.getCountries ?? (() => Promise.resolve([])),
|
|
@@ -4039,10 +3789,10 @@ function useContactDetailPage(config, contactId, options) {
|
|
|
4039
3789
|
}, [contact]),
|
|
4040
3790
|
mode: "onBlur"
|
|
4041
3791
|
});
|
|
4042
|
-
const updateMutation = useUpdateContactMutation(
|
|
3792
|
+
const updateMutation = useUpdateContactMutation(contactId, queryKeyPrefix, { onSuccess: () => {
|
|
4043
3793
|
methods.reset(methods.getValues());
|
|
4044
3794
|
} });
|
|
4045
|
-
const deleteMutation = useDeleteContactMutation(
|
|
3795
|
+
const deleteMutation = useDeleteContactMutation(queryKeyPrefix, { onSuccess: () => {
|
|
4046
3796
|
options?.onDeleteSuccess?.();
|
|
4047
3797
|
} });
|
|
4048
3798
|
const onSave = useCallback(() => {
|
|
@@ -4093,11 +3843,11 @@ function useContactDetailPage(config, contactId, options) {
|
|
|
4093
3843
|
}
|
|
4094
3844
|
//#endregion
|
|
4095
3845
|
//#region ../../contacts/ui/src/shared/hooks/useCreateContactMutation.ts
|
|
4096
|
-
function useCreateContactMutation(
|
|
3846
|
+
function useCreateContactMutation(queryKeyPrefix = "contacts", options) {
|
|
4097
3847
|
const queryClient = useQueryClient();
|
|
4098
|
-
const
|
|
3848
|
+
const api = useContactsCrud();
|
|
4099
3849
|
return useMutation({
|
|
4100
|
-
mutationFn: (data) => createContact(data),
|
|
3850
|
+
mutationFn: (data) => api.createContact(data),
|
|
4101
3851
|
onSuccess: (data) => {
|
|
4102
3852
|
fluidToast({
|
|
4103
3853
|
title: "Contact created successfully",
|
|
@@ -4141,6 +3891,253 @@ function useContactsConfig() {
|
|
|
4141
3891
|
]) };
|
|
4142
3892
|
}
|
|
4143
3893
|
//#endregion
|
|
3894
|
+
//#region ../../contacts/fluid-user-contacts-api-client/src/namespaces/users_contacts.ts
|
|
3895
|
+
/**
|
|
3896
|
+
* List activities for a contact
|
|
3897
|
+
*
|
|
3898
|
+
*
|
|
3899
|
+
* @param client - Fetch client instance
|
|
3900
|
+
* @param id - id
|
|
3901
|
+
* @param params? - params?
|
|
3902
|
+
*/
|
|
3903
|
+
async function listUserContactActivities(client, id, params) {
|
|
3904
|
+
return client.get(`/api/users/v2025-06/contacts/${id}/activities`, params);
|
|
3905
|
+
}
|
|
3906
|
+
/**
|
|
3907
|
+
* Bulk delete contacts
|
|
3908
|
+
*
|
|
3909
|
+
*
|
|
3910
|
+
* @param client - Fetch client instance
|
|
3911
|
+
* @param body - body
|
|
3912
|
+
*/
|
|
3913
|
+
async function bulkDeleteUserContacts(client, body) {
|
|
3914
|
+
return client.delete(`/api/users/v2025-06/contacts/bulk_delete`, { body });
|
|
3915
|
+
}
|
|
3916
|
+
/**
|
|
3917
|
+
* Create a contact
|
|
3918
|
+
*
|
|
3919
|
+
*
|
|
3920
|
+
* @param client - Fetch client instance
|
|
3921
|
+
* @param body - body
|
|
3922
|
+
*/
|
|
3923
|
+
async function createUserContact(client, body) {
|
|
3924
|
+
return client.post(`/api/users/v2025-06/contacts`, body);
|
|
3925
|
+
}
|
|
3926
|
+
/**
|
|
3927
|
+
* List user's contacts
|
|
3928
|
+
*
|
|
3929
|
+
*
|
|
3930
|
+
* @param client - Fetch client instance
|
|
3931
|
+
* @param params? - params?
|
|
3932
|
+
*/
|
|
3933
|
+
async function listUserContacts(client, params) {
|
|
3934
|
+
return client.get(`/api/users/v2025-06/contacts`, params);
|
|
3935
|
+
}
|
|
3936
|
+
/**
|
|
3937
|
+
* Delete a contact
|
|
3938
|
+
*
|
|
3939
|
+
*
|
|
3940
|
+
* @param client - Fetch client instance
|
|
3941
|
+
* @param id - id
|
|
3942
|
+
*/
|
|
3943
|
+
async function deleteUserContact(client, id) {
|
|
3944
|
+
return client.delete(`/api/users/v2025-06/contacts/${id}`);
|
|
3945
|
+
}
|
|
3946
|
+
/**
|
|
3947
|
+
* Get a contact
|
|
3948
|
+
*
|
|
3949
|
+
*
|
|
3950
|
+
* @param client - Fetch client instance
|
|
3951
|
+
* @param id - id
|
|
3952
|
+
*/
|
|
3953
|
+
async function getUserContact(client, id) {
|
|
3954
|
+
return client.get(`/api/users/v2025-06/contacts/${id}`);
|
|
3955
|
+
}
|
|
3956
|
+
/**
|
|
3957
|
+
* Update a contact
|
|
3958
|
+
*
|
|
3959
|
+
*
|
|
3960
|
+
* @param client - Fetch client instance
|
|
3961
|
+
* @param id - id
|
|
3962
|
+
* @param body - body
|
|
3963
|
+
*/
|
|
3964
|
+
async function updateUserContact(client, id, body) {
|
|
3965
|
+
return client.patch(`/api/users/v2025-06/contacts/${id}`, body);
|
|
3966
|
+
}
|
|
3967
|
+
/**
|
|
3968
|
+
* Create a note for a contact (deprecated)
|
|
3969
|
+
*
|
|
3970
|
+
*
|
|
3971
|
+
* @param client - Fetch client instance
|
|
3972
|
+
* @param id - id
|
|
3973
|
+
* @param body - body
|
|
3974
|
+
*/
|
|
3975
|
+
async function createUserContactNote(client, id, body) {
|
|
3976
|
+
return client.post(`/api/users/v2025-06/contacts/${id}/notes`, body);
|
|
3977
|
+
}
|
|
3978
|
+
/**
|
|
3979
|
+
* List notes for a contact
|
|
3980
|
+
*
|
|
3981
|
+
*
|
|
3982
|
+
* @param client - Fetch client instance
|
|
3983
|
+
* @param id - id
|
|
3984
|
+
*/
|
|
3985
|
+
async function listUserContactNotes(client, id) {
|
|
3986
|
+
return client.get(`/api/users/v2025-06/contacts/${id}/notes`);
|
|
3987
|
+
}
|
|
3988
|
+
/**
|
|
3989
|
+
* List orders for a contact
|
|
3990
|
+
*
|
|
3991
|
+
*
|
|
3992
|
+
* @param client - Fetch client instance
|
|
3993
|
+
* @param id - id
|
|
3994
|
+
* @param params? - params?
|
|
3995
|
+
*/
|
|
3996
|
+
async function listUserContactOrders(client, id, params) {
|
|
3997
|
+
return client.get(`/api/users/v2025-06/contacts/${id}/orders`, params);
|
|
3998
|
+
}
|
|
3999
|
+
/**
|
|
4000
|
+
* Mark contact's activities as read
|
|
4001
|
+
*
|
|
4002
|
+
*
|
|
4003
|
+
* @param client - Fetch client instance
|
|
4004
|
+
* @param id - id
|
|
4005
|
+
*/
|
|
4006
|
+
async function markUserContactRead(client, id) {
|
|
4007
|
+
return client.post(`/api/users/v2025-06/contacts/${id}/read`);
|
|
4008
|
+
}
|
|
4009
|
+
/**
|
|
4010
|
+
* List subscription orders for a contact
|
|
4011
|
+
*
|
|
4012
|
+
*
|
|
4013
|
+
* @param client - Fetch client instance
|
|
4014
|
+
* @param id - id
|
|
4015
|
+
* @param params? - params?
|
|
4016
|
+
*/
|
|
4017
|
+
async function listUserContactSubscriptionOrders(client, id, params) {
|
|
4018
|
+
return client.get(`/api/users/v2025-06/contacts/${id}/subscription_orders`, params);
|
|
4019
|
+
}
|
|
4020
|
+
/**
|
|
4021
|
+
* Create a task for a contact
|
|
4022
|
+
*
|
|
4023
|
+
*
|
|
4024
|
+
* @param client - Fetch client instance
|
|
4025
|
+
* @param id - id
|
|
4026
|
+
* @param body - body
|
|
4027
|
+
*/
|
|
4028
|
+
async function createUserContactTask(client, id, body) {
|
|
4029
|
+
return client.post(`/api/users/v2025-06/contacts/${id}/tasks`, body);
|
|
4030
|
+
}
|
|
4031
|
+
/**
|
|
4032
|
+
* List tasks for a contact
|
|
4033
|
+
*
|
|
4034
|
+
*
|
|
4035
|
+
* @param client - Fetch client instance
|
|
4036
|
+
* @param id - id
|
|
4037
|
+
*/
|
|
4038
|
+
async function listUserContactTasks(client, id) {
|
|
4039
|
+
return client.get(`/api/users/v2025-06/contacts/${id}/tasks`);
|
|
4040
|
+
}
|
|
4041
|
+
//#endregion
|
|
4042
|
+
//#region ../../notes/fluid-user-notes-api-client/src/namespaces/users_notes.ts
|
|
4043
|
+
/**
|
|
4044
|
+
* Delete a note
|
|
4045
|
+
*
|
|
4046
|
+
*
|
|
4047
|
+
* @param client - Fetch client instance
|
|
4048
|
+
* @param id - id
|
|
4049
|
+
* @param params - params
|
|
4050
|
+
*/
|
|
4051
|
+
async function deleteUserNote(client, id, params) {
|
|
4052
|
+
return client.delete(`/api/users/v2025-06/notes/${id}`, { params });
|
|
4053
|
+
}
|
|
4054
|
+
/**
|
|
4055
|
+
* Update a note
|
|
4056
|
+
*
|
|
4057
|
+
*
|
|
4058
|
+
* @param client - Fetch client instance
|
|
4059
|
+
* @param id - id
|
|
4060
|
+
* @param body - body
|
|
4061
|
+
*/
|
|
4062
|
+
async function updateUserNote(client, id, body) {
|
|
4063
|
+
return client.patch(`/api/users/v2025-06/notes/${id}`, body);
|
|
4064
|
+
}
|
|
4065
|
+
//#endregion
|
|
4066
|
+
//#region ../../tasks/fluid-user-tasks-api-client/src/namespaces/users_tasks.ts
|
|
4067
|
+
/**
|
|
4068
|
+
* Delete a task
|
|
4069
|
+
*
|
|
4070
|
+
*
|
|
4071
|
+
* @param client - Fetch client instance
|
|
4072
|
+
* @param id - id
|
|
4073
|
+
*/
|
|
4074
|
+
async function deleteUserTask(client, id) {
|
|
4075
|
+
return client.delete(`/api/users/v2025-06/tasks/${id}`);
|
|
4076
|
+
}
|
|
4077
|
+
/**
|
|
4078
|
+
* Update a task
|
|
4079
|
+
*
|
|
4080
|
+
*
|
|
4081
|
+
* @param client - Fetch client instance
|
|
4082
|
+
* @param id - id
|
|
4083
|
+
* @param body - body
|
|
4084
|
+
*/
|
|
4085
|
+
async function updateUserTask(client, id, body) {
|
|
4086
|
+
return client.patch(`/api/users/v2025-06/tasks/${id}`, body);
|
|
4087
|
+
}
|
|
4088
|
+
//#endregion
|
|
4089
|
+
//#region src/contacts/PortalContactsApiProvider.tsx
|
|
4090
|
+
function PortalContactsApiProvider({ children }) {
|
|
4091
|
+
const { client } = useContactsConfig();
|
|
4092
|
+
return /* @__PURE__ */ jsx(ContactsApiProvider, {
|
|
4093
|
+
value: useMemo(() => {
|
|
4094
|
+
return {
|
|
4095
|
+
contacts: {
|
|
4096
|
+
getContact: (id) => getUserContact(client, id),
|
|
4097
|
+
listContacts: (params) => listUserContacts(client, params),
|
|
4098
|
+
createContact: (data) => createUserContact(client, { contact: data }),
|
|
4099
|
+
updateContact: (id, data) => updateUserContact(client, id, {
|
|
4100
|
+
id: Number(id),
|
|
4101
|
+
contact: data
|
|
4102
|
+
}),
|
|
4103
|
+
deleteContact: (id) => deleteUserContact(client, id),
|
|
4104
|
+
bulkDeleteContacts: (ids) => bulkDeleteUserContacts(client, { contact_ids: ids }),
|
|
4105
|
+
listActivities: (contactId) => listUserContactActivities(client, contactId),
|
|
4106
|
+
markRead: (contactId) => markUserContactRead(client, contactId),
|
|
4107
|
+
listOrders: (contactId, params) => listUserContactOrders(client, contactId, params),
|
|
4108
|
+
listSubscriptionOrders: (contactId, params) => listUserContactSubscriptionOrders(client, contactId, params)
|
|
4109
|
+
},
|
|
4110
|
+
notes: {
|
|
4111
|
+
listNotes: (contactId) => listUserContactNotes(client, contactId),
|
|
4112
|
+
createNote: (contactId, input) => createUserContactNote(client, contactId, {
|
|
4113
|
+
id: Number(contactId),
|
|
4114
|
+
note: input
|
|
4115
|
+
}),
|
|
4116
|
+
updateNote: (noteId, contactId, input) => updateUserNote(client, noteId, {
|
|
4117
|
+
contact_id: Number(contactId),
|
|
4118
|
+
id: noteId,
|
|
4119
|
+
note: input
|
|
4120
|
+
}),
|
|
4121
|
+
deleteNote: (noteId, contactId) => deleteUserNote(client, noteId, { contact_id: Number(contactId) })
|
|
4122
|
+
},
|
|
4123
|
+
tasks: {
|
|
4124
|
+
listTasks: (contactId) => listUserContactTasks(client, contactId),
|
|
4125
|
+
createTask: (contactId, input) => createUserContactTask(client, contactId, {
|
|
4126
|
+
id: Number(contactId),
|
|
4127
|
+
task: input
|
|
4128
|
+
}),
|
|
4129
|
+
updateTask: (taskId, input) => updateUserTask(client, taskId, {
|
|
4130
|
+
id: taskId,
|
|
4131
|
+
task: input
|
|
4132
|
+
}),
|
|
4133
|
+
deleteTask: (taskId) => deleteUserTask(client, taskId)
|
|
4134
|
+
}
|
|
4135
|
+
};
|
|
4136
|
+
}, [client]),
|
|
4137
|
+
children
|
|
4138
|
+
});
|
|
4139
|
+
}
|
|
4140
|
+
//#endregion
|
|
4144
4141
|
//#region src/screens/ContactsScreen.tsx
|
|
4145
4142
|
var ContactsScreen_exports = /* @__PURE__ */ __exportAll({
|
|
4146
4143
|
ContactsScreen: () => ContactsScreen,
|
|
@@ -4150,7 +4147,8 @@ const QUERY_KEY_PREFIX = "sdk-contacts";
|
|
|
4150
4147
|
function fetchCountries(client) {
|
|
4151
4148
|
return client.get("/api/countries");
|
|
4152
4149
|
}
|
|
4153
|
-
function ContactListView({
|
|
4150
|
+
function ContactListView({ onNavigate, onContactSelect }) {
|
|
4151
|
+
const api = useContactsCrud();
|
|
4154
4152
|
const handleSelectContact = useCallback((contact) => {
|
|
4155
4153
|
onContactSelect?.(String(contact.id));
|
|
4156
4154
|
onNavigate({
|
|
@@ -4159,8 +4157,8 @@ function ContactListView({ client, onNavigate, onContactSelect }) {
|
|
|
4159
4157
|
});
|
|
4160
4158
|
}, [onNavigate, onContactSelect]);
|
|
4161
4159
|
return /* @__PURE__ */ jsx(ContactsListScreen, {
|
|
4162
|
-
listContacts: useCallback((params) =>
|
|
4163
|
-
deleteContacts: useCallback((ids) =>
|
|
4160
|
+
listContacts: useCallback((params) => api.listContacts(params), [api]),
|
|
4161
|
+
deleteContacts: useCallback((ids) => api.bulkDeleteContacts(ids), [api]),
|
|
4164
4162
|
queryKeyPrefix: QUERY_KEY_PREFIX,
|
|
4165
4163
|
tableLayout: "members",
|
|
4166
4164
|
onEditContact: handleSelectContact,
|
|
@@ -4170,11 +4168,9 @@ function ContactListView({ client, onNavigate, onContactSelect }) {
|
|
|
4170
4168
|
}, [onNavigate])
|
|
4171
4169
|
});
|
|
4172
4170
|
}
|
|
4173
|
-
function ContactDetailView({ contactId,
|
|
4174
|
-
const {
|
|
4175
|
-
|
|
4176
|
-
client
|
|
4177
|
-
}), [client]), contactId, {
|
|
4171
|
+
function ContactDetailView({ contactId, onNavigate }) {
|
|
4172
|
+
const { client } = useContactsConfig();
|
|
4173
|
+
const { contact, isLoading, methods, countryOptions, isDirty, isSubmitting, isDeleting, onSave, onDelete } = useContactDetailPage(contactId, {
|
|
4178
4174
|
queryKeyPrefix: QUERY_KEY_PREFIX,
|
|
4179
4175
|
getCountries: useCallback(() => fetchCountries(client), [client]),
|
|
4180
4176
|
onDeleteSuccess: () => onNavigate({ view: "list" })
|
|
@@ -4226,18 +4222,9 @@ function ContactDetailView({ contactId, client, onNavigate }) {
|
|
|
4226
4222
|
children: /* @__PURE__ */ jsx(RepContactDetailView, {
|
|
4227
4223
|
contact,
|
|
4228
4224
|
contactId,
|
|
4229
|
-
client,
|
|
4230
|
-
notesClient: client,
|
|
4231
|
-
tasksClient: client,
|
|
4232
4225
|
countryOptions,
|
|
4233
|
-
ordersSlot: /* @__PURE__ */ jsx(ContactOrdersList, {
|
|
4234
|
-
|
|
4235
|
-
contactId
|
|
4236
|
-
}),
|
|
4237
|
-
subscriptionsSlot: /* @__PURE__ */ jsx(ContactSubscriptionOrdersList, {
|
|
4238
|
-
client,
|
|
4239
|
-
contactId
|
|
4240
|
-
})
|
|
4226
|
+
ordersSlot: /* @__PURE__ */ jsx(ContactOrdersList, { contactId }),
|
|
4227
|
+
subscriptionsSlot: /* @__PURE__ */ jsx(ContactSubscriptionOrdersList, { contactId })
|
|
4241
4228
|
})
|
|
4242
4229
|
})
|
|
4243
4230
|
});
|
|
@@ -4257,12 +4244,9 @@ const CREATE_DEFAULT_VALUES = {
|
|
|
4257
4244
|
metadata: {},
|
|
4258
4245
|
affiliate: {}
|
|
4259
4246
|
};
|
|
4260
|
-
function ContactCreateView({
|
|
4247
|
+
function ContactCreateView({ onNavigate, onCreateContact }) {
|
|
4261
4248
|
const formRef = useRef(null);
|
|
4262
|
-
const
|
|
4263
|
-
mode: "rep",
|
|
4264
|
-
client
|
|
4265
|
-
}), [client]);
|
|
4249
|
+
const { client } = useContactsConfig();
|
|
4266
4250
|
const { data: countries } = useQuery({
|
|
4267
4251
|
queryKey: ["countries"],
|
|
4268
4252
|
queryFn: () => fetchCountries(client)
|
|
@@ -4272,7 +4256,7 @@ function ContactCreateView({ client, onNavigate, onCreateContact }) {
|
|
|
4272
4256
|
value: c.iso ?? String(c.id)
|
|
4273
4257
|
})).sort((a, b) => a.name.localeCompare(b.name)), [countries]);
|
|
4274
4258
|
const methods = useZodForm(createContactFormSchema, { defaultValues: CREATE_DEFAULT_VALUES });
|
|
4275
|
-
const mutation = useCreateContactMutation(
|
|
4259
|
+
const mutation = useCreateContactMutation(QUERY_KEY_PREFIX, { onSuccess: (data) => {
|
|
4276
4260
|
onCreateContact?.();
|
|
4277
4261
|
const newContactId = data?.contact?.id;
|
|
4278
4262
|
if (newContactId) onNavigate({
|
|
@@ -4315,29 +4299,25 @@ function ContactCreateView({ client, onNavigate, onCreateContact }) {
|
|
|
4315
4299
|
});
|
|
4316
4300
|
}
|
|
4317
4301
|
function ContactsScreen({ onContactSelect, onCreateContact, background, textColor, accentColor, padding, borderRadius, defaultViewMode, ...divProps }) {
|
|
4318
|
-
const { client } = useContactsConfig();
|
|
4319
4302
|
const [nav, setNav] = useState({ view: "list" });
|
|
4320
|
-
return /* @__PURE__ */ jsxs("div", {
|
|
4303
|
+
return /* @__PURE__ */ jsx(PortalContactsApiProvider, { children: /* @__PURE__ */ jsxs("div", {
|
|
4321
4304
|
...divProps,
|
|
4322
4305
|
className: `h-full ${divProps.className ?? ""}`,
|
|
4323
4306
|
children: [
|
|
4324
4307
|
nav.view === "list" && /* @__PURE__ */ jsx(ContactListView, {
|
|
4325
|
-
client,
|
|
4326
4308
|
onNavigate: setNav,
|
|
4327
4309
|
onContactSelect
|
|
4328
4310
|
}),
|
|
4329
4311
|
nav.view === "detail" && /* @__PURE__ */ jsx(ContactDetailView, {
|
|
4330
4312
|
contactId: nav.contactId,
|
|
4331
|
-
client,
|
|
4332
4313
|
onNavigate: setNav
|
|
4333
4314
|
}),
|
|
4334
4315
|
nav.view === "new" && /* @__PURE__ */ jsx(ContactCreateView, {
|
|
4335
|
-
client,
|
|
4336
4316
|
onNavigate: setNav,
|
|
4337
4317
|
onCreateContact
|
|
4338
4318
|
})
|
|
4339
4319
|
]
|
|
4340
|
-
});
|
|
4320
|
+
}) });
|
|
4341
4321
|
}
|
|
4342
4322
|
const contactsScreenPropertySchema = {
|
|
4343
4323
|
widgetType: "ContactsScreen",
|
|
@@ -4351,4 +4331,4 @@ const contactsScreenPropertySchema = {
|
|
|
4351
4331
|
//#endregion
|
|
4352
4332
|
export { ContactsScreen_exports as n, contactsScreenPropertySchema as r, ContactsScreen as t };
|
|
4353
4333
|
|
|
4354
|
-
//# sourceMappingURL=ContactsScreen-
|
|
4334
|
+
//# sourceMappingURL=ContactsScreen-CjpjEyvy.mjs.map
|