@magicfeedback/popup-sdk 1.9.0 → 1.10.0

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.
@@ -552,7 +552,7 @@ var init_style = __esm({
552
552
  style_default = `/**
553
553
  * NO EDITAR A MANO \u2014 generado por scripts/vendor-survey-css.mjs
554
554
  *
555
- * Copia de @magicfeedback/native@2.2.22 \u2192 dist/styles/magicfeedback-default.css
555
+ * Copia de @magicfeedback/native@2.2.31 \u2192 dist/styles/magicfeedback-default.css
556
556
  * (la hoja can\xF3nica del paquete, la que apunta su campo "style"), con estos cambios locales:
557
557
  *
558
558
  * 1. Sin el @import de Google Fonts (Nunito): no queremos una petici\xF3n externa desde la
@@ -1536,6 +1536,9 @@ div.magicfeedback-radio {
1536
1536
  width: 100%;
1537
1537
  overflow-x: auto;
1538
1538
  border-radius: var(--mf-radius-md);
1539
+ /* the layout follows the space the survey gets (a pop-in, a sidebar),
1540
+ not the size of the window */
1541
+ container-type: inline-size;
1539
1542
  }
1540
1543
 
1541
1544
  .magicfeedback-multi-question-matrix-table {
@@ -1587,6 +1590,296 @@ div.magicfeedback-radio {
1587
1590
  accent-color: var(--mf-primary);
1588
1591
  }
1589
1592
 
1593
+ .magicfeedback-multi-question-matrix-question {
1594
+ min-width: 200px;
1595
+ padding: 10px;
1596
+ }
1597
+
1598
+ /* the column header names the option in a table; the per-cell label is for
1599
+ screen readers until the rows stack */
1600
+ .magicfeedback-multi-question-matrix-option-label {
1601
+ position: absolute;
1602
+ width: 1px;
1603
+ height: 1px;
1604
+ overflow: hidden;
1605
+ clip: rect(0, 0, 0, 0);
1606
+ white-space: nowrap;
1607
+ }
1608
+
1609
+ /* narrow container: every row becomes its own question with the options
1610
+ stacked underneath, instead of a table cut off at the side */
1611
+ @container (max-width: 599px) {
1612
+ .magicfeedback-multi-question-matrix-table,
1613
+ .magicfeedback-multi-question-matrix-table tbody,
1614
+ .magicfeedback-multi-question-matrix-table tr,
1615
+ .magicfeedback-multi-question-matrix-table td {
1616
+ display: block;
1617
+ width: 100%;
1618
+ }
1619
+
1620
+ .magicfeedback-multi-question-matrix-table thead {
1621
+ display: none;
1622
+ }
1623
+
1624
+ .magicfeedback-multi-question-matrix-row-tr,
1625
+ .magicfeedback-multi-question-matrix-row-tr:nth-child(even) {
1626
+ margin-bottom: var(--mf-space-lg);
1627
+ background: transparent;
1628
+ box-shadow: none;
1629
+ }
1630
+
1631
+ @media (hover: hover) {
1632
+ .magicfeedback-multi-question-matrix-row-tr:hover {
1633
+ margin-bottom: var(--mf-space-lg);
1634
+ background: transparent;
1635
+ box-shadow: none;
1636
+ }
1637
+ }
1638
+
1639
+ .magicfeedback-multi-question-matrix-table td.magicfeedback-multi-question-matrix-question {
1640
+ min-width: 0;
1641
+ padding: 0 0 var(--mf-space-sm);
1642
+ text-align: start;
1643
+ }
1644
+
1645
+ .magicfeedback-multi-question-matrix-question .magicfeedback-multi-question-matrix-label {
1646
+ font-weight: 600;
1647
+ }
1648
+
1649
+ .magicfeedback-multi-question-matrix-table td.magicfeedback-multi-question-matrix-option {
1650
+ display: flex;
1651
+ align-items: center;
1652
+ gap: var(--mf-space-sm);
1653
+ margin-bottom: var(--mf-space-sm);
1654
+ padding: 0 var(--mf-space-md);
1655
+ text-align: start;
1656
+ background: var(--mf-bg-secondary);
1657
+ border: 2px solid var(--mf-border);
1658
+ border-radius: var(--mf-radius-md);
1659
+ cursor: pointer;
1660
+ transition: var(--mf-transition-fast);
1661
+ }
1662
+
1663
+ @media (hover: hover) {
1664
+ .magicfeedback-multi-question-matrix-option:hover {
1665
+ border-color: var(--mf-primary-border);
1666
+ }
1667
+ }
1668
+
1669
+ .magicfeedback-multi-question-matrix-option:has(input:checked) {
1670
+ border-color: var(--mf-primary);
1671
+ background: var(--mf-primary-light);
1672
+ }
1673
+
1674
+ .magicfeedback-multi-question-matrix-table .magicfeedback-multi-question-matrix-option input[type="radio"] {
1675
+ flex-shrink: 0;
1676
+ }
1677
+
1678
+ /* the whole card is the click target */
1679
+ .magicfeedback-multi-question-matrix-option-label {
1680
+ position: static;
1681
+ flex: 1;
1682
+ width: auto;
1683
+ height: auto;
1684
+ padding: var(--mf-space-md) 0;
1685
+ overflow: visible;
1686
+ clip: auto;
1687
+ white-space: normal;
1688
+ font-size: var(--mf-font-size-base);
1689
+ color: var(--mf-text-primary);
1690
+ cursor: pointer;
1691
+ }
1692
+ }
1693
+
1694
+ /* ========================================
1695
+ MAXDIFF (BEST\u2013WORST)
1696
+ ======================================== */
1697
+ .magicfeedback-max-diff {
1698
+ /* "least" gets its own hue, apart from the brand color "most" uses; dark
1699
+ enough to read as header text and to hold the white center dot */
1700
+ --mf-max-diff-worst: #b45309;
1701
+ width: 100%;
1702
+ }
1703
+
1704
+ .magicfeedback-max-diff-container {
1705
+ width: 100%;
1706
+ /* the layout follows the space the survey gets (a pop-in, a sidebar),
1707
+ not the size of the window */
1708
+ container-type: inline-size;
1709
+ }
1710
+
1711
+ .magicfeedback-max-diff-progress {
1712
+ display: flex;
1713
+ align-items: center;
1714
+ gap: var(--mf-space-md);
1715
+ margin-bottom: var(--mf-space-lg);
1716
+ }
1717
+
1718
+ .magicfeedback-max-diff-progress-label {
1719
+ font-size: 0.8125rem;
1720
+ font-weight: var(--mf-font-weight-bold);
1721
+ letter-spacing: 0.04em;
1722
+ text-transform: uppercase;
1723
+ white-space: nowrap;
1724
+ color: var(--mf-text-secondary);
1725
+ }
1726
+
1727
+ .magicfeedback-max-diff-progress-track {
1728
+ flex: 1;
1729
+ height: 6px;
1730
+ overflow: hidden;
1731
+ border-radius: var(--mf-radius-full);
1732
+ background: var(--mf-border);
1733
+ }
1734
+
1735
+ .magicfeedback-max-diff-progress-fill {
1736
+ display: block;
1737
+ height: 100%;
1738
+ border-radius: var(--mf-radius-full);
1739
+ background: var(--mf-primary);
1740
+ }
1741
+
1742
+ .magicfeedback-max-diff-table {
1743
+ width: 100%;
1744
+ border-collapse: collapse;
1745
+ }
1746
+
1747
+ .magicfeedback-max-diff-head,
1748
+ .magicfeedback-max-diff-head-spacer {
1749
+ border-bottom: 1px solid var(--mf-border);
1750
+ }
1751
+
1752
+ .magicfeedback-max-diff-head {
1753
+ width: 11rem;
1754
+ padding: 0 var(--mf-space-sm) var(--mf-space-sm);
1755
+ font-size: 0.8125rem;
1756
+ font-weight: var(--mf-font-weight-extrabold);
1757
+ letter-spacing: 0.04em;
1758
+ text-transform: uppercase;
1759
+ text-align: center;
1760
+ vertical-align: bottom;
1761
+ }
1762
+
1763
+ .magicfeedback-max-diff-head-best {
1764
+ color: var(--mf-primary);
1765
+ }
1766
+
1767
+ .magicfeedback-max-diff-head-worst {
1768
+ color: var(--mf-max-diff-worst);
1769
+ }
1770
+
1771
+ .magicfeedback-max-diff-head-label {
1772
+ display: inline-flex;
1773
+ align-items: center;
1774
+ gap: 6px;
1775
+ }
1776
+
1777
+ .magicfeedback-max-diff-row {
1778
+ transition: background-color 0.15s ease;
1779
+ }
1780
+
1781
+ .magicfeedback-max-diff-row > * {
1782
+ border-bottom: 1px solid var(--mf-border);
1783
+ }
1784
+
1785
+ .magicfeedback-max-diff-row:has(.magicfeedback-max-diff-best:checked) {
1786
+ background-color: color-mix(in srgb, var(--mf-primary) 8%, transparent);
1787
+ }
1788
+
1789
+ .magicfeedback-max-diff-row:has(.magicfeedback-max-diff-worst:checked) {
1790
+ background-color: color-mix(in srgb, var(--mf-max-diff-worst) 8%, transparent);
1791
+ }
1792
+
1793
+ .magicfeedback-max-diff-item {
1794
+ padding: var(--mf-space-md) var(--mf-space-sm);
1795
+ font-size: 1.0625rem;
1796
+ font-weight: var(--mf-font-weight-semibold);
1797
+ line-height: 1.4;
1798
+ text-align: center;
1799
+ color: var(--mf-text-primary);
1800
+ }
1801
+
1802
+ .magicfeedback-max-diff-row:has(input:checked) .magicfeedback-max-diff-item {
1803
+ font-weight: var(--mf-font-weight-extrabold);
1804
+ }
1805
+
1806
+ .magicfeedback-max-diff-cell {
1807
+ padding: 0;
1808
+ }
1809
+
1810
+ /* the whole cell is the click target */
1811
+ .magicfeedback-max-diff-pick {
1812
+ display: flex;
1813
+ align-items: center;
1814
+ justify-content: center;
1815
+ min-height: 64px;
1816
+ cursor: pointer;
1817
+ }
1818
+
1819
+ .magicfeedback-max-diff-input {
1820
+ appearance: none;
1821
+ -webkit-appearance: none;
1822
+ flex-shrink: 0;
1823
+ width: 26px;
1824
+ height: 26px;
1825
+ margin: 0;
1826
+ border: 2px solid color-mix(in srgb, var(--mf-text-secondary) 80%, white);
1827
+ border-radius: var(--mf-radius-full);
1828
+ background: var(--mf-bg-secondary);
1829
+ cursor: pointer;
1830
+ transition: var(--mf-transition-fast);
1831
+ }
1832
+
1833
+ @media (hover: hover) {
1834
+ .magicfeedback-max-diff-pick:hover .magicfeedback-max-diff-input {
1835
+ transform: scale(1.08);
1836
+ }
1837
+ }
1838
+
1839
+ .magicfeedback-max-diff-best:checked {
1840
+ border-color: var(--mf-primary);
1841
+ background: radial-gradient(circle, #FFFFFF 0 4px, var(--mf-primary) 4.5px);
1842
+ }
1843
+
1844
+ .magicfeedback-max-diff-worst:checked {
1845
+ border-color: var(--mf-max-diff-worst);
1846
+ background: radial-gradient(circle, #FFFFFF 0 4px, var(--mf-max-diff-worst) 4.5px);
1847
+ }
1848
+
1849
+ .magicfeedback-max-diff-input:focus-visible {
1850
+ outline: 3px solid var(--mf-primary-border);
1851
+ outline-offset: 3px;
1852
+ }
1853
+
1854
+ /* narrow container: same table, slimmer pick columns and the header icon
1855
+ stacked over its label */
1856
+ @container (max-width: 599px) {
1857
+ .magicfeedback-max-diff-head {
1858
+ width: 4.75rem;
1859
+ padding-inline: 2px;
1860
+ font-size: 0.6875rem;
1861
+ }
1862
+
1863
+ .magicfeedback-max-diff-head-label {
1864
+ flex-direction: column;
1865
+ gap: 2px;
1866
+ }
1867
+
1868
+ .magicfeedback-max-diff-item {
1869
+ padding-inline: 4px;
1870
+ font-size: var(--mf-font-size-base);
1871
+ }
1872
+
1873
+ .magicfeedback-max-diff-pick {
1874
+ min-height: 68px;
1875
+ }
1876
+
1877
+ .magicfeedback-max-diff-input {
1878
+ width: 28px;
1879
+ height: 28px;
1880
+ }
1881
+ }
1882
+
1590
1883
  /* ========================================
1591
1884
  PRIORITY LIST
1592
1885
  ======================================== */
@@ -1777,6 +2070,15 @@ div.magicfeedback-radio {
1777
2070
  }
1778
2071
  }
1779
2072
 
2073
+ /* hidden on the first page; keep the submit button on the right */
2074
+ .magicfeedback-back[hidden] {
2075
+ display: none;
2076
+ }
2077
+
2078
+ .magicfeedback-action-container .magicfeedback-submit {
2079
+ margin-left: auto;
2080
+ }
2081
+
1780
2082
  /* ========================================
1781
2083
  SKIP & COUNTER
1782
2084
  ======================================== */
@@ -3081,10 +3383,14 @@ async function renderPopup(container, surveyId, productId, actions, emit, onClos
3081
3383
  // La pantalla final la pinta el popup: `renderSuccess` de @magicfeedback/native usa
3082
3384
  // textContent, así que el mensaje de la plataforma (HTML con imagen) no se vería, y
3083
3385
  // su fallback es un literal genérico que ignora `style.successMessage`.
3084
- addSuccessScreen: false
3386
+ addSuccessScreen: false,
3387
+ // Surveys multi-idioma: native pide a la API este idioma (el del init o el del
3388
+ // dispositivo) y, si el survey no lo tiene, la API sirve el idioma por defecto.
3389
+ lang: options?.language
3085
3390
  };
3086
- generateOptions.onLoadedEvent = ({ formData }) => {
3087
- const surveyLang = Array.isArray(formData?.lang) ? formData.lang.find((l) => typeof l === "string" && l.trim().length > 0) : void 0;
3391
+ generateOptions.onLoadedEvent = ({ formData, lang }) => {
3392
+ const shownLang = typeof lang === "string" && lang.trim().length > 0 ? lang : void 0;
3393
+ const surveyLang = shownLang ?? (Array.isArray(formData?.lang) ? formData.lang.find((l) => typeof l === "string" && l.trim().length > 0) : void 0);
3088
3394
  if (surveyLang) applyLabels(surveyLang);
3089
3395
  try {
3090
3396
  } catch {
@@ -3460,7 +3766,7 @@ function trimmedOrNull(value) {
3460
3766
  }
3461
3767
  function buildSurveyHtml(opts) {
3462
3768
  const env = opts.env === "development" ? "dev" : "prod";
3463
- const version = opts.version ?? "2.2.22";
3769
+ const version = opts.version ?? "2.2.31";
3464
3770
  const cdn = `https://cdn.jsdelivr.net/npm/@magicfeedback/native@${version}/dist/magicfeedback-sdk.browser.js`;
3465
3771
  const sid = jsonForScript(opts.surveyId);
3466
3772
  const pid = jsonForScript(opts.productId);
@@ -3840,10 +4146,15 @@ ${REVEAL_JS}
3840
4146
  // textContent, as\xED que el mensaje de la plataforma (HTML con imagen) no se ver\xEDa, y su
3841
4147
  // fallback es un literal gen\xE9rico que ignora style.successMessage.
3842
4148
  addSuccessScreen:false,
4149
+ // Surveys multi-idioma: native pide a la API este idioma (el del init o el del
4150
+ // dispositivo); si el survey no lo tiene, la API sirve el idioma por defecto.
4151
+ lang:${initLangJson}||undefined,
3843
4152
  onLoadedEvent:function(args){
3844
- // Idioma del survey: manda sobre el del init para que el chrome no se quede en
3845
- // ingl\xE9s delante de un survey traducido.
3846
- var langs=args && args.formData ? args.formData.lang : null;
4153
+ // Idioma en el que native muestra el survey: manda sobre el del init para que el
4154
+ // chrome no se quede en ingl\xE9s delante de un survey traducido. Native < 2.3 no lo
4155
+ // env\xEDa: entonces el primero de formData.lang (el idioma por defecto).
4156
+ var shown=args && typeof args.lang==='string' && args.lang.trim() ? args.lang : null;
4157
+ var langs=shown ? [shown] : (args && args.formData ? args.formData.lang : null);
3847
4158
  if(langs && langs.length){
3848
4159
  for(var li=0;li<langs.length;li++){
3849
4160
  if(typeof langs[li]==='string' && langs[li].trim()){ ddApplyLabels(langs[li]); break; }