@fayz-ai/storefront 0.13.0 → 0.13.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -445,6 +445,17 @@ function toFacetMap(input) {
445
445
  }
446
446
  return out;
447
447
  }
448
+ var TRACKING_PARAM = /^(utm_[a-z0-9_]+|fbclid|gclid|gbraid|wbraid|dclid|msclkid|ttclid|twclid|li_fat_id|igshid|igsh|mc_cid|mc_eid|_ga|_gl|_hs[a-z]+|hsa_[a-z]+|yclid|srsltid|ref|ref_src)$/i;
449
+ function isTrackingParam(key) {
450
+ return TRACKING_PARAM.test(key);
451
+ }
452
+ function facetsFromQuery(params, reserved) {
453
+ const out = {};
454
+ for (const [key, value] of params.entries()) {
455
+ if (value && !reserved.has(key) && !isTrackingParam(key)) out[key] = value;
456
+ }
457
+ return out;
458
+ }
448
459
  function withFacet(facets, key, value) {
449
460
  if (value == null || value === "") {
450
461
  if (!(key in facets)) return facets;
@@ -3314,9 +3325,7 @@ function useCatalogUrlSync(searchParam) {
3314
3325
  if (p.has("q")) s2.setSearch(p.get("q") ?? "");
3315
3326
  else if (p.has("search")) s2.setSearch(p.get("search") ?? "");
3316
3327
  if (p.get("category")) s2.setCategoryId(p.get("category"));
3317
- for (const [key, value] of p.entries()) {
3318
- if (!RESERVED_PARAMS.has(key) && value) s2.setFacet(key, value);
3319
- }
3328
+ for (const [key, value] of Object.entries(facetsFromQuery(p, RESERVED_PARAMS))) s2.setFacet(key, value);
3320
3329
  const sort = p.get("sort");
3321
3330
  if (sort && SORTS.includes(sort)) s2.setSort(sort);
3322
3331
  if (p.get("stock") === "1") s2.setInStockOnly(true);
@@ -3324,7 +3333,11 @@ function useCatalogUrlSync(searchParam) {
3324
3333
  if (p.has("max")) s2.setPriceMax(Number(p.get("max")) || null);
3325
3334
  }, []);
3326
3335
  useEffect(() => {
3336
+ const current = adapter.getCurrentPath();
3327
3337
  const p = new URLSearchParams();
3338
+ for (const [key, value] of new URLSearchParams(current.split("?")[1] ?? "").entries()) {
3339
+ if (isTrackingParam(key)) p.set(key, value);
3340
+ }
3328
3341
  if (catalog.search) p.set(searchParam, catalog.search);
3329
3342
  if (catalog.categoryId) p.set("category", catalog.categoryId);
3330
3343
  for (const [key, value] of Object.entries(catalog.facets)) p.set(key, value);
@@ -3332,10 +3345,10 @@ function useCatalogUrlSync(searchParam) {
3332
3345
  if (catalog.inStockOnly) p.set("stock", "1");
3333
3346
  if (catalog.priceMin != null) p.set("min", String(catalog.priceMin));
3334
3347
  if (catalog.priceMax != null) p.set("max", String(catalog.priceMax));
3335
- const base = adapter.getCurrentPath().split("?")[0] || "/catalog";
3348
+ const base = current.split("?")[0] || "/catalog";
3336
3349
  const qs = p.toString();
3337
3350
  const next = qs ? `${base}?${qs}` : base;
3338
- if (next !== adapter.getCurrentPath()) adapter.replace(next);
3351
+ if (next !== current) adapter.replace(next);
3339
3352
  }, [
3340
3353
  catalog.search,
3341
3354
  catalog.categoryId,
@@ -4252,7 +4265,7 @@ function ProductDetailPage({ slug }) {
4252
4265
  );
4253
4266
  }
4254
4267
  return /* @__PURE__ */ jsxs("div", { ...storefrontComponentContracts.productDetail.root, className: "mx-auto max-w-5xl px-4 py-8 sm:px-6", children: [
4255
- /* @__PURE__ */ jsxs(Link, { to: "/", className: "mb-6 inline-flex items-center gap-1 text-sm text-muted-foreground hover:text-foreground", children: [
4268
+ /* @__PURE__ */ jsxs(Link, { to: config.catalogPath, className: "mb-6 inline-flex items-center gap-1 text-sm text-muted-foreground hover:text-foreground", children: [
4256
4269
  /* @__PURE__ */ jsx(ChevronLeft, { className: "h-4 w-4" }),
4257
4270
  " Continuar comprando"
4258
4271
  ] }),
@@ -9082,7 +9095,7 @@ function OrderConfirmationPage({ orderId }) {
9082
9095
  children: "Minhas compras"
9083
9096
  }
9084
9097
  ),
9085
- /* @__PURE__ */ jsx(Link, { to: "/", className: "rounded-xl border px-5 py-2.5 font-semibold hover:bg-muted", children: "Continuar comprando" })
9098
+ /* @__PURE__ */ jsx(Link, { to: config.catalogPath, className: "rounded-xl border px-5 py-2.5 font-semibold hover:bg-muted", children: "Continuar comprando" })
9086
9099
  ] })
9087
9100
  ] })
9088
9101
  }
@@ -9371,13 +9384,14 @@ function ProfilePanel() {
9371
9384
  ] });
9372
9385
  }
9373
9386
  function AddressesPanel() {
9387
+ const config = useStorefrontConfig();
9374
9388
  return /* @__PURE__ */ jsxs("div", { className: "rounded-2xl border bg-card p-6", children: [
9375
9389
  /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
9376
9390
  /* @__PURE__ */ jsx(MapPin, { className: "h-5 w-5 text-primary" }),
9377
9391
  /* @__PURE__ */ jsx("h2", { className: "sf-heading text-lg font-semibold", children: "Endere\xE7os" })
9378
9392
  ] }),
9379
9393
  /* @__PURE__ */ jsx("p", { className: "mt-2 text-sm text-muted-foreground", children: "Voc\xEA informa o endere\xE7o de entrega no checkout. Em breve ser\xE1 poss\xEDvel salvar endere\xE7os para reutilizar nas pr\xF3ximas compras." }),
9380
- /* @__PURE__ */ jsx(Link, { to: "/", className: "mt-4 inline-block text-sm font-semibold text-primary underline", children: "Continuar comprando" })
9394
+ /* @__PURE__ */ jsx(Link, { to: config.catalogPath, className: "mt-4 inline-block text-sm font-semibold text-primary underline", children: "Continuar comprando" })
9381
9395
  ] });
9382
9396
  }
9383
9397
  function PaymentsPanel() {
@@ -11077,5 +11091,5 @@ ${formatErrors(report.errors)}`;
11077
11091
  }
11078
11092
 
11079
11093
  export { BEFORE_PLACE_ORDER_VALVE, BLOCK_STRUCTURAL_KEYS, BenefitsRow, BlockDataError, CART_LINE_ANNOTATION_POINT, CATALOG_BODY_BLOCK, CHECKOUT_FIELD_POINT, CartDrawer, CatalogPage, CategoryShowcase, CheckoutPage, CollectionCta, CollectionHero, ContentPage, CountdownBand, EmailConfirmationRequiredError, EntityListBlock, FaqSection, FiltersPanel, FormBlock, HeroSection, ImageTiles, Link, ManifestoBlock, MediaCarousel, MotifStrip, MyPurchasesPage, NewsletterBand, ORDER_METADATA_POINT, OrderConfirmationPage, OrderTrackingTimeline, PAGE_DATA_SCRIPT_ID, PLACEHOLDER_ASPECTS, PRODUCT_BODY_BLOCK, PRODUCT_CARD_BADGE_POINT, PageDataScope, PaymentTerms, Price, ProductCard, ProductDetailPage, ProductEnquiryForm, ProductGallery, ProductGrid, ProductOptionSelector, ProductRail, ProductReviews, ProductSlider, ProductSpecs, ProductSpotlight, PromoBanner, QuantityInput, Reveal, STOREFRONT_COMPONENT_KEYS, STOREFRONT_PAGE_KINDS, STOREFRONT_SLOTS, STORE_BACKEND_PROVIDERS, STORE_COMMERCE_MODES, STORE_DOCUMENT_KIND, STORE_PAYMENT_METHOD_KINDS, STORE_PAYMENT_MODES, STORE_ROUTE_CHROMES, STORE_ROUTE_KINDS, STORE_SECTIONS, STORE_SECTION_NAMES, SealsBand, SearchOverlay, Slot, SmoothImage, StepsSection, StorefrontConfigHost, StorefrontConfigProvider, StorefrontFooter, StorefrontHeader, StorefrontPage, StorefrontRouterProvider, StorefrontShell, StorefrontThemeStyle, StoryQuote, THEME_SCALE_FIELDS, THEME_SCALE_VAR_PREFIX, TID, Testimonials, TierCards, applyStoreSettings, bannerPlaceholder, blockInstanceId, buildEnquiryFromForm, checkPageBlocks, collectDataNeeds, collectOrderMetadata, contentPagePath, createStorefront, createStorefrontApp, currentStaticRenderPass, defaultPageBlocks, entityListBlockMeta, establishCustomerSession, exportStore, formatMoney, formatProductOptionSelection, getCartLineAnnotations, getCheckoutFieldContributions, getCustomerAuthAdapter, getProductCardBadges, getProductOptionGroups, hydrateStoreDocument, hydratedEntriesFor, initStorefrontRuntime, isJsonValue, isKnownPath, isNestedBlockRef, isPublicPath, isRecord, listSlots, matchContentPage, matchPath, matchesFacets, mergeCollectionFacet, mergePageTheme, navigateTo, nextMilestone, normalizeProductOptionSelection, orderGalleryImages, overrideComponent, overrideProps, pageSeo, pageThemeSelector, pickProductCardImage, placeStorefrontOrder, prefersReducedMotion, primaryImageUrl, productCardComponentContract, productJsonLd, productOptionSelectionKey, productPlaceholder, productSeo, readHydratedPageData, registerStorefrontBlocks, registerStorefrontEntities, registerStorefrontExtensionPoints, registerStorefrontLoaders, resetPageDiagnostics, resetProductOptionsDeprecationWarnings, resetStorefrontExtensionPoints, resolveAuthAdapter, resolveConfig, resolveDataParams, resolveOverride, resolvePageData, resolvePageDataNeed, resolvePaymentTerms, resolveStorefrontProvider, resolveStorefrontRoute, resolveVariantForSelection, roundCents, routePathParams, runBeforePlaceOrderValve, sectionToJsonSchema, sectionsToBlocks, selectCount, selectDiscountTotal, selectRequiresShipping, selectShipping, selectSubtotal, selectTotal, selectionPrice, serializePageData, shellRouterAdapter, signInByEmail, signOutCustomer, signUpCustomer, slugifyStoreName, storefrontComponentContracts, storefrontPaths, themeToCss, toBlockNodes, toFacetMap, useBlockData, useCartStore, useCatalogStore, useCategories, useDeliveryStore, useDiscountValidator, useEnquiry, useHashPath, useInView, useLoader, useMyOrders, useNavigate, usePopOnChange, useProduct, useProducts, useRoutePath, useRouterAdapter, useScrollToTopOnNavigate, useScrolled, useSessionStore, useSlotContext, useStorefrontActions, useStorefrontConfig, useStorefrontConfigOptional, useStorefrontHead, useStorefrontPage, useStorefrontPageOptional, usedSlots, validateStore, withFacet, withStaticRenderPass };
11080
- //# sourceMappingURL=chunk-YU5GO4R5.js.map
11081
- //# sourceMappingURL=chunk-YU5GO4R5.js.map
11094
+ //# sourceMappingURL=chunk-6DWZAAIW.js.map
11095
+ //# sourceMappingURL=chunk-6DWZAAIW.js.map