@open-mercato/core 0.6.1-develop.3276.1.1fcd145078 → 0.6.1-develop.3287.1.450f4ffb56
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/.turbo/turbo-build.log +2 -2
- package/dist/generated/entities/domain_mapping/index.js +31 -0
- package/dist/generated/entities/domain_mapping/index.js.map +7 -0
- package/dist/generated/entities.ids.generated.js +2 -1
- package/dist/generated/entities.ids.generated.js.map +2 -2
- package/dist/generated/entity-fields-registry.js +16 -0
- package/dist/generated/entity-fields-registry.js.map +2 -2
- package/dist/helpers/integration/auth.js +1 -1
- package/dist/helpers/integration/auth.js.map +2 -2
- package/dist/helpers/integration/authUi.js +1 -1
- package/dist/helpers/integration/authUi.js.map +2 -2
- package/dist/helpers/integration/salesUi.js +18 -17
- package/dist/helpers/integration/salesUi.js.map +2 -2
- package/dist/modules/auth/frontend/login.js +4 -4
- package/dist/modules/auth/frontend/login.js.map +2 -2
- package/dist/modules/auth/frontend/reset/[token]/page.js +5 -5
- package/dist/modules/auth/frontend/reset/[token]/page.js.map +2 -2
- package/dist/modules/auth/frontend/reset.js +2 -2
- package/dist/modules/auth/frontend/reset.js.map +2 -2
- package/dist/modules/customer_accounts/acl.js +2 -1
- package/dist/modules/customer_accounts/acl.js.map +2 -2
- package/dist/modules/customer_accounts/api/admin/domain-mappings/[id]/health-check.js +110 -0
- package/dist/modules/customer_accounts/api/admin/domain-mappings/[id]/health-check.js.map +7 -0
- package/dist/modules/customer_accounts/api/admin/domain-mappings/[id]/verify.js +114 -0
- package/dist/modules/customer_accounts/api/admin/domain-mappings/[id]/verify.js.map +7 -0
- package/dist/modules/customer_accounts/api/admin/domain-mappings.js +271 -0
- package/dist/modules/customer_accounts/api/admin/domain-mappings.js.map +7 -0
- package/dist/modules/customer_accounts/api/domain-check.js +70 -0
- package/dist/modules/customer_accounts/api/domain-check.js.map +7 -0
- package/dist/modules/customer_accounts/api/domain-resolve/all.js +128 -0
- package/dist/modules/customer_accounts/api/domain-resolve/all.js.map +7 -0
- package/dist/modules/customer_accounts/api/domain-resolve.js +84 -0
- package/dist/modules/customer_accounts/api/domain-resolve.js.map +7 -0
- package/dist/modules/customer_accounts/api/login.js +14 -3
- package/dist/modules/customer_accounts/api/login.js.map +2 -2
- package/dist/modules/customer_accounts/api/magic-link/request.js +14 -3
- package/dist/modules/customer_accounts/api/magic-link/request.js.map +2 -2
- package/dist/modules/customer_accounts/api/password/reset-request.js +14 -3
- package/dist/modules/customer_accounts/api/password/reset-request.js.map +2 -2
- package/dist/modules/customer_accounts/api/signup.js +32 -5
- package/dist/modules/customer_accounts/api/signup.js.map +2 -2
- package/dist/modules/customer_accounts/backend/customer_accounts/settings/domain/components/Actions.js +48 -0
- package/dist/modules/customer_accounts/backend/customer_accounts/settings/domain/components/Actions.js.map +7 -0
- package/dist/modules/customer_accounts/backend/customer_accounts/settings/domain/components/Diagnostics.js +43 -0
- package/dist/modules/customer_accounts/backend/customer_accounts/settings/domain/components/Diagnostics.js.map +7 -0
- package/dist/modules/customer_accounts/backend/customer_accounts/settings/domain/components/DnsConfig.js +53 -0
- package/dist/modules/customer_accounts/backend/customer_accounts/settings/domain/components/DnsConfig.js.map +7 -0
- package/dist/modules/customer_accounts/backend/customer_accounts/settings/domain/components/DomainPanel.js +69 -0
- package/dist/modules/customer_accounts/backend/customer_accounts/settings/domain/components/DomainPanel.js.map +7 -0
- package/dist/modules/customer_accounts/backend/customer_accounts/settings/domain/components/OrgSwitcher.js +31 -0
- package/dist/modules/customer_accounts/backend/customer_accounts/settings/domain/components/OrgSwitcher.js.map +7 -0
- package/dist/modules/customer_accounts/backend/customer_accounts/settings/domain/components/RegisterDialog.js +147 -0
- package/dist/modules/customer_accounts/backend/customer_accounts/settings/domain/components/RegisterDialog.js.map +7 -0
- package/dist/modules/customer_accounts/backend/customer_accounts/settings/domain/components/StatusBadgeSection.js +39 -0
- package/dist/modules/customer_accounts/backend/customer_accounts/settings/domain/components/StatusBadgeSection.js.map +7 -0
- package/dist/modules/customer_accounts/backend/customer_accounts/settings/domain/components/Stepper.js +60 -0
- package/dist/modules/customer_accounts/backend/customer_accounts/settings/domain/components/Stepper.js.map +7 -0
- package/dist/modules/customer_accounts/backend/customer_accounts/settings/domain/components/domainStatusMap.js +11 -0
- package/dist/modules/customer_accounts/backend/customer_accounts/settings/domain/components/domainStatusMap.js.map +7 -0
- package/dist/modules/customer_accounts/backend/customer_accounts/settings/domain/components/types.js +1 -0
- package/dist/modules/customer_accounts/backend/customer_accounts/settings/domain/components/types.js.map +7 -0
- package/dist/modules/customer_accounts/backend/customer_accounts/settings/domain/page.js +361 -0
- package/dist/modules/customer_accounts/backend/customer_accounts/settings/domain/page.js.map +7 -0
- package/dist/modules/customer_accounts/backend/customer_accounts/settings/domain/page.meta.js +28 -0
- package/dist/modules/customer_accounts/backend/customer_accounts/settings/domain/page.meta.js.map +7 -0
- package/dist/modules/customer_accounts/backend/customer_accounts/users/[id]/page.js +4 -3
- package/dist/modules/customer_accounts/backend/customer_accounts/users/[id]/page.js.map +2 -2
- package/dist/modules/customer_accounts/backend/customer_accounts/users/page.js +6 -5
- package/dist/modules/customer_accounts/backend/customer_accounts/users/page.js.map +2 -2
- package/dist/modules/customer_accounts/data/enrichers.js +78 -12
- package/dist/modules/customer_accounts/data/enrichers.js.map +2 -2
- package/dist/modules/customer_accounts/data/entities.js +85 -2
- package/dist/modules/customer_accounts/data/entities.js.map +2 -2
- package/dist/modules/customer_accounts/data/guards.js +130 -0
- package/dist/modules/customer_accounts/data/guards.js.map +7 -0
- package/dist/modules/customer_accounts/data/validators.js +19 -0
- package/dist/modules/customer_accounts/data/validators.js.map +2 -2
- package/dist/modules/customer_accounts/di.js +23 -1
- package/dist/modules/customer_accounts/di.js.map +2 -2
- package/dist/modules/customer_accounts/events.js +9 -2
- package/dist/modules/customer_accounts/events.js.map +2 -2
- package/dist/modules/customer_accounts/lib/customerAuthServer.js +27 -7
- package/dist/modules/customer_accounts/lib/customerAuthServer.js.map +2 -2
- package/dist/modules/customer_accounts/lib/customerUrl.js +48 -0
- package/dist/modules/customer_accounts/lib/customerUrl.js.map +7 -0
- package/dist/modules/customer_accounts/lib/hostname.js +55 -0
- package/dist/modules/customer_accounts/lib/hostname.js.map +7 -0
- package/dist/modules/customer_accounts/lib/platformDomains.js +7 -0
- package/dist/modules/customer_accounts/lib/platformDomains.js.map +7 -0
- package/dist/modules/customer_accounts/lib/proxyRanges.js +71 -0
- package/dist/modules/customer_accounts/lib/proxyRanges.js.map +7 -0
- package/dist/modules/customer_accounts/lib/rateLimiter.js +7 -0
- package/dist/modules/customer_accounts/lib/rateLimiter.js.map +2 -2
- package/dist/modules/customer_accounts/lib/resolveTenantContext.js +63 -0
- package/dist/modules/customer_accounts/lib/resolveTenantContext.js.map +7 -0
- package/dist/modules/customer_accounts/lib/secretCompare.js +13 -0
- package/dist/modules/customer_accounts/lib/secretCompare.js.map +7 -0
- package/dist/modules/customer_accounts/migrations/Migration20260430120000_customer_accounts.js +37 -0
- package/dist/modules/customer_accounts/migrations/Migration20260430120000_customer_accounts.js.map +7 -0
- package/dist/modules/customer_accounts/notifications.client.js +76 -0
- package/dist/modules/customer_accounts/notifications.client.js.map +2 -2
- package/dist/modules/customer_accounts/notifications.js +76 -0
- package/dist/modules/customer_accounts/notifications.js.map +2 -2
- package/dist/modules/customer_accounts/services/domainMappingService.js +497 -0
- package/dist/modules/customer_accounts/services/domainMappingService.js.map +7 -0
- package/dist/modules/customer_accounts/setup.js +48 -1
- package/dist/modules/customer_accounts/setup.js.map +2 -2
- package/dist/modules/customer_accounts/subscribers/invalidateDomainCache.js +29 -0
- package/dist/modules/customer_accounts/subscribers/invalidateDomainCache.js.map +7 -0
- package/dist/modules/customer_accounts/subscribers/notifyDomainActivated.js +29 -0
- package/dist/modules/customer_accounts/subscribers/notifyDomainActivated.js.map +7 -0
- package/dist/modules/customer_accounts/subscribers/notifyDomainDnsFailed.js +30 -0
- package/dist/modules/customer_accounts/subscribers/notifyDomainDnsFailed.js.map +7 -0
- package/dist/modules/customer_accounts/subscribers/notifyDomainTlsFailed.js +31 -0
- package/dist/modules/customer_accounts/subscribers/notifyDomainTlsFailed.js.map +7 -0
- package/dist/modules/customer_accounts/subscribers/notifyDomainVerified.js +29 -0
- package/dist/modules/customer_accounts/subscribers/notifyDomainVerified.js.map +7 -0
- package/dist/modules/customer_accounts/widgets/injection/account-status/widget.client.js +2 -2
- package/dist/modules/customer_accounts/widgets/injection/account-status/widget.client.js.map +2 -2
- package/dist/modules/customer_accounts/workers/domainTlsRetryWorker.js +67 -0
- package/dist/modules/customer_accounts/workers/domainTlsRetryWorker.js.map +7 -0
- package/dist/modules/customer_accounts/workers/domainVerificationWorker.js +34 -0
- package/dist/modules/customer_accounts/workers/domainVerificationWorker.js.map +7 -0
- package/dist/modules/customers/api/companies/route.js +4 -9
- package/dist/modules/customers/api/companies/route.js.map +2 -2
- package/dist/modules/customers/api/deals/route.js +4 -9
- package/dist/modules/customers/api/deals/route.js.map +2 -2
- package/dist/modules/customers/api/people/route.js +4 -9
- package/dist/modules/customers/api/people/route.js.map +2 -2
- package/dist/modules/customers/api/utils.js +0 -12
- package/dist/modules/customers/api/utils.js.map +2 -2
- package/dist/modules/customers/backend/customers/companies/page.js +361 -284
- package/dist/modules/customers/backend/customers/companies/page.js.map +2 -2
- package/dist/modules/customers/backend/customers/deals/page.js +378 -473
- package/dist/modules/customers/backend/customers/deals/page.js.map +2 -2
- package/dist/modules/customers/backend/customers/people/page.js +368 -286
- package/dist/modules/customers/backend/customers/people/page.js.map +2 -2
- package/dist/modules/customers/components/detail/assignableStaff.js +15 -1
- package/dist/modules/customers/components/detail/assignableStaff.js.map +2 -2
- package/dist/modules/customers/components/formConfig.js +2 -2
- package/dist/modules/customers/components/formConfig.js.map +2 -2
- package/dist/modules/customers/widgets/injection/ai-assistant-trigger/widget.client.js +188 -36
- package/dist/modules/customers/widgets/injection/ai-assistant-trigger/widget.client.js.map +2 -2
- package/dist/modules/customers/widgets/injection/ai-assistant-trigger/widget.js +2 -2
- package/dist/modules/customers/widgets/injection/ai-assistant-trigger/widget.js.map +2 -2
- package/dist/modules/customers/widgets/injection-table.js +6 -0
- package/dist/modules/customers/widgets/injection-table.js.map +2 -2
- package/dist/modules/integrations/backend/integrations/[id]/page.js +2 -3
- package/dist/modules/integrations/backend/integrations/[id]/page.js.map +2 -2
- package/dist/modules/perspectives/services/perspectiveService.js +16 -2
- package/dist/modules/perspectives/services/perspectiveService.js.map +2 -2
- package/dist/modules/portal/frontend/[orgSlug]/portal/login/page.js +5 -3
- package/dist/modules/portal/frontend/[orgSlug]/portal/login/page.js.map +2 -2
- package/dist/modules/portal/frontend/[orgSlug]/portal/reset-password/page.js +3 -3
- package/dist/modules/portal/frontend/[orgSlug]/portal/reset-password/page.js.map +2 -2
- package/dist/modules/portal/frontend/[orgSlug]/portal/signup/page.js +4 -2
- package/dist/modules/portal/frontend/[orgSlug]/portal/signup/page.js.map +2 -2
- package/dist/modules/query_index/lib/engine.js +31 -8
- package/dist/modules/query_index/lib/engine.js.map +2 -2
- package/dist/modules/sales/backend/sales/documents/[id]/page.js +3 -5
- package/dist/modules/sales/backend/sales/documents/[id]/page.js.map +2 -2
- package/dist/modules/sales/components/ProviderFieldInput.js +2 -2
- package/dist/modules/sales/components/ProviderFieldInput.js.map +2 -2
- package/dist/modules/sales/components/documents/SalesDocumentForm.js +3 -4
- package/dist/modules/sales/components/documents/SalesDocumentForm.js.map +2 -2
- package/dist/modules/shipping_carriers/lib/shipment-wizard/components/ConfigureStep.js +3 -4
- package/dist/modules/shipping_carriers/lib/shipment-wizard/components/ConfigureStep.js.map +2 -2
- package/dist/modules/workflows/backend/tasks/[id]/page.js +2 -2
- package/dist/modules/workflows/backend/tasks/[id]/page.js.map +2 -2
- package/dist/modules/workflows/frontend/checkout-demo/page.js +2 -2
- package/dist/modules/workflows/frontend/checkout-demo/page.js.map +2 -2
- package/generated/entities/domain_mapping/index.ts +14 -0
- package/generated/entities.ids.generated.ts +2 -1
- package/generated/entity-fields-registry.ts +16 -0
- package/package.json +5 -5
- package/src/helpers/integration/auth.ts +1 -1
- package/src/helpers/integration/authUi.ts +1 -1
- package/src/helpers/integration/salesUi.ts +27 -23
- package/src/modules/auth/frontend/login.tsx +4 -3
- package/src/modules/auth/frontend/reset/[token]/page.tsx +4 -4
- package/src/modules/auth/frontend/reset.tsx +2 -2
- package/src/modules/customer_accounts/acl.ts +1 -0
- package/src/modules/customer_accounts/api/admin/domain-mappings/[id]/health-check.ts +119 -0
- package/src/modules/customer_accounts/api/admin/domain-mappings/[id]/verify.ts +123 -0
- package/src/modules/customer_accounts/api/admin/domain-mappings.ts +303 -0
- package/src/modules/customer_accounts/api/domain-check.ts +83 -0
- package/src/modules/customer_accounts/api/domain-resolve/all.ts +139 -0
- package/src/modules/customer_accounts/api/domain-resolve.ts +91 -0
- package/src/modules/customer_accounts/api/login.ts +14 -3
- package/src/modules/customer_accounts/api/magic-link/request.ts +14 -3
- package/src/modules/customer_accounts/api/password/reset-request.ts +15 -3
- package/src/modules/customer_accounts/api/signup.ts +36 -5
- package/src/modules/customer_accounts/backend/customer_accounts/settings/domain/components/Actions.tsx +70 -0
- package/src/modules/customer_accounts/backend/customer_accounts/settings/domain/components/Diagnostics.tsx +66 -0
- package/src/modules/customer_accounts/backend/customer_accounts/settings/domain/components/DnsConfig.tsx +78 -0
- package/src/modules/customer_accounts/backend/customer_accounts/settings/domain/components/DomainPanel.tsx +90 -0
- package/src/modules/customer_accounts/backend/customer_accounts/settings/domain/components/OrgSwitcher.tsx +43 -0
- package/src/modules/customer_accounts/backend/customer_accounts/settings/domain/components/RegisterDialog.tsx +178 -0
- package/src/modules/customer_accounts/backend/customer_accounts/settings/domain/components/StatusBadgeSection.tsx +56 -0
- package/src/modules/customer_accounts/backend/customer_accounts/settings/domain/components/Stepper.tsx +69 -0
- package/src/modules/customer_accounts/backend/customer_accounts/settings/domain/components/domainStatusMap.ts +10 -0
- package/src/modules/customer_accounts/backend/customer_accounts/settings/domain/components/types.ts +31 -0
- package/src/modules/customer_accounts/backend/customer_accounts/settings/domain/page.meta.ts +26 -0
- package/src/modules/customer_accounts/backend/customer_accounts/settings/domain/page.tsx +411 -0
- package/src/modules/customer_accounts/backend/customer_accounts/users/[id]/page.tsx +3 -2
- package/src/modules/customer_accounts/backend/customer_accounts/users/page.tsx +5 -4
- package/src/modules/customer_accounts/data/enrichers.ts +95 -12
- package/src/modules/customer_accounts/data/entities.ts +80 -1
- package/src/modules/customer_accounts/data/guards.ts +155 -0
- package/src/modules/customer_accounts/data/validators.ts +26 -0
- package/src/modules/customer_accounts/di.ts +35 -1
- package/src/modules/customer_accounts/events.ts +8 -1
- package/src/modules/customer_accounts/i18n/de.json +78 -0
- package/src/modules/customer_accounts/i18n/en.json +78 -0
- package/src/modules/customer_accounts/i18n/es.json +78 -0
- package/src/modules/customer_accounts/i18n/pl.json +78 -0
- package/src/modules/customer_accounts/lib/customerAuthServer.ts +44 -8
- package/src/modules/customer_accounts/lib/customerUrl.ts +72 -0
- package/src/modules/customer_accounts/lib/hostname.ts +76 -0
- package/src/modules/customer_accounts/lib/platformDomains.ts +14 -0
- package/src/modules/customer_accounts/lib/proxyRanges.ts +85 -0
- package/src/modules/customer_accounts/lib/rateLimiter.ts +10 -0
- package/src/modules/customer_accounts/lib/resolveTenantContext.ts +96 -0
- package/src/modules/customer_accounts/lib/secretCompare.ts +20 -0
- package/src/modules/customer_accounts/migrations/.snapshot-open-mercato.json +341 -0
- package/src/modules/customer_accounts/migrations/Migration20260430120000_customer_accounts.ts +38 -0
- package/src/modules/customer_accounts/notifications.client.ts +76 -0
- package/src/modules/customer_accounts/notifications.ts +76 -0
- package/src/modules/customer_accounts/services/domainMappingService.ts +632 -0
- package/src/modules/customer_accounts/setup.ts +81 -1
- package/src/modules/customer_accounts/subscribers/invalidateDomainCache.ts +35 -0
- package/src/modules/customer_accounts/subscribers/notifyDomainActivated.ts +32 -0
- package/src/modules/customer_accounts/subscribers/notifyDomainDnsFailed.ts +33 -0
- package/src/modules/customer_accounts/subscribers/notifyDomainTlsFailed.ts +34 -0
- package/src/modules/customer_accounts/subscribers/notifyDomainVerified.ts +32 -0
- package/src/modules/customer_accounts/widgets/injection/account-status/widget.client.tsx +2 -2
- package/src/modules/customer_accounts/workers/domainTlsRetryWorker.ts +84 -0
- package/src/modules/customer_accounts/workers/domainVerificationWorker.ts +45 -0
- package/src/modules/customers/api/companies/route.ts +4 -9
- package/src/modules/customers/api/deals/route.ts +4 -9
- package/src/modules/customers/api/people/route.ts +4 -9
- package/src/modules/customers/api/utils.ts +0 -14
- package/src/modules/customers/backend/customers/companies/page.tsx +321 -237
- package/src/modules/customers/backend/customers/deals/page.tsx +321 -455
- package/src/modules/customers/backend/customers/people/page.tsx +331 -240
- package/src/modules/customers/components/detail/assignableStaff.ts +21 -0
- package/src/modules/customers/components/formConfig.tsx +2 -2
- package/src/modules/customers/i18n/de.json +31 -0
- package/src/modules/customers/i18n/en.json +31 -0
- package/src/modules/customers/i18n/es.json +31 -0
- package/src/modules/customers/i18n/pl.json +31 -0
- package/src/modules/customers/widgets/injection/ai-assistant-trigger/widget.client.tsx +197 -40
- package/src/modules/customers/widgets/injection/ai-assistant-trigger/widget.ts +13 -7
- package/src/modules/customers/widgets/injection-table.ts +6 -0
- package/src/modules/integrations/backend/integrations/[id]/page.tsx +2 -2
- package/src/modules/perspectives/services/perspectiveService.ts +30 -2
- package/src/modules/portal/frontend/[orgSlug]/portal/login/page.tsx +5 -3
- package/src/modules/portal/frontend/[orgSlug]/portal/reset-password/page.tsx +3 -3
- package/src/modules/portal/frontend/[orgSlug]/portal/signup/page.tsx +4 -2
- package/src/modules/query_index/lib/engine.ts +46 -8
- package/src/modules/sales/backend/sales/documents/[id]/page.tsx +3 -5
- package/src/modules/sales/components/ProviderFieldInput.tsx +2 -2
- package/src/modules/sales/components/documents/SalesDocumentForm.tsx +2 -3
- package/src/modules/shipping_carriers/lib/shipment-wizard/components/ConfigureStep.tsx +3 -4
- package/src/modules/workflows/backend/tasks/[id]/page.tsx +2 -2
- package/src/modules/workflows/frontend/checkout-demo/page.tsx +2 -2
|
@@ -0,0 +1,361 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
import { useRouter, useSearchParams } from "next/navigation";
|
|
5
|
+
import { Globe } from "lucide-react";
|
|
6
|
+
import { Page, PageBody } from "@open-mercato/ui/backend/Page";
|
|
7
|
+
import { FormHeader } from "@open-mercato/ui/backend/forms";
|
|
8
|
+
import { EmptyState } from "@open-mercato/ui/backend/EmptyState";
|
|
9
|
+
import { LoadingMessage, ErrorMessage } from "@open-mercato/ui/backend/detail";
|
|
10
|
+
import { Button } from "@open-mercato/ui/primitives/button";
|
|
11
|
+
import { apiCall } from "@open-mercato/ui/backend/utils/apiCall";
|
|
12
|
+
import { flash } from "@open-mercato/ui/backend/FlashMessages";
|
|
13
|
+
import { useT } from "@open-mercato/shared/lib/i18n/context";
|
|
14
|
+
import { useConfirmDialog } from "@open-mercato/ui/backend/confirm-dialog";
|
|
15
|
+
import { useGuardedMutation } from "@open-mercato/ui/backend/injection/useGuardedMutation";
|
|
16
|
+
import { useAppEvent } from "@open-mercato/ui/backend/injection/useAppEvent";
|
|
17
|
+
import { OrgSwitcher } from "./components/OrgSwitcher.js";
|
|
18
|
+
import { DomainPanel } from "./components/DomainPanel.js";
|
|
19
|
+
import { RegisterDialog } from "./components/RegisterDialog.js";
|
|
20
|
+
const STATE_LOADING = "loading";
|
|
21
|
+
const STATE_LOADED = "loaded";
|
|
22
|
+
const STATE_ERROR = "error";
|
|
23
|
+
function flattenOrgNodes(nodes, acc = [], depth = 0) {
|
|
24
|
+
if (!nodes) return acc;
|
|
25
|
+
for (const node of nodes) {
|
|
26
|
+
if (node.selectable) {
|
|
27
|
+
acc.push({ id: node.id, label: node.name, depth });
|
|
28
|
+
}
|
|
29
|
+
flattenOrgNodes(node.children, acc, depth + 1);
|
|
30
|
+
}
|
|
31
|
+
return acc;
|
|
32
|
+
}
|
|
33
|
+
function CustomerDomainSettingsPage() {
|
|
34
|
+
const t = useT();
|
|
35
|
+
const router = useRouter();
|
|
36
|
+
const searchParams = useSearchParams();
|
|
37
|
+
const [orgOptions, setOrgOptions] = React.useState([]);
|
|
38
|
+
const [defaultOrgId, setDefaultOrgId] = React.useState(null);
|
|
39
|
+
const [orgsLoaded, setOrgsLoaded] = React.useState(false);
|
|
40
|
+
const urlOrgId = searchParams?.get("org") ?? null;
|
|
41
|
+
const selectedOrgId = urlOrgId ?? defaultOrgId;
|
|
42
|
+
const [mappings, setMappings] = React.useState([]);
|
|
43
|
+
const [config, setConfig] = React.useState({ cnameTarget: null, aRecordTarget: null });
|
|
44
|
+
const [loadState, setLoadState] = React.useState(STATE_LOADING);
|
|
45
|
+
const [reloadToken, setReloadToken] = React.useState(0);
|
|
46
|
+
const [registerOpen, setRegisterOpen] = React.useState(false);
|
|
47
|
+
const [registerMode, setRegisterMode] = React.useState("register");
|
|
48
|
+
const [replaceTargetId, setReplaceTargetId] = React.useState(null);
|
|
49
|
+
const [isMutating, setIsMutating] = React.useState(false);
|
|
50
|
+
const { confirm, ConfirmDialogElement } = useConfirmDialog();
|
|
51
|
+
const { runMutation } = useGuardedMutation({
|
|
52
|
+
contextId: "customer_accounts:domain-settings"
|
|
53
|
+
});
|
|
54
|
+
const runMutationWithContext = React.useCallback(
|
|
55
|
+
async (operation, mutationPayload) => {
|
|
56
|
+
return runMutation({
|
|
57
|
+
operation,
|
|
58
|
+
mutationPayload,
|
|
59
|
+
context: { entityType: "customer_accounts:domain_mapping" }
|
|
60
|
+
});
|
|
61
|
+
},
|
|
62
|
+
[runMutation]
|
|
63
|
+
);
|
|
64
|
+
const refresh = React.useCallback(() => {
|
|
65
|
+
setReloadToken((token) => token + 1);
|
|
66
|
+
}, []);
|
|
67
|
+
React.useEffect(() => {
|
|
68
|
+
let cancelled = false;
|
|
69
|
+
async function loadOrgs() {
|
|
70
|
+
try {
|
|
71
|
+
const call = await apiCall("/api/directory/organization-switcher");
|
|
72
|
+
if (cancelled) return;
|
|
73
|
+
if (!call.ok || !call.result) {
|
|
74
|
+
setOrgOptions([]);
|
|
75
|
+
setDefaultOrgId(null);
|
|
76
|
+
return;
|
|
77
|
+
}
|
|
78
|
+
const flat = flattenOrgNodes(call.result.items, [], 0);
|
|
79
|
+
setOrgOptions(flat);
|
|
80
|
+
const fallback = call.result.selectedId ?? (flat[0]?.id ?? null);
|
|
81
|
+
setDefaultOrgId(fallback);
|
|
82
|
+
} catch {
|
|
83
|
+
if (!cancelled) {
|
|
84
|
+
setOrgOptions([]);
|
|
85
|
+
setDefaultOrgId(null);
|
|
86
|
+
}
|
|
87
|
+
} finally {
|
|
88
|
+
if (!cancelled) setOrgsLoaded(true);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
loadOrgs();
|
|
92
|
+
return () => {
|
|
93
|
+
cancelled = true;
|
|
94
|
+
};
|
|
95
|
+
}, []);
|
|
96
|
+
React.useEffect(() => {
|
|
97
|
+
if (!orgsLoaded) return;
|
|
98
|
+
if (!selectedOrgId) {
|
|
99
|
+
setMappings([]);
|
|
100
|
+
setConfig({ cnameTarget: null, aRecordTarget: null });
|
|
101
|
+
setLoadState(STATE_LOADED);
|
|
102
|
+
return;
|
|
103
|
+
}
|
|
104
|
+
let cancelled = false;
|
|
105
|
+
async function load() {
|
|
106
|
+
setLoadState(STATE_LOADING);
|
|
107
|
+
try {
|
|
108
|
+
const call = await apiCall(
|
|
109
|
+
`/api/customer_accounts/admin/domain-mappings?organizationId=${encodeURIComponent(selectedOrgId)}`
|
|
110
|
+
);
|
|
111
|
+
if (cancelled) return;
|
|
112
|
+
if (!call.ok || !call.result?.ok) {
|
|
113
|
+
setLoadState(STATE_ERROR);
|
|
114
|
+
return;
|
|
115
|
+
}
|
|
116
|
+
setMappings(Array.isArray(call.result.domainMappings) ? call.result.domainMappings : []);
|
|
117
|
+
setConfig(call.result.config ?? { cnameTarget: null, aRecordTarget: null });
|
|
118
|
+
setLoadState(STATE_LOADED);
|
|
119
|
+
} catch {
|
|
120
|
+
if (!cancelled) setLoadState(STATE_ERROR);
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
load();
|
|
124
|
+
return () => {
|
|
125
|
+
cancelled = true;
|
|
126
|
+
};
|
|
127
|
+
}, [orgsLoaded, selectedOrgId, reloadToken]);
|
|
128
|
+
useAppEvent("customer_accounts.domain_mapping.*", () => {
|
|
129
|
+
refresh();
|
|
130
|
+
}, [refresh]);
|
|
131
|
+
const orderedMappings = React.useMemo(() => {
|
|
132
|
+
if (mappings.length === 0) return [];
|
|
133
|
+
const sorted = [...mappings].sort((a, b) => {
|
|
134
|
+
const aActive = a.status === "active" ? 0 : 1;
|
|
135
|
+
const bActive = b.status === "active" ? 0 : 1;
|
|
136
|
+
if (aActive !== bActive) return aActive - bActive;
|
|
137
|
+
return new Date(a.createdAt).getTime() - new Date(b.createdAt).getTime();
|
|
138
|
+
});
|
|
139
|
+
return sorted;
|
|
140
|
+
}, [mappings]);
|
|
141
|
+
const primaryActiveId = React.useMemo(() => {
|
|
142
|
+
const active = orderedMappings.find((m) => m.status === "active");
|
|
143
|
+
if (active) return active.id;
|
|
144
|
+
return orderedMappings[0]?.id ?? null;
|
|
145
|
+
}, [orderedMappings]);
|
|
146
|
+
const handleOrgChange = React.useCallback(
|
|
147
|
+
(next) => {
|
|
148
|
+
const params = new URLSearchParams(searchParams?.toString() ?? "");
|
|
149
|
+
if (next) params.set("org", next);
|
|
150
|
+
else params.delete("org");
|
|
151
|
+
const qs = params.toString();
|
|
152
|
+
router.replace(qs ? `?${qs}` : "?", { scroll: false });
|
|
153
|
+
},
|
|
154
|
+
[router, searchParams]
|
|
155
|
+
);
|
|
156
|
+
const handleOpenRegister = React.useCallback(() => {
|
|
157
|
+
setRegisterMode("register");
|
|
158
|
+
setReplaceTargetId(null);
|
|
159
|
+
setRegisterOpen(true);
|
|
160
|
+
}, []);
|
|
161
|
+
const handleOpenChange = React.useCallback((mappingId) => {
|
|
162
|
+
setRegisterMode("change");
|
|
163
|
+
setReplaceTargetId(mappingId);
|
|
164
|
+
setRegisterOpen(true);
|
|
165
|
+
}, []);
|
|
166
|
+
const handleSubmitRegister = React.useCallback(
|
|
167
|
+
async (hostname) => {
|
|
168
|
+
if (!selectedOrgId) {
|
|
169
|
+
throw new Error(t("customer_accounts.domainMapping.error.load", "Could not load custom-domain configuration"));
|
|
170
|
+
}
|
|
171
|
+
setIsMutating(true);
|
|
172
|
+
try {
|
|
173
|
+
await runMutationWithContext(async () => {
|
|
174
|
+
const body = {
|
|
175
|
+
hostname,
|
|
176
|
+
organizationId: selectedOrgId
|
|
177
|
+
};
|
|
178
|
+
if (registerMode === "change" && replaceTargetId) {
|
|
179
|
+
body.replacesDomainId = replaceTargetId;
|
|
180
|
+
}
|
|
181
|
+
const call = await apiCall(
|
|
182
|
+
"/api/customer_accounts/admin/domain-mappings",
|
|
183
|
+
{
|
|
184
|
+
method: "POST",
|
|
185
|
+
headers: { "content-type": "application/json" },
|
|
186
|
+
body: JSON.stringify(body)
|
|
187
|
+
}
|
|
188
|
+
);
|
|
189
|
+
if (!call.ok || !call.result?.ok) {
|
|
190
|
+
const message = call.result?.error || t("customer_accounts.domainMapping.alreadyClaimed", "This domain is not available. Please choose a different hostname.");
|
|
191
|
+
throw new Error(message);
|
|
192
|
+
}
|
|
193
|
+
flash(t("customer_accounts.domainMapping.registered", "Domain registered successfully"), "success");
|
|
194
|
+
setRegisterOpen(false);
|
|
195
|
+
refresh();
|
|
196
|
+
});
|
|
197
|
+
} finally {
|
|
198
|
+
setIsMutating(false);
|
|
199
|
+
}
|
|
200
|
+
},
|
|
201
|
+
[refresh, registerMode, replaceTargetId, runMutationWithContext, selectedOrgId, t]
|
|
202
|
+
);
|
|
203
|
+
const handleCheckNow = React.useCallback(
|
|
204
|
+
async (mapping) => {
|
|
205
|
+
setIsMutating(true);
|
|
206
|
+
try {
|
|
207
|
+
await runMutationWithContext(async () => {
|
|
208
|
+
const call = await apiCall(
|
|
209
|
+
`/api/customer_accounts/admin/domain-mappings/${encodeURIComponent(mapping.id)}/verify`,
|
|
210
|
+
{ method: "POST" }
|
|
211
|
+
);
|
|
212
|
+
if (!call.ok || !call.result?.ok) {
|
|
213
|
+
const message = call.result?.error || t("customer_accounts.domainMapping.error.load", "Could not load custom-domain configuration");
|
|
214
|
+
flash(message, "error");
|
|
215
|
+
return;
|
|
216
|
+
}
|
|
217
|
+
refresh();
|
|
218
|
+
});
|
|
219
|
+
} finally {
|
|
220
|
+
setIsMutating(false);
|
|
221
|
+
}
|
|
222
|
+
},
|
|
223
|
+
[refresh, runMutationWithContext, t]
|
|
224
|
+
);
|
|
225
|
+
const handleRetryTls = React.useCallback(
|
|
226
|
+
async (mapping) => {
|
|
227
|
+
setIsMutating(true);
|
|
228
|
+
try {
|
|
229
|
+
await runMutationWithContext(async () => {
|
|
230
|
+
const call = await apiCall(
|
|
231
|
+
`/api/customer_accounts/admin/domain-mappings/${encodeURIComponent(mapping.id)}/health-check`,
|
|
232
|
+
{ method: "POST" }
|
|
233
|
+
);
|
|
234
|
+
if (!call.ok || !call.result?.ok) {
|
|
235
|
+
const message = call.result?.error || t("customer_accounts.domainMapping.error.load", "Could not load custom-domain configuration");
|
|
236
|
+
flash(message, "error");
|
|
237
|
+
return;
|
|
238
|
+
}
|
|
239
|
+
refresh();
|
|
240
|
+
});
|
|
241
|
+
} finally {
|
|
242
|
+
setIsMutating(false);
|
|
243
|
+
}
|
|
244
|
+
},
|
|
245
|
+
[refresh, runMutationWithContext, t]
|
|
246
|
+
);
|
|
247
|
+
const handleRemove = React.useCallback(
|
|
248
|
+
async (mapping) => {
|
|
249
|
+
const replacement = orderedMappings.find(
|
|
250
|
+
(m) => m.id !== mapping.id && m.status !== "active"
|
|
251
|
+
);
|
|
252
|
+
const text = replacement ? t("customer_accounts.domainMapping.removeConfirm.hasReplacement", "This will also cancel the pending replacement domain ({hostname}).", { hostname: replacement.hostname }) : t("customer_accounts.domainMapping.removeConfirm", "Are you sure? Customers using this domain will no longer be able to reach your portal.");
|
|
253
|
+
const confirmed = await confirm({
|
|
254
|
+
title: t("customer_accounts.domainMapping.removeConfirm.title", "Remove custom domain?"),
|
|
255
|
+
text,
|
|
256
|
+
variant: "destructive",
|
|
257
|
+
confirmText: t("customer_accounts.domainMapping.removeDomain", "Remove Domain")
|
|
258
|
+
});
|
|
259
|
+
if (!confirmed) return;
|
|
260
|
+
setIsMutating(true);
|
|
261
|
+
try {
|
|
262
|
+
await runMutationWithContext(async () => {
|
|
263
|
+
const call = await apiCall(
|
|
264
|
+
`/api/customer_accounts/admin/domain-mappings?id=${encodeURIComponent(mapping.id)}`,
|
|
265
|
+
{ method: "DELETE" }
|
|
266
|
+
);
|
|
267
|
+
if (!call.ok || !call.result?.ok) {
|
|
268
|
+
const message = call.result?.error || t("customer_accounts.domainMapping.error.load", "Could not load custom-domain configuration");
|
|
269
|
+
flash(message, "error");
|
|
270
|
+
return;
|
|
271
|
+
}
|
|
272
|
+
flash(t("customer_accounts.domainMapping.removed", "Domain removed"), "success");
|
|
273
|
+
refresh();
|
|
274
|
+
});
|
|
275
|
+
} finally {
|
|
276
|
+
setIsMutating(false);
|
|
277
|
+
}
|
|
278
|
+
},
|
|
279
|
+
[confirm, orderedMappings, refresh, runMutationWithContext, t]
|
|
280
|
+
);
|
|
281
|
+
const replaceTargetHostname = React.useMemo(() => {
|
|
282
|
+
if (registerMode !== "change" || !replaceTargetId) return null;
|
|
283
|
+
return orderedMappings.find((m) => m.id === replaceTargetId)?.hostname ?? null;
|
|
284
|
+
}, [orderedMappings, registerMode, replaceTargetId]);
|
|
285
|
+
return /* @__PURE__ */ jsxs(Page, { children: [
|
|
286
|
+
/* @__PURE__ */ jsx("div", { className: "px-3 py-3 md:px-6 md:py-4", children: /* @__PURE__ */ jsx(
|
|
287
|
+
FormHeader,
|
|
288
|
+
{
|
|
289
|
+
mode: "detail",
|
|
290
|
+
title: t("customer_accounts.domainMapping.title", "Custom Domain"),
|
|
291
|
+
subtitle: t("customer_accounts.domainMapping.description", "Map your own domain to the customer portal"),
|
|
292
|
+
backHref: "/backend/customer_accounts/settings",
|
|
293
|
+
backLabel: t("customer_accounts.settings.title", "Portal Settings")
|
|
294
|
+
}
|
|
295
|
+
) }),
|
|
296
|
+
/* @__PURE__ */ jsxs(PageBody, { className: "space-y-6", children: [
|
|
297
|
+
orgOptions.length > 1 ? /* @__PURE__ */ jsx("div", { className: "flex flex-wrap items-center justify-between gap-3 rounded-lg border bg-card px-4 py-3", children: /* @__PURE__ */ jsx(
|
|
298
|
+
OrgSwitcher,
|
|
299
|
+
{
|
|
300
|
+
options: orgOptions,
|
|
301
|
+
selectedId: selectedOrgId,
|
|
302
|
+
onChange: handleOrgChange
|
|
303
|
+
}
|
|
304
|
+
) }) : null,
|
|
305
|
+
loadState === STATE_LOADING ? /* @__PURE__ */ jsx(LoadingMessage, { label: t("customer_accounts.domainMapping.loading", "Loading domain configuration\u2026") }) : null,
|
|
306
|
+
loadState === STATE_ERROR ? /* @__PURE__ */ jsx(
|
|
307
|
+
ErrorMessage,
|
|
308
|
+
{
|
|
309
|
+
label: t("customer_accounts.domainMapping.error.load", "Could not load custom-domain configuration"),
|
|
310
|
+
action: /* @__PURE__ */ jsx(Button, { type: "button", variant: "outline", size: "sm", onClick: refresh, children: t("customer_accounts.domainMapping.verifyNow", "Check Now") })
|
|
311
|
+
}
|
|
312
|
+
) : null,
|
|
313
|
+
loadState === STATE_LOADED && orderedMappings.length === 0 && selectedOrgId ? /* @__PURE__ */ jsx(
|
|
314
|
+
EmptyState,
|
|
315
|
+
{
|
|
316
|
+
icon: /* @__PURE__ */ jsx(Globe, { className: "h-8 w-8", "aria-hidden": true }),
|
|
317
|
+
title: t("customer_accounts.domainMapping.empty.title", "No custom domain yet"),
|
|
318
|
+
description: t("customer_accounts.domainMapping.empty.description", "Connect your own domain so customers can reach the portal at a branded URL."),
|
|
319
|
+
action: {
|
|
320
|
+
label: t("customer_accounts.domainMapping.empty.cta", "Register Domain"),
|
|
321
|
+
onClick: handleOpenRegister,
|
|
322
|
+
icon: /* @__PURE__ */ jsx(Globe, { className: "h-4 w-4", "aria-hidden": true })
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
) : null,
|
|
326
|
+
loadState === STATE_LOADED && orderedMappings.length > 0 ? /* @__PURE__ */ jsx("div", { className: "space-y-4", children: orderedMappings.map((mapping) => {
|
|
327
|
+
const isReplacement = mapping.id !== primaryActiveId && mapping.status !== "active";
|
|
328
|
+
return /* @__PURE__ */ jsx(
|
|
329
|
+
DomainPanel,
|
|
330
|
+
{
|
|
331
|
+
mapping,
|
|
332
|
+
isReplacement,
|
|
333
|
+
cnameTarget: config.cnameTarget,
|
|
334
|
+
aRecordTarget: config.aRecordTarget,
|
|
335
|
+
busy: isMutating,
|
|
336
|
+
onCheckNow: () => handleCheckNow(mapping),
|
|
337
|
+
onRetryTls: () => handleRetryTls(mapping),
|
|
338
|
+
onChangeDomain: () => handleOpenChange(mapping.id),
|
|
339
|
+
onRemove: () => handleRemove(mapping)
|
|
340
|
+
},
|
|
341
|
+
mapping.id
|
|
342
|
+
);
|
|
343
|
+
}) }) : null
|
|
344
|
+
] }),
|
|
345
|
+
/* @__PURE__ */ jsx(
|
|
346
|
+
RegisterDialog,
|
|
347
|
+
{
|
|
348
|
+
open: registerOpen,
|
|
349
|
+
onOpenChange: setRegisterOpen,
|
|
350
|
+
mode: registerMode,
|
|
351
|
+
currentHostname: replaceTargetHostname,
|
|
352
|
+
onSubmit: handleSubmitRegister
|
|
353
|
+
}
|
|
354
|
+
),
|
|
355
|
+
ConfirmDialogElement
|
|
356
|
+
] });
|
|
357
|
+
}
|
|
358
|
+
export {
|
|
359
|
+
CustomerDomainSettingsPage as default
|
|
360
|
+
};
|
|
361
|
+
//# sourceMappingURL=page.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../../../src/modules/customer_accounts/backend/customer_accounts/settings/domain/page.tsx"],
|
|
4
|
+
"sourcesContent": ["\"use client\"\n\nimport * as React from 'react'\nimport { useRouter, useSearchParams } from 'next/navigation'\nimport { Globe } from 'lucide-react'\nimport { Page, PageBody } from '@open-mercato/ui/backend/Page'\nimport { FormHeader } from '@open-mercato/ui/backend/forms'\nimport { EmptyState } from '@open-mercato/ui/backend/EmptyState'\nimport { LoadingMessage, ErrorMessage } from '@open-mercato/ui/backend/detail'\nimport { Button } from '@open-mercato/ui/primitives/button'\nimport { apiCall } from '@open-mercato/ui/backend/utils/apiCall'\nimport { flash } from '@open-mercato/ui/backend/FlashMessages'\nimport { useT } from '@open-mercato/shared/lib/i18n/context'\nimport { useConfirmDialog } from '@open-mercato/ui/backend/confirm-dialog'\nimport { useGuardedMutation } from '@open-mercato/ui/backend/injection/useGuardedMutation'\nimport { useAppEvent } from '@open-mercato/ui/backend/injection/useAppEvent'\nimport { OrgSwitcher, type OrgOption } from './components/OrgSwitcher'\nimport { DomainPanel } from './components/DomainPanel'\nimport { RegisterDialog } from './components/RegisterDialog'\nimport type { DomainListResponse, DomainMappingRow, DomainConfig } from './components/types'\n\nconst STATE_LOADING = 'loading'\nconst STATE_LOADED = 'loaded'\nconst STATE_ERROR = 'error'\ntype LoadState = typeof STATE_LOADING | typeof STATE_LOADED | typeof STATE_ERROR\n\ntype OrgSwitcherNode = {\n id: string\n name: string\n depth: number\n selectable: boolean\n children: OrgSwitcherNode[]\n}\n\ntype OrgSwitcherResponse = {\n items?: OrgSwitcherNode[]\n selectedId?: string | null\n}\n\nfunction flattenOrgNodes(nodes: OrgSwitcherNode[] | undefined, acc: OrgOption[] = [], depth = 0): OrgOption[] {\n if (!nodes) return acc\n for (const node of nodes) {\n if (node.selectable) {\n acc.push({ id: node.id, label: node.name, depth })\n }\n flattenOrgNodes(node.children, acc, depth + 1)\n }\n return acc\n}\n\nexport default function CustomerDomainSettingsPage() {\n const t = useT()\n const router = useRouter()\n const searchParams = useSearchParams()\n\n const [orgOptions, setOrgOptions] = React.useState<OrgOption[]>([])\n const [defaultOrgId, setDefaultOrgId] = React.useState<string | null>(null)\n const [orgsLoaded, setOrgsLoaded] = React.useState(false)\n\n const urlOrgId = searchParams?.get('org') ?? null\n const selectedOrgId = urlOrgId ?? defaultOrgId\n\n const [mappings, setMappings] = React.useState<DomainMappingRow[]>([])\n const [config, setConfig] = React.useState<DomainConfig>({ cnameTarget: null, aRecordTarget: null })\n const [loadState, setLoadState] = React.useState<LoadState>(STATE_LOADING)\n const [reloadToken, setReloadToken] = React.useState(0)\n const [registerOpen, setRegisterOpen] = React.useState(false)\n const [registerMode, setRegisterMode] = React.useState<'register' | 'change'>('register')\n const [replaceTargetId, setReplaceTargetId] = React.useState<string | null>(null)\n const [isMutating, setIsMutating] = React.useState(false)\n\n const { confirm, ConfirmDialogElement } = useConfirmDialog()\n const { runMutation } = useGuardedMutation<{ entityType: string; entityId?: string }>({\n contextId: 'customer_accounts:domain-settings',\n })\n\n const runMutationWithContext = React.useCallback(\n async <T,>(operation: () => Promise<T>, mutationPayload?: Record<string, unknown>): Promise<T> => {\n return runMutation({\n operation,\n mutationPayload,\n context: { entityType: 'customer_accounts:domain_mapping' },\n })\n },\n [runMutation],\n )\n\n const refresh = React.useCallback(() => {\n setReloadToken((token) => token + 1)\n }, [])\n\n React.useEffect(() => {\n let cancelled = false\n async function loadOrgs() {\n try {\n const call = await apiCall<OrgSwitcherResponse>('/api/directory/organization-switcher')\n if (cancelled) return\n if (!call.ok || !call.result) {\n setOrgOptions([])\n setDefaultOrgId(null)\n return\n }\n const flat = flattenOrgNodes(call.result.items, [], 0)\n setOrgOptions(flat)\n const fallback = call.result.selectedId ?? (flat[0]?.id ?? null)\n setDefaultOrgId(fallback)\n } catch {\n if (!cancelled) {\n setOrgOptions([])\n setDefaultOrgId(null)\n }\n } finally {\n if (!cancelled) setOrgsLoaded(true)\n }\n }\n loadOrgs()\n return () => {\n cancelled = true\n }\n }, [])\n\n React.useEffect(() => {\n if (!orgsLoaded) return\n if (!selectedOrgId) {\n setMappings([])\n setConfig({ cnameTarget: null, aRecordTarget: null })\n setLoadState(STATE_LOADED)\n return\n }\n let cancelled = false\n async function load() {\n setLoadState(STATE_LOADING)\n try {\n const call = await apiCall<DomainListResponse>(\n `/api/customer_accounts/admin/domain-mappings?organizationId=${encodeURIComponent(selectedOrgId!)}`,\n )\n if (cancelled) return\n if (!call.ok || !call.result?.ok) {\n setLoadState(STATE_ERROR)\n return\n }\n setMappings(Array.isArray(call.result.domainMappings) ? call.result.domainMappings : [])\n setConfig(call.result.config ?? { cnameTarget: null, aRecordTarget: null })\n setLoadState(STATE_LOADED)\n } catch {\n if (!cancelled) setLoadState(STATE_ERROR)\n }\n }\n load()\n return () => {\n cancelled = true\n }\n }, [orgsLoaded, selectedOrgId, reloadToken])\n\n useAppEvent('customer_accounts.domain_mapping.*', () => {\n refresh()\n }, [refresh])\n\n const orderedMappings = React.useMemo(() => {\n if (mappings.length === 0) return []\n const sorted = [...mappings].sort((a, b) => {\n const aActive = a.status === 'active' ? 0 : 1\n const bActive = b.status === 'active' ? 0 : 1\n if (aActive !== bActive) return aActive - bActive\n return new Date(a.createdAt).getTime() - new Date(b.createdAt).getTime()\n })\n return sorted\n }, [mappings])\n\n const primaryActiveId = React.useMemo(() => {\n const active = orderedMappings.find((m) => m.status === 'active')\n if (active) return active.id\n return orderedMappings[0]?.id ?? null\n }, [orderedMappings])\n\n const handleOrgChange = React.useCallback(\n (next: string) => {\n const params = new URLSearchParams(searchParams?.toString() ?? '')\n if (next) params.set('org', next)\n else params.delete('org')\n const qs = params.toString()\n router.replace(qs ? `?${qs}` : '?', { scroll: false })\n },\n [router, searchParams],\n )\n\n const handleOpenRegister = React.useCallback(() => {\n setRegisterMode('register')\n setReplaceTargetId(null)\n setRegisterOpen(true)\n }, [])\n\n const handleOpenChange = React.useCallback((mappingId: string) => {\n setRegisterMode('change')\n setReplaceTargetId(mappingId)\n setRegisterOpen(true)\n }, [])\n\n const handleSubmitRegister = React.useCallback(\n async (hostname: string) => {\n if (!selectedOrgId) {\n throw new Error(t('customer_accounts.domainMapping.error.load', 'Could not load custom-domain configuration'))\n }\n setIsMutating(true)\n try {\n await runMutationWithContext(async () => {\n const body: Record<string, unknown> = {\n hostname,\n organizationId: selectedOrgId,\n }\n if (registerMode === 'change' && replaceTargetId) {\n body.replacesDomainId = replaceTargetId\n }\n const call = await apiCall<{ ok: boolean; error?: string; domainMapping?: DomainMappingRow }>(\n '/api/customer_accounts/admin/domain-mappings',\n {\n method: 'POST',\n headers: { 'content-type': 'application/json' },\n body: JSON.stringify(body),\n },\n )\n if (!call.ok || !call.result?.ok) {\n const message = call.result?.error\n || t('customer_accounts.domainMapping.alreadyClaimed', 'This domain is not available. Please choose a different hostname.')\n throw new Error(message)\n }\n flash(t('customer_accounts.domainMapping.registered', 'Domain registered successfully'), 'success')\n setRegisterOpen(false)\n refresh()\n })\n } finally {\n setIsMutating(false)\n }\n },\n [refresh, registerMode, replaceTargetId, runMutationWithContext, selectedOrgId, t],\n )\n\n const handleCheckNow = React.useCallback(\n async (mapping: DomainMappingRow) => {\n setIsMutating(true)\n try {\n await runMutationWithContext(async () => {\n const call = await apiCall<{ ok: boolean; error?: string }>(\n `/api/customer_accounts/admin/domain-mappings/${encodeURIComponent(mapping.id)}/verify`,\n { method: 'POST' },\n )\n if (!call.ok || !call.result?.ok) {\n const message = call.result?.error || t('customer_accounts.domainMapping.error.load', 'Could not load custom-domain configuration')\n flash(message, 'error')\n return\n }\n refresh()\n })\n } finally {\n setIsMutating(false)\n }\n },\n [refresh, runMutationWithContext, t],\n )\n\n const handleRetryTls = React.useCallback(\n async (mapping: DomainMappingRow) => {\n setIsMutating(true)\n try {\n await runMutationWithContext(async () => {\n const call = await apiCall<{ ok: boolean; error?: string }>(\n `/api/customer_accounts/admin/domain-mappings/${encodeURIComponent(mapping.id)}/health-check`,\n { method: 'POST' },\n )\n if (!call.ok || !call.result?.ok) {\n const message = call.result?.error || t('customer_accounts.domainMapping.error.load', 'Could not load custom-domain configuration')\n flash(message, 'error')\n return\n }\n refresh()\n })\n } finally {\n setIsMutating(false)\n }\n },\n [refresh, runMutationWithContext, t],\n )\n\n const handleRemove = React.useCallback(\n async (mapping: DomainMappingRow) => {\n const replacement = orderedMappings.find(\n (m) => m.id !== mapping.id && m.status !== 'active',\n )\n const text = replacement\n ? t('customer_accounts.domainMapping.removeConfirm.hasReplacement', 'This will also cancel the pending replacement domain ({hostname}).', { hostname: replacement.hostname })\n : t('customer_accounts.domainMapping.removeConfirm', 'Are you sure? Customers using this domain will no longer be able to reach your portal.')\n const confirmed = await confirm({\n title: t('customer_accounts.domainMapping.removeConfirm.title', 'Remove custom domain?'),\n text,\n variant: 'destructive',\n confirmText: t('customer_accounts.domainMapping.removeDomain', 'Remove Domain'),\n })\n if (!confirmed) return\n setIsMutating(true)\n try {\n await runMutationWithContext(async () => {\n const call = await apiCall<{ ok: boolean; error?: string }>(\n `/api/customer_accounts/admin/domain-mappings?id=${encodeURIComponent(mapping.id)}`,\n { method: 'DELETE' },\n )\n if (!call.ok || !call.result?.ok) {\n const message = call.result?.error || t('customer_accounts.domainMapping.error.load', 'Could not load custom-domain configuration')\n flash(message, 'error')\n return\n }\n flash(t('customer_accounts.domainMapping.removed', 'Domain removed'), 'success')\n refresh()\n })\n } finally {\n setIsMutating(false)\n }\n },\n [confirm, orderedMappings, refresh, runMutationWithContext, t],\n )\n\n const replaceTargetHostname = React.useMemo(() => {\n if (registerMode !== 'change' || !replaceTargetId) return null\n return orderedMappings.find((m) => m.id === replaceTargetId)?.hostname ?? null\n }, [orderedMappings, registerMode, replaceTargetId])\n\n return (\n <Page>\n <div className=\"px-3 py-3 md:px-6 md:py-4\">\n <FormHeader\n mode=\"detail\"\n title={t('customer_accounts.domainMapping.title', 'Custom Domain')}\n subtitle={t('customer_accounts.domainMapping.description', 'Map your own domain to the customer portal')}\n backHref=\"/backend/customer_accounts/settings\"\n backLabel={t('customer_accounts.settings.title', 'Portal Settings')}\n />\n </div>\n\n <PageBody className=\"space-y-6\">\n {orgOptions.length > 1 ? (\n <div className=\"flex flex-wrap items-center justify-between gap-3 rounded-lg border bg-card px-4 py-3\">\n <OrgSwitcher\n options={orgOptions}\n selectedId={selectedOrgId}\n onChange={handleOrgChange}\n />\n </div>\n ) : null}\n\n {loadState === STATE_LOADING ? (\n <LoadingMessage label={t('customer_accounts.domainMapping.loading', 'Loading domain configuration\u2026')} />\n ) : null}\n\n {loadState === STATE_ERROR ? (\n <ErrorMessage\n label={t('customer_accounts.domainMapping.error.load', 'Could not load custom-domain configuration')}\n action={\n <Button type=\"button\" variant=\"outline\" size=\"sm\" onClick={refresh}>\n {t('customer_accounts.domainMapping.verifyNow', 'Check Now')}\n </Button>\n }\n />\n ) : null}\n\n {loadState === STATE_LOADED && orderedMappings.length === 0 && selectedOrgId ? (\n <EmptyState\n icon={<Globe className=\"h-8 w-8\" aria-hidden />}\n title={t('customer_accounts.domainMapping.empty.title', 'No custom domain yet')}\n description={t('customer_accounts.domainMapping.empty.description', 'Connect your own domain so customers can reach the portal at a branded URL.')}\n action={{\n label: t('customer_accounts.domainMapping.empty.cta', 'Register Domain'),\n onClick: handleOpenRegister,\n icon: <Globe className=\"h-4 w-4\" aria-hidden />,\n }}\n />\n ) : null}\n\n {loadState === STATE_LOADED && orderedMappings.length > 0 ? (\n <div className=\"space-y-4\">\n {orderedMappings.map((mapping) => {\n const isReplacement = mapping.id !== primaryActiveId && mapping.status !== 'active'\n return (\n <DomainPanel\n key={mapping.id}\n mapping={mapping}\n isReplacement={isReplacement}\n cnameTarget={config.cnameTarget}\n aRecordTarget={config.aRecordTarget}\n busy={isMutating}\n onCheckNow={() => handleCheckNow(mapping)}\n onRetryTls={() => handleRetryTls(mapping)}\n onChangeDomain={() => handleOpenChange(mapping.id)}\n onRemove={() => handleRemove(mapping)}\n />\n )\n })}\n </div>\n ) : null}\n </PageBody>\n\n <RegisterDialog\n open={registerOpen}\n onOpenChange={setRegisterOpen}\n mode={registerMode}\n currentHostname={replaceTargetHostname}\n onSubmit={handleSubmitRegister}\n />\n\n {ConfirmDialogElement}\n </Page>\n )\n}\n"],
|
|
5
|
+
"mappings": ";AAwUQ,cASF,YATE;AAtUR,YAAY,WAAW;AACvB,SAAS,WAAW,uBAAuB;AAC3C,SAAS,aAAa;AACtB,SAAS,MAAM,gBAAgB;AAC/B,SAAS,kBAAkB;AAC3B,SAAS,kBAAkB;AAC3B,SAAS,gBAAgB,oBAAoB;AAC7C,SAAS,cAAc;AACvB,SAAS,eAAe;AACxB,SAAS,aAAa;AACtB,SAAS,YAAY;AACrB,SAAS,wBAAwB;AACjC,SAAS,0BAA0B;AACnC,SAAS,mBAAmB;AAC5B,SAAS,mBAAmC;AAC5C,SAAS,mBAAmB;AAC5B,SAAS,sBAAsB;AAG/B,MAAM,gBAAgB;AACtB,MAAM,eAAe;AACrB,MAAM,cAAc;AAgBpB,SAAS,gBAAgB,OAAsC,MAAmB,CAAC,GAAG,QAAQ,GAAgB;AAC5G,MAAI,CAAC,MAAO,QAAO;AACnB,aAAW,QAAQ,OAAO;AACxB,QAAI,KAAK,YAAY;AACnB,UAAI,KAAK,EAAE,IAAI,KAAK,IAAI,OAAO,KAAK,MAAM,MAAM,CAAC;AAAA,IACnD;AACA,oBAAgB,KAAK,UAAU,KAAK,QAAQ,CAAC;AAAA,EAC/C;AACA,SAAO;AACT;AAEe,SAAR,6BAA8C;AACnD,QAAM,IAAI,KAAK;AACf,QAAM,SAAS,UAAU;AACzB,QAAM,eAAe,gBAAgB;AAErC,QAAM,CAAC,YAAY,aAAa,IAAI,MAAM,SAAsB,CAAC,CAAC;AAClE,QAAM,CAAC,cAAc,eAAe,IAAI,MAAM,SAAwB,IAAI;AAC1E,QAAM,CAAC,YAAY,aAAa,IAAI,MAAM,SAAS,KAAK;AAExD,QAAM,WAAW,cAAc,IAAI,KAAK,K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7
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
const globeIcon = React.createElement(
|
|
3
|
+
"svg",
|
|
4
|
+
{ width: 16, height: 16, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: 2, strokeLinecap: "round", strokeLinejoin: "round" },
|
|
5
|
+
React.createElement("circle", { cx: 12, cy: 12, r: 10 }),
|
|
6
|
+
React.createElement("path", { d: "M2 12h20" }),
|
|
7
|
+
React.createElement("path", { d: "M12 2a15.3 15.3 0 0 1 4 10 15.3 15.3 0 0 1-4 10 15.3 15.3 0 0 1-4-10 15.3 15.3 0 0 1 4-10z" })
|
|
8
|
+
);
|
|
9
|
+
const metadata = {
|
|
10
|
+
requireAuth: true,
|
|
11
|
+
requireFeatures: ["customer_accounts.domain.manage"],
|
|
12
|
+
pageTitle: "Custom Domain",
|
|
13
|
+
pageTitleKey: "customer_accounts.domainMapping.title",
|
|
14
|
+
pageGroup: "Module Configs",
|
|
15
|
+
pageGroupKey: "settings.sections.moduleConfigs",
|
|
16
|
+
pageOrder: 60,
|
|
17
|
+
icon: globeIcon,
|
|
18
|
+
pageContext: "settings",
|
|
19
|
+
breadcrumb: [
|
|
20
|
+
{ label: "Custom Domain", labelKey: "customer_accounts.domainMapping.title" }
|
|
21
|
+
]
|
|
22
|
+
};
|
|
23
|
+
var page_meta_default = metadata;
|
|
24
|
+
export {
|
|
25
|
+
page_meta_default as default,
|
|
26
|
+
metadata
|
|
27
|
+
};
|
|
28
|
+
//# sourceMappingURL=page.meta.js.map
|
package/dist/modules/customer_accounts/backend/customer_accounts/settings/domain/page.meta.js.map
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../../../src/modules/customer_accounts/backend/customer_accounts/settings/domain/page.meta.ts"],
|
|
4
|
+
"sourcesContent": ["import React from 'react'\n\nconst globeIcon = React.createElement(\n 'svg',\n { width: 16, height: 16, viewBox: '0 0 24 24', fill: 'none', stroke: 'currentColor', strokeWidth: 2, strokeLinecap: 'round', strokeLinejoin: 'round' },\n React.createElement('circle', { cx: 12, cy: 12, r: 10 }),\n React.createElement('path', { d: 'M2 12h20' }),\n React.createElement('path', { d: 'M12 2a15.3 15.3 0 0 1 4 10 15.3 15.3 0 0 1-4 10 15.3 15.3 0 0 1-4-10 15.3 15.3 0 0 1 4-10z' }),\n)\n\nexport const metadata = {\n requireAuth: true,\n requireFeatures: ['customer_accounts.domain.manage'],\n pageTitle: 'Custom Domain',\n pageTitleKey: 'customer_accounts.domainMapping.title',\n pageGroup: 'Module Configs',\n pageGroupKey: 'settings.sections.moduleConfigs',\n pageOrder: 60,\n icon: globeIcon,\n pageContext: 'settings' as const,\n breadcrumb: [\n { label: 'Custom Domain', labelKey: 'customer_accounts.domainMapping.title' },\n ],\n}\n\nexport default metadata\n"],
|
|
5
|
+
"mappings": "AAAA,OAAO,WAAW;AAElB,MAAM,YAAY,MAAM;AAAA,EACtB;AAAA,EACA,EAAE,OAAO,IAAI,QAAQ,IAAI,SAAS,aAAa,MAAM,QAAQ,QAAQ,gBAAgB,aAAa,GAAG,eAAe,SAAS,gBAAgB,QAAQ;AAAA,EACrJ,MAAM,cAAc,UAAU,EAAE,IAAI,IAAI,IAAI,IAAI,GAAG,GAAG,CAAC;AAAA,EACvD,MAAM,cAAc,QAAQ,EAAE,GAAG,WAAW,CAAC;AAAA,EAC7C,MAAM,cAAc,QAAQ,EAAE,GAAG,6FAA6F,CAAC;AACjI;AAEO,MAAM,WAAW;AAAA,EACtB,aAAa;AAAA,EACb,iBAAiB,CAAC,iCAAiC;AAAA,EACnD,WAAW;AAAA,EACX,cAAc;AAAA,EACd,WAAW;AAAA,EACX,cAAc;AAAA,EACd,WAAW;AAAA,EACX,MAAM;AAAA,EACN,aAAa;AAAA,EACb,YAAY;AAAA,IACV,EAAE,OAAO,iBAAiB,UAAU,wCAAwC;AAAA,EAC9E;AACF;AAEA,IAAO,oBAAQ;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -7,6 +7,7 @@ import { Page, PageBody } from "@open-mercato/ui/backend/Page";
|
|
|
7
7
|
import { FormHeader } from "@open-mercato/ui/backend/forms";
|
|
8
8
|
import { Button } from "@open-mercato/ui/primitives/button";
|
|
9
9
|
import { Input } from "@open-mercato/ui/primitives/input";
|
|
10
|
+
import { PasswordInput } from "@open-mercato/ui/primitives/password-input";
|
|
10
11
|
import { Spinner } from "@open-mercato/ui/primitives/spinner";
|
|
11
12
|
import { SwitchField } from "@open-mercato/ui/primitives/switch-field";
|
|
12
13
|
import { Dialog, DialogContent, DialogHeader, DialogTitle } from "@open-mercato/ui/primitives/dialog";
|
|
@@ -80,15 +81,15 @@ function ResetPasswordDialog({
|
|
|
80
81
|
/* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
|
|
81
82
|
/* @__PURE__ */ jsx("label", { className: "text-sm font-medium", htmlFor: "reset-password", children: t("customer_accounts.admin.detail.resetPassword.fields.newPassword", "New Password") }),
|
|
82
83
|
/* @__PURE__ */ jsx(
|
|
83
|
-
|
|
84
|
+
PasswordInput,
|
|
84
85
|
{
|
|
85
86
|
id: "reset-password",
|
|
86
|
-
type: "password",
|
|
87
87
|
required: true,
|
|
88
88
|
minLength: 8,
|
|
89
89
|
value: newPassword,
|
|
90
90
|
onChange: (event) => setNewPassword(event.target.value),
|
|
91
|
-
placeholder: t("customer_accounts.admin.detail.resetPassword.fields.placeholder", "Min. 8 characters")
|
|
91
|
+
placeholder: t("customer_accounts.admin.detail.resetPassword.fields.placeholder", "Min. 8 characters"),
|
|
92
|
+
autoComplete: "new-password"
|
|
92
93
|
}
|
|
93
94
|
)
|
|
94
95
|
] }),
|