brainerce 1.16.0 → 1.18.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 +4487 -4447
- package/dist/index.d.mts +130 -17
- package/dist/index.d.ts +130 -17
- package/dist/index.js +184 -43
- package/dist/index.mjs +184 -43
- package/package.json +76 -76
package/dist/index.d.mts
CHANGED
|
@@ -572,7 +572,7 @@ declare function getProductPrice(product: Pick<Product, 'basePrice' | 'salePrice
|
|
|
572
572
|
* }
|
|
573
573
|
* ```
|
|
574
574
|
*/
|
|
575
|
-
declare function getProductPriceInfo(product: Pick<Product, 'basePrice' | 'salePrice'> | null | undefined): {
|
|
575
|
+
declare function getProductPriceInfo(product: Pick<Product, 'basePrice' | 'salePrice' | 'discount'> | null | undefined): {
|
|
576
576
|
price: number;
|
|
577
577
|
originalPrice: number;
|
|
578
578
|
isOnSale: boolean;
|
|
@@ -961,10 +961,13 @@ interface OrderItem {
|
|
|
961
961
|
totalPrice?: string;
|
|
962
962
|
/** Product image URL (flat, not nested under product object) */
|
|
963
963
|
image?: string;
|
|
964
|
-
/**
|
|
964
|
+
/**
|
|
965
|
+
* Customer input field values captured at checkout (e.g., cake text, uploaded logo).
|
|
966
|
+
* `value` is `string[]` for MULTI_SELECT / GALLERY types, `string` otherwise.
|
|
967
|
+
*/
|
|
965
968
|
customizations?: Record<string, {
|
|
966
969
|
label: string;
|
|
967
|
-
value: string;
|
|
970
|
+
value: string | string[];
|
|
968
971
|
type: string;
|
|
969
972
|
}>;
|
|
970
973
|
}
|
|
@@ -2498,8 +2501,8 @@ interface CustomApiTestResult {
|
|
|
2498
2501
|
* The frontend dynamically loads the SDK script and calls init/render methods.
|
|
2499
2502
|
*/
|
|
2500
2503
|
interface PaymentClientSdk {
|
|
2501
|
-
/** How the payment UI is rendered: 'sdk-widget' (JS SDK), 'iframe', 'redirect',
|
|
2502
|
-
renderType: 'sdk-widget' | 'iframe' | 'redirect' | 'sandbox';
|
|
2504
|
+
/** How the payment UI is rendered: 'sdk-widget' (JS SDK), 'iframe', 'redirect', 'sandbox' (test orders), or 'embedded-fields' (PCI-compliant provider-hosted fields embedded in merchant DOM, e.g. Cardcom OpenFields, Stripe Elements) */
|
|
2505
|
+
renderType: 'sdk-widget' | 'iframe' | 'redirect' | 'sandbox' | 'embedded-fields';
|
|
2503
2506
|
/** URL of the main SDK script to load */
|
|
2504
2507
|
scriptUrl?: string;
|
|
2505
2508
|
/** Name of the global variable set by the SDK script (e.g., 'growPayment') */
|
|
@@ -2521,6 +2524,12 @@ interface PaymentClientSdk {
|
|
|
2521
2524
|
}>;
|
|
2522
2525
|
/** CSS to inject into <head> when SDK is active (e.g., LTR overrides for body-level popups on RTL pages) */
|
|
2523
2526
|
bodyStyles?: string;
|
|
2527
|
+
/** For renderType='embedded-fields': base URL the sensitive-field iframes load (e.g. 'https://secure.cardcom.solutions'). postMessage origin is strictly validated against this. */
|
|
2528
|
+
embeddedFieldsUrl?: string;
|
|
2529
|
+
/** For renderType='embedded-fields': opaque provider session id used in the iframe init handshake (e.g., Cardcom LowProfileId) */
|
|
2530
|
+
embeddedFieldsSessionId?: string;
|
|
2531
|
+
/** Provider discriminator that selects the correct embedded-fields component on the storefront */
|
|
2532
|
+
embeddedFieldsProvider?: 'cardcom';
|
|
2524
2533
|
}
|
|
2525
2534
|
/**
|
|
2526
2535
|
* Payment provider configuration (returned by `getPaymentProviders()`).
|
|
@@ -3156,7 +3165,7 @@ interface UpdateTaxRateDto {
|
|
|
3156
3165
|
/**
|
|
3157
3166
|
* Metafield type for defining value structure
|
|
3158
3167
|
*/
|
|
3159
|
-
type MetafieldType = 'TEXT' | 'TEXTAREA' | 'NUMBER' | 'BOOLEAN' | 'DATE' | 'DATETIME' | 'URL' | 'COLOR' | 'DIMENSION' | 'WEIGHT' | 'JSON' | 'IMAGE' | 'GALLERY';
|
|
3168
|
+
type MetafieldType = 'TEXT' | 'TEXTAREA' | 'NUMBER' | 'BOOLEAN' | 'DATE' | 'DATETIME' | 'URL' | 'COLOR' | 'DIMENSION' | 'WEIGHT' | 'JSON' | 'IMAGE' | 'GALLERY' | 'SELECT' | 'MULTI_SELECT';
|
|
3160
3169
|
/**
|
|
3161
3170
|
* Metafield definition - schema for product metafields
|
|
3162
3171
|
*/
|
|
@@ -3456,6 +3465,7 @@ interface EmailTemplate {
|
|
|
3456
3465
|
storeId: string;
|
|
3457
3466
|
name: string;
|
|
3458
3467
|
eventType: EmailEventType;
|
|
3468
|
+
language: string;
|
|
3459
3469
|
subject: string;
|
|
3460
3470
|
htmlContent: string;
|
|
3461
3471
|
textContent?: string | null;
|
|
@@ -3464,10 +3474,17 @@ interface EmailTemplate {
|
|
|
3464
3474
|
createdAt: string;
|
|
3465
3475
|
updatedAt: string;
|
|
3466
3476
|
}
|
|
3477
|
+
/** Paginated response for email templates, grouped by (eventType, language). */
|
|
3478
|
+
interface EmailTemplatesResponse {
|
|
3479
|
+
templates: EmailTemplate[];
|
|
3480
|
+
language: string;
|
|
3481
|
+
supportedLanguages: string[];
|
|
3482
|
+
}
|
|
3467
3483
|
/** DTO for creating an email template */
|
|
3468
3484
|
interface CreateEmailTemplateDto {
|
|
3469
3485
|
name: string;
|
|
3470
3486
|
eventType: EmailEventType;
|
|
3487
|
+
language: string;
|
|
3471
3488
|
subject: string;
|
|
3472
3489
|
htmlContent: string;
|
|
3473
3490
|
textContent?: string;
|
|
@@ -3580,7 +3597,7 @@ interface UpdateOAuthProviderDto {
|
|
|
3580
3597
|
isEnabled?: boolean;
|
|
3581
3598
|
providerConfig?: Record<string, unknown>;
|
|
3582
3599
|
}
|
|
3583
|
-
type DiscountRuleType = '
|
|
3600
|
+
type DiscountRuleType = 'PRODUCT_DISCOUNT' | 'ORDER_DISCOUNT' | 'BUY_X_GET_Y' | 'BUY_X_GET_X' | 'VOLUME_DISCOUNT' | 'SHIPPING_DISCOUNT' | 'BUNDLE';
|
|
3584
3601
|
/** Discount that was automatically applied to the cart by a rule */
|
|
3585
3602
|
interface CartAppliedDiscount {
|
|
3586
3603
|
ruleId: string;
|
|
@@ -3685,6 +3702,21 @@ interface CartBundleOffer {
|
|
|
3685
3702
|
interface CartBundlesResponse {
|
|
3686
3703
|
bundles: CartBundleOffer[];
|
|
3687
3704
|
}
|
|
3705
|
+
/** Valid values for the cart `include` query parameter */
|
|
3706
|
+
type CartIncludeOption = 'recommendations' | 'upgrades' | 'bundles';
|
|
3707
|
+
/** Options for getCart / smartGetCart with optional includes */
|
|
3708
|
+
interface CartIncludeOptions {
|
|
3709
|
+
include?: CartIncludeOption[];
|
|
3710
|
+
}
|
|
3711
|
+
/** Cart response enriched with optional included data */
|
|
3712
|
+
interface CartWithIncludes extends Cart {
|
|
3713
|
+
/** Cross-sell recommendations (present when include contains 'recommendations') */
|
|
3714
|
+
recommendations?: CartRecommendationsResponse;
|
|
3715
|
+
/** Upgrade suggestions (present when include contains 'upgrades') */
|
|
3716
|
+
upgrades?: CartUpgradesResponse;
|
|
3717
|
+
/** Bundle offers (present when include contains 'bundles') */
|
|
3718
|
+
bundles?: CartBundlesResponse;
|
|
3719
|
+
}
|
|
3688
3720
|
interface OrderBump {
|
|
3689
3721
|
id: string;
|
|
3690
3722
|
title: string;
|
|
@@ -3988,7 +4020,9 @@ declare class BrainerceClient {
|
|
|
3988
4020
|
* // Use tag IDs in getProducts({ tags: ['tag_id'] })
|
|
3989
4021
|
* ```
|
|
3990
4022
|
*/
|
|
3991
|
-
getTags(
|
|
4023
|
+
getTags(options?: {
|
|
4024
|
+
locale?: string;
|
|
4025
|
+
}): Promise<{
|
|
3992
4026
|
tags: Array<{
|
|
3993
4027
|
id: string;
|
|
3994
4028
|
name: string;
|
|
@@ -4901,18 +4935,60 @@ declare class BrainerceClient {
|
|
|
4901
4935
|
getCartByCustomer(customerId: string): Promise<Cart>;
|
|
4902
4936
|
/**
|
|
4903
4937
|
* Get a cart by ID
|
|
4938
|
+
*
|
|
4939
|
+
* @param cartId - The cart ID
|
|
4940
|
+
* @param options - Optional settings. Use `include` to fetch related data in a single request.
|
|
4941
|
+
*
|
|
4942
|
+
* @example
|
|
4943
|
+
* ```typescript
|
|
4944
|
+
* // Basic cart fetch
|
|
4945
|
+
* const cart = await client.getCart('cart_123');
|
|
4946
|
+
*
|
|
4947
|
+
* // Fetch cart with recommendations, upgrades, and bundles in one call
|
|
4948
|
+
* const enriched = await client.getCart('cart_123', {
|
|
4949
|
+
* include: ['recommendations', 'upgrades', 'bundles'],
|
|
4950
|
+
* });
|
|
4951
|
+
* console.log(enriched.recommendations); // { recommendations: [...] }
|
|
4952
|
+
* console.log(enriched.upgrades); // { upgrades: { ... } }
|
|
4953
|
+
* console.log(enriched.bundles); // { bundles: [...] }
|
|
4954
|
+
* ```
|
|
4904
4955
|
*/
|
|
4905
|
-
getCart(cartId: string): Promise<
|
|
4956
|
+
getCart(cartId: string, options?: CartIncludeOptions): Promise<CartWithIncludes>;
|
|
4906
4957
|
/**
|
|
4907
|
-
* Add an item to the cart
|
|
4958
|
+
* Add an item to the cart.
|
|
4959
|
+
*
|
|
4960
|
+
* If the product has `customizationFields` (merchant-defined buyer input
|
|
4961
|
+
* like engraving text, uploaded photos, select options), pass the buyer's
|
|
4962
|
+
* values in `metadata`. Keys must match each field's `key`. For `IMAGE` /
|
|
4963
|
+
* `GALLERY` types, upload the file first via `uploadCustomizationFile()`
|
|
4964
|
+
* and pass the returned URL. The server validates every value against its
|
|
4965
|
+
* `MetafieldDefinition` and rejects the request with HTTP 400 if anything
|
|
4966
|
+
* fails (type mismatch, required missing, not in `enumValues`, etc.).
|
|
4967
|
+
*
|
|
4968
|
+
* Values are snapshotted onto the order line at checkout — later edits to
|
|
4969
|
+
* the field definition do not retroactively change existing orders.
|
|
4908
4970
|
*
|
|
4909
4971
|
* @example
|
|
4910
4972
|
* ```typescript
|
|
4973
|
+
* // Product with no customization fields
|
|
4911
4974
|
* const cart = await client.addToCart('cart_123', {
|
|
4912
4975
|
* productId: 'prod_abc',
|
|
4913
4976
|
* quantity: 2,
|
|
4914
4977
|
* notes: 'Gift wrap please',
|
|
4915
4978
|
* });
|
|
4979
|
+
*
|
|
4980
|
+
* // Product WITH customization fields (engraving + photo + select + multi)
|
|
4981
|
+
* const { url: photoUrl } = await client.uploadCustomizationFile(file);
|
|
4982
|
+
* const cart = await client.addToCart('cart_123', {
|
|
4983
|
+
* productId: 'prod_mug',
|
|
4984
|
+
* quantity: 1,
|
|
4985
|
+
* metadata: {
|
|
4986
|
+
* engraving_text: 'Happy Birthday!', // TEXT
|
|
4987
|
+
* frame_color: 'Gold', // SELECT (must be in enumValues)
|
|
4988
|
+
* upload_photo: photoUrl, // IMAGE
|
|
4989
|
+
* addons: ['Gift wrap'], // MULTI_SELECT (always array)
|
|
4990
|
+
* },
|
|
4991
|
+
* });
|
|
4916
4992
|
* ```
|
|
4917
4993
|
*/
|
|
4918
4994
|
addToCart(cartId: string, item: AddToCartDto): Promise<Cart>;
|
|
@@ -5253,6 +5329,7 @@ declare class BrainerceClient {
|
|
|
5253
5329
|
productId: string;
|
|
5254
5330
|
variantId?: string;
|
|
5255
5331
|
quantity: number;
|
|
5332
|
+
metadata?: Record<string, unknown>;
|
|
5256
5333
|
}): Promise<Cart>;
|
|
5257
5334
|
/**
|
|
5258
5335
|
* Smart get cart - returns the current cart (server-side for both guests and logged-in users)
|
|
@@ -5261,13 +5338,21 @@ declare class BrainerceClient {
|
|
|
5261
5338
|
* - **Guest with session**: Returns server-side session cart
|
|
5262
5339
|
* - **Guest without session**: Returns empty cart (no server call, cart created lazily on add)
|
|
5263
5340
|
*
|
|
5341
|
+
* @param options - Optional. Use `include` to fetch recommendations, upgrades, and bundles
|
|
5342
|
+
* in a single request instead of separate calls.
|
|
5343
|
+
*
|
|
5264
5344
|
* @example
|
|
5265
5345
|
* ```typescript
|
|
5266
5346
|
* const cart = await client.smartGetCart();
|
|
5267
5347
|
* console.log('Items:', cart.items.length);
|
|
5348
|
+
*
|
|
5349
|
+
* // With includes — single request for cart + extras
|
|
5350
|
+
* const enriched = await client.smartGetCart({
|
|
5351
|
+
* include: ['recommendations', 'upgrades', 'bundles'],
|
|
5352
|
+
* });
|
|
5268
5353
|
* ```
|
|
5269
5354
|
*/
|
|
5270
|
-
smartGetCart(): Promise<
|
|
5355
|
+
smartGetCart(options?: CartIncludeOptions): Promise<CartWithIncludes>;
|
|
5271
5356
|
/**
|
|
5272
5357
|
* Smart update cart item quantity
|
|
5273
5358
|
*
|
|
@@ -6660,9 +6745,35 @@ declare class BrainerceClient {
|
|
|
6660
6745
|
*/
|
|
6661
6746
|
setProductCustomizationFields(productId: string, definitionIds: string[]): Promise<ProductCustomizationField[]>;
|
|
6662
6747
|
/**
|
|
6663
|
-
* Upload a file
|
|
6664
|
-
*
|
|
6665
|
-
*
|
|
6748
|
+
* Upload a buyer-submitted file (engraving photo, custom image, etc.) for a
|
|
6749
|
+
* product customization field of type `IMAGE` or `GALLERY`. The returned `url`
|
|
6750
|
+
* is what you pass back in the add-to-cart `metadata` payload.
|
|
6751
|
+
*
|
|
6752
|
+
* Available in storefront and vibe-coded modes — no customer login required.
|
|
6753
|
+
*
|
|
6754
|
+
* Server rules:
|
|
6755
|
+
* - `image/*` MIME only. Other types → HTTP 400.
|
|
6756
|
+
* - Max 5 MB per file.
|
|
6757
|
+
* - Throttled to 10 uploads / minute per IP → HTTP 429.
|
|
6758
|
+
* - Retention: at least 7 days. If the cart never becomes an order, the file
|
|
6759
|
+
* is reclaimed automatically. Once the order exists, the file is kept for
|
|
6760
|
+
* order-history purposes.
|
|
6761
|
+
*
|
|
6762
|
+
* @example
|
|
6763
|
+
* ```ts
|
|
6764
|
+
* // On a product page with IMAGE/GALLERY customization fields:
|
|
6765
|
+
* const { url } = await client.uploadCustomizationFile(fileInput.files[0]);
|
|
6766
|
+
*
|
|
6767
|
+
* // Then include the URL in the add-to-cart metadata:
|
|
6768
|
+
* await client.addToCart(cart.id, {
|
|
6769
|
+
* productId: product.id,
|
|
6770
|
+
* quantity: 1,
|
|
6771
|
+
* metadata: {
|
|
6772
|
+
* engraving_text: 'Happy Birthday!',
|
|
6773
|
+
* upload_photo: url,
|
|
6774
|
+
* },
|
|
6775
|
+
* });
|
|
6776
|
+
* ```
|
|
6666
6777
|
*/
|
|
6667
6778
|
uploadCustomizationFile(file: File | Blob): Promise<{
|
|
6668
6779
|
url: string;
|
|
@@ -6798,10 +6909,12 @@ declare class BrainerceClient {
|
|
|
6798
6909
|
*/
|
|
6799
6910
|
updateEmailSettings(data: UpdateEmailSettingsDto): Promise<EmailSettings>;
|
|
6800
6911
|
/**
|
|
6801
|
-
* Get all email templates for the store
|
|
6912
|
+
* Get all email templates for the store, grouped by (eventType, language).
|
|
6913
|
+
* Response includes the store's primary language and supported languages so
|
|
6914
|
+
* the caller can render a locale selector.
|
|
6802
6915
|
* Requires Admin mode (apiKey)
|
|
6803
6916
|
*/
|
|
6804
|
-
getEmailTemplates(): Promise<
|
|
6917
|
+
getEmailTemplates(): Promise<EmailTemplatesResponse>;
|
|
6805
6918
|
/**
|
|
6806
6919
|
* Get a specific email template
|
|
6807
6920
|
* Requires Admin mode (apiKey)
|
|
@@ -6987,4 +7100,4 @@ declare function enableDevGuards(options?: {
|
|
|
6987
7100
|
force?: boolean;
|
|
6988
7101
|
}): void;
|
|
6989
7102
|
|
|
6990
|
-
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 CartItem, type CartNudge, type CartRecommendationsResponse, type CartStatus, type CartUpgradeSuggestion, type CartUpgradesResponse, 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 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 };
|
|
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 };
|
package/dist/index.d.ts
CHANGED
|
@@ -572,7 +572,7 @@ declare function getProductPrice(product: Pick<Product, 'basePrice' | 'salePrice
|
|
|
572
572
|
* }
|
|
573
573
|
* ```
|
|
574
574
|
*/
|
|
575
|
-
declare function getProductPriceInfo(product: Pick<Product, 'basePrice' | 'salePrice'> | null | undefined): {
|
|
575
|
+
declare function getProductPriceInfo(product: Pick<Product, 'basePrice' | 'salePrice' | 'discount'> | null | undefined): {
|
|
576
576
|
price: number;
|
|
577
577
|
originalPrice: number;
|
|
578
578
|
isOnSale: boolean;
|
|
@@ -961,10 +961,13 @@ interface OrderItem {
|
|
|
961
961
|
totalPrice?: string;
|
|
962
962
|
/** Product image URL (flat, not nested under product object) */
|
|
963
963
|
image?: string;
|
|
964
|
-
/**
|
|
964
|
+
/**
|
|
965
|
+
* Customer input field values captured at checkout (e.g., cake text, uploaded logo).
|
|
966
|
+
* `value` is `string[]` for MULTI_SELECT / GALLERY types, `string` otherwise.
|
|
967
|
+
*/
|
|
965
968
|
customizations?: Record<string, {
|
|
966
969
|
label: string;
|
|
967
|
-
value: string;
|
|
970
|
+
value: string | string[];
|
|
968
971
|
type: string;
|
|
969
972
|
}>;
|
|
970
973
|
}
|
|
@@ -2498,8 +2501,8 @@ interface CustomApiTestResult {
|
|
|
2498
2501
|
* The frontend dynamically loads the SDK script and calls init/render methods.
|
|
2499
2502
|
*/
|
|
2500
2503
|
interface PaymentClientSdk {
|
|
2501
|
-
/** How the payment UI is rendered: 'sdk-widget' (JS SDK), 'iframe', 'redirect',
|
|
2502
|
-
renderType: 'sdk-widget' | 'iframe' | 'redirect' | 'sandbox';
|
|
2504
|
+
/** How the payment UI is rendered: 'sdk-widget' (JS SDK), 'iframe', 'redirect', 'sandbox' (test orders), or 'embedded-fields' (PCI-compliant provider-hosted fields embedded in merchant DOM, e.g. Cardcom OpenFields, Stripe Elements) */
|
|
2505
|
+
renderType: 'sdk-widget' | 'iframe' | 'redirect' | 'sandbox' | 'embedded-fields';
|
|
2503
2506
|
/** URL of the main SDK script to load */
|
|
2504
2507
|
scriptUrl?: string;
|
|
2505
2508
|
/** Name of the global variable set by the SDK script (e.g., 'growPayment') */
|
|
@@ -2521,6 +2524,12 @@ interface PaymentClientSdk {
|
|
|
2521
2524
|
}>;
|
|
2522
2525
|
/** CSS to inject into <head> when SDK is active (e.g., LTR overrides for body-level popups on RTL pages) */
|
|
2523
2526
|
bodyStyles?: string;
|
|
2527
|
+
/** For renderType='embedded-fields': base URL the sensitive-field iframes load (e.g. 'https://secure.cardcom.solutions'). postMessage origin is strictly validated against this. */
|
|
2528
|
+
embeddedFieldsUrl?: string;
|
|
2529
|
+
/** For renderType='embedded-fields': opaque provider session id used in the iframe init handshake (e.g., Cardcom LowProfileId) */
|
|
2530
|
+
embeddedFieldsSessionId?: string;
|
|
2531
|
+
/** Provider discriminator that selects the correct embedded-fields component on the storefront */
|
|
2532
|
+
embeddedFieldsProvider?: 'cardcom';
|
|
2524
2533
|
}
|
|
2525
2534
|
/**
|
|
2526
2535
|
* Payment provider configuration (returned by `getPaymentProviders()`).
|
|
@@ -3156,7 +3165,7 @@ interface UpdateTaxRateDto {
|
|
|
3156
3165
|
/**
|
|
3157
3166
|
* Metafield type for defining value structure
|
|
3158
3167
|
*/
|
|
3159
|
-
type MetafieldType = 'TEXT' | 'TEXTAREA' | 'NUMBER' | 'BOOLEAN' | 'DATE' | 'DATETIME' | 'URL' | 'COLOR' | 'DIMENSION' | 'WEIGHT' | 'JSON' | 'IMAGE' | 'GALLERY';
|
|
3168
|
+
type MetafieldType = 'TEXT' | 'TEXTAREA' | 'NUMBER' | 'BOOLEAN' | 'DATE' | 'DATETIME' | 'URL' | 'COLOR' | 'DIMENSION' | 'WEIGHT' | 'JSON' | 'IMAGE' | 'GALLERY' | 'SELECT' | 'MULTI_SELECT';
|
|
3160
3169
|
/**
|
|
3161
3170
|
* Metafield definition - schema for product metafields
|
|
3162
3171
|
*/
|
|
@@ -3456,6 +3465,7 @@ interface EmailTemplate {
|
|
|
3456
3465
|
storeId: string;
|
|
3457
3466
|
name: string;
|
|
3458
3467
|
eventType: EmailEventType;
|
|
3468
|
+
language: string;
|
|
3459
3469
|
subject: string;
|
|
3460
3470
|
htmlContent: string;
|
|
3461
3471
|
textContent?: string | null;
|
|
@@ -3464,10 +3474,17 @@ interface EmailTemplate {
|
|
|
3464
3474
|
createdAt: string;
|
|
3465
3475
|
updatedAt: string;
|
|
3466
3476
|
}
|
|
3477
|
+
/** Paginated response for email templates, grouped by (eventType, language). */
|
|
3478
|
+
interface EmailTemplatesResponse {
|
|
3479
|
+
templates: EmailTemplate[];
|
|
3480
|
+
language: string;
|
|
3481
|
+
supportedLanguages: string[];
|
|
3482
|
+
}
|
|
3467
3483
|
/** DTO for creating an email template */
|
|
3468
3484
|
interface CreateEmailTemplateDto {
|
|
3469
3485
|
name: string;
|
|
3470
3486
|
eventType: EmailEventType;
|
|
3487
|
+
language: string;
|
|
3471
3488
|
subject: string;
|
|
3472
3489
|
htmlContent: string;
|
|
3473
3490
|
textContent?: string;
|
|
@@ -3580,7 +3597,7 @@ interface UpdateOAuthProviderDto {
|
|
|
3580
3597
|
isEnabled?: boolean;
|
|
3581
3598
|
providerConfig?: Record<string, unknown>;
|
|
3582
3599
|
}
|
|
3583
|
-
type DiscountRuleType = '
|
|
3600
|
+
type DiscountRuleType = 'PRODUCT_DISCOUNT' | 'ORDER_DISCOUNT' | 'BUY_X_GET_Y' | 'BUY_X_GET_X' | 'VOLUME_DISCOUNT' | 'SHIPPING_DISCOUNT' | 'BUNDLE';
|
|
3584
3601
|
/** Discount that was automatically applied to the cart by a rule */
|
|
3585
3602
|
interface CartAppliedDiscount {
|
|
3586
3603
|
ruleId: string;
|
|
@@ -3685,6 +3702,21 @@ interface CartBundleOffer {
|
|
|
3685
3702
|
interface CartBundlesResponse {
|
|
3686
3703
|
bundles: CartBundleOffer[];
|
|
3687
3704
|
}
|
|
3705
|
+
/** Valid values for the cart `include` query parameter */
|
|
3706
|
+
type CartIncludeOption = 'recommendations' | 'upgrades' | 'bundles';
|
|
3707
|
+
/** Options for getCart / smartGetCart with optional includes */
|
|
3708
|
+
interface CartIncludeOptions {
|
|
3709
|
+
include?: CartIncludeOption[];
|
|
3710
|
+
}
|
|
3711
|
+
/** Cart response enriched with optional included data */
|
|
3712
|
+
interface CartWithIncludes extends Cart {
|
|
3713
|
+
/** Cross-sell recommendations (present when include contains 'recommendations') */
|
|
3714
|
+
recommendations?: CartRecommendationsResponse;
|
|
3715
|
+
/** Upgrade suggestions (present when include contains 'upgrades') */
|
|
3716
|
+
upgrades?: CartUpgradesResponse;
|
|
3717
|
+
/** Bundle offers (present when include contains 'bundles') */
|
|
3718
|
+
bundles?: CartBundlesResponse;
|
|
3719
|
+
}
|
|
3688
3720
|
interface OrderBump {
|
|
3689
3721
|
id: string;
|
|
3690
3722
|
title: string;
|
|
@@ -3988,7 +4020,9 @@ declare class BrainerceClient {
|
|
|
3988
4020
|
* // Use tag IDs in getProducts({ tags: ['tag_id'] })
|
|
3989
4021
|
* ```
|
|
3990
4022
|
*/
|
|
3991
|
-
getTags(
|
|
4023
|
+
getTags(options?: {
|
|
4024
|
+
locale?: string;
|
|
4025
|
+
}): Promise<{
|
|
3992
4026
|
tags: Array<{
|
|
3993
4027
|
id: string;
|
|
3994
4028
|
name: string;
|
|
@@ -4901,18 +4935,60 @@ declare class BrainerceClient {
|
|
|
4901
4935
|
getCartByCustomer(customerId: string): Promise<Cart>;
|
|
4902
4936
|
/**
|
|
4903
4937
|
* Get a cart by ID
|
|
4938
|
+
*
|
|
4939
|
+
* @param cartId - The cart ID
|
|
4940
|
+
* @param options - Optional settings. Use `include` to fetch related data in a single request.
|
|
4941
|
+
*
|
|
4942
|
+
* @example
|
|
4943
|
+
* ```typescript
|
|
4944
|
+
* // Basic cart fetch
|
|
4945
|
+
* const cart = await client.getCart('cart_123');
|
|
4946
|
+
*
|
|
4947
|
+
* // Fetch cart with recommendations, upgrades, and bundles in one call
|
|
4948
|
+
* const enriched = await client.getCart('cart_123', {
|
|
4949
|
+
* include: ['recommendations', 'upgrades', 'bundles'],
|
|
4950
|
+
* });
|
|
4951
|
+
* console.log(enriched.recommendations); // { recommendations: [...] }
|
|
4952
|
+
* console.log(enriched.upgrades); // { upgrades: { ... } }
|
|
4953
|
+
* console.log(enriched.bundles); // { bundles: [...] }
|
|
4954
|
+
* ```
|
|
4904
4955
|
*/
|
|
4905
|
-
getCart(cartId: string): Promise<
|
|
4956
|
+
getCart(cartId: string, options?: CartIncludeOptions): Promise<CartWithIncludes>;
|
|
4906
4957
|
/**
|
|
4907
|
-
* Add an item to the cart
|
|
4958
|
+
* Add an item to the cart.
|
|
4959
|
+
*
|
|
4960
|
+
* If the product has `customizationFields` (merchant-defined buyer input
|
|
4961
|
+
* like engraving text, uploaded photos, select options), pass the buyer's
|
|
4962
|
+
* values in `metadata`. Keys must match each field's `key`. For `IMAGE` /
|
|
4963
|
+
* `GALLERY` types, upload the file first via `uploadCustomizationFile()`
|
|
4964
|
+
* and pass the returned URL. The server validates every value against its
|
|
4965
|
+
* `MetafieldDefinition` and rejects the request with HTTP 400 if anything
|
|
4966
|
+
* fails (type mismatch, required missing, not in `enumValues`, etc.).
|
|
4967
|
+
*
|
|
4968
|
+
* Values are snapshotted onto the order line at checkout — later edits to
|
|
4969
|
+
* the field definition do not retroactively change existing orders.
|
|
4908
4970
|
*
|
|
4909
4971
|
* @example
|
|
4910
4972
|
* ```typescript
|
|
4973
|
+
* // Product with no customization fields
|
|
4911
4974
|
* const cart = await client.addToCart('cart_123', {
|
|
4912
4975
|
* productId: 'prod_abc',
|
|
4913
4976
|
* quantity: 2,
|
|
4914
4977
|
* notes: 'Gift wrap please',
|
|
4915
4978
|
* });
|
|
4979
|
+
*
|
|
4980
|
+
* // Product WITH customization fields (engraving + photo + select + multi)
|
|
4981
|
+
* const { url: photoUrl } = await client.uploadCustomizationFile(file);
|
|
4982
|
+
* const cart = await client.addToCart('cart_123', {
|
|
4983
|
+
* productId: 'prod_mug',
|
|
4984
|
+
* quantity: 1,
|
|
4985
|
+
* metadata: {
|
|
4986
|
+
* engraving_text: 'Happy Birthday!', // TEXT
|
|
4987
|
+
* frame_color: 'Gold', // SELECT (must be in enumValues)
|
|
4988
|
+
* upload_photo: photoUrl, // IMAGE
|
|
4989
|
+
* addons: ['Gift wrap'], // MULTI_SELECT (always array)
|
|
4990
|
+
* },
|
|
4991
|
+
* });
|
|
4916
4992
|
* ```
|
|
4917
4993
|
*/
|
|
4918
4994
|
addToCart(cartId: string, item: AddToCartDto): Promise<Cart>;
|
|
@@ -5253,6 +5329,7 @@ declare class BrainerceClient {
|
|
|
5253
5329
|
productId: string;
|
|
5254
5330
|
variantId?: string;
|
|
5255
5331
|
quantity: number;
|
|
5332
|
+
metadata?: Record<string, unknown>;
|
|
5256
5333
|
}): Promise<Cart>;
|
|
5257
5334
|
/**
|
|
5258
5335
|
* Smart get cart - returns the current cart (server-side for both guests and logged-in users)
|
|
@@ -5261,13 +5338,21 @@ declare class BrainerceClient {
|
|
|
5261
5338
|
* - **Guest with session**: Returns server-side session cart
|
|
5262
5339
|
* - **Guest without session**: Returns empty cart (no server call, cart created lazily on add)
|
|
5263
5340
|
*
|
|
5341
|
+
* @param options - Optional. Use `include` to fetch recommendations, upgrades, and bundles
|
|
5342
|
+
* in a single request instead of separate calls.
|
|
5343
|
+
*
|
|
5264
5344
|
* @example
|
|
5265
5345
|
* ```typescript
|
|
5266
5346
|
* const cart = await client.smartGetCart();
|
|
5267
5347
|
* console.log('Items:', cart.items.length);
|
|
5348
|
+
*
|
|
5349
|
+
* // With includes — single request for cart + extras
|
|
5350
|
+
* const enriched = await client.smartGetCart({
|
|
5351
|
+
* include: ['recommendations', 'upgrades', 'bundles'],
|
|
5352
|
+
* });
|
|
5268
5353
|
* ```
|
|
5269
5354
|
*/
|
|
5270
|
-
smartGetCart(): Promise<
|
|
5355
|
+
smartGetCart(options?: CartIncludeOptions): Promise<CartWithIncludes>;
|
|
5271
5356
|
/**
|
|
5272
5357
|
* Smart update cart item quantity
|
|
5273
5358
|
*
|
|
@@ -6660,9 +6745,35 @@ declare class BrainerceClient {
|
|
|
6660
6745
|
*/
|
|
6661
6746
|
setProductCustomizationFields(productId: string, definitionIds: string[]): Promise<ProductCustomizationField[]>;
|
|
6662
6747
|
/**
|
|
6663
|
-
* Upload a file
|
|
6664
|
-
*
|
|
6665
|
-
*
|
|
6748
|
+
* Upload a buyer-submitted file (engraving photo, custom image, etc.) for a
|
|
6749
|
+
* product customization field of type `IMAGE` or `GALLERY`. The returned `url`
|
|
6750
|
+
* is what you pass back in the add-to-cart `metadata` payload.
|
|
6751
|
+
*
|
|
6752
|
+
* Available in storefront and vibe-coded modes — no customer login required.
|
|
6753
|
+
*
|
|
6754
|
+
* Server rules:
|
|
6755
|
+
* - `image/*` MIME only. Other types → HTTP 400.
|
|
6756
|
+
* - Max 5 MB per file.
|
|
6757
|
+
* - Throttled to 10 uploads / minute per IP → HTTP 429.
|
|
6758
|
+
* - Retention: at least 7 days. If the cart never becomes an order, the file
|
|
6759
|
+
* is reclaimed automatically. Once the order exists, the file is kept for
|
|
6760
|
+
* order-history purposes.
|
|
6761
|
+
*
|
|
6762
|
+
* @example
|
|
6763
|
+
* ```ts
|
|
6764
|
+
* // On a product page with IMAGE/GALLERY customization fields:
|
|
6765
|
+
* const { url } = await client.uploadCustomizationFile(fileInput.files[0]);
|
|
6766
|
+
*
|
|
6767
|
+
* // Then include the URL in the add-to-cart metadata:
|
|
6768
|
+
* await client.addToCart(cart.id, {
|
|
6769
|
+
* productId: product.id,
|
|
6770
|
+
* quantity: 1,
|
|
6771
|
+
* metadata: {
|
|
6772
|
+
* engraving_text: 'Happy Birthday!',
|
|
6773
|
+
* upload_photo: url,
|
|
6774
|
+
* },
|
|
6775
|
+
* });
|
|
6776
|
+
* ```
|
|
6666
6777
|
*/
|
|
6667
6778
|
uploadCustomizationFile(file: File | Blob): Promise<{
|
|
6668
6779
|
url: string;
|
|
@@ -6798,10 +6909,12 @@ declare class BrainerceClient {
|
|
|
6798
6909
|
*/
|
|
6799
6910
|
updateEmailSettings(data: UpdateEmailSettingsDto): Promise<EmailSettings>;
|
|
6800
6911
|
/**
|
|
6801
|
-
* Get all email templates for the store
|
|
6912
|
+
* Get all email templates for the store, grouped by (eventType, language).
|
|
6913
|
+
* Response includes the store's primary language and supported languages so
|
|
6914
|
+
* the caller can render a locale selector.
|
|
6802
6915
|
* Requires Admin mode (apiKey)
|
|
6803
6916
|
*/
|
|
6804
|
-
getEmailTemplates(): Promise<
|
|
6917
|
+
getEmailTemplates(): Promise<EmailTemplatesResponse>;
|
|
6805
6918
|
/**
|
|
6806
6919
|
* Get a specific email template
|
|
6807
6920
|
* Requires Admin mode (apiKey)
|
|
@@ -6987,4 +7100,4 @@ declare function enableDevGuards(options?: {
|
|
|
6987
7100
|
force?: boolean;
|
|
6988
7101
|
}): void;
|
|
6989
7102
|
|
|
6990
|
-
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 CartItem, type CartNudge, type CartRecommendationsResponse, type CartStatus, type CartUpgradeSuggestion, type CartUpgradesResponse, 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 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 };
|
|
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 };
|