@thefittingroom/shop-ui 5.0.11 → 5.0.12

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.
Files changed (2) hide show
  1. package/dist/index.js +188 -131
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -19113,7 +19113,7 @@ const themeData = {
19113
19113
  color_tfr_800: "#265A64",
19114
19114
  font_family: "sans-serif"
19115
19115
  };
19116
- function _init$6(initThemeData) {
19116
+ function _init$7(initThemeData) {
19117
19117
  if (initThemeData) {
19118
19118
  Object.assign(themeData, initThemeData);
19119
19119
  }
@@ -20747,7 +20747,7 @@ const SvgLoadingCircle = (props) => /* @__PURE__ */ reactExports.createElement("
20747
20747
  const SvgTfrIcon = (props) => /* @__PURE__ */ reactExports.createElement("svg", { width: 12, height: 24, viewBox: "0 0 12 24", fill: "#21201F", xmlns: "http://www.w3.org/2000/svg", ...props }, /* @__PURE__ */ reactExports.createElement("path", { d: "M11.9082 4.0752V19.8516L0.161133 22.8545V1.05859L11.9082 4.0752ZM9.31836 10.8525C8.96951 10.8525 8.68661 11.206 8.68652 11.6416C8.68652 12.0773 8.96946 12.4307 9.31836 12.4307C9.6671 12.4304 9.9502 12.0771 9.9502 11.6416C9.95011 11.2062 9.66705 10.8528 9.31836 10.8525Z" }));
20748
20748
  const SvgTfrName = (props) => /* @__PURE__ */ reactExports.createElement("svg", { width: 1584, height: 245, viewBox: "0 0 1584 245", fill: "none", xmlns: "http://www.w3.org/2000/svg", ...props }, /* @__PURE__ */ reactExports.createElement("path", { d: "M131.362 34.4131V210.725L0 244.291V0.708984L131.362 34.4131ZM110.354 110.164C106.453 110.164 103.29 114.111 103.29 118.979C103.29 123.848 106.453 127.795 110.354 127.795C114.256 127.795 117.419 123.848 117.419 118.979C117.419 114.111 114.256 110.164 110.354 110.164Z", fill: "#265A64" }), /* @__PURE__ */ reactExports.createElement("path", { d: "M175.848 76.9219V60.8636H271.533V76.9219H232.957V184.5H214.363V76.9219H175.848ZM309.279 129.443V184.5H291.229V60.8636H309.038V106.865H310.185C312.358 101.875 315.678 97.9103 320.146 94.9723C324.613 92.0343 330.449 90.5653 337.653 90.5653C344.012 90.5653 349.566 91.8733 354.315 94.4893C359.104 97.1053 362.807 101.009 365.423 106.201C368.079 111.353 369.407 117.792 369.407 125.519V184.5H351.356V127.692C351.356 120.891 349.606 115.619 346.104 111.876C342.603 108.093 337.733 106.201 331.495 106.201C327.229 106.201 323.406 107.107 320.025 108.918C316.684 110.729 314.048 113.385 312.116 116.886C310.225 120.348 309.279 124.533 309.279 129.443ZM433.459 186.371C424.323 186.371 416.455 184.42 409.854 180.516C403.294 176.571 398.223 171.038 394.641 163.914C391.1 156.75 389.329 148.359 389.329 138.74C389.329 129.242 391.1 120.871 394.641 113.626C398.223 106.382 403.214 100.728 409.613 96.6626C416.052 92.5978 423.578 90.5653 432.191 90.5653C437.423 90.5653 442.494 91.4306 447.404 93.1612C452.314 94.8918 456.721 97.6084 460.625 101.311C464.529 105.014 467.608 109.823 469.861 115.739C472.115 121.615 473.242 128.759 473.242 137.17V143.57H399.531V130.047H455.554C455.554 125.298 454.588 121.092 452.656 117.43C450.724 113.727 448.008 110.809 444.506 108.676C441.045 106.543 436.98 105.477 432.312 105.477C427.241 105.477 422.814 106.724 419.031 109.219C415.288 111.674 412.39 114.894 410.337 118.879C408.325 122.823 407.319 127.109 407.319 131.737V142.302C407.319 148.5 408.406 153.772 410.579 158.119C412.792 162.465 415.871 165.786 419.815 168.08C423.759 170.333 428.368 171.46 433.64 171.46C437.061 171.46 440.18 170.977 442.997 170.011C445.814 169.005 448.249 167.516 450.302 165.544C452.354 163.572 453.924 161.137 455.011 158.239L472.095 161.318C470.727 166.349 468.272 170.756 464.73 174.539C461.229 178.282 456.822 181.2 451.509 183.293C446.237 185.345 440.22 186.371 433.459 186.371ZM539.709 184.5V60.8636H616.378V76.9219H558.363V114.592H610.884V130.59H558.363V184.5H539.709ZM637.869 184.5V91.7727H655.92V184.5H637.869ZM646.985 77.4652C643.846 77.4652 641.149 76.4188 638.896 74.326C636.682 72.1929 635.575 69.6574 635.575 66.7195C635.575 63.7412 636.682 61.2057 638.896 59.1129C641.149 56.9799 643.846 55.9133 646.985 55.9133C650.124 55.9133 652.801 56.9799 655.014 59.1129C657.268 61.2057 658.395 63.7412 658.395 66.7195C658.395 69.6574 657.268 72.1929 655.014 74.326C652.801 76.4188 650.124 77.4652 646.985 77.4652ZM723.488 91.7727V106.261H672.838V91.7727H723.488ZM686.421 69.5568H704.472V157.273C704.472 160.775 704.995 163.411 706.041 165.182C707.088 166.912 708.436 168.1 710.086 168.744C711.776 169.347 713.608 169.649 715.58 169.649C717.029 169.649 718.296 169.549 719.383 169.347C720.47 169.146 721.315 168.985 721.918 168.864L725.178 183.776C724.132 184.178 722.643 184.58 720.711 184.983C718.779 185.426 716.364 185.667 713.467 185.707C708.718 185.788 704.291 184.943 700.186 183.172C696.08 181.401 692.76 178.664 690.225 174.962C687.689 171.259 686.421 166.611 686.421 161.016V69.5568ZM786.74 91.7727V106.261H736.09V91.7727H786.74ZM749.673 69.5568H767.724V157.273C767.724 160.775 768.247 163.411 769.293 165.182C770.34 166.912 771.688 168.1 773.338 168.744C775.028 169.347 776.86 169.649 778.832 169.649C780.281 169.649 781.548 169.549 782.635 169.347C783.722 169.146 784.567 168.985 785.17 168.864L788.43 183.776C787.384 184.178 785.895 184.58 783.963 184.983C782.031 185.426 779.616 185.667 776.719 185.707C771.97 185.788 767.543 184.943 763.437 183.172C759.332 181.401 756.012 178.664 753.477 174.962C750.941 171.259 749.673 166.611 749.673 161.016V69.5568ZM806.707 184.5V91.7727H824.758V184.5H806.707ZM815.823 77.4652C812.684 77.4652 809.987 76.4188 807.733 74.326C805.52 72.1929 804.413 69.6574 804.413 66.7195C804.413 63.7412 805.52 61.2057 807.733 59.1129C809.987 56.9799 812.684 55.9133 815.823 55.9133C818.962 55.9133 821.639 56.9799 823.852 59.1129C826.106 61.2057 827.233 63.7412 827.233 66.7195C827.233 69.6574 826.106 72.1929 823.852 74.326C821.639 76.4188 818.962 77.4652 815.823 77.4652ZM867.092 129.443V184.5H849.041V91.7727H866.367V106.865H867.514C869.647 101.955 872.988 98.0109 877.535 95.0327C882.124 92.0544 887.899 90.5653 894.861 90.5653C901.18 90.5653 906.714 91.8935 911.463 94.5497C916.212 97.1657 919.895 101.07 922.511 106.261C925.127 111.453 926.435 117.872 926.435 125.519V184.5H908.384V127.692C908.384 120.971 906.633 115.719 903.132 111.936C899.631 108.113 894.821 106.201 888.704 106.201C884.518 106.201 880.795 107.107 877.535 108.918C874.316 110.729 871.76 113.385 869.869 116.886C868.017 120.348 867.092 124.533 867.092 129.443ZM989.521 221.205C982.156 221.205 975.817 220.239 970.504 218.307C965.232 216.375 960.926 213.819 957.585 210.64C954.245 207.46 951.749 203.979 950.099 200.196L965.614 193.797C966.701 195.568 968.15 197.439 969.961 199.411C971.812 201.424 974.307 203.134 977.447 204.543C980.626 205.951 984.711 206.656 989.702 206.656C996.544 206.656 1002.2 204.985 1006.67 201.645C1011.13 198.345 1013.37 193.072 1013.37 185.828V167.597H1012.22C1011.13 169.569 1009.56 171.762 1007.51 174.177C1005.5 176.592 1002.72 178.684 999.18 180.455C995.638 182.226 991.03 183.112 985.355 183.112C978.03 183.112 971.43 181.401 965.554 177.98C959.718 174.519 955.09 169.428 951.669 162.707C948.288 155.945 946.598 147.634 946.598 137.774C946.598 127.914 948.268 119.462 951.609 112.419C954.989 105.376 959.618 99.983 965.494 96.2401C971.37 92.4569 978.03 90.5653 985.476 90.5653C991.231 90.5653 995.879 91.5312 999.421 93.4631C1002.96 95.3546 1005.72 97.5682 1007.69 100.104C1009.7 102.639 1011.25 104.873 1012.34 106.805H1013.67V91.7727H1031.36V186.553C1031.36 194.521 1029.51 201.061 1025.8 206.173C1022.1 211.284 1017.09 215.067 1010.77 217.522C1004.49 219.977 997.409 221.205 989.521 221.205ZM989.339 168.14C994.531 168.14 998.918 166.933 1002.5 164.518C1006.12 162.063 1008.86 158.561 1010.71 154.013C1012.6 149.425 1013.55 143.932 1013.55 137.533C1013.55 131.295 1012.62 125.801 1010.77 121.052C1008.92 116.303 1006.2 112.6 1002.62 109.944C999.039 107.247 994.612 105.899 989.339 105.899C983.906 105.899 979.379 107.308 975.756 110.125C972.134 112.902 969.397 116.685 967.546 121.474C965.735 126.264 964.83 131.616 964.83 137.533C964.83 143.61 965.755 148.942 967.606 153.531C969.458 158.119 972.195 161.701 975.817 164.276C979.479 166.852 983.987 168.14 989.339 168.14ZM1102 184.5V60.8636H1146.07C1155.65 60.8636 1163.6 62.5137 1169.92 65.8139C1176.28 69.1141 1181.03 73.6821 1184.17 79.5178C1187.31 85.3132 1188.88 92.0142 1188.88 99.6207C1188.88 107.187 1187.29 113.848 1184.11 119.603C1180.97 125.318 1176.22 129.765 1169.86 132.945C1163.54 136.124 1155.59 137.714 1146.01 137.714H1112.63V121.656H1144.32C1150.36 121.656 1155.27 120.79 1159.05 119.06C1162.88 117.329 1165.67 114.814 1167.44 111.513C1169.21 108.213 1170.1 104.249 1170.1 99.6207C1170.1 94.9522 1169.19 90.9074 1167.38 87.4865C1165.61 84.0656 1162.82 81.4496 1158.99 79.6385C1155.21 77.7872 1150.24 76.8615 1144.08 76.8615H1120.66V184.5H1102ZM1163.04 128.719L1193.58 184.5H1172.33L1142.39 128.719H1163.04ZM1248.02 186.371C1239.33 186.371 1231.74 184.379 1225.26 180.395C1218.78 176.411 1213.75 170.836 1210.17 163.673C1206.59 156.509 1204.8 148.138 1204.8 138.559C1204.8 128.94 1206.59 120.529 1210.17 113.325C1213.75 106.12 1218.78 100.526 1225.26 96.5419C1231.74 92.5575 1239.33 90.5653 1248.02 90.5653C1256.72 90.5653 1264.3 92.5575 1270.78 96.5419C1277.26 100.526 1282.29 106.12 1285.87 113.325C1289.46 120.529 1291.25 128.94 1291.25 138.559C1291.25 148.138 1289.46 156.509 1285.87 163.673C1282.29 170.836 1277.26 176.411 1270.78 180.395C1264.3 184.379 1256.72 186.371 1248.02 186.371ZM1248.08 171.219C1253.72 171.219 1258.39 169.73 1262.09 166.751C1265.79 163.773 1268.53 159.809 1270.3 154.859C1272.11 149.908 1273.01 144.455 1273.01 138.499C1273.01 132.582 1272.11 127.149 1270.3 122.199C1268.53 117.208 1265.79 113.204 1262.09 110.185C1258.39 107.167 1253.72 105.658 1248.08 105.658C1242.41 105.658 1237.7 107.167 1233.96 110.185C1230.25 113.204 1227.5 117.208 1225.69 122.199C1223.91 127.149 1223.03 132.582 1223.03 138.499C1223.03 144.455 1223.91 149.908 1225.69 154.859C1227.5 159.809 1230.25 163.773 1233.96 166.751C1237.7 169.73 1242.41 171.219 1248.08 171.219ZM1350.45 186.371C1341.76 186.371 1334.17 184.379 1327.69 180.395C1321.21 176.411 1316.18 170.836 1312.6 163.673C1309.02 156.509 1307.23 148.138 1307.23 138.559C1307.23 128.94 1309.02 120.529 1312.6 113.325C1316.18 106.12 1321.21 100.526 1327.69 96.5419C1334.17 92.5575 1341.76 90.5653 1350.45 90.5653C1359.15 90.5653 1366.73 92.5575 1373.21 96.5419C1379.69 100.526 1384.72 106.12 1388.31 113.325C1391.89 120.529 1393.68 128.94 1393.68 138.559C1393.68 148.138 1391.89 156.509 1388.31 163.673C1384.72 170.836 1379.69 176.411 1373.21 180.395C1366.73 184.379 1359.15 186.371 1350.45 186.371ZM1350.51 171.219C1356.15 171.219 1360.82 169.73 1364.52 166.751C1368.22 163.773 1370.96 159.809 1372.73 154.859C1374.54 149.908 1375.45 144.455 1375.45 138.499C1375.45 132.582 1374.54 127.149 1372.73 122.199C1370.96 117.208 1368.22 113.204 1364.52 110.185C1360.82 107.167 1356.15 105.658 1350.51 105.658C1344.84 105.658 1340.13 107.167 1336.39 110.185C1332.68 113.204 1329.93 117.208 1328.12 122.199C1326.35 127.149 1325.46 132.582 1325.46 138.499C1325.46 144.455 1326.35 149.908 1328.12 154.859C1329.93 159.809 1332.68 163.773 1336.39 166.751C1340.13 169.73 1344.84 171.219 1350.51 171.219ZM1413.83 184.5V91.7727H1431.15V106.865H1432.3C1434.23 101.754 1437.39 97.7694 1441.78 94.9119C1446.16 92.0142 1451.42 90.5653 1457.53 90.5653C1463.73 90.5653 1468.92 92.0142 1473.11 94.9119C1477.33 97.8097 1480.45 101.794 1482.47 106.865H1483.43C1485.65 101.915 1489.17 97.9706 1494 95.0327C1498.83 92.0544 1504.58 90.5653 1511.26 90.5653C1519.67 90.5653 1526.54 93.2015 1531.85 98.4737C1537.2 103.746 1539.88 111.695 1539.88 122.32V184.5H1521.83V124.01C1521.83 117.732 1520.12 113.184 1516.7 110.366C1513.27 107.549 1509.19 106.141 1504.44 106.141C1498.56 106.141 1494 107.952 1490.74 111.574C1487.48 115.156 1485.85 119.764 1485.85 125.398V184.5H1467.86V122.863C1467.86 117.832 1466.29 113.787 1463.15 110.729C1460.01 107.67 1455.92 106.141 1450.89 106.141C1447.47 106.141 1444.31 107.046 1441.42 108.857C1438.56 110.628 1436.24 113.103 1434.47 116.283C1432.74 119.462 1431.88 123.145 1431.88 127.33V184.5H1413.83Z", fill: "#265A64" }));
20749
20749
  let baseUrl$1;
20750
- function _init$5() {
20750
+ function _init$6() {
20751
20751
  const {
20752
20752
  config
20753
20753
  } = getStaticData();
@@ -22677,7 +22677,7 @@ function isVersionServiceProvider(provider) {
22677
22677
  }
22678
22678
  const name$q = "@firebase/app";
22679
22679
  const version$1$1 = "0.14.5";
22680
- const logger$6 = new Logger$1("@firebase/app");
22680
+ const logger$7 = new Logger$1("@firebase/app");
22681
22681
  const name$p = "@firebase/app-compat";
22682
22682
  const name$o = "@firebase/analytics-compat";
22683
22683
  const name$n = "@firebase/analytics";
@@ -22744,13 +22744,13 @@ function _addComponent(app, component) {
22744
22744
  try {
22745
22745
  app.container.addComponent(component);
22746
22746
  } catch (e) {
22747
- logger$6.debug(`Component ${component.name} failed to register with FirebaseApp ${app.name}`, e);
22747
+ logger$7.debug(`Component ${component.name} failed to register with FirebaseApp ${app.name}`, e);
22748
22748
  }
22749
22749
  }
22750
22750
  function _registerComponent(component) {
22751
22751
  const componentName = component.name;
22752
22752
  if (_components.has(componentName)) {
22753
- logger$6.debug(`There were multiple attempts to register component ${componentName}.`);
22753
+ logger$7.debug(`There were multiple attempts to register component ${componentName}.`);
22754
22754
  return false;
22755
22755
  }
22756
22756
  _components.set(componentName, component);
@@ -22959,7 +22959,7 @@ function registerVersion(libraryKeyOrName, version2, variant) {
22959
22959
  if (versionMismatch) {
22960
22960
  warning.push(`version name "${version2}" contains illegal characters (whitespace or "/")`);
22961
22961
  }
22962
- logger$6.warn(warning.join(" "));
22962
+ logger$7.warn(warning.join(" "));
22963
22963
  return;
22964
22964
  }
22965
22965
  _registerComponent(new Component(
@@ -23003,12 +23003,12 @@ async function readHeartbeatsFromIndexedDB(app) {
23003
23003
  return result;
23004
23004
  } catch (e) {
23005
23005
  if (e instanceof FirebaseError) {
23006
- logger$6.warn(e.message);
23006
+ logger$7.warn(e.message);
23007
23007
  } else {
23008
23008
  const idbGetError = ERROR_FACTORY.create("idb-get", {
23009
23009
  originalErrorMessage: e?.message
23010
23010
  });
23011
- logger$6.warn(idbGetError.message);
23011
+ logger$7.warn(idbGetError.message);
23012
23012
  }
23013
23013
  }
23014
23014
  }
@@ -23021,12 +23021,12 @@ async function writeHeartbeatsToIndexedDB(app, heartbeatObject) {
23021
23021
  await tx.done;
23022
23022
  } catch (e) {
23023
23023
  if (e instanceof FirebaseError) {
23024
- logger$6.warn(e.message);
23024
+ logger$7.warn(e.message);
23025
23025
  } else {
23026
23026
  const idbGetError = ERROR_FACTORY.create("idb-set", {
23027
23027
  originalErrorMessage: e?.message
23028
23028
  });
23029
- logger$6.warn(idbGetError.message);
23029
+ logger$7.warn(idbGetError.message);
23030
23030
  }
23031
23031
  }
23032
23032
  }
@@ -23075,7 +23075,7 @@ class HeartbeatServiceImpl {
23075
23075
  }
23076
23076
  return this._storage.overwrite(this._heartbeatsCache);
23077
23077
  } catch (e) {
23078
- logger$6.warn(e);
23078
+ logger$7.warn(e);
23079
23079
  }
23080
23080
  }
23081
23081
  /**
@@ -23106,7 +23106,7 @@ class HeartbeatServiceImpl {
23106
23106
  }
23107
23107
  return headerString;
23108
23108
  } catch (e) {
23109
- logger$6.warn(e);
23109
+ logger$7.warn(e);
23110
23110
  return "";
23111
23111
  }
23112
23112
  }
@@ -40671,7 +40671,7 @@ registerAuth(
40671
40671
  /* ClientPlatform.BROWSER */
40672
40672
  );
40673
40673
  let debugSource = false;
40674
- function _init$4(debug) {
40674
+ function _init$5(debug) {
40675
40675
  if (debug) {
40676
40676
  let escapeRegExp = function(string) {
40677
40677
  return "^" + string.replace(/[.+^${}()|[\]\\]/g, "\\$&").replace(/\*/g, ".*").replace(/\?/g, ".") + "$";
@@ -40817,7 +40817,7 @@ const firebaseDateToDayjs = (date) => {
40817
40817
  return dayjs(date.seconds * 1e3);
40818
40818
  };
40819
40819
  const LOGIN_TRACKING_PERIOD_SECONDS = 1800;
40820
- const logger$5 = getLogger("firebase");
40820
+ const logger$6 = getLogger("firebase");
40821
40821
  let firebaseApp = null;
40822
40822
  class FirestoreManager {
40823
40823
  constructor(firestore) {
@@ -40945,7 +40945,7 @@ class AuthManager {
40945
40945
  this.listenToUserProfileUnsub = null;
40946
40946
  }
40947
40947
  if (authUser) {
40948
- logger$5.logDebug("User logged in:", {
40948
+ logger$6.logDebug("User logged in:", {
40949
40949
  uid: authUser.uid
40950
40950
  });
40951
40951
  this.listenToUserProfileUnsub = getFirestoreManager().listenToDoc("users", authUser.uid, (doc2) => {
@@ -40979,7 +40979,7 @@ class AuthManager {
40979
40979
  await firestore.mergeDocData("user_logging", userLoggingDocId, userLoggingData);
40980
40980
  }
40981
40981
  } catch (error) {
40982
- logger$5.logError("Error logging user login activity:", {
40982
+ logger$6.logError("Error logging user login activity:", {
40983
40983
  error
40984
40984
  });
40985
40985
  }
@@ -40997,7 +40997,7 @@ function getAuthManager() {
40997
40997
  }
40998
40998
  return authManager;
40999
40999
  }
41000
- async function _init$3() {
41000
+ async function _init$4() {
41001
41001
  const {
41002
41002
  brandId,
41003
41003
  config
@@ -41028,7 +41028,7 @@ async function _init$3() {
41028
41028
  }
41029
41029
  }
41030
41030
  const CONTACT_US_LINK = "mailto:info@thefittingroom.tech?subject=Forgot%20Password%20Assistance";
41031
- const logger$4 = getLogger("forgot-password");
41031
+ const logger$5 = getLogger("forgot-password");
41032
41032
  function ForgotPasswordOverlay({
41033
41033
  returnToOverlay
41034
41034
  }) {
@@ -41094,7 +41094,7 @@ function ForgotPasswordOverlay({
41094
41094
  await authManager2.sendPasswordResetEmail(email2);
41095
41095
  setLinkSent(true);
41096
41096
  } catch (error) {
41097
- logger$4.logError("Error sending password reset email:", {
41097
+ logger$5.logError("Error sending password reset email:", {
41098
41098
  error
41099
41099
  });
41100
41100
  }
@@ -41313,7 +41313,7 @@ function TfrTitle() {
41313
41313
  }));
41314
41314
  return /* @__PURE__ */ jsx$1("div", { css: css2.container, children: /* @__PURE__ */ jsx$1(SvgTfrName, { css: css2.nameIcon }) });
41315
41315
  }
41316
- const logger$3 = getLogger("sign-in");
41316
+ const logger$4 = getLogger("sign-in");
41317
41317
  function SignInOverlay({
41318
41318
  returnToOverlay
41319
41319
  }) {
@@ -41387,7 +41387,7 @@ function SignInOverlay({
41387
41387
  closeOverlay();
41388
41388
  }
41389
41389
  } catch (error) {
41390
- logger$3.logError("Login failed:", {
41390
+ logger$4.logError("Login failed:", {
41391
41391
  error
41392
41392
  });
41393
41393
  setEmailError(" ");
@@ -41783,7 +41783,7 @@ function Loading({
41783
41783
  }
41784
41784
  let baseUrl;
41785
41785
  let responseCache = {};
41786
- function _init$2() {
41786
+ function _init$3() {
41787
41787
  const {
41788
41788
  config
41789
41789
  } = getStaticData();
@@ -41888,32 +41888,86 @@ async function getStyleGarmentCategoryById(styleGarmentCategoryId) {
41888
41888
  recordCache[cacheKey] = record;
41889
41889
  return record;
41890
41890
  }
41891
+ const logger$3 = getLogger("product");
41892
+ function _init$2() {
41893
+ useMainStore.subscribe((state, prevState) => {
41894
+ if (state.userHasAvatar && !prevState.userHasAvatar) {
41895
+ const {
41896
+ currentProduct
41897
+ } = getStaticData();
41898
+ loadProductDataToStore(currentProduct.externalId);
41899
+ }
41900
+ });
41901
+ }
41902
+ async function loadProductData(externalId) {
41903
+ const {
41904
+ brandId
41905
+ } = getStaticData();
41906
+ const style = await getStyleByExternalId(brandId, externalId);
41907
+ if (!style) {
41908
+ throw new Error(`Style not found for externalId: ${externalId}`);
41909
+ }
41910
+ const [styleGarmentCategory, sizeFitRecommendation] = await Promise.all([getStyleGarmentCategoryById(style.style_garment_category_id), getSizeRecommendation(style.id)]);
41911
+ if (!styleGarmentCategory) {
41912
+ throw new Error(`StyleGarmentCategory not found for externalId: ${externalId} style_garment_category_id: ${style.style_garment_category_id}`);
41913
+ }
41914
+ return {
41915
+ externalId,
41916
+ style,
41917
+ styleGarmentCategory,
41918
+ sizeFitRecommendation
41919
+ };
41920
+ }
41921
+ function loadProductDataToStore(externalId) {
41922
+ async function loadAndStore() {
41923
+ try {
41924
+ const productData2 = await loadProductData(externalId);
41925
+ useMainStore.getState().setProductData(productData2.externalId, productData2);
41926
+ logger$3.logDebug(`Loaded product data for externalId: ${externalId}`, {
41927
+ productData: productData2
41928
+ });
41929
+ } catch (error) {
41930
+ logger$3.logError(`Error loading product data for externalId: ${externalId}`, {
41931
+ error
41932
+ });
41933
+ }
41934
+ }
41935
+ const {
41936
+ userIsLoggedIn,
41937
+ userHasAvatar,
41938
+ productData
41939
+ } = useMainStore.getState();
41940
+ if (productData[externalId] || !userIsLoggedIn || userHasAvatar === false) {
41941
+ return;
41942
+ }
41943
+ loadAndStore();
41944
+ }
41891
41945
  function getSizeLabelFromSize(size) {
41892
41946
  if (size.label) {
41893
41947
  return size.label;
41894
41948
  }
41895
41949
  return size.size_value?.name ?? null;
41896
41950
  }
41951
+ const NON_PRIORITY_VTO_REQUEST_DELAY_MS = 500;
41897
41952
  const AVATAR_IMAGE_ASPECT_RATIO = 2 / 3;
41898
41953
  const AVATAR_GUTTER_HEIGHT_PX = 100;
41899
41954
  const CONTENT_AREA_WIDTH_PX = 550;
41900
41955
  const logger$2 = getLogger("overlays/vto-single");
41901
41956
  function VtoSingleOverlay() {
41902
- const {
41903
- brandId
41904
- } = getStaticData();
41905
41957
  const userIsLoggedIn = useMainStore((state) => state.userIsLoggedIn);
41906
41958
  const userHasAvatar = useMainStore((state) => state.userHasAvatar);
41907
41959
  const userProfile = useMainStore((state) => state.userProfile);
41960
+ const storeProductData = useMainStore((state) => state.productData);
41908
41961
  const deviceLayout = useMainStore((state) => state.deviceLayout);
41909
41962
  const openOverlay = useMainStore((state) => state.openOverlay);
41910
41963
  const closeOverlay = useMainStore((state) => state.closeOverlay);
41911
- const [loadedProductData, setLoadedProductData] = reactExports.useState(null);
41964
+ const [vtoProductData, setVtoProductData] = reactExports.useState(null);
41912
41965
  const [selectedSizeLabel, setSelectedSizeLabel] = reactExports.useState(null);
41913
41966
  const [selectedColorLabel, setSelectedColorLabel] = reactExports.useState(null);
41914
41967
  const [modalStyle, setModalStyle] = reactExports.useState({});
41915
41968
  const fetchedVtoSkus = reactExports.useRef(/* @__PURE__ */ new Set());
41916
41969
  const readyVtoSkus = reactExports.useRef(/* @__PURE__ */ new Set());
41970
+ const lastPriorityVtoRequestTimeRef = reactExports.useRef(null);
41917
41971
  reactExports.useEffect(() => {
41918
41972
  if (!userIsLoggedIn) {
41919
41973
  openOverlay(OverlayName.LANDING, {
@@ -41930,15 +41984,25 @@ function VtoSingleOverlay() {
41930
41984
  }
41931
41985
  }, [userIsLoggedIn, userHasAvatar, openOverlay]);
41932
41986
  reactExports.useEffect(() => {
41933
- async function fetchInitialData() {
41987
+ const {
41988
+ currentProduct
41989
+ } = getStaticData();
41990
+ loadProductDataToStore(currentProduct.externalId);
41991
+ }, []);
41992
+ reactExports.useEffect(() => {
41993
+ async function setupInitialVtoData() {
41934
41994
  try {
41935
- logger$2.clearTimers();
41936
- logger$2.timerStart("fetchInitialData");
41937
- logger$2.logDebug("{{ts}} - Starting fetch of initial data");
41938
- logger$2.timerStart("fetchInitialData_1_getProductData");
41939
41995
  const {
41996
+ brandId,
41940
41997
  currentProduct
41941
41998
  } = getStaticData();
41999
+ const storeProduct = storeProductData[currentProduct.externalId];
42000
+ if (!storeProduct) {
42001
+ return;
42002
+ }
42003
+ if ("error" in storeProduct) {
42004
+ throw storeProduct.error;
42005
+ }
41942
42006
  const {
41943
42007
  productName,
41944
42008
  productDescriptionHtml,
@@ -41947,26 +42011,16 @@ function VtoSingleOverlay() {
41947
42011
  const {
41948
42012
  color: selectedColor
41949
42013
  } = await currentProduct.getSelectedOptions();
41950
- logger$2.timerEnd("fetchInitialData_1_getProductData");
41951
- logger$2.timerStart("fetchInitialData_2_getStyleData");
41952
- const styleRec = await getStyleByExternalId(brandId, currentProduct.externalId);
41953
- if (!styleRec) {
41954
- throw new Error(`Style not found for externalId: ${currentProduct.externalId}`);
41955
- }
41956
- const styleGarmentCategoryRec = await getStyleGarmentCategoryById(styleRec.style_garment_category_id);
42014
+ const styleGarmentCategoryRec = storeProduct.styleGarmentCategory;
41957
42015
  const styleCategoryLabel = styleGarmentCategoryRec?.style_category_label ?? null;
41958
- logger$2.timerEnd("fetchInitialData_2_getStyleData");
41959
- logger$2.timerStart("fetchInitialData_3_getSizeRecommendation");
41960
- const sizeRecommendationRecord = await getSizeRecommendation(styleRec.id);
41961
- logger$2.timerEnd("fetchInitialData_3_getSizeRecommendation");
41962
- logger$2.timerStart("fetchInitialData_4_assembleLoadedData");
42016
+ const sizeRecommendationRecord = storeProduct.sizeFitRecommendation;
41963
42017
  {
41964
42018
  const recommendedSizeId = sizeRecommendationRecord.recommended_size.id || null;
41965
42019
  const recommendedSizeLabel = getSizeLabelFromSize(sizeRecommendationRecord.recommended_size);
41966
42020
  if (recommendedSizeId == null || recommendedSizeLabel == null) {
41967
42021
  throw new Error(`No recommended size found for externalId: ${currentProduct.externalId}`);
41968
42022
  }
41969
- let productData;
42023
+ let vtoProductData2;
41970
42024
  {
41971
42025
  const fitClassification = sizeRecommendationRecord.fit_classification;
41972
42026
  const sizes = [];
@@ -42014,7 +42068,7 @@ function VtoSingleOverlay() {
42014
42068
  if (!sizes.length) {
42015
42069
  throw new Error(`No valid sizes found for externalId: ${currentProduct.externalId}`);
42016
42070
  }
42017
- productData = {
42071
+ vtoProductData2 = {
42018
42072
  productName,
42019
42073
  productDescriptionHtml,
42020
42074
  fitClassification,
@@ -42026,7 +42080,7 @@ function VtoSingleOverlay() {
42026
42080
  }
42027
42081
  let recommendedColorLabel = null;
42028
42082
  {
42029
- const recommendedSizeRecord = productData.sizes.find((s) => s.isRecommended);
42083
+ const recommendedSizeRecord = vtoProductData2.sizes.find((s) => s.isRecommended);
42030
42084
  if (!recommendedSizeRecord) {
42031
42085
  throw new Error("Recommended size record not found");
42032
42086
  }
@@ -42038,7 +42092,7 @@ function VtoSingleOverlay() {
42038
42092
  }) || recommendedSizeRecord.colors[0];
42039
42093
  recommendedColorLabel = recommendedSizeColorRecord?.colorLabel ?? null;
42040
42094
  }
42041
- setLoadedProductData(productData);
42095
+ setVtoProductData(vtoProductData2);
42042
42096
  setSelectedSizeLabel(recommendedSizeLabel);
42043
42097
  setSelectedColorLabel(recommendedColorLabel);
42044
42098
  }
@@ -42046,33 +42100,31 @@ function VtoSingleOverlay() {
42046
42100
  fetchedVtoSkus.current.add(sku);
42047
42101
  readyVtoSkus.current.add(sku);
42048
42102
  }
42049
- logger$2.timerEnd("fetchInitialData_4_assembleLoadedData");
42050
- logger$2.timerEnd("fetchInitialData");
42051
- logger$2.logTimer("total", "{{ts}} - Completed fetch of initial data", logger$2.getTimers());
42052
42103
  } catch (error) {
42053
42104
  logger$2.logError("Error fetching initial data:", {
42054
42105
  error
42055
42106
  });
42056
- setLoadedProductData(false);
42107
+ setVtoProductData(false);
42057
42108
  setSelectedSizeLabel(null);
42058
42109
  setSelectedColorLabel(null);
42059
42110
  }
42060
42111
  }
42061
- if (userIsLoggedIn && userHasAvatar && userProfile && loadedProductData == null) {
42062
- fetchInitialData();
42112
+ if (vtoProductData !== null) {
42113
+ return;
42063
42114
  }
42064
- }, [userIsLoggedIn, userHasAvatar, userProfile, loadedProductData]);
42115
+ setupInitialVtoData();
42116
+ }, [storeProductData, vtoProductData, userProfile]);
42065
42117
  const {
42066
42118
  sizeColorRecord: selectedColorSizeRecord,
42067
42119
  availableColorLabels
42068
42120
  } = reactExports.useMemo(() => {
42069
- if (!loadedProductData) {
42121
+ if (!vtoProductData) {
42070
42122
  return {
42071
42123
  sizeColorRecord: null,
42072
42124
  availableColorLabels: []
42073
42125
  };
42074
42126
  }
42075
- const sizeRecord = loadedProductData.sizes.find((s) => s.sizeLabel === selectedSizeLabel);
42127
+ const sizeRecord = vtoProductData.sizes.find((s) => s.sizeLabel === selectedSizeLabel);
42076
42128
  if (!sizeRecord || !sizeRecord.colors.length) {
42077
42129
  return {
42078
42130
  sizeColorRecord: null,
@@ -42085,43 +42137,69 @@ function VtoSingleOverlay() {
42085
42137
  sizeColorRecord,
42086
42138
  availableColorLabels: availableColorLabels2
42087
42139
  };
42088
- }, [loadedProductData, selectedSizeLabel, selectedColorLabel]);
42089
- const requestVto = reactExports.useCallback((sizeColorRecord) => {
42140
+ }, [vtoProductData, selectedSizeLabel, selectedColorLabel]);
42141
+ const requestVto = reactExports.useCallback((sizeColorRecord, priority) => {
42090
42142
  if (fetchedVtoSkus.current.has(sizeColorRecord.sku)) {
42091
42143
  return;
42092
42144
  }
42093
- logger$2.timerStart(`requestVto_${sizeColorRecord.sku}`);
42094
- logger$2.logDebug(`{{ts}} - Requesting VTO for sku: ${sizeColorRecord.sku}`, {
42095
- sizeColorRecord
42096
- });
42097
- fetchedVtoSkus.current.add(sizeColorRecord.sku);
42098
- requestVtoSingle(sizeColorRecord.colorwaySizeAssetId).catch((error) => {
42099
- logger$2.logError("Error requesting VTO:", {
42100
- error,
42145
+ function executeRequest() {
42146
+ logger$2.timerStart(`requestVto_${sizeColorRecord.sku}`);
42147
+ logger$2.logDebug(`{{ts}} - Requesting VTO for sku: ${sizeColorRecord.sku}`, {
42148
+ priority,
42101
42149
  sizeColorRecord
42102
42150
  });
42103
- });
42151
+ fetchedVtoSkus.current.add(sizeColorRecord.sku);
42152
+ requestVtoSingle(sizeColorRecord.colorwaySizeAssetId).catch((error) => {
42153
+ logger$2.logError(`Error requesting VTO for sku: ${sizeColorRecord.sku}`, {
42154
+ error,
42155
+ sizeColorRecord
42156
+ });
42157
+ });
42158
+ }
42159
+ {
42160
+ let delay = 0;
42161
+ if (priority) {
42162
+ lastPriorityVtoRequestTimeRef.current = Date.now();
42163
+ } else {
42164
+ const lastPriorityTime = lastPriorityVtoRequestTimeRef.current;
42165
+ if (lastPriorityTime) {
42166
+ const now = Date.now();
42167
+ const minNextRequestTime = lastPriorityTime + NON_PRIORITY_VTO_REQUEST_DELAY_MS;
42168
+ if (now < minNextRequestTime) {
42169
+ delay = minNextRequestTime - now;
42170
+ }
42171
+ }
42172
+ }
42173
+ if (delay) {
42174
+ setTimeout(executeRequest, delay);
42175
+ return;
42176
+ }
42177
+ }
42178
+ executeRequest();
42104
42179
  }, []);
42105
42180
  reactExports.useEffect(() => {
42106
42181
  if (selectedColorSizeRecord) {
42107
- requestVto(selectedColorSizeRecord);
42182
+ requestVto(selectedColorSizeRecord, true);
42108
42183
  }
42109
42184
  }, [requestVto, selectedColorSizeRecord]);
42110
42185
  reactExports.useEffect(() => {
42111
- if (!loadedProductData) {
42186
+ if (!vtoProductData) {
42112
42187
  return;
42113
42188
  }
42114
- for (const sizeRecord of loadedProductData.sizes) {
42189
+ for (const sizeRecord of vtoProductData.sizes) {
42115
42190
  const sizeColorRecord = sizeRecord.colors.find((c) => c.colorLabel === selectedColorLabel) ?? sizeRecord.colors[0];
42116
42191
  if (sizeColorRecord) {
42117
- requestVto(sizeColorRecord);
42192
+ requestVto(sizeColorRecord, false);
42118
42193
  }
42119
42194
  }
42120
- }, [requestVto, loadedProductData, selectedColorLabel]);
42195
+ }, [requestVto, vtoProductData, selectedColorLabel]);
42121
42196
  const vtoData = reactExports.useMemo(() => {
42122
42197
  if (!userProfile || !selectedColorSizeRecord) {
42123
42198
  return null;
42124
42199
  }
42200
+ const {
42201
+ brandId
42202
+ } = getStaticData();
42125
42203
  const availableSkuData = userProfile.vto?.[brandId];
42126
42204
  if (!availableSkuData) {
42127
42205
  return null;
@@ -42145,6 +42223,7 @@ function VtoSingleOverlay() {
42145
42223
  img.src = frameUrl;
42146
42224
  });
42147
42225
  }
42226
+ logger$2.logDebug(`{{ts}} - Displaying VTO for sku: ${selectedColorSizeRecord.sku}`);
42148
42227
  return vtoData2;
42149
42228
  }, [selectedColorSizeRecord, userProfile]);
42150
42229
  const frameUrls = vtoData?.frames ?? null;
@@ -42176,10 +42255,10 @@ function VtoSingleOverlay() {
42176
42255
  });
42177
42256
  }
42178
42257
  }, [selectedColorLabel, selectedSizeLabel]);
42179
- if (loadedProductData === false) {
42258
+ if (vtoProductData === false) {
42180
42259
  return /* @__PURE__ */ jsx$1(SidecarModalFrame, { onRequestClose: closeOverlay, children: /* @__PURE__ */ jsx$1(NoFitLayout, { onClose: closeOverlay, onSignOut: handleSignOutClick }) });
42181
42260
  }
42182
- if (!userIsLoggedIn || !userHasAvatar || loadedProductData == null || !selectedColorSizeRecord) {
42261
+ if (!userIsLoggedIn || !userHasAvatar || vtoProductData == null || !selectedColorSizeRecord) {
42183
42262
  return /* @__PURE__ */ jsx$1(SidecarModalFrame, { onRequestClose: closeOverlay, children: /* @__PURE__ */ jsx$1(Loading, {}) });
42184
42263
  }
42185
42264
  let Layout;
@@ -42188,7 +42267,7 @@ function VtoSingleOverlay() {
42188
42267
  } else {
42189
42268
  Layout = DesktopLayout;
42190
42269
  }
42191
- return /* @__PURE__ */ jsx$1(SidecarModalFrame, { onRequestClose: closeOverlay, contentStyle: modalStyle, children: /* @__PURE__ */ jsx$1(Layout, { loadedProductData, selectedColorSizeRecord, availableColorLabels, selectedColorLabel, selectedSizeLabel, frameUrls, setModalStyle, onClose: closeOverlay, onChangeColor: setSelectedColorLabel, onChangeSize: setSelectedSizeLabel, onAddToCart: handleAddToCartClick, onSignOut: handleSignOutClick }) });
42270
+ return /* @__PURE__ */ jsx$1(SidecarModalFrame, { onRequestClose: closeOverlay, contentStyle: modalStyle, children: /* @__PURE__ */ jsx$1(Layout, { loadedProductData: vtoProductData, selectedColorSizeRecord, availableColorLabels, selectedColorLabel, selectedSizeLabel, frameUrls, setModalStyle, onClose: closeOverlay, onChangeColor: setSelectedColorLabel, onChangeSize: setSelectedSizeLabel, onAddToCart: handleAddToCartClick, onSignOut: handleSignOutClick }) });
42192
42271
  }
42193
42272
  function NoFitLayout({
42194
42273
  onClose,
@@ -43145,65 +43224,34 @@ function Footer({
43145
43224
  /* @__PURE__ */ jsx$1(SvgTfrName, { css: css2.tfrIcon })
43146
43225
  ] });
43147
43226
  }
43148
- function useSizeRecommendation(load) {
43149
- const [record, setRecord] = reactExports.useState(null);
43150
- const [isLoading, setIsLoading] = reactExports.useState(false);
43151
- const [error, setError] = reactExports.useState(null);
43152
- const {
43153
- userHasAvatar
43154
- } = useMainStore();
43155
- reactExports.useEffect(() => {
43156
- if (!load || !userHasAvatar) {
43157
- return;
43158
- }
43159
- async function fetchSizeRec() {
43160
- const {
43161
- brandId,
43162
- currentProduct
43163
- } = getStaticData();
43164
- try {
43165
- setRecord(null);
43166
- setIsLoading(true);
43167
- setError(null);
43168
- const style = await getStyleByExternalId(brandId, currentProduct.externalId);
43169
- if (!style) {
43170
- throw new Error("Style not found");
43171
- }
43172
- const sizeRecommendationRecord = await getSizeRecommendation(style.id);
43173
- setRecord(sizeRecommendationRecord);
43174
- } catch (error2) {
43175
- setError(error2);
43176
- } finally {
43177
- setIsLoading(false);
43178
- }
43179
- }
43180
- fetchSizeRec();
43181
- }, [load, userHasAvatar]);
43182
- return {
43183
- record,
43184
- isLoading,
43185
- error
43186
- };
43187
- }
43188
43227
  const logger$1 = getLogger("size-rec");
43189
43228
  function SizeRecWidget({}) {
43190
43229
  const openOverlay = useMainStore((state) => state.openOverlay);
43191
43230
  const openedOverlays = useMainStore((state) => state.openedOverlays);
43231
+ const storeProductData = useMainStore((state) => state.productData);
43192
43232
  const hasOpenedVtoSingleOverlay = openedOverlays.includes(OverlayName.VTO_SINGLE);
43193
- const {
43194
- record: sizeRecommendationRecord,
43195
- error: sizeRecommendationError
43196
- } = useSizeRecommendation(hasOpenedVtoSingleOverlay);
43197
- reactExports.useEffect(() => {
43198
- if (sizeRecommendationError) {
43233
+ const sizeRecommendationRecord = reactExports.useMemo(() => {
43234
+ const {
43235
+ currentProduct
43236
+ } = getStaticData();
43237
+ const {
43238
+ externalId
43239
+ } = currentProduct;
43240
+ const productData = storeProductData[externalId];
43241
+ if (!productData) {
43242
+ return null;
43243
+ }
43244
+ if ("error" in productData) {
43199
43245
  logger$1.logError("Error loading size recommendation:", {
43200
- error: sizeRecommendationError
43246
+ error: productData.error
43201
43247
  });
43248
+ return null;
43202
43249
  }
43203
- }, [sizeRecommendationError]);
43250
+ return productData.sizeFitRecommendation || null;
43251
+ }, [storeProductData]);
43204
43252
  const handleLinkClick = reactExports.useCallback(() => {
43205
43253
  openOverlay(OverlayName.VTO_SINGLE);
43206
- }, []);
43254
+ }, [openOverlay]);
43207
43255
  if (!sizeRecommendationRecord || !hasOpenedVtoSingleOverlay) {
43208
43256
  return null;
43209
43257
  }
@@ -43392,6 +43440,14 @@ const useMainStore = create((set) => ({
43392
43440
  userHasAvatar
43393
43441
  });
43394
43442
  },
43443
+ // Product data:
43444
+ productData: {},
43445
+ setProductData: (externalId, data) => set((prevState) => ({
43446
+ productData: {
43447
+ ...prevState.productData,
43448
+ [externalId]: data
43449
+ }
43450
+ })),
43395
43451
  // UI state:
43396
43452
  activeOverlay: null,
43397
43453
  activeOverlayProps: null,
@@ -43446,9 +43502,9 @@ const SHARED_CONFIG = {
43446
43502
  appGooglePlayUrl: "https://play.google.com/store/apps/details?id=com.thefittingroom.marketplace"
43447
43503
  },
43448
43504
  build: {
43449
- version: `${"5.0.11"}`,
43450
- commitHash: `${"77ac921"}`,
43451
- date: `${"2026-02-02T01:20:02.888Z"}`
43505
+ version: `${"5.0.12"}`,
43506
+ commitHash: `${"f90361d"}`,
43507
+ date: `${"2026-02-03T13:13:25.133Z"}`
43452
43508
  }
43453
43509
  };
43454
43510
  const CONFIGS = {
@@ -43529,7 +43585,7 @@ async function init(initParams) {
43529
43585
  if (!Object.values(EnvName).includes(environment)) {
43530
43586
  throw new Error(`Invalid environment "${environment}"`);
43531
43587
  }
43532
- _init$4(debug);
43588
+ _init$5(debug);
43533
43589
  logger2.logDebug("Starting SDK initialization:", {
43534
43590
  initParams
43535
43591
  });
@@ -43543,10 +43599,10 @@ async function init(initParams) {
43543
43599
  environment,
43544
43600
  config
43545
43601
  });
43546
- _init$5();
43547
- _init$6(theme);
43602
+ _init$6();
43603
+ _init$7(theme);
43548
43604
  _init$1();
43549
- await _init$3();
43605
+ await _init$4();
43550
43606
  const authManager2 = getAuthManager();
43551
43607
  authManager2.addAuthStateChangeListener((authUser) => {
43552
43608
  useMainStore.getState().setAuthUser(authUser);
@@ -43554,6 +43610,7 @@ async function init(initParams) {
43554
43610
  authManager2.addUserProfileChangeListener((userProfile) => {
43555
43611
  useMainStore.getState().setUserProfile(userProfile);
43556
43612
  });
43613
+ _init$3();
43557
43614
  _init$2();
43558
43615
  {
43559
43616
  const styleEl = document.createElement("style");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thefittingroom/shop-ui",
3
- "version": "5.0.11",
3
+ "version": "5.0.12",
4
4
  "description": "the fitting room UI library",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",