@web-site-utilities/feedback 0.0.18 → 0.0.19-dev.60aa6a2

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 (55) hide show
  1. package/dist/index.cjs.js +255 -73
  2. package/dist/index.d.ts +94 -53
  3. package/dist/index.es.js +255 -73
  4. package/dist/index.iife.js +255 -73
  5. package/dist/{common → src/common}/components/Checkbox.d.ts +5 -5
  6. package/dist/{common → src/common}/components/ErrorMessage.d.ts +1 -1
  7. package/dist/src/common/components/Modal.d.ts +19 -0
  8. package/dist/{common → src/common}/components/QuestionMatrix.d.ts +6 -4
  9. package/dist/{common → src/common}/components/Radio.d.ts +3 -3
  10. package/dist/{common → src/common}/components/RangeSlide.d.ts +5 -5
  11. package/dist/{common → src/common}/components/Rating.d.ts +1 -1
  12. package/dist/{common → src/common}/components/Select.d.ts +4 -4
  13. package/dist/{common → src/common}/components/Step.d.ts +3 -2
  14. package/dist/{common → src/common}/components/StepsProgress.d.ts +1 -1
  15. package/dist/{common → src/common}/components/TextInput.d.ts +3 -3
  16. package/dist/{common → src/common}/components/Textarea.d.ts +2 -2
  17. package/dist/{common → src/common}/components/Typography.d.ts +2 -2
  18. package/dist/src/common/conf/endpoints.d.ts +5 -0
  19. package/dist/src/common/conf.d.ts +1 -0
  20. package/dist/src/common/conf.template.d.ts +1 -0
  21. package/dist/{common → src/common}/hooks/useStepper.d.ts +3 -0
  22. package/dist/{common → src/common}/theme/ThemeProvider.d.ts +1 -0
  23. package/dist/src/common/theme/breakpoints.d.ts +17 -0
  24. package/dist/src/common/types/DTO.d.ts +2288 -0
  25. package/dist/src/common/types/EndpointsConfig.d.ts +8 -0
  26. package/dist/{common → src/common}/types/FormConfig.d.ts +1 -1
  27. package/dist/{form → src/common}/types/InitiateFeedbackModuleOptions.d.ts +2 -1
  28. package/dist/{fields → src/fields}/Field/Field.d.ts +1 -2
  29. package/dist/{form → src/form}/App.d.ts +3 -4
  30. package/dist/{form → src/form}/api/baseApi.d.ts +3 -1
  31. package/dist/src/form/api/getFormConf.d.ts +8 -0
  32. package/dist/src/form/api/saveForm.d.ts +3 -0
  33. package/dist/src/form/api/useRequest.d.ts +13 -0
  34. package/dist/{form → src/form}/features/InPlaceForm/InPlaceForm.d.ts +10 -4
  35. package/dist/src/form/features/PopupForm/PopupForm.d.ts +11 -0
  36. package/dist/{form → src/form}/index.d.ts +4 -5
  37. package/package.json +6 -7
  38. package/tsconfig.json +7 -6
  39. package/dist/common/components/Modal.d.ts +0 -23
  40. package/dist/form/api/getFormConf.d.ts +0 -8
  41. package/dist/form/api/saveForm.d.ts +0 -2
  42. package/dist/form/api/useRequest.d.ts +0 -9
  43. package/dist/form/features/PopupForm/PopupForm.d.ts +0 -9
  44. /package/dist/{common → src/common}/components/Button.d.ts +0 -0
  45. /package/dist/{common → src/common}/hooks/useForm.d.ts +0 -0
  46. /package/dist/{common → src/common}/types/CommonFieldProps.d.ts +0 -0
  47. /package/dist/{common → src/common}/types/FormError.d.ts +0 -0
  48. /package/dist/{common → src/common}/types/Locale.d.ts +0 -0
  49. /package/dist/{common → src/common}/types/Nullable.d.ts +0 -0
  50. /package/dist/{common → src/common}/types/Option.d.ts +0 -0
  51. /package/dist/{common → src/common}/types/ValidationPerStep.d.ts +0 -0
  52. /package/dist/{common → src/common}/types/isNil.d.ts +0 -0
  53. /package/dist/{form → src/form}/components/FeedbackInput/FeedbackInput.d.ts +0 -0
  54. /package/dist/{form → src/form}/hooks/useIsClient.d.ts +0 -0
  55. /package/dist/{form → src/form}/index.dev.d.ts +0 -0
package/dist/index.es.js CHANGED
@@ -1269,6 +1269,13 @@ const CssVariables = dt.div`
1269
1269
  --depth: ${(props) => props.$theme["depth"]};
1270
1270
  --spacing: ${(props) => props.$theme["spacing"]};
1271
1271
  --all-fields-size: ${(props) => props.$theme["allFieldsSize"]};
1272
+
1273
+ //--breakpoint-xs: 576px;
1274
+ //--breakpoint-s: 576px;
1275
+ //--breakpoint-m: 768px;
1276
+ //--breakpoint-l: 992px;
1277
+ //--breakpoint-xl: 1200px;
1278
+ //--breakpoint-xxl: 1400px;
1272
1279
  `;
1273
1280
  const ThemeProvider = (props) => {
1274
1281
  const selectedVariant = props.selectedVariant ?? "primary";
@@ -1302,8 +1309,33 @@ const useDefaultVariantContentColor = (override) => {
1302
1309
  const colorVariantKey = override ? `${override}Content` : `${defaultVariant}Content`;
1303
1310
  return theme2[colorVariantKey];
1304
1311
  };
1312
+ const env = "DEV";
1313
+ var Environments = /* @__PURE__ */ ((Environments2) => {
1314
+ Environments2["LOCAL"] = "LOCAL";
1315
+ Environments2["DEV"] = "DEV";
1316
+ Environments2["PROD"] = "PROD";
1317
+ return Environments2;
1318
+ })(Environments || {});
1319
+ const endpoints = {
1320
+ [Environments.LOCAL]: {
1321
+ // host: "http://localhost:3000/mock",
1322
+ host: "http://localhost:4000/external"
1323
+ },
1324
+ [Environments.DEV]: {
1325
+ // utils-service is exposed directly at this host, no path prefix.
1326
+ host: "https://utils.dev.zabedovskii.com/external"
1327
+ },
1328
+ [Environments.PROD]: {
1329
+ // Traefik's strip-api-prefix Middleware routes feedback.oiva.dev/api/*
1330
+ // to utils-service with /api removed, landing on the same /external/* routes.
1331
+ host: "https://feedback.oiva.dev/api/external"
1332
+ }
1333
+ };
1334
+ const getEnvironmentConf = () => {
1335
+ return endpoints[env];
1336
+ };
1305
1337
  const createBaseApi = () => {
1306
- const apiUrl = "http://localhost:4000/external";
1338
+ const apiUrl = getEnvironmentConf().host;
1307
1339
  const unwrap = async (req) => {
1308
1340
  const unwrapped = await req;
1309
1341
  if (!unwrapped.ok) {
@@ -1359,20 +1391,26 @@ const createBaseApi = () => {
1359
1391
  };
1360
1392
  };
1361
1393
  const baseApi$1 = createBaseApi();
1362
- const getFormConf = (formId, options) => baseApi$1.get(`/feedback/form/${formId}`, options);
1363
- const useRequest = (request) => {
1394
+ const getFormConf = (payload, options) => baseApi$1.get(`/feedback/form/${payload.formId}?locale=${payload.locale}`, options);
1395
+ const useRequest = (props) => {
1364
1396
  const [data, setData] = useState();
1365
1397
  const [loading, setLoading] = useState(true);
1366
1398
  const [error, setError] = useState(null);
1367
- useEffect(() => {
1399
+ const exec = () => {
1368
1400
  const abortController = new AbortController();
1369
1401
  setLoading(true);
1370
- request(abortController).then((res) => setData(res.data)).catch(setError).finally(() => setLoading(false));
1402
+ props.request().then((res) => setData(res.data)).catch(setError).finally(() => setLoading(false));
1403
+ return abortController;
1404
+ };
1405
+ useEffect(() => {
1406
+ if (props.preventInitial) return () => {
1407
+ };
1408
+ const ac = exec();
1371
1409
  return () => {
1372
- abortController.abort();
1410
+ ac.abort();
1373
1411
  };
1374
1412
  }, []);
1375
- return { data, loading, error };
1413
+ return { data, loading, error, exec };
1376
1414
  };
1377
1415
  const Button = dt.button((props) => {
1378
1416
  const variantColor = useDefaultVariantColor();
@@ -1432,6 +1470,7 @@ const Div$3 = dt.div`
1432
1470
  max-width: 100%;
1433
1471
  @media (max-width: 900px) {
1434
1472
  min-height: auto;
1473
+ display: ${(props) => props.$isVisible ? "block" : "none"};
1435
1474
  height: ${(props) => props.$isVisible ? "auto" : "0"};
1436
1475
  width: ${(props) => props.$isVisible ? "auto" : "0"};
1437
1476
  }
@@ -1445,6 +1484,7 @@ const Step = (props) => {
1445
1484
  }, [ref, props.onSetMaxHeight]);
1446
1485
  return React.createElement(Div$3, {
1447
1486
  ref,
1487
+ key: "step",
1448
1488
  $height: props.height,
1449
1489
  $isVisible: props.isVisible,
1450
1490
  children: props.children
@@ -1653,9 +1693,82 @@ const useForm = (props) => {
1653
1693
  getStateByKey
1654
1694
  };
1655
1695
  };
1656
- const baseApi = createBaseApi();
1657
- const saveForm = (body, options) => baseApi.post(`/feedback-receiver`, body, options);
1658
- /*! @license DOMPurify 3.2.7 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.2.7/LICENSE */
1696
+ const byteToHex = [];
1697
+ for (let i = 0; i < 256; ++i) {
1698
+ byteToHex.push((i + 256).toString(16).slice(1));
1699
+ }
1700
+ function unsafeStringify(arr, offset = 0) {
1701
+ return (byteToHex[arr[offset + 0]] + byteToHex[arr[offset + 1]] + byteToHex[arr[offset + 2]] + byteToHex[arr[offset + 3]] + "-" + byteToHex[arr[offset + 4]] + byteToHex[arr[offset + 5]] + "-" + byteToHex[arr[offset + 6]] + byteToHex[arr[offset + 7]] + "-" + byteToHex[arr[offset + 8]] + byteToHex[arr[offset + 9]] + "-" + byteToHex[arr[offset + 10]] + byteToHex[arr[offset + 11]] + byteToHex[arr[offset + 12]] + byteToHex[arr[offset + 13]] + byteToHex[arr[offset + 14]] + byteToHex[arr[offset + 15]]).toLowerCase();
1702
+ }
1703
+ let getRandomValues;
1704
+ const rnds8 = new Uint8Array(16);
1705
+ function rng() {
1706
+ if (!getRandomValues) {
1707
+ if (typeof crypto === "undefined" || !crypto.getRandomValues) {
1708
+ throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
1709
+ }
1710
+ getRandomValues = crypto.getRandomValues.bind(crypto);
1711
+ }
1712
+ return getRandomValues(rnds8);
1713
+ }
1714
+ const _state = {};
1715
+ function v7(options, buf, offset) {
1716
+ let bytes;
1717
+ {
1718
+ const now = Date.now();
1719
+ const rnds = rng();
1720
+ updateV7State(_state, now, rnds);
1721
+ bytes = v7Bytes(rnds, _state.msecs, _state.seq, buf, offset);
1722
+ }
1723
+ return buf ?? unsafeStringify(bytes);
1724
+ }
1725
+ function updateV7State(state, now, rnds) {
1726
+ state.msecs ?? (state.msecs = -Infinity);
1727
+ state.seq ?? (state.seq = 0);
1728
+ if (now > state.msecs) {
1729
+ state.seq = rnds[6] << 23 | rnds[7] << 16 | rnds[8] << 8 | rnds[9];
1730
+ state.msecs = now;
1731
+ } else {
1732
+ state.seq = state.seq + 1 | 0;
1733
+ if (state.seq === 0) {
1734
+ state.msecs++;
1735
+ }
1736
+ }
1737
+ return state;
1738
+ }
1739
+ function v7Bytes(rnds, msecs, seq, buf, offset = 0) {
1740
+ if (rnds.length < 16) {
1741
+ throw new Error("Random bytes length must be >= 16");
1742
+ }
1743
+ if (!buf) {
1744
+ buf = new Uint8Array(16);
1745
+ offset = 0;
1746
+ } else {
1747
+ if (offset < 0 || offset + 16 > buf.length) {
1748
+ throw new RangeError(`UUID byte range ${offset}:${offset + 15} is out of buffer bounds`);
1749
+ }
1750
+ }
1751
+ msecs ?? (msecs = Date.now());
1752
+ seq ?? (seq = rnds[6] * 127 << 24 | rnds[7] << 16 | rnds[8] << 8 | rnds[9]);
1753
+ buf[offset++] = msecs / 1099511627776 & 255;
1754
+ buf[offset++] = msecs / 4294967296 & 255;
1755
+ buf[offset++] = msecs / 16777216 & 255;
1756
+ buf[offset++] = msecs / 65536 & 255;
1757
+ buf[offset++] = msecs / 256 & 255;
1758
+ buf[offset++] = msecs & 255;
1759
+ buf[offset++] = 112 | seq >>> 28 & 15;
1760
+ buf[offset++] = seq >>> 20 & 255;
1761
+ buf[offset++] = 128 | seq >>> 14 & 63;
1762
+ buf[offset++] = seq >>> 6 & 255;
1763
+ buf[offset++] = seq << 2 & 255 | rnds[10] & 3;
1764
+ buf[offset++] = rnds[11];
1765
+ buf[offset++] = rnds[12];
1766
+ buf[offset++] = rnds[13];
1767
+ buf[offset++] = rnds[14];
1768
+ buf[offset++] = rnds[15];
1769
+ return buf;
1770
+ }
1771
+ /*! @license DOMPurify 3.3.1 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.3.1/LICENSE */
1659
1772
  const {
1660
1773
  entries,
1661
1774
  setPrototypeOf,
@@ -1796,14 +1909,14 @@ function lookupGetter(object, prop) {
1796
1909
  return fallbackValue;
1797
1910
  }
1798
1911
  const html$1 = freeze(["a", "abbr", "acronym", "address", "area", "article", "aside", "audio", "b", "bdi", "bdo", "big", "blink", "blockquote", "body", "br", "button", "canvas", "caption", "center", "cite", "code", "col", "colgroup", "content", "data", "datalist", "dd", "decorator", "del", "details", "dfn", "dialog", "dir", "div", "dl", "dt", "element", "em", "fieldset", "figcaption", "figure", "font", "footer", "form", "h1", "h2", "h3", "h4", "h5", "h6", "head", "header", "hgroup", "hr", "html", "i", "img", "input", "ins", "kbd", "label", "legend", "li", "main", "map", "mark", "marquee", "menu", "menuitem", "meter", "nav", "nobr", "ol", "optgroup", "option", "output", "p", "picture", "pre", "progress", "q", "rp", "rt", "ruby", "s", "samp", "search", "section", "select", "shadow", "slot", "small", "source", "spacer", "span", "strike", "strong", "style", "sub", "summary", "sup", "table", "tbody", "td", "template", "textarea", "tfoot", "th", "thead", "time", "tr", "track", "tt", "u", "ul", "var", "video", "wbr"]);
1799
- const svg$1 = freeze(["svg", "a", "altglyph", "altglyphdef", "altglyphitem", "animatecolor", "animatemotion", "animatetransform", "circle", "clippath", "defs", "desc", "ellipse", "enterkeyhint", "exportparts", "filter", "font", "g", "glyph", "glyphref", "hkern", "image", "inputmode", "line", "lineargradient", "marker", "mask", "metadata", "mpath", "part", "path", "pattern", "polygon", "polyline", "radialgradient", "rect", "slot", "stop", "style", "switch", "symbol", "text", "textpath", "title", "tref", "tspan", "view", "vkern"]);
1912
+ const svg$1 = freeze(["svg", "a", "altglyph", "altglyphdef", "altglyphitem", "animatecolor", "animatemotion", "animatetransform", "circle", "clippath", "defs", "desc", "ellipse", "enterkeyhint", "exportparts", "filter", "font", "g", "glyph", "glyphref", "hkern", "image", "inputmode", "line", "lineargradient", "marker", "mask", "metadata", "mpath", "part", "path", "pattern", "polygon", "polyline", "radialgradient", "rect", "stop", "style", "switch", "symbol", "text", "textpath", "title", "tref", "tspan", "view", "vkern"]);
1800
1913
  const svgFilters = freeze(["feBlend", "feColorMatrix", "feComponentTransfer", "feComposite", "feConvolveMatrix", "feDiffuseLighting", "feDisplacementMap", "feDistantLight", "feDropShadow", "feFlood", "feFuncA", "feFuncB", "feFuncG", "feFuncR", "feGaussianBlur", "feImage", "feMerge", "feMergeNode", "feMorphology", "feOffset", "fePointLight", "feSpecularLighting", "feSpotLight", "feTile", "feTurbulence"]);
1801
1914
  const svgDisallowed = freeze(["animate", "color-profile", "cursor", "discard", "font-face", "font-face-format", "font-face-name", "font-face-src", "font-face-uri", "foreignobject", "hatch", "hatchpath", "mesh", "meshgradient", "meshpatch", "meshrow", "missing-glyph", "script", "set", "solidcolor", "unknown", "use"]);
1802
1915
  const mathMl$1 = freeze(["math", "menclose", "merror", "mfenced", "mfrac", "mglyph", "mi", "mlabeledtr", "mmultiscripts", "mn", "mo", "mover", "mpadded", "mphantom", "mroot", "mrow", "ms", "mspace", "msqrt", "mstyle", "msub", "msup", "msubsup", "mtable", "mtd", "mtext", "mtr", "munder", "munderover", "mprescripts"]);
1803
1916
  const mathMlDisallowed = freeze(["maction", "maligngroup", "malignmark", "mlongdiv", "mscarries", "mscarry", "msgroup", "mstack", "msline", "msrow", "semantics", "annotation", "annotation-xml", "mprescripts", "none"]);
1804
1917
  const text = freeze(["#text"]);
1805
1918
  const html = freeze(["accept", "action", "align", "alt", "autocapitalize", "autocomplete", "autopictureinpicture", "autoplay", "background", "bgcolor", "border", "capture", "cellpadding", "cellspacing", "checked", "cite", "class", "clear", "color", "cols", "colspan", "controls", "controlslist", "coords", "crossorigin", "datetime", "decoding", "default", "dir", "disabled", "disablepictureinpicture", "disableremoteplayback", "download", "draggable", "enctype", "enterkeyhint", "exportparts", "face", "for", "headers", "height", "hidden", "high", "href", "hreflang", "id", "inert", "inputmode", "integrity", "ismap", "kind", "label", "lang", "list", "loading", "loop", "low", "max", "maxlength", "media", "method", "min", "minlength", "multiple", "muted", "name", "nonce", "noshade", "novalidate", "nowrap", "open", "optimum", "part", "pattern", "placeholder", "playsinline", "popover", "popovertarget", "popovertargetaction", "poster", "preload", "pubdate", "radiogroup", "readonly", "rel", "required", "rev", "reversed", "role", "rows", "rowspan", "spellcheck", "scope", "selected", "shape", "size", "sizes", "slot", "span", "srclang", "start", "src", "srcset", "step", "style", "summary", "tabindex", "title", "translate", "type", "usemap", "valign", "value", "width", "wrap", "xmlns", "slot"]);
1806
- const svg = freeze(["accent-height", "accumulate", "additive", "alignment-baseline", "amplitude", "ascent", "attributename", "attributetype", "azimuth", "basefrequency", "baseline-shift", "begin", "bias", "by", "class", "clip", "clippathunits", "clip-path", "clip-rule", "color", "color-interpolation", "color-interpolation-filters", "color-profile", "color-rendering", "cx", "cy", "d", "dx", "dy", "diffuseconstant", "direction", "display", "divisor", "dur", "edgemode", "elevation", "end", "exponent", "fill", "fill-opacity", "fill-rule", "filter", "filterunits", "flood-color", "flood-opacity", "font-family", "font-size", "font-size-adjust", "font-stretch", "font-style", "font-variant", "font-weight", "fx", "fy", "g1", "g2", "glyph-name", "glyphref", "gradientunits", "gradienttransform", "height", "href", "id", "image-rendering", "in", "in2", "intercept", "k", "k1", "k2", "k3", "k4", "kerning", "keypoints", "keysplines", "keytimes", "lang", "lengthadjust", "letter-spacing", "kernelmatrix", "kernelunitlength", "lighting-color", "local", "marker-end", "marker-mid", "marker-start", "markerheight", "markerunits", "markerwidth", "maskcontentunits", "maskunits", "max", "mask", "media", "method", "mode", "min", "name", "numoctaves", "offset", "operator", "opacity", "order", "orient", "orientation", "origin", "overflow", "paint-order", "path", "pathlength", "patterncontentunits", "patterntransform", "patternunits", "points", "preservealpha", "preserveaspectratio", "primitiveunits", "r", "rx", "ry", "radius", "refx", "refy", "repeatcount", "repeatdur", "restart", "result", "rotate", "scale", "seed", "shape-rendering", "slope", "specularconstant", "specularexponent", "spreadmethod", "startoffset", "stddeviation", "stitchtiles", "stop-color", "stop-opacity", "stroke-dasharray", "stroke-dashoffset", "stroke-linecap", "stroke-linejoin", "stroke-miterlimit", "stroke-opacity", "stroke", "stroke-width", "style", "surfacescale", "systemlanguage", "tabindex", "tablevalues", "targetx", "targety", "transform", "transform-origin", "text-anchor", "text-decoration", "text-rendering", "textlength", "type", "u1", "u2", "unicode", "values", "viewbox", "visibility", "version", "vert-adv-y", "vert-origin-x", "vert-origin-y", "width", "word-spacing", "wrap", "writing-mode", "xchannelselector", "ychannelselector", "x", "x1", "x2", "xmlns", "y", "y1", "y2", "z", "zoomandpan"]);
1919
+ const svg = freeze(["accent-height", "accumulate", "additive", "alignment-baseline", "amplitude", "ascent", "attributename", "attributetype", "azimuth", "basefrequency", "baseline-shift", "begin", "bias", "by", "class", "clip", "clippathunits", "clip-path", "clip-rule", "color", "color-interpolation", "color-interpolation-filters", "color-profile", "color-rendering", "cx", "cy", "d", "dx", "dy", "diffuseconstant", "direction", "display", "divisor", "dur", "edgemode", "elevation", "end", "exponent", "fill", "fill-opacity", "fill-rule", "filter", "filterunits", "flood-color", "flood-opacity", "font-family", "font-size", "font-size-adjust", "font-stretch", "font-style", "font-variant", "font-weight", "fx", "fy", "g1", "g2", "glyph-name", "glyphref", "gradientunits", "gradienttransform", "height", "href", "id", "image-rendering", "in", "in2", "intercept", "k", "k1", "k2", "k3", "k4", "kerning", "keypoints", "keysplines", "keytimes", "lang", "lengthadjust", "letter-spacing", "kernelmatrix", "kernelunitlength", "lighting-color", "local", "marker-end", "marker-mid", "marker-start", "markerheight", "markerunits", "markerwidth", "maskcontentunits", "maskunits", "max", "mask", "mask-type", "media", "method", "mode", "min", "name", "numoctaves", "offset", "operator", "opacity", "order", "orient", "orientation", "origin", "overflow", "paint-order", "path", "pathlength", "patterncontentunits", "patterntransform", "patternunits", "points", "preservealpha", "preserveaspectratio", "primitiveunits", "r", "rx", "ry", "radius", "refx", "refy", "repeatcount", "repeatdur", "restart", "result", "rotate", "scale", "seed", "shape-rendering", "slope", "specularconstant", "specularexponent", "spreadmethod", "startoffset", "stddeviation", "stitchtiles", "stop-color", "stop-opacity", "stroke-dasharray", "stroke-dashoffset", "stroke-linecap", "stroke-linejoin", "stroke-miterlimit", "stroke-opacity", "stroke", "stroke-width", "style", "surfacescale", "systemlanguage", "tabindex", "tablevalues", "targetx", "targety", "transform", "transform-origin", "text-anchor", "text-decoration", "text-rendering", "textlength", "type", "u1", "u2", "unicode", "values", "viewbox", "visibility", "version", "vert-adv-y", "vert-origin-x", "vert-origin-y", "width", "word-spacing", "wrap", "writing-mode", "xchannelselector", "ychannelselector", "x", "x1", "x2", "xmlns", "y", "y1", "y2", "z", "zoomandpan"]);
1807
1920
  const mathMl = freeze(["accent", "accentunder", "align", "bevelled", "close", "columnsalign", "columnlines", "columnspan", "denomalign", "depth", "dir", "display", "displaystyle", "encoding", "fence", "frame", "height", "href", "id", "largeop", "length", "linethickness", "lspace", "lquote", "mathbackground", "mathcolor", "mathsize", "mathvariant", "maxsize", "minsize", "movablelimits", "notation", "numalign", "open", "rowalign", "rowlines", "rowspacing", "rowspan", "rspace", "rquote", "scriptlevel", "scriptminsize", "scriptsizemultiplier", "selection", "separator", "separators", "stretchy", "subscriptshift", "supscriptshift", "symmetric", "voffset", "width", "xmlns"]);
1808
1921
  const xml = freeze(["xlink:href", "xml:id", "xlink:title", "xml:space", "xmlns:xlink"]);
1809
1922
  const MUSTACHE_EXPR = seal(/\{\{[\w\W]*|[\w\W]*\}\}/gm);
@@ -1886,7 +1999,7 @@ const _createHooksMap = function _createHooksMap2() {
1886
1999
  function createDOMPurify() {
1887
2000
  let window2 = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : getGlobal();
1888
2001
  const DOMPurify = (root) => createDOMPurify(root);
1889
- DOMPurify.version = "3.2.7";
2002
+ DOMPurify.version = "3.3.1";
1890
2003
  DOMPurify.removed = [];
1891
2004
  if (!window2 || !window2.document || window2.document.nodeType !== NODE_TYPE.document || !window2.Element) {
1892
2005
  DOMPurify.isSupported = false;
@@ -1972,6 +2085,20 @@ function createDOMPurify() {
1972
2085
  }));
1973
2086
  let FORBID_TAGS = null;
1974
2087
  let FORBID_ATTR = null;
2088
+ const EXTRA_ELEMENT_HANDLING = Object.seal(create(null, {
2089
+ tagCheck: {
2090
+ writable: true,
2091
+ configurable: false,
2092
+ enumerable: true,
2093
+ value: null
2094
+ },
2095
+ attributeCheck: {
2096
+ writable: true,
2097
+ configurable: false,
2098
+ enumerable: true,
2099
+ value: null
2100
+ }
2101
+ }));
1975
2102
  let ALLOW_ARIA_ATTR = true;
1976
2103
  let ALLOW_DATA_ATTR = true;
1977
2104
  let ALLOW_UNKNOWN_PROTOCOLS = false;
@@ -2095,16 +2222,24 @@ function createDOMPurify() {
2095
2222
  }
2096
2223
  }
2097
2224
  if (cfg.ADD_TAGS) {
2098
- if (ALLOWED_TAGS === DEFAULT_ALLOWED_TAGS) {
2099
- ALLOWED_TAGS = clone(ALLOWED_TAGS);
2225
+ if (typeof cfg.ADD_TAGS === "function") {
2226
+ EXTRA_ELEMENT_HANDLING.tagCheck = cfg.ADD_TAGS;
2227
+ } else {
2228
+ if (ALLOWED_TAGS === DEFAULT_ALLOWED_TAGS) {
2229
+ ALLOWED_TAGS = clone(ALLOWED_TAGS);
2230
+ }
2231
+ addToSet(ALLOWED_TAGS, cfg.ADD_TAGS, transformCaseFunc);
2100
2232
  }
2101
- addToSet(ALLOWED_TAGS, cfg.ADD_TAGS, transformCaseFunc);
2102
2233
  }
2103
2234
  if (cfg.ADD_ATTR) {
2104
- if (ALLOWED_ATTR === DEFAULT_ALLOWED_ATTR) {
2105
- ALLOWED_ATTR = clone(ALLOWED_ATTR);
2235
+ if (typeof cfg.ADD_ATTR === "function") {
2236
+ EXTRA_ELEMENT_HANDLING.attributeCheck = cfg.ADD_ATTR;
2237
+ } else {
2238
+ if (ALLOWED_ATTR === DEFAULT_ALLOWED_ATTR) {
2239
+ ALLOWED_ATTR = clone(ALLOWED_ATTR);
2240
+ }
2241
+ addToSet(ALLOWED_ATTR, cfg.ADD_ATTR, transformCaseFunc);
2106
2242
  }
2107
- addToSet(ALLOWED_ATTR, cfg.ADD_ATTR, transformCaseFunc);
2108
2243
  }
2109
2244
  if (cfg.ADD_URI_SAFE_ATTR) {
2110
2245
  addToSet(URI_SAFE_ATTRIBUTES, cfg.ADD_URI_SAFE_ATTR, transformCaseFunc);
@@ -2115,6 +2250,12 @@ function createDOMPurify() {
2115
2250
  }
2116
2251
  addToSet(FORBID_CONTENTS, cfg.FORBID_CONTENTS, transformCaseFunc);
2117
2252
  }
2253
+ if (cfg.ADD_FORBID_CONTENTS) {
2254
+ if (FORBID_CONTENTS === DEFAULT_FORBID_CONTENTS) {
2255
+ FORBID_CONTENTS = clone(FORBID_CONTENTS);
2256
+ }
2257
+ addToSet(FORBID_CONTENTS, cfg.ADD_FORBID_CONTENTS, transformCaseFunc);
2258
+ }
2118
2259
  if (KEEP_CONTENT) {
2119
2260
  ALLOWED_TAGS["#text"] = true;
2120
2261
  }
@@ -2310,7 +2451,7 @@ function createDOMPurify() {
2310
2451
  _forceRemove(currentNode);
2311
2452
  return true;
2312
2453
  }
2313
- if (!ALLOWED_TAGS[tagName] || FORBID_TAGS[tagName]) {
2454
+ if (!(EXTRA_ELEMENT_HANDLING.tagCheck instanceof Function && EXTRA_ELEMENT_HANDLING.tagCheck(tagName)) && (!ALLOWED_TAGS[tagName] || FORBID_TAGS[tagName])) {
2314
2455
  if (!FORBID_TAGS[tagName] && _isBasicCustomElement(tagName)) {
2315
2456
  if (CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof RegExp && regExpTest(CUSTOM_ELEMENT_HANDLING.tagNameCheck, tagName)) {
2316
2457
  return false;
@@ -2363,6 +2504,7 @@ function createDOMPurify() {
2363
2504
  }
2364
2505
  if (ALLOW_DATA_ATTR && !FORBID_ATTR[lcName] && regExpTest(DATA_ATTR2, lcName)) ;
2365
2506
  else if (ALLOW_ARIA_ATTR && regExpTest(ARIA_ATTR2, lcName)) ;
2507
+ else if (EXTRA_ELEMENT_HANDLING.attributeCheck instanceof Function && EXTRA_ELEMENT_HANDLING.attributeCheck(lcName, lcTag)) ;
2366
2508
  else if (!ALLOWED_ATTR[lcName] || FORBID_ATTR[lcName]) {
2367
2509
  if (
2368
2510
  // First condition does a very basic check if a) it's basically a valid custom element tagname AND
@@ -2637,6 +2779,13 @@ function createDOMPurify() {
2637
2779
  var purify = createDOMPurify();
2638
2780
  const isNil = (value) => value === void 0 || value === null;
2639
2781
  const isNotNil = (value) => !isNil(value);
2782
+ const baseApi = createBaseApi();
2783
+ const saveForm = (body, options) => baseApi.post(`/feedback`, body, options);
2784
+ const SESSION_ID_SESSION_STORAGE_KEY = "@web-site-utilities/feedback/SESSION_ID_SESSION_STORAGE_KEY";
2785
+ const sessionIdPersistence = {
2786
+ get: () => sessionStorage.getItem(SESSION_ID_SESSION_STORAGE_KEY),
2787
+ set: (value) => sessionStorage.setItem(SESSION_ID_SESSION_STORAGE_KEY, value)
2788
+ };
2640
2789
  const validate = (value, validations) => {
2641
2790
  if (!validations) return null;
2642
2791
  if (validations.required) {
@@ -2673,20 +2822,24 @@ const useStepper = (props) => {
2673
2822
  const [errors, setErrors] = useState([]);
2674
2823
  const saveData = useCallback(async () => {
2675
2824
  try {
2825
+ const sessionId = sessionIdPersistence.get() || `${props.options.sessionId || "NOT_DEFINED"}-${v7()}`;
2826
+ sessionIdPersistence.set(sessionId);
2676
2827
  await saveForm({
2677
- feedbackFormId: props.formId,
2678
- link: window.location.pathname,
2828
+ formId: props.formId,
2829
+ sessionId,
2830
+ versionId: props.versionId,
2831
+ path: window.location.pathname,
2832
+ locale: "en",
2679
2833
  rawHtml: purify.sanitize(document.getElementsByTagName("html")[0] ?? ""),
2680
2834
  domainId: props.domainId,
2681
2835
  data: props.state,
2682
2836
  formType: props.formType,
2683
2837
  viewport: {
2684
- first: document.body.clientWidth,
2685
- second: document.body.clientHeight
2838
+ width: document.body.clientWidth,
2839
+ height: document.body.clientHeight
2686
2840
  },
2687
- browser: {
2841
+ browserInfo: {
2688
2842
  productSub: navigator.productSub,
2689
- vendor: navigator.vendor,
2690
2843
  pdfViewerEnabled: navigator.pdfViewerEnabled,
2691
2844
  maxTouchPoints: navigator.maxTouchPoints,
2692
2845
  hardwareConcurrency: navigator.hardwareConcurrency,
@@ -2695,7 +2848,6 @@ const useStepper = (props) => {
2695
2848
  platform: navigator.platform,
2696
2849
  userAgent: navigator.userAgent,
2697
2850
  language: navigator.language,
2698
- onLine: navigator.onLine,
2699
2851
  webdriver: navigator.webdriver,
2700
2852
  // @ts-ignore
2701
2853
  deviceMemory: navigator.deviceMemory
@@ -2734,7 +2886,7 @@ const useStepper = (props) => {
2734
2886
  return {
2735
2887
  step,
2736
2888
  errors,
2737
- isLastStep: step === props.stepsCount,
2889
+ isLastStep: step + 1 === props.stepsCount,
2738
2890
  onContinue,
2739
2891
  onBack
2740
2892
  };
@@ -2903,9 +3055,6 @@ const MatrixEl = dt(Button)(() => {
2903
3055
  "&:last-of-type": {
2904
3056
  borderTopLeftRadius: "0",
2905
3057
  borderBottomLeftRadius: "0"
2906
- },
2907
- "@media (max-width: 900px)": {
2908
- // display: 'none',
2909
3058
  }
2910
3059
  };
2911
3060
  });
@@ -2917,14 +3066,14 @@ const QuestionMatrixItem = (props) => {
2917
3066
  });
2918
3067
  };
2919
3068
  const TextIndicator = dt("span")(({
2920
- min,
2921
- variant
3069
+ $min,
3070
+ $variant
2922
3071
  }) => {
2923
- const color = variant || useDefaultVariantColor();
3072
+ const color = $variant || useDefaultVariantColor();
2924
3073
  return {
2925
3074
  position: "absolute",
2926
- left: min ? "0" : void 0,
2927
- right: min ? void 0 : "0",
3075
+ left: $min ? "0" : void 0,
3076
+ right: $min ? void 0 : "0",
2928
3077
  bottom: "-2px",
2929
3078
  opacity: "0.5",
2930
3079
  fontWeight: "300",
@@ -2938,25 +3087,29 @@ const QuestionMatrixContainer = dt.div((props) => {
2938
3087
  verticalAlign: "middle",
2939
3088
  display: "inline-flex",
2940
3089
  position: "relative",
2941
- marginBottom: props.withText ? "calc(var(--spacing) * 6)" : "0"
3090
+ marginBottom: props.$withText ? "calc(var(--spacing) * 6)" : "0"
2942
3091
  };
2943
3092
  });
2944
3093
  const QuestionMatrix = (props) => {
2945
3094
  return React.createElement("div", {
2946
3095
  children: [
2947
3096
  React.createElement(Typography, {
3097
+ key: "question-matrix-typography",
2948
3098
  children: props.label,
2949
3099
  variant: "section"
2950
3100
  }),
2951
3101
  React.createElement(QuestionMatrixContainer, {
2952
- withText: props.maxText || props.minText,
3102
+ $withText: props.maxText || props.minText,
3103
+ key: "question-matrix-container",
2953
3104
  children: [
2954
3105
  props.maxText ? React.createElement(TextIndicator, {
2955
- min: false,
3106
+ $min: false,
3107
+ key: `max-text-indicator-${props.maxText}`,
2956
3108
  children: props.maxText
2957
3109
  }) : null,
2958
3110
  props.minText ? React.createElement(TextIndicator, {
2959
- min: true,
3111
+ $min: true,
3112
+ key: `min-text-indicator-${props.minText}`,
2960
3113
  children: props.minText
2961
3114
  }) : null,
2962
3115
  Array(props.max).fill(1).map((_2, i) => {
@@ -2970,6 +3123,7 @@ const QuestionMatrix = (props) => {
2970
3123
  ]
2971
3124
  }),
2972
3125
  React.createElement(ErrorMessage, {
3126
+ key: "question-matrix-errors",
2973
3127
  errors: props.errors
2974
3128
  })
2975
3129
  ]
@@ -3344,15 +3498,17 @@ const Textarea = (props) => {
3344
3498
  children: [
3345
3499
  React.createElement(Typography, {
3346
3500
  variant: "section",
3501
+ key: "textarea-copy",
3347
3502
  children: props.label
3348
3503
  }),
3349
3504
  React.createElement(TextareaStyled, {
3350
3505
  value: props.value ?? "",
3351
- useThemeColors: props.colorVariant,
3506
+ key: "textarea",
3352
3507
  rows: props.rows ?? 3,
3353
3508
  onChange
3354
3509
  }),
3355
3510
  React.createElement(ErrorMessage, {
3511
+ key: "errors",
3356
3512
  errors: props.errors
3357
3513
  })
3358
3514
  ]
@@ -3546,10 +3702,10 @@ const Div = dt.div({
3546
3702
  fontSize: "var(--font-size)"
3547
3703
  });
3548
3704
  const Footer$1 = dt.div`
3549
- display: flex;
3550
- align-items: center;
3551
- justify-content: space-between;
3552
- margin-top: calc(var(--spacing) * 10);
3705
+ display: flex;
3706
+ align-items: center;
3707
+ justify-content: ${(props) => props.$isFirstStep ? `flex-end` : "space-between"};
3708
+ margin-top: calc(var(--spacing) * 10);
3553
3709
  `;
3554
3710
  const InPlaceForm = (props) => {
3555
3711
  const formClientRandomId = useMemo(
@@ -3574,6 +3730,8 @@ const InPlaceForm = (props) => {
3574
3730
  const stepper = useStepper({
3575
3731
  domainId: props.domainId,
3576
3732
  formType: "inlineForm",
3733
+ options: props.options,
3734
+ versionId: props.versionId,
3577
3735
  stepsCount: populatedForm.steps.length,
3578
3736
  validationsPerStep: populatedForm.validationsPerStep,
3579
3737
  formId: props.formId,
@@ -3594,32 +3752,41 @@ const InPlaceForm = (props) => {
3594
3752
  onSetMaxHeight,
3595
3753
  isVisible: index === stepper.step,
3596
3754
  children: step.fields.map(
3597
- (field) => React.createElement(Field, {
3598
- type: field.type,
3599
- fieldProps: field,
3600
- dataField: field.dataField,
3601
- formClientId: formClientRandomId,
3602
- onContinue: stepper.onContinue,
3603
- errors: stepper.errors.filter((e) => e.field === field.dataField),
3604
- getStateByKey: populatedForm.getStateByKey,
3605
- setStateByKey: populatedForm.setStateByKey
3606
- })
3755
+ (field, fieldIndex) => {
3756
+ var _a2;
3757
+ return React.createElement(Field, {
3758
+ key: `${(_a2 = step.meta) == null ? void 0 : _a2.name}-${field.type}-${fieldIndex}`,
3759
+ type: field.type,
3760
+ fieldProps: field,
3761
+ dataField: field.dataField,
3762
+ formClientId: formClientRandomId,
3763
+ onContinue: stepper.onContinue,
3764
+ errors: stepper.errors.filter((e) => e.field === field.dataField),
3765
+ getStateByKey: populatedForm.getStateByKey,
3766
+ setStateByKey: populatedForm.setStateByKey
3767
+ });
3768
+ }
3607
3769
  )
3608
3770
  });
3609
3771
  }
3610
3772
  ),
3611
3773
  React.createElement(Footer$1, {
3774
+ key: "footer-key",
3775
+ $isFirstStep: stepper.step === 0,
3612
3776
  children: [
3613
- React.createElement(Button, {
3777
+ stepper.step === 0 ? null : React.createElement(Button, {
3778
+ key: "btn-key",
3614
3779
  children: props.inlineForm.config.previousButtonText,
3615
3780
  disabled: stepper.step === 0,
3616
3781
  onClick: stepper.onBack
3617
3782
  }),
3618
- React.createElement(StepsProgress, {
3783
+ stepper.step === 0 ? null : React.createElement(StepsProgress, {
3784
+ key: "stepProgress-key",
3619
3785
  steps: populatedForm.steps,
3620
3786
  currentStepIndex: stepper.step
3621
3787
  }),
3622
3788
  React.createElement(Button, {
3789
+ key: "btn-last-key",
3623
3790
  children: stepper.isLastStep ? props.inlineForm.config.submitButtonText : props.inlineForm.config.nextButtonText,
3624
3791
  onClick: stepper.onContinue
3625
3792
  })
@@ -3776,6 +3943,7 @@ const PopupForm = (props) => {
3776
3943
  const stepper = useStepper({
3777
3944
  domainId: props.domainId,
3778
3945
  formType: "inlineForm",
3946
+ options: props.options,
3779
3947
  stepsCount: populatedForm.steps.length,
3780
3948
  validationsPerStep: populatedForm.validationsPerStep,
3781
3949
  formId: props.formId,
@@ -3858,32 +4026,40 @@ const PopupForm = (props) => {
3858
4026
  });
3859
4027
  };
3860
4028
  const App = (props) => {
3861
- const [isClient, setIsClient] = React.useState(false);
3862
- let { data, loading, error } = useRequest(
3863
- () => getFormConf(props.formId)
3864
- );
3865
- React.useEffect(() => setIsClient(true), []);
4029
+ const { formId, locale } = props.options;
4030
+ let { data, loading, error, exec } = useRequest({
4031
+ request: () => getFormConf({
4032
+ formId,
4033
+ locale: locale ?? "en"
4034
+ }),
4035
+ preventInitial: true
4036
+ });
4037
+ React.useEffect(() => {
4038
+ exec();
4039
+ }, []);
3866
4040
  const inPlaceForm = useMemo(() => {
3867
4041
  if (!(data == null ? void 0 : data.inlineForm)) return null;
3868
4042
  return React.createElement(InPlaceForm, {
3869
- key: `inline-form-${props.formId}`,
3870
- formId: props.formId,
4043
+ key: `inline-form-${formId}`,
4044
+ formId,
4045
+ options: props.options,
4046
+ versionId: data.versionId,
3871
4047
  domainId: data.domainId,
3872
4048
  formTheme: data.attributes.theme,
3873
4049
  inlineForm: data.inlineForm
3874
4050
  });
3875
- }, [data == null ? void 0 : data.attributes.theme, data == null ? void 0 : data.domainId, data == null ? void 0 : data.inlineForm, props.formId]);
4051
+ }, [data == null ? void 0 : data.attributes.theme, data == null ? void 0 : data.domainId, data == null ? void 0 : data.inlineForm, formId]);
3876
4052
  const popupForm = useMemo(() => {
3877
4053
  if (!(data == null ? void 0 : data.popupForm)) return null;
3878
4054
  return React.createElement(PopupForm, {
3879
- key: `popup-form-${props.formId}`,
3880
- formId: props.formId,
4055
+ key: `popup-form-${formId}`,
4056
+ formId,
4057
+ options: props.options,
3881
4058
  domainId: data.domainId,
3882
4059
  formTheme: data.attributes.theme,
3883
4060
  popupForm: data.popupForm
3884
4061
  });
3885
- }, [data == null ? void 0 : data.attributes.theme, data == null ? void 0 : data.domainId, data == null ? void 0 : data.inlineForm, props.formId]);
3886
- if (!isClient) return null;
4062
+ }, [data == null ? void 0 : data.attributes.theme, data == null ? void 0 : data.domainId, data == null ? void 0 : data.inlineForm, formId]);
3887
4063
  if (!data && loading) return "Loading...";
3888
4064
  if (!data || error) return error ? error.message : "Unknown error";
3889
4065
  return React.createElement(ThemeProvider, {
@@ -3905,7 +4081,7 @@ const initiateFeedbackModule = (options) => {
3905
4081
  if (typeof window !== "undefined") {
3906
4082
  root.render(
3907
4083
  React.createElement(App, {
3908
- formId: options.formId
4084
+ options
3909
4085
  })
3910
4086
  );
3911
4087
  }
@@ -3921,24 +4097,30 @@ const renderFeedbackModule = (options) => {
3921
4097
  }
3922
4098
  if (typeof window === "undefined") return null;
3923
4099
  return React.createElement(App, {
3924
- formId: options.formId
4100
+ key: options.formId,
4101
+ options
3925
4102
  });
3926
4103
  };
3927
4104
  const FeedbackModule = (options) => {
4105
+ const [isClient, setIsClient] = useState(false);
4106
+ useEffect(() => {
4107
+ setIsClient(true);
4108
+ }, []);
4109
+ if (!isClient) return null;
3928
4110
  return renderFeedbackModule(options);
3929
4111
  };
3930
4112
  const PreviewInPlaceForm = (props) => {
3931
4113
  return React.createElement(ThemeProvider, {
3932
4114
  theme: props.formTheme,
3933
4115
  selectedVariant: props.variant,
3934
- children: [React.createElement(InPlaceForm, props)]
4116
+ children: React.createElement(InPlaceForm, props)
3935
4117
  });
3936
4118
  };
3937
4119
  const PreviewPopupForm = (props) => {
3938
4120
  return React.createElement(ThemeProvider, {
3939
4121
  theme: props.formTheme,
3940
4122
  selectedVariant: props.variant,
3941
- children: [React.createElement(PopupForm, props)]
4123
+ children: React.createElement(PopupForm, props)
3942
4124
  });
3943
4125
  };
3944
4126
  const SurveyFormComponents = {