@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
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
require("./chunk-9hOWP6kD.cjs");
|
|
2
2
|
const require_FluidProvider = require("./FluidProvider-BMMu_rp3.cjs");
|
|
3
|
-
const
|
|
3
|
+
const require_portal_tenant_countries_adapter = require("./portal-tenant-countries-adapter-BJb82oyY.cjs");
|
|
4
4
|
const require_src = require("./src-UnXevN9n.cjs");
|
|
5
5
|
const require_use_fluid_auth = require("./use-fluid-auth-CyKaXLbW.cjs");
|
|
6
6
|
const require_ScreenHeaderContext = require("./ScreenHeaderContext-wrJlkhgN.cjs");
|
|
@@ -1169,7 +1169,7 @@ function PaymentMethods({ paymentMethods, isLoading = false, onDeletePaymentMeth
|
|
|
1169
1169
|
require_src.fluidToast({
|
|
1170
1170
|
title: t("failed_to_set_default_payment_method"),
|
|
1171
1171
|
type: "error",
|
|
1172
|
-
description:
|
|
1172
|
+
description: require_portal_tenant_countries_adapter.parseApiErrors(error)
|
|
1173
1173
|
});
|
|
1174
1174
|
if (error instanceof Error) setEditError(error.message);
|
|
1175
1175
|
else setEditError("An unexpected error occurred. Please try again.");
|
|
@@ -2065,6 +2065,51 @@ function CreditCardFormDialog({ isOpen, onClose, onSubmit, isSubmitting, countri
|
|
|
2065
2065
|
});
|
|
2066
2066
|
}
|
|
2067
2067
|
//#endregion
|
|
2068
|
+
//#region ../../store/api-client/src/portal-tenant-languages-adapter.ts
|
|
2069
|
+
/**
|
|
2070
|
+
* Maps a BFF language to the port's Language shape.
|
|
2071
|
+
*/
|
|
2072
|
+
function mapLanguage(raw) {
|
|
2073
|
+
return {
|
|
2074
|
+
code: raw.code ?? "",
|
|
2075
|
+
name: raw.name ?? ""
|
|
2076
|
+
};
|
|
2077
|
+
}
|
|
2078
|
+
/**
|
|
2079
|
+
* Maps the BFF meta envelope to the port's ApiMeta shape.
|
|
2080
|
+
*/
|
|
2081
|
+
function mapMeta(raw) {
|
|
2082
|
+
return {
|
|
2083
|
+
request_id: raw?.request_id ?? null,
|
|
2084
|
+
timestamp: raw?.timestamp ?? "",
|
|
2085
|
+
pagination: raw?.pagination ? {
|
|
2086
|
+
cursor: raw.pagination.cursor ?? null,
|
|
2087
|
+
limit: raw.pagination.limit,
|
|
2088
|
+
next_cursor: raw.pagination.next_cursor ?? null,
|
|
2089
|
+
prev_cursor: raw.pagination.prev_cursor ?? null
|
|
2090
|
+
} : void 0
|
|
2091
|
+
};
|
|
2092
|
+
}
|
|
2093
|
+
/**
|
|
2094
|
+
* Creates a LanguagesApi adapter backed by the portal-tenant store BFF.
|
|
2095
|
+
*
|
|
2096
|
+
* Maps the generated portal-tenant-store namespace functions to the abstract
|
|
2097
|
+
* LanguagesApi port, closing over the FetchClient so consumers don't need
|
|
2098
|
+
* to pass it per-call.
|
|
2099
|
+
*/
|
|
2100
|
+
function createPortalTenantLanguagesAdapter(client) {
|
|
2101
|
+
return { listLanguages: async (params) => {
|
|
2102
|
+
const response = await require_portal_tenant_countries_adapter.languages_list(client, {
|
|
2103
|
+
"page[cursor]": params?.cursor,
|
|
2104
|
+
"page[limit]": params?.limit
|
|
2105
|
+
});
|
|
2106
|
+
return {
|
|
2107
|
+
languages: (response.languages ?? []).map(mapLanguage),
|
|
2108
|
+
meta: mapMeta(response.meta)
|
|
2109
|
+
};
|
|
2110
|
+
} };
|
|
2111
|
+
}
|
|
2112
|
+
//#endregion
|
|
2068
2113
|
//#region src/screens/ProfileContentScreen.tsx
|
|
2069
2114
|
const translations = {
|
|
2070
2115
|
edit_profile: "Edit Profile",
|
|
@@ -2172,10 +2217,18 @@ function ProfileContentScreen({ onToast, countryIso }) {
|
|
|
2172
2217
|
queryFn: () => api.paymentMethods.fetchAll(jwt, countryIso),
|
|
2173
2218
|
enabled: isAuthenticated
|
|
2174
2219
|
});
|
|
2220
|
+
const portalTenantClient = require_FluidProvider.usePortalTenantClient();
|
|
2221
|
+
const countriesAdapter = (0, react.useMemo)(() => require_portal_tenant_countries_adapter.createPortalTenantCountriesAdapter(portalTenantClient), [portalTenantClient]);
|
|
2222
|
+
const languagesAdapter = (0, react.useMemo)(() => createPortalTenantLanguagesAdapter(portalTenantClient), [portalTenantClient]);
|
|
2175
2223
|
const { data: countriesData } = (0, _tanstack_react_query.useQuery)({
|
|
2176
|
-
queryKey: ["
|
|
2177
|
-
queryFn: () =>
|
|
2178
|
-
|
|
2224
|
+
queryKey: ["bff-store-countries"],
|
|
2225
|
+
queryFn: () => countriesAdapter.listCountries(),
|
|
2226
|
+
enabled: isAuthenticated
|
|
2227
|
+
});
|
|
2228
|
+
const { data: languagesData } = (0, _tanstack_react_query.useQuery)({
|
|
2229
|
+
queryKey: ["bff-store-languages"],
|
|
2230
|
+
queryFn: () => languagesAdapter.listLanguages(),
|
|
2231
|
+
enabled: isAuthenticated
|
|
2179
2232
|
});
|
|
2180
2233
|
const { data: companySettings, isLoading: isLoadingCompanySettings } = (0, _tanstack_react_query.useQuery)({
|
|
2181
2234
|
queryKey: ["sdk-company-settings"],
|
|
@@ -2272,13 +2325,13 @@ function ProfileContentScreen({ onToast, countryIso }) {
|
|
|
2272
2325
|
const addresses = addressesData?.addresses ?? [];
|
|
2273
2326
|
const paymentMethods = paymentMethodsData?.payment_methods ?? [];
|
|
2274
2327
|
const adaptedPointsLedger = pointsLedgerData?.points_ledgers?.map(adaptPointsLedger) ?? [];
|
|
2275
|
-
const adaptedLanguages = [{
|
|
2276
|
-
id:
|
|
2277
|
-
name:
|
|
2278
|
-
iso:
|
|
2279
|
-
}
|
|
2280
|
-
const countryOptions = (0, react.useMemo)(() => [...countriesData].map((c) => ({
|
|
2281
|
-
iso: c.
|
|
2328
|
+
const adaptedLanguages = (languagesData?.languages ?? []).map((l, i) => ({
|
|
2329
|
+
id: i,
|
|
2330
|
+
name: l.name,
|
|
2331
|
+
iso: l.code
|
|
2332
|
+
}));
|
|
2333
|
+
const countryOptions = (0, react.useMemo)(() => [...countriesData?.countries ?? []].map((c) => ({
|
|
2334
|
+
iso: c.code,
|
|
2282
2335
|
name: c.name
|
|
2283
2336
|
})).sort((a, b) => a.name.localeCompare(b.name)), [countriesData]);
|
|
2284
2337
|
if (!isAuthenticated) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
@@ -2446,4 +2499,4 @@ Object.defineProperty(exports, "profileScreenPropertySchema", {
|
|
|
2446
2499
|
}
|
|
2447
2500
|
});
|
|
2448
2501
|
|
|
2449
|
-
//# sourceMappingURL=ProfileScreen-
|
|
2502
|
+
//# sourceMappingURL=ProfileScreen-FYGHStqM.cjs.map
|