brainerce 1.18.0 → 1.19.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 +2 -2
- package/dist/index.d.mts +84 -1
- package/dist/index.d.ts +84 -1
- package/dist/index.js +36 -4
- package/dist/index.mjs +36 -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) {
|
|
@@ -4308,7 +4308,7 @@ When building a store, implement these pages:
|
|
|
4308
4308
|
- [ ] **Register** (`/register`) - Customer registration + social signup buttons
|
|
4309
4309
|
- [ ] **Auth Callback** (`/auth/callback`) - Handle OAuth redirects from Google/Facebook/GitHub
|
|
4310
4310
|
- [ ] **Verify Email** (`/verify-email`) - Email verification with 6-digit code (if store requires it)
|
|
4311
|
-
- [ ] **Account** (`/account`) - Profile and order history
|
|
4311
|
+
- [ ] **Account** (`/account`) - Profile, addresses, and full order history (per-item customizations, shipping & tracking, payment status, status timeline)
|
|
4312
4312
|
|
|
4313
4313
|
### ⚠️ Payment Page is REQUIRED
|
|
4314
4314
|
|
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
|
*/
|
|
@@ -6711,6 +6774,26 @@ declare class BrainerceClient {
|
|
|
6711
6774
|
* Requires Admin mode (apiKey)
|
|
6712
6775
|
*/
|
|
6713
6776
|
deleteMetafieldDefinition(definitionId: string): Promise<void>;
|
|
6777
|
+
/**
|
|
6778
|
+
* Replace the list of products a (customer-input) metafield definition is
|
|
6779
|
+
* attached to. Diff-scoped: only rows for this definition are touched, so
|
|
6780
|
+
* concurrent edits to other definitions on the same product are safe.
|
|
6781
|
+
*
|
|
6782
|
+
* Optionally toggles `appliesToAllProducts` in the same call. When that
|
|
6783
|
+
* flag is true the `productIds` list is still respected as the explicit
|
|
6784
|
+
* subset, but buyers will see the field on every product regardless.
|
|
6785
|
+
*
|
|
6786
|
+
* Requires Admin mode (apiKey).
|
|
6787
|
+
*
|
|
6788
|
+
* @example
|
|
6789
|
+
* ```typescript
|
|
6790
|
+
* await client.setDefinitionProducts('def_123', {
|
|
6791
|
+
* productIds: ['prod_a', 'prod_b'],
|
|
6792
|
+
* appliesToAllProducts: false,
|
|
6793
|
+
* });
|
|
6794
|
+
* ```
|
|
6795
|
+
*/
|
|
6796
|
+
setDefinitionProducts(definitionId: string, data: SetDefinitionProductsDto): Promise<MetafieldDefinition>;
|
|
6714
6797
|
/**
|
|
6715
6798
|
* Get all metafield values for a product
|
|
6716
6799
|
* Requires Admin mode (apiKey)
|
|
@@ -7100,4 +7183,4 @@ declare function enableDevGuards(options?: {
|
|
|
7100
7183
|
force?: boolean;
|
|
7101
7184
|
}): void;
|
|
7102
7185
|
|
|
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 };
|
|
7186
|
+
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 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
|
*/
|
|
@@ -6711,6 +6774,26 @@ declare class BrainerceClient {
|
|
|
6711
6774
|
* Requires Admin mode (apiKey)
|
|
6712
6775
|
*/
|
|
6713
6776
|
deleteMetafieldDefinition(definitionId: string): Promise<void>;
|
|
6777
|
+
/**
|
|
6778
|
+
* Replace the list of products a (customer-input) metafield definition is
|
|
6779
|
+
* attached to. Diff-scoped: only rows for this definition are touched, so
|
|
6780
|
+
* concurrent edits to other definitions on the same product are safe.
|
|
6781
|
+
*
|
|
6782
|
+
* Optionally toggles `appliesToAllProducts` in the same call. When that
|
|
6783
|
+
* flag is true the `productIds` list is still respected as the explicit
|
|
6784
|
+
* subset, but buyers will see the field on every product regardless.
|
|
6785
|
+
*
|
|
6786
|
+
* Requires Admin mode (apiKey).
|
|
6787
|
+
*
|
|
6788
|
+
* @example
|
|
6789
|
+
* ```typescript
|
|
6790
|
+
* await client.setDefinitionProducts('def_123', {
|
|
6791
|
+
* productIds: ['prod_a', 'prod_b'],
|
|
6792
|
+
* appliesToAllProducts: false,
|
|
6793
|
+
* });
|
|
6794
|
+
* ```
|
|
6795
|
+
*/
|
|
6796
|
+
setDefinitionProducts(definitionId: string, data: SetDefinitionProductsDto): Promise<MetafieldDefinition>;
|
|
6714
6797
|
/**
|
|
6715
6798
|
* Get all metafield values for a product
|
|
6716
6799
|
* Requires Admin mode (apiKey)
|
|
@@ -7100,4 +7183,4 @@ declare function enableDevGuards(options?: {
|
|
|
7100
7183
|
force?: boolean;
|
|
7101
7184
|
}): void;
|
|
7102
7185
|
|
|
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 };
|
|
7186
|
+
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 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);
|
|
@@ -5709,6 +5715,32 @@ var BrainerceClient = class {
|
|
|
5709
5715
|
async deleteMetafieldDefinition(definitionId) {
|
|
5710
5716
|
await this.adminRequest("DELETE", `/api/v1/metafield-definitions/${definitionId}`);
|
|
5711
5717
|
}
|
|
5718
|
+
/**
|
|
5719
|
+
* Replace the list of products a (customer-input) metafield definition is
|
|
5720
|
+
* attached to. Diff-scoped: only rows for this definition are touched, so
|
|
5721
|
+
* concurrent edits to other definitions on the same product are safe.
|
|
5722
|
+
*
|
|
5723
|
+
* Optionally toggles `appliesToAllProducts` in the same call. When that
|
|
5724
|
+
* flag is true the `productIds` list is still respected as the explicit
|
|
5725
|
+
* subset, but buyers will see the field on every product regardless.
|
|
5726
|
+
*
|
|
5727
|
+
* Requires Admin mode (apiKey).
|
|
5728
|
+
*
|
|
5729
|
+
* @example
|
|
5730
|
+
* ```typescript
|
|
5731
|
+
* await client.setDefinitionProducts('def_123', {
|
|
5732
|
+
* productIds: ['prod_a', 'prod_b'],
|
|
5733
|
+
* appliesToAllProducts: false,
|
|
5734
|
+
* });
|
|
5735
|
+
* ```
|
|
5736
|
+
*/
|
|
5737
|
+
async setDefinitionProducts(definitionId, data) {
|
|
5738
|
+
return this.adminRequest(
|
|
5739
|
+
"PATCH",
|
|
5740
|
+
`/api/v1/metafield-definitions/${definitionId}/products`,
|
|
5741
|
+
data
|
|
5742
|
+
);
|
|
5743
|
+
}
|
|
5712
5744
|
// -------------------- Metafields: Product Values --------------------
|
|
5713
5745
|
// These methods require Admin mode (apiKey)
|
|
5714
5746
|
/**
|
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);
|
|
@@ -5648,6 +5654,32 @@ var BrainerceClient = class {
|
|
|
5648
5654
|
async deleteMetafieldDefinition(definitionId) {
|
|
5649
5655
|
await this.adminRequest("DELETE", `/api/v1/metafield-definitions/${definitionId}`);
|
|
5650
5656
|
}
|
|
5657
|
+
/**
|
|
5658
|
+
* Replace the list of products a (customer-input) metafield definition is
|
|
5659
|
+
* attached to. Diff-scoped: only rows for this definition are touched, so
|
|
5660
|
+
* concurrent edits to other definitions on the same product are safe.
|
|
5661
|
+
*
|
|
5662
|
+
* Optionally toggles `appliesToAllProducts` in the same call. When that
|
|
5663
|
+
* flag is true the `productIds` list is still respected as the explicit
|
|
5664
|
+
* subset, but buyers will see the field on every product regardless.
|
|
5665
|
+
*
|
|
5666
|
+
* Requires Admin mode (apiKey).
|
|
5667
|
+
*
|
|
5668
|
+
* @example
|
|
5669
|
+
* ```typescript
|
|
5670
|
+
* await client.setDefinitionProducts('def_123', {
|
|
5671
|
+
* productIds: ['prod_a', 'prod_b'],
|
|
5672
|
+
* appliesToAllProducts: false,
|
|
5673
|
+
* });
|
|
5674
|
+
* ```
|
|
5675
|
+
*/
|
|
5676
|
+
async setDefinitionProducts(definitionId, data) {
|
|
5677
|
+
return this.adminRequest(
|
|
5678
|
+
"PATCH",
|
|
5679
|
+
`/api/v1/metafield-definitions/${definitionId}/products`,
|
|
5680
|
+
data
|
|
5681
|
+
);
|
|
5682
|
+
}
|
|
5651
5683
|
// -------------------- Metafields: Product Values --------------------
|
|
5652
5684
|
// These methods require Admin mode (apiKey)
|
|
5653
5685
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "brainerce",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.19.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",
|