@sixtyninecommerce/admin 0.10.0 → 0.12.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/README.md +5772 -118
- package/dist/auth/index.d.ts +7 -1
- package/dist/auth/index.js +8 -1
- package/dist/catalog/assets.d.ts +120 -8
- package/dist/catalog/assets.js +98 -12
- package/dist/catalog/collections.d.ts +279 -14
- package/dist/catalog/collections.js +246 -15
- package/dist/catalog/documents.d.ts +142 -0
- package/dist/catalog/documents.js +114 -0
- package/dist/catalog/index.d.ts +54 -6
- package/dist/catalog/index.js +10 -1
- package/dist/catalog/metadata.d.ts +244 -0
- package/dist/catalog/metadata.js +220 -0
- package/dist/catalog/products.d.ts +159 -19
- package/dist/catalog/products.js +88 -13
- package/dist/catalog/properties.d.ts +140 -14
- package/dist/catalog/properties.js +65 -1
- package/dist/catalog/recommendations.d.ts +288 -0
- package/dist/catalog/recommendations.js +237 -0
- package/dist/catalog/reviews.d.ts +381 -0
- package/dist/catalog/reviews.js +325 -0
- package/dist/catalog/types.d.ts +17 -1
- package/dist/catalog/types.js +10 -0
- package/dist/catalog/variant-find.d.ts +136 -0
- package/dist/catalog/variant-find.js +239 -0
- package/dist/catalog/variants.d.ts +293 -26
- package/dist/catalog/variants.js +164 -7
- package/dist/catalog/visibility.d.ts +38 -7
- package/dist/catalog/visibility.js +19 -1
- package/dist/client.d.ts +121 -9
- package/dist/client.js +53 -14
- package/dist/content/assets.d.ts +285 -0
- package/dist/content/assets.js +181 -0
- package/dist/content/forms.d.ts +332 -1
- package/dist/content/forms.js +140 -4
- package/dist/content/items.d.ts +292 -0
- package/dist/content/items.js +170 -0
- package/dist/content/menus.d.ts +254 -0
- package/dist/content/menus.js +70 -0
- package/dist/content/strings.d.ts +137 -0
- package/dist/content/strings.js +82 -0
- package/dist/content/types.d.ts +282 -0
- package/dist/content/types.js +100 -0
- package/dist/customers/age-verification.d.ts +66 -0
- package/dist/customers/age-verification.js +79 -0
- package/dist/customers/credit.d.ts +263 -0
- package/dist/customers/credit.js +244 -0
- package/dist/customers/delivery-preferences.d.ts +120 -0
- package/dist/customers/delivery-preferences.js +97 -0
- package/dist/customers/delivery-terms.d.ts +44 -0
- package/dist/customers/delivery-terms.js +32 -0
- package/dist/customers/groups.d.ts +207 -0
- package/dist/customers/groups.js +438 -0
- package/dist/customers/index.d.ts +462 -37
- package/dist/customers/index.js +317 -40
- package/dist/customers/invitation-status.d.ts +57 -0
- package/dist/customers/invitation-status.js +21 -0
- package/dist/customers/notes.d.ts +67 -0
- package/dist/customers/notes.js +51 -0
- package/dist/customers/notification-recipients.d.ts +97 -0
- package/dist/customers/notification-recipients.js +84 -0
- package/dist/customers/saved-lists.d.ts +42 -0
- package/dist/customers/saved-lists.js +61 -0
- package/dist/customers/vat.d.ts +83 -0
- package/dist/customers/vat.js +46 -0
- package/dist/customers/wire.d.ts +20 -0
- package/dist/customers/wire.js +35 -0
- package/dist/documents/ar.d.ts +307 -0
- package/dist/documents/ar.js +254 -0
- package/dist/documents/emails.d.ts +150 -0
- package/dist/documents/emails.js +220 -0
- package/dist/documents/index.d.ts +744 -21
- package/dist/documents/index.js +438 -24
- package/dist/documents/pdf.d.ts +2 -0
- package/dist/documents/pdf.js +11 -0
- package/dist/fulfillments/create.d.ts +167 -0
- package/dist/fulfillments/create.js +216 -0
- package/dist/fulfillments/index.d.ts +163 -11
- package/dist/fulfillments/index.js +135 -6
- package/dist/fulfillments/payment-policy.d.ts +64 -0
- package/dist/fulfillments/payment-policy.js +140 -0
- package/dist/fulfillments/warehouse.d.ts +724 -0
- package/dist/fulfillments/warehouse.js +914 -0
- package/dist/geo/index.d.ts +119 -0
- package/dist/geo/index.js +107 -0
- package/dist/index.d.ts +147 -39
- package/dist/index.js +51 -12
- package/dist/integrations/afas-actions.d.ts +234 -0
- package/dist/integrations/afas-actions.js +310 -0
- package/dist/integrations/afas-types.d.ts +483 -0
- package/dist/integrations/afas-types.js +5 -0
- package/dist/integrations/afas.d.ts +234 -0
- package/dist/integrations/afas.js +290 -0
- package/dist/integrations/connections.d.ts +103 -0
- package/dist/integrations/connections.js +55 -0
- package/dist/integrations/esp.d.ts +313 -0
- package/dist/integrations/esp.js +169 -0
- package/dist/integrations/exact-online-types.d.ts +965 -0
- package/dist/integrations/exact-online-types.js +6 -0
- package/dist/integrations/exact-online.d.ts +784 -0
- package/dist/integrations/exact-online.js +1089 -0
- package/dist/integrations/index.d.ts +44 -3
- package/dist/integrations/index.js +23 -3
- package/dist/integrations/pipeline-discoveries.d.ts +65 -0
- package/dist/integrations/pipeline-discoveries.js +65 -0
- package/dist/integrations/pipeline-keys.d.ts +13 -0
- package/dist/integrations/pipeline-keys.js +22 -0
- package/dist/integrations/pipeline-runs.d.ts +119 -0
- package/dist/integrations/pipeline-runs.js +87 -0
- package/dist/integrations/pipelines.d.ts +87 -15
- package/dist/integrations/pipelines.js +41 -22
- package/dist/integrations/price-import.d.ts +223 -0
- package/dist/integrations/price-import.js +124 -0
- package/dist/integrations/types.d.ts +367 -3
- package/dist/integrations/types.js +4 -3
- package/dist/locations/index.d.ts +66 -0
- package/dist/locations/index.js +31 -0
- package/dist/meta/index.d.ts +172 -0
- package/dist/metafields/index.d.ts +8 -1
- package/dist/metafields/index.js +10 -0
- package/dist/orders/cancel-with-money.d.ts +237 -0
- package/dist/orders/cancel-with-money.js +155 -0
- package/dist/orders/commit-edit.d.ts +23 -1
- package/dist/orders/commit-edit.js +19 -2
- package/dist/orders/deposit-policy.d.ts +3 -1
- package/dist/orders/drafts.d.ts +800 -0
- package/dist/orders/drafts.js +771 -0
- package/dist/orders/fields.d.ts +245 -0
- package/dist/orders/fields.js +188 -0
- package/dist/orders/get.d.ts +29 -19
- package/dist/orders/get.js +17 -8
- package/dist/orders/index.d.ts +66 -15
- package/dist/orders/index.js +25 -2
- package/dist/orders/lifecycle.d.ts +128 -0
- package/dist/orders/lifecycle.js +158 -0
- package/dist/orders/line-price-preview.d.ts +7 -2
- package/dist/orders/list.d.ts +243 -0
- package/dist/orders/list.js +487 -0
- package/dist/orders/manual-discounts.d.ts +13 -5
- package/dist/orders/manual-pricing.d.ts +5 -0
- package/dist/orders/money-view.d.ts +149 -0
- package/dist/orders/money-view.js +99 -0
- package/dist/orders/order-entry.d.ts +20 -7
- package/dist/orders/plan-edit.d.ts +34 -2
- package/dist/orders/plan-edit.js +112 -11
- package/dist/orders/settings.d.ts +201 -0
- package/dist/orders/settings.js +325 -0
- package/dist/orders/status.d.ts +159 -13
- package/dist/orders/status.js +21 -0
- package/dist/orders/surcharges.d.ts +20 -1
- package/dist/orders/surcharges.js +37 -11
- package/dist/payments/account-credit.d.ts +46 -0
- package/dist/payments/account-credit.js +42 -0
- package/dist/payments/ar.d.ts +292 -0
- package/dist/payments/ar.js +223 -0
- package/dist/payments/connected-account.d.ts +47 -0
- package/dist/payments/connected-account.js +61 -0
- package/dist/payments/credit-noted-fields.d.ts +19 -0
- package/dist/payments/credit-noted-fields.js +69 -0
- package/dist/payments/customer-consent.d.ts +30 -0
- package/dist/payments/customer-consent.js +49 -0
- package/dist/payments/index.d.ts +340 -19
- package/dist/payments/index.js +151 -1
- package/dist/payments/methods.d.ts +303 -8
- package/dist/payments/methods.js +337 -7
- package/dist/payments/mollie-methods.d.ts +159 -0
- package/dist/payments/mollie-methods.js +141 -0
- package/dist/payments/payment-links.d.ts +180 -0
- package/dist/payments/payment-links.js +97 -0
- package/dist/payments/provider-keys.d.ts +150 -0
- package/dist/payments/provider-keys.js +118 -0
- package/dist/payments/providers.d.ts +86 -11
- package/dist/payments/providers.js +29 -0
- package/dist/payments/requests.d.ts +147 -0
- package/dist/payments/requests.js +93 -0
- package/dist/payments/store-credit-fields.d.ts +15 -0
- package/dist/payments/store-credit-fields.js +51 -0
- package/dist/pickups/index.d.ts +106 -0
- package/dist/pickups/index.js +108 -0
- package/dist/platform/channels.d.ts +132 -0
- package/dist/platform/channels.js +128 -0
- package/dist/platform/email-gateways.d.ts +165 -0
- package/dist/platform/email-gateways.js +78 -0
- package/dist/platform/geo.d.ts +123 -0
- package/dist/platform/geo.js +144 -0
- package/dist/platform/tax.d.ts +162 -0
- package/dist/platform/tax.js +169 -0
- package/dist/pos/anomalies.d.ts +158 -0
- package/dist/pos/anomalies.js +64 -0
- package/dist/pos/assisted-selling.d.ts +79 -0
- package/dist/pos/assisted-selling.js +38 -0
- package/dist/pos/exchanges.d.ts +108 -0
- package/dist/pos/exchanges.js +22 -0
- package/dist/pos/gift-cards.d.ts +135 -0
- package/dist/pos/gift-cards.js +47 -0
- package/dist/pos/index.d.ts +2370 -58
- package/dist/pos/index.js +854 -7
- package/dist/pos/no-receipt.d.ts +94 -0
- package/dist/pos/no-receipt.js +25 -0
- package/dist/pos/offline-sales.d.ts +228 -0
- package/dist/pos/offline-sales.js +170 -0
- package/dist/pos/pay-by-link.d.ts +143 -0
- package/dist/pos/pay-by-link.js +57 -0
- package/dist/pos/quick-keys.d.ts +103 -0
- package/dist/pos/quick-keys.js +45 -0
- package/dist/pos/reports.d.ts +360 -0
- package/dist/pos/reports.js +62 -0
- package/dist/pos/returns.d.ts +244 -0
- package/dist/pos/returns.js +83 -0
- package/dist/pricing/bulk-coupons.d.ts +139 -0
- package/dist/pricing/bulk-coupons.js +112 -0
- package/dist/pricing/index.d.ts +174 -4
- package/dist/pricing/index.js +174 -1
- package/dist/pricing/price-lists.d.ts +606 -0
- package/dist/pricing/price-lists.js +600 -0
- package/dist/purchasing/alerts.d.ts +104 -0
- package/dist/purchasing/alerts.js +88 -0
- package/dist/purchasing/backorders.d.ts +61 -0
- package/dist/purchasing/backorders.js +92 -0
- package/dist/purchasing/cost.d.ts +110 -0
- package/dist/purchasing/cost.js +86 -0
- package/dist/purchasing/index.d.ts +54 -0
- package/dist/purchasing/index.js +24 -0
- package/dist/purchasing/links.d.ts +263 -0
- package/dist/purchasing/links.js +192 -0
- package/dist/purchasing/purchase-orders.d.ts +551 -0
- package/dist/purchasing/purchase-orders.js +491 -0
- package/dist/purchasing/receipts.d.ts +396 -0
- package/dist/purchasing/receipts.js +287 -0
- package/dist/purchasing/replenishment.d.ts +281 -0
- package/dist/purchasing/replenishment.js +240 -0
- package/dist/purchasing/returns.d.ts +273 -0
- package/dist/purchasing/returns.js +229 -0
- package/dist/purchasing/settings.d.ts +152 -0
- package/dist/purchasing/settings.js +181 -0
- package/dist/purchasing/suppliers.d.ts +476 -0
- package/dist/purchasing/suppliers.js +438 -0
- package/dist/quotes/index.d.ts +518 -0
- package/dist/quotes/index.js +439 -0
- package/dist/reports/index.d.ts +71 -8
- package/dist/reports/index.js +74 -11
- package/dist/returns/index.d.ts +675 -21
- package/dist/returns/index.js +756 -11
- package/dist/search/index.d.ts +76 -1
- package/dist/search/index.js +63 -0
- package/dist/seo/config.d.ts +128 -0
- package/dist/seo/config.js +95 -0
- package/dist/seo/redirects.d.ts +125 -0
- package/dist/seo/redirects.js +60 -1
- package/dist/seo/settings.d.ts +147 -0
- package/dist/seo/settings.js +209 -0
- package/dist/shipping/definitions.d.ts +29 -0
- package/dist/shipping/definitions.js +47 -0
- package/dist/shipping/fulfillment-profiles.d.ts +174 -0
- package/dist/shipping/fulfillment-profiles.js +104 -0
- package/dist/shipping/hendriks.d.ts +97 -0
- package/dist/shipping/hendriks.js +50 -0
- package/dist/shipping/index.d.ts +54 -0
- package/dist/shipping/index.js +27 -0
- package/dist/shipping/methods.d.ts +205 -0
- package/dist/shipping/methods.js +240 -0
- package/dist/shipping/myparcel.d.ts +668 -0
- package/dist/shipping/myparcel.js +466 -0
- package/dist/shipping/parcel-count-suggestion.d.ts +2 -0
- package/dist/shipping/parcel-rule.d.ts +6 -5
- package/dist/shipping/parcel-rule.js +21 -23
- package/dist/shipping/rate-tables.d.ts +324 -0
- package/dist/shipping/rate-tables.js +390 -0
- package/dist/shipping/ship-to-countries.d.ts +75 -0
- package/dist/shipping/ship-to-countries.js +47 -0
- package/dist/stock/by-location.d.ts +86 -0
- package/dist/stock/by-location.js +94 -0
- package/dist/stock/index.d.ts +18 -4
- package/dist/stock/index.js +7 -0
- package/dist/stock/locations.d.ts +144 -0
- package/dist/stock/locations.js +168 -0
- package/dist/stock/settings.d.ts +106 -0
- package/dist/stock/settings.js +103 -0
- package/dist/stock/transfers.d.ts +386 -52
- package/dist/stock/transfers.js +222 -17
- package/dist/stored-value/index.d.ts +312 -11
- package/dist/stored-value/index.js +223 -4
- package/dist/subscriptions/index.d.ts +682 -0
- package/dist/subscriptions/index.js +815 -0
- package/dist/tax/display-policy.d.ts +105 -0
- package/dist/tax/display-policy.js +84 -0
- package/dist/tax/index.d.ts +79 -1
- package/dist/tax/index.js +52 -0
- package/dist/tenant/email-style.d.ts +102 -0
- package/dist/tenant/email-style.js +72 -0
- package/dist/tenant/email-templates.d.ts +287 -0
- package/dist/tenant/email-templates.js +271 -0
- package/dist/tenant/notifications.d.ts +23 -17
- package/dist/tenant/settings-sources.d.ts +1 -1
- package/dist/tenant/time-zone.d.ts +17 -0
- package/dist/tenant/time-zone.js +11 -0
- package/dist/types.d.ts +50 -3
- package/dist/users/index.d.ts +3 -0
- package/dist/users/index.js +2 -0
- package/dist/users/warehouses.d.ts +50 -0
- package/dist/users/warehouses.js +51 -0
- package/package.json +2 -2
|
@@ -0,0 +1,282 @@
|
|
|
1
|
+
import { type Page, type Transport } from '@sixtyninecommerce/core';
|
|
2
|
+
import type { Call, ListOptions } from '../types.js';
|
|
3
|
+
/**
|
|
4
|
+
* The field types the CMS accepts (`FIELD_TYPES` in `services/cms`), pinned against the CMS's
|
|
5
|
+
* published `openapi.json` by `content-coverage.spec.ts`. A read types `fieldType` as a plain
|
|
6
|
+
* string on purpose: a type the CMS adds later must not turn a read into a type error.
|
|
7
|
+
*/
|
|
8
|
+
export type ContentFieldType = 'string' | 'textarea' | 'text' | 'number' | 'boolean' | 'date' | 'datetime' | 'image' | 'images' | 'file' | 'video' | 'color' | 'link' | 'enum' | 'multi_enum' | 'json' | 'collection_ref' | 'multi_collection_ref' | 'product' | 'product_collection' | 'content_item' | 'form' | 'location' | 'group' | 'filtered_products';
|
|
9
|
+
/**
|
|
10
|
+
* `item` fields are the schema of the type's entries; `page` fields are the content of the
|
|
11
|
+
* type's own index page (`content.pageValues`).
|
|
12
|
+
*/
|
|
13
|
+
export type ContentFieldScope = 'item' | 'page';
|
|
14
|
+
/**
|
|
15
|
+
* One field of a content type, as the CMS stores it.
|
|
16
|
+
*
|
|
17
|
+
* `config` is stored VERBATIM and its keys are the CMS's own snake_case vocabulary
|
|
18
|
+
* (`min_length`, `target_collection_id`, `allowed_link_types`): this SDK never case-converts it,
|
|
19
|
+
* in either direction, so a fetched `config` can be written back unchanged.
|
|
20
|
+
*/
|
|
21
|
+
export interface ContentField {
|
|
22
|
+
id: string;
|
|
23
|
+
collectionId: string;
|
|
24
|
+
name: string;
|
|
25
|
+
/** Unique per type and scope (per group for a sub-field); the key of an entry's value. */
|
|
26
|
+
slug: string;
|
|
27
|
+
/** One of {@link ContentFieldType}, typed open so a newer CMS's type still reads. */
|
|
28
|
+
fieldType: string;
|
|
29
|
+
isRequired: boolean;
|
|
30
|
+
isLocalizable: boolean;
|
|
31
|
+
/** Order among the type's top-level fields. A sub-field orders by `groupPosition`. */
|
|
32
|
+
position: number;
|
|
33
|
+
config: Record<string, unknown> | null;
|
|
34
|
+
helpText: string | null;
|
|
35
|
+
scope: ContentFieldScope;
|
|
36
|
+
/** The `group` field this is a sub-field of, or null for a top-level field. */
|
|
37
|
+
groupId: string | null;
|
|
38
|
+
groupPosition: number;
|
|
39
|
+
/** A `group` field's own fields, ordered by `groupPosition`. Present on `types.get` only. */
|
|
40
|
+
subFields?: ContentField[];
|
|
41
|
+
createdAt: string;
|
|
42
|
+
updatedAt: string;
|
|
43
|
+
[extra: string]: unknown;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* A content type: what the CMS calls a collection (blog posts, FAQs, a team page), with the
|
|
47
|
+
* fields its entries and its index page are made of.
|
|
48
|
+
*/
|
|
49
|
+
export interface ContentType {
|
|
50
|
+
id: string;
|
|
51
|
+
channelId: string;
|
|
52
|
+
name: string;
|
|
53
|
+
/** Unique within the store. Lowercase letters, digits and hyphens. */
|
|
54
|
+
slug: string;
|
|
55
|
+
description: string | null;
|
|
56
|
+
/** A singleton type holds exactly one entry (a settings page, a home page). */
|
|
57
|
+
isSingleton: boolean;
|
|
58
|
+
/**
|
|
59
|
+
* Where the type's entries live on the storefront: null for no URLs, `''` for the root,
|
|
60
|
+
* `/blog` for a prefix. Moving it re-paths every entry.
|
|
61
|
+
*/
|
|
62
|
+
basePath: string | null;
|
|
63
|
+
isHierarchical: boolean;
|
|
64
|
+
/** The field whose value titles an entry; set only once the field exists. */
|
|
65
|
+
titleFieldSlug: string | null;
|
|
66
|
+
/**
|
|
67
|
+
* The type's top-level fields of both scopes, ordered by `position`, each `group` field with
|
|
68
|
+
* its `subFields`. Only `types.get` answers them: a list item and a `create` answer carry
|
|
69
|
+
* none, and an `update` answer carries them only when it moved `basePath`.
|
|
70
|
+
*/
|
|
71
|
+
fields?: ContentField[];
|
|
72
|
+
createdAt: string;
|
|
73
|
+
updatedAt: string;
|
|
74
|
+
[extra: string]: unknown;
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Exactly what `CreateCollectionDto` whitelists, less `titleFieldSlug`: the CMS refuses a title
|
|
78
|
+
* field on a type that has no fields yet, so it is set with `types.update` once they exist.
|
|
79
|
+
*/
|
|
80
|
+
export interface CreateContentTypeInput {
|
|
81
|
+
name: string;
|
|
82
|
+
slug: string;
|
|
83
|
+
description?: string;
|
|
84
|
+
isSingleton?: boolean;
|
|
85
|
+
basePath?: string | null;
|
|
86
|
+
isHierarchical?: boolean;
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* What `UpdateCollectionDto` whitelists. An absent key leaves the stored value alone; `null`
|
|
90
|
+
* clears `description`, `basePath` and `titleFieldSlug`.
|
|
91
|
+
*/
|
|
92
|
+
export interface UpdateContentTypeInput {
|
|
93
|
+
name?: string;
|
|
94
|
+
slug?: string;
|
|
95
|
+
description?: string | null;
|
|
96
|
+
isSingleton?: boolean;
|
|
97
|
+
basePath?: string | null;
|
|
98
|
+
isHierarchical?: boolean;
|
|
99
|
+
titleFieldSlug?: string | null;
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* Exactly what `CreateFieldDto` whitelists — not `Partial<ContentField>`: the CMS runs
|
|
103
|
+
* `forbidNonWhitelisted`, so handing a fetched field back (with its `id` and timestamps) is a
|
|
104
|
+
* 400 that fails the whole write.
|
|
105
|
+
*/
|
|
106
|
+
export interface CreateContentFieldInput {
|
|
107
|
+
name: string;
|
|
108
|
+
/** Lowercase letters, digits and underscores. */
|
|
109
|
+
slug: string;
|
|
110
|
+
fieldType: ContentFieldType;
|
|
111
|
+
isRequired?: boolean;
|
|
112
|
+
isLocalizable?: boolean;
|
|
113
|
+
/** Defaults to after the last field of its scope (of its group, for a sub-field). */
|
|
114
|
+
position?: number;
|
|
115
|
+
/** Stored verbatim; keys are the CMS's snake_case vocabulary. */
|
|
116
|
+
config?: Record<string, unknown>;
|
|
117
|
+
helpText?: string;
|
|
118
|
+
scope?: ContentFieldScope;
|
|
119
|
+
/** Makes this a sub-field of that `group` field. */
|
|
120
|
+
groupId?: string;
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* The members `fields.update` acts on. An absent key leaves the stored value alone; `null`
|
|
124
|
+
* clears `helpText` and `config`. A field's `scope` and `groupId` cannot move.
|
|
125
|
+
*/
|
|
126
|
+
export interface UpdateContentFieldInput {
|
|
127
|
+
name?: string;
|
|
128
|
+
slug?: string;
|
|
129
|
+
fieldType?: ContentFieldType;
|
|
130
|
+
isRequired?: boolean;
|
|
131
|
+
isLocalizable?: boolean;
|
|
132
|
+
/** For a sub-field, its position within the group. */
|
|
133
|
+
position?: number;
|
|
134
|
+
config?: Record<string, unknown> | null;
|
|
135
|
+
helpText?: string | null;
|
|
136
|
+
}
|
|
137
|
+
/** A type's index page: its `page` fields and their values. */
|
|
138
|
+
export interface ContentPageValues {
|
|
139
|
+
/** The type's top-level `page` fields, ordered by `position`. */
|
|
140
|
+
fields: ContentField[];
|
|
141
|
+
/** Field slug → value, stored verbatim (the slugs are the merchant's own keys). */
|
|
142
|
+
values: Record<string, unknown>;
|
|
143
|
+
[extra: string]: unknown;
|
|
144
|
+
}
|
|
145
|
+
export interface GetContentPageValuesOptions extends Call {
|
|
146
|
+
/**
|
|
147
|
+
* The language to read: each field's value in that language, else its base value. Without
|
|
148
|
+
* one, the base values only — the client's tenant `language` is NOT applied here, so a read
|
|
149
|
+
* and the `set` that writes it back always name the same rows.
|
|
150
|
+
*/
|
|
151
|
+
languageCode?: string;
|
|
152
|
+
}
|
|
153
|
+
export interface SetContentPageValuesInput {
|
|
154
|
+
/**
|
|
155
|
+
* Field slug → value for the slugs to write; a slug left out keeps its value. Every slug must
|
|
156
|
+
* be one of the type's `page` fields, or nothing is written.
|
|
157
|
+
*/
|
|
158
|
+
values: Record<string, unknown>;
|
|
159
|
+
/** Writes the values for that language; without one, the base values. */
|
|
160
|
+
languageCode?: string;
|
|
161
|
+
}
|
|
162
|
+
/**
|
|
163
|
+
* Content types (CMS collections), read and written through the CMS.
|
|
164
|
+
*
|
|
165
|
+
* Reads need no permission: a type's schema is public, and storefronts read the same routes.
|
|
166
|
+
* Writes need the permission each method names (`@permission`).
|
|
167
|
+
*
|
|
168
|
+
* Refusals are the CMS's problem+json, mapped by status:
|
|
169
|
+
* - `NotFoundError` (404, `NOT_FOUND`): no such type in this store.
|
|
170
|
+
* - `ConflictError` (409, `CONFLICT`): the slug is taken in this store.
|
|
171
|
+
* - `ValidationError` (400): `VALIDATION_FAILED` with one `details[]` entry per refused input
|
|
172
|
+
* member; `VALIDATION_ERROR` for a value the CMS refuses on its own (a malformed `basePath`,
|
|
173
|
+
* a `titleFieldSlug` naming no field, an id that is not a UUID).
|
|
174
|
+
* - `PermissionDeniedError` (403): the credential lacks the write's permission.
|
|
175
|
+
*
|
|
176
|
+
* No write here is deduplicated: an `idempotencyKey` is sent and acts on nothing, so a repeated
|
|
177
|
+
* `create` is a second write (refused `CONFLICT` on the same slug).
|
|
178
|
+
*/
|
|
179
|
+
export interface ContentTypesModule {
|
|
180
|
+
/**
|
|
181
|
+
* Every content type of the store, newest first, a page at a time. A list item carries no
|
|
182
|
+
* `fields`; read one with `get`.
|
|
183
|
+
*
|
|
184
|
+
* @effect read
|
|
185
|
+
*/
|
|
186
|
+
list(options?: ListOptions): Promise<Page<ContentType>>;
|
|
187
|
+
/**
|
|
188
|
+
* One content type with its fields.
|
|
189
|
+
*
|
|
190
|
+
* @effect read
|
|
191
|
+
*/
|
|
192
|
+
get(id: string, options?: Call): Promise<ContentType>;
|
|
193
|
+
/**
|
|
194
|
+
* @effect write
|
|
195
|
+
* @permission CreateCmsContent
|
|
196
|
+
*/
|
|
197
|
+
create(input: CreateContentTypeInput, options?: Call): Promise<ContentType>;
|
|
198
|
+
/**
|
|
199
|
+
* Changing `basePath` re-paths every entry of the type on the storefront.
|
|
200
|
+
*
|
|
201
|
+
* @effect write
|
|
202
|
+
* @permission UpdateCmsContent
|
|
203
|
+
*/
|
|
204
|
+
update(id: string, input: UpdateContentTypeInput, options?: Call): Promise<ContentType>;
|
|
205
|
+
/**
|
|
206
|
+
* Removes the type from the store: its entries and its index page stop being served, and
|
|
207
|
+
* nothing in the SDK brings it back.
|
|
208
|
+
*
|
|
209
|
+
* @effect destructive
|
|
210
|
+
* @permission DeleteCmsContent
|
|
211
|
+
*/
|
|
212
|
+
delete(id: string, options?: Call): Promise<void>;
|
|
213
|
+
}
|
|
214
|
+
/**
|
|
215
|
+
* The fields of a content type. Every method takes the type's id first; a field of another
|
|
216
|
+
* type, or of another store's type, is `NotFoundError` (404). Refusals as on
|
|
217
|
+
* {@link ContentTypesModule}; a slug taken within the type's scope (or the group) is
|
|
218
|
+
* `ConflictError` (409).
|
|
219
|
+
*/
|
|
220
|
+
export interface ContentFieldsModule {
|
|
221
|
+
/**
|
|
222
|
+
* Adds a field; with `groupId`, a sub-field of that `group` field (only the types a group
|
|
223
|
+
* allows: a disallowed one is `ValidationError`).
|
|
224
|
+
*
|
|
225
|
+
* @effect write
|
|
226
|
+
* @permission CreateCmsContent
|
|
227
|
+
*/
|
|
228
|
+
create(typeId: string, input: CreateContentFieldInput, options?: Call): Promise<ContentField>;
|
|
229
|
+
/**
|
|
230
|
+
* @effect write
|
|
231
|
+
* @permission UpdateCmsContent
|
|
232
|
+
*/
|
|
233
|
+
update(typeId: string, fieldId: string, input: UpdateContentFieldInput, options?: Call): Promise<ContentField>;
|
|
234
|
+
/**
|
|
235
|
+
* Removes the field from the type. Entries keep no reachable value for it, and nothing in the
|
|
236
|
+
* SDK brings it back.
|
|
237
|
+
*
|
|
238
|
+
* @effect destructive
|
|
239
|
+
* @permission DeleteCmsContent
|
|
240
|
+
*/
|
|
241
|
+
delete(typeId: string, fieldId: string, options?: Call): Promise<void>;
|
|
242
|
+
/**
|
|
243
|
+
* Gives each listed field the position of its index in `fieldIds`. Pass every top-level field
|
|
244
|
+
* of the scope, in the order wanted: an unlisted field keeps its old position, and an id that
|
|
245
|
+
* is not one of the type's fields is skipped without a refusal.
|
|
246
|
+
*
|
|
247
|
+
* @effect write
|
|
248
|
+
* @permission UpdateCmsContent
|
|
249
|
+
*/
|
|
250
|
+
reorder(typeId: string, fieldIds: string[], options?: Call): Promise<void>;
|
|
251
|
+
/**
|
|
252
|
+
* Gives each listed sub-field of the `group` field the position of its index in `fieldIds`.
|
|
253
|
+
* Pass every sub-field, in the order wanted; an id outside the group is skipped.
|
|
254
|
+
*
|
|
255
|
+
* @effect write
|
|
256
|
+
* @permission UpdateCmsContent
|
|
257
|
+
*/
|
|
258
|
+
reorderSubFields(typeId: string, groupFieldId: string, fieldIds: string[], options?: Call): Promise<void>;
|
|
259
|
+
}
|
|
260
|
+
/**
|
|
261
|
+
* The content of a type's own index page (its `page` fields): the blog's intro above the list
|
|
262
|
+
* of posts. Refusals as on {@link ContentTypesModule}.
|
|
263
|
+
*/
|
|
264
|
+
export interface ContentPageValuesModule {
|
|
265
|
+
/** @effect read */
|
|
266
|
+
get(typeId: string, options?: GetContentPageValuesOptions): Promise<ContentPageValues>;
|
|
267
|
+
/**
|
|
268
|
+
* Writes the given slugs' values in one transaction, and answers the language's values as
|
|
269
|
+
* stored afterwards. A slug that is not a `page` field is `ValidationError` and writes
|
|
270
|
+
* nothing.
|
|
271
|
+
*
|
|
272
|
+
* @effect write
|
|
273
|
+
* @permission UpdateCmsContent
|
|
274
|
+
*/
|
|
275
|
+
set(typeId: string, input: SetContentPageValuesInput, options?: Call): Promise<{
|
|
276
|
+
values: Record<string, unknown>;
|
|
277
|
+
[extra: string]: unknown;
|
|
278
|
+
}>;
|
|
279
|
+
}
|
|
280
|
+
export declare function createContentTypesModule(transport: Transport): ContentTypesModule;
|
|
281
|
+
export declare function createContentFieldsModule(transport: Transport): ContentFieldsModule;
|
|
282
|
+
export declare function createContentPageValuesModule(transport: Transport): ContentPageValuesModule;
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import { createPage, PLATFORM_PASSTHROUGH_KEYS, readRestPage, } from '@sixtyninecommerce/core';
|
|
2
|
+
const COLLECTIONS = '/collections';
|
|
3
|
+
/**
|
|
4
|
+
* `GET /collections` returns the WHOLE list unless `after` is sent; an empty `after` starts
|
|
5
|
+
* the cursor sequence, which then pages by `limit` (CMS default 50, at most 200).
|
|
6
|
+
*/
|
|
7
|
+
const FIRST_PAGE = '';
|
|
8
|
+
/**
|
|
9
|
+
* `config` (a field's settings) is in the platform set. Page values add `values`, a bag keyed by
|
|
10
|
+
* the merchant's field slugs: `hero_title` must not come back as `heroTitle`. `values` is not
|
|
11
|
+
* in the platform set because content strings use the same name for a DTO array.
|
|
12
|
+
*/
|
|
13
|
+
const PAGE_VALUES_PASSTHROUGH = new Set([
|
|
14
|
+
...PLATFORM_PASSTHROUGH_KEYS,
|
|
15
|
+
'values',
|
|
16
|
+
]);
|
|
17
|
+
function typePath(id) {
|
|
18
|
+
return `${COLLECTIONS}/${encodeURIComponent(id)}`;
|
|
19
|
+
}
|
|
20
|
+
function fieldsPath(typeId) {
|
|
21
|
+
return `${typePath(typeId)}/fields`;
|
|
22
|
+
}
|
|
23
|
+
function fieldPath(typeId, fieldId) {
|
|
24
|
+
return `${fieldsPath(typeId)}/${encodeURIComponent(fieldId)}`;
|
|
25
|
+
}
|
|
26
|
+
export function createContentTypesModule(transport) {
|
|
27
|
+
async function list(options) {
|
|
28
|
+
const body = await transport.rest('cms', {
|
|
29
|
+
method: 'GET',
|
|
30
|
+
path: COLLECTIONS,
|
|
31
|
+
query: { after: options?.after ?? FIRST_PAGE, limit: options?.limit },
|
|
32
|
+
}, { ...options, preserveKeys: PLATFORM_PASSTHROUGH_KEYS });
|
|
33
|
+
const { items, meta } = readRestPage(body);
|
|
34
|
+
return createPage(items, meta, (cursor) => list({ ...options, after: cursor }));
|
|
35
|
+
}
|
|
36
|
+
return {
|
|
37
|
+
list,
|
|
38
|
+
async get(id, options) {
|
|
39
|
+
const body = await transport.rest('cms', { method: 'GET', path: typePath(id) }, { ...options, preserveKeys: PLATFORM_PASSTHROUGH_KEYS });
|
|
40
|
+
return body.data;
|
|
41
|
+
},
|
|
42
|
+
async create(input, options) {
|
|
43
|
+
const body = await transport.rest('cms', { method: 'POST', path: COLLECTIONS, body: input }, { ...options, preserveKeys: PLATFORM_PASSTHROUGH_KEYS });
|
|
44
|
+
return body.data;
|
|
45
|
+
},
|
|
46
|
+
async update(id, input, options) {
|
|
47
|
+
const body = await transport.rest('cms', { method: 'PATCH', path: typePath(id), body: input }, { ...options, preserveKeys: PLATFORM_PASSTHROUGH_KEYS });
|
|
48
|
+
return body.data;
|
|
49
|
+
},
|
|
50
|
+
async delete(id, options) {
|
|
51
|
+
await transport.rest('cms', { method: 'DELETE', path: typePath(id), expect: 'void' }, options);
|
|
52
|
+
},
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
export function createContentFieldsModule(transport) {
|
|
56
|
+
return {
|
|
57
|
+
async create(typeId, input, options) {
|
|
58
|
+
const body = await transport.rest('cms', { method: 'POST', path: fieldsPath(typeId), body: input }, { ...options, preserveKeys: PLATFORM_PASSTHROUGH_KEYS });
|
|
59
|
+
return body.data;
|
|
60
|
+
},
|
|
61
|
+
async update(typeId, fieldId, input, options) {
|
|
62
|
+
const body = await transport.rest('cms', { method: 'PATCH', path: fieldPath(typeId, fieldId), body: input }, { ...options, preserveKeys: PLATFORM_PASSTHROUGH_KEYS });
|
|
63
|
+
return body.data;
|
|
64
|
+
},
|
|
65
|
+
async delete(typeId, fieldId, options) {
|
|
66
|
+
await transport.rest('cms', { method: 'DELETE', path: fieldPath(typeId, fieldId), expect: 'void' }, options);
|
|
67
|
+
},
|
|
68
|
+
async reorder(typeId, fieldIds, options) {
|
|
69
|
+
// The literal `reorder` segment: the CMS declares it before `:fieldId`, so it is never
|
|
70
|
+
// read as a field id.
|
|
71
|
+
await transport.rest('cms', { method: 'PATCH', path: `${fieldsPath(typeId)}/reorder`, body: { fieldIds } }, options);
|
|
72
|
+
},
|
|
73
|
+
async reorderSubFields(typeId, groupFieldId, fieldIds, options) {
|
|
74
|
+
await transport.rest('cms', {
|
|
75
|
+
method: 'PATCH',
|
|
76
|
+
path: `${fieldPath(typeId, groupFieldId)}/reorder-sub-fields`,
|
|
77
|
+
body: { fieldIds },
|
|
78
|
+
}, options);
|
|
79
|
+
},
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
export function createContentPageValuesModule(transport) {
|
|
83
|
+
return {
|
|
84
|
+
async get(typeId, options) {
|
|
85
|
+
const body = await transport.rest('cms', {
|
|
86
|
+
method: 'GET',
|
|
87
|
+
path: `${typePath(typeId)}/page-values`,
|
|
88
|
+
// Always sent, empty for the base values: the transport adds the tenant's `language`
|
|
89
|
+
// to any read that names none, and `set` (a write) never gets it, so a value read on
|
|
90
|
+
// an `nl` client and written back unchanged would land in the base rows.
|
|
91
|
+
query: { language_code: options?.languageCode ?? '' },
|
|
92
|
+
}, { ...options, preserveKeys: PAGE_VALUES_PASSTHROUGH });
|
|
93
|
+
return body.data;
|
|
94
|
+
},
|
|
95
|
+
async set(typeId, input, options) {
|
|
96
|
+
const body = await transport.rest('cms', { method: 'PATCH', path: `${typePath(typeId)}/page-values`, body: input }, { ...options, preserveKeys: PAGE_VALUES_PASSTHROUGH });
|
|
97
|
+
return body.data;
|
|
98
|
+
},
|
|
99
|
+
};
|
|
100
|
+
}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A customer's date of birth and the age check on it (headless spec §9.2 `customers`; W10-33).
|
|
3
|
+
* A date of birth is a calendar DATE, sent and answered as `YYYY-MM-DD` with no time and no
|
|
4
|
+
* zone, so it reads the same wherever it is shown.
|
|
5
|
+
*/
|
|
6
|
+
import { type Transport } from '@sixtyninecommerce/core';
|
|
7
|
+
import type { Call } from '../types.js';
|
|
8
|
+
/** The age check of one customer, as the engine judges it today. */
|
|
9
|
+
export interface CustomerAgeVerification {
|
|
10
|
+
/** Whether the store checks age at all (it has a minimum age). */
|
|
11
|
+
required: boolean;
|
|
12
|
+
/**
|
|
13
|
+
* The minimum age the store enforces, its organization's when the organization shares the age
|
|
14
|
+
* gate; null without one.
|
|
15
|
+
*/
|
|
16
|
+
minimumAge: number | null;
|
|
17
|
+
/**
|
|
18
|
+
* With a minimum age: the customer has a date of birth that meets it. Without one: true.
|
|
19
|
+
*/
|
|
20
|
+
verified: boolean;
|
|
21
|
+
/**
|
|
22
|
+
* `YYYY-MM-DD`, or null. It is the UTC date of the instant the engine stores, which is the
|
|
23
|
+
* date {@link CustomerDateOfBirthModule.set} was given.
|
|
24
|
+
*/
|
|
25
|
+
dateOfBirth: string | null;
|
|
26
|
+
/**
|
|
27
|
+
* The customer's age in whole years today, as the engine counts it (the rule `verified` is
|
|
28
|
+
* judged by); null without a date of birth. "Today" is the STORE's calendar day, in its time
|
|
29
|
+
* zone (`admin.tenant.timeZone()`): the age and the verdict turn at the store's local
|
|
30
|
+
* midnight, never at midnight UTC or the reader's. A 29 February birthday counts from 1 March
|
|
31
|
+
* in a year without one.
|
|
32
|
+
*/
|
|
33
|
+
age: number | null;
|
|
34
|
+
/**
|
|
35
|
+
* Set when the caller's customer-data level withheld the date of birth and the age (an app
|
|
36
|
+
* installation below `full`): null then means "not granted".
|
|
37
|
+
*/
|
|
38
|
+
redacted?: true;
|
|
39
|
+
}
|
|
40
|
+
export interface CustomerDateOfBirthModule {
|
|
41
|
+
/**
|
|
42
|
+
* Record a customer's date of birth (`YYYY-MM-DD`), or clear it with `null`. Needs
|
|
43
|
+
* `UpdateCustomer`. Answers the age check as it stands afterwards.
|
|
44
|
+
*
|
|
45
|
+
* Refused before anything is sent: `INVALID_DATE_OF_BIRTH` (`ValidationError`, 400) for a
|
|
46
|
+
* value that is not a real calendar date written `YYYY-MM-DD`. Refused by the engine with its
|
|
47
|
+
* sentence (`ValidationError`, `USER_INPUT_ERROR`, 400): a date in the future, or before
|
|
48
|
+
* 1900. A customer this store does not hold is a `NotFoundError` (`ENTITY_NOT_FOUND`).
|
|
49
|
+
* Requires a platform release that answers the age: an older engine refuses the call as a
|
|
50
|
+
* whole (a `ValidationError`, 400), with nothing written.
|
|
51
|
+
*
|
|
52
|
+
* @effect write
|
|
53
|
+
*/
|
|
54
|
+
set(customerId: string, dateOfBirth: string | null, options?: Call): Promise<CustomerAgeVerification>;
|
|
55
|
+
}
|
|
56
|
+
export declare const AGE_VERIFICATION_QUERY = "\n query CustomerAgeVerification($customerId: ID!) {\n customerAgeVerification(customerId: $customerId) {\n \n required\n minimumAge\n verified\n dateOfBirth\n age\n\n }\n }\n";
|
|
57
|
+
export declare const SET_DATE_OF_BIRTH_MUTATION = "\n mutation SetCustomerDateOfBirth($customerId: ID!, $dateOfBirth: DateTime) {\n setCustomerDateOfBirth(customerId: $customerId, dateOfBirth: $dateOfBirth) {\n \n required\n minimumAge\n verified\n dateOfBirth\n age\n\n }\n }\n";
|
|
58
|
+
/**
|
|
59
|
+
* The instant the engine stores for a calendar date: its UTC midnight. A value that is not a
|
|
60
|
+
* real date written `YYYY-MM-DD` is refused (`2026-02-30` is no date).
|
|
61
|
+
*/
|
|
62
|
+
export declare function dateOfBirthInstant(date: string): string;
|
|
63
|
+
/** The calendar date of a stored instant: its UTC date. Null for no value or an unreadable one. */
|
|
64
|
+
export declare function dateOfBirthDate(instant: string | null | undefined): string | null;
|
|
65
|
+
export declare function readCustomerAgeVerification(transport: Transport, customerId: string, options?: Call): Promise<CustomerAgeVerification | null>;
|
|
66
|
+
export declare function createCustomerDateOfBirthModule(transport: Transport): CustomerDateOfBirthModule;
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A customer's date of birth and the age check on it (headless spec §9.2 `customers`; W10-33).
|
|
3
|
+
* A date of birth is a calendar DATE, sent and answered as `YYYY-MM-DD` with no time and no
|
|
4
|
+
* zone, so it reads the same wherever it is shown.
|
|
5
|
+
*/
|
|
6
|
+
import { ValidationError } from '@sixtyninecommerce/core';
|
|
7
|
+
import { customerDataField } from './wire.js';
|
|
8
|
+
const AGE_VERIFICATION_FIELDS = /* GraphQL */ `
|
|
9
|
+
required
|
|
10
|
+
minimumAge
|
|
11
|
+
verified
|
|
12
|
+
dateOfBirth
|
|
13
|
+
age
|
|
14
|
+
`;
|
|
15
|
+
export const AGE_VERIFICATION_QUERY = /* GraphQL */ `
|
|
16
|
+
query CustomerAgeVerification($customerId: ID!) {
|
|
17
|
+
customerAgeVerification(customerId: $customerId) {
|
|
18
|
+
${AGE_VERIFICATION_FIELDS}
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
`;
|
|
22
|
+
export const SET_DATE_OF_BIRTH_MUTATION = /* GraphQL */ `
|
|
23
|
+
mutation SetCustomerDateOfBirth($customerId: ID!, $dateOfBirth: DateTime) {
|
|
24
|
+
setCustomerDateOfBirth(customerId: $customerId, dateOfBirth: $dateOfBirth) {
|
|
25
|
+
${AGE_VERIFICATION_FIELDS}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
`;
|
|
29
|
+
const DATE_ONLY = /^(\d{4})-(\d{2})-(\d{2})$/;
|
|
30
|
+
/**
|
|
31
|
+
* The instant the engine stores for a calendar date: its UTC midnight. A value that is not a
|
|
32
|
+
* real date written `YYYY-MM-DD` is refused (`2026-02-30` is no date).
|
|
33
|
+
*/
|
|
34
|
+
export function dateOfBirthInstant(date) {
|
|
35
|
+
const match = typeof date === 'string' ? DATE_ONLY.exec(date) : null;
|
|
36
|
+
const instant = match ? new Date(`${date}T00:00:00.000Z`) : null;
|
|
37
|
+
if (instant === null ||
|
|
38
|
+
Number.isNaN(instant.getTime()) ||
|
|
39
|
+
instant.toISOString().slice(0, 10) !== date) {
|
|
40
|
+
throw new ValidationError({
|
|
41
|
+
code: 'INVALID_DATE_OF_BIRTH',
|
|
42
|
+
message: `A date of birth is a calendar date written YYYY-MM-DD; got ${JSON.stringify(date)}.`,
|
|
43
|
+
status: 400,
|
|
44
|
+
service: 'vendure',
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
return instant.toISOString();
|
|
48
|
+
}
|
|
49
|
+
/** The calendar date of a stored instant: its UTC date. Null for no value or an unreadable one. */
|
|
50
|
+
export function dateOfBirthDate(instant) {
|
|
51
|
+
if (typeof instant !== 'string' || instant === '')
|
|
52
|
+
return null;
|
|
53
|
+
const parsed = new Date(instant);
|
|
54
|
+
return Number.isNaN(parsed.getTime()) ? null : parsed.toISOString().slice(0, 10);
|
|
55
|
+
}
|
|
56
|
+
function ageVerificationOf(wire) {
|
|
57
|
+
return {
|
|
58
|
+
required: wire.required,
|
|
59
|
+
minimumAge: wire.minimumAge ?? null,
|
|
60
|
+
verified: wire.verified,
|
|
61
|
+
dateOfBirth: dateOfBirthDate(wire.dateOfBirth),
|
|
62
|
+
age: wire.age ?? null,
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
export async function readCustomerAgeVerification(transport, customerId, options) {
|
|
66
|
+
const { value, mark } = await customerDataField(transport, AGE_VERIFICATION_QUERY, 'customerAgeVerification', { customerId }, options);
|
|
67
|
+
return value === null ? null : mark(ageVerificationOf(value));
|
|
68
|
+
}
|
|
69
|
+
export function createCustomerDateOfBirthModule(transport) {
|
|
70
|
+
return {
|
|
71
|
+
async set(customerId, dateOfBirth, options) {
|
|
72
|
+
const { value, mark } = await customerDataField(transport, SET_DATE_OF_BIRTH_MUTATION, 'setCustomerDateOfBirth', {
|
|
73
|
+
customerId,
|
|
74
|
+
dateOfBirth: dateOfBirth === null ? null : dateOfBirthInstant(dateOfBirth),
|
|
75
|
+
}, options);
|
|
76
|
+
return mark(ageVerificationOf(value));
|
|
77
|
+
},
|
|
78
|
+
};
|
|
79
|
+
}
|