@numueg/theme-sdk 0.13.0 → 0.13.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.
package/dist/index.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
  export { resolveThemeSettings } from './chunk-XF2FGIVS.mjs';
2
- export { KNOWN_SETTING_TYPES, KNOWN_TEMPLATES, REQUIRED_TEMPLATES, SDK_VERSION, THEME_CONTRACT_VERSION, mergeResults, validateBuiltManifest, validateManifest, validateSectionSchema, validateSettingsAgainstSchema } from './chunk-QPXMBK5U.mjs';
3
- import { ShopContext, ThemeSettingsContext, CurrentTemplateContext, PageContext, LocalizationContext, CurrencyContext, CartContext, CustomerContext, NavigationContext, CollectionContext, ProductContext, useShop, useLocalization, useCustomer, useThemeSettings } from './chunk-ZYZZG4JR.mjs';
4
- export { CartContext, CollectionContext, CurrencyContext, CustomerContext, LocalizationContext, NavigationContext, PageContext, ProductContext, ShopContext, ThemeSettingsContext, useCollections, useCustomer, useDirection, useFieldTranslation, useLocale, useLocalization, useNumberFormat, usePage, useProducts, useShop, useThemeSettings, useTranslation } from './chunk-ZYZZG4JR.mjs';
2
+ export { KNOWN_SETTING_TYPES, KNOWN_TEMPLATES, REQUIRED_TEMPLATES, SDK_VERSION, THEME_CONTRACT_VERSION, mergeResults, validateBuiltManifest, validateManifest, validateSectionSchema, validateSettingsAgainstSchema } from './chunk-X2YWGRRG.mjs';
3
+ import { ShopContext, ThemeSettingsContext, CurrentTemplateContext, PageContext, LocalizationContext, CurrencyContext, CartContext, CustomerContext, NavigationContext, CollectionContext, ProductContext, useShop, useLocalization, useCustomer, useThemeSettings } from './chunk-VZO2WMEM.mjs';
4
+ export { CartContext, CollectionContext, CurrencyContext, CustomerContext, LocalizationContext, NavigationContext, PageContext, ProductContext, ShopContext, ThemeSettingsContext, useCollections, useCustomer, useDirection, useFieldTranslation, useLocale, useLocalization, useNumberFormat, usePage, useProducts, useShop, useThemeSettings, useTranslation } from './chunk-VZO2WMEM.mjs';
5
5
  import { createContext, forwardRef, useState, useImperativeHandle, useEffect, useCallback, useMemo, useRef, useContext, useSyncExternalStore, StrictMode, createElement, Component } from 'react';
6
6
  import { hydrateRoot, createRoot } from 'react-dom/client';
7
7
  import { jsx, Fragment, jsxs } from 'react/jsx-runtime';
@@ -666,9 +666,11 @@ function dispatchAnalyticsEvent(eventName, payload = {}) {
666
666
  }
667
667
  const step = EVENT_TO_FUNNEL_STEP[eventName] ?? null;
668
668
  const customerId = readCustomerId();
669
+ const pageUrl = typeof window !== "undefined" ? window.location.href : void 0;
669
670
  const body = step ? {
670
671
  event_id: eventId,
671
672
  path: window.location.pathname,
673
+ page_url: pageUrl,
672
674
  fingerprint: getFingerprint(),
673
675
  step,
674
676
  step_data: payload,
@@ -679,6 +681,7 @@ function dispatchAnalyticsEvent(eventName, payload = {}) {
679
681
  event: eventName,
680
682
  payload,
681
683
  event_id: eventId,
684
+ page_url: pageUrl,
682
685
  ts: Date.now(),
683
686
  attribution: readAttribution() ?? void 0,
684
687
  customer_id: customerId ?? void 0
@@ -2606,16 +2609,20 @@ function applyImageTransform(t, fit = "cover") {
2606
2609
  return style;
2607
2610
  }
2608
2611
  var clamp01 = (n) => Math.min(1, Math.max(0, n));
2612
+ function hostHonorsCropParams() {
2613
+ return globalThis.__NUMU_CF_IMAGE_RESIZING__ === true;
2614
+ }
2609
2615
  function focalSrc(url, options = {}) {
2610
2616
  if (!url) return "";
2611
2617
  if (url.startsWith("data:") || /[?&](fp-x|fp-y)=/.test(url)) return url;
2618
+ const crop = hostHonorsCropParams();
2612
2619
  const p = new URLSearchParams();
2613
2620
  p.set("url", url);
2614
2621
  if (options.width) p.set("w", String(Math.round(options.width)));
2615
- if (options.focal?.x != null) p.set("fp-x", String(clamp01(options.focal.x)));
2616
- if (options.focal?.y != null) p.set("fp-y", String(clamp01(options.focal.y)));
2617
- if (options.aspect) p.set("ar", options.aspect);
2618
- if (options.fit) p.set("fit", options.fit);
2622
+ if (crop && options.focal?.x != null) p.set("fp-x", String(clamp01(options.focal.x)));
2623
+ if (crop && options.focal?.y != null) p.set("fp-y", String(clamp01(options.focal.y)));
2624
+ if (crop && options.aspect) p.set("ar", options.aspect);
2625
+ if (crop && options.fit) p.set("fit", options.fit);
2619
2626
  if (options.quality) p.set("q", String(Math.min(100, Math.max(1, Math.round(options.quality)))));
2620
2627
  if (options.format) p.set("f", options.format.toLowerCase());
2621
2628
  return `/api/image-transform?${p.toString()}`;