brainerce 1.2.0 → 1.3.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/dist/index.d.mts CHANGED
@@ -1784,6 +1784,53 @@ interface ShippingRate {
1784
1784
  /** Service level (e.g., "ground", "express") - only for carrier rates */
1785
1785
  service?: string;
1786
1786
  }
1787
+ /**
1788
+ * Pickup location details for local pickup orders.
1789
+ */
1790
+ interface PickupLocation {
1791
+ /** Rate ID for this pickup location (use for selectPickupLocation) */
1792
+ id: string;
1793
+ /** Pickup location name (e.g., "Main Store", "Tel Aviv Warehouse") */
1794
+ name: string;
1795
+ /** Shipping rate name */
1796
+ rateName: string;
1797
+ /** Location address */
1798
+ address: {
1799
+ line1: string;
1800
+ line2?: string;
1801
+ city: string;
1802
+ region?: string;
1803
+ postalCode: string;
1804
+ country: string;
1805
+ };
1806
+ /** Contact phone */
1807
+ phone?: string;
1808
+ /** Business hours (e.g., "Sun-Thu 9:00-17:00") */
1809
+ hours?: string;
1810
+ /** Pickup instructions (e.g., "Enter through side door") */
1811
+ instructions?: string;
1812
+ /** Pickup fee as string (e.g., "0", "2.99") */
1813
+ price: string;
1814
+ /** Currency code */
1815
+ currency: string;
1816
+ }
1817
+ /**
1818
+ * Data required to select a pickup location during checkout.
1819
+ */
1820
+ interface SelectPickupLocationDto {
1821
+ /** The pickup rate ID (from getPickupLocations) */
1822
+ pickupRateId: string;
1823
+ /** Customer email (required) */
1824
+ email: string;
1825
+ /** Customer first name */
1826
+ firstName?: string;
1827
+ /** Customer last name */
1828
+ lastName?: string;
1829
+ /** Customer phone */
1830
+ phone?: string;
1831
+ /** Marketing consent */
1832
+ acceptsMarketing?: boolean;
1833
+ }
1787
1834
  /**
1788
1835
  * Represents a checkout session for completing a purchase.
1789
1836
  *
@@ -1841,6 +1888,10 @@ interface Checkout {
1841
1888
  email?: string | null;
1842
1889
  /** Customer ID if linked to a customer account */
1843
1890
  customerId?: string | null;
1891
+ /** Delivery method: "shipping" (default) or "pickup" */
1892
+ deliveryType?: 'shipping' | 'pickup';
1893
+ /** Pickup location details (when deliveryType is "pickup") */
1894
+ pickupLocation?: PickupLocation | null;
1844
1895
  /** Shipping address (required before selecting shipping) */
1845
1896
  shippingAddress?: CheckoutAddress | null;
1846
1897
  /** Billing address (optional, defaults to shipping) */
@@ -2336,9 +2387,9 @@ type PaymentProvider = PaymentProviderConfig;
2336
2387
  *
2337
2388
  * const growProvider = providers.find(p => p.provider === 'grow');
2338
2389
  * if (growProvider) {
2339
- * // Grow uses iframeno client-side SDK needed
2340
- * // createPaymentIntent() returns a payment URL as clientSecret
2341
- * // Show it in an iframe: <iframe src={paymentIntent.clientSecret} />
2390
+ * // Grow uses SDK wallet load https://cdn.meshulam.co.il/sdk/gs.min.js
2391
+ * // createPaymentIntent() returns an authCode as clientSecret
2392
+ * // Call growPayment.init({...}) then growPayment.renderPaymentOptions(authCode)
2342
2393
  * }
2343
2394
  * ```
2344
2395
  */
@@ -2372,7 +2423,7 @@ interface PaymentConfig {
2372
2423
  interface PaymentIntent {
2373
2424
  /** Payment intent ID */
2374
2425
  id: string;
2375
- /** Client secret for completing payment on frontend. For Stripe: client secret (pi_xxx_secret_xxx). For Grow: payment page URL. */
2426
+ /** Client secret for completing payment on frontend. For Stripe: client secret (pi_xxx_secret_xxx). For Grow: authCode for SDK wallet rendering. */
2376
2427
  clientSecret: string;
2377
2428
  /** Amount in display format (e.g., "99.99") */
2378
2429
  amount: string;
@@ -4906,6 +4957,45 @@ declare class BrainerceClient {
4906
4957
  * ```
4907
4958
  */
4908
4959
  selectShippingMethod(checkoutId: string, shippingRateId: string): Promise<Checkout>;
4960
+ /**
4961
+ * Get available pickup locations for a store.
4962
+ * Returns empty array if no pickup locations are configured.
4963
+ *
4964
+ * @example
4965
+ * ```typescript
4966
+ * const locations = await client.getPickupLocations();
4967
+ * if (locations.length > 0) {
4968
+ * // Show pickup option in checkout
4969
+ * }
4970
+ * ```
4971
+ */
4972
+ getPickupLocations(): Promise<PickupLocation[]>;
4973
+ /**
4974
+ * Set delivery type on checkout (shipping or pickup).
4975
+ *
4976
+ * @example
4977
+ * ```typescript
4978
+ * const checkout = await client.setDeliveryType('checkout_123', 'pickup');
4979
+ * ```
4980
+ */
4981
+ setDeliveryType(checkoutId: string, deliveryType: 'shipping' | 'pickup'): Promise<Checkout>;
4982
+ /**
4983
+ * Select a pickup location for checkout.
4984
+ * This sets the delivery type to "pickup", records customer info, and prepares for payment.
4985
+ * Equivalent to setShippingAddress + selectShippingMethod for delivery orders.
4986
+ *
4987
+ * @example
4988
+ * ```typescript
4989
+ * const checkout = await client.selectPickupLocation('checkout_123', {
4990
+ * pickupRateId: 'rate_main_store',
4991
+ * email: 'customer@example.com',
4992
+ * firstName: 'John',
4993
+ * lastName: 'Doe',
4994
+ * });
4995
+ * // Now proceed to payment
4996
+ * ```
4997
+ */
4998
+ selectPickupLocation(checkoutId: string, data: SelectPickupLocationDto): Promise<Checkout>;
4909
4999
  /**
4910
5000
  * Set billing address on checkout
4911
5001
  * Can optionally use shipping address as billing address
@@ -5073,6 +5163,19 @@ declare class BrainerceClient {
5073
5163
  * ```
5074
5164
  */
5075
5165
  getPaymentStatus(checkoutId: string): Promise<PaymentStatus>;
5166
+ /**
5167
+ * Confirm a Grow SDK payment from the frontend.
5168
+ * Call this in the Grow SDK `onSuccess` callback to notify the backend
5169
+ * that payment succeeded, triggering order creation.
5170
+ *
5171
+ * **Vibe-coded mode only** - requires connectionId
5172
+ *
5173
+ * @param checkoutId - The checkout ID
5174
+ * @param confirmationNumber - Optional confirmation number from Grow onSuccess
5175
+ */
5176
+ confirmGrowPayment(checkoutId: string, confirmationNumber?: string): Promise<{
5177
+ confirmed: boolean;
5178
+ }>;
5076
5179
  /**
5077
5180
  * Wait for order creation after payment.
5078
5181
  *
@@ -6314,4 +6417,4 @@ declare function enableDevGuards(options?: {
6314
6417
  force?: boolean;
6315
6418
  }): void;
6316
6419
 
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 };
6420
+ 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 PickupLocation, 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 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
@@ -1784,6 +1784,53 @@ interface ShippingRate {
1784
1784
  /** Service level (e.g., "ground", "express") - only for carrier rates */
1785
1785
  service?: string;
1786
1786
  }
1787
+ /**
1788
+ * Pickup location details for local pickup orders.
1789
+ */
1790
+ interface PickupLocation {
1791
+ /** Rate ID for this pickup location (use for selectPickupLocation) */
1792
+ id: string;
1793
+ /** Pickup location name (e.g., "Main Store", "Tel Aviv Warehouse") */
1794
+ name: string;
1795
+ /** Shipping rate name */
1796
+ rateName: string;
1797
+ /** Location address */
1798
+ address: {
1799
+ line1: string;
1800
+ line2?: string;
1801
+ city: string;
1802
+ region?: string;
1803
+ postalCode: string;
1804
+ country: string;
1805
+ };
1806
+ /** Contact phone */
1807
+ phone?: string;
1808
+ /** Business hours (e.g., "Sun-Thu 9:00-17:00") */
1809
+ hours?: string;
1810
+ /** Pickup instructions (e.g., "Enter through side door") */
1811
+ instructions?: string;
1812
+ /** Pickup fee as string (e.g., "0", "2.99") */
1813
+ price: string;
1814
+ /** Currency code */
1815
+ currency: string;
1816
+ }
1817
+ /**
1818
+ * Data required to select a pickup location during checkout.
1819
+ */
1820
+ interface SelectPickupLocationDto {
1821
+ /** The pickup rate ID (from getPickupLocations) */
1822
+ pickupRateId: string;
1823
+ /** Customer email (required) */
1824
+ email: string;
1825
+ /** Customer first name */
1826
+ firstName?: string;
1827
+ /** Customer last name */
1828
+ lastName?: string;
1829
+ /** Customer phone */
1830
+ phone?: string;
1831
+ /** Marketing consent */
1832
+ acceptsMarketing?: boolean;
1833
+ }
1787
1834
  /**
1788
1835
  * Represents a checkout session for completing a purchase.
1789
1836
  *
@@ -1841,6 +1888,10 @@ interface Checkout {
1841
1888
  email?: string | null;
1842
1889
  /** Customer ID if linked to a customer account */
1843
1890
  customerId?: string | null;
1891
+ /** Delivery method: "shipping" (default) or "pickup" */
1892
+ deliveryType?: 'shipping' | 'pickup';
1893
+ /** Pickup location details (when deliveryType is "pickup") */
1894
+ pickupLocation?: PickupLocation | null;
1844
1895
  /** Shipping address (required before selecting shipping) */
1845
1896
  shippingAddress?: CheckoutAddress | null;
1846
1897
  /** Billing address (optional, defaults to shipping) */
@@ -2336,9 +2387,9 @@ type PaymentProvider = PaymentProviderConfig;
2336
2387
  *
2337
2388
  * const growProvider = providers.find(p => p.provider === 'grow');
2338
2389
  * if (growProvider) {
2339
- * // Grow uses iframeno client-side SDK needed
2340
- * // createPaymentIntent() returns a payment URL as clientSecret
2341
- * // Show it in an iframe: <iframe src={paymentIntent.clientSecret} />
2390
+ * // Grow uses SDK wallet load https://cdn.meshulam.co.il/sdk/gs.min.js
2391
+ * // createPaymentIntent() returns an authCode as clientSecret
2392
+ * // Call growPayment.init({...}) then growPayment.renderPaymentOptions(authCode)
2342
2393
  * }
2343
2394
  * ```
2344
2395
  */
@@ -2372,7 +2423,7 @@ interface PaymentConfig {
2372
2423
  interface PaymentIntent {
2373
2424
  /** Payment intent ID */
2374
2425
  id: string;
2375
- /** Client secret for completing payment on frontend. For Stripe: client secret (pi_xxx_secret_xxx). For Grow: payment page URL. */
2426
+ /** Client secret for completing payment on frontend. For Stripe: client secret (pi_xxx_secret_xxx). For Grow: authCode for SDK wallet rendering. */
2376
2427
  clientSecret: string;
2377
2428
  /** Amount in display format (e.g., "99.99") */
2378
2429
  amount: string;
@@ -4906,6 +4957,45 @@ declare class BrainerceClient {
4906
4957
  * ```
4907
4958
  */
4908
4959
  selectShippingMethod(checkoutId: string, shippingRateId: string): Promise<Checkout>;
4960
+ /**
4961
+ * Get available pickup locations for a store.
4962
+ * Returns empty array if no pickup locations are configured.
4963
+ *
4964
+ * @example
4965
+ * ```typescript
4966
+ * const locations = await client.getPickupLocations();
4967
+ * if (locations.length > 0) {
4968
+ * // Show pickup option in checkout
4969
+ * }
4970
+ * ```
4971
+ */
4972
+ getPickupLocations(): Promise<PickupLocation[]>;
4973
+ /**
4974
+ * Set delivery type on checkout (shipping or pickup).
4975
+ *
4976
+ * @example
4977
+ * ```typescript
4978
+ * const checkout = await client.setDeliveryType('checkout_123', 'pickup');
4979
+ * ```
4980
+ */
4981
+ setDeliveryType(checkoutId: string, deliveryType: 'shipping' | 'pickup'): Promise<Checkout>;
4982
+ /**
4983
+ * Select a pickup location for checkout.
4984
+ * This sets the delivery type to "pickup", records customer info, and prepares for payment.
4985
+ * Equivalent to setShippingAddress + selectShippingMethod for delivery orders.
4986
+ *
4987
+ * @example
4988
+ * ```typescript
4989
+ * const checkout = await client.selectPickupLocation('checkout_123', {
4990
+ * pickupRateId: 'rate_main_store',
4991
+ * email: 'customer@example.com',
4992
+ * firstName: 'John',
4993
+ * lastName: 'Doe',
4994
+ * });
4995
+ * // Now proceed to payment
4996
+ * ```
4997
+ */
4998
+ selectPickupLocation(checkoutId: string, data: SelectPickupLocationDto): Promise<Checkout>;
4909
4999
  /**
4910
5000
  * Set billing address on checkout
4911
5001
  * Can optionally use shipping address as billing address
@@ -5073,6 +5163,19 @@ declare class BrainerceClient {
5073
5163
  * ```
5074
5164
  */
5075
5165
  getPaymentStatus(checkoutId: string): Promise<PaymentStatus>;
5166
+ /**
5167
+ * Confirm a Grow SDK payment from the frontend.
5168
+ * Call this in the Grow SDK `onSuccess` callback to notify the backend
5169
+ * that payment succeeded, triggering order creation.
5170
+ *
5171
+ * **Vibe-coded mode only** - requires connectionId
5172
+ *
5173
+ * @param checkoutId - The checkout ID
5174
+ * @param confirmationNumber - Optional confirmation number from Grow onSuccess
5175
+ */
5176
+ confirmGrowPayment(checkoutId: string, confirmationNumber?: string): Promise<{
5177
+ confirmed: boolean;
5178
+ }>;
5076
5179
  /**
5077
5180
  * Wait for order creation after payment.
5078
5181
  *
@@ -6314,4 +6417,4 @@ declare function enableDevGuards(options?: {
6314
6417
  force?: boolean;
6315
6418
  }): void;
6316
6419
 
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 };
6420
+ 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 PickupLocation, 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 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
@@ -3103,6 +3103,91 @@ var BrainerceClient = class {
3103
3103
  "checkout"
3104
3104
  );
3105
3105
  }
3106
+ /**
3107
+ * Get available pickup locations for a store.
3108
+ * Returns empty array if no pickup locations are configured.
3109
+ *
3110
+ * @example
3111
+ * ```typescript
3112
+ * const locations = await client.getPickupLocations();
3113
+ * if (locations.length > 0) {
3114
+ * // Show pickup option in checkout
3115
+ * }
3116
+ * ```
3117
+ */
3118
+ async getPickupLocations() {
3119
+ if (this.isVibeCodedMode()) {
3120
+ const result = await this.vibeCodedRequest(
3121
+ "GET",
3122
+ "/checkout/pickup-locations"
3123
+ );
3124
+ return result.pickupLocations;
3125
+ }
3126
+ if (this.storeId && !this.apiKey) {
3127
+ return this.storefrontRequest("GET", "/checkout/pickup-locations");
3128
+ }
3129
+ return this.adminRequest("GET", "/api/v1/checkouts/pickup-locations");
3130
+ }
3131
+ /**
3132
+ * Set delivery type on checkout (shipping or pickup).
3133
+ *
3134
+ * @example
3135
+ * ```typescript
3136
+ * const checkout = await client.setDeliveryType('checkout_123', 'pickup');
3137
+ * ```
3138
+ */
3139
+ async setDeliveryType(checkoutId, deliveryType) {
3140
+ if (this.isVibeCodedMode()) {
3141
+ return this.vibeCodedRequest("PATCH", `/checkout/${checkoutId}/delivery-type`, {
3142
+ deliveryType
3143
+ });
3144
+ }
3145
+ if (this.storeId && !this.apiKey) {
3146
+ return this.storefrontRequest("PATCH", `/checkout/${checkoutId}/delivery-type`, {
3147
+ deliveryType
3148
+ });
3149
+ }
3150
+ return this.adminRequest("PATCH", `/api/v1/checkout/${checkoutId}/delivery-type`, {
3151
+ deliveryType
3152
+ });
3153
+ }
3154
+ /**
3155
+ * Select a pickup location for checkout.
3156
+ * This sets the delivery type to "pickup", records customer info, and prepares for payment.
3157
+ * Equivalent to setShippingAddress + selectShippingMethod for delivery orders.
3158
+ *
3159
+ * @example
3160
+ * ```typescript
3161
+ * const checkout = await client.selectPickupLocation('checkout_123', {
3162
+ * pickupRateId: 'rate_main_store',
3163
+ * email: 'customer@example.com',
3164
+ * firstName: 'John',
3165
+ * lastName: 'Doe',
3166
+ * });
3167
+ * // Now proceed to payment
3168
+ * ```
3169
+ */
3170
+ async selectPickupLocation(checkoutId, data) {
3171
+ if (this.isVibeCodedMode()) {
3172
+ return this.vibeCodedRequest(
3173
+ "PATCH",
3174
+ `/checkout/${checkoutId}/pickup-location`,
3175
+ data
3176
+ );
3177
+ }
3178
+ if (this.storeId && !this.apiKey) {
3179
+ return this.storefrontRequest(
3180
+ "PATCH",
3181
+ `/checkout/${checkoutId}/pickup-location`,
3182
+ data
3183
+ );
3184
+ }
3185
+ return this.adminRequest(
3186
+ "PATCH",
3187
+ `/api/v1/checkout/${checkoutId}/pickup-location`,
3188
+ data
3189
+ );
3190
+ }
3106
3191
  /**
3107
3192
  * Set billing address on checkout
3108
3193
  * Can optionally use shipping address as billing address
@@ -3345,6 +3430,28 @@ var BrainerceClient = class {
3345
3430
  }
3346
3431
  return this.vibeCodedRequest("GET", `/checkout/${checkoutId}/payment-status`);
3347
3432
  }
3433
+ /**
3434
+ * Confirm a Grow SDK payment from the frontend.
3435
+ * Call this in the Grow SDK `onSuccess` callback to notify the backend
3436
+ * that payment succeeded, triggering order creation.
3437
+ *
3438
+ * **Vibe-coded mode only** - requires connectionId
3439
+ *
3440
+ * @param checkoutId - The checkout ID
3441
+ * @param confirmationNumber - Optional confirmation number from Grow onSuccess
3442
+ */
3443
+ async confirmGrowPayment(checkoutId, confirmationNumber) {
3444
+ if (!this.isVibeCodedMode()) {
3445
+ throw new BrainerceError(
3446
+ "confirmGrowPayment is only available in vibe-coded mode (use connectionId)",
3447
+ 400
3448
+ );
3449
+ }
3450
+ return this.vibeCodedRequest("POST", "/payment/grow-confirm", {
3451
+ checkoutId,
3452
+ confirmationNumber
3453
+ });
3454
+ }
3348
3455
  /**
3349
3456
  * Wait for order creation after payment.
3350
3457
  *
package/dist/index.mjs CHANGED
@@ -3045,6 +3045,91 @@ var BrainerceClient = class {
3045
3045
  "checkout"
3046
3046
  );
3047
3047
  }
3048
+ /**
3049
+ * Get available pickup locations for a store.
3050
+ * Returns empty array if no pickup locations are configured.
3051
+ *
3052
+ * @example
3053
+ * ```typescript
3054
+ * const locations = await client.getPickupLocations();
3055
+ * if (locations.length > 0) {
3056
+ * // Show pickup option in checkout
3057
+ * }
3058
+ * ```
3059
+ */
3060
+ async getPickupLocations() {
3061
+ if (this.isVibeCodedMode()) {
3062
+ const result = await this.vibeCodedRequest(
3063
+ "GET",
3064
+ "/checkout/pickup-locations"
3065
+ );
3066
+ return result.pickupLocations;
3067
+ }
3068
+ if (this.storeId && !this.apiKey) {
3069
+ return this.storefrontRequest("GET", "/checkout/pickup-locations");
3070
+ }
3071
+ return this.adminRequest("GET", "/api/v1/checkouts/pickup-locations");
3072
+ }
3073
+ /**
3074
+ * Set delivery type on checkout (shipping or pickup).
3075
+ *
3076
+ * @example
3077
+ * ```typescript
3078
+ * const checkout = await client.setDeliveryType('checkout_123', 'pickup');
3079
+ * ```
3080
+ */
3081
+ async setDeliveryType(checkoutId, deliveryType) {
3082
+ if (this.isVibeCodedMode()) {
3083
+ return this.vibeCodedRequest("PATCH", `/checkout/${checkoutId}/delivery-type`, {
3084
+ deliveryType
3085
+ });
3086
+ }
3087
+ if (this.storeId && !this.apiKey) {
3088
+ return this.storefrontRequest("PATCH", `/checkout/${checkoutId}/delivery-type`, {
3089
+ deliveryType
3090
+ });
3091
+ }
3092
+ return this.adminRequest("PATCH", `/api/v1/checkout/${checkoutId}/delivery-type`, {
3093
+ deliveryType
3094
+ });
3095
+ }
3096
+ /**
3097
+ * Select a pickup location for checkout.
3098
+ * This sets the delivery type to "pickup", records customer info, and prepares for payment.
3099
+ * Equivalent to setShippingAddress + selectShippingMethod for delivery orders.
3100
+ *
3101
+ * @example
3102
+ * ```typescript
3103
+ * const checkout = await client.selectPickupLocation('checkout_123', {
3104
+ * pickupRateId: 'rate_main_store',
3105
+ * email: 'customer@example.com',
3106
+ * firstName: 'John',
3107
+ * lastName: 'Doe',
3108
+ * });
3109
+ * // Now proceed to payment
3110
+ * ```
3111
+ */
3112
+ async selectPickupLocation(checkoutId, data) {
3113
+ if (this.isVibeCodedMode()) {
3114
+ return this.vibeCodedRequest(
3115
+ "PATCH",
3116
+ `/checkout/${checkoutId}/pickup-location`,
3117
+ data
3118
+ );
3119
+ }
3120
+ if (this.storeId && !this.apiKey) {
3121
+ return this.storefrontRequest(
3122
+ "PATCH",
3123
+ `/checkout/${checkoutId}/pickup-location`,
3124
+ data
3125
+ );
3126
+ }
3127
+ return this.adminRequest(
3128
+ "PATCH",
3129
+ `/api/v1/checkout/${checkoutId}/pickup-location`,
3130
+ data
3131
+ );
3132
+ }
3048
3133
  /**
3049
3134
  * Set billing address on checkout
3050
3135
  * Can optionally use shipping address as billing address
@@ -3287,6 +3372,28 @@ var BrainerceClient = class {
3287
3372
  }
3288
3373
  return this.vibeCodedRequest("GET", `/checkout/${checkoutId}/payment-status`);
3289
3374
  }
3375
+ /**
3376
+ * Confirm a Grow SDK payment from the frontend.
3377
+ * Call this in the Grow SDK `onSuccess` callback to notify the backend
3378
+ * that payment succeeded, triggering order creation.
3379
+ *
3380
+ * **Vibe-coded mode only** - requires connectionId
3381
+ *
3382
+ * @param checkoutId - The checkout ID
3383
+ * @param confirmationNumber - Optional confirmation number from Grow onSuccess
3384
+ */
3385
+ async confirmGrowPayment(checkoutId, confirmationNumber) {
3386
+ if (!this.isVibeCodedMode()) {
3387
+ throw new BrainerceError(
3388
+ "confirmGrowPayment is only available in vibe-coded mode (use connectionId)",
3389
+ 400
3390
+ );
3391
+ }
3392
+ return this.vibeCodedRequest("POST", "/payment/grow-confirm", {
3393
+ checkoutId,
3394
+ confirmationNumber
3395
+ });
3396
+ }
3290
3397
  /**
3291
3398
  * Wait for order creation after payment.
3292
3399
  *
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "brainerce",
3
- "version": "1.2.0",
3
+ "version": "1.3.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",