brainerce 1.18.0 → 1.20.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 +21 -2
- package/dist/index.d.mts +117 -1
- package/dist/index.d.ts +117 -1
- package/dist/index.js +58 -4
- package/dist/index.mjs +58 -4
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -119,7 +119,7 @@ const { data: products } = await client.getProducts();
|
|
|
119
119
|
|
|
120
120
|
### Product customization fields (buyer input)
|
|
121
121
|
|
|
122
|
-
Products can expose `customizationFields` — merchant-defined inputs the buyer fills on the product page (engraving text, photo upload, select / multi-select options, date pickers, etc.). Render the form from the array, upload any images via `uploadCustomizationFile()`, then pass values as `metadata` on add-to-cart. The server validates and snapshots everything onto the order line.
|
|
122
|
+
Products can expose `customizationFields` — merchant-defined inputs the buyer fills on the product page (engraving text, photo upload, select / multi-select options, date pickers, etc.). Render the form from the array, upload any images via `uploadCustomizationFile()`, then pass values as `metadata` on add-to-cart. The server validates and snapshots everything onto the order line. Definitions flagged `appliesToAllProducts: true` are folded into every product's `customizationFields` automatically — no client-side merging required.
|
|
123
123
|
|
|
124
124
|
```typescript
|
|
125
125
|
if (product.customizationFields?.length) {
|
|
@@ -4176,6 +4176,25 @@ try {
|
|
|
4176
4176
|
|
|
4177
4177
|
---
|
|
4178
4178
|
|
|
4179
|
+
## Contact Inquiries
|
|
4180
|
+
|
|
4181
|
+
Submit contact-form messages from your storefront. Inquiries show up for the merchant at `Customers → Inquiries` in the dashboard; the merchant's reply is emailed back to the customer.
|
|
4182
|
+
|
|
4183
|
+
```typescript
|
|
4184
|
+
await brainerce.createInquiry({
|
|
4185
|
+
name: 'Jane Doe',
|
|
4186
|
+
email: 'jane@example.com',
|
|
4187
|
+
subject: 'Do you ship to Canada?',
|
|
4188
|
+
message: 'Hi, I had a question about delivery...',
|
|
4189
|
+
phone: '+1-555-0100', // optional
|
|
4190
|
+
});
|
|
4191
|
+
// → { id, status: 'NEW', createdAt }
|
|
4192
|
+
```
|
|
4193
|
+
|
|
4194
|
+
**Rate limit:** 3 submissions per 60 seconds per IP. Include a hidden honeypot field (and do not submit it) — bots that auto-fill every input will be rejected.
|
|
4195
|
+
|
|
4196
|
+
---
|
|
4197
|
+
|
|
4179
4198
|
## Webhooks
|
|
4180
4199
|
|
|
4181
4200
|
Receive real-time updates when products, orders, or inventory change.
|
|
@@ -4308,7 +4327,7 @@ When building a store, implement these pages:
|
|
|
4308
4327
|
- [ ] **Register** (`/register`) - Customer registration + social signup buttons
|
|
4309
4328
|
- [ ] **Auth Callback** (`/auth/callback`) - Handle OAuth redirects from Google/Facebook/GitHub
|
|
4310
4329
|
- [ ] **Verify Email** (`/verify-email`) - Email verification with 6-digit code (if store requires it)
|
|
4311
|
-
- [ ] **Account** (`/account`) - Profile and order history
|
|
4330
|
+
- [ ] **Account** (`/account`) - Profile, addresses, and full order history (per-item customizations, shipping & tracking, payment status, status timeline)
|
|
4312
4331
|
|
|
4313
4332
|
### ⚠️ Payment Page is REQUIRED
|
|
4314
4333
|
|
package/dist/index.d.mts
CHANGED
|
@@ -895,6 +895,32 @@ interface Order {
|
|
|
895
895
|
/** Tax amount */
|
|
896
896
|
taxAmount?: string | null;
|
|
897
897
|
createdAt: string;
|
|
898
|
+
/** Payment method used (e.g., "card", "paypal", "cash_on_delivery"). */
|
|
899
|
+
paymentMethod?: string | null;
|
|
900
|
+
/** Financial status: "pending", "paid", "refunded", "partially_refunded", "voided". */
|
|
901
|
+
financialStatus?: string | null;
|
|
902
|
+
/** Fulfillment status: "unfulfilled", "partial", "fulfilled". */
|
|
903
|
+
fulfillmentStatus?: string | null;
|
|
904
|
+
/** Tracking number, e.g., "1Z999AA10123456784". */
|
|
905
|
+
trackingNumber?: string | null;
|
|
906
|
+
/** Deep link to the carrier's tracking page. */
|
|
907
|
+
trackingUrl?: string | null;
|
|
908
|
+
/** Carrier name, e.g., "UPS", "USPS", "DHL". */
|
|
909
|
+
carrier?: string | null;
|
|
910
|
+
/** ISO-8601 timestamp when the order was shipped. */
|
|
911
|
+
shippedAt?: string | null;
|
|
912
|
+
/** ISO-8601 timestamp when the order was delivered. */
|
|
913
|
+
deliveredAt?: string | null;
|
|
914
|
+
/** Status timeline entries in chronological order. */
|
|
915
|
+
statusHistory?: OrderStatusChange[] | null;
|
|
916
|
+
}
|
|
917
|
+
/** One status transition on an order. */
|
|
918
|
+
interface OrderStatusChange {
|
|
919
|
+
status: OrderStatus;
|
|
920
|
+
/** ISO-8601 timestamp of the transition. */
|
|
921
|
+
at: string;
|
|
922
|
+
/** Optional note (why the status changed). */
|
|
923
|
+
note?: string | null;
|
|
898
924
|
}
|
|
899
925
|
/**
|
|
900
926
|
* Order status values are **lowercase**.
|
|
@@ -3177,6 +3203,13 @@ interface MetafieldDefinition {
|
|
|
3177
3203
|
description?: string | null;
|
|
3178
3204
|
type: MetafieldType;
|
|
3179
3205
|
required: boolean;
|
|
3206
|
+
isCustomerInput?: boolean;
|
|
3207
|
+
/**
|
|
3208
|
+
* When `true`, the field is treated as present on every product of this
|
|
3209
|
+
* account — including products created later. Clients don't need to list
|
|
3210
|
+
* individual `ProductCustomizationField` rows when this is set.
|
|
3211
|
+
*/
|
|
3212
|
+
appliesToAllProducts?: boolean;
|
|
3180
3213
|
minLength?: number | null;
|
|
3181
3214
|
maxLength?: number | null;
|
|
3182
3215
|
minValue?: number | null;
|
|
@@ -3186,6 +3219,11 @@ interface MetafieldDefinition {
|
|
|
3186
3219
|
position: number;
|
|
3187
3220
|
isActive: boolean;
|
|
3188
3221
|
mappings?: MetafieldPlatformMapping[];
|
|
3222
|
+
/** Products this definition is explicitly attached to (customer-input only). */
|
|
3223
|
+
products?: Array<{
|
|
3224
|
+
id: string;
|
|
3225
|
+
name: string;
|
|
3226
|
+
}>;
|
|
3189
3227
|
createdAt: string;
|
|
3190
3228
|
updatedAt: string;
|
|
3191
3229
|
}
|
|
@@ -3201,6 +3239,11 @@ interface PublicMetafieldDefinition {
|
|
|
3201
3239
|
type: MetafieldType;
|
|
3202
3240
|
required: boolean;
|
|
3203
3241
|
isCustomerInput?: boolean;
|
|
3242
|
+
/**
|
|
3243
|
+
* When true, this definition applies to every product of the account —
|
|
3244
|
+
* including ones created after the flag was set.
|
|
3245
|
+
*/
|
|
3246
|
+
appliesToAllProducts?: boolean;
|
|
3204
3247
|
enumValues?: string[];
|
|
3205
3248
|
minLength?: number | null;
|
|
3206
3249
|
maxLength?: number | null;
|
|
@@ -3247,6 +3290,14 @@ interface CreateMetafieldDefinitionDto {
|
|
|
3247
3290
|
description?: string;
|
|
3248
3291
|
type?: MetafieldType;
|
|
3249
3292
|
required?: boolean;
|
|
3293
|
+
isCustomerInput?: boolean;
|
|
3294
|
+
/** When true the field applies to every product in the account. */
|
|
3295
|
+
appliesToAllProducts?: boolean;
|
|
3296
|
+
/**
|
|
3297
|
+
* Assign the new (customer-input) definition to specific products atomically
|
|
3298
|
+
* in the same create call. Only valid when `isCustomerInput` is true.
|
|
3299
|
+
*/
|
|
3300
|
+
productIds?: string[];
|
|
3250
3301
|
minLength?: number;
|
|
3251
3302
|
maxLength?: number;
|
|
3252
3303
|
minValue?: number;
|
|
@@ -3260,6 +3311,8 @@ interface UpdateMetafieldDefinitionDto {
|
|
|
3260
3311
|
description?: string | null;
|
|
3261
3312
|
type?: MetafieldType;
|
|
3262
3313
|
required?: boolean;
|
|
3314
|
+
isCustomerInput?: boolean;
|
|
3315
|
+
appliesToAllProducts?: boolean;
|
|
3263
3316
|
minLength?: number | null;
|
|
3264
3317
|
maxLength?: number | null;
|
|
3265
3318
|
minValue?: number | null;
|
|
@@ -3269,6 +3322,16 @@ interface UpdateMetafieldDefinitionDto {
|
|
|
3269
3322
|
position?: number;
|
|
3270
3323
|
isActive?: boolean;
|
|
3271
3324
|
}
|
|
3325
|
+
/**
|
|
3326
|
+
* Set (replace with diff-scoped semantics) the list of products linked to a
|
|
3327
|
+
* single customer-input metafield definition. Passing an empty array detaches
|
|
3328
|
+
* the definition from every product.
|
|
3329
|
+
*/
|
|
3330
|
+
interface SetDefinitionProductsDto {
|
|
3331
|
+
productIds: string[];
|
|
3332
|
+
/** Optionally flip the `appliesToAllProducts` flag in the same call. */
|
|
3333
|
+
appliesToAllProducts?: boolean;
|
|
3334
|
+
}
|
|
3272
3335
|
/**
|
|
3273
3336
|
* Product metafield value
|
|
3274
3337
|
*/
|
|
@@ -3788,6 +3851,20 @@ type CheckoutFieldPricing = {
|
|
|
3788
3851
|
interface SetCheckoutCustomFieldsDto {
|
|
3789
3852
|
fields: Record<string, unknown>;
|
|
3790
3853
|
}
|
|
3854
|
+
interface CreateInquiryInput {
|
|
3855
|
+
name: string;
|
|
3856
|
+
email: string;
|
|
3857
|
+
subject: string;
|
|
3858
|
+
message: string;
|
|
3859
|
+
phone?: string;
|
|
3860
|
+
customerId?: string;
|
|
3861
|
+
metadata?: Record<string, unknown>;
|
|
3862
|
+
}
|
|
3863
|
+
interface CreateInquiryResponse {
|
|
3864
|
+
id: string;
|
|
3865
|
+
status: 'NEW';
|
|
3866
|
+
createdAt: string;
|
|
3867
|
+
}
|
|
3791
3868
|
interface BrainerceApiError {
|
|
3792
3869
|
statusCode: number;
|
|
3793
3870
|
message: string;
|
|
@@ -4901,6 +4978,25 @@ declare class BrainerceClient {
|
|
|
4901
4978
|
page?: number;
|
|
4902
4979
|
limit?: number;
|
|
4903
4980
|
}): Promise<PaginatedResponse<Order>>;
|
|
4981
|
+
/**
|
|
4982
|
+
* Submit a contact inquiry from a storefront contact form.
|
|
4983
|
+
*
|
|
4984
|
+
* Storefront (public) mode only. Rate-limited to 3 requests / 60 seconds
|
|
4985
|
+
* per IP on the server. Include an empty `honeypot` field on your form
|
|
4986
|
+
* and do NOT send it — bots that auto-fill every input will be rejected.
|
|
4987
|
+
*
|
|
4988
|
+
* @example
|
|
4989
|
+
* ```typescript
|
|
4990
|
+
* await brainerce.createInquiry({
|
|
4991
|
+
* name: 'Jane Doe',
|
|
4992
|
+
* email: 'jane@example.com',
|
|
4993
|
+
* subject: 'Question about shipping',
|
|
4994
|
+
* message: 'Do you ship to Canada?',
|
|
4995
|
+
* phone: '+1-555-0100',
|
|
4996
|
+
* });
|
|
4997
|
+
* ```
|
|
4998
|
+
*/
|
|
4999
|
+
createInquiry(input: CreateInquiryInput): Promise<CreateInquiryResponse>;
|
|
4904
5000
|
/**
|
|
4905
5001
|
* Create a new cart for a guest user
|
|
4906
5002
|
* Returns a cart with a sessionToken that identifies this cart
|
|
@@ -6711,6 +6807,26 @@ declare class BrainerceClient {
|
|
|
6711
6807
|
* Requires Admin mode (apiKey)
|
|
6712
6808
|
*/
|
|
6713
6809
|
deleteMetafieldDefinition(definitionId: string): Promise<void>;
|
|
6810
|
+
/**
|
|
6811
|
+
* Replace the list of products a (customer-input) metafield definition is
|
|
6812
|
+
* attached to. Diff-scoped: only rows for this definition are touched, so
|
|
6813
|
+
* concurrent edits to other definitions on the same product are safe.
|
|
6814
|
+
*
|
|
6815
|
+
* Optionally toggles `appliesToAllProducts` in the same call. When that
|
|
6816
|
+
* flag is true the `productIds` list is still respected as the explicit
|
|
6817
|
+
* subset, but buyers will see the field on every product regardless.
|
|
6818
|
+
*
|
|
6819
|
+
* Requires Admin mode (apiKey).
|
|
6820
|
+
*
|
|
6821
|
+
* @example
|
|
6822
|
+
* ```typescript
|
|
6823
|
+
* await client.setDefinitionProducts('def_123', {
|
|
6824
|
+
* productIds: ['prod_a', 'prod_b'],
|
|
6825
|
+
* appliesToAllProducts: false,
|
|
6826
|
+
* });
|
|
6827
|
+
* ```
|
|
6828
|
+
*/
|
|
6829
|
+
setDefinitionProducts(definitionId: string, data: SetDefinitionProductsDto): Promise<MetafieldDefinition>;
|
|
6714
6830
|
/**
|
|
6715
6831
|
* Get all metafield values for a product
|
|
6716
6832
|
* Requires Admin mode (apiKey)
|
|
@@ -7100,4 +7216,4 @@ declare function enableDevGuards(options?: {
|
|
|
7100
7216
|
force?: boolean;
|
|
7101
7217
|
}): void;
|
|
7102
7218
|
|
|
7103
|
-
export { type AddToCartDto, type AppliedDiscount, type ApplyCouponDto, type Attribute, type AttributeOption, type AttributeSource, type BrainerceApiError, BrainerceClient, type BrainerceClientOptions, BrainerceError, type Brand, type BulkInventoryResponse, type BulkSaveVariantsDto, type BulkSaveVariantsResponse, type BulkVariantInput, type Cart, type CartAppliedDiscount, type CartBundleOffer, type CartBundlesResponse, type CartIncludeOption, type CartIncludeOptions, type CartItem, type CartNudge, type CartRecommendationsResponse, type CartStatus, type CartUpgradeSuggestion, type CartUpgradesResponse, type CartWithIncludes, type Category, type CategoryNode, type CategorySuggestion, type Checkout, type CheckoutAddress, type CheckoutBumpsResponse, type CheckoutCustomFieldDefinition, type CheckoutFieldPricing, type CheckoutFieldVisibility, type CheckoutLineItem, type CheckoutPrefillData, type CheckoutStatus, type CompleteCheckoutResponse, type CompleteDraftDto, type ConfigureOAuthProviderDto as ConfigureOAuthProviderInput, type ConflictStatus, type ConnectorPlatform, 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 CreateCouponDto, type CreateCustomApiDto, type CreateCustomerDto, type CreateEmailTemplateDto as CreateEmailTemplateInput, type CreateGuestOrderDto, type CreateMetafieldDefinitionDto as CreateMetafieldDefinitionInput, type CreateOrderDto, type CreateProductDto, type CreateRefundDto, type CreateShippingRateDto as CreateShippingRateInput, type CreateShippingZoneDto as CreateShippingZoneInput, type CreateTagDto as CreateTagInput, type CreateTaxRateDto as CreateTaxRateInput, type CreateVariantDto, type CustomApiAuthType, type CustomApiConnectionStatus, type CustomApiCredentials, type CustomApiIntegration, type CustomApiSyncConfig, type CustomApiSyncDirection, type CustomApiTestResult, type Customer, type CustomerAddress, type CustomerAuthResponse, type CustomerOAuthProvider, type CustomerProfile, type CustomerQueryParams, type DeleteProductResponse, 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 FormatPriceOptions, type FulfillOrderDto, type GuestCheckoutStartResponse, type GuestOrderResponse, type InsufficientStockError, type InventoryInfo, type InventoryReservationStrategy, type InventorySyncStatus, type InventoryTrackingMode, type InvitationStatus, type InviteMemberDto as InviteMemberInput, type InviteStoreMemberDto as InviteStoreMemberInput, type LocalCart, type LocalCartItem, type LockedVariant, type MergeCartsDto, type MetafieldConflict, type MetafieldConflictResolution, type MetafieldDefinition, type MetafieldPlatformMapping, type MetafieldType, type OAuthAuthorizeResponse, type OAuthCallbackResponse, type OAuthConnection, type OAuthConnectionsResponse, type OAuthProviderConfig, type OAuthProviderType, type OAuthProvidersResponse, type Order, type OrderAddress, type OrderBump, type OrderCustomer, type OrderDownloadLink, type OrderItem, type OrderQueryParams, type OrderStatus, type PaginatedResponse, type PaymentClientSdk, type PaymentConfig, type PaymentIntent, type PaymentProvider, type PaymentProviderConfig, type PaymentProvidersConfig, type PaymentStatus, type PickupLocation, type PlatformCouponCapabilities, type PreviewEmailTemplateDto as PreviewEmailTemplateInput, type Product, type ProductAttributeInput, type ProductAvailability, type ProductCustomizationField, type ProductDiscount, type ProductDiscountBadge, type ProductImage, type ProductMetafield, type ProductMetafieldValue, type ProductQueryParams, type ProductRecommendation, type ProductRecommendationsResponse, type ProductRelationType, type ProductSuggestion, type ProductVariant, type PublicMetafieldDefinition, type PublishProductResponse, type RecommendationVariant, type ReconcileInventoryResponse, type Refund, type RefundLineItem, type RefundLineItemResponse, type RefundType, type RegisterCustomerDto, type ReservationInfo, type ResolveMetafieldConflictDto as ResolveMetafieldConflictInput, type ResolveSyncConflictDto as ResolveSyncConflictInput, SDK_VERSION, type SearchSuggestions, type SelectPickupLocationDto, type SelectShippingMethodDto, type SendInvoiceDto, type SessionCartRef, type SetBillingAddressDto, type SetCheckoutCustomFieldsDto, type SetCheckoutCustomerDto, type SetShippingAddressDto, type SetShippingAddressResponse, type ShippingDestinations, type ShippingLine, type ShippingRate, type ShippingRateConfig, type ShippingRateType, type ShippingZone, type ShippingZoneQueryParams, type StockAvailabilityRequest, type StockAvailabilityResponse, type StockAvailabilityResult, type StoreInfo, type StoreInvitation, type StoreInvitationDetails, type StoreMember, type StorePermission, type StoreRole, type StoreTeamResponse, type SyncConflict, type SyncConflictResolution, type SyncJob, type Tag, type TaxBreakdown, type TaxBreakdownItem, type TaxRate, type TaxonomyQueryParams, type TeamInvitation, type TeamInvitationsResponse, type TeamMember, type TeamMembersResponse, type TeamRole, type UpdateAddressDto, type UpdateAttributeDto as UpdateAttributeInput, type UpdateAttributeOptionDto as UpdateAttributeOptionInput, type UpdateBrandDto as UpdateBrandInput, type UpdateCartItemDto, type UpdateCategoryDto as UpdateCategoryInput, type UpdateCouponDto, type UpdateCustomApiDto, type UpdateCustomerDto, type UpdateDraftDto, type UpdateEmailSettingsDto as UpdateEmailSettingsInput, type UpdateEmailTemplateDto as UpdateEmailTemplateInput, type UpdateInventoryDto, type UpdateMemberRoleDto as UpdateMemberRoleInput, type UpdateMetafieldDefinitionDto as UpdateMetafieldDefinitionInput, type UpdateOAuthProviderDto as UpdateOAuthProviderInput, type UpdateOrderDto, type UpdateOrderShippingDto, type UpdateProductDto, type UpdateShippingRateDto as UpdateShippingRateInput, type UpdateShippingZoneDto as UpdateShippingZoneInput, type UpdateStoreMemberDto as UpdateStoreMemberInput, type UpdateTagDto as UpdateTagInput, type UpdateTaxRateDto as UpdateTaxRateInput, type UpdateVariantDto, type UpdateVariantInventoryDto, type UpsertProductMetafieldDto as UpsertProductMetafieldInput, type UserStore, type UserStorePermissions, type VariantInventoryResponse, type VariantPlatformOverlay, type VariantStatus, type WaitForOrderOptions, type WaitForOrderResult, type WebhookEvent, type WebhookEventType, createWebhookHandler, enableDevGuards, formatPrice, getCartItemImage, getCartItemName, getCartTotals, getDescriptionContent, formatPrice as getPriceDisplay, getProductCustomizationFields, getProductMetafield, getProductMetafieldValue, getProductMetafieldsByType, getProductPrice, getProductPriceInfo, getProductSwatches, getStockStatus, getVariantOptions, getVariantPrice, isCouponApplicableToProduct, isHtmlDescription, isWebhookEventType, parseWebhookEvent, verifyWebhook };
|
|
7219
|
+
export { type AddToCartDto, type AppliedDiscount, type ApplyCouponDto, type Attribute, type AttributeOption, type AttributeSource, type BrainerceApiError, BrainerceClient, type BrainerceClientOptions, BrainerceError, type Brand, type BulkInventoryResponse, type BulkSaveVariantsDto, type BulkSaveVariantsResponse, type BulkVariantInput, type Cart, type CartAppliedDiscount, type CartBundleOffer, type CartBundlesResponse, type CartIncludeOption, type CartIncludeOptions, type CartItem, type CartNudge, type CartRecommendationsResponse, type CartStatus, type CartUpgradeSuggestion, type CartUpgradesResponse, type CartWithIncludes, type Category, type CategoryNode, type CategorySuggestion, type Checkout, type CheckoutAddress, type CheckoutBumpsResponse, type CheckoutCustomFieldDefinition, type CheckoutFieldPricing, type CheckoutFieldVisibility, type CheckoutLineItem, type CheckoutPrefillData, type CheckoutStatus, type CompleteCheckoutResponse, type CompleteDraftDto, type ConfigureOAuthProviderDto as ConfigureOAuthProviderInput, type ConflictStatus, type ConnectorPlatform, 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 CreateCouponDto, type CreateCustomApiDto, type CreateCustomerDto, type CreateEmailTemplateDto as CreateEmailTemplateInput, type CreateGuestOrderDto, type CreateInquiryInput, type CreateInquiryResponse, type CreateMetafieldDefinitionDto as CreateMetafieldDefinitionInput, type CreateOrderDto, type CreateProductDto, type CreateRefundDto, type CreateShippingRateDto as CreateShippingRateInput, type CreateShippingZoneDto as CreateShippingZoneInput, type CreateTagDto as CreateTagInput, type CreateTaxRateDto as CreateTaxRateInput, type CreateVariantDto, type CustomApiAuthType, type CustomApiConnectionStatus, type CustomApiCredentials, type CustomApiIntegration, type CustomApiSyncConfig, type CustomApiSyncDirection, type CustomApiTestResult, type Customer, type CustomerAddress, type CustomerAuthResponse, type CustomerOAuthProvider, type CustomerProfile, type CustomerQueryParams, type DeleteProductResponse, 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 FormatPriceOptions, type FulfillOrderDto, type GuestCheckoutStartResponse, type GuestOrderResponse, type InsufficientStockError, type InventoryInfo, type InventoryReservationStrategy, type InventorySyncStatus, type InventoryTrackingMode, type InvitationStatus, type InviteMemberDto as InviteMemberInput, type InviteStoreMemberDto as InviteStoreMemberInput, type LocalCart, type LocalCartItem, type LockedVariant, type MergeCartsDto, type MetafieldConflict, type MetafieldConflictResolution, type MetafieldDefinition, type MetafieldPlatformMapping, type MetafieldType, type OAuthAuthorizeResponse, type OAuthCallbackResponse, type OAuthConnection, type OAuthConnectionsResponse, 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 PaginatedResponse, type PaymentClientSdk, type PaymentConfig, type PaymentIntent, type PaymentProvider, type PaymentProviderConfig, type PaymentProvidersConfig, type PaymentStatus, type PickupLocation, type PlatformCouponCapabilities, type PreviewEmailTemplateDto as PreviewEmailTemplateInput, type Product, type ProductAttributeInput, type ProductAvailability, type ProductCustomizationField, type ProductDiscount, type ProductDiscountBadge, type ProductImage, type ProductMetafield, type ProductMetafieldValue, type ProductQueryParams, type ProductRecommendation, type ProductRecommendationsResponse, type ProductRelationType, type ProductSuggestion, type ProductVariant, type PublicMetafieldDefinition, type PublishProductResponse, type RecommendationVariant, type ReconcileInventoryResponse, type Refund, type RefundLineItem, type RefundLineItemResponse, type RefundType, type RegisterCustomerDto, type ReservationInfo, type ResolveMetafieldConflictDto as ResolveMetafieldConflictInput, type ResolveSyncConflictDto as ResolveSyncConflictInput, SDK_VERSION, type SearchSuggestions, type SelectPickupLocationDto, type SelectShippingMethodDto, type SendInvoiceDto, type SessionCartRef, type SetBillingAddressDto, type SetCheckoutCustomFieldsDto, type SetCheckoutCustomerDto, type SetDefinitionProductsDto as SetDefinitionProductsInput, type SetShippingAddressDto, type SetShippingAddressResponse, type ShippingDestinations, type ShippingLine, type ShippingRate, type ShippingRateConfig, type ShippingRateType, type ShippingZone, type ShippingZoneQueryParams, type StockAvailabilityRequest, type StockAvailabilityResponse, type StockAvailabilityResult, type StoreInfo, type StoreInvitation, type StoreInvitationDetails, type StoreMember, type StorePermission, type StoreRole, type StoreTeamResponse, type SyncConflict, type SyncConflictResolution, type SyncJob, type Tag, type TaxBreakdown, type TaxBreakdownItem, type TaxRate, type TaxonomyQueryParams, type TeamInvitation, type TeamInvitationsResponse, type TeamMember, type TeamMembersResponse, type TeamRole, type UpdateAddressDto, type UpdateAttributeDto as UpdateAttributeInput, type UpdateAttributeOptionDto as UpdateAttributeOptionInput, type UpdateBrandDto as UpdateBrandInput, type UpdateCartItemDto, type UpdateCategoryDto as UpdateCategoryInput, type UpdateCouponDto, type UpdateCustomApiDto, type UpdateCustomerDto, type UpdateDraftDto, type UpdateEmailSettingsDto as UpdateEmailSettingsInput, type UpdateEmailTemplateDto as UpdateEmailTemplateInput, type UpdateInventoryDto, type UpdateMemberRoleDto as UpdateMemberRoleInput, type UpdateMetafieldDefinitionDto as UpdateMetafieldDefinitionInput, type UpdateOAuthProviderDto as UpdateOAuthProviderInput, type UpdateOrderDto, type UpdateOrderShippingDto, type UpdateProductDto, type UpdateShippingRateDto as UpdateShippingRateInput, type UpdateShippingZoneDto as UpdateShippingZoneInput, type UpdateStoreMemberDto as UpdateStoreMemberInput, type UpdateTagDto as UpdateTagInput, type UpdateTaxRateDto as UpdateTaxRateInput, type UpdateVariantDto, type UpdateVariantInventoryDto, type UpsertProductMetafieldDto as UpsertProductMetafieldInput, type UserStore, type UserStorePermissions, type VariantInventoryResponse, type VariantPlatformOverlay, type VariantStatus, type WaitForOrderOptions, type WaitForOrderResult, type WebhookEvent, type WebhookEventType, createWebhookHandler, enableDevGuards, formatPrice, getCartItemImage, getCartItemName, getCartTotals, getDescriptionContent, formatPrice as getPriceDisplay, getProductCustomizationFields, getProductMetafield, getProductMetafieldValue, getProductMetafieldsByType, getProductPrice, getProductPriceInfo, getProductSwatches, getStockStatus, getVariantOptions, getVariantPrice, isCouponApplicableToProduct, isHtmlDescription, isWebhookEventType, parseWebhookEvent, verifyWebhook };
|
package/dist/index.d.ts
CHANGED
|
@@ -895,6 +895,32 @@ interface Order {
|
|
|
895
895
|
/** Tax amount */
|
|
896
896
|
taxAmount?: string | null;
|
|
897
897
|
createdAt: string;
|
|
898
|
+
/** Payment method used (e.g., "card", "paypal", "cash_on_delivery"). */
|
|
899
|
+
paymentMethod?: string | null;
|
|
900
|
+
/** Financial status: "pending", "paid", "refunded", "partially_refunded", "voided". */
|
|
901
|
+
financialStatus?: string | null;
|
|
902
|
+
/** Fulfillment status: "unfulfilled", "partial", "fulfilled". */
|
|
903
|
+
fulfillmentStatus?: string | null;
|
|
904
|
+
/** Tracking number, e.g., "1Z999AA10123456784". */
|
|
905
|
+
trackingNumber?: string | null;
|
|
906
|
+
/** Deep link to the carrier's tracking page. */
|
|
907
|
+
trackingUrl?: string | null;
|
|
908
|
+
/** Carrier name, e.g., "UPS", "USPS", "DHL". */
|
|
909
|
+
carrier?: string | null;
|
|
910
|
+
/** ISO-8601 timestamp when the order was shipped. */
|
|
911
|
+
shippedAt?: string | null;
|
|
912
|
+
/** ISO-8601 timestamp when the order was delivered. */
|
|
913
|
+
deliveredAt?: string | null;
|
|
914
|
+
/** Status timeline entries in chronological order. */
|
|
915
|
+
statusHistory?: OrderStatusChange[] | null;
|
|
916
|
+
}
|
|
917
|
+
/** One status transition on an order. */
|
|
918
|
+
interface OrderStatusChange {
|
|
919
|
+
status: OrderStatus;
|
|
920
|
+
/** ISO-8601 timestamp of the transition. */
|
|
921
|
+
at: string;
|
|
922
|
+
/** Optional note (why the status changed). */
|
|
923
|
+
note?: string | null;
|
|
898
924
|
}
|
|
899
925
|
/**
|
|
900
926
|
* Order status values are **lowercase**.
|
|
@@ -3177,6 +3203,13 @@ interface MetafieldDefinition {
|
|
|
3177
3203
|
description?: string | null;
|
|
3178
3204
|
type: MetafieldType;
|
|
3179
3205
|
required: boolean;
|
|
3206
|
+
isCustomerInput?: boolean;
|
|
3207
|
+
/**
|
|
3208
|
+
* When `true`, the field is treated as present on every product of this
|
|
3209
|
+
* account — including products created later. Clients don't need to list
|
|
3210
|
+
* individual `ProductCustomizationField` rows when this is set.
|
|
3211
|
+
*/
|
|
3212
|
+
appliesToAllProducts?: boolean;
|
|
3180
3213
|
minLength?: number | null;
|
|
3181
3214
|
maxLength?: number | null;
|
|
3182
3215
|
minValue?: number | null;
|
|
@@ -3186,6 +3219,11 @@ interface MetafieldDefinition {
|
|
|
3186
3219
|
position: number;
|
|
3187
3220
|
isActive: boolean;
|
|
3188
3221
|
mappings?: MetafieldPlatformMapping[];
|
|
3222
|
+
/** Products this definition is explicitly attached to (customer-input only). */
|
|
3223
|
+
products?: Array<{
|
|
3224
|
+
id: string;
|
|
3225
|
+
name: string;
|
|
3226
|
+
}>;
|
|
3189
3227
|
createdAt: string;
|
|
3190
3228
|
updatedAt: string;
|
|
3191
3229
|
}
|
|
@@ -3201,6 +3239,11 @@ interface PublicMetafieldDefinition {
|
|
|
3201
3239
|
type: MetafieldType;
|
|
3202
3240
|
required: boolean;
|
|
3203
3241
|
isCustomerInput?: boolean;
|
|
3242
|
+
/**
|
|
3243
|
+
* When true, this definition applies to every product of the account —
|
|
3244
|
+
* including ones created after the flag was set.
|
|
3245
|
+
*/
|
|
3246
|
+
appliesToAllProducts?: boolean;
|
|
3204
3247
|
enumValues?: string[];
|
|
3205
3248
|
minLength?: number | null;
|
|
3206
3249
|
maxLength?: number | null;
|
|
@@ -3247,6 +3290,14 @@ interface CreateMetafieldDefinitionDto {
|
|
|
3247
3290
|
description?: string;
|
|
3248
3291
|
type?: MetafieldType;
|
|
3249
3292
|
required?: boolean;
|
|
3293
|
+
isCustomerInput?: boolean;
|
|
3294
|
+
/** When true the field applies to every product in the account. */
|
|
3295
|
+
appliesToAllProducts?: boolean;
|
|
3296
|
+
/**
|
|
3297
|
+
* Assign the new (customer-input) definition to specific products atomically
|
|
3298
|
+
* in the same create call. Only valid when `isCustomerInput` is true.
|
|
3299
|
+
*/
|
|
3300
|
+
productIds?: string[];
|
|
3250
3301
|
minLength?: number;
|
|
3251
3302
|
maxLength?: number;
|
|
3252
3303
|
minValue?: number;
|
|
@@ -3260,6 +3311,8 @@ interface UpdateMetafieldDefinitionDto {
|
|
|
3260
3311
|
description?: string | null;
|
|
3261
3312
|
type?: MetafieldType;
|
|
3262
3313
|
required?: boolean;
|
|
3314
|
+
isCustomerInput?: boolean;
|
|
3315
|
+
appliesToAllProducts?: boolean;
|
|
3263
3316
|
minLength?: number | null;
|
|
3264
3317
|
maxLength?: number | null;
|
|
3265
3318
|
minValue?: number | null;
|
|
@@ -3269,6 +3322,16 @@ interface UpdateMetafieldDefinitionDto {
|
|
|
3269
3322
|
position?: number;
|
|
3270
3323
|
isActive?: boolean;
|
|
3271
3324
|
}
|
|
3325
|
+
/**
|
|
3326
|
+
* Set (replace with diff-scoped semantics) the list of products linked to a
|
|
3327
|
+
* single customer-input metafield definition. Passing an empty array detaches
|
|
3328
|
+
* the definition from every product.
|
|
3329
|
+
*/
|
|
3330
|
+
interface SetDefinitionProductsDto {
|
|
3331
|
+
productIds: string[];
|
|
3332
|
+
/** Optionally flip the `appliesToAllProducts` flag in the same call. */
|
|
3333
|
+
appliesToAllProducts?: boolean;
|
|
3334
|
+
}
|
|
3272
3335
|
/**
|
|
3273
3336
|
* Product metafield value
|
|
3274
3337
|
*/
|
|
@@ -3788,6 +3851,20 @@ type CheckoutFieldPricing = {
|
|
|
3788
3851
|
interface SetCheckoutCustomFieldsDto {
|
|
3789
3852
|
fields: Record<string, unknown>;
|
|
3790
3853
|
}
|
|
3854
|
+
interface CreateInquiryInput {
|
|
3855
|
+
name: string;
|
|
3856
|
+
email: string;
|
|
3857
|
+
subject: string;
|
|
3858
|
+
message: string;
|
|
3859
|
+
phone?: string;
|
|
3860
|
+
customerId?: string;
|
|
3861
|
+
metadata?: Record<string, unknown>;
|
|
3862
|
+
}
|
|
3863
|
+
interface CreateInquiryResponse {
|
|
3864
|
+
id: string;
|
|
3865
|
+
status: 'NEW';
|
|
3866
|
+
createdAt: string;
|
|
3867
|
+
}
|
|
3791
3868
|
interface BrainerceApiError {
|
|
3792
3869
|
statusCode: number;
|
|
3793
3870
|
message: string;
|
|
@@ -4901,6 +4978,25 @@ declare class BrainerceClient {
|
|
|
4901
4978
|
page?: number;
|
|
4902
4979
|
limit?: number;
|
|
4903
4980
|
}): Promise<PaginatedResponse<Order>>;
|
|
4981
|
+
/**
|
|
4982
|
+
* Submit a contact inquiry from a storefront contact form.
|
|
4983
|
+
*
|
|
4984
|
+
* Storefront (public) mode only. Rate-limited to 3 requests / 60 seconds
|
|
4985
|
+
* per IP on the server. Include an empty `honeypot` field on your form
|
|
4986
|
+
* and do NOT send it — bots that auto-fill every input will be rejected.
|
|
4987
|
+
*
|
|
4988
|
+
* @example
|
|
4989
|
+
* ```typescript
|
|
4990
|
+
* await brainerce.createInquiry({
|
|
4991
|
+
* name: 'Jane Doe',
|
|
4992
|
+
* email: 'jane@example.com',
|
|
4993
|
+
* subject: 'Question about shipping',
|
|
4994
|
+
* message: 'Do you ship to Canada?',
|
|
4995
|
+
* phone: '+1-555-0100',
|
|
4996
|
+
* });
|
|
4997
|
+
* ```
|
|
4998
|
+
*/
|
|
4999
|
+
createInquiry(input: CreateInquiryInput): Promise<CreateInquiryResponse>;
|
|
4904
5000
|
/**
|
|
4905
5001
|
* Create a new cart for a guest user
|
|
4906
5002
|
* Returns a cart with a sessionToken that identifies this cart
|
|
@@ -6711,6 +6807,26 @@ declare class BrainerceClient {
|
|
|
6711
6807
|
* Requires Admin mode (apiKey)
|
|
6712
6808
|
*/
|
|
6713
6809
|
deleteMetafieldDefinition(definitionId: string): Promise<void>;
|
|
6810
|
+
/**
|
|
6811
|
+
* Replace the list of products a (customer-input) metafield definition is
|
|
6812
|
+
* attached to. Diff-scoped: only rows for this definition are touched, so
|
|
6813
|
+
* concurrent edits to other definitions on the same product are safe.
|
|
6814
|
+
*
|
|
6815
|
+
* Optionally toggles `appliesToAllProducts` in the same call. When that
|
|
6816
|
+
* flag is true the `productIds` list is still respected as the explicit
|
|
6817
|
+
* subset, but buyers will see the field on every product regardless.
|
|
6818
|
+
*
|
|
6819
|
+
* Requires Admin mode (apiKey).
|
|
6820
|
+
*
|
|
6821
|
+
* @example
|
|
6822
|
+
* ```typescript
|
|
6823
|
+
* await client.setDefinitionProducts('def_123', {
|
|
6824
|
+
* productIds: ['prod_a', 'prod_b'],
|
|
6825
|
+
* appliesToAllProducts: false,
|
|
6826
|
+
* });
|
|
6827
|
+
* ```
|
|
6828
|
+
*/
|
|
6829
|
+
setDefinitionProducts(definitionId: string, data: SetDefinitionProductsDto): Promise<MetafieldDefinition>;
|
|
6714
6830
|
/**
|
|
6715
6831
|
* Get all metafield values for a product
|
|
6716
6832
|
* Requires Admin mode (apiKey)
|
|
@@ -7100,4 +7216,4 @@ declare function enableDevGuards(options?: {
|
|
|
7100
7216
|
force?: boolean;
|
|
7101
7217
|
}): void;
|
|
7102
7218
|
|
|
7103
|
-
export { type AddToCartDto, type AppliedDiscount, type ApplyCouponDto, type Attribute, type AttributeOption, type AttributeSource, type BrainerceApiError, BrainerceClient, type BrainerceClientOptions, BrainerceError, type Brand, type BulkInventoryResponse, type BulkSaveVariantsDto, type BulkSaveVariantsResponse, type BulkVariantInput, type Cart, type CartAppliedDiscount, type CartBundleOffer, type CartBundlesResponse, type CartIncludeOption, type CartIncludeOptions, type CartItem, type CartNudge, type CartRecommendationsResponse, type CartStatus, type CartUpgradeSuggestion, type CartUpgradesResponse, type CartWithIncludes, type Category, type CategoryNode, type CategorySuggestion, type Checkout, type CheckoutAddress, type CheckoutBumpsResponse, type CheckoutCustomFieldDefinition, type CheckoutFieldPricing, type CheckoutFieldVisibility, type CheckoutLineItem, type CheckoutPrefillData, type CheckoutStatus, type CompleteCheckoutResponse, type CompleteDraftDto, type ConfigureOAuthProviderDto as ConfigureOAuthProviderInput, type ConflictStatus, type ConnectorPlatform, 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 CreateCouponDto, type CreateCustomApiDto, type CreateCustomerDto, type CreateEmailTemplateDto as CreateEmailTemplateInput, type CreateGuestOrderDto, type CreateMetafieldDefinitionDto as CreateMetafieldDefinitionInput, type CreateOrderDto, type CreateProductDto, type CreateRefundDto, type CreateShippingRateDto as CreateShippingRateInput, type CreateShippingZoneDto as CreateShippingZoneInput, type CreateTagDto as CreateTagInput, type CreateTaxRateDto as CreateTaxRateInput, type CreateVariantDto, type CustomApiAuthType, type CustomApiConnectionStatus, type CustomApiCredentials, type CustomApiIntegration, type CustomApiSyncConfig, type CustomApiSyncDirection, type CustomApiTestResult, type Customer, type CustomerAddress, type CustomerAuthResponse, type CustomerOAuthProvider, type CustomerProfile, type CustomerQueryParams, type DeleteProductResponse, 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 FormatPriceOptions, type FulfillOrderDto, type GuestCheckoutStartResponse, type GuestOrderResponse, type InsufficientStockError, type InventoryInfo, type InventoryReservationStrategy, type InventorySyncStatus, type InventoryTrackingMode, type InvitationStatus, type InviteMemberDto as InviteMemberInput, type InviteStoreMemberDto as InviteStoreMemberInput, type LocalCart, type LocalCartItem, type LockedVariant, type MergeCartsDto, type MetafieldConflict, type MetafieldConflictResolution, type MetafieldDefinition, type MetafieldPlatformMapping, type MetafieldType, type OAuthAuthorizeResponse, type OAuthCallbackResponse, type OAuthConnection, type OAuthConnectionsResponse, type OAuthProviderConfig, type OAuthProviderType, type OAuthProvidersResponse, type Order, type OrderAddress, type OrderBump, type OrderCustomer, type OrderDownloadLink, type OrderItem, type OrderQueryParams, type OrderStatus, type PaginatedResponse, type PaymentClientSdk, type PaymentConfig, type PaymentIntent, type PaymentProvider, type PaymentProviderConfig, type PaymentProvidersConfig, type PaymentStatus, type PickupLocation, type PlatformCouponCapabilities, type PreviewEmailTemplateDto as PreviewEmailTemplateInput, type Product, type ProductAttributeInput, type ProductAvailability, type ProductCustomizationField, type ProductDiscount, type ProductDiscountBadge, type ProductImage, type ProductMetafield, type ProductMetafieldValue, type ProductQueryParams, type ProductRecommendation, type ProductRecommendationsResponse, type ProductRelationType, type ProductSuggestion, type ProductVariant, type PublicMetafieldDefinition, type PublishProductResponse, type RecommendationVariant, type ReconcileInventoryResponse, type Refund, type RefundLineItem, type RefundLineItemResponse, type RefundType, type RegisterCustomerDto, type ReservationInfo, type ResolveMetafieldConflictDto as ResolveMetafieldConflictInput, type ResolveSyncConflictDto as ResolveSyncConflictInput, SDK_VERSION, type SearchSuggestions, type SelectPickupLocationDto, type SelectShippingMethodDto, type SendInvoiceDto, type SessionCartRef, type SetBillingAddressDto, type SetCheckoutCustomFieldsDto, type SetCheckoutCustomerDto, type SetShippingAddressDto, type SetShippingAddressResponse, type ShippingDestinations, type ShippingLine, type ShippingRate, type ShippingRateConfig, type ShippingRateType, type ShippingZone, type ShippingZoneQueryParams, type StockAvailabilityRequest, type StockAvailabilityResponse, type StockAvailabilityResult, type StoreInfo, type StoreInvitation, type StoreInvitationDetails, type StoreMember, type StorePermission, type StoreRole, type StoreTeamResponse, type SyncConflict, type SyncConflictResolution, type SyncJob, type Tag, type TaxBreakdown, type TaxBreakdownItem, type TaxRate, type TaxonomyQueryParams, type TeamInvitation, type TeamInvitationsResponse, type TeamMember, type TeamMembersResponse, type TeamRole, type UpdateAddressDto, type UpdateAttributeDto as UpdateAttributeInput, type UpdateAttributeOptionDto as UpdateAttributeOptionInput, type UpdateBrandDto as UpdateBrandInput, type UpdateCartItemDto, type UpdateCategoryDto as UpdateCategoryInput, type UpdateCouponDto, type UpdateCustomApiDto, type UpdateCustomerDto, type UpdateDraftDto, type UpdateEmailSettingsDto as UpdateEmailSettingsInput, type UpdateEmailTemplateDto as UpdateEmailTemplateInput, type UpdateInventoryDto, type UpdateMemberRoleDto as UpdateMemberRoleInput, type UpdateMetafieldDefinitionDto as UpdateMetafieldDefinitionInput, type UpdateOAuthProviderDto as UpdateOAuthProviderInput, type UpdateOrderDto, type UpdateOrderShippingDto, type UpdateProductDto, type UpdateShippingRateDto as UpdateShippingRateInput, type UpdateShippingZoneDto as UpdateShippingZoneInput, type UpdateStoreMemberDto as UpdateStoreMemberInput, type UpdateTagDto as UpdateTagInput, type UpdateTaxRateDto as UpdateTaxRateInput, type UpdateVariantDto, type UpdateVariantInventoryDto, type UpsertProductMetafieldDto as UpsertProductMetafieldInput, type UserStore, type UserStorePermissions, type VariantInventoryResponse, type VariantPlatformOverlay, type VariantStatus, type WaitForOrderOptions, type WaitForOrderResult, type WebhookEvent, type WebhookEventType, createWebhookHandler, enableDevGuards, formatPrice, getCartItemImage, getCartItemName, getCartTotals, getDescriptionContent, formatPrice as getPriceDisplay, getProductCustomizationFields, getProductMetafield, getProductMetafieldValue, getProductMetafieldsByType, getProductPrice, getProductPriceInfo, getProductSwatches, getStockStatus, getVariantOptions, getVariantPrice, isCouponApplicableToProduct, isHtmlDescription, isWebhookEventType, parseWebhookEvent, verifyWebhook };
|
|
7219
|
+
export { type AddToCartDto, type AppliedDiscount, type ApplyCouponDto, type Attribute, type AttributeOption, type AttributeSource, type BrainerceApiError, BrainerceClient, type BrainerceClientOptions, BrainerceError, type Brand, type BulkInventoryResponse, type BulkSaveVariantsDto, type BulkSaveVariantsResponse, type BulkVariantInput, type Cart, type CartAppliedDiscount, type CartBundleOffer, type CartBundlesResponse, type CartIncludeOption, type CartIncludeOptions, type CartItem, type CartNudge, type CartRecommendationsResponse, type CartStatus, type CartUpgradeSuggestion, type CartUpgradesResponse, type CartWithIncludes, type Category, type CategoryNode, type CategorySuggestion, type Checkout, type CheckoutAddress, type CheckoutBumpsResponse, type CheckoutCustomFieldDefinition, type CheckoutFieldPricing, type CheckoutFieldVisibility, type CheckoutLineItem, type CheckoutPrefillData, type CheckoutStatus, type CompleteCheckoutResponse, type CompleteDraftDto, type ConfigureOAuthProviderDto as ConfigureOAuthProviderInput, type ConflictStatus, type ConnectorPlatform, 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 CreateCouponDto, type CreateCustomApiDto, type CreateCustomerDto, type CreateEmailTemplateDto as CreateEmailTemplateInput, type CreateGuestOrderDto, type CreateInquiryInput, type CreateInquiryResponse, type CreateMetafieldDefinitionDto as CreateMetafieldDefinitionInput, type CreateOrderDto, type CreateProductDto, type CreateRefundDto, type CreateShippingRateDto as CreateShippingRateInput, type CreateShippingZoneDto as CreateShippingZoneInput, type CreateTagDto as CreateTagInput, type CreateTaxRateDto as CreateTaxRateInput, type CreateVariantDto, type CustomApiAuthType, type CustomApiConnectionStatus, type CustomApiCredentials, type CustomApiIntegration, type CustomApiSyncConfig, type CustomApiSyncDirection, type CustomApiTestResult, type Customer, type CustomerAddress, type CustomerAuthResponse, type CustomerOAuthProvider, type CustomerProfile, type CustomerQueryParams, type DeleteProductResponse, 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 FormatPriceOptions, type FulfillOrderDto, type GuestCheckoutStartResponse, type GuestOrderResponse, type InsufficientStockError, type InventoryInfo, type InventoryReservationStrategy, type InventorySyncStatus, type InventoryTrackingMode, type InvitationStatus, type InviteMemberDto as InviteMemberInput, type InviteStoreMemberDto as InviteStoreMemberInput, type LocalCart, type LocalCartItem, type LockedVariant, type MergeCartsDto, type MetafieldConflict, type MetafieldConflictResolution, type MetafieldDefinition, type MetafieldPlatformMapping, type MetafieldType, type OAuthAuthorizeResponse, type OAuthCallbackResponse, type OAuthConnection, type OAuthConnectionsResponse, 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 PaginatedResponse, type PaymentClientSdk, type PaymentConfig, type PaymentIntent, type PaymentProvider, type PaymentProviderConfig, type PaymentProvidersConfig, type PaymentStatus, type PickupLocation, type PlatformCouponCapabilities, type PreviewEmailTemplateDto as PreviewEmailTemplateInput, type Product, type ProductAttributeInput, type ProductAvailability, type ProductCustomizationField, type ProductDiscount, type ProductDiscountBadge, type ProductImage, type ProductMetafield, type ProductMetafieldValue, type ProductQueryParams, type ProductRecommendation, type ProductRecommendationsResponse, type ProductRelationType, type ProductSuggestion, type ProductVariant, type PublicMetafieldDefinition, type PublishProductResponse, type RecommendationVariant, type ReconcileInventoryResponse, type Refund, type RefundLineItem, type RefundLineItemResponse, type RefundType, type RegisterCustomerDto, type ReservationInfo, type ResolveMetafieldConflictDto as ResolveMetafieldConflictInput, type ResolveSyncConflictDto as ResolveSyncConflictInput, SDK_VERSION, type SearchSuggestions, type SelectPickupLocationDto, type SelectShippingMethodDto, type SendInvoiceDto, type SessionCartRef, type SetBillingAddressDto, type SetCheckoutCustomFieldsDto, type SetCheckoutCustomerDto, type SetDefinitionProductsDto as SetDefinitionProductsInput, type SetShippingAddressDto, type SetShippingAddressResponse, type ShippingDestinations, type ShippingLine, type ShippingRate, type ShippingRateConfig, type ShippingRateType, type ShippingZone, type ShippingZoneQueryParams, type StockAvailabilityRequest, type StockAvailabilityResponse, type StockAvailabilityResult, type StoreInfo, type StoreInvitation, type StoreInvitationDetails, type StoreMember, type StorePermission, type StoreRole, type StoreTeamResponse, type SyncConflict, type SyncConflictResolution, type SyncJob, type Tag, type TaxBreakdown, type TaxBreakdownItem, type TaxRate, type TaxonomyQueryParams, type TeamInvitation, type TeamInvitationsResponse, type TeamMember, type TeamMembersResponse, type TeamRole, type UpdateAddressDto, type UpdateAttributeDto as UpdateAttributeInput, type UpdateAttributeOptionDto as UpdateAttributeOptionInput, type UpdateBrandDto as UpdateBrandInput, type UpdateCartItemDto, type UpdateCategoryDto as UpdateCategoryInput, type UpdateCouponDto, type UpdateCustomApiDto, type UpdateCustomerDto, type UpdateDraftDto, type UpdateEmailSettingsDto as UpdateEmailSettingsInput, type UpdateEmailTemplateDto as UpdateEmailTemplateInput, type UpdateInventoryDto, type UpdateMemberRoleDto as UpdateMemberRoleInput, type UpdateMetafieldDefinitionDto as UpdateMetafieldDefinitionInput, type UpdateOAuthProviderDto as UpdateOAuthProviderInput, type UpdateOrderDto, type UpdateOrderShippingDto, type UpdateProductDto, type UpdateShippingRateDto as UpdateShippingRateInput, type UpdateShippingZoneDto as UpdateShippingZoneInput, type UpdateStoreMemberDto as UpdateStoreMemberInput, type UpdateTagDto as UpdateTagInput, type UpdateTaxRateDto as UpdateTaxRateInput, type UpdateVariantDto, type UpdateVariantInventoryDto, type UpsertProductMetafieldDto as UpsertProductMetafieldInput, type UserStore, type UserStorePermissions, type VariantInventoryResponse, type VariantPlatformOverlay, type VariantStatus, type WaitForOrderOptions, type WaitForOrderResult, type WebhookEvent, type WebhookEventType, createWebhookHandler, enableDevGuards, formatPrice, getCartItemImage, getCartItemName, getCartTotals, getDescriptionContent, formatPrice as getPriceDisplay, getProductCustomizationFields, getProductMetafield, getProductMetafieldValue, getProductMetafieldsByType, getProductPrice, getProductPriceInfo, getProductSwatches, getStockStatus, getVariantOptions, getVariantPrice, isCouponApplicableToProduct, isHtmlDescription, isWebhookEventType, parseWebhookEvent, verifyWebhook };
|
package/dist/index.js
CHANGED
|
@@ -439,11 +439,14 @@ var BrainerceClient = class {
|
|
|
439
439
|
const controller = new AbortController();
|
|
440
440
|
const timeoutId = setTimeout(() => controller.abort(), this.timeout);
|
|
441
441
|
try {
|
|
442
|
+
const isFormData = typeof FormData !== "undefined" && body instanceof FormData;
|
|
442
443
|
const headers = {
|
|
443
|
-
"Content-Type": "application/json",
|
|
444
444
|
"X-SDK-Version": SDK_VERSION,
|
|
445
445
|
"ngrok-skip-browser-warning": "true"
|
|
446
446
|
};
|
|
447
|
+
if (!isFormData) {
|
|
448
|
+
headers["Content-Type"] = "application/json";
|
|
449
|
+
}
|
|
447
450
|
if (this.origin) {
|
|
448
451
|
headers["Origin"] = this.origin;
|
|
449
452
|
}
|
|
@@ -462,7 +465,7 @@ var BrainerceClient = class {
|
|
|
462
465
|
const response = await fetch(url.toString(), {
|
|
463
466
|
method,
|
|
464
467
|
headers,
|
|
465
|
-
body: body ? JSON.stringify(body) : void 0,
|
|
468
|
+
body: body ? isFormData ? body : JSON.stringify(body) : void 0,
|
|
466
469
|
signal: controller.signal
|
|
467
470
|
});
|
|
468
471
|
clearTimeout(timeoutId);
|
|
@@ -516,11 +519,14 @@ var BrainerceClient = class {
|
|
|
516
519
|
const controller = new AbortController();
|
|
517
520
|
const timeoutId = setTimeout(() => controller.abort(), this.timeout);
|
|
518
521
|
try {
|
|
522
|
+
const isFormData = typeof FormData !== "undefined" && body instanceof FormData;
|
|
519
523
|
const headers = {
|
|
520
|
-
"Content-Type": "application/json",
|
|
521
524
|
"X-SDK-Version": SDK_VERSION,
|
|
522
525
|
"ngrok-skip-browser-warning": "true"
|
|
523
526
|
};
|
|
527
|
+
if (!isFormData) {
|
|
528
|
+
headers["Content-Type"] = "application/json";
|
|
529
|
+
}
|
|
524
530
|
if (this.origin) {
|
|
525
531
|
headers["Origin"] = this.origin;
|
|
526
532
|
}
|
|
@@ -536,7 +542,7 @@ var BrainerceClient = class {
|
|
|
536
542
|
const response = await fetch(url.toString(), {
|
|
537
543
|
method,
|
|
538
544
|
headers,
|
|
539
|
-
body: body ? JSON.stringify(body) : void 0,
|
|
545
|
+
body: body ? isFormData ? body : JSON.stringify(body) : void 0,
|
|
540
546
|
signal: controller.signal
|
|
541
547
|
});
|
|
542
548
|
clearTimeout(timeoutId);
|
|
@@ -2056,6 +2062,28 @@ var BrainerceClient = class {
|
|
|
2056
2062
|
{ page: params?.page, limit: params?.limit }
|
|
2057
2063
|
);
|
|
2058
2064
|
}
|
|
2065
|
+
// -------------------- Contact Inquiries --------------------
|
|
2066
|
+
/**
|
|
2067
|
+
* Submit a contact inquiry from a storefront contact form.
|
|
2068
|
+
*
|
|
2069
|
+
* Storefront (public) mode only. Rate-limited to 3 requests / 60 seconds
|
|
2070
|
+
* per IP on the server. Include an empty `honeypot` field on your form
|
|
2071
|
+
* and do NOT send it — bots that auto-fill every input will be rejected.
|
|
2072
|
+
*
|
|
2073
|
+
* @example
|
|
2074
|
+
* ```typescript
|
|
2075
|
+
* await brainerce.createInquiry({
|
|
2076
|
+
* name: 'Jane Doe',
|
|
2077
|
+
* email: 'jane@example.com',
|
|
2078
|
+
* subject: 'Question about shipping',
|
|
2079
|
+
* message: 'Do you ship to Canada?',
|
|
2080
|
+
* phone: '+1-555-0100',
|
|
2081
|
+
* });
|
|
2082
|
+
* ```
|
|
2083
|
+
*/
|
|
2084
|
+
async createInquiry(input) {
|
|
2085
|
+
return this.storefrontRequest("POST", "/inquiries", input);
|
|
2086
|
+
}
|
|
2059
2087
|
// -------------------- Cart --------------------
|
|
2060
2088
|
/**
|
|
2061
2089
|
* Create a new cart for a guest user
|
|
@@ -5709,6 +5737,32 @@ var BrainerceClient = class {
|
|
|
5709
5737
|
async deleteMetafieldDefinition(definitionId) {
|
|
5710
5738
|
await this.adminRequest("DELETE", `/api/v1/metafield-definitions/${definitionId}`);
|
|
5711
5739
|
}
|
|
5740
|
+
/**
|
|
5741
|
+
* Replace the list of products a (customer-input) metafield definition is
|
|
5742
|
+
* attached to. Diff-scoped: only rows for this definition are touched, so
|
|
5743
|
+
* concurrent edits to other definitions on the same product are safe.
|
|
5744
|
+
*
|
|
5745
|
+
* Optionally toggles `appliesToAllProducts` in the same call. When that
|
|
5746
|
+
* flag is true the `productIds` list is still respected as the explicit
|
|
5747
|
+
* subset, but buyers will see the field on every product regardless.
|
|
5748
|
+
*
|
|
5749
|
+
* Requires Admin mode (apiKey).
|
|
5750
|
+
*
|
|
5751
|
+
* @example
|
|
5752
|
+
* ```typescript
|
|
5753
|
+
* await client.setDefinitionProducts('def_123', {
|
|
5754
|
+
* productIds: ['prod_a', 'prod_b'],
|
|
5755
|
+
* appliesToAllProducts: false,
|
|
5756
|
+
* });
|
|
5757
|
+
* ```
|
|
5758
|
+
*/
|
|
5759
|
+
async setDefinitionProducts(definitionId, data) {
|
|
5760
|
+
return this.adminRequest(
|
|
5761
|
+
"PATCH",
|
|
5762
|
+
`/api/v1/metafield-definitions/${definitionId}/products`,
|
|
5763
|
+
data
|
|
5764
|
+
);
|
|
5765
|
+
}
|
|
5712
5766
|
// -------------------- Metafields: Product Values --------------------
|
|
5713
5767
|
// These methods require Admin mode (apiKey)
|
|
5714
5768
|
/**
|
package/dist/index.mjs
CHANGED
|
@@ -378,11 +378,14 @@ var BrainerceClient = class {
|
|
|
378
378
|
const controller = new AbortController();
|
|
379
379
|
const timeoutId = setTimeout(() => controller.abort(), this.timeout);
|
|
380
380
|
try {
|
|
381
|
+
const isFormData = typeof FormData !== "undefined" && body instanceof FormData;
|
|
381
382
|
const headers = {
|
|
382
|
-
"Content-Type": "application/json",
|
|
383
383
|
"X-SDK-Version": SDK_VERSION,
|
|
384
384
|
"ngrok-skip-browser-warning": "true"
|
|
385
385
|
};
|
|
386
|
+
if (!isFormData) {
|
|
387
|
+
headers["Content-Type"] = "application/json";
|
|
388
|
+
}
|
|
386
389
|
if (this.origin) {
|
|
387
390
|
headers["Origin"] = this.origin;
|
|
388
391
|
}
|
|
@@ -401,7 +404,7 @@ var BrainerceClient = class {
|
|
|
401
404
|
const response = await fetch(url.toString(), {
|
|
402
405
|
method,
|
|
403
406
|
headers,
|
|
404
|
-
body: body ? JSON.stringify(body) : void 0,
|
|
407
|
+
body: body ? isFormData ? body : JSON.stringify(body) : void 0,
|
|
405
408
|
signal: controller.signal
|
|
406
409
|
});
|
|
407
410
|
clearTimeout(timeoutId);
|
|
@@ -455,11 +458,14 @@ var BrainerceClient = class {
|
|
|
455
458
|
const controller = new AbortController();
|
|
456
459
|
const timeoutId = setTimeout(() => controller.abort(), this.timeout);
|
|
457
460
|
try {
|
|
461
|
+
const isFormData = typeof FormData !== "undefined" && body instanceof FormData;
|
|
458
462
|
const headers = {
|
|
459
|
-
"Content-Type": "application/json",
|
|
460
463
|
"X-SDK-Version": SDK_VERSION,
|
|
461
464
|
"ngrok-skip-browser-warning": "true"
|
|
462
465
|
};
|
|
466
|
+
if (!isFormData) {
|
|
467
|
+
headers["Content-Type"] = "application/json";
|
|
468
|
+
}
|
|
463
469
|
if (this.origin) {
|
|
464
470
|
headers["Origin"] = this.origin;
|
|
465
471
|
}
|
|
@@ -475,7 +481,7 @@ var BrainerceClient = class {
|
|
|
475
481
|
const response = await fetch(url.toString(), {
|
|
476
482
|
method,
|
|
477
483
|
headers,
|
|
478
|
-
body: body ? JSON.stringify(body) : void 0,
|
|
484
|
+
body: body ? isFormData ? body : JSON.stringify(body) : void 0,
|
|
479
485
|
signal: controller.signal
|
|
480
486
|
});
|
|
481
487
|
clearTimeout(timeoutId);
|
|
@@ -1995,6 +2001,28 @@ var BrainerceClient = class {
|
|
|
1995
2001
|
{ page: params?.page, limit: params?.limit }
|
|
1996
2002
|
);
|
|
1997
2003
|
}
|
|
2004
|
+
// -------------------- Contact Inquiries --------------------
|
|
2005
|
+
/**
|
|
2006
|
+
* Submit a contact inquiry from a storefront contact form.
|
|
2007
|
+
*
|
|
2008
|
+
* Storefront (public) mode only. Rate-limited to 3 requests / 60 seconds
|
|
2009
|
+
* per IP on the server. Include an empty `honeypot` field on your form
|
|
2010
|
+
* and do NOT send it — bots that auto-fill every input will be rejected.
|
|
2011
|
+
*
|
|
2012
|
+
* @example
|
|
2013
|
+
* ```typescript
|
|
2014
|
+
* await brainerce.createInquiry({
|
|
2015
|
+
* name: 'Jane Doe',
|
|
2016
|
+
* email: 'jane@example.com',
|
|
2017
|
+
* subject: 'Question about shipping',
|
|
2018
|
+
* message: 'Do you ship to Canada?',
|
|
2019
|
+
* phone: '+1-555-0100',
|
|
2020
|
+
* });
|
|
2021
|
+
* ```
|
|
2022
|
+
*/
|
|
2023
|
+
async createInquiry(input) {
|
|
2024
|
+
return this.storefrontRequest("POST", "/inquiries", input);
|
|
2025
|
+
}
|
|
1998
2026
|
// -------------------- Cart --------------------
|
|
1999
2027
|
/**
|
|
2000
2028
|
* Create a new cart for a guest user
|
|
@@ -5648,6 +5676,32 @@ var BrainerceClient = class {
|
|
|
5648
5676
|
async deleteMetafieldDefinition(definitionId) {
|
|
5649
5677
|
await this.adminRequest("DELETE", `/api/v1/metafield-definitions/${definitionId}`);
|
|
5650
5678
|
}
|
|
5679
|
+
/**
|
|
5680
|
+
* Replace the list of products a (customer-input) metafield definition is
|
|
5681
|
+
* attached to. Diff-scoped: only rows for this definition are touched, so
|
|
5682
|
+
* concurrent edits to other definitions on the same product are safe.
|
|
5683
|
+
*
|
|
5684
|
+
* Optionally toggles `appliesToAllProducts` in the same call. When that
|
|
5685
|
+
* flag is true the `productIds` list is still respected as the explicit
|
|
5686
|
+
* subset, but buyers will see the field on every product regardless.
|
|
5687
|
+
*
|
|
5688
|
+
* Requires Admin mode (apiKey).
|
|
5689
|
+
*
|
|
5690
|
+
* @example
|
|
5691
|
+
* ```typescript
|
|
5692
|
+
* await client.setDefinitionProducts('def_123', {
|
|
5693
|
+
* productIds: ['prod_a', 'prod_b'],
|
|
5694
|
+
* appliesToAllProducts: false,
|
|
5695
|
+
* });
|
|
5696
|
+
* ```
|
|
5697
|
+
*/
|
|
5698
|
+
async setDefinitionProducts(definitionId, data) {
|
|
5699
|
+
return this.adminRequest(
|
|
5700
|
+
"PATCH",
|
|
5701
|
+
`/api/v1/metafield-definitions/${definitionId}/products`,
|
|
5702
|
+
data
|
|
5703
|
+
);
|
|
5704
|
+
}
|
|
5651
5705
|
// -------------------- Metafields: Product Values --------------------
|
|
5652
5706
|
// These methods require Admin mode (apiKey)
|
|
5653
5707
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "brainerce",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.20.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",
|