@open-mercato/core 0.6.7-develop.6795.1.8a3f27921c → 0.6.7-develop.6824.1.21fff90682
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 +1 -1
- package/dist/generated/entities/customer_deal_person_link/index.js +2 -0
- package/dist/generated/entities/customer_deal_person_link/index.js.map +2 -2
- package/dist/generated/entities/customer_user_invitation/index.js +2 -0
- package/dist/generated/entities/customer_user_invitation/index.js.map +2 -2
- package/dist/generated/entity-fields-registry.js +2 -0
- package/dist/generated/entity-fields-registry.js.map +2 -2
- package/dist/modules/auth/lib/backendChrome.js +10 -9
- package/dist/modules/auth/lib/backendChrome.js.map +2 -2
- package/dist/modules/auth/lib/tenantAccess.js +7 -0
- package/dist/modules/auth/lib/tenantAccess.js.map +2 -2
- package/dist/modules/business_rules/api/openmercato-call-options/route.js +85 -0
- package/dist/modules/business_rules/api/openmercato-call-options/route.js.map +7 -0
- package/dist/modules/business_rules/api/rules/route.js +71 -4
- package/dist/modules/business_rules/api/rules/route.js.map +2 -2
- package/dist/modules/business_rules/components/ActionBuilder.js +47 -4
- package/dist/modules/business_rules/components/ActionBuilder.js.map +3 -3
- package/dist/modules/business_rules/components/ActionRow.js +106 -16
- package/dist/modules/business_rules/components/ActionRow.js.map +2 -2
- package/dist/modules/business_rules/components/utils/actionValidation.js +6 -0
- package/dist/modules/business_rules/components/utils/actionValidation.js.map +2 -2
- package/dist/modules/business_rules/lib/action-executor.js +148 -0
- package/dist/modules/business_rules/lib/action-executor.js.map +2 -2
- package/dist/modules/business_rules/lib/openmercato-call-options-types.js +5 -0
- package/dist/modules/business_rules/lib/openmercato-call-options-types.js.map +7 -0
- package/dist/modules/business_rules/lib/openmercato-call-options.js +231 -0
- package/dist/modules/business_rules/lib/openmercato-call-options.js.map +7 -0
- package/dist/modules/business_rules/lib/rule-engine.js +5 -1
- package/dist/modules/business_rules/lib/rule-engine.js.map +2 -2
- package/dist/modules/communication_channels/api/post/webhook/[provider]/route.js +11 -1
- package/dist/modules/communication_channels/api/post/webhook/[provider]/route.js.map +2 -2
- package/dist/modules/communication_channels/api/post/webhooks/gmail/route.js +11 -6
- package/dist/modules/communication_channels/api/post/webhooks/gmail/route.js.map +2 -2
- package/dist/modules/configs/lib/upgrade-actions.js +12 -0
- package/dist/modules/configs/lib/upgrade-actions.js.map +2 -2
- package/dist/modules/customer_accounts/api/admin/users/[id].js +10 -1
- package/dist/modules/customer_accounts/api/admin/users/[id].js.map +2 -2
- package/dist/modules/customer_accounts/api/admin/users-invite.js +61 -4
- package/dist/modules/customer_accounts/api/admin/users-invite.js.map +2 -2
- package/dist/modules/customer_accounts/api/portal/users-invite.js +20 -2
- package/dist/modules/customer_accounts/api/portal/users-invite.js.map +2 -2
- package/dist/modules/customer_accounts/data/entities.js +3 -0
- package/dist/modules/customer_accounts/data/entities.js.map +2 -2
- package/dist/modules/customer_accounts/data/validators.js +1 -0
- package/dist/modules/customer_accounts/data/validators.js.map +2 -2
- package/dist/modules/customer_accounts/emails/CustomerInvitationEmail.js +26 -0
- package/dist/modules/customer_accounts/emails/CustomerInvitationEmail.js.map +7 -0
- package/dist/modules/customer_accounts/lib/customerEntityOwnership.js +29 -3
- package/dist/modules/customer_accounts/lib/customerEntityOwnership.js.map +2 -2
- package/dist/modules/customer_accounts/lib/customerUrl.js +19 -10
- package/dist/modules/customer_accounts/lib/customerUrl.js.map +2 -2
- package/dist/modules/customer_accounts/lib/invitationEmail.js +35 -0
- package/dist/modules/customer_accounts/lib/invitationEmail.js.map +7 -0
- package/dist/modules/customer_accounts/migrations/Migration20260723120000_customer_accounts.js +13 -0
- package/dist/modules/customer_accounts/migrations/Migration20260723120000_customer_accounts.js.map +7 -0
- package/dist/modules/customer_accounts/services/customerInvitationService.js +32 -2
- package/dist/modules/customer_accounts/services/customerInvitationService.js.map +2 -2
- package/dist/modules/customer_accounts/subscribers/autoLinkCrm.js +47 -7
- package/dist/modules/customer_accounts/subscribers/autoLinkCrm.js.map +2 -2
- 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/widgets/injection-table.js +1 -1
- package/dist/modules/customer_accounts/widgets/injection-table.js.map +2 -2
- package/dist/modules/customers/api/deals/[id]/people/route.js +4 -2
- package/dist/modules/customers/api/deals/[id]/people/route.js.map +2 -2
- package/dist/modules/customers/api/deals/[id]/route.js +7 -3
- package/dist/modules/customers/api/deals/[id]/route.js.map +2 -2
- package/dist/modules/customers/backend/customers/companies-v2/[id]/page.js +11 -1
- package/dist/modules/customers/backend/customers/companies-v2/[id]/page.js.map +2 -2
- package/dist/modules/customers/backend/customers/deals/[id]/page.js +14 -8
- package/dist/modules/customers/backend/customers/deals/[id]/page.js.map +2 -2
- package/dist/modules/customers/backend/customers/people-v2/[id]/page.js +21 -6
- package/dist/modules/customers/backend/customers/people-v2/[id]/page.js.map +2 -2
- package/dist/modules/customers/commands/deals.js +48 -10
- package/dist/modules/customers/commands/deals.js.map +2 -2
- package/dist/modules/customers/commands/people.js +2 -0
- package/dist/modules/customers/commands/people.js.map +2 -2
- package/dist/modules/customers/components/detail/CompanyDetailTabs.js +26 -6
- package/dist/modules/customers/components/detail/CompanyDetailTabs.js.map +2 -2
- package/dist/modules/customers/components/detail/DealDetailTabs.js +30 -8
- package/dist/modules/customers/components/detail/DealDetailTabs.js.map +2 -2
- package/dist/modules/customers/components/detail/PersonDetailTabs.js +30 -8
- package/dist/modules/customers/components/detail/PersonDetailTabs.js.map +2 -2
- package/dist/modules/customers/data/entities.js +8 -0
- package/dist/modules/customers/data/entities.js.map +2 -2
- package/dist/modules/customers/data/validators.js +2 -1
- package/dist/modules/customers/data/validators.js.map +2 -2
- package/dist/modules/customers/migrations/Migration20260723210000_customers.js +15 -0
- package/dist/modules/customers/migrations/Migration20260723210000_customers.js.map +7 -0
- package/dist/modules/directory/api/tenants/route.js +8 -2
- package/dist/modules/directory/api/tenants/route.js.map +2 -2
- package/dist/modules/directory/commands/tenants.js +6 -0
- package/dist/modules/directory/commands/tenants.js.map +2 -2
- package/dist/modules/entities/api/entity-settings.js +59 -9
- package/dist/modules/entities/api/entity-settings.js.map +2 -2
- package/dist/modules/entities/backend/config/settings/page.js +10 -0
- package/dist/modules/entities/backend/config/settings/page.js.map +7 -0
- package/dist/modules/entities/backend/config/settings/page.meta.js +36 -0
- package/dist/modules/entities/backend/config/settings/page.meta.js.map +7 -0
- package/dist/modules/entities/backend/entities/user/create/page.js +16 -7
- package/dist/modules/entities/backend/entities/user/create/page.js.map +2 -2
- package/dist/modules/entities/components/EntitySettingsManager.js +136 -0
- package/dist/modules/entities/components/EntitySettingsManager.js.map +7 -0
- package/dist/modules/inbox_ops/api/webhook/inbound.js +14 -10
- package/dist/modules/inbox_ops/api/webhook/inbound.js.map +2 -2
- package/dist/modules/payment_gateways/api/sessions/route.js +1 -3
- package/dist/modules/payment_gateways/api/sessions/route.js.map +2 -2
- package/dist/modules/payment_gateways/api/webhook/[provider]/route.js +11 -1
- package/dist/modules/payment_gateways/api/webhook/[provider]/route.js.map +2 -2
- package/dist/modules/payment_gateways/data/entities.js +4 -0
- package/dist/modules/payment_gateways/data/entities.js.map +2 -2
- package/dist/modules/payment_gateways/lib/gateway-service.js +15 -6
- package/dist/modules/payment_gateways/lib/gateway-service.js.map +2 -2
- package/dist/modules/payment_gateways/lib/session-idempotency.js +33 -0
- package/dist/modules/payment_gateways/lib/session-idempotency.js.map +2 -2
- package/dist/modules/payment_gateways/migrations/Migration20260803103035_payment_gateways.js +18 -0
- package/dist/modules/payment_gateways/migrations/Migration20260803103035_payment_gateways.js.map +7 -0
- package/dist/modules/payment_gateways/setup.js +47 -0
- package/dist/modules/payment_gateways/setup.js.map +2 -2
- package/dist/modules/payment_gateways/workers/session-initialization-prune.js +50 -0
- package/dist/modules/payment_gateways/workers/session-initialization-prune.js.map +7 -0
- package/dist/modules/portal/frontend/[orgSlug]/portal/invite/page.js +134 -0
- package/dist/modules/portal/frontend/[orgSlug]/portal/invite/page.js.map +7 -0
- package/dist/modules/portal/frontend/[orgSlug]/portal/invite/page.meta.js +11 -0
- package/dist/modules/portal/frontend/[orgSlug]/portal/invite/page.meta.js.map +7 -0
- package/dist/modules/portal/lib/navigation.js +7 -0
- package/dist/modules/portal/lib/navigation.js.map +7 -0
- package/dist/modules/query_index/lib/engine.js +43 -0
- package/dist/modules/query_index/lib/engine.js.map +2 -2
- package/dist/modules/query_index/lib/search-tokens.js +15 -5
- package/dist/modules/query_index/lib/search-tokens.js.map +2 -2
- package/dist/modules/shipping_carriers/api/webhook/[provider]/route.js +11 -1
- package/dist/modules/shipping_carriers/api/webhook/[provider]/route.js.map +2 -2
- package/generated/entities/customer_deal_person_link/index.ts +1 -0
- package/generated/entities/customer_user_invitation/index.ts +1 -0
- package/generated/entity-fields-registry.ts +2 -0
- package/package.json +7 -7
- package/src/modules/auth/lib/backendChrome.tsx +15 -9
- package/src/modules/auth/lib/tenantAccess.ts +8 -0
- package/src/modules/business_rules/api/openmercato-call-options/route.ts +94 -0
- package/src/modules/business_rules/api/rules/route.ts +92 -4
- package/src/modules/business_rules/components/ActionBuilder.tsx +54 -5
- package/src/modules/business_rules/components/ActionRow.tsx +156 -18
- package/src/modules/business_rules/components/utils/actionValidation.ts +6 -0
- package/src/modules/business_rules/i18n/de.json +12 -0
- package/src/modules/business_rules/i18n/en.json +12 -0
- package/src/modules/business_rules/i18n/es.json +12 -0
- package/src/modules/business_rules/i18n/pl.json +12 -0
- package/src/modules/business_rules/lib/action-executor.ts +198 -0
- package/src/modules/business_rules/lib/openmercato-call-options-types.ts +31 -0
- package/src/modules/business_rules/lib/openmercato-call-options.ts +297 -0
- package/src/modules/business_rules/lib/rule-engine.ts +4 -0
- package/src/modules/communication_channels/api/post/webhook/[provider]/route.ts +11 -1
- package/src/modules/communication_channels/api/post/webhooks/gmail/route.ts +17 -11
- package/src/modules/configs/lib/upgrade-actions.ts +14 -0
- package/src/modules/customer_accounts/api/admin/users/[id].ts +16 -1
- package/src/modules/customer_accounts/api/admin/users-invite.ts +78 -3
- package/src/modules/customer_accounts/api/portal/users-invite.ts +22 -1
- package/src/modules/customer_accounts/data/entities.ts +3 -0
- package/src/modules/customer_accounts/data/validators.ts +1 -0
- package/src/modules/customer_accounts/emails/CustomerInvitationEmail.tsx +45 -0
- package/src/modules/customer_accounts/i18n/de.json +6 -0
- package/src/modules/customer_accounts/i18n/en.json +6 -0
- package/src/modules/customer_accounts/i18n/es.json +6 -0
- package/src/modules/customer_accounts/i18n/pl.json +6 -0
- package/src/modules/customer_accounts/lib/customerEntityOwnership.ts +68 -2
- package/src/modules/customer_accounts/lib/customerUrl.ts +27 -11
- package/src/modules/customer_accounts/lib/invitationEmail.ts +42 -0
- package/src/modules/customer_accounts/migrations/.snapshot-open-mercato.json +16 -0
- package/src/modules/customer_accounts/migrations/Migration20260723120000_customer_accounts.ts +13 -0
- package/src/modules/customer_accounts/services/customerInvitationService.ts +56 -3
- package/src/modules/customer_accounts/subscribers/autoLinkCrm.ts +75 -8
- package/src/modules/customer_accounts/widgets/injection/account-status/widget.client.tsx +2 -2
- package/src/modules/customer_accounts/widgets/injection-table.ts +4 -1
- package/src/modules/customers/api/deals/[id]/people/route.ts +3 -0
- package/src/modules/customers/api/deals/[id]/route.ts +10 -2
- package/src/modules/customers/backend/customers/companies-v2/[id]/page.tsx +12 -1
- package/src/modules/customers/backend/customers/deals/[id]/hooks/types.ts +1 -0
- package/src/modules/customers/backend/customers/deals/[id]/page.tsx +15 -9
- package/src/modules/customers/backend/customers/people-v2/[id]/page.tsx +24 -6
- package/src/modules/customers/commands/deals.ts +50 -9
- package/src/modules/customers/commands/people.ts +3 -0
- package/src/modules/customers/components/detail/CompanyDetailTabs.tsx +30 -7
- package/src/modules/customers/components/detail/DealDetailTabs.tsx +34 -9
- package/src/modules/customers/components/detail/PersonDetailTabs.tsx +34 -9
- package/src/modules/customers/data/entities.ts +9 -1
- package/src/modules/customers/data/validators.ts +1 -0
- package/src/modules/customers/i18n/de.json +1 -0
- package/src/modules/customers/i18n/en.json +1 -0
- package/src/modules/customers/i18n/es.json +1 -0
- package/src/modules/customers/i18n/pl.json +1 -0
- package/src/modules/customers/migrations/.snapshot-open-mercato.json +27 -1
- package/src/modules/customers/migrations/Migration20260723210000_customers.ts +15 -0
- package/src/modules/directory/api/tenants/route.ts +9 -1
- package/src/modules/directory/commands/tenants.ts +6 -0
- package/src/modules/entities/api/entity-settings.ts +66 -22
- package/src/modules/entities/backend/config/settings/page.meta.ts +34 -0
- package/src/modules/entities/backend/config/settings/page.tsx +12 -0
- package/src/modules/entities/backend/entities/user/create/page.tsx +16 -7
- package/src/modules/entities/components/EntitySettingsManager.tsx +160 -0
- package/src/modules/entities/i18n/de.json +9 -0
- package/src/modules/entities/i18n/en.json +9 -0
- package/src/modules/entities/i18n/es.json +9 -0
- package/src/modules/entities/i18n/pl.json +9 -0
- package/src/modules/inbox_ops/api/webhook/inbound.ts +14 -12
- package/src/modules/payment_gateways/api/sessions/route.ts +1 -3
- package/src/modules/payment_gateways/api/webhook/[provider]/route.ts +13 -1
- package/src/modules/payment_gateways/data/entities.ts +5 -0
- package/src/modules/payment_gateways/i18n/de.json +5 -1
- package/src/modules/payment_gateways/i18n/en.json +5 -1
- package/src/modules/payment_gateways/i18n/es.json +5 -1
- package/src/modules/payment_gateways/i18n/pl.json +5 -1
- package/src/modules/payment_gateways/lib/gateway-service.ts +17 -8
- package/src/modules/payment_gateways/lib/session-idempotency.ts +36 -0
- package/src/modules/payment_gateways/migrations/.snapshot-open-mercato.json +10 -1
- package/src/modules/payment_gateways/migrations/Migration20260803103035_payment_gateways.ts +17 -0
- package/src/modules/payment_gateways/setup.ts +62 -0
- package/src/modules/payment_gateways/workers/session-initialization-prune.ts +63 -0
- package/src/modules/portal/frontend/[orgSlug]/portal/invite/page.meta.ts +9 -0
- package/src/modules/portal/frontend/[orgSlug]/portal/invite/page.tsx +164 -0
- package/src/modules/portal/i18n/de.json +18 -0
- package/src/modules/portal/i18n/en.json +18 -0
- package/src/modules/portal/i18n/es.json +18 -0
- package/src/modules/portal/i18n/pl.json +18 -0
- package/src/modules/portal/lib/navigation.ts +3 -0
- package/src/modules/query_index/lib/engine.ts +52 -0
- package/src/modules/query_index/lib/search-tokens.ts +16 -4
- package/src/modules/shipping_carriers/api/webhook/[provider]/route.ts +11 -1
|
@@ -3,6 +3,7 @@ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
|
3
3
|
import * as React from "react";
|
|
4
4
|
import { Button } from "@open-mercato/ui/primitives/button";
|
|
5
5
|
import { Plus, Code } from "lucide-react";
|
|
6
|
+
import { apiCall } from "@open-mercato/ui/backend/utils/apiCall";
|
|
6
7
|
import { ActionRow } from "./ActionRow.js";
|
|
7
8
|
import { validateActions } from "./utils/actionValidation.js";
|
|
8
9
|
import { useT } from "@open-mercato/shared/lib/i18n/context";
|
|
@@ -18,7 +19,47 @@ function ActionBuilder({
|
|
|
18
19
|
const t = useT();
|
|
19
20
|
const { confirm: confirmDialog, ConfirmDialogElement } = useConfirmDialog();
|
|
20
21
|
const [showDebug, setShowDebug] = React.useState(false);
|
|
21
|
-
const
|
|
22
|
+
const [openMercatoOptions, setOpenMercatoOptions] = React.useState({
|
|
23
|
+
endpoints: [],
|
|
24
|
+
apiKeys: [],
|
|
25
|
+
loading: true,
|
|
26
|
+
error: null
|
|
27
|
+
});
|
|
28
|
+
const actions = React.useMemo(() => value || [], [value]);
|
|
29
|
+
React.useEffect(() => {
|
|
30
|
+
let cancelled = false;
|
|
31
|
+
async function loadOpenMercatoOptions() {
|
|
32
|
+
setOpenMercatoOptions((current) => ({ ...current, loading: true, error: null }));
|
|
33
|
+
try {
|
|
34
|
+
const response = await apiCall("/api/business_rules/openmercato-call-options");
|
|
35
|
+
if (!response.ok || !response.result) {
|
|
36
|
+
const error2 = response.result && "error" in response.result ? String(response.result.error) : t("business_rules.components.actionRow.openMercato.options.fetchFailed", { status: response.status });
|
|
37
|
+
throw new Error(error2);
|
|
38
|
+
}
|
|
39
|
+
if (!cancelled) {
|
|
40
|
+
setOpenMercatoOptions({
|
|
41
|
+
endpoints: Array.isArray(response.result.endpoints) ? response.result.endpoints : [],
|
|
42
|
+
apiKeys: Array.isArray(response.result.apiKeys) ? response.result.apiKeys : [],
|
|
43
|
+
loading: false,
|
|
44
|
+
error: null
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
} catch (error2) {
|
|
48
|
+
if (!cancelled) {
|
|
49
|
+
setOpenMercatoOptions({
|
|
50
|
+
endpoints: [],
|
|
51
|
+
apiKeys: [],
|
|
52
|
+
loading: false,
|
|
53
|
+
error: error2 instanceof Error ? error2.message : String(error2)
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
void loadOpenMercatoOptions();
|
|
59
|
+
return () => {
|
|
60
|
+
cancelled = true;
|
|
61
|
+
};
|
|
62
|
+
}, [t]);
|
|
22
63
|
const handleAddAction = () => {
|
|
23
64
|
const newAction = {
|
|
24
65
|
type: "",
|
|
@@ -74,11 +115,12 @@ function ActionBuilder({
|
|
|
74
115
|
] })
|
|
75
116
|
] }),
|
|
76
117
|
/* @__PURE__ */ jsx("div", { className: "flex items-center gap-2", children: showJsonPreview && actions.length > 0 && /* @__PURE__ */ jsxs(
|
|
77
|
-
|
|
118
|
+
Button,
|
|
78
119
|
{
|
|
79
120
|
type: "button",
|
|
80
121
|
onClick: () => setShowDebug(!showDebug),
|
|
81
|
-
|
|
122
|
+
variant: "muted",
|
|
123
|
+
size: "2xs",
|
|
82
124
|
title: t("business_rules.components.actionBuilder.jsonPreview.toggle"),
|
|
83
125
|
children: [
|
|
84
126
|
/* @__PURE__ */ jsx(Code, { className: "w-3 h-3" }),
|
|
@@ -104,7 +146,8 @@ function ActionBuilder({
|
|
|
104
146
|
onMoveUp: index > 0 ? handleMoveUp : void 0,
|
|
105
147
|
onMoveDown: index < actions.length - 1 ? handleMoveDown : void 0,
|
|
106
148
|
canMoveUp: index > 0,
|
|
107
|
-
canMoveDown: index < actions.length - 1
|
|
149
|
+
canMoveDown: index < actions.length - 1,
|
|
150
|
+
openMercatoOptions
|
|
108
151
|
},
|
|
109
152
|
index
|
|
110
153
|
)) }),
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/modules/business_rules/components/ActionBuilder.tsx"],
|
|
4
|
-
"sourcesContent": ["\"use client\"\n\nimport * as React from 'react'\nimport { Button } from '@open-mercato/ui/primitives/button'\nimport { Plus, Code } from 'lucide-react'\nimport { ActionRow } from './ActionRow'\nimport type { Action } from './utils/actionValidation'\nimport { validateActions } from './utils/actionValidation'\nimport { useT } from '@open-mercato/shared/lib/i18n/context'\nimport { useConfirmDialog } from '@open-mercato/ui/backend/confirm-dialog'\n\nexport type ActionBuilderProps = {\n value: Action[] | null | undefined\n onChange: (value: Action[]) => void\n error?: string\n showJsonPreview?: boolean\n label?: string\n emptyMessage?: string\n}\n\nexport function ActionBuilder({\n value,\n onChange,\n error,\n showJsonPreview = false,\n label,\n emptyMessage,\n}: ActionBuilderProps) {\n const t = useT()\n const { confirm: confirmDialog, ConfirmDialogElement } = useConfirmDialog()\n const [showDebug, setShowDebug] = React.useState(false)\n const actions = value || []\n\n const handleAddAction = () => {\n const newAction: Action = {\n type: '',\n config: {},\n }\n onChange([...actions, newAction])\n }\n\n const handleChangeAction = (index: number, updatedAction: Action) => {\n const newActions = [...actions]\n newActions[index] = updatedAction\n onChange(newActions)\n }\n\n const handleDeleteAction = (index: number) => {\n const newActions = actions.filter((_, i) => i !== index)\n onChange(newActions)\n }\n\n const handleMoveUp = (index: number) => {\n if (index === 0) return\n const newActions = [...actions]\n const temp = newActions[index - 1]\n newActions[index - 1] = newActions[index]\n newActions[index] = temp\n onChange(newActions)\n }\n\n const handleMoveDown = (index: number) => {\n if (index === actions.length - 1) return\n const newActions = [...actions]\n const temp = newActions[index + 1]\n newActions[index + 1] = newActions[index]\n newActions[index] = temp\n onChange(newActions)\n }\n\n const handleClearAll = async () => {\n const confirmed = await confirmDialog({\n title: t('business_rules.components.actionBuilder.confirm.clearAll'),\n variant: 'destructive',\n })\n if (confirmed) {\n onChange([])\n }\n }\n\n // Validate actions (memoized to avoid expensive re-computation)\n const validation = React.useMemo(() => {\n return validateActions(actions, t)\n }, [actions, t])\n\n return (\n <div className=\"space-y-3\">\n {/* Header */}\n <div className=\"flex items-center justify-between\">\n <div className=\"flex items-center gap-2\">\n <h3 className=\"text-sm font-medium text-foreground\">\n {label || t('business_rules.components.actionBuilder.label')}\n </h3>\n {actions.length > 0 && (\n <span className=\"text-xs text-muted-foreground\">\n ({t('business_rules.components.actionBuilder.actionCount', { count: actions.length })})\n </span>\n )}\n </div>\n\n {/* Controls */}\n <div className=\"flex items-center gap-2\">\n {showJsonPreview && actions.length > 0 && (\n <
|
|
5
|
-
"mappings": ";
|
|
6
|
-
"names": []
|
|
4
|
+
"sourcesContent": ["\"use client\"\n\nimport * as React from 'react'\nimport { Button } from '@open-mercato/ui/primitives/button'\nimport { Plus, Code } from 'lucide-react'\nimport { apiCall } from '@open-mercato/ui/backend/utils/apiCall'\nimport { ActionRow, type OpenMercatoCallOptionsState } from './ActionRow'\nimport type { Action } from './utils/actionValidation'\nimport { validateActions } from './utils/actionValidation'\nimport { useT } from '@open-mercato/shared/lib/i18n/context'\nimport { useConfirmDialog } from '@open-mercato/ui/backend/confirm-dialog'\nimport type { OpenMercatoCallOptionsResponse } from '../lib/openmercato-call-options-types'\n\nexport type ActionBuilderProps = {\n value: Action[] | null | undefined\n onChange: (value: Action[]) => void\n error?: string\n showJsonPreview?: boolean\n label?: string\n emptyMessage?: string\n}\n\nexport function ActionBuilder({\n value,\n onChange,\n error,\n showJsonPreview = false,\n label,\n emptyMessage,\n}: ActionBuilderProps) {\n const t = useT()\n const { confirm: confirmDialog, ConfirmDialogElement } = useConfirmDialog()\n const [showDebug, setShowDebug] = React.useState(false)\n const [openMercatoOptions, setOpenMercatoOptions] = React.useState<OpenMercatoCallOptionsState>({\n endpoints: [],\n apiKeys: [],\n loading: true,\n error: null,\n })\n const actions = React.useMemo(() => value || [], [value])\n\n React.useEffect(() => {\n let cancelled = false\n\n async function loadOpenMercatoOptions() {\n setOpenMercatoOptions((current) => ({ ...current, loading: true, error: null }))\n try {\n const response = await apiCall<OpenMercatoCallOptionsResponse>('/api/business_rules/openmercato-call-options')\n if (!response.ok || !response.result) {\n const error = response.result && 'error' in response.result\n ? String((response.result as any).error)\n : t('business_rules.components.actionRow.openMercato.options.fetchFailed', { status: response.status })\n throw new Error(error)\n }\n if (!cancelled) {\n setOpenMercatoOptions({\n endpoints: Array.isArray(response.result.endpoints) ? response.result.endpoints : [],\n apiKeys: Array.isArray(response.result.apiKeys) ? response.result.apiKeys : [],\n loading: false,\n error: null,\n })\n }\n } catch (error) {\n if (!cancelled) {\n setOpenMercatoOptions({\n endpoints: [],\n apiKeys: [],\n loading: false,\n error: error instanceof Error ? error.message : String(error),\n })\n }\n }\n }\n\n void loadOpenMercatoOptions()\n return () => {\n cancelled = true\n }\n }, [t])\n\n const handleAddAction = () => {\n const newAction: Action = {\n type: '',\n config: {},\n }\n onChange([...actions, newAction])\n }\n\n const handleChangeAction = (index: number, updatedAction: Action) => {\n const newActions = [...actions]\n newActions[index] = updatedAction\n onChange(newActions)\n }\n\n const handleDeleteAction = (index: number) => {\n const newActions = actions.filter((_, i) => i !== index)\n onChange(newActions)\n }\n\n const handleMoveUp = (index: number) => {\n if (index === 0) return\n const newActions = [...actions]\n const temp = newActions[index - 1]\n newActions[index - 1] = newActions[index]\n newActions[index] = temp\n onChange(newActions)\n }\n\n const handleMoveDown = (index: number) => {\n if (index === actions.length - 1) return\n const newActions = [...actions]\n const temp = newActions[index + 1]\n newActions[index + 1] = newActions[index]\n newActions[index] = temp\n onChange(newActions)\n }\n\n const handleClearAll = async () => {\n const confirmed = await confirmDialog({\n title: t('business_rules.components.actionBuilder.confirm.clearAll'),\n variant: 'destructive',\n })\n if (confirmed) {\n onChange([])\n }\n }\n\n // Validate actions (memoized to avoid expensive re-computation)\n const validation = React.useMemo(() => {\n return validateActions(actions, t)\n }, [actions, t])\n\n return (\n <div className=\"space-y-3\">\n {/* Header */}\n <div className=\"flex items-center justify-between\">\n <div className=\"flex items-center gap-2\">\n <h3 className=\"text-sm font-medium text-foreground\">\n {label || t('business_rules.components.actionBuilder.label')}\n </h3>\n {actions.length > 0 && (\n <span className=\"text-xs text-muted-foreground\">\n ({t('business_rules.components.actionBuilder.actionCount', { count: actions.length })})\n </span>\n )}\n </div>\n\n {/* Controls */}\n <div className=\"flex items-center gap-2\">\n {showJsonPreview && actions.length > 0 && (\n <Button\n type=\"button\"\n onClick={() => setShowDebug(!showDebug)}\n variant=\"muted\"\n size=\"2xs\"\n title={t('business_rules.components.actionBuilder.jsonPreview.toggle')}\n >\n <Code className=\"w-3 h-3\" />\n {showDebug\n ? t('business_rules.components.actionBuilder.jsonPreview.hide')\n : t('business_rules.components.actionBuilder.jsonPreview.show')\n }\n </Button>\n )}\n </div>\n </div>\n\n {/* Empty State */}\n {actions.length === 0 ? (\n <div className=\"flex flex-col items-center justify-center p-8 border-2 border-dashed border-border rounded-lg bg-muted\">\n <p className=\"text-sm text-muted-foreground mb-4\">\n {emptyMessage || t('business_rules.components.actionBuilder.emptyMessage')}\n </p>\n <Button type=\"button\" onClick={handleAddAction} variant=\"outline\" size=\"sm\">\n <Plus className=\"w-4 h-4 mr-2\" />\n {t('business_rules.components.actionBuilder.addAction')}\n </Button>\n </div>\n ) : (\n <>\n {/* Action List */}\n <div className=\"space-y-2\">\n {actions.map((action, index) => (\n <ActionRow\n key={index}\n action={action}\n index={index}\n onChange={handleChangeAction}\n onDelete={handleDeleteAction}\n onMoveUp={index > 0 ? handleMoveUp : undefined}\n onMoveDown={index < actions.length - 1 ? handleMoveDown : undefined}\n canMoveUp={index > 0}\n canMoveDown={index < actions.length - 1}\n openMercatoOptions={openMercatoOptions}\n />\n ))}\n </div>\n\n {/* Add More / Clear All */}\n <div className=\"flex items-center justify-between\">\n <Button type=\"button\" onClick={handleAddAction} variant=\"outline\" size=\"sm\">\n <Plus className=\"w-4 h-4 mr-2\" />\n {t('business_rules.components.actionBuilder.addAction')}\n </Button>\n {actions.length > 1 && (\n <Button type=\"button\" onClick={handleClearAll} variant=\"outline\" size=\"sm\" className=\"text-status-error-text\">\n {t('business_rules.components.actionBuilder.clearAll')}\n </Button>\n )}\n </div>\n </>\n )}\n\n {/* Validation Errors */}\n {!validation.valid && (\n <div className=\"p-3 bg-status-error-bg border border-status-error-border rounded\">\n <p className=\"text-sm font-medium text-status-error-text mb-1\">\n {t('business_rules.components.actionBuilder.validationErrors')}\n </p>\n <ul className=\"list-disc list-inside space-y-0.5\">\n {validation.errors.map((err, index) => (\n <li key={index} className=\"text-xs text-status-error-text\">\n {err}\n </li>\n ))}\n </ul>\n </div>\n )}\n\n {/* External Error */}\n {error && (\n <div className=\"p-3 bg-status-error-bg border border-status-error-border rounded\">\n <p className=\"text-sm text-status-error-text\">{error}</p>\n </div>\n )}\n\n {/* JSON Preview */}\n {showDebug && actions.length > 0 && (\n <div className=\"p-3 bg-zinc-900 dark:bg-zinc-950 rounded text-xs font-mono overflow-x-auto border border-border\">\n <pre className=\"text-zinc-100\">{JSON.stringify(actions, null, 2)}</pre>\n </div>\n )}\n\n {/* Help Text */}\n {actions.length > 0 && (\n <div className=\"text-xs text-muted-foreground space-y-1\">\n <p>\n <strong>{t('business_rules.components.actionBuilder.help.actionOrder')}</strong>{' '}\n {t('business_rules.components.actionBuilder.help.actionOrderDescription')}\n </p>\n <p>\n <strong>{t('business_rules.components.actionBuilder.help.messageInterpolation')}</strong>{' '}\n {t('business_rules.components.actionBuilder.help.messageInterpolationDescription')}\n </p>\n </div>\n )}\n {ConfirmDialogElement}\n </div>\n )\n}\n"],
|
|
5
|
+
"mappings": ";AAyIU,SA0CF,U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AAQ,SAAS,KAChB,qBAAC,SAAI,WAAU,2CACb;AAAA,2BAAC,OACC;AAAA,4BAAC,YAAQ,YAAE,0DAA0D,GAAE;AAAA,QAAU;AAAA,QAChF,EAAE,qEAAqE;AAAA,SAC1E;AAAA,MACA,qBAAC,OACC;AAAA,4BAAC,YAAQ,YAAE,mEAAmE,GAAE;AAAA,QAAU;AAAA,QACzF,EAAE,8EAA8E;AAAA,SACnF;AAAA,OACF;AAAA,IAED;AAAA,KACH;AAEJ;",
|
|
6
|
+
"names": ["error"]
|
|
7
7
|
}
|
|
@@ -2,6 +2,9 @@
|
|
|
2
2
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { X, ChevronUp, ChevronDown } from "lucide-react";
|
|
4
4
|
import { Input } from "@open-mercato/ui/primitives/input";
|
|
5
|
+
import { Textarea } from "@open-mercato/ui/primitives/textarea";
|
|
6
|
+
import { IconButton } from "@open-mercato/ui/primitives/icon-button";
|
|
7
|
+
import { ComboboxInput } from "@open-mercato/ui/backend/inputs";
|
|
5
8
|
import {
|
|
6
9
|
Select,
|
|
7
10
|
SelectContent,
|
|
@@ -20,7 +23,8 @@ function ActionRow({
|
|
|
20
23
|
onMoveDown,
|
|
21
24
|
canMoveUp,
|
|
22
25
|
canMoveDown,
|
|
23
|
-
error
|
|
26
|
+
error,
|
|
27
|
+
openMercatoOptions
|
|
24
28
|
}) {
|
|
25
29
|
const t = useT();
|
|
26
30
|
const actionTypes = getActionTypeOptions(t);
|
|
@@ -43,6 +47,85 @@ function ActionRow({
|
|
|
43
47
|
}
|
|
44
48
|
});
|
|
45
49
|
};
|
|
50
|
+
const renderOpenMercatoConfig = () => {
|
|
51
|
+
const options = openMercatoOptions ?? { endpoints: [], apiKeys: [], loading: false, error: null };
|
|
52
|
+
const endpointValue = action.config?.endpoint && action.config?.method ? `${String(action.config.method).toUpperCase()} ${action.config.endpoint}` : void 0;
|
|
53
|
+
const apiKeyValue = action.config?.apiKeyId || void 0;
|
|
54
|
+
const endpointOptions = options.endpoints.map((option) => ({
|
|
55
|
+
value: option.id,
|
|
56
|
+
label: option.label,
|
|
57
|
+
description: option.summary || option.operationId || null
|
|
58
|
+
}));
|
|
59
|
+
const bodyValue = action.config?.body == null ? "" : typeof action.config.body === "string" ? action.config.body : JSON.stringify(action.config.body, null, 2);
|
|
60
|
+
const handleEndpointChange = (value) => {
|
|
61
|
+
const option = options.endpoints.find((candidate) => candidate.id === value);
|
|
62
|
+
if (!option) return;
|
|
63
|
+
onChange(index, {
|
|
64
|
+
...action,
|
|
65
|
+
config: {
|
|
66
|
+
...action.config || {},
|
|
67
|
+
endpoint: option.path,
|
|
68
|
+
method: option.method
|
|
69
|
+
}
|
|
70
|
+
});
|
|
71
|
+
};
|
|
72
|
+
return /* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
|
|
73
|
+
options.loading && /* @__PURE__ */ jsx("p", { className: "text-xs text-muted-foreground col-start-2", children: t("business_rules.components.actionRow.openMercato.options.loading") }),
|
|
74
|
+
options.error && /* @__PURE__ */ jsx("p", { className: "text-xs text-status-error-text col-start-2", children: t("business_rules.components.actionRow.openMercato.options.error", { error: options.error }) }),
|
|
75
|
+
!options.loading && !options.error && options.endpoints.length === 0 && /* @__PURE__ */ jsx("p", { className: "text-xs text-muted-foreground col-start-2", children: t("business_rules.components.actionRow.openMercato.options.noEndpoints") }),
|
|
76
|
+
!options.loading && !options.error && options.apiKeys.length === 0 && /* @__PURE__ */ jsx("p", { className: "text-xs text-muted-foreground col-start-2", children: t("business_rules.components.actionRow.openMercato.options.noApiKeys") }),
|
|
77
|
+
/* @__PURE__ */ jsxs("div", { className: "grid grid-cols-4 gap-2 items-center", children: [
|
|
78
|
+
/* @__PURE__ */ jsxs("label", { className: "text-xs font-medium text-foreground col-span-1", children: [
|
|
79
|
+
t("business_rules.components.actionRow.config.endpoint"),
|
|
80
|
+
" ",
|
|
81
|
+
/* @__PURE__ */ jsx("span", { className: "text-status-error-text", children: t("business_rules.components.actionRow.actionType.required") })
|
|
82
|
+
] }),
|
|
83
|
+
/* @__PURE__ */ jsx("div", { className: "col-span-3", children: /* @__PURE__ */ jsx(
|
|
84
|
+
ComboboxInput,
|
|
85
|
+
{
|
|
86
|
+
value: endpointValue ?? "",
|
|
87
|
+
onChange: handleEndpointChange,
|
|
88
|
+
suggestions: endpointOptions,
|
|
89
|
+
placeholder: t("business_rules.components.actionRow.config.endpoint.placeholder"),
|
|
90
|
+
disabled: options.loading || !!options.error || options.endpoints.length === 0,
|
|
91
|
+
allowCustomValues: false
|
|
92
|
+
}
|
|
93
|
+
) })
|
|
94
|
+
] }),
|
|
95
|
+
/* @__PURE__ */ jsxs("div", { className: "grid grid-cols-4 gap-2 items-center", children: [
|
|
96
|
+
/* @__PURE__ */ jsxs("label", { className: "text-xs font-medium text-foreground col-span-1", children: [
|
|
97
|
+
t("business_rules.components.actionRow.config.apiKey"),
|
|
98
|
+
" ",
|
|
99
|
+
/* @__PURE__ */ jsx("span", { className: "text-status-error-text", children: t("business_rules.components.actionRow.actionType.required") })
|
|
100
|
+
] }),
|
|
101
|
+
/* @__PURE__ */ jsxs(
|
|
102
|
+
Select,
|
|
103
|
+
{
|
|
104
|
+
value: apiKeyValue,
|
|
105
|
+
onValueChange: (next) => handleConfigChange("apiKeyId", next),
|
|
106
|
+
disabled: options.loading || !!options.error || options.apiKeys.length === 0,
|
|
107
|
+
children: [
|
|
108
|
+
/* @__PURE__ */ jsx(SelectTrigger, { size: "sm", className: "col-span-3", children: /* @__PURE__ */ jsx(SelectValue, { placeholder: t("business_rules.components.actionRow.config.apiKey.placeholder") }) }),
|
|
109
|
+
/* @__PURE__ */ jsx(SelectContent, { children: options.apiKeys.map((apiKey) => /* @__PURE__ */ jsx(SelectItem, { value: apiKey.id, children: apiKey.organizationName ? `${apiKey.name} (${apiKey.keyPrefix}, ${apiKey.organizationName})` : `${apiKey.name} (${apiKey.keyPrefix})` }, apiKey.id)) })
|
|
110
|
+
]
|
|
111
|
+
}
|
|
112
|
+
)
|
|
113
|
+
] }),
|
|
114
|
+
/* @__PURE__ */ jsxs("div", { className: "grid grid-cols-4 gap-2 items-start", children: [
|
|
115
|
+
/* @__PURE__ */ jsx("label", { className: "text-xs font-medium text-foreground col-span-1", children: t("business_rules.components.actionRow.config.body") }),
|
|
116
|
+
/* @__PURE__ */ jsx(
|
|
117
|
+
Textarea,
|
|
118
|
+
{
|
|
119
|
+
value: bodyValue,
|
|
120
|
+
onChange: (e) => handleConfigChange("body", e.target.value),
|
|
121
|
+
placeholder: t("business_rules.components.actionRow.config.body.placeholder"),
|
|
122
|
+
rows: 3,
|
|
123
|
+
className: "col-span-3"
|
|
124
|
+
}
|
|
125
|
+
)
|
|
126
|
+
] })
|
|
127
|
+
] });
|
|
128
|
+
};
|
|
46
129
|
const renderConfigField = (field, required) => {
|
|
47
130
|
const value = action.config?.[field] || "";
|
|
48
131
|
if (field === "recipients" && action.type === "NOTIFY") {
|
|
@@ -50,7 +133,7 @@ function ActionRow({
|
|
|
50
133
|
/* @__PURE__ */ jsxs("label", { className: "text-xs font-medium text-foreground col-span-1", children: [
|
|
51
134
|
t("business_rules.components.actionRow.config.recipients"),
|
|
52
135
|
" ",
|
|
53
|
-
required && /* @__PURE__ */ jsx("span", { className: "text-
|
|
136
|
+
required && /* @__PURE__ */ jsx("span", { className: "text-status-error-text", children: t("business_rules.components.actionRow.actionType.required") })
|
|
54
137
|
] }),
|
|
55
138
|
/* @__PURE__ */ jsx(
|
|
56
139
|
Input,
|
|
@@ -113,16 +196,16 @@ function ActionRow({
|
|
|
113
196
|
/* @__PURE__ */ jsxs("label", { className: "text-xs font-medium text-foreground col-span-1", children: [
|
|
114
197
|
t("business_rules.components.actionRow.config.message"),
|
|
115
198
|
" ",
|
|
116
|
-
required && /* @__PURE__ */ jsx("span", { className: "text-
|
|
199
|
+
required && /* @__PURE__ */ jsx("span", { className: "text-status-error-text", children: t("business_rules.components.actionRow.actionType.required") })
|
|
117
200
|
] }),
|
|
118
201
|
/* @__PURE__ */ jsx(
|
|
119
|
-
|
|
202
|
+
Textarea,
|
|
120
203
|
{
|
|
121
204
|
value,
|
|
122
205
|
onChange: (e) => handleConfigChange(field, e.target.value),
|
|
123
206
|
placeholder: t("business_rules.components.actionRow.config.message.placeholder"),
|
|
124
207
|
rows: 2,
|
|
125
|
-
className: "col-span-3
|
|
208
|
+
className: "col-span-3"
|
|
126
209
|
}
|
|
127
210
|
),
|
|
128
211
|
/* @__PURE__ */ jsx("div", { className: "col-span-4 col-start-2", children: /* @__PURE__ */ jsx("p", { className: "text-xs text-muted-foreground", children: t("business_rules.components.actionRow.config.message.help") }) })
|
|
@@ -132,7 +215,7 @@ function ActionRow({
|
|
|
132
215
|
/* @__PURE__ */ jsxs("label", { className: "text-xs font-medium text-foreground col-span-1", children: [
|
|
133
216
|
field,
|
|
134
217
|
" ",
|
|
135
|
-
required && /* @__PURE__ */ jsx("span", { className: "text-
|
|
218
|
+
required && /* @__PURE__ */ jsx("span", { className: "text-status-error-text", children: t("business_rules.components.actionRow.actionType.required") })
|
|
136
219
|
] }),
|
|
137
220
|
/* @__PURE__ */ jsx(
|
|
138
221
|
Input,
|
|
@@ -152,7 +235,7 @@ function ActionRow({
|
|
|
152
235
|
/* @__PURE__ */ jsxs("label", { className: "text-xs font-medium text-foreground col-span-1", children: [
|
|
153
236
|
t("business_rules.components.actionRow.actionType"),
|
|
154
237
|
" ",
|
|
155
|
-
/* @__PURE__ */ jsx("span", { className: "text-
|
|
238
|
+
/* @__PURE__ */ jsx("span", { className: "text-status-error-text", children: t("business_rules.components.actionRow.actionType.required") })
|
|
156
239
|
] }),
|
|
157
240
|
/* @__PURE__ */ jsxs(
|
|
158
241
|
Select,
|
|
@@ -166,42 +249,49 @@ function ActionRow({
|
|
|
166
249
|
}
|
|
167
250
|
)
|
|
168
251
|
] }),
|
|
169
|
-
action.type && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
252
|
+
action.type && /* @__PURE__ */ jsx(Fragment, { children: action.type === "CALL_OPEN_MERCATO" ? renderOpenMercatoConfig() : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
170
253
|
requiredFields.map((field) => renderConfigField(field, true)),
|
|
171
254
|
optionalFields.map((field) => renderConfigField(field, false))
|
|
172
|
-
] }),
|
|
173
|
-
error && /* @__PURE__ */ jsx("div", { className: "mt-2", children: /* @__PURE__ */ jsx("p", { className: "text-xs text-
|
|
255
|
+
] }) }),
|
|
256
|
+
error && /* @__PURE__ */ jsx("div", { className: "mt-2", children: /* @__PURE__ */ jsx("p", { className: "text-xs text-status-error-text", children: error }) })
|
|
174
257
|
] }),
|
|
175
258
|
/* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-1", children: [
|
|
176
259
|
onMoveUp && /* @__PURE__ */ jsx(
|
|
177
|
-
|
|
260
|
+
IconButton,
|
|
178
261
|
{
|
|
179
262
|
type: "button",
|
|
180
263
|
onClick: () => onMoveUp(index),
|
|
181
264
|
disabled: !canMoveUp,
|
|
182
|
-
|
|
265
|
+
variant: "ghost",
|
|
266
|
+
size: "xs",
|
|
183
267
|
title: t("business_rules.components.actionRow.moveUp"),
|
|
268
|
+
"aria-label": t("business_rules.components.actionRow.moveUp"),
|
|
184
269
|
children: /* @__PURE__ */ jsx(ChevronUp, { className: "w-4 h-4" })
|
|
185
270
|
}
|
|
186
271
|
),
|
|
187
272
|
onMoveDown && /* @__PURE__ */ jsx(
|
|
188
|
-
|
|
273
|
+
IconButton,
|
|
189
274
|
{
|
|
190
275
|
type: "button",
|
|
191
276
|
onClick: () => onMoveDown(index),
|
|
192
277
|
disabled: !canMoveDown,
|
|
193
|
-
|
|
278
|
+
variant: "ghost",
|
|
279
|
+
size: "xs",
|
|
194
280
|
title: t("business_rules.components.actionRow.moveDown"),
|
|
281
|
+
"aria-label": t("business_rules.components.actionRow.moveDown"),
|
|
195
282
|
children: /* @__PURE__ */ jsx(ChevronDown, { className: "w-4 h-4" })
|
|
196
283
|
}
|
|
197
284
|
),
|
|
198
285
|
/* @__PURE__ */ jsx(
|
|
199
|
-
|
|
286
|
+
IconButton,
|
|
200
287
|
{
|
|
201
288
|
type: "button",
|
|
202
289
|
onClick: () => onDelete(index),
|
|
203
|
-
|
|
290
|
+
variant: "ghost",
|
|
291
|
+
size: "xs",
|
|
292
|
+
className: "hover:text-status-error-text",
|
|
204
293
|
title: t("business_rules.components.actionRow.delete"),
|
|
294
|
+
"aria-label": t("business_rules.components.actionRow.delete"),
|
|
205
295
|
children: /* @__PURE__ */ jsx(X, { className: "w-4 h-4" })
|
|
206
296
|
}
|
|
207
297
|
)
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/modules/business_rules/components/ActionRow.tsx"],
|
|
4
|
-
"sourcesContent": ["\"use client\"\n\nimport * as React from 'react'\nimport { X, ChevronUp, ChevronDown } from 'lucide-react'\nimport { Input } from '@open-mercato/ui/primitives/input'\nimport {\n Select,\n SelectContent,\n SelectItem,\n SelectTrigger,\n SelectValue,\n} from '@open-mercato/ui/primitives/select'\nimport type { Action } from './utils/actionValidation'\nimport { getActionTypeOptions, getRequiredConfigFields, getOptionalConfigFields } from './utils/actionValidation'\nimport { useT } from '@open-mercato/shared/lib/i18n/context'\n\nexport type ActionRowProps = {\n action: Action\n index: number\n onChange: (index: number, action: Action) => void\n onDelete: (index: number) => void\n onMoveUp?: (index: number) => void\n onMoveDown?: (index: number) => void\n canMoveUp?: boolean\n canMoveDown?: boolean\n error?: string\n}\n\nexport function ActionRow({\n action,\n index,\n onChange,\n onDelete,\n onMoveUp,\n onMoveDown,\n canMoveUp,\n canMoveDown,\n error,\n}: ActionRowProps) {\n const t = useT()\n const actionTypes = getActionTypeOptions(t)\n const requiredFields = getRequiredConfigFields(action.type)\n const optionalFields = getOptionalConfigFields(action.type)\n\n const handleTypeChange = (e: React.ChangeEvent<HTMLSelectElement>) => {\n onChange(index, {\n ...action,\n type: e.target.value,\n config: {}, // Reset config when type changes\n })\n }\n\n const handleConfigChange = (field: string, value: any) => {\n onChange(index, {\n ...action,\n config: {\n ...(action.config || {}),\n [field]: value,\n },\n })\n }\n\n const renderConfigField = (field: string, required: boolean) => {\n const value = action.config?.[field] || ''\n\n // Special handling for different field types\n if (field === 'recipients' && action.type === 'NOTIFY') {\n return (\n <div key={field} className=\"grid grid-cols-4 gap-2 items-start\">\n <label className=\"text-xs font-medium text-foreground col-span-1\">\n {t('business_rules.components.actionRow.config.recipients')} {required && <span className=\"text-red-500\">{t('business_rules.components.actionRow.actionType.required')}</span>}\n </label>\n <Input\n type=\"text\"\n value={value}\n onChange={(e) => handleConfigChange(field, e.target.value.split(',').map((s) => s.trim()))}\n placeholder={t('business_rules.components.actionRow.config.recipients.placeholder')}\n className=\"col-span-3\"\n />\n <div className=\"col-span-4 col-start-2\">\n <p className=\"text-xs text-muted-foreground\">{t('business_rules.components.actionRow.config.recipients.help')}</p>\n </div>\n </div>\n )\n }\n\n if (field === 'level' && action.type === 'LOG') {\n return (\n <div key={field} className=\"grid grid-cols-4 gap-2 items-center\">\n <label className=\"text-xs font-medium text-foreground col-span-1\">{t('business_rules.components.actionRow.config.level')}</label>\n <Select\n value={value || 'info'}\n onValueChange={(next) => handleConfigChange(field, next)}\n >\n <SelectTrigger size=\"sm\" className=\"col-span-3\">\n <SelectValue />\n </SelectTrigger>\n <SelectContent>\n <SelectItem value=\"info\">{t('business_rules.components.actionRow.config.level.info')}</SelectItem>\n <SelectItem value=\"warn\">{t('business_rules.components.actionRow.config.level.warn')}</SelectItem>\n <SelectItem value=\"error\">{t('business_rules.components.actionRow.config.level.error')}</SelectItem>\n <SelectItem value=\"debug\">{t('business_rules.components.actionRow.config.level.debug')}</SelectItem>\n </SelectContent>\n </Select>\n </div>\n )\n }\n\n if (field === 'method' && action.type === 'CALL_WEBHOOK') {\n return (\n <div key={field} className=\"grid grid-cols-4 gap-2 items-center\">\n <label className=\"text-xs font-medium text-foreground col-span-1\">{t('business_rules.components.actionRow.config.method')}</label>\n <Select\n value={value || 'POST'}\n onValueChange={(next) => handleConfigChange(field, next)}\n >\n <SelectTrigger size=\"sm\" className=\"col-span-3\">\n <SelectValue />\n </SelectTrigger>\n <SelectContent>\n <SelectItem value=\"GET\">GET</SelectItem>\n <SelectItem value=\"POST\">POST</SelectItem>\n <SelectItem value=\"PUT\">PUT</SelectItem>\n <SelectItem value=\"PATCH\">PATCH</SelectItem>\n <SelectItem value=\"DELETE\">DELETE</SelectItem>\n </SelectContent>\n </Select>\n </div>\n )\n }\n\n if (field === 'message') {\n return (\n <div key={field} className=\"grid grid-cols-4 gap-2 items-start\">\n <label className=\"text-xs font-medium text-foreground col-span-1\">\n {t('business_rules.components.actionRow.config.message')} {required && <span className=\"text-red-500\">{t('business_rules.components.actionRow.actionType.required')}</span>}\n </label>\n <textarea\n value={value}\n onChange={(e) => handleConfigChange(field, e.target.value)}\n placeholder={t('business_rules.components.actionRow.config.message.placeholder')}\n rows={2}\n className=\"col-span-3 px-2 py-1.5 text-sm border border-border rounded bg-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring\"\n />\n <div className=\"col-span-4 col-start-2\">\n <p className=\"text-xs text-muted-foreground\">{t('business_rules.components.actionRow.config.message.help')}</p>\n </div>\n </div>\n )\n }\n\n // Default text input\n return (\n <div key={field} className=\"grid grid-cols-4 gap-2 items-center\">\n <label className=\"text-xs font-medium text-foreground col-span-1\">\n {field} {required && <span className=\"text-red-500\">{t('business_rules.components.actionRow.actionType.required')}</span>}\n </label>\n <Input\n type=\"text\"\n value={value}\n onChange={(e) => handleConfigChange(field, e.target.value)}\n placeholder={t('business_rules.components.actionRow.config.field.placeholder', { field })}\n className=\"col-span-3\"\n />\n </div>\n )\n }\n\n return (\n <div className=\"flex items-start gap-2 p-3 bg-muted rounded border border-border\">\n <div className=\"flex-1 space-y-2\">\n {/* Action Type */}\n <div className=\"grid grid-cols-4 gap-2 items-center\">\n <label className=\"text-xs font-medium text-foreground col-span-1\">\n {t('business_rules.components.actionRow.actionType')} <span className=\"text-red-500\">{t('business_rules.components.actionRow.actionType.required')}</span>\n </label>\n <Select\n value={action.type || undefined}\n onValueChange={(value) => handleTypeChange({ target: { value } } as React.ChangeEvent<HTMLSelectElement>)}\n >\n <SelectTrigger size=\"sm\" className=\"col-span-3 font-medium\">\n <SelectValue placeholder={t('business_rules.components.actionRow.actionType.placeholder')} />\n </SelectTrigger>\n <SelectContent>\n {actionTypes.map((type) => (\n <SelectItem key={type.value} value={type.value}>\n {type.label}\n </SelectItem>\n ))}\n </SelectContent>\n </Select>\n </div>\n\n {/* Config Fields */}\n {action.type && (\n <>\n {requiredFields.map((field) => renderConfigField(field, true))}\n {optionalFields.map((field) => renderConfigField(field, false))}\n </>\n )}\n\n {/* Error Display */}\n {error && (\n <div className=\"mt-2\">\n <p className=\"text-xs text-red-600\">{error}</p>\n </div>\n )}\n </div>\n\n {/* Control Buttons */}\n <div className=\"flex flex-col gap-1\">\n {onMoveUp && (\n <button\n type=\"button\"\n onClick={() => onMoveUp(index)}\n disabled={!canMoveUp}\n className=\"p-1 text-muted-foreground hover:text-foreground hover:bg-muted rounded transition-colors disabled:opacity-50 disabled:cursor-not-allowed\"\n title={t('business_rules.components.actionRow.moveUp')}\n >\n <ChevronUp className=\"w-4 h-4\" />\n </button>\n )}\n {onMoveDown && (\n <button\n type=\"button\"\n onClick={() => onMoveDown(index)}\n disabled={!canMoveDown}\n className=\"p-1 text-muted-foreground hover:text-foreground hover:bg-muted rounded transition-colors disabled:opacity-50 disabled:cursor-not-allowed\"\n title={t('business_rules.components.actionRow.moveDown')}\n >\n <ChevronDown className=\"w-4 h-4\" />\n </button>\n )}\n <button\n type=\"button\"\n onClick={() => onDelete(index)}\n className=\"p-1 text-muted-foreground hover:text-red-600 hover:bg-red-50 dark:hover:bg-red-900/20 rounded transition-colors\"\n title={t('business_rules.components.actionRow.delete')}\n >\n <X className=\"w-4 h-4\" />\n </button>\n </div>\n </div>\n )\n}\n"],
|
|
5
|
-
"mappings": ";
|
|
4
|
+
"sourcesContent": ["\"use client\"\n\nimport * as React from 'react'\nimport { X, ChevronUp, ChevronDown } from 'lucide-react'\nimport { Input } from '@open-mercato/ui/primitives/input'\nimport { Textarea } from '@open-mercato/ui/primitives/textarea'\nimport { IconButton } from '@open-mercato/ui/primitives/icon-button'\nimport { ComboboxInput, type ComboboxOption } from '@open-mercato/ui/backend/inputs'\nimport {\n Select,\n SelectContent,\n SelectItem,\n SelectTrigger,\n SelectValue,\n} from '@open-mercato/ui/primitives/select'\nimport type { Action } from './utils/actionValidation'\nimport { getActionTypeOptions, getRequiredConfigFields, getOptionalConfigFields } from './utils/actionValidation'\nimport { useT } from '@open-mercato/shared/lib/i18n/context'\nimport type {\n OpenMercatoApiKeyOption,\n OpenMercatoEndpointOption,\n} from '../lib/openmercato-call-options-types'\n\nexport type OpenMercatoCallOptionsState = {\n endpoints: OpenMercatoEndpointOption[]\n apiKeys: OpenMercatoApiKeyOption[]\n loading: boolean\n error: string | null\n}\n\nexport type ActionRowProps = {\n action: Action\n index: number\n onChange: (index: number, action: Action) => void\n onDelete: (index: number) => void\n onMoveUp?: (index: number) => void\n onMoveDown?: (index: number) => void\n canMoveUp?: boolean\n canMoveDown?: boolean\n error?: string\n openMercatoOptions?: OpenMercatoCallOptionsState\n}\n\nexport function ActionRow({\n action,\n index,\n onChange,\n onDelete,\n onMoveUp,\n onMoveDown,\n canMoveUp,\n canMoveDown,\n error,\n openMercatoOptions,\n}: ActionRowProps) {\n const t = useT()\n const actionTypes = getActionTypeOptions(t)\n const requiredFields = getRequiredConfigFields(action.type)\n const optionalFields = getOptionalConfigFields(action.type)\n\n const handleTypeChange = (e: React.ChangeEvent<HTMLSelectElement>) => {\n onChange(index, {\n ...action,\n type: e.target.value,\n config: {}, // Reset config when type changes\n })\n }\n\n const handleConfigChange = (field: string, value: any) => {\n onChange(index, {\n ...action,\n config: {\n ...(action.config || {}),\n [field]: value,\n },\n })\n }\n\n const renderOpenMercatoConfig = () => {\n const options = openMercatoOptions ?? { endpoints: [], apiKeys: [], loading: false, error: null }\n const endpointValue = action.config?.endpoint && action.config?.method\n ? `${String(action.config.method).toUpperCase()} ${action.config.endpoint}`\n : undefined\n const apiKeyValue = action.config?.apiKeyId || undefined\n const endpointOptions = options.endpoints.map<ComboboxOption>((option) => ({\n value: option.id,\n label: option.label,\n description: option.summary || option.operationId || null,\n }))\n const bodyValue = action.config?.body == null\n ? ''\n : typeof action.config.body === 'string'\n ? action.config.body\n : JSON.stringify(action.config.body, null, 2)\n\n const handleEndpointChange = (value: string) => {\n const option = options.endpoints.find((candidate) => candidate.id === value)\n if (!option) return\n onChange(index, {\n ...action,\n config: {\n ...(action.config || {}),\n endpoint: option.path,\n method: option.method,\n },\n })\n }\n\n return (\n <div className=\"space-y-2\">\n {options.loading && (\n <p className=\"text-xs text-muted-foreground col-start-2\">\n {t('business_rules.components.actionRow.openMercato.options.loading')}\n </p>\n )}\n {options.error && (\n <p className=\"text-xs text-status-error-text col-start-2\">\n {t('business_rules.components.actionRow.openMercato.options.error', { error: options.error })}\n </p>\n )}\n {!options.loading && !options.error && options.endpoints.length === 0 && (\n <p className=\"text-xs text-muted-foreground col-start-2\">\n {t('business_rules.components.actionRow.openMercato.options.noEndpoints')}\n </p>\n )}\n {!options.loading && !options.error && options.apiKeys.length === 0 && (\n <p className=\"text-xs text-muted-foreground col-start-2\">\n {t('business_rules.components.actionRow.openMercato.options.noApiKeys')}\n </p>\n )}\n\n <div className=\"grid grid-cols-4 gap-2 items-center\">\n <label className=\"text-xs font-medium text-foreground col-span-1\">\n {t('business_rules.components.actionRow.config.endpoint')} <span className=\"text-status-error-text\">{t('business_rules.components.actionRow.actionType.required')}</span>\n </label>\n <div className=\"col-span-3\">\n <ComboboxInput\n value={endpointValue ?? ''}\n onChange={handleEndpointChange}\n suggestions={endpointOptions}\n placeholder={t('business_rules.components.actionRow.config.endpoint.placeholder')}\n disabled={options.loading || !!options.error || options.endpoints.length === 0}\n allowCustomValues={false}\n />\n </div>\n </div>\n\n <div className=\"grid grid-cols-4 gap-2 items-center\">\n <label className=\"text-xs font-medium text-foreground col-span-1\">\n {t('business_rules.components.actionRow.config.apiKey')} <span className=\"text-status-error-text\">{t('business_rules.components.actionRow.actionType.required')}</span>\n </label>\n <Select\n value={apiKeyValue}\n onValueChange={(next) => handleConfigChange('apiKeyId', next)}\n disabled={options.loading || !!options.error || options.apiKeys.length === 0}\n >\n <SelectTrigger size=\"sm\" className=\"col-span-3\">\n <SelectValue placeholder={t('business_rules.components.actionRow.config.apiKey.placeholder')} />\n </SelectTrigger>\n <SelectContent>\n {options.apiKeys.map((apiKey) => (\n <SelectItem key={apiKey.id} value={apiKey.id}>\n {apiKey.organizationName\n ? `${apiKey.name} (${apiKey.keyPrefix}, ${apiKey.organizationName})`\n : `${apiKey.name} (${apiKey.keyPrefix})`}\n </SelectItem>\n ))}\n </SelectContent>\n </Select>\n </div>\n\n <div className=\"grid grid-cols-4 gap-2 items-start\">\n <label className=\"text-xs font-medium text-foreground col-span-1\">\n {t('business_rules.components.actionRow.config.body')}\n </label>\n <Textarea\n value={bodyValue}\n onChange={(e) => handleConfigChange('body', e.target.value)}\n placeholder={t('business_rules.components.actionRow.config.body.placeholder')}\n rows={3}\n className=\"col-span-3\"\n />\n </div>\n </div>\n )\n }\n\n const renderConfigField = (field: string, required: boolean) => {\n const value = action.config?.[field] || ''\n\n // Special handling for different field types\n if (field === 'recipients' && action.type === 'NOTIFY') {\n return (\n <div key={field} className=\"grid grid-cols-4 gap-2 items-start\">\n <label className=\"text-xs font-medium text-foreground col-span-1\">\n {t('business_rules.components.actionRow.config.recipients')} {required && <span className=\"text-status-error-text\">{t('business_rules.components.actionRow.actionType.required')}</span>}\n </label>\n <Input\n type=\"text\"\n value={value}\n onChange={(e) => handleConfigChange(field, e.target.value.split(',').map((s) => s.trim()))}\n placeholder={t('business_rules.components.actionRow.config.recipients.placeholder')}\n className=\"col-span-3\"\n />\n <div className=\"col-span-4 col-start-2\">\n <p className=\"text-xs text-muted-foreground\">{t('business_rules.components.actionRow.config.recipients.help')}</p>\n </div>\n </div>\n )\n }\n\n if (field === 'level' && action.type === 'LOG') {\n return (\n <div key={field} className=\"grid grid-cols-4 gap-2 items-center\">\n <label className=\"text-xs font-medium text-foreground col-span-1\">{t('business_rules.components.actionRow.config.level')}</label>\n <Select\n value={value || 'info'}\n onValueChange={(next) => handleConfigChange(field, next)}\n >\n <SelectTrigger size=\"sm\" className=\"col-span-3\">\n <SelectValue />\n </SelectTrigger>\n <SelectContent>\n <SelectItem value=\"info\">{t('business_rules.components.actionRow.config.level.info')}</SelectItem>\n <SelectItem value=\"warn\">{t('business_rules.components.actionRow.config.level.warn')}</SelectItem>\n <SelectItem value=\"error\">{t('business_rules.components.actionRow.config.level.error')}</SelectItem>\n <SelectItem value=\"debug\">{t('business_rules.components.actionRow.config.level.debug')}</SelectItem>\n </SelectContent>\n </Select>\n </div>\n )\n }\n\n if (field === 'method' && action.type === 'CALL_WEBHOOK') {\n return (\n <div key={field} className=\"grid grid-cols-4 gap-2 items-center\">\n <label className=\"text-xs font-medium text-foreground col-span-1\">{t('business_rules.components.actionRow.config.method')}</label>\n <Select\n value={value || 'POST'}\n onValueChange={(next) => handleConfigChange(field, next)}\n >\n <SelectTrigger size=\"sm\" className=\"col-span-3\">\n <SelectValue />\n </SelectTrigger>\n <SelectContent>\n <SelectItem value=\"GET\">GET</SelectItem>\n <SelectItem value=\"POST\">POST</SelectItem>\n <SelectItem value=\"PUT\">PUT</SelectItem>\n <SelectItem value=\"PATCH\">PATCH</SelectItem>\n <SelectItem value=\"DELETE\">DELETE</SelectItem>\n </SelectContent>\n </Select>\n </div>\n )\n }\n\n if (field === 'message') {\n return (\n <div key={field} className=\"grid grid-cols-4 gap-2 items-start\">\n <label className=\"text-xs font-medium text-foreground col-span-1\">\n {t('business_rules.components.actionRow.config.message')} {required && <span className=\"text-status-error-text\">{t('business_rules.components.actionRow.actionType.required')}</span>}\n </label>\n <Textarea\n value={value}\n onChange={(e) => handleConfigChange(field, e.target.value)}\n placeholder={t('business_rules.components.actionRow.config.message.placeholder')}\n rows={2}\n className=\"col-span-3\"\n />\n <div className=\"col-span-4 col-start-2\">\n <p className=\"text-xs text-muted-foreground\">{t('business_rules.components.actionRow.config.message.help')}</p>\n </div>\n </div>\n )\n }\n\n // Default text input\n return (\n <div key={field} className=\"grid grid-cols-4 gap-2 items-center\">\n <label className=\"text-xs font-medium text-foreground col-span-1\">\n {field} {required && <span className=\"text-status-error-text\">{t('business_rules.components.actionRow.actionType.required')}</span>}\n </label>\n <Input\n type=\"text\"\n value={value}\n onChange={(e) => handleConfigChange(field, e.target.value)}\n placeholder={t('business_rules.components.actionRow.config.field.placeholder', { field })}\n className=\"col-span-3\"\n />\n </div>\n )\n }\n\n return (\n <div className=\"flex items-start gap-2 p-3 bg-muted rounded border border-border\">\n <div className=\"flex-1 space-y-2\">\n {/* Action Type */}\n <div className=\"grid grid-cols-4 gap-2 items-center\">\n <label className=\"text-xs font-medium text-foreground col-span-1\">\n {t('business_rules.components.actionRow.actionType')} <span className=\"text-status-error-text\">{t('business_rules.components.actionRow.actionType.required')}</span>\n </label>\n <Select\n value={action.type || undefined}\n onValueChange={(value) => handleTypeChange({ target: { value } } as React.ChangeEvent<HTMLSelectElement>)}\n >\n <SelectTrigger size=\"sm\" className=\"col-span-3 font-medium\">\n <SelectValue placeholder={t('business_rules.components.actionRow.actionType.placeholder')} />\n </SelectTrigger>\n <SelectContent>\n {actionTypes.map((type) => (\n <SelectItem key={type.value} value={type.value}>\n {type.label}\n </SelectItem>\n ))}\n </SelectContent>\n </Select>\n </div>\n\n {/* Config Fields */}\n {action.type && (\n <>\n {action.type === 'CALL_OPEN_MERCATO'\n ? renderOpenMercatoConfig()\n : (\n <>\n {requiredFields.map((field) => renderConfigField(field, true))}\n {optionalFields.map((field) => renderConfigField(field, false))}\n </>\n )}\n </>\n )}\n\n {/* Error Display */}\n {error && (\n <div className=\"mt-2\">\n <p className=\"text-xs text-status-error-text\">{error}</p>\n </div>\n )}\n </div>\n\n {/* Control Buttons */}\n <div className=\"flex flex-col gap-1\">\n {onMoveUp && (\n <IconButton\n type=\"button\"\n onClick={() => onMoveUp(index)}\n disabled={!canMoveUp}\n variant=\"ghost\"\n size=\"xs\"\n title={t('business_rules.components.actionRow.moveUp')}\n aria-label={t('business_rules.components.actionRow.moveUp')}\n >\n <ChevronUp className=\"w-4 h-4\" />\n </IconButton>\n )}\n {onMoveDown && (\n <IconButton\n type=\"button\"\n onClick={() => onMoveDown(index)}\n disabled={!canMoveDown}\n variant=\"ghost\"\n size=\"xs\"\n title={t('business_rules.components.actionRow.moveDown')}\n aria-label={t('business_rules.components.actionRow.moveDown')}\n >\n <ChevronDown className=\"w-4 h-4\" />\n </IconButton>\n )}\n <IconButton\n type=\"button\"\n onClick={() => onDelete(index)}\n variant=\"ghost\"\n size=\"xs\"\n className=\"hover:text-status-error-text\"\n title={t('business_rules.components.actionRow.delete')}\n aria-label={t('business_rules.components.actionRow.delete')}\n >\n <X className=\"w-4 h-4\" />\n </IconButton>\n </div>\n </div>\n )\n}\n"],
|
|
5
|
+
"mappings": ";AA+GU,SAqNM,UArNN,KAqBA,YArBA;AA5GV,SAAS,GAAG,WAAW,mBAAmB;AAC1C,SAAS,aAAa;AACtB,SAAS,gBAAgB;AACzB,SAAS,kBAAkB;AAC3B,SAAS,qBAA0C;AACnD;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAEP,SAAS,sBAAsB,yBAAyB,+BAA+B;AACvF,SAAS,YAAY;AA0Bd,SAAS,UAAU;AAAA,EACxB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,GAAmB;AACjB,QAAM,IAAI,KAAK;AACf,QAAM,cAAc,qBAAqB,CAAC;AAC1C,QAAM,iBAAiB,wBAAwB,OAAO,IAAI;AAC1D,QAAM,iB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WAAW,KAAK;AAAA,UAC/B,UAAU,CAAC;AAAA,UACX,SAAQ;AAAA,UACR,MAAK;AAAA,UACL,OAAO,EAAE,8CAA8C;AAAA,UACvD,cAAY,EAAE,8CAA8C;AAAA,UAE5D,8BAAC,eAAY,WAAU,WAAU;AAAA;AAAA,MACnC;AAAA,MAEF;AAAA,QAAC;AAAA;AAAA,UACC,MAAK;AAAA,UACL,SAAS,MAAM,SAAS,KAAK;AAAA,UAC7B,SAAQ;AAAA,UACR,MAAK;AAAA,UACL,WAAU;AAAA,UACV,OAAO,EAAE,4CAA4C;AAAA,UACrD,cAAY,EAAE,4CAA4C;AAAA,UAE1D,8BAAC,KAAE,WAAU,WAAU;AAAA;AAAA,MACzB;AAAA,OACF;AAAA,KACF;AAEJ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -8,6 +8,7 @@ const ACTION_TYPES = [
|
|
|
8
8
|
"NOTIFY",
|
|
9
9
|
"SET_FIELD",
|
|
10
10
|
"CALL_WEBHOOK",
|
|
11
|
+
"CALL_OPEN_MERCATO",
|
|
11
12
|
"EMIT_EVENT"
|
|
12
13
|
];
|
|
13
14
|
function getActionTypeOptions(t) {
|
|
@@ -21,6 +22,7 @@ function getActionTypeOptions(t) {
|
|
|
21
22
|
{ value: "NOTIFY", label: t("business_rules.validation.actionTypes.NOTIFY") },
|
|
22
23
|
{ value: "SET_FIELD", label: t("business_rules.validation.actionTypes.SET_FIELD") },
|
|
23
24
|
{ value: "CALL_WEBHOOK", label: t("business_rules.validation.actionTypes.CALL_WEBHOOK") },
|
|
25
|
+
{ value: "CALL_OPEN_MERCATO", label: t("business_rules.validation.actionTypes.CALL_OPEN_MERCATO") },
|
|
24
26
|
{ value: "EMIT_EVENT", label: t("business_rules.validation.actionTypes.EMIT_EVENT") }
|
|
25
27
|
];
|
|
26
28
|
}
|
|
@@ -37,6 +39,8 @@ function getRequiredConfigFields(actionType) {
|
|
|
37
39
|
return ["field", "value"];
|
|
38
40
|
case "CALL_WEBHOOK":
|
|
39
41
|
return ["url"];
|
|
42
|
+
case "CALL_OPEN_MERCATO":
|
|
43
|
+
return ["endpoint", "method", "apiKeyId"];
|
|
40
44
|
case "EMIT_EVENT":
|
|
41
45
|
return ["eventName"];
|
|
42
46
|
case "ALLOW_TRANSITION":
|
|
@@ -53,6 +57,8 @@ function getOptionalConfigFields(actionType) {
|
|
|
53
57
|
return ["template"];
|
|
54
58
|
case "CALL_WEBHOOK":
|
|
55
59
|
return ["method", "headers", "body"];
|
|
60
|
+
case "CALL_OPEN_MERCATO":
|
|
61
|
+
return ["body"];
|
|
56
62
|
case "EMIT_EVENT":
|
|
57
63
|
return ["payload"];
|
|
58
64
|
default:
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../src/modules/business_rules/components/utils/actionValidation.ts"],
|
|
4
|
-
"sourcesContent": ["export type TranslatorFn = (key: string, params?: Record<string, any>) => string\n\nexport type Action = {\n type: string\n config?: Record<string, any>\n}\n\nexport type ValidationResult = {\n valid: boolean\n errors: string[]\n}\n\n/**\n * Available action types\n */\nexport const ACTION_TYPES = [\n 'ALLOW_TRANSITION',\n 'BLOCK_TRANSITION',\n 'LOG',\n 'SHOW_ERROR',\n 'SHOW_WARNING',\n 'SHOW_INFO',\n 'NOTIFY',\n 'SET_FIELD',\n 'CALL_WEBHOOK',\n 'EMIT_EVENT',\n] as const\n\nexport type ActionType = (typeof ACTION_TYPES)[number]\n\n/**\n * Get action type options for dropdown\n */\nexport function getActionTypeOptions(t: TranslatorFn): { value: string; label: string }[] {\n return [\n { value: 'ALLOW_TRANSITION', label: t('business_rules.validation.actionTypes.ALLOW_TRANSITION') },\n { value: 'BLOCK_TRANSITION', label: t('business_rules.validation.actionTypes.BLOCK_TRANSITION') },\n { value: 'LOG', label: t('business_rules.validation.actionTypes.LOG') },\n { value: 'SHOW_ERROR', label: t('business_rules.validation.actionTypes.SHOW_ERROR') },\n { value: 'SHOW_WARNING', label: t('business_rules.validation.actionTypes.SHOW_WARNING') },\n { value: 'SHOW_INFO', label: t('business_rules.validation.actionTypes.SHOW_INFO') },\n { value: 'NOTIFY', label: t('business_rules.validation.actionTypes.NOTIFY') },\n { value: 'SET_FIELD', label: t('business_rules.validation.actionTypes.SET_FIELD') },\n { value: 'CALL_WEBHOOK', label: t('business_rules.validation.actionTypes.CALL_WEBHOOK') },\n { value: 'EMIT_EVENT', label: t('business_rules.validation.actionTypes.EMIT_EVENT') },\n ]\n}\n\n/**\n * Get required config fields for an action type\n */\nexport function getRequiredConfigFields(actionType: string): string[] {\n switch (actionType) {\n case 'LOG':\n case 'SHOW_ERROR':\n case 'SHOW_WARNING':\n case 'SHOW_INFO':\n return ['message']\n case 'NOTIFY':\n return ['message', 'recipients']\n case 'SET_FIELD':\n return ['field', 'value']\n case 'CALL_WEBHOOK':\n return ['url']\n case 'EMIT_EVENT':\n return ['eventName']\n case 'ALLOW_TRANSITION':\n case 'BLOCK_TRANSITION':\n default:\n return []\n }\n}\n\n/**\n * Get optional config fields for an action type\n */\nexport function getOptionalConfigFields(actionType: string): string[] {\n switch (actionType) {\n case 'LOG':\n return ['level']\n case 'NOTIFY':\n return ['template']\n case 'CALL_WEBHOOK':\n return ['method', 'headers', 'body']\n case 'EMIT_EVENT':\n return ['payload']\n default:\n return []\n }\n}\n\n/**\n * Validate a single action\n */\nexport function validateAction(action: Action, t?: TranslatorFn): ValidationResult {\n const errors: string[] = []\n const translate = t || ((key: string) => key)\n\n if (!action) {\n errors.push(translate('business_rules.validation.action.required'))\n return { valid: false, errors }\n }\n\n if (!action.type || typeof action.type !== 'string') {\n errors.push(translate('business_rules.validation.action.typeRequired'))\n } else if (!ACTION_TYPES.includes(action.type as ActionType)) {\n errors.push(translate('business_rules.validation.action.unknownType', { type: action.type, validTypes: ACTION_TYPES.join(', ') }))\n }\n\n const requiredFields = getRequiredConfigFields(action.type)\n if (requiredFields.length > 0) {\n if (!action.config) {\n errors.push(translate('business_rules.validation.action.configRequired', { type: action.type, fields: requiredFields.join(', ') }))\n } else {\n requiredFields.forEach((field) => {\n if (!action.config![field]) {\n errors.push(translate('business_rules.validation.action.fieldMissing', { field }))\n }\n })\n }\n }\n\n return {\n valid: errors.length === 0,\n errors,\n }\n}\n\n/**\n * Validate action config for a specific type\n */\nexport function validateActionConfig(actionType: string, config: Record<string, any> | undefined, t?: TranslatorFn): ValidationResult {\n const errors: string[] = []\n const translate = t || ((key: string) => key)\n\n const requiredFields = getRequiredConfigFields(actionType)\n if (requiredFields.length > 0 && !config) {\n errors.push(translate('business_rules.validation.action.configRequiredForType', { type: actionType }))\n return { valid: false, errors }\n }\n\n if (config) {\n requiredFields.forEach((field) => {\n if (!config[field]) {\n errors.push(translate('business_rules.validation.action.fieldMissingShort', { field }))\n }\n })\n }\n\n return {\n valid: errors.length === 0,\n errors,\n }\n}\n\n/**\n * Validate array of actions\n */\nexport function validateActions(actions: Action[] | null | undefined, t?: TranslatorFn): ValidationResult {\n if (!actions || actions.length === 0) {\n return { valid: true, errors: [] } // Empty is valid\n }\n\n const errors: string[] = []\n const translate = t || ((key: string) => key)\n\n actions.forEach((action, index) => {\n const result = validateAction(action, t)\n if (!result.valid) {\n errors.push(translate('business_rules.validation.action.indexError', { index: index + 1, errors: result.errors.join(', ') }))\n }\n })\n\n return {\n valid: errors.length === 0,\n errors,\n }\n}\n"],
|
|
5
|
-
"mappings": "AAeO,MAAM,eAAe;AAAA,EAC1B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AAOO,SAAS,qBAAqB,GAAqD;AACxF,SAAO;AAAA,IACL,EAAE,OAAO,oBAAoB,OAAO,EAAE,wDAAwD,EAAE;AAAA,IAChG,EAAE,OAAO,oBAAoB,OAAO,EAAE,wDAAwD,EAAE;AAAA,IAChG,EAAE,OAAO,OAAO,OAAO,EAAE,2CAA2C,EAAE;AA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AA,MACxF;AAAA,IACF,CAAC;AAAA,EACH;AAEA,SAAO;AAAA,IACL,OAAO,OAAO,WAAW;AAAA,IACzB;AAAA,EACF;AACF;AAKO,SAAS,gBAAgB,SAAsC,GAAoC;AACxG,MAAI,CAAC,WAAW,QAAQ,WAAW,GAAG;AACpC,WAAO,EAAE,OAAO,MAAM,QAAQ,CAAC,EAAE;AAAA,EACnC;AAEA,QAAM,SAAmB,CAAC;AAC1B,QAAM,YAAY,MAAM,CAAC,QAAgB;AAEzC,UAAQ,QAAQ,CAAC,QAAQ,UAAU;AACjC,UAAM,SAAS,eAAe,QAAQ,CAAC;AACvC,QAAI,CAAC,OAAO,OAAO;AACjB,aAAO,KAAK,UAAU,+CAA+C,EAAE,OAAO,QAAQ,GAAG,QAAQ,OAAO,OAAO,KAAK,IAAI,EAAE,CAAC,CAAC;AAAA,IAC9H;AAAA,EACF,CAAC;AAED,SAAO;AAAA,IACL,OAAO,OAAO,WAAW;AAAA,IACzB;AAAA,EACF;AACF;",
|
|
4
|
+
"sourcesContent": ["export type TranslatorFn = (key: string, params?: Record<string, any>) => string\n\nexport type Action = {\n type: string\n config?: Record<string, any>\n}\n\nexport type ValidationResult = {\n valid: boolean\n errors: string[]\n}\n\n/**\n * Available action types\n */\nexport const ACTION_TYPES = [\n 'ALLOW_TRANSITION',\n 'BLOCK_TRANSITION',\n 'LOG',\n 'SHOW_ERROR',\n 'SHOW_WARNING',\n 'SHOW_INFO',\n 'NOTIFY',\n 'SET_FIELD',\n 'CALL_WEBHOOK',\n 'CALL_OPEN_MERCATO',\n 'EMIT_EVENT',\n] as const\n\nexport type ActionType = (typeof ACTION_TYPES)[number]\n\n/**\n * Get action type options for dropdown\n */\nexport function getActionTypeOptions(t: TranslatorFn): { value: string; label: string }[] {\n return [\n { value: 'ALLOW_TRANSITION', label: t('business_rules.validation.actionTypes.ALLOW_TRANSITION') },\n { value: 'BLOCK_TRANSITION', label: t('business_rules.validation.actionTypes.BLOCK_TRANSITION') },\n { value: 'LOG', label: t('business_rules.validation.actionTypes.LOG') },\n { value: 'SHOW_ERROR', label: t('business_rules.validation.actionTypes.SHOW_ERROR') },\n { value: 'SHOW_WARNING', label: t('business_rules.validation.actionTypes.SHOW_WARNING') },\n { value: 'SHOW_INFO', label: t('business_rules.validation.actionTypes.SHOW_INFO') },\n { value: 'NOTIFY', label: t('business_rules.validation.actionTypes.NOTIFY') },\n { value: 'SET_FIELD', label: t('business_rules.validation.actionTypes.SET_FIELD') },\n { value: 'CALL_WEBHOOK', label: t('business_rules.validation.actionTypes.CALL_WEBHOOK') },\n { value: 'CALL_OPEN_MERCATO', label: t('business_rules.validation.actionTypes.CALL_OPEN_MERCATO') },\n { value: 'EMIT_EVENT', label: t('business_rules.validation.actionTypes.EMIT_EVENT') },\n ]\n}\n\n/**\n * Get required config fields for an action type\n */\nexport function getRequiredConfigFields(actionType: string): string[] {\n switch (actionType) {\n case 'LOG':\n case 'SHOW_ERROR':\n case 'SHOW_WARNING':\n case 'SHOW_INFO':\n return ['message']\n case 'NOTIFY':\n return ['message', 'recipients']\n case 'SET_FIELD':\n return ['field', 'value']\n case 'CALL_WEBHOOK':\n return ['url']\n case 'CALL_OPEN_MERCATO':\n return ['endpoint', 'method', 'apiKeyId']\n case 'EMIT_EVENT':\n return ['eventName']\n case 'ALLOW_TRANSITION':\n case 'BLOCK_TRANSITION':\n default:\n return []\n }\n}\n\n/**\n * Get optional config fields for an action type\n */\nexport function getOptionalConfigFields(actionType: string): string[] {\n switch (actionType) {\n case 'LOG':\n return ['level']\n case 'NOTIFY':\n return ['template']\n case 'CALL_WEBHOOK':\n return ['method', 'headers', 'body']\n case 'CALL_OPEN_MERCATO':\n return ['body']\n case 'EMIT_EVENT':\n return ['payload']\n default:\n return []\n }\n}\n\n/**\n * Validate a single action\n */\nexport function validateAction(action: Action, t?: TranslatorFn): ValidationResult {\n const errors: string[] = []\n const translate = t || ((key: string) => key)\n\n if (!action) {\n errors.push(translate('business_rules.validation.action.required'))\n return { valid: false, errors }\n }\n\n if (!action.type || typeof action.type !== 'string') {\n errors.push(translate('business_rules.validation.action.typeRequired'))\n } else if (!ACTION_TYPES.includes(action.type as ActionType)) {\n errors.push(translate('business_rules.validation.action.unknownType', { type: action.type, validTypes: ACTION_TYPES.join(', ') }))\n }\n\n const requiredFields = getRequiredConfigFields(action.type)\n if (requiredFields.length > 0) {\n if (!action.config) {\n errors.push(translate('business_rules.validation.action.configRequired', { type: action.type, fields: requiredFields.join(', ') }))\n } else {\n requiredFields.forEach((field) => {\n if (!action.config![field]) {\n errors.push(translate('business_rules.validation.action.fieldMissing', { field }))\n }\n })\n }\n }\n\n return {\n valid: errors.length === 0,\n errors,\n }\n}\n\n/**\n * Validate action config for a specific type\n */\nexport function validateActionConfig(actionType: string, config: Record<string, any> | undefined, t?: TranslatorFn): ValidationResult {\n const errors: string[] = []\n const translate = t || ((key: string) => key)\n\n const requiredFields = getRequiredConfigFields(actionType)\n if (requiredFields.length > 0 && !config) {\n errors.push(translate('business_rules.validation.action.configRequiredForType', { type: actionType }))\n return { valid: false, errors }\n }\n\n if (config) {\n requiredFields.forEach((field) => {\n if (!config[field]) {\n errors.push(translate('business_rules.validation.action.fieldMissingShort', { field }))\n }\n })\n }\n\n return {\n valid: errors.length === 0,\n errors,\n }\n}\n\n/**\n * Validate array of actions\n */\nexport function validateActions(actions: Action[] | null | undefined, t?: TranslatorFn): ValidationResult {\n if (!actions || actions.length === 0) {\n return { valid: true, errors: [] } // Empty is valid\n }\n\n const errors: string[] = []\n const translate = t || ((key: string) => key)\n\n actions.forEach((action, index) => {\n const result = validateAction(action, t)\n if (!result.valid) {\n errors.push(translate('business_rules.validation.action.indexError', { index: index + 1, errors: result.errors.join(', ') }))\n }\n })\n\n return {\n valid: errors.length === 0,\n errors,\n }\n}\n"],
|
|
5
|
+
"mappings": "AAeO,MAAM,eAAe;AAAA,EAC1B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA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