@endora-commerce/contracts 0.108.0 → 0.110.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/actor.d.ts +16 -0
- package/dist/actor.d.ts.map +1 -1
- package/dist/addresses.d.ts +35 -0
- package/dist/addresses.d.ts.map +1 -1
- package/dist/addresses.js +8 -1
- package/dist/addresses.js.map +1 -1
- package/dist/admin-actions.d.ts +12 -3
- package/dist/admin-actions.d.ts.map +1 -1
- package/dist/admin-actions.js +34 -3
- package/dist/admin-actions.js.map +1 -1
- package/dist/admin-contributions.d.ts +94 -10
- package/dist/admin-contributions.d.ts.map +1 -1
- package/dist/admin-contributions.js +65 -0
- package/dist/admin-contributions.js.map +1 -1
- package/dist/admin-notifications.d.ts +17 -1
- package/dist/admin-notifications.d.ts.map +1 -1
- package/dist/admin-preferences.d.ts +108 -0
- package/dist/admin-preferences.d.ts.map +1 -0
- package/dist/admin-preferences.js +133 -0
- package/dist/admin-preferences.js.map +1 -0
- package/dist/admin-roles.d.ts +8 -2
- package/dist/admin-roles.d.ts.map +1 -1
- package/dist/admin-roles.js.map +1 -1
- package/dist/admin-users.d.ts +9 -0
- package/dist/admin-users.d.ts.map +1 -1
- package/dist/admin.d.ts +92 -5
- package/dist/admin.d.ts.map +1 -1
- package/dist/admin.js +86 -3
- package/dist/admin.js.map +1 -1
- package/dist/assets-library.d.ts +123 -3
- package/dist/assets-library.d.ts.map +1 -1
- package/dist/assets-library.js +11 -3
- package/dist/assets-library.js.map +1 -1
- package/dist/audit-logs.d.ts +12 -0
- package/dist/audit-logs.d.ts.map +1 -1
- package/dist/audit-logs.js +12 -0
- package/dist/audit-logs.js.map +1 -1
- package/dist/blog.d.ts +431 -14
- package/dist/blog.d.ts.map +1 -1
- package/dist/blog.js +251 -7
- package/dist/blog.js.map +1 -1
- package/dist/carts.d.ts +507 -92
- package/dist/carts.d.ts.map +1 -1
- package/dist/carts.js +197 -21
- package/dist/carts.js.map +1 -1
- package/dist/catalog.d.ts +515 -144
- package/dist/catalog.d.ts.map +1 -1
- package/dist/catalog.js +356 -68
- package/dist/catalog.js.map +1 -1
- package/dist/cms-brand.d.ts +2233 -0
- package/dist/cms-brand.d.ts.map +1 -0
- package/dist/cms-brand.js +311 -0
- package/dist/cms-brand.js.map +1 -0
- package/dist/cms-contact-form.d.ts +55 -0
- package/dist/cms-contact-form.d.ts.map +1 -0
- package/dist/cms-contact-form.js +100 -0
- package/dist/cms-contact-form.js.map +1 -0
- package/dist/cms.d.ts +576 -17
- package/dist/cms.d.ts.map +1 -1
- package/dist/cms.js +251 -0
- package/dist/cms.js.map +1 -1
- package/dist/common.d.ts +23 -6
- package/dist/common.d.ts.map +1 -1
- package/dist/common.js +25 -2
- package/dist/common.js.map +1 -1
- package/dist/comparisons.d.ts +28 -21
- package/dist/comparisons.d.ts.map +1 -1
- package/dist/comparisons.js +2 -1
- package/dist/comparisons.js.map +1 -1
- package/dist/credit-limits.d.ts +1 -0
- package/dist/credit-limits.d.ts.map +1 -1
- package/dist/credit-limits.js +14 -0
- package/dist/credit-limits.js.map +1 -1
- package/dist/crm-rich-text.d.ts +10 -61
- package/dist/crm-rich-text.d.ts.map +1 -1
- package/dist/crm-rich-text.js +10 -300
- package/dist/crm-rich-text.js.map +1 -1
- package/dist/crm.d.ts +173 -115
- package/dist/crm.d.ts.map +1 -1
- package/dist/crm.js +35 -88
- package/dist/crm.js.map +1 -1
- package/dist/custom-fields.d.ts +54 -22
- package/dist/custom-fields.d.ts.map +1 -1
- package/dist/custom-fields.js +21 -1
- package/dist/custom-fields.js.map +1 -1
- package/dist/customer-accounts.d.ts +216 -22
- package/dist/customer-accounts.d.ts.map +1 -1
- package/dist/customer-accounts.js +70 -0
- package/dist/customer-accounts.js.map +1 -1
- package/dist/customers.d.ts +40 -73
- package/dist/customers.d.ts.map +1 -1
- package/dist/customers.js +45 -10
- package/dist/customers.js.map +1 -1
- package/dist/document-templates.d.ts +35 -23
- package/dist/document-templates.d.ts.map +1 -1
- package/dist/document-values.d.ts +8 -0
- package/dist/document-values.d.ts.map +1 -1
- package/dist/document-values.js +24 -6
- package/dist/document-values.js.map +1 -1
- package/dist/email.d.ts +5 -0
- package/dist/email.d.ts.map +1 -1
- package/dist/errors.d.ts +224 -1
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js +269 -1
- package/dist/errors.js.map +1 -1
- package/dist/forms-logic.d.ts +79 -0
- package/dist/forms-logic.d.ts.map +1 -0
- package/dist/forms-logic.fixtures.d.ts +52 -0
- package/dist/forms-logic.fixtures.d.ts.map +1 -0
- package/dist/forms-logic.fixtures.js +610 -0
- package/dist/forms-logic.fixtures.js.map +1 -0
- package/dist/forms-logic.js +699 -0
- package/dist/forms-logic.js.map +1 -0
- package/dist/forms.d.ts +9833 -0
- package/dist/forms.d.ts.map +1 -0
- package/dist/forms.js +827 -0
- package/dist/forms.js.map +1 -0
- package/dist/import-export.d.ts +180 -0
- package/dist/import-export.d.ts.map +1 -1
- package/dist/import-export.js +60 -0
- package/dist/import-export.js.map +1 -1
- package/dist/index.d.ts +22 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +45 -1
- package/dist/index.js.map +1 -1
- package/dist/inventory.d.ts +6 -6
- package/dist/invoice-ledger.d.ts +7 -7
- package/dist/invoices.d.ts +6 -2
- package/dist/invoices.d.ts.map +1 -1
- package/dist/invoices.js +7 -0
- package/dist/invoices.js.map +1 -1
- package/dist/megamenu.d.ts +674 -0
- package/dist/megamenu.d.ts.map +1 -1
- package/dist/megamenu.js +96 -3
- package/dist/megamenu.js.map +1 -1
- package/dist/mfa.d.ts +125 -4
- package/dist/mfa.d.ts.map +1 -1
- package/dist/mfa.js +54 -2
- package/dist/mfa.js.map +1 -1
- package/dist/modules.d.ts +44 -5
- package/dist/modules.d.ts.map +1 -1
- package/dist/modules.js +73 -0
- package/dist/modules.js.map +1 -1
- package/dist/money-decimal.d.ts +54 -0
- package/dist/money-decimal.d.ts.map +1 -1
- package/dist/money-decimal.js +95 -0
- package/dist/money-decimal.js.map +1 -1
- package/dist/newsletter.d.ts +7 -7
- package/dist/orders.d.ts +128 -10
- package/dist/orders.d.ts.map +1 -1
- package/dist/orders.js +74 -4
- package/dist/orders.js.map +1 -1
- package/dist/organization-registry-lookup.d.ts +362 -0
- package/dist/organization-registry-lookup.d.ts.map +1 -0
- package/dist/organization-registry-lookup.js +196 -0
- package/dist/organization-registry-lookup.js.map +1 -0
- package/dist/organization-roles.d.ts +340 -0
- package/dist/organization-roles.d.ts.map +1 -0
- package/dist/organization-roles.js +211 -0
- package/dist/organization-roles.js.map +1 -0
- package/dist/organizations.d.ts +123 -89
- package/dist/organizations.d.ts.map +1 -1
- package/dist/organizations.js +68 -24
- package/dist/organizations.js.map +1 -1
- package/dist/page-builder-props.d.ts +1401 -0
- package/dist/page-builder-props.d.ts.map +1 -0
- package/dist/page-builder-props.js +266 -0
- package/dist/page-builder-props.js.map +1 -0
- package/dist/page-builder-values.d.ts +95 -0
- package/dist/page-builder-values.d.ts.map +1 -0
- package/dist/page-builder-values.js +164 -0
- package/dist/page-builder-values.js.map +1 -0
- package/dist/pim-connector.d.ts +6 -2
- package/dist/pim-connector.d.ts.map +1 -1
- package/dist/pim-connector.js +6 -2
- package/dist/pim-connector.js.map +1 -1
- package/dist/pim-field-path.d.ts +5 -1
- package/dist/pim-field-path.d.ts.map +1 -1
- package/dist/pim-field-path.js +37 -81
- package/dist/pim-field-path.js.map +1 -1
- package/dist/pim-locale-mapping.d.ts +131 -0
- package/dist/pim-locale-mapping.d.ts.map +1 -0
- package/dist/pim-locale-mapping.js +193 -0
- package/dist/pim-locale-mapping.js.map +1 -0
- package/dist/platform-language.d.ts +9 -0
- package/dist/platform-language.d.ts.map +1 -1
- package/dist/platform-language.js +14 -0
- package/dist/platform-language.js.map +1 -1
- package/dist/price-books.d.ts +47 -43
- package/dist/price-books.d.ts.map +1 -1
- package/dist/price-books.js +6 -2
- package/dist/price-books.js.map +1 -1
- package/dist/price-lists.d.ts +48 -14
- package/dist/price-lists.d.ts.map +1 -1
- package/dist/price-lists.js +24 -1
- package/dist/price-lists.js.map +1 -1
- package/dist/product-feeds.d.ts +144 -84
- package/dist/product-feeds.d.ts.map +1 -1
- package/dist/product-feeds.js +23 -0
- package/dist/product-feeds.js.map +1 -1
- package/dist/product-scope-model.d.ts +161 -0
- package/dist/product-scope-model.d.ts.map +1 -0
- package/dist/product-scope-model.js +161 -0
- package/dist/product-scope-model.js.map +1 -0
- package/dist/product-scope-overrides.d.ts +0 -103
- package/dist/product-scope-overrides.d.ts.map +1 -1
- package/dist/product-scope-overrides.js +0 -54
- package/dist/product-scope-overrides.js.map +1 -1
- package/dist/product-scoped-values.d.ts +2610 -0
- package/dist/product-scoped-values.d.ts.map +1 -0
- package/dist/product-scoped-values.js +425 -0
- package/dist/product-scoped-values.js.map +1 -0
- package/dist/product-scopes.d.ts +746 -0
- package/dist/product-scopes.d.ts.map +1 -0
- package/dist/product-scopes.js +436 -0
- package/dist/product-scopes.js.map +1 -0
- package/dist/product-summary-text.d.ts +23 -0
- package/dist/product-summary-text.d.ts.map +1 -0
- package/dist/product-summary-text.js +64 -0
- package/dist/product-summary-text.js.map +1 -0
- package/dist/product-tax-rates.d.ts +38 -0
- package/dist/product-tax-rates.d.ts.map +1 -0
- package/dist/product-tax-rates.js +45 -0
- package/dist/product-tax-rates.js.map +1 -0
- package/dist/product-url-keys.d.ts +210 -0
- package/dist/product-url-keys.d.ts.map +1 -0
- package/dist/product-url-keys.js +200 -0
- package/dist/product-url-keys.js.map +1 -0
- package/dist/product-value-resolver.d.ts +37 -60
- package/dist/product-value-resolver.d.ts.map +1 -1
- package/dist/product-value-resolver.js +36 -96
- package/dist/product-value-resolver.js.map +1 -1
- package/dist/projects.d.ts +2370 -0
- package/dist/projects.d.ts.map +1 -0
- package/dist/projects.js +843 -0
- package/dist/projects.js.map +1 -0
- package/dist/promotions.d.ts +10 -10
- package/dist/prompt-actions.d.ts +19 -1
- package/dist/prompt-actions.d.ts.map +1 -1
- package/dist/prompt-actions.js +31 -2
- package/dist/prompt-actions.js.map +1 -1
- package/dist/pwa.d.ts +2 -2
- package/dist/quick-order.d.ts +150 -7
- package/dist/quick-order.d.ts.map +1 -1
- package/dist/quick-order.js +76 -2
- package/dist/quick-order.js.map +1 -1
- package/dist/quote-requests.d.ts +99 -13
- package/dist/quote-requests.d.ts.map +1 -1
- package/dist/quote-requests.js +66 -1
- package/dist/quote-requests.js.map +1 -1
- package/dist/record-references.d.ts +252 -0
- package/dist/record-references.d.ts.map +1 -0
- package/dist/record-references.js +178 -0
- package/dist/record-references.js.map +1 -0
- package/dist/record-rich-text.d.ts +66 -0
- package/dist/record-rich-text.d.ts.map +1 -0
- package/dist/record-rich-text.js +304 -0
- package/dist/record-rich-text.js.map +1 -0
- package/dist/returns.d.ts +234 -52
- package/dist/returns.d.ts.map +1 -1
- package/dist/returns.js +139 -26
- package/dist/returns.js.map +1 -1
- package/dist/sales-channels.d.ts +51 -7
- package/dist/sales-channels.d.ts.map +1 -1
- package/dist/sales-channels.js +38 -4
- package/dist/sales-channels.js.map +1 -1
- package/dist/saved-list-views.d.ts +56 -0
- package/dist/saved-list-views.d.ts.map +1 -1
- package/dist/saved-list-views.js +27 -1
- package/dist/saved-list-views.js.map +1 -1
- package/dist/scoped-write-encoding.d.ts +100 -0
- package/dist/scoped-write-encoding.d.ts.map +1 -0
- package/dist/scoped-write-encoding.js +135 -0
- package/dist/scoped-write-encoding.js.map +1 -0
- package/dist/search.d.ts +25 -15
- package/dist/search.d.ts.map +1 -1
- package/dist/seo.d.ts +127 -15
- package/dist/seo.d.ts.map +1 -1
- package/dist/seo.js +38 -4
- package/dist/seo.js.map +1 -1
- package/dist/settings.d.ts +161 -3
- package/dist/settings.d.ts.map +1 -1
- package/dist/settings.js +73 -3
- package/dist/settings.js.map +1 -1
- package/dist/shopping-lists.d.ts +24 -3
- package/dist/shopping-lists.d.ts.map +1 -1
- package/dist/shopping-lists.js +20 -0
- package/dist/shopping-lists.js.map +1 -1
- package/dist/storefront-cache-tags.d.ts +41 -0
- package/dist/storefront-cache-tags.d.ts.map +1 -1
- package/dist/storefront-cache-tags.js +36 -0
- package/dist/storefront-cache-tags.js.map +1 -1
- package/dist/storefront-language-path.d.ts +77 -0
- package/dist/storefront-language-path.d.ts.map +1 -0
- package/dist/storefront-language-path.js +123 -0
- package/dist/storefront-language-path.js.map +1 -0
- package/dist/storefront-value-overrides.d.ts +18 -56
- package/dist/storefront-value-overrides.d.ts.map +1 -1
- package/dist/storefront-value-overrides.js +11 -86
- package/dist/storefront-value-overrides.js.map +1 -1
- package/dist/tasks.d.ts +2842 -0
- package/dist/tasks.d.ts.map +1 -0
- package/dist/tasks.js +901 -0
- package/dist/tasks.js.map +1 -0
- package/dist/transactional-emails.d.ts +14 -11
- package/dist/transactional-emails.d.ts.map +1 -1
- package/dist/transactional-emails.js +13 -0
- package/dist/transactional-emails.js.map +1 -1
- package/package.json +3 -3
|
@@ -0,0 +1,746 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { type ProductVisibility } from './common.js';
|
|
3
|
+
import { type ProductAudience } from './catalog.js';
|
|
4
|
+
import type { UrlKeyWriteOutcome } from './product-url-keys.js';
|
|
5
|
+
import { type FieldPath, type ScopeRef } from './product-scope-model.js';
|
|
6
|
+
import { type ScopedWriteOp } from './scoped-write-encoding.js';
|
|
7
|
+
/**
|
|
8
|
+
* Feature 163 (`specs/163-product-data-scopes/`) — product data scopes per sales
|
|
9
|
+
* channel and language: the one rule of effective availability, its admin shapes and
|
|
10
|
+
* the ports other modules ask through (`contracts/product-scopes.md`,
|
|
11
|
+
* `contracts/admin-scopes-api.md`, research R1–R7, R18).
|
|
12
|
+
*
|
|
13
|
+
* Scopes, from widest to narrowest: **global** (the `products` row), **channel**
|
|
14
|
+
* (`product_channel_scopes`, one row per product × channel) and **channel × language**
|
|
15
|
+
* (`product_channel_language_scopes`, status only). An override that is absent —
|
|
16
|
+
* `null` on a channel row, no row at all — inherits from the scope above it.
|
|
17
|
+
*
|
|
18
|
+
* Import direction: this file imports from `catalog.ts`, never the reverse, so either
|
|
19
|
+
* may be loaded first without meeting the other half-evaluated.
|
|
20
|
+
*/
|
|
21
|
+
/**
|
|
22
|
+
* The scoped status values (FR-010, R3). The same set as the global product status,
|
|
23
|
+
* and derived from it so there is one list. Every predicate tests `=== 'active'`
|
|
24
|
+
* through {@link isOn} and never enumerates the off values, which is what keeps a
|
|
25
|
+
* later change of this set (owner question Q1) a data migration rather than a rewrite.
|
|
26
|
+
*/
|
|
27
|
+
export declare const PRODUCT_SCOPE_STATUSES: ("active" | "inactive")[];
|
|
28
|
+
export type ProductScopeStatus = (typeof PRODUCT_SCOPE_STATUSES)[number];
|
|
29
|
+
export declare const productScopeStatusSchema: z.ZodEnum<{
|
|
30
|
+
active: "active";
|
|
31
|
+
inactive: "inactive";
|
|
32
|
+
}>;
|
|
33
|
+
/** A publication window — inclusive at both ends; `null` = open on that side (K4). */
|
|
34
|
+
export interface PublicationWindow {
|
|
35
|
+
from: Date | null;
|
|
36
|
+
until: Date | null;
|
|
37
|
+
}
|
|
38
|
+
/** The audience rule — mode and organization list, one value (C4). */
|
|
39
|
+
export interface AudienceRule {
|
|
40
|
+
visibility: ProductVisibility;
|
|
41
|
+
allowedOrganizationIds: string[];
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* A `product_channel_scopes` row. Every `null` inherits the global value, except the
|
|
45
|
+
* minimum order quantity, whose override is the flag (feature 174, data-model §4).
|
|
46
|
+
*/
|
|
47
|
+
export interface ProductChannelScopeRecord {
|
|
48
|
+
productId: string;
|
|
49
|
+
channelId: string;
|
|
50
|
+
/** `null` = inherit. */
|
|
51
|
+
status: ProductScopeStatus | null;
|
|
52
|
+
/** `null` = inherit the global pair; a non-null pair replaces it, even when both bounds are open. */
|
|
53
|
+
window: PublicationWindow | null;
|
|
54
|
+
/** `null` = inherit the whole global rule. */
|
|
55
|
+
audience: AudienceRule | null;
|
|
56
|
+
/**
|
|
57
|
+
* Feature 174 (data-model §4) — whether the channel overrides the global minimum. When
|
|
58
|
+
* it does, {@link minOrderQuantity} `null` = **no minimum in this channel**.
|
|
59
|
+
*/
|
|
60
|
+
minOrderQuantityOverridden: boolean;
|
|
61
|
+
/** Meaningful only when {@link minOrderQuantityOverridden}; `null` = no minimum here. */
|
|
62
|
+
minOrderQuantity: number | null;
|
|
63
|
+
/** `null` = inherit. */
|
|
64
|
+
returnable: boolean | null;
|
|
65
|
+
}
|
|
66
|
+
/** A `product_channel_language_scopes` row. Absent = inherit. */
|
|
67
|
+
export interface ProductChannelLanguageScopeRecord {
|
|
68
|
+
productId: string;
|
|
69
|
+
channelId: string;
|
|
70
|
+
languageCode: string;
|
|
71
|
+
status: ProductScopeStatus;
|
|
72
|
+
}
|
|
73
|
+
/** The global values the rule reads off the product row. */
|
|
74
|
+
export interface ProductGlobalScopeFields {
|
|
75
|
+
status: ProductScopeStatus;
|
|
76
|
+
deletedAt: Date | null;
|
|
77
|
+
archivedAt: Date | null;
|
|
78
|
+
window: PublicationWindow;
|
|
79
|
+
visibility: ProductVisibility;
|
|
80
|
+
allowedOrganizationIds: string[];
|
|
81
|
+
minOrderQuantity: number | null;
|
|
82
|
+
returnable: boolean;
|
|
83
|
+
}
|
|
84
|
+
/** A sales channel as the rule needs it: its id and its current content languages. */
|
|
85
|
+
export interface ScopeChannel {
|
|
86
|
+
id: string;
|
|
87
|
+
languages: readonly string[];
|
|
88
|
+
defaultLanguage: string;
|
|
89
|
+
}
|
|
90
|
+
/** Everything that decides a product's effective status, before or after a write. */
|
|
91
|
+
export interface ScopeSnapshot {
|
|
92
|
+
global: ProductGlobalScopeFields;
|
|
93
|
+
channelRows: readonly ProductChannelScopeRecord[];
|
|
94
|
+
languageRows: readonly ProductChannelLanguageScopeRecord[];
|
|
95
|
+
}
|
|
96
|
+
/** `status === 'active'` — the only test of a status value anywhere. */
|
|
97
|
+
export declare function isOn(status: ProductScopeStatus): boolean;
|
|
98
|
+
/** `cl.status ?? c.status ?? global.status`. */
|
|
99
|
+
export declare function effectiveStatus(global: Pick<ProductGlobalScopeFields, 'status'>, channelRow: Pick<ProductChannelScopeRecord, 'status'> | undefined, clRow: Pick<ProductChannelLanguageScopeRecord, 'status'> | undefined): ProductScopeStatus;
|
|
100
|
+
/** The channel's window when it overrides one, else the global window — as a pair (R4). */
|
|
101
|
+
export declare function effectiveWindow(global: Pick<ProductGlobalScopeFields, 'window'>, channelRow: Pick<ProductChannelScopeRecord, 'window'> | undefined): PublicationWindow;
|
|
102
|
+
/** `from ≤ now ≤ until`, to the millisecond; a `null` bound is open (K4). */
|
|
103
|
+
export declare function isInsideWindow(window: PublicationWindow, now: Date): boolean;
|
|
104
|
+
/** The channel's rule when it overrides one, else the global rule — replaced whole, never merged (C4). */
|
|
105
|
+
export declare function effectiveAudience(global: Pick<ProductGlobalScopeFields, 'visibility' | 'allowedOrganizationIds'>, channelRow: Pick<ProductChannelScopeRecord, 'audience'> | undefined): AudienceRule;
|
|
106
|
+
/** Minimum order quantity and the returnable flag in a channel (FR-100). */
|
|
107
|
+
export declare function effectiveOrderRules(global: Pick<ProductGlobalScopeFields, 'minOrderQuantity' | 'returnable'>, channelRow: Pick<ProductChannelScopeRecord, 'minOrderQuantity' | 'minOrderQuantityOverridden' | 'returnable'> | undefined): {
|
|
108
|
+
minOrderQuantity: number | null;
|
|
109
|
+
returnable: boolean;
|
|
110
|
+
};
|
|
111
|
+
/**
|
|
112
|
+
* FR-100, research R26 — `records` with the channel's effective minimum order quantity
|
|
113
|
+
* and returnable flag (`rules`, from `catalogProductAvailabilityPort.effectiveOrderRules`)
|
|
114
|
+
* in place of the global ones, for a seam that judges a basket, an order or a quote
|
|
115
|
+
* line in that channel: the order-minimum rule and the returnable stamp. A record the
|
|
116
|
+
* rules do not name is returned as it is; the input is never mutated. The port's own
|
|
117
|
+
* records keep meaning "global".
|
|
118
|
+
*/
|
|
119
|
+
export declare function withChannelOrderRules<T extends {
|
|
120
|
+
id: string;
|
|
121
|
+
minOrderQuantity: number | null;
|
|
122
|
+
returnable: boolean;
|
|
123
|
+
}>(records: readonly T[], rules: ReadonlyMap<string, {
|
|
124
|
+
minOrderQuantity: number | null;
|
|
125
|
+
returnable: boolean;
|
|
126
|
+
}>): T[];
|
|
127
|
+
export interface ProductAvailabilityInput {
|
|
128
|
+
global: ProductGlobalScopeFields;
|
|
129
|
+
channelRow?: ProductChannelScopeRecord | undefined;
|
|
130
|
+
clRow?: ProductChannelLanguageScopeRecord | undefined;
|
|
131
|
+
/** Membership of the product in `channel`, read through the kernel accessor. */
|
|
132
|
+
isMember: boolean;
|
|
133
|
+
channel: ScopeChannel;
|
|
134
|
+
/** Already resolved by {@link resolveScopeLanguage}. */
|
|
135
|
+
languageCode: string;
|
|
136
|
+
audience: ProductAudience;
|
|
137
|
+
now: Date;
|
|
138
|
+
}
|
|
139
|
+
/**
|
|
140
|
+
* FR-001 — is the product effectively available at (channel, language) to this
|
|
141
|
+
* audience, now? Not deleted, not archived, a member of the channel, the language
|
|
142
|
+
* offered by the channel, effectively on there, inside its effective window, and
|
|
143
|
+
* admitted by its effective audience rule.
|
|
144
|
+
*
|
|
145
|
+
* Membership and the channel's languages are tested **before** any override is read,
|
|
146
|
+
* which is how orphaned overrides are ignored (FR-015). A row naming another channel
|
|
147
|
+
* or another language is ignored too.
|
|
148
|
+
*
|
|
149
|
+
* Its SQL restatement is `availabilityCondition` in catalog's
|
|
150
|
+
* `product-availability.sql.ts`; a parity test holds the two equal.
|
|
151
|
+
*/
|
|
152
|
+
export declare function isProductEffectivelyAvailable(input: ProductAvailabilityInput): boolean;
|
|
153
|
+
/**
|
|
154
|
+
* The (channel, language) pairs an edit turns on — the completeness gate's subject
|
|
155
|
+
* (R18, N3).
|
|
156
|
+
*
|
|
157
|
+
* **Status only (owner decision M3 → A, 2026-10-22; FR-060).** A pair is returned
|
|
158
|
+
* when the product's effective status there goes from off to on; the window, the
|
|
159
|
+
* audience and archiving are not compared. `channels` is the product's member
|
|
160
|
+
* channels with their languages *after* the write and serves both snapshots, so
|
|
161
|
+
* neither a membership change nor a channel gaining a language produces a pair on
|
|
162
|
+
* its own. Archiving is not a status (spec Session 2026-10-25): setting an archived
|
|
163
|
+
* product `active` turns its pairs on, and a Restore — `archivedAt` alone moving —
|
|
164
|
+
* turns nothing on.
|
|
165
|
+
*/
|
|
166
|
+
export declare function pairsTurningOn(before: ScopeSnapshot, after: ScopeSnapshot, channels: readonly ScopeChannel[]): Array<{
|
|
167
|
+
channelId: string;
|
|
168
|
+
languageCode: string;
|
|
169
|
+
}>;
|
|
170
|
+
/**
|
|
171
|
+
* Which content language "L" a request is in (R7, A-3): the channel's language
|
|
172
|
+
* matching the requested tag case-insensitively, else the first channel language
|
|
173
|
+
* sharing its base language (`pl` ↔ `pl-PL`), else the channel's default. The answer
|
|
174
|
+
* is always spelled as the channel spells it.
|
|
175
|
+
*
|
|
176
|
+
* Not the platform's prose-language resolver: channel content languages are free
|
|
177
|
+
* BCP-47 codes, while the prose resolver normalises to the platform's UI languages.
|
|
178
|
+
*/
|
|
179
|
+
export declare function resolveScopeLanguage(channel: ScopeChannel, requestedTag: string | null | undefined): string;
|
|
180
|
+
export { sameLanguage } from './product-scope-model.js';
|
|
181
|
+
/**
|
|
182
|
+
* A channel record as the scope rule reads it. The default language is always
|
|
183
|
+
* one of the languages: a channel whose list is empty, or omits its own
|
|
184
|
+
* default, still offers that default — the language every request on it falls
|
|
185
|
+
* back to. The one home of that normalisation (catalog's availability service
|
|
186
|
+
* and every consumer seam read it from here).
|
|
187
|
+
*/
|
|
188
|
+
export declare function toScopeChannel(channel: {
|
|
189
|
+
id: string;
|
|
190
|
+
languages?: readonly string[] | undefined;
|
|
191
|
+
defaultLanguage: string;
|
|
192
|
+
}): ScopeChannel;
|
|
193
|
+
/**
|
|
194
|
+
* {@link resolveScopeLanguage} over a channel record as a resolver holds it —
|
|
195
|
+
* the scope language L of a buyer request on `channel` that asked in
|
|
196
|
+
* `requestedTag` (the first `Accept-Language` tag, see {@link firstLanguageTag}).
|
|
197
|
+
*/
|
|
198
|
+
export declare function scopeLanguageOf(channel: {
|
|
199
|
+
id: string;
|
|
200
|
+
languages?: readonly string[] | undefined;
|
|
201
|
+
defaultLanguage: string;
|
|
202
|
+
}, requestedTag: string | null | undefined): string;
|
|
203
|
+
/**
|
|
204
|
+
* The first tag of an `Accept-Language` header, without its quality parameter,
|
|
205
|
+
* or `undefined` when the header is absent or empty.
|
|
206
|
+
*/
|
|
207
|
+
export declare function firstLanguageTag(header: string | readonly string[] | undefined): string | undefined;
|
|
208
|
+
/** Where an availability question is asked. */
|
|
209
|
+
export interface ProductAvailabilityScope {
|
|
210
|
+
channelId: string;
|
|
211
|
+
/**
|
|
212
|
+
* Already resolved by {@link resolveScopeLanguage} against this channel, or
|
|
213
|
+
* `null` for the channel's default language — an operator acting for a
|
|
214
|
+
* customer (N2), or a seam that knows no request language.
|
|
215
|
+
*/
|
|
216
|
+
languageCode: string | null;
|
|
217
|
+
audience: ProductAudience;
|
|
218
|
+
/** Default: the time of the call. */
|
|
219
|
+
now?: Date;
|
|
220
|
+
}
|
|
221
|
+
/** A product's availability across one channel, for whole-channel projections. */
|
|
222
|
+
export interface ChannelAvailability {
|
|
223
|
+
/** Channel languages where the effective status is on (member, not archived or deleted). */
|
|
224
|
+
liveLanguages: string[];
|
|
225
|
+
window: PublicationWindow;
|
|
226
|
+
audience: AudienceRule;
|
|
227
|
+
}
|
|
228
|
+
/**
|
|
229
|
+
* Container name: `catalogProductAvailabilityPort`. Owner: `catalog`.
|
|
230
|
+
*
|
|
231
|
+
* The one way another module asks whether a product is available (FR-002). `catalog`
|
|
232
|
+
* is non-deactivatable, so the port is always present. Never asked for an unresolved
|
|
233
|
+
* channel (FR-007): a caller with no channel does not call it.
|
|
234
|
+
*/
|
|
235
|
+
export interface CatalogProductAvailabilityPort {
|
|
236
|
+
/** FR-001 for each id; an id not returned is unavailable for any reason — callers answer one not-found. */
|
|
237
|
+
filterAvailable(productIds: readonly string[], scope: ProductAvailabilityScope): Promise<Set<string>>;
|
|
238
|
+
/** Projection for whole-channel consumers (search documents, sitemap, feeds). Non-members are absent. */
|
|
239
|
+
describeChannelAvailability(productIds: readonly string[], channelId: string): Promise<Map<string, ChannelAvailability>>;
|
|
240
|
+
/**
|
|
241
|
+
* Feature 174 (FR-030, `contracts/readers.md` §2) — the effective name and description
|
|
242
|
+
* per id at (channel, language) along C×L → C → G; an empty description override
|
|
243
|
+
* answers `null`. `languageCode` `null` = the channel's default language (an
|
|
244
|
+
* operator, N2). Applies no availability: an id not found is absent.
|
|
245
|
+
*/
|
|
246
|
+
effectiveTexts(productIds: readonly string[], scope: {
|
|
247
|
+
channelId: string;
|
|
248
|
+
languageCode: string | null;
|
|
249
|
+
}): Promise<Map<string, EffectiveProductTexts>>;
|
|
250
|
+
/**
|
|
251
|
+
* Feature 174 — the effective packaging-unit name per unit id at (channel, language);
|
|
252
|
+
* `null` = an empty override (nothing shown). Basket and quote snapshots take it at
|
|
253
|
+
* the line's scope and never re-resolve it.
|
|
254
|
+
*/
|
|
255
|
+
effectivePackagingUnitNames(unitIds: readonly string[], scope: {
|
|
256
|
+
channelId: string;
|
|
257
|
+
languageCode: string | null;
|
|
258
|
+
}): Promise<Map<string, string | null>>;
|
|
259
|
+
/**
|
|
260
|
+
* FR-100 — the effective minimum order quantity and returnable flag in the channel.
|
|
261
|
+
*
|
|
262
|
+
* **Applies no availability** (checkpoint C security review, I8): it answers for
|
|
263
|
+
* every id it is given, whether or not the product is available — or even visible —
|
|
264
|
+
* to anyone in the channel. A buyer-facing caller narrows the ids with
|
|
265
|
+
* {@link filterAvailable} first and never discloses a rule for an id it dropped.
|
|
266
|
+
*/
|
|
267
|
+
effectiveOrderRules(productIds: readonly string[], channelId: string): Promise<Map<string, {
|
|
268
|
+
minOrderQuantity: number | null;
|
|
269
|
+
returnable: boolean;
|
|
270
|
+
}>>;
|
|
271
|
+
}
|
|
272
|
+
/** {@link CatalogProductAvailabilityPort.effectiveTexts}' answer for one product. */
|
|
273
|
+
export interface EffectiveProductTexts {
|
|
274
|
+
name: string;
|
|
275
|
+
/** `null` = no description at this scope (none anywhere, or an empty override). */
|
|
276
|
+
description: string | null;
|
|
277
|
+
}
|
|
278
|
+
/** One cell of a connector or import write: one field at one scope (`pim-locale-mapping.md` §4). */
|
|
279
|
+
export interface ProductScopedWriteCell {
|
|
280
|
+
scope: ScopeRef;
|
|
281
|
+
field: FieldPath;
|
|
282
|
+
op: ScopedWriteOp<unknown>;
|
|
283
|
+
}
|
|
284
|
+
/**
|
|
285
|
+
* Feature 174 — what an integration writes through {@link CatalogProductScopeWritePort} (v2):
|
|
286
|
+
* only the named (field, scope) cells are touched (FR-044), so writing Global values removes
|
|
287
|
+
* no operator override.
|
|
288
|
+
*/
|
|
289
|
+
export interface ProductScopedWriteInput {
|
|
290
|
+
cells: ProductScopedWriteCell[];
|
|
291
|
+
}
|
|
292
|
+
/** The most cells one call of the scope write port carries (R13a). */
|
|
293
|
+
export declare const PRODUCT_SCOPED_WRITE_CELLS_MAX = 2000;
|
|
294
|
+
/**
|
|
295
|
+
* The field paths of data-model §9, as a grammar: a family, a subject uuid where the family has
|
|
296
|
+
* one, an attribute key. Global-only fields are not paths.
|
|
297
|
+
*/
|
|
298
|
+
export declare const fieldPathSchema: z.ZodPipe<z.ZodString, z.ZodTransform<"description" | "name" | "status" | "window" | "audience" | "minOrderQuantity" | "returnable" | "urlKey" | "seo:description" | "seo:title" | "seo:ogTitle" | "seo:ogDescription" | "seo:ogImageUrl" | `attribute:${string}` | `gallery:${string}:altText` | `gallery:${string}:hidden` | "galleryRole:base_image" | "galleryRole:small_image" | "galleryRole:thumbnail" | `attachment:${string}:description` | `attachment:${string}:name` | `attachment:${string}:hidden` | `packagingUnit:${string}:name`, string>>;
|
|
299
|
+
/** A scope as a request names it (`scoped-values-api.md` §1): neither → G, channel → C, both → C×L. */
|
|
300
|
+
export declare const scopeRequestSchema: z.ZodObject<{
|
|
301
|
+
channelId: z.ZodOptional<z.ZodString>;
|
|
302
|
+
languageCode: z.ZodOptional<z.ZodString>;
|
|
303
|
+
}, z.core.$strict>;
|
|
304
|
+
/** The wire form of {@link ProductScopedWriteInput}: `value` in the write encoding. */
|
|
305
|
+
export declare const productScopedWriteInputSchema: z.ZodPipe<z.ZodObject<{
|
|
306
|
+
cells: z.ZodArray<z.ZodObject<{
|
|
307
|
+
scope: z.ZodObject<{
|
|
308
|
+
channelId: z.ZodOptional<z.ZodString>;
|
|
309
|
+
languageCode: z.ZodOptional<z.ZodString>;
|
|
310
|
+
}, z.core.$strict>;
|
|
311
|
+
field: z.ZodPipe<z.ZodString, z.ZodTransform<"description" | "name" | "status" | "window" | "audience" | "minOrderQuantity" | "returnable" | "urlKey" | "seo:description" | "seo:title" | "seo:ogTitle" | "seo:ogDescription" | "seo:ogImageUrl" | `attribute:${string}` | `gallery:${string}:altText` | `gallery:${string}:hidden` | "galleryRole:base_image" | "galleryRole:small_image" | "galleryRole:thumbnail" | `attachment:${string}:description` | `attachment:${string}:name` | `attachment:${string}:hidden` | `packagingUnit:${string}:name`, string>>;
|
|
312
|
+
value: z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodOptional<z.ZodUnion<readonly [z.ZodNull, z.ZodObject<{
|
|
313
|
+
inherit: z.ZodLiteral<true>;
|
|
314
|
+
}, z.core.$strict>, z.ZodUnknown & z.ZodType<{} | null, unknown, z.core.$ZodTypeInternals<{} | null, unknown>>]>>>;
|
|
315
|
+
}, z.core.$strict>>;
|
|
316
|
+
}, z.core.$strict>, z.ZodTransform<{
|
|
317
|
+
cells: {
|
|
318
|
+
scope: ScopeRef;
|
|
319
|
+
field: "description" | "name" | "status" | "window" | "audience" | "minOrderQuantity" | "returnable" | "urlKey" | "seo:description" | "seo:title" | "seo:ogTitle" | "seo:ogDescription" | "seo:ogImageUrl" | `attribute:${string}` | `gallery:${string}:altText` | `gallery:${string}:hidden` | "galleryRole:base_image" | "galleryRole:small_image" | "galleryRole:thumbnail" | `attachment:${string}:description` | `attachment:${string}:name` | `attachment:${string}:hidden` | `packagingUnit:${string}:name`;
|
|
320
|
+
op: ScopedWriteOp<{}> | undefined;
|
|
321
|
+
}[];
|
|
322
|
+
}, {
|
|
323
|
+
cells: {
|
|
324
|
+
scope: {
|
|
325
|
+
channelId?: string | undefined;
|
|
326
|
+
languageCode?: string | undefined;
|
|
327
|
+
};
|
|
328
|
+
field: "description" | "name" | "status" | "window" | "audience" | "minOrderQuantity" | "returnable" | "urlKey" | "seo:description" | "seo:title" | "seo:ogTitle" | "seo:ogDescription" | "seo:ogImageUrl" | `attribute:${string}` | `gallery:${string}:altText` | `gallery:${string}:hidden` | "galleryRole:base_image" | "galleryRole:small_image" | "galleryRole:thumbnail" | `attachment:${string}:description` | `attachment:${string}:name` | `attachment:${string}:hidden` | `packagingUnit:${string}:name`;
|
|
329
|
+
value?: {} | {
|
|
330
|
+
inherit: true;
|
|
331
|
+
} | null | undefined;
|
|
332
|
+
}[];
|
|
333
|
+
}>>;
|
|
334
|
+
/**
|
|
335
|
+
* Feature 174 (`pim-locale-mapping.md` §4, R13a, R21) — why one cell of an integration write was
|
|
336
|
+
* not applied. The rest of the call still applies (per-cell tolerant):
|
|
337
|
+
*
|
|
338
|
+
* - `not_supported` — the field family is outside the integration allowlist
|
|
339
|
+
* ({@link integrationWritableField});
|
|
340
|
+
* - `SCOPE_INVALID` — a channel the product is not a member of, or a language it does not offer;
|
|
341
|
+
* - `FIELD_NOT_AT_SCOPE` — the field has no value at the scope's level (data-model §9);
|
|
342
|
+
* - `required_empty`, `not_emptyable`, `inherit_at_global` — `validateScopedWrite`'s refusals;
|
|
343
|
+
* - `subject_not_found` — a gallery item, attachment or packaging unit that is not the product's;
|
|
344
|
+
* - `invalid` — a value its field's own schema refuses (type, length, an attribute outside the
|
|
345
|
+
* product's set, an option the attribute does not have).
|
|
346
|
+
*
|
|
347
|
+
* A `urlKey` cell another product holds is not a refusal: it is reported in `urlKeys`.
|
|
348
|
+
*/
|
|
349
|
+
export type ProductScopedWriteRefusalCode = 'not_supported' | 'SCOPE_INVALID' | 'FIELD_NOT_AT_SCOPE' | 'required_empty' | 'not_emptyable' | 'inherit_at_global' | 'subject_not_found' | 'invalid';
|
|
350
|
+
export interface ProductScopedWriteResult {
|
|
351
|
+
/** Cells written. */
|
|
352
|
+
applied: number;
|
|
353
|
+
/** Cells refused; `index` is the cell's position in `input.cells`. */
|
|
354
|
+
refused: Array<{
|
|
355
|
+
index: number;
|
|
356
|
+
scope: ScopeRef;
|
|
357
|
+
field: FieldPath;
|
|
358
|
+
code: ProductScopedWriteRefusalCode;
|
|
359
|
+
}>;
|
|
360
|
+
/** One outcome per `urlKey` cell, in order. */
|
|
361
|
+
urlKeys: UrlKeyWriteOutcome[];
|
|
362
|
+
}
|
|
363
|
+
/**
|
|
364
|
+
* R13a (plan decision Q6) — whether an integration (a PIM connector, the products import) may
|
|
365
|
+
* write `field` at all: `name`, `description`, `attribute:<key>`, `gallery:<id>:altText`,
|
|
366
|
+
* `attachment:<id>:name|description`, `packagingUnit:<id>:name`, `urlKey`, `status`, `window`.
|
|
367
|
+
* Every other family — `audience`, `product.*`, `seo:*`, `galleryRole:*`, `*:hidden`,
|
|
368
|
+
* `minOrderQuantity`, `returnable` — is `not_supported`. Pure; the port applies it per cell.
|
|
369
|
+
*/
|
|
370
|
+
export declare function integrationWritableField(field: string): boolean;
|
|
371
|
+
/**
|
|
372
|
+
* Container name: `catalogProductScopeWritePort`. Owner: `catalog` (R17, feature 174 v2,
|
|
373
|
+
* `contracts/pim-locale-mapping.md` §4).
|
|
374
|
+
*
|
|
375
|
+
* Scoped writes for connectors: one Command `product.scoped_values.import` per call (one audit
|
|
376
|
+
* entry, `source` in it, `product.updated.v1` after commit, `products.scope_version` bumped),
|
|
377
|
+
* per-cell tolerant (each refused cell is reported with a {@link ProductScopedWriteRefusalCode},
|
|
378
|
+
* the rest applied; a call where every cell is refused writes, audits and bumps nothing). Each
|
|
379
|
+
* value is checked against its field's own schema (the save's — lengths `PRODUCT_NAME_MAX`,
|
|
380
|
+
* `PRODUCT_DESCRIPTION_MAX`, attribute value types and options) and `validateScopedWrite`
|
|
381
|
+
* (`required_empty`, `not_emptyable`, `inherit_at_global`); every subject id must be the
|
|
382
|
+
* product's. Never the completeness gate (A-6); URL keys through the URL-key service in
|
|
383
|
+
* `integration` mode — a key another product holds is reported in `urlKeys`, a redirect is never
|
|
384
|
+
* taken over (FR-093). Allowlist: {@link integrationWritableField}.
|
|
385
|
+
*
|
|
386
|
+
* The call itself is refused — nothing written — with:
|
|
387
|
+
* - `404 PRODUCT_NOT_FOUND` for an unknown or deleted product;
|
|
388
|
+
* - `422 VALIDATION_FAILED` `details.field = 'source'` when `options.source` is not a module id
|
|
389
|
+
* (`^[a-z][a-z0-9_]{1,63}$`) present in the module registry;
|
|
390
|
+
* - `422 VALIDATION_FAILED` `details.field = 'cells'` for more than
|
|
391
|
+
* {@link PRODUCT_SCOPED_WRITE_CELLS_MAX} cells or the same (field, scope) twice.
|
|
392
|
+
*/
|
|
393
|
+
export interface CatalogProductScopeWritePort {
|
|
394
|
+
applyScopes(productId: string, input: ProductScopedWriteInput, options: {
|
|
395
|
+
source: string;
|
|
396
|
+
}): Promise<ProductScopedWriteResult>;
|
|
397
|
+
}
|
|
398
|
+
/**
|
|
399
|
+
* What the completeness gate reports missing at a (channel, language) — one
|
|
400
|
+
* vocabulary for the save warning, the `SCOPE_INCOMPLETE` refusal and the scope
|
|
401
|
+
* overview's cells, so they cannot disagree (FR-041, FR-060).
|
|
402
|
+
*/
|
|
403
|
+
export declare const scopeMissingValueSchema: z.ZodUnion<readonly [z.ZodLiteral<"name">, z.ZodLiteral<"urlKey">, z.ZodTemplateLiteral<`attribute:${string}`>]>;
|
|
404
|
+
export type ScopeMissingValue = z.infer<typeof scopeMissingValueSchema>;
|
|
405
|
+
/** §1 — `GET /api/v1/admin/catalog/products/:id/scopes`. */
|
|
406
|
+
export declare const productScopesSchema: z.ZodObject<{
|
|
407
|
+
global: z.ZodObject<{
|
|
408
|
+
status: z.ZodEnum<{
|
|
409
|
+
active: "active";
|
|
410
|
+
inactive: "inactive";
|
|
411
|
+
}>;
|
|
412
|
+
publishFrom: z.ZodNullable<z.ZodString>;
|
|
413
|
+
publishUntil: z.ZodNullable<z.ZodString>;
|
|
414
|
+
visibility: z.ZodEnum<{
|
|
415
|
+
public: "public";
|
|
416
|
+
logged_in_only: "logged_in_only";
|
|
417
|
+
organization_restricted: "organization_restricted";
|
|
418
|
+
}>;
|
|
419
|
+
allowedOrganizationIds: z.ZodArray<z.ZodString>;
|
|
420
|
+
minOrderQuantity: z.ZodNullable<z.ZodNumber>;
|
|
421
|
+
returnable: z.ZodBoolean;
|
|
422
|
+
}, z.core.$strip>;
|
|
423
|
+
channels: z.ZodArray<z.ZodObject<{
|
|
424
|
+
channelId: z.ZodString;
|
|
425
|
+
isMember: z.ZodBoolean;
|
|
426
|
+
languages: z.ZodArray<z.ZodString>;
|
|
427
|
+
status: z.ZodNullable<z.ZodEnum<{
|
|
428
|
+
active: "active";
|
|
429
|
+
inactive: "inactive";
|
|
430
|
+
}>>;
|
|
431
|
+
window: z.ZodNullable<z.ZodObject<{
|
|
432
|
+
from: z.ZodNullable<z.ZodString>;
|
|
433
|
+
until: z.ZodNullable<z.ZodString>;
|
|
434
|
+
}, z.core.$strip>>;
|
|
435
|
+
audience: z.ZodNullable<z.ZodObject<{
|
|
436
|
+
visibility: z.ZodEnum<{
|
|
437
|
+
public: "public";
|
|
438
|
+
logged_in_only: "logged_in_only";
|
|
439
|
+
organization_restricted: "organization_restricted";
|
|
440
|
+
}>;
|
|
441
|
+
allowedOrganizationIds: z.ZodArray<z.ZodString>;
|
|
442
|
+
nonMemberOrganizationIds: z.ZodArray<z.ZodString>;
|
|
443
|
+
}, z.core.$strip>>;
|
|
444
|
+
minOrderQuantityOverridden: z.ZodBoolean;
|
|
445
|
+
minOrderQuantity: z.ZodNullable<z.ZodNumber>;
|
|
446
|
+
returnable: z.ZodNullable<z.ZodBoolean>;
|
|
447
|
+
languageStatuses: z.ZodArray<z.ZodObject<{
|
|
448
|
+
languageCode: z.ZodString;
|
|
449
|
+
status: z.ZodEnum<{
|
|
450
|
+
active: "active";
|
|
451
|
+
inactive: "inactive";
|
|
452
|
+
}>;
|
|
453
|
+
orphaned: z.ZodBoolean;
|
|
454
|
+
}, z.core.$strip>>;
|
|
455
|
+
orphaned: z.ZodBoolean;
|
|
456
|
+
}, z.core.$strip>>;
|
|
457
|
+
organizations: z.ZodArray<z.ZodObject<{
|
|
458
|
+
id: z.ZodString;
|
|
459
|
+
name: z.ZodString;
|
|
460
|
+
}, z.core.$strip>>;
|
|
461
|
+
}, z.core.$strip>;
|
|
462
|
+
export type ProductScopes = z.infer<typeof productScopesSchema>;
|
|
463
|
+
export declare const productScopesResponseSchema: z.ZodObject<{
|
|
464
|
+
data: z.ZodObject<{
|
|
465
|
+
global: z.ZodObject<{
|
|
466
|
+
status: z.ZodEnum<{
|
|
467
|
+
active: "active";
|
|
468
|
+
inactive: "inactive";
|
|
469
|
+
}>;
|
|
470
|
+
publishFrom: z.ZodNullable<z.ZodString>;
|
|
471
|
+
publishUntil: z.ZodNullable<z.ZodString>;
|
|
472
|
+
visibility: z.ZodEnum<{
|
|
473
|
+
public: "public";
|
|
474
|
+
logged_in_only: "logged_in_only";
|
|
475
|
+
organization_restricted: "organization_restricted";
|
|
476
|
+
}>;
|
|
477
|
+
allowedOrganizationIds: z.ZodArray<z.ZodString>;
|
|
478
|
+
minOrderQuantity: z.ZodNullable<z.ZodNumber>;
|
|
479
|
+
returnable: z.ZodBoolean;
|
|
480
|
+
}, z.core.$strip>;
|
|
481
|
+
channels: z.ZodArray<z.ZodObject<{
|
|
482
|
+
channelId: z.ZodString;
|
|
483
|
+
isMember: z.ZodBoolean;
|
|
484
|
+
languages: z.ZodArray<z.ZodString>;
|
|
485
|
+
status: z.ZodNullable<z.ZodEnum<{
|
|
486
|
+
active: "active";
|
|
487
|
+
inactive: "inactive";
|
|
488
|
+
}>>;
|
|
489
|
+
window: z.ZodNullable<z.ZodObject<{
|
|
490
|
+
from: z.ZodNullable<z.ZodString>;
|
|
491
|
+
until: z.ZodNullable<z.ZodString>;
|
|
492
|
+
}, z.core.$strip>>;
|
|
493
|
+
audience: z.ZodNullable<z.ZodObject<{
|
|
494
|
+
visibility: z.ZodEnum<{
|
|
495
|
+
public: "public";
|
|
496
|
+
logged_in_only: "logged_in_only";
|
|
497
|
+
organization_restricted: "organization_restricted";
|
|
498
|
+
}>;
|
|
499
|
+
allowedOrganizationIds: z.ZodArray<z.ZodString>;
|
|
500
|
+
nonMemberOrganizationIds: z.ZodArray<z.ZodString>;
|
|
501
|
+
}, z.core.$strip>>;
|
|
502
|
+
minOrderQuantityOverridden: z.ZodBoolean;
|
|
503
|
+
minOrderQuantity: z.ZodNullable<z.ZodNumber>;
|
|
504
|
+
returnable: z.ZodNullable<z.ZodBoolean>;
|
|
505
|
+
languageStatuses: z.ZodArray<z.ZodObject<{
|
|
506
|
+
languageCode: z.ZodString;
|
|
507
|
+
status: z.ZodEnum<{
|
|
508
|
+
active: "active";
|
|
509
|
+
inactive: "inactive";
|
|
510
|
+
}>;
|
|
511
|
+
orphaned: z.ZodBoolean;
|
|
512
|
+
}, z.core.$strip>>;
|
|
513
|
+
orphaned: z.ZodBoolean;
|
|
514
|
+
}, z.core.$strip>>;
|
|
515
|
+
organizations: z.ZodArray<z.ZodObject<{
|
|
516
|
+
id: z.ZodString;
|
|
517
|
+
name: z.ZodString;
|
|
518
|
+
}, z.core.$strip>>;
|
|
519
|
+
}, z.core.$strip>;
|
|
520
|
+
}, z.core.$strip>;
|
|
521
|
+
export type ProductScopesResponse = z.infer<typeof productScopesResponseSchema>;
|
|
522
|
+
/**
|
|
523
|
+
* §2 — `PATCH /api/v1/admin/catalog/products/:id/scopes`, in the one write encoding
|
|
524
|
+
* (feature 174, `contracts/write-encoding.md` §5, FR-116): absent or `""` = no change,
|
|
525
|
+
* `{ inherit: true }` = use inherited (deletes the override), `null` = the empty override
|
|
526
|
+
* where the field takes one — `minOrderQuantity: null` = no minimum in this channel,
|
|
527
|
+
* `window: null` = an open window override; `status`, `audience` and `returnable` refuse
|
|
528
|
+
* `null` (`SCOPED_VALUE_INVALID`, `not_emptyable`, from the service). A window whose
|
|
529
|
+
* `from` is not before its `until` is refused with `VALIDATION_FAILED`,
|
|
530
|
+
* `details.field = 'window'`.
|
|
531
|
+
*/
|
|
532
|
+
export declare const patchProductScopesRequestSchema: z.ZodObject<{
|
|
533
|
+
channels: z.ZodArray<z.ZodObject<{
|
|
534
|
+
channelId: z.ZodString;
|
|
535
|
+
status: z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodOptional<z.ZodUnion<readonly [z.ZodNull, z.ZodObject<{
|
|
536
|
+
inherit: z.ZodLiteral<true>;
|
|
537
|
+
}, z.core.$strict>, z.ZodEnum<{
|
|
538
|
+
active: "active";
|
|
539
|
+
inactive: "inactive";
|
|
540
|
+
}>]>>>;
|
|
541
|
+
window: z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodOptional<z.ZodUnion<readonly [z.ZodNull, z.ZodObject<{
|
|
542
|
+
inherit: z.ZodLiteral<true>;
|
|
543
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
544
|
+
from: z.ZodNullable<z.ZodString>;
|
|
545
|
+
until: z.ZodNullable<z.ZodString>;
|
|
546
|
+
}, z.core.$strict>]>>>;
|
|
547
|
+
audience: z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodOptional<z.ZodUnion<readonly [z.ZodNull, z.ZodObject<{
|
|
548
|
+
inherit: z.ZodLiteral<true>;
|
|
549
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
550
|
+
visibility: z.ZodEnum<{
|
|
551
|
+
public: "public";
|
|
552
|
+
logged_in_only: "logged_in_only";
|
|
553
|
+
organization_restricted: "organization_restricted";
|
|
554
|
+
}>;
|
|
555
|
+
allowedOrganizationIds: z.ZodArray<z.ZodString>;
|
|
556
|
+
}, z.core.$strict>]>>>;
|
|
557
|
+
minOrderQuantity: z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodOptional<z.ZodUnion<readonly [z.ZodNull, z.ZodObject<{
|
|
558
|
+
inherit: z.ZodLiteral<true>;
|
|
559
|
+
}, z.core.$strict>, z.ZodNumber]>>>;
|
|
560
|
+
returnable: z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodOptional<z.ZodUnion<readonly [z.ZodNull, z.ZodObject<{
|
|
561
|
+
inherit: z.ZodLiteral<true>;
|
|
562
|
+
}, z.core.$strict>, z.ZodBoolean]>>>;
|
|
563
|
+
languageStatuses: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
564
|
+
languageCode: z.ZodString;
|
|
565
|
+
status: z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodOptional<z.ZodUnion<readonly [z.ZodNull, z.ZodObject<{
|
|
566
|
+
inherit: z.ZodLiteral<true>;
|
|
567
|
+
}, z.core.$strict>, z.ZodEnum<{
|
|
568
|
+
active: "active";
|
|
569
|
+
inactive: "inactive";
|
|
570
|
+
}>]>>>;
|
|
571
|
+
}, z.core.$strip>>>;
|
|
572
|
+
}, z.core.$strip>>;
|
|
573
|
+
global: z.ZodOptional<z.ZodObject<{
|
|
574
|
+
publishFrom: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
575
|
+
publishUntil: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
576
|
+
}, z.core.$strip>>;
|
|
577
|
+
}, z.core.$strip>;
|
|
578
|
+
export type PatchProductScopesRequest = z.infer<typeof patchProductScopesRequestSchema>;
|
|
579
|
+
export declare const scopeWarningSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
580
|
+
kind: z.ZodLiteral<"completeness">;
|
|
581
|
+
channelId: z.ZodString;
|
|
582
|
+
languageCode: z.ZodString;
|
|
583
|
+
missing: z.ZodArray<z.ZodUnion<readonly [z.ZodLiteral<"name">, z.ZodLiteral<"urlKey">, z.ZodTemplateLiteral<`attribute:${string}`>]>>;
|
|
584
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
585
|
+
kind: z.ZodLiteral<"audience_non_members">;
|
|
586
|
+
channelId: z.ZodString;
|
|
587
|
+
organizationIds: z.ZodArray<z.ZodString>;
|
|
588
|
+
}, z.core.$strip>], "kind">;
|
|
589
|
+
export type ScopeWarning = z.infer<typeof scopeWarningSchema>;
|
|
590
|
+
export declare const patchProductScopesResponseSchema: z.ZodObject<{
|
|
591
|
+
data: z.ZodObject<{
|
|
592
|
+
global: z.ZodObject<{
|
|
593
|
+
status: z.ZodEnum<{
|
|
594
|
+
active: "active";
|
|
595
|
+
inactive: "inactive";
|
|
596
|
+
}>;
|
|
597
|
+
publishFrom: z.ZodNullable<z.ZodString>;
|
|
598
|
+
publishUntil: z.ZodNullable<z.ZodString>;
|
|
599
|
+
visibility: z.ZodEnum<{
|
|
600
|
+
public: "public";
|
|
601
|
+
logged_in_only: "logged_in_only";
|
|
602
|
+
organization_restricted: "organization_restricted";
|
|
603
|
+
}>;
|
|
604
|
+
allowedOrganizationIds: z.ZodArray<z.ZodString>;
|
|
605
|
+
minOrderQuantity: z.ZodNullable<z.ZodNumber>;
|
|
606
|
+
returnable: z.ZodBoolean;
|
|
607
|
+
}, z.core.$strip>;
|
|
608
|
+
channels: z.ZodArray<z.ZodObject<{
|
|
609
|
+
channelId: z.ZodString;
|
|
610
|
+
isMember: z.ZodBoolean;
|
|
611
|
+
languages: z.ZodArray<z.ZodString>;
|
|
612
|
+
status: z.ZodNullable<z.ZodEnum<{
|
|
613
|
+
active: "active";
|
|
614
|
+
inactive: "inactive";
|
|
615
|
+
}>>;
|
|
616
|
+
window: z.ZodNullable<z.ZodObject<{
|
|
617
|
+
from: z.ZodNullable<z.ZodString>;
|
|
618
|
+
until: z.ZodNullable<z.ZodString>;
|
|
619
|
+
}, z.core.$strip>>;
|
|
620
|
+
audience: z.ZodNullable<z.ZodObject<{
|
|
621
|
+
visibility: z.ZodEnum<{
|
|
622
|
+
public: "public";
|
|
623
|
+
logged_in_only: "logged_in_only";
|
|
624
|
+
organization_restricted: "organization_restricted";
|
|
625
|
+
}>;
|
|
626
|
+
allowedOrganizationIds: z.ZodArray<z.ZodString>;
|
|
627
|
+
nonMemberOrganizationIds: z.ZodArray<z.ZodString>;
|
|
628
|
+
}, z.core.$strip>>;
|
|
629
|
+
minOrderQuantityOverridden: z.ZodBoolean;
|
|
630
|
+
minOrderQuantity: z.ZodNullable<z.ZodNumber>;
|
|
631
|
+
returnable: z.ZodNullable<z.ZodBoolean>;
|
|
632
|
+
languageStatuses: z.ZodArray<z.ZodObject<{
|
|
633
|
+
languageCode: z.ZodString;
|
|
634
|
+
status: z.ZodEnum<{
|
|
635
|
+
active: "active";
|
|
636
|
+
inactive: "inactive";
|
|
637
|
+
}>;
|
|
638
|
+
orphaned: z.ZodBoolean;
|
|
639
|
+
}, z.core.$strip>>;
|
|
640
|
+
orphaned: z.ZodBoolean;
|
|
641
|
+
}, z.core.$strip>>;
|
|
642
|
+
organizations: z.ZodArray<z.ZodObject<{
|
|
643
|
+
id: z.ZodString;
|
|
644
|
+
name: z.ZodString;
|
|
645
|
+
}, z.core.$strip>>;
|
|
646
|
+
}, z.core.$strip>;
|
|
647
|
+
warnings: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
648
|
+
kind: z.ZodLiteral<"completeness">;
|
|
649
|
+
channelId: z.ZodString;
|
|
650
|
+
languageCode: z.ZodString;
|
|
651
|
+
missing: z.ZodArray<z.ZodUnion<readonly [z.ZodLiteral<"name">, z.ZodLiteral<"urlKey">, z.ZodTemplateLiteral<`attribute:${string}`>]>>;
|
|
652
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
653
|
+
kind: z.ZodLiteral<"audience_non_members">;
|
|
654
|
+
channelId: z.ZodString;
|
|
655
|
+
organizationIds: z.ZodArray<z.ZodString>;
|
|
656
|
+
}, z.core.$strip>], "kind">>;
|
|
657
|
+
}, z.core.$strip>;
|
|
658
|
+
export type PatchProductScopesResponse = z.infer<typeof patchProductScopesResponseSchema>;
|
|
659
|
+
/** `422 SCOPE_INVALID` details (FR-014). */
|
|
660
|
+
export declare const scopeInvalidDetailsSchema: z.ZodObject<{
|
|
661
|
+
channelId: z.ZodString;
|
|
662
|
+
languageCode: z.ZodOptional<z.ZodString>;
|
|
663
|
+
reason: z.ZodEnum<{
|
|
664
|
+
not_a_member: "not_a_member";
|
|
665
|
+
language_not_offered: "language_not_offered";
|
|
666
|
+
}>;
|
|
667
|
+
}, z.core.$strip>;
|
|
668
|
+
export type ScopeInvalidDetails = z.infer<typeof scopeInvalidDetailsSchema>;
|
|
669
|
+
/** `422 SCOPE_INCOMPLETE` details (FR-060). */
|
|
670
|
+
export declare const scopeIncompleteDetailsSchema: z.ZodObject<{
|
|
671
|
+
pairs: z.ZodArray<z.ZodObject<{
|
|
672
|
+
channelId: z.ZodString;
|
|
673
|
+
languageCode: z.ZodString;
|
|
674
|
+
missing: z.ZodArray<z.ZodUnion<readonly [z.ZodLiteral<"name">, z.ZodLiteral<"urlKey">, z.ZodTemplateLiteral<`attribute:${string}`>]>>;
|
|
675
|
+
}, z.core.$strip>>;
|
|
676
|
+
}, z.core.$strip>;
|
|
677
|
+
export type ScopeIncompleteDetails = z.infer<typeof scopeIncompleteDetailsSchema>;
|
|
678
|
+
/** Feature 174 (FR-010) — there is no Language scope: an override sits at C or C×L. */
|
|
679
|
+
export declare const scopeLevelSchema: z.ZodEnum<{
|
|
680
|
+
channel: "channel";
|
|
681
|
+
channel_language: "channel_language";
|
|
682
|
+
}>;
|
|
683
|
+
/** §3 — `GET /api/v1/admin/catalog/products/:id/scope-overview`. */
|
|
684
|
+
export declare const scopeOverviewResponseSchema: z.ZodObject<{
|
|
685
|
+
data: z.ZodObject<{
|
|
686
|
+
channels: z.ZodArray<z.ZodObject<{
|
|
687
|
+
channelId: z.ZodString;
|
|
688
|
+
name: z.ZodRecord<z.ZodString, z.ZodString>;
|
|
689
|
+
isMember: z.ZodBoolean;
|
|
690
|
+
languages: z.ZodArray<z.ZodString>;
|
|
691
|
+
}, z.core.$strip>>;
|
|
692
|
+
languages: z.ZodArray<z.ZodString>;
|
|
693
|
+
cells: z.ZodArray<z.ZodObject<{
|
|
694
|
+
channelId: z.ZodString;
|
|
695
|
+
languageCode: z.ZodString;
|
|
696
|
+
available: z.ZodBoolean;
|
|
697
|
+
effectiveStatus: z.ZodEnum<{
|
|
698
|
+
active: "active";
|
|
699
|
+
inactive: "inactive";
|
|
700
|
+
}>;
|
|
701
|
+
statusSource: z.ZodEnum<{
|
|
702
|
+
global: "global";
|
|
703
|
+
channel: "channel";
|
|
704
|
+
channel_language: "channel_language";
|
|
705
|
+
}>;
|
|
706
|
+
overriddenFields: z.ZodArray<z.ZodObject<{
|
|
707
|
+
field: z.ZodString;
|
|
708
|
+
level: z.ZodEnum<{
|
|
709
|
+
channel: "channel";
|
|
710
|
+
channel_language: "channel_language";
|
|
711
|
+
}>;
|
|
712
|
+
}, z.core.$strip>>;
|
|
713
|
+
missing: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodLiteral<"name">, z.ZodLiteral<"urlKey">, z.ZodTemplateLiteral<`attribute:${string}`>]>>>;
|
|
714
|
+
}, z.core.$strip>>;
|
|
715
|
+
channelRows: z.ZodArray<z.ZodObject<{
|
|
716
|
+
channelId: z.ZodString;
|
|
717
|
+
overriddenFields: z.ZodArray<z.ZodString>;
|
|
718
|
+
}, z.core.$strip>>;
|
|
719
|
+
orphans: z.ZodArray<z.ZodObject<{
|
|
720
|
+
field: z.ZodString;
|
|
721
|
+
channelId: z.ZodNullable<z.ZodString>;
|
|
722
|
+
languageCode: z.ZodNullable<z.ZodString>;
|
|
723
|
+
reason: z.ZodEnum<{
|
|
724
|
+
not_a_member: "not_a_member";
|
|
725
|
+
language_not_offered: "language_not_offered";
|
|
726
|
+
attribute_scope_changed: "attribute_scope_changed";
|
|
727
|
+
}>;
|
|
728
|
+
}, z.core.$strip>>;
|
|
729
|
+
}, z.core.$strip>;
|
|
730
|
+
}, z.core.$strip>;
|
|
731
|
+
export type ScopeOverviewResponse = z.infer<typeof scopeOverviewResponseSchema>;
|
|
732
|
+
/** §6 — `GET /api/v1/admin/catalog/attributes/:idOrKey/scope-change-preview`. */
|
|
733
|
+
export declare const attributeScopeChangePreviewResponseSchema: z.ZodObject<{
|
|
734
|
+
data: z.ZodObject<{
|
|
735
|
+
orphanedOverrides: z.ZodNumber;
|
|
736
|
+
byChannel: z.ZodArray<z.ZodObject<{
|
|
737
|
+
channelId: z.ZodString;
|
|
738
|
+
count: z.ZodNumber;
|
|
739
|
+
}, z.core.$strip>>;
|
|
740
|
+
}, z.core.$strip>;
|
|
741
|
+
}, z.core.$strip>;
|
|
742
|
+
export type AttributeScopeChangePreviewResponse = z.infer<typeof attributeScopeChangePreviewResponseSchema>;
|
|
743
|
+
/** §5 — the completeness gate's mode (`catalog.scope_completeness_gate`). */
|
|
744
|
+
export declare const SCOPE_COMPLETENESS_GATE_MODES: readonly ["warn", "refuse"];
|
|
745
|
+
export type ScopeCompletenessGateMode = (typeof SCOPE_COMPLETENESS_GATE_MODES)[number];
|
|
746
|
+
//# sourceMappingURL=product-scopes.d.ts.map
|