@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
|
@@ -33,6 +33,11 @@ export interface Property {
|
|
|
33
33
|
position: number;
|
|
34
34
|
config: PropertyConfig | null;
|
|
35
35
|
facetId: string | null;
|
|
36
|
+
/**
|
|
37
|
+
* A filterable `content_item` property's field-level facets, one per content field it filters
|
|
38
|
+
* by, as `configureFieldFacets` last wrote them; null when it has none.
|
|
39
|
+
*/
|
|
40
|
+
fieldFacets: PropertyFieldFacet[] | null;
|
|
36
41
|
translations: Array<{
|
|
37
42
|
id: string;
|
|
38
43
|
languageCode: LanguageCode;
|
|
@@ -40,6 +45,25 @@ export interface Property {
|
|
|
40
45
|
helpText: string | null;
|
|
41
46
|
}>;
|
|
42
47
|
}
|
|
48
|
+
/** One field-level facet of a `content_item` property: the facet a content field's values fill. */
|
|
49
|
+
export interface PropertyFieldFacet {
|
|
50
|
+
fieldSlug: string;
|
|
51
|
+
/** The content field's type (`enum`, `multi_enum`, `boolean`). */
|
|
52
|
+
fieldType: string;
|
|
53
|
+
facetId: string;
|
|
54
|
+
}
|
|
55
|
+
/** A content field a `content_item` property filters by (`configureFieldFacets`). */
|
|
56
|
+
export interface FieldFacetDefinition {
|
|
57
|
+
/** The content type's field slug. */
|
|
58
|
+
fieldSlug: string;
|
|
59
|
+
/** The content field's type (`enum`, `multi_enum`, `boolean`). */
|
|
60
|
+
fieldType: string;
|
|
61
|
+
/** For an `enum` / `multi_enum` field: its options, each becoming one facet value. */
|
|
62
|
+
options?: Array<{
|
|
63
|
+
value: string;
|
|
64
|
+
label: string;
|
|
65
|
+
}>;
|
|
66
|
+
}
|
|
43
67
|
export interface PropertyGroup {
|
|
44
68
|
id: string;
|
|
45
69
|
createdAt: string;
|
|
@@ -186,49 +210,151 @@ export interface ContentFacetSyncResult {
|
|
|
186
210
|
*/
|
|
187
211
|
export interface PropertiesModule {
|
|
188
212
|
groups: {
|
|
189
|
-
/**
|
|
213
|
+
/**
|
|
214
|
+
* The store's own groups, the complete list as one terminal page (the query takes no paging).
|
|
215
|
+
*
|
|
216
|
+
* @effect read
|
|
217
|
+
*/
|
|
190
218
|
list(options?: Call): Promise<Page<PropertyGroup>>;
|
|
219
|
+
/**
|
|
220
|
+
* One of the store's own groups, or null.
|
|
221
|
+
*
|
|
222
|
+
* @effect read
|
|
223
|
+
*/
|
|
191
224
|
get(id: string, options?: Call): Promise<PropertyGroup | null>;
|
|
225
|
+
/** @effect write */
|
|
192
226
|
create(input: CreatePropertyGroupInput, options?: Call): Promise<PropertyGroup>;
|
|
227
|
+
/** @effect write */
|
|
193
228
|
update(input: UpdatePropertyGroupInput, options?: Call): Promise<PropertyGroup>;
|
|
194
|
-
/**
|
|
229
|
+
/**
|
|
230
|
+
* Deletes the group AND every property in it, with their values on every product and the
|
|
231
|
+
* filter values (facets) the filterable ones mirror. Not undoable.
|
|
232
|
+
*
|
|
233
|
+
* @effect destructive
|
|
234
|
+
*/
|
|
195
235
|
delete(id: string, options?: Call): Promise<void>;
|
|
196
236
|
/**
|
|
197
237
|
* Pass EVERY group id of the store, in the order wanted. Only the store's own groups:
|
|
198
238
|
* a workspace group (`editableHere` false) or another store's id refuses the whole call.
|
|
239
|
+
*
|
|
240
|
+
* @effect write
|
|
199
241
|
*/
|
|
200
242
|
reorder(ids: string[], options?: Call): Promise<PropertyGroup[]>;
|
|
201
243
|
};
|
|
244
|
+
/** @effect write */
|
|
202
245
|
create(input: CreatePropertyInput, options?: Call): Promise<Property>;
|
|
246
|
+
/** @effect write */
|
|
203
247
|
update(input: UpdatePropertyInput, options?: Call): Promise<Property>;
|
|
248
|
+
/**
|
|
249
|
+
* Deletes the property with its values on every product, and the filter values (facets) a
|
|
250
|
+
* filterable one mirrors. Not undoable.
|
|
251
|
+
*
|
|
252
|
+
* @effect destructive
|
|
253
|
+
*/
|
|
204
254
|
delete(id: string, options?: Call): Promise<void>;
|
|
205
|
-
/**
|
|
255
|
+
/**
|
|
256
|
+
* Pass every property id of the group, in the order wanted.
|
|
257
|
+
*
|
|
258
|
+
* @effect write
|
|
259
|
+
*/
|
|
206
260
|
reorder(groupId: string, propertyIds: string[], options?: Call): Promise<Property[]>;
|
|
261
|
+
/**
|
|
262
|
+
* Sets which content fields a filterable `content_item` property filters by: one field-level
|
|
263
|
+
* facet per field named, its values the field's options (an `enum` / `multi_enum` field) or
|
|
264
|
+
* yes/no (a `boolean` one). Needs `UpdateCatalog`.
|
|
265
|
+
*
|
|
266
|
+
* `fields` is the WHOLE set: a field already configured keeps its facet (its values follow the
|
|
267
|
+
* options sent), a new one gets a facet, and a field left out loses its facet, which is removed
|
|
268
|
+
* from every product of the store. `[]` removes them all. Send the fields the property was
|
|
269
|
+
* SAVED with (`config.filterableFieldSlugs`), never an unsaved form's. The products' field
|
|
270
|
+
* values are filled by `catalog.syncContentFacets`, not here. It resolves with nothing (the
|
|
271
|
+
* engine answers only that it is done): the property's `fieldFacets`, read again through
|
|
272
|
+
* `groups.get`, holds what was written.
|
|
273
|
+
*
|
|
274
|
+
* Refusals (nothing is written):
|
|
275
|
+
* - `PROPERTY_NOT_FOUND` → `NotFoundError` (404): no such property among the store's own groups.
|
|
276
|
+
* - `PROPERTY_FACET_SYNC_INVALID` → `ValidationError` (400): not a `content_item` property, or
|
|
277
|
+
* not saved as filterable.
|
|
278
|
+
* - `MANAGED_BY_ORGANIZATION` → `BusinessRuleError` (422): in a store of an organization, a
|
|
279
|
+
* property of the workspace's groups (`editableHere` false): configure it in the workspace.
|
|
280
|
+
*
|
|
281
|
+
* Not idempotent by key; repeating the same `fields` writes the same facets again.
|
|
282
|
+
*
|
|
283
|
+
* Destructive: a dropped field's facet and a dropped option's filter value leave every product.
|
|
284
|
+
*
|
|
285
|
+
* @effect destructive
|
|
286
|
+
*/
|
|
287
|
+
configureFieldFacets(propertyId: string, fields: FieldFacetDefinition[], options?: Call): Promise<void>;
|
|
207
288
|
values: {
|
|
208
289
|
/**
|
|
209
290
|
* Every group of the store, each with this product's stored values in every language. For a
|
|
210
291
|
* product the store holds from its organization, the workspace's groups and values come too,
|
|
211
292
|
* with `group.editableHere` false.
|
|
293
|
+
*
|
|
294
|
+
* @effect read
|
|
212
295
|
*/
|
|
213
296
|
get(productId: string, options?: Call): Promise<ProductPropertyGroupValues[]>;
|
|
214
|
-
/**
|
|
297
|
+
/**
|
|
298
|
+
* Upsert the given values; properties not named keep theirs.
|
|
299
|
+
*
|
|
300
|
+
* @effect write
|
|
301
|
+
*/
|
|
215
302
|
set(productId: string, values: SetPropertyValueInput[], options?: Call): Promise<void>;
|
|
216
303
|
};
|
|
217
304
|
}
|
|
218
|
-
export declare const PROPERTY_GROUP_FIELDS = "\n id\n createdAt\n updatedAt\n position\n translations {\n id\n languageCode\n name\n }\n properties { \n id\n createdAt\n updatedAt\n slug\n fieldType\n isFilterable\n isRequired\n position\n config {\n options {\n value\n label\n }\n min\n max\n maxLength\n allowedCollectionIds\n filterableFieldSlugs\n productFilter\n }\n facetId\n translations {\n id\n languageCode\n name\n helpText\n }\n }\n editableHere\n";
|
|
219
|
-
export declare const PROPERTY_GROUPS_QUERY = "\n query CatalogPropertyGroups {\n propertyGroups { \n id\n createdAt\n updatedAt\n position\n translations {\n id\n languageCode\n name\n }\n properties { \n id\n createdAt\n updatedAt\n slug\n fieldType\n isFilterable\n isRequired\n position\n config {\n options {\n value\n label\n }\n min\n max\n maxLength\n allowedCollectionIds\n filterableFieldSlugs\n productFilter\n }\n facetId\n translations {\n id\n languageCode\n name\n helpText\n }\n }\n editableHere\n }\n }\n";
|
|
220
|
-
export declare const PROPERTY_GROUP_QUERY = "\n query CatalogPropertyGroup($id: ID!) {\n propertyGroup(id: $id) { \n id\n createdAt\n updatedAt\n position\n translations {\n id\n languageCode\n name\n }\n properties { \n id\n createdAt\n updatedAt\n slug\n fieldType\n isFilterable\n isRequired\n position\n config {\n options {\n value\n label\n }\n min\n max\n maxLength\n allowedCollectionIds\n filterableFieldSlugs\n productFilter\n }\n facetId\n translations {\n id\n languageCode\n name\n helpText\n }\n }\n editableHere\n }\n }\n";
|
|
221
|
-
export declare const CREATE_PROPERTY_GROUP_MUTATION = "\n mutation CatalogCreatePropertyGroup($input: CreatePropertyGroupInput!) {\n createPropertyGroup(input: $input) { \n id\n createdAt\n updatedAt\n position\n translations {\n id\n languageCode\n name\n }\n properties { \n id\n createdAt\n updatedAt\n slug\n fieldType\n isFilterable\n isRequired\n position\n config {\n options {\n value\n label\n }\n min\n max\n maxLength\n allowedCollectionIds\n filterableFieldSlugs\n productFilter\n }\n facetId\n translations {\n id\n languageCode\n name\n helpText\n }\n }\n editableHere\n }\n }\n";
|
|
222
|
-
export declare const UPDATE_PROPERTY_GROUP_MUTATION = "\n mutation CatalogUpdatePropertyGroup($input: UpdatePropertyGroupInput!) {\n updatePropertyGroup(input: $input) { \n id\n createdAt\n updatedAt\n position\n translations {\n id\n languageCode\n name\n }\n properties { \n id\n createdAt\n updatedAt\n slug\n fieldType\n isFilterable\n isRequired\n position\n config {\n options {\n value\n label\n }\n min\n max\n maxLength\n allowedCollectionIds\n filterableFieldSlugs\n productFilter\n }\n facetId\n translations {\n id\n languageCode\n name\n helpText\n }\n }\n editableHere\n }\n }\n";
|
|
305
|
+
export declare const PROPERTY_GROUP_FIELDS = "\n id\n createdAt\n updatedAt\n position\n translations {\n id\n languageCode\n name\n }\n properties { \n id\n createdAt\n updatedAt\n slug\n fieldType\n isFilterable\n isRequired\n position\n config {\n options {\n value\n label\n }\n min\n max\n maxLength\n allowedCollectionIds\n filterableFieldSlugs\n productFilter\n }\n facetId\n fieldFacets {\n fieldSlug\n fieldType\n facetId\n }\n translations {\n id\n languageCode\n name\n helpText\n }\n }\n editableHere\n";
|
|
306
|
+
export declare const PROPERTY_GROUPS_QUERY = "\n query CatalogPropertyGroups {\n propertyGroups { \n id\n createdAt\n updatedAt\n position\n translations {\n id\n languageCode\n name\n }\n properties { \n id\n createdAt\n updatedAt\n slug\n fieldType\n isFilterable\n isRequired\n position\n config {\n options {\n value\n label\n }\n min\n max\n maxLength\n allowedCollectionIds\n filterableFieldSlugs\n productFilter\n }\n facetId\n fieldFacets {\n fieldSlug\n fieldType\n facetId\n }\n translations {\n id\n languageCode\n name\n helpText\n }\n }\n editableHere\n }\n }\n";
|
|
307
|
+
export declare const PROPERTY_GROUP_QUERY = "\n query CatalogPropertyGroup($id: ID!) {\n propertyGroup(id: $id) { \n id\n createdAt\n updatedAt\n position\n translations {\n id\n languageCode\n name\n }\n properties { \n id\n createdAt\n updatedAt\n slug\n fieldType\n isFilterable\n isRequired\n position\n config {\n options {\n value\n label\n }\n min\n max\n maxLength\n allowedCollectionIds\n filterableFieldSlugs\n productFilter\n }\n facetId\n fieldFacets {\n fieldSlug\n fieldType\n facetId\n }\n translations {\n id\n languageCode\n name\n helpText\n }\n }\n editableHere\n }\n }\n";
|
|
308
|
+
export declare const CREATE_PROPERTY_GROUP_MUTATION = "\n mutation CatalogCreatePropertyGroup($input: CreatePropertyGroupInput!) {\n createPropertyGroup(input: $input) { \n id\n createdAt\n updatedAt\n position\n translations {\n id\n languageCode\n name\n }\n properties { \n id\n createdAt\n updatedAt\n slug\n fieldType\n isFilterable\n isRequired\n position\n config {\n options {\n value\n label\n }\n min\n max\n maxLength\n allowedCollectionIds\n filterableFieldSlugs\n productFilter\n }\n facetId\n fieldFacets {\n fieldSlug\n fieldType\n facetId\n }\n translations {\n id\n languageCode\n name\n helpText\n }\n }\n editableHere\n }\n }\n";
|
|
309
|
+
export declare const UPDATE_PROPERTY_GROUP_MUTATION = "\n mutation CatalogUpdatePropertyGroup($input: UpdatePropertyGroupInput!) {\n updatePropertyGroup(input: $input) { \n id\n createdAt\n updatedAt\n position\n translations {\n id\n languageCode\n name\n }\n properties { \n id\n createdAt\n updatedAt\n slug\n fieldType\n isFilterable\n isRequired\n position\n config {\n options {\n value\n label\n }\n min\n max\n maxLength\n allowedCollectionIds\n filterableFieldSlugs\n productFilter\n }\n facetId\n fieldFacets {\n fieldSlug\n fieldType\n facetId\n }\n translations {\n id\n languageCode\n name\n helpText\n }\n }\n editableHere\n }\n }\n";
|
|
223
310
|
export declare const DELETE_PROPERTY_GROUP_MUTATION = "\n mutation CatalogDeletePropertyGroup($id: ID!) {\n deletePropertyGroup(id: $id) { \n result\n message\n }\n }\n";
|
|
224
|
-
export declare const REORDER_PROPERTY_GROUPS_MUTATION = "\n mutation CatalogReorderPropertyGroups($ids: [ID!]!) {\n reorderPropertyGroups(ids: $ids) { \n id\n createdAt\n updatedAt\n position\n translations {\n id\n languageCode\n name\n }\n properties { \n id\n createdAt\n updatedAt\n slug\n fieldType\n isFilterable\n isRequired\n position\n config {\n options {\n value\n label\n }\n min\n max\n maxLength\n allowedCollectionIds\n filterableFieldSlugs\n productFilter\n }\n facetId\n translations {\n id\n languageCode\n name\n helpText\n }\n }\n editableHere\n }\n }\n";
|
|
225
|
-
export declare const CREATE_PROPERTY_MUTATION = "\n mutation CatalogCreateProperty($input: CreatePropertyInput!) {\n createProperty(input: $input) { \n id\n createdAt\n updatedAt\n slug\n fieldType\n isFilterable\n isRequired\n position\n config {\n options {\n value\n label\n }\n min\n max\n maxLength\n allowedCollectionIds\n filterableFieldSlugs\n productFilter\n }\n facetId\n translations {\n id\n languageCode\n name\n helpText\n }\n }\n }\n";
|
|
226
|
-
export declare const UPDATE_PROPERTY_MUTATION = "\n mutation CatalogUpdateProperty($input: UpdatePropertyInput!) {\n updateProperty(input: $input) { \n id\n createdAt\n updatedAt\n slug\n fieldType\n isFilterable\n isRequired\n position\n config {\n options {\n value\n label\n }\n min\n max\n maxLength\n allowedCollectionIds\n filterableFieldSlugs\n productFilter\n }\n facetId\n translations {\n id\n languageCode\n name\n helpText\n }\n }\n }\n";
|
|
311
|
+
export declare const REORDER_PROPERTY_GROUPS_MUTATION = "\n mutation CatalogReorderPropertyGroups($ids: [ID!]!) {\n reorderPropertyGroups(ids: $ids) { \n id\n createdAt\n updatedAt\n position\n translations {\n id\n languageCode\n name\n }\n properties { \n id\n createdAt\n updatedAt\n slug\n fieldType\n isFilterable\n isRequired\n position\n config {\n options {\n value\n label\n }\n min\n max\n maxLength\n allowedCollectionIds\n filterableFieldSlugs\n productFilter\n }\n facetId\n fieldFacets {\n fieldSlug\n fieldType\n facetId\n }\n translations {\n id\n languageCode\n name\n helpText\n }\n }\n editableHere\n }\n }\n";
|
|
312
|
+
export declare const CREATE_PROPERTY_MUTATION = "\n mutation CatalogCreateProperty($input: CreatePropertyInput!) {\n createProperty(input: $input) { \n id\n createdAt\n updatedAt\n slug\n fieldType\n isFilterable\n isRequired\n position\n config {\n options {\n value\n label\n }\n min\n max\n maxLength\n allowedCollectionIds\n filterableFieldSlugs\n productFilter\n }\n facetId\n fieldFacets {\n fieldSlug\n fieldType\n facetId\n }\n translations {\n id\n languageCode\n name\n helpText\n }\n }\n }\n";
|
|
313
|
+
export declare const UPDATE_PROPERTY_MUTATION = "\n mutation CatalogUpdateProperty($input: UpdatePropertyInput!) {\n updateProperty(input: $input) { \n id\n createdAt\n updatedAt\n slug\n fieldType\n isFilterable\n isRequired\n position\n config {\n options {\n value\n label\n }\n min\n max\n maxLength\n allowedCollectionIds\n filterableFieldSlugs\n productFilter\n }\n facetId\n fieldFacets {\n fieldSlug\n fieldType\n facetId\n }\n translations {\n id\n languageCode\n name\n helpText\n }\n }\n }\n";
|
|
227
314
|
export declare const DELETE_PROPERTY_MUTATION = "\n mutation CatalogDeleteProperty($id: ID!) {\n deleteProperty(id: $id) { \n result\n message\n }\n }\n";
|
|
228
|
-
export declare const REORDER_PROPERTIES_MUTATION = "\n mutation CatalogReorderProperties($groupId: ID!, $propertyIds: [ID!]!) {\n reorderProperties(groupId: $groupId, propertyIds: $propertyIds) { \n id\n createdAt\n updatedAt\n slug\n fieldType\n isFilterable\n isRequired\n position\n config {\n options {\n value\n label\n }\n min\n max\n maxLength\n allowedCollectionIds\n filterableFieldSlugs\n productFilter\n }\n facetId\n translations {\n id\n languageCode\n name\n helpText\n }\n }\n }\n";
|
|
229
|
-
export declare const
|
|
315
|
+
export declare const REORDER_PROPERTIES_MUTATION = "\n mutation CatalogReorderProperties($groupId: ID!, $propertyIds: [ID!]!) {\n reorderProperties(groupId: $groupId, propertyIds: $propertyIds) { \n id\n createdAt\n updatedAt\n slug\n fieldType\n isFilterable\n isRequired\n position\n config {\n options {\n value\n label\n }\n min\n max\n maxLength\n allowedCollectionIds\n filterableFieldSlugs\n productFilter\n }\n facetId\n fieldFacets {\n fieldSlug\n fieldType\n facetId\n }\n translations {\n id\n languageCode\n name\n helpText\n }\n }\n }\n";
|
|
316
|
+
export declare const CONFIGURE_FIELD_FACETS_MUTATION = "\n mutation CatalogConfigureFieldFacets($propertyId: ID!, $fields: [FieldFacetDefinitionInput!]!) {\n configureFieldFacets(propertyId: $propertyId, fields: $fields)\n }\n";
|
|
317
|
+
export declare const PRODUCT_PROPERTY_VALUES_QUERY = "\n query CatalogProductPropertyValues($productId: ID!) {\n productPropertyValues(productId: $productId) {\n group { \n id\n createdAt\n updatedAt\n position\n translations {\n id\n languageCode\n name\n }\n properties { \n id\n createdAt\n updatedAt\n slug\n fieldType\n isFilterable\n isRequired\n position\n config {\n options {\n value\n label\n }\n min\n max\n maxLength\n allowedCollectionIds\n filterableFieldSlugs\n productFilter\n }\n facetId\n fieldFacets {\n fieldSlug\n fieldType\n facetId\n }\n translations {\n id\n languageCode\n name\n helpText\n }\n }\n editableHere\n }\n values {\n id\n propertyId\n languageCode\n value\n }\n }\n }\n";
|
|
230
318
|
export declare const SET_PRODUCT_PROPERTY_VALUES_MUTATION = "\n mutation CatalogSetProductPropertyValues($productId: ID!, $values: [SetProductPropertyValueInput!]!) {\n setProductPropertyValues(productId: $productId, values: $values)\n }\n";
|
|
231
319
|
export declare const SYNC_PROPERTY_FACETS_MUTATION = "\n mutation CatalogSyncPropertyFacets($propertyId: ID!) {\n syncPropertyFacets(propertyId: $propertyId) {\n propertyId\n items\n unresolved\n fieldFacets\n }\n }\n";
|
|
232
320
|
/** `catalog.syncContentFacets`; its contract is on {@link CatalogModule.syncContentFacets}. */
|
|
233
321
|
export declare function syncContentFacets(transport: Transport, propertyId: string, options?: Call): Promise<ContentFacetSyncResult>;
|
|
322
|
+
/**
|
|
323
|
+
* The most different content item ids one {@link CatalogModule.syncContentItemFacets} call takes
|
|
324
|
+
* (the engine's own bound); repeats count once.
|
|
325
|
+
*/
|
|
326
|
+
export declare const MAX_CONTENT_ITEM_FACET_SYNC_IDS = 500;
|
|
327
|
+
/** A property {@link CatalogModule.syncContentItemFacets} did not sync, and why. */
|
|
328
|
+
export interface ContentItemFacetSyncSkip {
|
|
329
|
+
propertyId: string;
|
|
330
|
+
/**
|
|
331
|
+
* The refusal the property's own sync gave: `MANAGED_BY_ORGANIZATION` for a property of the
|
|
332
|
+
* store's organization workspace (it is synced in the workspace), or any refusal
|
|
333
|
+
* {@link CatalogModule.syncContentFacets} documents.
|
|
334
|
+
*/
|
|
335
|
+
code: string;
|
|
336
|
+
/** The refusal's sentence, as the engine words it. */
|
|
337
|
+
message: string;
|
|
338
|
+
}
|
|
339
|
+
/** What {@link CatalogModule.syncContentItemFacets} did. */
|
|
340
|
+
export interface ContentItemFacetSyncResult {
|
|
341
|
+
/**
|
|
342
|
+
* Each filterable `content_item` property of the store whose values name at least one of the
|
|
343
|
+
* items, synced as {@link CatalogModule.syncContentFacets} syncs it.
|
|
344
|
+
*/
|
|
345
|
+
synced: ContentFacetSyncResult[];
|
|
346
|
+
/** Each such property that was refused; nothing of it was written, the others were synced. */
|
|
347
|
+
skipped: ContentItemFacetSyncSkip[];
|
|
348
|
+
/**
|
|
349
|
+
* Whether the call wrote anything: a filter value created, renamed or removed, or a product's
|
|
350
|
+
* filter assignments changed. False on a repeat that found everything in line.
|
|
351
|
+
*/
|
|
352
|
+
changed: boolean;
|
|
353
|
+
}
|
|
354
|
+
export declare const SYNC_CONTENT_ITEM_FACETS_MUTATION = "\n mutation CatalogSyncContentItemFacets($contentItemIds: [ID!]!) {\n syncContentItemFacets(contentItemIds: $contentItemIds) {\n synced {\n propertyId\n items\n unresolved\n fieldFacets\n }\n skipped {\n propertyId\n code\n message\n }\n changed\n }\n }\n";
|
|
355
|
+
/**
|
|
356
|
+
* `catalog.syncContentItemFacets`; its contract is on
|
|
357
|
+
* {@link CatalogModule.syncContentItemFacets}. The engine's own id checks run before sending.
|
|
358
|
+
*/
|
|
359
|
+
export declare function syncContentItemFacets(transport: Transport, contentItemIds: readonly string[], options?: Call): Promise<ContentItemFacetSyncResult>;
|
|
234
360
|
export declare function createPropertiesModule(transport: Transport): PropertiesModule;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { createPage } from '@sixtyninecommerce/core';
|
|
1
|
+
import { createPage, ValidationError } from '@sixtyninecommerce/core';
|
|
2
2
|
import { assertDeleted, DELETION_FIELDS, fieldOf, } from './types.js';
|
|
3
3
|
const PROPERTY_FIELDS = /* GraphQL */ `
|
|
4
4
|
id
|
|
@@ -22,6 +22,11 @@ const PROPERTY_FIELDS = /* GraphQL */ `
|
|
|
22
22
|
productFilter
|
|
23
23
|
}
|
|
24
24
|
facetId
|
|
25
|
+
fieldFacets {
|
|
26
|
+
fieldSlug
|
|
27
|
+
fieldType
|
|
28
|
+
facetId
|
|
29
|
+
}
|
|
25
30
|
translations {
|
|
26
31
|
id
|
|
27
32
|
languageCode
|
|
@@ -92,6 +97,11 @@ export const REORDER_PROPERTIES_MUTATION = /* GraphQL */ `
|
|
|
92
97
|
reorderProperties(groupId: $groupId, propertyIds: $propertyIds) { ${PROPERTY_FIELDS} }
|
|
93
98
|
}
|
|
94
99
|
`;
|
|
100
|
+
export const CONFIGURE_FIELD_FACETS_MUTATION = /* GraphQL */ `
|
|
101
|
+
mutation CatalogConfigureFieldFacets($propertyId: ID!, $fields: [FieldFacetDefinitionInput!]!) {
|
|
102
|
+
configureFieldFacets(propertyId: $propertyId, fields: $fields)
|
|
103
|
+
}
|
|
104
|
+
`;
|
|
95
105
|
export const PRODUCT_PROPERTY_VALUES_QUERY = /* GraphQL */ `
|
|
96
106
|
query CatalogProductPropertyValues($productId: ID!) {
|
|
97
107
|
productPropertyValues(productId: $productId) {
|
|
@@ -124,6 +134,57 @@ export const SYNC_PROPERTY_FACETS_MUTATION = /* GraphQL */ `
|
|
|
124
134
|
export function syncContentFacets(transport, propertyId, options) {
|
|
125
135
|
return fieldOf(transport, SYNC_PROPERTY_FACETS_MUTATION, 'syncPropertyFacets', { propertyId }, options);
|
|
126
136
|
}
|
|
137
|
+
/**
|
|
138
|
+
* The most different content item ids one {@link CatalogModule.syncContentItemFacets} call takes
|
|
139
|
+
* (the engine's own bound); repeats count once.
|
|
140
|
+
*/
|
|
141
|
+
export const MAX_CONTENT_ITEM_FACET_SYNC_IDS = 500;
|
|
142
|
+
export const SYNC_CONTENT_ITEM_FACETS_MUTATION = /* GraphQL */ `
|
|
143
|
+
mutation CatalogSyncContentItemFacets($contentItemIds: [ID!]!) {
|
|
144
|
+
syncContentItemFacets(contentItemIds: $contentItemIds) {
|
|
145
|
+
synced {
|
|
146
|
+
propertyId
|
|
147
|
+
items
|
|
148
|
+
unresolved
|
|
149
|
+
fieldFacets
|
|
150
|
+
}
|
|
151
|
+
skipped {
|
|
152
|
+
propertyId
|
|
153
|
+
code
|
|
154
|
+
message
|
|
155
|
+
}
|
|
156
|
+
changed
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
`;
|
|
160
|
+
function refuseContentItemIds(message) {
|
|
161
|
+
return new ValidationError({
|
|
162
|
+
code: 'CONTENT_ITEM_IDS_INVALID',
|
|
163
|
+
message: `${message} Nothing was sent.`,
|
|
164
|
+
status: 400,
|
|
165
|
+
service: 'vendure',
|
|
166
|
+
});
|
|
167
|
+
}
|
|
168
|
+
/**
|
|
169
|
+
* `catalog.syncContentItemFacets`; its contract is on
|
|
170
|
+
* {@link CatalogModule.syncContentItemFacets}. The engine's own id checks run before sending.
|
|
171
|
+
*/
|
|
172
|
+
export function syncContentItemFacets(transport, contentItemIds, options) {
|
|
173
|
+
if (!Array.isArray(contentItemIds)) {
|
|
174
|
+
return Promise.reject(refuseContentItemIds('Send the content item ids as a list.'));
|
|
175
|
+
}
|
|
176
|
+
const distinct = new Set();
|
|
177
|
+
for (const id of contentItemIds) {
|
|
178
|
+
if (typeof id !== 'string' || id.trim() === '') {
|
|
179
|
+
return Promise.reject(refuseContentItemIds('A content item id is blank.'));
|
|
180
|
+
}
|
|
181
|
+
distinct.add(id.trim().toLowerCase());
|
|
182
|
+
}
|
|
183
|
+
if (distinct.size > MAX_CONTENT_ITEM_FACET_SYNC_IDS) {
|
|
184
|
+
return Promise.reject(refuseContentItemIds(`Send at most ${String(MAX_CONTENT_ITEM_FACET_SYNC_IDS)} different content item ids per call; this one named ${String(distinct.size)}. Split them into several calls.`));
|
|
185
|
+
}
|
|
186
|
+
return fieldOf(transport, SYNC_CONTENT_ITEM_FACETS_MUTATION, 'syncContentItemFacets', { contentItemIds: [...contentItemIds] }, options);
|
|
187
|
+
}
|
|
127
188
|
export function createPropertiesModule(transport) {
|
|
128
189
|
const call = (document, field, variables, options) => fieldOf(transport, document, field, variables, options);
|
|
129
190
|
const deleted = async (document, field, code, id, options) => {
|
|
@@ -148,6 +209,9 @@ export function createPropertiesModule(transport) {
|
|
|
148
209
|
update: (input, options) => call(UPDATE_PROPERTY_MUTATION, 'updateProperty', { input }, options),
|
|
149
210
|
delete: (id, options) => deleted(DELETE_PROPERTY_MUTATION, 'deleteProperty', 'PROPERTY_NOT_DELETED', id, options),
|
|
150
211
|
reorder: (groupId, propertyIds, options) => call(REORDER_PROPERTIES_MUTATION, 'reorderProperties', { groupId, propertyIds }, options),
|
|
212
|
+
async configureFieldFacets(propertyId, fields, options) {
|
|
213
|
+
await call(CONFIGURE_FIELD_FACETS_MUTATION, 'configureFieldFacets', { propertyId, fields }, options);
|
|
214
|
+
},
|
|
151
215
|
values: {
|
|
152
216
|
get: (productId, options) => call(PRODUCT_PROPERTY_VALUES_QUERY, 'productPropertyValues', { productId }, options),
|
|
153
217
|
async set(productId, values, options) {
|
|
@@ -0,0 +1,288 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Product recommendations (headless spec §9.2 `catalog`: "recommendations"; W10-13): the store's
|
|
3
|
+
* recommendation groups ("Customers also bought", "Complete the look"), what each one draws its
|
|
4
|
+
* products from, and the products hand-picked per product for a manual group.
|
|
5
|
+
*
|
|
6
|
+
* - **A `DYNAMIC` group's entries are its rules**, read in `position` order: one named product
|
|
7
|
+
* (`PRODUCT`), the products of a collection (`COLLECTION`) or with a facet value
|
|
8
|
+
* (`FACET_VALUE`), or the viewed product's own collections (`SAME_COLLECTION`) or properties
|
|
9
|
+
* (`SAME_PROPERTIES`). The storefront fills the group up to `maxItems` from the first entry on,
|
|
10
|
+
* never with the viewed product, a disabled product or one the store hides from the shopper.
|
|
11
|
+
* - **A `MANUAL` group has no entries**: its products are picked per viewed product
|
|
12
|
+
* (`manual.set`), and the storefront shows them in the order picked. A group's mode is chosen
|
|
13
|
+
* when it is created and never changes.
|
|
14
|
+
* - **A disabled group** (`enabled: false`) is kept but never shown on the storefront.
|
|
15
|
+
* - **Positions** are integers; a group or entry created without one goes after the last.
|
|
16
|
+
* `reorder` rewrites them as `0, 1, 2…` in the order given.
|
|
17
|
+
*
|
|
18
|
+
* Permissions: reads need `ReadCatalog`, writes `UpdateCatalog`. Every row is the store's own: a
|
|
19
|
+
* group or entry of another store is never answered and never changed (a read answers `null` or
|
|
20
|
+
* leaves it out; a write refuses it as unknown), and a rule only ever draws from the store's own
|
|
21
|
+
* products, collections and facet values.
|
|
22
|
+
*
|
|
23
|
+
* Refusals, GraphQL errors mapped by `core`. An unknown id and another store's get the same answer,
|
|
24
|
+
* so none tells whether another store holds the row:
|
|
25
|
+
* - `ENTITY_NOT_FOUND` → `NotFoundError` (404): a group or entry the store does not have, and the
|
|
26
|
+
* viewed product of `manual.set` when the store does not hold it.
|
|
27
|
+
* - `RECOMMENDATION_SOURCE_NOT_FOUND` → `NotFoundError` (404): a rule's `sourceId` that is not a
|
|
28
|
+
* product, collection or facet value of the store (`entries.create`, `entries.update`).
|
|
29
|
+
* - `RECOMMENDATION_TARGET_NOT_FOUND` → `NotFoundError` (404): `manual.set` picks the store does
|
|
30
|
+
* not hold, each named in the message and in `details` (`field` `/targetProductIds/<index>`).
|
|
31
|
+
* - `RECOMMENDATION_GROUP_SLUG_TAKEN` → `ConflictError` (409): another of the store's groups holds
|
|
32
|
+
* the slug, also when two writes race for one free slug.
|
|
33
|
+
* - `RECOMMENDATION_MAX_ITEMS_INVALID` → `ValidationError` (400): a group's `maxItems` that is not
|
|
34
|
+
* a whole number from 1 to 50 ({@link RECOMMENDATION_MAX_ITEMS_RANGE}), on `groups.create` and
|
|
35
|
+
* on a `groups.update` that sends it, `details[0].field` `/input/maxItems`. This SDK refuses it
|
|
36
|
+
* before anything is sent, with the same code and detail, so an older platform release (which
|
|
37
|
+
* stores any value) never receives one.
|
|
38
|
+
* - `USER_INPUT_ERROR` → `ValidationError` (400), in the engine's words: a rule that does not fit
|
|
39
|
+
* its group or its type (a `MANUAL` group, a `sourceId` missing or sent where none goes), picks
|
|
40
|
+
* in a `DYNAMIC` group.
|
|
41
|
+
* - `FORBIDDEN` → `PermissionDeniedError` (403) without the permission.
|
|
42
|
+
*
|
|
43
|
+
* An id that is not a uuid (any id argument, a `sourceId` and each pick included) is refused
|
|
44
|
+
* before all of these with core's `ENTITY_NOT_FOUND` (`NotFoundError`, 404, no `details`), so
|
|
45
|
+
* branch on the class for not-found and on the code only to tell which row is missing.
|
|
46
|
+
*
|
|
47
|
+
* A platform release older than these codes answers each not-found and a taken slug as
|
|
48
|
+
* `USER_INPUT_ERROR` (400) in its own words ("Recommendation group not found"), a slug lost in a
|
|
49
|
+
* race as `DUPLICATE_RECORD`, and takes another store's collection or facet value as a rule's
|
|
50
|
+
* source.
|
|
51
|
+
*
|
|
52
|
+
* No release gate: every operation here is served by every platform release this SDK supports.
|
|
53
|
+
* No method deduplicates on `idempotencyKey`: repeating a `create` makes a second row.
|
|
54
|
+
*/
|
|
55
|
+
import { type Transport } from '@sixtyninecommerce/core';
|
|
56
|
+
import type { Call } from '../types.js';
|
|
57
|
+
/**
|
|
58
|
+
* The fewest and the most products a group may show (`maxItems`), both included. The platform
|
|
59
|
+
* refuses any other value with `RECOMMENDATION_MAX_ITEMS_INVALID`, and so does this SDK before
|
|
60
|
+
* sending.
|
|
61
|
+
*/
|
|
62
|
+
export declare const RECOMMENDATION_MAX_ITEMS_RANGE: {
|
|
63
|
+
readonly min: 1;
|
|
64
|
+
readonly max: 50;
|
|
65
|
+
};
|
|
66
|
+
/** What a `DYNAMIC` group's entry draws its products from. */
|
|
67
|
+
export type RecommendationSourceType = 'PRODUCT' | 'COLLECTION' | 'FACET_VALUE' | 'SAME_COLLECTION' | 'SAME_PROPERTIES';
|
|
68
|
+
/** `DYNAMIC`: rules (entries). `MANUAL`: products picked per viewed product (`manual.set`). */
|
|
69
|
+
export type RecommendationGroupMode = 'DYNAMIC' | 'MANUAL';
|
|
70
|
+
/** The source types whose entry names a row (`sourceId`); the others must name none. */
|
|
71
|
+
export declare const RECOMMENDATION_SOURCE_TYPES_WITH_ID: readonly RecommendationSourceType[];
|
|
72
|
+
/** One rule of a `DYNAMIC` group. */
|
|
73
|
+
export interface RecommendationEntry {
|
|
74
|
+
id: string;
|
|
75
|
+
groupId: string;
|
|
76
|
+
sourceType: RecommendationSourceType;
|
|
77
|
+
/**
|
|
78
|
+
* The product, collection or facet value for `PRODUCT`, `COLLECTION` and `FACET_VALUE`; `null`
|
|
79
|
+
* for `SAME_COLLECTION` and `SAME_PROPERTIES`. Always a row of this store when it was written:
|
|
80
|
+
* `entries.create` and `entries.update` refuse any other (`RECOMMENDATION_SOURCE_NOT_FOUND`). A
|
|
81
|
+
* row deleted or taken out of the store since adds nothing, and the storefront never draws from
|
|
82
|
+
* another store's collection or facet value, a rule stored before the refusal included. A deleted
|
|
83
|
+
* product's `PRODUCT` entries are removed with it.
|
|
84
|
+
*/
|
|
85
|
+
sourceId: string | null;
|
|
86
|
+
position: number;
|
|
87
|
+
/** ISO-8601 UTC. */
|
|
88
|
+
createdAt: string;
|
|
89
|
+
/** ISO-8601 UTC. */
|
|
90
|
+
updatedAt: string;
|
|
91
|
+
}
|
|
92
|
+
/** A group without its entries, as `manual.get` and `manual.set` answer it. */
|
|
93
|
+
export interface RecommendationGroupSummary {
|
|
94
|
+
id: string;
|
|
95
|
+
name: string;
|
|
96
|
+
/** Unique within the store; the storefront asks for one group by it. */
|
|
97
|
+
slug: string;
|
|
98
|
+
description: string | null;
|
|
99
|
+
/**
|
|
100
|
+
* The most products the storefront shows for this group. Written as 1 to 50; a group stored
|
|
101
|
+
* outside that range before the platform enforced it keeps its value until `maxItems` is sent.
|
|
102
|
+
*/
|
|
103
|
+
maxItems: number;
|
|
104
|
+
position: number;
|
|
105
|
+
enabled: boolean;
|
|
106
|
+
mode: RecommendationGroupMode;
|
|
107
|
+
/** ISO-8601 UTC. */
|
|
108
|
+
createdAt: string;
|
|
109
|
+
/** ISO-8601 UTC. */
|
|
110
|
+
updatedAt: string;
|
|
111
|
+
}
|
|
112
|
+
export interface RecommendationGroup extends RecommendationGroupSummary {
|
|
113
|
+
/** In `position` order (ties: the older first). Always empty on a `MANUAL` group. */
|
|
114
|
+
entries: RecommendationEntry[];
|
|
115
|
+
}
|
|
116
|
+
/** One `MANUAL` group and the products picked in it for one viewed product. */
|
|
117
|
+
export interface ProductManualRecommendations {
|
|
118
|
+
group: RecommendationGroupSummary;
|
|
119
|
+
/** In the order picked; empty when none are. */
|
|
120
|
+
productIds: string[];
|
|
121
|
+
}
|
|
122
|
+
export interface CreateRecommendationGroupInput {
|
|
123
|
+
name: string;
|
|
124
|
+
/** Defaults to the name, lower-cased, every run of other characters than `a-z0-9` a `-`. */
|
|
125
|
+
slug?: string;
|
|
126
|
+
description?: string;
|
|
127
|
+
/**
|
|
128
|
+
* Defaults to 10. A whole number from 1 to 50 ({@link RECOMMENDATION_MAX_ITEMS_RANGE}); any
|
|
129
|
+
* other is refused `RECOMMENDATION_MAX_ITEMS_INVALID` before it is sent.
|
|
130
|
+
*/
|
|
131
|
+
maxItems?: number;
|
|
132
|
+
/** Defaults to after the store's last group. */
|
|
133
|
+
position?: number;
|
|
134
|
+
/** Defaults to true. */
|
|
135
|
+
enabled?: boolean;
|
|
136
|
+
/** Defaults to `DYNAMIC`; never changes afterwards. */
|
|
137
|
+
mode?: RecommendationGroupMode;
|
|
138
|
+
}
|
|
139
|
+
/** Only the fields named change; `description: null` clears it. */
|
|
140
|
+
export interface UpdateRecommendationGroupInput {
|
|
141
|
+
name?: string;
|
|
142
|
+
slug?: string;
|
|
143
|
+
description?: string | null;
|
|
144
|
+
/**
|
|
145
|
+
* A whole number from 1 to 50, else refused `RECOMMENDATION_MAX_ITEMS_INVALID` before it is
|
|
146
|
+
* sent. Left out, the stored value stays (and is not judged, so a group stored outside the
|
|
147
|
+
* range before the rule can still be renamed, moved or disabled).
|
|
148
|
+
*/
|
|
149
|
+
maxItems?: number;
|
|
150
|
+
position?: number;
|
|
151
|
+
enabled?: boolean;
|
|
152
|
+
}
|
|
153
|
+
export interface CreateRecommendationEntryInput {
|
|
154
|
+
groupId: string;
|
|
155
|
+
sourceType: RecommendationSourceType;
|
|
156
|
+
/** Required for `PRODUCT`, `COLLECTION` and `FACET_VALUE`; refused for the other two. */
|
|
157
|
+
sourceId?: string;
|
|
158
|
+
/** Defaults to after the group's last entry. */
|
|
159
|
+
position?: number;
|
|
160
|
+
}
|
|
161
|
+
/** Only the fields named change; `sourceId: null` clears it (for a `SAME_*` source type). */
|
|
162
|
+
export interface UpdateRecommendationEntryInput {
|
|
163
|
+
sourceType?: RecommendationSourceType;
|
|
164
|
+
sourceId?: string | null;
|
|
165
|
+
position?: number;
|
|
166
|
+
}
|
|
167
|
+
export interface RecommendationsModule {
|
|
168
|
+
groups: {
|
|
169
|
+
/**
|
|
170
|
+
* Every group of the store, in `position` order (ties: the older first), each with its
|
|
171
|
+
* entries. The engine answers them all at once; there are no pages.
|
|
172
|
+
*
|
|
173
|
+
* @effect read
|
|
174
|
+
*/
|
|
175
|
+
list(options?: Call): Promise<RecommendationGroup[]>;
|
|
176
|
+
/**
|
|
177
|
+
* One group with its entries; `null` when the store has no group with that id.
|
|
178
|
+
*
|
|
179
|
+
* @effect read
|
|
180
|
+
*/
|
|
181
|
+
get(id: string, options?: Call): Promise<RecommendationGroup | null>;
|
|
182
|
+
/**
|
|
183
|
+
* Refused: a `maxItems` outside 1–50 (`RECOMMENDATION_MAX_ITEMS_INVALID`, before anything is
|
|
184
|
+
* sent); a slug the store's other group already holds, the defaulted one included
|
|
185
|
+
* (`RECOMMENDATION_GROUP_SLUG_TAKEN`).
|
|
186
|
+
*
|
|
187
|
+
* @effect write
|
|
188
|
+
*/
|
|
189
|
+
create(input: CreateRecommendationGroupInput, options?: Call): Promise<RecommendationGroup>;
|
|
190
|
+
/**
|
|
191
|
+
* Refused: a `maxItems` sent outside 1–50 (`RECOMMENDATION_MAX_ITEMS_INVALID`, before anything
|
|
192
|
+
* is sent); a group the store does not have (`ENTITY_NOT_FOUND`); a slug another of its groups
|
|
193
|
+
* holds (`RECOMMENDATION_GROUP_SLUG_TAKEN`).
|
|
194
|
+
*
|
|
195
|
+
* @effect write
|
|
196
|
+
*/
|
|
197
|
+
update(id: string, input: UpdateRecommendationGroupInput, options?: Call): Promise<RecommendationGroup>;
|
|
198
|
+
/**
|
|
199
|
+
* Deletes the group, its entries and every product's picks in it. Refused
|
|
200
|
+
* (`ENTITY_NOT_FOUND`) for a group the store does not have.
|
|
201
|
+
*
|
|
202
|
+
* @effect destructive
|
|
203
|
+
*/
|
|
204
|
+
delete(id: string, options?: Call): Promise<void>;
|
|
205
|
+
/**
|
|
206
|
+
* Gives the named groups the positions `0, 1, 2…` in the order given, and answers every group
|
|
207
|
+
* as `list` does. An id the store does not hold is skipped without a word; a group left out
|
|
208
|
+
* keeps its position, which may then equal a named one's: name them all.
|
|
209
|
+
*
|
|
210
|
+
* @effect write
|
|
211
|
+
*/
|
|
212
|
+
reorder(ids: string[], options?: Call): Promise<RecommendationGroup[]>;
|
|
213
|
+
};
|
|
214
|
+
/** The rules of `DYNAMIC` groups. */
|
|
215
|
+
entries: {
|
|
216
|
+
/**
|
|
217
|
+
* Refused: a group the store does not have (`ENTITY_NOT_FOUND`); a `sourceId` that is not a
|
|
218
|
+
* product, collection or facet value of the store (`RECOMMENDATION_SOURCE_NOT_FOUND`: another
|
|
219
|
+
* store's is refused like an unknown id); a `MANUAL` group, or a `sourceId` missing for
|
|
220
|
+
* `PRODUCT` / `COLLECTION` / `FACET_VALUE` or sent for `SAME_COLLECTION` / `SAME_PROPERTIES`
|
|
221
|
+
* (`USER_INPUT_ERROR`).
|
|
222
|
+
*
|
|
223
|
+
* @effect write
|
|
224
|
+
*/
|
|
225
|
+
create(input: CreateRecommendationEntryInput, options?: Call): Promise<RecommendationEntry>;
|
|
226
|
+
/**
|
|
227
|
+
* Refused: an entry the store does not have (`ENTITY_NOT_FOUND`); a source type and
|
|
228
|
+
* `sourceId` that do not go together once the change is applied (`USER_INPUT_ERROR`); a
|
|
229
|
+
* change of either that leaves the rule naming no row of the store
|
|
230
|
+
* (`RECOMMENDATION_SOURCE_NOT_FOUND`). A change of `position` alone is not judged.
|
|
231
|
+
*
|
|
232
|
+
* @effect write
|
|
233
|
+
*/
|
|
234
|
+
update(id: string, input: UpdateRecommendationEntryInput, options?: Call): Promise<RecommendationEntry>;
|
|
235
|
+
/**
|
|
236
|
+
* Refused (`ENTITY_NOT_FOUND`) for an entry the store does not have.
|
|
237
|
+
*
|
|
238
|
+
* @effect destructive
|
|
239
|
+
*/
|
|
240
|
+
delete(id: string, options?: Call): Promise<void>;
|
|
241
|
+
/**
|
|
242
|
+
* Gives the group's named entries the positions `0, 1, 2…` in the order given, and answers
|
|
243
|
+
* the group's entries in `position` order. An id that is not one of THIS group's entries is
|
|
244
|
+
* skipped without a word (another group's entry never moves); an entry left out keeps its
|
|
245
|
+
* position. Refused (`ENTITY_NOT_FOUND`) for a group the store does not have.
|
|
246
|
+
*
|
|
247
|
+
* @effect write
|
|
248
|
+
*/
|
|
249
|
+
reorder(groupId: string, ids: string[], options?: Call): Promise<RecommendationEntry[]>;
|
|
250
|
+
};
|
|
251
|
+
/** The products picked per viewed product in `MANUAL` groups (the product page's card). */
|
|
252
|
+
manual: {
|
|
253
|
+
/**
|
|
254
|
+
* Every `MANUAL` group of the store, in `position` order, each with the products picked for
|
|
255
|
+
* `productId`. A product with no picks (or none of this store) answers every group with an
|
|
256
|
+
* empty `productIds`; a store with no manual group answers `[]`.
|
|
257
|
+
*
|
|
258
|
+
* @effect read
|
|
259
|
+
*/
|
|
260
|
+
get(productId: string, options?: Call): Promise<ProductManualRecommendations[]>;
|
|
261
|
+
/**
|
|
262
|
+
* Replaces the products picked for `productId` in one `MANUAL` group, in the order given:
|
|
263
|
+
* `[]` clears them. The product itself and repeats are dropped (the first one kept). One
|
|
264
|
+
* write: refused, nothing changes.
|
|
265
|
+
*
|
|
266
|
+
* Refused: a group the store does not have, or `productId` not a product of this store
|
|
267
|
+
* (`ENTITY_NOT_FOUND`); a picked product that is not (`RECOMMENDATION_TARGET_NOT_FOUND`,
|
|
268
|
+
* naming each, `details` pointing at where it was sent); a `DYNAMIC` group
|
|
269
|
+
* (`USER_INPUT_ERROR`).
|
|
270
|
+
*
|
|
271
|
+
* @effect write
|
|
272
|
+
*/
|
|
273
|
+
set(productId: string, groupId: string, productIds: string[], options?: Call): Promise<RecommendationGroupSummary>;
|
|
274
|
+
};
|
|
275
|
+
}
|
|
276
|
+
export declare const RECOMMENDATION_GROUPS_QUERY = "\n query CatalogRecommendationGroups {\n recommendationGroups { \n \n id\n name\n slug\n description\n maxItems\n position\n enabled\n mode\n createdAt\n updatedAt\n\n entries { \n id\n groupId\n sourceType\n sourceId\n position\n createdAt\n updatedAt\n }\n }\n }\n";
|
|
277
|
+
export declare const RECOMMENDATION_GROUP_QUERY = "\n query CatalogRecommendationGroup($id: ID!) {\n recommendationGroup(id: $id) { \n \n id\n name\n slug\n description\n maxItems\n position\n enabled\n mode\n createdAt\n updatedAt\n\n entries { \n id\n groupId\n sourceType\n sourceId\n position\n createdAt\n updatedAt\n }\n }\n }\n";
|
|
278
|
+
export declare const CREATE_RECOMMENDATION_GROUP_MUTATION = "\n mutation CatalogCreateRecommendationGroup($input: CreateRecommendationGroupInput!) {\n createRecommendationGroup(input: $input) { \n \n id\n name\n slug\n description\n maxItems\n position\n enabled\n mode\n createdAt\n updatedAt\n\n entries { \n id\n groupId\n sourceType\n sourceId\n position\n createdAt\n updatedAt\n }\n }\n }\n";
|
|
279
|
+
export declare const UPDATE_RECOMMENDATION_GROUP_MUTATION = "\n mutation CatalogUpdateRecommendationGroup($id: ID!, $input: UpdateRecommendationGroupInput!) {\n updateRecommendationGroup(id: $id, input: $input) { \n \n id\n name\n slug\n description\n maxItems\n position\n enabled\n mode\n createdAt\n updatedAt\n\n entries { \n id\n groupId\n sourceType\n sourceId\n position\n createdAt\n updatedAt\n }\n }\n }\n";
|
|
280
|
+
export declare const DELETE_RECOMMENDATION_GROUP_MUTATION = "\n mutation CatalogDeleteRecommendationGroup($id: ID!) {\n deleteRecommendationGroup(id: $id) { \n result\n message\n }\n }\n";
|
|
281
|
+
export declare const REORDER_RECOMMENDATION_GROUPS_MUTATION = "\n mutation CatalogReorderRecommendationGroups($ids: [ID!]!) {\n reorderRecommendationGroups(ids: $ids) { \n \n id\n name\n slug\n description\n maxItems\n position\n enabled\n mode\n createdAt\n updatedAt\n\n entries { \n id\n groupId\n sourceType\n sourceId\n position\n createdAt\n updatedAt\n }\n }\n }\n";
|
|
282
|
+
export declare const CREATE_RECOMMENDATION_ENTRY_MUTATION = "\n mutation CatalogCreateRecommendationEntry($input: CreateRecommendationEntryInput!) {\n createRecommendationEntry(input: $input) { \n id\n groupId\n sourceType\n sourceId\n position\n createdAt\n updatedAt\n }\n }\n";
|
|
283
|
+
export declare const UPDATE_RECOMMENDATION_ENTRY_MUTATION = "\n mutation CatalogUpdateRecommendationEntry($id: ID!, $input: UpdateRecommendationEntryInput!) {\n updateRecommendationEntry(id: $id, input: $input) { \n id\n groupId\n sourceType\n sourceId\n position\n createdAt\n updatedAt\n }\n }\n";
|
|
284
|
+
export declare const DELETE_RECOMMENDATION_ENTRY_MUTATION = "\n mutation CatalogDeleteRecommendationEntry($id: ID!) {\n deleteRecommendationEntry(id: $id) { \n result\n message\n }\n }\n";
|
|
285
|
+
export declare const REORDER_RECOMMENDATION_ENTRIES_MUTATION = "\n mutation CatalogReorderRecommendationEntries($groupId: ID!, $ids: [ID!]!) {\n reorderRecommendationEntries(groupId: $groupId, ids: $ids) { \n id\n groupId\n sourceType\n sourceId\n position\n createdAt\n updatedAt\n }\n }\n";
|
|
286
|
+
export declare const PRODUCT_MANUAL_RECOMMENDATIONS_QUERY = "\n query CatalogProductManualRecommendations($productId: ID!) {\n productManualRecommendations(productId: $productId) {\n group { \n id\n name\n slug\n description\n maxItems\n position\n enabled\n mode\n createdAt\n updatedAt\n }\n productIds\n }\n }\n";
|
|
287
|
+
export declare const SET_PRODUCT_MANUAL_RECOMMENDATIONS_MUTATION = "\n mutation CatalogSetProductManualRecommendations(\n $productId: ID!\n $groupId: ID!\n $targetProductIds: [ID!]!\n ) {\n setProductManualRecommendations(\n productId: $productId\n groupId: $groupId\n targetProductIds: $targetProductIds\n ) { \n id\n name\n slug\n description\n maxItems\n position\n enabled\n mode\n createdAt\n updatedAt\n }\n }\n";
|
|
288
|
+
export declare function createRecommendationsModule(transport: Transport): RecommendationsModule;
|