@primestyleai/tryon 5.7.2 → 5.7.3

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.
@@ -20969,6 +20969,8 @@ function PrimeStyleTryonInner({
20969
20969
  function PrimeStyleTryon(props) {
20970
20970
  return /* @__PURE__ */ jsxRuntimeExports.jsx(PrimeStyleTryonInner, { ...props });
20971
20971
  }
20972
+ const TAG = "[primestyle-tryon]";
20973
+ console.log(`${TAG} bundle loaded — version 5.7.x storefront entry`);
20972
20974
  const MOUNTED = /* @__PURE__ */ new WeakMap();
20973
20975
  function readDataAttrs(el2) {
20974
20976
  const out = {};
@@ -20983,12 +20985,13 @@ function parseJsonAttr(raw, fallback) {
20983
20985
  if (!raw) return fallback;
20984
20986
  try {
20985
20987
  return JSON.parse(raw);
20986
- } catch {
20988
+ } catch (e) {
20989
+ console.warn(`${TAG} failed to parse JSON data attribute`, raw, e);
20987
20990
  return fallback;
20988
20991
  }
20989
20992
  }
20990
20993
  function buildPropsFromDataAttrs(data) {
20991
- return {
20994
+ const props = {
20992
20995
  apiUrl: data.proxyUrl || data.apiUrl || "",
20993
20996
  // No API key needed — the Shopify App Proxy authenticates via
20994
20997
  // HMAC signature and forwards to the backend with the shared
@@ -21009,24 +21012,48 @@ function buildPropsFromDataAttrs(data) {
21009
21012
  buttonStyles: parseJsonAttr(data.buttonStyles, void 0),
21010
21013
  modalStyles: parseJsonAttr(data.modalStyles, void 0)
21011
21014
  };
21015
+ console.log(`${TAG} built props`, props);
21016
+ return props;
21012
21017
  }
21013
21018
  function mount(el2) {
21014
- if (MOUNTED.has(el2)) return;
21019
+ if (MOUNTED.has(el2)) {
21020
+ console.log(`${TAG} already mounted on`, el2);
21021
+ return;
21022
+ }
21023
+ console.log(`${TAG} mounting on element`, el2);
21015
21024
  const data = readDataAttrs(el2);
21025
+ console.log(`${TAG} read data attributes`, data);
21016
21026
  const props = buildPropsFromDataAttrs(data);
21017
- const root = createRoot(el2);
21018
- root.render(reactExports.createElement(PrimeStyleTryon, props));
21019
- MOUNTED.set(el2, root);
21027
+ try {
21028
+ const root = createRoot(el2);
21029
+ root.render(reactExports.createElement(PrimeStyleTryon, props));
21030
+ MOUNTED.set(el2, root);
21031
+ console.log(`${TAG} ✓ mounted React component`);
21032
+ } catch (err) {
21033
+ console.error(`${TAG} ✗ React mount failed`, err);
21034
+ }
21020
21035
  }
21021
21036
  function mountAll() {
21022
21037
  const nodes = document.querySelectorAll(".primestyle-tryon-root");
21038
+ console.log(`${TAG} scanning for .primestyle-tryon-root — found ${nodes.length} element(s)`);
21039
+ if (nodes.length === 0) {
21040
+ console.warn(
21041
+ `${TAG} no .primestyle-tryon-root elements found on the page. Make sure the theme app extension block is added to the product page in the theme editor.`
21042
+ );
21043
+ return;
21044
+ }
21023
21045
  nodes.forEach(mount);
21024
21046
  }
21025
21047
  if (typeof document !== "undefined") {
21048
+ console.log(`${TAG} document.readyState = ${document.readyState}`);
21026
21049
  if (document.readyState === "loading") {
21027
- document.addEventListener("DOMContentLoaded", mountAll);
21050
+ document.addEventListener("DOMContentLoaded", () => {
21051
+ console.log(`${TAG} DOMContentLoaded fired`);
21052
+ mountAll();
21053
+ });
21028
21054
  } else {
21029
21055
  mountAll();
21030
21056
  }
21031
21057
  }
21032
21058
  window.PrimeStyleTryonMount = mountAll;
21059
+ console.log(`${TAG} window.PrimeStyleTryonMount installed for manual remount`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@primestyleai/tryon",
3
- "version": "5.7.2",
3
+ "version": "5.7.3",
4
4
  "description": "PrimeStyle Virtual Try-On SDK — React component & Web Component",
5
5
  "type": "module",
6
6
  "main": "dist/primestyle-tryon.js",