@endora-commerce/contracts 0.109.0 → 0.111.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.
- package/dist/accept-language.d.ts +31 -0
- package/dist/accept-language.js +64 -0
- package/dist/actor.d.ts +16 -0
- package/dist/addresses.d.ts +35 -0
- package/dist/addresses.js +8 -1
- package/dist/admin-actions.d.ts +2 -0
- package/dist/admin-actions.js +18 -0
- package/dist/admin-contributions.d.ts +99 -12
- package/dist/admin-contributions.js +36 -10
- package/dist/admin-roles.d.ts +17 -2
- package/dist/admin-users.d.ts +9 -0
- package/dist/admin.d.ts +114 -4
- package/dist/admin.js +98 -3
- package/dist/api-keys.d.ts +22 -0
- package/dist/api-keys.js +4 -0
- package/dist/assets-library.d.ts +45 -0
- package/dist/assets-library.js +20 -3
- package/dist/audit-logs.d.ts +12 -0
- package/dist/audit-logs.js +12 -0
- package/dist/auth.d.ts +9 -0
- package/dist/auth.js +9 -0
- package/dist/blog.d.ts +382 -22
- package/dist/blog.js +199 -17
- package/dist/carts.d.ts +423 -36
- package/dist/carts.js +150 -12
- package/dist/catalog.d.ts +379 -208
- package/dist/catalog.js +241 -163
- package/dist/cms-brand.d.ts +14 -14
- package/dist/cms.d.ts +71 -16
- package/dist/cms.js +15 -0
- package/dist/command-hooks.d.ts +301 -0
- package/dist/command-hooks.js +248 -0
- package/dist/common.d.ts +23 -6
- package/dist/common.js +25 -2
- package/dist/comparisons.d.ts +21 -14
- package/dist/comparisons.js +2 -1
- package/dist/credit-limits.d.ts +22 -0
- package/dist/credit-limits.js +35 -0
- package/dist/crm.d.ts +134 -78
- package/dist/crm.js +21 -5
- package/dist/custom-fields.d.ts +417 -49
- package/dist/custom-fields.js +142 -1
- package/dist/customer-accounts.d.ts +324 -22
- package/dist/customer-accounts.js +43 -0
- package/dist/customer-notifications.d.ts +143 -0
- package/dist/customer-notifications.js +41 -0
- package/dist/customers.d.ts +92 -73
- package/dist/customers.js +98 -10
- package/dist/dictionary.d.ts +53 -0
- package/dist/dictionary.js +25 -0
- package/dist/document-templates.d.ts +12 -12
- package/dist/email.d.ts +34 -0
- package/dist/email.js +6 -0
- package/dist/errors.d.ts +431 -3
- package/dist/errors.js +523 -3
- package/dist/forms-logic.d.ts +79 -0
- package/dist/forms-logic.fixtures.d.ts +52 -0
- package/dist/forms-logic.fixtures.js +610 -0
- package/dist/forms-logic.js +699 -0
- package/dist/forms.d.ts +9833 -0
- package/dist/forms.js +827 -0
- package/dist/i18n.d.ts +34 -0
- package/dist/i18n.js +15 -0
- package/dist/import-export.d.ts +180 -0
- package/dist/import-export.js +60 -0
- package/dist/index.d.ts +16 -1
- package/dist/index.js +30 -1
- package/dist/inventory.d.ts +9 -9
- package/dist/invoice-ledger.d.ts +13 -13
- package/dist/invoices.d.ts +126 -0
- package/dist/invoices.js +53 -0
- package/dist/line-bounds.d.ts +53 -0
- package/dist/line-bounds.js +65 -0
- package/dist/megamenu.d.ts +27 -27
- package/dist/mfa.d.ts +210 -4
- package/dist/mfa.js +136 -0
- package/dist/modules.d.ts +56 -8
- package/dist/modules.js +128 -3
- package/dist/money-decimal.d.ts +54 -0
- package/dist/money-decimal.js +95 -0
- package/dist/newsletter.d.ts +4 -4
- package/dist/orders.d.ts +246 -12
- package/dist/orders.js +140 -7
- package/dist/organization-hooks.d.ts +99 -0
- package/dist/organization-hooks.js +22 -0
- package/dist/organization-registry-lookup.d.ts +362 -0
- package/dist/organization-registry-lookup.js +196 -0
- package/dist/organization-roles.d.ts +341 -0
- package/dist/organization-roles.js +218 -0
- package/dist/organizations.d.ts +1074 -103
- package/dist/organizations.js +293 -28
- package/dist/page-builder-props.d.ts +56 -56
- package/dist/pim-connector.d.ts +7 -3
- package/dist/pim-connector.js +6 -2
- package/dist/pim-field-path.d.ts +5 -1
- package/dist/pim-field-path.js +37 -81
- package/dist/pim-locale-mapping.d.ts +131 -0
- package/dist/pim-locale-mapping.js +193 -0
- package/dist/price-books.d.ts +215 -63
- package/dist/price-books.js +47 -2
- package/dist/price-lists.d.ts +13 -10
- package/dist/product-feeds.d.ts +249 -100
- package/dist/product-feeds.js +46 -2
- package/dist/product-scope-model.d.ts +161 -0
- package/dist/product-scope-model.js +161 -0
- package/dist/product-scope-overrides.d.ts +0 -103
- package/dist/product-scope-overrides.js +0 -54
- package/dist/product-scoped-values.d.ts +2610 -0
- package/dist/product-scoped-values.js +425 -0
- package/dist/product-scopes.d.ts +199 -64
- package/dist/product-scopes.js +120 -23
- package/dist/product-tax-rates.d.ts +38 -0
- package/dist/product-tax-rates.js +45 -0
- package/dist/product-url-keys.d.ts +51 -45
- package/dist/product-url-keys.js +73 -39
- package/dist/product-value-resolver.d.ts +37 -60
- package/dist/product-value-resolver.js +36 -96
- package/dist/projects.d.ts +76 -28
- package/dist/projects.js +53 -9
- package/dist/promotions.d.ts +163 -11
- package/dist/promotions.js +23 -1
- package/dist/pwa.d.ts +41 -2
- package/dist/quick-order.d.ts +159 -9
- package/dist/quick-order.js +79 -4
- package/dist/quote-requests.d.ts +231 -17
- package/dist/quote-requests.js +111 -9
- package/dist/record-references.d.ts +15 -15
- package/dist/record-references.js +2 -3
- package/dist/record-rich-text.js +2 -1
- package/dist/returns.d.ts +214 -52
- package/dist/returns.js +143 -28
- package/dist/sales-channels.d.ts +34 -3
- package/dist/sales-channels.js +16 -1
- package/dist/saved-list-views.d.ts +28 -0
- package/dist/saved-list-views.js +14 -1
- package/dist/schema-extensions.d.ts +36 -0
- package/dist/schema-extensions.js +29 -0
- package/dist/scoped-write-encoding.d.ts +100 -0
- package/dist/scoped-write-encoding.js +135 -0
- package/dist/search.d.ts +18 -16
- package/dist/seo.d.ts +83 -30
- package/dist/seo.js +8 -1
- package/dist/settings.d.ts +173 -2
- package/dist/settings.js +53 -2
- package/dist/shopping-lists.d.ts +63 -4
- package/dist/shopping-lists.js +57 -3
- package/dist/storefront-cache-tags.d.ts +22 -0
- package/dist/storefront-cache-tags.js +12 -0
- package/dist/storefront-value-overrides.d.ts +18 -56
- package/dist/storefront-value-overrides.js +11 -86
- package/dist/tasks.d.ts +27 -27
- package/dist/taxes.d.ts +27 -0
- package/dist/taxes.js +4 -0
- package/dist/transactional-emails.d.ts +48 -22
- package/dist/webhooks.d.ts +75 -0
- package/dist/webhooks.js +24 -0
- package/package.json +5 -3
- package/dist/actor.d.ts.map +0 -1
- package/dist/actor.js.map +0 -1
- package/dist/addresses.d.ts.map +0 -1
- package/dist/addresses.js.map +0 -1
- package/dist/admin-actions.d.ts.map +0 -1
- package/dist/admin-actions.js.map +0 -1
- package/dist/admin-contributions.d.ts.map +0 -1
- package/dist/admin-contributions.js.map +0 -1
- package/dist/admin-feedback.d.ts.map +0 -1
- package/dist/admin-feedback.js.map +0 -1
- package/dist/admin-i18n.d.ts.map +0 -1
- package/dist/admin-i18n.js.map +0 -1
- package/dist/admin-name.d.ts.map +0 -1
- package/dist/admin-name.js.map +0 -1
- package/dist/admin-notifications.d.ts.map +0 -1
- package/dist/admin-notifications.js.map +0 -1
- package/dist/admin-preferences.d.ts.map +0 -1
- package/dist/admin-preferences.js.map +0 -1
- package/dist/admin-roles.d.ts.map +0 -1
- package/dist/admin-roles.js.map +0 -1
- package/dist/admin-search.d.ts.map +0 -1
- package/dist/admin-search.js.map +0 -1
- package/dist/admin-users.d.ts.map +0 -1
- package/dist/admin-users.js.map +0 -1
- package/dist/admin.d.ts.map +0 -1
- package/dist/admin.js.map +0 -1
- package/dist/analytics.d.ts.map +0 -1
- package/dist/analytics.js.map +0 -1
- package/dist/api-keys.d.ts.map +0 -1
- package/dist/api-keys.js.map +0 -1
- package/dist/assets-library.d.ts.map +0 -1
- package/dist/assets-library.js.map +0 -1
- package/dist/audit-logs.d.ts.map +0 -1
- package/dist/audit-logs.js.map +0 -1
- package/dist/auth.d.ts.map +0 -1
- package/dist/auth.js.map +0 -1
- package/dist/blog.d.ts.map +0 -1
- package/dist/blog.js.map +0 -1
- package/dist/capabilities.d.ts.map +0 -1
- package/dist/capabilities.js.map +0 -1
- package/dist/carts.d.ts.map +0 -1
- package/dist/carts.js.map +0 -1
- package/dist/catalog.d.ts.map +0 -1
- package/dist/catalog.js.map +0 -1
- package/dist/cms-brand.d.ts.map +0 -1
- package/dist/cms-brand.js.map +0 -1
- package/dist/cms-contact-form.d.ts.map +0 -1
- package/dist/cms-contact-form.js.map +0 -1
- package/dist/cms.d.ts.map +0 -1
- package/dist/cms.js.map +0 -1
- package/dist/common.d.ts.map +0 -1
- package/dist/common.js.map +0 -1
- package/dist/comparisons.d.ts.map +0 -1
- package/dist/comparisons.js.map +0 -1
- package/dist/credentials.d.ts.map +0 -1
- package/dist/credentials.js.map +0 -1
- package/dist/credit-limits.d.ts.map +0 -1
- package/dist/credit-limits.js.map +0 -1
- package/dist/crm-rich-text.d.ts.map +0 -1
- package/dist/crm-rich-text.js.map +0 -1
- package/dist/crm.d.ts.map +0 -1
- package/dist/crm.js.map +0 -1
- package/dist/currencies.d.ts.map +0 -1
- package/dist/currencies.js.map +0 -1
- package/dist/custom-fields.d.ts.map +0 -1
- package/dist/custom-fields.js.map +0 -1
- package/dist/customer-accounts.d.ts.map +0 -1
- package/dist/customer-accounts.js.map +0 -1
- package/dist/customers.d.ts.map +0 -1
- package/dist/customers.js.map +0 -1
- package/dist/dictionary.d.ts.map +0 -1
- package/dist/dictionary.js.map +0 -1
- package/dist/document-templates.d.ts.map +0 -1
- package/dist/document-templates.js.map +0 -1
- package/dist/document-values.d.ts.map +0 -1
- package/dist/document-values.js.map +0 -1
- package/dist/email-address.d.ts.map +0 -1
- package/dist/email-address.js.map +0 -1
- package/dist/email.d.ts.map +0 -1
- package/dist/email.js.map +0 -1
- package/dist/envelopes.d.ts.map +0 -1
- package/dist/envelopes.js.map +0 -1
- package/dist/environment-inputs.d.ts.map +0 -1
- package/dist/environment-inputs.js.map +0 -1
- package/dist/erp-connector.d.ts.map +0 -1
- package/dist/erp-connector.js.map +0 -1
- package/dist/errors.d.ts.map +0 -1
- package/dist/errors.js.map +0 -1
- package/dist/google-analytics.d.ts.map +0 -1
- package/dist/google-analytics.js.map +0 -1
- package/dist/google-tag-manager.d.ts.map +0 -1
- package/dist/google-tag-manager.js.map +0 -1
- package/dist/i18n.d.ts.map +0 -1
- package/dist/i18n.js.map +0 -1
- package/dist/import-export.d.ts.map +0 -1
- package/dist/import-export.js.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/inventory.d.ts.map +0 -1
- package/dist/inventory.js.map +0 -1
- package/dist/invoice-ledger.d.ts.map +0 -1
- package/dist/invoice-ledger.js.map +0 -1
- package/dist/invoices.d.ts.map +0 -1
- package/dist/invoices.js.map +0 -1
- package/dist/kernel.d.ts.map +0 -1
- package/dist/kernel.js.map +0 -1
- package/dist/languages.d.ts.map +0 -1
- package/dist/languages.js.map +0 -1
- package/dist/line-groups.d.ts.map +0 -1
- package/dist/line-groups.js.map +0 -1
- package/dist/linkedin-ads.d.ts.map +0 -1
- package/dist/linkedin-ads.js.map +0 -1
- package/dist/localized-name.d.ts.map +0 -1
- package/dist/localized-name.js.map +0 -1
- package/dist/megamenu.d.ts.map +0 -1
- package/dist/megamenu.js.map +0 -1
- package/dist/meta-ads.d.ts.map +0 -1
- package/dist/meta-ads.js.map +0 -1
- package/dist/mfa.d.ts.map +0 -1
- package/dist/mfa.js.map +0 -1
- package/dist/modules.d.ts.map +0 -1
- package/dist/modules.js.map +0 -1
- package/dist/money-decimal.d.ts.map +0 -1
- package/dist/money-decimal.js.map +0 -1
- package/dist/money-input.d.ts.map +0 -1
- package/dist/money-input.js.map +0 -1
- package/dist/newsletter.d.ts.map +0 -1
- package/dist/newsletter.js.map +0 -1
- package/dist/order-minimums.d.ts.map +0 -1
- package/dist/order-minimums.js.map +0 -1
- package/dist/orders.d.ts.map +0 -1
- package/dist/orders.js.map +0 -1
- package/dist/organizations.d.ts.map +0 -1
- package/dist/organizations.js.map +0 -1
- package/dist/page-builder-props.d.ts.map +0 -1
- package/dist/page-builder-props.js.map +0 -1
- package/dist/page-builder-values.d.ts.map +0 -1
- package/dist/page-builder-values.js.map +0 -1
- package/dist/pagination.d.ts.map +0 -1
- package/dist/pagination.js.map +0 -1
- package/dist/payment-methods.d.ts.map +0 -1
- package/dist/payment-methods.js.map +0 -1
- package/dist/payment-return-url.d.ts.map +0 -1
- package/dist/payment-return-url.js.map +0 -1
- package/dist/payments.d.ts.map +0 -1
- package/dist/payments.js.map +0 -1
- package/dist/pim-connector.d.ts.map +0 -1
- package/dist/pim-connector.js.map +0 -1
- package/dist/pim-field-path.d.ts.map +0 -1
- package/dist/pim-field-path.js.map +0 -1
- package/dist/platform-info.d.ts.map +0 -1
- package/dist/platform-info.js.map +0 -1
- package/dist/platform-language.d.ts.map +0 -1
- package/dist/platform-language.js.map +0 -1
- package/dist/price-book-decimal.d.ts.map +0 -1
- package/dist/price-book-decimal.js.map +0 -1
- package/dist/price-books.d.ts.map +0 -1
- package/dist/price-books.js.map +0 -1
- package/dist/price-lists.d.ts.map +0 -1
- package/dist/price-lists.js.map +0 -1
- package/dist/product-feeds.d.ts.map +0 -1
- package/dist/product-feeds.js.map +0 -1
- package/dist/product-scope-overrides.d.ts.map +0 -1
- package/dist/product-scope-overrides.js.map +0 -1
- package/dist/product-scopes.d.ts.map +0 -1
- package/dist/product-scopes.js.map +0 -1
- package/dist/product-summary-text.d.ts.map +0 -1
- package/dist/product-summary-text.js.map +0 -1
- package/dist/product-url-keys.d.ts.map +0 -1
- package/dist/product-url-keys.js.map +0 -1
- package/dist/product-value-resolver.d.ts.map +0 -1
- package/dist/product-value-resolver.js.map +0 -1
- package/dist/projects.d.ts.map +0 -1
- package/dist/projects.js.map +0 -1
- package/dist/promotions.d.ts.map +0 -1
- package/dist/promotions.js.map +0 -1
- package/dist/prompt-actions.d.ts.map +0 -1
- package/dist/prompt-actions.js.map +0 -1
- package/dist/pwa.d.ts.map +0 -1
- package/dist/pwa.js.map +0 -1
- package/dist/quick-order.d.ts.map +0 -1
- package/dist/quick-order.js.map +0 -1
- package/dist/quote-requests.d.ts.map +0 -1
- package/dist/quote-requests.js.map +0 -1
- package/dist/record-references.d.ts.map +0 -1
- package/dist/record-references.js.map +0 -1
- package/dist/record-rich-text.d.ts.map +0 -1
- package/dist/record-rich-text.js.map +0 -1
- package/dist/returns.d.ts.map +0 -1
- package/dist/returns.js.map +0 -1
- package/dist/sales-channels.d.ts.map +0 -1
- package/dist/sales-channels.js.map +0 -1
- package/dist/saved-list-views.d.ts.map +0 -1
- package/dist/saved-list-views.js.map +0 -1
- package/dist/scope-notice.d.ts.map +0 -1
- package/dist/scope-notice.js.map +0 -1
- package/dist/scoped-translations.d.ts +0 -48
- package/dist/scoped-translations.d.ts.map +0 -1
- package/dist/scoped-translations.js +0 -78
- package/dist/scoped-translations.js.map +0 -1
- package/dist/search.d.ts.map +0 -1
- package/dist/search.js.map +0 -1
- package/dist/seo.d.ts.map +0 -1
- package/dist/seo.js.map +0 -1
- package/dist/settings.d.ts.map +0 -1
- package/dist/settings.js.map +0 -1
- package/dist/shipments.d.ts.map +0 -1
- package/dist/shipments.js.map +0 -1
- package/dist/shipping-methods.d.ts.map +0 -1
- package/dist/shipping-methods.js.map +0 -1
- package/dist/shopping-lists.d.ts.map +0 -1
- package/dist/shopping-lists.js.map +0 -1
- package/dist/storefront-cache-tags.d.ts.map +0 -1
- package/dist/storefront-cache-tags.js.map +0 -1
- package/dist/storefront-language-path.d.ts.map +0 -1
- package/dist/storefront-language-path.js.map +0 -1
- package/dist/storefront-value-overrides.d.ts.map +0 -1
- package/dist/storefront-value-overrides.js.map +0 -1
- package/dist/tasks.d.ts.map +0 -1
- package/dist/tasks.js.map +0 -1
- package/dist/taxes.d.ts.map +0 -1
- package/dist/taxes.js.map +0 -1
- package/dist/text-normalization.d.ts.map +0 -1
- package/dist/text-normalization.js.map +0 -1
- package/dist/transactional-emails.d.ts.map +0 -1
- package/dist/transactional-emails.js.map +0 -1
- package/dist/webhooks.d.ts.map +0 -1
- package/dist/webhooks.js.map +0 -1
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
/**
|
|
3
|
+
* `customer_notifications` module contracts — the buyer's notification centre on
|
|
4
|
+
* the storefront (`specs/179-rfq-and-customer-notifications/`).
|
|
5
|
+
*
|
|
6
|
+
* Two halves:
|
|
7
|
+
* (1) the in-process port producers record entries through
|
|
8
|
+
* (`contracts/delivery-and-ports.md` §1) — plain TypeScript, as in
|
|
9
|
+
* `admin-notifications.ts`, because it describes an in-process call;
|
|
10
|
+
* (2) the storefront API shapes (`contracts/customer-notifications-storefront-api.md` §2)
|
|
11
|
+
* — Zod schemas, the source of truth for the HTTP boundary (Principle II).
|
|
12
|
+
*/
|
|
13
|
+
/**
|
|
14
|
+
* A translatable sentence: the bundle (`scope`, a module id), the key in it and
|
|
15
|
+
* the `{name}` placeholders' values — strings and numbers only, drawn as text.
|
|
16
|
+
* The same shape as `AdminNotificationMessage`, deliberately (research R-13):
|
|
17
|
+
* an entry is translated when it is read, in the reader's language, and the
|
|
18
|
+
* English sentence stored beside it is shown when the key does not resolve.
|
|
19
|
+
*/
|
|
20
|
+
export interface CustomerNotificationMessage {
|
|
21
|
+
scope: string;
|
|
22
|
+
key: string;
|
|
23
|
+
params?: Record<string, string | number>;
|
|
24
|
+
}
|
|
25
|
+
export interface RecordCustomerNotificationInput {
|
|
26
|
+
organizationId: string;
|
|
27
|
+
customerAccountId: string;
|
|
28
|
+
/** The channel the entry concerns; `null` = shown on every channel. */
|
|
29
|
+
salesChannelId: string | null;
|
|
30
|
+
/** The producing module's id; the list hides entries whose producer is absent. */
|
|
31
|
+
sourceModule: string;
|
|
32
|
+
/** Unique per `sourceModule`; a second record with the same key is refused (see the port). */
|
|
33
|
+
sourceKey: string;
|
|
34
|
+
/** E.g. `quote_requests.approved`; consumers branch on it, never on the sentence. */
|
|
35
|
+
kind: string;
|
|
36
|
+
subjectType?: string | null;
|
|
37
|
+
subjectId?: string | null;
|
|
38
|
+
/** The finished English sentence — always, also beside `titleMessage`. */
|
|
39
|
+
title: string;
|
|
40
|
+
titleMessage: CustomerNotificationMessage;
|
|
41
|
+
body?: string | null;
|
|
42
|
+
/** `body`, translatable. Rejected without a `body` to fall back to. */
|
|
43
|
+
bodyMessage?: CustomerNotificationMessage | null;
|
|
44
|
+
/** Storefront-relative: starts with one `/`, no scheme, no `//` (FR-047). */
|
|
45
|
+
linkPath?: string | null;
|
|
46
|
+
}
|
|
47
|
+
/** What was recorded, for a caller that wants to correlate its own log. */
|
|
48
|
+
export interface CustomerNotificationRecord {
|
|
49
|
+
id: string;
|
|
50
|
+
createdAt: Date;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Container name: `customerNotificationRecordPort`. Owner: `customer_notifications`
|
|
54
|
+
* (`specs/179-rfq-and-customer-notifications/`).
|
|
55
|
+
*
|
|
56
|
+
* Owner off: the gate fails closed (`ModuleDisabledError`). Callers decide
|
|
57
|
+
* presence in front of it (`effectiveState.isPresent('customer_notifications')`)
|
|
58
|
+
* and never catch the refusal (D-60).
|
|
59
|
+
*
|
|
60
|
+
* `recordWithin` persists into the caller's unit of work, with no fork and no
|
|
61
|
+
* flush, and commits or rolls back with it — the admin bell's `recordWithin`
|
|
62
|
+
* semantics. It validates before persisting and throws a plain `Error` on
|
|
63
|
+
* invalid input (link, params, body/bodyMessage pairing): a programming error,
|
|
64
|
+
* not a delivery outcome.
|
|
65
|
+
*
|
|
66
|
+
* Idempotency: `(sourceModule, sourceKey)` is unique in the database.
|
|
67
|
+
* `recordWithin` relies on the caller's own idempotency (`quote_requests`
|
|
68
|
+
* closes its delivery record in the same transaction, so a second call for the
|
|
69
|
+
* same record cannot happen); `record` answers the existing entry when the key
|
|
70
|
+
* is already present.
|
|
71
|
+
*
|
|
72
|
+
* `EM` is the caller's MikroORM `EntityManager`, a type parameter because this
|
|
73
|
+
* package holds no `@mikro-orm` import (the `AdminNotificationRecordPort`
|
|
74
|
+
* precedent). A consumer writes `CustomerNotificationRecordPort<EntityManager>`.
|
|
75
|
+
*/
|
|
76
|
+
export interface CustomerNotificationRecordPort<EM = unknown> {
|
|
77
|
+
record(input: RecordCustomerNotificationInput): Promise<CustomerNotificationRecord>;
|
|
78
|
+
recordWithin(em: EM, input: RecordCustomerNotificationInput): CustomerNotificationRecord;
|
|
79
|
+
}
|
|
80
|
+
/** One entry as the signed-in buyer reads it. */
|
|
81
|
+
export declare const customerNotificationSchema: z.ZodObject<{
|
|
82
|
+
id: z.ZodString;
|
|
83
|
+
kind: z.ZodString;
|
|
84
|
+
title: z.ZodString;
|
|
85
|
+
body: z.ZodNullable<z.ZodString>;
|
|
86
|
+
subject: z.ZodNullable<z.ZodObject<{
|
|
87
|
+
type: z.ZodString;
|
|
88
|
+
id: z.ZodString;
|
|
89
|
+
}, z.core.$strip>>;
|
|
90
|
+
linkPath: z.ZodNullable<z.ZodString>;
|
|
91
|
+
createdAt: z.ZodString;
|
|
92
|
+
readAt: z.ZodNullable<z.ZodString>;
|
|
93
|
+
}, z.core.$strict>;
|
|
94
|
+
export type CustomerNotification = z.infer<typeof customerNotificationSchema>;
|
|
95
|
+
/** `GET /api/v1/storefront/notifications` — newest first, keyset-paged. */
|
|
96
|
+
export declare const customerNotificationListResponseSchema: z.ZodObject<{
|
|
97
|
+
data: z.ZodObject<{
|
|
98
|
+
items: z.ZodArray<z.ZodObject<{
|
|
99
|
+
id: z.ZodString;
|
|
100
|
+
kind: z.ZodString;
|
|
101
|
+
title: z.ZodString;
|
|
102
|
+
body: z.ZodNullable<z.ZodString>;
|
|
103
|
+
subject: z.ZodNullable<z.ZodObject<{
|
|
104
|
+
type: z.ZodString;
|
|
105
|
+
id: z.ZodString;
|
|
106
|
+
}, z.core.$strip>>;
|
|
107
|
+
linkPath: z.ZodNullable<z.ZodString>;
|
|
108
|
+
createdAt: z.ZodString;
|
|
109
|
+
readAt: z.ZodNullable<z.ZodString>;
|
|
110
|
+
}, z.core.$strict>>;
|
|
111
|
+
nextCursor: z.ZodNullable<z.ZodString>;
|
|
112
|
+
unreadCount: z.ZodNumber;
|
|
113
|
+
}, z.core.$strip>;
|
|
114
|
+
}, z.core.$strip>;
|
|
115
|
+
export type CustomerNotificationListResponse = z.infer<typeof customerNotificationListResponseSchema>;
|
|
116
|
+
/**
|
|
117
|
+
* `GET /api/v1/storefront/notifications/:id` — one entry, under the same three
|
|
118
|
+
* visibility predicates as the list; read-only, it marks nothing.
|
|
119
|
+
*/
|
|
120
|
+
export declare const customerNotificationResponseSchema: z.ZodObject<{
|
|
121
|
+
data: z.ZodObject<{
|
|
122
|
+
id: z.ZodString;
|
|
123
|
+
kind: z.ZodString;
|
|
124
|
+
title: z.ZodString;
|
|
125
|
+
body: z.ZodNullable<z.ZodString>;
|
|
126
|
+
subject: z.ZodNullable<z.ZodObject<{
|
|
127
|
+
type: z.ZodString;
|
|
128
|
+
id: z.ZodString;
|
|
129
|
+
}, z.core.$strip>>;
|
|
130
|
+
linkPath: z.ZodNullable<z.ZodString>;
|
|
131
|
+
createdAt: z.ZodString;
|
|
132
|
+
readAt: z.ZodNullable<z.ZodString>;
|
|
133
|
+
}, z.core.$strict>;
|
|
134
|
+
}, z.core.$strip>;
|
|
135
|
+
export type CustomerNotificationResponse = z.infer<typeof customerNotificationResponseSchema>;
|
|
136
|
+
/** `GET /api/v1/storefront/notifications/unread-count`. */
|
|
137
|
+
export declare const customerNotificationUnreadCountResponseSchema: z.ZodObject<{
|
|
138
|
+
data: z.ZodObject<{
|
|
139
|
+
unreadCount: z.ZodNumber;
|
|
140
|
+
}, z.core.$strip>;
|
|
141
|
+
}, z.core.$strip>;
|
|
142
|
+
export type CustomerNotificationUnreadCountResponse = z.infer<typeof customerNotificationUnreadCountResponseSchema>;
|
|
143
|
+
//# sourceMappingURL=customer-notifications.d.ts.map
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { isoDateTimeSchema, uuidSchema } from './common.js';
|
|
3
|
+
// ---------------------------------------------------------------------------
|
|
4
|
+
// (2) Storefront API — `/api/v1/storefront/notifications*`
|
|
5
|
+
// ---------------------------------------------------------------------------
|
|
6
|
+
/** One entry as the signed-in buyer reads it. */
|
|
7
|
+
export const customerNotificationSchema = z
|
|
8
|
+
.object({
|
|
9
|
+
id: uuidSchema,
|
|
10
|
+
kind: z.string(),
|
|
11
|
+
/** Rendered in the request's language; the stored English sentence when the key does not resolve. */
|
|
12
|
+
title: z.string(),
|
|
13
|
+
body: z.string().nullable(),
|
|
14
|
+
subject: z.object({ type: z.string(), id: uuidSchema }).nullable(),
|
|
15
|
+
/** Storefront-relative, without locale prefix; the storefront localises it. */
|
|
16
|
+
linkPath: z.string().nullable(),
|
|
17
|
+
createdAt: isoDateTimeSchema,
|
|
18
|
+
readAt: isoDateTimeSchema.nullable(),
|
|
19
|
+
})
|
|
20
|
+
.strict();
|
|
21
|
+
/** `GET /api/v1/storefront/notifications` — newest first, keyset-paged. */
|
|
22
|
+
export const customerNotificationListResponseSchema = z.object({
|
|
23
|
+
data: z.object({
|
|
24
|
+
items: z.array(customerNotificationSchema),
|
|
25
|
+
/** Opaque keyset cursor over `(created_at desc, id desc)`, base64url; `null` on the last page. */
|
|
26
|
+
nextCursor: z.string().nullable(),
|
|
27
|
+
unreadCount: z.number().int().nonnegative(),
|
|
28
|
+
}),
|
|
29
|
+
});
|
|
30
|
+
/**
|
|
31
|
+
* `GET /api/v1/storefront/notifications/:id` — one entry, under the same three
|
|
32
|
+
* visibility predicates as the list; read-only, it marks nothing.
|
|
33
|
+
*/
|
|
34
|
+
export const customerNotificationResponseSchema = z.object({
|
|
35
|
+
data: customerNotificationSchema,
|
|
36
|
+
});
|
|
37
|
+
/** `GET /api/v1/storefront/notifications/unread-count`. */
|
|
38
|
+
export const customerNotificationUnreadCountResponseSchema = z.object({
|
|
39
|
+
data: z.object({ unreadCount: z.number().int().nonnegative() }),
|
|
40
|
+
});
|
|
41
|
+
//# sourceMappingURL=customer-notifications.js.map
|
package/dist/customers.d.ts
CHANGED
|
@@ -18,26 +18,22 @@ export declare const customerBlockSourceSchema: z.ZodEnum<{
|
|
|
18
18
|
org_owner: "org_owner";
|
|
19
19
|
}>;
|
|
20
20
|
export type CustomerBlockSource = z.infer<typeof customerBlockSourceSchema>;
|
|
21
|
+
/**
|
|
22
|
+
* The codes a redacted `customer_address` audit row keeps (issue #844) — the
|
|
23
|
+
* legacy personal address book's rows (`specs/173-b2c-address-book-merge/`).
|
|
24
|
+
*
|
|
25
|
+
* Owner: `customers`; **codes only** — see `CUSTOMER_ACCOUNT_AUDIT_KEEP_KEYS`
|
|
26
|
+
* for the rule they extend. `mergeRefusal` is the code a refused merge into the
|
|
27
|
+
* Organization book records; `countryCode` is kept as the address scrub keeps
|
|
28
|
+
* the country.
|
|
29
|
+
*/
|
|
30
|
+
export declare const CUSTOMER_ADDRESS_AUDIT_KEEP_KEYS: readonly string[];
|
|
21
31
|
export declare const customerLifecycleStatusSchema: z.ZodEnum<{
|
|
22
32
|
active: "active";
|
|
23
|
-
blocked: "blocked";
|
|
24
33
|
deleted: "deleted";
|
|
34
|
+
blocked: "blocked";
|
|
25
35
|
}>;
|
|
26
36
|
export type CustomerLifecycleStatus = z.infer<typeof customerLifecycleStatusSchema>;
|
|
27
|
-
export declare const customerAddressInputSchema: z.ZodObject<{
|
|
28
|
-
kind: z.ZodEnum<{
|
|
29
|
-
delivery: "delivery";
|
|
30
|
-
billing: "billing";
|
|
31
|
-
}>;
|
|
32
|
-
recipientName: z.ZodString;
|
|
33
|
-
street: z.ZodString;
|
|
34
|
-
city: z.ZodString;
|
|
35
|
-
postalCode: z.ZodString;
|
|
36
|
-
country: z.ZodString;
|
|
37
|
-
phone: z.ZodOptional<z.ZodString>;
|
|
38
|
-
isDefault: z.ZodOptional<z.ZodBoolean>;
|
|
39
|
-
}, z.core.$strip>;
|
|
40
|
-
export type CustomerAddressInput = z.infer<typeof customerAddressInputSchema>;
|
|
41
37
|
export declare const customerAddressSchema: z.ZodObject<{
|
|
42
38
|
id: z.ZodString;
|
|
43
39
|
customerAccountId: z.ZodString;
|
|
@@ -54,6 +50,7 @@ export declare const customerAddressSchema: z.ZodObject<{
|
|
|
54
50
|
isDefault: z.ZodBoolean;
|
|
55
51
|
createdAt: z.ZodString;
|
|
56
52
|
updatedAt: z.ZodString;
|
|
53
|
+
mergeRefusal: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
57
54
|
}, z.core.$strip>;
|
|
58
55
|
export type CustomerAddress = z.infer<typeof customerAddressSchema>;
|
|
59
56
|
/**
|
|
@@ -76,6 +73,11 @@ export declare const organizationAddressRefSchema: z.ZodObject<{
|
|
|
76
73
|
isDefault: z.ZodBoolean;
|
|
77
74
|
}, z.core.$strip>;
|
|
78
75
|
export type OrganizationAddressRef = z.infer<typeof organizationAddressRefSchema>;
|
|
76
|
+
/**
|
|
77
|
+
* `GET /api/v1/admin/customers/:id/addresses` — the admin card (OD-6): the
|
|
78
|
+
* customer's Organization book, read-only, and under `personal` only the
|
|
79
|
+
* personal-book rows the retirement job refused, each with its `mergeRefusal`.
|
|
80
|
+
*/
|
|
79
81
|
export declare const customerAddressBookSchema: z.ZodObject<{
|
|
80
82
|
personal: z.ZodArray<z.ZodObject<{
|
|
81
83
|
id: z.ZodString;
|
|
@@ -93,6 +95,7 @@ export declare const customerAddressBookSchema: z.ZodObject<{
|
|
|
93
95
|
isDefault: z.ZodBoolean;
|
|
94
96
|
createdAt: z.ZodString;
|
|
95
97
|
updatedAt: z.ZodString;
|
|
98
|
+
mergeRefusal: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
96
99
|
}, z.core.$strip>>;
|
|
97
100
|
organization: z.ZodArray<z.ZodObject<{
|
|
98
101
|
id: z.ZodString;
|
|
@@ -133,6 +136,18 @@ export declare const customerRegisterRequestSchema: z.ZodObject<{
|
|
|
133
136
|
acceptedTermsVersion: z.ZodString;
|
|
134
137
|
}, z.core.$strip>;
|
|
135
138
|
export type CustomerRegisterRequest = z.infer<typeof customerRegisterRequestSchema>;
|
|
139
|
+
/**
|
|
140
|
+
* `GET /api/v1/storefront/settings/customer-registration` — whether the
|
|
141
|
+
* storefront may offer individual (org-less) self-registration (issue #756).
|
|
142
|
+
* It is the answer `POST /api/v1/customers/register` applies, read before the
|
|
143
|
+
* form is rendered rather than after it is submitted.
|
|
144
|
+
*/
|
|
145
|
+
export declare const customerRegistrationOptionsResponseSchema: z.ZodObject<{
|
|
146
|
+
data: z.ZodObject<{
|
|
147
|
+
allowRegistrationWithoutOrganization: z.ZodBoolean;
|
|
148
|
+
}, z.core.$strip>;
|
|
149
|
+
}, z.core.$strip>;
|
|
150
|
+
export type CustomerRegistrationOptionsResponse = z.infer<typeof customerRegistrationOptionsResponseSchema>;
|
|
136
151
|
export declare const customerSelfProfileSchema: z.ZodObject<{
|
|
137
152
|
id: z.ZodString;
|
|
138
153
|
email: z.ZodString;
|
|
@@ -141,8 +156,42 @@ export declare const customerSelfProfileSchema: z.ZodObject<{
|
|
|
141
156
|
organizationId: z.ZodNullable<z.ZodString>;
|
|
142
157
|
customerGroupId: z.ZodNullable<z.ZodString>;
|
|
143
158
|
twoFactorEnabled: z.ZodBoolean;
|
|
159
|
+
preferredLanguage: z.ZodNullable<z.ZodString>;
|
|
160
|
+
organizationRole: z.ZodObject<{
|
|
161
|
+
id: z.ZodString;
|
|
162
|
+
name: z.ZodString;
|
|
163
|
+
kind: z.ZodEnum<{
|
|
164
|
+
custom: "custom";
|
|
165
|
+
administrator: "administrator";
|
|
166
|
+
member: "member";
|
|
167
|
+
}>;
|
|
168
|
+
}, z.core.$strict>;
|
|
169
|
+
permissions: z.ZodArray<z.ZodString>;
|
|
144
170
|
}, z.core.$strip>;
|
|
145
171
|
export type CustomerSelfProfile = z.infer<typeof customerSelfProfileSchema>;
|
|
172
|
+
/**
|
|
173
|
+
* The longest language tag a preferred language may be — RFC 5646 §4.4.1's
|
|
174
|
+
* recommended minimum buffer, and the width of `customer_accounts.preferred_language`.
|
|
175
|
+
*/
|
|
176
|
+
export declare const CUSTOMER_PREFERRED_LANGUAGE_MAX_LENGTH = 35;
|
|
177
|
+
/**
|
|
178
|
+
* `PATCH /api/v1/me/customer/preferred-language` — the buyer's explicit choice
|
|
179
|
+
* of the language their e-mails are written in (issue #652, D-292). Not
|
|
180
|
+
* nullable: the account page always submits a language. A tag the request's
|
|
181
|
+
* sales channel does not offer is refused `422 PREFERRED_LANGUAGE_NOT_OFFERED`;
|
|
182
|
+
* an offered one is stored in the channel's spelling, matched
|
|
183
|
+
* case-insensitively.
|
|
184
|
+
*/
|
|
185
|
+
export declare const patchCustomerPreferredLanguageBodySchema: z.ZodObject<{
|
|
186
|
+
preferredLanguage: z.ZodString;
|
|
187
|
+
}, z.core.$strip>;
|
|
188
|
+
export type PatchCustomerPreferredLanguageBody = z.infer<typeof patchCustomerPreferredLanguageBodySchema>;
|
|
189
|
+
export declare const patchCustomerPreferredLanguageResponseSchema: z.ZodObject<{
|
|
190
|
+
data: z.ZodObject<{
|
|
191
|
+
preferredLanguage: z.ZodString;
|
|
192
|
+
}, z.core.$strip>;
|
|
193
|
+
}, z.core.$strip>;
|
|
194
|
+
export type PatchCustomerPreferredLanguageResponse = z.infer<typeof patchCustomerPreferredLanguageResponseSchema>;
|
|
146
195
|
export declare const adminCustomerListItemSchema: z.ZodObject<{
|
|
147
196
|
id: z.ZodString;
|
|
148
197
|
email: z.ZodString;
|
|
@@ -158,6 +207,33 @@ export declare const adminCustomerListItemSchema: z.ZodObject<{
|
|
|
158
207
|
lastLoginAt: z.ZodNullable<z.ZodString>;
|
|
159
208
|
}, z.core.$strip>;
|
|
160
209
|
export type AdminCustomerListItem = z.infer<typeof adminCustomerListItemSchema>;
|
|
210
|
+
/**
|
|
211
|
+
* `GET /api/v1/admin/customers` — one page of the admin list (issue #599).
|
|
212
|
+
* Offset paging: `page` is 1-based, `pageSize` 1–100, `total` the rows the
|
|
213
|
+
* filters match across every page.
|
|
214
|
+
*/
|
|
215
|
+
export declare const adminCustomerListResponseSchema: z.ZodObject<{
|
|
216
|
+
data: z.ZodArray<z.ZodObject<{
|
|
217
|
+
id: z.ZodString;
|
|
218
|
+
email: z.ZodString;
|
|
219
|
+
firstName: z.ZodString;
|
|
220
|
+
lastName: z.ZodString;
|
|
221
|
+
organizationId: z.ZodNullable<z.ZodString>;
|
|
222
|
+
organizationName: z.ZodNullable<z.ZodString>;
|
|
223
|
+
customerGroupId: z.ZodNullable<z.ZodString>;
|
|
224
|
+
customerGroupName: z.ZodNullable<z.ZodString>;
|
|
225
|
+
blocked: z.ZodBoolean;
|
|
226
|
+
deleted: z.ZodBoolean;
|
|
227
|
+
createdAt: z.ZodString;
|
|
228
|
+
lastLoginAt: z.ZodNullable<z.ZodString>;
|
|
229
|
+
}, z.core.$strip>>;
|
|
230
|
+
meta: z.ZodObject<{
|
|
231
|
+
page: z.ZodNumber;
|
|
232
|
+
pageSize: z.ZodNumber;
|
|
233
|
+
total: z.ZodNumber;
|
|
234
|
+
}, z.core.$strip>;
|
|
235
|
+
}, z.core.$strip>;
|
|
236
|
+
export type AdminCustomerListResponse = z.infer<typeof adminCustomerListResponseSchema>;
|
|
161
237
|
export declare const adminCustomerBlockInfoSchema: z.ZodObject<{
|
|
162
238
|
blockedAt: z.ZodString;
|
|
163
239
|
blockSource: z.ZodEnum<{
|
|
@@ -205,6 +281,7 @@ export declare const adminCustomerDetailSchema: z.ZodObject<{
|
|
|
205
281
|
}, z.core.$strip>>;
|
|
206
282
|
emailVerifiedAt: z.ZodNullable<z.ZodString>;
|
|
207
283
|
twoFactorEnabled: z.ZodBoolean;
|
|
284
|
+
preferredLanguage: z.ZodNullable<z.ZodString>;
|
|
208
285
|
salesChannelIds: z.ZodArray<z.ZodString>;
|
|
209
286
|
defaults: z.ZodObject<{
|
|
210
287
|
paymentMethodId: z.ZodNullable<z.ZodString>;
|
|
@@ -244,62 +321,4 @@ export declare const onlineCustomerSchema: z.ZodObject<{
|
|
|
244
321
|
lastSeenAt: z.ZodString;
|
|
245
322
|
}, z.core.$strip>;
|
|
246
323
|
export type OnlineCustomer = z.infer<typeof onlineCustomerSchema>;
|
|
247
|
-
/**
|
|
248
|
-
* A customer's own saved address — never the ORM entity (FR-011).
|
|
249
|
-
*
|
|
250
|
-
* Distinct from `AddressRecord` in `addresses.ts`, and the difference is the
|
|
251
|
-
* key: this one hangs off a **customer account**, that one off an
|
|
252
|
-
* **organisation**. Both tables exist because a B2C buyer keeps addresses that
|
|
253
|
-
* are theirs rather than their personal organisation's, and merging the two
|
|
254
|
-
* shapes here would hide which of the two a caller is holding.
|
|
255
|
-
*/
|
|
256
|
-
export interface CustomerAddressRecord {
|
|
257
|
-
id: string;
|
|
258
|
-
customerAccountId: string;
|
|
259
|
-
kind: 'delivery' | 'billing';
|
|
260
|
-
recipientName: string;
|
|
261
|
-
street: string;
|
|
262
|
-
city: string;
|
|
263
|
-
postalCode: string;
|
|
264
|
-
country: string;
|
|
265
|
-
phone: string | null;
|
|
266
|
-
isDefault: boolean;
|
|
267
|
-
createdAt: Date;
|
|
268
|
-
updatedAt: Date;
|
|
269
|
-
deletedAt: Date | null;
|
|
270
|
-
}
|
|
271
|
-
/**
|
|
272
|
-
* Container name: `customerAddressReadPort`. Owner: `customers`.
|
|
273
|
-
*
|
|
274
|
-
* `findById` is scoped by customer account for the reason its organisation
|
|
275
|
-
* twin gives: every caller already knows whose address it is asking for, and
|
|
276
|
-
* one query is what stops the ownership check being forgotten.
|
|
277
|
-
*
|
|
278
|
-
* **`liveOnly` defaults to `false`: `findById` returns a soft-deleted address.**
|
|
279
|
-
* Same split as {@link AddressReadPort} — the by-id lookup resolves an id
|
|
280
|
-
* something else already stored, so it answers with the row it finds;
|
|
281
|
-
* `listForCustomer` is choosing an address to use *now*, so it filters
|
|
282
|
-
* `deletedAt: null` unconditionally and takes no flag.
|
|
283
|
-
*
|
|
284
|
-
* The intended consumer is `quick_order`'s one-click default eligibility check,
|
|
285
|
-
* which today spells the rule itself:
|
|
286
|
-
* `personal != null && !personal.deletedAt && personal.customerAccountId === customerAccountId`
|
|
287
|
-
* (`quick_order/services/default-preference-service.ts`). Two of those three
|
|
288
|
-
* conjuncts do become redundant against this port; **`!personal.deletedAt` does
|
|
289
|
-
* not**. Dropping it with the others makes deleted addresses eligible one-click
|
|
290
|
-
* shipping defaults, so a cut passes `{ liveOnly: true }` (Phase-P
|
|
291
|
-
* unreached-port audit, A8).
|
|
292
|
-
*
|
|
293
|
-
* **Owner off:** the seam fails closed — resolving this port throws
|
|
294
|
-
* `ModuleDisabledError` and the call answers 503 `MODULE_DISABLED`, so nothing
|
|
295
|
-
* half-executes. Whether `customers` has an off state at all is its manifest's
|
|
296
|
-
* `activation` to say, not this line's: a module declaring
|
|
297
|
-
* `nonDeactivatable` never enters one.
|
|
298
|
-
*/
|
|
299
|
-
export interface CustomerAddressReadPort {
|
|
300
|
-
findById(customerAccountId: string, addressId: string, options?: {
|
|
301
|
-
liveOnly?: boolean;
|
|
302
|
-
}): Promise<CustomerAddressRecord | null>;
|
|
303
|
-
listForCustomer(customerAccountId: string, kind?: 'delivery' | 'billing'): Promise<CustomerAddressRecord[]>;
|
|
304
|
-
}
|
|
305
324
|
//# sourceMappingURL=customers.d.ts.map
|
package/dist/customers.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { isoDateTimeSchema, uuidSchema } from './common.js';
|
|
3
|
+
import { organizationRoleRefSchema } from './organization-roles.js';
|
|
3
4
|
/**
|
|
4
5
|
* Customers (Klienci) module — feature 040.
|
|
5
6
|
*
|
|
@@ -12,22 +13,29 @@ import { isoDateTimeSchema, uuidSchema } from './common.js';
|
|
|
12
13
|
// ── Primitives ────────────────────────────────────────────────────────────
|
|
13
14
|
export const customerAddressKindSchema = z.enum(['delivery', 'billing']);
|
|
14
15
|
export const customerBlockSourceSchema = z.enum(['staff', 'org_owner']);
|
|
16
|
+
/**
|
|
17
|
+
* The codes a redacted `customer_address` audit row keeps (issue #844) — the
|
|
18
|
+
* legacy personal address book's rows (`specs/173-b2c-address-book-merge/`).
|
|
19
|
+
*
|
|
20
|
+
* Owner: `customers`; **codes only** — see `CUSTOMER_ACCOUNT_AUDIT_KEEP_KEYS`
|
|
21
|
+
* for the rule they extend. `mergeRefusal` is the code a refused merge into the
|
|
22
|
+
* Organization book records; `countryCode` is kept as the address scrub keeps
|
|
23
|
+
* the country.
|
|
24
|
+
*/
|
|
25
|
+
export const CUSTOMER_ADDRESS_AUDIT_KEEP_KEYS = ['countryCode', 'mergeRefusal'];
|
|
15
26
|
export const customerLifecycleStatusSchema = z.enum([
|
|
16
27
|
'active',
|
|
17
28
|
'blocked',
|
|
18
29
|
'deleted',
|
|
19
30
|
]);
|
|
20
31
|
// ── Addresses ─────────────────────────────────────────────────────────────
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
phone: z.string().max(32).optional(),
|
|
29
|
-
isDefault: z.boolean().optional(),
|
|
30
|
-
});
|
|
32
|
+
//
|
|
33
|
+
// `specs/173-b2c-address-book-merge/` release 1 retired the personal address
|
|
34
|
+
// book for everyone: its routes answer `410 CUSTOMER_ADDRESS_BOOK_RETIRED`, and
|
|
35
|
+
// every customer's one book is their Organization's (`organizations.ts` owns
|
|
36
|
+
// those shapes). What is left here is the admin card's read, which lists the
|
|
37
|
+
// rows the release-1 retirement job refused. Release 2 removes it with the
|
|
38
|
+
// table.
|
|
31
39
|
export const customerAddressSchema = z.object({
|
|
32
40
|
id: uuidSchema,
|
|
33
41
|
customerAccountId: uuidSchema,
|
|
@@ -41,6 +49,12 @@ export const customerAddressSchema = z.object({
|
|
|
41
49
|
isDefault: z.boolean(),
|
|
42
50
|
createdAt: isoDateTimeSchema,
|
|
43
51
|
updatedAt: isoDateTimeSchema,
|
|
52
|
+
/**
|
|
53
|
+
* Why the release-1 retirement job could not move this row into the
|
|
54
|
+
* Organization book — the owner's error code, for example
|
|
55
|
+
* `DICTIONARY_ENTRY_INACTIVE`. Present on the admin card's refused rows.
|
|
56
|
+
*/
|
|
57
|
+
mergeRefusal: z.string().nullable().optional(),
|
|
44
58
|
});
|
|
45
59
|
/**
|
|
46
60
|
* An organization-owned address (subset of the `addresses` module shape)
|
|
@@ -58,6 +72,11 @@ export const organizationAddressRefSchema = z.object({
|
|
|
58
72
|
phone: z.string().nullable(),
|
|
59
73
|
isDefault: z.boolean(),
|
|
60
74
|
});
|
|
75
|
+
/**
|
|
76
|
+
* `GET /api/v1/admin/customers/:id/addresses` — the admin card (OD-6): the
|
|
77
|
+
* customer's Organization book, read-only, and under `personal` only the
|
|
78
|
+
* personal-book rows the retirement job refused, each with its `mergeRefusal`.
|
|
79
|
+
*/
|
|
61
80
|
export const customerAddressBookSchema = z.object({
|
|
62
81
|
personal: z.array(customerAddressSchema),
|
|
63
82
|
organization: z.array(organizationAddressRefSchema),
|
|
@@ -83,6 +102,18 @@ export const customerRegisterRequestSchema = z.object({
|
|
|
83
102
|
lastName: z.string().min(1).max(120),
|
|
84
103
|
acceptedTermsVersion: z.string().min(1).max(64),
|
|
85
104
|
});
|
|
105
|
+
/**
|
|
106
|
+
* `GET /api/v1/storefront/settings/customer-registration` — whether the
|
|
107
|
+
* storefront may offer individual (org-less) self-registration (issue #756).
|
|
108
|
+
* It is the answer `POST /api/v1/customers/register` applies, read before the
|
|
109
|
+
* form is rendered rather than after it is submitted.
|
|
110
|
+
*/
|
|
111
|
+
export const customerRegistrationOptionsResponseSchema = z.object({
|
|
112
|
+
data: z.object({
|
|
113
|
+
/** `customers.allow_registration_without_organization`. */
|
|
114
|
+
allowRegistrationWithoutOrganization: z.boolean(),
|
|
115
|
+
}),
|
|
116
|
+
});
|
|
86
117
|
export const customerSelfProfileSchema = z.object({
|
|
87
118
|
id: uuidSchema,
|
|
88
119
|
email: z.string().email(),
|
|
@@ -91,6 +122,45 @@ export const customerSelfProfileSchema = z.object({
|
|
|
91
122
|
organizationId: uuidSchema.nullable(),
|
|
92
123
|
customerGroupId: uuidSchema.nullable(),
|
|
93
124
|
twoFactorEnabled: z.boolean(),
|
|
125
|
+
/**
|
|
126
|
+
* Issue #652 (D-292) — the language the account's e-mails are written in, as
|
|
127
|
+
* the channel that captured it spells it; `null` while unknown. See
|
|
128
|
+
* `CustomerAccountRecord.preferredLanguage`.
|
|
129
|
+
*/
|
|
130
|
+
preferredLanguage: z.string().nullable(),
|
|
131
|
+
/** The member's role (`specs/170-organization-roles/` FR-056); it replaced the legacy `role`. */
|
|
132
|
+
organizationRole: organizationRoleRefSchema,
|
|
133
|
+
/** The member's effective organization permissions, sorted (FR-056). */
|
|
134
|
+
permissions: z.array(z.string()),
|
|
135
|
+
});
|
|
136
|
+
/**
|
|
137
|
+
* The longest language tag a preferred language may be — RFC 5646 §4.4.1's
|
|
138
|
+
* recommended minimum buffer, and the width of `customer_accounts.preferred_language`.
|
|
139
|
+
*/
|
|
140
|
+
export const CUSTOMER_PREFERRED_LANGUAGE_MAX_LENGTH = 35;
|
|
141
|
+
/**
|
|
142
|
+
* A BCP-47 tag's shape: a two- or three-letter primary subtag, then hyphenated
|
|
143
|
+
* subtags of one to eight letters or digits. The shape, not the registry — the
|
|
144
|
+
* route checks the tag against the request channel's own languages.
|
|
145
|
+
*/
|
|
146
|
+
const LANGUAGE_TAG_SHAPE = /^[A-Za-z]{2,3}(-[A-Za-z0-9]{1,8})*$/;
|
|
147
|
+
/**
|
|
148
|
+
* `PATCH /api/v1/me/customer/preferred-language` — the buyer's explicit choice
|
|
149
|
+
* of the language their e-mails are written in (issue #652, D-292). Not
|
|
150
|
+
* nullable: the account page always submits a language. A tag the request's
|
|
151
|
+
* sales channel does not offer is refused `422 PREFERRED_LANGUAGE_NOT_OFFERED`;
|
|
152
|
+
* an offered one is stored in the channel's spelling, matched
|
|
153
|
+
* case-insensitively.
|
|
154
|
+
*/
|
|
155
|
+
export const patchCustomerPreferredLanguageBodySchema = z.object({
|
|
156
|
+
preferredLanguage: z
|
|
157
|
+
.string()
|
|
158
|
+
.trim()
|
|
159
|
+
.max(CUSTOMER_PREFERRED_LANGUAGE_MAX_LENGTH)
|
|
160
|
+
.regex(LANGUAGE_TAG_SHAPE),
|
|
161
|
+
});
|
|
162
|
+
export const patchCustomerPreferredLanguageResponseSchema = z.object({
|
|
163
|
+
data: z.object({ preferredLanguage: z.string() }),
|
|
94
164
|
});
|
|
95
165
|
// Password change reuses `changePasswordRequestSchema` from organizations.ts.
|
|
96
166
|
// ── Admin: list & detail ──────────────────────────────────────────────────
|
|
@@ -108,6 +178,19 @@ export const adminCustomerListItemSchema = z.object({
|
|
|
108
178
|
createdAt: isoDateTimeSchema,
|
|
109
179
|
lastLoginAt: isoDateTimeSchema.nullable(),
|
|
110
180
|
});
|
|
181
|
+
/**
|
|
182
|
+
* `GET /api/v1/admin/customers` — one page of the admin list (issue #599).
|
|
183
|
+
* Offset paging: `page` is 1-based, `pageSize` 1–100, `total` the rows the
|
|
184
|
+
* filters match across every page.
|
|
185
|
+
*/
|
|
186
|
+
export const adminCustomerListResponseSchema = z.object({
|
|
187
|
+
data: z.array(adminCustomerListItemSchema),
|
|
188
|
+
meta: z.object({
|
|
189
|
+
page: z.number().int().positive(),
|
|
190
|
+
pageSize: z.number().int().positive(),
|
|
191
|
+
total: z.number().int().nonnegative(),
|
|
192
|
+
}),
|
|
193
|
+
});
|
|
111
194
|
export const adminCustomerBlockInfoSchema = z.object({
|
|
112
195
|
blockedAt: isoDateTimeSchema,
|
|
113
196
|
blockSource: customerBlockSourceSchema,
|
|
@@ -125,6 +208,11 @@ export const adminCustomerDetailSchema = adminCustomerListItemSchema.extend({
|
|
|
125
208
|
deletion: adminCustomerDeletionInfoSchema.nullable(),
|
|
126
209
|
emailVerifiedAt: isoDateTimeSchema.nullable(),
|
|
127
210
|
twoFactorEnabled: z.boolean(),
|
|
211
|
+
/**
|
|
212
|
+
* Issue #652 (D-292) — the customer's e-mail language, shown read-only to
|
|
213
|
+
* staff; `null` while unknown (the store's default language is used).
|
|
214
|
+
*/
|
|
215
|
+
preferredLanguage: z.string().nullable(),
|
|
128
216
|
salesChannelIds: z.array(uuidSchema),
|
|
129
217
|
defaults: customerDefaultsSchema,
|
|
130
218
|
/** Feature 055 — custom-field values captured on this customer. */
|
package/dist/dictionary.d.ts
CHANGED
|
@@ -262,6 +262,59 @@ export declare const dictionaryLanguagesPageResponseSchema: z.ZodObject<{
|
|
|
262
262
|
}, z.core.$strip>;
|
|
263
263
|
}, z.core.$strip>;
|
|
264
264
|
export type DictionaryLanguagesPageResponse = z.infer<typeof dictionaryLanguagesPageResponseSchema>;
|
|
265
|
+
/** `GET /api/v1/admin/dictionary/translations/:entryType/:entryCode` — every translation of one entry (issue #599). */
|
|
266
|
+
export declare const dictionaryTranslationListResponseSchema: z.ZodObject<{
|
|
267
|
+
data: z.ZodArray<z.ZodObject<{
|
|
268
|
+
entryType: z.ZodEnum<{
|
|
269
|
+
language: "language";
|
|
270
|
+
currency: "currency";
|
|
271
|
+
country: "country";
|
|
272
|
+
}>;
|
|
273
|
+
entryCode: z.ZodString;
|
|
274
|
+
languageCode: z.ZodString;
|
|
275
|
+
label: z.ZodString;
|
|
276
|
+
createdAt: z.ZodString;
|
|
277
|
+
updatedAt: z.ZodString;
|
|
278
|
+
}, z.core.$strip>>;
|
|
279
|
+
}, z.core.$strip>;
|
|
280
|
+
export type DictionaryTranslationListResponse = z.infer<typeof dictionaryTranslationListResponseSchema>;
|
|
281
|
+
/**
|
|
282
|
+
* One stored dictionary code no dictionary row answers for (feature 017
|
|
283
|
+
* FR-022): which consumer stores it, where, and how many times.
|
|
284
|
+
*/
|
|
285
|
+
export declare const dictionaryOrphanRowSchema: z.ZodObject<{
|
|
286
|
+
dictionary: z.ZodEnum<{
|
|
287
|
+
language: "language";
|
|
288
|
+
currency: "currency";
|
|
289
|
+
country: "country";
|
|
290
|
+
}>;
|
|
291
|
+
consumer: z.ZodString;
|
|
292
|
+
tableName: z.ZodString;
|
|
293
|
+
columnName: z.ZodString;
|
|
294
|
+
code: z.ZodString;
|
|
295
|
+
count: z.ZodNumber;
|
|
296
|
+
}, z.core.$strip>;
|
|
297
|
+
export type DictionaryOrphanRow = z.infer<typeof dictionaryOrphanRowSchema>;
|
|
298
|
+
/** `GET /api/v1/admin/dictionary/audit/orphans` — the orphan report (issue #599). */
|
|
299
|
+
export declare const dictionaryOrphanReportResponseSchema: z.ZodObject<{
|
|
300
|
+
data: z.ZodArray<z.ZodObject<{
|
|
301
|
+
dictionary: z.ZodEnum<{
|
|
302
|
+
language: "language";
|
|
303
|
+
currency: "currency";
|
|
304
|
+
country: "country";
|
|
305
|
+
}>;
|
|
306
|
+
consumer: z.ZodString;
|
|
307
|
+
tableName: z.ZodString;
|
|
308
|
+
columnName: z.ZodString;
|
|
309
|
+
code: z.ZodString;
|
|
310
|
+
count: z.ZodNumber;
|
|
311
|
+
}, z.core.$strip>>;
|
|
312
|
+
meta: z.ZodObject<{
|
|
313
|
+
generatedAt: z.ZodString;
|
|
314
|
+
total: z.ZodNumber;
|
|
315
|
+
}, z.core.$strip>;
|
|
316
|
+
}, z.core.$strip>;
|
|
317
|
+
export type DictionaryOrphanReportResponse = z.infer<typeof dictionaryOrphanReportResponseSchema>;
|
|
265
318
|
export declare const resolvedCountrySchema: z.ZodObject<{
|
|
266
319
|
code: z.ZodString;
|
|
267
320
|
label: z.ZodString;
|
package/dist/dictionary.js
CHANGED
|
@@ -196,6 +196,31 @@ export const dictionaryLanguagesPageResponseSchema = z.object({
|
|
|
196
196
|
data: z.array(dictionaryLanguageSchema),
|
|
197
197
|
pagination: paginationMetaSchema,
|
|
198
198
|
});
|
|
199
|
+
/** `GET /api/v1/admin/dictionary/translations/:entryType/:entryCode` — every translation of one entry (issue #599). */
|
|
200
|
+
export const dictionaryTranslationListResponseSchema = z.object({
|
|
201
|
+
data: z.array(dictionaryTranslationSchema),
|
|
202
|
+
});
|
|
203
|
+
/**
|
|
204
|
+
* One stored dictionary code no dictionary row answers for (feature 017
|
|
205
|
+
* FR-022): which consumer stores it, where, and how many times.
|
|
206
|
+
*/
|
|
207
|
+
export const dictionaryOrphanRowSchema = z.object({
|
|
208
|
+
dictionary: dictionaryEntryTypeSchema,
|
|
209
|
+
consumer: z.string(),
|
|
210
|
+
tableName: z.string(),
|
|
211
|
+
columnName: z.string(),
|
|
212
|
+
code: z.string(),
|
|
213
|
+
count: z.number().int().positive(),
|
|
214
|
+
});
|
|
215
|
+
/** `GET /api/v1/admin/dictionary/audit/orphans` — the orphan report (issue #599). */
|
|
216
|
+
export const dictionaryOrphanReportResponseSchema = z.object({
|
|
217
|
+
data: z.array(dictionaryOrphanRowSchema),
|
|
218
|
+
meta: z.object({
|
|
219
|
+
generatedAt: isoDateTimeSchema,
|
|
220
|
+
/** The sum of every row's `count`. */
|
|
221
|
+
total: z.number().int().nonnegative(),
|
|
222
|
+
}),
|
|
223
|
+
});
|
|
199
224
|
// ---------------------------------------------------------------------------
|
|
200
225
|
// Storefront read facade — locale-resolved labels
|
|
201
226
|
// ---------------------------------------------------------------------------
|