brainerce 1.9.0 → 1.10.1
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 +843 -843
- package/README.md +4237 -4236
- package/dist/index.d.mts +54 -1
- package/dist/index.d.ts +54 -1
- package/dist/index.js +70 -16
- package/dist/index.mjs +70 -16
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -2379,6 +2379,36 @@ interface CustomApiTestResult {
|
|
|
2379
2379
|
latency?: number;
|
|
2380
2380
|
error?: string;
|
|
2381
2381
|
}
|
|
2382
|
+
/**
|
|
2383
|
+
* Client-side SDK configuration for payment providers that render a widget.
|
|
2384
|
+
* Returned by the backend in provider config and payment intents.
|
|
2385
|
+
* The frontend dynamically loads the SDK script and calls init/render methods.
|
|
2386
|
+
*/
|
|
2387
|
+
interface PaymentClientSdk {
|
|
2388
|
+
/** How the payment UI is rendered: 'sdk-widget' (JS SDK), 'iframe', or 'redirect' */
|
|
2389
|
+
renderType: 'sdk-widget' | 'iframe' | 'redirect';
|
|
2390
|
+
/** URL of the main SDK script to load */
|
|
2391
|
+
scriptUrl?: string;
|
|
2392
|
+
/** Name of the global variable set by the SDK script (e.g., 'growPayment') */
|
|
2393
|
+
globalName?: string;
|
|
2394
|
+
/** Method name to call for initialization (default: 'init') */
|
|
2395
|
+
initMethod?: string;
|
|
2396
|
+
/** Method name to call for rendering the payment widget (default: 'renderPaymentOptions') */
|
|
2397
|
+
renderMethod?: string;
|
|
2398
|
+
/** DOM element ID for the payment widget container */
|
|
2399
|
+
containerId?: string;
|
|
2400
|
+
/** Configuration object passed to the init method (e.g., { version: 1, environment: 'DEV' }) */
|
|
2401
|
+
initConfig?: Record<string, unknown>;
|
|
2402
|
+
/** Argument passed to the render method (overrides clientSecret) */
|
|
2403
|
+
renderArg?: string;
|
|
2404
|
+
/** Additional scripts to load (e.g., Apple Pay SDK) */
|
|
2405
|
+
additionalScripts?: Array<{
|
|
2406
|
+
url: string;
|
|
2407
|
+
optional?: boolean;
|
|
2408
|
+
}>;
|
|
2409
|
+
/** CSS to inject into <head> when SDK is active (e.g., LTR overrides for body-level popups on RTL pages) */
|
|
2410
|
+
bodyStyles?: string;
|
|
2411
|
+
}
|
|
2382
2412
|
/**
|
|
2383
2413
|
* Payment provider configuration (returned by `getPaymentProviders()`).
|
|
2384
2414
|
* Contains only public information safe to expose in frontend.
|
|
@@ -2405,6 +2435,8 @@ interface PaymentProviderConfig {
|
|
|
2405
2435
|
testMode: boolean;
|
|
2406
2436
|
/** Whether this is the default provider */
|
|
2407
2437
|
isDefault: boolean;
|
|
2438
|
+
/** Client-side SDK configuration for providers that render a widget */
|
|
2439
|
+
clientSdk?: PaymentClientSdk;
|
|
2408
2440
|
}
|
|
2409
2441
|
/**
|
|
2410
2442
|
* Alias for `PaymentProviderConfig`.
|
|
@@ -2486,6 +2518,8 @@ interface PaymentIntent {
|
|
|
2486
2518
|
status: string;
|
|
2487
2519
|
/** Payment provider type: 'stripe', 'grow', 'paypal', etc. */
|
|
2488
2520
|
provider?: string;
|
|
2521
|
+
/** Runtime client SDK overrides (merged with provider manifest config) */
|
|
2522
|
+
clientSdk?: PaymentClientSdk;
|
|
2489
2523
|
}
|
|
2490
2524
|
/**
|
|
2491
2525
|
* Payment status for a checkout.
|
|
@@ -5094,6 +5128,15 @@ declare class BrainerceClient {
|
|
|
5094
5128
|
* ```
|
|
5095
5129
|
*/
|
|
5096
5130
|
completeCheckout(checkoutId: string): Promise<CompleteCheckoutResponse>;
|
|
5131
|
+
/**
|
|
5132
|
+
* Delete a checkout session. Releases inventory reservations and removes
|
|
5133
|
+
* payment records not yet linked to an order.
|
|
5134
|
+
*
|
|
5135
|
+
* Cannot delete checkouts with status COMPLETED or PAYMENT_PROCESSING.
|
|
5136
|
+
*/
|
|
5137
|
+
deleteCheckout(checkoutId: string): Promise<{
|
|
5138
|
+
success: boolean;
|
|
5139
|
+
}>;
|
|
5097
5140
|
/**
|
|
5098
5141
|
* Get payment configuration for the connected store.
|
|
5099
5142
|
* Returns public information needed to initialize payment UI.
|
|
@@ -5654,6 +5697,16 @@ declare class BrainerceClient {
|
|
|
5654
5697
|
* ```
|
|
5655
5698
|
*/
|
|
5656
5699
|
getOrderDownloads(orderId: string): Promise<OrderDownloadLink[]>;
|
|
5700
|
+
/**
|
|
5701
|
+
* Get download links for a guest order (no login required)
|
|
5702
|
+
* Validates identity via email + order number
|
|
5703
|
+
*
|
|
5704
|
+
* @example
|
|
5705
|
+
* ```typescript
|
|
5706
|
+
* const links = await client.getGuestOrderDownloads('guest@email.com', 'ORD-20260310-0001');
|
|
5707
|
+
* ```
|
|
5708
|
+
*/
|
|
5709
|
+
getGuestOrderDownloads(email: string, orderNumber: string): Promise<OrderDownloadLink[]>;
|
|
5657
5710
|
/**
|
|
5658
5711
|
* Get the current customer's addresses (requires customerToken)
|
|
5659
5712
|
* Works in vibe-coded and storefront modes
|
|
@@ -6485,4 +6538,4 @@ declare function enableDevGuards(options?: {
|
|
|
6485
6538
|
force?: boolean;
|
|
6486
6539
|
}): void;
|
|
6487
6540
|
|
|
6488
|
-
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 CategoryNode, 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 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, 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, getStockStatus, getVariantOptions, getVariantPrice, isCouponApplicableToProduct, isHtmlDescription, isWebhookEventType, parseWebhookEvent, verifyWebhook };
|
|
6541
|
+
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 CategoryNode, 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 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, 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, getStockStatus, getVariantOptions, getVariantPrice, isCouponApplicableToProduct, isHtmlDescription, isWebhookEventType, parseWebhookEvent, verifyWebhook };
|
package/dist/index.d.ts
CHANGED
|
@@ -2379,6 +2379,36 @@ interface CustomApiTestResult {
|
|
|
2379
2379
|
latency?: number;
|
|
2380
2380
|
error?: string;
|
|
2381
2381
|
}
|
|
2382
|
+
/**
|
|
2383
|
+
* Client-side SDK configuration for payment providers that render a widget.
|
|
2384
|
+
* Returned by the backend in provider config and payment intents.
|
|
2385
|
+
* The frontend dynamically loads the SDK script and calls init/render methods.
|
|
2386
|
+
*/
|
|
2387
|
+
interface PaymentClientSdk {
|
|
2388
|
+
/** How the payment UI is rendered: 'sdk-widget' (JS SDK), 'iframe', or 'redirect' */
|
|
2389
|
+
renderType: 'sdk-widget' | 'iframe' | 'redirect';
|
|
2390
|
+
/** URL of the main SDK script to load */
|
|
2391
|
+
scriptUrl?: string;
|
|
2392
|
+
/** Name of the global variable set by the SDK script (e.g., 'growPayment') */
|
|
2393
|
+
globalName?: string;
|
|
2394
|
+
/** Method name to call for initialization (default: 'init') */
|
|
2395
|
+
initMethod?: string;
|
|
2396
|
+
/** Method name to call for rendering the payment widget (default: 'renderPaymentOptions') */
|
|
2397
|
+
renderMethod?: string;
|
|
2398
|
+
/** DOM element ID for the payment widget container */
|
|
2399
|
+
containerId?: string;
|
|
2400
|
+
/** Configuration object passed to the init method (e.g., { version: 1, environment: 'DEV' }) */
|
|
2401
|
+
initConfig?: Record<string, unknown>;
|
|
2402
|
+
/** Argument passed to the render method (overrides clientSecret) */
|
|
2403
|
+
renderArg?: string;
|
|
2404
|
+
/** Additional scripts to load (e.g., Apple Pay SDK) */
|
|
2405
|
+
additionalScripts?: Array<{
|
|
2406
|
+
url: string;
|
|
2407
|
+
optional?: boolean;
|
|
2408
|
+
}>;
|
|
2409
|
+
/** CSS to inject into <head> when SDK is active (e.g., LTR overrides for body-level popups on RTL pages) */
|
|
2410
|
+
bodyStyles?: string;
|
|
2411
|
+
}
|
|
2382
2412
|
/**
|
|
2383
2413
|
* Payment provider configuration (returned by `getPaymentProviders()`).
|
|
2384
2414
|
* Contains only public information safe to expose in frontend.
|
|
@@ -2405,6 +2435,8 @@ interface PaymentProviderConfig {
|
|
|
2405
2435
|
testMode: boolean;
|
|
2406
2436
|
/** Whether this is the default provider */
|
|
2407
2437
|
isDefault: boolean;
|
|
2438
|
+
/** Client-side SDK configuration for providers that render a widget */
|
|
2439
|
+
clientSdk?: PaymentClientSdk;
|
|
2408
2440
|
}
|
|
2409
2441
|
/**
|
|
2410
2442
|
* Alias for `PaymentProviderConfig`.
|
|
@@ -2486,6 +2518,8 @@ interface PaymentIntent {
|
|
|
2486
2518
|
status: string;
|
|
2487
2519
|
/** Payment provider type: 'stripe', 'grow', 'paypal', etc. */
|
|
2488
2520
|
provider?: string;
|
|
2521
|
+
/** Runtime client SDK overrides (merged with provider manifest config) */
|
|
2522
|
+
clientSdk?: PaymentClientSdk;
|
|
2489
2523
|
}
|
|
2490
2524
|
/**
|
|
2491
2525
|
* Payment status for a checkout.
|
|
@@ -5094,6 +5128,15 @@ declare class BrainerceClient {
|
|
|
5094
5128
|
* ```
|
|
5095
5129
|
*/
|
|
5096
5130
|
completeCheckout(checkoutId: string): Promise<CompleteCheckoutResponse>;
|
|
5131
|
+
/**
|
|
5132
|
+
* Delete a checkout session. Releases inventory reservations and removes
|
|
5133
|
+
* payment records not yet linked to an order.
|
|
5134
|
+
*
|
|
5135
|
+
* Cannot delete checkouts with status COMPLETED or PAYMENT_PROCESSING.
|
|
5136
|
+
*/
|
|
5137
|
+
deleteCheckout(checkoutId: string): Promise<{
|
|
5138
|
+
success: boolean;
|
|
5139
|
+
}>;
|
|
5097
5140
|
/**
|
|
5098
5141
|
* Get payment configuration for the connected store.
|
|
5099
5142
|
* Returns public information needed to initialize payment UI.
|
|
@@ -5654,6 +5697,16 @@ declare class BrainerceClient {
|
|
|
5654
5697
|
* ```
|
|
5655
5698
|
*/
|
|
5656
5699
|
getOrderDownloads(orderId: string): Promise<OrderDownloadLink[]>;
|
|
5700
|
+
/**
|
|
5701
|
+
* Get download links for a guest order (no login required)
|
|
5702
|
+
* Validates identity via email + order number
|
|
5703
|
+
*
|
|
5704
|
+
* @example
|
|
5705
|
+
* ```typescript
|
|
5706
|
+
* const links = await client.getGuestOrderDownloads('guest@email.com', 'ORD-20260310-0001');
|
|
5707
|
+
* ```
|
|
5708
|
+
*/
|
|
5709
|
+
getGuestOrderDownloads(email: string, orderNumber: string): Promise<OrderDownloadLink[]>;
|
|
5657
5710
|
/**
|
|
5658
5711
|
* Get the current customer's addresses (requires customerToken)
|
|
5659
5712
|
* Works in vibe-coded and storefront modes
|
|
@@ -6485,4 +6538,4 @@ declare function enableDevGuards(options?: {
|
|
|
6485
6538
|
force?: boolean;
|
|
6486
6539
|
}): void;
|
|
6487
6540
|
|
|
6488
|
-
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 CategoryNode, 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 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, 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, getStockStatus, getVariantOptions, getVariantPrice, isCouponApplicableToProduct, isHtmlDescription, isWebhookEventType, parseWebhookEvent, verifyWebhook };
|
|
6541
|
+
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 CategoryNode, 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 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, 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, getStockStatus, getVariantOptions, getVariantPrice, isCouponApplicableToProduct, isHtmlDescription, isWebhookEventType, parseWebhookEvent, verifyWebhook };
|
package/dist/index.js
CHANGED
|
@@ -1770,7 +1770,7 @@ var BrainerceClient = class {
|
|
|
1770
1770
|
if (!provider) {
|
|
1771
1771
|
throw new BrainerceError("provider is required (e.g., 'GOOGLE', 'FACEBOOK', 'GITHUB')", 400);
|
|
1772
1772
|
}
|
|
1773
|
-
if (!this.customerToken) {
|
|
1773
|
+
if (!this.customerToken && !this.proxyMode) {
|
|
1774
1774
|
throw new BrainerceError("Customer token is required. Call setCustomerToken() first.", 401);
|
|
1775
1775
|
}
|
|
1776
1776
|
const params = new URLSearchParams();
|
|
@@ -1803,7 +1803,7 @@ var BrainerceClient = class {
|
|
|
1803
1803
|
if (!provider) {
|
|
1804
1804
|
throw new BrainerceError("provider is required (e.g., 'GOOGLE', 'FACEBOOK', 'GITHUB')", 400);
|
|
1805
1805
|
}
|
|
1806
|
-
if (!this.customerToken) {
|
|
1806
|
+
if (!this.customerToken && !this.proxyMode) {
|
|
1807
1807
|
throw new BrainerceError("Customer token is required. Call setCustomerToken() first.", 401);
|
|
1808
1808
|
}
|
|
1809
1809
|
if (this.isVibeCodedMode()) {
|
|
@@ -1826,7 +1826,7 @@ var BrainerceClient = class {
|
|
|
1826
1826
|
* ```
|
|
1827
1827
|
*/
|
|
1828
1828
|
async getOAuthConnections() {
|
|
1829
|
-
if (!this.customerToken) {
|
|
1829
|
+
if (!this.customerToken && !this.proxyMode) {
|
|
1830
1830
|
throw new BrainerceError("Customer token is required. Call setCustomerToken() first.", 401);
|
|
1831
1831
|
}
|
|
1832
1832
|
if (this.isVibeCodedMode()) {
|
|
@@ -1859,7 +1859,7 @@ var BrainerceClient = class {
|
|
|
1859
1859
|
* ```
|
|
1860
1860
|
*/
|
|
1861
1861
|
async getCustomerProfile() {
|
|
1862
|
-
if (!this.customerToken) {
|
|
1862
|
+
if (!this.customerToken && !this.proxyMode) {
|
|
1863
1863
|
throw new BrainerceError("Customer token is required. Call setCustomerToken() first.", 401);
|
|
1864
1864
|
}
|
|
1865
1865
|
if (this.isVibeCodedMode()) {
|
|
@@ -2221,7 +2221,7 @@ var BrainerceClient = class {
|
|
|
2221
2221
|
* ```
|
|
2222
2222
|
*/
|
|
2223
2223
|
async linkCart(cartId) {
|
|
2224
|
-
if (!this.customerToken) {
|
|
2224
|
+
if (!this.customerToken && !this.proxyMode) {
|
|
2225
2225
|
throw new BrainerceError(
|
|
2226
2226
|
"Customer must be logged in to link cart. Call setCustomerToken() first.",
|
|
2227
2227
|
401
|
|
@@ -2681,7 +2681,7 @@ var BrainerceClient = class {
|
|
|
2681
2681
|
* @internal
|
|
2682
2682
|
*/
|
|
2683
2683
|
async fetchCustomerCart() {
|
|
2684
|
-
if (!this.customerToken) {
|
|
2684
|
+
if (!this.customerToken && !this.proxyMode) {
|
|
2685
2685
|
throw new BrainerceError("Customer token required", 401);
|
|
2686
2686
|
}
|
|
2687
2687
|
if (this.isVibeCodedMode()) {
|
|
@@ -3296,6 +3296,33 @@ var BrainerceClient = class {
|
|
|
3296
3296
|
this.clearActiveCheckoutStorage();
|
|
3297
3297
|
return result;
|
|
3298
3298
|
}
|
|
3299
|
+
/**
|
|
3300
|
+
* Delete a checkout session. Releases inventory reservations and removes
|
|
3301
|
+
* payment records not yet linked to an order.
|
|
3302
|
+
*
|
|
3303
|
+
* Cannot delete checkouts with status COMPLETED or PAYMENT_PROCESSING.
|
|
3304
|
+
*/
|
|
3305
|
+
async deleteCheckout(checkoutId) {
|
|
3306
|
+
let result;
|
|
3307
|
+
if (this.isVibeCodedMode()) {
|
|
3308
|
+
result = await this.vibeCodedRequest(
|
|
3309
|
+
"DELETE",
|
|
3310
|
+
`/checkout/${checkoutId}`
|
|
3311
|
+
);
|
|
3312
|
+
} else if (this.storeId && !this.apiKey) {
|
|
3313
|
+
result = await this.storefrontRequest(
|
|
3314
|
+
"DELETE",
|
|
3315
|
+
`/checkout/${checkoutId}`
|
|
3316
|
+
);
|
|
3317
|
+
} else {
|
|
3318
|
+
result = await this.adminRequest(
|
|
3319
|
+
"DELETE",
|
|
3320
|
+
`/api/v1/checkout/${checkoutId}`
|
|
3321
|
+
);
|
|
3322
|
+
}
|
|
3323
|
+
this.clearActiveCheckoutStorage();
|
|
3324
|
+
return result;
|
|
3325
|
+
}
|
|
3299
3326
|
// -------------------- Payment (Vibe-Coded Only) --------------------
|
|
3300
3327
|
/**
|
|
3301
3328
|
* Get payment configuration for the connected store.
|
|
@@ -4291,7 +4318,7 @@ var BrainerceClient = class {
|
|
|
4291
4318
|
* ```
|
|
4292
4319
|
*/
|
|
4293
4320
|
async getMyProfile() {
|
|
4294
|
-
if (!this.customerToken) {
|
|
4321
|
+
if (!this.customerToken && !this.proxyMode) {
|
|
4295
4322
|
throw new BrainerceError(
|
|
4296
4323
|
"Customer token required. Call setCustomerToken() after login.",
|
|
4297
4324
|
401
|
|
@@ -4330,7 +4357,7 @@ var BrainerceClient = class {
|
|
|
4330
4357
|
* ```
|
|
4331
4358
|
*/
|
|
4332
4359
|
async getCheckoutPrefillData() {
|
|
4333
|
-
if (!this.customerToken) {
|
|
4360
|
+
if (!this.customerToken && !this.proxyMode) {
|
|
4334
4361
|
throw new BrainerceError(
|
|
4335
4362
|
"Customer token required. Call setCustomerToken() after login.",
|
|
4336
4363
|
401
|
|
@@ -4352,7 +4379,7 @@ var BrainerceClient = class {
|
|
|
4352
4379
|
* Only available in storefront mode
|
|
4353
4380
|
*/
|
|
4354
4381
|
async updateMyProfile(data) {
|
|
4355
|
-
if (!this.customerToken) {
|
|
4382
|
+
if (!this.customerToken && !this.proxyMode) {
|
|
4356
4383
|
throw new BrainerceError(
|
|
4357
4384
|
"Customer token required. Call setCustomerToken() after login.",
|
|
4358
4385
|
401
|
|
@@ -4374,7 +4401,7 @@ var BrainerceClient = class {
|
|
|
4374
4401
|
* Works in vibe-coded and storefront modes
|
|
4375
4402
|
*/
|
|
4376
4403
|
async getMyOrders(params) {
|
|
4377
|
-
if (!this.customerToken) {
|
|
4404
|
+
if (!this.customerToken && !this.proxyMode) {
|
|
4378
4405
|
throw new BrainerceError(
|
|
4379
4406
|
"Customer token required. Call setCustomerToken() after login.",
|
|
4380
4407
|
401
|
|
@@ -4421,7 +4448,7 @@ var BrainerceClient = class {
|
|
|
4421
4448
|
* ```
|
|
4422
4449
|
*/
|
|
4423
4450
|
async getOrderDownloads(orderId) {
|
|
4424
|
-
if (!this.customerToken) {
|
|
4451
|
+
if (!this.customerToken && !this.proxyMode) {
|
|
4425
4452
|
throw new BrainerceError(
|
|
4426
4453
|
"Customer token required. Call setCustomerToken() after login.",
|
|
4427
4454
|
401
|
|
@@ -4444,12 +4471,39 @@ var BrainerceClient = class {
|
|
|
4444
4471
|
400
|
|
4445
4472
|
);
|
|
4446
4473
|
}
|
|
4474
|
+
/**
|
|
4475
|
+
* Get download links for a guest order (no login required)
|
|
4476
|
+
* Validates identity via email + order number
|
|
4477
|
+
*
|
|
4478
|
+
* @example
|
|
4479
|
+
* ```typescript
|
|
4480
|
+
* const links = await client.getGuestOrderDownloads('guest@email.com', 'ORD-20260310-0001');
|
|
4481
|
+
* ```
|
|
4482
|
+
*/
|
|
4483
|
+
async getGuestOrderDownloads(email, orderNumber) {
|
|
4484
|
+
if (this.isVibeCodedMode()) {
|
|
4485
|
+
return this.vibeCodedRequest("POST", "/orders/guest/downloads", {
|
|
4486
|
+
email,
|
|
4487
|
+
orderNumber
|
|
4488
|
+
});
|
|
4489
|
+
}
|
|
4490
|
+
if (this.storeId && !this.apiKey) {
|
|
4491
|
+
return this.storefrontRequest("POST", "/orders/guest/downloads", {
|
|
4492
|
+
email,
|
|
4493
|
+
orderNumber
|
|
4494
|
+
});
|
|
4495
|
+
}
|
|
4496
|
+
throw new BrainerceError(
|
|
4497
|
+
"getGuestOrderDownloads is only available in vibe-coded or storefront mode",
|
|
4498
|
+
400
|
|
4499
|
+
);
|
|
4500
|
+
}
|
|
4447
4501
|
/**
|
|
4448
4502
|
* Get the current customer's addresses (requires customerToken)
|
|
4449
4503
|
* Works in vibe-coded and storefront modes
|
|
4450
4504
|
*/
|
|
4451
4505
|
async getMyAddresses() {
|
|
4452
|
-
if (!this.customerToken) {
|
|
4506
|
+
if (!this.customerToken && !this.proxyMode) {
|
|
4453
4507
|
throw new BrainerceError(
|
|
4454
4508
|
"Customer token required. Call setCustomerToken() after login.",
|
|
4455
4509
|
401
|
|
@@ -4471,7 +4525,7 @@ var BrainerceClient = class {
|
|
|
4471
4525
|
* Works in vibe-coded and storefront modes
|
|
4472
4526
|
*/
|
|
4473
4527
|
async addMyAddress(address) {
|
|
4474
|
-
if (!this.customerToken) {
|
|
4528
|
+
if (!this.customerToken && !this.proxyMode) {
|
|
4475
4529
|
throw new BrainerceError(
|
|
4476
4530
|
"Customer token required. Call setCustomerToken() after login.",
|
|
4477
4531
|
401
|
|
@@ -4493,7 +4547,7 @@ var BrainerceClient = class {
|
|
|
4493
4547
|
* Works in vibe-coded and storefront modes
|
|
4494
4548
|
*/
|
|
4495
4549
|
async updateMyAddress(addressId, data) {
|
|
4496
|
-
if (!this.customerToken) {
|
|
4550
|
+
if (!this.customerToken && !this.proxyMode) {
|
|
4497
4551
|
throw new BrainerceError(
|
|
4498
4552
|
"Customer token required. Call setCustomerToken() after login.",
|
|
4499
4553
|
401
|
|
@@ -4523,7 +4577,7 @@ var BrainerceClient = class {
|
|
|
4523
4577
|
* Works in vibe-coded and storefront modes
|
|
4524
4578
|
*/
|
|
4525
4579
|
async deleteMyAddress(addressId) {
|
|
4526
|
-
if (!this.customerToken) {
|
|
4580
|
+
if (!this.customerToken && !this.proxyMode) {
|
|
4527
4581
|
throw new BrainerceError(
|
|
4528
4582
|
"Customer token required. Call setCustomerToken() after login.",
|
|
4529
4583
|
401
|
|
@@ -4551,7 +4605,7 @@ var BrainerceClient = class {
|
|
|
4551
4605
|
if (!this.storeId) {
|
|
4552
4606
|
throw new BrainerceError("getMyCart is only available in storefront mode", 400);
|
|
4553
4607
|
}
|
|
4554
|
-
if (!this.customerToken) {
|
|
4608
|
+
if (!this.customerToken && !this.proxyMode) {
|
|
4555
4609
|
throw new BrainerceError(
|
|
4556
4610
|
"Customer token required. Call setCustomerToken() after login.",
|
|
4557
4611
|
401
|
package/dist/index.mjs
CHANGED
|
@@ -1712,7 +1712,7 @@ var BrainerceClient = class {
|
|
|
1712
1712
|
if (!provider) {
|
|
1713
1713
|
throw new BrainerceError("provider is required (e.g., 'GOOGLE', 'FACEBOOK', 'GITHUB')", 400);
|
|
1714
1714
|
}
|
|
1715
|
-
if (!this.customerToken) {
|
|
1715
|
+
if (!this.customerToken && !this.proxyMode) {
|
|
1716
1716
|
throw new BrainerceError("Customer token is required. Call setCustomerToken() first.", 401);
|
|
1717
1717
|
}
|
|
1718
1718
|
const params = new URLSearchParams();
|
|
@@ -1745,7 +1745,7 @@ var BrainerceClient = class {
|
|
|
1745
1745
|
if (!provider) {
|
|
1746
1746
|
throw new BrainerceError("provider is required (e.g., 'GOOGLE', 'FACEBOOK', 'GITHUB')", 400);
|
|
1747
1747
|
}
|
|
1748
|
-
if (!this.customerToken) {
|
|
1748
|
+
if (!this.customerToken && !this.proxyMode) {
|
|
1749
1749
|
throw new BrainerceError("Customer token is required. Call setCustomerToken() first.", 401);
|
|
1750
1750
|
}
|
|
1751
1751
|
if (this.isVibeCodedMode()) {
|
|
@@ -1768,7 +1768,7 @@ var BrainerceClient = class {
|
|
|
1768
1768
|
* ```
|
|
1769
1769
|
*/
|
|
1770
1770
|
async getOAuthConnections() {
|
|
1771
|
-
if (!this.customerToken) {
|
|
1771
|
+
if (!this.customerToken && !this.proxyMode) {
|
|
1772
1772
|
throw new BrainerceError("Customer token is required. Call setCustomerToken() first.", 401);
|
|
1773
1773
|
}
|
|
1774
1774
|
if (this.isVibeCodedMode()) {
|
|
@@ -1801,7 +1801,7 @@ var BrainerceClient = class {
|
|
|
1801
1801
|
* ```
|
|
1802
1802
|
*/
|
|
1803
1803
|
async getCustomerProfile() {
|
|
1804
|
-
if (!this.customerToken) {
|
|
1804
|
+
if (!this.customerToken && !this.proxyMode) {
|
|
1805
1805
|
throw new BrainerceError("Customer token is required. Call setCustomerToken() first.", 401);
|
|
1806
1806
|
}
|
|
1807
1807
|
if (this.isVibeCodedMode()) {
|
|
@@ -2163,7 +2163,7 @@ var BrainerceClient = class {
|
|
|
2163
2163
|
* ```
|
|
2164
2164
|
*/
|
|
2165
2165
|
async linkCart(cartId) {
|
|
2166
|
-
if (!this.customerToken) {
|
|
2166
|
+
if (!this.customerToken && !this.proxyMode) {
|
|
2167
2167
|
throw new BrainerceError(
|
|
2168
2168
|
"Customer must be logged in to link cart. Call setCustomerToken() first.",
|
|
2169
2169
|
401
|
|
@@ -2623,7 +2623,7 @@ var BrainerceClient = class {
|
|
|
2623
2623
|
* @internal
|
|
2624
2624
|
*/
|
|
2625
2625
|
async fetchCustomerCart() {
|
|
2626
|
-
if (!this.customerToken) {
|
|
2626
|
+
if (!this.customerToken && !this.proxyMode) {
|
|
2627
2627
|
throw new BrainerceError("Customer token required", 401);
|
|
2628
2628
|
}
|
|
2629
2629
|
if (this.isVibeCodedMode()) {
|
|
@@ -3238,6 +3238,33 @@ var BrainerceClient = class {
|
|
|
3238
3238
|
this.clearActiveCheckoutStorage();
|
|
3239
3239
|
return result;
|
|
3240
3240
|
}
|
|
3241
|
+
/**
|
|
3242
|
+
* Delete a checkout session. Releases inventory reservations and removes
|
|
3243
|
+
* payment records not yet linked to an order.
|
|
3244
|
+
*
|
|
3245
|
+
* Cannot delete checkouts with status COMPLETED or PAYMENT_PROCESSING.
|
|
3246
|
+
*/
|
|
3247
|
+
async deleteCheckout(checkoutId) {
|
|
3248
|
+
let result;
|
|
3249
|
+
if (this.isVibeCodedMode()) {
|
|
3250
|
+
result = await this.vibeCodedRequest(
|
|
3251
|
+
"DELETE",
|
|
3252
|
+
`/checkout/${checkoutId}`
|
|
3253
|
+
);
|
|
3254
|
+
} else if (this.storeId && !this.apiKey) {
|
|
3255
|
+
result = await this.storefrontRequest(
|
|
3256
|
+
"DELETE",
|
|
3257
|
+
`/checkout/${checkoutId}`
|
|
3258
|
+
);
|
|
3259
|
+
} else {
|
|
3260
|
+
result = await this.adminRequest(
|
|
3261
|
+
"DELETE",
|
|
3262
|
+
`/api/v1/checkout/${checkoutId}`
|
|
3263
|
+
);
|
|
3264
|
+
}
|
|
3265
|
+
this.clearActiveCheckoutStorage();
|
|
3266
|
+
return result;
|
|
3267
|
+
}
|
|
3241
3268
|
// -------------------- Payment (Vibe-Coded Only) --------------------
|
|
3242
3269
|
/**
|
|
3243
3270
|
* Get payment configuration for the connected store.
|
|
@@ -4233,7 +4260,7 @@ var BrainerceClient = class {
|
|
|
4233
4260
|
* ```
|
|
4234
4261
|
*/
|
|
4235
4262
|
async getMyProfile() {
|
|
4236
|
-
if (!this.customerToken) {
|
|
4263
|
+
if (!this.customerToken && !this.proxyMode) {
|
|
4237
4264
|
throw new BrainerceError(
|
|
4238
4265
|
"Customer token required. Call setCustomerToken() after login.",
|
|
4239
4266
|
401
|
|
@@ -4272,7 +4299,7 @@ var BrainerceClient = class {
|
|
|
4272
4299
|
* ```
|
|
4273
4300
|
*/
|
|
4274
4301
|
async getCheckoutPrefillData() {
|
|
4275
|
-
if (!this.customerToken) {
|
|
4302
|
+
if (!this.customerToken && !this.proxyMode) {
|
|
4276
4303
|
throw new BrainerceError(
|
|
4277
4304
|
"Customer token required. Call setCustomerToken() after login.",
|
|
4278
4305
|
401
|
|
@@ -4294,7 +4321,7 @@ var BrainerceClient = class {
|
|
|
4294
4321
|
* Only available in storefront mode
|
|
4295
4322
|
*/
|
|
4296
4323
|
async updateMyProfile(data) {
|
|
4297
|
-
if (!this.customerToken) {
|
|
4324
|
+
if (!this.customerToken && !this.proxyMode) {
|
|
4298
4325
|
throw new BrainerceError(
|
|
4299
4326
|
"Customer token required. Call setCustomerToken() after login.",
|
|
4300
4327
|
401
|
|
@@ -4316,7 +4343,7 @@ var BrainerceClient = class {
|
|
|
4316
4343
|
* Works in vibe-coded and storefront modes
|
|
4317
4344
|
*/
|
|
4318
4345
|
async getMyOrders(params) {
|
|
4319
|
-
if (!this.customerToken) {
|
|
4346
|
+
if (!this.customerToken && !this.proxyMode) {
|
|
4320
4347
|
throw new BrainerceError(
|
|
4321
4348
|
"Customer token required. Call setCustomerToken() after login.",
|
|
4322
4349
|
401
|
|
@@ -4363,7 +4390,7 @@ var BrainerceClient = class {
|
|
|
4363
4390
|
* ```
|
|
4364
4391
|
*/
|
|
4365
4392
|
async getOrderDownloads(orderId) {
|
|
4366
|
-
if (!this.customerToken) {
|
|
4393
|
+
if (!this.customerToken && !this.proxyMode) {
|
|
4367
4394
|
throw new BrainerceError(
|
|
4368
4395
|
"Customer token required. Call setCustomerToken() after login.",
|
|
4369
4396
|
401
|
|
@@ -4386,12 +4413,39 @@ var BrainerceClient = class {
|
|
|
4386
4413
|
400
|
|
4387
4414
|
);
|
|
4388
4415
|
}
|
|
4416
|
+
/**
|
|
4417
|
+
* Get download links for a guest order (no login required)
|
|
4418
|
+
* Validates identity via email + order number
|
|
4419
|
+
*
|
|
4420
|
+
* @example
|
|
4421
|
+
* ```typescript
|
|
4422
|
+
* const links = await client.getGuestOrderDownloads('guest@email.com', 'ORD-20260310-0001');
|
|
4423
|
+
* ```
|
|
4424
|
+
*/
|
|
4425
|
+
async getGuestOrderDownloads(email, orderNumber) {
|
|
4426
|
+
if (this.isVibeCodedMode()) {
|
|
4427
|
+
return this.vibeCodedRequest("POST", "/orders/guest/downloads", {
|
|
4428
|
+
email,
|
|
4429
|
+
orderNumber
|
|
4430
|
+
});
|
|
4431
|
+
}
|
|
4432
|
+
if (this.storeId && !this.apiKey) {
|
|
4433
|
+
return this.storefrontRequest("POST", "/orders/guest/downloads", {
|
|
4434
|
+
email,
|
|
4435
|
+
orderNumber
|
|
4436
|
+
});
|
|
4437
|
+
}
|
|
4438
|
+
throw new BrainerceError(
|
|
4439
|
+
"getGuestOrderDownloads is only available in vibe-coded or storefront mode",
|
|
4440
|
+
400
|
|
4441
|
+
);
|
|
4442
|
+
}
|
|
4389
4443
|
/**
|
|
4390
4444
|
* Get the current customer's addresses (requires customerToken)
|
|
4391
4445
|
* Works in vibe-coded and storefront modes
|
|
4392
4446
|
*/
|
|
4393
4447
|
async getMyAddresses() {
|
|
4394
|
-
if (!this.customerToken) {
|
|
4448
|
+
if (!this.customerToken && !this.proxyMode) {
|
|
4395
4449
|
throw new BrainerceError(
|
|
4396
4450
|
"Customer token required. Call setCustomerToken() after login.",
|
|
4397
4451
|
401
|
|
@@ -4413,7 +4467,7 @@ var BrainerceClient = class {
|
|
|
4413
4467
|
* Works in vibe-coded and storefront modes
|
|
4414
4468
|
*/
|
|
4415
4469
|
async addMyAddress(address) {
|
|
4416
|
-
if (!this.customerToken) {
|
|
4470
|
+
if (!this.customerToken && !this.proxyMode) {
|
|
4417
4471
|
throw new BrainerceError(
|
|
4418
4472
|
"Customer token required. Call setCustomerToken() after login.",
|
|
4419
4473
|
401
|
|
@@ -4435,7 +4489,7 @@ var BrainerceClient = class {
|
|
|
4435
4489
|
* Works in vibe-coded and storefront modes
|
|
4436
4490
|
*/
|
|
4437
4491
|
async updateMyAddress(addressId, data) {
|
|
4438
|
-
if (!this.customerToken) {
|
|
4492
|
+
if (!this.customerToken && !this.proxyMode) {
|
|
4439
4493
|
throw new BrainerceError(
|
|
4440
4494
|
"Customer token required. Call setCustomerToken() after login.",
|
|
4441
4495
|
401
|
|
@@ -4465,7 +4519,7 @@ var BrainerceClient = class {
|
|
|
4465
4519
|
* Works in vibe-coded and storefront modes
|
|
4466
4520
|
*/
|
|
4467
4521
|
async deleteMyAddress(addressId) {
|
|
4468
|
-
if (!this.customerToken) {
|
|
4522
|
+
if (!this.customerToken && !this.proxyMode) {
|
|
4469
4523
|
throw new BrainerceError(
|
|
4470
4524
|
"Customer token required. Call setCustomerToken() after login.",
|
|
4471
4525
|
401
|
|
@@ -4493,7 +4547,7 @@ var BrainerceClient = class {
|
|
|
4493
4547
|
if (!this.storeId) {
|
|
4494
4548
|
throw new BrainerceError("getMyCart is only available in storefront mode", 400);
|
|
4495
4549
|
}
|
|
4496
|
-
if (!this.customerToken) {
|
|
4550
|
+
if (!this.customerToken && !this.proxyMode) {
|
|
4497
4551
|
throw new BrainerceError(
|
|
4498
4552
|
"Customer token required. Call setCustomerToken() after login.",
|
|
4499
4553
|
401
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "brainerce",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.10.1",
|
|
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",
|