@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.cjs.js CHANGED
@@ -1271,6 +1271,13 @@ const CssVariables = dt.div`
1271
1271
  --depth: ${(props) => props.$theme["depth"]};
1272
1272
  --spacing: ${(props) => props.$theme["spacing"]};
1273
1273
  --all-fields-size: ${(props) => props.$theme["allFieldsSize"]};
1274
+
1275
+ //--breakpoint-xs: 576px;
1276
+ //--breakpoint-s: 576px;
1277
+ //--breakpoint-m: 768px;
1278
+ //--breakpoint-l: 992px;
1279
+ //--breakpoint-xl: 1200px;
1280
+ //--breakpoint-xxl: 1400px;
1274
1281
  `;
1275
1282
  const ThemeProvider = (props) => {
1276
1283
  const selectedVariant = props.selectedVariant ?? "primary";
@@ -1304,8 +1311,33 @@ const useDefaultVariantContentColor = (override) => {
1304
1311
  const colorVariantKey = override ? `${override}Content` : `${defaultVariant}Content`;
1305
1312
  return theme2[colorVariantKey];
1306
1313
  };
1314
+ const env = "DEV";
1315
+ var Environments = /* @__PURE__ */ ((Environments2) => {
1316
+ Environments2["LOCAL"] = "LOCAL";
1317
+ Environments2["DEV"] = "DEV";
1318
+ Environments2["PROD"] = "PROD";
1319
+ return Environments2;
1320
+ })(Environments || {});
1321
+ const endpoints = {
1322
+ [Environments.LOCAL]: {
1323
+ // host: "http://localhost:3000/mock",
1324
+ host: "http://localhost:4000/external"
1325
+ },
1326
+ [Environments.DEV]: {
1327
+ // utils-service is exposed directly at this host, no path prefix.
1328
+ host: "https://utils.dev.zabedovskii.com/external"
1329
+ },
1330
+ [Environments.PROD]: {
1331
+ // Traefik's strip-api-prefix Middleware routes feedback.oiva.dev/api/*
1332
+ // to utils-service with /api removed, landing on the same /external/* routes.
1333
+ host: "https://feedback.oiva.dev/api/external"
1334
+ }
1335
+ };
1336
+ const getEnvironmentConf = () => {
1337
+ return endpoints[env];
1338
+ };
1307
1339
  const createBaseApi = () => {
1308
- const apiUrl = "http://localhost:4000/external";
1340
+ const apiUrl = getEnvironmentConf().host;
1309
1341
  const unwrap = async (req) => {
1310
1342
  const unwrapped = await req;
1311
1343
  if (!unwrapped.ok) {
@@ -1361,20 +1393,26 @@ const createBaseApi = () => {
1361
1393
  };
1362
1394
  };
1363
1395
  const baseApi$1 = createBaseApi();
1364
- const getFormConf = (formId, options) => baseApi$1.get(`/feedback/form/${formId}`, options);
1365
- const useRequest = (request) => {
1396
+ const getFormConf = (payload, options) => baseApi$1.get(`/feedback/form/${payload.formId}?locale=${payload.locale}`, options);
1397
+ const useRequest = (props) => {
1366
1398
  const [data, setData] = React.useState();
1367
1399
  const [loading, setLoading] = React.useState(true);
1368
1400
  const [error, setError] = React.useState(null);
1369
- React.useEffect(() => {
1401
+ const exec = () => {
1370
1402
  const abortController = new AbortController();
1371
1403
  setLoading(true);
1372
- request(abortController).then((res) => setData(res.data)).catch(setError).finally(() => setLoading(false));
1404
+ props.request().then((res) => setData(res.data)).catch(setError).finally(() => setLoading(false));
1405
+ return abortController;
1406
+ };
1407
+ React.useEffect(() => {
1408
+ if (props.preventInitial) return () => {
1409
+ };
1410
+ const ac = exec();
1373
1411
  return () => {
1374
- abortController.abort();
1412
+ ac.abort();
1375
1413
  };
1376
1414
  }, []);
1377
- return { data, loading, error };
1415
+ return { data, loading, error, exec };
1378
1416
  };
1379
1417
  const Button = dt.button((props) => {
1380
1418
  const variantColor = useDefaultVariantColor();
@@ -1434,6 +1472,7 @@ const Div$3 = dt.div`
1434
1472
  max-width: 100%;
1435
1473
  @media (max-width: 900px) {
1436
1474
  min-height: auto;
1475
+ display: ${(props) => props.$isVisible ? "block" : "none"};
1437
1476
  height: ${(props) => props.$isVisible ? "auto" : "0"};
1438
1477
  width: ${(props) => props.$isVisible ? "auto" : "0"};
1439
1478
  }
@@ -1447,6 +1486,7 @@ const Step = (props) => {
1447
1486
  }, [ref, props.onSetMaxHeight]);
1448
1487
  return React.createElement(Div$3, {
1449
1488
  ref,
1489
+ key: "step",
1450
1490
  $height: props.height,
1451
1491
  $isVisible: props.isVisible,
1452
1492
  children: props.children
@@ -1655,9 +1695,82 @@ const useForm = (props) => {
1655
1695
  getStateByKey
1656
1696
  };
1657
1697
  };
1658
- const baseApi = createBaseApi();
1659
- const saveForm = (body, options) => baseApi.post(`/feedback-receiver`, body, options);
1660
- /*! @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 */
1698
+ const byteToHex = [];
1699
+ for (let i = 0; i < 256; ++i) {
1700
+ byteToHex.push((i + 256).toString(16).slice(1));
1701
+ }
1702
+ function unsafeStringify(arr, offset = 0) {
1703
+ 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();
1704
+ }
1705
+ let getRandomValues;
1706
+ const rnds8 = new Uint8Array(16);
1707
+ function rng() {
1708
+ if (!getRandomValues) {
1709
+ if (typeof crypto === "undefined" || !crypto.getRandomValues) {
1710
+ throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
1711
+ }
1712
+ getRandomValues = crypto.getRandomValues.bind(crypto);
1713
+ }
1714
+ return getRandomValues(rnds8);
1715
+ }
1716
+ const _state = {};
1717
+ function v7(options, buf, offset) {
1718
+ let bytes;
1719
+ {
1720
+ const now = Date.now();
1721
+ const rnds = rng();
1722
+ updateV7State(_state, now, rnds);
1723
+ bytes = v7Bytes(rnds, _state.msecs, _state.seq, buf, offset);
1724
+ }
1725
+ return buf ?? unsafeStringify(bytes);
1726
+ }
1727
+ function updateV7State(state, now, rnds) {
1728
+ state.msecs ?? (state.msecs = -Infinity);
1729
+ state.seq ?? (state.seq = 0);
1730
+ if (now > state.msecs) {
1731
+ state.seq = rnds[6] << 23 | rnds[7] << 16 | rnds[8] << 8 | rnds[9];
1732
+ state.msecs = now;
1733
+ } else {
1734
+ state.seq = state.seq + 1 | 0;
1735
+ if (state.seq === 0) {
1736
+ state.msecs++;
1737
+ }
1738
+ }
1739
+ return state;
1740
+ }
1741
+ function v7Bytes(rnds, msecs, seq, buf, offset = 0) {
1742
+ if (rnds.length < 16) {
1743
+ throw new Error("Random bytes length must be >= 16");
1744
+ }
1745
+ if (!buf) {
1746
+ buf = new Uint8Array(16);
1747
+ offset = 0;
1748
+ } else {
1749
+ if (offset < 0 || offset + 16 > buf.length) {
1750
+ throw new RangeError(`UUID byte range ${offset}:${offset + 15} is out of buffer bounds`);
1751
+ }
1752
+ }
1753
+ msecs ?? (msecs = Date.now());
1754
+ seq ?? (seq = rnds[6] * 127 << 24 | rnds[7] << 16 | rnds[8] << 8 | rnds[9]);
1755
+ buf[offset++] = msecs / 1099511627776 & 255;
1756
+ buf[offset++] = msecs / 4294967296 & 255;
1757
+ buf[offset++] = msecs / 16777216 & 255;
1758
+ buf[offset++] = msecs / 65536 & 255;
1759
+ buf[offset++] = msecs / 256 & 255;
1760
+ buf[offset++] = msecs & 255;
1761
+ buf[offset++] = 112 | seq >>> 28 & 15;
1762
+ buf[offset++] = seq >>> 20 & 255;
1763
+ buf[offset++] = 128 | seq >>> 14 & 63;
1764
+ buf[offset++] = seq >>> 6 & 255;
1765
+ buf[offset++] = seq << 2 & 255 | rnds[10] & 3;
1766
+ buf[offset++] = rnds[11];
1767
+ buf[offset++] = rnds[12];
1768
+ buf[offset++] = rnds[13];
1769
+ buf[offset++] = rnds[14];
1770
+ buf[offset++] = rnds[15];
1771
+ return buf;
1772
+ }
1773
+ /*! @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 */
1661
1774
  const {
1662
1775
  entries,
1663
1776
  setPrototypeOf,
@@ -1798,14 +1911,14 @@ function lookupGetter(object, prop) {
1798
1911
  return fallbackValue;
1799
1912
  }
1800
1913
  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"]);
1801
- 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"]);
1914
+ 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"]);
1802
1915
  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"]);
1803
1916
  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"]);
1804
1917
  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"]);
1805
1918
  const mathMlDisallowed = freeze(["maction", "maligngroup", "malignmark", "mlongdiv", "mscarries", "mscarry", "msgroup", "mstack", "msline", "msrow", "semantics", "annotation", "annotation-xml", "mprescripts", "none"]);
1806
1919
  const text = freeze(["#text"]);
1807
1920
  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"]);
1808
- 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"]);
1921
+ 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"]);
1809
1922
  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"]);
1810
1923
  const xml = freeze(["xlink:href", "xml:id", "xlink:title", "xml:space", "xmlns:xlink"]);
1811
1924
  const MUSTACHE_EXPR = seal(/\{\{[\w\W]*|[\w\W]*\}\}/gm);
@@ -1888,7 +2001,7 @@ const _createHooksMap = function _createHooksMap2() {
1888
2001
  function createDOMPurify() {
1889
2002
  let window2 = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : getGlobal();
1890
2003
  const DOMPurify = (root) => createDOMPurify(root);
1891
- DOMPurify.version = "3.2.7";
2004
+ DOMPurify.version = "3.3.1";
1892
2005
  DOMPurify.removed = [];
1893
2006
  if (!window2 || !window2.document || window2.document.nodeType !== NODE_TYPE.document || !window2.Element) {
1894
2007
  DOMPurify.isSupported = false;
@@ -1974,6 +2087,20 @@ function createDOMPurify() {
1974
2087
  }));
1975
2088
  let FORBID_TAGS = null;
1976
2089
  let FORBID_ATTR = null;
2090
+ const EXTRA_ELEMENT_HANDLING = Object.seal(create(null, {
2091
+ tagCheck: {
2092
+ writable: true,
2093
+ configurable: false,
2094
+ enumerable: true,
2095
+ value: null
2096
+ },
2097
+ attributeCheck: {
2098
+ writable: true,
2099
+ configurable: false,
2100
+ enumerable: true,
2101
+ value: null
2102
+ }
2103
+ }));
1977
2104
  let ALLOW_ARIA_ATTR = true;
1978
2105
  let ALLOW_DATA_ATTR = true;
1979
2106
  let ALLOW_UNKNOWN_PROTOCOLS = false;
@@ -2097,16 +2224,24 @@ function createDOMPurify() {
2097
2224
  }
2098
2225
  }
2099
2226
  if (cfg.ADD_TAGS) {
2100
- if (ALLOWED_TAGS === DEFAULT_ALLOWED_TAGS) {
2101
- ALLOWED_TAGS = clone(ALLOWED_TAGS);
2227
+ if (typeof cfg.ADD_TAGS === "function") {
2228
+ EXTRA_ELEMENT_HANDLING.tagCheck = cfg.ADD_TAGS;
2229
+ } else {
2230
+ if (ALLOWED_TAGS === DEFAULT_ALLOWED_TAGS) {
2231
+ ALLOWED_TAGS = clone(ALLOWED_TAGS);
2232
+ }
2233
+ addToSet(ALLOWED_TAGS, cfg.ADD_TAGS, transformCaseFunc);
2102
2234
  }
2103
- addToSet(ALLOWED_TAGS, cfg.ADD_TAGS, transformCaseFunc);
2104
2235
  }
2105
2236
  if (cfg.ADD_ATTR) {
2106
- if (ALLOWED_ATTR === DEFAULT_ALLOWED_ATTR) {
2107
- ALLOWED_ATTR = clone(ALLOWED_ATTR);
2237
+ if (typeof cfg.ADD_ATTR === "function") {
2238
+ EXTRA_ELEMENT_HANDLING.attributeCheck = cfg.ADD_ATTR;
2239
+ } else {
2240
+ if (ALLOWED_ATTR === DEFAULT_ALLOWED_ATTR) {
2241
+ ALLOWED_ATTR = clone(ALLOWED_ATTR);
2242
+ }
2243
+ addToSet(ALLOWED_ATTR, cfg.ADD_ATTR, transformCaseFunc);
2108
2244
  }
2109
- addToSet(ALLOWED_ATTR, cfg.ADD_ATTR, transformCaseFunc);
2110
2245
  }
2111
2246
  if (cfg.ADD_URI_SAFE_ATTR) {
2112
2247
  addToSet(URI_SAFE_ATTRIBUTES, cfg.ADD_URI_SAFE_ATTR, transformCaseFunc);
@@ -2117,6 +2252,12 @@ function createDOMPurify() {
2117
2252
  }
2118
2253
  addToSet(FORBID_CONTENTS, cfg.FORBID_CONTENTS, transformCaseFunc);
2119
2254
  }
2255
+ if (cfg.ADD_FORBID_CONTENTS) {
2256
+ if (FORBID_CONTENTS === DEFAULT_FORBID_CONTENTS) {
2257
+ FORBID_CONTENTS = clone(FORBID_CONTENTS);
2258
+ }
2259
+ addToSet(FORBID_CONTENTS, cfg.ADD_FORBID_CONTENTS, transformCaseFunc);
2260
+ }
2120
2261
  if (KEEP_CONTENT) {
2121
2262
  ALLOWED_TAGS["#text"] = true;
2122
2263
  }
@@ -2312,7 +2453,7 @@ function createDOMPurify() {
2312
2453
  _forceRemove(currentNode);
2313
2454
  return true;
2314
2455
  }
2315
- if (!ALLOWED_TAGS[tagName] || FORBID_TAGS[tagName]) {
2456
+ if (!(EXTRA_ELEMENT_HANDLING.tagCheck instanceof Function && EXTRA_ELEMENT_HANDLING.tagCheck(tagName)) && (!ALLOWED_TAGS[tagName] || FORBID_TAGS[tagName])) {
2316
2457
  if (!FORBID_TAGS[tagName] && _isBasicCustomElement(tagName)) {
2317
2458
  if (CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof RegExp && regExpTest(CUSTOM_ELEMENT_HANDLING.tagNameCheck, tagName)) {
2318
2459
  return false;
@@ -2365,6 +2506,7 @@ function createDOMPurify() {
2365
2506
  }
2366
2507
  if (ALLOW_DATA_ATTR && !FORBID_ATTR[lcName] && regExpTest(DATA_ATTR2, lcName)) ;
2367
2508
  else if (ALLOW_ARIA_ATTR && regExpTest(ARIA_ATTR2, lcName)) ;
2509
+ else if (EXTRA_ELEMENT_HANDLING.attributeCheck instanceof Function && EXTRA_ELEMENT_HANDLING.attributeCheck(lcName, lcTag)) ;
2368
2510
  else if (!ALLOWED_ATTR[lcName] || FORBID_ATTR[lcName]) {
2369
2511
  if (
2370
2512
  // First condition does a very basic check if a) it's basically a valid custom element tagname AND
@@ -2639,6 +2781,13 @@ function createDOMPurify() {
2639
2781
  var purify = createDOMPurify();
2640
2782
  const isNil = (value) => value === void 0 || value === null;
2641
2783
  const isNotNil = (value) => !isNil(value);
2784
+ const baseApi = createBaseApi();
2785
+ const saveForm = (body, options) => baseApi.post(`/feedback`, body, options);
2786
+ const SESSION_ID_SESSION_STORAGE_KEY = "@web-site-utilities/feedback/SESSION_ID_SESSION_STORAGE_KEY";
2787
+ const sessionIdPersistence = {
2788
+ get: () => sessionStorage.getItem(SESSION_ID_SESSION_STORAGE_KEY),
2789
+ set: (value) => sessionStorage.setItem(SESSION_ID_SESSION_STORAGE_KEY, value)
2790
+ };
2642
2791
  const validate = (value, validations) => {
2643
2792
  if (!validations) return null;
2644
2793
  if (validations.required) {
@@ -2675,20 +2824,24 @@ const useStepper = (props) => {
2675
2824
  const [errors, setErrors] = React.useState([]);
2676
2825
  const saveData = React.useCallback(async () => {
2677
2826
  try {
2827
+ const sessionId = sessionIdPersistence.get() || `${props.options.sessionId || "NOT_DEFINED"}-${v7()}`;
2828
+ sessionIdPersistence.set(sessionId);
2678
2829
  await saveForm({
2679
- feedbackFormId: props.formId,
2680
- link: window.location.pathname,
2830
+ formId: props.formId,
2831
+ sessionId,
2832
+ versionId: props.versionId,
2833
+ path: window.location.pathname,
2834
+ locale: "en",
2681
2835
  rawHtml: purify.sanitize(document.getElementsByTagName("html")[0] ?? ""),
2682
2836
  domainId: props.domainId,
2683
2837
  data: props.state,
2684
2838
  formType: props.formType,
2685
2839
  viewport: {
2686
- first: document.body.clientWidth,
2687
- second: document.body.clientHeight
2840
+ width: document.body.clientWidth,
2841
+ height: document.body.clientHeight
2688
2842
  },
2689
- browser: {
2843
+ browserInfo: {
2690
2844
  productSub: navigator.productSub,
2691
- vendor: navigator.vendor,
2692
2845
  pdfViewerEnabled: navigator.pdfViewerEnabled,
2693
2846
  maxTouchPoints: navigator.maxTouchPoints,
2694
2847
  hardwareConcurrency: navigator.hardwareConcurrency,
@@ -2697,7 +2850,6 @@ const useStepper = (props) => {
2697
2850
  platform: navigator.platform,
2698
2851
  userAgent: navigator.userAgent,
2699
2852
  language: navigator.language,
2700
- onLine: navigator.onLine,
2701
2853
  webdriver: navigator.webdriver,
2702
2854
  // @ts-ignore
2703
2855
  deviceMemory: navigator.deviceMemory
@@ -2736,7 +2888,7 @@ const useStepper = (props) => {
2736
2888
  return {
2737
2889
  step,
2738
2890
  errors,
2739
- isLastStep: step === props.stepsCount,
2891
+ isLastStep: step + 1 === props.stepsCount,
2740
2892
  onContinue,
2741
2893
  onBack
2742
2894
  };
@@ -2905,9 +3057,6 @@ const MatrixEl = dt(Button)(() => {
2905
3057
  "&:last-of-type": {
2906
3058
  borderTopLeftRadius: "0",
2907
3059
  borderBottomLeftRadius: "0"
2908
- },
2909
- "@media (max-width: 900px)": {
2910
- // display: 'none',
2911
3060
  }
2912
3061
  };
2913
3062
  });
@@ -2919,14 +3068,14 @@ const QuestionMatrixItem = (props) => {
2919
3068
  });
2920
3069
  };
2921
3070
  const TextIndicator = dt("span")(({
2922
- min,
2923
- variant
3071
+ $min,
3072
+ $variant
2924
3073
  }) => {
2925
- const color = variant || useDefaultVariantColor();
3074
+ const color = $variant || useDefaultVariantColor();
2926
3075
  return {
2927
3076
  position: "absolute",
2928
- left: min ? "0" : void 0,
2929
- right: min ? void 0 : "0",
3077
+ left: $min ? "0" : void 0,
3078
+ right: $min ? void 0 : "0",
2930
3079
  bottom: "-2px",
2931
3080
  opacity: "0.5",
2932
3081
  fontWeight: "300",
@@ -2940,25 +3089,29 @@ const QuestionMatrixContainer = dt.div((props) => {
2940
3089
  verticalAlign: "middle",
2941
3090
  display: "inline-flex",
2942
3091
  position: "relative",
2943
- marginBottom: props.withText ? "calc(var(--spacing) * 6)" : "0"
3092
+ marginBottom: props.$withText ? "calc(var(--spacing) * 6)" : "0"
2944
3093
  };
2945
3094
  });
2946
3095
  const QuestionMatrix = (props) => {
2947
3096
  return React.createElement("div", {
2948
3097
  children: [
2949
3098
  React.createElement(Typography, {
3099
+ key: "question-matrix-typography",
2950
3100
  children: props.label,
2951
3101
  variant: "section"
2952
3102
  }),
2953
3103
  React.createElement(QuestionMatrixContainer, {
2954
- withText: props.maxText || props.minText,
3104
+ $withText: props.maxText || props.minText,
3105
+ key: "question-matrix-container",
2955
3106
  children: [
2956
3107
  props.maxText ? React.createElement(TextIndicator, {
2957
- min: false,
3108
+ $min: false,
3109
+ key: `max-text-indicator-${props.maxText}`,
2958
3110
  children: props.maxText
2959
3111
  }) : null,
2960
3112
  props.minText ? React.createElement(TextIndicator, {
2961
- min: true,
3113
+ $min: true,
3114
+ key: `min-text-indicator-${props.minText}`,
2962
3115
  children: props.minText
2963
3116
  }) : null,
2964
3117
  Array(props.max).fill(1).map((_2, i) => {
@@ -2972,6 +3125,7 @@ const QuestionMatrix = (props) => {
2972
3125
  ]
2973
3126
  }),
2974
3127
  React.createElement(ErrorMessage, {
3128
+ key: "question-matrix-errors",
2975
3129
  errors: props.errors
2976
3130
  })
2977
3131
  ]
@@ -3346,15 +3500,17 @@ const Textarea = (props) => {
3346
3500
  children: [
3347
3501
  React.createElement(Typography, {
3348
3502
  variant: "section",
3503
+ key: "textarea-copy",
3349
3504
  children: props.label
3350
3505
  }),
3351
3506
  React.createElement(TextareaStyled, {
3352
3507
  value: props.value ?? "",
3353
- useThemeColors: props.colorVariant,
3508
+ key: "textarea",
3354
3509
  rows: props.rows ?? 3,
3355
3510
  onChange
3356
3511
  }),
3357
3512
  React.createElement(ErrorMessage, {
3513
+ key: "errors",
3358
3514
  errors: props.errors
3359
3515
  })
3360
3516
  ]
@@ -3548,10 +3704,10 @@ const Div = dt.div({
3548
3704
  fontSize: "var(--font-size)"
3549
3705
  });
3550
3706
  const Footer$1 = dt.div`
3551
- display: flex;
3552
- align-items: center;
3553
- justify-content: space-between;
3554
- margin-top: calc(var(--spacing) * 10);
3707
+ display: flex;
3708
+ align-items: center;
3709
+ justify-content: ${(props) => props.$isFirstStep ? `flex-end` : "space-between"};
3710
+ margin-top: calc(var(--spacing) * 10);
3555
3711
  `;
3556
3712
  const InPlaceForm = (props) => {
3557
3713
  const formClientRandomId = React.useMemo(
@@ -3576,6 +3732,8 @@ const InPlaceForm = (props) => {
3576
3732
  const stepper = useStepper({
3577
3733
  domainId: props.domainId,
3578
3734
  formType: "inlineForm",
3735
+ options: props.options,
3736
+ versionId: props.versionId,
3579
3737
  stepsCount: populatedForm.steps.length,
3580
3738
  validationsPerStep: populatedForm.validationsPerStep,
3581
3739
  formId: props.formId,
@@ -3596,32 +3754,41 @@ const InPlaceForm = (props) => {
3596
3754
  onSetMaxHeight,
3597
3755
  isVisible: index === stepper.step,
3598
3756
  children: step.fields.map(
3599
- (field) => React.createElement(Field, {
3600
- type: field.type,
3601
- fieldProps: field,
3602
- dataField: field.dataField,
3603
- formClientId: formClientRandomId,
3604
- onContinue: stepper.onContinue,
3605
- errors: stepper.errors.filter((e) => e.field === field.dataField),
3606
- getStateByKey: populatedForm.getStateByKey,
3607
- setStateByKey: populatedForm.setStateByKey
3608
- })
3757
+ (field, fieldIndex) => {
3758
+ var _a2;
3759
+ return React.createElement(Field, {
3760
+ key: `${(_a2 = step.meta) == null ? void 0 : _a2.name}-${field.type}-${fieldIndex}`,
3761
+ type: field.type,
3762
+ fieldProps: field,
3763
+ dataField: field.dataField,
3764
+ formClientId: formClientRandomId,
3765
+ onContinue: stepper.onContinue,
3766
+ errors: stepper.errors.filter((e) => e.field === field.dataField),
3767
+ getStateByKey: populatedForm.getStateByKey,
3768
+ setStateByKey: populatedForm.setStateByKey
3769
+ });
3770
+ }
3609
3771
  )
3610
3772
  });
3611
3773
  }
3612
3774
  ),
3613
3775
  React.createElement(Footer$1, {
3776
+ key: "footer-key",
3777
+ $isFirstStep: stepper.step === 0,
3614
3778
  children: [
3615
- React.createElement(Button, {
3779
+ stepper.step === 0 ? null : React.createElement(Button, {
3780
+ key: "btn-key",
3616
3781
  children: props.inlineForm.config.previousButtonText,
3617
3782
  disabled: stepper.step === 0,
3618
3783
  onClick: stepper.onBack
3619
3784
  }),
3620
- React.createElement(StepsProgress, {
3785
+ stepper.step === 0 ? null : React.createElement(StepsProgress, {
3786
+ key: "stepProgress-key",
3621
3787
  steps: populatedForm.steps,
3622
3788
  currentStepIndex: stepper.step
3623
3789
  }),
3624
3790
  React.createElement(Button, {
3791
+ key: "btn-last-key",
3625
3792
  children: stepper.isLastStep ? props.inlineForm.config.submitButtonText : props.inlineForm.config.nextButtonText,
3626
3793
  onClick: stepper.onContinue
3627
3794
  })
@@ -3778,6 +3945,7 @@ const PopupForm = (props) => {
3778
3945
  const stepper = useStepper({
3779
3946
  domainId: props.domainId,
3780
3947
  formType: "inlineForm",
3948
+ options: props.options,
3781
3949
  stepsCount: populatedForm.steps.length,
3782
3950
  validationsPerStep: populatedForm.validationsPerStep,
3783
3951
  formId: props.formId,
@@ -3860,32 +4028,40 @@ const PopupForm = (props) => {
3860
4028
  });
3861
4029
  };
3862
4030
  const App = (props) => {
3863
- const [isClient, setIsClient] = React.useState(false);
3864
- let { data, loading, error } = useRequest(
3865
- () => getFormConf(props.formId)
3866
- );
3867
- React.useEffect(() => setIsClient(true), []);
4031
+ const { formId, locale } = props.options;
4032
+ let { data, loading, error, exec } = useRequest({
4033
+ request: () => getFormConf({
4034
+ formId,
4035
+ locale: locale ?? "en"
4036
+ }),
4037
+ preventInitial: true
4038
+ });
4039
+ React.useEffect(() => {
4040
+ exec();
4041
+ }, []);
3868
4042
  const inPlaceForm = React.useMemo(() => {
3869
4043
  if (!(data == null ? void 0 : data.inlineForm)) return null;
3870
4044
  return React.createElement(InPlaceForm, {
3871
- key: `inline-form-${props.formId}`,
3872
- formId: props.formId,
4045
+ key: `inline-form-${formId}`,
4046
+ formId,
4047
+ options: props.options,
4048
+ versionId: data.versionId,
3873
4049
  domainId: data.domainId,
3874
4050
  formTheme: data.attributes.theme,
3875
4051
  inlineForm: data.inlineForm
3876
4052
  });
3877
- }, [data == null ? void 0 : data.attributes.theme, data == null ? void 0 : data.domainId, data == null ? void 0 : data.inlineForm, props.formId]);
4053
+ }, [data == null ? void 0 : data.attributes.theme, data == null ? void 0 : data.domainId, data == null ? void 0 : data.inlineForm, formId]);
3878
4054
  const popupForm = React.useMemo(() => {
3879
4055
  if (!(data == null ? void 0 : data.popupForm)) return null;
3880
4056
  return React.createElement(PopupForm, {
3881
- key: `popup-form-${props.formId}`,
3882
- formId: props.formId,
4057
+ key: `popup-form-${formId}`,
4058
+ formId,
4059
+ options: props.options,
3883
4060
  domainId: data.domainId,
3884
4061
  formTheme: data.attributes.theme,
3885
4062
  popupForm: data.popupForm
3886
4063
  });
3887
- }, [data == null ? void 0 : data.attributes.theme, data == null ? void 0 : data.domainId, data == null ? void 0 : data.inlineForm, props.formId]);
3888
- if (!isClient) return null;
4064
+ }, [data == null ? void 0 : data.attributes.theme, data == null ? void 0 : data.domainId, data == null ? void 0 : data.inlineForm, formId]);
3889
4065
  if (!data && loading) return "Loading...";
3890
4066
  if (!data || error) return error ? error.message : "Unknown error";
3891
4067
  return React.createElement(ThemeProvider, {
@@ -3907,7 +4083,7 @@ const initiateFeedbackModule = (options) => {
3907
4083
  if (typeof window !== "undefined") {
3908
4084
  root.render(
3909
4085
  React.createElement(App, {
3910
- formId: options.formId
4086
+ options
3911
4087
  })
3912
4088
  );
3913
4089
  }
@@ -3923,24 +4099,30 @@ const renderFeedbackModule = (options) => {
3923
4099
  }
3924
4100
  if (typeof window === "undefined") return null;
3925
4101
  return React.createElement(App, {
3926
- formId: options.formId
4102
+ key: options.formId,
4103
+ options
3927
4104
  });
3928
4105
  };
3929
4106
  const FeedbackModule = (options) => {
4107
+ const [isClient, setIsClient] = React.useState(false);
4108
+ React.useEffect(() => {
4109
+ setIsClient(true);
4110
+ }, []);
4111
+ if (!isClient) return null;
3930
4112
  return renderFeedbackModule(options);
3931
4113
  };
3932
4114
  const PreviewInPlaceForm = (props) => {
3933
4115
  return React.createElement(ThemeProvider, {
3934
4116
  theme: props.formTheme,
3935
4117
  selectedVariant: props.variant,
3936
- children: [React.createElement(InPlaceForm, props)]
4118
+ children: React.createElement(InPlaceForm, props)
3937
4119
  });
3938
4120
  };
3939
4121
  const PreviewPopupForm = (props) => {
3940
4122
  return React.createElement(ThemeProvider, {
3941
4123
  theme: props.formTheme,
3942
4124
  selectedVariant: props.variant,
3943
- children: [React.createElement(PopupForm, props)]
4125
+ children: React.createElement(PopupForm, props)
3944
4126
  });
3945
4127
  };
3946
4128
  const SurveyFormComponents = {