@fayz-ai/storefront 0.13.0 → 0.14.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.
@@ -1 +1 @@
1
- {"version":3,"file":"router.d.ts","sourceRoot":"","sources":["../../src/app/router.ts"],"names":[],"mappings":"AAAA,OAAO,KAAqE,MAAM,OAAO,CAAA;AACzF,OAAO,EAA6C,KAAK,aAAa,EAAE,MAAM,eAAe,CAAA;AAwB7F,eAAO,MAAM,wBAAwB,sCAAgC,CAAA;AAuBrE,wBAAgB,gBAAgB,IAAI,aAAa,CAehD;AAED,iEAAiE;AACjE,wBAAgB,YAAY,IAAI,MAAM,CAOrC;AAED;iEACiE;AACjE,wBAAgB,wBAAwB,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAI3D;AAED,wBAAgB,WAAW,IAAI,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAGlD;AAED,iFAAiF;AACjF,eAAO,MAAM,WAAW,qBAAe,CAAA;AAEvC,+EAA+E;AAC/E,wBAAgB,UAAU,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI,CAE3C;AAED;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAAC,YAAY,EAAE,MAAM,GAAG,SAAS,EAAE,IAAI,EAAE,aAAa,GAAG,aAAa,CAOvG;AAED,gGAAgG;AAChG,wBAAgB,SAAS,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,IAAI,CAatF;AAED,MAAM,WAAW,SAAU,SAAQ,IAAI,CAAC,KAAK,CAAC,oBAAoB,CAAC,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC5F,EAAE,EAAE,MAAM,CAAA;CACX;AAED;;;;;;;;GAQG;AACH,wBAAgB,IAAI,CAAC,EAAE,EAAE,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,EAAE,SAAS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AAM,WAAW,SAAU,SAAQ,IAAI,CAAC,KAAK,CAAC,oBAAoB,CAAC,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC5F,EAAE,EAAE,MAAM,CAAA;CACX;AAED;;;;;;;;GAQG;AACH,wBAAgB,IAAI,CAAC,EAAE,EAAE,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,EAAE,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;qBAG5C,KAAK,CAAC,UAAU,CAAC,iBAAiB,CAAC;;gBAgBhE"}
@@ -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;
@@ -886,7 +897,12 @@ function useRoutePath() {
886
897
  );
887
898
  }
888
899
  function useScrollToTopOnNavigate(path) {
900
+ const mounted = useRef(false);
889
901
  useEffect(() => {
902
+ if (!mounted.current) {
903
+ mounted.current = true;
904
+ return;
905
+ }
890
906
  if (typeof window !== "undefined") window.scrollTo(0, 0);
891
907
  }, [path]);
892
908
  }
@@ -1106,6 +1122,7 @@ var TID = {
1106
1122
  purchasesEmpty: "purchases-empty",
1107
1123
  signout: "signout"
1108
1124
  };
1125
+ var clientMounted = false;
1109
1126
  function SmoothImage({
1110
1127
  imageLoading,
1111
1128
  variant,
@@ -1129,7 +1146,7 @@ function SmoothImage({
1129
1146
  const blur = resolved.blur ?? true;
1130
1147
  const transform = resolved.transform ?? "none";
1131
1148
  const ref = React4.useRef(null);
1132
- const [loaded, setLoaded] = React4.useState(mode === "none");
1149
+ const [loaded, setLoaded] = React4.useState(() => mode === "none" || !clientMounted);
1133
1150
  const delivered = React4.useMemo(() => {
1134
1151
  if (transform !== "supabase" || !src || srcSet || !isStorageImageUrl(src)) return { src, srcSet, sizes };
1135
1152
  if (variant?.width) {
@@ -1148,6 +1165,9 @@ function SmoothImage({
1148
1165
  sizes: variant?.sizes ?? sizes ?? "100vw"
1149
1166
  };
1150
1167
  }, [transform, src, srcSet, sizes, variant?.width, variant?.sizes, variant?.widths, variant?.quality]);
1168
+ React4.useEffect(() => {
1169
+ clientMounted = true;
1170
+ }, []);
1151
1171
  React4.useEffect(() => {
1152
1172
  if (mode === "none") {
1153
1173
  setLoaded(true);
@@ -3314,9 +3334,7 @@ function useCatalogUrlSync(searchParam) {
3314
3334
  if (p.has("q")) s2.setSearch(p.get("q") ?? "");
3315
3335
  else if (p.has("search")) s2.setSearch(p.get("search") ?? "");
3316
3336
  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
- }
3337
+ for (const [key, value] of Object.entries(facetsFromQuery(p, RESERVED_PARAMS))) s2.setFacet(key, value);
3320
3338
  const sort = p.get("sort");
3321
3339
  if (sort && SORTS.includes(sort)) s2.setSort(sort);
3322
3340
  if (p.get("stock") === "1") s2.setInStockOnly(true);
@@ -3324,7 +3342,11 @@ function useCatalogUrlSync(searchParam) {
3324
3342
  if (p.has("max")) s2.setPriceMax(Number(p.get("max")) || null);
3325
3343
  }, []);
3326
3344
  useEffect(() => {
3345
+ const current = adapter.getCurrentPath();
3327
3346
  const p = new URLSearchParams();
3347
+ for (const [key, value] of new URLSearchParams(current.split("?")[1] ?? "").entries()) {
3348
+ if (isTrackingParam(key)) p.set(key, value);
3349
+ }
3328
3350
  if (catalog.search) p.set(searchParam, catalog.search);
3329
3351
  if (catalog.categoryId) p.set("category", catalog.categoryId);
3330
3352
  for (const [key, value] of Object.entries(catalog.facets)) p.set(key, value);
@@ -3332,10 +3354,10 @@ function useCatalogUrlSync(searchParam) {
3332
3354
  if (catalog.inStockOnly) p.set("stock", "1");
3333
3355
  if (catalog.priceMin != null) p.set("min", String(catalog.priceMin));
3334
3356
  if (catalog.priceMax != null) p.set("max", String(catalog.priceMax));
3335
- const base = adapter.getCurrentPath().split("?")[0] || "/catalog";
3357
+ const base = current.split("?")[0] || "/catalog";
3336
3358
  const qs = p.toString();
3337
3359
  const next = qs ? `${base}?${qs}` : base;
3338
- if (next !== adapter.getCurrentPath()) adapter.replace(next);
3360
+ if (next !== current) adapter.replace(next);
3339
3361
  }, [
3340
3362
  catalog.search,
3341
3363
  catalog.categoryId,
@@ -4252,7 +4274,7 @@ function ProductDetailPage({ slug }) {
4252
4274
  );
4253
4275
  }
4254
4276
  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: [
4277
+ /* @__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
4278
  /* @__PURE__ */ jsx(ChevronLeft, { className: "h-4 w-4" }),
4257
4279
  " Continuar comprando"
4258
4280
  ] }),
@@ -9082,7 +9104,7 @@ function OrderConfirmationPage({ orderId }) {
9082
9104
  children: "Minhas compras"
9083
9105
  }
9084
9106
  ),
9085
- /* @__PURE__ */ jsx(Link, { to: "/", className: "rounded-xl border px-5 py-2.5 font-semibold hover:bg-muted", children: "Continuar comprando" })
9107
+ /* @__PURE__ */ jsx(Link, { to: config.catalogPath, className: "rounded-xl border px-5 py-2.5 font-semibold hover:bg-muted", children: "Continuar comprando" })
9086
9108
  ] })
9087
9109
  ] })
9088
9110
  }
@@ -9371,13 +9393,14 @@ function ProfilePanel() {
9371
9393
  ] });
9372
9394
  }
9373
9395
  function AddressesPanel() {
9396
+ const config = useStorefrontConfig();
9374
9397
  return /* @__PURE__ */ jsxs("div", { className: "rounded-2xl border bg-card p-6", children: [
9375
9398
  /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
9376
9399
  /* @__PURE__ */ jsx(MapPin, { className: "h-5 w-5 text-primary" }),
9377
9400
  /* @__PURE__ */ jsx("h2", { className: "sf-heading text-lg font-semibold", children: "Endere\xE7os" })
9378
9401
  ] }),
9379
9402
  /* @__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" })
9403
+ /* @__PURE__ */ jsx(Link, { to: config.catalogPath, className: "mt-4 inline-block text-sm font-semibold text-primary underline", children: "Continuar comprando" })
9381
9404
  ] });
9382
9405
  }
9383
9406
  function PaymentsPanel() {
@@ -11077,5 +11100,5 @@ ${formatErrors(report.errors)}`;
11077
11100
  }
11078
11101
 
11079
11102
  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
11103
+ //# sourceMappingURL=chunk-NBYDY2C3.js.map
11104
+ //# sourceMappingURL=chunk-NBYDY2C3.js.map