brainerce 1.15.0 → 1.17.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 +4447 -4334
- package/dist/index.d.mts +270 -15
- package/dist/index.d.ts +270 -15
- package/dist/index.js +273 -34
- package/dist/index.mjs +272 -34
- package/package.json +76 -76
package/dist/index.d.mts
CHANGED
|
@@ -137,6 +137,17 @@ interface StoreInfo {
|
|
|
137
137
|
requireEmailVerification?: boolean;
|
|
138
138
|
/** Upsell feature settings (storefront mode) */
|
|
139
139
|
upsell?: UpsellSettings;
|
|
140
|
+
/** Multi-language / i18n settings */
|
|
141
|
+
i18n?: I18nSettings;
|
|
142
|
+
}
|
|
143
|
+
/** Multi-language configuration exposed to the storefront */
|
|
144
|
+
interface I18nSettings {
|
|
145
|
+
/** Whether multi-language is enabled for this store */
|
|
146
|
+
enabled: boolean;
|
|
147
|
+
/** The store's default locale (content language) */
|
|
148
|
+
defaultLocale: string;
|
|
149
|
+
/** All supported locales */
|
|
150
|
+
supportedLocales: string[];
|
|
140
151
|
}
|
|
141
152
|
/** Upsell feature configuration exposed to the storefront */
|
|
142
153
|
interface UpsellSettings {
|
|
@@ -228,6 +239,8 @@ interface Product {
|
|
|
228
239
|
/** Array of attribute option IDs for global assignments (admin mode only) */
|
|
229
240
|
attributes?: string[];
|
|
230
241
|
metafields?: ProductMetafield[];
|
|
242
|
+
/** Customer-facing input fields assigned to this product (storefront/vibe-coded mode) */
|
|
243
|
+
customizationFields?: ProductCustomizationField[];
|
|
231
244
|
channels?: Record<string, Record<string, unknown>>;
|
|
232
245
|
/** Whether product needs sync to platforms. Always returned by backend. */
|
|
233
246
|
needsSync: boolean;
|
|
@@ -247,6 +260,7 @@ interface Product {
|
|
|
247
260
|
id: string;
|
|
248
261
|
name: string;
|
|
249
262
|
displayType?: string;
|
|
263
|
+
translations?: Record<string, Record<string, string>> | null;
|
|
250
264
|
} | null;
|
|
251
265
|
attributeOption: {
|
|
252
266
|
id: string;
|
|
@@ -255,6 +269,7 @@ interface Product {
|
|
|
255
269
|
swatchColor?: string | null;
|
|
256
270
|
swatchColor2?: string | null;
|
|
257
271
|
swatchImageUrl?: string | null;
|
|
272
|
+
translations?: Record<string, Record<string, string>> | null;
|
|
258
273
|
} | null;
|
|
259
274
|
}>;
|
|
260
275
|
/** Vibe-coded sites this product is published to (admin mode only) */
|
|
@@ -557,7 +572,7 @@ declare function getProductPrice(product: Pick<Product, 'basePrice' | 'salePrice
|
|
|
557
572
|
* }
|
|
558
573
|
* ```
|
|
559
574
|
*/
|
|
560
|
-
declare function getProductPriceInfo(product: Pick<Product, 'basePrice' | 'salePrice'> | null | undefined): {
|
|
575
|
+
declare function getProductPriceInfo(product: Pick<Product, 'basePrice' | 'salePrice' | 'discount'> | null | undefined): {
|
|
561
576
|
price: number;
|
|
562
577
|
originalPrice: number;
|
|
563
578
|
isOnSale: boolean;
|
|
@@ -695,6 +710,11 @@ declare function getProductMetafieldValue(product: Pick<Product, 'metafields'>,
|
|
|
695
710
|
* Filter metafields by type.
|
|
696
711
|
*/
|
|
697
712
|
declare function getProductMetafieldsByType(product: Pick<Product, 'metafields'>, type: string): ProductMetafield[];
|
|
713
|
+
/**
|
|
714
|
+
* Get customer-facing customization fields assigned to a product.
|
|
715
|
+
* These fields should be rendered as inputs on the product page.
|
|
716
|
+
*/
|
|
717
|
+
declare function getProductCustomizationFields(product: Pick<Product, 'customizationFields'>): ProductCustomizationField[];
|
|
698
718
|
interface ProductQueryParams {
|
|
699
719
|
page?: number;
|
|
700
720
|
limit?: number;
|
|
@@ -713,6 +733,8 @@ interface ProductQueryParams {
|
|
|
713
733
|
/** Sort by field (default: menuOrder) */
|
|
714
734
|
sortBy?: 'name' | 'price' | 'createdAt';
|
|
715
735
|
sortOrder?: 'asc' | 'desc';
|
|
736
|
+
/** Locale for translated content (e.g., "he", "es"). Falls back to store default. */
|
|
737
|
+
locale?: string;
|
|
716
738
|
type?: 'SIMPLE' | 'VARIABLE';
|
|
717
739
|
isDownloadable?: boolean;
|
|
718
740
|
}
|
|
@@ -939,6 +961,12 @@ interface OrderItem {
|
|
|
939
961
|
totalPrice?: string;
|
|
940
962
|
/** Product image URL (flat, not nested under product object) */
|
|
941
963
|
image?: string;
|
|
964
|
+
/** Customer input field values captured at checkout (e.g., cake text, uploaded logo) */
|
|
965
|
+
customizations?: Record<string, {
|
|
966
|
+
label: string;
|
|
967
|
+
value: string;
|
|
968
|
+
type: string;
|
|
969
|
+
}>;
|
|
942
970
|
}
|
|
943
971
|
/** A downloadable file attached to a product */
|
|
944
972
|
interface DownloadFile {
|
|
@@ -1151,9 +1179,10 @@ interface Customer {
|
|
|
1151
1179
|
totalOrders: number;
|
|
1152
1180
|
lastOrderAt?: string;
|
|
1153
1181
|
metadata?: Record<string, unknown>;
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1182
|
+
platformConnections?: Array<{
|
|
1183
|
+
platformCode: string;
|
|
1184
|
+
externalId: string;
|
|
1185
|
+
}>;
|
|
1157
1186
|
addresses: CustomerAddress[];
|
|
1158
1187
|
createdAt: string;
|
|
1159
1188
|
updatedAt: string;
|
|
@@ -1843,6 +1872,10 @@ interface CheckoutLineItem {
|
|
|
1843
1872
|
sku?: string | null;
|
|
1844
1873
|
image?: ProductImage | string | null;
|
|
1845
1874
|
} | null;
|
|
1875
|
+
/** Item-level notes (e.g., gift message) */
|
|
1876
|
+
notes?: string | null;
|
|
1877
|
+
/** Custom metadata including customer input field values */
|
|
1878
|
+
metadata?: Record<string, unknown> | null;
|
|
1846
1879
|
}
|
|
1847
1880
|
/**
|
|
1848
1881
|
* Represents an available shipping rate/method for checkout.
|
|
@@ -2040,6 +2073,17 @@ interface Checkout {
|
|
|
2040
2073
|
taxBreakdown?: TaxBreakdown | null;
|
|
2041
2074
|
/** Total amount as string - use parseFloat() */
|
|
2042
2075
|
total: string;
|
|
2076
|
+
/** Surcharge amount from checkout custom fields as string - use parseFloat() */
|
|
2077
|
+
surchargeAmount: string;
|
|
2078
|
+
/** Applied surcharges breakdown from checkout custom fields */
|
|
2079
|
+
appliedSurcharges?: Array<{
|
|
2080
|
+
key: string;
|
|
2081
|
+
name: string;
|
|
2082
|
+
value: unknown;
|
|
2083
|
+
amount: string;
|
|
2084
|
+
}> | null;
|
|
2085
|
+
/** Customer-provided values for checkout custom fields */
|
|
2086
|
+
customFieldValues?: Record<string, unknown> | null;
|
|
2043
2087
|
/** Applied coupon code */
|
|
2044
2088
|
couponCode?: string | null;
|
|
2045
2089
|
/** Line items with nested product/variant data */
|
|
@@ -3147,7 +3191,32 @@ interface PublicMetafieldDefinition {
|
|
|
3147
3191
|
description?: string | null;
|
|
3148
3192
|
type: MetafieldType;
|
|
3149
3193
|
required: boolean;
|
|
3194
|
+
isCustomerInput?: boolean;
|
|
3150
3195
|
enumValues?: string[];
|
|
3196
|
+
minLength?: number | null;
|
|
3197
|
+
maxLength?: number | null;
|
|
3198
|
+
minValue?: number | null;
|
|
3199
|
+
maxValue?: number | null;
|
|
3200
|
+
defaultValue?: string | null;
|
|
3201
|
+
position: number;
|
|
3202
|
+
}
|
|
3203
|
+
/**
|
|
3204
|
+
* Customer-facing input field definition assigned to a specific product.
|
|
3205
|
+
* Returned in product responses to tell the storefront which input fields to render.
|
|
3206
|
+
*/
|
|
3207
|
+
interface ProductCustomizationField {
|
|
3208
|
+
definitionId: string;
|
|
3209
|
+
name: string;
|
|
3210
|
+
key: string;
|
|
3211
|
+
description?: string | null;
|
|
3212
|
+
type: MetafieldType;
|
|
3213
|
+
required: boolean;
|
|
3214
|
+
minLength?: number | null;
|
|
3215
|
+
maxLength?: number | null;
|
|
3216
|
+
minValue?: number | null;
|
|
3217
|
+
maxValue?: number | null;
|
|
3218
|
+
enumValues?: string[];
|
|
3219
|
+
defaultValue?: string | null;
|
|
3151
3220
|
position: number;
|
|
3152
3221
|
}
|
|
3153
3222
|
/**
|
|
@@ -3387,6 +3456,7 @@ interface EmailTemplate {
|
|
|
3387
3456
|
storeId: string;
|
|
3388
3457
|
name: string;
|
|
3389
3458
|
eventType: EmailEventType;
|
|
3459
|
+
language: string;
|
|
3390
3460
|
subject: string;
|
|
3391
3461
|
htmlContent: string;
|
|
3392
3462
|
textContent?: string | null;
|
|
@@ -3395,10 +3465,17 @@ interface EmailTemplate {
|
|
|
3395
3465
|
createdAt: string;
|
|
3396
3466
|
updatedAt: string;
|
|
3397
3467
|
}
|
|
3468
|
+
/** Paginated response for email templates, grouped by (eventType, language). */
|
|
3469
|
+
interface EmailTemplatesResponse {
|
|
3470
|
+
templates: EmailTemplate[];
|
|
3471
|
+
language: string;
|
|
3472
|
+
supportedLanguages: string[];
|
|
3473
|
+
}
|
|
3398
3474
|
/** DTO for creating an email template */
|
|
3399
3475
|
interface CreateEmailTemplateDto {
|
|
3400
3476
|
name: string;
|
|
3401
3477
|
eventType: EmailEventType;
|
|
3478
|
+
language: string;
|
|
3402
3479
|
subject: string;
|
|
3403
3480
|
htmlContent: string;
|
|
3404
3481
|
textContent?: string;
|
|
@@ -3511,7 +3588,7 @@ interface UpdateOAuthProviderDto {
|
|
|
3511
3588
|
isEnabled?: boolean;
|
|
3512
3589
|
providerConfig?: Record<string, unknown>;
|
|
3513
3590
|
}
|
|
3514
|
-
type DiscountRuleType = '
|
|
3591
|
+
type DiscountRuleType = 'PRODUCT_DISCOUNT' | 'ORDER_DISCOUNT' | 'BUY_X_GET_Y' | 'BUY_X_GET_X' | 'VOLUME_DISCOUNT' | 'SHIPPING_DISCOUNT' | 'BUNDLE';
|
|
3515
3592
|
/** Discount that was automatically applied to the cart by a rule */
|
|
3516
3593
|
interface CartAppliedDiscount {
|
|
3517
3594
|
ruleId: string;
|
|
@@ -3553,6 +3630,18 @@ interface CartNudge {
|
|
|
3553
3630
|
quantityNeeded?: number;
|
|
3554
3631
|
}
|
|
3555
3632
|
type ProductRelationType = 'CROSS_SELL' | 'UPSELL' | 'RELATED';
|
|
3633
|
+
interface RecommendationVariant {
|
|
3634
|
+
id: string;
|
|
3635
|
+
name?: string | null;
|
|
3636
|
+
price?: string | null;
|
|
3637
|
+
salePrice?: string | null;
|
|
3638
|
+
attributes?: Record<string, string> | null;
|
|
3639
|
+
image?: ProductImage | string | null;
|
|
3640
|
+
inventory?: {
|
|
3641
|
+
available: number;
|
|
3642
|
+
trackingMode: string;
|
|
3643
|
+
} | null;
|
|
3644
|
+
}
|
|
3556
3645
|
interface ProductRecommendation {
|
|
3557
3646
|
id: string;
|
|
3558
3647
|
name: string;
|
|
@@ -3563,6 +3652,7 @@ interface ProductRecommendation {
|
|
|
3563
3652
|
type: 'SIMPLE' | 'VARIABLE';
|
|
3564
3653
|
inventory?: InventoryInfo | null;
|
|
3565
3654
|
relationType: ProductRelationType;
|
|
3655
|
+
variants?: RecommendationVariant[];
|
|
3566
3656
|
}
|
|
3567
3657
|
interface ProductRecommendationsResponse {
|
|
3568
3658
|
crossSells: ProductRecommendation[];
|
|
@@ -3581,6 +3671,11 @@ interface CartUpgradeSuggestion {
|
|
|
3581
3671
|
interface CartUpgradesResponse {
|
|
3582
3672
|
upgrades: Record<string, CartUpgradeSuggestion>;
|
|
3583
3673
|
}
|
|
3674
|
+
interface LockedVariant {
|
|
3675
|
+
id: string;
|
|
3676
|
+
name?: string | null;
|
|
3677
|
+
attributes?: Record<string, string> | null;
|
|
3678
|
+
}
|
|
3584
3679
|
interface CartBundleOffer {
|
|
3585
3680
|
id: string;
|
|
3586
3681
|
name: string;
|
|
@@ -3588,6 +3683,8 @@ interface CartBundleOffer {
|
|
|
3588
3683
|
sourceProductId: string;
|
|
3589
3684
|
bundleProduct: ProductRecommendation;
|
|
3590
3685
|
bundleVariantId: string | null;
|
|
3686
|
+
requiresVariantSelection: boolean;
|
|
3687
|
+
lockedVariant?: LockedVariant | null;
|
|
3591
3688
|
discountType: 'PERCENTAGE' | 'FIXED_AMOUNT';
|
|
3592
3689
|
discountValue: string;
|
|
3593
3690
|
originalPrice: string;
|
|
@@ -3602,6 +3699,8 @@ interface OrderBump {
|
|
|
3602
3699
|
description: string | null;
|
|
3603
3700
|
bumpProduct: ProductRecommendation;
|
|
3604
3701
|
bumpVariantId: string | null;
|
|
3702
|
+
requiresVariantSelection: boolean;
|
|
3703
|
+
lockedVariant?: LockedVariant | null;
|
|
3605
3704
|
originalPrice: string;
|
|
3606
3705
|
discountedPrice: string | null;
|
|
3607
3706
|
discountType: string | null;
|
|
@@ -3610,6 +3709,61 @@ interface OrderBump {
|
|
|
3610
3709
|
interface CheckoutBumpsResponse {
|
|
3611
3710
|
bumps: OrderBump[];
|
|
3612
3711
|
}
|
|
3712
|
+
/**
|
|
3713
|
+
* Checkout-level custom field definition with optional pricing (surcharges).
|
|
3714
|
+
* Store owners define these; customers fill them in during checkout.
|
|
3715
|
+
*/
|
|
3716
|
+
interface CheckoutCustomFieldDefinition {
|
|
3717
|
+
id: string;
|
|
3718
|
+
key: string;
|
|
3719
|
+
name: string;
|
|
3720
|
+
description?: string | null;
|
|
3721
|
+
type: 'TEXT' | 'TEXTAREA' | 'NUMBER' | 'BOOLEAN' | 'SELECT' | 'DATE';
|
|
3722
|
+
required: boolean;
|
|
3723
|
+
position: number;
|
|
3724
|
+
visibility: CheckoutFieldVisibility;
|
|
3725
|
+
pricing: CheckoutFieldPricing;
|
|
3726
|
+
options?: Array<{
|
|
3727
|
+
value: string;
|
|
3728
|
+
label: string;
|
|
3729
|
+
}> | null;
|
|
3730
|
+
minLength?: number | null;
|
|
3731
|
+
maxLength?: number | null;
|
|
3732
|
+
minValue?: number | null;
|
|
3733
|
+
maxValue?: number | null;
|
|
3734
|
+
translations?: Record<string, Record<string, string>> | null;
|
|
3735
|
+
}
|
|
3736
|
+
interface CheckoutFieldVisibility {
|
|
3737
|
+
show: 'always' | 'shipping' | 'pickup' | 'products';
|
|
3738
|
+
productIds?: string[];
|
|
3739
|
+
categoryIds?: string[];
|
|
3740
|
+
}
|
|
3741
|
+
type CheckoutFieldPricing = {
|
|
3742
|
+
type: 'none';
|
|
3743
|
+
} | {
|
|
3744
|
+
type: 'fixed';
|
|
3745
|
+
amount: number;
|
|
3746
|
+
} | {
|
|
3747
|
+
type: 'boolean_checked';
|
|
3748
|
+
amount: number;
|
|
3749
|
+
} | {
|
|
3750
|
+
type: 'per_option';
|
|
3751
|
+
options: Array<{
|
|
3752
|
+
value: string;
|
|
3753
|
+
label: string;
|
|
3754
|
+
price: number;
|
|
3755
|
+
}>;
|
|
3756
|
+
} | {
|
|
3757
|
+
type: 'conditional';
|
|
3758
|
+
condition: {
|
|
3759
|
+
operator: string;
|
|
3760
|
+
threshold: number;
|
|
3761
|
+
amount: number;
|
|
3762
|
+
};
|
|
3763
|
+
};
|
|
3764
|
+
interface SetCheckoutCustomFieldsDto {
|
|
3765
|
+
fields: Record<string, unknown>;
|
|
3766
|
+
}
|
|
3613
3767
|
interface BrainerceApiError {
|
|
3614
3768
|
statusCode: number;
|
|
3615
3769
|
message: string;
|
|
@@ -3667,7 +3821,33 @@ declare class BrainerceClient {
|
|
|
3667
3821
|
private readonly origin?;
|
|
3668
3822
|
private readonly proxyMode;
|
|
3669
3823
|
private readonly onAuthError?;
|
|
3824
|
+
/** Active locale for content translation. When set, content endpoints return translated data. */
|
|
3825
|
+
private locale?;
|
|
3670
3826
|
constructor(options: BrainerceClientOptions);
|
|
3827
|
+
/**
|
|
3828
|
+
* Set the active locale for content translation.
|
|
3829
|
+
* When set, all content endpoints (products, categories, brands) will return
|
|
3830
|
+
* translated content for this locale, falling back to the store's default language.
|
|
3831
|
+
*
|
|
3832
|
+
* @param locale - Locale code (e.g., "he", "es", "fr") or undefined to clear
|
|
3833
|
+
*/
|
|
3834
|
+
setLocale(locale: string | undefined): void;
|
|
3835
|
+
/**
|
|
3836
|
+
* Get the currently active locale.
|
|
3837
|
+
*/
|
|
3838
|
+
getLocale(): string | undefined;
|
|
3839
|
+
/**
|
|
3840
|
+
* Get the supported locales for this store.
|
|
3841
|
+
* Fetches store info and returns the i18n config.
|
|
3842
|
+
* Returns `[storeLanguage]` if multi-language is not enabled.
|
|
3843
|
+
*
|
|
3844
|
+
* @example
|
|
3845
|
+
* ```typescript
|
|
3846
|
+
* const locales = await client.getSupportedLocales();
|
|
3847
|
+
* // ["en", "he", "es"]
|
|
3848
|
+
* ```
|
|
3849
|
+
*/
|
|
3850
|
+
getSupportedLocales(): Promise<string[]>;
|
|
3671
3851
|
/**
|
|
3672
3852
|
* Apply dev guards to returned objects (when enabled via enableDevGuards()).
|
|
3673
3853
|
* Handles both sync values and Promises.
|
|
@@ -3757,7 +3937,9 @@ declare class BrainerceClient {
|
|
|
3757
3937
|
* Get a single product by ID
|
|
3758
3938
|
* Works in vibe-coded, storefront (public), and admin mode
|
|
3759
3939
|
*/
|
|
3760
|
-
getProduct(productId: string
|
|
3940
|
+
getProduct(productId: string, options?: {
|
|
3941
|
+
locale?: string;
|
|
3942
|
+
}): Promise<Product>;
|
|
3761
3943
|
/**
|
|
3762
3944
|
* Get a single product by slug
|
|
3763
3945
|
* Works in vibe-coded, storefront (public), and admin mode
|
|
@@ -3768,7 +3950,9 @@ declare class BrainerceClient {
|
|
|
3768
3950
|
* const product = await client.getProductBySlug('awesome-product-name');
|
|
3769
3951
|
* ```
|
|
3770
3952
|
*/
|
|
3771
|
-
getProductBySlug(slug: string
|
|
3953
|
+
getProductBySlug(slug: string, options?: {
|
|
3954
|
+
locale?: string;
|
|
3955
|
+
}): Promise<Product>;
|
|
3772
3956
|
/**
|
|
3773
3957
|
* Get available categories for filtering products
|
|
3774
3958
|
* Works in vibe-coded mode
|
|
@@ -3779,7 +3963,9 @@ declare class BrainerceClient {
|
|
|
3779
3963
|
* // categories is a tree structure with children
|
|
3780
3964
|
* ```
|
|
3781
3965
|
*/
|
|
3782
|
-
getCategories(
|
|
3966
|
+
getCategories(options?: {
|
|
3967
|
+
locale?: string;
|
|
3968
|
+
}): Promise<{
|
|
3783
3969
|
categories: CategoryNode[];
|
|
3784
3970
|
}>;
|
|
3785
3971
|
/**
|
|
@@ -3792,7 +3978,9 @@ declare class BrainerceClient {
|
|
|
3792
3978
|
* // Use brand IDs in getProducts({ brands: ['brand_id'] })
|
|
3793
3979
|
* ```
|
|
3794
3980
|
*/
|
|
3795
|
-
getBrands(
|
|
3981
|
+
getBrands(options?: {
|
|
3982
|
+
locale?: string;
|
|
3983
|
+
}): Promise<{
|
|
3796
3984
|
brands: Array<{
|
|
3797
3985
|
id: string;
|
|
3798
3986
|
name: string;
|
|
@@ -3808,7 +3996,9 @@ declare class BrainerceClient {
|
|
|
3808
3996
|
* // Use tag IDs in getProducts({ tags: ['tag_id'] })
|
|
3809
3997
|
* ```
|
|
3810
3998
|
*/
|
|
3811
|
-
getTags(
|
|
3999
|
+
getTags(options?: {
|
|
4000
|
+
locale?: string;
|
|
4001
|
+
}): Promise<{
|
|
3812
4002
|
tags: Array<{
|
|
3813
4003
|
id: string;
|
|
3814
4004
|
name: string;
|
|
@@ -3834,6 +4024,22 @@ declare class BrainerceClient {
|
|
|
3834
4024
|
* const suggestions = await client.getSearchSuggestions('dress', 3);
|
|
3835
4025
|
* ```
|
|
3836
4026
|
*/
|
|
4027
|
+
/**
|
|
4028
|
+
* Get locale alternates for a product (for SEO hreflang tags).
|
|
4029
|
+
* Returns the slug for each available locale.
|
|
4030
|
+
*
|
|
4031
|
+
* @example
|
|
4032
|
+
* ```typescript
|
|
4033
|
+
* const { alternates } = await client.getProductAlternates('product_id');
|
|
4034
|
+
* // alternates = [{ locale: "en", slug: "running-shoes" }, { locale: "he", slug: "נעלי-ריצה" }]
|
|
4035
|
+
* ```
|
|
4036
|
+
*/
|
|
4037
|
+
getProductAlternates(productId: string): Promise<{
|
|
4038
|
+
alternates: Array<{
|
|
4039
|
+
locale: string;
|
|
4040
|
+
slug: string;
|
|
4041
|
+
}>;
|
|
4042
|
+
}>;
|
|
3837
4043
|
getSearchSuggestions(query: string, limit?: number): Promise<SearchSuggestions>;
|
|
3838
4044
|
/**
|
|
3839
4045
|
* Create a new product
|
|
@@ -4917,9 +5123,10 @@ declare class BrainerceClient {
|
|
|
4917
5123
|
*
|
|
4918
5124
|
* @param cartId - Cart ID
|
|
4919
5125
|
* @param bumpConfigId - Order bump config ID
|
|
5126
|
+
* @param variantId - Optional variant ID (required when bump product has variants and no admin-locked variant)
|
|
4920
5127
|
* @returns Updated cart
|
|
4921
5128
|
*/
|
|
4922
|
-
addOrderBump(cartId: string, bumpConfigId: string): Promise<Cart>;
|
|
5129
|
+
addOrderBump(cartId: string, bumpConfigId: string, variantId?: string): Promise<Cart>;
|
|
4923
5130
|
/**
|
|
4924
5131
|
* Remove an order bump from the cart.
|
|
4925
5132
|
*
|
|
@@ -4933,15 +5140,19 @@ declare class BrainerceClient {
|
|
|
4933
5140
|
*
|
|
4934
5141
|
* @param cartId - Cart ID
|
|
4935
5142
|
* @param bundleOfferId - Bundle offer ID
|
|
5143
|
+
* @param variantId - Optional variant ID (required when bundle product has variants and no admin-locked variant)
|
|
4936
5144
|
* @returns Updated cart
|
|
4937
5145
|
*
|
|
4938
5146
|
* @example
|
|
4939
5147
|
* ```typescript
|
|
4940
5148
|
* const { bundles } = await client.getCartBundles('cart_123');
|
|
5149
|
+
* // Simple product or locked variant:
|
|
4941
5150
|
* const cart = await client.addBundleToCart('cart_123', bundles[0].id);
|
|
5151
|
+
* // Product with variants (customer selects):
|
|
5152
|
+
* const cart = await client.addBundleToCart('cart_123', bundles[0].id, selectedVariantId);
|
|
4942
5153
|
* ```
|
|
4943
5154
|
*/
|
|
4944
|
-
addBundleToCart(cartId: string, bundleOfferId: string): Promise<Cart>;
|
|
5155
|
+
addBundleToCart(cartId: string, bundleOfferId: string, variantId?: string): Promise<Cart>;
|
|
4945
5156
|
/**
|
|
4946
5157
|
* Remove a bundle offer product from the cart.
|
|
4947
5158
|
*
|
|
@@ -5329,6 +5540,28 @@ declare class BrainerceClient {
|
|
|
5329
5540
|
* ```
|
|
5330
5541
|
*/
|
|
5331
5542
|
completeCheckout(checkoutId: string): Promise<CompleteCheckoutResponse>;
|
|
5543
|
+
/**
|
|
5544
|
+
* Get applicable custom field definitions for a checkout.
|
|
5545
|
+
* Returns fields filtered by visibility conditions (delivery type, products in cart).
|
|
5546
|
+
* Use these to render dynamic input fields in the checkout flow.
|
|
5547
|
+
*/
|
|
5548
|
+
getCheckoutCustomFields(checkoutId: string): Promise<CheckoutCustomFieldDefinition[]>;
|
|
5549
|
+
/**
|
|
5550
|
+
* Set checkout custom field values and recalculate surcharges.
|
|
5551
|
+
* The checkout total is automatically updated to include surcharges.
|
|
5552
|
+
*
|
|
5553
|
+
* @example
|
|
5554
|
+
* ```typescript
|
|
5555
|
+
* const checkout = await client.setCheckoutCustomFields(checkoutId, {
|
|
5556
|
+
* gift_wrapping: 'premium', // SELECT field
|
|
5557
|
+
* floor_number: 5, // NUMBER field
|
|
5558
|
+
* installation: true, // BOOLEAN field
|
|
5559
|
+
* });
|
|
5560
|
+
* // checkout.surchargeAmount reflects the new surcharges
|
|
5561
|
+
* // checkout.total is recalculated
|
|
5562
|
+
* ```
|
|
5563
|
+
*/
|
|
5564
|
+
setCheckoutCustomFields(checkoutId: string, fields: Record<string, unknown>): Promise<Checkout>;
|
|
5332
5565
|
/**
|
|
5333
5566
|
* Delete a checkout session. Releases inventory reservations and removes
|
|
5334
5567
|
* payment records not yet linked to an order.
|
|
@@ -6425,6 +6658,26 @@ declare class BrainerceClient {
|
|
|
6425
6658
|
* Requires Admin mode (apiKey)
|
|
6426
6659
|
*/
|
|
6427
6660
|
deleteProductMetafield(productId: string, definitionId: string): Promise<void>;
|
|
6661
|
+
/**
|
|
6662
|
+
* Get customization fields assigned to a product.
|
|
6663
|
+
* Requires Admin mode (apiKey).
|
|
6664
|
+
*/
|
|
6665
|
+
getProductCustomizationFields(productId: string): Promise<ProductCustomizationField[]>;
|
|
6666
|
+
/**
|
|
6667
|
+
* Set customization fields for a product (replaces all existing assignments).
|
|
6668
|
+
* Only definitions marked as `isCustomerInput: true` can be assigned.
|
|
6669
|
+
* Requires Admin mode (apiKey).
|
|
6670
|
+
*/
|
|
6671
|
+
setProductCustomizationFields(productId: string, definitionIds: string[]): Promise<ProductCustomizationField[]>;
|
|
6672
|
+
/**
|
|
6673
|
+
* Upload a file for product customization (e.g., customer logo for printing).
|
|
6674
|
+
* Available in storefront and vibe-coded modes.
|
|
6675
|
+
* Returns the uploaded file URL and key.
|
|
6676
|
+
*/
|
|
6677
|
+
uploadCustomizationFile(file: File | Blob): Promise<{
|
|
6678
|
+
url: string;
|
|
6679
|
+
key: string;
|
|
6680
|
+
}>;
|
|
6428
6681
|
/**
|
|
6429
6682
|
* @deprecated Use `getStoreTeam(storeId)` instead.
|
|
6430
6683
|
*/
|
|
@@ -6555,10 +6808,12 @@ declare class BrainerceClient {
|
|
|
6555
6808
|
*/
|
|
6556
6809
|
updateEmailSettings(data: UpdateEmailSettingsDto): Promise<EmailSettings>;
|
|
6557
6810
|
/**
|
|
6558
|
-
* Get all email templates for the store
|
|
6811
|
+
* Get all email templates for the store, grouped by (eventType, language).
|
|
6812
|
+
* Response includes the store's primary language and supported languages so
|
|
6813
|
+
* the caller can render a locale selector.
|
|
6559
6814
|
* Requires Admin mode (apiKey)
|
|
6560
6815
|
*/
|
|
6561
|
-
getEmailTemplates(): Promise<
|
|
6816
|
+
getEmailTemplates(): Promise<EmailTemplatesResponse>;
|
|
6562
6817
|
/**
|
|
6563
6818
|
* Get a specific email template
|
|
6564
6819
|
* Requires Admin mode (apiKey)
|
|
@@ -6744,4 +6999,4 @@ declare function enableDevGuards(options?: {
|
|
|
6744
6999
|
force?: boolean;
|
|
6745
7000
|
}): void;
|
|
6746
7001
|
|
|
6747
|
-
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 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 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 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 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 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, getProductMetafield, getProductMetafieldValue, getProductMetafieldsByType, getProductPrice, getProductPriceInfo, getProductSwatches, getStockStatus, getVariantOptions, getVariantPrice, isCouponApplicableToProduct, isHtmlDescription, isWebhookEventType, parseWebhookEvent, verifyWebhook };
|
|
7002
|
+
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 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 };
|