brainerce 1.44.1 → 1.46.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 +221 -34
- package/dist/index.d.mts +286 -2
- package/dist/index.d.ts +286 -2
- package/dist/index.js +147 -5
- package/dist/index.mjs +147 -5
- package/package.json +81 -81
package/dist/index.d.ts
CHANGED
|
@@ -1202,6 +1202,10 @@ interface CreateProductDto {
|
|
|
1202
1202
|
name: string;
|
|
1203
1203
|
slug?: string;
|
|
1204
1204
|
sku?: string;
|
|
1205
|
+
/** Global Trade Item Number (EAN/UPC/ISBN) — cross-platform identifier. */
|
|
1206
|
+
gtin?: string;
|
|
1207
|
+
/** Manufacturer Part Number — used by Google Shopping (with brand) when no GTIN exists. */
|
|
1208
|
+
mpn?: string;
|
|
1205
1209
|
description?: string;
|
|
1206
1210
|
basePrice: number;
|
|
1207
1211
|
salePrice?: number;
|
|
@@ -1219,11 +1223,26 @@ interface CreateProductDto {
|
|
|
1219
1223
|
brandNames?: string[];
|
|
1220
1224
|
tags?: string[];
|
|
1221
1225
|
images?: ProductImage[];
|
|
1226
|
+
/** Sale-price effective window (ISO 8601) — Google Merchant Center
|
|
1227
|
+
* sale_price_effective_date. Set both together, or neither applies. */
|
|
1228
|
+
salePriceStartsAt?: string;
|
|
1229
|
+
salePriceEndsAt?: string;
|
|
1230
|
+
shippingWeightValue?: number;
|
|
1231
|
+
shippingWeightUnit?: 'kg' | 'lb' | 'g' | 'oz';
|
|
1232
|
+
shippingLengthValue?: number;
|
|
1233
|
+
shippingWidthValue?: number;
|
|
1234
|
+
shippingHeightValue?: number;
|
|
1235
|
+
/** Unit shared by shippingLengthValue/shippingWidthValue/shippingHeightValue. */
|
|
1236
|
+
shippingDimensionUnit?: 'cm' | 'in';
|
|
1222
1237
|
}
|
|
1223
1238
|
interface UpdateProductDto {
|
|
1224
1239
|
name?: string;
|
|
1225
1240
|
slug?: string;
|
|
1226
1241
|
sku?: string;
|
|
1242
|
+
/** Global Trade Item Number (EAN/UPC/ISBN). Pass `null` to clear. */
|
|
1243
|
+
gtin?: string | null;
|
|
1244
|
+
/** Manufacturer Part Number. Pass `null` to clear. */
|
|
1245
|
+
mpn?: string | null;
|
|
1227
1246
|
description?: string;
|
|
1228
1247
|
basePrice?: number;
|
|
1229
1248
|
salePrice?: number | null;
|
|
@@ -1240,6 +1259,15 @@ interface UpdateProductDto {
|
|
|
1240
1259
|
brandNames?: string[];
|
|
1241
1260
|
tags?: string[];
|
|
1242
1261
|
images?: ProductImage[];
|
|
1262
|
+
/** Sale-price effective window (ISO 8601). Pass `null` to clear either bound. */
|
|
1263
|
+
salePriceStartsAt?: string | null;
|
|
1264
|
+
salePriceEndsAt?: string | null;
|
|
1265
|
+
shippingWeightValue?: number | null;
|
|
1266
|
+
shippingWeightUnit?: 'kg' | 'lb' | 'g' | 'oz' | null;
|
|
1267
|
+
shippingLengthValue?: number | null;
|
|
1268
|
+
shippingWidthValue?: number | null;
|
|
1269
|
+
shippingHeightValue?: number | null;
|
|
1270
|
+
shippingDimensionUnit?: 'cm' | 'in' | null;
|
|
1243
1271
|
}
|
|
1244
1272
|
/**
|
|
1245
1273
|
* Response from deleting a product
|
|
@@ -2930,6 +2958,32 @@ interface ShippingDestinations {
|
|
|
2930
2958
|
name: string;
|
|
2931
2959
|
}>>;
|
|
2932
2960
|
}
|
|
2961
|
+
/** One predicted address from `getAddressSuggestions()`. */
|
|
2962
|
+
interface AddressSuggestion {
|
|
2963
|
+
/** Opaque id — pass to `getAddressDetails()` to resolve the full address. */
|
|
2964
|
+
placeId: string;
|
|
2965
|
+
/** Human-readable prediction text to render in the dropdown. */
|
|
2966
|
+
description: string;
|
|
2967
|
+
}
|
|
2968
|
+
/**
|
|
2969
|
+
* A resolved address + whether it falls inside any of the store's shipping
|
|
2970
|
+
* zones. `inZone: false` doesn't mean the order can't ship there — it's a
|
|
2971
|
+
* soft signal for a UI banner like "outside our regular delivery zones,
|
|
2972
|
+
* we'll confirm by phone" (see `getAddressDetails()`), never a hard block.
|
|
2973
|
+
*/
|
|
2974
|
+
interface AddressDetailsResult {
|
|
2975
|
+
address: {
|
|
2976
|
+
line1: string;
|
|
2977
|
+
city: string;
|
|
2978
|
+
region: string;
|
|
2979
|
+
postalCode: string;
|
|
2980
|
+
country: string;
|
|
2981
|
+
lat: number;
|
|
2982
|
+
lng: number;
|
|
2983
|
+
formattedAddress: string;
|
|
2984
|
+
};
|
|
2985
|
+
inZone: boolean;
|
|
2986
|
+
}
|
|
2933
2987
|
interface CompleteCheckoutResponse {
|
|
2934
2988
|
orderId: string;
|
|
2935
2989
|
}
|
|
@@ -3643,6 +3697,10 @@ interface CreateCategoryDto {
|
|
|
3643
3697
|
/** R2/S3 object key for `image`; powers asset-deletion cascade. */
|
|
3644
3698
|
imageKey?: string;
|
|
3645
3699
|
taxBehavior?: 'taxable' | 'exempt';
|
|
3700
|
+
/** Merchant override for Google's numeric product taxonomy id (Merchant
|
|
3701
|
+
* Center `google_product_category`). Omit to let the name-based
|
|
3702
|
+
* auto-resolver assign one. */
|
|
3703
|
+
googleTaxonomyId?: number;
|
|
3646
3704
|
}
|
|
3647
3705
|
interface UpdateCategoryDto {
|
|
3648
3706
|
name?: string;
|
|
@@ -3652,6 +3710,10 @@ interface UpdateCategoryDto {
|
|
|
3652
3710
|
/** R2/S3 object key for `image`; pass null to clear. */
|
|
3653
3711
|
imageKey?: string | null;
|
|
3654
3712
|
taxBehavior?: 'taxable' | 'exempt';
|
|
3713
|
+
/** Merchant override for Google's numeric product taxonomy id. Pass a
|
|
3714
|
+
* valid id to pin it (protects it from auto-resolution forever); pass
|
|
3715
|
+
* `null` to clear the override and re-resolve automatically. */
|
|
3716
|
+
googleTaxonomyId?: number | null;
|
|
3655
3717
|
}
|
|
3656
3718
|
/**
|
|
3657
3719
|
* Brand entity for product organization
|
|
@@ -3888,6 +3950,14 @@ interface TaxonomyQueryParams {
|
|
|
3888
3950
|
/**
|
|
3889
3951
|
* Shipping zone with geographic restrictions
|
|
3890
3952
|
*/
|
|
3953
|
+
/** GeoJSON Polygon/MultiPolygon, [lng, lat] ring coordinates (RFC 7946). */
|
|
3954
|
+
type ShippingZoneGeometry = {
|
|
3955
|
+
type: 'Polygon';
|
|
3956
|
+
coordinates: number[][][];
|
|
3957
|
+
} | {
|
|
3958
|
+
type: 'MultiPolygon';
|
|
3959
|
+
coordinates: number[][][][];
|
|
3960
|
+
};
|
|
3891
3961
|
interface ShippingZone {
|
|
3892
3962
|
id: string;
|
|
3893
3963
|
accountId: string;
|
|
@@ -3899,12 +3969,25 @@ interface ShippingZone {
|
|
|
3899
3969
|
regions?: Record<string, string[]> | null;
|
|
3900
3970
|
/** Postal code patterns */
|
|
3901
3971
|
postalCodes?: Record<string, string[]> | null;
|
|
3972
|
+
/**
|
|
3973
|
+
* Polygon zone definition ("draw on map") — one or more hand-drawn shapes.
|
|
3974
|
+
* Independent of countries/regions/postalCodes: a zone matches if the
|
|
3975
|
+
* address satisfies *either* the country-list coverage *or* the polygon
|
|
3976
|
+
* coverage, so both may be set on the same zone.
|
|
3977
|
+
*/
|
|
3978
|
+
geometry?: ShippingZoneGeometry | null;
|
|
3902
3979
|
/**
|
|
3903
3980
|
* Region restriction (PRD §25). Region IDs this zone is limited to. Empty =
|
|
3904
3981
|
* available for any region (default). Non-empty = the zone is only offered to
|
|
3905
3982
|
* checkouts whose region is in the list.
|
|
3906
3983
|
*/
|
|
3907
3984
|
regionIds: string[];
|
|
3985
|
+
/**
|
|
3986
|
+
* Sales-channel restriction. `SalesChannel.id` values. Empty = available
|
|
3987
|
+
* on every channel (default). Non-empty = the zone is only offered to
|
|
3988
|
+
* checkouts from a channel in the list.
|
|
3989
|
+
*/
|
|
3990
|
+
salesChannelIds: string[];
|
|
3908
3991
|
/** Zone priority (lower = higher priority) */
|
|
3909
3992
|
priority: number;
|
|
3910
3993
|
isActive: boolean;
|
|
@@ -3943,8 +4026,16 @@ interface CreateShippingZoneDto {
|
|
|
3943
4026
|
countries: string[];
|
|
3944
4027
|
regions?: Record<string, string[]>;
|
|
3945
4028
|
postalCodes?: Record<string, string[]>;
|
|
4029
|
+
/**
|
|
4030
|
+
* Polygon zone definition ("draw on map") — one or more hand-drawn shapes,
|
|
4031
|
+
* combined with countries/regions/postalCodes via OR (both may be set on
|
|
4032
|
+
* the same zone).
|
|
4033
|
+
*/
|
|
4034
|
+
geometry?: ShippingZoneGeometry;
|
|
3946
4035
|
/** Region restriction (PRD §25). Region IDs; empty/omitted = any region. */
|
|
3947
4036
|
regionIds?: string[];
|
|
4037
|
+
/** Sales-channel restriction (SalesChannel.id, or vc_* connectionId). Empty/omitted = every channel. */
|
|
4038
|
+
salesChannelIds?: string[];
|
|
3948
4039
|
priority?: number;
|
|
3949
4040
|
isActive?: boolean;
|
|
3950
4041
|
}
|
|
@@ -3953,8 +4044,12 @@ interface UpdateShippingZoneDto {
|
|
|
3953
4044
|
countries?: string[];
|
|
3954
4045
|
regions?: Record<string, string[]> | null;
|
|
3955
4046
|
postalCodes?: Record<string, string[]> | null;
|
|
4047
|
+
/** Polygon zone definition ("draw on map"). Pass `null` to clear. Omit to leave unchanged. */
|
|
4048
|
+
geometry?: ShippingZoneGeometry | null;
|
|
3956
4049
|
/** Region restriction (PRD §25). Empty array = clear; omit = leave unchanged. */
|
|
3957
4050
|
regionIds?: string[];
|
|
4051
|
+
/** Sales-channel restriction. Empty array = clear (every channel); omit = leave unchanged. */
|
|
4052
|
+
salesChannelIds?: string[];
|
|
3958
4053
|
priority?: number;
|
|
3959
4054
|
isActive?: boolean;
|
|
3960
4055
|
platformSettings?: Record<string, unknown>;
|
|
@@ -4666,6 +4761,122 @@ interface UpdateEmailSettingsDto {
|
|
|
4666
4761
|
hourlyRateLimit?: number;
|
|
4667
4762
|
customDomainId?: string;
|
|
4668
4763
|
}
|
|
4764
|
+
/** One FAQ entry the bot can answer from directly. */
|
|
4765
|
+
interface BotFaq {
|
|
4766
|
+
q: string;
|
|
4767
|
+
a: string;
|
|
4768
|
+
}
|
|
4769
|
+
/** Per-capability on/off toggles. */
|
|
4770
|
+
interface BotCapabilities {
|
|
4771
|
+
productQa?: boolean;
|
|
4772
|
+
recommendations?: boolean;
|
|
4773
|
+
orderTracking?: boolean;
|
|
4774
|
+
returns?: boolean;
|
|
4775
|
+
cartRecovery?: boolean;
|
|
4776
|
+
bundleNudges?: boolean;
|
|
4777
|
+
}
|
|
4778
|
+
/** Persona/behavior config — greeting, tone, starter questions, guardrails, capabilities. */
|
|
4779
|
+
interface PersonaConfig {
|
|
4780
|
+
greeting?: string;
|
|
4781
|
+
tone?: 'friendly' | 'formal' | 'playful' | 'concise';
|
|
4782
|
+
accentColor?: string;
|
|
4783
|
+
responseLength?: 'concise' | 'balanced' | 'detailed';
|
|
4784
|
+
emoji?: boolean;
|
|
4785
|
+
bubbleShape?: 'rounded' | 'square';
|
|
4786
|
+
displayMode?: 'floating' | 'side_rail' | 'inline' | 'auto_open' | 'full_screen';
|
|
4787
|
+
position?: 'start' | 'end';
|
|
4788
|
+
allowExpand?: boolean;
|
|
4789
|
+
/** Freeform merchant instructions injected into the bot's system prompt. */
|
|
4790
|
+
customInstructions?: string;
|
|
4791
|
+
faqs?: BotFaq[];
|
|
4792
|
+
capabilities?: BotCapabilities;
|
|
4793
|
+
languages?: ('en' | 'he' | 'ar' | 'es' | 'fr')[];
|
|
4794
|
+
/** Starter questions shown as quick-reply chips before the shopper types. */
|
|
4795
|
+
starterQuestions?: string[];
|
|
4796
|
+
/** Freeform guardrail text — topics the bot should decline to discuss. */
|
|
4797
|
+
avoidTopics?: string;
|
|
4798
|
+
maxDiscountPct?: number | null;
|
|
4799
|
+
minRecommend?: number | null;
|
|
4800
|
+
}
|
|
4801
|
+
/** One connection (SalesChannel) + its current (or default) bot settings. */
|
|
4802
|
+
interface BotSettings {
|
|
4803
|
+
salesChannelId: string;
|
|
4804
|
+
connectionId: string;
|
|
4805
|
+
name: string;
|
|
4806
|
+
enabled: boolean;
|
|
4807
|
+
displayName: string;
|
|
4808
|
+
avatarUrl: string | null;
|
|
4809
|
+
personaJson: PersonaConfig;
|
|
4810
|
+
escalationJson: Record<string, unknown>;
|
|
4811
|
+
retentionJson: Record<string, unknown>;
|
|
4812
|
+
localeJson: Record<string, unknown> | null;
|
|
4813
|
+
dailySpendCeilingUsd: number | null;
|
|
4814
|
+
}
|
|
4815
|
+
interface BotSettingsConfigResponse {
|
|
4816
|
+
connections: {
|
|
4817
|
+
salesChannelId: string;
|
|
4818
|
+
connectionId: string;
|
|
4819
|
+
name: string;
|
|
4820
|
+
}[];
|
|
4821
|
+
settings: BotSettings[];
|
|
4822
|
+
}
|
|
4823
|
+
/** PATCH semantics — only fields present are changed. */
|
|
4824
|
+
interface UpdateBotSettingsDto {
|
|
4825
|
+
salesChannelId: string;
|
|
4826
|
+
enabled?: boolean;
|
|
4827
|
+
displayName?: string;
|
|
4828
|
+
avatarUrl?: string;
|
|
4829
|
+
personaJson?: PersonaConfig;
|
|
4830
|
+
}
|
|
4831
|
+
interface BotConversationMessage {
|
|
4832
|
+
id: string;
|
|
4833
|
+
role: string;
|
|
4834
|
+
content: string;
|
|
4835
|
+
createdAt: string;
|
|
4836
|
+
}
|
|
4837
|
+
interface BotConversationListItem {
|
|
4838
|
+
id: string;
|
|
4839
|
+
salesChannelId: string;
|
|
4840
|
+
title: string | null;
|
|
4841
|
+
locale: string;
|
|
4842
|
+
customerName: string | null;
|
|
4843
|
+
lastMessage: {
|
|
4844
|
+
role: string;
|
|
4845
|
+
content: string;
|
|
4846
|
+
createdAt: string;
|
|
4847
|
+
} | null;
|
|
4848
|
+
messageCount: number;
|
|
4849
|
+
unread: boolean;
|
|
4850
|
+
lastActivityAt: string;
|
|
4851
|
+
createdAt: string;
|
|
4852
|
+
}
|
|
4853
|
+
interface BotConversationDetail {
|
|
4854
|
+
id: string;
|
|
4855
|
+
salesChannelId: string;
|
|
4856
|
+
title: string | null;
|
|
4857
|
+
locale: string;
|
|
4858
|
+
customerName: string | null;
|
|
4859
|
+
customerEmail: string | null;
|
|
4860
|
+
merchantReadAt: string | null;
|
|
4861
|
+
lastActivityAt: string;
|
|
4862
|
+
createdAt: string;
|
|
4863
|
+
messages: BotConversationMessage[];
|
|
4864
|
+
/** Rolling summary from the most recent summarize() call, if any. */
|
|
4865
|
+
summarizedHistory: string | null;
|
|
4866
|
+
}
|
|
4867
|
+
interface BotConversationsPage {
|
|
4868
|
+
data: BotConversationListItem[];
|
|
4869
|
+
meta: {
|
|
4870
|
+
page: number;
|
|
4871
|
+
limit: number;
|
|
4872
|
+
total: number;
|
|
4873
|
+
totalPages: number;
|
|
4874
|
+
};
|
|
4875
|
+
}
|
|
4876
|
+
interface SummarizeBotConversationResult {
|
|
4877
|
+
summarized: boolean;
|
|
4878
|
+
summary: string | null;
|
|
4879
|
+
}
|
|
4669
4880
|
/** Email template */
|
|
4670
4881
|
interface EmailTemplate {
|
|
4671
4882
|
id: string;
|
|
@@ -8033,6 +8244,47 @@ declare class BrainerceClient {
|
|
|
8033
8244
|
* ```
|
|
8034
8245
|
*/
|
|
8035
8246
|
getShippingRates(checkoutId: string): Promise<ShippingRate[]>;
|
|
8247
|
+
/**
|
|
8248
|
+
* Address autocomplete predictions for a checkout address field.
|
|
8249
|
+
*
|
|
8250
|
+
* `sessionToken` groups one address-entry attempt together for billing —
|
|
8251
|
+
* generate a fresh id (e.g. `crypto.randomUUID()`) when the field is
|
|
8252
|
+
* focused, reuse it for every keystroke, then pass the same value once more
|
|
8253
|
+
* to `getAddressDetails()` when the shopper picks a suggestion. Debounce
|
|
8254
|
+
* calls to this method (e.g. 300ms) rather than firing on every keystroke.
|
|
8255
|
+
*
|
|
8256
|
+
* @example
|
|
8257
|
+
* ```typescript
|
|
8258
|
+
* const sessionToken = crypto.randomUUID();
|
|
8259
|
+
* const suggestions = await client.getAddressSuggestions('123 Main', sessionToken);
|
|
8260
|
+
* ```
|
|
8261
|
+
*/
|
|
8262
|
+
getAddressSuggestions(query: string, sessionToken: string, near?: {
|
|
8263
|
+
lat: number;
|
|
8264
|
+
lng: number;
|
|
8265
|
+
}): Promise<AddressSuggestion[]>;
|
|
8266
|
+
/**
|
|
8267
|
+
* Resolve a predicted place (from `getAddressSuggestions()`) to a full
|
|
8268
|
+
* postal address + coordinates, and whether it falls inside any of the
|
|
8269
|
+
* store's shipping zones. Pass the SAME `sessionToken` used for the
|
|
8270
|
+
* preceding suggestion calls — this is the billed call that ends the
|
|
8271
|
+
* autocomplete session.
|
|
8272
|
+
*
|
|
8273
|
+
* `inZone: false` is a soft signal, not a rejection — pair it with a
|
|
8274
|
+
* banner like "outside our regular delivery zones, we'll confirm by phone"
|
|
8275
|
+
* and still let the shopper continue.
|
|
8276
|
+
*
|
|
8277
|
+
* @example
|
|
8278
|
+
* ```typescript
|
|
8279
|
+
* const details = await client.getAddressDetails(suggestion.placeId, sessionToken);
|
|
8280
|
+
* if (!details.inZone) {
|
|
8281
|
+
* showOutsideZoneBanner();
|
|
8282
|
+
* }
|
|
8283
|
+
* ```
|
|
8284
|
+
*/
|
|
8285
|
+
getAddressDetails(placeId: string, sessionToken: string, options?: {
|
|
8286
|
+
regionId?: string;
|
|
8287
|
+
}): Promise<AddressDetailsResult>;
|
|
8036
8288
|
/**
|
|
8037
8289
|
* Select a shipping method for checkout
|
|
8038
8290
|
*
|
|
@@ -9891,6 +10143,38 @@ declare class BrainerceClient {
|
|
|
9891
10143
|
* Requires Admin mode (apiKey)
|
|
9892
10144
|
*/
|
|
9893
10145
|
updateEmailSettings(data: UpdateEmailSettingsDto): Promise<EmailSettings>;
|
|
10146
|
+
/**
|
|
10147
|
+
* Get Storefront Bot (AI Shopping Assistant) settings for every connection
|
|
10148
|
+
* on the store — name, avatar, persona, starter questions, guardrails,
|
|
10149
|
+
* capabilities. Requires Admin mode (apiKey).
|
|
10150
|
+
*/
|
|
10151
|
+
getBotSettings(): Promise<BotSettingsConfigResponse>;
|
|
10152
|
+
/**
|
|
10153
|
+
* Create/update one connection's Storefront Bot settings. Only fields
|
|
10154
|
+
* present in `data` are changed (PATCH semantics). Requires Admin mode
|
|
10155
|
+
* (apiKey).
|
|
10156
|
+
*/
|
|
10157
|
+
updateBotSettings(data: UpdateBotSettingsDto): Promise<BotSettings>;
|
|
10158
|
+
/**
|
|
10159
|
+
* Paginated Storefront Bot conversation inbox, optionally filtered to one
|
|
10160
|
+
* connection. Requires Admin mode (apiKey).
|
|
10161
|
+
*/
|
|
10162
|
+
listBotConversations(opts?: {
|
|
10163
|
+
salesChannelId?: string;
|
|
10164
|
+
page?: number;
|
|
10165
|
+
limit?: number;
|
|
10166
|
+
}): Promise<BotConversationsPage>;
|
|
10167
|
+
/**
|
|
10168
|
+
* Full transcript for one Storefront Bot conversation, including its
|
|
10169
|
+
* summary if one was generated. Requires Admin mode (apiKey).
|
|
10170
|
+
*/
|
|
10171
|
+
getBotConversation(conversationId: string): Promise<BotConversationDetail>;
|
|
10172
|
+
/**
|
|
10173
|
+
* Summarize a Storefront Bot conversation on demand and persist the
|
|
10174
|
+
* summary. Short threads (10 or fewer messages) are a graceful no-op — no
|
|
10175
|
+
* credits charged. Requires Admin mode (apiKey).
|
|
10176
|
+
*/
|
|
10177
|
+
summarizeBotConversation(conversationId: string): Promise<SummarizeBotConversationResult>;
|
|
9894
10178
|
/**
|
|
9895
10179
|
* Get all email templates for the store, grouped by (eventType, language).
|
|
9896
10180
|
* Response includes the store's primary language and supported languages so
|
|
@@ -10009,7 +10293,7 @@ declare class BrainerceError extends Error {
|
|
|
10009
10293
|
constructor(message: string, statusCode: number, details?: unknown);
|
|
10010
10294
|
}
|
|
10011
10295
|
|
|
10012
|
-
declare const SDK_VERSION = "1.
|
|
10296
|
+
declare const SDK_VERSION = "1.45.0";
|
|
10013
10297
|
|
|
10014
10298
|
/**
|
|
10015
10299
|
* Verify a webhook signature from Brainerce
|
|
@@ -10149,4 +10433,4 @@ declare function formatVariantPrice(variant: Pick<ProductVariant, 'price' | 'sal
|
|
|
10149
10433
|
/** Format any numeric amount as currency. Useful for cart totals, fees, etc. */
|
|
10150
10434
|
declare function formatMoney(amount: number, currency: string, locale?: string): string;
|
|
10151
10435
|
|
|
10152
|
-
export { type AddToCartDto, type AnnouncementContent, type AnnouncementSeverity, type AppliedDiscount, type ApplyCouponDto, type AttachModifierGroupInput, 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 CartItemModifierLine, 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 ContactFormFieldType, type ContactFormFieldValidation, type ContactFormPublic, type ContactFormPublicField, type ContactFormSummary, type Content, type ContentDataMap, type ContentStatus, type ContentSummary, type ContentType, type Coupon, type CouponCreateResponse, type CouponQueryParams, type CouponStatus, type CouponType, type CouponValidationWarning, type CreateAddressDto, type CreateAttributeDto as CreateAttributeInput, type CreateAttributeOptionDto as CreateAttributeOptionInput, type CreateBrandDto as CreateBrandInput, type CreateCategoryDto as CreateCategoryInput, type CreateCheckoutDto, type CreateContentInput, type CreateCouponDto, type CreateCustomApiDto, type CreateCustomerDto, type CreateEmailTemplateDto as CreateEmailTemplateInput, type CreateGuestOrderDto, type CreateInquiryInput, type CreateInquiryResponse, type CreateMetafieldDefinitionDto as CreateMetafieldDefinitionInput, type CreateModifierGroupInput, type CreateModifierInput, type CreateOrderDto, type CreateProductDto, type CreateRefundDto, type 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 FaqContent, type FaqItem, type FooterColumn, type FooterContent, type FooterLink, type FooterSocialLink, type FormatPriceOptions, type FormatProductPriceOptions, type FreeAllocationPolicy, type FulfillOrderDto, type GuestCheckoutStartResponse, type GuestOrderResponse, type HeaderContent, type HeaderCta, type HeaderLogo, type HeaderNavItem, type InsufficientStockError, type InventoryInfo, type InventoryReservationStrategy, type InventorySyncStatus, type InventoryTrackingMode, type InvitationStatus, type InviteMemberDto as InviteMemberInput, type InviteStoreMemberDto as InviteStoreMemberInput, type ListModifierGroupsParams, type LocalCart, type LocalCartItem, type LockedVariant, type LoyaltyNextTierSummary, type LoyaltyReward, type LoyaltyStatus, type LoyaltyTierSummary, type MergeCartsDto, type MetafieldConflict, type MetafieldConflictResolution, type MetafieldDefinition, type MetafieldType, type Modifier, type ModifierGroup, type ModifierSelection, type ModifierSelectionType, type ModifierValidationCode, type ModifierValidationError, type MyProductReview, type OAuthAuthorizeResponse, type OAuthCallbackResponse, type OAuthConnection, type OAuthConnectionsResponse, type OAuthProviderConfig, type OAuthProviderType, type OAuthProvidersResponse, type Order, type OrderAddress, type OrderBump, type OrderCustomer, type OrderDownloadLink, type OrderItem, type OrderQueryParams, type OrderStatus, type OrderStatusChange, type PageContent, type PageSeo, type PaginatedResponse, type PaymentClientSdk, type PaymentConfig, type PaymentIntent, type PaymentProvider, type PaymentProviderConfig, type PaymentProvidersConfig, type PaymentStatus, type PaymentUrlOptions, type PickupLocation, type PlatformCouponCapabilities, type PlatformMetafieldMetadata, type PreviewEmailTemplateDto as PreviewEmailTemplateInput, type Product, type ProductAttributeInput, type ProductAvailability, type ProductCustomizationField, type ProductDiscount, type ProductDiscountBadge, type ProductImage, type ProductMetafield, type ProductMetafieldValue, type ProductModifierGroupAttachment, type ProductQueryParams, type ProductRecommendation, type ProductRecommendationsResponse, type ProductRelationType, type ProductReview, type ProductReviewAdmin, type ProductSuggestion, type ProductVariant, type PublicMetafieldDefinition, type PublishProductResponse, RTL_LOCALES, type RecommendationVariant, type ReconcileInventoryResponse, type RedeemRewardResult, type ReferralInfo, type Refund, type RefundLineItem, type RefundLineItemResponse, type RefundType, type RegisterCustomerDto, type ReservationInfo, type ResolveMetafieldConflictDto as ResolveMetafieldConflictInput, type ResolveSyncConflictDto as ResolveSyncConflictInput, type RichTextContent, SDK_VERSION, type SearchSuggestions, type SelectPickupLocationDto, type SelectShippingMethodDto, type SendInvoiceDto, type SessionCartRef, type SetBillingAddressDto, type SetCheckoutCustomFieldsDto, type SetCheckoutCustomerDto, type SetDefinitionProductsDto as SetDefinitionProductsInput, type SetMetafieldPlatformsDto as SetMetafieldPlatformsInput, type SetShippingAddressDto, type SetShippingAddressResponse, type 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 SubmitProductReviewInput, type SupportedLocaleObject, 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 UpdateAttachmentInput, type UpdateAttributeDto as UpdateAttributeInput, type UpdateAttributeOptionDto as UpdateAttributeOptionInput, type UpdateBrandDto as UpdateBrandInput, type UpdateCartItemDto, type UpdateCategoryDto as UpdateCategoryInput, type UpdateContentInput, 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 UpdateModifierGroupInput, type UpdateModifierInput, 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, type WriteProductReviewInput, createWebhookHandler, deriveSeoDescription, enableDevGuards, formatMoney, formatPrice, formatProductPrice, formatVariantPrice, getCartItemImage, getCartItemName, getCartTotals, getDescriptionContent, getDirectionForLocale, formatPrice as getPriceDisplay, getProductCustomizationFields, getProductMetafield, getProductMetafieldValue, getProductMetafieldsByType, getProductPrice, getProductPriceInfo, getProductSwatches, getStockStatus, getVariantOptions, getVariantPrice, isAllowedPaymentUrl, isCouponApplicableToProduct, isHtmlDescription, isWebhookEventType, parseWebhookEvent, safePaymentRedirect, stripHtml, verifyWebhook };
|
|
10436
|
+
export { type AddToCartDto, type AddressDetailsResult, type AddressSuggestion, type AnnouncementContent, type AnnouncementSeverity, type AppliedDiscount, type ApplyCouponDto, type AttachModifierGroupInput, 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 CartItemModifierLine, 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 ContactFormFieldType, type ContactFormFieldValidation, type ContactFormPublic, type ContactFormPublicField, type ContactFormSummary, type Content, type ContentDataMap, type ContentStatus, type ContentSummary, type ContentType, type Coupon, type CouponCreateResponse, type CouponQueryParams, type CouponStatus, type CouponType, type CouponValidationWarning, type CreateAddressDto, type CreateAttributeDto as CreateAttributeInput, type CreateAttributeOptionDto as CreateAttributeOptionInput, type CreateBrandDto as CreateBrandInput, type CreateCategoryDto as CreateCategoryInput, type CreateCheckoutDto, type CreateContentInput, type CreateCouponDto, type CreateCustomApiDto, type CreateCustomerDto, type CreateEmailTemplateDto as CreateEmailTemplateInput, type CreateGuestOrderDto, type CreateInquiryInput, type CreateInquiryResponse, type CreateMetafieldDefinitionDto as CreateMetafieldDefinitionInput, type CreateModifierGroupInput, type CreateModifierInput, type CreateOrderDto, type CreateProductDto, type CreateRefundDto, type 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 FaqContent, type FaqItem, type FooterColumn, type FooterContent, type FooterLink, type FooterSocialLink, type FormatPriceOptions, type FormatProductPriceOptions, type FreeAllocationPolicy, type FulfillOrderDto, type GuestCheckoutStartResponse, type GuestOrderResponse, type HeaderContent, type HeaderCta, type HeaderLogo, type HeaderNavItem, type InsufficientStockError, type InventoryInfo, type InventoryReservationStrategy, type InventorySyncStatus, type InventoryTrackingMode, type InvitationStatus, type InviteMemberDto as InviteMemberInput, type InviteStoreMemberDto as InviteStoreMemberInput, type ListModifierGroupsParams, type LocalCart, type LocalCartItem, type LockedVariant, type LoyaltyNextTierSummary, type LoyaltyReward, type LoyaltyStatus, type LoyaltyTierSummary, type MergeCartsDto, type MetafieldConflict, type MetafieldConflictResolution, type MetafieldDefinition, type MetafieldType, type Modifier, type ModifierGroup, type ModifierSelection, type ModifierSelectionType, type ModifierValidationCode, type ModifierValidationError, type MyProductReview, type OAuthAuthorizeResponse, type OAuthCallbackResponse, type OAuthConnection, type OAuthConnectionsResponse, type OAuthProviderConfig, type OAuthProviderType, type OAuthProvidersResponse, type Order, type OrderAddress, type OrderBump, type OrderCustomer, type OrderDownloadLink, type OrderItem, type OrderQueryParams, type OrderStatus, type OrderStatusChange, type PageContent, type PageSeo, type PaginatedResponse, type PaymentClientSdk, type PaymentConfig, type PaymentIntent, type PaymentProvider, type PaymentProviderConfig, type PaymentProvidersConfig, type PaymentStatus, type PaymentUrlOptions, type PickupLocation, type PlatformCouponCapabilities, type PlatformMetafieldMetadata, type PreviewEmailTemplateDto as PreviewEmailTemplateInput, type Product, type ProductAttributeInput, type ProductAvailability, type ProductCustomizationField, type ProductDiscount, type ProductDiscountBadge, type ProductImage, type ProductMetafield, type ProductMetafieldValue, type ProductModifierGroupAttachment, type ProductQueryParams, type ProductRecommendation, type ProductRecommendationsResponse, type ProductRelationType, type ProductReview, type ProductReviewAdmin, type ProductSuggestion, type ProductVariant, type PublicMetafieldDefinition, type PublishProductResponse, RTL_LOCALES, type RecommendationVariant, type ReconcileInventoryResponse, type RedeemRewardResult, type ReferralInfo, type Refund, type RefundLineItem, type RefundLineItemResponse, type RefundType, type RegisterCustomerDto, type ReservationInfo, type ResolveMetafieldConflictDto as ResolveMetafieldConflictInput, type ResolveSyncConflictDto as ResolveSyncConflictInput, type RichTextContent, SDK_VERSION, type SearchSuggestions, type SelectPickupLocationDto, type SelectShippingMethodDto, type SendInvoiceDto, type SessionCartRef, type SetBillingAddressDto, type SetCheckoutCustomFieldsDto, type SetCheckoutCustomerDto, type SetDefinitionProductsDto as SetDefinitionProductsInput, type SetMetafieldPlatformsDto as SetMetafieldPlatformsInput, type SetShippingAddressDto, type SetShippingAddressResponse, type 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 SubmitProductReviewInput, type SupportedLocaleObject, 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 UpdateAttachmentInput, type UpdateAttributeDto as UpdateAttributeInput, type UpdateAttributeOptionDto as UpdateAttributeOptionInput, type UpdateBrandDto as UpdateBrandInput, type UpdateCartItemDto, type UpdateCategoryDto as UpdateCategoryInput, type UpdateContentInput, 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 UpdateModifierGroupInput, type UpdateModifierInput, 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, type WriteProductReviewInput, createWebhookHandler, deriveSeoDescription, enableDevGuards, formatMoney, formatPrice, formatProductPrice, formatVariantPrice, getCartItemImage, getCartItemName, getCartTotals, getDescriptionContent, getDirectionForLocale, formatPrice as getPriceDisplay, getProductCustomizationFields, getProductMetafield, getProductMetafieldValue, getProductMetafieldsByType, getProductPrice, getProductPriceInfo, getProductSwatches, getStockStatus, getVariantOptions, getVariantPrice, isAllowedPaymentUrl, isCouponApplicableToProduct, isHtmlDescription, isWebhookEventType, parseWebhookEvent, safePaymentRedirect, stripHtml, verifyWebhook };
|
package/dist/index.js
CHANGED
|
@@ -185,7 +185,7 @@ function isDevGuardsEnabled() {
|
|
|
185
185
|
}
|
|
186
186
|
|
|
187
187
|
// src/version.ts
|
|
188
|
-
var SDK_VERSION = "1.
|
|
188
|
+
var SDK_VERSION = "1.45.0";
|
|
189
189
|
|
|
190
190
|
// src/client.ts
|
|
191
191
|
var DEFAULT_BASE_URL = "https://api.brainerce.com";
|
|
@@ -4924,6 +4924,102 @@ var BrainerceClient = class {
|
|
|
4924
4924
|
`/api/v1/checkout/${encodePathSegment(checkoutId)}/shipping-rates`
|
|
4925
4925
|
);
|
|
4926
4926
|
}
|
|
4927
|
+
/**
|
|
4928
|
+
* Address autocomplete predictions for a checkout address field.
|
|
4929
|
+
*
|
|
4930
|
+
* `sessionToken` groups one address-entry attempt together for billing —
|
|
4931
|
+
* generate a fresh id (e.g. `crypto.randomUUID()`) when the field is
|
|
4932
|
+
* focused, reuse it for every keystroke, then pass the same value once more
|
|
4933
|
+
* to `getAddressDetails()` when the shopper picks a suggestion. Debounce
|
|
4934
|
+
* calls to this method (e.g. 300ms) rather than firing on every keystroke.
|
|
4935
|
+
*
|
|
4936
|
+
* @example
|
|
4937
|
+
* ```typescript
|
|
4938
|
+
* const sessionToken = crypto.randomUUID();
|
|
4939
|
+
* const suggestions = await client.getAddressSuggestions('123 Main', sessionToken);
|
|
4940
|
+
* ```
|
|
4941
|
+
*/
|
|
4942
|
+
async getAddressSuggestions(query, sessionToken, near) {
|
|
4943
|
+
const queryParams = {
|
|
4944
|
+
q: query,
|
|
4945
|
+
sessionToken,
|
|
4946
|
+
lat: near?.lat,
|
|
4947
|
+
lng: near?.lng
|
|
4948
|
+
};
|
|
4949
|
+
if (this.isVibeCodedMode()) {
|
|
4950
|
+
const result2 = await this.vibeCodedRequest(
|
|
4951
|
+
"GET",
|
|
4952
|
+
"/checkout/address-suggestions",
|
|
4953
|
+
void 0,
|
|
4954
|
+
queryParams
|
|
4955
|
+
);
|
|
4956
|
+
return result2.suggestions;
|
|
4957
|
+
}
|
|
4958
|
+
if (this.storeId && !this.apiKey) {
|
|
4959
|
+
const result2 = await this.storefrontRequest(
|
|
4960
|
+
"GET",
|
|
4961
|
+
"/checkout/address-suggestions",
|
|
4962
|
+
void 0,
|
|
4963
|
+
queryParams
|
|
4964
|
+
);
|
|
4965
|
+
return result2.suggestions;
|
|
4966
|
+
}
|
|
4967
|
+
const result = await this.adminRequest(
|
|
4968
|
+
"GET",
|
|
4969
|
+
"/api/v1/checkout/address-suggestions",
|
|
4970
|
+
void 0,
|
|
4971
|
+
queryParams
|
|
4972
|
+
);
|
|
4973
|
+
return result.suggestions;
|
|
4974
|
+
}
|
|
4975
|
+
/**
|
|
4976
|
+
* Resolve a predicted place (from `getAddressSuggestions()`) to a full
|
|
4977
|
+
* postal address + coordinates, and whether it falls inside any of the
|
|
4978
|
+
* store's shipping zones. Pass the SAME `sessionToken` used for the
|
|
4979
|
+
* preceding suggestion calls — this is the billed call that ends the
|
|
4980
|
+
* autocomplete session.
|
|
4981
|
+
*
|
|
4982
|
+
* `inZone: false` is a soft signal, not a rejection — pair it with a
|
|
4983
|
+
* banner like "outside our regular delivery zones, we'll confirm by phone"
|
|
4984
|
+
* and still let the shopper continue.
|
|
4985
|
+
*
|
|
4986
|
+
* @example
|
|
4987
|
+
* ```typescript
|
|
4988
|
+
* const details = await client.getAddressDetails(suggestion.placeId, sessionToken);
|
|
4989
|
+
* if (!details.inZone) {
|
|
4990
|
+
* showOutsideZoneBanner();
|
|
4991
|
+
* }
|
|
4992
|
+
* ```
|
|
4993
|
+
*/
|
|
4994
|
+
async getAddressDetails(placeId, sessionToken, options) {
|
|
4995
|
+
const queryParams = {
|
|
4996
|
+
placeId,
|
|
4997
|
+
sessionToken,
|
|
4998
|
+
regionId: options?.regionId
|
|
4999
|
+
};
|
|
5000
|
+
if (this.isVibeCodedMode()) {
|
|
5001
|
+
return this.vibeCodedRequest(
|
|
5002
|
+
"GET",
|
|
5003
|
+
"/checkout/address-details",
|
|
5004
|
+
void 0,
|
|
5005
|
+
queryParams
|
|
5006
|
+
);
|
|
5007
|
+
}
|
|
5008
|
+
if (this.storeId && !this.apiKey) {
|
|
5009
|
+
return this.storefrontRequest(
|
|
5010
|
+
"GET",
|
|
5011
|
+
"/checkout/address-details",
|
|
5012
|
+
void 0,
|
|
5013
|
+
queryParams
|
|
5014
|
+
);
|
|
5015
|
+
}
|
|
5016
|
+
return this.adminRequest(
|
|
5017
|
+
"GET",
|
|
5018
|
+
"/api/v1/checkout/address-details",
|
|
5019
|
+
void 0,
|
|
5020
|
+
queryParams
|
|
5021
|
+
);
|
|
5022
|
+
}
|
|
4927
5023
|
/**
|
|
4928
5024
|
* Select a shipping method for checkout
|
|
4929
5025
|
*
|
|
@@ -5568,10 +5664,7 @@ var BrainerceClient = class {
|
|
|
5568
5664
|
"order"
|
|
5569
5665
|
);
|
|
5570
5666
|
}
|
|
5571
|
-
throw new BrainerceError(
|
|
5572
|
-
"getOrderByCheckout() requires vibe-coded or storefront mode",
|
|
5573
|
-
400
|
|
5574
|
-
);
|
|
5667
|
+
throw new BrainerceError("getOrderByCheckout() requires vibe-coded or storefront mode", 400);
|
|
5575
5668
|
}
|
|
5576
5669
|
/**
|
|
5577
5670
|
* Check if localStorage is available (browser environment)
|
|
@@ -8392,6 +8485,55 @@ var BrainerceClient = class {
|
|
|
8392
8485
|
async updateEmailSettings(data) {
|
|
8393
8486
|
return this.adminRequest("PUT", "/api/v1/email/settings", data);
|
|
8394
8487
|
}
|
|
8488
|
+
/**
|
|
8489
|
+
* Get Storefront Bot (AI Shopping Assistant) settings for every connection
|
|
8490
|
+
* on the store — name, avatar, persona, starter questions, guardrails,
|
|
8491
|
+
* capabilities. Requires Admin mode (apiKey).
|
|
8492
|
+
*/
|
|
8493
|
+
async getBotSettings() {
|
|
8494
|
+
return this.adminRequest("GET", "/api/v1/storefront-bot/settings");
|
|
8495
|
+
}
|
|
8496
|
+
/**
|
|
8497
|
+
* Create/update one connection's Storefront Bot settings. Only fields
|
|
8498
|
+
* present in `data` are changed (PATCH semantics). Requires Admin mode
|
|
8499
|
+
* (apiKey).
|
|
8500
|
+
*/
|
|
8501
|
+
async updateBotSettings(data) {
|
|
8502
|
+
return this.adminRequest("PUT", "/api/v1/storefront-bot/settings", data);
|
|
8503
|
+
}
|
|
8504
|
+
/**
|
|
8505
|
+
* Paginated Storefront Bot conversation inbox, optionally filtered to one
|
|
8506
|
+
* connection. Requires Admin mode (apiKey).
|
|
8507
|
+
*/
|
|
8508
|
+
async listBotConversations(opts) {
|
|
8509
|
+
return this.adminRequest(
|
|
8510
|
+
"GET",
|
|
8511
|
+
"/api/v1/storefront-bot/conversations",
|
|
8512
|
+
void 0,
|
|
8513
|
+
opts
|
|
8514
|
+
);
|
|
8515
|
+
}
|
|
8516
|
+
/**
|
|
8517
|
+
* Full transcript for one Storefront Bot conversation, including its
|
|
8518
|
+
* summary if one was generated. Requires Admin mode (apiKey).
|
|
8519
|
+
*/
|
|
8520
|
+
async getBotConversation(conversationId) {
|
|
8521
|
+
return this.adminRequest(
|
|
8522
|
+
"GET",
|
|
8523
|
+
`/api/v1/storefront-bot/conversations/${conversationId}`
|
|
8524
|
+
);
|
|
8525
|
+
}
|
|
8526
|
+
/**
|
|
8527
|
+
* Summarize a Storefront Bot conversation on demand and persist the
|
|
8528
|
+
* summary. Short threads (10 or fewer messages) are a graceful no-op — no
|
|
8529
|
+
* credits charged. Requires Admin mode (apiKey).
|
|
8530
|
+
*/
|
|
8531
|
+
async summarizeBotConversation(conversationId) {
|
|
8532
|
+
return this.adminRequest(
|
|
8533
|
+
"POST",
|
|
8534
|
+
`/api/v1/storefront-bot/conversations/${conversationId}/summarize`
|
|
8535
|
+
);
|
|
8536
|
+
}
|
|
8395
8537
|
/**
|
|
8396
8538
|
* Get all email templates for the store, grouped by (eventType, language).
|
|
8397
8539
|
* Response includes the store's primary language and supported languages so
|