@fluid-app/portal-sdk 0.1.34 → 0.1.35
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/{AppNavigationContext-v_y8OYHo.mjs → AppNavigationContext-CcRZ_LqM.mjs} +1 -1
- package/dist/{AppNavigationContext-v_y8OYHo.mjs.map → AppNavigationContext-CcRZ_LqM.mjs.map} +1 -1
- package/dist/{AppNavigationContext-0Ij6tU2H.cjs → AppNavigationContext-Dt02ymnf.cjs} +1 -1
- package/dist/{AppNavigationContext-0Ij6tU2H.cjs.map → AppNavigationContext-Dt02ymnf.cjs.map} +1 -1
- package/dist/{ContactsScreen-Ck_ngCS3.cjs → ContactsScreen-BZSNw0uV.cjs} +2 -2
- package/dist/{ContactsScreen-Ck_ngCS3.cjs.map → ContactsScreen-BZSNw0uV.cjs.map} +1 -1
- package/dist/{ContactsScreen-BmggZSZU.cjs → ContactsScreen-XI4f7ix6.cjs} +2 -2
- package/dist/{ContactsScreen-DXstI3Jj.mjs → ContactsScreen-eDQWCAQK.mjs} +2 -2
- package/dist/{ContactsScreen-DXstI3Jj.mjs.map → ContactsScreen-eDQWCAQK.mjs.map} +1 -1
- package/dist/{CustomersScreen-CeIiZKrq.cjs → CustomersScreen-B5k86dq0.cjs} +1 -1
- package/dist/{CustomersScreen-CeIiZKrq.cjs.map → CustomersScreen-B5k86dq0.cjs.map} +1 -1
- package/dist/{CustomersScreen-DEFY3mRL.mjs → CustomersScreen-DiXO5M5q.mjs} +1 -1
- package/dist/{CustomersScreen-DEFY3mRL.mjs.map → CustomersScreen-DiXO5M5q.mjs.map} +1 -1
- package/dist/{MessagingScreen-Kij03Kn-.mjs → MessagingScreen-CXA3RIlu2.mjs} +2 -2
- package/dist/{MessagingScreen-CUkIqREX.mjs → MessagingScreen-Df6yRSZ5.mjs} +2 -2
- package/dist/{MessagingScreen-CUkIqREX.mjs.map → MessagingScreen-Df6yRSZ5.mjs.map} +1 -1
- package/dist/{MessagingScreen-BZWaW9H_.cjs → MessagingScreen-Dp3t7kpp.cjs} +2 -2
- package/dist/{MessagingScreen-CbBgOUSs.cjs → MessagingScreen-onjDz5S1.cjs} +2 -2
- package/dist/{MessagingScreen-CbBgOUSs.cjs.map → MessagingScreen-onjDz5S1.cjs.map} +1 -1
- package/dist/{OrdersScreen-BEIE6mCd.cjs → OrdersScreen-BeUKNA_f.cjs} +5 -5
- package/dist/{OrdersScreen-BEIE6mCd.cjs.map → OrdersScreen-BeUKNA_f.cjs.map} +1 -1
- package/dist/{OrdersScreen-DrvVSd4b.cjs → OrdersScreen-DJFlTTTO.cjs} +2 -2
- package/dist/{OrdersScreen-CBxsKlnU.mjs → OrdersScreen-DTF-zAqR.mjs} +5 -5
- package/dist/{OrdersScreen-CBxsKlnU.mjs.map → OrdersScreen-DTF-zAqR.mjs.map} +1 -1
- package/dist/{ProductsScreen-CoHFvcO_.mjs → ProductsScreen-CNz_p26B.mjs} +3 -3
- package/dist/{ProductsScreen-DVxAFERc.mjs → ProductsScreen-CtGow3-U.mjs} +7 -7
- package/dist/ProductsScreen-CtGow3-U.mjs.map +1 -0
- package/dist/{ProductsScreen-D_crd0ir.cjs → ProductsScreen-CzbRJMF4.cjs} +7 -7
- package/dist/ProductsScreen-CzbRJMF4.cjs.map +1 -0
- package/dist/{ProductsScreen-Dzq3KP63.cjs → ProductsScreen-UgEr2Y6M.cjs} +3 -3
- package/dist/{ProfileScreen-B1_m1WId.cjs → ProfileScreen-CNOAZaoe.cjs} +1 -1
- package/dist/{ProfileScreen-BACkWuAC.cjs → ProfileScreen-CzARNtFJ.cjs} +5 -4
- package/dist/{ProfileScreen-BACkWuAC.cjs.map → ProfileScreen-CzARNtFJ.cjs.map} +1 -1
- package/dist/{ProfileScreen-Cn4iihgD.mjs → ProfileScreen-DCFj7ETG.mjs} +3 -2
- package/dist/{ProfileScreen-Cn4iihgD.mjs.map → ProfileScreen-DCFj7ETG.mjs.map} +1 -1
- package/dist/{ShareablesScreen-BhrhYh4W.cjs → ShareablesScreen-DSJ7x0Ww.cjs} +8 -8
- package/dist/ShareablesScreen-DSJ7x0Ww.cjs.map +1 -0
- package/dist/{ShareablesScreen-D588qo6a.mjs → ShareablesScreen-Dofp37E4.mjs} +3 -3
- package/dist/{ShareablesScreen-6fpWI08O.cjs → ShareablesScreen-cpwboVjB.cjs} +3 -3
- package/dist/{ShareablesScreen-BEFG54-I.mjs → ShareablesScreen-w3DGRfIr.mjs} +8 -8
- package/dist/ShareablesScreen-w3DGRfIr.mjs.map +1 -0
- package/dist/{ShopScreen-Drg27OZM.mjs → ShopScreen-BlyzHYeU.mjs} +6 -4
- package/dist/{ShopScreen-Drg27OZM.mjs.map → ShopScreen-BlyzHYeU.mjs.map} +1 -1
- package/dist/{ShopScreen-B7mMrj2I.cjs → ShopScreen-ByjnSNho.cjs} +6 -4
- package/dist/ShopScreen-ByjnSNho.cjs.map +1 -0
- package/dist/{ShopScreen-B3EgfJsG.cjs → ShopScreen-vbGhD5GJ.cjs} +1 -1
- package/dist/{SubscriptionsScreen-DsHjhOII.cjs → SubscriptionsScreen-BNjDelpe.cjs} +2 -2
- package/dist/{SubscriptionsScreen-DMFug2Kk.cjs → SubscriptionsScreen-DawiAb7q.cjs} +5 -5
- package/dist/{SubscriptionsScreen-DMFug2Kk.cjs.map → SubscriptionsScreen-DawiAb7q.cjs.map} +1 -1
- package/dist/{SubscriptionsScreen-DtcFH3sB.mjs → SubscriptionsScreen-tUrUZ3VC.mjs} +5 -5
- package/dist/{SubscriptionsScreen-DtcFH3sB.mjs.map → SubscriptionsScreen-tUrUZ3VC.mjs.map} +1 -1
- package/dist/customers-BHw3-Lg-.mjs +19 -0
- package/dist/customers-BHw3-Lg-.mjs.map +1 -0
- package/dist/customers-DIn-CxMl.cjs +30 -0
- package/dist/customers-DIn-CxMl.cjs.map +1 -0
- package/dist/{es-DZKcJZKh.mjs → es-BPF1dsEO.mjs} +1 -1
- package/dist/{es-DZKcJZKh.mjs.map → es-BPF1dsEO.mjs.map} +1 -1
- package/dist/{es-B1uNuoqD.cjs → es-DfGWLS4J.cjs} +1 -1
- package/dist/{es-B1uNuoqD.cjs.map → es-DfGWLS4J.cjs.map} +1 -1
- package/dist/index.cjs +32 -32
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +32 -32
- package/dist/index.mjs.map +1 -1
- package/dist/{src-BHiCoWU5.cjs → src-B7JarYAL.cjs} +1 -1
- package/dist/{src-BHiCoWU5.cjs.map → src-B7JarYAL.cjs.map} +1 -1
- package/dist/{src-J8sXTG9i.mjs → src-C2NjWMLg.mjs} +1 -1
- package/dist/{src-J8sXTG9i.mjs.map → src-C2NjWMLg.mjs.map} +1 -1
- package/dist/{src-C1qfvUE4.cjs → src-CsjWsZwA.cjs} +2 -2
- package/dist/{src-C1qfvUE4.cjs.map → src-CsjWsZwA.cjs.map} +1 -1
- package/dist/{src-D7GSa3rY.mjs → src-rgyT4GpO.mjs} +2 -2
- package/dist/{src-D7GSa3rY.mjs.map → src-rgyT4GpO.mjs.map} +1 -1
- package/dist/{use-account-clients-ak24jQa5.mjs → use-account-clients-DAQe3cFz.mjs} +2 -18
- package/dist/use-account-clients-DAQe3cFz.mjs.map +1 -0
- package/dist/{use-account-clients-D7BxTeLW.cjs → use-account-clients-T32HqoLD.cjs} +1 -29
- package/dist/use-account-clients-T32HqoLD.cjs.map +1 -0
- package/dist/{use-customer-account-BnnxuHea.mjs → use-customer-account-BV3IWOWw.mjs} +3 -2
- package/dist/{use-customer-account-BnnxuHea.mjs.map → use-customer-account-BV3IWOWw.mjs.map} +1 -1
- package/dist/{use-customer-account-KDDX2Irm.cjs → use-customer-account-C1oG0PQ5.cjs} +4 -3
- package/dist/{use-customer-account-KDDX2Irm.cjs.map → use-customer-account-C1oG0PQ5.cjs.map} +1 -1
- package/package.json +13 -13
- package/dist/ProductsScreen-DVxAFERc.mjs.map +0 -1
- package/dist/ProductsScreen-D_crd0ir.cjs.map +0 -1
- package/dist/ShareablesScreen-BEFG54-I.mjs.map +0 -1
- package/dist/ShareablesScreen-BhrhYh4W.cjs.map +0 -1
- package/dist/ShopScreen-B7mMrj2I.cjs.map +0 -1
- package/dist/use-account-clients-D7BxTeLW.cjs.map +0 -1
- package/dist/use-account-clients-ak24jQa5.mjs.map +0 -1
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
require("./chunk-9hOWP6kD.cjs");
|
|
2
|
-
const require_use_account_clients = require("./use-account-clients-
|
|
3
|
-
const require_src = require("./src-
|
|
4
|
-
const require_AppNavigationContext = require("./AppNavigationContext-
|
|
5
|
-
const require_use_customer_account = require("./use-customer-account-
|
|
2
|
+
const require_use_account_clients = require("./use-account-clients-T32HqoLD.cjs");
|
|
3
|
+
const require_src = require("./src-B7JarYAL.cjs");
|
|
4
|
+
const require_AppNavigationContext = require("./AppNavigationContext-Dt02ymnf.cjs");
|
|
5
|
+
const require_use_customer_account = require("./use-customer-account-C1oG0PQ5.cjs");
|
|
6
6
|
let react_jsx_runtime = require("react/jsx-runtime");
|
|
7
7
|
//#region src/screens/OrdersListScreen.tsx
|
|
8
8
|
const translations = {
|
|
@@ -131,4 +131,4 @@ Object.defineProperty(exports, "ordersScreenPropertySchema", {
|
|
|
131
131
|
}
|
|
132
132
|
});
|
|
133
133
|
|
|
134
|
-
//# sourceMappingURL=OrdersScreen-
|
|
134
|
+
//# sourceMappingURL=OrdersScreen-BeUKNA_f.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OrdersScreen-
|
|
1
|
+
{"version":3,"file":"OrdersScreen-BeUKNA_f.cjs","names":["useOrdersClient","useAppNavigation","OrdersCoreProvider","OrdersList","useOrdersClient","useAppNavigation","OrdersCoreProvider","OrderDetail","useAppNavigation","useCustomerAccount"],"sources":["../src/screens/OrdersListScreen.tsx","../src/screens/OrderDetailScreen.tsx","../src/screens/OrdersScreen.tsx"],"sourcesContent":["import { OrdersCoreProvider } from \"@fluid-app/orders-core\";\nimport { OrdersList } from \"@fluid-app/orders-ui\";\nimport type { orders } from \"@fluid-app/orders-api-client\";\nimport { useOrdersClient } from \"../account/use-account-clients\";\nimport { useAppNavigation } from \"../shell/AppNavigationContext\";\n\ninterface OrdersListScreenProps {\n customerId: number | undefined;\n isLoadingCustomer: boolean;\n}\n\nconst translations: Record<string, string> = {\n search_orders: \"Search orders...\",\n order_number: \"Order #\",\n date: \"Date\",\n status: \"Status\",\n product: \"Product\",\n no_orders_found: \"No orders found\",\n no_matching_orders: \"No matching orders\",\n no_image_available: \"No image available\",\n this_product_no_longer_exists: \"This product no longer exists\",\n subscription: \"Subscription\",\n view_subscription: \"View Subscription\",\n total: \"Total\",\n results: \"results\",\n previous: \"Previous\",\n next: \"Next\",\n pagination: \"Pagination\",\n};\n\nexport function OrdersListScreen({\n customerId,\n isLoadingCustomer,\n}: OrdersListScreenProps): React.JSX.Element {\n const ordersClient = useOrdersClient();\n const { navigate } = useAppNavigation();\n\n const handleOrderClick = (order: orders.ListOrder) => {\n navigate(`orders/${order.token}`);\n };\n\n const handleSubscriptionClick = (subscriptionToken: string) => {\n navigate(`subscriptions/${subscriptionToken}`);\n };\n\n if (isLoadingCustomer) {\n return (\n <div className=\"mx-auto max-w-7xl px-4 py-4 sm:px-6 sm:py-6 lg:px-10 lg:py-8\">\n <div className=\"space-y-3\">\n <div className=\"bg-muted h-10 animate-pulse rounded\" />\n <div className=\"bg-muted h-64 animate-pulse rounded\" />\n </div>\n </div>\n );\n }\n\n return (\n <OrdersCoreProvider client={ordersClient}>\n <div className=\"mx-auto max-w-7xl px-4 py-4 sm:px-6 sm:py-6 lg:px-10 lg:py-8\">\n <OrdersList\n customerId={customerId}\n onOrderClick={handleOrderClick}\n onSubscriptionClick={handleSubscriptionClick}\n t={(key) => translations[key] ?? key}\n />\n </div>\n </OrdersCoreProvider>\n );\n}\n","import { OrdersCoreProvider } from \"@fluid-app/orders-core\";\nimport { OrderDetail } from \"@fluid-app/orders-ui\";\nimport { useOrdersClient } from \"../account/use-account-clients\";\nimport { useAppNavigation } from \"../shell/AppNavigationContext\";\n\ninterface OrderDetailScreenProps {\n token: string;\n onToast: (message: string, type: \"success\" | \"error\" | \"warning\") => void;\n}\n\nexport function OrderDetailScreen({\n token,\n onToast,\n}: OrderDetailScreenProps): React.JSX.Element {\n const client = useOrdersClient();\n const { navigate } = useAppNavigation();\n\n return (\n <OrdersCoreProvider client={client}>\n <div className=\"mx-auto max-w-7xl px-4 py-4 sm:px-6 sm:py-6 lg:px-10 lg:py-8\">\n <OrderDetail\n token={token}\n onNotFound={() => {\n onToast(\"Order not found\", \"warning\");\n navigate(\"orders\");\n }}\n onError={(err) => {\n const message =\n err instanceof Error ? err.message : \"An error occurred\";\n onToast(`Failed to load order: ${message}`, \"error\");\n }}\n />\n </div>\n </OrdersCoreProvider>\n );\n}\n","import type { ComponentProps } from \"react\";\nimport type {\n BackgroundValue,\n BorderRadiusOptions,\n ColorOptions,\n PaddingOptions,\n} from \"../types\";\nimport type { WidgetPropertySchema } from \"../registries/property-schema-types\";\nimport { useAppNavigation } from \"../shell/AppNavigationContext\";\nimport { useCustomerAccount } from \"../account/use-customer-account\";\nimport { OrdersListScreen } from \"./OrdersListScreen\";\nimport { OrderDetailScreen } from \"./OrderDetailScreen\";\n\ntype OrdersScreenProps = ComponentProps<\"div\"> & {\n background?: BackgroundValue;\n textColor?: ColorOptions;\n accentColor?: ColorOptions;\n padding?: PaddingOptions;\n borderRadius?: BorderRadiusOptions;\n onToast?: (message: string, type: \"success\" | \"error\" | \"warning\") => void;\n};\n\nfunction defaultToast(message: string, type: \"success\" | \"error\" | \"warning\") {\n if (type === \"error\" || type === \"warning\") {\n console.warn(\"[Orders]\", message);\n } else {\n console.info(\"[Orders]\", message);\n }\n}\n\nexport function OrdersScreen({\n onToast,\n /* eslint-disable @typescript-eslint/no-unused-vars -- destructured to exclude from divProps spread */\n background,\n textColor,\n accentColor,\n padding,\n borderRadius,\n /* eslint-enable @typescript-eslint/no-unused-vars */\n ...divProps\n}: OrdersScreenProps): React.JSX.Element {\n const { currentSlug } = useAppNavigation();\n const effectiveToast = onToast ?? defaultToast;\n\n // Parse slug: \"orders\" → list, \"orders/{token}\" → detail\n const detailToken = currentSlug.split(\"/\")[1];\n const isDetailView = detailToken !== undefined;\n\n const { customerId, isLoadingCustomer, isCustomerError } = useCustomerAccount(\n { enabled: !isDetailView },\n );\n\n if (isDetailView) {\n return (\n <div {...divProps}>\n <OrderDetailScreen token={detailToken} onToast={effectiveToast} />\n </div>\n );\n }\n\n if (isCustomerError && !isLoadingCustomer) {\n return (\n <div {...divProps}>\n <div className=\"text-muted-foreground px-4 py-8 text-center text-sm\">\n Unable to load account data. Please try again later.\n </div>\n </div>\n );\n }\n\n return (\n <div {...divProps}>\n <OrdersListScreen\n customerId={customerId}\n isLoadingCustomer={isLoadingCustomer}\n />\n </div>\n );\n}\n\nexport const ordersScreenPropertySchema: WidgetPropertySchema = {\n widgetType: \"OrdersScreen\",\n displayName: \"Orders Screen\",\n tabsConfig: [{ id: \"styling\", label: \"Styling\" }],\n fields: [],\n} as const satisfies WidgetPropertySchema;\n"],"mappings":"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"}
|
|
@@ -27,7 +27,7 @@ require("./SpacerWidget-DyZ49XpL.cjs");
|
|
|
27
27
|
require("./TableWidget-CCEwDiby.cjs");
|
|
28
28
|
require("./ToDoWidget-CrZ9xJV1.cjs");
|
|
29
29
|
require("./VideoWidget-BJrnmHCe.cjs");
|
|
30
|
-
require("./src-
|
|
31
|
-
const require_OrdersScreen = require("./OrdersScreen-
|
|
30
|
+
require("./src-B7JarYAL.cjs");
|
|
31
|
+
const require_OrdersScreen = require("./OrdersScreen-BeUKNA_f.cjs");
|
|
32
32
|
exports.OrdersScreen = require_OrdersScreen.OrdersScreen;
|
|
33
33
|
exports.ordersScreenPropertySchema = require_OrdersScreen.ordersScreenPropertySchema;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { n as __exportAll } from "./chunk-ByhMGyNw.mjs";
|
|
2
|
-
import { r as useOrdersClient } from "./use-account-clients-
|
|
3
|
-
import { a as OrdersCoreProvider, n as OrdersList, t as OrderDetail } from "./src-
|
|
4
|
-
import { n as useAppNavigation } from "./AppNavigationContext-
|
|
5
|
-
import { t as useCustomerAccount } from "./use-customer-account-
|
|
2
|
+
import { r as useOrdersClient } from "./use-account-clients-DAQe3cFz.mjs";
|
|
3
|
+
import { a as OrdersCoreProvider, n as OrdersList, t as OrderDetail } from "./src-C2NjWMLg.mjs";
|
|
4
|
+
import { n as useAppNavigation } from "./AppNavigationContext-CcRZ_LqM.mjs";
|
|
5
|
+
import { t as useCustomerAccount } from "./use-customer-account-BV3IWOWw.mjs";
|
|
6
6
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
7
|
//#region src/screens/OrdersListScreen.tsx
|
|
8
8
|
const translations = {
|
|
@@ -124,4 +124,4 @@ const ordersScreenPropertySchema = {
|
|
|
124
124
|
//#endregion
|
|
125
125
|
export { OrdersScreen_exports as n, ordersScreenPropertySchema as r, OrdersScreen as t };
|
|
126
126
|
|
|
127
|
-
//# sourceMappingURL=OrdersScreen-
|
|
127
|
+
//# sourceMappingURL=OrdersScreen-DTF-zAqR.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OrdersScreen-
|
|
1
|
+
{"version":3,"file":"OrdersScreen-DTF-zAqR.mjs","names":[],"sources":["../src/screens/OrdersListScreen.tsx","../src/screens/OrderDetailScreen.tsx","../src/screens/OrdersScreen.tsx"],"sourcesContent":["import { OrdersCoreProvider } from \"@fluid-app/orders-core\";\nimport { OrdersList } from \"@fluid-app/orders-ui\";\nimport type { orders } from \"@fluid-app/orders-api-client\";\nimport { useOrdersClient } from \"../account/use-account-clients\";\nimport { useAppNavigation } from \"../shell/AppNavigationContext\";\n\ninterface OrdersListScreenProps {\n customerId: number | undefined;\n isLoadingCustomer: boolean;\n}\n\nconst translations: Record<string, string> = {\n search_orders: \"Search orders...\",\n order_number: \"Order #\",\n date: \"Date\",\n status: \"Status\",\n product: \"Product\",\n no_orders_found: \"No orders found\",\n no_matching_orders: \"No matching orders\",\n no_image_available: \"No image available\",\n this_product_no_longer_exists: \"This product no longer exists\",\n subscription: \"Subscription\",\n view_subscription: \"View Subscription\",\n total: \"Total\",\n results: \"results\",\n previous: \"Previous\",\n next: \"Next\",\n pagination: \"Pagination\",\n};\n\nexport function OrdersListScreen({\n customerId,\n isLoadingCustomer,\n}: OrdersListScreenProps): React.JSX.Element {\n const ordersClient = useOrdersClient();\n const { navigate } = useAppNavigation();\n\n const handleOrderClick = (order: orders.ListOrder) => {\n navigate(`orders/${order.token}`);\n };\n\n const handleSubscriptionClick = (subscriptionToken: string) => {\n navigate(`subscriptions/${subscriptionToken}`);\n };\n\n if (isLoadingCustomer) {\n return (\n <div className=\"mx-auto max-w-7xl px-4 py-4 sm:px-6 sm:py-6 lg:px-10 lg:py-8\">\n <div className=\"space-y-3\">\n <div className=\"bg-muted h-10 animate-pulse rounded\" />\n <div className=\"bg-muted h-64 animate-pulse rounded\" />\n </div>\n </div>\n );\n }\n\n return (\n <OrdersCoreProvider client={ordersClient}>\n <div className=\"mx-auto max-w-7xl px-4 py-4 sm:px-6 sm:py-6 lg:px-10 lg:py-8\">\n <OrdersList\n customerId={customerId}\n onOrderClick={handleOrderClick}\n onSubscriptionClick={handleSubscriptionClick}\n t={(key) => translations[key] ?? key}\n />\n </div>\n </OrdersCoreProvider>\n );\n}\n","import { OrdersCoreProvider } from \"@fluid-app/orders-core\";\nimport { OrderDetail } from \"@fluid-app/orders-ui\";\nimport { useOrdersClient } from \"../account/use-account-clients\";\nimport { useAppNavigation } from \"../shell/AppNavigationContext\";\n\ninterface OrderDetailScreenProps {\n token: string;\n onToast: (message: string, type: \"success\" | \"error\" | \"warning\") => void;\n}\n\nexport function OrderDetailScreen({\n token,\n onToast,\n}: OrderDetailScreenProps): React.JSX.Element {\n const client = useOrdersClient();\n const { navigate } = useAppNavigation();\n\n return (\n <OrdersCoreProvider client={client}>\n <div className=\"mx-auto max-w-7xl px-4 py-4 sm:px-6 sm:py-6 lg:px-10 lg:py-8\">\n <OrderDetail\n token={token}\n onNotFound={() => {\n onToast(\"Order not found\", \"warning\");\n navigate(\"orders\");\n }}\n onError={(err) => {\n const message =\n err instanceof Error ? err.message : \"An error occurred\";\n onToast(`Failed to load order: ${message}`, \"error\");\n }}\n />\n </div>\n </OrdersCoreProvider>\n );\n}\n","import type { ComponentProps } from \"react\";\nimport type {\n BackgroundValue,\n BorderRadiusOptions,\n ColorOptions,\n PaddingOptions,\n} from \"../types\";\nimport type { WidgetPropertySchema } from \"../registries/property-schema-types\";\nimport { useAppNavigation } from \"../shell/AppNavigationContext\";\nimport { useCustomerAccount } from \"../account/use-customer-account\";\nimport { OrdersListScreen } from \"./OrdersListScreen\";\nimport { OrderDetailScreen } from \"./OrderDetailScreen\";\n\ntype OrdersScreenProps = ComponentProps<\"div\"> & {\n background?: BackgroundValue;\n textColor?: ColorOptions;\n accentColor?: ColorOptions;\n padding?: PaddingOptions;\n borderRadius?: BorderRadiusOptions;\n onToast?: (message: string, type: \"success\" | \"error\" | \"warning\") => void;\n};\n\nfunction defaultToast(message: string, type: \"success\" | \"error\" | \"warning\") {\n if (type === \"error\" || type === \"warning\") {\n console.warn(\"[Orders]\", message);\n } else {\n console.info(\"[Orders]\", message);\n }\n}\n\nexport function OrdersScreen({\n onToast,\n /* eslint-disable @typescript-eslint/no-unused-vars -- destructured to exclude from divProps spread */\n background,\n textColor,\n accentColor,\n padding,\n borderRadius,\n /* eslint-enable @typescript-eslint/no-unused-vars */\n ...divProps\n}: OrdersScreenProps): React.JSX.Element {\n const { currentSlug } = useAppNavigation();\n const effectiveToast = onToast ?? defaultToast;\n\n // Parse slug: \"orders\" → list, \"orders/{token}\" → detail\n const detailToken = currentSlug.split(\"/\")[1];\n const isDetailView = detailToken !== undefined;\n\n const { customerId, isLoadingCustomer, isCustomerError } = useCustomerAccount(\n { enabled: !isDetailView },\n );\n\n if (isDetailView) {\n return (\n <div {...divProps}>\n <OrderDetailScreen token={detailToken} onToast={effectiveToast} />\n </div>\n );\n }\n\n if (isCustomerError && !isLoadingCustomer) {\n return (\n <div {...divProps}>\n <div className=\"text-muted-foreground px-4 py-8 text-center text-sm\">\n Unable to load account data. Please try again later.\n </div>\n </div>\n );\n }\n\n return (\n <div {...divProps}>\n <OrdersListScreen\n customerId={customerId}\n isLoadingCustomer={isLoadingCustomer}\n />\n </div>\n );\n}\n\nexport const ordersScreenPropertySchema: WidgetPropertySchema = {\n widgetType: \"OrdersScreen\",\n displayName: \"Orders Screen\",\n tabsConfig: [{ id: \"styling\", label: \"Styling\" }],\n fields: [],\n} as const satisfies WidgetPropertySchema;\n"],"mappings":";;;;;;;AAWA,MAAM,eAAuC;CAC3C,eAAe;CACf,cAAc;CACd,MAAM;CACN,QAAQ;CACR,SAAS;CACT,iBAAiB;CACjB,oBAAoB;CACpB,oBAAoB;CACpB,+BAA+B;CAC/B,cAAc;CACd,mBAAmB;CACnB,OAAO;CACP,SAAS;CACT,UAAU;CACV,MAAM;CACN,YAAY;CACb;AAED,SAAgB,iBAAiB,EAC/B,YACA,qBAC2C;CAC3C,MAAM,eAAe,iBAAiB;CACtC,MAAM,EAAE,aAAa,kBAAkB;CAEvC,MAAM,oBAAoB,UAA4B;AACpD,WAAS,UAAU,MAAM,QAAQ;;CAGnC,MAAM,2BAA2B,sBAA8B;AAC7D,WAAS,iBAAiB,oBAAoB;;AAGhD,KAAI,kBACF,QACE,oBAAC,OAAD;EAAK,WAAU;YACb,qBAAC,OAAD;GAAK,WAAU;aAAf,CACE,oBAAC,OAAD,EAAK,WAAU,uCAAwC,CAAA,EACvD,oBAAC,OAAD,EAAK,WAAU,uCAAwC,CAAA,CACnD;;EACF,CAAA;AAIV,QACE,oBAAC,oBAAD;EAAoB,QAAQ;YAC1B,oBAAC,OAAD;GAAK,WAAU;aACb,oBAAC,YAAD;IACc;IACZ,cAAc;IACd,qBAAqB;IACrB,IAAI,QAAQ,aAAa,QAAQ;IACjC,CAAA;GACE,CAAA;EACa,CAAA;;;;ACxDzB,SAAgB,kBAAkB,EAChC,OACA,WAC4C;CAC5C,MAAM,SAAS,iBAAiB;CAChC,MAAM,EAAE,aAAa,kBAAkB;AAEvC,QACE,oBAAC,oBAAD;EAA4B;YAC1B,oBAAC,OAAD;GAAK,WAAU;aACb,oBAAC,aAAD;IACS;IACP,kBAAkB;AAChB,aAAQ,mBAAmB,UAAU;AACrC,cAAS,SAAS;;IAEpB,UAAU,QAAQ;AAGhB,aAAQ,yBADN,eAAe,QAAQ,IAAI,UAAU,uBACK,QAAQ;;IAEtD,CAAA;GACE,CAAA;EACa,CAAA;;;;;;;;ACXzB,SAAS,aAAa,SAAiB,MAAuC;AAC5E,KAAI,SAAS,WAAW,SAAS,UAC/B,SAAQ,KAAK,YAAY,QAAQ;KAEjC,SAAQ,KAAK,YAAY,QAAQ;;AAIrC,SAAgB,aAAa,EAC3B,SAEA,YACA,WACA,aACA,SACA,cAEA,GAAG,YACoC;CACvC,MAAM,EAAE,gBAAgB,kBAAkB;CAC1C,MAAM,iBAAiB,WAAW;CAGlC,MAAM,cAAc,YAAY,MAAM,IAAI,CAAC;CAC3C,MAAM,eAAe,gBAAgB,KAAA;CAErC,MAAM,EAAE,YAAY,mBAAmB,oBAAoB,mBACzD,EAAE,SAAS,CAAC,cAAc,CAC3B;AAED,KAAI,aACF,QACE,oBAAC,OAAD;EAAK,GAAI;YACP,oBAAC,mBAAD;GAAmB,OAAO;GAAa,SAAS;GAAkB,CAAA;EAC9D,CAAA;AAIV,KAAI,mBAAmB,CAAC,kBACtB,QACE,oBAAC,OAAD;EAAK,GAAI;YACP,oBAAC,OAAD;GAAK,WAAU;aAAsD;GAE/D,CAAA;EACF,CAAA;AAIV,QACE,oBAAC,OAAD;EAAK,GAAI;YACP,oBAAC,kBAAD;GACc;GACO;GACnB,CAAA;EACE,CAAA;;AAIV,MAAa,6BAAmD;CAC9D,YAAY;CACZ,aAAa;CACb,YAAY,CAAC;EAAE,IAAI;EAAW,OAAO;EAAW,CAAC;CACjD,QAAQ,EAAE;CACX"}
|
|
@@ -26,7 +26,7 @@ import "./SpacerWidget-DXXnYNIX.mjs";
|
|
|
26
26
|
import "./TableWidget-DCiqxLv5.mjs";
|
|
27
27
|
import "./ToDoWidget-CmJIUKr0.mjs";
|
|
28
28
|
import "./VideoWidget-D6aWKmRN.mjs";
|
|
29
|
-
import "./es-
|
|
30
|
-
import "./src-
|
|
31
|
-
import { n as productsScreenPropertySchema, t as ProductsScreen } from "./ProductsScreen-
|
|
29
|
+
import "./es-BPF1dsEO.mjs";
|
|
30
|
+
import "./src-rgyT4GpO.mjs";
|
|
31
|
+
import { n as productsScreenPropertySchema, t as ProductsScreen } from "./ProductsScreen-CtGow3-U.mjs";
|
|
32
32
|
export { ProductsScreen, productsScreenPropertySchema };
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { n as useFluidContext } from "./FluidProvider-CWC6LA9W.mjs";
|
|
2
1
|
import { i as useCurrentUser } from "./products-CBjo08FD.mjs";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
2
|
+
import { i as useSdkClient } from "./use-account-clients-DAQe3cFz.mjs";
|
|
3
|
+
import { n as useAppNavigation } from "./AppNavigationContext-CcRZ_LqM.mjs";
|
|
4
|
+
import { i as ShareablesCoreProvider, r as ShareablesUIProvider, t as ProductsApp } from "./src-rgyT4GpO.mjs";
|
|
5
5
|
import { useCallback, useMemo } from "react";
|
|
6
6
|
import { jsx } from "react/jsx-runtime";
|
|
7
7
|
//#region src/screens/ProductsScreen.tsx
|
|
8
8
|
function ProductsScreen({ background, textColor, accentColor, padding, borderRadius, ...divProps }) {
|
|
9
|
-
const
|
|
9
|
+
const domainClient = useSdkClient();
|
|
10
10
|
const { data: userData } = useCurrentUser();
|
|
11
11
|
const { currentSlug, navigate } = useAppNavigation();
|
|
12
12
|
const productId = useMemo(() => {
|
|
@@ -19,9 +19,9 @@ function ProductsScreen({ background, textColor, accentColor, padding, borderRad
|
|
|
19
19
|
navigate("products");
|
|
20
20
|
}, [navigate]);
|
|
21
21
|
const coreConfig = useMemo(() => ({
|
|
22
|
-
client:
|
|
22
|
+
client: domainClient,
|
|
23
23
|
user: userData ? { id: userData.id } : null
|
|
24
|
-
}), [
|
|
24
|
+
}), [domainClient, userData]);
|
|
25
25
|
const uiConfig = useMemo(() => ({
|
|
26
26
|
user: userData ? {
|
|
27
27
|
id: userData.id,
|
|
@@ -65,4 +65,4 @@ const productsScreenPropertySchema = {
|
|
|
65
65
|
//#endregion
|
|
66
66
|
export { productsScreenPropertySchema as n, ProductsScreen as t };
|
|
67
67
|
|
|
68
|
-
//# sourceMappingURL=ProductsScreen-
|
|
68
|
+
//# sourceMappingURL=ProductsScreen-CtGow3-U.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ProductsScreen-CtGow3-U.mjs","names":[],"sources":["../src/screens/ProductsScreen.tsx"],"sourcesContent":["import { useCallback, useMemo, type ComponentProps } from \"react\";\nimport type {\n BackgroundValue,\n BorderRadiusOptions,\n ColorOptions,\n PaddingOptions,\n} from \"../types\";\nimport type { WidgetPropertySchema } from \"../registries/property-schema-types\";\nimport { ShareablesCoreProvider } from \"@fluid-app/shareables-core\";\nimport { ShareablesUIProvider, ProductsApp } from \"@fluid-app/shareables-ui\";\nimport { useCurrentUser } from \"../hooks/use-current-user\";\nimport { useAppNavigation } from \"../shell/AppNavigationContext\";\nimport { useSdkClient } from \"../account/use-account-clients\";\n\ntype ProductsScreenProps = ComponentProps<\"div\"> & {\n background?: BackgroundValue;\n textColor?: ColorOptions;\n accentColor?: ColorOptions;\n padding?: PaddingOptions;\n borderRadius?: BorderRadiusOptions;\n};\n\nexport function ProductsScreen({\n /* eslint-disable @typescript-eslint/no-unused-vars -- destructured to exclude from divProps spread */\n background,\n textColor,\n accentColor,\n padding,\n borderRadius,\n /* eslint-enable @typescript-eslint/no-unused-vars */\n ...divProps\n}: ProductsScreenProps): React.JSX.Element {\n const domainClient = useSdkClient();\n const { data: userData } = useCurrentUser();\n const { currentSlug, navigate } = useAppNavigation();\n\n // Extract product ID from slug: \"products/123\" → \"123\"\n const productId = useMemo(() => {\n const match = currentSlug.match(/^products\\/(.+)/);\n return match?.[1] ?? null;\n }, [currentSlug]);\n\n const handleSelectProduct = useCallback(\n (id: string) => {\n navigate(`products/${id}`);\n },\n [navigate],\n );\n\n const handleBack = useCallback(() => {\n navigate(\"products\");\n }, [navigate]);\n\n const coreConfig = useMemo(\n () => ({\n client: domainClient,\n user: userData ? { id: userData.id } : null,\n }),\n [domainClient, userData],\n );\n\n const uiConfig = useMemo(\n () => ({\n user: userData\n ? {\n id: userData.id,\n company: userData.company\n ? { logo_url: userData.company.logo_url }\n : null,\n }\n : undefined,\n basePath: \"\",\n navigate: (path: string) => {\n navigate(path);\n },\n showToast: (opts: {\n title: string;\n type: \"success\" | \"error\" | \"warning\";\n }) => {\n console.log(`[Products] ${opts.type}: ${opts.title}`);\n },\n }),\n [userData, navigate],\n );\n\n return (\n <div {...divProps} className={`h-full ${divProps.className ?? \"\"}`}>\n <ShareablesCoreProvider config={coreConfig}>\n <ShareablesUIProvider config={uiConfig}>\n <ProductsApp\n countryCode={userData?.country?.iso}\n companyLogoUrl={userData?.company?.logo_url}\n productId={productId}\n onSelectProduct={handleSelectProduct}\n onBack={handleBack}\n />\n </ShareablesUIProvider>\n </ShareablesCoreProvider>\n </div>\n );\n}\n\nexport const productsScreenPropertySchema: WidgetPropertySchema = {\n widgetType: \"ProductsScreen\",\n displayName: \"Products Screen\",\n tabsConfig: [{ id: \"styling\", label: \"Styling\" }],\n fields: [],\n} as const satisfies WidgetPropertySchema;\n"],"mappings":";;;;;;;AAsBA,SAAgB,eAAe,EAE7B,YACA,WACA,aACA,SACA,cAEA,GAAG,YACsC;CACzC,MAAM,eAAe,cAAc;CACnC,MAAM,EAAE,MAAM,aAAa,gBAAgB;CAC3C,MAAM,EAAE,aAAa,aAAa,kBAAkB;CAGpD,MAAM,YAAY,cAAc;AAE9B,SADc,YAAY,MAAM,kBAAkB,GACnC,MAAM;IACpB,CAAC,YAAY,CAAC;CAEjB,MAAM,sBAAsB,aACzB,OAAe;AACd,WAAS,YAAY,KAAK;IAE5B,CAAC,SAAS,CACX;CAED,MAAM,aAAa,kBAAkB;AACnC,WAAS,WAAW;IACnB,CAAC,SAAS,CAAC;CAEd,MAAM,aAAa,eACV;EACL,QAAQ;EACR,MAAM,WAAW,EAAE,IAAI,SAAS,IAAI,GAAG;EACxC,GACD,CAAC,cAAc,SAAS,CACzB;CAED,MAAM,WAAW,eACR;EACL,MAAM,WACF;GACE,IAAI,SAAS;GACb,SAAS,SAAS,UACd,EAAE,UAAU,SAAS,QAAQ,UAAU,GACvC;GACL,GACD,KAAA;EACJ,UAAU;EACV,WAAW,SAAiB;AAC1B,YAAS,KAAK;;EAEhB,YAAY,SAGN;AACJ,WAAQ,IAAI,cAAc,KAAK,KAAK,IAAI,KAAK,QAAQ;;EAExD,GACD,CAAC,UAAU,SAAS,CACrB;AAED,QACE,oBAAC,OAAD;EAAK,GAAI;EAAU,WAAW,UAAU,SAAS,aAAa;YAC5D,oBAAC,wBAAD;GAAwB,QAAQ;aAC9B,oBAAC,sBAAD;IAAsB,QAAQ;cAC5B,oBAAC,aAAD;KACE,aAAa,UAAU,SAAS;KAChC,gBAAgB,UAAU,SAAS;KACxB;KACX,iBAAiB;KACjB,QAAQ;KACR,CAAA;IACmB,CAAA;GACA,CAAA;EACrB,CAAA;;AAIV,MAAa,+BAAqD;CAChE,YAAY;CACZ,aAAa;CACb,YAAY,CAAC;EAAE,IAAI;EAAW,OAAO;EAAW,CAAC;CACjD,QAAQ,EAAE;CACX"}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
require("./chunk-9hOWP6kD.cjs");
|
|
2
|
-
const require_FluidProvider = require("./FluidProvider-BXxRdatZ.cjs");
|
|
3
2
|
const require_products = require("./products-Q7fqnjYK.cjs");
|
|
4
|
-
const
|
|
5
|
-
const
|
|
3
|
+
const require_use_account_clients = require("./use-account-clients-T32HqoLD.cjs");
|
|
4
|
+
const require_AppNavigationContext = require("./AppNavigationContext-Dt02ymnf.cjs");
|
|
5
|
+
const require_src = require("./src-CsjWsZwA.cjs");
|
|
6
6
|
let react = require("react");
|
|
7
7
|
let react_jsx_runtime = require("react/jsx-runtime");
|
|
8
8
|
//#region src/screens/ProductsScreen.tsx
|
|
9
9
|
function ProductsScreen({ background, textColor, accentColor, padding, borderRadius, ...divProps }) {
|
|
10
|
-
const
|
|
10
|
+
const domainClient = require_use_account_clients.useSdkClient();
|
|
11
11
|
const { data: userData } = require_products.useCurrentUser();
|
|
12
12
|
const { currentSlug, navigate } = require_AppNavigationContext.useAppNavigation();
|
|
13
13
|
const productId = (0, react.useMemo)(() => {
|
|
@@ -20,9 +20,9 @@ function ProductsScreen({ background, textColor, accentColor, padding, borderRad
|
|
|
20
20
|
navigate("products");
|
|
21
21
|
}, [navigate]);
|
|
22
22
|
const coreConfig = (0, react.useMemo)(() => ({
|
|
23
|
-
client:
|
|
23
|
+
client: domainClient,
|
|
24
24
|
user: userData ? { id: userData.id } : null
|
|
25
|
-
}), [
|
|
25
|
+
}), [domainClient, userData]);
|
|
26
26
|
const uiConfig = (0, react.useMemo)(() => ({
|
|
27
27
|
user: userData ? {
|
|
28
28
|
id: userData.id,
|
|
@@ -77,4 +77,4 @@ Object.defineProperty(exports, "productsScreenPropertySchema", {
|
|
|
77
77
|
}
|
|
78
78
|
});
|
|
79
79
|
|
|
80
|
-
//# sourceMappingURL=ProductsScreen-
|
|
80
|
+
//# sourceMappingURL=ProductsScreen-CzbRJMF4.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ProductsScreen-CzbRJMF4.cjs","names":["useSdkClient","useCurrentUser","useAppNavigation","ShareablesCoreProvider","ShareablesUIProvider","ProductsApp"],"sources":["../src/screens/ProductsScreen.tsx"],"sourcesContent":["import { useCallback, useMemo, type ComponentProps } from \"react\";\nimport type {\n BackgroundValue,\n BorderRadiusOptions,\n ColorOptions,\n PaddingOptions,\n} from \"../types\";\nimport type { WidgetPropertySchema } from \"../registries/property-schema-types\";\nimport { ShareablesCoreProvider } from \"@fluid-app/shareables-core\";\nimport { ShareablesUIProvider, ProductsApp } from \"@fluid-app/shareables-ui\";\nimport { useCurrentUser } from \"../hooks/use-current-user\";\nimport { useAppNavigation } from \"../shell/AppNavigationContext\";\nimport { useSdkClient } from \"../account/use-account-clients\";\n\ntype ProductsScreenProps = ComponentProps<\"div\"> & {\n background?: BackgroundValue;\n textColor?: ColorOptions;\n accentColor?: ColorOptions;\n padding?: PaddingOptions;\n borderRadius?: BorderRadiusOptions;\n};\n\nexport function ProductsScreen({\n /* eslint-disable @typescript-eslint/no-unused-vars -- destructured to exclude from divProps spread */\n background,\n textColor,\n accentColor,\n padding,\n borderRadius,\n /* eslint-enable @typescript-eslint/no-unused-vars */\n ...divProps\n}: ProductsScreenProps): React.JSX.Element {\n const domainClient = useSdkClient();\n const { data: userData } = useCurrentUser();\n const { currentSlug, navigate } = useAppNavigation();\n\n // Extract product ID from slug: \"products/123\" → \"123\"\n const productId = useMemo(() => {\n const match = currentSlug.match(/^products\\/(.+)/);\n return match?.[1] ?? null;\n }, [currentSlug]);\n\n const handleSelectProduct = useCallback(\n (id: string) => {\n navigate(`products/${id}`);\n },\n [navigate],\n );\n\n const handleBack = useCallback(() => {\n navigate(\"products\");\n }, [navigate]);\n\n const coreConfig = useMemo(\n () => ({\n client: domainClient,\n user: userData ? { id: userData.id } : null,\n }),\n [domainClient, userData],\n );\n\n const uiConfig = useMemo(\n () => ({\n user: userData\n ? {\n id: userData.id,\n company: userData.company\n ? { logo_url: userData.company.logo_url }\n : null,\n }\n : undefined,\n basePath: \"\",\n navigate: (path: string) => {\n navigate(path);\n },\n showToast: (opts: {\n title: string;\n type: \"success\" | \"error\" | \"warning\";\n }) => {\n console.log(`[Products] ${opts.type}: ${opts.title}`);\n },\n }),\n [userData, navigate],\n );\n\n return (\n <div {...divProps} className={`h-full ${divProps.className ?? \"\"}`}>\n <ShareablesCoreProvider config={coreConfig}>\n <ShareablesUIProvider config={uiConfig}>\n <ProductsApp\n countryCode={userData?.country?.iso}\n companyLogoUrl={userData?.company?.logo_url}\n productId={productId}\n onSelectProduct={handleSelectProduct}\n onBack={handleBack}\n />\n </ShareablesUIProvider>\n </ShareablesCoreProvider>\n </div>\n );\n}\n\nexport const productsScreenPropertySchema: WidgetPropertySchema = {\n widgetType: \"ProductsScreen\",\n displayName: \"Products Screen\",\n tabsConfig: [{ id: \"styling\", label: \"Styling\" }],\n fields: [],\n} as const satisfies WidgetPropertySchema;\n"],"mappings":";;;;;;;;AAsBA,SAAgB,eAAe,EAE7B,YACA,WACA,aACA,SACA,cAEA,GAAG,YACsC;CACzC,MAAM,eAAeA,4BAAAA,cAAc;CACnC,MAAM,EAAE,MAAM,aAAaC,iBAAAA,gBAAgB;CAC3C,MAAM,EAAE,aAAa,aAAaC,6BAAAA,kBAAkB;CAGpD,MAAM,aAAA,GAAA,MAAA,eAA0B;AAE9B,SADc,YAAY,MAAM,kBAAkB,GACnC,MAAM;IACpB,CAAC,YAAY,CAAC;CAEjB,MAAM,uBAAA,GAAA,MAAA,cACH,OAAe;AACd,WAAS,YAAY,KAAK;IAE5B,CAAC,SAAS,CACX;CAED,MAAM,cAAA,GAAA,MAAA,mBAA+B;AACnC,WAAS,WAAW;IACnB,CAAC,SAAS,CAAC;CAEd,MAAM,cAAA,GAAA,MAAA,gBACG;EACL,QAAQ;EACR,MAAM,WAAW,EAAE,IAAI,SAAS,IAAI,GAAG;EACxC,GACD,CAAC,cAAc,SAAS,CACzB;CAED,MAAM,YAAA,GAAA,MAAA,gBACG;EACL,MAAM,WACF;GACE,IAAI,SAAS;GACb,SAAS,SAAS,UACd,EAAE,UAAU,SAAS,QAAQ,UAAU,GACvC;GACL,GACD,KAAA;EACJ,UAAU;EACV,WAAW,SAAiB;AAC1B,YAAS,KAAK;;EAEhB,YAAY,SAGN;AACJ,WAAQ,IAAI,cAAc,KAAK,KAAK,IAAI,KAAK,QAAQ;;EAExD,GACD,CAAC,UAAU,SAAS,CACrB;AAED,QACE,iBAAA,GAAA,kBAAA,KAAC,OAAD;EAAK,GAAI;EAAU,WAAW,UAAU,SAAS,aAAa;YAC5D,iBAAA,GAAA,kBAAA,KAACC,YAAAA,wBAAD;GAAwB,QAAQ;aAC9B,iBAAA,GAAA,kBAAA,KAACC,YAAAA,sBAAD;IAAsB,QAAQ;cAC5B,iBAAA,GAAA,kBAAA,KAACC,YAAAA,aAAD;KACE,aAAa,UAAU,SAAS;KAChC,gBAAgB,UAAU,SAAS;KACxB;KACX,iBAAiB;KACjB,QAAQ;KACR,CAAA;IACmB,CAAA;GACA,CAAA;EACrB,CAAA;;AAIV,MAAa,+BAAqD;CAChE,YAAY;CACZ,aAAa;CACb,YAAY,CAAC;EAAE,IAAI;EAAW,OAAO;EAAW,CAAC;CACjD,QAAQ,EAAE;CACX"}
|
|
@@ -27,8 +27,8 @@ require("./SpacerWidget-DyZ49XpL.cjs");
|
|
|
27
27
|
require("./TableWidget-CCEwDiby.cjs");
|
|
28
28
|
require("./ToDoWidget-CrZ9xJV1.cjs");
|
|
29
29
|
require("./VideoWidget-BJrnmHCe.cjs");
|
|
30
|
-
require("./es-
|
|
31
|
-
require("./src-
|
|
32
|
-
const require_ProductsScreen = require("./ProductsScreen-
|
|
30
|
+
require("./es-DfGWLS4J.cjs");
|
|
31
|
+
require("./src-CsjWsZwA.cjs");
|
|
32
|
+
const require_ProductsScreen = require("./ProductsScreen-CzbRJMF4.cjs");
|
|
33
33
|
exports.ProductsScreen = require_ProductsScreen.ProductsScreen;
|
|
34
34
|
exports.productsScreenPropertySchema = require_ProductsScreen.productsScreenPropertySchema;
|
|
@@ -27,6 +27,6 @@ require("./SpacerWidget-DyZ49XpL.cjs");
|
|
|
27
27
|
require("./TableWidget-CCEwDiby.cjs");
|
|
28
28
|
require("./ToDoWidget-CrZ9xJV1.cjs");
|
|
29
29
|
require("./VideoWidget-BJrnmHCe.cjs");
|
|
30
|
-
const require_ProfileScreen = require("./ProfileScreen-
|
|
30
|
+
const require_ProfileScreen = require("./ProfileScreen-CzARNtFJ.cjs");
|
|
31
31
|
exports.ProfileScreen = require_ProfileScreen.ProfileScreen;
|
|
32
32
|
exports.profileScreenPropertySchema = require_ProfileScreen.profileScreenPropertySchema;
|
|
@@ -2,7 +2,8 @@ require("./chunk-9hOWP6kD.cjs");
|
|
|
2
2
|
const require_FluidProvider = require("./FluidProvider-BXxRdatZ.cjs");
|
|
3
3
|
const require_parse_api_errors = require("./parse-api-errors-CAnpE2_r.cjs");
|
|
4
4
|
const require_src = require("./src-bBQo2OdY.cjs");
|
|
5
|
-
const require_use_account_clients = require("./use-account-clients-
|
|
5
|
+
const require_use_account_clients = require("./use-account-clients-T32HqoLD.cjs");
|
|
6
|
+
const require_customers = require("./customers-DIn-CxMl.cjs");
|
|
6
7
|
let react = require("react");
|
|
7
8
|
let _tanstack_react_query = require("@tanstack/react-query");
|
|
8
9
|
let react_jsx_runtime = require("react/jsx-runtime");
|
|
@@ -2489,7 +2490,7 @@ function ProfileContentScreen({ onToast, countryIso }) {
|
|
|
2489
2490
|
const userId = user?.id;
|
|
2490
2491
|
const { data: accountData, isLoading: isLoadingAccount, isError: isAccountError } = (0, _tanstack_react_query.useQuery)({
|
|
2491
2492
|
queryKey: ["fluidPayAccount", userId],
|
|
2492
|
-
queryFn: () =>
|
|
2493
|
+
queryFn: () => require_customers.fetchCustomerAccount(client, jwt),
|
|
2493
2494
|
enabled: !!jwt
|
|
2494
2495
|
});
|
|
2495
2496
|
const { data: addressesData, isLoading: isLoadingAddresses } = (0, _tanstack_react_query.useQuery)({
|
|
@@ -2520,7 +2521,7 @@ function ProfileContentScreen({ onToast, countryIso }) {
|
|
|
2520
2521
|
const updateCustomerMutation = (0, _tanstack_react_query.useMutation)({
|
|
2521
2522
|
mutationFn: (data) => {
|
|
2522
2523
|
const languageIso = adaptedLanguages?.find((l) => l.name === data.language)?.iso ?? "en";
|
|
2523
|
-
return
|
|
2524
|
+
return require_customers.updateCustomer(client, jwt, {
|
|
2524
2525
|
first_name: data.first_name,
|
|
2525
2526
|
last_name: data.last_name,
|
|
2526
2527
|
phone: data.phone_number,
|
|
@@ -2769,4 +2770,4 @@ Object.defineProperty(exports, "profileScreenPropertySchema", {
|
|
|
2769
2770
|
}
|
|
2770
2771
|
});
|
|
2771
2772
|
|
|
2772
|
-
//# sourceMappingURL=ProfileScreen-
|
|
2773
|
+
//# sourceMappingURL=ProfileScreen-CzARNtFJ.cjs.map
|