brainerce 2.7.0 → 2.8.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 +124 -0
- package/dist/index.d.mts +119 -2
- package/dist/index.d.ts +119 -2
- package/dist/index.js +81 -1
- package/dist/index.mjs +81 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1322,6 +1322,21 @@ The SDK uses **server-side carts for all users**. Guests get automatic session c
|
|
|
1322
1322
|
> `publishProductToSalesChannel()`. Note `publishProduct()` is a DIFFERENT
|
|
1323
1323
|
> operation — that one pushes to external platforms, not to your storefront.
|
|
1324
1324
|
|
|
1325
|
+
> **A shopper cart holds at most 50 distinct lines.** Adding a 51st _different_
|
|
1326
|
+
> product throws `400 "A cart can hold at most 50 different items. Remove
|
|
1327
|
+
> something before adding more."` It is a fixed platform limit with no per-store
|
|
1328
|
+
> setting. **It applies in channel (`salesChannelId: 'vc_*'`) and store
|
|
1329
|
+
> (`storeId`) mode only — an admin (`apiKey: 'brainerce_*'`) cart is not
|
|
1330
|
+
> capped**, because a B2B or bulk-import cart legitimately runs long, so the same
|
|
1331
|
+
> call can succeed for one client and fail for another. The cap counts distinct
|
|
1332
|
+
> lines, not quantity, and is only checked when a **new** line would be created,
|
|
1333
|
+
> so a full cart can still have quantities changed and items removed rather than
|
|
1334
|
+
> becoming unusable. Show it as a "your cart is full" state and keep the item the
|
|
1335
|
+
> shopper tried to add on screen. ⛔ Bundle and order-bump adds are **not
|
|
1336
|
+
> transactional**: a bundle whose lines would cross 50 throws part-way and leaves
|
|
1337
|
+
> the earlier products of that bundle in the cart, so re-read the cart after a
|
|
1338
|
+
> failed bundle add.
|
|
1339
|
+
|
|
1325
1340
|
```typescript
|
|
1326
1341
|
// Add to cart (guest or logged-in — same code!)
|
|
1327
1342
|
await client.smartAddToCart({ productId: 'prod_123', quantity: 2 });
|
|
@@ -2610,6 +2625,11 @@ await client.smartAddToCart({
|
|
|
2610
2625
|
> guest or a logged-in shopper, so you never need a `cartId` of your own.
|
|
2611
2626
|
> Validation stays server-side, so a bad modifier set still comes back as a
|
|
2612
2627
|
> `MODIFIER_VALIDATION_FAILED` envelope on `BrainerceError.details`.
|
|
2628
|
+
>
|
|
2629
|
+
> **The 50-distinct-line cap applies here too** (channel and store mode; not
|
|
2630
|
+
> admin). A 51st different product throws `400 "A cart can hold at most 50
|
|
2631
|
+
> different items. Remove something before adding more."` — see
|
|
2632
|
+
> [Cart (Unified for All Users)](#cart-unified-for-all-users) above.
|
|
2613
2633
|
|
|
2614
2634
|
#### Get Cart
|
|
2615
2635
|
|
|
@@ -2874,6 +2894,12 @@ const cart = await client.addToCart(cartId, {
|
|
|
2874
2894
|
});
|
|
2875
2895
|
```
|
|
2876
2896
|
|
|
2897
|
+
> **Capped at 50 distinct lines** in channel and store mode (not admin): a 51st
|
|
2898
|
+
> different product throws `400 "A cart can hold at most 50 different items.
|
|
2899
|
+
> Remove something before adding more."` Quantity changes on an already-full cart
|
|
2900
|
+
> still work — only a new line is refused. See
|
|
2901
|
+
> [Cart (Unified for All Users)](#cart-unified-for-all-users).
|
|
2902
|
+
|
|
2877
2903
|
#### Update Cart Item
|
|
2878
2904
|
|
|
2879
2905
|
```typescript
|
|
@@ -5994,6 +6020,55 @@ await client.setMetafieldPlatforms('def_id', {
|
|
|
5994
6020
|
});
|
|
5995
6021
|
```
|
|
5996
6022
|
|
|
6023
|
+
### Order custom fields
|
|
6024
|
+
|
|
6025
|
+
Merchant-defined fields that hold a value **on an order**. Not the ones a
|
|
6026
|
+
shopper fills in at checkout — these are the store's own, and they are how you
|
|
6027
|
+
attach something that only exists after the purchase: a licence key, a booking
|
|
6028
|
+
reference, a warranty number issued by a third party.
|
|
6029
|
+
|
|
6030
|
+
The point of writing here rather than emailing the customer yourself: the value
|
|
6031
|
+
travels to the merchant's own order email templates as `orderCustomFields`, and
|
|
6032
|
+
shows on the customer's own order page when the definition is `isPublic`. You do
|
|
6033
|
+
not build an email, and the merchant keeps their branding and their language.
|
|
6034
|
+
|
|
6035
|
+
⛔ **The stock templates do not print it.** The variable reaches every order
|
|
6036
|
+
email, but no default template renders it, so a value you write is invisible to
|
|
6037
|
+
the customer until the merchant adds the block to the template once (the email
|
|
6038
|
+
editor's variable helper offers `orderCustomFields`). Writing the field is not
|
|
6039
|
+
the same as the customer being told. Say so when you hand this to a merchant.
|
|
6040
|
+
|
|
6041
|
+
The merchant creates the definitions in the dashboard (Orders → settings). The
|
|
6042
|
+
SDK reads them and writes values.
|
|
6043
|
+
|
|
6044
|
+
```typescript
|
|
6045
|
+
// 1. Discover the keys. `key` is what you write; `type` is what a value must fit.
|
|
6046
|
+
const definitions = await client.getOrderCustomFieldDefinitions();
|
|
6047
|
+
|
|
6048
|
+
// 2. Write. A MERGE — omitted keys keep their value, null clears a non-required one.
|
|
6049
|
+
const stored = await client.setOrderCustomFieldValues(
|
|
6050
|
+
'order_123',
|
|
6051
|
+
{ licence_key: 'ABCD-EFGH-IJKL' },
|
|
6052
|
+
{ idempotencyKey: 'licence-order_123' }
|
|
6053
|
+
);
|
|
6054
|
+
console.log(stored.fields); // what was ACTUALLY persisted, after coercion
|
|
6055
|
+
|
|
6056
|
+
// 3. Read back later
|
|
6057
|
+
const { fields } = await client.getOrderCustomFieldValues('order_123');
|
|
6058
|
+
```
|
|
6059
|
+
|
|
6060
|
+
Three behaviours worth knowing before you rely on them:
|
|
6061
|
+
|
|
6062
|
+
- **A key with no active definition is ignored, not rejected.** The call still
|
|
6063
|
+
succeeds. Check the returned `fields` to confirm your value landed, rather
|
|
6064
|
+
than assuming a 200 means it did.
|
|
6065
|
+
- **Values are coerced to the definition type.** A `NUMBER` field written as
|
|
6066
|
+
`'5'` reads back as `5`. A value that cannot be coerced is a 400.
|
|
6067
|
+
- **`required` fields cannot be cleared.** Sending `null` for one is a 400.
|
|
6068
|
+
|
|
6069
|
+
Requires an API key with `orders:read` (the two reads) and `orders:write` (the
|
|
6070
|
+
write).
|
|
6071
|
+
|
|
5997
6072
|
### Per-Channel Publishing (Categories / Tags / Brands / Custom Fields)
|
|
5998
6073
|
|
|
5999
6074
|
Each of these entities can be **gated per vibe-coded site**: merchants
|
|
@@ -8099,6 +8174,53 @@ was missing 14 real events and still listed 8 fake ones — `coupon.*`,
|
|
|
8099
8174
|
subscribable events. If you're on an older SDK version, upgrade rather than
|
|
8100
8175
|
casting around the type.)
|
|
8101
8176
|
|
|
8177
|
+
### Finishing a purchase that depends on something outside Brainerce
|
|
8178
|
+
|
|
8179
|
+
The common shape: the customer pays, then a third party has to issue the thing
|
|
8180
|
+
they bought — a licence key, a booking reference, a ticket number — and only
|
|
8181
|
+
then can the customer be told what it is. That answer usually arrives seconds
|
|
8182
|
+
after payment, sometimes minutes, and occasionally never.
|
|
8183
|
+
|
|
8184
|
+
Do not hold the order confirmation waiting for it. The confirmation is the
|
|
8185
|
+
receipt for the payment; send it immediately, and deliver the answer in a
|
|
8186
|
+
second email once you have it.
|
|
8187
|
+
|
|
8188
|
+
```typescript
|
|
8189
|
+
// order.paid handler, on YOUR server
|
|
8190
|
+
const key = await someProvider.issue({
|
|
8191
|
+
// Use the order id as the provider's idempotency reference, never a random
|
|
8192
|
+
// one. A retried handler then collides with the original instead of buying
|
|
8193
|
+
// a second key.
|
|
8194
|
+
reference: order.id,
|
|
8195
|
+
});
|
|
8196
|
+
|
|
8197
|
+
await client.setOrderCustomFieldValues(
|
|
8198
|
+
order.id,
|
|
8199
|
+
{ licence_key: key },
|
|
8200
|
+
{ idempotencyKey: `licence-${order.id}` }
|
|
8201
|
+
);
|
|
8202
|
+
|
|
8203
|
+
// Fires ORDER_COMPLETED, which renders the field the line above just wrote.
|
|
8204
|
+
await client.updateOrder(order.id, { status: 'COMPLETED' });
|
|
8205
|
+
```
|
|
8206
|
+
|
|
8207
|
+
Two things this gets you for free:
|
|
8208
|
+
|
|
8209
|
+
- **The failure case has a queue.** If the provider errors, you never mark the
|
|
8210
|
+
order complete, so no email goes out claiming something was delivered. The
|
|
8211
|
+
merchant's list of paid-but-not-completed orders is the list of purchases
|
|
8212
|
+
needing attention, with no extra screen to build.
|
|
8213
|
+
- **The merchant owns the email.** The value renders through their existing
|
|
8214
|
+
`ORDER_COMPLETED` template, in their branding and their language. Add the
|
|
8215
|
+
field to that template once (as `orderCustomFields`) and every future
|
|
8216
|
+
integration reuses it.
|
|
8217
|
+
|
|
8218
|
+
⛔ **Marking an order `COMPLETED` also commits its inventory reservation, and
|
|
8219
|
+
tells the customer the whole order is done.** That is correct for a purely
|
|
8220
|
+
digital order. If the same order also ships a physical item, use a different
|
|
8221
|
+
signal — do not tell someone their parcel is finished because a licence
|
|
8222
|
+
arrived.
|
|
8223
|
+
|
|
8102
8224
|
---
|
|
8103
8225
|
|
|
8104
8226
|
## TypeScript Support
|
|
@@ -8138,6 +8260,8 @@ import type {
|
|
|
8138
8260
|
Order,
|
|
8139
8261
|
OrderStatus,
|
|
8140
8262
|
OrderItem,
|
|
8263
|
+
OrderCustomFieldDefinition,
|
|
8264
|
+
OrderCustomFieldValues,
|
|
8141
8265
|
|
|
8142
8266
|
// Webhooks
|
|
8143
8267
|
WebhookEvent,
|
package/dist/index.d.mts
CHANGED
|
@@ -2381,6 +2381,66 @@ interface CreateOrderDto {
|
|
|
2381
2381
|
interface UpdateOrderDto {
|
|
2382
2382
|
status?: OrderStatus;
|
|
2383
2383
|
}
|
|
2384
|
+
/**
|
|
2385
|
+
* A merchant-defined field that can hold a value on an order.
|
|
2386
|
+
*
|
|
2387
|
+
* These are the fields the STORE manages on an order (`adminFieldValues`), not
|
|
2388
|
+
* the ones a shopper fills in during checkout. They are how an integration
|
|
2389
|
+
* attaches data that only exists after the purchase — a licence key, a booking
|
|
2390
|
+
* reference, a warranty number issued by a third party — to the order it
|
|
2391
|
+
* belongs to. What is written travels to the merchant's own order email
|
|
2392
|
+
* templates as `orderCustomFields`, so the customer can be told without a
|
|
2393
|
+
* bespoke email being built for each integration.
|
|
2394
|
+
*
|
|
2395
|
+
* ⛔ No default template PRINTS it. The merchant adds the block to their
|
|
2396
|
+
* template once; until then a written value is invisible to the customer.
|
|
2397
|
+
*/
|
|
2398
|
+
interface OrderCustomFieldDefinition {
|
|
2399
|
+
id: string;
|
|
2400
|
+
storeId: string;
|
|
2401
|
+
/** Display label. Renders beside the value in order emails. */
|
|
2402
|
+
name: string;
|
|
2403
|
+
/** The property name to use in `setOrderCustomFieldValues`. */
|
|
2404
|
+
key: string;
|
|
2405
|
+
description: string | null;
|
|
2406
|
+
type: 'TEXT' | 'TEXTAREA' | 'NUMBER' | 'BOOLEAN' | 'SELECT' | 'DATE' | 'DATETIME' | 'IMAGE';
|
|
2407
|
+
/** A required field cannot be cleared once it holds a value. */
|
|
2408
|
+
required: boolean;
|
|
2409
|
+
/**
|
|
2410
|
+
* When true the value is exposed to the storefront through the SDK, so the
|
|
2411
|
+
* customer can see it on their own order page and not only in the email.
|
|
2412
|
+
*/
|
|
2413
|
+
isPublic: boolean;
|
|
2414
|
+
position: number;
|
|
2415
|
+
/**
|
|
2416
|
+
* An inactive definition refuses new values but still resolves its label on
|
|
2417
|
+
* orders that already carry one.
|
|
2418
|
+
*/
|
|
2419
|
+
isActive: boolean;
|
|
2420
|
+
/** SELECT only. */
|
|
2421
|
+
options?: Array<{
|
|
2422
|
+
value: string;
|
|
2423
|
+
label: string;
|
|
2424
|
+
}> | null;
|
|
2425
|
+
minLength?: number | null;
|
|
2426
|
+
maxLength?: number | null;
|
|
2427
|
+
minValue?: string | null;
|
|
2428
|
+
maxValue?: string | null;
|
|
2429
|
+
dateAvailability?: unknown;
|
|
2430
|
+
translations?: Record<string, unknown> | null;
|
|
2431
|
+
createdAt: string;
|
|
2432
|
+
updatedAt: string;
|
|
2433
|
+
}
|
|
2434
|
+
/** The custom field values stored on one order, keyed by definition `key`. */
|
|
2435
|
+
interface OrderCustomFieldValues {
|
|
2436
|
+
orderId: string;
|
|
2437
|
+
/**
|
|
2438
|
+
* Values AFTER coercion to each field's type — a NUMBER field written as
|
|
2439
|
+
* `'5'` reads back as `5`. Keys with no matching definition were never
|
|
2440
|
+
* stored and so never appear here.
|
|
2441
|
+
*/
|
|
2442
|
+
fields: Record<string, unknown>;
|
|
2443
|
+
}
|
|
2384
2444
|
interface UpdateInventoryDto {
|
|
2385
2445
|
quantity: number;
|
|
2386
2446
|
variantId?: string;
|
|
@@ -9121,6 +9181,63 @@ declare class BrainerceClient {
|
|
|
9121
9181
|
* Update an order (e.g., change status)
|
|
9122
9182
|
*/
|
|
9123
9183
|
updateOrder(orderId: string, data: UpdateOrderDto): Promise<Order>;
|
|
9184
|
+
/**
|
|
9185
|
+
* List the store's order custom field definitions.
|
|
9186
|
+
*
|
|
9187
|
+
* Call this before writing values: the `key` of each definition is what
|
|
9188
|
+
* {@link setOrderCustomFieldValues} accepts, and `type` is what a value has
|
|
9189
|
+
* to fit. Inactive definitions are included, so you can tell "the merchant
|
|
9190
|
+
* turned this field off" apart from "the merchant never created it".
|
|
9191
|
+
*
|
|
9192
|
+
* Requires an API key with the `orders:read` scope.
|
|
9193
|
+
*/
|
|
9194
|
+
getOrderCustomFieldDefinitions(): Promise<OrderCustomFieldDefinition[]>;
|
|
9195
|
+
/**
|
|
9196
|
+
* Read the custom field values stored on one order.
|
|
9197
|
+
*
|
|
9198
|
+
* Requires an API key with the `orders:read` scope.
|
|
9199
|
+
*/
|
|
9200
|
+
getOrderCustomFieldValues(orderId: string): Promise<OrderCustomFieldValues>;
|
|
9201
|
+
/**
|
|
9202
|
+
* Write custom field values onto an order.
|
|
9203
|
+
*
|
|
9204
|
+
* This is how work that finishes OUTSIDE Brainerce gets back onto the order
|
|
9205
|
+
* it belongs to. Subscribe to the `order.paid` webhook, call whatever third
|
|
9206
|
+
* party issues the thing you sell — a licence key, a booking reference, a
|
|
9207
|
+
* warranty number — then write the answer here. The value travels to the
|
|
9208
|
+
* merchant's own order email templates as `orderCustomFields` and, when the
|
|
9209
|
+
* definition is `isPublic`, to the customer's own order page. No email
|
|
9210
|
+
* template or endpoint has to be built per integration.
|
|
9211
|
+
*
|
|
9212
|
+
* ⛔ No default template PRINTS `orderCustomFields`. The variable reaches
|
|
9213
|
+
* every order email, but until the merchant adds the block to their template
|
|
9214
|
+
* once, a value written here is invisible to the customer. Writing the field
|
|
9215
|
+
* is not the same as the customer being told.
|
|
9216
|
+
*
|
|
9217
|
+
* The write is a MERGE: keys you leave out keep their current value, and
|
|
9218
|
+
* `null` clears a field that is not required. Values are coerced to the
|
|
9219
|
+
* definition's type and rejected with a 400 when they cannot be — but a key
|
|
9220
|
+
* with no active definition on the store is IGNORED rather than failing the
|
|
9221
|
+
* whole call, so read the returned `fields` to confirm what was stored.
|
|
9222
|
+
*
|
|
9223
|
+
* Pass an `idempotencyKey` when the caller may retry: an identical re-send
|
|
9224
|
+
* then replays the original response instead of writing again.
|
|
9225
|
+
*
|
|
9226
|
+
* Requires an API key with the `orders:write` scope.
|
|
9227
|
+
*
|
|
9228
|
+
* @example
|
|
9229
|
+
* ```typescript
|
|
9230
|
+
* // after the third party answered
|
|
9231
|
+
* await client.setOrderCustomFieldValues(
|
|
9232
|
+
* order.id,
|
|
9233
|
+
* { licence_key: 'ABCD-EFGH-IJKL' },
|
|
9234
|
+
* { idempotencyKey: `licence-${order.id}` }
|
|
9235
|
+
* );
|
|
9236
|
+
* // fires the "order completed" email, which carries the field
|
|
9237
|
+
* await client.updateOrder(order.id, { status: 'COMPLETED' });
|
|
9238
|
+
* ```
|
|
9239
|
+
*/
|
|
9240
|
+
setOrderCustomFieldValues(orderId: string, fields: Record<string, unknown>, options?: IdempotentRequestOptions): Promise<OrderCustomFieldValues>;
|
|
9124
9241
|
/**
|
|
9125
9242
|
* Update order status.
|
|
9126
9243
|
*
|
|
@@ -14186,7 +14303,7 @@ declare class BrainerceError extends Error {
|
|
|
14186
14303
|
constructor(message: string, statusCode: number, details?: unknown);
|
|
14187
14304
|
}
|
|
14188
14305
|
|
|
14189
|
-
declare const SDK_VERSION = "2.
|
|
14306
|
+
declare const SDK_VERSION = "2.8.0";
|
|
14190
14307
|
|
|
14191
14308
|
/**
|
|
14192
14309
|
* Verify a webhook signature from Brainerce
|
|
@@ -14687,4 +14804,4 @@ interface CategorySitemapOptions {
|
|
|
14687
14804
|
*/
|
|
14688
14805
|
declare function getCategorySitemapEntries(client: BrainerceClient, opts: CategorySitemapOptions): Promise<SitemapEntry[]>;
|
|
14689
14806
|
|
|
14690
|
-
export { type AddToCartDto, type AddressDetailsResult, type AddressSuggestion, type AiTranslateBulkInput, type AiTranslateBulkResult, type AiTranslateSingleInput, type AnnouncementContent, type AnnouncementSeverity, type AppliedDiscount, type ApplyCouponDto, type AssignTaxClassDto, type AttachModifierGroupInput, type Attribute, type AttributeDisplayType, type AttributeOption, type AttributeSource, type AutoRegionResponse, type AvailabilityClock, type BlogPost, type BlogPostListParams, type BlogPostListResponse, type BlogSitemapOptions, type BrainerceApiError, BrainerceClient, type BrainerceClientOptions, BrainerceError, type Brand, type BulkCreateProductsDto, type BulkCreateProductsError, type BulkCreateProductsJob, type BulkCreateProductsStatus, type BulkInventoryResponse, type BulkSaveVariantsDto, type BulkSaveVariantsResponse, type BulkVariantInput, type BusinessHoursWindow, type Cart, type CartAppliedDiscount, type CartBundleOffer, type CartBundleOfferOfferedProduct, type CartBundlesResponse, type CartIncludeOption, type CartIncludeOptions, type CartItem, type CartItemModifierLine, type CartItemUnavailableReason, type CartNudge, type CartRecommendationsResponse, type CartStatus, type CartUpgradeSuggestion, type CartUpgradesResponse, type CartWithIncludes, type Category, type CategoryDetail, type CategoryNode, type CategorySitemapOptions, type CategorySuggestion, type Checkout, type CheckoutAddress, type CheckoutBumpsResponse, type CheckoutCustomFieldDefinition, type CheckoutFieldPricing, type CheckoutFieldVisibility, type CheckoutLineItem, type CheckoutPrefillData, type CheckoutStatus, type CheckoutTender, type CompleteCheckoutResponse, type CompleteDraftDto, type ConfigureOAuthProviderDto as ConfigureOAuthProviderInput, type ConflictStatus, type ConnectorPlatform, type ContactFormFieldType, type ContactFormFieldValidation, type ContactFormPublic, type ContactFormPublicField, type ContactFormSummary, type Content, type ContentDataMap, type ContentStatus, type ContentSummary, type ContentType, type Coupon, type CouponCreateResponse, type CouponQueryParams, type CouponStatus, type CouponType, type CouponValidationWarning, type CreateAddressDto, type CreateAttributeDto as CreateAttributeInput, type CreateAttributeOptionDto as CreateAttributeOptionInput, type CreateBrandDto as CreateBrandInput, type CreateCategoryDto as CreateCategoryInput, type CreateCheckoutDto, type CreateContentInput, type CreateCouponDto, type CreateCustomerDto, type CreateEmailTemplateDto as CreateEmailTemplateInput, type CreateGuestOrderDto, type CreateInquiryInput, type CreateInquiryResponse, type CreateMetafieldDefinitionDto as CreateMetafieldDefinitionInput, type CreateModifierGroupInput, type CreateModifierInput, type CreateOrderDto, type CreateProductDto, type CreateRefundDto, type CreateRegionDto, type CreateReturnLabelDto as CreateReturnLabelInput, type CreateReturnLabelResponse, type CreateShippingRateDto as CreateShippingRateInput, type CreateShippingZoneDto as CreateShippingZoneInput, type CreateStockAlertInput, type CreateTagDto as CreateTagInput, type CreateTaxClassDto, type CreateTaxRateDto as CreateTaxRateInput, type CreateVariantDto, type Customer, type CustomerAddress, type CustomerAuthResponse, type CustomerOAuthProvider, type CustomerProfile, type CustomerQueryParams, type CustomizationFieldOption, type DateAvailabilityConstraints, type DateAvailabilitySurface, type DateFieldParseResult, type DeleteProductResponse, type DeliveryType, type DiscountBanner, type DiscountRuleType, type DownloadFile, type DraftLineItem, type EditInventoryDto, type EmailDomain, type EmailEventSettings, type EmailEventType, type EmailSettings, type EmailTemplate, type EmailTemplatePreview, type EmailTemplatesResponse, type EmailVerificationResponse, type ExtendReservationResponse, type FaqContent, type FaqItem, type FooterColumn, type FooterContent, type FooterLink, type FooterSocialLink, type FormatPriceOptions, type FormatProductPriceOptions, type FreeAllocationPolicy, type FulfillOrderDto, type GiftCardAdmin, type GiftCardAdminDetail, type GiftCardBalance, type GiftCardLiability, type GiftCardTransaction, type GuestCheckoutStartResponse, type GuestOrderResponse, type HeaderContent, type HeaderCta, type HeaderLogo, type HeaderNavItem, type I18nSettings, type IdempotentRequestOptions, type InsufficientStockError, type InventoryInfo, type InventoryReservationStrategy, type InventorySyncStatus, type InventoryTrackingMode, type InvitationStatus, type InviteMemberDto as InviteMemberInput, type InviteStoreMemberDto as InviteStoreMemberInput, type IssueGiftCardAdminDto, type IssuedGiftCardAdmin, type JsonLdOptions, type ListModifierGroupsParams, type ListNewsletterBenefitGrantsParams, type LocalCart, type LocalCartItem, type LocaleTranslation, type LockedVariant, type LoyaltyBadge, type LoyaltyMembershipPlan, type LoyaltyNextTierSummary, type LoyaltyReward, type LoyaltyRewardRecommendation, type LoyaltyStatus, type LoyaltyTierSummary, type MergeCartsDto, type MetafieldConflict, type MetafieldConflictResolution, type MetafieldDefinition, type MetafieldFilter, type MetafieldFilterValue, type MetafieldFiltersResponse, type MetafieldType, type Modifier, type ModifierGroup, type ModifierSelection, type ModifierSelectionType, type ModifierValidationCode, type ModifierValidationError, type ModifierValidationFailedError, type MyProductReview, type NestedModifierSelection, type NewsletterBenefitDiscountKind, type NewsletterBenefitGrant, type NewsletterBenefitGrantState, type NewsletterBenefitSettings, type OAuthAuthorizeResponse, type OAuthCallbackResponse, type OAuthConnection, type OAuthConnectionsResponse, type OAuthErrorCode, type OAuthProviderConfig, type OAuthProviderType, type OAuthProvidersResponse, type Order, type OrderAddress, type OrderBump, type OrderCustomer, type OrderDownloadLink, type OrderItem, type OrderQueryParams, type OrderStatus, type OrderStatusChange, type PageContent, type PageSeo, type PaginatedResponse, type PaidMembershipInfo, type ParsedDateFieldValue, type PaymentClientSdk, type PaymentConfig, type PaymentIntent, type PaymentProvider, type PaymentProviderConfig, type PaymentProvidersConfig, type PaymentRecordStatus, type PaymentStatus, type PaymentUrlOptions, type PickupLocation, type PlatformCouponCapabilities, type PlatformMetafieldMetadata, type PreviewEmailTemplateDto as PreviewEmailTemplateInput, type PriceDriftError, type Product, type ProductAttributeInput, type ProductAvailability, type ProductCustomizationField, type ProductDiscount, type ProductDiscountBadge, type ProductImage, type ProductInventoryResponse, type ProductMetafield, type ProductMetafieldValue, type ProductModifierGroupAttachment, type ProductQueryParams, type ProductRecommendation, type ProductRecommendationsResponse, type ProductRelationType, type ProductReview, type ProductReviewAdmin, type ProductReviewImage, type ProductReviewImageAdmin, type ProductSitemapOptions, type ProductStatus, type ProductSuggestion, type ProductUnavailableError, type ProductVariant, type PublicMetafieldDefinition, type PublicNewsletterBenefitOffer, type PublicRegion, type PublicRegionDetail, type PublicRegionPaymentProvider, type PublicTaxClass, type PublishProductResponse, RTL_LOCALES, type RecommendationVariant, type ReconcileInventoryResponse, type RedeemRewardResult, type ReferralInfo, type Refund, type RefundLineItem, type RefundLineItemResponse, type RefundType, type Region, type RegionPaymentProvider, type RegisterCustomerDto, type ReissuedGiftCardAdmin, type RelativeDateBounds, type ResendNewsletterBenefitResult, type ReservationInfo, type ResolveMetafieldConflictDto as ResolveMetafieldConflictInput, type ResolveSyncConflictDto as ResolveSyncConflictInput, type ReturnLabelParcel, type ReviewPhotoUpload, type ReviewStatus, type RichTextContent, SDK_VERSION, type SavedPaymentMethodSummary, type SearchSuggestions, type SelectPickupLocationDto, type SelectShippingMethodDto, type SendInvoiceDto, type SessionCartRef, type SetBillingAddressDto, type SetCheckoutCustomFieldsDto, type SetCheckoutCustomerDto, type SetDefinitionProductsDto as SetDefinitionProductsInput, type SetMetafieldPlatformsDto as SetMetafieldPlatformsInput, type SetShippingAddressDto, type SetShippingAddressResponse, type SetTranslationFields, type ShippingDestinations, type ShippingLine, type ShippingRate, type ShippingRateConfig, type ShippingRateType, type ShippingSummaryEntry, type ShippingZone, type ShippingZoneQueryParams, type SitemapEntry, type StockAlertResponse, type StockAvailabilityRequest, type StockAvailabilityResponse, type StockAvailabilityResult, type StoreCapabilities, type StoreInfo, type StoreInvitation, type StoreInvitationDetails, type StoreMember, type StorePermission, type StoreRole, type StoreTeamResponse, type StoreTracking, type StorefrontSavedPaymentMethod, type SubmitProductReviewInput, type SubscribeMarketingInput, type SubscribeMarketingResponse, type SupportedLocaleObject, type SyncConflict, type SyncConflictResolution, type SyncJob, type Tag, type TaxBreakdown, type TaxBreakdownItem, type TaxClass, type TaxEstimateResponse, type TaxRate, type TaxonomyQueryParams, type TeamInvitation, type TeamInvitationsResponse, type TeamMember, type TeamMembersResponse, type TeamRole, type TrackingEventItem, type TrackingEventName, type TrackingEventPayload, type TranslatableEntityType, type TranslationStatusEntry, type TranslationsMap, type UpdateAddressDto, type UpdateAttachmentInput, type UpdateAttributeDto as UpdateAttributeInput, type UpdateAttributeOptionDto as UpdateAttributeOptionInput, type UpdateBrandDto as UpdateBrandInput, type UpdateCartItemDto, type UpdateCategoryDto as UpdateCategoryInput, type UpdateContentInput, type UpdateCouponDto, type UpdateCustomerDto, type UpdateDraftDto, type UpdateEmailSettingsDto as UpdateEmailSettingsInput, type UpdateEmailTemplateDto as UpdateEmailTemplateInput, type UpdateInventoryDto, type UpdateMemberRoleDto as UpdateMemberRoleInput, type UpdateMetafieldDefinitionDto as UpdateMetafieldDefinitionInput, type UpdateModifierGroupInput, type UpdateModifierInput, type UpdateNewsletterBenefitSettingsInput, type UpdateOAuthProviderDto as UpdateOAuthProviderInput, type UpdateOrderDto, type UpdateOrderShippingDto, type UpdateProductDto, type UpdateRegionDto, type UpdateShippingRateDto as UpdateShippingRateInput, type UpdateShippingZoneDto as UpdateShippingZoneInput, type UpdateStoreMemberDto as UpdateStoreMemberInput, type UpdateTagDto as UpdateTagInput, type UpdateTaxClassDto, type UpdateTaxRateDto as UpdateTaxRateInput, type UpdateVariantDto, type UpdateVariantInventoryDto, type UpsellSettings, type UpsertProductMetafieldDto as UpsertProductMetafieldInput, type UserStore, type UserStorePermissions, type VariantInventoryResponse, type VariantPlatformOverlay, type VariantStatus, type WaitForOrderOptions, type WaitForOrderResult, type WebhookEvent, type WebhookEventType, type WriteProductReviewInput, buildArticleJsonLd, buildBreadcrumbJsonLd, buildCollectionPageJsonLd, buildOrganizationJsonLd, buildProductFaqJsonLd, buildProductJsonLd, buildWebsiteJsonLd, computeAvailableSlots, createWebhookHandler, deriveSeoDescription, enableDevGuards, formatMoney, formatPrice, formatProductPrice, formatVariantPrice, getBlogSitemapEntries, getBusinessHoursForDate, getCartItemImage, getCartItemName, getCartTotals, getCategorySitemapEntries, getDescriptionContent, getDirectionForLocale, formatPrice as getPriceDisplay, getProductCustomizationFields, getProductMetafield, getProductMetafieldValue, getProductMetafieldsByType, getProductPrice, getProductPriceInfo, getProductSitemapEntries, getProductSwatches, getStockStatus, getVariantOptions, getVariantPrice, isAllowedPaymentUrl, isCalendarDateAllowed, isCouponApplicableToProduct, isDateValueAllowed, isHtmlDescription, isWebhookEventType, jsonLdScriptProps, parseDateFieldValue, parseWebhookEvent, resolveRelativeBounds, resolveStoreLocalParts, safePaymentRedirect, stripHtml, validateDateAvailabilityConfig, verifyWebhook };
|
|
14807
|
+
export { type AddToCartDto, type AddressDetailsResult, type AddressSuggestion, type AiTranslateBulkInput, type AiTranslateBulkResult, type AiTranslateSingleInput, type AnnouncementContent, type AnnouncementSeverity, type AppliedDiscount, type ApplyCouponDto, type AssignTaxClassDto, type AttachModifierGroupInput, type Attribute, type AttributeDisplayType, type AttributeOption, type AttributeSource, type AutoRegionResponse, type AvailabilityClock, type BlogPost, type BlogPostListParams, type BlogPostListResponse, type BlogSitemapOptions, type BrainerceApiError, BrainerceClient, type BrainerceClientOptions, BrainerceError, type Brand, type BulkCreateProductsDto, type BulkCreateProductsError, type BulkCreateProductsJob, type BulkCreateProductsStatus, type BulkInventoryResponse, type BulkSaveVariantsDto, type BulkSaveVariantsResponse, type BulkVariantInput, type BusinessHoursWindow, type Cart, type CartAppliedDiscount, type CartBundleOffer, type CartBundleOfferOfferedProduct, type CartBundlesResponse, type CartIncludeOption, type CartIncludeOptions, type CartItem, type CartItemModifierLine, type CartItemUnavailableReason, type CartNudge, type CartRecommendationsResponse, type CartStatus, type CartUpgradeSuggestion, type CartUpgradesResponse, type CartWithIncludes, type Category, type CategoryDetail, type CategoryNode, type CategorySitemapOptions, type CategorySuggestion, type Checkout, type CheckoutAddress, type CheckoutBumpsResponse, type CheckoutCustomFieldDefinition, type CheckoutFieldPricing, type CheckoutFieldVisibility, type CheckoutLineItem, type CheckoutPrefillData, type CheckoutStatus, type CheckoutTender, type CompleteCheckoutResponse, type CompleteDraftDto, type ConfigureOAuthProviderDto as ConfigureOAuthProviderInput, type ConflictStatus, type ConnectorPlatform, type ContactFormFieldType, type ContactFormFieldValidation, type ContactFormPublic, type ContactFormPublicField, type ContactFormSummary, type Content, type ContentDataMap, type ContentStatus, type ContentSummary, type ContentType, type Coupon, type CouponCreateResponse, type CouponQueryParams, type CouponStatus, type CouponType, type CouponValidationWarning, type CreateAddressDto, type CreateAttributeDto as CreateAttributeInput, type CreateAttributeOptionDto as CreateAttributeOptionInput, type CreateBrandDto as CreateBrandInput, type CreateCategoryDto as CreateCategoryInput, type CreateCheckoutDto, type CreateContentInput, type CreateCouponDto, type CreateCustomerDto, type CreateEmailTemplateDto as CreateEmailTemplateInput, type CreateGuestOrderDto, type CreateInquiryInput, type CreateInquiryResponse, type CreateMetafieldDefinitionDto as CreateMetafieldDefinitionInput, type CreateModifierGroupInput, type CreateModifierInput, type CreateOrderDto, type CreateProductDto, type CreateRefundDto, type CreateRegionDto, type CreateReturnLabelDto as CreateReturnLabelInput, type CreateReturnLabelResponse, type CreateShippingRateDto as CreateShippingRateInput, type CreateShippingZoneDto as CreateShippingZoneInput, type CreateStockAlertInput, type CreateTagDto as CreateTagInput, type CreateTaxClassDto, type CreateTaxRateDto as CreateTaxRateInput, type CreateVariantDto, type Customer, type CustomerAddress, type CustomerAuthResponse, type CustomerOAuthProvider, type CustomerProfile, type CustomerQueryParams, type CustomizationFieldOption, type DateAvailabilityConstraints, type DateAvailabilitySurface, type DateFieldParseResult, type DeleteProductResponse, type DeliveryType, type DiscountBanner, type DiscountRuleType, type DownloadFile, type DraftLineItem, type EditInventoryDto, type EmailDomain, type EmailEventSettings, type EmailEventType, type EmailSettings, type EmailTemplate, type EmailTemplatePreview, type EmailTemplatesResponse, type EmailVerificationResponse, type ExtendReservationResponse, type FaqContent, type FaqItem, type FooterColumn, type FooterContent, type FooterLink, type FooterSocialLink, type FormatPriceOptions, type FormatProductPriceOptions, type FreeAllocationPolicy, type FulfillOrderDto, type GiftCardAdmin, type GiftCardAdminDetail, type GiftCardBalance, type GiftCardLiability, type GiftCardTransaction, type GuestCheckoutStartResponse, type GuestOrderResponse, type HeaderContent, type HeaderCta, type HeaderLogo, type HeaderNavItem, type I18nSettings, type IdempotentRequestOptions, type InsufficientStockError, type InventoryInfo, type InventoryReservationStrategy, type InventorySyncStatus, type InventoryTrackingMode, type InvitationStatus, type InviteMemberDto as InviteMemberInput, type InviteStoreMemberDto as InviteStoreMemberInput, type IssueGiftCardAdminDto, type IssuedGiftCardAdmin, type JsonLdOptions, type ListModifierGroupsParams, type ListNewsletterBenefitGrantsParams, type LocalCart, type LocalCartItem, type LocaleTranslation, type LockedVariant, type LoyaltyBadge, type LoyaltyMembershipPlan, type LoyaltyNextTierSummary, type LoyaltyReward, type LoyaltyRewardRecommendation, type LoyaltyStatus, type LoyaltyTierSummary, type MergeCartsDto, type MetafieldConflict, type MetafieldConflictResolution, type MetafieldDefinition, type MetafieldFilter, type MetafieldFilterValue, type MetafieldFiltersResponse, type MetafieldType, type Modifier, type ModifierGroup, type ModifierSelection, type ModifierSelectionType, type ModifierValidationCode, type ModifierValidationError, type ModifierValidationFailedError, type MyProductReview, type NestedModifierSelection, type NewsletterBenefitDiscountKind, type NewsletterBenefitGrant, type NewsletterBenefitGrantState, type NewsletterBenefitSettings, type OAuthAuthorizeResponse, type OAuthCallbackResponse, type OAuthConnection, type OAuthConnectionsResponse, type OAuthErrorCode, type OAuthProviderConfig, type OAuthProviderType, type OAuthProvidersResponse, type Order, type OrderAddress, type OrderBump, type OrderCustomFieldDefinition, type OrderCustomFieldValues, type OrderCustomer, type OrderDownloadLink, type OrderItem, type OrderQueryParams, type OrderStatus, type OrderStatusChange, type PageContent, type PageSeo, type PaginatedResponse, type PaidMembershipInfo, type ParsedDateFieldValue, type PaymentClientSdk, type PaymentConfig, type PaymentIntent, type PaymentProvider, type PaymentProviderConfig, type PaymentProvidersConfig, type PaymentRecordStatus, type PaymentStatus, type PaymentUrlOptions, type PickupLocation, type PlatformCouponCapabilities, type PlatformMetafieldMetadata, type PreviewEmailTemplateDto as PreviewEmailTemplateInput, type PriceDriftError, type Product, type ProductAttributeInput, type ProductAvailability, type ProductCustomizationField, type ProductDiscount, type ProductDiscountBadge, type ProductImage, type ProductInventoryResponse, type ProductMetafield, type ProductMetafieldValue, type ProductModifierGroupAttachment, type ProductQueryParams, type ProductRecommendation, type ProductRecommendationsResponse, type ProductRelationType, type ProductReview, type ProductReviewAdmin, type ProductReviewImage, type ProductReviewImageAdmin, type ProductSitemapOptions, type ProductStatus, type ProductSuggestion, type ProductUnavailableError, type ProductVariant, type PublicMetafieldDefinition, type PublicNewsletterBenefitOffer, type PublicRegion, type PublicRegionDetail, type PublicRegionPaymentProvider, type PublicTaxClass, type PublishProductResponse, RTL_LOCALES, type RecommendationVariant, type ReconcileInventoryResponse, type RedeemRewardResult, type ReferralInfo, type Refund, type RefundLineItem, type RefundLineItemResponse, type RefundType, type Region, type RegionPaymentProvider, type RegisterCustomerDto, type ReissuedGiftCardAdmin, type RelativeDateBounds, type ResendNewsletterBenefitResult, type ReservationInfo, type ResolveMetafieldConflictDto as ResolveMetafieldConflictInput, type ResolveSyncConflictDto as ResolveSyncConflictInput, type ReturnLabelParcel, type ReviewPhotoUpload, type ReviewStatus, type RichTextContent, SDK_VERSION, type SavedPaymentMethodSummary, type SearchSuggestions, type SelectPickupLocationDto, type SelectShippingMethodDto, type SendInvoiceDto, type SessionCartRef, type SetBillingAddressDto, type SetCheckoutCustomFieldsDto, type SetCheckoutCustomerDto, type SetDefinitionProductsDto as SetDefinitionProductsInput, type SetMetafieldPlatformsDto as SetMetafieldPlatformsInput, type SetShippingAddressDto, type SetShippingAddressResponse, type SetTranslationFields, type ShippingDestinations, type ShippingLine, type ShippingRate, type ShippingRateConfig, type ShippingRateType, type ShippingSummaryEntry, type ShippingZone, type ShippingZoneQueryParams, type SitemapEntry, type StockAlertResponse, type StockAvailabilityRequest, type StockAvailabilityResponse, type StockAvailabilityResult, type StoreCapabilities, type StoreInfo, type StoreInvitation, type StoreInvitationDetails, type StoreMember, type StorePermission, type StoreRole, type StoreTeamResponse, type StoreTracking, type StorefrontSavedPaymentMethod, type SubmitProductReviewInput, type SubscribeMarketingInput, type SubscribeMarketingResponse, type SupportedLocaleObject, type SyncConflict, type SyncConflictResolution, type SyncJob, type Tag, type TaxBreakdown, type TaxBreakdownItem, type TaxClass, type TaxEstimateResponse, type TaxRate, type TaxonomyQueryParams, type TeamInvitation, type TeamInvitationsResponse, type TeamMember, type TeamMembersResponse, type TeamRole, type TrackingEventItem, type TrackingEventName, type TrackingEventPayload, type TranslatableEntityType, type TranslationStatusEntry, type TranslationsMap, type UpdateAddressDto, type UpdateAttachmentInput, type UpdateAttributeDto as UpdateAttributeInput, type UpdateAttributeOptionDto as UpdateAttributeOptionInput, type UpdateBrandDto as UpdateBrandInput, type UpdateCartItemDto, type UpdateCategoryDto as UpdateCategoryInput, type UpdateContentInput, type UpdateCouponDto, type UpdateCustomerDto, type UpdateDraftDto, type UpdateEmailSettingsDto as UpdateEmailSettingsInput, type UpdateEmailTemplateDto as UpdateEmailTemplateInput, type UpdateInventoryDto, type UpdateMemberRoleDto as UpdateMemberRoleInput, type UpdateMetafieldDefinitionDto as UpdateMetafieldDefinitionInput, type UpdateModifierGroupInput, type UpdateModifierInput, type UpdateNewsletterBenefitSettingsInput, type UpdateOAuthProviderDto as UpdateOAuthProviderInput, type UpdateOrderDto, type UpdateOrderShippingDto, type UpdateProductDto, type UpdateRegionDto, type UpdateShippingRateDto as UpdateShippingRateInput, type UpdateShippingZoneDto as UpdateShippingZoneInput, type UpdateStoreMemberDto as UpdateStoreMemberInput, type UpdateTagDto as UpdateTagInput, type UpdateTaxClassDto, type UpdateTaxRateDto as UpdateTaxRateInput, type UpdateVariantDto, type UpdateVariantInventoryDto, type UpsellSettings, type UpsertProductMetafieldDto as UpsertProductMetafieldInput, type UserStore, type UserStorePermissions, type VariantInventoryResponse, type VariantPlatformOverlay, type VariantStatus, type WaitForOrderOptions, type WaitForOrderResult, type WebhookEvent, type WebhookEventType, type WriteProductReviewInput, buildArticleJsonLd, buildBreadcrumbJsonLd, buildCollectionPageJsonLd, buildOrganizationJsonLd, buildProductFaqJsonLd, buildProductJsonLd, buildWebsiteJsonLd, computeAvailableSlots, createWebhookHandler, deriveSeoDescription, enableDevGuards, formatMoney, formatPrice, formatProductPrice, formatVariantPrice, getBlogSitemapEntries, getBusinessHoursForDate, getCartItemImage, getCartItemName, getCartTotals, getCategorySitemapEntries, getDescriptionContent, getDirectionForLocale, formatPrice as getPriceDisplay, getProductCustomizationFields, getProductMetafield, getProductMetafieldValue, getProductMetafieldsByType, getProductPrice, getProductPriceInfo, getProductSitemapEntries, getProductSwatches, getStockStatus, getVariantOptions, getVariantPrice, isAllowedPaymentUrl, isCalendarDateAllowed, isCouponApplicableToProduct, isDateValueAllowed, isHtmlDescription, isWebhookEventType, jsonLdScriptProps, parseDateFieldValue, parseWebhookEvent, resolveRelativeBounds, resolveStoreLocalParts, safePaymentRedirect, stripHtml, validateDateAvailabilityConfig, verifyWebhook };
|
package/dist/index.d.ts
CHANGED
|
@@ -2381,6 +2381,66 @@ interface CreateOrderDto {
|
|
|
2381
2381
|
interface UpdateOrderDto {
|
|
2382
2382
|
status?: OrderStatus;
|
|
2383
2383
|
}
|
|
2384
|
+
/**
|
|
2385
|
+
* A merchant-defined field that can hold a value on an order.
|
|
2386
|
+
*
|
|
2387
|
+
* These are the fields the STORE manages on an order (`adminFieldValues`), not
|
|
2388
|
+
* the ones a shopper fills in during checkout. They are how an integration
|
|
2389
|
+
* attaches data that only exists after the purchase — a licence key, a booking
|
|
2390
|
+
* reference, a warranty number issued by a third party — to the order it
|
|
2391
|
+
* belongs to. What is written travels to the merchant's own order email
|
|
2392
|
+
* templates as `orderCustomFields`, so the customer can be told without a
|
|
2393
|
+
* bespoke email being built for each integration.
|
|
2394
|
+
*
|
|
2395
|
+
* ⛔ No default template PRINTS it. The merchant adds the block to their
|
|
2396
|
+
* template once; until then a written value is invisible to the customer.
|
|
2397
|
+
*/
|
|
2398
|
+
interface OrderCustomFieldDefinition {
|
|
2399
|
+
id: string;
|
|
2400
|
+
storeId: string;
|
|
2401
|
+
/** Display label. Renders beside the value in order emails. */
|
|
2402
|
+
name: string;
|
|
2403
|
+
/** The property name to use in `setOrderCustomFieldValues`. */
|
|
2404
|
+
key: string;
|
|
2405
|
+
description: string | null;
|
|
2406
|
+
type: 'TEXT' | 'TEXTAREA' | 'NUMBER' | 'BOOLEAN' | 'SELECT' | 'DATE' | 'DATETIME' | 'IMAGE';
|
|
2407
|
+
/** A required field cannot be cleared once it holds a value. */
|
|
2408
|
+
required: boolean;
|
|
2409
|
+
/**
|
|
2410
|
+
* When true the value is exposed to the storefront through the SDK, so the
|
|
2411
|
+
* customer can see it on their own order page and not only in the email.
|
|
2412
|
+
*/
|
|
2413
|
+
isPublic: boolean;
|
|
2414
|
+
position: number;
|
|
2415
|
+
/**
|
|
2416
|
+
* An inactive definition refuses new values but still resolves its label on
|
|
2417
|
+
* orders that already carry one.
|
|
2418
|
+
*/
|
|
2419
|
+
isActive: boolean;
|
|
2420
|
+
/** SELECT only. */
|
|
2421
|
+
options?: Array<{
|
|
2422
|
+
value: string;
|
|
2423
|
+
label: string;
|
|
2424
|
+
}> | null;
|
|
2425
|
+
minLength?: number | null;
|
|
2426
|
+
maxLength?: number | null;
|
|
2427
|
+
minValue?: string | null;
|
|
2428
|
+
maxValue?: string | null;
|
|
2429
|
+
dateAvailability?: unknown;
|
|
2430
|
+
translations?: Record<string, unknown> | null;
|
|
2431
|
+
createdAt: string;
|
|
2432
|
+
updatedAt: string;
|
|
2433
|
+
}
|
|
2434
|
+
/** The custom field values stored on one order, keyed by definition `key`. */
|
|
2435
|
+
interface OrderCustomFieldValues {
|
|
2436
|
+
orderId: string;
|
|
2437
|
+
/**
|
|
2438
|
+
* Values AFTER coercion to each field's type — a NUMBER field written as
|
|
2439
|
+
* `'5'` reads back as `5`. Keys with no matching definition were never
|
|
2440
|
+
* stored and so never appear here.
|
|
2441
|
+
*/
|
|
2442
|
+
fields: Record<string, unknown>;
|
|
2443
|
+
}
|
|
2384
2444
|
interface UpdateInventoryDto {
|
|
2385
2445
|
quantity: number;
|
|
2386
2446
|
variantId?: string;
|
|
@@ -9121,6 +9181,63 @@ declare class BrainerceClient {
|
|
|
9121
9181
|
* Update an order (e.g., change status)
|
|
9122
9182
|
*/
|
|
9123
9183
|
updateOrder(orderId: string, data: UpdateOrderDto): Promise<Order>;
|
|
9184
|
+
/**
|
|
9185
|
+
* List the store's order custom field definitions.
|
|
9186
|
+
*
|
|
9187
|
+
* Call this before writing values: the `key` of each definition is what
|
|
9188
|
+
* {@link setOrderCustomFieldValues} accepts, and `type` is what a value has
|
|
9189
|
+
* to fit. Inactive definitions are included, so you can tell "the merchant
|
|
9190
|
+
* turned this field off" apart from "the merchant never created it".
|
|
9191
|
+
*
|
|
9192
|
+
* Requires an API key with the `orders:read` scope.
|
|
9193
|
+
*/
|
|
9194
|
+
getOrderCustomFieldDefinitions(): Promise<OrderCustomFieldDefinition[]>;
|
|
9195
|
+
/**
|
|
9196
|
+
* Read the custom field values stored on one order.
|
|
9197
|
+
*
|
|
9198
|
+
* Requires an API key with the `orders:read` scope.
|
|
9199
|
+
*/
|
|
9200
|
+
getOrderCustomFieldValues(orderId: string): Promise<OrderCustomFieldValues>;
|
|
9201
|
+
/**
|
|
9202
|
+
* Write custom field values onto an order.
|
|
9203
|
+
*
|
|
9204
|
+
* This is how work that finishes OUTSIDE Brainerce gets back onto the order
|
|
9205
|
+
* it belongs to. Subscribe to the `order.paid` webhook, call whatever third
|
|
9206
|
+
* party issues the thing you sell — a licence key, a booking reference, a
|
|
9207
|
+
* warranty number — then write the answer here. The value travels to the
|
|
9208
|
+
* merchant's own order email templates as `orderCustomFields` and, when the
|
|
9209
|
+
* definition is `isPublic`, to the customer's own order page. No email
|
|
9210
|
+
* template or endpoint has to be built per integration.
|
|
9211
|
+
*
|
|
9212
|
+
* ⛔ No default template PRINTS `orderCustomFields`. The variable reaches
|
|
9213
|
+
* every order email, but until the merchant adds the block to their template
|
|
9214
|
+
* once, a value written here is invisible to the customer. Writing the field
|
|
9215
|
+
* is not the same as the customer being told.
|
|
9216
|
+
*
|
|
9217
|
+
* The write is a MERGE: keys you leave out keep their current value, and
|
|
9218
|
+
* `null` clears a field that is not required. Values are coerced to the
|
|
9219
|
+
* definition's type and rejected with a 400 when they cannot be — but a key
|
|
9220
|
+
* with no active definition on the store is IGNORED rather than failing the
|
|
9221
|
+
* whole call, so read the returned `fields` to confirm what was stored.
|
|
9222
|
+
*
|
|
9223
|
+
* Pass an `idempotencyKey` when the caller may retry: an identical re-send
|
|
9224
|
+
* then replays the original response instead of writing again.
|
|
9225
|
+
*
|
|
9226
|
+
* Requires an API key with the `orders:write` scope.
|
|
9227
|
+
*
|
|
9228
|
+
* @example
|
|
9229
|
+
* ```typescript
|
|
9230
|
+
* // after the third party answered
|
|
9231
|
+
* await client.setOrderCustomFieldValues(
|
|
9232
|
+
* order.id,
|
|
9233
|
+
* { licence_key: 'ABCD-EFGH-IJKL' },
|
|
9234
|
+
* { idempotencyKey: `licence-${order.id}` }
|
|
9235
|
+
* );
|
|
9236
|
+
* // fires the "order completed" email, which carries the field
|
|
9237
|
+
* await client.updateOrder(order.id, { status: 'COMPLETED' });
|
|
9238
|
+
* ```
|
|
9239
|
+
*/
|
|
9240
|
+
setOrderCustomFieldValues(orderId: string, fields: Record<string, unknown>, options?: IdempotentRequestOptions): Promise<OrderCustomFieldValues>;
|
|
9124
9241
|
/**
|
|
9125
9242
|
* Update order status.
|
|
9126
9243
|
*
|
|
@@ -14186,7 +14303,7 @@ declare class BrainerceError extends Error {
|
|
|
14186
14303
|
constructor(message: string, statusCode: number, details?: unknown);
|
|
14187
14304
|
}
|
|
14188
14305
|
|
|
14189
|
-
declare const SDK_VERSION = "2.
|
|
14306
|
+
declare const SDK_VERSION = "2.8.0";
|
|
14190
14307
|
|
|
14191
14308
|
/**
|
|
14192
14309
|
* Verify a webhook signature from Brainerce
|
|
@@ -14687,4 +14804,4 @@ interface CategorySitemapOptions {
|
|
|
14687
14804
|
*/
|
|
14688
14805
|
declare function getCategorySitemapEntries(client: BrainerceClient, opts: CategorySitemapOptions): Promise<SitemapEntry[]>;
|
|
14689
14806
|
|
|
14690
|
-
export { type AddToCartDto, type AddressDetailsResult, type AddressSuggestion, type AiTranslateBulkInput, type AiTranslateBulkResult, type AiTranslateSingleInput, type AnnouncementContent, type AnnouncementSeverity, type AppliedDiscount, type ApplyCouponDto, type AssignTaxClassDto, type AttachModifierGroupInput, type Attribute, type AttributeDisplayType, type AttributeOption, type AttributeSource, type AutoRegionResponse, type AvailabilityClock, type BlogPost, type BlogPostListParams, type BlogPostListResponse, type BlogSitemapOptions, type BrainerceApiError, BrainerceClient, type BrainerceClientOptions, BrainerceError, type Brand, type BulkCreateProductsDto, type BulkCreateProductsError, type BulkCreateProductsJob, type BulkCreateProductsStatus, type BulkInventoryResponse, type BulkSaveVariantsDto, type BulkSaveVariantsResponse, type BulkVariantInput, type BusinessHoursWindow, type Cart, type CartAppliedDiscount, type CartBundleOffer, type CartBundleOfferOfferedProduct, type CartBundlesResponse, type CartIncludeOption, type CartIncludeOptions, type CartItem, type CartItemModifierLine, type CartItemUnavailableReason, type CartNudge, type CartRecommendationsResponse, type CartStatus, type CartUpgradeSuggestion, type CartUpgradesResponse, type CartWithIncludes, type Category, type CategoryDetail, type CategoryNode, type CategorySitemapOptions, type CategorySuggestion, type Checkout, type CheckoutAddress, type CheckoutBumpsResponse, type CheckoutCustomFieldDefinition, type CheckoutFieldPricing, type CheckoutFieldVisibility, type CheckoutLineItem, type CheckoutPrefillData, type CheckoutStatus, type CheckoutTender, type CompleteCheckoutResponse, type CompleteDraftDto, type ConfigureOAuthProviderDto as ConfigureOAuthProviderInput, type ConflictStatus, type ConnectorPlatform, type ContactFormFieldType, type ContactFormFieldValidation, type ContactFormPublic, type ContactFormPublicField, type ContactFormSummary, type Content, type ContentDataMap, type ContentStatus, type ContentSummary, type ContentType, type Coupon, type CouponCreateResponse, type CouponQueryParams, type CouponStatus, type CouponType, type CouponValidationWarning, type CreateAddressDto, type CreateAttributeDto as CreateAttributeInput, type CreateAttributeOptionDto as CreateAttributeOptionInput, type CreateBrandDto as CreateBrandInput, type CreateCategoryDto as CreateCategoryInput, type CreateCheckoutDto, type CreateContentInput, type CreateCouponDto, type CreateCustomerDto, type CreateEmailTemplateDto as CreateEmailTemplateInput, type CreateGuestOrderDto, type CreateInquiryInput, type CreateInquiryResponse, type CreateMetafieldDefinitionDto as CreateMetafieldDefinitionInput, type CreateModifierGroupInput, type CreateModifierInput, type CreateOrderDto, type CreateProductDto, type CreateRefundDto, type CreateRegionDto, type CreateReturnLabelDto as CreateReturnLabelInput, type CreateReturnLabelResponse, type CreateShippingRateDto as CreateShippingRateInput, type CreateShippingZoneDto as CreateShippingZoneInput, type CreateStockAlertInput, type CreateTagDto as CreateTagInput, type CreateTaxClassDto, type CreateTaxRateDto as CreateTaxRateInput, type CreateVariantDto, type Customer, type CustomerAddress, type CustomerAuthResponse, type CustomerOAuthProvider, type CustomerProfile, type CustomerQueryParams, type CustomizationFieldOption, type DateAvailabilityConstraints, type DateAvailabilitySurface, type DateFieldParseResult, type DeleteProductResponse, type DeliveryType, type DiscountBanner, type DiscountRuleType, type DownloadFile, type DraftLineItem, type EditInventoryDto, type EmailDomain, type EmailEventSettings, type EmailEventType, type EmailSettings, type EmailTemplate, type EmailTemplatePreview, type EmailTemplatesResponse, type EmailVerificationResponse, type ExtendReservationResponse, type FaqContent, type FaqItem, type FooterColumn, type FooterContent, type FooterLink, type FooterSocialLink, type FormatPriceOptions, type FormatProductPriceOptions, type FreeAllocationPolicy, type FulfillOrderDto, type GiftCardAdmin, type GiftCardAdminDetail, type GiftCardBalance, type GiftCardLiability, type GiftCardTransaction, type GuestCheckoutStartResponse, type GuestOrderResponse, type HeaderContent, type HeaderCta, type HeaderLogo, type HeaderNavItem, type I18nSettings, type IdempotentRequestOptions, type InsufficientStockError, type InventoryInfo, type InventoryReservationStrategy, type InventorySyncStatus, type InventoryTrackingMode, type InvitationStatus, type InviteMemberDto as InviteMemberInput, type InviteStoreMemberDto as InviteStoreMemberInput, type IssueGiftCardAdminDto, type IssuedGiftCardAdmin, type JsonLdOptions, type ListModifierGroupsParams, type ListNewsletterBenefitGrantsParams, type LocalCart, type LocalCartItem, type LocaleTranslation, type LockedVariant, type LoyaltyBadge, type LoyaltyMembershipPlan, type LoyaltyNextTierSummary, type LoyaltyReward, type LoyaltyRewardRecommendation, type LoyaltyStatus, type LoyaltyTierSummary, type MergeCartsDto, type MetafieldConflict, type MetafieldConflictResolution, type MetafieldDefinition, type MetafieldFilter, type MetafieldFilterValue, type MetafieldFiltersResponse, type MetafieldType, type Modifier, type ModifierGroup, type ModifierSelection, type ModifierSelectionType, type ModifierValidationCode, type ModifierValidationError, type ModifierValidationFailedError, type MyProductReview, type NestedModifierSelection, type NewsletterBenefitDiscountKind, type NewsletterBenefitGrant, type NewsletterBenefitGrantState, type NewsletterBenefitSettings, type OAuthAuthorizeResponse, type OAuthCallbackResponse, type OAuthConnection, type OAuthConnectionsResponse, type OAuthErrorCode, type OAuthProviderConfig, type OAuthProviderType, type OAuthProvidersResponse, type Order, type OrderAddress, type OrderBump, type OrderCustomer, type OrderDownloadLink, type OrderItem, type OrderQueryParams, type OrderStatus, type OrderStatusChange, type PageContent, type PageSeo, type PaginatedResponse, type PaidMembershipInfo, type ParsedDateFieldValue, type PaymentClientSdk, type PaymentConfig, type PaymentIntent, type PaymentProvider, type PaymentProviderConfig, type PaymentProvidersConfig, type PaymentRecordStatus, type PaymentStatus, type PaymentUrlOptions, type PickupLocation, type PlatformCouponCapabilities, type PlatformMetafieldMetadata, type PreviewEmailTemplateDto as PreviewEmailTemplateInput, type PriceDriftError, type Product, type ProductAttributeInput, type ProductAvailability, type ProductCustomizationField, type ProductDiscount, type ProductDiscountBadge, type ProductImage, type ProductInventoryResponse, type ProductMetafield, type ProductMetafieldValue, type ProductModifierGroupAttachment, type ProductQueryParams, type ProductRecommendation, type ProductRecommendationsResponse, type ProductRelationType, type ProductReview, type ProductReviewAdmin, type ProductReviewImage, type ProductReviewImageAdmin, type ProductSitemapOptions, type ProductStatus, type ProductSuggestion, type ProductUnavailableError, type ProductVariant, type PublicMetafieldDefinition, type PublicNewsletterBenefitOffer, type PublicRegion, type PublicRegionDetail, type PublicRegionPaymentProvider, type PublicTaxClass, type PublishProductResponse, RTL_LOCALES, type RecommendationVariant, type ReconcileInventoryResponse, type RedeemRewardResult, type ReferralInfo, type Refund, type RefundLineItem, type RefundLineItemResponse, type RefundType, type Region, type RegionPaymentProvider, type RegisterCustomerDto, type ReissuedGiftCardAdmin, type RelativeDateBounds, type ResendNewsletterBenefitResult, type ReservationInfo, type ResolveMetafieldConflictDto as ResolveMetafieldConflictInput, type ResolveSyncConflictDto as ResolveSyncConflictInput, type ReturnLabelParcel, type ReviewPhotoUpload, type ReviewStatus, type RichTextContent, SDK_VERSION, type SavedPaymentMethodSummary, type SearchSuggestions, type SelectPickupLocationDto, type SelectShippingMethodDto, type SendInvoiceDto, type SessionCartRef, type SetBillingAddressDto, type SetCheckoutCustomFieldsDto, type SetCheckoutCustomerDto, type SetDefinitionProductsDto as SetDefinitionProductsInput, type SetMetafieldPlatformsDto as SetMetafieldPlatformsInput, type SetShippingAddressDto, type SetShippingAddressResponse, type SetTranslationFields, type ShippingDestinations, type ShippingLine, type ShippingRate, type ShippingRateConfig, type ShippingRateType, type ShippingSummaryEntry, type ShippingZone, type ShippingZoneQueryParams, type SitemapEntry, type StockAlertResponse, type StockAvailabilityRequest, type StockAvailabilityResponse, type StockAvailabilityResult, type StoreCapabilities, type StoreInfo, type StoreInvitation, type StoreInvitationDetails, type StoreMember, type StorePermission, type StoreRole, type StoreTeamResponse, type StoreTracking, type StorefrontSavedPaymentMethod, type SubmitProductReviewInput, type SubscribeMarketingInput, type SubscribeMarketingResponse, type SupportedLocaleObject, type SyncConflict, type SyncConflictResolution, type SyncJob, type Tag, type TaxBreakdown, type TaxBreakdownItem, type TaxClass, type TaxEstimateResponse, type TaxRate, type TaxonomyQueryParams, type TeamInvitation, type TeamInvitationsResponse, type TeamMember, type TeamMembersResponse, type TeamRole, type TrackingEventItem, type TrackingEventName, type TrackingEventPayload, type TranslatableEntityType, type TranslationStatusEntry, type TranslationsMap, type UpdateAddressDto, type UpdateAttachmentInput, type UpdateAttributeDto as UpdateAttributeInput, type UpdateAttributeOptionDto as UpdateAttributeOptionInput, type UpdateBrandDto as UpdateBrandInput, type UpdateCartItemDto, type UpdateCategoryDto as UpdateCategoryInput, type UpdateContentInput, type UpdateCouponDto, type UpdateCustomerDto, type UpdateDraftDto, type UpdateEmailSettingsDto as UpdateEmailSettingsInput, type UpdateEmailTemplateDto as UpdateEmailTemplateInput, type UpdateInventoryDto, type UpdateMemberRoleDto as UpdateMemberRoleInput, type UpdateMetafieldDefinitionDto as UpdateMetafieldDefinitionInput, type UpdateModifierGroupInput, type UpdateModifierInput, type UpdateNewsletterBenefitSettingsInput, type UpdateOAuthProviderDto as UpdateOAuthProviderInput, type UpdateOrderDto, type UpdateOrderShippingDto, type UpdateProductDto, type UpdateRegionDto, type UpdateShippingRateDto as UpdateShippingRateInput, type UpdateShippingZoneDto as UpdateShippingZoneInput, type UpdateStoreMemberDto as UpdateStoreMemberInput, type UpdateTagDto as UpdateTagInput, type UpdateTaxClassDto, type UpdateTaxRateDto as UpdateTaxRateInput, type UpdateVariantDto, type UpdateVariantInventoryDto, type UpsellSettings, type UpsertProductMetafieldDto as UpsertProductMetafieldInput, type UserStore, type UserStorePermissions, type VariantInventoryResponse, type VariantPlatformOverlay, type VariantStatus, type WaitForOrderOptions, type WaitForOrderResult, type WebhookEvent, type WebhookEventType, type WriteProductReviewInput, buildArticleJsonLd, buildBreadcrumbJsonLd, buildCollectionPageJsonLd, buildOrganizationJsonLd, buildProductFaqJsonLd, buildProductJsonLd, buildWebsiteJsonLd, computeAvailableSlots, createWebhookHandler, deriveSeoDescription, enableDevGuards, formatMoney, formatPrice, formatProductPrice, formatVariantPrice, getBlogSitemapEntries, getBusinessHoursForDate, getCartItemImage, getCartItemName, getCartTotals, getCategorySitemapEntries, getDescriptionContent, getDirectionForLocale, formatPrice as getPriceDisplay, getProductCustomizationFields, getProductMetafield, getProductMetafieldValue, getProductMetafieldsByType, getProductPrice, getProductPriceInfo, getProductSitemapEntries, getProductSwatches, getStockStatus, getVariantOptions, getVariantPrice, isAllowedPaymentUrl, isCalendarDateAllowed, isCouponApplicableToProduct, isDateValueAllowed, isHtmlDescription, isWebhookEventType, jsonLdScriptProps, parseDateFieldValue, parseWebhookEvent, resolveRelativeBounds, resolveStoreLocalParts, safePaymentRedirect, stripHtml, validateDateAvailabilityConfig, verifyWebhook };
|
|
14807
|
+
export { type AddToCartDto, type AddressDetailsResult, type AddressSuggestion, type AiTranslateBulkInput, type AiTranslateBulkResult, type AiTranslateSingleInput, type AnnouncementContent, type AnnouncementSeverity, type AppliedDiscount, type ApplyCouponDto, type AssignTaxClassDto, type AttachModifierGroupInput, type Attribute, type AttributeDisplayType, type AttributeOption, type AttributeSource, type AutoRegionResponse, type AvailabilityClock, type BlogPost, type BlogPostListParams, type BlogPostListResponse, type BlogSitemapOptions, type BrainerceApiError, BrainerceClient, type BrainerceClientOptions, BrainerceError, type Brand, type BulkCreateProductsDto, type BulkCreateProductsError, type BulkCreateProductsJob, type BulkCreateProductsStatus, type BulkInventoryResponse, type BulkSaveVariantsDto, type BulkSaveVariantsResponse, type BulkVariantInput, type BusinessHoursWindow, type Cart, type CartAppliedDiscount, type CartBundleOffer, type CartBundleOfferOfferedProduct, type CartBundlesResponse, type CartIncludeOption, type CartIncludeOptions, type CartItem, type CartItemModifierLine, type CartItemUnavailableReason, type CartNudge, type CartRecommendationsResponse, type CartStatus, type CartUpgradeSuggestion, type CartUpgradesResponse, type CartWithIncludes, type Category, type CategoryDetail, type CategoryNode, type CategorySitemapOptions, type CategorySuggestion, type Checkout, type CheckoutAddress, type CheckoutBumpsResponse, type CheckoutCustomFieldDefinition, type CheckoutFieldPricing, type CheckoutFieldVisibility, type CheckoutLineItem, type CheckoutPrefillData, type CheckoutStatus, type CheckoutTender, type CompleteCheckoutResponse, type CompleteDraftDto, type ConfigureOAuthProviderDto as ConfigureOAuthProviderInput, type ConflictStatus, type ConnectorPlatform, type ContactFormFieldType, type ContactFormFieldValidation, type ContactFormPublic, type ContactFormPublicField, type ContactFormSummary, type Content, type ContentDataMap, type ContentStatus, type ContentSummary, type ContentType, type Coupon, type CouponCreateResponse, type CouponQueryParams, type CouponStatus, type CouponType, type CouponValidationWarning, type CreateAddressDto, type CreateAttributeDto as CreateAttributeInput, type CreateAttributeOptionDto as CreateAttributeOptionInput, type CreateBrandDto as CreateBrandInput, type CreateCategoryDto as CreateCategoryInput, type CreateCheckoutDto, type CreateContentInput, type CreateCouponDto, type CreateCustomerDto, type CreateEmailTemplateDto as CreateEmailTemplateInput, type CreateGuestOrderDto, type CreateInquiryInput, type CreateInquiryResponse, type CreateMetafieldDefinitionDto as CreateMetafieldDefinitionInput, type CreateModifierGroupInput, type CreateModifierInput, type CreateOrderDto, type CreateProductDto, type CreateRefundDto, type CreateRegionDto, type CreateReturnLabelDto as CreateReturnLabelInput, type CreateReturnLabelResponse, type CreateShippingRateDto as CreateShippingRateInput, type CreateShippingZoneDto as CreateShippingZoneInput, type CreateStockAlertInput, type CreateTagDto as CreateTagInput, type CreateTaxClassDto, type CreateTaxRateDto as CreateTaxRateInput, type CreateVariantDto, type Customer, type CustomerAddress, type CustomerAuthResponse, type CustomerOAuthProvider, type CustomerProfile, type CustomerQueryParams, type CustomizationFieldOption, type DateAvailabilityConstraints, type DateAvailabilitySurface, type DateFieldParseResult, type DeleteProductResponse, type DeliveryType, type DiscountBanner, type DiscountRuleType, type DownloadFile, type DraftLineItem, type EditInventoryDto, type EmailDomain, type EmailEventSettings, type EmailEventType, type EmailSettings, type EmailTemplate, type EmailTemplatePreview, type EmailTemplatesResponse, type EmailVerificationResponse, type ExtendReservationResponse, type FaqContent, type FaqItem, type FooterColumn, type FooterContent, type FooterLink, type FooterSocialLink, type FormatPriceOptions, type FormatProductPriceOptions, type FreeAllocationPolicy, type FulfillOrderDto, type GiftCardAdmin, type GiftCardAdminDetail, type GiftCardBalance, type GiftCardLiability, type GiftCardTransaction, type GuestCheckoutStartResponse, type GuestOrderResponse, type HeaderContent, type HeaderCta, type HeaderLogo, type HeaderNavItem, type I18nSettings, type IdempotentRequestOptions, type InsufficientStockError, type InventoryInfo, type InventoryReservationStrategy, type InventorySyncStatus, type InventoryTrackingMode, type InvitationStatus, type InviteMemberDto as InviteMemberInput, type InviteStoreMemberDto as InviteStoreMemberInput, type IssueGiftCardAdminDto, type IssuedGiftCardAdmin, type JsonLdOptions, type ListModifierGroupsParams, type ListNewsletterBenefitGrantsParams, type LocalCart, type LocalCartItem, type LocaleTranslation, type LockedVariant, type LoyaltyBadge, type LoyaltyMembershipPlan, type LoyaltyNextTierSummary, type LoyaltyReward, type LoyaltyRewardRecommendation, type LoyaltyStatus, type LoyaltyTierSummary, type MergeCartsDto, type MetafieldConflict, type MetafieldConflictResolution, type MetafieldDefinition, type MetafieldFilter, type MetafieldFilterValue, type MetafieldFiltersResponse, type MetafieldType, type Modifier, type ModifierGroup, type ModifierSelection, type ModifierSelectionType, type ModifierValidationCode, type ModifierValidationError, type ModifierValidationFailedError, type MyProductReview, type NestedModifierSelection, type NewsletterBenefitDiscountKind, type NewsletterBenefitGrant, type NewsletterBenefitGrantState, type NewsletterBenefitSettings, type OAuthAuthorizeResponse, type OAuthCallbackResponse, type OAuthConnection, type OAuthConnectionsResponse, type OAuthErrorCode, type OAuthProviderConfig, type OAuthProviderType, type OAuthProvidersResponse, type Order, type OrderAddress, type OrderBump, type OrderCustomFieldDefinition, type OrderCustomFieldValues, type OrderCustomer, type OrderDownloadLink, type OrderItem, type OrderQueryParams, type OrderStatus, type OrderStatusChange, type PageContent, type PageSeo, type PaginatedResponse, type PaidMembershipInfo, type ParsedDateFieldValue, type PaymentClientSdk, type PaymentConfig, type PaymentIntent, type PaymentProvider, type PaymentProviderConfig, type PaymentProvidersConfig, type PaymentRecordStatus, type PaymentStatus, type PaymentUrlOptions, type PickupLocation, type PlatformCouponCapabilities, type PlatformMetafieldMetadata, type PreviewEmailTemplateDto as PreviewEmailTemplateInput, type PriceDriftError, type Product, type ProductAttributeInput, type ProductAvailability, type ProductCustomizationField, type ProductDiscount, type ProductDiscountBadge, type ProductImage, type ProductInventoryResponse, type ProductMetafield, type ProductMetafieldValue, type ProductModifierGroupAttachment, type ProductQueryParams, type ProductRecommendation, type ProductRecommendationsResponse, type ProductRelationType, type ProductReview, type ProductReviewAdmin, type ProductReviewImage, type ProductReviewImageAdmin, type ProductSitemapOptions, type ProductStatus, type ProductSuggestion, type ProductUnavailableError, type ProductVariant, type PublicMetafieldDefinition, type PublicNewsletterBenefitOffer, type PublicRegion, type PublicRegionDetail, type PublicRegionPaymentProvider, type PublicTaxClass, type PublishProductResponse, RTL_LOCALES, type RecommendationVariant, type ReconcileInventoryResponse, type RedeemRewardResult, type ReferralInfo, type Refund, type RefundLineItem, type RefundLineItemResponse, type RefundType, type Region, type RegionPaymentProvider, type RegisterCustomerDto, type ReissuedGiftCardAdmin, type RelativeDateBounds, type ResendNewsletterBenefitResult, type ReservationInfo, type ResolveMetafieldConflictDto as ResolveMetafieldConflictInput, type ResolveSyncConflictDto as ResolveSyncConflictInput, type ReturnLabelParcel, type ReviewPhotoUpload, type ReviewStatus, type RichTextContent, SDK_VERSION, type SavedPaymentMethodSummary, type SearchSuggestions, type SelectPickupLocationDto, type SelectShippingMethodDto, type SendInvoiceDto, type SessionCartRef, type SetBillingAddressDto, type SetCheckoutCustomFieldsDto, type SetCheckoutCustomerDto, type SetDefinitionProductsDto as SetDefinitionProductsInput, type SetMetafieldPlatformsDto as SetMetafieldPlatformsInput, type SetShippingAddressDto, type SetShippingAddressResponse, type SetTranslationFields, type ShippingDestinations, type ShippingLine, type ShippingRate, type ShippingRateConfig, type ShippingRateType, type ShippingSummaryEntry, type ShippingZone, type ShippingZoneQueryParams, type SitemapEntry, type StockAlertResponse, type StockAvailabilityRequest, type StockAvailabilityResponse, type StockAvailabilityResult, type StoreCapabilities, type StoreInfo, type StoreInvitation, type StoreInvitationDetails, type StoreMember, type StorePermission, type StoreRole, type StoreTeamResponse, type StoreTracking, type StorefrontSavedPaymentMethod, type SubmitProductReviewInput, type SubscribeMarketingInput, type SubscribeMarketingResponse, type SupportedLocaleObject, type SyncConflict, type SyncConflictResolution, type SyncJob, type Tag, type TaxBreakdown, type TaxBreakdownItem, type TaxClass, type TaxEstimateResponse, type TaxRate, type TaxonomyQueryParams, type TeamInvitation, type TeamInvitationsResponse, type TeamMember, type TeamMembersResponse, type TeamRole, type TrackingEventItem, type TrackingEventName, type TrackingEventPayload, type TranslatableEntityType, type TranslationStatusEntry, type TranslationsMap, type UpdateAddressDto, type UpdateAttachmentInput, type UpdateAttributeDto as UpdateAttributeInput, type UpdateAttributeOptionDto as UpdateAttributeOptionInput, type UpdateBrandDto as UpdateBrandInput, type UpdateCartItemDto, type UpdateCategoryDto as UpdateCategoryInput, type UpdateContentInput, type UpdateCouponDto, type UpdateCustomerDto, type UpdateDraftDto, type UpdateEmailSettingsDto as UpdateEmailSettingsInput, type UpdateEmailTemplateDto as UpdateEmailTemplateInput, type UpdateInventoryDto, type UpdateMemberRoleDto as UpdateMemberRoleInput, type UpdateMetafieldDefinitionDto as UpdateMetafieldDefinitionInput, type UpdateModifierGroupInput, type UpdateModifierInput, type UpdateNewsletterBenefitSettingsInput, type UpdateOAuthProviderDto as UpdateOAuthProviderInput, type UpdateOrderDto, type UpdateOrderShippingDto, type UpdateProductDto, type UpdateRegionDto, type UpdateShippingRateDto as UpdateShippingRateInput, type UpdateShippingZoneDto as UpdateShippingZoneInput, type UpdateStoreMemberDto as UpdateStoreMemberInput, type UpdateTagDto as UpdateTagInput, type UpdateTaxClassDto, type UpdateTaxRateDto as UpdateTaxRateInput, type UpdateVariantDto, type UpdateVariantInventoryDto, type UpsellSettings, type UpsertProductMetafieldDto as UpsertProductMetafieldInput, type UserStore, type UserStorePermissions, type VariantInventoryResponse, type VariantPlatformOverlay, type VariantStatus, type WaitForOrderOptions, type WaitForOrderResult, type WebhookEvent, type WebhookEventType, type WriteProductReviewInput, buildArticleJsonLd, buildBreadcrumbJsonLd, buildCollectionPageJsonLd, buildOrganizationJsonLd, buildProductFaqJsonLd, buildProductJsonLd, buildWebsiteJsonLd, computeAvailableSlots, createWebhookHandler, deriveSeoDescription, enableDevGuards, formatMoney, formatPrice, formatProductPrice, formatVariantPrice, getBlogSitemapEntries, getBusinessHoursForDate, getCartItemImage, getCartItemName, getCartTotals, getCategorySitemapEntries, getDescriptionContent, getDirectionForLocale, formatPrice as getPriceDisplay, getProductCustomizationFields, getProductMetafield, getProductMetafieldValue, getProductMetafieldsByType, getProductPrice, getProductPriceInfo, getProductSitemapEntries, getProductSwatches, getStockStatus, getVariantOptions, getVariantPrice, isAllowedPaymentUrl, isCalendarDateAllowed, isCouponApplicableToProduct, isDateValueAllowed, isHtmlDescription, isWebhookEventType, jsonLdScriptProps, parseDateFieldValue, parseWebhookEvent, resolveRelativeBounds, resolveStoreLocalParts, safePaymentRedirect, stripHtml, validateDateAvailabilityConfig, verifyWebhook };
|
package/dist/index.js
CHANGED
|
@@ -204,7 +204,7 @@ function isDevGuardsEnabled() {
|
|
|
204
204
|
}
|
|
205
205
|
|
|
206
206
|
// src/version.ts
|
|
207
|
-
var SDK_VERSION = "2.
|
|
207
|
+
var SDK_VERSION = "2.8.0";
|
|
208
208
|
|
|
209
209
|
// src/client.ts
|
|
210
210
|
var DEFAULT_BASE_URL = "https://api.brainerce.com";
|
|
@@ -2961,6 +2961,79 @@ var _BrainerceClient = class _BrainerceClient {
|
|
|
2961
2961
|
async updateOrder(orderId, data) {
|
|
2962
2962
|
return this.request("PATCH", `/api/v1/orders/${encodePathSegment(orderId)}`, data);
|
|
2963
2963
|
}
|
|
2964
|
+
/**
|
|
2965
|
+
* List the store's order custom field definitions.
|
|
2966
|
+
*
|
|
2967
|
+
* Call this before writing values: the `key` of each definition is what
|
|
2968
|
+
* {@link setOrderCustomFieldValues} accepts, and `type` is what a value has
|
|
2969
|
+
* to fit. Inactive definitions are included, so you can tell "the merchant
|
|
2970
|
+
* turned this field off" apart from "the merchant never created it".
|
|
2971
|
+
*
|
|
2972
|
+
* Requires an API key with the `orders:read` scope.
|
|
2973
|
+
*/
|
|
2974
|
+
async getOrderCustomFieldDefinitions() {
|
|
2975
|
+
return this.adminRequest("GET", "/api/v1/order-custom-fields");
|
|
2976
|
+
}
|
|
2977
|
+
/**
|
|
2978
|
+
* Read the custom field values stored on one order.
|
|
2979
|
+
*
|
|
2980
|
+
* Requires an API key with the `orders:read` scope.
|
|
2981
|
+
*/
|
|
2982
|
+
async getOrderCustomFieldValues(orderId) {
|
|
2983
|
+
return this.adminRequest(
|
|
2984
|
+
"GET",
|
|
2985
|
+
`/api/v1/orders/${encodePathSegment(orderId)}/custom-fields`
|
|
2986
|
+
);
|
|
2987
|
+
}
|
|
2988
|
+
/**
|
|
2989
|
+
* Write custom field values onto an order.
|
|
2990
|
+
*
|
|
2991
|
+
* This is how work that finishes OUTSIDE Brainerce gets back onto the order
|
|
2992
|
+
* it belongs to. Subscribe to the `order.paid` webhook, call whatever third
|
|
2993
|
+
* party issues the thing you sell — a licence key, a booking reference, a
|
|
2994
|
+
* warranty number — then write the answer here. The value travels to the
|
|
2995
|
+
* merchant's own order email templates as `orderCustomFields` and, when the
|
|
2996
|
+
* definition is `isPublic`, to the customer's own order page. No email
|
|
2997
|
+
* template or endpoint has to be built per integration.
|
|
2998
|
+
*
|
|
2999
|
+
* ⛔ No default template PRINTS `orderCustomFields`. The variable reaches
|
|
3000
|
+
* every order email, but until the merchant adds the block to their template
|
|
3001
|
+
* once, a value written here is invisible to the customer. Writing the field
|
|
3002
|
+
* is not the same as the customer being told.
|
|
3003
|
+
*
|
|
3004
|
+
* The write is a MERGE: keys you leave out keep their current value, and
|
|
3005
|
+
* `null` clears a field that is not required. Values are coerced to the
|
|
3006
|
+
* definition's type and rejected with a 400 when they cannot be — but a key
|
|
3007
|
+
* with no active definition on the store is IGNORED rather than failing the
|
|
3008
|
+
* whole call, so read the returned `fields` to confirm what was stored.
|
|
3009
|
+
*
|
|
3010
|
+
* Pass an `idempotencyKey` when the caller may retry: an identical re-send
|
|
3011
|
+
* then replays the original response instead of writing again.
|
|
3012
|
+
*
|
|
3013
|
+
* Requires an API key with the `orders:write` scope.
|
|
3014
|
+
*
|
|
3015
|
+
* @example
|
|
3016
|
+
* ```typescript
|
|
3017
|
+
* // after the third party answered
|
|
3018
|
+
* await client.setOrderCustomFieldValues(
|
|
3019
|
+
* order.id,
|
|
3020
|
+
* { licence_key: 'ABCD-EFGH-IJKL' },
|
|
3021
|
+
* { idempotencyKey: `licence-${order.id}` }
|
|
3022
|
+
* );
|
|
3023
|
+
* // fires the "order completed" email, which carries the field
|
|
3024
|
+
* await client.updateOrder(order.id, { status: 'COMPLETED' });
|
|
3025
|
+
* ```
|
|
3026
|
+
*/
|
|
3027
|
+
async setOrderCustomFieldValues(orderId, fields, options) {
|
|
3028
|
+
return this.adminRequest(
|
|
3029
|
+
"PATCH",
|
|
3030
|
+
`/api/v1/orders/${encodePathSegment(orderId)}/custom-fields`,
|
|
3031
|
+
{ fields },
|
|
3032
|
+
void 0,
|
|
3033
|
+
"json",
|
|
3034
|
+
this.idempotencyHeaders(options)
|
|
3035
|
+
);
|
|
3036
|
+
}
|
|
2964
3037
|
/**
|
|
2965
3038
|
* Update order status.
|
|
2966
3039
|
*
|
|
@@ -11267,6 +11340,13 @@ var ALLOWED_PAYMENT_HOSTS = [
|
|
|
11267
11340
|
// reachable, so a terminal configured against it keeps working.
|
|
11268
11341
|
"pay.hyp.co.il",
|
|
11269
11342
|
"icom.yaad.net",
|
|
11343
|
+
// iCredit (ריווחית) — the hosted payment page returned by
|
|
11344
|
+
// PaymentPageRequest. Both environments are listed EXPLICITLY rather than
|
|
11345
|
+
// allowing `rivhit.co.il`: the matcher below also accepts `*.<host>`, so a
|
|
11346
|
+
// bare parent entry would open every Rivhit subdomain (their accounting app,
|
|
11347
|
+
// marketing site, anything they add later) to a payment redirect.
|
|
11348
|
+
"icredit.rivhit.co.il",
|
|
11349
|
+
"testicredit.rivhit.co.il",
|
|
11270
11350
|
// Brainerce-hosted payment embeds (backend payment-embed proxy at
|
|
11271
11351
|
// `/api/payment/embed/...` that fronts provider apps' embed shells —
|
|
11272
11352
|
// e.g. cardcom-payments OpenFields wrapper). The match also covers
|
package/dist/index.mjs
CHANGED
|
@@ -115,7 +115,7 @@ function isDevGuardsEnabled() {
|
|
|
115
115
|
}
|
|
116
116
|
|
|
117
117
|
// src/version.ts
|
|
118
|
-
var SDK_VERSION = "2.
|
|
118
|
+
var SDK_VERSION = "2.8.0";
|
|
119
119
|
|
|
120
120
|
// src/client.ts
|
|
121
121
|
var DEFAULT_BASE_URL = "https://api.brainerce.com";
|
|
@@ -2872,6 +2872,79 @@ var _BrainerceClient = class _BrainerceClient {
|
|
|
2872
2872
|
async updateOrder(orderId, data) {
|
|
2873
2873
|
return this.request("PATCH", `/api/v1/orders/${encodePathSegment(orderId)}`, data);
|
|
2874
2874
|
}
|
|
2875
|
+
/**
|
|
2876
|
+
* List the store's order custom field definitions.
|
|
2877
|
+
*
|
|
2878
|
+
* Call this before writing values: the `key` of each definition is what
|
|
2879
|
+
* {@link setOrderCustomFieldValues} accepts, and `type` is what a value has
|
|
2880
|
+
* to fit. Inactive definitions are included, so you can tell "the merchant
|
|
2881
|
+
* turned this field off" apart from "the merchant never created it".
|
|
2882
|
+
*
|
|
2883
|
+
* Requires an API key with the `orders:read` scope.
|
|
2884
|
+
*/
|
|
2885
|
+
async getOrderCustomFieldDefinitions() {
|
|
2886
|
+
return this.adminRequest("GET", "/api/v1/order-custom-fields");
|
|
2887
|
+
}
|
|
2888
|
+
/**
|
|
2889
|
+
* Read the custom field values stored on one order.
|
|
2890
|
+
*
|
|
2891
|
+
* Requires an API key with the `orders:read` scope.
|
|
2892
|
+
*/
|
|
2893
|
+
async getOrderCustomFieldValues(orderId) {
|
|
2894
|
+
return this.adminRequest(
|
|
2895
|
+
"GET",
|
|
2896
|
+
`/api/v1/orders/${encodePathSegment(orderId)}/custom-fields`
|
|
2897
|
+
);
|
|
2898
|
+
}
|
|
2899
|
+
/**
|
|
2900
|
+
* Write custom field values onto an order.
|
|
2901
|
+
*
|
|
2902
|
+
* This is how work that finishes OUTSIDE Brainerce gets back onto the order
|
|
2903
|
+
* it belongs to. Subscribe to the `order.paid` webhook, call whatever third
|
|
2904
|
+
* party issues the thing you sell — a licence key, a booking reference, a
|
|
2905
|
+
* warranty number — then write the answer here. The value travels to the
|
|
2906
|
+
* merchant's own order email templates as `orderCustomFields` and, when the
|
|
2907
|
+
* definition is `isPublic`, to the customer's own order page. No email
|
|
2908
|
+
* template or endpoint has to be built per integration.
|
|
2909
|
+
*
|
|
2910
|
+
* ⛔ No default template PRINTS `orderCustomFields`. The variable reaches
|
|
2911
|
+
* every order email, but until the merchant adds the block to their template
|
|
2912
|
+
* once, a value written here is invisible to the customer. Writing the field
|
|
2913
|
+
* is not the same as the customer being told.
|
|
2914
|
+
*
|
|
2915
|
+
* The write is a MERGE: keys you leave out keep their current value, and
|
|
2916
|
+
* `null` clears a field that is not required. Values are coerced to the
|
|
2917
|
+
* definition's type and rejected with a 400 when they cannot be — but a key
|
|
2918
|
+
* with no active definition on the store is IGNORED rather than failing the
|
|
2919
|
+
* whole call, so read the returned `fields` to confirm what was stored.
|
|
2920
|
+
*
|
|
2921
|
+
* Pass an `idempotencyKey` when the caller may retry: an identical re-send
|
|
2922
|
+
* then replays the original response instead of writing again.
|
|
2923
|
+
*
|
|
2924
|
+
* Requires an API key with the `orders:write` scope.
|
|
2925
|
+
*
|
|
2926
|
+
* @example
|
|
2927
|
+
* ```typescript
|
|
2928
|
+
* // after the third party answered
|
|
2929
|
+
* await client.setOrderCustomFieldValues(
|
|
2930
|
+
* order.id,
|
|
2931
|
+
* { licence_key: 'ABCD-EFGH-IJKL' },
|
|
2932
|
+
* { idempotencyKey: `licence-${order.id}` }
|
|
2933
|
+
* );
|
|
2934
|
+
* // fires the "order completed" email, which carries the field
|
|
2935
|
+
* await client.updateOrder(order.id, { status: 'COMPLETED' });
|
|
2936
|
+
* ```
|
|
2937
|
+
*/
|
|
2938
|
+
async setOrderCustomFieldValues(orderId, fields, options) {
|
|
2939
|
+
return this.adminRequest(
|
|
2940
|
+
"PATCH",
|
|
2941
|
+
`/api/v1/orders/${encodePathSegment(orderId)}/custom-fields`,
|
|
2942
|
+
{ fields },
|
|
2943
|
+
void 0,
|
|
2944
|
+
"json",
|
|
2945
|
+
this.idempotencyHeaders(options)
|
|
2946
|
+
);
|
|
2947
|
+
}
|
|
2875
2948
|
/**
|
|
2876
2949
|
* Update order status.
|
|
2877
2950
|
*
|
|
@@ -11178,6 +11251,13 @@ var ALLOWED_PAYMENT_HOSTS = [
|
|
|
11178
11251
|
// reachable, so a terminal configured against it keeps working.
|
|
11179
11252
|
"pay.hyp.co.il",
|
|
11180
11253
|
"icom.yaad.net",
|
|
11254
|
+
// iCredit (ריווחית) — the hosted payment page returned by
|
|
11255
|
+
// PaymentPageRequest. Both environments are listed EXPLICITLY rather than
|
|
11256
|
+
// allowing `rivhit.co.il`: the matcher below also accepts `*.<host>`, so a
|
|
11257
|
+
// bare parent entry would open every Rivhit subdomain (their accounting app,
|
|
11258
|
+
// marketing site, anything they add later) to a payment redirect.
|
|
11259
|
+
"icredit.rivhit.co.il",
|
|
11260
|
+
"testicredit.rivhit.co.il",
|
|
11181
11261
|
// Brainerce-hosted payment embeds (backend payment-embed proxy at
|
|
11182
11262
|
// `/api/payment/embed/...` that fronts provider apps' embed shells —
|
|
11183
11263
|
// e.g. cardcom-payments OpenFields wrapper). The match also covers
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "brainerce",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.8.0",
|
|
4
4
|
"description": "Official SDK for building e-commerce storefronts with Brainerce Platform. Perfect for vibe-coded sites, AI-built stores (Cursor, Lovable, v0), and custom storefronts.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.mjs",
|