@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
package/dist/projects.js
CHANGED
|
@@ -230,9 +230,24 @@ export const UpdateProjectBodySchema = z
|
|
|
230
230
|
version: z.number().int().positive(),
|
|
231
231
|
})
|
|
232
232
|
.strict();
|
|
233
|
-
/**
|
|
233
|
+
/**
|
|
234
|
+
* Optimistic concurrency for a Project's configuration (issue #449) — two
|
|
235
|
+
* tokens, each optional, so a client that sends none is served as before. Sent
|
|
236
|
+
* and stale, the write answers 409 `PROJECT_CHANGED` and nothing is written.
|
|
237
|
+
* Neither is the Project's `version`, which no write of its configuration moves.
|
|
238
|
+
*
|
|
239
|
+
* - `configurationVersion` (`ProjectDetail.configurationVersion`) — the
|
|
240
|
+
* Project's sets: `POST …/stages`, `PUT …/stages/order`, `PUT …/moves`,
|
|
241
|
+
* `PUT …/organizations`, `PUT …/members`; each of them, and
|
|
242
|
+
* `DELETE …/stages/:stageId`, moves it.
|
|
243
|
+
* - `version` (`ProjectStage.version`) — a Stage's own edits:
|
|
244
|
+
* `PATCH …/stages/:stageId`, `PUT …/stages/:stageId/tasks`; each moves it.
|
|
245
|
+
*/
|
|
246
|
+
const configurationVersionShape = { configurationVersion: z.number().int().positive().optional() };
|
|
247
|
+
const stageVersionShape = { version: z.number().int().positive().optional() };
|
|
248
|
+
/** `PUT /projects/:id/organizations` — the whole set, in one transaction (409 `PROJECT_ORGANIZATION_IN_USE`). */
|
|
234
249
|
export const SetProjectOrganizationsBodySchema = z
|
|
235
|
-
.object({ organizationIds: distinctIds(50) })
|
|
250
|
+
.object({ organizationIds: distinctIds(50), ...configurationVersionShape })
|
|
236
251
|
.strict();
|
|
237
252
|
/**
|
|
238
253
|
* The answer of `PUT /projects/:id/organizations` when the change the caller
|
|
@@ -243,12 +258,12 @@ export const SetProjectOrganizationsBodySchema = z
|
|
|
243
258
|
*/
|
|
244
259
|
export const ProjectOutOfReachAfterWriteSchema = z.object({ id: uuid, outOfReach: z.literal(true) }).strict();
|
|
245
260
|
/** `PUT /projects/:id/members` — the whole set, Members and their Roles, in one Command. */
|
|
246
|
-
export const SetProjectMembersBodySchema = z.object({ members: membersSchema }).strict();
|
|
261
|
+
export const SetProjectMembersBodySchema = z.object({ members: membersSchema, ...configurationVersionShape }).strict();
|
|
247
262
|
// ---------------------------------------------------------------------------
|
|
248
263
|
// §2.2 Stages and moves — requests
|
|
249
264
|
// ---------------------------------------------------------------------------
|
|
250
265
|
/** `POST /projects/:id/stages`. */
|
|
251
|
-
export const CreateProjectStageBodySchema = z.object(stageAttributesShape).strict();
|
|
266
|
+
export const CreateProjectStageBodySchema = z.object({ ...stageAttributesShape, ...configurationVersionShape }).strict();
|
|
252
267
|
/**
|
|
253
268
|
* `PATCH /projects/:id/stages/:stageId` — any attribute, at least one.
|
|
254
269
|
* `deadlineOn` sets the deadline by hand; `null` drops the manual deadline and
|
|
@@ -257,11 +272,15 @@ export const CreateProjectStageBodySchema = z.object(stageAttributesShape).stric
|
|
|
257
272
|
export const UpdateProjectStageBodySchema = z
|
|
258
273
|
.object({ ...stageAttributesShape, deadlineOn: calendarDateSchema.nullable() })
|
|
259
274
|
.partial()
|
|
275
|
+
.extend(stageVersionShape)
|
|
260
276
|
.strict()
|
|
261
|
-
.refine((body) => Object.keys(body).
|
|
277
|
+
.refine((body) => Object.keys(body).some((key) => key !== 'version'), { message: 'Nothing to change' });
|
|
262
278
|
/** `PUT /projects/:id/stages/order` — every Stage id of the Project, in the new order. */
|
|
263
279
|
export const ReorderProjectStagesBodySchema = z
|
|
264
|
-
.object({
|
|
280
|
+
.object({
|
|
281
|
+
stageIds: distinctIds(PROJECT_STAGES_MAX).refine((ids) => ids.length > 0, 'At least one Stage'),
|
|
282
|
+
...configurationVersionShape,
|
|
283
|
+
})
|
|
265
284
|
.strict();
|
|
266
285
|
export const ProjectStageMoveSchema = z
|
|
267
286
|
.object({ fromStageId: uuid, toStageId: uuid })
|
|
@@ -271,10 +290,13 @@ export const ProjectStageMoveSchema = z
|
|
|
271
290
|
});
|
|
272
291
|
/** `PUT /projects/:id/moves` — the whole set of permitted moves (FR-011). */
|
|
273
292
|
export const SetProjectMovesBodySchema = z
|
|
274
|
-
.object({
|
|
293
|
+
.object({
|
|
294
|
+
moves: z.array(ProjectStageMoveSchema).max(PROJECT_STAGES_MAX * PROJECT_STAGES_MAX),
|
|
295
|
+
...configurationVersionShape,
|
|
296
|
+
})
|
|
275
297
|
.strict();
|
|
276
298
|
/** `PUT /projects/:id/stages/:stageId/tasks` — the Stage's Task definitions, replaced whole. */
|
|
277
|
-
export const SetProjectStageTasksBodySchema = z.object({ tasks: stageTasksSchema }).strict();
|
|
299
|
+
export const SetProjectStageTasksBodySchema = z.object({ tasks: stageTasksSchema, ...stageVersionShape }).strict();
|
|
278
300
|
/** `POST /projects/:id/move`. */
|
|
279
301
|
export const MoveProjectBodySchema = z
|
|
280
302
|
.object({ toStageId: uuid, version: z.number().int().positive() })
|
|
@@ -531,6 +553,8 @@ export const ProjectStageSchema = z.object({
|
|
|
531
553
|
tasksMaterializeFailed: z.boolean(),
|
|
532
554
|
/** The Stage's own Task definitions (R-7). */
|
|
533
555
|
stageTasks: z.array(StageTaskDefinitionSchema.extend({ id: uuid, position: z.number().int() })),
|
|
556
|
+
/** What `PATCH …/stages/:stageId` and `PUT …/stages/:stageId/tasks` name (issue #449). */
|
|
557
|
+
version: z.number().int().positive(),
|
|
534
558
|
});
|
|
535
559
|
export const ProjectMemberSchema = z.object({
|
|
536
560
|
id: uuid,
|
|
@@ -558,6 +582,8 @@ export const ProjectDetailSchema = ProjectSummarySchema.extend({
|
|
|
558
582
|
unreadMessageCount: z.number().int().nonnegative(),
|
|
559
583
|
customFieldValues: customFieldValuesSchema,
|
|
560
584
|
version: z.number().int().positive(),
|
|
585
|
+
/** What the Project's sets — Stages added or reordered, workflow, Organizations, Members — name (issue #449). */
|
|
586
|
+
configurationVersion: z.number().int().positive(),
|
|
561
587
|
permissions: z.object({ canWrite: z.boolean(), canConfigure: z.boolean() }),
|
|
562
588
|
});
|
|
563
589
|
export const ProjectStageEntrySchema = z.object({
|
|
@@ -574,6 +600,8 @@ export const ProjectStageEntrySchema = z.object({
|
|
|
574
600
|
export const SetProjectMovesResultSchema = z.object({
|
|
575
601
|
moves: z.array(z.object({ fromStageId: uuid, toStageId: uuid })),
|
|
576
602
|
unreachableStageIds: z.array(uuid),
|
|
603
|
+
/** The Project's `configurationVersion` after the write — what the next of its sets names (issue #449). */
|
|
604
|
+
configurationVersion: z.number().int().positive(),
|
|
577
605
|
});
|
|
578
606
|
/** `POST /projects/:id/move` — the Project after the move and what the move recorded. */
|
|
579
607
|
export const ProjectMoveResultSchema = z.object({
|
|
@@ -595,9 +623,21 @@ export const ProjectLinkSchema = z.object({
|
|
|
595
623
|
recordId: uuid,
|
|
596
624
|
available: z.boolean(),
|
|
597
625
|
number: z.string().optional(),
|
|
626
|
+
/** The record's status code, as its owner stores it. */
|
|
598
627
|
status: z.string().optional(),
|
|
628
|
+
/**
|
|
629
|
+
* The status's name in the response language, as the record's owner names it
|
|
630
|
+
* (issue #455) — what a reader is shown; `status` stays the machine token.
|
|
631
|
+
*/
|
|
632
|
+
statusName: z.string().optional(),
|
|
599
633
|
amount: z.string().optional(),
|
|
600
634
|
currency: z.string().optional(),
|
|
635
|
+
/**
|
|
636
|
+
* A Quote Request's link only, while available — how far its lines are
|
|
637
|
+
* agreed (issue #456, `quoteRequestAmountSchema`). `amount` is absent when
|
|
638
|
+
* no line has a price.
|
|
639
|
+
*/
|
|
640
|
+
agreement: z.enum(['agreed', 'partial', 'none']).optional(),
|
|
601
641
|
href: z.string().optional(),
|
|
602
642
|
linkedBy: personSchema.nullable(),
|
|
603
643
|
linkedAt: isoTimestampSchema,
|
|
@@ -701,7 +741,10 @@ export const ProjectTemplateResponseSchema = dataEnvelope(ProjectTemplateDetailS
|
|
|
701
741
|
export const ProjectCurrencyAmountSchema = z.object({ currency: z.string(), amount: z.string() });
|
|
702
742
|
/**
|
|
703
743
|
* Every figure states the period it covers, how many Projects it was computed
|
|
704
|
-
* from and how many it left out for a missing value (FR-038)
|
|
744
|
+
* from and how many it left out for a missing value (FR-038) — and the time
|
|
745
|
+
* zone its days were counted in (issue #475): the `analytics` module's
|
|
746
|
+
* reporting time zone, or `UTC` while that module is off. An IANA name;
|
|
747
|
+
* additive, so a reply without it parses as before.
|
|
705
748
|
*/
|
|
706
749
|
export function projectAnalyticsEnvelope(data) {
|
|
707
750
|
return z.object({
|
|
@@ -709,6 +752,7 @@ export function projectAnalyticsEnvelope(data) {
|
|
|
709
752
|
to: z.string(),
|
|
710
753
|
projectCount: z.number().int().nonnegative(),
|
|
711
754
|
excluded: z.object({ noValue: z.number().int().nonnegative() }),
|
|
755
|
+
timeZone: z.string().min(1).optional(),
|
|
712
756
|
data,
|
|
713
757
|
});
|
|
714
758
|
}
|
package/dist/promotions.d.ts
CHANGED
|
@@ -32,8 +32,8 @@ declare const attributeCriterionSchema: z.ZodObject<{
|
|
|
32
32
|
attributeKey: z.ZodString;
|
|
33
33
|
op: z.ZodEnum<{
|
|
34
34
|
in: "in";
|
|
35
|
-
equals: "equals";
|
|
36
35
|
range: "range";
|
|
36
|
+
equals: "equals";
|
|
37
37
|
}>;
|
|
38
38
|
values: z.ZodArray<z.ZodUnknown>;
|
|
39
39
|
}, z.core.$strip>;
|
|
@@ -42,8 +42,8 @@ export declare const promotionCriterionSchema: z.ZodDiscriminatedUnion<[z.ZodObj
|
|
|
42
42
|
attributeKey: z.ZodString;
|
|
43
43
|
op: z.ZodEnum<{
|
|
44
44
|
in: "in";
|
|
45
|
-
equals: "equals";
|
|
46
45
|
range: "range";
|
|
46
|
+
equals: "equals";
|
|
47
47
|
}>;
|
|
48
48
|
values: z.ZodArray<z.ZodUnknown>;
|
|
49
49
|
}, z.core.$strip>, z.ZodObject<{
|
|
@@ -68,13 +68,13 @@ export type AttributePromotionCriterion = z.infer<typeof attributeCriterionSchem
|
|
|
68
68
|
*/
|
|
69
69
|
export declare const promotionRuleOpSchema: z.ZodEnum<{
|
|
70
70
|
in: "in";
|
|
71
|
+
contains: "contains";
|
|
71
72
|
startsWith: "startsWith";
|
|
72
73
|
eq: "eq";
|
|
73
74
|
gt: "gt";
|
|
74
75
|
gte: "gte";
|
|
75
76
|
lt: "lt";
|
|
76
77
|
lte: "lte";
|
|
77
|
-
contains: "contains";
|
|
78
78
|
neq: "neq";
|
|
79
79
|
between: "between";
|
|
80
80
|
notIn: "notIn";
|
|
@@ -83,8 +83,8 @@ export type PromotionRuleOp = z.infer<typeof promotionRuleOpSchema>;
|
|
|
83
83
|
/** Built-in cart-context / relationship fields available to the Rule Builder. */
|
|
84
84
|
export declare const promotionRuleBuiltinFieldSchema: z.ZodEnum<{
|
|
85
85
|
category: "category";
|
|
86
|
-
paymentMethod: "paymentMethod";
|
|
87
86
|
organization: "organization";
|
|
87
|
+
paymentMethod: "paymentMethod";
|
|
88
88
|
deliveryMethod: "deliveryMethod";
|
|
89
89
|
customerGroup: "customerGroup";
|
|
90
90
|
cartTotal: "cartTotal";
|
|
@@ -97,8 +97,8 @@ export declare const promotionRuleFieldSchema: z.ZodDiscriminatedUnion<[z.ZodObj
|
|
|
97
97
|
kind: z.ZodLiteral<"builtin">;
|
|
98
98
|
key: z.ZodEnum<{
|
|
99
99
|
category: "category";
|
|
100
|
-
paymentMethod: "paymentMethod";
|
|
101
100
|
organization: "organization";
|
|
101
|
+
paymentMethod: "paymentMethod";
|
|
102
102
|
deliveryMethod: "deliveryMethod";
|
|
103
103
|
customerGroup: "customerGroup";
|
|
104
104
|
cartTotal: "cartTotal";
|
|
@@ -226,8 +226,8 @@ export declare const promotionSchema: z.ZodObject<{
|
|
|
226
226
|
attributeKey: z.ZodString;
|
|
227
227
|
op: z.ZodEnum<{
|
|
228
228
|
in: "in";
|
|
229
|
-
equals: "equals";
|
|
230
229
|
range: "range";
|
|
230
|
+
equals: "equals";
|
|
231
231
|
}>;
|
|
232
232
|
values: z.ZodArray<z.ZodUnknown>;
|
|
233
233
|
}, z.core.$strip>, z.ZodObject<{
|
|
@@ -304,6 +304,110 @@ export declare const promotionSchema: z.ZodObject<{
|
|
|
304
304
|
updatedAt: z.ZodString;
|
|
305
305
|
}, z.core.$strip>;
|
|
306
306
|
export type Promotion = z.infer<typeof promotionSchema>;
|
|
307
|
+
/** `GET /api/v1/admin/promotions` — every promotion (issue #599). */
|
|
308
|
+
export declare const promotionListResponseSchema: z.ZodObject<{
|
|
309
|
+
data: z.ZodArray<z.ZodObject<{
|
|
310
|
+
id: z.ZodString;
|
|
311
|
+
code: z.ZodNullable<z.ZodString>;
|
|
312
|
+
name: z.ZodString;
|
|
313
|
+
kind: z.ZodNullable<z.ZodEnum<{
|
|
314
|
+
free_delivery: "free_delivery";
|
|
315
|
+
percentage_off: "percentage_off";
|
|
316
|
+
amount_off: "amount_off";
|
|
317
|
+
}>>;
|
|
318
|
+
value: z.ZodNullable<z.ZodNumber>;
|
|
319
|
+
currency: z.ZodNullable<z.ZodString>;
|
|
320
|
+
minCartSubtotal: z.ZodNullable<z.ZodNumber>;
|
|
321
|
+
validFrom: z.ZodNullable<z.ZodString>;
|
|
322
|
+
validUntil: z.ZodNullable<z.ZodString>;
|
|
323
|
+
organizationId: z.ZodNullable<z.ZodString>;
|
|
324
|
+
customerGroupId: z.ZodNullable<z.ZodString>;
|
|
325
|
+
categoryId: z.ZodNullable<z.ZodString>;
|
|
326
|
+
productId: z.ZodNullable<z.ZodString>;
|
|
327
|
+
criteria: z.ZodDefault<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
328
|
+
type: z.ZodLiteral<"attribute">;
|
|
329
|
+
attributeKey: z.ZodString;
|
|
330
|
+
op: z.ZodEnum<{
|
|
331
|
+
in: "in";
|
|
332
|
+
range: "range";
|
|
333
|
+
equals: "equals";
|
|
334
|
+
}>;
|
|
335
|
+
values: z.ZodArray<z.ZodUnknown>;
|
|
336
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
337
|
+
type: z.ZodLiteral<"category">;
|
|
338
|
+
categoryIds: z.ZodArray<z.ZodString>;
|
|
339
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
340
|
+
type: z.ZodLiteral<"product">;
|
|
341
|
+
productIds: z.ZodArray<z.ZodString>;
|
|
342
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
343
|
+
type: z.ZodLiteral<"customerGroup">;
|
|
344
|
+
customerGroupIds: z.ZodArray<z.ZodString>;
|
|
345
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
346
|
+
type: z.ZodLiteral<"organization">;
|
|
347
|
+
organizationIds: z.ZodArray<z.ZodString>;
|
|
348
|
+
}, z.core.$strip>], "type">>>;
|
|
349
|
+
isActive: z.ZodBoolean;
|
|
350
|
+
description: z.ZodDefault<z.ZodNullable<z.ZodString>>;
|
|
351
|
+
priority: z.ZodDefault<z.ZodNumber>;
|
|
352
|
+
stopFurther: z.ZodDefault<z.ZodBoolean>;
|
|
353
|
+
action: z.ZodDefault<z.ZodNullable<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
354
|
+
type: z.ZodLiteral<"free_delivery">;
|
|
355
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
356
|
+
type: z.ZodLiteral<"percentage_off_cart">;
|
|
357
|
+
percent: z.ZodNumber;
|
|
358
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
359
|
+
type: z.ZodLiteral<"amount_off_cart">;
|
|
360
|
+
amount: z.ZodNumber;
|
|
361
|
+
currency: z.ZodString;
|
|
362
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
363
|
+
type: z.ZodLiteral<"buy_x_get_y_free">;
|
|
364
|
+
buyQuantity: z.ZodNumber;
|
|
365
|
+
freeQuantity: z.ZodNumber;
|
|
366
|
+
target: z.ZodEnum<{
|
|
367
|
+
cheapest: "cheapest";
|
|
368
|
+
most_expensive: "most_expensive";
|
|
369
|
+
}>;
|
|
370
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
371
|
+
type: z.ZodLiteral<"spend_x_percent_off">;
|
|
372
|
+
spendStep: z.ZodNumber;
|
|
373
|
+
percent: z.ZodNumber;
|
|
374
|
+
currency: z.ZodString;
|
|
375
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
376
|
+
type: z.ZodLiteral<"spend_x_amount_off">;
|
|
377
|
+
spendStep: z.ZodNumber;
|
|
378
|
+
amount: z.ZodNumber;
|
|
379
|
+
currency: z.ZodString;
|
|
380
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
381
|
+
type: z.ZodLiteral<"every_nth_product_percent_off">;
|
|
382
|
+
nth: z.ZodNumber;
|
|
383
|
+
percent: z.ZodNumber;
|
|
384
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
385
|
+
type: z.ZodLiteral<"buy_x_units_y_free">;
|
|
386
|
+
productId: z.ZodString;
|
|
387
|
+
buyUnits: z.ZodNumber;
|
|
388
|
+
freeUnits: z.ZodNumber;
|
|
389
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
390
|
+
type: z.ZodLiteral<"buy_x_units_percent_off">;
|
|
391
|
+
productId: z.ZodString;
|
|
392
|
+
buyUnits: z.ZodNumber;
|
|
393
|
+
percent: z.ZodNumber;
|
|
394
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
395
|
+
type: z.ZodLiteral<"buy_x_units_amount_off">;
|
|
396
|
+
productId: z.ZodString;
|
|
397
|
+
buyUnits: z.ZodNumber;
|
|
398
|
+
amount: z.ZodNumber;
|
|
399
|
+
currency: z.ZodString;
|
|
400
|
+
}, z.core.$strip>], "type">>>;
|
|
401
|
+
ruleId: z.ZodDefault<z.ZodNullable<z.ZodString>>;
|
|
402
|
+
rule: z.ZodDefault<z.ZodNullable<z.ZodType<PromotionRule, unknown, z.core.$ZodTypeInternals<PromotionRule, unknown>>>>;
|
|
403
|
+
usageLimitGlobal: z.ZodDefault<z.ZodNullable<z.ZodNumber>>;
|
|
404
|
+
usageLimitPerOrganization: z.ZodDefault<z.ZodNullable<z.ZodNumber>>;
|
|
405
|
+
usageLimitPerCustomer: z.ZodDefault<z.ZodNullable<z.ZodNumber>>;
|
|
406
|
+
createdAt: z.ZodString;
|
|
407
|
+
updatedAt: z.ZodString;
|
|
408
|
+
}, z.core.$strip>>;
|
|
409
|
+
}, z.core.$strip>;
|
|
410
|
+
export type PromotionListResponse = z.infer<typeof promotionListResponseSchema>;
|
|
307
411
|
export declare const upsertPromotionRequestSchema: z.ZodObject<{
|
|
308
412
|
code: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
309
413
|
name: z.ZodString;
|
|
@@ -326,8 +430,8 @@ export declare const upsertPromotionRequestSchema: z.ZodObject<{
|
|
|
326
430
|
attributeKey: z.ZodString;
|
|
327
431
|
op: z.ZodEnum<{
|
|
328
432
|
in: "in";
|
|
329
|
-
equals: "equals";
|
|
330
433
|
range: "range";
|
|
434
|
+
equals: "equals";
|
|
331
435
|
}>;
|
|
332
436
|
values: z.ZodArray<z.ZodUnknown>;
|
|
333
437
|
}, z.core.$strip>, z.ZodObject<{
|
|
@@ -435,6 +539,38 @@ export declare const promotionRuleRecordSchema: z.ZodObject<{
|
|
|
435
539
|
updatedAt: z.ZodString;
|
|
436
540
|
}, z.core.$strip>;
|
|
437
541
|
export type PromotionRuleRecord = z.infer<typeof promotionRuleRecordSchema>;
|
|
542
|
+
/** `GET /api/v1/admin/promotion-rules` — every named rule (issue #599). */
|
|
543
|
+
export declare const promotionRuleListResponseSchema: z.ZodObject<{
|
|
544
|
+
data: z.ZodArray<z.ZodObject<{
|
|
545
|
+
id: z.ZodString;
|
|
546
|
+
name: z.ZodString;
|
|
547
|
+
description: z.ZodNullable<z.ZodString>;
|
|
548
|
+
definition: z.ZodType<PromotionRule, unknown, z.core.$ZodTypeInternals<PromotionRule, unknown>>;
|
|
549
|
+
createdAt: z.ZodString;
|
|
550
|
+
updatedAt: z.ZodString;
|
|
551
|
+
}, z.core.$strip>>;
|
|
552
|
+
}, z.core.$strip>;
|
|
553
|
+
export type PromotionRuleListResponse = z.infer<typeof promotionRuleListResponseSchema>;
|
|
554
|
+
/**
|
|
555
|
+
* `GET /api/v1/admin/promotion-rules/:id` — the rule, and beside the envelope's
|
|
556
|
+
* `data` the promotions that reference it, which is what refuses its deletion
|
|
557
|
+
* (issue #599).
|
|
558
|
+
*/
|
|
559
|
+
export declare const promotionRuleDetailResponseSchema: z.ZodObject<{
|
|
560
|
+
data: z.ZodObject<{
|
|
561
|
+
id: z.ZodString;
|
|
562
|
+
name: z.ZodString;
|
|
563
|
+
description: z.ZodNullable<z.ZodString>;
|
|
564
|
+
definition: z.ZodType<PromotionRule, unknown, z.core.$ZodTypeInternals<PromotionRule, unknown>>;
|
|
565
|
+
createdAt: z.ZodString;
|
|
566
|
+
updatedAt: z.ZodString;
|
|
567
|
+
}, z.core.$strip>;
|
|
568
|
+
usedBy: z.ZodArray<z.ZodObject<{
|
|
569
|
+
id: z.ZodString;
|
|
570
|
+
name: z.ZodString;
|
|
571
|
+
}, z.core.$strip>>;
|
|
572
|
+
}, z.core.$strip>;
|
|
573
|
+
export type PromotionRuleDetailResponse = z.infer<typeof promotionRuleDetailResponseSchema>;
|
|
438
574
|
export declare const upsertPromotionRuleRequestSchema: z.ZodObject<{
|
|
439
575
|
name: z.ZodString;
|
|
440
576
|
description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
@@ -443,8 +579,8 @@ export declare const upsertPromotionRuleRequestSchema: z.ZodObject<{
|
|
|
443
579
|
export type UpsertPromotionRuleRequest = z.infer<typeof upsertPromotionRuleRequestSchema>;
|
|
444
580
|
export declare const couponFormatSchema: z.ZodEnum<{
|
|
445
581
|
digits: "digits";
|
|
446
|
-
alnum: "alnum";
|
|
447
582
|
letters: "letters";
|
|
583
|
+
alnum: "alnum";
|
|
448
584
|
}>;
|
|
449
585
|
export type CouponFormat = z.infer<typeof couponFormatSchema>;
|
|
450
586
|
export declare const couponLimitScopeSchema: z.ZodEnum<{
|
|
@@ -465,13 +601,29 @@ export declare const promotionCouponSchema: z.ZodObject<{
|
|
|
465
601
|
createdAt: z.ZodString;
|
|
466
602
|
}, z.core.$strip>;
|
|
467
603
|
export type PromotionCouponDto = z.infer<typeof promotionCouponSchema>;
|
|
604
|
+
/** `GET /api/v1/admin/promotions/:id/coupons` — a promotion's coupons (issue #599). */
|
|
605
|
+
export declare const promotionCouponListResponseSchema: z.ZodObject<{
|
|
606
|
+
data: z.ZodArray<z.ZodObject<{
|
|
607
|
+
id: z.ZodString;
|
|
608
|
+
promotionId: z.ZodString;
|
|
609
|
+
batchId: z.ZodNullable<z.ZodString>;
|
|
610
|
+
code: z.ZodString;
|
|
611
|
+
limitScope: z.ZodEnum<{
|
|
612
|
+
per_coupon: "per_coupon";
|
|
613
|
+
shared_batch: "shared_batch";
|
|
614
|
+
}>;
|
|
615
|
+
isActive: z.ZodBoolean;
|
|
616
|
+
createdAt: z.ZodString;
|
|
617
|
+
}, z.core.$strip>>;
|
|
618
|
+
}, z.core.$strip>;
|
|
619
|
+
export type PromotionCouponListResponse = z.infer<typeof promotionCouponListResponseSchema>;
|
|
468
620
|
export declare const generateCouponsRequestSchema: z.ZodObject<{
|
|
469
621
|
count: z.ZodNumber;
|
|
470
622
|
length: z.ZodNumber;
|
|
471
623
|
format: z.ZodEnum<{
|
|
472
624
|
digits: "digits";
|
|
473
|
-
alnum: "alnum";
|
|
474
625
|
letters: "letters";
|
|
626
|
+
alnum: "alnum";
|
|
475
627
|
}>;
|
|
476
628
|
prefix: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
477
629
|
suffix: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
@@ -578,8 +730,8 @@ export declare const promotionRuleAttributeSchema: z.ZodObject<{
|
|
|
578
730
|
date: "date";
|
|
579
731
|
enum: "enum";
|
|
580
732
|
select: "select";
|
|
581
|
-
price: "price";
|
|
582
733
|
multiselect: "multiselect";
|
|
734
|
+
price: "price";
|
|
583
735
|
}>;
|
|
584
736
|
options: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
585
737
|
value: z.ZodString;
|
|
@@ -602,8 +754,8 @@ export declare const promotionRuleAttributesResponseSchema: z.ZodObject<{
|
|
|
602
754
|
date: "date";
|
|
603
755
|
enum: "enum";
|
|
604
756
|
select: "select";
|
|
605
|
-
price: "price";
|
|
606
757
|
multiselect: "multiselect";
|
|
758
|
+
price: "price";
|
|
607
759
|
}>;
|
|
608
760
|
options: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
609
761
|
value: z.ZodString;
|
package/dist/promotions.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { isoDateTimeSchema, moneySchema, uuidSchema } from './common.js';
|
|
3
3
|
import { addAmountPrecisionIssue, hasAtMostTwoDecimals, twoDecimalAmount } from './money-input.js';
|
|
4
|
+
import { lineQuantitySchema } from './line-bounds.js';
|
|
4
5
|
/**
|
|
5
6
|
* Promotion contracts (T129, T132 / FR-052).
|
|
6
7
|
*
|
|
@@ -243,6 +244,10 @@ export const promotionSchema = z.object({
|
|
|
243
244
|
createdAt: isoDateTimeSchema,
|
|
244
245
|
updatedAt: isoDateTimeSchema,
|
|
245
246
|
});
|
|
247
|
+
/** `GET /api/v1/admin/promotions` — every promotion (issue #599). */
|
|
248
|
+
export const promotionListResponseSchema = z.object({
|
|
249
|
+
data: z.array(promotionSchema),
|
|
250
|
+
});
|
|
246
251
|
export const upsertPromotionRequestSchema = z
|
|
247
252
|
.object({
|
|
248
253
|
code: z.string().min(1).max(64).nullable().optional(),
|
|
@@ -363,6 +368,19 @@ export const promotionRuleRecordSchema = z.object({
|
|
|
363
368
|
createdAt: isoDateTimeSchema,
|
|
364
369
|
updatedAt: isoDateTimeSchema,
|
|
365
370
|
});
|
|
371
|
+
/** `GET /api/v1/admin/promotion-rules` — every named rule (issue #599). */
|
|
372
|
+
export const promotionRuleListResponseSchema = z.object({
|
|
373
|
+
data: z.array(promotionRuleRecordSchema),
|
|
374
|
+
});
|
|
375
|
+
/**
|
|
376
|
+
* `GET /api/v1/admin/promotion-rules/:id` — the rule, and beside the envelope's
|
|
377
|
+
* `data` the promotions that reference it, which is what refuses its deletion
|
|
378
|
+
* (issue #599).
|
|
379
|
+
*/
|
|
380
|
+
export const promotionRuleDetailResponseSchema = z.object({
|
|
381
|
+
data: promotionRuleRecordSchema,
|
|
382
|
+
usedBy: z.array(z.object({ id: uuidSchema, name: z.string() })),
|
|
383
|
+
});
|
|
366
384
|
export const upsertPromotionRuleRequestSchema = z.object({
|
|
367
385
|
name: z.string().min(1).max(160),
|
|
368
386
|
description: z.string().max(2000).nullable().optional(),
|
|
@@ -380,6 +398,10 @@ export const promotionCouponSchema = z.object({
|
|
|
380
398
|
isActive: z.boolean(),
|
|
381
399
|
createdAt: isoDateTimeSchema,
|
|
382
400
|
});
|
|
401
|
+
/** `GET /api/v1/admin/promotions/:id/coupons` — a promotion's coupons (issue #599). */
|
|
402
|
+
export const promotionCouponListResponseSchema = z.object({
|
|
403
|
+
data: z.array(promotionCouponSchema),
|
|
404
|
+
});
|
|
383
405
|
export const generateCouponsRequestSchema = z.object({
|
|
384
406
|
count: z.number().int().positive().max(100_000),
|
|
385
407
|
length: z.number().int().min(3).max(40),
|
|
@@ -400,7 +422,7 @@ export const cartLineSchema = z.object({
|
|
|
400
422
|
productId: uuidSchema,
|
|
401
423
|
variantId: uuidSchema.nullable(),
|
|
402
424
|
categoryIds: z.array(uuidSchema),
|
|
403
|
-
quantity:
|
|
425
|
+
quantity: lineQuantitySchema,
|
|
404
426
|
unitPrice: moneySchema,
|
|
405
427
|
/**
|
|
406
428
|
* Feature 012 / US8 — optional attribute snapshot for line-level
|
package/dist/pwa.d.ts
CHANGED
|
@@ -147,8 +147,8 @@ export declare const PushTriggerSchema: z.ZodEnum<{
|
|
|
147
147
|
export type PushTrigger = z.infer<typeof PushTriggerSchema>;
|
|
148
148
|
export declare const PushMessageStatusSchema: z.ZodEnum<{
|
|
149
149
|
failed: "failed";
|
|
150
|
-
sent: "sent";
|
|
151
150
|
queued: "queued";
|
|
151
|
+
sent: "sent";
|
|
152
152
|
sending: "sending";
|
|
153
153
|
}>;
|
|
154
154
|
export type PushMessageStatus = z.infer<typeof PushMessageStatusSchema>;
|
|
@@ -187,8 +187,8 @@ export declare const PushMessageSummarySchema: z.ZodObject<{
|
|
|
187
187
|
}>;
|
|
188
188
|
status: z.ZodEnum<{
|
|
189
189
|
failed: "failed";
|
|
190
|
-
sent: "sent";
|
|
191
190
|
queued: "queued";
|
|
191
|
+
sent: "sent";
|
|
192
192
|
sending: "sending";
|
|
193
193
|
}>;
|
|
194
194
|
sentCount: z.ZodNumber;
|
|
@@ -325,4 +325,43 @@ export interface PushProviderRegistryPort {
|
|
|
325
325
|
get(key: string): PushProvider | undefined;
|
|
326
326
|
resolveDefault(salesChannelId: string): Promise<PushProvider>;
|
|
327
327
|
}
|
|
328
|
+
/** The automatic push category a producer pushes under; `order` stays on pwa's own subscription. */
|
|
329
|
+
export type CustomerPushCategory = 'quote';
|
|
330
|
+
export interface CustomerPushInput {
|
|
331
|
+
organizationId: string;
|
|
332
|
+
customerAccountId: string;
|
|
333
|
+
/** The channel whose push settings apply; `null` = the system default channel. */
|
|
334
|
+
salesChannelId: string | null;
|
|
335
|
+
category: CustomerPushCategory;
|
|
336
|
+
/** Already rendered by the caller in the language it chose. */
|
|
337
|
+
title: string;
|
|
338
|
+
body: string;
|
|
339
|
+
/** Storefront-relative path the notification opens. */
|
|
340
|
+
url: string;
|
|
341
|
+
/** Idempotency key; becomes `push_messages.source_event_id` under trigger `quote_request`. */
|
|
342
|
+
sourceKey: string;
|
|
343
|
+
}
|
|
344
|
+
export type CustomerPushOutcome = 'enqueued'
|
|
345
|
+
/** `pwa.push_enabled` or the category's setting is off on the channel. */
|
|
346
|
+
| 'skipped:switched_off'
|
|
347
|
+
/** The account's preference for the category is off. */
|
|
348
|
+
| 'skipped:customer_preference'
|
|
349
|
+
/** The account is deleted or anonymised. */
|
|
350
|
+
| 'skipped:no_account'
|
|
351
|
+
/** The account has no active device subscription. */
|
|
352
|
+
| 'skipped:no_subscription';
|
|
353
|
+
/**
|
|
354
|
+
* Container name: `customerPushPort`. Owner: `pwa`
|
|
355
|
+
* (`specs/179-rfq-and-customer-notifications/` WP-10). Owner off: fails
|
|
356
|
+
* closed; callers decide presence first (D-60).
|
|
357
|
+
*
|
|
358
|
+
* Producer only: it writes the push message and enqueues pwa's own delivery
|
|
359
|
+
* worker; it never sends inline (Principle X). Gates, in order: channel →
|
|
360
|
+
* `pwa.push_enabled` and the category setting → account live → preference →
|
|
361
|
+
* subscriptions → enqueue. A repeated `sourceKey` answers `enqueued` and writes
|
|
362
|
+
* nothing (`push_messages_trigger_event_uniq`).
|
|
363
|
+
*/
|
|
364
|
+
export interface CustomerPushPort {
|
|
365
|
+
push(input: CustomerPushInput): Promise<CustomerPushOutcome>;
|
|
366
|
+
}
|
|
328
367
|
//# sourceMappingURL=pwa.d.ts.map
|