@fluid-app/portal-sdk 0.1.123 → 0.1.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.
- package/dist/{ContactsScreen-DlogYCS0.cjs → ContactsScreen-CRROZFdR.cjs} +1 -1
- package/dist/{ContactsScreen-jG9eiK_i.mjs → ContactsScreen-CjFnJkt7.mjs} +44 -39
- package/dist/{ContactsScreen-jG9eiK_i.mjs.map → ContactsScreen-CjFnJkt7.mjs.map} +1 -1
- package/dist/{ContactsScreen-DKo-lq8T.cjs → ContactsScreen-V9dHSQNX.cjs} +54 -49
- package/dist/ContactsScreen-V9dHSQNX.cjs.map +1 -0
- package/dist/{ProfileScreen-BlZ2-IPe.mjs → ProfileScreen-BKRn8AqI.mjs} +66 -13
- package/dist/ProfileScreen-BKRn8AqI.mjs.map +1 -0
- package/dist/{ProfileScreen-Doas44hA.cjs → ProfileScreen-CZp_NrjO.cjs} +1 -1
- package/dist/{ProfileScreen-BgU7ZIvV.cjs → ProfileScreen-FYGHStqM.cjs} +66 -13
- package/dist/{ProfileScreen-BgU7ZIvV.cjs.map → ProfileScreen-FYGHStqM.cjs.map} +1 -1
- package/dist/index.cjs +6 -6
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +6 -6
- package/dist/{parse-api-errors-Dy2gL1eC.mjs → portal-tenant-countries-adapter-BJb82oyY.cjs} +97 -2
- package/dist/portal-tenant-countries-adapter-BJb82oyY.cjs.map +1 -0
- package/dist/{parse-api-errors-CAnpE2_r.cjs → portal-tenant-countries-adapter-C3HVoAls.mjs} +80 -7
- package/dist/portal-tenant-countries-adapter-C3HVoAls.mjs.map +1 -0
- package/package.json +16 -15
- package/dist/ContactsScreen-DKo-lq8T.cjs.map +0 -1
- package/dist/ProfileScreen-BlZ2-IPe.mjs.map +0 -1
- package/dist/parse-api-errors-CAnpE2_r.cjs.map +0 -1
- package/dist/parse-api-errors-Dy2gL1eC.mjs.map +0 -1
|
@@ -35,7 +35,7 @@ require("./ToDoWidget-eGB9cfou.cjs");
|
|
|
35
35
|
require("./VideoWidget-bfOCjnnn.cjs");
|
|
36
36
|
require("./ScreenHeaderContext-wrJlkhgN.cjs");
|
|
37
37
|
require("./dist-thaj08s5.cjs");
|
|
38
|
-
const require_ContactsScreen = require("./ContactsScreen-
|
|
38
|
+
const require_ContactsScreen = require("./ContactsScreen-V9dHSQNX.cjs");
|
|
39
39
|
require("./order-detail-DHXdE4Cl.cjs");
|
|
40
40
|
require("./src-DMVR26Fk.cjs");
|
|
41
41
|
require("./dist-CCDAKHvf.cjs");
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { n as __exportAll } from "./chunk-ByhMGyNw.mjs";
|
|
2
|
-
import { ct as createFetchClient, n as useFluidContext } from "./FluidProvider-CgTeGUnF.mjs";
|
|
3
|
-
import {
|
|
2
|
+
import { ct as createFetchClient, n as useFluidContext, u as usePortalTenantClient } from "./FluidProvider-CgTeGUnF.mjs";
|
|
3
|
+
import { r as parseApiErrors, t as createPortalTenantCountriesAdapter } from "./portal-tenant-countries-adapter-C3HVoAls.mjs";
|
|
4
4
|
import { $t as AvatarImage, A as SelectContent, C as SheetContent, Ct as CardHeader, E as SheetTitle, G as DropdownMenuContent, Gt as BreadcrumbItem, J as DropdownMenuSeparator, Jt as BreadcrumbPage, K as DropdownMenuItem, Kt as BreadcrumbLink, M as SelectTrigger, N as SelectValue, P as Input, Q as DropdownMenuTrigger, Qt as AvatarFallback, S as Sheet, T as SheetHeader, U as Label, W as DropdownMenu, Wt as Breadcrumb, Xt as Badge, Yt as BreadcrumbSeparator, Zt as Avatar, _n as cn, an as AlertDialogFooter, c as TabsList, cn as AlertDialogTitle, d as TableBody, en as AlertDialog, f as TableCell, gn as useZodForm, h as TableRow, i as TooltipTrigger, in as AlertDialogDescription, j as SelectItem, k as Select, l as TabsTrigger, ln as Button, m as TableHeader, n as TooltipContent, nn as AlertDialogCancel, o as Tabs, on as AlertDialogHeader, p as TableHead, q as DropdownMenuLabel, qt as BreadcrumbList, r as TooltipProvider, rn as AlertDialogContent, s as TabsContent, t as Tooltip, tn as AlertDialogAction, u as Table$1, w as SheetFooter, wt as CardTitle, x as Skeleton, xt as CardContent, y as fluidToast, yt as Card } from "./src-N020oyu4.mjs";
|
|
5
5
|
import { n as useScreenHeaderActions, r as useScreenHeaderBreadcrumbs } from "./ScreenHeaderContext-NdrJ58Mg.mjs";
|
|
6
6
|
import { a as useEditor, n as Heading, o as Placeholder, r as EditorContent, t as StarterKit } from "./dist-CkIGP8my.mjs";
|
|
@@ -3867,30 +3867,6 @@ function useCreateContactMutation(queryKeyPrefix = "contacts", options) {
|
|
|
3867
3867
|
});
|
|
3868
3868
|
}
|
|
3869
3869
|
//#endregion
|
|
3870
|
-
//#region src/contacts/use-contacts-config.ts
|
|
3871
|
-
/**
|
|
3872
|
-
* Hook that derives a FetchClient from the portal SDK's FluidProvider context.
|
|
3873
|
-
*
|
|
3874
|
-
* Maps FluidSDKConfig fields to a FetchClient suitable for contacts, notes, and tasks APIs.
|
|
3875
|
-
* Follows the same pattern as useMessagingConfig.
|
|
3876
|
-
*/
|
|
3877
|
-
function useContactsConfig() {
|
|
3878
|
-
const { config } = useFluidContext();
|
|
3879
|
-
return { client: useMemo(() => {
|
|
3880
|
-
return createFetchClient({
|
|
3881
|
-
baseUrl: config.baseUrl.replace(/\/+$/, "").replace(/\/api$/, ""),
|
|
3882
|
-
getAuthToken: config.getAuthToken,
|
|
3883
|
-
onAuthError: config.onAuthError,
|
|
3884
|
-
defaultHeaders: config.defaultHeaders
|
|
3885
|
-
});
|
|
3886
|
-
}, [
|
|
3887
|
-
config.baseUrl,
|
|
3888
|
-
config.getAuthToken,
|
|
3889
|
-
config.onAuthError,
|
|
3890
|
-
config.defaultHeaders
|
|
3891
|
-
]) };
|
|
3892
|
-
}
|
|
3893
|
-
//#endregion
|
|
3894
3870
|
//#region ../../contacts/fluid-user-contacts-api-client/src/namespaces/users_contacts.ts
|
|
3895
3871
|
/**
|
|
3896
3872
|
* List activities for a contact
|
|
@@ -4201,6 +4177,30 @@ function createContactsDomainApiAdapter(client) {
|
|
|
4201
4177
|
};
|
|
4202
4178
|
}
|
|
4203
4179
|
//#endregion
|
|
4180
|
+
//#region src/contacts/use-contacts-config.ts
|
|
4181
|
+
/**
|
|
4182
|
+
* Hook that derives a FetchClient from the portal SDK's FluidProvider context.
|
|
4183
|
+
*
|
|
4184
|
+
* Maps FluidSDKConfig fields to a FetchClient suitable for contacts, notes, and tasks APIs.
|
|
4185
|
+
* Follows the same pattern as useMessagingConfig.
|
|
4186
|
+
*/
|
|
4187
|
+
function useContactsConfig() {
|
|
4188
|
+
const { config } = useFluidContext();
|
|
4189
|
+
return { client: useMemo(() => {
|
|
4190
|
+
return createFetchClient({
|
|
4191
|
+
baseUrl: config.baseUrl.replace(/\/+$/, "").replace(/\/api$/, ""),
|
|
4192
|
+
getAuthToken: config.getAuthToken,
|
|
4193
|
+
onAuthError: config.onAuthError,
|
|
4194
|
+
defaultHeaders: config.defaultHeaders
|
|
4195
|
+
});
|
|
4196
|
+
}, [
|
|
4197
|
+
config.baseUrl,
|
|
4198
|
+
config.getAuthToken,
|
|
4199
|
+
config.onAuthError,
|
|
4200
|
+
config.defaultHeaders
|
|
4201
|
+
]) };
|
|
4202
|
+
}
|
|
4203
|
+
//#endregion
|
|
4204
4204
|
//#region src/contacts/PortalContactsApiProvider.tsx
|
|
4205
4205
|
function PortalContactsApiProvider({ children }) {
|
|
4206
4206
|
const { client } = useContactsConfig();
|
|
@@ -4216,9 +4216,6 @@ var ContactsScreen_exports = /* @__PURE__ */ __exportAll({
|
|
|
4216
4216
|
contactsScreenPropertySchema: () => contactsScreenPropertySchema
|
|
4217
4217
|
});
|
|
4218
4218
|
const QUERY_KEY_PREFIX = "sdk-contacts";
|
|
4219
|
-
function fetchCountries(client) {
|
|
4220
|
-
return client.get("/api/countries");
|
|
4221
|
-
}
|
|
4222
4219
|
function ContactListView({ onNavigate, onContactSelect }) {
|
|
4223
4220
|
const api = useContactsCrud();
|
|
4224
4221
|
const handleSelectContact = useCallback((contact) => {
|
|
@@ -4241,10 +4238,17 @@ function ContactListView({ onNavigate, onContactSelect }) {
|
|
|
4241
4238
|
});
|
|
4242
4239
|
}
|
|
4243
4240
|
function ContactDetailView({ contactId, onNavigate }) {
|
|
4244
|
-
const
|
|
4241
|
+
const portalTenantClient = usePortalTenantClient();
|
|
4242
|
+
const countriesAdapter = useMemo(() => createPortalTenantCountriesAdapter(portalTenantClient), [portalTenantClient]);
|
|
4245
4243
|
const { contact, isLoading, methods, countryOptions, isDirty, isSubmitting, isDeleting, onSave, onDelete } = useContactDetailPage(contactId, {
|
|
4246
4244
|
queryKeyPrefix: QUERY_KEY_PREFIX,
|
|
4247
|
-
getCountries: useCallback(() =>
|
|
4245
|
+
getCountries: useCallback(async () => {
|
|
4246
|
+
return (await countriesAdapter.listCountries()).countries.map((c) => ({
|
|
4247
|
+
id: 0,
|
|
4248
|
+
name: c.name,
|
|
4249
|
+
iso: c.code
|
|
4250
|
+
}));
|
|
4251
|
+
}, [countriesAdapter]),
|
|
4248
4252
|
onDeleteSuccess: () => onNavigate({ view: "list" })
|
|
4249
4253
|
});
|
|
4250
4254
|
const handleNavigateToList = useCallback(() => {
|
|
@@ -4318,15 +4322,16 @@ const CREATE_DEFAULT_VALUES = {
|
|
|
4318
4322
|
};
|
|
4319
4323
|
function ContactCreateView({ onNavigate, onCreateContact }) {
|
|
4320
4324
|
const formRef = useRef(null);
|
|
4321
|
-
const
|
|
4322
|
-
const
|
|
4323
|
-
|
|
4324
|
-
|
|
4325
|
+
const portalTenantClient = usePortalTenantClient();
|
|
4326
|
+
const countriesAdapter = useMemo(() => createPortalTenantCountriesAdapter(portalTenantClient), [portalTenantClient]);
|
|
4327
|
+
const { data: countriesResponse } = useQuery({
|
|
4328
|
+
queryKey: ["bff-store-countries"],
|
|
4329
|
+
queryFn: () => countriesAdapter.listCountries()
|
|
4325
4330
|
});
|
|
4326
|
-
const countryOptions = useMemo(() => (countries ?? []).map((c) => ({
|
|
4331
|
+
const countryOptions = useMemo(() => (countriesResponse?.countries ?? []).map((c) => ({
|
|
4327
4332
|
name: c.name,
|
|
4328
|
-
value: c.
|
|
4329
|
-
})).sort((a, b) => a.name.localeCompare(b.name)), [
|
|
4333
|
+
value: c.code
|
|
4334
|
+
})).sort((a, b) => a.name.localeCompare(b.name)), [countriesResponse]);
|
|
4330
4335
|
const methods = useZodForm(createContactFormSchema, { defaultValues: CREATE_DEFAULT_VALUES });
|
|
4331
4336
|
const mutation = useCreateContactMutation(QUERY_KEY_PREFIX, { onSuccess: (data) => {
|
|
4332
4337
|
onCreateContact?.();
|
|
@@ -4403,4 +4408,4 @@ const contactsScreenPropertySchema = {
|
|
|
4403
4408
|
//#endregion
|
|
4404
4409
|
export { ContactsScreen_exports as n, contactsScreenPropertySchema as r, ContactsScreen as t };
|
|
4405
4410
|
|
|
4406
|
-
//# sourceMappingURL=ContactsScreen-
|
|
4411
|
+
//# sourceMappingURL=ContactsScreen-CjFnJkt7.mjs.map
|