@fayz-ai/storefront 0.84.1 → 0.84.2

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.
@@ -234,15 +234,27 @@ function metaEventFor(event, currency) {
234
234
  }
235
235
  }
236
236
  var strip = (params) => Object.fromEntries(Object.entries(params).filter(([, v]) => v !== void 0 && v !== null));
237
- function loadFbEventsAfterLoad() {
237
+ var META_PIXEL_DELAY_MS = 3e3;
238
+ function loadFbEventsOnIntentOrDelay() {
239
+ let done = false;
240
+ const events = ["pointerdown", "keydown", "touchstart", "scroll", "wheel"];
238
241
  const inject = () => {
242
+ if (done) return;
243
+ done = true;
244
+ for (const name of events) window.removeEventListener(name, inject, true);
245
+ window.clearTimeout(timer);
239
246
  const script = document.createElement("script");
240
247
  script.async = true;
241
248
  script.src = "https://connect.facebook.net/en_US/fbevents.js";
242
249
  document.head.appendChild(script);
243
250
  };
244
- if (document.readyState === "complete") inject();
245
- else window.addEventListener("load", inject, { once: true });
251
+ for (const name of events) window.addEventListener(name, inject, { capture: true, once: true, passive: true });
252
+ let timer = 0;
253
+ const arm = () => {
254
+ timer = window.setTimeout(inject, META_PIXEL_DELAY_MS);
255
+ };
256
+ if (document.readyState === "complete") arm();
257
+ else window.addEventListener("load", arm, { once: true });
246
258
  }
247
259
  function installFbq() {
248
260
  if (window.fbq) return window.fbq;
@@ -256,7 +268,7 @@ function installFbq() {
256
268
  fbq.queue = [];
257
269
  window.fbq = fbq;
258
270
  if (!window._fbq) window._fbq = fbq;
259
- loadFbEventsAfterLoad();
271
+ loadFbEventsOnIntentOrDelay();
260
272
  return fbq;
261
273
  }
262
274
  var PURCHASES_KEY = "fayz.meta.purchases";
@@ -7599,5 +7611,5 @@ function createStorefront(options) {
7599
7611
  }
7600
7612
 
7601
7613
  export { AddressStrip, BenefitsRow, CartDrawer, CatalogPage, CategoryShowcase, ClosedStoreDialog, CollectionCta, CollectionHero, ContentPage, CountdownBand, EntityListBlock, ExperimentBlock, ExperimentProvider, ExperimentVariantBlock, FaqSection, FiltersPanel, FormBlock, HeroSection, ImageTiles, ItemSheet, ManifestoBlock, MediaCarousel, MenuItemRow, MenuPage, MenuToolbar, MotifStrip, NewsletterBand, PLACEHOLDER_ASPECTS, PaymentTerms, Price, ProductCard, ProductDetailPage, ProductEnquiryForm, ProductGallery, ProductGrid, ProductOptionSelector, ProductRail, ProductReviews, ProductSlider, ProductSpecs, ProductSpotlight, PromoBanner, QuantityInput, ScheduleSheet, SealsBand, SearchOverlay, ServiceHoursModal, StepsSection, StoreCover, StorefrontAnalytics, StorefrontConfigHost, StorefrontFooter, StorefrontHeader, StorefrontShell, StorefrontThemeStyle, StoryQuote, THEME_SCALE_FIELDS, THEME_SCALE_VAR_PREFIX, Testimonials, TierCards, applyDeliveryPolicy, applyStoreSettings, bannerPlaceholder, buildEnquiryFromForm, createStorefront, createStorefrontApp, entityListBlockMeta, initStorefrontRuntime, isExperimentBinding, matchesFacets, mergeCollectionFacet, nextMilestone, orderGalleryImages, overrideComponent, overrideProps, pickProductCardImage, productCardComponentContract, productPlaceholder, registerStorefrontBlocks, registerStorefrontEntities, registerStorefrontLoaders, resolveExperimental, resolveOverride, resolvePaymentTerms, resolveStorefrontProvider, sectionsToBlocks, selectIsOpen, selectShowsHours, startStorefrontPostHog, storeBuyerId, storefrontComponentContracts, themeToCss, toFacetMap, useCatalogStore, useCategories, useEnquiry, useExperiment, useExperimentValue, useMarketProduct, useProduct, useProducts, useServiceStore, useStorefrontActions, withFacet };
7602
- //# sourceMappingURL=chunk-HRLF5NYO.js.map
7603
- //# sourceMappingURL=chunk-HRLF5NYO.js.map
7614
+ //# sourceMappingURL=chunk-JLCF7CPP.js.map
7615
+ //# sourceMappingURL=chunk-JLCF7CPP.js.map