@endora-commerce/mod-carts 0.100.0

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.
Files changed (155) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +62 -0
  3. package/dist/admin/components/CartApprovalPolicyPanel.d.ts +51 -0
  4. package/dist/admin/components/CartApprovalPolicyPanel.d.ts.map +1 -0
  5. package/dist/admin/components/CartApprovalPolicyPanel.js +59 -0
  6. package/dist/admin/components/CartApprovalPolicyPanel.js.map +1 -0
  7. package/dist/admin/index.d.ts +38 -0
  8. package/dist/admin/index.d.ts.map +1 -0
  9. package/dist/admin/index.js +73 -0
  10. package/dist/admin/index.js.map +1 -0
  11. package/dist/admin/pages/CartDetail.d.ts +3 -0
  12. package/dist/admin/pages/CartDetail.d.ts.map +1 -0
  13. package/dist/admin/pages/CartDetail.js +74 -0
  14. package/dist/admin/pages/CartDetail.js.map +1 -0
  15. package/dist/admin/pages/CartsList.d.ts +3 -0
  16. package/dist/admin/pages/CartsList.d.ts.map +1 -0
  17. package/dist/admin/pages/CartsList.js +90 -0
  18. package/dist/admin/pages/CartsList.js.map +1 -0
  19. package/dist/admin/zones/CartApprovalPolicy.d.ts +29 -0
  20. package/dist/admin/zones/CartApprovalPolicy.d.ts.map +1 -0
  21. package/dist/admin/zones/CartApprovalPolicy.js +11 -0
  22. package/dist/admin/zones/CartApprovalPolicy.js.map +1 -0
  23. package/dist/backend/cli/abandonment-sweep.d.ts +64 -0
  24. package/dist/backend/cli/abandonment-sweep.d.ts.map +1 -0
  25. package/dist/backend/cli/abandonment-sweep.js +17 -0
  26. package/dist/backend/cli/abandonment-sweep.js.map +1 -0
  27. package/dist/backend/entities/cart-audit-entry.entity.d.ts +29 -0
  28. package/dist/backend/entities/cart-audit-entry.entity.d.ts.map +1 -0
  29. package/dist/backend/entities/cart-audit-entry.entity.js +109 -0
  30. package/dist/backend/entities/cart-audit-entry.entity.js.map +1 -0
  31. package/dist/backend/entities/cart-item.entity.d.ts +42 -0
  32. package/dist/backend/entities/cart-item.entity.d.ts.map +1 -0
  33. package/dist/backend/entities/cart-item.entity.js +119 -0
  34. package/dist/backend/entities/cart-item.entity.js.map +1 -0
  35. package/dist/backend/entities/cart.entity.d.ts +96 -0
  36. package/dist/backend/entities/cart.entity.d.ts.map +1 -0
  37. package/dist/backend/entities/cart.entity.js +207 -0
  38. package/dist/backend/entities/cart.entity.js.map +1 -0
  39. package/dist/backend/index.d.ts +122 -0
  40. package/dist/backend/index.d.ts.map +1 -0
  41. package/dist/backend/index.js +184 -0
  42. package/dist/backend/index.js.map +1 -0
  43. package/dist/backend/routes.admin.d.ts +31 -0
  44. package/dist/backend/routes.admin.d.ts.map +1 -0
  45. package/dist/backend/routes.admin.js +95 -0
  46. package/dist/backend/routes.admin.js.map +1 -0
  47. package/dist/backend/routes.d.ts +101 -0
  48. package/dist/backend/routes.d.ts.map +1 -0
  49. package/dist/backend/routes.js +620 -0
  50. package/dist/backend/routes.js.map +1 -0
  51. package/dist/backend/routes.organization.d.ts +29 -0
  52. package/dist/backend/routes.organization.d.ts.map +1 -0
  53. package/dist/backend/routes.organization.js +150 -0
  54. package/dist/backend/routes.organization.js.map +1 -0
  55. package/dist/backend/services/cart-abandonment-settings.d.ts +34 -0
  56. package/dist/backend/services/cart-abandonment-settings.d.ts.map +1 -0
  57. package/dist/backend/services/cart-abandonment-settings.js +55 -0
  58. package/dist/backend/services/cart-abandonment-settings.js.map +1 -0
  59. package/dist/backend/services/cart-abandonment-worker.d.ts +110 -0
  60. package/dist/backend/services/cart-abandonment-worker.d.ts.map +1 -0
  61. package/dist/backend/services/cart-abandonment-worker.js +185 -0
  62. package/dist/backend/services/cart-abandonment-worker.js.map +1 -0
  63. package/dist/backend/services/cart-admin-service.d.ts +58 -0
  64. package/dist/backend/services/cart-admin-service.d.ts.map +1 -0
  65. package/dist/backend/services/cart-admin-service.js +397 -0
  66. package/dist/backend/services/cart-admin-service.js.map +1 -0
  67. package/dist/backend/services/cart-approval-service.d.ts +147 -0
  68. package/dist/backend/services/cart-approval-service.d.ts.map +1 -0
  69. package/dist/backend/services/cart-approval-service.js +242 -0
  70. package/dist/backend/services/cart-approval-service.js.map +1 -0
  71. package/dist/backend/services/cart-audit-service.d.ts +75 -0
  72. package/dist/backend/services/cart-audit-service.d.ts.map +1 -0
  73. package/dist/backend/services/cart-audit-service.js +70 -0
  74. package/dist/backend/services/cart-audit-service.js.map +1 -0
  75. package/dist/backend/services/cart-conversion-service.d.ts +104 -0
  76. package/dist/backend/services/cart-conversion-service.d.ts.map +1 -0
  77. package/dist/backend/services/cart-conversion-service.js +175 -0
  78. package/dist/backend/services/cart-conversion-service.js.map +1 -0
  79. package/dist/backend/services/cart-coupon-service.d.ts +129 -0
  80. package/dist/backend/services/cart-coupon-service.d.ts.map +1 -0
  81. package/dist/backend/services/cart-coupon-service.js +244 -0
  82. package/dist/backend/services/cart-coupon-service.js.map +1 -0
  83. package/dist/backend/services/cart-organization-visibility-service.d.ts +43 -0
  84. package/dist/backend/services/cart-organization-visibility-service.d.ts.map +1 -0
  85. package/dist/backend/services/cart-organization-visibility-service.js +98 -0
  86. package/dist/backend/services/cart-organization-visibility-service.js.map +1 -0
  87. package/dist/backend/services/cart-placement-apply-port.d.ts +38 -0
  88. package/dist/backend/services/cart-placement-apply-port.d.ts.map +1 -0
  89. package/dist/backend/services/cart-placement-apply-port.js +71 -0
  90. package/dist/backend/services/cart-placement-apply-port.js.map +1 -0
  91. package/dist/backend/services/cart-pricing-recompute.d.ts +62 -0
  92. package/dist/backend/services/cart-pricing-recompute.d.ts.map +1 -0
  93. package/dist/backend/services/cart-pricing-recompute.js +131 -0
  94. package/dist/backend/services/cart-pricing-recompute.js.map +1 -0
  95. package/dist/backend/services/cart-query-service.d.ts +29 -0
  96. package/dist/backend/services/cart-query-service.d.ts.map +1 -0
  97. package/dist/backend/services/cart-query-service.js +40 -0
  98. package/dist/backend/services/cart-query-service.js.map +1 -0
  99. package/dist/backend/services/cart-read-port.d.ts +40 -0
  100. package/dist/backend/services/cart-read-port.d.ts.map +1 -0
  101. package/dist/backend/services/cart-read-port.js +144 -0
  102. package/dist/backend/services/cart-read-port.js.map +1 -0
  103. package/dist/backend/services/cart-recompute-cache.d.ts +49 -0
  104. package/dist/backend/services/cart-recompute-cache.d.ts.map +1 -0
  105. package/dist/backend/services/cart-recompute-cache.js +56 -0
  106. package/dist/backend/services/cart-recompute-cache.js.map +1 -0
  107. package/dist/backend/services/cart-service.d.ts +165 -0
  108. package/dist/backend/services/cart-service.d.ts.map +1 -0
  109. package/dist/backend/services/cart-service.js +556 -0
  110. package/dist/backend/services/cart-service.js.map +1 -0
  111. package/dist/backend/services/cart-state-machine.d.ts +51 -0
  112. package/dist/backend/services/cart-state-machine.d.ts.map +1 -0
  113. package/dist/backend/services/cart-state-machine.js +74 -0
  114. package/dist/backend/services/cart-state-machine.js.map +1 -0
  115. package/dist/backend/services/cart-upsell-service.d.ts +57 -0
  116. package/dist/backend/services/cart-upsell-service.d.ts.map +1 -0
  117. package/dist/backend/services/cart-upsell-service.js +100 -0
  118. package/dist/backend/services/cart-upsell-service.js.map +1 -0
  119. package/dist/backend/services/customer-group-resolver.d.ts +27 -0
  120. package/dist/backend/services/customer-group-resolver.d.ts.map +1 -0
  121. package/dist/backend/services/customer-group-resolver.js +32 -0
  122. package/dist/backend/services/customer-group-resolver.js.map +1 -0
  123. package/dist/manifest.d.ts +221 -0
  124. package/dist/manifest.d.ts.map +1 -0
  125. package/dist/manifest.js +224 -0
  126. package/dist/manifest.js.map +1 -0
  127. package/dist/migrations/20260611T140352_carts_consolidation.d.ts +43 -0
  128. package/dist/migrations/20260611T140352_carts_consolidation.d.ts.map +1 -0
  129. package/dist/migrations/20260611T140352_carts_consolidation.js +237 -0
  130. package/dist/migrations/20260611T140352_carts_consolidation.js.map +1 -0
  131. package/dist/migrations/20260611T140413_carts_cart_item_packaging.d.ts +12 -0
  132. package/dist/migrations/20260611T140413_carts_cart_item_packaging.d.ts.map +1 -0
  133. package/dist/migrations/20260611T140413_carts_cart_item_packaging.js +20 -0
  134. package/dist/migrations/20260611T140413_carts_cart_item_packaging.js.map +1 -0
  135. package/dist/migrations/20260818T081253_carts_cart_completed_order_fk.d.ts +50 -0
  136. package/dist/migrations/20260818T081253_carts_cart_completed_order_fk.d.ts.map +1 -0
  137. package/dist/migrations/20260818T081253_carts_cart_completed_order_fk.js +62 -0
  138. package/dist/migrations/20260818T081253_carts_cart_completed_order_fk.js.map +1 -0
  139. package/dist/migrations/20260830T112911_carts_organization_attribution_check.d.ts +67 -0
  140. package/dist/migrations/20260830T112911_carts_organization_attribution_check.d.ts.map +1 -0
  141. package/dist/migrations/20260830T112911_carts_organization_attribution_check.js +121 -0
  142. package/dist/migrations/20260830T112911_carts_organization_attribution_check.js.map +1 -0
  143. package/dist/migrations/index.d.ts +30 -0
  144. package/dist/migrations/index.d.ts.map +1 -0
  145. package/dist/migrations/index.js +35 -0
  146. package/dist/migrations/index.js.map +1 -0
  147. package/dist/ports/index.d.ts +106 -0
  148. package/dist/ports/index.d.ts.map +1 -0
  149. package/dist/ports/index.js +2 -0
  150. package/dist/ports/index.js.map +1 -0
  151. package/docs/carts.md +232 -0
  152. package/i18n/en.json +96 -0
  153. package/i18n/pl.json +96 -0
  154. package/package.json +107 -0
  155. package/tailwind.css +14 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Endora sp. z o.o. and the Endora Commerce contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,62 @@
1
+ <!-- Generated by `pnpm --filter backend run manifests:generate`. Delete this line to take the file over; a README without it is never regenerated. -->
2
+
3
+ # @endora-commerce/mod-carts
4
+
5
+ Shopping cart aggregation, pricing, lifecycle, and approval gate.
6
+
7
+ ## What this is
8
+
9
+ An **Endora Commerce module package**. Its module id is `carts` — the identity of record in the platform's registries, in its migrations and in its setting, permission and translation codes.
10
+
11
+ A module is not imported by application code. The platform discovers the extension packages an instance has installed, reads the manifest on the root subpath and composes the module from it, so installing this package and starting the instance is the whole integration.
12
+
13
+ ## Entry points
14
+
15
+ | Import | Contents |
16
+ | --- | --- |
17
+ | `@endora-commerce/mod-carts` | the module manifest — its id, version, dependencies, settings and activation |
18
+ | `@endora-commerce/mod-carts/admin` | the Admin UI contribution: the screens, navigation and palette actions it adds |
19
+ | `@endora-commerce/mod-carts/backend` | the composition root the platform calls, with the entities, services, routes and workers it registers |
20
+ | `@endora-commerce/mod-carts/migrations` | the module’s own schema migrations, in the order the platform runs them |
21
+ | `@endora-commerce/mod-carts/ports` | type-only — the port interfaces other modules resolve this one through |
22
+ | `@endora-commerce/mod-carts/tailwind.css` | the Tailwind source declaration for the admin code above |
23
+
24
+ ## Depends on
25
+
26
+ Everything below is a **peer** dependency, so the application resolves exactly one copy of each — two copies of a host or of React are a runtime failure rather than a type error. An entry marked *optional* is needed only by the layers that use it.
27
+
28
+ **Endora packages**
29
+
30
+ - `@endora-commerce/admin-kit` — *optional*
31
+ - `@endora-commerce/contracts`
32
+ - `@endora-commerce/platform`
33
+
34
+ **Third-party**
35
+
36
+ - `@fastify/cookie` ^11
37
+ - `@mikro-orm/core` ^6
38
+ - `@mikro-orm/migrations` ^6
39
+ - `@mikro-orm/postgresql` ^6
40
+ - `fastify` ^5
41
+ - `ioredis` ^5
42
+ - `lucide-react` ^1 — *optional*
43
+ - `react` ^19 — *optional*
44
+ - `react-router-dom` ^7 — *optional*
45
+ - `zod` ^4
46
+
47
+ ## What the tarball carries
48
+
49
+ - `dist/` — the compiled JavaScript and its type declarations
50
+ - `i18n/` — the translation bundles this package ships (`en`, `pl`), loaded by the platform
51
+ - `docs/` — the package’s own pages in the Endora Commerce documentation site
52
+ - `tailwind.css` — the Tailwind source declaration
53
+
54
+ ## Install
55
+
56
+ ```bash
57
+ pnpm add @endora-commerce/mod-carts
58
+ ```
59
+
60
+ ## Licence
61
+
62
+ MIT — the text is in `LICENSE`, beside this file.
@@ -0,0 +1,51 @@
1
+ import { type ReactNode } from 'react';
2
+ /**
3
+ * CartApprovalPolicyPanel (feature 027 US4).
4
+ *
5
+ * Lets a platform admin toggle the per-Organization
6
+ * `requires_cart_approval` policy on the Organization detail page.
7
+ * When on, ordinary members of the Org must submit their cart for
8
+ * an Organization Administrator's approval before checkout.
9
+ *
10
+ * On toggle-off, the backend cascades: every pending/approved cart in
11
+ * the Organization returns to `not_required` with an audit row.
12
+ *
13
+ * ## What P7b changed, and why the file was dead before it (feature 091, §10.5)
14
+ *
15
+ * It stood at `admin/src/modules/organizations/panels/`, **imported by
16
+ * nothing** — and it was the one `module-namespace` key of
17
+ * `backend/scripts/ledgers/foreign-module-ids.ts` that `organizations` carried,
18
+ * recorded because the file named this module's i18n namespace on another
19
+ * module's screen. The backend behind it was live the whole time, so the
20
+ * platform had the capability and no screen for it: a product gap rather than a
21
+ * stale panel, which is why the repair is to revive it here rather than to
22
+ * delete it.
23
+ *
24
+ * **It reads its own initial state.** `initialRequiresCartApproval` used to
25
+ * cross from `organizations`' detail payload as a prop, and a zone's props may
26
+ * not carry it (Z3: the other three contributors to `organization.detail.after`
27
+ * want neither the prop nor the request). This module owned a `PATCH` and no
28
+ * `GET`; §10.5 ruled for a `GET` of its own over parsing another module's
29
+ * payload for one boolean, so `routes.admin.ts` serves one, on the same
30
+ * `customers:manage` code and in the same response shape as the write.
31
+ *
32
+ * `onChanged` went with the prop and is not replaced: nothing on the
33
+ * organization detail screen re-renders from this policy, and a zone has no
34
+ * callback to hand a contributor.
35
+ *
36
+ * The nine `policy.*` keys are **new**, in this module's own bundle in both
37
+ * shipped languages. §10.5 recorded the copy as this module's eight existing
38
+ * `carts.policy.*` keys; measured, that spelling resolves to
39
+ * `bundle['carts']['carts.policy.title']` under the `carts` namespace and was
40
+ * in no bundle at all, so this panel had never rendered a translated word. They
41
+ * are `policy.*` here, which is the spelling this module's shipped keys use
42
+ * (`approval.banner.*`).
43
+ *
44
+ * Browser-verification note: switch interaction + the "policy off
45
+ * resets carts" notification copy need eyes.
46
+ */
47
+ export interface CartApprovalPolicyPanelProps {
48
+ organizationId: string;
49
+ }
50
+ export declare function CartApprovalPolicyPanel({ organizationId, }: CartApprovalPolicyPanelProps): ReactNode;
51
+ //# sourceMappingURL=CartApprovalPolicyPanel.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CartApprovalPolicyPanel.d.ts","sourceRoot":"","sources":["../../../src/admin/components/CartApprovalPolicyPanel.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAoC,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAczE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4CG;AAEH,MAAM,WAAW,4BAA4B;IAC3C,cAAc,EAAE,MAAM,CAAC;CACxB;AAKD,wBAAgB,uBAAuB,CAAC,EACtC,cAAc,GACf,EAAE,4BAA4B,GAAG,SAAS,CA4F1C"}
@@ -0,0 +1,59 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useCallback, useEffect, useState } from 'react';
3
+ import { ApiError, apiClient } from '@endora-commerce/admin-kit/lib';
4
+ import { Alert, AlertDescription, Button, Card, CardContent, CardHeader, CardTitle, Checkbox, } from '@endora-commerce/admin-kit/ui';
5
+ import { useTranslation } from '@endora-commerce/admin-kit/i18n';
6
+ const routeFor = (organizationId) => `/api/v1/admin/organizations/${encodeURIComponent(organizationId)}/cart-approval-policy`;
7
+ export function CartApprovalPolicyPanel({ organizationId, }) {
8
+ const t = useTranslation('carts');
9
+ const [requires, setRequires] = useState(false);
10
+ const [loading, setLoading] = useState(true);
11
+ const [busy, setBusy] = useState(false);
12
+ const [error, setError] = useState(null);
13
+ const [info, setInfo] = useState(null);
14
+ useEffect(() => {
15
+ let cancelled = false;
16
+ setLoading(true);
17
+ setError(null);
18
+ apiClient
19
+ .get(routeFor(organizationId))
20
+ .then((res) => {
21
+ if (!cancelled)
22
+ setRequires(res.data.requiresCartApproval);
23
+ })
24
+ .catch((err) => {
25
+ if (cancelled)
26
+ return;
27
+ setError(err instanceof ApiError ? err.envelope.error.message : t('policy.loadError'));
28
+ })
29
+ .finally(() => {
30
+ if (!cancelled)
31
+ setLoading(false);
32
+ });
33
+ return () => {
34
+ cancelled = true;
35
+ };
36
+ }, [organizationId, t]);
37
+ const handleToggle = useCallback(async (next) => {
38
+ setBusy(true);
39
+ setError(null);
40
+ setInfo(null);
41
+ try {
42
+ await apiClient.patch(routeFor(organizationId), { requiresCartApproval: next });
43
+ setRequires(next);
44
+ setInfo(next ? t('policy.turnedOn') : t('policy.turnedOff'));
45
+ }
46
+ catch (err) {
47
+ setError(err instanceof ApiError ? err.envelope.error.message : t('policy.saveError'));
48
+ // Roll back the optimistic toggle in the UI.
49
+ setRequires(!next);
50
+ }
51
+ finally {
52
+ setBusy(false);
53
+ }
54
+ }, [organizationId, t]);
55
+ return (_jsxs(Card, { className: "mb-4", children: [_jsx(CardHeader, { children: _jsx(CardTitle, { children: t('policy.title') }) }), _jsxs(CardContent, { className: "space-y-3", children: [_jsx("p", { className: "text-sm text-muted-foreground", children: t('policy.description') }), _jsxs("div", { className: "flex items-center gap-3", children: [_jsx(Checkbox, { id: `cart-approval-${organizationId}`, checked: requires, disabled: busy || loading, onChange: (e) => {
56
+ void handleToggle(e.target.checked);
57
+ } }), _jsx("label", { htmlFor: `cart-approval-${organizationId}`, className: "text-sm", children: requires ? t('policy.on') : t('policy.off') })] }), error ? (_jsx(Alert, { variant: "destructive", children: _jsx(AlertDescription, { children: error }) })) : null, info ? (_jsx(Alert, { children: _jsx(AlertDescription, { children: info }) })) : null, _jsx("p", { className: "text-xs text-muted-foreground", children: t('policy.hint') }), busy ? (_jsx(Button, { variant: "outline", size: "sm", disabled: true, children: t('policy.saving') })) : null] })] }));
58
+ }
59
+ //# sourceMappingURL=CartApprovalPolicyPanel.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CartApprovalPolicyPanel.js","sourceRoot":"","sources":["../../../src/admin/components/CartApprovalPolicyPanel.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,QAAQ,EAAkB,MAAM,OAAO,CAAC;AACzE,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,gCAAgC,CAAC;AACrE,OAAO,EACL,KAAK,EACL,gBAAgB,EAChB,MAAM,EACN,IAAI,EACJ,WAAW,EACX,UAAU,EACV,SAAS,EACT,QAAQ,GACT,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AAoDjE,MAAM,QAAQ,GAAG,CAAC,cAAsB,EAAU,EAAE,CAClD,+BAA+B,kBAAkB,CAAC,cAAc,CAAC,uBAAuB,CAAC;AAE3F,MAAM,UAAU,uBAAuB,CAAC,EACtC,cAAc,GACe;IAC7B,MAAM,CAAC,GAAG,cAAc,CAAC,OAAO,CAAC,CAAC;IA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,EAAE,IAAI,IAAI,OAAO,EACzB,QAAQ,EAAE,CAAC,CAAC,EAAQ,EAAE;oCACpB,KAAK,YAAY,CAAC,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;gCACtC,CAAC,GACD,EACF,gBAAO,OAAO,EAAE,iBAAiB,cAAc,EAAE,EAAE,SAAS,EAAC,SAAS,YACnE,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,YAAY,CAAC,GACtC,IACJ,EAEL,KAAK,CAAC,CAAC,CAAC,CACP,KAAC,KAAK,IAAC,OAAO,EAAC,aAAa,YAC1B,KAAC,gBAAgB,cAAE,KAAK,GAAoB,GACtC,CACT,CAAC,CAAC,CAAC,IAAI,EACP,IAAI,CAAC,CAAC,CAAC,CACN,KAAC,KAAK,cACJ,KAAC,gBAAgB,cAAE,IAAI,GAAoB,GACrC,CACT,CAAC,CAAC,CAAC,IAAI,EAER,YAAG,SAAS,EAAC,+BAA+B,YAAE,CAAC,CAAC,aAAa,CAAC,GAAK,EAElE,IAAI,CAAC,CAAC,CAAC,CACN,KAAC,MAAM,IAAC,OAAO,EAAC,SAAS,EAAC,IAAI,EAAC,IAAI,EAAC,QAAQ,kBACzC,CAAC,CAAC,eAAe,CAAC,GACZ,CACV,CAAC,CAAC,CAAC,IAAI,IACI,IACT,CACR,CAAC;AACJ,CAAC"}
@@ -0,0 +1,38 @@
1
+ /**
2
+ * `carts`' admin surface — two routes, one zone contribution and no sidebar
3
+ * entry, declared by the module that owns them (feature 091, Phase 4, batch
4
+ * four, and P7b;
5
+ * `specs/091-module-owned-admin-surfaces/contracts/admin-contribution.md`).
6
+ *
7
+ * **The locked-and-nav-less shape.** Batch two rejected this module twice over
8
+ * — once for declaring `activation.nonDeactivatable`, once for contributing no
9
+ * sidebar entry — and `plan.md`'s two rulings retire both grounds. What a
10
+ * locked module still has is the **permission** axis, which
11
+ * `useSurfaceVisibility` gates identically to presence, and what a nav-less
12
+ * module has is the **route**, which `admin/src/App.tsx`'s `ModuleRoute` gates
13
+ * on exactly that predicate. So the off-state proof here is three of the four
14
+ * cases driven over the two routes rather than over a sidebar this module has
15
+ * never had — `admin/test/modules/carts.module-owned-surface.test.tsx` — and
16
+ * the fourth is absent because the platform refuses to have it, which is
17
+ * asserted from the manifest rather than skipped
18
+ * (`backend/test/integration/carts/off-state.test.ts`).
19
+ *
20
+ * **Both routes gate on `carts:read`, which is read from the API and not from
21
+ * the neighbourhood.** `GET /api/v1/admin/carts` and
22
+ * `GET /api/v1/admin/carts/:id` both enforce it
23
+ * (`packages/modules/carts/src/backend/routes.admin.ts`). The detail screen's
24
+ * emergency reject posts to `/api/v1/admin/carts/:id/reject`, which enforces
25
+ * `carts:reject` — that gate stays on the API and is deliberately *not* the
26
+ * route's requirement: `carts:read` is what opens the screen, and an operator
27
+ * holding it but not `carts:reject` is meant to see the cart and be refused the
28
+ * action, which is what the screen already renders.
29
+ *
30
+ * **This entry exports data and nothing else** (R2), like every `./admin`
31
+ * layer: `check:module-boundary`'s D-171 rule designates a subpath as contract
32
+ * surface when it emits no runtime binding, and `./admin` deliberately does not
33
+ * qualify, so a consumer reaching into another module's `./admin` stays a
34
+ * counted boundary reach.
35
+ */
36
+ import { type AdminContributions } from '@endora-commerce/admin-kit/contributions';
37
+ export declare const contributions: AdminContributions;
38
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/admin/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,OAAO,EAEL,KAAK,kBAAkB,EACxB,MAAM,0CAA0C,CAAC;AAKlD,eAAO,MAAM,aAAa,EAAE,kBAiC3B,CAAC"}
@@ -0,0 +1,73 @@
1
+ /**
2
+ * `carts`' admin surface — two routes, one zone contribution and no sidebar
3
+ * entry, declared by the module that owns them (feature 091, Phase 4, batch
4
+ * four, and P7b;
5
+ * `specs/091-module-owned-admin-surfaces/contracts/admin-contribution.md`).
6
+ *
7
+ * **The locked-and-nav-less shape.** Batch two rejected this module twice over
8
+ * — once for declaring `activation.nonDeactivatable`, once for contributing no
9
+ * sidebar entry — and `plan.md`'s two rulings retire both grounds. What a
10
+ * locked module still has is the **permission** axis, which
11
+ * `useSurfaceVisibility` gates identically to presence, and what a nav-less
12
+ * module has is the **route**, which `admin/src/App.tsx`'s `ModuleRoute` gates
13
+ * on exactly that predicate. So the off-state proof here is three of the four
14
+ * cases driven over the two routes rather than over a sidebar this module has
15
+ * never had — `admin/test/modules/carts.module-owned-surface.test.tsx` — and
16
+ * the fourth is absent because the platform refuses to have it, which is
17
+ * asserted from the manifest rather than skipped
18
+ * (`backend/test/integration/carts/off-state.test.ts`).
19
+ *
20
+ * **Both routes gate on `carts:read`, which is read from the API and not from
21
+ * the neighbourhood.** `GET /api/v1/admin/carts` and
22
+ * `GET /api/v1/admin/carts/:id` both enforce it
23
+ * (`packages/modules/carts/src/backend/routes.admin.ts`). The detail screen's
24
+ * emergency reject posts to `/api/v1/admin/carts/:id/reject`, which enforces
25
+ * `carts:reject` — that gate stays on the API and is deliberately *not* the
26
+ * route's requirement: `carts:read` is what opens the screen, and an operator
27
+ * holding it but not `carts:reject` is meant to see the cart and be refused the
28
+ * action, which is what the screen already renders.
29
+ *
30
+ * **This entry exports data and nothing else** (R2), like every `./admin`
31
+ * layer: `check:module-boundary`'s D-171 rule designates a subpath as contract
32
+ * surface when it emits no runtime binding, and `./admin` deliberately does not
33
+ * qualify, so a consumer reaching into another module's `./admin` stays a
34
+ * counted boundary reach.
35
+ */
36
+ import { zoneComponent, } from '@endora-commerce/admin-kit/contributions';
37
+ /** The module's landing route: the platform-wide cart list. */
38
+ const ROUTE_PATH = '/carts';
39
+ export const contributions = {
40
+ routes: [
41
+ {
42
+ path: ROUTE_PATH,
43
+ component: () => import('./pages/CartsList.js'),
44
+ requiredPermission: 'carts:read',
45
+ index: true,
46
+ },
47
+ {
48
+ path: `${ROUTE_PATH}/:id`,
49
+ component: () => import('./pages/CartDetail.js'),
50
+ requiredPermission: 'carts:read',
51
+ },
52
+ ],
53
+ zones: [
54
+ // Weight 400 of four contributors to the organization detail's zone
55
+ // (feature 091, P7b): `sales_channels` at 100, `price_lists` at 200,
56
+ // `quick_order` at 300, then this panel. The first three are the order the
57
+ // operator saw when those panels were scattered through
58
+ // `OrganizationDetail.tsx`; this one is last because it is the addition —
59
+ // the panel behind it was imported by nothing and rendered nowhere (§10.5).
60
+ //
61
+ // **`customers:manage`, and not `carts:read`.** Both halves of the policy
62
+ // route enforce it — `packages/modules/carts/src/backend/routes.admin.ts`
63
+ // gates the `GET` and the `PATCH` on that one code — and a contribution
64
+ // declares one. `carts:read` opens this module's cart list and says nothing
65
+ // about an organization's policy, so declaring it would render a toggle
66
+ // that 403s on its first use.
67
+ zoneComponent('organization.detail.after', () => import('./zones/CartApprovalPolicy.js'), {
68
+ weight: 400,
69
+ requiredPermission: 'customers:manage',
70
+ }),
71
+ ],
72
+ };
73
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/admin/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,OAAO,EACL,aAAa,GAEd,MAAM,0CAA0C,CAAC;AAElD,+DAA+D;AAC/D,MAAM,UAAU,GAAG,QAAQ,CAAC;AAE5B,MAAM,CAAC,MAAM,aAAa,GAAuB;IAC/C,MAAM,EAAE;QACN;YACE,IAAI,EAAE,UAAU;YAChB,SAAS,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,sBAAsB,CAAC;YAC/C,kBAAkB,EAAE,YAAY;YAChC,KAAK,EAAE,IAAI;SACZ;QACD;YACE,IAAI,EAAE,GAAG,UAAU,MAAM;YACzB,SAAS,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,uBAAuB,CAAC;YAChD,kBAAkB,EAAE,YAAY;SACjC;KACF;IACD,KAAK,EAAE;QACL,oEAAoE;QACpE,qEAAqE;QACrE,2EAA2E;QAC3E,wDAAwD;QACxD,0EAA0E;QAC1E,4EAA4E;QAC5E,EAAE;QACF,0EAA0E;QAC1E,0EAA0E;QAC1E,wEAAwE;QACxE,4EAA4E;QAC5E,wEAAwE;QACxE,8BAA8B;QAC9B,aAAa,CAAC,2BAA2B,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,+BAA+B,CAAC,EAAE;YACxF,MAAM,EAAE,GAAG;YACX,kBAAkB,EAAE,kBAAkB;SACvC,CAAC;KACH;CACF,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { type ReactNode } from 'react';
2
+ export default function CartDetail(): ReactNode;
3
+ //# sourceMappingURL=CartDetail.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CartDetail.d.ts","sourceRoot":"","sources":["../../../src/admin/pages/CartDetail.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAoC,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AA2EzE,MAAM,CAAC,OAAO,UAAU,UAAU,IAAI,SAAS,CA2N9C"}
@@ -0,0 +1,74 @@
1
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
+ import { useCallback, useEffect, useState } from 'react';
3
+ import { useParams } from 'react-router-dom';
4
+ import { ApiError, apiClient, formatDateTime, formatMoney } from '@endora-commerce/admin-kit/lib';
5
+ import { Alert, AlertDescription, Badge, Button, Card, CardContent, Input, Label, PageHeader, Table, TableBody, TableCell, TableHead, TableHeader, TableRow, } from '@endora-commerce/admin-kit/ui';
6
+ import { useTranslation } from '@endora-commerce/admin-kit/i18n';
7
+ export default function CartDetail() {
8
+ const { id } = useParams();
9
+ const t = useTranslation('carts');
10
+ const [cart, setCart] = useState(null);
11
+ const [audit, setAudit] = useState([]);
12
+ const [loading, setLoading] = useState(true);
13
+ const [error, setError] = useState(null);
14
+ const [showReject, setShowReject] = useState(false);
15
+ const [rejectReason, setRejectReason] = useState('');
16
+ const [rejecting, setRejecting] = useState(false);
17
+ const load = useCallback(async () => {
18
+ if (!id)
19
+ return;
20
+ setLoading(true);
21
+ setError(null);
22
+ try {
23
+ const [detail, auditRes] = await Promise.all([
24
+ apiClient.get(`/api/v1/admin/carts/${id}`),
25
+ apiClient.get(`/api/v1/admin/carts/${id}/audit`),
26
+ ]);
27
+ setCart(detail.data);
28
+ setAudit(Array.isArray(auditRes.data) ? auditRes.data : []);
29
+ }
30
+ catch (err) {
31
+ setError(err instanceof ApiError ? err.envelope.error.message : 'Failed to load cart.');
32
+ }
33
+ finally {
34
+ setLoading(false);
35
+ }
36
+ }, [id]);
37
+ useEffect(() => {
38
+ void load();
39
+ }, [load]);
40
+ const handleReject = useCallback(async () => {
41
+ if (!id || rejectReason.trim().length === 0)
42
+ return;
43
+ setRejecting(true);
44
+ setError(null);
45
+ try {
46
+ await apiClient.post(`/api/v1/admin/carts/${id}/reject`, { reason: rejectReason.trim() });
47
+ setShowReject(false);
48
+ setRejectReason('');
49
+ await load();
50
+ }
51
+ catch (err) {
52
+ setError(err instanceof ApiError ? err.envelope.error.message : 'Failed to reject cart.');
53
+ }
54
+ finally {
55
+ setRejecting(false);
56
+ }
57
+ }, [id, rejectReason, load]);
58
+ if (loading) {
59
+ return _jsx("p", { className: "text-sm text-muted-foreground", children: t('carts.loading') });
60
+ }
61
+ if (!cart) {
62
+ return _jsx(Alert, { variant: "destructive", children: _jsx(AlertDescription, { children: error ?? 'Cart not found.' }) });
63
+ }
64
+ const isTerminal = cart.status === 'completed' || cart.status === 'rejected';
65
+ return (_jsxs(_Fragment, { children: [_jsx(PageHeader, { title: t('carts.detail.title'), description: cart.id }), error ? (_jsx(Alert, { variant: "destructive", className: "mb-4", children: _jsx(AlertDescription, { children: error }) })) : null, _jsx(Card, { className: "mb-4", children: _jsx(CardContent, { className: "pt-6 space-y-2", children: _jsxs("div", { className: "grid grid-cols-2 gap-2 md:grid-cols-4 text-sm", children: [_jsxs("div", { children: [_jsx(Label, { children: t('carts.column.status') }), _jsx(Badge, { children: cart.status })] }), _jsxs("div", { children: [_jsx(Label, { children: t('carts.column.approval') }), _jsx(Badge, { children: cart.approvalStatus })] }), _jsxs("div", { children: [_jsx(Label, { children: t('carts.column.owner') }), _jsx("span", { children: cart.ownerDisplayName ?? '(anon)' })] }), _jsxs("div", { children: [_jsx(Label, { children: t('carts.column.org') }), _jsx("span", { children: cart.organizationDisplayName ?? '—' })] }), _jsxs("div", { children: [_jsx(Label, { children: t('carts.column.lastActivity') }), _jsx("span", { children: formatDateTime(cart.lastActivityAt) })] }), _jsxs("div", { children: [_jsx(Label, { children: t('carts.column.created') }), _jsx("span", { children: formatDateTime(cart.createdAt) })] }), cart.appliedPromotionCode ? (_jsxs("div", { children: [_jsx(Label, { children: t('carts.column.coupon') }), _jsx(Badge, { variant: "secondary", children: cart.appliedPromotionCode })] })) : null, cart.convertedToQuoteRequestId ? (_jsxs("div", { children: [_jsx(Label, { children: t('carts.column.convertedToQr') }), _jsx("span", { className: "font-mono text-xs", children: cart.convertedToQuoteRequestId.slice(0, 8) })] })) : null, cart.rejectedReason ? (_jsxs("div", { className: "col-span-2 md:col-span-4", children: [_jsx(Label, { children: t('carts.column.rejectedReason') }), _jsxs("p", { className: "text-sm", children: [cart.rejectedReason, " ", _jsxs("span", { className: "text-muted-foreground text-xs", children: ["\u2014 ", cart.rejectedByActor] })] })] })) : null] }) }) }), _jsx(Card, { className: "mb-4", children: _jsxs(CardContent, { className: "pt-6", children: [_jsx("h2", { className: "font-semibold mb-2", children: t('carts.detail.lines') }), _jsxs(Table, { children: [_jsx(TableHeader, { children: _jsxs(TableRow, { children: [_jsx(TableHead, { children: t('carts.column.product') }), _jsx(TableHead, { children: t('carts.column.qty') }), _jsx(TableHead, { children: t('carts.column.unit') }), _jsx(TableHead, { children: t('carts.column.line') })] }) }), _jsxs(TableBody, { children: [cart.items.map((it) => (_jsxs(TableRow, { children: [_jsx(TableCell, { children: it.productName }), _jsx(TableCell, { className: "tabular-nums", children: it.quantity }), _jsx(TableCell, { className: "tabular-nums", children: formatMoney(it.unitPrice.amount, it.unitPrice.currency) }), _jsx(TableCell, { className: "tabular-nums", children: formatMoney(it.lineTotal.amount, it.lineTotal.currency) })] }, it.id))), cart.discount && cart.discount.amount > 0 ? (_jsxs(TableRow, { children: [_jsx(TableCell, { colSpan: 3, className: "text-right text-muted-foreground", children: t('carts.column.discount') }), _jsxs(TableCell, { className: "tabular-nums text-ok", children: ["\u2212", formatMoney(cart.discount.amount, cart.discount.currency)] })] })) : null, _jsxs(TableRow, { children: [_jsx(TableCell, { colSpan: 3, className: "text-right font-semibold", children: t('carts.column.total') }), _jsx(TableCell, { className: "tabular-nums font-semibold", children: formatMoney(cart.total.amount, cart.total.currency) })] })] })] })] }) }), !isTerminal ? (_jsx(Card, { className: "mb-4", children: _jsx(CardContent, { className: "pt-6", children: showReject ? (_jsxs("div", { className: "space-y-2", children: [_jsx(Label, { htmlFor: "reason", children: t('carts.reject.reasonLabel') }), _jsx(Input, { id: "reason", value: rejectReason, onChange: (e) => setRejectReason(e.target.value), placeholder: t('carts.reject.reasonPlaceholder'), disabled: rejecting }), _jsxs("div", { className: "flex gap-2", children: [_jsx(Button, { onClick: () => {
66
+ void handleReject();
67
+ }, disabled: rejecting || rejectReason.trim().length === 0, children: rejecting
68
+ ? t('carts.reject.submitting')
69
+ : t('carts.reject.confirm') }), _jsx(Button, { variant: "outline", onClick: () => {
70
+ setShowReject(false);
71
+ setRejectReason('');
72
+ }, disabled: rejecting, children: t('carts.reject.cancel') })] })] })) : (_jsx(Button, { variant: "destructive", onClick: () => setShowReject(true), children: t('carts.reject.open') })) }) })) : null, _jsx(Card, { children: _jsxs(CardContent, { className: "pt-6", children: [_jsx("h2", { className: "font-semibold mb-2", children: t('carts.detail.audit') }), audit.length === 0 ? (_jsx("p", { className: "text-sm text-muted-foreground", children: t('carts.detail.auditEmpty') })) : (_jsxs(Table, { children: [_jsx(TableHeader, { children: _jsxs(TableRow, { children: [_jsx(TableHead, { children: t('carts.audit.when') }), _jsx(TableHead, { children: t('carts.audit.who') }), _jsx(TableHead, { children: t('carts.audit.action') }), _jsx(TableHead, { children: t('carts.audit.transition') }), _jsx(TableHead, { children: t('carts.audit.reason') })] }) }), _jsx(TableBody, { children: audit.map((row) => (_jsxs(TableRow, { children: [_jsx(TableCell, { className: "text-xs", children: formatDateTime(row.occurredAt) }), _jsxs(TableCell, { className: "text-xs", children: [_jsx("span", { className: "text-muted-foreground", children: row.actorType }), row.actorDisplayName ? ` · ${row.actorDisplayName}` : ''] }), _jsx(TableCell, { children: _jsx(Badge, { variant: "secondary", children: row.action }) }), _jsxs(TableCell, { className: "text-xs", children: [row.fromState ?? '—', " \u2192 ", row.toState ?? '—'] }), _jsx(TableCell, { className: "text-xs", children: row.reason ?? '' })] }, row.id))) })] }))] }) })] }));
73
+ }
74
+ //# sourceMappingURL=CartDetail.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CartDetail.js","sourceRoot":"","sources":["../../../src/admin/pages/CartDetail.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,QAAQ,EAAkB,MAAM,OAAO,CAAC;AACzE,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,gCAAgC,CAAC;AAClG,OAAO,EACL,KAAK,EACL,gBAAgB,EAChB,KAAK,EACL,MAAM,EACN,IAAI,EACJ,WAAW,EACX,KAAK,EACL,KAAK,EACL,UAAU,EACV,KAAK,EACL,SAAS,EACT,SAAS,EACT,SAAS,EACT,WAAW,EACX,QAAQ,GACT,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AAuDjE,MAAM,CAAC,OAAO,UAAU,UAAU;IAChC,MAAM,EAAE,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AAgB,CAAC,CAAC,CAAC,MAAM,GAAG,CAAC,gBAAgB,EAAE,CAAC,CAAC,CAAC,EAAE,IAC/C,EACZ,KAAC,SAAS,cAAC,KAAC,KAAK,IAAC,OAAO,EAAC,WAAW,YAAE,GAAG,CAAC,MAAM,GAAS,GAAY,EACtE,MAAC,SAAS,IAAC,SAAS,EAAC,SAAS,aAC3B,GAAG,CAAC,SAAS,IAAI,GAAG,cAAK,GAAG,CAAC,OAAO,IAAI,GAAG,IAClC,EACZ,KAAC,SAAS,IAAC,SAAS,EAAC,SAAS,YAAE,GAAG,CAAC,MAAM,IAAI,EAAE,GAAa,KAVhD,GAAG,CAAC,EAAE,CAWV,CACZ,CAAC,GACQ,IACN,CACT,IACW,GACT,IACN,CACJ,CAAC;AACJ,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { type ReactNode } from 'react';
2
+ export default function CartsList(): ReactNode;
3
+ //# sourceMappingURL=CartsList.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CartsList.d.ts","sourceRoot":"","sources":["../../../src/admin/pages/CartsList.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAoC,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AA6DzE,MAAM,CAAC,OAAO,UAAU,SAAS,IAAI,SAAS,CAmK7C"}
@@ -0,0 +1,90 @@
1
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
+ import { useCallback, useEffect, useState } from 'react';
3
+ import { Link } from 'react-router-dom';
4
+ import { ArrowRight } from 'lucide-react';
5
+ import { ApiError, apiClient, formatDateTime, formatMoney } from '@endora-commerce/admin-kit/lib';
6
+ import { Alert, AlertDescription, Badge, Button, Card, CardContent, Label, PageHeader, Select, } from '@endora-commerce/admin-kit/ui';
7
+ import { ResponsiveTable } from '@endora-commerce/admin-kit/components';
8
+ import { useTranslation } from '@endora-commerce/admin-kit/i18n';
9
+ const STATUSES = ['active', 'abandoned', 'completed', 'rejected'];
10
+ const APPROVAL_STATUSES = ['not_required', 'pending', 'approved', 'rejected_by_org_admin'];
11
+ const STATUS_VARIANT = {
12
+ active: 'default',
13
+ abandoned: 'warning',
14
+ completed: 'success',
15
+ rejected: 'destructive',
16
+ };
17
+ const APPROVAL_VARIANT = {
18
+ not_required: 'secondary',
19
+ pending: 'warning',
20
+ approved: 'success',
21
+ rejected_by_org_admin: 'destructive',
22
+ };
23
+ export default function CartsList() {
24
+ const t = useTranslation('carts');
25
+ const [rows, setRows] = useState([]);
26
+ const [loading, setLoading] = useState(true);
27
+ const [error, setError] = useState(null);
28
+ const [statusFilter, setStatusFilter] = useState('');
29
+ const [approvalFilter, setApprovalFilter] = useState('');
30
+ const refresh = useCallback(async () => {
31
+ setLoading(true);
32
+ setError(null);
33
+ try {
34
+ const params = new URLSearchParams();
35
+ if (statusFilter)
36
+ params.set('status', statusFilter);
37
+ if (approvalFilter)
38
+ params.set('approvalStatus', approvalFilter);
39
+ const qs = params.toString();
40
+ const res = await apiClient.get(`/api/v1/admin/carts${qs ? `?${qs}` : ''}`);
41
+ setRows(res.data);
42
+ }
43
+ catch (err) {
44
+ setError(err instanceof ApiError ? err.envelope.error.message : 'Failed to load carts.');
45
+ }
46
+ finally {
47
+ setLoading(false);
48
+ }
49
+ }, [statusFilter, approvalFilter]);
50
+ useEffect(() => {
51
+ void refresh();
52
+ }, [refresh]);
53
+ return (_jsxs(_Fragment, { children: [_jsx(PageHeader, { title: t('carts.page.title'), description: t('carts.page.description') }), error ? (_jsx(Alert, { variant: "destructive", className: "mb-4", children: _jsx(AlertDescription, { children: error }) })) : null, _jsx(Card, { className: "mb-4", children: _jsx(CardContent, { className: "pt-6", children: _jsxs("div", { className: "grid gap-4 md:grid-cols-2 md:max-w-xl", children: [_jsxs("div", { className: "space-y-2", children: [_jsx(Label, { htmlFor: "cstatus", children: t('carts.column.status') }), _jsxs(Select, { id: "cstatus", value: statusFilter, onChange: (e) => setStatusFilter(e.target.value), children: [_jsx("option", { value: "", children: t('carts.filter.all') }), STATUSES.map((s) => (_jsx("option", { value: s, children: s }, s)))] })] }), _jsxs("div", { className: "space-y-2", children: [_jsx(Label, { htmlFor: "capproval", children: t('carts.column.approval') }), _jsxs(Select, { id: "capproval", value: approvalFilter, onChange: (e) => setApprovalFilter(e.target.value), children: [_jsx("option", { value: "", children: t('carts.filter.all') }), APPROVAL_STATUSES.map((s) => (_jsx("option", { value: s, children: s }, s)))] })] })] }) }) }), _jsx(Card, { children: _jsx(CardContent, { className: "pt-6", children: loading ? (_jsx("p", { className: "text-sm text-muted-foreground", children: t('carts.loading') })) : rows.length === 0 ? (_jsx("p", { className: "text-sm text-muted-foreground", children: t('carts.empty') })) : (_jsx(ResponsiveTable, { data: rows, keyExtractor: (c) => c.id, columns: [
54
+ {
55
+ id: 'cart',
56
+ header: t('carts.column.id'),
57
+ primary: true,
58
+ render: (c) => (_jsx(Link, { to: `/carts/${c.id}`, className: "font-mono text-xs underline underline-offset-2", children: c.id.slice(0, 8) })),
59
+ meta: (c) => formatDateTime(c.lastActivityAt),
60
+ },
61
+ {
62
+ id: 'owner',
63
+ header: t('carts.column.owner'),
64
+ render: (c) => (_jsx("span", { className: "text-xs text-muted-foreground", children: c.ownerDisplayName ?? '(anonymous)' })),
65
+ },
66
+ {
67
+ id: 'org',
68
+ header: t('carts.column.org'),
69
+ hideOnMobile: true,
70
+ render: (c) => (_jsx("span", { className: "text-xs text-muted-foreground", children: c.organizationDisplayName ?? '—' })),
71
+ },
72
+ {
73
+ id: 'status',
74
+ header: t('carts.column.status'),
75
+ render: (c) => (_jsx(Badge, { variant: STATUS_VARIANT[c.status] ?? 'secondary', children: c.status })),
76
+ },
77
+ {
78
+ id: 'approval',
79
+ header: t('carts.column.approval'),
80
+ render: (c) => (_jsx(Badge, { variant: APPROVAL_VARIANT[c.approvalStatus] ?? 'secondary', children: c.approvalStatus })),
81
+ },
82
+ {
83
+ id: 'total',
84
+ header: t('carts.column.total'),
85
+ render: (c) => (_jsx("span", { className: "tabular-nums", children: formatMoney(c.total.amount, c.total.currency) })),
86
+ meta: (c) => `${c.itemCount} items`,
87
+ },
88
+ ], renderActions: (c) => (_jsx(Button, { asChild: true, variant: "outline", size: "sm", className: "min-h-11", children: _jsxs(Link, { to: `/carts/${c.id}`, children: [t('carts.open'), _jsx(ArrowRight, {})] }) })) })) }) })] }));
89
+ }
90
+ //# sourceMappingURL=CartsList.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CartsList.js","sourceRoot":"","sources":["../../../src/admin/pages/CartsList.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,QAAQ,EAAkB,MAAM,OAAO,CAAC;AACzE,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AACxC,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,gCAAgC,CAAC;AAClG,OAAO,EACL,KAAK,EACL,gBAAgB,EAChB,KAAK,EACL,MAAM,EACN,IAAI,EACJ,WAAW,EACX,KAAK,EACL,UAAU,EACV,MAAM,GACP,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAE,eAAe,EAAE,MAAM,uCAAuC,CAAC;AACxE,OAAO,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AA4BjE,MAAM,QAAQ,GAAG,CAAC,QAAQ,EAAE,WAAW,EAAE,WAAW,EAAE,UAAU,CAAU,CAAC;AAC3E,MAAM,iBAAiB,GAAG,CAAC,cAAc,EAAE,SAAS,EAAE,UAAU,EAAE,uBAAuB,CAAU,CAAC;AAEpG,MAAM,cAAc,GAAoF;IACtG,MAAM,EAAE,SAAS;IACjB,SAAS,EAAE,SAAS;IACpB,SAAS,EAAE,SAAS;IACpB,QAAQ,EAAE,aAAa;CACxB,CAAC;AAEF,MAAM,gBAAgB,GAAoF;IACxG,YAAY,EAAE,WAAW;IACzB,OAAO,EAAE,S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C,EAAE,EAAE,CAAC,CACb,eAAM,SAAS,EAAC,cAAc,YAC3B,WAAW,CAAC,CAAC,CAAC,KAAK,CAAC,MAAM,EAAE,CAAC,CAAC,KAAK,CAAC,QAAQ,CAAC,GACzC,CACR;gCACD,IAAI,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,CAAC,CAAC,SAAS,QAAQ;6BACpC;yBACF,EACD,aAAa,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CACpB,KAAC,MAAM,IAAC,OAAO,QAAC,OAAO,EAAC,SAAS,EAAC,IAAI,EAAC,IAAI,EAAC,SAAS,EAAC,UAAU,YAC9D,MAAC,IAAI,IAAC,EAAE,EAAE,UAAU,CAAC,CAAC,EAAE,EAAE,aACvB,CAAC,CAAC,YAAY,CAAC,EAChB,KAAC,UAAU,KAAG,IACT,GACA,CACV,GACD,CACH,GACW,GACT,IACN,CACJ,CAAC;AACJ,CAAC"}
@@ -0,0 +1,29 @@
1
+ import type { ReactNode } from 'react';
2
+ import type { AdminZoneProps } from '@endora-commerce/contracts';
3
+ /**
4
+ * The organization's cart-approval policy (feature 091, P7b; §10.5).
5
+ *
6
+ * The place is `organization.detail.after`, and this contribution is the one in
7
+ * the family that adds a surface rather than moving one: the panel behind it
8
+ * existed, was imported by nothing, and the capability it drives has been on
9
+ * the API since feature 027 with no screen anywhere.
10
+ *
11
+ * **`customers:manage`, and not `carts:read`.** The contribution declares the
12
+ * code its own routes enforce, both of them — the panel is a toggle, and a
13
+ * control whose only action 403s is worse than an absent control. This module's
14
+ * `carts:read` opens the cart list and says nothing about an organization's
15
+ * policy.
16
+ *
17
+ * **No `match`, and it is a decision rather than an omission.** `match` narrows
18
+ * the mounts of one place (Z13); this place has one host and one mount.
19
+ * `admin/test/modules/carts/cart-approval-policy-zone.test.tsx` asserts it
20
+ * absent so a later author cannot add one quietly.
21
+ */
22
+ export type CartApprovalPolicyProps = AdminZoneProps<'organization.detail.after'>;
23
+ export declare function CartApprovalPolicy({ organizationId }: CartApprovalPolicyProps): ReactNode;
24
+ /**
25
+ * The zone renderer loads a contribution through a dynamic-import factory and
26
+ * reads its default export (feature 091, FR-013).
27
+ */
28
+ export default CartApprovalPolicy;
29
+ //# sourceMappingURL=CartApprovalPolicy.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CartApprovalPolicy.d.ts","sourceRoot":"","sources":["../../../src/admin/zones/CartApprovalPolicy.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAGjE;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,MAAM,uBAAuB,GAAG,cAAc,CAAC,2BAA2B,CAAC,CAAC;AAElF,wBAAgB,kBAAkB,CAAC,EAAE,cAAc,EAAE,EAAE,uBAAuB,GAAG,SAAS,CAEzF;AAED;;;GAGG;AACH,eAAe,kBAAkB,CAAC"}
@@ -0,0 +1,11 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { CartApprovalPolicyPanel } from '../components/CartApprovalPolicyPanel.js';
3
+ export function CartApprovalPolicy({ organizationId }) {
4
+ return _jsx(CartApprovalPolicyPanel, { organizationId: organizationId });
5
+ }
6
+ /**
7
+ * The zone renderer loads a contribution through a dynamic-import factory and
8
+ * reads its default export (feature 091, FR-013).
9
+ */
10
+ export default CartApprovalPolicy;
11
+ //# sourceMappingURL=CartApprovalPolicy.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CartApprovalPolicy.js","sourceRoot":"","sources":["../../../src/admin/zones/CartApprovalPolicy.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAE,uBAAuB,EAAE,MAAM,0CAA0C,CAAC;AAuBnF,MAAM,UAAU,kBAAkB,CAAC,EAAE,cAAc,EAA2B;IAC5E,OAAO,KAAC,uBAAuB,IAAC,cAAc,EAAE,cAAc,GAAI,CAAC;AACrE,CAAC;AAED;;;GAGG;AACH,eAAe,kBAAkB,CAAC"}