@behio/storefront-sdk 0.38.0 → 0.41.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.
@@ -339,6 +339,31 @@ interface ProductListItem {
339
339
  /** `null` when prices are gated behind login for guests (B2B mode). */
340
340
  price: ProductPrice | null;
341
341
  inStock: boolean;
342
+ /**
343
+ * Launch okno: sale window opens at this time (epoch ms); null/undefined =
344
+ * on sale since publish. Before it the product is visible but NOT
345
+ * purchasable — render a "Prodej startuje za ..." countdown instead of the
346
+ * buy button.
347
+ */
348
+ saleStartAt?: number | null;
349
+ /** Sale window closes at this time (epoch ms); null/undefined = never closes. */
350
+ saleEndAt?: number | null;
351
+ /**
352
+ * Server-resolved "can this be bought RIGHT NOW": the sale window is open
353
+ * AND the product can be ordered (in stock, or the shop sells beyond
354
+ * stock). The cart/checkout enforce the same rule server-side — use this to
355
+ * disable the buy button, never re-derive the rule client-side.
356
+ */
357
+ isPurchasable: boolean;
358
+ /**
359
+ * Early bird (time-based launch price) is active: `price.amount` already IS
360
+ * the discounted early-bird amount and the regular price sits in
361
+ * `price.compareAtPrice`. Applies in the eshop default currency only.
362
+ */
363
+ earlyBirdActive: boolean;
364
+ /** When the active early bird ends (epoch ms) — render "Early bird do ...".
365
+ * Null when no early bird is active. */
366
+ earlyBirdUntil?: number | null;
342
367
  /** Exact remaining stock, or `null` when the merchant hides the count
343
368
  * (showStockCount off) — treat null as "unknown", never as 0. */
344
369
  stockQuantity?: number | null;
@@ -404,7 +429,7 @@ interface ProductPromotionSummary {
404
429
  badgeText: string | null;
405
430
  /** Merchant hex badge color; null falls back to the shop's sale color. */
406
431
  badgeColor: string | null;
407
- discountType: 'PERCENTAGE' | 'FIXED_AMOUNT' | 'BUY_X_GET_Y';
432
+ discountType: "PERCENTAGE" | "FIXED_AMOUNT" | "BUY_X_GET_Y";
408
433
  discountValue: number;
409
434
  /** Promotion end (epoch ms), or null for open-ended. */
410
435
  endsAt: number | null;
@@ -413,8 +438,8 @@ interface ProductPromotionSummary {
413
438
  }
414
439
  /** A single responsive derivative (size + format) of a media image. */
415
440
  interface ProductMediaVariant {
416
- variant: 'thumb' | 'medium' | 'large' | 'xlarge';
417
- format: 'jpeg' | 'webp' | 'avif';
441
+ variant: "thumb" | "medium" | "large" | "xlarge";
442
+ format: "jpeg" | "webp" | "avif";
418
443
  url: string;
419
444
  width: number;
420
445
  height: number;
@@ -427,7 +452,7 @@ interface ProductMediaVariant {
427
452
  */
428
453
  interface ProductMedia {
429
454
  id: string;
430
- type: 'IMAGE' | 'VIDEO';
455
+ type: "IMAGE" | "VIDEO";
431
456
  /** Original uploaded file URL. */
432
457
  url: string;
433
458
  alt?: string | null;
@@ -452,7 +477,7 @@ interface VariantAxisValue {
452
477
  */
453
478
  interface VariantAxis {
454
479
  name: string;
455
- displayType: 'DROPDOWN' | 'BUTTON' | 'SWATCH_COLOR' | 'SWATCH_IMAGE';
480
+ displayType: "DROPDOWN" | "BUTTON" | "SWATCH_COLOR" | "SWATCH_IMAGE";
456
481
  order: number;
457
482
  /** Values present among the purchasable variants, in admin-defined order. */
458
483
  values: VariantAxisValue[];
@@ -1122,6 +1147,11 @@ interface CourseListItem {
1122
1147
  /** Access expiry (epoch ms, null = never expires). */
1123
1148
  expiresAt: number | null;
1124
1149
  isExpired: boolean;
1150
+ /**
1151
+ * Course content opens at this time (epoch ms); null/undefined = already
1152
+ * open. While in the future, render "Startujeme ..." + countdown.
1153
+ */
1154
+ contentAvailableFrom?: number | null;
1125
1155
  }
1126
1156
  /** Downloadable attachment on a course lesson. */
1127
1157
  interface CourseAttachment {
@@ -1145,6 +1175,11 @@ interface CourseLesson {
1145
1175
  videoUrl: string | null;
1146
1176
  content: string | null;
1147
1177
  attachments: CourseAttachment[];
1178
+ /**
1179
+ * Number of quiz questions on this lesson (0 = no quiz). Load the quiz via
1180
+ * `customer.getLessonQuiz()` once the lesson is unlocked.
1181
+ */
1182
+ quizQuestionCount: number;
1148
1183
  }
1149
1184
  interface CourseModule {
1150
1185
  id: string;
@@ -1159,11 +1194,37 @@ interface CourseDetail {
1159
1194
  imageUrl: string | null;
1160
1195
  /** Welcome text shown at the top of the member area (markdown). */
1161
1196
  welcomeText: string | null;
1197
+ /**
1198
+ * AI tutor ("Ask about this lesson") is available on unlocked lessons —
1199
+ * render the tutor widget only when true.
1200
+ */
1201
+ aiTutorEnabled: boolean;
1202
+ /**
1203
+ * Lesson discussion (comments) is available on unlocked lessons — render
1204
+ * the discussion widget only when true.
1205
+ */
1206
+ discussionEnabled: boolean;
1207
+ /**
1208
+ * Course content opens at this time (epoch ms); null/undefined = already
1209
+ * open. While in the future EVERY lesson (including previews) is locked
1210
+ * with `unlockAt >= contentAvailableFrom` — render "Startujeme ..." +
1211
+ * countdown in the member area.
1212
+ */
1213
+ contentAvailableFrom?: number | null;
1162
1214
  enrolledAt: number;
1163
1215
  expiresAt: number | null;
1164
1216
  totalLessons: number;
1165
1217
  completedLessons: number;
1166
1218
  modules: CourseModule[];
1219
+ /**
1220
+ * Completion certificate, present once the course is 100 % finished and the
1221
+ * merchant has certificates enabled. Verify the code publicly via
1222
+ * `certificates.verify(code)`.
1223
+ */
1224
+ certificate?: {
1225
+ code: string;
1226
+ issuedAt: number;
1227
+ } | null;
1167
1228
  }
1168
1229
  /** Progress snapshot returned after completing a lesson. */
1169
1230
  interface CourseProgress {
@@ -1172,6 +1233,142 @@ interface CourseProgress {
1172
1233
  totalLessons: number;
1173
1234
  completedLessons: number;
1174
1235
  }
1236
+ /** One quiz question. Correct answers are never exposed before submitting. */
1237
+ interface QuizQuestion {
1238
+ id: string;
1239
+ question: string;
1240
+ /** Option texts in order; submit the chosen option's index. */
1241
+ options: string[];
1242
+ }
1243
+ interface LessonQuiz {
1244
+ courseId: string;
1245
+ lessonId: string;
1246
+ /** Minimum score (in %) that completes the lesson automatically. */
1247
+ passPercent: number;
1248
+ questions: QuizQuestion[];
1249
+ }
1250
+ interface QuizAnswerInput {
1251
+ questionId: string;
1252
+ /** Index of the chosen option (0-based). */
1253
+ selectedIndex: number;
1254
+ }
1255
+ interface QuizAnswerResult {
1256
+ questionId: string;
1257
+ /** Echo of the submitted choice; null when unanswered or out of range. */
1258
+ selectedIndex: number | null;
1259
+ /** Correct option index, revealed only after submitting. */
1260
+ correctIndex: number;
1261
+ correct: boolean;
1262
+ }
1263
+ interface QuizResult {
1264
+ courseId: string;
1265
+ lessonId: string;
1266
+ totalQuestions: number;
1267
+ correctCount: number;
1268
+ scorePercent: number;
1269
+ passPercent: number;
1270
+ passed: boolean;
1271
+ /** True when the passing score marked the lesson completed. */
1272
+ lessonCompleted: boolean;
1273
+ results: QuizAnswerResult[];
1274
+ /** Course progress after a passing submit; null when not passed. */
1275
+ progress: {
1276
+ totalLessons: number;
1277
+ completedLessons: number;
1278
+ } | null;
1279
+ }
1280
+ /** One exchange in the private AI tutor thread: question + answer. */
1281
+ interface CourseTutorMessage {
1282
+ id: string;
1283
+ /** The student's question. */
1284
+ question: string;
1285
+ /** The AI tutor's answer (plain text / light markdown). */
1286
+ answer: string;
1287
+ createdAt: number;
1288
+ }
1289
+ /** The student's private tutor thread for one lesson. */
1290
+ interface CourseTutorThread {
1291
+ courseId: string;
1292
+ lessonId: string;
1293
+ /** False when the merchant disabled the AI tutor — hide the widget. */
1294
+ enabled: boolean;
1295
+ /** Oldest first. */
1296
+ items: CourseTutorMessage[];
1297
+ }
1298
+ /** A one-level reply under a top-level lesson comment. */
1299
+ interface CourseCommentReply {
1300
+ id: string;
1301
+ /** Id of the parent (top-level) comment. */
1302
+ parentId: string;
1303
+ body: string;
1304
+ /** Author's first name, or a masked e-mail when no name is known. */
1305
+ authorName: string;
1306
+ /** True when the logged-in customer wrote this reply (can delete it). */
1307
+ isMine: boolean;
1308
+ createdAt: number;
1309
+ }
1310
+ /** A top-level comment under a lesson, with one level of replies. */
1311
+ interface CourseComment {
1312
+ id: string;
1313
+ body: string;
1314
+ /** Author's first name, or a masked e-mail when no name is known. */
1315
+ authorName: string;
1316
+ /** True when the logged-in customer wrote this comment (can delete it). */
1317
+ isMine: boolean;
1318
+ createdAt: number;
1319
+ /** Oldest first. */
1320
+ replies: CourseCommentReply[];
1321
+ }
1322
+ /** Paginated lesson discussion (top-level comments, newest first). */
1323
+ interface CourseCommentsList {
1324
+ courseId: string;
1325
+ lessonId: string;
1326
+ /** False when the merchant disabled the discussion — hide the widget. */
1327
+ enabled: boolean;
1328
+ /** 1-based page of top-level comments. */
1329
+ page: number;
1330
+ pageSize: number;
1331
+ /** Total count of top-level comments on the lesson. */
1332
+ totalCount: number;
1333
+ items: CourseComment[];
1334
+ }
1335
+ /** The comment (or reply) just posted by the logged-in customer. */
1336
+ interface CoursePostedComment {
1337
+ id: string;
1338
+ /** Id of the parent comment when this is a reply; null for top-level. */
1339
+ parentId?: string | null;
1340
+ body: string;
1341
+ authorName: string;
1342
+ isMine: boolean;
1343
+ createdAt: number;
1344
+ }
1345
+ /** The student's private note for one lesson (visible only to them). */
1346
+ interface LessonNote {
1347
+ courseId: string;
1348
+ lessonId: string;
1349
+ /** The note text; empty string when no note exists yet. */
1350
+ body: string;
1351
+ /** Last save time (epoch ms); null when no note exists yet. */
1352
+ updatedAt: number | null;
1353
+ }
1354
+ /** One completion certificate on the customer's account. */
1355
+ interface CourseCertificate {
1356
+ courseId: string;
1357
+ courseName: string | null;
1358
+ /** Public verification code (share it, verify via `certificates.verify`). */
1359
+ code: string;
1360
+ issuedAt: number;
1361
+ }
1362
+ /** Public verification payload for a certificate code. */
1363
+ interface CertificateVerification {
1364
+ valid: boolean;
1365
+ code: string;
1366
+ courseId: string;
1367
+ courseName: string | null;
1368
+ /** Student's name, or a masked e-mail when no name is known. */
1369
+ studentName: string;
1370
+ issuedAt: number;
1371
+ }
1175
1372
  /** Short-lived signed URL to fetch a purchased digital file. */
1176
1373
  interface DownloadUrl {
1177
1374
  /** Short-lived (15 min) signed URL. */
@@ -1876,6 +2073,7 @@ declare class BehioStorefront {
1876
2073
  readonly shipping: ShippingModule;
1877
2074
  readonly newsletter: NewsletterModule;
1878
2075
  readonly subscriptions: SubscriptionsModule;
2076
+ readonly certificates: CourseCertificatesModule;
1879
2077
  /**
1880
2078
  * Called by the analytics tracker when the visitor grants (id) or revokes
1881
2079
  * (null) analytics consent. When set, requests carry the X-Behio-Vid header
@@ -2006,6 +2204,13 @@ declare class BehioStorefront {
2006
2204
  signal?: AbortSignal;
2007
2205
  headers?: Record<string, string>;
2008
2206
  }): Promise<SdkResult<T>>;
2207
+ /**
2208
+ * Binary GET (PDF downloads). Same auth headers as `request()`, but the
2209
+ * response is returned as a Blob instead of parsed JSON.
2210
+ *
2211
+ * @internal — use the typed module methods (behio.certificates.downloadPdf).
2212
+ */
2213
+ requestBlob(path: string): Promise<SdkResult<Blob>>;
2009
2214
  /**
2010
2215
  * Throws on failure (API error / network / timeout). Kept private so
2011
2216
  * internal auth refresh recursion keeps its existing control flow —
@@ -2298,6 +2503,77 @@ declare class CustomerModule {
2298
2503
  getCourse(courseId: string): Promise<SdkResult<CourseDetail>>;
2299
2504
  /** Mark an unlocked lesson as completed (idempotent). */
2300
2505
  completeLesson(courseId: string, lessonId: string): Promise<SdkResult<CourseProgress>>;
2506
+ /**
2507
+ * Quiz for an unlocked lesson. Correct answers are never included — scoring
2508
+ * happens server-side in `submitLessonQuiz`. Locked lessons return 403.
2509
+ */
2510
+ getLessonQuiz(courseId: string, lessonId: string): Promise<SdkResult<LessonQuiz>>;
2511
+ /**
2512
+ * Submit quiz answers: returns the score, reveals correct answers and, when
2513
+ * the score reaches `passPercent` (70 %), marks the lesson completed
2514
+ * automatically.
2515
+ */
2516
+ submitLessonQuiz(courseId: string, lessonId: string, answers: QuizAnswerInput[]): Promise<SdkResult<QuizResult>>;
2517
+ /**
2518
+ * Completion certificates of the logged-in customer. Each carries a public
2519
+ * verification code for sharing (LinkedIn, CV).
2520
+ */
2521
+ getCourseCertificates(): Promise<SdkResult<{
2522
+ items: CourseCertificate[];
2523
+ }>>;
2524
+ /**
2525
+ * AI tutor "Ask about this lesson": the student's private thread for one
2526
+ * lesson (oldest first). `enabled: false` = the merchant turned the tutor
2527
+ * off — hide the widget. Locked lessons return 403.
2528
+ */
2529
+ getLessonTutorThread(courseId: string, lessonId: string): Promise<SdkResult<CourseTutorThread>>;
2530
+ /**
2531
+ * Ask the AI tutor a question about the lesson. The answer sticks to the
2532
+ * lesson topic and comes back in the language of the question (Czech by
2533
+ * default). Rate limited (20/min); 403 on locked lessons or when the
2534
+ * merchant disabled the tutor.
2535
+ */
2536
+ askLessonTutor(courseId: string, lessonId: string, question: string): Promise<SdkResult<CourseTutorMessage>>;
2537
+ /**
2538
+ * Lesson discussion: paginated top-level comments (newest first) with one
2539
+ * level of replies. Only enrolled customers with the lesson unlocked; 403
2540
+ * when the merchant disabled the discussion.
2541
+ */
2542
+ getLessonComments(courseId: string, lessonId: string, page?: number): Promise<SdkResult<CourseCommentsList>>;
2543
+ /**
2544
+ * Post a comment under the lesson, or a reply when `parentId` points to a
2545
+ * top-level comment (replies go one level deep only). Max 5000 characters.
2546
+ */
2547
+ postLessonComment(courseId: string, lessonId: string, body: string, parentId?: string): Promise<SdkResult<CoursePostedComment>>;
2548
+ /**
2549
+ * Delete the customer's OWN comment (including its replies). Someone
2550
+ * else's comment returns 404.
2551
+ */
2552
+ deleteLessonComment(courseId: string, lessonId: string, commentId: string): Promise<SdkResult<void>>;
2553
+ /**
2554
+ * The student's private note for one lesson. `body` is an empty string
2555
+ * when no note exists yet. Visible only to the logged-in student.
2556
+ */
2557
+ getLessonNote(courseId: string, lessonId: string): Promise<SdkResult<LessonNote>>;
2558
+ /**
2559
+ * Save (upsert) the student's private lesson note. Autosave-friendly; an
2560
+ * empty string clears the note. Max 20 000 characters.
2561
+ */
2562
+ saveLessonNote(courseId: string, lessonId: string, body: string): Promise<SdkResult<LessonNote>>;
2563
+ }
2564
+ declare class CourseCertificatesModule {
2565
+ private client;
2566
+ constructor(client: BehioStorefront);
2567
+ /**
2568
+ * Publicly verify a certificate code (no customer login needed) — build a
2569
+ * `/certifikat/{code}` page with this. Unknown codes return a 404 error.
2570
+ */
2571
+ verify(code: string): Promise<SdkResult<CertificateVerification>>;
2572
+ /**
2573
+ * Download the certificate as a branded PDF (A5 landscape). Returns a Blob;
2574
+ * trigger a browser download via `URL.createObjectURL(blob)`.
2575
+ */
2576
+ downloadPdf(code: string): Promise<SdkResult<Blob>>;
2301
2577
  }
2302
2578
  declare class PagesModule {
2303
2579
  private client;
@@ -2488,4 +2764,4 @@ declare class NewsletterModule {
2488
2764
  unsubscribe(email: string): Promise<SdkResult<NewsletterUnsubscribeResult>>;
2489
2765
  }
2490
2766
 
2491
- export { type ReturnRequest as $, type AddressSuggestion as A, type BehioStorefrontConfig as B, type Category as C, type CheckoutInput as D, type PageDetail as E, type FilterField as F, type Page as G, type ShopInfo as H, type ShopScripts as I, type ShopSeo as J, type Bundle as K, type LoyaltySummary as L, type Menu as M, type NewsletterSubscribeResult as N, type OrderListItem as O, type ProductsQuery as P, type ProductGroup as Q, type RegisterInput as R, type Subscription as S, type CrossSellItem as T, type ActivePromotion as U, type GiftCardBalance as V, type WishlistItem as W, type ProductReviewsResponse as X, type SubmitReviewInput as Y, type ReturnableOrder as Z, type ReturnStatus as _, BehioStorefront as a, type OrderStatusHistory as a$, type SubmitReturnInput as a0, type CookieConsent as a1, type CookieConsentInput as a2, type QuoteRequest as a3, type SubmitQuoteInput as a4, type BackInStockSubscription as a5, type AddToCartInput as a6, type AuthTokens as a7, BehioApiError as a8, type BundleItem as a9, type CourseLesson as aA, type CourseModule as aB, type DataGroupFieldType as aC, type DigitalDownload as aD, type DownloadUrl as aE, type Facet as aF, type FacetAvailability as aG, type FacetCategory as aH, type FacetLabel as aI, type FacetPriceRange as aJ, type FacetRange as aK, type FacetRatingBucket as aL, type FacetValue as aM, FulfillmentStatuses as aN, type GiftCardPurchaseInput as aO, type GiftCardPurchaseResult as aP, type GiftCardSummary as aQ, type LoyaltyBalance as aR, type LoyaltyNextTier as aS, type LoyaltyProgram as aT, type LoyaltyTier as aU, type LoyaltyTierPerks as aV, type LoyaltyTransaction as aW, type MenuItem as aX, type MenuItemRef as aY, type MenuItemType as aZ, type NewsletterOptInDefault as a_, type CartDiscount as aa, type CartItem as ab, type CheckoutAddress as ac, type FulfillmentStatus as ad, type LoginInput as ae, type MessageResponse as af, type OrderItem as ag, type OrderStatus as ah, type PaymentStatus as ai, type ProductPrice as aj, type ProductReview as ak, type ProductVariant as al, type SdkResult as am, type AddressType as an, AddressTypes as ao, type BadgeTone as ap, type BehioErrorCode as aq, type BehioEventHandler as ar, type BehioEventType as as, BehioNetworkError as at, type CartBundleLine as au, type CartBundleLineItem as av, type CartItemProduct as aw, type CartPromotion as ax, type CheckoutSettings as ay, type CourseAttachment as az, type PaginatedResponse as b, OrderStatuses as b0, type OrderTracking as b1, type PageAttachment as b2, PaymentStatuses as b3, type PickupPointHours as b4, type PriceDisplay as b5, type ProductAvailability as b6, type ProductCustomField as b7, type ProductCustomFieldGroup as b8, type ProductMedia as b9, type VariantAxisValue as bA, err as bB, ok as bC, toSdkError as bD, type ProductMediaVariant as ba, type ProductPromotionSummary as bb, ProductSort as bc, type ProductSortValue as bd, type ProductVolumePrice as be, type QuoteItem as bf, type RegisterResult as bg, type RequestInterceptor as bh, type RequestInterceptorConfig as bi, type ResponseInterceptor as bj, type ResponseInterceptorData as bk, type ReturnRequestItem as bl, type ReturnStatusItem as bm, type ReturnableOrderItem as bn, type SdkError as bo, type ShopScript as bp, type ShopScriptPlacement as bq, type ShopScriptType as br, type ShopSeoIdentity as bs, type StockBehavior as bt, type StockMode as bu, type SubscriptionFrequency as bv, type SubscriptionItem as bw, type SubscriptionStatus as bx, type TaxBreakdownLine as by, type VariantAxis as bz, type ProductListItem as c, type ProductDetail as d, type CategoryDetail as e, type ProductLabel as f, type FacetsResponse as g, type Cart as h, type CustomerProfile as i, type CustomerAddress as j, type AddressDetail as k, type CourseDetail as l, type CourseProgress as m, type CourseListItem as n, type SubscriptionAction as o, type PickupPointsInput as p, type PickupPoint as q, type ShippingMethodSummary as r, type ShippingQuoteInput as s, type ShippingQuote as t, type CheckoutPaymentMethod as u, type NewsletterSubscribeInput as v, type NewsletterUnsubscribeResult as w, type OrderDetail as x, type OrderAccessRequestResponse as y, type OrderAccessVerifyResponse as z };
2767
+ export { type DownloadUrl as $, type ActivePromotion as A, BehioStorefront as B, type CookieConsent as C, type CheckoutAddress as D, type CheckoutInput as E, type CheckoutPaymentMethod as F, type CheckoutSettings as G, type CookieConsentInput as H, type CourseAttachment as I, type CourseCertificate as J, type CourseComment as K, type CourseCommentReply as L, type CourseCommentsList as M, type CourseDetail as N, type CourseLesson as O, type CourseListItem as P, type CourseModule as Q, type CoursePostedComment as R, type SdkResult as S, type CourseProgress as T, type CourseTutorMessage as U, type CourseTutorThread as V, type CrossSellItem as W, type CustomerAddress as X, type CustomerProfile as Y, type DataGroupFieldType as Z, type DigitalDownload as _, type AddToCartInput as a, type ProductPrice as a$, type Facet as a0, type FacetAvailability as a1, type FacetCategory as a2, type FacetLabel as a3, type FacetPriceRange as a4, type FacetRange as a5, type FacetRatingBucket as a6, type FacetValue as a7, type FacetsResponse as a8, type FilterField as a9, type OrderAccessVerifyResponse as aA, type OrderDetail as aB, type OrderItem as aC, type OrderListItem as aD, type OrderStatus as aE, type OrderStatusHistory as aF, OrderStatuses as aG, type OrderTracking as aH, type Page as aI, type PageAttachment as aJ, type PageDetail as aK, type PaginatedResponse as aL, type PaymentStatus as aM, PaymentStatuses as aN, type PickupPoint as aO, type PickupPointHours as aP, type PickupPointsInput as aQ, type PriceDisplay as aR, type ProductAvailability as aS, type ProductCustomField as aT, type ProductCustomFieldGroup as aU, type ProductDetail as aV, type ProductGroup as aW, type ProductLabel as aX, type ProductListItem as aY, type ProductMedia as aZ, type ProductMediaVariant as a_, type FulfillmentStatus as aa, FulfillmentStatuses as ab, type GiftCardBalance as ac, type GiftCardPurchaseInput as ad, type GiftCardPurchaseResult as ae, type GiftCardSummary as af, type LessonNote as ag, type LessonQuiz as ah, type LoginInput as ai, type LoyaltyBalance as aj, type LoyaltyNextTier as ak, type LoyaltyProgram as al, type LoyaltySummary as am, type LoyaltyTier as an, type LoyaltyTierPerks as ao, type LoyaltyTransaction as ap, type Menu as aq, type MenuItem as ar, type MenuItemRef as as, type MenuItemType as at, type MessageResponse as au, type NewsletterOptInDefault as av, type NewsletterSubscribeInput as aw, type NewsletterSubscribeResult as ax, type NewsletterUnsubscribeResult as ay, type OrderAccessRequestResponse as az, type AddressDetail as b, type ProductPromotionSummary as b0, type ProductReview as b1, type ProductReviewsResponse as b2, ProductSort as b3, type ProductSortValue as b4, type ProductVariant as b5, type ProductVolumePrice as b6, type ProductsQuery as b7, type QuizAnswerInput as b8, type QuizAnswerResult as b9, type ShopSeoIdentity as bA, type StockBehavior as bB, type StockMode as bC, type SubmitQuoteInput as bD, type SubmitReturnInput as bE, type SubmitReviewInput as bF, type Subscription as bG, type SubscriptionAction as bH, type SubscriptionFrequency as bI, type SubscriptionItem as bJ, type SubscriptionStatus as bK, type TaxBreakdownLine as bL, type VariantAxis as bM, type VariantAxisValue as bN, type WishlistItem as bO, err as bP, ok as bQ, toSdkError as bR, type QuizQuestion as ba, type QuizResult as bb, type QuoteItem as bc, type QuoteRequest as bd, type RegisterInput as be, type RegisterResult as bf, type RequestInterceptor as bg, type RequestInterceptorConfig as bh, type ResponseInterceptor as bi, type ResponseInterceptorData as bj, type ReturnRequest as bk, type ReturnRequestItem as bl, type ReturnStatus as bm, type ReturnStatusItem as bn, type ReturnableOrder as bo, type ReturnableOrderItem as bp, type SdkError as bq, type ShippingMethodSummary as br, type ShippingQuote as bs, type ShippingQuoteInput as bt, type ShopInfo as bu, type ShopScript as bv, type ShopScriptPlacement as bw, type ShopScriptType as bx, type ShopScripts as by, type ShopSeo as bz, type AddressSuggestion as c, type AddressType as d, AddressTypes as e, type AuthTokens as f, type BackInStockSubscription as g, type BadgeTone as h, BehioApiError as i, type BehioErrorCode as j, type BehioEventHandler as k, type BehioEventType as l, BehioNetworkError as m, type BehioStorefrontConfig as n, type Bundle as o, type BundleItem as p, type Cart as q, type CartBundleLine as r, type CartBundleLineItem as s, type CartDiscount as t, type CartItem as u, type CartItemProduct as v, type CartPromotion as w, type Category as x, type CategoryDetail as y, type CertificateVerification as z };
package/dist/index.d.mts CHANGED
@@ -1,5 +1,5 @@
1
- import { a as BehioStorefront, am as SdkResult, a1 as CookieConsent } from './client-Cb_eHKm9.mjs';
2
- export { U as ActivePromotion, a6 as AddToCartInput, k as AddressDetail, A as AddressSuggestion, an as AddressType, ao as AddressTypes, a7 as AuthTokens, a5 as BackInStockSubscription, ap as BadgeTone, a8 as BehioApiError, aq as BehioErrorCode, ar as BehioEventHandler, as as BehioEventType, at as BehioNetworkError, B as BehioStorefrontConfig, K as Bundle, a9 as BundleItem, h as Cart, au as CartBundleLine, av as CartBundleLineItem, aa as CartDiscount, ab as CartItem, aw as CartItemProduct, ax as CartPromotion, C as Category, e as CategoryDetail, ac as CheckoutAddress, D as CheckoutInput, u as CheckoutPaymentMethod, ay as CheckoutSettings, a2 as CookieConsentInput, az as CourseAttachment, l as CourseDetail, aA as CourseLesson, n as CourseListItem, aB as CourseModule, m as CourseProgress, T as CrossSellItem, j as CustomerAddress, i as CustomerProfile, aC as DataGroupFieldType, aD as DigitalDownload, aE as DownloadUrl, aF as Facet, aG as FacetAvailability, aH as FacetCategory, aI as FacetLabel, aJ as FacetPriceRange, aK as FacetRange, aL as FacetRatingBucket, aM as FacetValue, g as FacetsResponse, F as FilterField, ad as FulfillmentStatus, aN as FulfillmentStatuses, V as GiftCardBalance, aO as GiftCardPurchaseInput, aP as GiftCardPurchaseResult, aQ as GiftCardSummary, ae as LoginInput, aR as LoyaltyBalance, aS as LoyaltyNextTier, aT as LoyaltyProgram, L as LoyaltySummary, aU as LoyaltyTier, aV as LoyaltyTierPerks, aW as LoyaltyTransaction, M as Menu, aX as MenuItem, aY as MenuItemRef, aZ as MenuItemType, af as MessageResponse, a_ as NewsletterOptInDefault, v as NewsletterSubscribeInput, N as NewsletterSubscribeResult, w as NewsletterUnsubscribeResult, y as OrderAccessRequestResponse, z as OrderAccessVerifyResponse, x as OrderDetail, ag as OrderItem, O as OrderListItem, ah as OrderStatus, a$ as OrderStatusHistory, b0 as OrderStatuses, b1 as OrderTracking, G as Page, b2 as PageAttachment, E as PageDetail, b as PaginatedResponse, ai as PaymentStatus, b3 as PaymentStatuses, q as PickupPoint, b4 as PickupPointHours, p as PickupPointsInput, b5 as PriceDisplay, b6 as ProductAvailability, b7 as ProductCustomField, b8 as ProductCustomFieldGroup, d as ProductDetail, Q as ProductGroup, f as ProductLabel, c as ProductListItem, b9 as ProductMedia, ba as ProductMediaVariant, aj as ProductPrice, bb as ProductPromotionSummary, ak as ProductReview, X as ProductReviewsResponse, bc as ProductSort, bd as ProductSortValue, al as ProductVariant, be as ProductVolumePrice, P as ProductsQuery, bf as QuoteItem, a3 as QuoteRequest, R as RegisterInput, bg as RegisterResult, bh as RequestInterceptor, bi as RequestInterceptorConfig, bj as ResponseInterceptor, bk as ResponseInterceptorData, $ as ReturnRequest, bl as ReturnRequestItem, _ as ReturnStatus, bm as ReturnStatusItem, Z as ReturnableOrder, bn as ReturnableOrderItem, bo as SdkError, r as ShippingMethodSummary, t as ShippingQuote, s as ShippingQuoteInput, H as ShopInfo, bp as ShopScript, bq as ShopScriptPlacement, br as ShopScriptType, I as ShopScripts, J as ShopSeo, bs as ShopSeoIdentity, bt as StockBehavior, bu as StockMode, a4 as SubmitQuoteInput, a0 as SubmitReturnInput, Y as SubmitReviewInput, S as Subscription, o as SubscriptionAction, bv as SubscriptionFrequency, bw as SubscriptionItem, bx as SubscriptionStatus, by as TaxBreakdownLine, bz as VariantAxis, bA as VariantAxisValue, W as WishlistItem, bB as err, bC as ok, bD as toSdkError } from './client-Cb_eHKm9.mjs';
1
+ import { B as BehioStorefront, S as SdkResult, C as CookieConsent } from './client-sN7fZvjG.mjs';
2
+ export { A as ActivePromotion, a as AddToCartInput, b as AddressDetail, c as AddressSuggestion, d as AddressType, e as AddressTypes, f as AuthTokens, g as BackInStockSubscription, h as BadgeTone, i as BehioApiError, j as BehioErrorCode, k as BehioEventHandler, l as BehioEventType, m as BehioNetworkError, n as BehioStorefrontConfig, o as Bundle, p as BundleItem, q as Cart, r as CartBundleLine, s as CartBundleLineItem, t as CartDiscount, u as CartItem, v as CartItemProduct, w as CartPromotion, x as Category, y as CategoryDetail, z as CertificateVerification, D as CheckoutAddress, E as CheckoutInput, F as CheckoutPaymentMethod, G as CheckoutSettings, H as CookieConsentInput, I as CourseAttachment, J as CourseCertificate, K as CourseComment, L as CourseCommentReply, M as CourseCommentsList, N as CourseDetail, O as CourseLesson, P as CourseListItem, Q as CourseModule, R as CoursePostedComment, T as CourseProgress, U as CourseTutorMessage, V as CourseTutorThread, W as CrossSellItem, X as CustomerAddress, Y as CustomerProfile, Z as DataGroupFieldType, _ as DigitalDownload, $ as DownloadUrl, a0 as Facet, a1 as FacetAvailability, a2 as FacetCategory, a3 as FacetLabel, a4 as FacetPriceRange, a5 as FacetRange, a6 as FacetRatingBucket, a7 as FacetValue, a8 as FacetsResponse, a9 as FilterField, aa as FulfillmentStatus, ab as FulfillmentStatuses, ac as GiftCardBalance, ad as GiftCardPurchaseInput, ae as GiftCardPurchaseResult, af as GiftCardSummary, ag as LessonNote, ah as LessonQuiz, ai as LoginInput, aj as LoyaltyBalance, ak as LoyaltyNextTier, al as LoyaltyProgram, am as LoyaltySummary, an as LoyaltyTier, ao as LoyaltyTierPerks, ap as LoyaltyTransaction, aq as Menu, ar as MenuItem, as as MenuItemRef, at as MenuItemType, au as MessageResponse, av as NewsletterOptInDefault, aw as NewsletterSubscribeInput, ax as NewsletterSubscribeResult, ay as NewsletterUnsubscribeResult, az as OrderAccessRequestResponse, aA as OrderAccessVerifyResponse, aB as OrderDetail, aC as OrderItem, aD as OrderListItem, aE as OrderStatus, aF as OrderStatusHistory, aG as OrderStatuses, aH as OrderTracking, aI as Page, aJ as PageAttachment, aK as PageDetail, aL as PaginatedResponse, aM as PaymentStatus, aN as PaymentStatuses, aO as PickupPoint, aP as PickupPointHours, aQ as PickupPointsInput, aR as PriceDisplay, aS as ProductAvailability, aT as ProductCustomField, aU as ProductCustomFieldGroup, aV as ProductDetail, aW as ProductGroup, aX as ProductLabel, aY as ProductListItem, aZ as ProductMedia, a_ as ProductMediaVariant, a$ as ProductPrice, b0 as ProductPromotionSummary, b1 as ProductReview, b2 as ProductReviewsResponse, b3 as ProductSort, b4 as ProductSortValue, b5 as ProductVariant, b6 as ProductVolumePrice, b7 as ProductsQuery, b8 as QuizAnswerInput, b9 as QuizAnswerResult, ba as QuizQuestion, bb as QuizResult, bc as QuoteItem, bd as QuoteRequest, be as RegisterInput, bf as RegisterResult, bg as RequestInterceptor, bh as RequestInterceptorConfig, bi as ResponseInterceptor, bj as ResponseInterceptorData, bk as ReturnRequest, bl as ReturnRequestItem, bm as ReturnStatus, bn as ReturnStatusItem, bo as ReturnableOrder, bp as ReturnableOrderItem, bq as SdkError, br as ShippingMethodSummary, bs as ShippingQuote, bt as ShippingQuoteInput, bu as ShopInfo, bv as ShopScript, bw as ShopScriptPlacement, bx as ShopScriptType, by as ShopScripts, bz as ShopSeo, bA as ShopSeoIdentity, bB as StockBehavior, bC as StockMode, bD as SubmitQuoteInput, bE as SubmitReturnInput, bF as SubmitReviewInput, bG as Subscription, bH as SubscriptionAction, bI as SubscriptionFrequency, bJ as SubscriptionItem, bK as SubscriptionStatus, bL as TaxBreakdownLine, bM as VariantAxis, bN as VariantAxisValue, bO as WishlistItem, bP as err, bQ as ok, bR as toSdkError } from './client-sN7fZvjG.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 { a as BehioStorefront, am as SdkResult, a1 as CookieConsent } from './client-Cb_eHKm9.js';
2
- export { U as ActivePromotion, a6 as AddToCartInput, k as AddressDetail, A as AddressSuggestion, an as AddressType, ao as AddressTypes, a7 as AuthTokens, a5 as BackInStockSubscription, ap as BadgeTone, a8 as BehioApiError, aq as BehioErrorCode, ar as BehioEventHandler, as as BehioEventType, at as BehioNetworkError, B as BehioStorefrontConfig, K as Bundle, a9 as BundleItem, h as Cart, au as CartBundleLine, av as CartBundleLineItem, aa as CartDiscount, ab as CartItem, aw as CartItemProduct, ax as CartPromotion, C as Category, e as CategoryDetail, ac as CheckoutAddress, D as CheckoutInput, u as CheckoutPaymentMethod, ay as CheckoutSettings, a2 as CookieConsentInput, az as CourseAttachment, l as CourseDetail, aA as CourseLesson, n as CourseListItem, aB as CourseModule, m as CourseProgress, T as CrossSellItem, j as CustomerAddress, i as CustomerProfile, aC as DataGroupFieldType, aD as DigitalDownload, aE as DownloadUrl, aF as Facet, aG as FacetAvailability, aH as FacetCategory, aI as FacetLabel, aJ as FacetPriceRange, aK as FacetRange, aL as FacetRatingBucket, aM as FacetValue, g as FacetsResponse, F as FilterField, ad as FulfillmentStatus, aN as FulfillmentStatuses, V as GiftCardBalance, aO as GiftCardPurchaseInput, aP as GiftCardPurchaseResult, aQ as GiftCardSummary, ae as LoginInput, aR as LoyaltyBalance, aS as LoyaltyNextTier, aT as LoyaltyProgram, L as LoyaltySummary, aU as LoyaltyTier, aV as LoyaltyTierPerks, aW as LoyaltyTransaction, M as Menu, aX as MenuItem, aY as MenuItemRef, aZ as MenuItemType, af as MessageResponse, a_ as NewsletterOptInDefault, v as NewsletterSubscribeInput, N as NewsletterSubscribeResult, w as NewsletterUnsubscribeResult, y as OrderAccessRequestResponse, z as OrderAccessVerifyResponse, x as OrderDetail, ag as OrderItem, O as OrderListItem, ah as OrderStatus, a$ as OrderStatusHistory, b0 as OrderStatuses, b1 as OrderTracking, G as Page, b2 as PageAttachment, E as PageDetail, b as PaginatedResponse, ai as PaymentStatus, b3 as PaymentStatuses, q as PickupPoint, b4 as PickupPointHours, p as PickupPointsInput, b5 as PriceDisplay, b6 as ProductAvailability, b7 as ProductCustomField, b8 as ProductCustomFieldGroup, d as ProductDetail, Q as ProductGroup, f as ProductLabel, c as ProductListItem, b9 as ProductMedia, ba as ProductMediaVariant, aj as ProductPrice, bb as ProductPromotionSummary, ak as ProductReview, X as ProductReviewsResponse, bc as ProductSort, bd as ProductSortValue, al as ProductVariant, be as ProductVolumePrice, P as ProductsQuery, bf as QuoteItem, a3 as QuoteRequest, R as RegisterInput, bg as RegisterResult, bh as RequestInterceptor, bi as RequestInterceptorConfig, bj as ResponseInterceptor, bk as ResponseInterceptorData, $ as ReturnRequest, bl as ReturnRequestItem, _ as ReturnStatus, bm as ReturnStatusItem, Z as ReturnableOrder, bn as ReturnableOrderItem, bo as SdkError, r as ShippingMethodSummary, t as ShippingQuote, s as ShippingQuoteInput, H as ShopInfo, bp as ShopScript, bq as ShopScriptPlacement, br as ShopScriptType, I as ShopScripts, J as ShopSeo, bs as ShopSeoIdentity, bt as StockBehavior, bu as StockMode, a4 as SubmitQuoteInput, a0 as SubmitReturnInput, Y as SubmitReviewInput, S as Subscription, o as SubscriptionAction, bv as SubscriptionFrequency, bw as SubscriptionItem, bx as SubscriptionStatus, by as TaxBreakdownLine, bz as VariantAxis, bA as VariantAxisValue, W as WishlistItem, bB as err, bC as ok, bD as toSdkError } from './client-Cb_eHKm9.js';
1
+ import { B as BehioStorefront, S as SdkResult, C as CookieConsent } from './client-sN7fZvjG.js';
2
+ export { A as ActivePromotion, a as AddToCartInput, b as AddressDetail, c as AddressSuggestion, d as AddressType, e as AddressTypes, f as AuthTokens, g as BackInStockSubscription, h as BadgeTone, i as BehioApiError, j as BehioErrorCode, k as BehioEventHandler, l as BehioEventType, m as BehioNetworkError, n as BehioStorefrontConfig, o as Bundle, p as BundleItem, q as Cart, r as CartBundleLine, s as CartBundleLineItem, t as CartDiscount, u as CartItem, v as CartItemProduct, w as CartPromotion, x as Category, y as CategoryDetail, z as CertificateVerification, D as CheckoutAddress, E as CheckoutInput, F as CheckoutPaymentMethod, G as CheckoutSettings, H as CookieConsentInput, I as CourseAttachment, J as CourseCertificate, K as CourseComment, L as CourseCommentReply, M as CourseCommentsList, N as CourseDetail, O as CourseLesson, P as CourseListItem, Q as CourseModule, R as CoursePostedComment, T as CourseProgress, U as CourseTutorMessage, V as CourseTutorThread, W as CrossSellItem, X as CustomerAddress, Y as CustomerProfile, Z as DataGroupFieldType, _ as DigitalDownload, $ as DownloadUrl, a0 as Facet, a1 as FacetAvailability, a2 as FacetCategory, a3 as FacetLabel, a4 as FacetPriceRange, a5 as FacetRange, a6 as FacetRatingBucket, a7 as FacetValue, a8 as FacetsResponse, a9 as FilterField, aa as FulfillmentStatus, ab as FulfillmentStatuses, ac as GiftCardBalance, ad as GiftCardPurchaseInput, ae as GiftCardPurchaseResult, af as GiftCardSummary, ag as LessonNote, ah as LessonQuiz, ai as LoginInput, aj as LoyaltyBalance, ak as LoyaltyNextTier, al as LoyaltyProgram, am as LoyaltySummary, an as LoyaltyTier, ao as LoyaltyTierPerks, ap as LoyaltyTransaction, aq as Menu, ar as MenuItem, as as MenuItemRef, at as MenuItemType, au as MessageResponse, av as NewsletterOptInDefault, aw as NewsletterSubscribeInput, ax as NewsletterSubscribeResult, ay as NewsletterUnsubscribeResult, az as OrderAccessRequestResponse, aA as OrderAccessVerifyResponse, aB as OrderDetail, aC as OrderItem, aD as OrderListItem, aE as OrderStatus, aF as OrderStatusHistory, aG as OrderStatuses, aH as OrderTracking, aI as Page, aJ as PageAttachment, aK as PageDetail, aL as PaginatedResponse, aM as PaymentStatus, aN as PaymentStatuses, aO as PickupPoint, aP as PickupPointHours, aQ as PickupPointsInput, aR as PriceDisplay, aS as ProductAvailability, aT as ProductCustomField, aU as ProductCustomFieldGroup, aV as ProductDetail, aW as ProductGroup, aX as ProductLabel, aY as ProductListItem, aZ as ProductMedia, a_ as ProductMediaVariant, a$ as ProductPrice, b0 as ProductPromotionSummary, b1 as ProductReview, b2 as ProductReviewsResponse, b3 as ProductSort, b4 as ProductSortValue, b5 as ProductVariant, b6 as ProductVolumePrice, b7 as ProductsQuery, b8 as QuizAnswerInput, b9 as QuizAnswerResult, ba as QuizQuestion, bb as QuizResult, bc as QuoteItem, bd as QuoteRequest, be as RegisterInput, bf as RegisterResult, bg as RequestInterceptor, bh as RequestInterceptorConfig, bi as ResponseInterceptor, bj as ResponseInterceptorData, bk as ReturnRequest, bl as ReturnRequestItem, bm as ReturnStatus, bn as ReturnStatusItem, bo as ReturnableOrder, bp as ReturnableOrderItem, bq as SdkError, br as ShippingMethodSummary, bs as ShippingQuote, bt as ShippingQuoteInput, bu as ShopInfo, bv as ShopScript, bw as ShopScriptPlacement, bx as ShopScriptType, by as ShopScripts, bz as ShopSeo, bA as ShopSeoIdentity, bB as StockBehavior, bC as StockMode, bD as SubmitQuoteInput, bE as SubmitReturnInput, bF as SubmitReviewInput, bG as Subscription, bH as SubscriptionAction, bI as SubscriptionFrequency, bJ as SubscriptionItem, bK as SubscriptionStatus, bL as TaxBreakdownLine, bM as VariantAxis, bN as VariantAxisValue, bO as WishlistItem, bP as err, bQ as ok, bR as toSdkError } from './client-sN7fZvjG.js';
3
3
 
4
4
  /**
5
5
  * Format a price amount with currency using Intl.NumberFormat.
package/dist/index.js CHANGED
@@ -1,40 +1,142 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
-
3
-
4
-
5
-
6
-
7
-
8
- var _chunkCZRSJULDjs = require('./chunk-CZRSJULD.js');
9
-
10
-
11
-
12
-
13
-
14
-
15
-
16
-
17
-
18
-
19
-
20
-
21
- var _chunkFOUBL2EQjs = require('./chunk-FOUBL2EQ.js');
22
-
23
-
24
-
25
-
26
-
27
-
28
-
29
-
30
-
31
-
32
-
33
-
34
-
35
-
36
-
37
-
38
-
39
-
40
- exports.AddressTypes = _chunkFOUBL2EQjs.AddressTypes; exports.BehioApiError = _chunkFOUBL2EQjs.BehioApiError; exports.BehioNetworkError = _chunkFOUBL2EQjs.BehioNetworkError; exports.BehioStorefront = _chunkFOUBL2EQjs.BehioStorefront; exports.FulfillmentStatuses = _chunkFOUBL2EQjs.FulfillmentStatuses; exports.OrderStatuses = _chunkFOUBL2EQjs.OrderStatuses; exports.PaymentStatuses = _chunkFOUBL2EQjs.PaymentStatuses; exports.ProductSort = _chunkFOUBL2EQjs.ProductSort; exports.err = _chunkFOUBL2EQjs.err; exports.formatPrice = _chunkCZRSJULDjs.formatPrice; exports.generateVisitorId = _chunkCZRSJULDjs.generateVisitorId; exports.getStoredVisitorId = _chunkCZRSJULDjs.getStoredVisitorId; exports.grantAnalyticsConsent = _chunkCZRSJULDjs.grantAnalyticsConsent; exports.ok = _chunkFOUBL2EQjs.ok; exports.revokeAnalyticsConsent = _chunkCZRSJULDjs.revokeAnalyticsConsent; exports.toSdkError = _chunkFOUBL2EQjs.toSdkError; exports.trackEcommerceEvent = _chunkCZRSJULDjs.trackEcommerceEvent;
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
+
3
+
4
+
5
+
6
+
7
+
8
+
9
+
10
+
11
+
12
+
13
+ var _chunk3TPJG2WVjs = require('./chunk-3TPJG2WV.js');
14
+
15
+ // src/react/utils/format-price.ts
16
+ function formatPrice(amount, currency, locale) {
17
+ const resolvedLocale = _nullishCoalesce(locale, () => ( "cs"));
18
+ try {
19
+ return new Intl.NumberFormat(resolvedLocale, {
20
+ style: "currency",
21
+ currency,
22
+ minimumFractionDigits: Number.isInteger(amount) ? 0 : 2,
23
+ maximumFractionDigits: 2
24
+ }).format(amount);
25
+ } catch (e) {
26
+ return `${amount} ${currency}`;
27
+ }
28
+ }
29
+
30
+ // src/analytics.ts
31
+ var GA4_NAME_MAP = {
32
+ newsletter_signup: "generate_lead"
33
+ };
34
+ function trackEcommerceEvent(event, payload) {
35
+ if (typeof window === "undefined") return;
36
+ const w = window;
37
+ try {
38
+ _optionalChain([w, 'access', _ => _.__behioEcommerceSink, 'optionalCall', _2 => _2(event, payload)]);
39
+ } catch (e2) {
40
+ }
41
+ const gaName = _nullishCoalesce(GA4_NAME_MAP[event], () => ( event));
42
+ try {
43
+ if (typeof w.gtag === "function") {
44
+ w.gtag("event", gaName, payload);
45
+ return;
46
+ }
47
+ if (Array.isArray(w.dataLayer)) {
48
+ w.dataLayer.push({ ecommerce: null });
49
+ w.dataLayer.push({ event: gaName, ecommerce: payload });
50
+ }
51
+ } catch (e3) {
52
+ }
53
+ }
54
+
55
+ // src/consent-visitor.ts
56
+ var VISITOR_KEY = "behio_visitor_id";
57
+ var COOKIE_MAX_AGE = 60 * 60 * 24 * 365;
58
+ function getStoredVisitorId() {
59
+ if (typeof window === "undefined") return null;
60
+ try {
61
+ const ls = localStorage.getItem(VISITOR_KEY);
62
+ if (ls) return ls;
63
+ } catch (e4) {
64
+ }
65
+ return readCookie(VISITOR_KEY);
66
+ }
67
+ function generateVisitorId() {
68
+ const bytes = new Uint8Array(18);
69
+ try {
70
+ _optionalChain([globalThis, 'access', _3 => _3.crypto, 'optionalAccess', _4 => _4.getRandomValues, 'optionalCall', _5 => _5(bytes)]);
71
+ } catch (e5) {
72
+ }
73
+ let filled = false;
74
+ for (const b of bytes) if (b !== 0) filled = true;
75
+ if (!filled) for (let i = 0; i < bytes.length; i++) bytes[i] = Math.floor(Math.random() * 256);
76
+ let bin = "";
77
+ for (const b of bytes) bin += String.fromCharCode(b);
78
+ const b64 = typeof btoa === "function" ? btoa(bin) : Buffer.from(bytes).toString("base64");
79
+ return `v${b64.replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/, "")}`.slice(0, 40);
80
+ }
81
+ function writeVisitorId(id) {
82
+ if (typeof window === "undefined") return;
83
+ try {
84
+ localStorage.setItem(VISITOR_KEY, id);
85
+ } catch (e6) {
86
+ }
87
+ try {
88
+ document.cookie = `${VISITOR_KEY}=${encodeURIComponent(id)}; path=/; max-age=${COOKIE_MAX_AGE}; SameSite=Lax`;
89
+ } catch (e7) {
90
+ }
91
+ }
92
+ function readCookie(name) {
93
+ if (typeof document === "undefined") return null;
94
+ const match = document.cookie.match(new RegExp(`(?:^|; )${name}=([^;]*)`));
95
+ return match ? decodeURIComponent(match[1]) : null;
96
+ }
97
+ function emitConsentChanged() {
98
+ if (typeof window === "undefined") return;
99
+ try {
100
+ window.dispatchEvent(new Event("behio:consent-changed"));
101
+ } catch (e8) {
102
+ }
103
+ }
104
+ async function grantAnalyticsConsent(client, categories) {
105
+ const id = _nullishCoalesce(getStoredVisitorId(), () => ( generateVisitorId()));
106
+ writeVisitorId(id);
107
+ client.setAnalyticsVisitorId(id);
108
+ const res = await client.consent.record({
109
+ visitorId: id,
110
+ analytics: true,
111
+ marketing: _nullishCoalesce(_optionalChain([categories, 'optionalAccess', _6 => _6.marketing]), () => ( false)),
112
+ preferences: _nullishCoalesce(_optionalChain([categories, 'optionalAccess', _7 => _7.preferences]), () => ( false))
113
+ });
114
+ emitConsentChanged();
115
+ return res;
116
+ }
117
+ async function revokeAnalyticsConsent(client) {
118
+ const id = getStoredVisitorId();
119
+ client.setAnalyticsVisitorId(null);
120
+ emitConsentChanged();
121
+ if (!id) return { data: { success: true }, error: null };
122
+ return client.consent.revoke(id);
123
+ }
124
+
125
+
126
+
127
+
128
+
129
+
130
+
131
+
132
+
133
+
134
+
135
+
136
+
137
+
138
+
139
+
140
+
141
+
142
+ exports.AddressTypes = _chunk3TPJG2WVjs.AddressTypes; exports.BehioApiError = _chunk3TPJG2WVjs.BehioApiError; exports.BehioNetworkError = _chunk3TPJG2WVjs.BehioNetworkError; exports.BehioStorefront = _chunk3TPJG2WVjs.BehioStorefront; exports.FulfillmentStatuses = _chunk3TPJG2WVjs.FulfillmentStatuses; exports.OrderStatuses = _chunk3TPJG2WVjs.OrderStatuses; exports.PaymentStatuses = _chunk3TPJG2WVjs.PaymentStatuses; exports.ProductSort = _chunk3TPJG2WVjs.ProductSort; exports.err = _chunk3TPJG2WVjs.err; exports.formatPrice = formatPrice; exports.generateVisitorId = generateVisitorId; exports.getStoredVisitorId = getStoredVisitorId; exports.grantAnalyticsConsent = grantAnalyticsConsent; exports.ok = _chunk3TPJG2WVjs.ok; exports.revokeAnalyticsConsent = revokeAnalyticsConsent; exports.toSdkError = _chunk3TPJG2WVjs.toSdkError; exports.trackEcommerceEvent = trackEcommerceEvent;