brainerce 1.0.2 → 1.2.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/AI_BUILDER_PROMPT.md +782 -700
- package/README.md +4013 -3974
- package/dist/index.d.mts +52 -1
- package/dist/index.d.ts +52 -1
- package/dist/index.js +57 -5
- package/dist/index.mjs +57 -5
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -1969,6 +1969,31 @@ interface SetShippingAddressResponse {
|
|
|
1969
1969
|
checkout: Checkout;
|
|
1970
1970
|
rates: ShippingRate[];
|
|
1971
1971
|
}
|
|
1972
|
+
/**
|
|
1973
|
+
* Available shipping destinations for a store.
|
|
1974
|
+
*
|
|
1975
|
+
* Use `getShippingDestinations()` to populate country/region `<select>` elements
|
|
1976
|
+
* in your checkout form instead of free-text fields.
|
|
1977
|
+
*
|
|
1978
|
+
* - If `worldwide` is true, the store ships to all countries (use a full country list).
|
|
1979
|
+
* - `countries` contains the specific country codes/names the store ships to.
|
|
1980
|
+
* - `regions` contains region restrictions per country. If a country has no entry,
|
|
1981
|
+
* all regions within it are available.
|
|
1982
|
+
*/
|
|
1983
|
+
interface ShippingDestinations {
|
|
1984
|
+
/** Whether the store ships worldwide (has a zone covering all countries) */
|
|
1985
|
+
worldwide: boolean;
|
|
1986
|
+
/** Countries the store ships to */
|
|
1987
|
+
countries: Array<{
|
|
1988
|
+
code: string;
|
|
1989
|
+
name: string;
|
|
1990
|
+
}>;
|
|
1991
|
+
/** Region restrictions per country code. Empty object means no region restrictions. */
|
|
1992
|
+
regions: Record<string, Array<{
|
|
1993
|
+
code: string;
|
|
1994
|
+
name: string;
|
|
1995
|
+
}>>;
|
|
1996
|
+
}
|
|
1972
1997
|
interface CompleteCheckoutResponse {
|
|
1973
1998
|
orderId: string;
|
|
1974
1999
|
}
|
|
@@ -4811,6 +4836,32 @@ declare class BrainerceClient {
|
|
|
4811
4836
|
* ```
|
|
4812
4837
|
*/
|
|
4813
4838
|
setCheckoutCustomer(checkoutId: string, data: SetCheckoutCustomerDto): Promise<Checkout>;
|
|
4839
|
+
/**
|
|
4840
|
+
* Get available shipping destinations for this store.
|
|
4841
|
+
*
|
|
4842
|
+
* Returns which countries and regions the store ships to,
|
|
4843
|
+
* so you can populate `<select>` dropdowns in your checkout form.
|
|
4844
|
+
*
|
|
4845
|
+
* @example
|
|
4846
|
+
* ```typescript
|
|
4847
|
+
* const dest = await client.getShippingDestinations();
|
|
4848
|
+
*
|
|
4849
|
+
* if (dest.worldwide) {
|
|
4850
|
+
* // Store ships everywhere — use a full country list
|
|
4851
|
+
* } else {
|
|
4852
|
+
* // Only show available countries
|
|
4853
|
+
* dest.countries.forEach(c => console.log(c.code, c.name));
|
|
4854
|
+
* }
|
|
4855
|
+
*
|
|
4856
|
+
* // Check region restrictions for a country
|
|
4857
|
+
* const usRegions = dest.regions['US'];
|
|
4858
|
+
* if (usRegions) {
|
|
4859
|
+
* // Only these US states are available
|
|
4860
|
+
* usRegions.forEach(r => console.log(r.code, r.name));
|
|
4861
|
+
* }
|
|
4862
|
+
* ```
|
|
4863
|
+
*/
|
|
4864
|
+
getShippingDestinations(): Promise<ShippingDestinations>;
|
|
4814
4865
|
/**
|
|
4815
4866
|
* Set shipping address on checkout (includes customer email).
|
|
4816
4867
|
* Returns the checkout and available shipping rates for the address.
|
|
@@ -6263,4 +6314,4 @@ declare function enableDevGuards(options?: {
|
|
|
6263
6314
|
force?: boolean;
|
|
6264
6315
|
}): void;
|
|
6265
6316
|
|
|
6266
|
-
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 CartItem, type CartNudge, type CartRecommendationsResponse, type CartStatus, type Category, type CategorySuggestion, type Checkout, type CheckoutAddress, 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 OrderCustomer, type OrderDownloadLink, type OrderItem, type OrderQueryParams, type OrderStatus, type PaginatedResponse, type PaymentConfig, type PaymentIntent, type PaymentProvider, type PaymentProviderConfig, type PaymentProvidersConfig, type PaymentStatus, type PlatformCouponCapabilities, type PreviewEmailTemplateDto as PreviewEmailTemplateInput, type Product, type ProductAttributeInput, type ProductAvailability, 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, type SearchSuggestions, type SelectShippingMethodDto, type SendInvoiceDto, type SessionCartRef, type SetBillingAddressDto, type SetCheckoutCustomerDto, type SetShippingAddressDto, type SetShippingAddressResponse, 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, getStockStatus, getVariantOptions, getVariantPrice, isCouponApplicableToProduct, isHtmlDescription, isWebhookEventType, parseWebhookEvent, verifyWebhook };
|
|
6317
|
+
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 CartItem, type CartNudge, type CartRecommendationsResponse, type CartStatus, type Category, type CategorySuggestion, type Checkout, type CheckoutAddress, 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 OrderCustomer, type OrderDownloadLink, type OrderItem, type OrderQueryParams, type OrderStatus, type PaginatedResponse, type PaymentConfig, type PaymentIntent, type PaymentProvider, type PaymentProviderConfig, type PaymentProvidersConfig, type PaymentStatus, type PlatformCouponCapabilities, type PreviewEmailTemplateDto as PreviewEmailTemplateInput, type Product, type ProductAttributeInput, type ProductAvailability, 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, type SearchSuggestions, 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, getStockStatus, getVariantOptions, getVariantPrice, isCouponApplicableToProduct, isHtmlDescription, isWebhookEventType, parseWebhookEvent, verifyWebhook };
|
package/dist/index.d.ts
CHANGED
|
@@ -1969,6 +1969,31 @@ interface SetShippingAddressResponse {
|
|
|
1969
1969
|
checkout: Checkout;
|
|
1970
1970
|
rates: ShippingRate[];
|
|
1971
1971
|
}
|
|
1972
|
+
/**
|
|
1973
|
+
* Available shipping destinations for a store.
|
|
1974
|
+
*
|
|
1975
|
+
* Use `getShippingDestinations()` to populate country/region `<select>` elements
|
|
1976
|
+
* in your checkout form instead of free-text fields.
|
|
1977
|
+
*
|
|
1978
|
+
* - If `worldwide` is true, the store ships to all countries (use a full country list).
|
|
1979
|
+
* - `countries` contains the specific country codes/names the store ships to.
|
|
1980
|
+
* - `regions` contains region restrictions per country. If a country has no entry,
|
|
1981
|
+
* all regions within it are available.
|
|
1982
|
+
*/
|
|
1983
|
+
interface ShippingDestinations {
|
|
1984
|
+
/** Whether the store ships worldwide (has a zone covering all countries) */
|
|
1985
|
+
worldwide: boolean;
|
|
1986
|
+
/** Countries the store ships to */
|
|
1987
|
+
countries: Array<{
|
|
1988
|
+
code: string;
|
|
1989
|
+
name: string;
|
|
1990
|
+
}>;
|
|
1991
|
+
/** Region restrictions per country code. Empty object means no region restrictions. */
|
|
1992
|
+
regions: Record<string, Array<{
|
|
1993
|
+
code: string;
|
|
1994
|
+
name: string;
|
|
1995
|
+
}>>;
|
|
1996
|
+
}
|
|
1972
1997
|
interface CompleteCheckoutResponse {
|
|
1973
1998
|
orderId: string;
|
|
1974
1999
|
}
|
|
@@ -4811,6 +4836,32 @@ declare class BrainerceClient {
|
|
|
4811
4836
|
* ```
|
|
4812
4837
|
*/
|
|
4813
4838
|
setCheckoutCustomer(checkoutId: string, data: SetCheckoutCustomerDto): Promise<Checkout>;
|
|
4839
|
+
/**
|
|
4840
|
+
* Get available shipping destinations for this store.
|
|
4841
|
+
*
|
|
4842
|
+
* Returns which countries and regions the store ships to,
|
|
4843
|
+
* so you can populate `<select>` dropdowns in your checkout form.
|
|
4844
|
+
*
|
|
4845
|
+
* @example
|
|
4846
|
+
* ```typescript
|
|
4847
|
+
* const dest = await client.getShippingDestinations();
|
|
4848
|
+
*
|
|
4849
|
+
* if (dest.worldwide) {
|
|
4850
|
+
* // Store ships everywhere — use a full country list
|
|
4851
|
+
* } else {
|
|
4852
|
+
* // Only show available countries
|
|
4853
|
+
* dest.countries.forEach(c => console.log(c.code, c.name));
|
|
4854
|
+
* }
|
|
4855
|
+
*
|
|
4856
|
+
* // Check region restrictions for a country
|
|
4857
|
+
* const usRegions = dest.regions['US'];
|
|
4858
|
+
* if (usRegions) {
|
|
4859
|
+
* // Only these US states are available
|
|
4860
|
+
* usRegions.forEach(r => console.log(r.code, r.name));
|
|
4861
|
+
* }
|
|
4862
|
+
* ```
|
|
4863
|
+
*/
|
|
4864
|
+
getShippingDestinations(): Promise<ShippingDestinations>;
|
|
4814
4865
|
/**
|
|
4815
4866
|
* Set shipping address on checkout (includes customer email).
|
|
4816
4867
|
* Returns the checkout and available shipping rates for the address.
|
|
@@ -6263,4 +6314,4 @@ declare function enableDevGuards(options?: {
|
|
|
6263
6314
|
force?: boolean;
|
|
6264
6315
|
}): void;
|
|
6265
6316
|
|
|
6266
|
-
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 CartItem, type CartNudge, type CartRecommendationsResponse, type CartStatus, type Category, type CategorySuggestion, type Checkout, type CheckoutAddress, 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 OrderCustomer, type OrderDownloadLink, type OrderItem, type OrderQueryParams, type OrderStatus, type PaginatedResponse, type PaymentConfig, type PaymentIntent, type PaymentProvider, type PaymentProviderConfig, type PaymentProvidersConfig, type PaymentStatus, type PlatformCouponCapabilities, type PreviewEmailTemplateDto as PreviewEmailTemplateInput, type Product, type ProductAttributeInput, type ProductAvailability, 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, type SearchSuggestions, type SelectShippingMethodDto, type SendInvoiceDto, type SessionCartRef, type SetBillingAddressDto, type SetCheckoutCustomerDto, type SetShippingAddressDto, type SetShippingAddressResponse, 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, getStockStatus, getVariantOptions, getVariantPrice, isCouponApplicableToProduct, isHtmlDescription, isWebhookEventType, parseWebhookEvent, verifyWebhook };
|
|
6317
|
+
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 CartItem, type CartNudge, type CartRecommendationsResponse, type CartStatus, type Category, type CategorySuggestion, type Checkout, type CheckoutAddress, 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 OrderCustomer, type OrderDownloadLink, type OrderItem, type OrderQueryParams, type OrderStatus, type PaginatedResponse, type PaymentConfig, type PaymentIntent, type PaymentProvider, type PaymentProviderConfig, type PaymentProvidersConfig, type PaymentStatus, type PlatformCouponCapabilities, type PreviewEmailTemplateDto as PreviewEmailTemplateInput, type Product, type ProductAttributeInput, type ProductAvailability, 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, type SearchSuggestions, 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, getStockStatus, getVariantOptions, getVariantPrice, isCouponApplicableToProduct, isHtmlDescription, isWebhookEventType, parseWebhookEvent, verifyWebhook };
|
package/dist/index.js
CHANGED
|
@@ -2028,7 +2028,9 @@ var BrainerceClient = class {
|
|
|
2028
2028
|
*/
|
|
2029
2029
|
async updateCartItem(cartId, itemId, data) {
|
|
2030
2030
|
if (cartId === this.VIRTUAL_LOCAL_CART_ID) {
|
|
2031
|
-
console.warn(
|
|
2031
|
+
console.warn(
|
|
2032
|
+
'updateCartItem("__local__", ...) is deprecated. Use smartUpdateCartItem() instead.'
|
|
2033
|
+
);
|
|
2032
2034
|
const index = parseInt(itemId.replace("local_", ""), 10);
|
|
2033
2035
|
const localCart = this.getLocalCart();
|
|
2034
2036
|
if (index >= 0 && index < localCart.items.length) {
|
|
@@ -2064,7 +2066,9 @@ var BrainerceClient = class {
|
|
|
2064
2066
|
*/
|
|
2065
2067
|
async removeCartItem(cartId, itemId) {
|
|
2066
2068
|
if (cartId === this.VIRTUAL_LOCAL_CART_ID) {
|
|
2067
|
-
console.warn(
|
|
2069
|
+
console.warn(
|
|
2070
|
+
'removeCartItem("__local__", ...) is deprecated. Use smartRemoveFromCart() instead.'
|
|
2071
|
+
);
|
|
2068
2072
|
const index = parseInt(itemId.replace("local_", ""), 10);
|
|
2069
2073
|
const localCart = this.getLocalCart();
|
|
2070
2074
|
if (index >= 0 && index < localCart.items.length) {
|
|
@@ -2100,7 +2104,9 @@ var BrainerceClient = class {
|
|
|
2100
2104
|
*/
|
|
2101
2105
|
async clearCart(cartId) {
|
|
2102
2106
|
if (cartId === this.VIRTUAL_LOCAL_CART_ID) {
|
|
2103
|
-
console.warn(
|
|
2107
|
+
console.warn(
|
|
2108
|
+
'clearCart("__local__") is deprecated. Use onCheckoutComplete() or clearLocalCart() directly.'
|
|
2109
|
+
);
|
|
2104
2110
|
this.clearLocalCart();
|
|
2105
2111
|
return this.withGuards(this.localCartToCart(this.getLocalCart()), "cart");
|
|
2106
2112
|
}
|
|
@@ -2952,6 +2958,46 @@ var BrainerceClient = class {
|
|
|
2952
2958
|
}
|
|
2953
2959
|
return this.adminRequest("PATCH", `/api/v1/checkout/${checkoutId}/customer`, data);
|
|
2954
2960
|
}
|
|
2961
|
+
/**
|
|
2962
|
+
* Get available shipping destinations for this store.
|
|
2963
|
+
*
|
|
2964
|
+
* Returns which countries and regions the store ships to,
|
|
2965
|
+
* so you can populate `<select>` dropdowns in your checkout form.
|
|
2966
|
+
*
|
|
2967
|
+
* @example
|
|
2968
|
+
* ```typescript
|
|
2969
|
+
* const dest = await client.getShippingDestinations();
|
|
2970
|
+
*
|
|
2971
|
+
* if (dest.worldwide) {
|
|
2972
|
+
* // Store ships everywhere — use a full country list
|
|
2973
|
+
* } else {
|
|
2974
|
+
* // Only show available countries
|
|
2975
|
+
* dest.countries.forEach(c => console.log(c.code, c.name));
|
|
2976
|
+
* }
|
|
2977
|
+
*
|
|
2978
|
+
* // Check region restrictions for a country
|
|
2979
|
+
* const usRegions = dest.regions['US'];
|
|
2980
|
+
* if (usRegions) {
|
|
2981
|
+
* // Only these US states are available
|
|
2982
|
+
* usRegions.forEach(r => console.log(r.code, r.name));
|
|
2983
|
+
* }
|
|
2984
|
+
* ```
|
|
2985
|
+
*/
|
|
2986
|
+
async getShippingDestinations() {
|
|
2987
|
+
if (this.isVibeCodedMode()) {
|
|
2988
|
+
return this.vibeCodedRequest("GET", "/shipping/destinations");
|
|
2989
|
+
}
|
|
2990
|
+
if (this.storeId && !this.apiKey) {
|
|
2991
|
+
return this.storefrontRequest(
|
|
2992
|
+
"GET",
|
|
2993
|
+
"/checkouts/shipping-destinations"
|
|
2994
|
+
);
|
|
2995
|
+
}
|
|
2996
|
+
return this.adminRequest(
|
|
2997
|
+
"GET",
|
|
2998
|
+
"/api/v1/checkouts/shipping-destinations"
|
|
2999
|
+
);
|
|
3000
|
+
}
|
|
2955
3001
|
/**
|
|
2956
3002
|
* Set shipping address on checkout (includes customer email).
|
|
2957
3003
|
* Returns the checkout and available shipping rates for the address.
|
|
@@ -3634,10 +3680,16 @@ var BrainerceClient = class {
|
|
|
3634
3680
|
}
|
|
3635
3681
|
const localCart = this.getLocalCart();
|
|
3636
3682
|
if (!localCart.customer?.email) {
|
|
3637
|
-
throw new BrainerceError(
|
|
3683
|
+
throw new BrainerceError(
|
|
3684
|
+
"Customer email is required. Call setLocalCartCustomer() first.",
|
|
3685
|
+
400
|
|
3686
|
+
);
|
|
3638
3687
|
}
|
|
3639
3688
|
if (!localCart.shippingAddress) {
|
|
3640
|
-
throw new BrainerceError(
|
|
3689
|
+
throw new BrainerceError(
|
|
3690
|
+
"Shipping address is required. Call setLocalCartShippingAddress() first.",
|
|
3691
|
+
400
|
|
3692
|
+
);
|
|
3641
3693
|
}
|
|
3642
3694
|
const trackingResult = await this.startGuestCheckout();
|
|
3643
3695
|
if (!trackingResult.tracked) {
|
package/dist/index.mjs
CHANGED
|
@@ -1970,7 +1970,9 @@ var BrainerceClient = class {
|
|
|
1970
1970
|
*/
|
|
1971
1971
|
async updateCartItem(cartId, itemId, data) {
|
|
1972
1972
|
if (cartId === this.VIRTUAL_LOCAL_CART_ID) {
|
|
1973
|
-
console.warn(
|
|
1973
|
+
console.warn(
|
|
1974
|
+
'updateCartItem("__local__", ...) is deprecated. Use smartUpdateCartItem() instead.'
|
|
1975
|
+
);
|
|
1974
1976
|
const index = parseInt(itemId.replace("local_", ""), 10);
|
|
1975
1977
|
const localCart = this.getLocalCart();
|
|
1976
1978
|
if (index >= 0 && index < localCart.items.length) {
|
|
@@ -2006,7 +2008,9 @@ var BrainerceClient = class {
|
|
|
2006
2008
|
*/
|
|
2007
2009
|
async removeCartItem(cartId, itemId) {
|
|
2008
2010
|
if (cartId === this.VIRTUAL_LOCAL_CART_ID) {
|
|
2009
|
-
console.warn(
|
|
2011
|
+
console.warn(
|
|
2012
|
+
'removeCartItem("__local__", ...) is deprecated. Use smartRemoveFromCart() instead.'
|
|
2013
|
+
);
|
|
2010
2014
|
const index = parseInt(itemId.replace("local_", ""), 10);
|
|
2011
2015
|
const localCart = this.getLocalCart();
|
|
2012
2016
|
if (index >= 0 && index < localCart.items.length) {
|
|
@@ -2042,7 +2046,9 @@ var BrainerceClient = class {
|
|
|
2042
2046
|
*/
|
|
2043
2047
|
async clearCart(cartId) {
|
|
2044
2048
|
if (cartId === this.VIRTUAL_LOCAL_CART_ID) {
|
|
2045
|
-
console.warn(
|
|
2049
|
+
console.warn(
|
|
2050
|
+
'clearCart("__local__") is deprecated. Use onCheckoutComplete() or clearLocalCart() directly.'
|
|
2051
|
+
);
|
|
2046
2052
|
this.clearLocalCart();
|
|
2047
2053
|
return this.withGuards(this.localCartToCart(this.getLocalCart()), "cart");
|
|
2048
2054
|
}
|
|
@@ -2894,6 +2900,46 @@ var BrainerceClient = class {
|
|
|
2894
2900
|
}
|
|
2895
2901
|
return this.adminRequest("PATCH", `/api/v1/checkout/${checkoutId}/customer`, data);
|
|
2896
2902
|
}
|
|
2903
|
+
/**
|
|
2904
|
+
* Get available shipping destinations for this store.
|
|
2905
|
+
*
|
|
2906
|
+
* Returns which countries and regions the store ships to,
|
|
2907
|
+
* so you can populate `<select>` dropdowns in your checkout form.
|
|
2908
|
+
*
|
|
2909
|
+
* @example
|
|
2910
|
+
* ```typescript
|
|
2911
|
+
* const dest = await client.getShippingDestinations();
|
|
2912
|
+
*
|
|
2913
|
+
* if (dest.worldwide) {
|
|
2914
|
+
* // Store ships everywhere — use a full country list
|
|
2915
|
+
* } else {
|
|
2916
|
+
* // Only show available countries
|
|
2917
|
+
* dest.countries.forEach(c => console.log(c.code, c.name));
|
|
2918
|
+
* }
|
|
2919
|
+
*
|
|
2920
|
+
* // Check region restrictions for a country
|
|
2921
|
+
* const usRegions = dest.regions['US'];
|
|
2922
|
+
* if (usRegions) {
|
|
2923
|
+
* // Only these US states are available
|
|
2924
|
+
* usRegions.forEach(r => console.log(r.code, r.name));
|
|
2925
|
+
* }
|
|
2926
|
+
* ```
|
|
2927
|
+
*/
|
|
2928
|
+
async getShippingDestinations() {
|
|
2929
|
+
if (this.isVibeCodedMode()) {
|
|
2930
|
+
return this.vibeCodedRequest("GET", "/shipping/destinations");
|
|
2931
|
+
}
|
|
2932
|
+
if (this.storeId && !this.apiKey) {
|
|
2933
|
+
return this.storefrontRequest(
|
|
2934
|
+
"GET",
|
|
2935
|
+
"/checkouts/shipping-destinations"
|
|
2936
|
+
);
|
|
2937
|
+
}
|
|
2938
|
+
return this.adminRequest(
|
|
2939
|
+
"GET",
|
|
2940
|
+
"/api/v1/checkouts/shipping-destinations"
|
|
2941
|
+
);
|
|
2942
|
+
}
|
|
2897
2943
|
/**
|
|
2898
2944
|
* Set shipping address on checkout (includes customer email).
|
|
2899
2945
|
* Returns the checkout and available shipping rates for the address.
|
|
@@ -3576,10 +3622,16 @@ var BrainerceClient = class {
|
|
|
3576
3622
|
}
|
|
3577
3623
|
const localCart = this.getLocalCart();
|
|
3578
3624
|
if (!localCart.customer?.email) {
|
|
3579
|
-
throw new BrainerceError(
|
|
3625
|
+
throw new BrainerceError(
|
|
3626
|
+
"Customer email is required. Call setLocalCartCustomer() first.",
|
|
3627
|
+
400
|
|
3628
|
+
);
|
|
3580
3629
|
}
|
|
3581
3630
|
if (!localCart.shippingAddress) {
|
|
3582
|
-
throw new BrainerceError(
|
|
3631
|
+
throw new BrainerceError(
|
|
3632
|
+
"Shipping address is required. Call setLocalCartShippingAddress() first.",
|
|
3633
|
+
400
|
|
3634
|
+
);
|
|
3583
3635
|
}
|
|
3584
3636
|
const trackingResult = await this.startGuestCheckout();
|
|
3585
3637
|
if (!trackingResult.tracked) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "brainerce",
|
|
3
|
-
"version": "1.0
|
|
3
|
+
"version": "1.2.0",
|
|
4
4
|
"description": "Official SDK for building e-commerce storefronts with Brainerce Platform. Perfect for vibe-coded sites, AI-built stores (Cursor, Lovable, v0), and custom storefronts.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.mjs",
|