@behio/storefront-sdk 2.0.3 → 2.1.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.
@@ -519,6 +519,21 @@ var BehioStorefront = class {
519
519
  return { data: null, error: toSdkError(err2) };
520
520
  }
521
521
  }
522
+ /**
523
+ * PUT of a file body to a presigned storage URL (form attachments). No API
524
+ * key and no JSON: the URL itself carries the permission and the exact size.
525
+ *
526
+ * @internal — use behio.forms.uploadFile.
527
+ */
528
+ async putToPresignedUrl(url, body, contentType) {
529
+ try {
530
+ const res = await this.fetchFn(url, { method: "PUT", headers: { "Content-Type": contentType }, body });
531
+ if (!res.ok) throw new BehioApiError(res.status, { code: "be.forms.fileUploadIncomplete" });
532
+ return ok(true);
533
+ } catch (err2) {
534
+ return { data: null, error: toSdkError(err2) };
535
+ }
536
+ }
522
537
  /**
523
538
  * Throws on failure (API error / network / timeout). Kept private so
524
539
  * internal auth refresh recursion keeps its existing control flow —
@@ -1750,6 +1765,33 @@ var FormsModule = class {
1750
1765
  { body: input, auth: false }
1751
1766
  );
1752
1767
  }
1768
+ /**
1769
+ * Upload one file for a `file` field, straight from the browser to storage
1770
+ * (it never passes through the API, so large files are fine: up to
1771
+ * `field.maxSizeMb`, at most 500 MB). Three steps in one call: a presigned
1772
+ * PUT URL for this exact size, the PUT itself, and a confirm where the API
1773
+ * checks the real size and the type from the file content (images, PDF,
1774
+ * Office; never SVG or HTML). Send the returned `id` in `data[fieldKey]`.
1775
+ * Errors: `be.forms.fileTypeNotAllowed`, `be.forms.fileTooLarge`
1776
+ * (params.maxMb), `be.forms.fileRateLimited`, `be.forms.fileUploadIncomplete`.
1777
+ */
1778
+ async uploadFile(slug, fieldKey, file, fileName) {
1779
+ const name = fileName ?? file.name ?? "file";
1780
+ const contentType = file.type || "application/octet-stream";
1781
+ const start = await this.client.request(
1782
+ "POST",
1783
+ `/forms/${encodeURIComponent(slug)}/files/upload-url`,
1784
+ { body: { field: fieldKey, fileName: name, contentType, size: file.size }, auth: false }
1785
+ );
1786
+ if (start.error) return { data: null, error: start.error };
1787
+ const put = await this.client.putToPresignedUrl(start.data.uploadUrl, file, start.data.contentType);
1788
+ if (put.error) return { data: null, error: put.error };
1789
+ return this.client.request(
1790
+ "POST",
1791
+ `/forms/${encodeURIComponent(slug)}/files/${encodeURIComponent(start.data.id)}/confirm`,
1792
+ { auth: false }
1793
+ );
1794
+ }
1753
1795
  };
1754
1796
  var WishlistModule = class {
1755
1797
  constructor(client) {
@@ -519,6 +519,21 @@ var BehioStorefront = class {
519
519
  return { data: null, error: toSdkError(err2) };
520
520
  }
521
521
  }
522
+ /**
523
+ * PUT of a file body to a presigned storage URL (form attachments). No API
524
+ * key and no JSON: the URL itself carries the permission and the exact size.
525
+ *
526
+ * @internal — use behio.forms.uploadFile.
527
+ */
528
+ async putToPresignedUrl(url, body, contentType) {
529
+ try {
530
+ const res = await this.fetchFn(url, { method: "PUT", headers: { "Content-Type": contentType }, body });
531
+ if (!res.ok) throw new BehioApiError(res.status, { code: "be.forms.fileUploadIncomplete" });
532
+ return ok(true);
533
+ } catch (err2) {
534
+ return { data: null, error: toSdkError(err2) };
535
+ }
536
+ }
522
537
  /**
523
538
  * Throws on failure (API error / network / timeout). Kept private so
524
539
  * internal auth refresh recursion keeps its existing control flow —
@@ -1750,6 +1765,33 @@ var FormsModule = class {
1750
1765
  { body: input, auth: false }
1751
1766
  );
1752
1767
  }
1768
+ /**
1769
+ * Upload one file for a `file` field, straight from the browser to storage
1770
+ * (it never passes through the API, so large files are fine: up to
1771
+ * `field.maxSizeMb`, at most 500 MB). Three steps in one call: a presigned
1772
+ * PUT URL for this exact size, the PUT itself, and a confirm where the API
1773
+ * checks the real size and the type from the file content (images, PDF,
1774
+ * Office; never SVG or HTML). Send the returned `id` in `data[fieldKey]`.
1775
+ * Errors: `be.forms.fileTypeNotAllowed`, `be.forms.fileTooLarge`
1776
+ * (params.maxMb), `be.forms.fileRateLimited`, `be.forms.fileUploadIncomplete`.
1777
+ */
1778
+ async uploadFile(slug, fieldKey, file, fileName) {
1779
+ const name = _nullishCoalesce(_nullishCoalesce(fileName, () => ( file.name)), () => ( "file"));
1780
+ const contentType = file.type || "application/octet-stream";
1781
+ const start = await this.client.request(
1782
+ "POST",
1783
+ `/forms/${encodeURIComponent(slug)}/files/upload-url`,
1784
+ { body: { field: fieldKey, fileName: name, contentType, size: file.size }, auth: false }
1785
+ );
1786
+ if (start.error) return { data: null, error: start.error };
1787
+ const put = await this.client.putToPresignedUrl(start.data.uploadUrl, file, start.data.contentType);
1788
+ if (put.error) return { data: null, error: put.error };
1789
+ return this.client.request(
1790
+ "POST",
1791
+ `/forms/${encodeURIComponent(slug)}/files/${encodeURIComponent(start.data.id)}/confirm`,
1792
+ { auth: false }
1793
+ );
1794
+ }
1753
1795
  };
1754
1796
  var WishlistModule = class {
1755
1797
  constructor(client) {
@@ -2068,7 +2068,9 @@ type SiteFormFieldType = "text" | "email" | "phone" | "textarea" | "number" | "s
2068
2068
  /** "YYYY-MM-DDTHH:MM" without a zone, as `<input type="datetime-local">` */
2069
2069
  | "datetime"
2070
2070
  /** http(s) address */
2071
- | "url" | "hidden";
2071
+ | "url" | "hidden"
2072
+ /** Attachments: upload with `forms.uploadFile`, submit the returned ids as an array. */
2073
+ | "file";
2072
2074
  interface SiteFormFieldOption {
2073
2075
  value: string;
2074
2076
  label: string;
@@ -2094,6 +2096,16 @@ interface SiteFormField {
2094
2096
  width?: "full" | "half";
2095
2097
  /** Value of hidden fields (source, campaign) or a prefill for visible ones. */
2096
2098
  defaultValue?: string;
2099
+ /** Merchant's own message shown when the field fails validation. */
2100
+ errorMessage?: string;
2101
+ /** Date / datetime: "future" = today or later, "past" = today or earlier. */
2102
+ dateRule?: "any" | "future" | "past";
2103
+ /** File: allowed kinds (images, documents = PDF and Office, any = both). */
2104
+ accept?: "images" | "documents" | "any";
2105
+ /** File: most files (1 to 5, default 1). Multiselect uses `min`/`max` as choice counts. */
2106
+ maxFiles?: number;
2107
+ /** File: largest single file in MB (1 to 500, default 10). */
2108
+ maxSizeMb?: number;
2097
2109
  }
2098
2110
  interface StorefrontFormSettings {
2099
2111
  submitLabel?: string;
@@ -2127,6 +2139,27 @@ interface StorefrontFormSubmitInput {
2127
2139
  * untouched: a filled value is answered like a success but stored nowhere.
2128
2140
  */
2129
2141
  website?: string;
2142
+ /**
2143
+ * Milliseconds between rendering the form and submitting it. Under 1.5 s is
2144
+ * treated as a bot (answered like a success, stored nowhere). Optional.
2145
+ */
2146
+ elapsedMs?: number;
2147
+ }
2148
+ /** Presigned upload of one form file (`POST /forms/{slug}/files/upload-url`). */
2149
+ interface StorefrontFormUpload {
2150
+ id: string;
2151
+ /** Presigned PUT straight to storage, valid 30 minutes, exact size only. */
2152
+ uploadUrl: string;
2153
+ /** Send this as the PUT's Content-Type. */
2154
+ contentType: string;
2155
+ }
2156
+ /** An uploaded file for a `file` field (`forms.uploadFile`). */
2157
+ interface StorefrontFormFile {
2158
+ /** Send this in `data[fieldKey]` on submit. */
2159
+ id: string;
2160
+ name: string;
2161
+ size: number;
2162
+ type: string;
2130
2163
  }
2131
2164
  interface StorefrontFormSubmitResult {
2132
2165
  ok: boolean;
@@ -2137,7 +2170,7 @@ interface StorefrontFormSubmitResult {
2137
2170
  /** `settings.redirectUrl`, when set. */
2138
2171
  redirectUrl: string | null;
2139
2172
  }
2140
- type StorefrontFormFieldErrorCode = "required" | "invalid" | "tooShort" | "tooLong" | "min" | "max" | "notOption" | "pattern";
2173
+ type StorefrontFormFieldErrorCode = "required" | "invalid" | "tooShort" | "tooLong" | "min" | "max" | "notOption" | "pattern" | "dateNotFuture" | "dateNotPast" | "tooManyFiles";
2141
2174
  /** One per-field validation error of a rejected submit (`be.forms.validationFailed`). */
2142
2175
  interface StorefrontFormFieldError {
2143
2176
  key: string;
@@ -3044,6 +3077,13 @@ declare class BehioStorefront {
3044
3077
  * @internal — use the typed module methods (behio.certificates.downloadPdf).
3045
3078
  */
3046
3079
  requestBlob(path: string): Promise<SdkResult<Blob>>;
3080
+ /**
3081
+ * PUT of a file body to a presigned storage URL (form attachments). No API
3082
+ * key and no JSON: the URL itself carries the permission and the exact size.
3083
+ *
3084
+ * @internal — use behio.forms.uploadFile.
3085
+ */
3086
+ putToPresignedUrl(url: string, body: Blob, contentType: string): Promise<SdkResult<true>>;
3047
3087
  /**
3048
3088
  * Throws on failure (API error / network / timeout). Kept private so
3049
3089
  * internal auth refresh recursion keeps its existing control flow —
@@ -3560,6 +3600,17 @@ declare class FormsModule {
3560
3600
  * `be.forms.formNotFound`; rate limit 10 submits per minute per visitor.
3561
3601
  */
3562
3602
  submit(slug: string, input: StorefrontFormSubmitInput): Promise<SdkResult<StorefrontFormSubmitResult>>;
3603
+ /**
3604
+ * Upload one file for a `file` field, straight from the browser to storage
3605
+ * (it never passes through the API, so large files are fine: up to
3606
+ * `field.maxSizeMb`, at most 500 MB). Three steps in one call: a presigned
3607
+ * PUT URL for this exact size, the PUT itself, and a confirm where the API
3608
+ * checks the real size and the type from the file content (images, PDF,
3609
+ * Office; never SVG or HTML). Send the returned `id` in `data[fieldKey]`.
3610
+ * Errors: `be.forms.fileTypeNotAllowed`, `be.forms.fileTooLarge`
3611
+ * (params.maxMb), `be.forms.fileRateLimited`, `be.forms.fileUploadIncomplete`.
3612
+ */
3613
+ uploadFile(slug: string, fieldKey: string, file: Blob, fileName?: string): Promise<SdkResult<StorefrontFormFile>>;
3563
3614
  }
3564
3615
  declare class WishlistModule {
3565
3616
  private client;
@@ -3740,4 +3791,4 @@ declare class NewsletterModule {
3740
3791
  unsubscribe(email: string): Promise<SdkResult<NewsletterUnsubscribeResult>>;
3741
3792
  }
3742
3793
 
3743
- export { type CourseDetail as $, type ActivePromotion as A, BehioStorefront as B, type CookieConsent as C, type Cart as D, type CartBundleLine as E, type CartBundleLineItem as F, type CartDiscount as G, type CartItem as H, type CartItemProduct as I, type CartPromotion as J, type Category as K, type CategoryDetail as L, type CertificateVerification as M, type CheckoutAddress as N, type CheckoutInput as O, type ProductDetail as P, type CheckoutPaymentMethod as Q, type CheckoutPreview as R, type SdkResult as S, type CheckoutResult as T, type CheckoutSettings as U, type CookieConsentInput as V, type CourseAttachment as W, type CourseCertificate as X, type CourseComment as Y, type CourseCommentReply as Z, type CourseCommentsList as _, type ProductVariant as a, PaymentStatuses as a$, type CourseLesson as a0, type CourseListItem as a1, type CourseModule as a2, type CoursePostedComment as a3, type CourseProgress as a4, type CourseTutorMessage as a5, type CourseTutorThread as a6, type CrossSellItem as a7, type CurrencyDisplayFormat as a8, type CustomerAddress as a9, type LoyaltyTier as aA, type LoyaltyTierPerks as aB, type LoyaltyTransaction as aC, type Menu as aD, type MenuItem as aE, type MenuItemRef as aF, type MenuItemType as aG, type MessageResponse as aH, type NewsletterOptInDefault as aI, type NewsletterSubscribeInput as aJ, type NewsletterSubscribeResult as aK, type NewsletterUnsubscribeResult as aL, type OrderAccessRequestResponse as aM, type OrderAccessVerifyResponse as aN, type OrderDetail as aO, type OrderItem as aP, type OrderListItem as aQ, type OrderStatus as aR, type OrderStatusHistory as aS, OrderStatuses as aT, type OrderTracking as aU, type Page as aV, type PageAttachment as aW, type PageDetail as aX, type PaginatedResponse as aY, type PaymentInstrument as aZ, type PaymentStatus as a_, type CustomerProfile as aa, type DigitalDownload as ab, type DownloadUrl as ac, type Facet as ad, type FacetAvailability as ae, type FacetCategory as af, type FacetLabel as ag, type FacetPriceRange as ah, type FacetRange as ai, type FacetRatingBucket as aj, type FacetValue as ak, type FacetsResponse as al, type FilterField as am, type FulfillmentStatus as an, FulfillmentStatuses as ao, type GiftCardBalance as ap, type GiftCardPurchaseInput as aq, type GiftCardPurchaseResult as ar, type GiftCardSummary as as, type LessonNote as at, type LessonQuiz as au, type LoginInput as av, type LoyaltyBalance as aw, type LoyaltyNextTier as ax, type LoyaltyProgram as ay, type LoyaltySummary as az, type StorefrontFormFieldError as b, type StorefrontForm as b$, type PaymentSwift as b0, type PickupPoint as b1, type PickupPointHours as b2, type PickupPointsInput as b3, type PickupWidgetConfig as b4, type PriceDisplay as b5, type ProductAssetGroup as b6, type ProductAssetItem as b7, type ProductAvailability as b8, type ProductGroup as b9, type ResponseInterceptor as bA, type ResponseInterceptorData as bB, type ReturnRequest as bC, type ReturnRequestItem as bD, type ReturnStatus as bE, type ReturnStatusItem as bF, type ReturnableOrder as bG, type ReturnableOrderItem as bH, type SdkError as bI, type ShippingMethodSummary as bJ, type ShippingQuote as bK, type ShippingQuoteInput as bL, type ShopAppearance as bM, type ShopInfo as bN, type ShopScript as bO, type ShopScriptPlacement as bP, type ShopScriptType as bQ, type ShopScripts as bR, type ShopSeo as bS, type ShopSeoIdentity as bT, type SiteFormField as bU, type SiteFormFieldOption as bV, type SiteFormFieldType as bW, type Sitemap as bX, type SitemapEntry as bY, type StockBehavior as bZ, type StockMode as b_, type ProductLabel as ba, type ProductListItem as bb, type ProductMedia as bc, type ProductMediaVariant as bd, type ProductParameter as be, type ProductParameterGroup as bf, type ProductParametersResponse as bg, type ProductPrice as bh, type ProductPromotionSummary as bi, type ProductReview as bj, type ProductReviewsResponse as bk, type ProductSibling as bl, ProductSort as bm, type ProductSortValue as bn, type ProductVolumePrice as bo, type ProductsQuery as bp, type QuizAnswerInput as bq, type QuizAnswerResult as br, type QuizQuestion as bs, type QuizResult as bt, type QuoteItem as bu, type QuoteRequest as bv, type RegisterInput as bw, type RegisterResult as bx, type RequestInterceptor as by, type RequestInterceptorConfig as bz, type AddToCartInput as c, type StorefrontFormFieldErrorCode as c0, type StorefrontFormSettings as c1, type StorefrontFormSubmitInput as c2, type StorefrontFormSubmitResult as c3, type SubmitQuoteInput as c4, type SubmitReturnInput as c5, type SubmitReviewInput as c6, type Subscription as c7, type SubscriptionAction as c8, type SubscriptionFrequency as c9, type SubscriptionItem as ca, type SubscriptionStatus as cb, type TaxBreakdownLine as cc, type VariantAxis as cd, type VariantAxisValue as ce, type WishlistItem as cf, err as cg, ok as ch, toSdkError as ci, type AddressDetail as d, type AddressSuggestion as e, type AddressType as f, AddressTypes as g, type AuthTokens as h, type BackInStockSubscription as i, type BadgeTone as j, BehioApiError as k, type BehioErrorCode as l, type BehioEventHandler as m, type BehioEventType as n, BehioNetworkError as o, type BehioStorefrontConfig as p, type Blog as q, type BlogPostDetail as r, type BlogPostListItem as s, type BlogPostsPage as t, type BlogPostsQuery as u, type BlogSettings as v, type BlogTag as w, type Bundle as x, type BundleCatalogQuery as y, type BundleItem as z };
3794
+ export { type CourseDetail as $, type ActivePromotion as A, BehioStorefront as B, type CookieConsent as C, type Cart as D, type CartBundleLine as E, type CartBundleLineItem as F, type CartDiscount as G, type CartItem as H, type CartItemProduct as I, type CartPromotion as J, type Category as K, type CategoryDetail as L, type CertificateVerification as M, type CheckoutAddress as N, type CheckoutInput as O, type ProductDetail as P, type CheckoutPaymentMethod as Q, type CheckoutPreview as R, type SdkResult as S, type CheckoutResult as T, type CheckoutSettings as U, type CookieConsentInput as V, type CourseAttachment as W, type CourseCertificate as X, type CourseComment as Y, type CourseCommentReply as Z, type CourseCommentsList as _, type ProductVariant as a, PaymentStatuses as a$, type CourseLesson as a0, type CourseListItem as a1, type CourseModule as a2, type CoursePostedComment as a3, type CourseProgress as a4, type CourseTutorMessage as a5, type CourseTutorThread as a6, type CrossSellItem as a7, type CurrencyDisplayFormat as a8, type CustomerAddress as a9, type LoyaltyTier as aA, type LoyaltyTierPerks as aB, type LoyaltyTransaction as aC, type Menu as aD, type MenuItem as aE, type MenuItemRef as aF, type MenuItemType as aG, type MessageResponse as aH, type NewsletterOptInDefault as aI, type NewsletterSubscribeInput as aJ, type NewsletterSubscribeResult as aK, type NewsletterUnsubscribeResult as aL, type OrderAccessRequestResponse as aM, type OrderAccessVerifyResponse as aN, type OrderDetail as aO, type OrderItem as aP, type OrderListItem as aQ, type OrderStatus as aR, type OrderStatusHistory as aS, OrderStatuses as aT, type OrderTracking as aU, type Page as aV, type PageAttachment as aW, type PageDetail as aX, type PaginatedResponse as aY, type PaymentInstrument as aZ, type PaymentStatus as a_, type CustomerProfile as aa, type DigitalDownload as ab, type DownloadUrl as ac, type Facet as ad, type FacetAvailability as ae, type FacetCategory as af, type FacetLabel as ag, type FacetPriceRange as ah, type FacetRange as ai, type FacetRatingBucket as aj, type FacetValue as ak, type FacetsResponse as al, type FilterField as am, type FulfillmentStatus as an, FulfillmentStatuses as ao, type GiftCardBalance as ap, type GiftCardPurchaseInput as aq, type GiftCardPurchaseResult as ar, type GiftCardSummary as as, type LessonNote as at, type LessonQuiz as au, type LoginInput as av, type LoyaltyBalance as aw, type LoyaltyNextTier as ax, type LoyaltyProgram as ay, type LoyaltySummary as az, type StorefrontFormFieldError as b, type StorefrontForm as b$, type PaymentSwift as b0, type PickupPoint as b1, type PickupPointHours as b2, type PickupPointsInput as b3, type PickupWidgetConfig as b4, type PriceDisplay as b5, type ProductAssetGroup as b6, type ProductAssetItem as b7, type ProductAvailability as b8, type ProductGroup as b9, type ResponseInterceptor as bA, type ResponseInterceptorData as bB, type ReturnRequest as bC, type ReturnRequestItem as bD, type ReturnStatus as bE, type ReturnStatusItem as bF, type ReturnableOrder as bG, type ReturnableOrderItem as bH, type SdkError as bI, type ShippingMethodSummary as bJ, type ShippingQuote as bK, type ShippingQuoteInput as bL, type ShopAppearance as bM, type ShopInfo as bN, type ShopScript as bO, type ShopScriptPlacement as bP, type ShopScriptType as bQ, type ShopScripts as bR, type ShopSeo as bS, type ShopSeoIdentity as bT, type SiteFormField as bU, type SiteFormFieldOption as bV, type SiteFormFieldType as bW, type Sitemap as bX, type SitemapEntry as bY, type StockBehavior as bZ, type StockMode as b_, type ProductLabel as ba, type ProductListItem as bb, type ProductMedia as bc, type ProductMediaVariant as bd, type ProductParameter as be, type ProductParameterGroup as bf, type ProductParametersResponse as bg, type ProductPrice as bh, type ProductPromotionSummary as bi, type ProductReview as bj, type ProductReviewsResponse as bk, type ProductSibling as bl, ProductSort as bm, type ProductSortValue as bn, type ProductVolumePrice as bo, type ProductsQuery as bp, type QuizAnswerInput as bq, type QuizAnswerResult as br, type QuizQuestion as bs, type QuizResult as bt, type QuoteItem as bu, type QuoteRequest as bv, type RegisterInput as bw, type RegisterResult as bx, type RequestInterceptor as by, type RequestInterceptorConfig as bz, type AddToCartInput as c, type StorefrontFormFieldErrorCode as c0, type StorefrontFormFile as c1, type StorefrontFormSettings as c2, type StorefrontFormSubmitInput as c3, type StorefrontFormSubmitResult as c4, type StorefrontFormUpload as c5, type SubmitQuoteInput as c6, type SubmitReturnInput as c7, type SubmitReviewInput as c8, type Subscription as c9, type SubscriptionAction as ca, type SubscriptionFrequency as cb, type SubscriptionItem as cc, type SubscriptionStatus as cd, type TaxBreakdownLine as ce, type VariantAxis as cf, type VariantAxisValue as cg, type WishlistItem as ch, err as ci, ok as cj, toSdkError as ck, type AddressDetail as d, type AddressSuggestion as e, type AddressType as f, AddressTypes as g, type AuthTokens as h, type BackInStockSubscription as i, type BadgeTone as j, BehioApiError as k, type BehioErrorCode as l, type BehioEventHandler as m, type BehioEventType as n, BehioNetworkError as o, type BehioStorefrontConfig as p, type Blog as q, type BlogPostDetail as r, type BlogPostListItem as s, type BlogPostsPage as t, type BlogPostsQuery as u, type BlogSettings as v, type BlogTag as w, type Bundle as x, type BundleCatalogQuery as y, type BundleItem as z };
@@ -2068,7 +2068,9 @@ type SiteFormFieldType = "text" | "email" | "phone" | "textarea" | "number" | "s
2068
2068
  /** "YYYY-MM-DDTHH:MM" without a zone, as `<input type="datetime-local">` */
2069
2069
  | "datetime"
2070
2070
  /** http(s) address */
2071
- | "url" | "hidden";
2071
+ | "url" | "hidden"
2072
+ /** Attachments: upload with `forms.uploadFile`, submit the returned ids as an array. */
2073
+ | "file";
2072
2074
  interface SiteFormFieldOption {
2073
2075
  value: string;
2074
2076
  label: string;
@@ -2094,6 +2096,16 @@ interface SiteFormField {
2094
2096
  width?: "full" | "half";
2095
2097
  /** Value of hidden fields (source, campaign) or a prefill for visible ones. */
2096
2098
  defaultValue?: string;
2099
+ /** Merchant's own message shown when the field fails validation. */
2100
+ errorMessage?: string;
2101
+ /** Date / datetime: "future" = today or later, "past" = today or earlier. */
2102
+ dateRule?: "any" | "future" | "past";
2103
+ /** File: allowed kinds (images, documents = PDF and Office, any = both). */
2104
+ accept?: "images" | "documents" | "any";
2105
+ /** File: most files (1 to 5, default 1). Multiselect uses `min`/`max` as choice counts. */
2106
+ maxFiles?: number;
2107
+ /** File: largest single file in MB (1 to 500, default 10). */
2108
+ maxSizeMb?: number;
2097
2109
  }
2098
2110
  interface StorefrontFormSettings {
2099
2111
  submitLabel?: string;
@@ -2127,6 +2139,27 @@ interface StorefrontFormSubmitInput {
2127
2139
  * untouched: a filled value is answered like a success but stored nowhere.
2128
2140
  */
2129
2141
  website?: string;
2142
+ /**
2143
+ * Milliseconds between rendering the form and submitting it. Under 1.5 s is
2144
+ * treated as a bot (answered like a success, stored nowhere). Optional.
2145
+ */
2146
+ elapsedMs?: number;
2147
+ }
2148
+ /** Presigned upload of one form file (`POST /forms/{slug}/files/upload-url`). */
2149
+ interface StorefrontFormUpload {
2150
+ id: string;
2151
+ /** Presigned PUT straight to storage, valid 30 minutes, exact size only. */
2152
+ uploadUrl: string;
2153
+ /** Send this as the PUT's Content-Type. */
2154
+ contentType: string;
2155
+ }
2156
+ /** An uploaded file for a `file` field (`forms.uploadFile`). */
2157
+ interface StorefrontFormFile {
2158
+ /** Send this in `data[fieldKey]` on submit. */
2159
+ id: string;
2160
+ name: string;
2161
+ size: number;
2162
+ type: string;
2130
2163
  }
2131
2164
  interface StorefrontFormSubmitResult {
2132
2165
  ok: boolean;
@@ -2137,7 +2170,7 @@ interface StorefrontFormSubmitResult {
2137
2170
  /** `settings.redirectUrl`, when set. */
2138
2171
  redirectUrl: string | null;
2139
2172
  }
2140
- type StorefrontFormFieldErrorCode = "required" | "invalid" | "tooShort" | "tooLong" | "min" | "max" | "notOption" | "pattern";
2173
+ type StorefrontFormFieldErrorCode = "required" | "invalid" | "tooShort" | "tooLong" | "min" | "max" | "notOption" | "pattern" | "dateNotFuture" | "dateNotPast" | "tooManyFiles";
2141
2174
  /** One per-field validation error of a rejected submit (`be.forms.validationFailed`). */
2142
2175
  interface StorefrontFormFieldError {
2143
2176
  key: string;
@@ -3044,6 +3077,13 @@ declare class BehioStorefront {
3044
3077
  * @internal — use the typed module methods (behio.certificates.downloadPdf).
3045
3078
  */
3046
3079
  requestBlob(path: string): Promise<SdkResult<Blob>>;
3080
+ /**
3081
+ * PUT of a file body to a presigned storage URL (form attachments). No API
3082
+ * key and no JSON: the URL itself carries the permission and the exact size.
3083
+ *
3084
+ * @internal — use behio.forms.uploadFile.
3085
+ */
3086
+ putToPresignedUrl(url: string, body: Blob, contentType: string): Promise<SdkResult<true>>;
3047
3087
  /**
3048
3088
  * Throws on failure (API error / network / timeout). Kept private so
3049
3089
  * internal auth refresh recursion keeps its existing control flow —
@@ -3560,6 +3600,17 @@ declare class FormsModule {
3560
3600
  * `be.forms.formNotFound`; rate limit 10 submits per minute per visitor.
3561
3601
  */
3562
3602
  submit(slug: string, input: StorefrontFormSubmitInput): Promise<SdkResult<StorefrontFormSubmitResult>>;
3603
+ /**
3604
+ * Upload one file for a `file` field, straight from the browser to storage
3605
+ * (it never passes through the API, so large files are fine: up to
3606
+ * `field.maxSizeMb`, at most 500 MB). Three steps in one call: a presigned
3607
+ * PUT URL for this exact size, the PUT itself, and a confirm where the API
3608
+ * checks the real size and the type from the file content (images, PDF,
3609
+ * Office; never SVG or HTML). Send the returned `id` in `data[fieldKey]`.
3610
+ * Errors: `be.forms.fileTypeNotAllowed`, `be.forms.fileTooLarge`
3611
+ * (params.maxMb), `be.forms.fileRateLimited`, `be.forms.fileUploadIncomplete`.
3612
+ */
3613
+ uploadFile(slug: string, fieldKey: string, file: Blob, fileName?: string): Promise<SdkResult<StorefrontFormFile>>;
3563
3614
  }
3564
3615
  declare class WishlistModule {
3565
3616
  private client;
@@ -3740,4 +3791,4 @@ declare class NewsletterModule {
3740
3791
  unsubscribe(email: string): Promise<SdkResult<NewsletterUnsubscribeResult>>;
3741
3792
  }
3742
3793
 
3743
- export { type CourseDetail as $, type ActivePromotion as A, BehioStorefront as B, type CookieConsent as C, type Cart as D, type CartBundleLine as E, type CartBundleLineItem as F, type CartDiscount as G, type CartItem as H, type CartItemProduct as I, type CartPromotion as J, type Category as K, type CategoryDetail as L, type CertificateVerification as M, type CheckoutAddress as N, type CheckoutInput as O, type ProductDetail as P, type CheckoutPaymentMethod as Q, type CheckoutPreview as R, type SdkResult as S, type CheckoutResult as T, type CheckoutSettings as U, type CookieConsentInput as V, type CourseAttachment as W, type CourseCertificate as X, type CourseComment as Y, type CourseCommentReply as Z, type CourseCommentsList as _, type ProductVariant as a, PaymentStatuses as a$, type CourseLesson as a0, type CourseListItem as a1, type CourseModule as a2, type CoursePostedComment as a3, type CourseProgress as a4, type CourseTutorMessage as a5, type CourseTutorThread as a6, type CrossSellItem as a7, type CurrencyDisplayFormat as a8, type CustomerAddress as a9, type LoyaltyTier as aA, type LoyaltyTierPerks as aB, type LoyaltyTransaction as aC, type Menu as aD, type MenuItem as aE, type MenuItemRef as aF, type MenuItemType as aG, type MessageResponse as aH, type NewsletterOptInDefault as aI, type NewsletterSubscribeInput as aJ, type NewsletterSubscribeResult as aK, type NewsletterUnsubscribeResult as aL, type OrderAccessRequestResponse as aM, type OrderAccessVerifyResponse as aN, type OrderDetail as aO, type OrderItem as aP, type OrderListItem as aQ, type OrderStatus as aR, type OrderStatusHistory as aS, OrderStatuses as aT, type OrderTracking as aU, type Page as aV, type PageAttachment as aW, type PageDetail as aX, type PaginatedResponse as aY, type PaymentInstrument as aZ, type PaymentStatus as a_, type CustomerProfile as aa, type DigitalDownload as ab, type DownloadUrl as ac, type Facet as ad, type FacetAvailability as ae, type FacetCategory as af, type FacetLabel as ag, type FacetPriceRange as ah, type FacetRange as ai, type FacetRatingBucket as aj, type FacetValue as ak, type FacetsResponse as al, type FilterField as am, type FulfillmentStatus as an, FulfillmentStatuses as ao, type GiftCardBalance as ap, type GiftCardPurchaseInput as aq, type GiftCardPurchaseResult as ar, type GiftCardSummary as as, type LessonNote as at, type LessonQuiz as au, type LoginInput as av, type LoyaltyBalance as aw, type LoyaltyNextTier as ax, type LoyaltyProgram as ay, type LoyaltySummary as az, type StorefrontFormFieldError as b, type StorefrontForm as b$, type PaymentSwift as b0, type PickupPoint as b1, type PickupPointHours as b2, type PickupPointsInput as b3, type PickupWidgetConfig as b4, type PriceDisplay as b5, type ProductAssetGroup as b6, type ProductAssetItem as b7, type ProductAvailability as b8, type ProductGroup as b9, type ResponseInterceptor as bA, type ResponseInterceptorData as bB, type ReturnRequest as bC, type ReturnRequestItem as bD, type ReturnStatus as bE, type ReturnStatusItem as bF, type ReturnableOrder as bG, type ReturnableOrderItem as bH, type SdkError as bI, type ShippingMethodSummary as bJ, type ShippingQuote as bK, type ShippingQuoteInput as bL, type ShopAppearance as bM, type ShopInfo as bN, type ShopScript as bO, type ShopScriptPlacement as bP, type ShopScriptType as bQ, type ShopScripts as bR, type ShopSeo as bS, type ShopSeoIdentity as bT, type SiteFormField as bU, type SiteFormFieldOption as bV, type SiteFormFieldType as bW, type Sitemap as bX, type SitemapEntry as bY, type StockBehavior as bZ, type StockMode as b_, type ProductLabel as ba, type ProductListItem as bb, type ProductMedia as bc, type ProductMediaVariant as bd, type ProductParameter as be, type ProductParameterGroup as bf, type ProductParametersResponse as bg, type ProductPrice as bh, type ProductPromotionSummary as bi, type ProductReview as bj, type ProductReviewsResponse as bk, type ProductSibling as bl, ProductSort as bm, type ProductSortValue as bn, type ProductVolumePrice as bo, type ProductsQuery as bp, type QuizAnswerInput as bq, type QuizAnswerResult as br, type QuizQuestion as bs, type QuizResult as bt, type QuoteItem as bu, type QuoteRequest as bv, type RegisterInput as bw, type RegisterResult as bx, type RequestInterceptor as by, type RequestInterceptorConfig as bz, type AddToCartInput as c, type StorefrontFormFieldErrorCode as c0, type StorefrontFormSettings as c1, type StorefrontFormSubmitInput as c2, type StorefrontFormSubmitResult as c3, type SubmitQuoteInput as c4, type SubmitReturnInput as c5, type SubmitReviewInput as c6, type Subscription as c7, type SubscriptionAction as c8, type SubscriptionFrequency as c9, type SubscriptionItem as ca, type SubscriptionStatus as cb, type TaxBreakdownLine as cc, type VariantAxis as cd, type VariantAxisValue as ce, type WishlistItem as cf, err as cg, ok as ch, toSdkError as ci, type AddressDetail as d, type AddressSuggestion as e, type AddressType as f, AddressTypes as g, type AuthTokens as h, type BackInStockSubscription as i, type BadgeTone as j, BehioApiError as k, type BehioErrorCode as l, type BehioEventHandler as m, type BehioEventType as n, BehioNetworkError as o, type BehioStorefrontConfig as p, type Blog as q, type BlogPostDetail as r, type BlogPostListItem as s, type BlogPostsPage as t, type BlogPostsQuery as u, type BlogSettings as v, type BlogTag as w, type Bundle as x, type BundleCatalogQuery as y, type BundleItem as z };
3794
+ export { type CourseDetail as $, type ActivePromotion as A, BehioStorefront as B, type CookieConsent as C, type Cart as D, type CartBundleLine as E, type CartBundleLineItem as F, type CartDiscount as G, type CartItem as H, type CartItemProduct as I, type CartPromotion as J, type Category as K, type CategoryDetail as L, type CertificateVerification as M, type CheckoutAddress as N, type CheckoutInput as O, type ProductDetail as P, type CheckoutPaymentMethod as Q, type CheckoutPreview as R, type SdkResult as S, type CheckoutResult as T, type CheckoutSettings as U, type CookieConsentInput as V, type CourseAttachment as W, type CourseCertificate as X, type CourseComment as Y, type CourseCommentReply as Z, type CourseCommentsList as _, type ProductVariant as a, PaymentStatuses as a$, type CourseLesson as a0, type CourseListItem as a1, type CourseModule as a2, type CoursePostedComment as a3, type CourseProgress as a4, type CourseTutorMessage as a5, type CourseTutorThread as a6, type CrossSellItem as a7, type CurrencyDisplayFormat as a8, type CustomerAddress as a9, type LoyaltyTier as aA, type LoyaltyTierPerks as aB, type LoyaltyTransaction as aC, type Menu as aD, type MenuItem as aE, type MenuItemRef as aF, type MenuItemType as aG, type MessageResponse as aH, type NewsletterOptInDefault as aI, type NewsletterSubscribeInput as aJ, type NewsletterSubscribeResult as aK, type NewsletterUnsubscribeResult as aL, type OrderAccessRequestResponse as aM, type OrderAccessVerifyResponse as aN, type OrderDetail as aO, type OrderItem as aP, type OrderListItem as aQ, type OrderStatus as aR, type OrderStatusHistory as aS, OrderStatuses as aT, type OrderTracking as aU, type Page as aV, type PageAttachment as aW, type PageDetail as aX, type PaginatedResponse as aY, type PaymentInstrument as aZ, type PaymentStatus as a_, type CustomerProfile as aa, type DigitalDownload as ab, type DownloadUrl as ac, type Facet as ad, type FacetAvailability as ae, type FacetCategory as af, type FacetLabel as ag, type FacetPriceRange as ah, type FacetRange as ai, type FacetRatingBucket as aj, type FacetValue as ak, type FacetsResponse as al, type FilterField as am, type FulfillmentStatus as an, FulfillmentStatuses as ao, type GiftCardBalance as ap, type GiftCardPurchaseInput as aq, type GiftCardPurchaseResult as ar, type GiftCardSummary as as, type LessonNote as at, type LessonQuiz as au, type LoginInput as av, type LoyaltyBalance as aw, type LoyaltyNextTier as ax, type LoyaltyProgram as ay, type LoyaltySummary as az, type StorefrontFormFieldError as b, type StorefrontForm as b$, type PaymentSwift as b0, type PickupPoint as b1, type PickupPointHours as b2, type PickupPointsInput as b3, type PickupWidgetConfig as b4, type PriceDisplay as b5, type ProductAssetGroup as b6, type ProductAssetItem as b7, type ProductAvailability as b8, type ProductGroup as b9, type ResponseInterceptor as bA, type ResponseInterceptorData as bB, type ReturnRequest as bC, type ReturnRequestItem as bD, type ReturnStatus as bE, type ReturnStatusItem as bF, type ReturnableOrder as bG, type ReturnableOrderItem as bH, type SdkError as bI, type ShippingMethodSummary as bJ, type ShippingQuote as bK, type ShippingQuoteInput as bL, type ShopAppearance as bM, type ShopInfo as bN, type ShopScript as bO, type ShopScriptPlacement as bP, type ShopScriptType as bQ, type ShopScripts as bR, type ShopSeo as bS, type ShopSeoIdentity as bT, type SiteFormField as bU, type SiteFormFieldOption as bV, type SiteFormFieldType as bW, type Sitemap as bX, type SitemapEntry as bY, type StockBehavior as bZ, type StockMode as b_, type ProductLabel as ba, type ProductListItem as bb, type ProductMedia as bc, type ProductMediaVariant as bd, type ProductParameter as be, type ProductParameterGroup as bf, type ProductParametersResponse as bg, type ProductPrice as bh, type ProductPromotionSummary as bi, type ProductReview as bj, type ProductReviewsResponse as bk, type ProductSibling as bl, ProductSort as bm, type ProductSortValue as bn, type ProductVolumePrice as bo, type ProductsQuery as bp, type QuizAnswerInput as bq, type QuizAnswerResult as br, type QuizQuestion as bs, type QuizResult as bt, type QuoteItem as bu, type QuoteRequest as bv, type RegisterInput as bw, type RegisterResult as bx, type RequestInterceptor as by, type RequestInterceptorConfig as bz, type AddToCartInput as c, type StorefrontFormFieldErrorCode as c0, type StorefrontFormFile as c1, type StorefrontFormSettings as c2, type StorefrontFormSubmitInput as c3, type StorefrontFormSubmitResult as c4, type StorefrontFormUpload as c5, type SubmitQuoteInput as c6, type SubmitReturnInput as c7, type SubmitReviewInput as c8, type Subscription as c9, type SubscriptionAction as ca, type SubscriptionFrequency as cb, type SubscriptionItem as cc, type SubscriptionStatus as cd, type TaxBreakdownLine as ce, type VariantAxis as cf, type VariantAxisValue as cg, type WishlistItem as ch, err as ci, ok as cj, toSdkError as ck, type AddressDetail as d, type AddressSuggestion as e, type AddressType as f, AddressTypes as g, type AuthTokens as h, type BackInStockSubscription as i, type BadgeTone as j, BehioApiError as k, type BehioErrorCode as l, type BehioEventHandler as m, type BehioEventType as n, BehioNetworkError as o, type BehioStorefrontConfig as p, type Blog as q, type BlogPostDetail as r, type BlogPostListItem as s, type BlogPostsPage as t, type BlogPostsQuery as u, type BlogSettings as v, type BlogTag as w, type Bundle as x, type BundleCatalogQuery as y, type BundleItem as z };
package/dist/index.d.mts CHANGED
@@ -1,5 +1,5 @@
1
- import { P as ProductDetail, a as ProductVariant, B as BehioStorefront, S as SdkResult, C as CookieConsent, b as StorefrontFormFieldError } from './client-Gf4MBpav.mjs';
2
- export { A as ActivePromotion, c as AddToCartInput, d as AddressDetail, e as AddressSuggestion, f as AddressType, g as AddressTypes, h as AuthTokens, i as BackInStockSubscription, j as BadgeTone, k as BehioApiError, l as BehioErrorCode, m as BehioEventHandler, n as BehioEventType, o as BehioNetworkError, p as BehioStorefrontConfig, q as Blog, r as BlogPostDetail, s as BlogPostListItem, t as BlogPostsPage, u as BlogPostsQuery, v as BlogSettings, w as BlogTag, x as Bundle, y as BundleCatalogQuery, z as BundleItem, D as Cart, E as CartBundleLine, F as CartBundleLineItem, G as CartDiscount, H as CartItem, I as CartItemProduct, J as CartPromotion, K as Category, L as CategoryDetail, M as CertificateVerification, N as CheckoutAddress, O as CheckoutInput, Q as CheckoutPaymentMethod, R as CheckoutPreview, T as CheckoutResult, U as CheckoutSettings, V as CookieConsentInput, W as CourseAttachment, X as CourseCertificate, Y as CourseComment, Z as CourseCommentReply, _ as CourseCommentsList, $ as CourseDetail, a0 as CourseLesson, a1 as CourseListItem, a2 as CourseModule, a3 as CoursePostedComment, a4 as CourseProgress, a5 as CourseTutorMessage, a6 as CourseTutorThread, a7 as CrossSellItem, a8 as CurrencyDisplayFormat, a9 as CustomerAddress, aa as CustomerProfile, ab as DigitalDownload, ac as DownloadUrl, ad as Facet, ae as FacetAvailability, af as FacetCategory, ag as FacetLabel, ah as FacetPriceRange, ai as FacetRange, aj as FacetRatingBucket, ak as FacetValue, al as FacetsResponse, am as FilterField, an as FulfillmentStatus, ao as FulfillmentStatuses, ap as GiftCardBalance, aq as GiftCardPurchaseInput, ar as GiftCardPurchaseResult, as as GiftCardSummary, at as LessonNote, au as LessonQuiz, av as LoginInput, aw as LoyaltyBalance, ax as LoyaltyNextTier, ay as LoyaltyProgram, az as LoyaltySummary, aA as LoyaltyTier, aB as LoyaltyTierPerks, aC as LoyaltyTransaction, aD as Menu, aE as MenuItem, aF as MenuItemRef, aG as MenuItemType, aH as MessageResponse, aI as NewsletterOptInDefault, aJ as NewsletterSubscribeInput, aK as NewsletterSubscribeResult, aL as NewsletterUnsubscribeResult, aM as OrderAccessRequestResponse, aN as OrderAccessVerifyResponse, aO as OrderDetail, aP as OrderItem, aQ as OrderListItem, aR as OrderStatus, aS as OrderStatusHistory, aT as OrderStatuses, aU as OrderTracking, aV as Page, aW as PageAttachment, aX as PageDetail, aY as PaginatedResponse, aZ as PaymentInstrument, a_ as PaymentStatus, a$ as PaymentStatuses, b0 as PaymentSwift, b1 as PickupPoint, b2 as PickupPointHours, b3 as PickupPointsInput, b4 as PickupWidgetConfig, b5 as PriceDisplay, b6 as ProductAssetGroup, b7 as ProductAssetItem, b8 as ProductAvailability, b9 as ProductGroup, ba as ProductLabel, bb as ProductListItem, bc as ProductMedia, bd as ProductMediaVariant, be as ProductParameter, bf as ProductParameterGroup, bg as ProductParametersResponse, bh as ProductPrice, bi as ProductPromotionSummary, bj as ProductReview, bk as ProductReviewsResponse, bl as ProductSibling, bm as ProductSort, bn as ProductSortValue, bo as ProductVolumePrice, bp as ProductsQuery, bq as QuizAnswerInput, br as QuizAnswerResult, bs as QuizQuestion, bt as QuizResult, bu as QuoteItem, bv as QuoteRequest, bw as RegisterInput, bx as RegisterResult, by as RequestInterceptor, bz as RequestInterceptorConfig, bA as ResponseInterceptor, bB as ResponseInterceptorData, bC as ReturnRequest, bD as ReturnRequestItem, bE as ReturnStatus, bF as ReturnStatusItem, bG as ReturnableOrder, bH as ReturnableOrderItem, bI as SdkError, bJ as ShippingMethodSummary, bK as ShippingQuote, bL as ShippingQuoteInput, bM as ShopAppearance, bN as ShopInfo, bO as ShopScript, bP as ShopScriptPlacement, bQ as ShopScriptType, bR as ShopScripts, bS as ShopSeo, bT as ShopSeoIdentity, bU as SiteFormField, bV as SiteFormFieldOption, bW as SiteFormFieldType, bX as Sitemap, bY as SitemapEntry, bZ as StockBehavior, b_ as StockMode, b$ as StorefrontForm, c0 as StorefrontFormFieldErrorCode, c1 as StorefrontFormSettings, c2 as StorefrontFormSubmitInput, c3 as StorefrontFormSubmitResult, c4 as SubmitQuoteInput, c5 as SubmitReturnInput, c6 as SubmitReviewInput, c7 as Subscription, c8 as SubscriptionAction, c9 as SubscriptionFrequency, ca as SubscriptionItem, cb as SubscriptionStatus, cc as TaxBreakdownLine, cd as VariantAxis, ce as VariantAxisValue, cf as WishlistItem, cg as err, ch as ok, ci as toSdkError } from './client-Gf4MBpav.mjs';
1
+ import { P as ProductDetail, a as ProductVariant, B as BehioStorefront, S as SdkResult, C as CookieConsent, b as StorefrontFormFieldError } from './client-BhdlZIGe.mjs';
2
+ export { A as ActivePromotion, c as AddToCartInput, d as AddressDetail, e as AddressSuggestion, f as AddressType, g as AddressTypes, h as AuthTokens, i as BackInStockSubscription, j as BadgeTone, k as BehioApiError, l as BehioErrorCode, m as BehioEventHandler, n as BehioEventType, o as BehioNetworkError, p as BehioStorefrontConfig, q as Blog, r as BlogPostDetail, s as BlogPostListItem, t as BlogPostsPage, u as BlogPostsQuery, v as BlogSettings, w as BlogTag, x as Bundle, y as BundleCatalogQuery, z as BundleItem, D as Cart, E as CartBundleLine, F as CartBundleLineItem, G as CartDiscount, H as CartItem, I as CartItemProduct, J as CartPromotion, K as Category, L as CategoryDetail, M as CertificateVerification, N as CheckoutAddress, O as CheckoutInput, Q as CheckoutPaymentMethod, R as CheckoutPreview, T as CheckoutResult, U as CheckoutSettings, V as CookieConsentInput, W as CourseAttachment, X as CourseCertificate, Y as CourseComment, Z as CourseCommentReply, _ as CourseCommentsList, $ as CourseDetail, a0 as CourseLesson, a1 as CourseListItem, a2 as CourseModule, a3 as CoursePostedComment, a4 as CourseProgress, a5 as CourseTutorMessage, a6 as CourseTutorThread, a7 as CrossSellItem, a8 as CurrencyDisplayFormat, a9 as CustomerAddress, aa as CustomerProfile, ab as DigitalDownload, ac as DownloadUrl, ad as Facet, ae as FacetAvailability, af as FacetCategory, ag as FacetLabel, ah as FacetPriceRange, ai as FacetRange, aj as FacetRatingBucket, ak as FacetValue, al as FacetsResponse, am as FilterField, an as FulfillmentStatus, ao as FulfillmentStatuses, ap as GiftCardBalance, aq as GiftCardPurchaseInput, ar as GiftCardPurchaseResult, as as GiftCardSummary, at as LessonNote, au as LessonQuiz, av as LoginInput, aw as LoyaltyBalance, ax as LoyaltyNextTier, ay as LoyaltyProgram, az as LoyaltySummary, aA as LoyaltyTier, aB as LoyaltyTierPerks, aC as LoyaltyTransaction, aD as Menu, aE as MenuItem, aF as MenuItemRef, aG as MenuItemType, aH as MessageResponse, aI as NewsletterOptInDefault, aJ as NewsletterSubscribeInput, aK as NewsletterSubscribeResult, aL as NewsletterUnsubscribeResult, aM as OrderAccessRequestResponse, aN as OrderAccessVerifyResponse, aO as OrderDetail, aP as OrderItem, aQ as OrderListItem, aR as OrderStatus, aS as OrderStatusHistory, aT as OrderStatuses, aU as OrderTracking, aV as Page, aW as PageAttachment, aX as PageDetail, aY as PaginatedResponse, aZ as PaymentInstrument, a_ as PaymentStatus, a$ as PaymentStatuses, b0 as PaymentSwift, b1 as PickupPoint, b2 as PickupPointHours, b3 as PickupPointsInput, b4 as PickupWidgetConfig, b5 as PriceDisplay, b6 as ProductAssetGroup, b7 as ProductAssetItem, b8 as ProductAvailability, b9 as ProductGroup, ba as ProductLabel, bb as ProductListItem, bc as ProductMedia, bd as ProductMediaVariant, be as ProductParameter, bf as ProductParameterGroup, bg as ProductParametersResponse, bh as ProductPrice, bi as ProductPromotionSummary, bj as ProductReview, bk as ProductReviewsResponse, bl as ProductSibling, bm as ProductSort, bn as ProductSortValue, bo as ProductVolumePrice, bp as ProductsQuery, bq as QuizAnswerInput, br as QuizAnswerResult, bs as QuizQuestion, bt as QuizResult, bu as QuoteItem, bv as QuoteRequest, bw as RegisterInput, bx as RegisterResult, by as RequestInterceptor, bz as RequestInterceptorConfig, bA as ResponseInterceptor, bB as ResponseInterceptorData, bC as ReturnRequest, bD as ReturnRequestItem, bE as ReturnStatus, bF as ReturnStatusItem, bG as ReturnableOrder, bH as ReturnableOrderItem, bI as SdkError, bJ as ShippingMethodSummary, bK as ShippingQuote, bL as ShippingQuoteInput, bM as ShopAppearance, bN as ShopInfo, bO as ShopScript, bP as ShopScriptPlacement, bQ as ShopScriptType, bR as ShopScripts, bS as ShopSeo, bT as ShopSeoIdentity, bU as SiteFormField, bV as SiteFormFieldOption, bW as SiteFormFieldType, bX as Sitemap, bY as SitemapEntry, bZ as StockBehavior, b_ as StockMode, b$ as StorefrontForm, c0 as StorefrontFormFieldErrorCode, c1 as StorefrontFormFile, c2 as StorefrontFormSettings, c3 as StorefrontFormSubmitInput, c4 as StorefrontFormSubmitResult, c5 as StorefrontFormUpload, c6 as SubmitQuoteInput, c7 as SubmitReturnInput, c8 as SubmitReviewInput, c9 as Subscription, ca as SubscriptionAction, cb as SubscriptionFrequency, cc as SubscriptionItem, cd as SubscriptionStatus, ce as TaxBreakdownLine, cf as VariantAxis, cg as VariantAxisValue, ch as WishlistItem, ci as err, cj as ok, ck as toSdkError } from './client-BhdlZIGe.mjs';
3
3
 
4
4
  /**
5
5
  * Format a price amount with currency using Intl.NumberFormat.
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { P as ProductDetail, a as ProductVariant, B as BehioStorefront, S as SdkResult, C as CookieConsent, b as StorefrontFormFieldError } from './client-Gf4MBpav.js';
2
- export { A as ActivePromotion, c as AddToCartInput, d as AddressDetail, e as AddressSuggestion, f as AddressType, g as AddressTypes, h as AuthTokens, i as BackInStockSubscription, j as BadgeTone, k as BehioApiError, l as BehioErrorCode, m as BehioEventHandler, n as BehioEventType, o as BehioNetworkError, p as BehioStorefrontConfig, q as Blog, r as BlogPostDetail, s as BlogPostListItem, t as BlogPostsPage, u as BlogPostsQuery, v as BlogSettings, w as BlogTag, x as Bundle, y as BundleCatalogQuery, z as BundleItem, D as Cart, E as CartBundleLine, F as CartBundleLineItem, G as CartDiscount, H as CartItem, I as CartItemProduct, J as CartPromotion, K as Category, L as CategoryDetail, M as CertificateVerification, N as CheckoutAddress, O as CheckoutInput, Q as CheckoutPaymentMethod, R as CheckoutPreview, T as CheckoutResult, U as CheckoutSettings, V as CookieConsentInput, W as CourseAttachment, X as CourseCertificate, Y as CourseComment, Z as CourseCommentReply, _ as CourseCommentsList, $ as CourseDetail, a0 as CourseLesson, a1 as CourseListItem, a2 as CourseModule, a3 as CoursePostedComment, a4 as CourseProgress, a5 as CourseTutorMessage, a6 as CourseTutorThread, a7 as CrossSellItem, a8 as CurrencyDisplayFormat, a9 as CustomerAddress, aa as CustomerProfile, ab as DigitalDownload, ac as DownloadUrl, ad as Facet, ae as FacetAvailability, af as FacetCategory, ag as FacetLabel, ah as FacetPriceRange, ai as FacetRange, aj as FacetRatingBucket, ak as FacetValue, al as FacetsResponse, am as FilterField, an as FulfillmentStatus, ao as FulfillmentStatuses, ap as GiftCardBalance, aq as GiftCardPurchaseInput, ar as GiftCardPurchaseResult, as as GiftCardSummary, at as LessonNote, au as LessonQuiz, av as LoginInput, aw as LoyaltyBalance, ax as LoyaltyNextTier, ay as LoyaltyProgram, az as LoyaltySummary, aA as LoyaltyTier, aB as LoyaltyTierPerks, aC as LoyaltyTransaction, aD as Menu, aE as MenuItem, aF as MenuItemRef, aG as MenuItemType, aH as MessageResponse, aI as NewsletterOptInDefault, aJ as NewsletterSubscribeInput, aK as NewsletterSubscribeResult, aL as NewsletterUnsubscribeResult, aM as OrderAccessRequestResponse, aN as OrderAccessVerifyResponse, aO as OrderDetail, aP as OrderItem, aQ as OrderListItem, aR as OrderStatus, aS as OrderStatusHistory, aT as OrderStatuses, aU as OrderTracking, aV as Page, aW as PageAttachment, aX as PageDetail, aY as PaginatedResponse, aZ as PaymentInstrument, a_ as PaymentStatus, a$ as PaymentStatuses, b0 as PaymentSwift, b1 as PickupPoint, b2 as PickupPointHours, b3 as PickupPointsInput, b4 as PickupWidgetConfig, b5 as PriceDisplay, b6 as ProductAssetGroup, b7 as ProductAssetItem, b8 as ProductAvailability, b9 as ProductGroup, ba as ProductLabel, bb as ProductListItem, bc as ProductMedia, bd as ProductMediaVariant, be as ProductParameter, bf as ProductParameterGroup, bg as ProductParametersResponse, bh as ProductPrice, bi as ProductPromotionSummary, bj as ProductReview, bk as ProductReviewsResponse, bl as ProductSibling, bm as ProductSort, bn as ProductSortValue, bo as ProductVolumePrice, bp as ProductsQuery, bq as QuizAnswerInput, br as QuizAnswerResult, bs as QuizQuestion, bt as QuizResult, bu as QuoteItem, bv as QuoteRequest, bw as RegisterInput, bx as RegisterResult, by as RequestInterceptor, bz as RequestInterceptorConfig, bA as ResponseInterceptor, bB as ResponseInterceptorData, bC as ReturnRequest, bD as ReturnRequestItem, bE as ReturnStatus, bF as ReturnStatusItem, bG as ReturnableOrder, bH as ReturnableOrderItem, bI as SdkError, bJ as ShippingMethodSummary, bK as ShippingQuote, bL as ShippingQuoteInput, bM as ShopAppearance, bN as ShopInfo, bO as ShopScript, bP as ShopScriptPlacement, bQ as ShopScriptType, bR as ShopScripts, bS as ShopSeo, bT as ShopSeoIdentity, bU as SiteFormField, bV as SiteFormFieldOption, bW as SiteFormFieldType, bX as Sitemap, bY as SitemapEntry, bZ as StockBehavior, b_ as StockMode, b$ as StorefrontForm, c0 as StorefrontFormFieldErrorCode, c1 as StorefrontFormSettings, c2 as StorefrontFormSubmitInput, c3 as StorefrontFormSubmitResult, c4 as SubmitQuoteInput, c5 as SubmitReturnInput, c6 as SubmitReviewInput, c7 as Subscription, c8 as SubscriptionAction, c9 as SubscriptionFrequency, ca as SubscriptionItem, cb as SubscriptionStatus, cc as TaxBreakdownLine, cd as VariantAxis, ce as VariantAxisValue, cf as WishlistItem, cg as err, ch as ok, ci as toSdkError } from './client-Gf4MBpav.js';
1
+ import { P as ProductDetail, a as ProductVariant, B as BehioStorefront, S as SdkResult, C as CookieConsent, b as StorefrontFormFieldError } from './client-BhdlZIGe.js';
2
+ export { A as ActivePromotion, c as AddToCartInput, d as AddressDetail, e as AddressSuggestion, f as AddressType, g as AddressTypes, h as AuthTokens, i as BackInStockSubscription, j as BadgeTone, k as BehioApiError, l as BehioErrorCode, m as BehioEventHandler, n as BehioEventType, o as BehioNetworkError, p as BehioStorefrontConfig, q as Blog, r as BlogPostDetail, s as BlogPostListItem, t as BlogPostsPage, u as BlogPostsQuery, v as BlogSettings, w as BlogTag, x as Bundle, y as BundleCatalogQuery, z as BundleItem, D as Cart, E as CartBundleLine, F as CartBundleLineItem, G as CartDiscount, H as CartItem, I as CartItemProduct, J as CartPromotion, K as Category, L as CategoryDetail, M as CertificateVerification, N as CheckoutAddress, O as CheckoutInput, Q as CheckoutPaymentMethod, R as CheckoutPreview, T as CheckoutResult, U as CheckoutSettings, V as CookieConsentInput, W as CourseAttachment, X as CourseCertificate, Y as CourseComment, Z as CourseCommentReply, _ as CourseCommentsList, $ as CourseDetail, a0 as CourseLesson, a1 as CourseListItem, a2 as CourseModule, a3 as CoursePostedComment, a4 as CourseProgress, a5 as CourseTutorMessage, a6 as CourseTutorThread, a7 as CrossSellItem, a8 as CurrencyDisplayFormat, a9 as CustomerAddress, aa as CustomerProfile, ab as DigitalDownload, ac as DownloadUrl, ad as Facet, ae as FacetAvailability, af as FacetCategory, ag as FacetLabel, ah as FacetPriceRange, ai as FacetRange, aj as FacetRatingBucket, ak as FacetValue, al as FacetsResponse, am as FilterField, an as FulfillmentStatus, ao as FulfillmentStatuses, ap as GiftCardBalance, aq as GiftCardPurchaseInput, ar as GiftCardPurchaseResult, as as GiftCardSummary, at as LessonNote, au as LessonQuiz, av as LoginInput, aw as LoyaltyBalance, ax as LoyaltyNextTier, ay as LoyaltyProgram, az as LoyaltySummary, aA as LoyaltyTier, aB as LoyaltyTierPerks, aC as LoyaltyTransaction, aD as Menu, aE as MenuItem, aF as MenuItemRef, aG as MenuItemType, aH as MessageResponse, aI as NewsletterOptInDefault, aJ as NewsletterSubscribeInput, aK as NewsletterSubscribeResult, aL as NewsletterUnsubscribeResult, aM as OrderAccessRequestResponse, aN as OrderAccessVerifyResponse, aO as OrderDetail, aP as OrderItem, aQ as OrderListItem, aR as OrderStatus, aS as OrderStatusHistory, aT as OrderStatuses, aU as OrderTracking, aV as Page, aW as PageAttachment, aX as PageDetail, aY as PaginatedResponse, aZ as PaymentInstrument, a_ as PaymentStatus, a$ as PaymentStatuses, b0 as PaymentSwift, b1 as PickupPoint, b2 as PickupPointHours, b3 as PickupPointsInput, b4 as PickupWidgetConfig, b5 as PriceDisplay, b6 as ProductAssetGroup, b7 as ProductAssetItem, b8 as ProductAvailability, b9 as ProductGroup, ba as ProductLabel, bb as ProductListItem, bc as ProductMedia, bd as ProductMediaVariant, be as ProductParameter, bf as ProductParameterGroup, bg as ProductParametersResponse, bh as ProductPrice, bi as ProductPromotionSummary, bj as ProductReview, bk as ProductReviewsResponse, bl as ProductSibling, bm as ProductSort, bn as ProductSortValue, bo as ProductVolumePrice, bp as ProductsQuery, bq as QuizAnswerInput, br as QuizAnswerResult, bs as QuizQuestion, bt as QuizResult, bu as QuoteItem, bv as QuoteRequest, bw as RegisterInput, bx as RegisterResult, by as RequestInterceptor, bz as RequestInterceptorConfig, bA as ResponseInterceptor, bB as ResponseInterceptorData, bC as ReturnRequest, bD as ReturnRequestItem, bE as ReturnStatus, bF as ReturnStatusItem, bG as ReturnableOrder, bH as ReturnableOrderItem, bI as SdkError, bJ as ShippingMethodSummary, bK as ShippingQuote, bL as ShippingQuoteInput, bM as ShopAppearance, bN as ShopInfo, bO as ShopScript, bP as ShopScriptPlacement, bQ as ShopScriptType, bR as ShopScripts, bS as ShopSeo, bT as ShopSeoIdentity, bU as SiteFormField, bV as SiteFormFieldOption, bW as SiteFormFieldType, bX as Sitemap, bY as SitemapEntry, bZ as StockBehavior, b_ as StockMode, b$ as StorefrontForm, c0 as StorefrontFormFieldErrorCode, c1 as StorefrontFormFile, c2 as StorefrontFormSettings, c3 as StorefrontFormSubmitInput, c4 as StorefrontFormSubmitResult, c5 as StorefrontFormUpload, c6 as SubmitQuoteInput, c7 as SubmitReturnInput, c8 as SubmitReviewInput, c9 as Subscription, ca as SubscriptionAction, cb as SubscriptionFrequency, cc as SubscriptionItem, cd as SubscriptionStatus, ce as TaxBreakdownLine, cf as VariantAxis, cg as VariantAxisValue, ch as WishlistItem, ci as err, cj as ok, ck as toSdkError } from './client-BhdlZIGe.js';
3
3
 
4
4
  /**
5
5
  * Format a price amount with currency using Intl.NumberFormat.
package/dist/index.js CHANGED
@@ -10,7 +10,7 @@
10
10
 
11
11
 
12
12
 
13
- var _chunkSF7JTW3Yjs = require('./chunk-SF7JTW3Y.js');
13
+ var _chunkM6TCQUXZjs = require('./chunk-M6TCQUXZ.js');
14
14
 
15
15
  // src/react/utils/format-price.ts
16
16
  function formatPrice(amount, currency, locale, display) {
@@ -237,6 +237,12 @@ var ERROR_MESSAGES = {
237
237
  "cs": {
238
238
  "be.common.notFound": "Tohle u\u017E neexistuje.",
239
239
  "be.forms.consentRequired": "Bez souhlasu nejde formul\xE1\u0159 odeslat.",
240
+ "be.forms.fileFieldNotFound": "Formul\xE1\u0159 takov\xE9 pole pro soubor nem\xE1.",
241
+ "be.forms.fileNotFound": "Soubor nebyl nalezen.",
242
+ "be.forms.fileRateLimited": "Formul\xE1\u0159 te\u010F p\u0159ij\xEDm\xE1 p\u0159\xEDli\u0161 mnoho soubor\u016F. Zkuste to pros\xEDm za chv\xEDli.",
243
+ "be.forms.fileTooLarge": "Soubor je v\u011Bt\u0161\xED, ne\u017E formul\xE1\u0159 povoluje (nejv\xFD\u0161 {maxMb} MB).",
244
+ "be.forms.fileTypeNotAllowed": "Tenhle typ souboru formul\xE1\u0159 nep\u0159ij\xEDm\xE1.",
245
+ "be.forms.fileUploadIncomplete": "Soubor se je\u0161t\u011B nenahr\xE1l. Zkuste ho pros\xEDm vybrat znovu.",
240
246
  "be.forms.formNotFound": "Formul\xE1\u0159 nebyl nalezen.",
241
247
  "be.forms.tooLarge": "Odeslan\xE1 data jsou p\u0159\xEDli\u0161 velk\xE1.",
242
248
  "be.forms.validationFailed": "N\u011Bkter\xE1 pole nejsou vypln\u011Bn\xE1 spr\xE1vn\u011B.",
@@ -420,7 +426,6 @@ var ERROR_MESSAGES = {
420
426
  "be.storefront.reviewNotFound": "Recenze nenalezena.",
421
427
  "be.storefront.saleEnded": "Prodej produktu {name} skon\u010Dil.",
422
428
  "be.storefront.saleNotStarted": "Prodej produktu {name} je\u0161t\u011B neza\u010Dal.",
423
- "be.storefront.sessionTokenRequired": "Chyb\xED identifikace ko\u0161\xEDku nebo z\xE1kazn\xEDka.",
424
429
  "be.storefront.shippingAddressRequired": "Fyzick\xE9 produkty vy\u017Eaduj\xED doru\u010Dovac\xED adresu.",
425
430
  "be.storefront.shippingMethodNotFound": "Doprava nenalezena.",
426
431
  "be.storefront.shippingMethodRequired": "Chyb\xED zvolen\xE1 doprava.",
@@ -467,6 +472,12 @@ var ERROR_MESSAGES = {
467
472
  "sk": {
468
473
  "be.common.notFound": "Toto u\u017E neexistuje.",
469
474
  "be.forms.consentRequired": "Bez s\xFAhlasu sa formul\xE1r ned\xE1 odosla\u0165.",
475
+ "be.forms.fileFieldNotFound": "Formul\xE1r tak\xE9to pole pre s\xFAbor nem\xE1.",
476
+ "be.forms.fileNotFound": "S\xFAbor sa nena\u0161iel.",
477
+ "be.forms.fileRateLimited": "Formul\xE1r teraz prij\xEDma pr\xEDli\u0161 ve\u013Ea s\xFAborov. Sk\xFAste to pros\xEDm o chv\xED\u013Eu.",
478
+ "be.forms.fileTooLarge": "S\xFAbor je v\xE4\u010D\u0161\xED, ne\u017E formul\xE1r povo\u013Euje (najviac {maxMb} MB).",
479
+ "be.forms.fileTypeNotAllowed": "Tento typ s\xFAboru formul\xE1r neprij\xEDma.",
480
+ "be.forms.fileUploadIncomplete": "S\xFAbor sa e\u0161te nenahral. Sk\xFAste ho pros\xEDm vybra\u0165 znova.",
470
481
  "be.forms.formNotFound": "Formul\xE1r sa nena\u0161iel.",
471
482
  "be.forms.tooLarge": "Odoslan\xE9 d\xE1ta s\xFA pr\xEDli\u0161 ve\u013Ek\xE9.",
472
483
  "be.forms.validationFailed": "Niektor\xE9 polia nie s\xFA vyplnen\xE9 spr\xE1vne.",
@@ -650,7 +661,6 @@ var ERROR_MESSAGES = {
650
661
  "be.storefront.reviewNotFound": "Recenzia sa nena\u0161la.",
651
662
  "be.storefront.saleEnded": "Predaj produktu {name} sa skon\u010Dil.",
652
663
  "be.storefront.saleNotStarted": "Predaj produktu {name} sa e\u0161te neza\u010Dal.",
653
- "be.storefront.sessionTokenRequired": "Ch\xFDba identifik\xE1cia ko\u0161\xEDka alebo z\xE1kazn\xEDka.",
654
664
  "be.storefront.shippingAddressRequired": "Fyzick\xE9 produkty vy\u017Eaduj\xFA doru\u010Dovaciu adresu.",
655
665
  "be.storefront.shippingMethodNotFound": "Doprava sa nena\u0161la.",
656
666
  "be.storefront.shippingMethodRequired": "Ch\xFDba zvolen\xE1 doprava.",
@@ -697,6 +707,12 @@ var ERROR_MESSAGES = {
697
707
  "en": {
698
708
  "be.common.notFound": "This no longer exists.",
699
709
  "be.forms.consentRequired": "The form cannot be sent without consent.",
710
+ "be.forms.fileFieldNotFound": "This form has no such file field.",
711
+ "be.forms.fileNotFound": "The file was not found.",
712
+ "be.forms.fileRateLimited": "The form is receiving too many files right now. Please try again in a moment.",
713
+ "be.forms.fileTooLarge": "The file is larger than the form allows (at most {maxMb} MB).",
714
+ "be.forms.fileTypeNotAllowed": "This form does not accept this file type.",
715
+ "be.forms.fileUploadIncomplete": "The file has not finished uploading. Please choose it again.",
700
716
  "be.forms.formNotFound": "Form not found.",
701
717
  "be.forms.tooLarge": "The submitted data is too large.",
702
718
  "be.forms.validationFailed": "Some fields are not filled in correctly.",
@@ -880,7 +896,6 @@ var ERROR_MESSAGES = {
880
896
  "be.storefront.reviewNotFound": "Review not found",
881
897
  "be.storefront.saleEnded": "Sale for {name} has ended",
882
898
  "be.storefront.saleNotStarted": "Sale for {name} has not started yet",
883
- "be.storefront.sessionTokenRequired": "Session token or customer id required",
884
899
  "be.storefront.shippingAddressRequired": "Physical products require a delivery address.",
885
900
  "be.storefront.shippingMethodNotFound": "Shipping method not found",
886
901
  "be.storefront.shippingMethodRequired": "Shipping method is required",
@@ -933,7 +948,7 @@ var GENERIC = {
933
948
  en: "Something went wrong, please try again."
934
949
  };
935
950
  function bodyOf(err2) {
936
- const body = err2 instanceof _chunkSF7JTW3Yjs.BehioApiError ? err2.body : err2 && typeof err2 === "object" && "body" in err2 ? err2.body : err2;
951
+ const body = err2 instanceof _chunkM6TCQUXZjs.BehioApiError ? err2.body : err2 && typeof err2 === "object" && "body" in err2 ? err2.body : err2;
937
952
  return body && typeof body === "object" ? body : null;
938
953
  }
939
954
  function errorCode(err2) {
@@ -1045,4 +1060,4 @@ function formFieldErrors(err2) {
1045
1060
 
1046
1061
 
1047
1062
 
1048
- exports.AddressTypes = _chunkSF7JTW3Yjs.AddressTypes; exports.BehioApiError = _chunkSF7JTW3Yjs.BehioApiError; exports.BehioNetworkError = _chunkSF7JTW3Yjs.BehioNetworkError; exports.BehioStorefront = _chunkSF7JTW3Yjs.BehioStorefront; exports.FulfillmentStatuses = _chunkSF7JTW3Yjs.FulfillmentStatuses; exports.OrderStatuses = _chunkSF7JTW3Yjs.OrderStatuses; exports.PaymentStatuses = _chunkSF7JTW3Yjs.PaymentStatuses; exports.ProductSort = _chunkSF7JTW3Yjs.ProductSort; exports.VARIANT_QUERY_PARAM = VARIANT_QUERY_PARAM; exports.availableAxisValues = availableAxisValues; exports.buildVariantComparison = buildVariantComparison; exports.err = _chunkSF7JTW3Yjs.err; exports.errorCode = errorCode; exports.errorMessage = errorMessage; exports.errorParams = errorParams; exports.findVariantByAttributes = findVariantByAttributes; exports.formFieldErrors = formFieldErrors; exports.formatPrice = formatPrice; exports.generateVisitorId = generateVisitorId; exports.getStoredVisitorId = getStoredVisitorId; exports.grantAnalyticsConsent = grantAnalyticsConsent; exports.ok = _chunkSF7JTW3Yjs.ok; exports.resolveVariantContent = resolveVariantContent; exports.revokeAnalyticsConsent = revokeAnalyticsConsent; exports.toSdkError = _chunkSF7JTW3Yjs.toSdkError; exports.trackEcommerceEvent = trackEcommerceEvent; exports.validationFieldMessages = validationFieldMessages; exports.variantFromQuery = variantFromQuery; exports.variantHref = variantHref;
1063
+ exports.AddressTypes = _chunkM6TCQUXZjs.AddressTypes; exports.BehioApiError = _chunkM6TCQUXZjs.BehioApiError; exports.BehioNetworkError = _chunkM6TCQUXZjs.BehioNetworkError; exports.BehioStorefront = _chunkM6TCQUXZjs.BehioStorefront; exports.FulfillmentStatuses = _chunkM6TCQUXZjs.FulfillmentStatuses; exports.OrderStatuses = _chunkM6TCQUXZjs.OrderStatuses; exports.PaymentStatuses = _chunkM6TCQUXZjs.PaymentStatuses; exports.ProductSort = _chunkM6TCQUXZjs.ProductSort; exports.VARIANT_QUERY_PARAM = VARIANT_QUERY_PARAM; exports.availableAxisValues = availableAxisValues; exports.buildVariantComparison = buildVariantComparison; exports.err = _chunkM6TCQUXZjs.err; exports.errorCode = errorCode; exports.errorMessage = errorMessage; exports.errorParams = errorParams; exports.findVariantByAttributes = findVariantByAttributes; exports.formFieldErrors = formFieldErrors; exports.formatPrice = formatPrice; exports.generateVisitorId = generateVisitorId; exports.getStoredVisitorId = getStoredVisitorId; exports.grantAnalyticsConsent = grantAnalyticsConsent; exports.ok = _chunkM6TCQUXZjs.ok; exports.resolveVariantContent = resolveVariantContent; exports.revokeAnalyticsConsent = revokeAnalyticsConsent; exports.toSdkError = _chunkM6TCQUXZjs.toSdkError; exports.trackEcommerceEvent = trackEcommerceEvent; exports.validationFieldMessages = validationFieldMessages; exports.variantFromQuery = variantFromQuery; exports.variantHref = variantHref;
package/dist/index.mjs CHANGED
@@ -10,7 +10,7 @@ import {
10
10
  err,
11
11
  ok,
12
12
  toSdkError
13
- } from "./chunk-MCWHR3BY.mjs";
13
+ } from "./chunk-EXHIA7ST.mjs";
14
14
 
15
15
  // src/react/utils/format-price.ts
16
16
  function formatPrice(amount, currency, locale, display) {
@@ -237,6 +237,12 @@ var ERROR_MESSAGES = {
237
237
  "cs": {
238
238
  "be.common.notFound": "Tohle u\u017E neexistuje.",
239
239
  "be.forms.consentRequired": "Bez souhlasu nejde formul\xE1\u0159 odeslat.",
240
+ "be.forms.fileFieldNotFound": "Formul\xE1\u0159 takov\xE9 pole pro soubor nem\xE1.",
241
+ "be.forms.fileNotFound": "Soubor nebyl nalezen.",
242
+ "be.forms.fileRateLimited": "Formul\xE1\u0159 te\u010F p\u0159ij\xEDm\xE1 p\u0159\xEDli\u0161 mnoho soubor\u016F. Zkuste to pros\xEDm za chv\xEDli.",
243
+ "be.forms.fileTooLarge": "Soubor je v\u011Bt\u0161\xED, ne\u017E formul\xE1\u0159 povoluje (nejv\xFD\u0161 {maxMb} MB).",
244
+ "be.forms.fileTypeNotAllowed": "Tenhle typ souboru formul\xE1\u0159 nep\u0159ij\xEDm\xE1.",
245
+ "be.forms.fileUploadIncomplete": "Soubor se je\u0161t\u011B nenahr\xE1l. Zkuste ho pros\xEDm vybrat znovu.",
240
246
  "be.forms.formNotFound": "Formul\xE1\u0159 nebyl nalezen.",
241
247
  "be.forms.tooLarge": "Odeslan\xE1 data jsou p\u0159\xEDli\u0161 velk\xE1.",
242
248
  "be.forms.validationFailed": "N\u011Bkter\xE1 pole nejsou vypln\u011Bn\xE1 spr\xE1vn\u011B.",
@@ -420,7 +426,6 @@ var ERROR_MESSAGES = {
420
426
  "be.storefront.reviewNotFound": "Recenze nenalezena.",
421
427
  "be.storefront.saleEnded": "Prodej produktu {name} skon\u010Dil.",
422
428
  "be.storefront.saleNotStarted": "Prodej produktu {name} je\u0161t\u011B neza\u010Dal.",
423
- "be.storefront.sessionTokenRequired": "Chyb\xED identifikace ko\u0161\xEDku nebo z\xE1kazn\xEDka.",
424
429
  "be.storefront.shippingAddressRequired": "Fyzick\xE9 produkty vy\u017Eaduj\xED doru\u010Dovac\xED adresu.",
425
430
  "be.storefront.shippingMethodNotFound": "Doprava nenalezena.",
426
431
  "be.storefront.shippingMethodRequired": "Chyb\xED zvolen\xE1 doprava.",
@@ -467,6 +472,12 @@ var ERROR_MESSAGES = {
467
472
  "sk": {
468
473
  "be.common.notFound": "Toto u\u017E neexistuje.",
469
474
  "be.forms.consentRequired": "Bez s\xFAhlasu sa formul\xE1r ned\xE1 odosla\u0165.",
475
+ "be.forms.fileFieldNotFound": "Formul\xE1r tak\xE9to pole pre s\xFAbor nem\xE1.",
476
+ "be.forms.fileNotFound": "S\xFAbor sa nena\u0161iel.",
477
+ "be.forms.fileRateLimited": "Formul\xE1r teraz prij\xEDma pr\xEDli\u0161 ve\u013Ea s\xFAborov. Sk\xFAste to pros\xEDm o chv\xED\u013Eu.",
478
+ "be.forms.fileTooLarge": "S\xFAbor je v\xE4\u010D\u0161\xED, ne\u017E formul\xE1r povo\u013Euje (najviac {maxMb} MB).",
479
+ "be.forms.fileTypeNotAllowed": "Tento typ s\xFAboru formul\xE1r neprij\xEDma.",
480
+ "be.forms.fileUploadIncomplete": "S\xFAbor sa e\u0161te nenahral. Sk\xFAste ho pros\xEDm vybra\u0165 znova.",
470
481
  "be.forms.formNotFound": "Formul\xE1r sa nena\u0161iel.",
471
482
  "be.forms.tooLarge": "Odoslan\xE9 d\xE1ta s\xFA pr\xEDli\u0161 ve\u013Ek\xE9.",
472
483
  "be.forms.validationFailed": "Niektor\xE9 polia nie s\xFA vyplnen\xE9 spr\xE1vne.",
@@ -650,7 +661,6 @@ var ERROR_MESSAGES = {
650
661
  "be.storefront.reviewNotFound": "Recenzia sa nena\u0161la.",
651
662
  "be.storefront.saleEnded": "Predaj produktu {name} sa skon\u010Dil.",
652
663
  "be.storefront.saleNotStarted": "Predaj produktu {name} sa e\u0161te neza\u010Dal.",
653
- "be.storefront.sessionTokenRequired": "Ch\xFDba identifik\xE1cia ko\u0161\xEDka alebo z\xE1kazn\xEDka.",
654
664
  "be.storefront.shippingAddressRequired": "Fyzick\xE9 produkty vy\u017Eaduj\xFA doru\u010Dovaciu adresu.",
655
665
  "be.storefront.shippingMethodNotFound": "Doprava sa nena\u0161la.",
656
666
  "be.storefront.shippingMethodRequired": "Ch\xFDba zvolen\xE1 doprava.",
@@ -697,6 +707,12 @@ var ERROR_MESSAGES = {
697
707
  "en": {
698
708
  "be.common.notFound": "This no longer exists.",
699
709
  "be.forms.consentRequired": "The form cannot be sent without consent.",
710
+ "be.forms.fileFieldNotFound": "This form has no such file field.",
711
+ "be.forms.fileNotFound": "The file was not found.",
712
+ "be.forms.fileRateLimited": "The form is receiving too many files right now. Please try again in a moment.",
713
+ "be.forms.fileTooLarge": "The file is larger than the form allows (at most {maxMb} MB).",
714
+ "be.forms.fileTypeNotAllowed": "This form does not accept this file type.",
715
+ "be.forms.fileUploadIncomplete": "The file has not finished uploading. Please choose it again.",
700
716
  "be.forms.formNotFound": "Form not found.",
701
717
  "be.forms.tooLarge": "The submitted data is too large.",
702
718
  "be.forms.validationFailed": "Some fields are not filled in correctly.",
@@ -880,7 +896,6 @@ var ERROR_MESSAGES = {
880
896
  "be.storefront.reviewNotFound": "Review not found",
881
897
  "be.storefront.saleEnded": "Sale for {name} has ended",
882
898
  "be.storefront.saleNotStarted": "Sale for {name} has not started yet",
883
- "be.storefront.sessionTokenRequired": "Session token or customer id required",
884
899
  "be.storefront.shippingAddressRequired": "Physical products require a delivery address.",
885
900
  "be.storefront.shippingMethodNotFound": "Shipping method not found",
886
901
  "be.storefront.shippingMethodRequired": "Shipping method is required",
package/dist/next.d.mts CHANGED
@@ -1,4 +1,4 @@
1
- import { p as BehioStorefrontConfig, B as BehioStorefront } from './client-Gf4MBpav.mjs';
1
+ import { p as BehioStorefrontConfig, B as BehioStorefront } from './client-BhdlZIGe.mjs';
2
2
 
3
3
  interface GetBehioOptions extends Partial<BehioStorefrontConfig> {
4
4
  /** Override the cart session cookie name (default: "behio_cart_session"). */
package/dist/next.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { p as BehioStorefrontConfig, B as BehioStorefront } from './client-Gf4MBpav.js';
1
+ import { p as BehioStorefrontConfig, B as BehioStorefront } from './client-BhdlZIGe.js';
2
2
 
3
3
  interface GetBehioOptions extends Partial<BehioStorefrontConfig> {
4
4
  /** Override the cart session cookie name (default: "behio_cart_session"). */
package/dist/next.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
2
2
 
3
- var _chunkSF7JTW3Yjs = require('./chunk-SF7JTW3Y.js');
3
+ var _chunkM6TCQUXZjs = require('./chunk-M6TCQUXZ.js');
4
4
 
5
5
  // src/next.ts
6
6
  var _headers = require('next/headers');
@@ -19,7 +19,7 @@ async function getBehio(options = {}) {
19
19
  const locale = _nullishCoalesce(options.locale, () => ( process.env.BEHIO_LOCALE));
20
20
  const currency = _nullishCoalesce(options.currency, () => ( process.env.BEHIO_CURRENCY));
21
21
  const cookieName = _nullishCoalesce(options.cartCookieName, () => ( CART_COOKIE_NAME));
22
- const client = new (0, _chunkSF7JTW3Yjs.BehioStorefront)({
22
+ const client = new (0, _chunkM6TCQUXZjs.BehioStorefront)({
23
23
  apiKey,
24
24
  ...baseUrl ? { baseUrl } : {},
25
25
  ...locale ? { locale } : {},
package/dist/next.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  BehioStorefront
3
- } from "./chunk-MCWHR3BY.mjs";
3
+ } from "./chunk-EXHIA7ST.mjs";
4
4
 
5
5
  // src/next.ts
6
6
  import { cookies, headers } from "next/headers";
package/dist/react.d.mts CHANGED
@@ -2124,7 +2124,9 @@ type SiteFormFieldType = "text" | "email" | "phone" | "textarea" | "number" | "s
2124
2124
  /** "YYYY-MM-DDTHH:MM" without a zone, as `<input type="datetime-local">` */
2125
2125
  | "datetime"
2126
2126
  /** http(s) address */
2127
- | "url" | "hidden";
2127
+ | "url" | "hidden"
2128
+ /** Attachments: upload with `forms.uploadFile`, submit the returned ids as an array. */
2129
+ | "file";
2128
2130
  interface SiteFormFieldOption {
2129
2131
  value: string;
2130
2132
  label: string;
@@ -2150,6 +2152,16 @@ interface SiteFormField {
2150
2152
  width?: "full" | "half";
2151
2153
  /** Value of hidden fields (source, campaign) or a prefill for visible ones. */
2152
2154
  defaultValue?: string;
2155
+ /** Merchant's own message shown when the field fails validation. */
2156
+ errorMessage?: string;
2157
+ /** Date / datetime: "future" = today or later, "past" = today or earlier. */
2158
+ dateRule?: "any" | "future" | "past";
2159
+ /** File: allowed kinds (images, documents = PDF and Office, any = both). */
2160
+ accept?: "images" | "documents" | "any";
2161
+ /** File: most files (1 to 5, default 1). Multiselect uses `min`/`max` as choice counts. */
2162
+ maxFiles?: number;
2163
+ /** File: largest single file in MB (1 to 500, default 10). */
2164
+ maxSizeMb?: number;
2153
2165
  }
2154
2166
  interface StorefrontFormSettings {
2155
2167
  submitLabel?: string;
@@ -2183,6 +2195,19 @@ interface StorefrontFormSubmitInput {
2183
2195
  * untouched: a filled value is answered like a success but stored nowhere.
2184
2196
  */
2185
2197
  website?: string;
2198
+ /**
2199
+ * Milliseconds between rendering the form and submitting it. Under 1.5 s is
2200
+ * treated as a bot (answered like a success, stored nowhere). Optional.
2201
+ */
2202
+ elapsedMs?: number;
2203
+ }
2204
+ /** An uploaded file for a `file` field (`forms.uploadFile`). */
2205
+ interface StorefrontFormFile {
2206
+ /** Send this in `data[fieldKey]` on submit. */
2207
+ id: string;
2208
+ name: string;
2209
+ size: number;
2210
+ type: string;
2186
2211
  }
2187
2212
  interface StorefrontFormSubmitResult {
2188
2213
  ok: boolean;
@@ -2193,7 +2218,7 @@ interface StorefrontFormSubmitResult {
2193
2218
  /** `settings.redirectUrl`, when set. */
2194
2219
  redirectUrl: string | null;
2195
2220
  }
2196
- type StorefrontFormFieldErrorCode = "required" | "invalid" | "tooShort" | "tooLong" | "min" | "max" | "notOption" | "pattern";
2221
+ type StorefrontFormFieldErrorCode = "required" | "invalid" | "tooShort" | "tooLong" | "min" | "max" | "notOption" | "pattern" | "dateNotFuture" | "dateNotPast" | "tooManyFiles";
2197
2222
  /** One per-field validation error of a rejected submit (`be.forms.validationFailed`). */
2198
2223
  interface StorefrontFormFieldError {
2199
2224
  key: string;
@@ -3062,6 +3087,13 @@ declare class BehioStorefront {
3062
3087
  * @internal — use the typed module methods (behio.certificates.downloadPdf).
3063
3088
  */
3064
3089
  requestBlob(path: string): Promise<SdkResult<Blob>>;
3090
+ /**
3091
+ * PUT of a file body to a presigned storage URL (form attachments). No API
3092
+ * key and no JSON: the URL itself carries the permission and the exact size.
3093
+ *
3094
+ * @internal — use behio.forms.uploadFile.
3095
+ */
3096
+ putToPresignedUrl(url: string, body: Blob, contentType: string): Promise<SdkResult<true>>;
3065
3097
  /**
3066
3098
  * Throws on failure (API error / network / timeout). Kept private so
3067
3099
  * internal auth refresh recursion keeps its existing control flow —
@@ -3578,6 +3610,17 @@ declare class FormsModule {
3578
3610
  * `be.forms.formNotFound`; rate limit 10 submits per minute per visitor.
3579
3611
  */
3580
3612
  submit(slug: string, input: StorefrontFormSubmitInput): Promise<SdkResult<StorefrontFormSubmitResult>>;
3613
+ /**
3614
+ * Upload one file for a `file` field, straight from the browser to storage
3615
+ * (it never passes through the API, so large files are fine: up to
3616
+ * `field.maxSizeMb`, at most 500 MB). Three steps in one call: a presigned
3617
+ * PUT URL for this exact size, the PUT itself, and a confirm where the API
3618
+ * checks the real size and the type from the file content (images, PDF,
3619
+ * Office; never SVG or HTML). Send the returned `id` in `data[fieldKey]`.
3620
+ * Errors: `be.forms.fileTypeNotAllowed`, `be.forms.fileTooLarge`
3621
+ * (params.maxMb), `be.forms.fileRateLimited`, `be.forms.fileUploadIncomplete`.
3622
+ */
3623
+ uploadFile(slug: string, fieldKey: string, file: Blob, fileName?: string): Promise<SdkResult<StorefrontFormFile>>;
3581
3624
  }
3582
3625
  declare class WishlistModule {
3583
3626
  private client;
package/dist/react.d.ts CHANGED
@@ -2124,7 +2124,9 @@ type SiteFormFieldType = "text" | "email" | "phone" | "textarea" | "number" | "s
2124
2124
  /** "YYYY-MM-DDTHH:MM" without a zone, as `<input type="datetime-local">` */
2125
2125
  | "datetime"
2126
2126
  /** http(s) address */
2127
- | "url" | "hidden";
2127
+ | "url" | "hidden"
2128
+ /** Attachments: upload with `forms.uploadFile`, submit the returned ids as an array. */
2129
+ | "file";
2128
2130
  interface SiteFormFieldOption {
2129
2131
  value: string;
2130
2132
  label: string;
@@ -2150,6 +2152,16 @@ interface SiteFormField {
2150
2152
  width?: "full" | "half";
2151
2153
  /** Value of hidden fields (source, campaign) or a prefill for visible ones. */
2152
2154
  defaultValue?: string;
2155
+ /** Merchant's own message shown when the field fails validation. */
2156
+ errorMessage?: string;
2157
+ /** Date / datetime: "future" = today or later, "past" = today or earlier. */
2158
+ dateRule?: "any" | "future" | "past";
2159
+ /** File: allowed kinds (images, documents = PDF and Office, any = both). */
2160
+ accept?: "images" | "documents" | "any";
2161
+ /** File: most files (1 to 5, default 1). Multiselect uses `min`/`max` as choice counts. */
2162
+ maxFiles?: number;
2163
+ /** File: largest single file in MB (1 to 500, default 10). */
2164
+ maxSizeMb?: number;
2153
2165
  }
2154
2166
  interface StorefrontFormSettings {
2155
2167
  submitLabel?: string;
@@ -2183,6 +2195,19 @@ interface StorefrontFormSubmitInput {
2183
2195
  * untouched: a filled value is answered like a success but stored nowhere.
2184
2196
  */
2185
2197
  website?: string;
2198
+ /**
2199
+ * Milliseconds between rendering the form and submitting it. Under 1.5 s is
2200
+ * treated as a bot (answered like a success, stored nowhere). Optional.
2201
+ */
2202
+ elapsedMs?: number;
2203
+ }
2204
+ /** An uploaded file for a `file` field (`forms.uploadFile`). */
2205
+ interface StorefrontFormFile {
2206
+ /** Send this in `data[fieldKey]` on submit. */
2207
+ id: string;
2208
+ name: string;
2209
+ size: number;
2210
+ type: string;
2186
2211
  }
2187
2212
  interface StorefrontFormSubmitResult {
2188
2213
  ok: boolean;
@@ -2193,7 +2218,7 @@ interface StorefrontFormSubmitResult {
2193
2218
  /** `settings.redirectUrl`, when set. */
2194
2219
  redirectUrl: string | null;
2195
2220
  }
2196
- type StorefrontFormFieldErrorCode = "required" | "invalid" | "tooShort" | "tooLong" | "min" | "max" | "notOption" | "pattern";
2221
+ type StorefrontFormFieldErrorCode = "required" | "invalid" | "tooShort" | "tooLong" | "min" | "max" | "notOption" | "pattern" | "dateNotFuture" | "dateNotPast" | "tooManyFiles";
2197
2222
  /** One per-field validation error of a rejected submit (`be.forms.validationFailed`). */
2198
2223
  interface StorefrontFormFieldError {
2199
2224
  key: string;
@@ -3062,6 +3087,13 @@ declare class BehioStorefront {
3062
3087
  * @internal — use the typed module methods (behio.certificates.downloadPdf).
3063
3088
  */
3064
3089
  requestBlob(path: string): Promise<SdkResult<Blob>>;
3090
+ /**
3091
+ * PUT of a file body to a presigned storage URL (form attachments). No API
3092
+ * key and no JSON: the URL itself carries the permission and the exact size.
3093
+ *
3094
+ * @internal — use behio.forms.uploadFile.
3095
+ */
3096
+ putToPresignedUrl(url: string, body: Blob, contentType: string): Promise<SdkResult<true>>;
3065
3097
  /**
3066
3098
  * Throws on failure (API error / network / timeout). Kept private so
3067
3099
  * internal auth refresh recursion keeps its existing control flow —
@@ -3578,6 +3610,17 @@ declare class FormsModule {
3578
3610
  * `be.forms.formNotFound`; rate limit 10 submits per minute per visitor.
3579
3611
  */
3580
3612
  submit(slug: string, input: StorefrontFormSubmitInput): Promise<SdkResult<StorefrontFormSubmitResult>>;
3613
+ /**
3614
+ * Upload one file for a `file` field, straight from the browser to storage
3615
+ * (it never passes through the API, so large files are fine: up to
3616
+ * `field.maxSizeMb`, at most 500 MB). Three steps in one call: a presigned
3617
+ * PUT URL for this exact size, the PUT itself, and a confirm where the API
3618
+ * checks the real size and the type from the file content (images, PDF,
3619
+ * Office; never SVG or HTML). Send the returned `id` in `data[fieldKey]`.
3620
+ * Errors: `be.forms.fileTypeNotAllowed`, `be.forms.fileTooLarge`
3621
+ * (params.maxMb), `be.forms.fileRateLimited`, `be.forms.fileUploadIncomplete`.
3622
+ */
3623
+ uploadFile(slug: string, fieldKey: string, file: Blob, fileName?: string): Promise<SdkResult<StorefrontFormFile>>;
3581
3624
  }
3582
3625
  declare class WishlistModule {
3583
3626
  private client;
package/dist/react.js CHANGED
@@ -598,6 +598,21 @@ var BehioStorefront = class {
598
598
  return { data: null, error: toSdkError(err) };
599
599
  }
600
600
  }
601
+ /**
602
+ * PUT of a file body to a presigned storage URL (form attachments). No API
603
+ * key and no JSON: the URL itself carries the permission and the exact size.
604
+ *
605
+ * @internal — use behio.forms.uploadFile.
606
+ */
607
+ async putToPresignedUrl(url, body, contentType) {
608
+ try {
609
+ const res = await this.fetchFn(url, { method: "PUT", headers: { "Content-Type": contentType }, body });
610
+ if (!res.ok) throw new BehioApiError(res.status, { code: "be.forms.fileUploadIncomplete" });
611
+ return ok(true);
612
+ } catch (err) {
613
+ return { data: null, error: toSdkError(err) };
614
+ }
615
+ }
601
616
  /**
602
617
  * Throws on failure (API error / network / timeout). Kept private so
603
618
  * internal auth refresh recursion keeps its existing control flow —
@@ -1829,6 +1844,33 @@ var FormsModule = class {
1829
1844
  { body: input, auth: false }
1830
1845
  );
1831
1846
  }
1847
+ /**
1848
+ * Upload one file for a `file` field, straight from the browser to storage
1849
+ * (it never passes through the API, so large files are fine: up to
1850
+ * `field.maxSizeMb`, at most 500 MB). Three steps in one call: a presigned
1851
+ * PUT URL for this exact size, the PUT itself, and a confirm where the API
1852
+ * checks the real size and the type from the file content (images, PDF,
1853
+ * Office; never SVG or HTML). Send the returned `id` in `data[fieldKey]`.
1854
+ * Errors: `be.forms.fileTypeNotAllowed`, `be.forms.fileTooLarge`
1855
+ * (params.maxMb), `be.forms.fileRateLimited`, `be.forms.fileUploadIncomplete`.
1856
+ */
1857
+ async uploadFile(slug, fieldKey, file, fileName) {
1858
+ const name = fileName ?? file.name ?? "file";
1859
+ const contentType = file.type || "application/octet-stream";
1860
+ const start = await this.client.request(
1861
+ "POST",
1862
+ `/forms/${encodeURIComponent(slug)}/files/upload-url`,
1863
+ { body: { field: fieldKey, fileName: name, contentType, size: file.size }, auth: false }
1864
+ );
1865
+ if (start.error) return { data: null, error: start.error };
1866
+ const put = await this.client.putToPresignedUrl(start.data.uploadUrl, file, start.data.contentType);
1867
+ if (put.error) return { data: null, error: put.error };
1868
+ return this.client.request(
1869
+ "POST",
1870
+ `/forms/${encodeURIComponent(slug)}/files/${encodeURIComponent(start.data.id)}/confirm`,
1871
+ { auth: false }
1872
+ );
1873
+ }
1832
1874
  };
1833
1875
  var WishlistModule = class {
1834
1876
  constructor(client) {
package/dist/react.mjs CHANGED
@@ -488,6 +488,21 @@ var BehioStorefront = class {
488
488
  return { data: null, error: toSdkError(err) };
489
489
  }
490
490
  }
491
+ /**
492
+ * PUT of a file body to a presigned storage URL (form attachments). No API
493
+ * key and no JSON: the URL itself carries the permission and the exact size.
494
+ *
495
+ * @internal — use behio.forms.uploadFile.
496
+ */
497
+ async putToPresignedUrl(url, body, contentType) {
498
+ try {
499
+ const res = await this.fetchFn(url, { method: "PUT", headers: { "Content-Type": contentType }, body });
500
+ if (!res.ok) throw new BehioApiError(res.status, { code: "be.forms.fileUploadIncomplete" });
501
+ return ok(true);
502
+ } catch (err) {
503
+ return { data: null, error: toSdkError(err) };
504
+ }
505
+ }
491
506
  /**
492
507
  * Throws on failure (API error / network / timeout). Kept private so
493
508
  * internal auth refresh recursion keeps its existing control flow —
@@ -1719,6 +1734,33 @@ var FormsModule = class {
1719
1734
  { body: input, auth: false }
1720
1735
  );
1721
1736
  }
1737
+ /**
1738
+ * Upload one file for a `file` field, straight from the browser to storage
1739
+ * (it never passes through the API, so large files are fine: up to
1740
+ * `field.maxSizeMb`, at most 500 MB). Three steps in one call: a presigned
1741
+ * PUT URL for this exact size, the PUT itself, and a confirm where the API
1742
+ * checks the real size and the type from the file content (images, PDF,
1743
+ * Office; never SVG or HTML). Send the returned `id` in `data[fieldKey]`.
1744
+ * Errors: `be.forms.fileTypeNotAllowed`, `be.forms.fileTooLarge`
1745
+ * (params.maxMb), `be.forms.fileRateLimited`, `be.forms.fileUploadIncomplete`.
1746
+ */
1747
+ async uploadFile(slug, fieldKey, file, fileName) {
1748
+ const name = fileName ?? file.name ?? "file";
1749
+ const contentType = file.type || "application/octet-stream";
1750
+ const start = await this.client.request(
1751
+ "POST",
1752
+ `/forms/${encodeURIComponent(slug)}/files/upload-url`,
1753
+ { body: { field: fieldKey, fileName: name, contentType, size: file.size }, auth: false }
1754
+ );
1755
+ if (start.error) return { data: null, error: start.error };
1756
+ const put = await this.client.putToPresignedUrl(start.data.uploadUrl, file, start.data.contentType);
1757
+ if (put.error) return { data: null, error: put.error };
1758
+ return this.client.request(
1759
+ "POST",
1760
+ `/forms/${encodeURIComponent(slug)}/files/${encodeURIComponent(start.data.id)}/confirm`,
1761
+ { auth: false }
1762
+ );
1763
+ }
1722
1764
  };
1723
1765
  var WishlistModule = class {
1724
1766
  constructor(client) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@behio/storefront-sdk",
3
- "version": "2.0.3",
3
+ "version": "2.1.0",
4
4
  "description": "TypeScript SDK for Behio headless e-commerce: core client + React hooks",
5
5
  "author": "Behio",
6
6
  "license": "MIT",