@sprig-technologies/sprig-browser 2.41.3 → 2.42.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.
- package/dist/{conversational-ui-Dh8pa8lZ.js → conversational-ui-AwKR1XUT.js} +4 -4
- package/dist/{conversational-ui-CA3qI7QP.cjs → conversational-ui-DtwfDSqx.cjs} +1 -1
- package/dist/core-CP9Lrdyw.cjs +12 -0
- package/dist/core-bEj9FkiJ.js +1003 -0
- package/dist/core.cjs +1 -1
- package/dist/core.d.ts +33 -49
- package/dist/core.js +6 -5
- package/dist/{getAttributedUrl-DUf8Ossa.js → getAttributedUrl-BGCIZtTj.js} +3 -3
- package/dist/{getAttributedUrl-NpiI9_tt.cjs → getAttributedUrl-pgeeuX2S.cjs} +1 -1
- package/dist/{index-D3K1BCMf.js → index-C7zv53wV.js} +66 -66
- package/dist/{index-Dx7xdcFy.cjs → index-lO4vq_pY.cjs} +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +33 -49
- package/dist/index.js +7 -6
- package/dist/{metricsReporter-DYupscmb.cjs → metricsReporter-DTdxsqej.cjs} +1 -1
- package/dist/{metricsReporter-BGxaFPwL.js → metricsReporter-DbRyYFfD.js} +1 -1
- package/dist/replay.cjs +1 -1
- package/dist/replay.js +410 -408
- package/dist/{view-CbuHTm4G.js → view-BqGpnqXK.js} +88 -85
- package/dist/view-CmZqxMJO.cjs +1 -0
- package/package.json +1 -1
- package/dist/core-Ciwf_Oir.cjs +0 -12
- package/dist/core-DcjPmwAM.js +0 -975
- package/dist/view-D7g2wJX6.cjs +0 -1
package/dist/core.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const i=require("./metricsReporter-
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const i=require("./metricsReporter-DTdxsqej.cjs"),e=require("./core-CP9Lrdyw.cjs");exports.DismissReason=i.DismissReason,exports.SprigEvent=i.SprigEvent,exports.Sprig=e.Sprig,exports.SprigAPI=e.SprigAPI,exports.default=e.core,exports.sprig=e.sprig;
|
package/dist/core.d.ts
CHANGED
|
@@ -1827,7 +1827,6 @@ interface Config extends MobileReplayConfig {
|
|
|
1827
1827
|
interactiveEventsHandler?: (e: MouseEvent) => void;
|
|
1828
1828
|
isConversationalUI?: boolean;
|
|
1829
1829
|
isOnQuestionsTab?: boolean;
|
|
1830
|
-
isPreview?: boolean;
|
|
1831
1830
|
launchDarklyEnabled?: boolean;
|
|
1832
1831
|
layout: StudyLayout;
|
|
1833
1832
|
locale: string;
|
|
@@ -1935,45 +1934,6 @@ type EventDigest = {
|
|
|
1935
1934
|
type: "Sprig_ReplayResumed";
|
|
1936
1935
|
};
|
|
1937
1936
|
|
|
1938
|
-
declare namespace optimizely {
|
|
1939
|
-
interface Optimizely {
|
|
1940
|
-
get?: (key: "state") => {
|
|
1941
|
-
getExperimentStates: (options: {
|
|
1942
|
-
filter?: unknown;
|
|
1943
|
-
isActive?: boolean;
|
|
1944
|
-
}) => Record<string, OptimizelyExperimentState>;
|
|
1945
|
-
};
|
|
1946
|
-
}
|
|
1947
|
-
|
|
1948
|
-
// Ref: https://docs.developers.optimizely.com/web/docs/state#return-value-2
|
|
1949
|
-
interface OptimizelyExperimentState {
|
|
1950
|
-
/** Audiences the visitor was in when the experiment was activated.
|
|
1951
|
-
* @example { "id": "6672770135", "name": "Chrome users" }
|
|
1952
|
-
*/
|
|
1953
|
-
audiences: { id: number; name: string }[];
|
|
1954
|
-
/** The name of the experiment
|
|
1955
|
-
* @example OptimizelyExperimentState
|
|
1956
|
-
* */
|
|
1957
|
-
experimentName: string;
|
|
1958
|
-
/** The ID of the experiment
|
|
1959
|
-
* @example OptimizelyExperimentState
|
|
1960
|
-
* */
|
|
1961
|
-
id: string;
|
|
1962
|
-
/** Indicates if the experiment is currently active */
|
|
1963
|
-
isActive: boolean;
|
|
1964
|
-
/** Indicates if the visitor is in the holdback (i.e., is excluded due traffic allocation) */
|
|
1965
|
-
isInExperimentHoldback: boolean;
|
|
1966
|
-
/** The name of the object. Required */
|
|
1967
|
-
name: string;
|
|
1968
|
-
/** An object with the name and the ID of the variation the visitor is bucketed in, or null if the visitor was not bucketed
|
|
1969
|
-
* @example { "id": "6626731852", "name": "Variation #1" }
|
|
1970
|
-
*/
|
|
1971
|
-
variation: { id: number; name: string } | null;
|
|
1972
|
-
/** Indicates if the visitor was redirected due to this experiment */
|
|
1973
|
-
visitorRedirected: boolean;
|
|
1974
|
-
}
|
|
1975
|
-
}
|
|
1976
|
-
|
|
1977
1937
|
declare namespace sprigConfig {
|
|
1978
1938
|
type IdentifyResult = Promise<
|
|
1979
1939
|
| {
|
|
@@ -2170,6 +2130,33 @@ declare global {
|
|
|
2170
2130
|
SprigLoggerCallback?: (message: string) => void;
|
|
2171
2131
|
}
|
|
2172
2132
|
|
|
2133
|
+
/* eslint-disable no-var */
|
|
2134
|
+
var __cfg: Config;
|
|
2135
|
+
var _sprigReinitialize: () => void;
|
|
2136
|
+
var attachEvent: typeof window.addEventListener | undefined;
|
|
2137
|
+
var Backbone: {
|
|
2138
|
+
history: typeof window.history;
|
|
2139
|
+
};
|
|
2140
|
+
var Intercom: { ul_wasVisible?: boolean } & ((
|
|
2141
|
+
method: string,
|
|
2142
|
+
data?: unknown,
|
|
2143
|
+
) => void);
|
|
2144
|
+
var optimizely: optimizely.Optimizely;
|
|
2145
|
+
var optimizelyDatafile: object;
|
|
2146
|
+
var previewMode: unknown;
|
|
2147
|
+
var UpChunk: {
|
|
2148
|
+
createUpload: typeof createUpload;
|
|
2149
|
+
};
|
|
2150
|
+
var _Sprig: sprigConfig.WindowSprig | undefined;
|
|
2151
|
+
var Sprig: sprigConfig.WindowSprig;
|
|
2152
|
+
var UserLeap: sprigConfig.WindowSprig & {
|
|
2153
|
+
windowDimensions?: { height: number; width: number };
|
|
2154
|
+
};
|
|
2155
|
+
var rrwebRecord: (typeof _rrweb_record)["record"] | undefined;
|
|
2156
|
+
var sprigAPI: { openUrl: (url: string) => void } | undefined;
|
|
2157
|
+
var SprigLoggerCallback: (message: string) => void | undefined;
|
|
2158
|
+
/* eslint-enable no-var */
|
|
2159
|
+
|
|
2173
2160
|
type WindowSprig = sprigConfig.WindowSprig;
|
|
2174
2161
|
type SprigAttributes = Record<string, boolean | number | string>;
|
|
2175
2162
|
type SprigListener = Listener<unknown[]>;
|
|
@@ -2216,17 +2203,12 @@ declare class SprigAPI {
|
|
|
2216
2203
|
SURVEY_WILL_PRESENT: SprigEvent;
|
|
2217
2204
|
QUESTION_ANSWERED: SprigEvent;
|
|
2218
2205
|
REPLAY_CAPTURE: SprigEvent;
|
|
2219
|
-
CLOSE_SURVEY_ON_OVERLAY_CLICK: SprigEvent;
|
|
2220
|
-
* Tracks a page view with the provided URL and additional event properties.
|
|
2221
|
-
*/
|
|
2206
|
+
CLOSE_SURVEY_ON_OVERLAY_CLICK: SprigEvent;
|
|
2222
2207
|
VISITOR_ID_UPDATED: SprigEvent;
|
|
2223
2208
|
DATA: {
|
|
2224
2209
|
DISMISS_REASONS: {
|
|
2225
2210
|
API: DismissReason;
|
|
2226
2211
|
CLOSED: DismissReason;
|
|
2227
|
-
/**
|
|
2228
|
-
* Apply a css string representing the customized styles
|
|
2229
|
-
*/
|
|
2230
2212
|
COMPLETE: DismissReason;
|
|
2231
2213
|
PAGE_CHANGE: DismissReason;
|
|
2232
2214
|
OVERRIDE: DismissReason;
|
|
@@ -2325,7 +2307,7 @@ declare class SprigAPI {
|
|
|
2325
2307
|
*/
|
|
2326
2308
|
logoutUser(): void;
|
|
2327
2309
|
/**
|
|
2328
|
-
* Clears Sprig from
|
|
2310
|
+
* Clears Sprig from globalThis
|
|
2329
2311
|
*/
|
|
2330
2312
|
teardown(): void;
|
|
2331
2313
|
/**
|
|
@@ -2350,8 +2332,9 @@ declare const sprig: {
|
|
|
2350
2332
|
*/
|
|
2351
2333
|
configure: (config: NpmConfig) => sprigConfig.WindowSprig;
|
|
2352
2334
|
};
|
|
2353
|
-
type WindowSprig$1 = typeof
|
|
2335
|
+
type WindowSprig$1 = typeof globalThis.Sprig;
|
|
2354
2336
|
|
|
2337
|
+
declare const Sprig: SprigAPI;
|
|
2355
2338
|
declare const _default: {
|
|
2356
2339
|
sprig: {
|
|
2357
2340
|
/**
|
|
@@ -2363,6 +2346,7 @@ declare const _default: {
|
|
|
2363
2346
|
};
|
|
2364
2347
|
SprigAPI: typeof SprigAPI;
|
|
2365
2348
|
configure: (config: NpmConfig) => sprigConfig.WindowSprig;
|
|
2349
|
+
Sprig: SprigAPI;
|
|
2366
2350
|
};
|
|
2367
2351
|
|
|
2368
|
-
export { DismissReason, SprigAPI, SprigEvent, type WindowSprig$1 as WindowSprig, _default as default, sprig };
|
|
2352
|
+
export { DismissReason, Sprig, SprigAPI, SprigEvent, type WindowSprig$1 as WindowSprig, _default as default, sprig };
|
package/dist/core.js
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import { D as r, S as
|
|
2
|
-
import { S as o, c as
|
|
1
|
+
import { D as r, S as i } from "./metricsReporter-DbRyYFfD.js";
|
|
2
|
+
import { a as e, S as o, c as S, s as g } from "./core-bEj9FkiJ.js";
|
|
3
3
|
export {
|
|
4
4
|
r as DismissReason,
|
|
5
|
+
e as Sprig,
|
|
5
6
|
o as SprigAPI,
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
i as SprigEvent,
|
|
8
|
+
S as default,
|
|
9
|
+
g as sprig
|
|
9
10
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { u, c as _, a as F, F as _e, h as ae, p as ne, _ as de, g as Ce, S as Me, b as se, y as Oe, d as Be } from "./view-
|
|
2
|
-
import { g as He, i as Se, E as Ue,
|
|
1
|
+
import { u, c as _, a as F, F as _e, h as ae, p as ne, _ as de, g as Ce, S as Me, b as se, y as Oe, d as Be } from "./view-BqGpnqXK.js";
|
|
2
|
+
import { g as He, i as Se, E as Ue, b as we } from "./core-bEj9FkiJ.js";
|
|
3
3
|
import { d as Ne } from "./debounce-CMb8f7wh.js";
|
|
4
|
-
import { v as Ve } from "./metricsReporter-
|
|
4
|
+
import { v as Ve } from "./metricsReporter-DbRyYFfD.js";
|
|
5
5
|
const Fe = (e) => u("button", { ...e, className: _("ul-card-text__button", e.className), id: "ul-card-text__button" }), $e = ({ html: e, ...n }) => {
|
|
6
6
|
const { enableCspTrustedTypes: o } = F((r) => ({ enableCspTrustedTypes: r.enableCspTrustedTypes })), t = _e(() => He(e, o), [o, e]);
|
|
7
7
|
return u("div", { ...n, dangerouslySetInnerHTML: { __html: t } });
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";const i=require("./view-
|
|
1
|
+
"use strict";const i=require("./view-CmZqxMJO.cjs"),W=require("./core-CP9Lrdyw.cjs"),Le=require("./debounce-DsC7462b.cjs"),_e=require("./metricsReporter-DTdxsqej.cjs"),le=e=>i.u("button",{...e,className:i.cc("ul-card-text__button",e.className),id:"ul-card-text__button"}),ye=({html:e,...n})=>{const{enableCspTrustedTypes:o}=i.useConfig(r=>({enableCspTrustedTypes:r.enableCspTrustedTypes})),t=i.F(()=>W.getHtml(e,o),[o,e]);return i.u("div",{...n,dangerouslySetInnerHTML:{__html:t}})},ae=()=>{const{viewDocument:e}=i.useConfig(t=>({viewDocument:t.viewDocument})),[n,o]=i.h(!1);return i.p(()=>{const t=e.querySelector(".sprig-question-body"),r=new ResizeObserver(()=>{window.requestAnimationFrame(()=>{o(!!(t&&W.isHTMLElement(t)&&t.scrollHeight>t.offsetHeight))})});return t&&r.observe(t),()=>{t&&r.disconnect()}},[e]),n},de=({plainText:e,richText:n,id:o,className:t,isHeader:r,showAsterisk:l})=>n?i.u(ye,{className:t,html:n,id:o}):e?r?i.u("h1",{className:t,id:o,children:[e,l&&"*"]}):i.u("p",{className:t,id:o,children:e}):null,Pe=()=>i.u("svg",{fill:"none",height:"10",viewBox:"0 0 13 10",width:"13",xmlns:"http://www.w3.org/2000/svg",children:i.u("path",{d:"M11.5 1.5L4.5 8.5L1 5",stroke:"#FFFFFF",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.5"})}),Ee=(e,n)=>{const o=i._(0);return()=>{if(e.current){const t=e.current;t.style.height="1px";const r=t.scrollHeight+(t.offsetHeight-t.clientHeight),l=parseInt(window.getComputedStyle(t).getPropertyValue("max-height")),a=r<=l?r:l;o.current!==a&&requestAnimationFrame(()=>{n()}),o.current=a,t.style.height=`${a}px`}}},ce=({buttonText:e="View Prototype",handleClick:n})=>i.u("button",{className:"prototype-button",onClick:n,children:e},"prototype-btn"),xe=({isSelected:e,id:n,divId:o,themeColor:t,disabled:r=!1})=>i.u("div",{"aria-checked":e,"aria-disabled":r,"aria-labelledby":`label-${n}`,className:"select-checkbox",id:o,role:"checkbox",style:{...e?{backgroundColor:t,borderColor:t,boxShadow:"none"}:{},...r?{opacity:.5}:{}},tabIndex:r?-1:0,children:e&&i.u(i.SvgCheckmark,{})}),Oe=({promptText:e,textValue:n,onTextChange:o,useMobileStyling:t})=>{const r=i._(null),{update:l}=i.useConfig(d=>({update:d.update})),a=Ee(r,()=>l());return i.p(()=>(a(),r.current&&r.current.focus(),()=>{l()}),[]),i.u("textarea",{"aria-label":e,"aria-multiline":"true","aria-placeholder":e,className:i.cc(i.getClasses("choice-text-input",t)),"data-gramm":"false",maxLength:5e3,name:"text",onChange:d=>{a(),d.stopPropagation(),o(d.currentTarget.value)},onClick:d=>{d.stopPropagation()},onKeyPress:d=>{d.stopPropagation()},placeholder:e,ref:r,role:"textbox",rows:1,value:n})},ue="ul-select-style-element",K="ul-select-active-dynamic-style",je="ul-select-error-dynamic-style",Me=(e,n,o)=>{let t=e.getElementById(ue),r=!1;t||(t=e.createElement("style"),r=!0),t.tagName.toLowerCase()==="style"&&(t.id=ue,o&&(t.nonce=o),t.textContent=Be(n),r&&e.head.appendChild(t))},Be=e=>`
|
|
2
2
|
.${K} {
|
|
3
3
|
border-color: ${e};
|
|
4
4
|
}
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import { a as Y, h as Z, u as e, c as O, b as re, f as Me, F as he, g as ye, e as ge, _ as te, T as ke, A as ir, p as ne, i as ar, q as lr, r as or, M as de, s as Ze, t as dr, j as cr, n as ur, v as pr, k as Ae, l as mr, m as gr, x as hr, o as Qe } from "./view-
|
|
2
|
-
import { t as le } from "./metricsReporter-
|
|
3
|
-
import {
|
|
4
|
-
import { c as ie, a as ae, H as _e, M as pe, Q as ue, O as Se, B as ee, L as Ie, b as Te, S as vr, u as yr, g as fr, P as Sr, p as xr, v as kr, R as se, d as Ir, s as _r, e as Tr } from "./getAttributedUrl-
|
|
1
|
+
import { a as Y, h as Z, u as e, c as O, b as re, f as Me, F as he, g as ye, e as ge, _ as te, T as ke, A as ir, p as ne, i as ar, q as lr, r as or, M as de, s as Ze, t as dr, j as cr, n as ur, v as pr, k as Ae, l as mr, m as gr, x as hr, o as Qe } from "./view-BqGpnqXK.js";
|
|
2
|
+
import { t as le } from "./metricsReporter-DbRyYFfD.js";
|
|
3
|
+
import { b as qe, D as Ee, g as We, A as br } from "./core-bEj9FkiJ.js";
|
|
4
|
+
import { c as ie, a as ae, H as _e, M as pe, Q as ue, O as Se, B as ee, L as Ie, b as Te, S as vr, u as yr, g as fr, P as Sr, p as xr, v as kr, R as se, d as Ir, s as _r, e as Tr } from "./getAttributedUrl-BGCIZtTj.js";
|
|
5
5
|
const Cr = ({ className: n, message: s, next: o, properties: r, questionId: t, type: a }) => {
|
|
6
|
-
const { useMobileStyling: m, border: y, isLongFormSurvey: d, focusedQuestionId: g } = Y((v) => ({ useMobileStyling: v.useMobileStyling, border: v.border, isLongFormSurvey: le(v.studyType), focusedQuestionId: v.focusedQuestionId })), [c, f] = Z(!1), [i, S] = Z(""), [p, h] = Z(!1), b = d && g === t, x = r == null ? void 0 : r.collectName, _ = (r == null ? void 0 : r.nameLabelText) || "Full Name", k = (r == null ? void 0 : r.consentText) || "I agree to the stated conditions", U = (r == null ? void 0 : r.submitButtonText) || "Submit", P = !!i.trim(),
|
|
6
|
+
const { useMobileStyling: m, border: y, isLongFormSurvey: d, focusedQuestionId: g } = Y((v) => ({ useMobileStyling: v.useMobileStyling, border: v.border, isLongFormSurvey: le(v.studyType), focusedQuestionId: v.focusedQuestionId })), [c, f] = Z(!1), [i, S] = Z(""), [p, h] = Z(!1), b = d && g === t, x = r == null ? void 0 : r.collectName, _ = (r == null ? void 0 : r.nameLabelText) || "Full Name", k = (r == null ? void 0 : r.consentText) || "I agree to the stated conditions", U = (r == null ? void 0 : r.submitButtonText) || "Submit", P = !!i.trim(), E = c && (!x || P), D = (v, w = !1) => {
|
|
7
7
|
v.preventDefault(), v.stopPropagation();
|
|
8
8
|
let B = null;
|
|
9
9
|
if (!w) {
|
|
10
|
-
if (!
|
|
10
|
+
if (!E) return void h(!0);
|
|
11
11
|
B = { submitted: !0 }, x && (B.name = i);
|
|
12
12
|
}
|
|
13
|
-
o({ value: B, questionId: t, type: a },
|
|
13
|
+
o({ value: B, questionId: t, type: a }, E);
|
|
14
14
|
};
|
|
15
15
|
return e("div", { className: O(n, d && !b && "ul-card--unfocused", "ul-card__consent-legal", "fade-in-transition"), children: [e(ie, { isRequired: d && (r == null ? void 0 : r.required), message: s, properties: { questionHtml: r.questionHtml } }), r != null && r.richTextBody ? e(ae, { children: e(_e, { className: "ul-rich-text-body", html: r.richTextBody, id: "ul-card__consent-legal-body-container" }) }) : null, e(pe, { embeddedType: "pdf", properties: r, children: e(ue, { children: [e("div", { className: "sprig-stretch", children: [e(Se, { allowTextEntry: !1, border: y, error: p && !c, id: "consent", isRadio: !1, isSelected: c, label: k, onUserInputChanged: ({ selected: v }) => {
|
|
16
16
|
v !== c && f(!c);
|
|
@@ -20,15 +20,15 @@ const Cr = ({ className: n, message: s, next: o, properties: r, questionId: t, t
|
|
|
20
20
|
v.currentTarget.style.borderColor = p && !P ? qe : y;
|
|
21
21
|
}, onInput: (v) => {
|
|
22
22
|
v.preventDefault(), v.stopPropagation(), S(v.currentTarget.value);
|
|
23
|
-
}, placeholder: _, style: p && !P ? { borderColor: qe } : {}, tabIndex: 0, value: i })] }), e("div", { className: "ul-card__button-wrapper ul-card-vertical__button-wrapper", children: [e(ee, { className:
|
|
23
|
+
}, placeholder: _, style: p && !P ? { borderColor: qe } : {}, tabIndex: 0, value: i })] }), e("div", { className: "ul-card__button-wrapper ul-card-vertical__button-wrapper", children: [e(ee, { className: E ? "" : "sprig-button-disabled", onClick: D, children: U }), r.required === !1 && !d && e("button", { className: "ul-card-skip__button", onClick: (v) => D(v, !0), children: Me(r) })] })] }) })] }, t);
|
|
24
24
|
}, Nr = ({ activeValue: n, border: s, icon: o, isPressed: r, onSubmit: t, range: a, scaleLabelType: m, selectedValue: y, setSelectedValue: d, setActiveValue: g, setIsPressed: c, useMobileStyling: f, value: i, viewDocument: S }) => {
|
|
25
|
-
const { isLongFormSurvey: p, enableCspTrustedTypes: h } = Y((w) => ({ isLongFormSurvey: le(w.studyType), enableCspTrustedTypes: w.enableCspTrustedTypes })), b = `option-${i}`, x = m === "number", _ = m === "star", k = m === "smiley", U = x && i === n || i === y, [P,
|
|
25
|
+
const { isLongFormSurvey: p, enableCspTrustedTypes: h } = Y((w) => ({ isLongFormSurvey: le(w.studyType), enableCspTrustedTypes: w.enableCspTrustedTypes })), b = `option-${i}`, x = m === "number", _ = m === "star", k = m === "smiley", U = x && i === n || i === y, [P, E] = (() => {
|
|
26
26
|
const w = _ && y !== null && i <= y;
|
|
27
27
|
return _ && i <= n || k && i === n || w || i === n || i === y ? [s, r || w || i === y ? 1 : 0.3] : ["", 1];
|
|
28
28
|
})(), D = he(() => {
|
|
29
|
-
const w = { borderColor: U ? P : "", fillOpacity: U ? "" :
|
|
29
|
+
const w = { borderColor: U ? P : "", fillOpacity: U ? "" : E, zIndex: U ? 3 : "auto", color: y === i ? "#fff" : "" };
|
|
30
30
|
return x ? { ...w, backgroundColor: y === i ? P : "" } : { ...w, color: _ || k || y === i ? P : "" };
|
|
31
|
-
}, [U, P,
|
|
31
|
+
}, [U, P, E, y, i, x, _, k]), v = he(() => We((({ icon: w, scaleLabelType: B, value: T, selectedValue: L }) => {
|
|
32
32
|
if (B === "smiley" && T === L) {
|
|
33
33
|
let A = 0;
|
|
34
34
|
return w.replace(/black/g, () => ++A == 1 ? "black" : "white");
|
|
@@ -56,8 +56,8 @@ const Cr = ({ className: n, message: s, next: o, properties: r, questionId: t, t
|
|
|
56
56
|
}, wr = ({ className: n, labels: s, message: o, next: r, properties: t, questionId: a, type: m }) => {
|
|
57
57
|
const { border: y, useMobileStyling: d, viewDocument: g, isLongFormSurvey: c, focusedQuestionId: f } = Y((T) => ({ border: T.border, useMobileStyling: T.useMobileStyling, viewDocument: T.viewDocument, isLongFormSurvey: le(T.studyType), focusedQuestionId: T.focusedQuestionId })), [i, S] = Z(-1), [p, h] = Z(!1), [b, x] = Z(null), _ = c && f === a, k = s && s.left, U = s && s.right;
|
|
58
58
|
let P;
|
|
59
|
-
const { range:
|
|
60
|
-
|
|
59
|
+
const { range: E, scaleLabelType: D, ratingIcons: v } = t;
|
|
60
|
+
E && (P = Number(E));
|
|
61
61
|
const w = P || 5, B = (T) => {
|
|
62
62
|
var L, A;
|
|
63
63
|
switch (D) {
|
|
@@ -137,10 +137,10 @@ const Cr = ({ className: n, message: s, next: o, properties: r, questionId: t, t
|
|
|
137
137
|
D.preventDefault(), D.stopPropagation(), o({ value: _, questionId: a, type: m }, !0), d && d();
|
|
138
138
|
}, x = r.reduce((D, v) => (D[v.id] = null, D), {}), [_, k] = Z(x), U = (D) => p && Object.values(D).every((v) => v == null), P = (D, v) => {
|
|
139
139
|
c && o({ value: { ..._, [D]: v }, questionId: a, type: m }, !U({ ..._, [D]: v })), k((w) => ({ ...w, [D]: v }));
|
|
140
|
-
},
|
|
140
|
+
}, E = t.displayMatrixAsAccordion || g;
|
|
141
141
|
return e("form", { className: O(n, !c && "ul-card__matrix", "fade-in-transition", c && !h && "ul-card--unfocused"), id: "text-form", onClick: () => {
|
|
142
142
|
h && i(a);
|
|
143
|
-
}, onSubmit: b, children: [e(ie, { isRequired: c && (t == null ? void 0 : t.required), message: s, properties: t }), e(pe, { properties: t, children: [e(ae, { children: [e(
|
|
143
|
+
}, onSubmit: b, children: [e(ie, { isRequired: c && (t == null ? void 0 : t.required), message: s, properties: t }), e(pe, { properties: t, children: [e(ae, { children: [e(E ? Lr : Pr, { columns: S, onSelect: P, options: r, selectedOptions: _ }), y && e(Ie, { handleSubmit: b, isSubmitDisabled: U(_) })] }), !c && e(ue, { children: e("div", { className: "ul-card__button-wrapper", children: e(ee, { disabled: U(_), children: ge(t) }) }) })] })] }, a);
|
|
144
144
|
}, Ye = ({ className: n, message: s, onSubmit: o, options: r = [], properties: t, questionId: a, type: m, showIndividualSubmit: y = !1, onSubmitButtonClick: d }) => {
|
|
145
145
|
const { border: g, useMobileStyling: c, isLongFormSurvey: f, focusedQuestionId: i, setFocusedQuestionId: S } = Y((u) => ({ border: u.border, useMobileStyling: u.useMobileStyling, isLongFormSurvey: le(u.studyType), focusedQuestionId: u.focusedQuestionId, setFocusedQuestionId: u.setFocusedQuestionId })), p = f && i === a, h = r.reduce((u, C) => (u[C.id] = { isSelected: !1 }, u), {}), [b, x] = Z(h), _ = m === "multiplechoice", k = t.required, U = r.find((u) => {
|
|
146
146
|
var C;
|
|
@@ -149,8 +149,8 @@ const Cr = ({ className: n, message: s, next: o, properties: r, questionId: t, t
|
|
|
149
149
|
var l;
|
|
150
150
|
const W = r.find((I) => `${I.id}` === C), H = V.userText === void 0 || V.userText.trim() === "";
|
|
151
151
|
return ((l = W == null ? void 0 : W.optionProperties) == null ? void 0 : l.allowsTextEntry) && H && V.isSelected;
|
|
152
|
-
}),
|
|
153
|
-
const { minSelect: V = 0, maxSelect: W = 1 / 0, maxSelectMode: H } = t, l =
|
|
152
|
+
}), E = (u) => Object.values(u).filter((C) => C.isSelected).length, D = t.minSelect && t.minSelect > 0 && t.maxSelectMode === Te.Range && E(b) < t.minSelect && (k || E(b) > 0), v = (u) => P(u) || k && !E(u) || !((C) => {
|
|
153
|
+
const { minSelect: V = 0, maxSelect: W = 1 / 0, maxSelectMode: H } = t, l = E(C);
|
|
154
154
|
switch (H) {
|
|
155
155
|
case Te.Maximum:
|
|
156
156
|
return l <= W;
|
|
@@ -166,7 +166,7 @@ const Cr = ({ className: n, message: s, next: o, properties: r, questionId: t, t
|
|
|
166
166
|
K(u.id, u.selected, u.userText, u.noneOfTheAbove), u.selected && f && !_ && !p && S(a);
|
|
167
167
|
}, L = (u) => {
|
|
168
168
|
var C;
|
|
169
|
-
return (t == null ? void 0 : t.maxSelectMode) !== Te.Unlimited &&
|
|
169
|
+
return (t == null ? void 0 : t.maxSelectMode) !== Te.Unlimited && E(b) === (t == null ? void 0 : t.maxSelect) && !((C = b[u]) != null && C.isSelected);
|
|
170
170
|
}, A = (u) => {
|
|
171
171
|
u.preventDefault(), u.stopPropagation(), o(b, !0), d && d();
|
|
172
172
|
}, K = (u, C, V, W) => {
|
|
@@ -175,23 +175,23 @@ const Cr = ({ className: n, message: s, next: o, properties: r, questionId: t, t
|
|
|
175
175
|
else U && !W && b[U.id].isSelected && (H[U.id].isSelected = !1);
|
|
176
176
|
H[u] = { isSelected: C, userText: V };
|
|
177
177
|
const l = _ && Object.entries(H).some(([q, F]) => {
|
|
178
|
-
var
|
|
179
|
-
return F.isSelected && ((G = (
|
|
178
|
+
var M, G;
|
|
179
|
+
return F.isSelected && ((G = (M = r.find((X) => `${X.id}` === q)) == null ? void 0 : M.optionProperties) == null ? void 0 : G.allowsTextEntry);
|
|
180
180
|
}), I = !v(H);
|
|
181
181
|
f && (o(H, I), _ && !l && I && d && d()), x(H);
|
|
182
182
|
};
|
|
183
183
|
return e("form", { className: O(n, "ul-card--multiple", "fade-in-transition", f && !p && "ul-card--unfocused"), id: "text-form", onClick: m === "multipleselect" ? () => {
|
|
184
184
|
f && i !== a && m === "multipleselect" && S(a);
|
|
185
|
-
} : void 0, onSubmit: A, children: [e(ie, { isRequired: f && (t == null ? void 0 : t.required), message: s, properties: t }), e(pe, { properties: t, children: e(ye, { children: [e(ae, { children: [t.isDropdown ? e(vr, { disabledOptions: r.filter((u) => L(u.id)), dropdownFooter: D ? e("div", { className: "ul-card__min-select-counter", style: { marginLeft: "16px" }, children: [
|
|
185
|
+
} : void 0, onSubmit: A, children: [e(ie, { isRequired: f && (t == null ? void 0 : t.required), message: s, properties: t }), e(pe, { properties: t, children: e(ye, { children: [e(ae, { children: [t.isDropdown ? e(vr, { disabledOptions: r.filter((u) => L(u.id)), dropdownFooter: D ? e("div", { className: "ul-card__min-select-counter", style: { marginLeft: "16px" }, children: [E(b), "/", t.minSelect] }) : void 0, isMultiSelect: !_, multiselectText: t.dropdownMultiselectedText ?? "choices selected", onChange: (u) => {
|
|
186
186
|
const C = { ...b };
|
|
187
187
|
for (const V of r) u.includes(V) ? C[V.id].isSelected = !0 : C[V.id].isSelected = !1;
|
|
188
188
|
f && o(C, !v(C)), x(C);
|
|
189
189
|
}, options: r, placeholderText: t.dropdownPlaceholderText ?? (_ ? "Select choice" : "Select choice(s)"), value: r.filter((u) => b[u.id].isSelected) }) : e("div", { className: O(re("ul-card__choices", c)), role: _ ? "radiogroup" : "group", children: [r.map(({ id: u, label: C, value: V, optionProperties: W }) => {
|
|
190
|
-
var F,
|
|
190
|
+
var F, M;
|
|
191
191
|
const H = `${u}`, { allowsTextEntry: l, noneOfTheAbove: I } = { allowsTextEntry: !1, noneOfTheAbove: !1, ...W };
|
|
192
|
-
return e(Se, { allowTextEntry: l, border: g, disabled: L(H), error: (q = b, P(q)), id: H, isRadio: _, isSelected: !!((F = b[H]) != null && F.isSelected), label: C, noneOfTheAbove: I, onUserInputChanged: T, promptText: (W == null ? void 0 : W.otherOptionPlaceholder) || "Please specify", text: (
|
|
192
|
+
return e(Se, { allowTextEntry: l, border: g, disabled: L(H), error: (q = b, P(q)), id: H, isRadio: _, isSelected: !!((F = b[H]) != null && F.isSelected), label: C, noneOfTheAbove: I, onUserInputChanged: T, promptText: (W == null ? void 0 : W.otherOptionPlaceholder) || "Please specify", text: (M = b[u]) == null ? void 0 : M.userText, useMobileStyling: c, value: V }, H);
|
|
193
193
|
var q;
|
|
194
|
-
}), !!D && e("div", { className: "ul-card__min-select-counter", children: [
|
|
194
|
+
}), !!D && e("div", { className: "ul-card__min-select-counter", children: [E(b), "/", t.minSelect] })] }), B && e(Ie, { handleSubmit: A, isSubmitDisabled: v(b) })] }), !f && e(ue, { children: e("div", { className: "ul-card__button-wrapper", children: e(ee, { disabled: v(b), onClick: A, children: ge(t) }) }) })] }) })] }, a);
|
|
195
195
|
}, Er = (n) => {
|
|
196
196
|
const { questionId: s, type: o, next: r, options: t } = n, { setFocusedQuestionId: a } = Y((m) => ({ setFocusedQuestionId: m.setFocusedQuestionId }));
|
|
197
197
|
return e(Ye, { ...n, onSubmit: (m, y) => {
|
|
@@ -216,9 +216,9 @@ const Cr = ({ className: n, message: s, next: o, properties: r, questionId: t, t
|
|
|
216
216
|
return e("form", { className: O(n, "ul-card--nps", "fade-in-transition", i && !p && "ul-card--unfocused"), children: [e(ie, { isRequired: i && (r == null ? void 0 : r.required), message: o, properties: r }), e(pe, { properties: r, children: [e(ae, { children: [e("div", { className: "ul-card--nps__numbers", children: [...Array(11)].map((x, _) => e("button", { className: O(re("nps-number", c), re(`nps-number-${_}`, c)), id: `option-${_}`, onClick: (k) => {
|
|
217
217
|
i && (k.preventDefault(), k.stopPropagation(), d(_)), t({ value: _, questionId: a, type: m }, !0);
|
|
218
218
|
}, onKeyDown: (k) => {
|
|
219
|
-
var P,
|
|
219
|
+
var P, E;
|
|
220
220
|
const U = f.querySelectorAll("button.nps-number");
|
|
221
|
-
k.key === "ArrowRight" ? (P = U[_ + 1]) == null || P.focus() : k.key === "ArrowLeft" ? (
|
|
221
|
+
k.key === "ArrowRight" ? (P = U[_ + 1]) == null || P.focus() : k.key === "ArrowLeft" ? (E = U[_ - 1]) == null || E.focus() : k.key !== "Enter" && k.key !== " " || (i && (k.preventDefault(), k.stopPropagation(), d(_)), t({ value: _, questionId: a, type: m }, !0));
|
|
222
222
|
}, onPointerDown: (k) => {
|
|
223
223
|
k.currentTarget.style.zIndex = "2", k.currentTarget.style.borderColor = g;
|
|
224
224
|
}, onPointerLeave: (k) => {
|
|
@@ -232,7 +232,7 @@ const Cr = ({ className: n, message: s, next: o, properties: r, questionId: t, t
|
|
|
232
232
|
var T, L;
|
|
233
233
|
S && !b && (U ? (T = k.current) == null || T.focus() : (L = k.current) == null || L.blur());
|
|
234
234
|
}, [S, U, b]);
|
|
235
|
-
const P = x.trim(),
|
|
235
|
+
const P = x.trim(), E = t.required === !0 && !P, D = yr(k, () => i()), v = (T) => {
|
|
236
236
|
T.preventDefault(), T.stopPropagation();
|
|
237
237
|
const L = P.length > 0, A = !t.required || L;
|
|
238
238
|
r({ value: x, questionId: a, type: m }, A), d && d(L);
|
|
@@ -251,7 +251,7 @@ const Cr = ({ className: n, message: s, next: o, properties: r, questionId: t, t
|
|
|
251
251
|
}
|
|
252
252
|
}, onFocus: (T) => {
|
|
253
253
|
T.currentTarget.style.borderColor = c, h(a);
|
|
254
|
-
}, placeholder: w, ref: k, role: "textbox", tabIndex: 0 }) }), t.footerHtml && e(_e, { className: "footer", html: t.footerHtml }), y && e(Ie, { handleSubmit: v, isSubmitDisabled:
|
|
254
|
+
}, placeholder: w, ref: k, role: "textbox", tabIndex: 0 }) }), t.footerHtml && e(_e, { className: "footer", html: t.footerHtml }), y && e(Ie, { handleSubmit: v, isSubmitDisabled: E }), e(ue, { children: !S && e(ee, { disabled: E || !!g, onClick: v, children: ge(t) }) })] }) }) })] }, a);
|
|
255
255
|
}, Pe = 1, Ke = 2, Xe = 3, Ce = (n) => n.type === "av_permission", Oe = (n) => n.type === "screen_permission", Je = (n, s) => n === void 0 ? Pe : n ? ((o, r) => !(Ce(r) ? r.permissionDescriptors : []).includes("camera") || o.getVideoTracks().length > 0)(n, s) ? Xe : Pe : Ke, $e = { avStream: null, currentPage: null, mediaRecordingUids: null, nextQuestion: () => {
|
|
256
256
|
}, passthroughData: void 0, recordingMediaTypes: void 0, screenPermissionRequested: !1, type: void 0 }, ce = ar((n) => ({ ...$e, reset: () => {
|
|
257
257
|
n($e);
|
|
@@ -357,7 +357,7 @@ const er = "ul-permission-graphics-container", rr = "ul-permission-body", tr = O
|
|
|
357
357
|
const t = Y(), { surveyId: a, responseGroupUid: m, userId: y, update: d } = t, g = ce(), { screenPermissionRequested: c } = g, f = ce((b) => b.avStream);
|
|
358
358
|
let i = ce((b) => b.currentPage);
|
|
359
359
|
i || (i = function({ pages: b, userId: x, responseGroupUid: _, surveyId: k, questionId: U, next: P }) {
|
|
360
|
-
const { updatePage:
|
|
360
|
+
const { updatePage: E } = ce.getState(), { eventEmitFn: D, recorderEventEmitter: v } = Y.getState(), w = { questionId: U, surveyId: k, visitorId: x, responseGroupUid: _ };
|
|
361
361
|
let B = 0;
|
|
362
362
|
v.emit("recorded.task.permission.screen"), D("recorded.task.permission.screen"), v.emit("permission.status", { "permission.status.callback": (L, A, K, u) => {
|
|
363
363
|
const C = b[B], { type: V } = C, W = ["screen"];
|
|
@@ -365,7 +365,7 @@ const er = "ul-permission-graphics-container", rr = "ul-permission-body", tr = O
|
|
|
365
365
|
const { permissionDescriptors: H } = C, l = H == null ? void 0 : H.includes("microphone"), I = H == null ? void 0 : H.includes("camera");
|
|
366
366
|
l && W.push("audio"), I && W.push("video"), (L != null && L.active && !I || L != null && L.active && A) && B++;
|
|
367
367
|
}
|
|
368
|
-
Oe(b[B]) && K && (B++, v.emit("begin.recording", { "recording.media.types": W, "start.recording.callback": (H) =>
|
|
368
|
+
Oe(b[B]) && K && (B++, v.emit("begin.recording", { "recording.media.types": W, "start.recording.callback": (H) => E({ mediaRecordingUids: H }) })), E({ currentPage: b[B], avStream: L, screenPermissionRequested: K, nextQuestion: P, type: V, passthroughData: w, recordingMediaTypes: W, captureStream: u });
|
|
369
369
|
} });
|
|
370
370
|
const T = b[B];
|
|
371
371
|
return T.type === "av_permission" && Re({ currentPage: T, pages: b }), T;
|
|
@@ -396,7 +396,7 @@ const er = "ul-permission-graphics-container", rr = "ul-permission-body", tr = O
|
|
|
396
396
|
m();
|
|
397
397
|
}, [m]), e("div", { className: O(n, "ul-card--thanks", "fade-in-transition"), children: e("div", { children: e("div", { className: "ul-card--thanks-content", children: [e("div", { className: "ul-thanks-check", children: e("svg", { "aria-labelledby": "title", fill: "none", height: "99", viewBox: "0 0 81 99", width: "81", xmlns: "http://www.w3.org/2000/svg", children: [e("path", { clipRule: "evenodd", d: "M40.5 77C60.9345 77 77.5 60.4345 77.5 40C77.5 19.5655 60.9345 3 40.5 3C20.0655 3 3.5 19.5655 3.5 40C3.5 60.4345 20.0655 77 40.5 77ZM80.5 40C80.5 62.0914 62.5914 80 40.5 80C18.4086 80 0.5 62.0914 0.5 40C0.5 17.9086 18.4086 0 40.5 0C62.5914 0 80.5 17.9086 80.5 40Z", fill: o, fillRule: "evenodd" }), e("path", { clipRule: "evenodd", d: "M55.025 22.9046C55.6299 23.4705 55.6616 24.4198 55.0956 25.0247C54.8724 25.2634 54.6109 25.5285 54.3157 25.8277C52.2547 27.9168 48.5549 31.667 44.8135 39.6658C43.2818 42.9406 42.0864 45.8386 41.0823 48.2729C40.6539 49.3116 40.2603 50.2659 39.8902 51.129C39.287 52.5359 38.7248 53.7508 38.1744 54.625C37.8997 55.0613 37.5806 55.4905 37.2017 55.8245C36.8201 56.1607 36.2613 56.5 35.5457 56.5C34.6742 56.5 34.0892 55.9692 33.7774 55.6083C33.4502 55.2296 33.1752 54.7511 32.9396 54.301C32.7305 53.9013 32.5088 53.4367 32.2797 52.9565C32.2429 52.8794 32.2059 52.8019 32.1688 52.7243C31.8942 52.1499 31.5959 51.534 31.2537 50.8868C29.8886 48.305 27.8539 45.2878 24.2343 43.1382C23.522 42.7152 23.2875 41.7949 23.7105 41.0826C24.1335 40.3703 25.0539 40.1358 25.7662 40.5588C30.0556 43.1062 32.4149 46.6647 33.9058 49.4845C34.2776 50.1876 34.5973 50.8487 34.8753 51.4302C34.9147 51.5124 34.9529 51.5926 34.9902 51.6707C35.2222 52.1567 35.4164 52.5637 35.5978 52.9102C35.6151 52.9434 35.6321 52.9754 35.6485 53.0061C36.0565 52.3531 36.5341 51.3434 37.133 49.9468C37.4781 49.1418 37.8572 48.2229 38.2761 47.2074C39.2886 44.7532 40.5339 41.7347 42.0961 38.3948C46.0591 29.9221 50.0641 25.8648 52.1535 23.7482C52.4423 23.4556 52.6944 23.2002 52.9048 22.9753C53.4708 22.3703 54.42 22.3387 55.025 22.9046ZM35.1994 53.5892C35.1994 53.5892 35.2 53.5888 35.2012 53.5879C35.2 53.5889 35.1994 53.5893 35.1994 53.5892ZM36.0666 53.6682C36.0732 53.674 36.0765 53.6775 36.0765 53.6777C36.0765 53.678 36.0732 53.6751 36.0666 53.6682Z", fill: o, fillRule: "evenodd" }), e("path", { d: "M69.5 97C69.5 98.1046 56.2924 99 40 99C23.7076 99 10.5 98.1046 10.5 97C10.5 95.8954 23.7076 95 40 95C56.2924 95 69.5 95.8954 69.5 97Z", fill: "black", fillOpacity: "0.2" })] }) }), e(ie, { message: d }), y] }) }) }, s);
|
|
398
398
|
}, ve = "ul-card-video__player_recorder", He = "ul-video-btn", Le = 0, Ve = 1, Kr = ({ className: n, message: s, next: o, properties: r, questionId: t, type: a }) => {
|
|
399
|
-
const { apiURL: m, envId: y, handleUploadUpdate: d, headers: g, responseGroupUid: c, surveyId: f, update: i, viewDocument: S, visitorId: p } = Y((u) => ({ apiURL: u.apiURL, envId: u.envId, handleUploadUpdate: u.handleUploadUpdate, headers: u.headers, responseGroupUid: u.responseGroupUid, surveyId: u.surveyId, update: u.update, viewDocument: u.viewDocument, visitorId: u.userId })), [h, b] = Z(!1), [x, _] = Z(null), [k, U] = Z(null), [P,
|
|
399
|
+
const { apiURL: m, envId: y, handleUploadUpdate: d, headers: g, responseGroupUid: c, surveyId: f, update: i, viewDocument: S, visitorId: p } = Y((u) => ({ apiURL: u.apiURL, envId: u.envId, handleUploadUpdate: u.handleUploadUpdate, headers: u.headers, responseGroupUid: u.responseGroupUid, surveyId: u.surveyId, update: u.update, viewDocument: u.viewDocument, visitorId: u.userId })), [h, b] = Z(!1), [x, _] = Z(null), [k, U] = Z(null), [P, E] = Z(Le), [D, v] = Z(null), [w, B] = Z(null), T = r && r.videoUrl, L = ke((u) => {
|
|
400
400
|
u && v(u);
|
|
401
401
|
}, [v]);
|
|
402
402
|
ne(() => {
|
|
@@ -419,9 +419,9 @@ const er = "ul-permission-graphics-container", rr = "ul-permission-body", tr = O
|
|
|
419
419
|
u.appendChild(C);
|
|
420
420
|
}
|
|
421
421
|
} }), e(pe, { properties: r, children: e("button", { className: `${He} ul-record-response-btn`, onClick: (u) => {
|
|
422
|
-
u.preventDefault(), u.stopPropagation(), document.getElementById(ve) && xr(ve),
|
|
422
|
+
u.preventDefault(), u.stopPropagation(), document.getElementById(ve) && xr(ve), E(Ve);
|
|
423
423
|
} }) })] }), e("div", { style: { display: P === Ve ? "block" : "none" }, children: [e("button", { className: `${He} ul-back-question-btn`, onClick: (u) => {
|
|
424
|
-
u.preventDefault(), u.stopPropagation(),
|
|
424
|
+
u.preventDefault(), u.stopPropagation(), E(Le);
|
|
425
425
|
}, style: { display: r.hideRecordedPrompt ? "none" : "block" } }), e("div", { id: "ul-recorder-player-container", ref: (u) => {
|
|
426
426
|
if (u && u.children.length === 0) {
|
|
427
427
|
B(u);
|
|
@@ -436,7 +436,7 @@ const er = "ul-permission-graphics-container", rr = "ul-permission-body", tr = O
|
|
|
436
436
|
const t = Math.round(Math.min(99, ...Object.values(s).filter((a) => a.isSubmitted).map((a) => a.progressPct || 0)));
|
|
437
437
|
return e("div", { className: O(n, "ul-card--uploading", "fade-in-transition"), children: [e("div", { "aria-busy": "true", "aria-label": "Processing...", "aria-live": "polite", className: "ul-loading-spinner-container", role: "progressbar", children: e("div", { className: "ul-loading-spinner", children: [e("div", { className: "first" }), e("div", { className: "second" }), e("div", { className: "third" }), e("div", { className: "fourth" })] }) }), e(ie, { message: `${o} (${t}% complete)` }), e("p", { className: "ul-caption", children: r })] });
|
|
438
438
|
}, sr = lr(void 0), Jr = ({ value: n, children: s }) => e(sr.Provider, { value: n, children: s }), et = ({ isRightLabel: n, isLeftLabel: s }) => n ? de.RIGHT : s ? de.LEFT : null, rt = "Best", tt = "Worst", nt = ({ className: n, labels: s, message: o, properties: r, options: t, questionId: a, type: m, next: y }) => {
|
|
439
|
-
var U, P,
|
|
439
|
+
var U, P, E, D;
|
|
440
440
|
const [d, g] = Z(t.map((v, w) => ({ ...v, label: v.label === "" ? `Item ${w + 1}` : v.label, isRightLabel: !1, isLeftLabel: !1 }))), c = (() => {
|
|
441
441
|
const v = or(sr);
|
|
442
442
|
if (v === void 0) throw new Error("usePreviousResponses must be used within a PreviousResponsesProvider");
|
|
@@ -457,12 +457,12 @@ const er = "ul-permission-graphics-container", rr = "ul-permission-body", tr = O
|
|
|
457
457
|
const { border: p, useMobileStyling: h, enableCspTrustedTypes: b } = Y((v) => ({ border: v.border, useMobileStyling: v.useMobileStyling, enableCspTrustedTypes: v.enableCspTrustedTypes })), x = (v, w) => () => {
|
|
458
458
|
i || g((B) => ((T, L, A) => T.map((K) => K.id === L ? { ...K, isRightLabel: A === de.RIGHT, isLeftLabel: A === de.LEFT } : A === de.RIGHT && K.isRightLabel || A === de.LEFT && K.isLeftLabel ? { ...K, isRightLabel: !1, isLeftLabel: !1 } : K))(B, v, w));
|
|
459
459
|
}, _ = (U = r.ratingIcons) == null ? void 0 : U[0].svg, k = (P = r.ratingIcons) == null ? void 0 : P[1].svg;
|
|
460
|
-
return e("form", { className: O(n, "ul-card-maxdiff", "fade-in-transition"), children: [e(ie, { isRequired: r == null ? void 0 : r.required, message: o, properties: r }), e(ae, { children: e("div", { className: "ul-card--maxdiff__question-inner-container", children: [e("div", { className: "ul-card-maxdiff__label", children: (s == null ? void 0 : s.left) || ((
|
|
460
|
+
return e("form", { className: O(n, "ul-card-maxdiff", "fade-in-transition"), children: [e(ie, { isRequired: r == null ? void 0 : r.required, message: o, properties: r }), e(ae, { children: e("div", { className: "ul-card--maxdiff__question-inner-container", children: [e("div", { className: "ul-card-maxdiff__label", children: (s == null ? void 0 : s.left) || ((E = r == null ? void 0 : r.labels) == null ? void 0 : E.left) || rt }), e("div", { children: " " }), e("div", { className: "ul-card-maxdiff__label", children: (s == null ? void 0 : s.right) || ((D = r == null ? void 0 : r.labels) == null ? void 0 : D.right) || tt }), d.map(({ id: v, label: w, isLeftLabel: B, isRightLabel: T }) => e(ye, { children: [e("div", { className: "ul-card-maxdiff__option-control " + (k ? "smiley" : ""), children: k ? e(Ge, { ariaPressed: B, className: B ? "ul-card-maxdiff__option-btn ul-card-maxdiff__option-selected good" : "ul-card-maxdiff__option-btn", enableCspTrustedTypes: b, html: k, id: `smiley-good-${v}`, onClick: x(v, de.LEFT) }) : e(Se, { allowTextEntry: !1, ariaLabel: `bestLabel-${w}`, border: p, choiceStyle: f, error: !1, id: `${v}`, isRadio: !0, isSelected: B, onUserInputChanged: x(v, de.LEFT), useMobileStyling: h }) }), e("div", { className: "ul-card-maxdiff__option-label", children: w }), e("div", { className: "ul-card-maxdiff__option-control " + (_ ? "smiley" : ""), children: _ ? e(Ge, { ariaPressed: T, className: T ? "ul-card-maxdiff__option-btn ul-card-maxdiff__option-selected bad" : "ul-card-maxdiff__option-btn", enableCspTrustedTypes: b, html: _, id: `smiley-bad-${v}`, onClick: x(v, de.RIGHT) }) : e(Se, { allowTextEntry: !1, ariaLabel: `worstLabel-${w}`, border: p, choiceStyle: f, error: !1, id: `${v}`, isRadio: !0, isSelected: T, onUserInputChanged: x(v, de.RIGHT), useMobileStyling: h }) })] }))] }) })] }, a);
|
|
461
461
|
}, Ge = ({ enableCspTrustedTypes: n, ariaPressed: s, className: o, html: r, id: t, onClick: a }) => {
|
|
462
462
|
const m = he(() => We(r, n), [n, r]);
|
|
463
463
|
return e("span", { "aria-pressed": s, className: o, dangerouslySetInnerHTML: { __html: m }, id: t, onClick: a, tabIndex: 0, type: "button" });
|
|
464
464
|
}, st = ({ className: n, labels: s, message: o, next: r, properties: t, questionId: a, type: m, onSubmitButtonClick: y, options: d, showIndividualSubmit: g = !1 }) => {
|
|
465
|
-
const c = te(null), f = te(0), i = te(0), S = te(null), p = te(!1), h = te([]), [b, x] = Z(() => (t == null ? void 0 : t.required) === !0), [_, k] = Z(() => d.map((N) => ({ ...N, rank: null }))), U = he(() => Array.from({ length: d.length }, (N, Q) => Q + 1), [d.length]), { isLongFormSurvey: P, focusedQuestionId:
|
|
465
|
+
const c = te(null), f = te(0), i = te(0), S = te(null), p = te(!1), h = te([]), [b, x] = Z(() => (t == null ? void 0 : t.required) === !0), [_, k] = Z(() => d.map((N) => ({ ...N, rank: null }))), U = he(() => Array.from({ length: d.length }, (N, Q) => Q + 1), [d.length]), { isLongFormSurvey: P, focusedQuestionId: E, setFocusedQuestionId: D, useMobileStyling: v, isPreview: w, headers: B } = Y((N) => ({ useMobileStyling: N.useMobileStyling, isLongFormSurvey: le(N.studyType), focusedQuestionId: N.focusedQuestionId, setFocusedQuestionId: N.setFocusedQuestionId, isPreview: N.isPreview, headers: N.headers })), T = (B == null ? void 0 : B["userleap-platform"]) === "android", L = v && !w && !T, A = !L && !T, K = P && E === a, u = (N) => {
|
|
466
466
|
N.preventDefault(), q(_), y && y();
|
|
467
467
|
}, C = (N, Q) => {
|
|
468
468
|
k(($) => {
|
|
@@ -522,16 +522,16 @@ const er = "ul-permission-graphics-container", rr = "ul-permission-body", tr = O
|
|
|
522
522
|
N.reduce(($, R) => ($[R.id] = R.rank, $), Q), r({ value: Q, questionId: a, type: m }, !0);
|
|
523
523
|
}, F = (N) => {
|
|
524
524
|
x(!1), P && q(N);
|
|
525
|
-
}, { left:
|
|
525
|
+
}, { left: M, right: G } = s, X = d.length, me = (N) => {
|
|
526
526
|
N.preventDefault(), N.currentTarget.classList.add("is-drop-target");
|
|
527
527
|
}, be = (N) => {
|
|
528
528
|
N.currentTarget.classList.remove("is-drop-target");
|
|
529
529
|
}, xe = (N) => {
|
|
530
530
|
c.current = null, N.currentTarget.classList.remove("is-dragging");
|
|
531
531
|
};
|
|
532
|
-
return e("form", { className: O(n, "ul-card-rank", "fade-in-transition", P && !K && "ul-card--unfocused"), onClick: P ? () => {
|
|
533
|
-
|
|
534
|
-
} : void 0, onSubmit: u, children: [e(ie, { isRequired: t == null ? void 0 : t.required, message: o, properties: t }), e(pe, { properties: t, children: e(ye, T ? { children: [e(ae, { children: [e("div", { className: "ul-card--rank__question-inner-container", children: [e("div", { className: "ul-card-rank__labels", children: e("span", { children: ["1 - ",
|
|
532
|
+
return e("form", { className: O(n, "ul-card-rank", "fade-in-transition", P && !K && "ul-card--unfocused"), onClick: P && !K ? () => {
|
|
533
|
+
D(a);
|
|
534
|
+
} : void 0, onSubmit: u, children: [e(ie, { isRequired: t == null ? void 0 : t.required, message: o, properties: t }), e(pe, { properties: t, children: e(ye, T ? { children: [e(ae, { children: [e("div", { className: "ul-card--rank__question-inner-container", children: [e("div", { className: "ul-card-rank__labels", children: e("span", { children: ["1 - ", M] }) }), e("ol", { className: "ul-card-rank__list", children: _.map(({ id: N, label: Q, rank: $ }) => e("li", { className: "ul-card-rank__option", children: [e("select", { "aria-label": `Rank for ${Q}`, className: O("ul-card-rank__select", $ == null && "ul-card-rank__select--placeholder"), name: `rank[${N}]`, onChange: (R) => C(N, R.currentTarget.value), value: $ ?? "", children: [$ == null && e("option", { className: "ul-card-rank__select-option", disabled: !0, value: "", children: "-" }), U.map((R) => e("option", { className: "ul-card-rank__select-option", value: R, children: R }, `${R}-${a}`))] }), e("span", { children: Q })] }, N)) }), e("div", { className: "ul-card-rank__labels", children: e("span", { children: [X, " - ", G] }) })] }), g && e(Ie, { handleSubmit: u, isSubmitDisabled: b })] }), !P && e(ue, { children: e("div", { className: "ul-card__button-wrapper", children: e(ee, { disabled: b, children: ge(t) }) }) })] } : { children: [e(ae, { children: [e("div", { className: "ul-card--rank__question-inner-container", children: [e("div", { className: "ul-card-rank__labels", children: e("span", { children: ["1 - ", M] }) }), e("ol", { className: "ul-card-rank__list", onDragOver: T ? void 0 : (N) => {
|
|
535
535
|
N.preventDefault(), N.dataTransfer && (N.dataTransfer.dropEffect = "move");
|
|
536
536
|
}, children: _.map(({ id: N, label: Q, rank: $ }, R) => {
|
|
537
537
|
return e("li", { className: "ul-card-rank__option", draggable: !!A || void 0, onDragEnd: A ? xe : void 0, onDragEnter: A ? me : void 0, onDragLeave: A ? be : void 0, onDragStart: A ? (oe = R, (J) => {
|
|
@@ -612,20 +612,20 @@ const er = "ul-permission-graphics-container", rr = "ul-permission-body", tr = O
|
|
|
612
612
|
ne(() => {
|
|
613
613
|
const l = k, I = U.current;
|
|
614
614
|
if (I !== null) for (const q of I) l.has(q) || (a((F) => {
|
|
615
|
-
const
|
|
616
|
-
return delete
|
|
615
|
+
const M = { ...F };
|
|
616
|
+
return delete M[q], M;
|
|
617
617
|
}), y((F) => {
|
|
618
|
-
const
|
|
619
|
-
return delete
|
|
618
|
+
const M = { ...F };
|
|
619
|
+
return delete M[q], M;
|
|
620
620
|
}));
|
|
621
621
|
U.current = new Set(l);
|
|
622
622
|
}, [k]);
|
|
623
|
-
const P = te(null),
|
|
624
|
-
var
|
|
625
|
-
|
|
623
|
+
const P = te(null), E = te(!1), D = te(null), v = ke((l) => {
|
|
624
|
+
var M, G;
|
|
625
|
+
E.current = !0;
|
|
626
626
|
const I = n.findIndex((X) => X.name === l);
|
|
627
|
-
if (!d || l === null || I === -1) return void (
|
|
628
|
-
const q = (
|
|
627
|
+
if (!d || l === null || I === -1) return void (E.current = !1);
|
|
628
|
+
const q = (M = P.current) == null ? void 0 : M.querySelectorAll(".ul-card-scroll-wrapper")[I], F = (G = P.current) == null ? void 0 : G.closest(".ul-card-main-content");
|
|
629
629
|
if (q && F) {
|
|
630
630
|
if (q && F) {
|
|
631
631
|
const X = q.getBoundingClientRect(), me = F.getBoundingClientRect(), be = X.top - me.top + F.scrollTop, xe = be + X.height / 2, N = window.innerHeight - 157;
|
|
@@ -633,10 +633,10 @@ const er = "ul-permission-graphics-container", rr = "ul-permission-body", tr = O
|
|
|
633
633
|
X.height >= N ? Q = be : Q = xe - F.clientHeight / 2;
|
|
634
634
|
const $ = F.clientHeight, R = F.scrollHeight - $, j = Math.max(0, Math.min(Q, R));
|
|
635
635
|
F.scrollTo({ top: j, behavior: "smooth" }), setTimeout(() => {
|
|
636
|
-
|
|
636
|
+
E.current = !1;
|
|
637
637
|
}, 500);
|
|
638
638
|
}
|
|
639
|
-
} else
|
|
639
|
+
} else E.current = !1;
|
|
640
640
|
}, [d, n]);
|
|
641
641
|
ne(() => {
|
|
642
642
|
g !== null && n.findIndex((l) => l.name === g) !== -1 || c(n[0].name);
|
|
@@ -649,8 +649,8 @@ const er = "ul-permission-graphics-container", rr = "ul-permission-body", tr = O
|
|
|
649
649
|
};
|
|
650
650
|
function B(l, I) {
|
|
651
651
|
return l.filter((q) => k.has(q.name)).map((q) => {
|
|
652
|
-
const F = I[q.name],
|
|
653
|
-
return { ...F, questionText:
|
|
652
|
+
const F = I[q.name], M = x.find((G) => G.name === q.name);
|
|
653
|
+
return { ...F, questionText: M ? Qe(M) : void 0 };
|
|
654
654
|
});
|
|
655
655
|
}
|
|
656
656
|
const T = (l) => {
|
|
@@ -664,18 +664,18 @@ const er = "ul-permission-graphics-container", rr = "ul-permission-body", tr = O
|
|
|
664
664
|
}, [g, d, v]);
|
|
665
665
|
const L = ke(() => {
|
|
666
666
|
var me, be;
|
|
667
|
-
if (
|
|
667
|
+
if (E.current) return;
|
|
668
668
|
const l = (me = P.current) == null ? void 0 : me.closest(".ul-card-main-content");
|
|
669
669
|
if (!l) return;
|
|
670
670
|
const I = (be = P.current) == null ? void 0 : be.querySelectorAll(".ul-card-scroll-wrapper");
|
|
671
671
|
if (!I || I.length === 0) return;
|
|
672
672
|
const q = l.getBoundingClientRect(), F = q.top + q.height / 2;
|
|
673
|
-
let
|
|
673
|
+
let M = 0, G = 1 / 0;
|
|
674
674
|
I.forEach((xe, N) => {
|
|
675
675
|
const Q = xe.getBoundingClientRect(), $ = Q.top + Q.height / 2, R = Math.abs(F - $);
|
|
676
|
-
R < G && (G = R,
|
|
676
|
+
R < G && (G = R, M = N);
|
|
677
677
|
});
|
|
678
|
-
const X = n[
|
|
678
|
+
const X = n[M];
|
|
679
679
|
D.current = X.name, c(X.name);
|
|
680
680
|
}, [n, c]);
|
|
681
681
|
ne(() => {
|
|
@@ -690,10 +690,10 @@ const er = "ul-permission-graphics-container", rr = "ul-permission-body", tr = O
|
|
|
690
690
|
var I;
|
|
691
691
|
return !k.has(l.name) || !(!(l != null && l.props) || !("properties" in l.props) || ((I = l.props.properties) == null ? void 0 : I.required) !== !1) || m[l.name];
|
|
692
692
|
}), [m, n, k]), K = async (l, I, q) => {
|
|
693
|
-
return y((
|
|
693
|
+
return y((M) => ({ ...M, [l]: q })), await (F = (M) => ({ ...M, [l]: I }), new Promise((M) => {
|
|
694
694
|
a((G) => {
|
|
695
695
|
const X = F(G);
|
|
696
|
-
return
|
|
696
|
+
return M(X), X;
|
|
697
697
|
});
|
|
698
698
|
}));
|
|
699
699
|
var F;
|
|
@@ -704,28 +704,28 @@ const er = "ul-permission-graphics-container", rr = "ul-permission-body", tr = O
|
|
|
704
704
|
const l = r.current, I = (F = n == null ? void 0 : n[0]) == null ? void 0 : F.groupId;
|
|
705
705
|
r.current = I;
|
|
706
706
|
const q = {};
|
|
707
|
-
if (n.forEach((
|
|
707
|
+
if (n.forEach((M) => {
|
|
708
708
|
var G, X;
|
|
709
|
-
Tr(
|
|
709
|
+
Tr(M) && (M.props.properties.required || (q[M.name] = { value: ((G = t[M.name]) == null ? void 0 : G.value) ?? null, secondaryValue: ((X = t[M.name]) == null ? void 0 : X.secondaryValue) ?? null, questionId: M.name, type: M.type }));
|
|
710
710
|
}), l == null || l !== I) a(q), y({});
|
|
711
711
|
else {
|
|
712
712
|
a((G) => ({ ...G, ...q }));
|
|
713
|
-
const
|
|
713
|
+
const M = n.reduce((G, X) => {
|
|
714
714
|
var me;
|
|
715
715
|
return X.type === "aidynamicfollowup" && ((me = X.props) == null ? void 0 : me.loading) === null && (G[X.name] = !0), G;
|
|
716
716
|
}, {});
|
|
717
|
-
y((G) => ({ ...G, ...
|
|
717
|
+
y((G) => ({ ...G, ...M }));
|
|
718
718
|
}
|
|
719
719
|
}, [n, d]);
|
|
720
720
|
const u = async (l, I) => {
|
|
721
721
|
if (d) {
|
|
722
|
-
const q = await K(l.questionId, l, I), F = C(l.type),
|
|
723
|
-
if (F && T(l.questionId),
|
|
722
|
+
const q = await K(l.questionId, l, I), F = C(l.type), M = V(l.type);
|
|
723
|
+
if (F && T(l.questionId), M && I) {
|
|
724
724
|
const G = B(n, q);
|
|
725
725
|
s(G);
|
|
726
726
|
}
|
|
727
727
|
} else {
|
|
728
|
-
const q = x.find((
|
|
728
|
+
const q = x.find((M) => M.name === l.questionId), F = { ...l, questionText: q ? Qe(q) : void 0 };
|
|
729
729
|
w({ displayCard: q, response: l }), s([F]);
|
|
730
730
|
}
|
|
731
731
|
}, C = (l) => (/* @__PURE__ */ new Set(["nps", "likert", "multiplechoice"])).has(l), V = (l) => (/* @__PURE__ */ new Set(["videovoice", "consentlegal", "texturlprompt", "maxdiff"])).has(l), W = ((H = n[0]) == null ? void 0 : H.type) === "thanks";
|