freemium-survey-components 0.10.27 → 0.10.28
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/lib/index.cjs.js +1 -1
- package/lib/index.esm.js +1 -1
- package/lib/types/components/radio-button/index.d.ts +2 -1
- package/lib/types/constants.d.ts +4 -0
- package/lib/types/index.d.ts +1 -1
- package/lib/types/mock.d.ts +86 -13
- package/lib/types/survey/card.d.ts +5 -133
- package/lib/types/survey/constants.d.ts +4 -0
- package/lib/types/survey/index.d.ts +1 -22
- package/lib/types/survey/standard.d.ts +5 -0
- package/lib/types/types.d.ts +15 -0
- package/package.json +1 -1
package/lib/index.cjs.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";function e(e){return e&&"object"==typeof e&&"default"in e?e.default:e}Object.defineProperty(exports,"__esModule",{value:!0});var n=require("react"),t=e(n),o=e(require("react-dom"));function r(e,n){void 0===n&&(n={});var t=n.insertAt;if(e&&"undefined"!=typeof document){var o=document.head||document.getElementsByTagName("head")[0],r=document.createElement("style");r.type="text/css","top"===t&&o.firstChild?o.insertBefore(r,o.firstChild):o.appendChild(r),r.styleSheet?r.styleSheet.cssText=e:r.appendChild(document.createTextNode(e))}}r(".freemium-survey-components .nps-container {\n margin: 0 auto;\n width: 100%;\n display: flex;\n flex-direction: column;\n grid-gap: 28px;\n gap: 28px;\n}\n.freemium-survey-components .nps-container .footer {\n border-top: 1px solid var(--default-background-color);\n border-top: 1px solid var(--background-color, var(--default-background-color));\n padding-top: 20px;\n display: flex;\n justify-content: center;\n font-size: 0.875rem;\n line-height: 1.5;\n color: #666;\n}\n.freemium-survey-components .nps-container .footer:empty {\n display: none;\n}\n.freemium-survey-components .nps-container .nps-scale {\n position: relative;\n}\n.freemium-survey-components .nps-container .nps-scale .button-container {\n display: flex;\n border-radius: 4px;\n justify-content: space-between;\n background: var(--default-background-color);\n background: var(--background-color, var(--default-background-color));\n position: relative;\n margin-bottom: 40px;\n}\n.freemium-survey-components .nps-container .nps-scale .positive-text {\n position: absolute;\n color: #475867;\n bottom: -40px;\n font-size: 12px;\n right: 0px;\n text-align: right;\n}\n.freemium-survey-components .nps-container .nps-scale .negative-text {\n position: absolute;\n color: #475867;\n bottom: -40px;\n font-size: 12px;\n left: 0;\n text-align: left;\n}\n.freemium-survey-components .nps-container .nps-scale span {\n color: #aaa;\n font-size: 0.75rem;\n}\n.freemium-survey-components .nps-container .nps-scale button {\n display: inline-block;\n font-size: 1rem;\n white-space: nowrap;\n vertical-align: middle;\n background: none;\n border: none;\n box-shadow: none;\n cursor: pointer;\n text-align: center;\n font-weight: 400;\n border-radius: 4px;\n margin: 0;\n outline: none;\n margin-left: -1px;\n width: 40px;\n height: 40px;\n transform: scale(1);\n}\n.freemium-survey-components .nps-container .nps-scale button:hover {\n transition: background 0.2s ease-in, color 0.2s ease-in, border-color 0.2s ease-in, transform 0.2s cubic-bezier(0.5, 2, 0.5, 0.75);\n}\n.freemium-survey-components .nps-container .nps-scale button:hover, .freemium-survey-components .nps-container .nps-scale button:focus {\n color: white;\n transform: scale(1.2);\n z-index: 2;\n position: relative;\n}\n.freemium-survey-components .nps-container .nps-scale button.active {\n color: white;\n transform: scale(1.2);\n z-index: 2;\n position: relative;\n}\n.freemium-survey-components .nps-container .nps-scale.rounded button {\n border-radius: 50%;\n}\n.freemium-survey-components .nps-container .nps-scale.square button {\n border-radius: 0;\n}\n.freemium-survey-components .nps-container .nps-scale.curved button {\n border-radius: 3px;\n}\n.freemium-survey-components .nps-container .nps-scale.highlighted button:hover, .freemium-survey-components .nps-container .nps-scale.highlighted button:focus, .freemium-survey-components .nps-container .nps-scale.highlighted button.active {\n background: var(--default-brand-color) !important;\n background: var(--brand-color, var(--default-brand-color)) !important;\n}\n.freemium-survey-components .nps-container .nps-scale .choices {\n width: 100%;\n display: flex;\n justify-content: space-between;\n font-weight: 500;\n}\n.freemium-survey-components .nps-container .nps-scale.standard .button-container {\n background-color: transparent;\n}\n.freemium-survey-components .nps-container .nps-scale.standard .choice {\n background: #E43E3D;\n color: #fff;\n}\n.freemium-survey-components .nps-container .nps-scale.standard .choice:nth-last-child(1), .freemium-survey-components .nps-container .nps-scale.standard .choice:nth-last-child(2) {\n background: #00AF50;\n}\n.freemium-survey-components .nps-container .nps-scale.standard .choice:nth-last-child(3), .freemium-survey-components .nps-container .nps-scale.standard .choice:nth-last-child(4) {\n background: #F8C43E;\n}\n.freemium-survey-components .nps-container .nps-scale.standard .choice:hover, .freemium-survey-components .nps-container .nps-scale.standard .choice:focus, .freemium-survey-components .nps-container .nps-scale.standard .choice.active {\n transform: scale(1.2);\n}\n\n.freemium-survey-components.mobile-preview .nps-container .nps-scale .button-container {\n background: transparent;\n}\n.freemium-survey-components.mobile-preview .nps-container .nps-scale .choices {\n flex-wrap: wrap;\n justify-content: center;\n grid-gap: 16px;\n gap: 16px;\n background: transparent;\n}\n.freemium-survey-components.mobile-preview .nps-container .nps-scale button {\n border-radius: 50%;\n background: #ebeff3;\n}\n\n@media (max-width: 550px) {\n .freemium-survey-components .nps-container .nps-scale .button-container,\n.card-survey-style .nps-container .nps-scale .button-container {\n background: transparent;\n }\n .freemium-survey-components .nps-container .nps-scale .choices,\n.card-survey-style .nps-container .nps-scale .choices {\n flex-wrap: wrap;\n justify-content: center;\n grid-gap: 16px;\n gap: 16px;\n background: transparent;\n }\n .freemium-survey-components .nps-container .nps-scale button,\n.card-survey-style .nps-container .nps-scale button {\n border-radius: 50%;\n background: #ebeff3;\n }\n}\n.widget-survey-components .nps-container .nps-scale .button-container {\n background: transparent;\n}\n.widget-survey-components .nps-container .nps-scale .choices {\n flex-wrap: wrap;\n justify-content: center;\n grid-gap: 16px;\n gap: 16px;\n background: transparent;\n}\n.widget-survey-components .nps-container .nps-scale button {\n border-radius: 50%;\n background: #ebeff3;\n}");const a=e=>{const{type_info:{linear_scale:{button_style:o="highlighted",button_shape:r="rounded"}={},score_presets:{start:a="Very unlikely",end:i="Very likely"}={},validation:{min:s},footer_text:c}}=e,u=e=>{switch(e){case e<=6:return"detractor";case e<=8:return"passive";default:return"promoter"}},l=n.useRef(Array.from({length:10+(0===s?1:0)},((e,n)=>n+s)));return t.createElement("div",{className:"nps-container","data-test-input":"nps"},t.createElement("div",{className:`nps-scale ${r} ${o}`},t.createElement("div",{className:"button-container"},t.createElement("span",{className:"negative-text",role:"note"},`${s} - ${a}`),t.createElement("span",{className:"positive-text",role:"note"},`${l.current[l.current.length-1]} - ${i}`),t.createElement("div",{className:"choices",role:"radiogroup","aria-required":!0},l.current.map((n=>t.createElement("button",{role:"radio","aria-checked":e.npsValue===n,key:n,"data-test-nps-choice":n,onClick:t=>{e.onChangeHandler(n)},className:`choice ${u(n)} ${e.npsValue===n&&"active"}`},n)))))),t.createElement("div",{className:"footer",role:"note"},c))},i=(e,n)=>(e.defaultProps=n,e);r('.freemium-survey-components .input-container,\n.freemium-survey-components .textarea-container {\n display: flex;\n flex-direction: column;\n width: 100%;\n border-radius: 4px;\n position: relative;\n}\n.freemium-survey-components label.input-label {\n display: inline-block;\n padding-bottom: 8px;\n padding-left: 2px;\n font-size: 0.75rem;\n font-weight: 400;\n}\n.freemium-survey-components label.required::after {\n content: "*";\n position: relative;\n top: 2px;\n font-weight: 500;\n font-size: 0.85rem;\n padding-left: 3px;\n color: #d72d30;\n}\n.freemium-survey-components .input-basic {\n width: 100%;\n display: flex;\n align-items: center;\n border-radius: 4px;\n border: 1px solid var(--default-brand-color);\n border: 1px solid var(--brand-color, var(--default-brand-color));\n transition: border-color 0.2s linear;\n background: #fff;\n}\n.freemium-survey-components .textarea-container .input-basic {\n flex-direction: column;\n align-items: unset;\n}\n.freemium-survey-components .input-basic.error {\n border: 1px solid #d72d30;\n}\n.freemium-survey-components .input-basic.error:hover {\n border: 1px solid #d72d30;\n}\n.freemium-survey-components .input-basic.error[focus-within] {\n box-shadow: none;\n}\n.freemium-survey-components .input-basic.error:focus-within {\n box-shadow: none;\n}\n.freemium-survey-components .input-basic:hover {\n border-color: var(--default-brand-color);\n border-color: var(--brand-color, var(--default-brand-color));\n transition: 0.2s linear;\n}\n.freemium-survey-components .input-basic[focus-within] {\n border: 1px solid transparent;\n box-shadow: 0 0 0 2px var(--default-brand-color);\n box-shadow: 0 0 0 2px var(--brand-color, var(--default-brand-color));\n}\n.freemium-survey-components .input-basic:focus-within {\n border: 1px solid transparent;\n box-shadow: 0 0 0 2px var(--default-brand-color);\n box-shadow: 0 0 0 2px var(--brand-color, var(--default-brand-color));\n}\n.freemium-survey-components .end-max-length {\n padding: 0 8px;\n font-size: 0.75rem;\n color: #264966;\n}\n.freemium-survey-components .textarea-container .end-max-length {\n padding: 8px;\n align-self: flex-end;\n}\n.freemium-survey-components span.input-error {\n display: block;\n padding-left: 2px;\n padding-top: 4px;\n font-size: 0.9rem;\n color: #d72d30;\n}\n.freemium-survey-components input[type=text] {\n padding: 6px 12px;\n flex: 1;\n border: unset;\n height: 32px;\n font-size: 1rem;\n /* line-height: ${typography.input.text.lineHeight}; */\n border-radius: 4px;\n}\n.freemium-survey-components input[type=text],\n.freemium-survey-components textarea {\n outline: none;\n border: none;\n}\n.freemium-survey-components input[type=text]::-moz-placeholder {\n color: #92a2b2;\n font-weight: 400;\n font-size: 0.85rem;\n}\n.freemium-survey-components input[type=text]:-ms-input-placeholder {\n color: #92a2b2;\n font-weight: 400;\n font-size: 0.85rem;\n}\n.freemium-survey-components input[type=text]::placeholder {\n color: #92a2b2;\n font-weight: 400;\n font-size: 0.85rem;\n}\n.freemium-survey-components textarea {\n min-height: 116px;\n padding: 12px;\n flex: 1;\n border: unset;\n resize: none;\n font-size: 1rem;\n /* line-height: ${typography.input.text.lineHeight}; */\n border-radius: 4px;\n}\n.freemium-survey-components textarea::-moz-placeholder {\n color: #92a2b2;\n font-weight: 400;\n font-size: 0.85rem;\n}\n.freemium-survey-components textarea:-ms-input-placeholder {\n color: #92a2b2;\n font-weight: 400;\n font-size: 0.85rem;\n}\n.freemium-survey-components textarea::placeholder {\n color: #92a2b2;\n font-weight: 400;\n font-size: 0.85rem;\n}');const s={isRequired:!1,showCount:!0,isErrored:!1,inline:!1,spellCheck:!1,autoFocusInput:!0},c=n.forwardRef(((e,o)=>{const r=n.useRef(null);n.useEffect((()=>{e.autoFocusInput&&setTimeout((()=>{r.current?.focus()}),_+e.autoFocusDelay)}),[e.autoFocusInput]);const{inputStyle:a,style:i,className:s,showCount:c,isErrored:u,startLabel:l,isRequired:d,errorText:p,endLabel:m,maxLength:f=300,onChange:x,autoFocusInput:v,...h}=e;return t.createElement("div",{className:"input-container",style:i},e.label&&t.createElement("label",{className:"input-label "+(d?"required":"")},e.label),t.createElement("div",null,l&&t.createElement("div",{className:"start-label"},l),t.createElement("div",{className:`input-basic ${u?"error":""}${s||""}`},t.createElement("input",Object.assign({},h,{type:"text",autoComplete:"off",ref:r,style:a,onChange:e=>{e.target.value?.length>f||x?.(e)}})),c&&f>0&&t.createElement("div",{className:"end-max-length"},`${e.value&&e.value.length||0}/${f}`)),m&&t.createElement("div",{className:"end-label"},m)),u&&p&&t.createElement("span",{className:"input-error"},e.errorText))})),u=n.forwardRef(((e,o)=>{const r=n.useRef(null);n.useEffect((()=>{e.autoFocusInput&&setTimeout((()=>{r.current?.focus()}),_+e.autoFocusDelay)}),[e.autoFocusInput]);const{inputStyle:a,style:i,className:s,showCount:c,maxLength:u=1500,startLabel:l,isRequired:d,autoFocusInput:p,onChange:m,...f}=e;return t.createElement(t.Fragment,null,t.createElement("div",{className:"textarea-container",style:i},e.label&&t.createElement("label",{className:"input-label "+(d?"required":"")},e.label),l&&t.createElement("div",{className:"start-label"},l),t.createElement("div",{className:`input-basic ${s||""}`},t.createElement("textarea",Object.assign({},f,{autoComplete:"off",ref:r,style:a,onChange:e=>{e.target.value?.length>u||m?.(e)}})),c&&u&&u>0&&t.createElement("div",{className:"end-max-length"},`${e.value&&e.value.length||0}/${u}`)),e.endLabel&&t.createElement("div",{className:"end-label"},e.endLabel)))})),l=i(c,s),d=i(u,s);r('.freemium-survey-components .checkbox-group {\n width: 100%;\n display: flex;\n grid-gap: 12px;\n gap: 12px;\n flex-direction: column;\n white-space: nowrap;\n flex-wrap: wrap;\n}\n.freemium-survey-components .icon-container {\n display: inline-block;\n flex: 0 0 12px;\n width: 12px;\n height: 12px;\n min-width: 12px;\n min-height: 12px;\n color: inherit;\n position: absolute;\n left: 1px;\n top: 2px;\n}\n.freemium-survey-components .tick-icon {\n position: absolute;\n top: 0;\n right: 0;\n bottom: 0;\n left: 0;\n height: 100%;\n width: 100%;\n color: inherit;\n fill: currentColor;\n}\n.freemium-survey-components input[type=checkbox] {\n position: absolute;\n clip: rect(0px 0px 0px 0px);\n width: 0px;\n height: 0px;\n}\n.freemium-survey-components input[type=checkbox]:focus ~ .checkbox {\n /* box-shadow: ${pseudo.focus} 0px 0px 0px 2px; */\n box-shadow: var(--default-brand-color) 0px 0px 0px 2px;\n box-shadow: var(--brand-color, var(--default-brand-color)) 0px 0px 0px 2px;\n border-color: transparent;\n}\n.freemium-survey-components .checkbox-label {\n display: flex;\n align-items: baseline;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n text-align: left;\n opacity: 1;\n line-height: 1.2;\n cursor: pointer;\n font-size: 1rem;\n padding: 16px 24px;\n min-width: 200px;\n border: 1px solid #ebeff3;\n box-shadow: 0px 2px 5px rgba(18, 52, 77, 0.06);\n border-radius: 4px;\n white-space: pre-wrap;\n}\n.freemium-survey-components .checkbox-label:hover .checkbox {\n border-color: var(--default-brand-color);\n border-color: var(--brand-color, var(--default-brand-color));\n box-shadow: var(--default-background-color) 0px 0px 0px 5px;\n box-shadow: var(--background-color, var(--default-background-color)) 0px 0px 0px 5px;\n}\n.freemium-survey-components .checkbox-label.disabled {\n opacity: 0.5;\n cursor: "not-allowed";\n}\n.freemium-survey-components .checkbox {\n transition: background-color ease-in 0.2s;\n min-width: 14px;\n min-height: 14px;\n min-height: 14px;\n max-height: 14px;\n border-radius: 2px;\n position: relative;\n margin-right: 16px;\n background-color: #fff;\n border: 1px solid;\n text-align: left;\n border-color: var(--default-brand-color);\n border-color: var(--brand-color, var(--default-brand-color));\n}\n.freemium-survey-components .checkbox:hover {\n border-color: var(--default-brand-color);\n border-color: var(--brand-color, var(--default-brand-color));\n box-shadow: var(--default-background-color) 0px 0px 0px 5px;\n box-shadow: var(--background-color, var(--default-background-color)) 0px 0px 0px 5px;\n}\n.freemium-survey-components input[type=checkbox]:checked ~ .checkbox {\n background-color: var(--default-brand-color);\n background-color: var(--brand-color, var(--default-brand-color));\n border-color: var(--default-brand-color);\n border-color: var(--brand-color, var(--default-brand-color));\n}\n.freemium-survey-components input[type=checkbox]:checked ~ .checkbox:hover {\n border-color: var(--default-brand-color);\n border-color: var(--brand-color, var(--default-brand-color));\n}\n.freemium-survey-components input[type=checkbox]:disabled ~ .checkbox:hover {\n box-shadow: unset;\n border-color: unset;\n}');const p=()=>t.createElement("svg",{id:"tick",className:"tick-icon",xmlns:"http://www.w3.org/2000/svg","aria-labelledby":"title",viewBox:"0 0 10 10"},t.createElement("path",{d:"M3 5.87c-.18666814.00267463-.36667109-.06932655-.5-.2L.21 3.41c-.1786328-.17863279-.24839684-.43899577-.1830127-.6830127.06538414-.24401694.25598306-.43461586.5-.5C.77100423 2.16160316 1.0313672 2.23136721 1.21 2.41L3 4.18 6.8.33c.27679776-.27455556.72320224-.27455556 1 0 .13696438.13025306.21450026.31098915.21450026.5S7.93696438 1.19974694 7.8 1.33L3.45 5.67c-.12082534.11896945-.28072735.19003701-.45.2Z",fill:"#fff",fillRule:"evenodd"})),m=({values:e=[],othersValue:o="",options:r,name:a,autoFocusGroup:i,autoFocusDelay:s,onChangeHandler:c,saveOthersValue:u,othersOption:d,othersRequired:p})=>{const[m,x]=n.useState(!1),v=n.useRef(null);return n.useEffect((()=>{i&&setTimeout((()=>{v.current?.focus()}),_+s)}),[i]),t.createElement("div",{className:"checkbox-group"},t.createElement("button",{ref:v,className:"autofocus-button","aria-hidden":!0}),r?.map(((n,o)=>t.createElement(f,{key:n.id,checked:e?.includes(n.value),name:n.value,id:n.id,onChange:(t,o)=>{if(o)c([...e||[],n.value]);else{const t=e.indexOf(n.value);t>-1&&e.splice(t,1),c([...e])}}},n.value))),d&&t.createElement(f,{key:"others",checked:m,name:"others",id:"others",onChange:(n,t)=>{if(x(t),t)c([...e,"others"]);else{const n=e.findIndex((e=>"others"===e));e.splice(n,1),c(e)}}},"Others"),m&&t.createElement(t.Fragment,null,t.createElement(l,{placeholder:"Enter your comment",value:o[a],onChange:e=>{u(a,e.target.value)},autoFocusDelay:10,label:""})))},f=i((e=>{const o=n.useRef(null);return n.useEffect((()=>{e.autoFocus&&setTimeout((()=>{o.current?.focus()}),_+20)}),[]),t.createElement("label",{className:`checkbox-label ${e.disabled&&"disabled"}`},t.createElement("input",{ref:o,id:e.id,type:"checkbox",name:e.name,readOnly:e.readOnly,disabled:e.disabled,"aria-disabled":e.disabled,checked:e.checked,onChange:e.readOnly?()=>{}:n=>e.onChange(n,n.target.checked)}),t.createElement("div",{className:"checkbox"},e.checked&&t.createElement("div",{className:"icon-container"},t.createElement(p,null)," ")),t.createElement("div",null,e.children))}),{checked:!1});r('.freemium-survey-components .radio-group {\n display: flex;\n grid-gap: 12px;\n gap: 12px;\n white-space: nowrap;\n flex-direction: column;\n width: 100%;\n}\n.freemium-survey-components .radio {\n background-color: #fff;\n border: 1px solid;\n border-color: var(--default-brand-color);\n border-color: var(--brand-color, var(--default-brand-color));\n transition: background-color ease-in 0.2s;\n min-width: 18px;\n max-width: 18px;\n min-height: 18px;\n max-height: 18px;\n border-radius: 50%;\n position: relative;\n margin-right: 16px;\n text-align: left;\n}\n.freemium-survey-components .radio:before {\n left: 3px;\n top: 3px;\n content: "";\n position: absolute;\n width: 10px;\n height: 10px;\n border-radius: 50%;\n transition: all ease-in 0.2s;\n background-color: #fff;\n}\n.freemium-survey-components .radio-label {\n display: flex;\n align-items: baseline;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n text-align: left;\n cursor: pointer;\n line-height: 1.2;\n font-size: 1rem;\n font-weight: 400;\n padding: 16px 24px;\n min-width: 200px;\n border: 1px solid #ebeff3;\n box-shadow: 0px 2px 5px rgba(18, 52, 77, 0.06);\n border-radius: 4px;\n white-space: pre-wrap;\n}\n.freemium-survey-components input[type=radio] {\n position: absolute;\n clip: rect(0, 0, 0, 0);\n width: 0px;\n height: 0px;\n}\n.freemium-survey-components input[type=radio]:focus ~ .radio {\n /* box-shadow: ${pseudo.focus} 0px 0px 0px 3px; */\n box-shadow: var(--default-brand-color) 0px 0px 0px 3px;\n box-shadow: var(--brand-color, var(--default-brand-color)) 0px 0px 0px 3px;\n border-color: transparent;\n}\n.freemium-survey-components input[type=radio]:checked ~ .radio:before {\n background-color: var(--default-brand-color);\n background-color: var(--brand-color, var(--default-brand-color));\n}\n.freemium-survey-components .radio-label:hover .radio {\n border-color: var(--default-brand-color);\n border-color: var(--brand-color, var(--default-brand-color));\n box-shadow: var(--default-background-color) 0px 0px 0px 5px;\n box-shadow: var(--background-color, var(--default-background-color)) 0px 0px 0px 5px;\n}');const x=({name:e,options:o,value:r,autoFocusGroup:a,autoFocusDelay:i,onChangeHandler:s,saveOthersValue:c,othersOption:u,othersRequired:d})=>{const[p,m]=n.useState(""),[f,x]=n.useState(""),h=n.useRef(null);return n.useEffect((()=>{a&&setTimeout((()=>{h.current?.focus()}),_+i)}),[a]),n.useEffect((()=>{r||(x(""),m(""))}),[r]),n.useEffect((()=>{f&&o.find((e=>e.value===f))&&s(f)}),[f]),t.createElement("div",{className:"radio-group",role:"radiogroup"},t.createElement("button",{ref:h,className:"autofocus-button","aria-hidden":!0,tabIndex:-1}),o?.map(((n,o)=>t.createElement(v,{key:n.value,value:n.value,name:e,onChange:e=>{x(e.currentTarget.value)},checked:f===n.value},n.value))),u&&t.createElement(v,{key:"others",value:"others",name:e,onChange:e=>{x("others")},checked:"others"===f},"Others"),"others"===f&&t.createElement(t.Fragment,null,t.createElement(l,{value:p,onChange:e=>m(e.target.value),placeholder:"Enter your comment",label:"",autoFocusDelay:10}),p!==r&&t.createElement(b,{inline:!0,disabled:d&&0===p.length,onClick:()=>{s("others"),c(e,p)}},"Next")))},v=i((e=>{const o=n.useRef(null);return n.useEffect((()=>{e.autoFocus&&setTimeout((()=>{o.current?.focus()}),_+20)}),[]),t.createElement("label",{className:"radio-label"},t.createElement("input",{ref:o,type:"radio",name:e.name,value:e.value,checked:e.checked,onChange:e.onChange}),t.createElement("div",{className:"radio"}),t.createElement("div",null,e.children))}),{checked:!1,autoFocus:!1});r(".progressbar-container {\n width: 100%;\n height: 4px;\n position: fixed;\n top: 0;\n left: 0;\n z-index: 1;\n text-align: left;\n}\n\n.progressbar {\n transition: transform 0.25s linear;\n transform-origin: left;\n height: 100%;\n background-color: var(--default-brand-color);\n background-color: var(--brand-color, var(--default-brand-color));\n}");const h=e=>{const{totalSteps:n,completedSteps:o}=e;return t.createElement("div",{className:"progressbar-container"},t.createElement("div",{className:"progressbar",style:{width:(o>0?100/n:0)+"%",transform:`scaleX(${o})`}}))};r(".freemium-survey-components .action-button {\n width: auto;\n display: block;\n padding: 8px 16px;\n cursor: pointer;\n line-height: 1.5;\n text-align: center;\n font-weight: 500;\n letter-spacing: 0.3px;\n border-radius: 4px;\n white-space: nowrap;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n color: --default-button-text-color;\n color: var(--button-text-color, --default-button-text-color);\n background: var(--default-brand-color);\n background: var(--brand-color, var(--default-brand-color));\n border: 1px solid var(--default-brand-color);\n border: 1px solid var(--brand-color, var(--default-brand-color));\n border-radius: 4px;\n min-width: 200px;\n max-width: -webkit-fit-content;\n max-width: -moz-fit-content;\n max-width: fit-content;\n transform: translateY(0px);\n transition: transform ease 0.2s;\n}\n.freemium-survey-components .action-button:not([disabled]):hover {\n transform: translateY(-4px);\n}\n.freemium-survey-components .action-button[disabled] {\n cursor: not-allowed;\n opacity: 0.6;\n}\n.freemium-survey-components button:focus:not(:active) {\n /* box-shadow: 0 0 0 2px ${pseudo.focus}; */\n}\n\n@media (max-width: 550px) {\n .freemium-survey-components .action-button {\n min-width: 120px;\n }\n}\n.widget-survey-components .action-button {\n min-width: 120px;\n}\n\n.freemium-survey-components.mobile-preview .action-button {\n min-width: 120px;\n}");const y=()=>t.createElement(t.Fragment,null,"..."),b=e=>{const{inline:n=!1,children:o,disabled:r,className:a="",htmlType:i,type:s="primary",onClick:c,size:u,overrideStyleClassName:l="",loading:d=!1,...p}=e;return t.createElement("button",Object.assign({style:n?{display:"inline-block"}:{},disabled:r,className:`action-button ${a} ${l}`,type:i,onClick:c},p),d?t.createElement(y,null):o)},g=()=>t.createElement("svg",{style:{display:"block"},width:"9",height:"14",viewBox:"0 0 10 16",fill:"none",xmlns:"http://www.w3.org/2000/svg"},t.createElement("path",{d:"M7.82585 6.15754C7.98999 6.32147 8.08232 6.54389 8.08252 6.77587L8.08252 7.2192C8.07983 7.45069 7.98788 7.6722 7.82585 7.83754L1.82919 13.8225C1.77496 13.8772 1.71044 13.9206 1.63936 13.9502C1.56827 13.9798 1.49203 13.9951 1.41502 13.9951C1.33801 13.9951 1.26177 13.9798 1.19068 13.9502C1.1196 13.9206 1.05508 13.8772 1.00085 13.8225L0.172521 12.9942C0.118197 12.941 0.0750381 12.8774 0.0455752 12.8073C0.0161124 12.7372 0.000937578 12.6619 0.000937585 12.5859C0.000937592 12.5098 0.0161125 12.4345 0.0455753 12.3644C0.0750381 12.2943 0.118197 12.2308 0.172521 12.1775L5.36419 6.99754L0.172522 1.81754C0.117847 1.76331 0.0744506 1.69879 0.0448352 1.62771C0.0152208 1.55662 -2.75162e-05 1.48038 -2.75094e-05 1.40337C-2.75027e-05 1.32636 0.0152208 1.25012 0.0448353 1.17904C0.0744507 1.10795 0.117847 1.04343 0.172522 0.989205L1.00086 0.172537C1.05508 0.117862 1.1196 0.0744661 1.19069 0.0448507C1.26177 0.0152353 1.33801 -1.20337e-05 1.41502 -1.2027e-05C1.49203 -1.20203e-05 1.56827 0.0152353 1.63936 0.0448507C1.71044 0.0744661 1.77496 0.117862 1.82919 0.172537L7.82585 6.15754Z",fill:"#6B6B6B"})),w=()=>t.createElement("svg",{style:{display:"block"},width:"9",height:"14",viewBox:"0 0 10 16",fill:"none",xmlns:"http://www.w3.org/2000/svg"},t.createElement("path",{d:"M0.256667 7.83755C0.0925257 7.67361 0.000204227 7.4512 0 7.21921V6.77588C0.00268801 6.5444 0.0946357 6.32289 0.256667 6.15755L6.25333 0.172549C6.30756 0.117874 6.37208 0.0744776 6.44316 0.0448625C6.51425 0.0152474 6.59049 0 6.6675 0C6.74451 0 6.82075 0.0152474 6.89184 0.0448625C6.96292 0.0744776 7.02744 0.117874 7.08167 0.172549L7.91 1.00088C7.96432 1.05411 8.00748 1.11764 8.03694 1.18776C8.06641 1.25787 8.08158 1.33316 8.08158 1.40922C8.08158 1.48527 8.06641 1.56056 8.03694 1.63067C8.00748 1.70079 7.96432 1.76432 7.91 1.81755L2.71833 6.99755L7.91 12.1775C7.96467 12.2318 8.00807 12.2963 8.03769 12.3674C8.0673 12.4385 8.08255 12.5147 8.08255 12.5917C8.08255 12.6687 8.0673 12.745 8.03769 12.8161C8.00807 12.8871 7.96467 12.9517 7.91 13.0059L7.08167 13.8225C7.02744 13.8772 6.96292 13.9206 6.89184 13.9502C6.82075 13.9799 6.74451 13.9951 6.6675 13.9951C6.59049 13.9951 6.51425 13.9799 6.44316 13.9502C6.37208 13.9206 6.30756 13.8772 6.25333 13.8225L0.256667 7.83755Z",fill:"#6B6B6B"})),k=({question:e,formValues:n,othersMeta:o,onChangeHandler:r,saveOthersValue:i,autoFocus:s,autoFocusDelay:c})=>{switch(e.type_info.question_type){case"RANGE":return t.createElement(a,{type_info:e.type_info,onChangeHandler:r,npsValue:n[e.name]});case"CHECKBOX":case"MULTI_SELECT":return t.createElement(m,{name:e.name,autoFocusGroup:s,values:n[e.name],othersValue:o[e.name],options:e.type_info.choices,onChangeHandler:r,saveOthersValue:i,othersOption:e.type_info.meta?.othersOption,othersRequired:e.type_info.meta?.othersRequired,autoFocusDelay:c});case"RADIO":case"DROPDOWN":return t.createElement(x,{autoFocusGroup:s,autoFocusDelay:c,name:e.name,onChangeHandler:r,saveOthersValue:i,options:e.type_info.choices,value:n[e.name],othersOption:e.type_info.meta?.othersOption,othersRequired:e.type_info.meta?.othersRequired});case"INPUT":case"TEXT":return e.type_info?.meta?.readOnly?t.createElement("div",{className:"message-container"},e.type_info?.meta?.value):t.createElement("div",{className:"responsive-text-field"},t.createElement(l,{autoFocusInput:s,autoFocusDelay:c,label:"",isRequired:e.is_required,value:n[e.name]||"",placeholder:e.type_info?.meta?.placeholder??"",onChange:e=>r(e.target.value)}),t.createElement(d,{autoFocusInput:s,autoFocusDelay:c,label:"",isRequired:e.is_required,placeholder:e.type_info?.meta?.placeholder??"",value:n[e.name]||"",onChange:e=>r(e.target.value)}));case"PARAGRAPH":return t.createElement(d,{autoFocusInput:s,autoFocusDelay:c,label:"",isRequired:e.is_required,placeholder:e.type_info?.meta?.placeholder??"",value:n[e.name]||"",onChange:e=>r(e.target.value)});default:return console.error(`Question type ${e.type_info.question_type} not found`),null}},q=(e,n,t)=>{if(e){let o={"{{nps.score}}":t};n&&(o={...o,...n});const r=new RegExp(Object.keys(o).join("|"),"gi");e=e.replace(r,(function(e){return o[e.toLowerCase()]}))}return e};r(":root {\n --default-brand-color: #264966;\n --default-question-text-color: #000;\n --default-question-background-color: #fff;\n --default-background-color: #f8f8f8;\n --default-button-text-color: #fff;\n --default-secondary-button-text-color: #000;\n --default-input-placeholder-color: #92a2b1;\n --compact-widget-max-height: 560px;\n --default-widget-max-height: 400px;\n --cozy-widget-max-height: 380px;\n}\n\n.freemium-survey-step-navigation {\n padding: 0 2px;\n box-shadow: 0px 0px 6px #eee;\n white-space: nowrap;\n}\n.freemium-survey-step-navigation .navigation-button {\n width: 38px;\n text-align: -webkit-center;\n height: 38px;\n background-color: #fff;\n border: none;\n cursor: pointer;\n border-radius: 0 3px 3px 0;\n}\n.freemium-survey-step-navigation .navigation-button:first-of-type {\n border-right: 1px solid #d9d9d9;\n border-radius: 3px 0 0 3px;\n}\n.freemium-survey-step-navigation .navigation-button:disabled {\n cursor: not-allowed;\n opacity: 0.5;\n}\n.freemium-survey-step-navigation .navigation-button:focus {\n position: relative;\n z-index: 1;\n}\n\n.freemium-survey-components .question-container {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n text-align: center;\n max-width: 700px;\n margin: 0 auto;\n background: var(--default-question-background-color);\n background: var(--question-background-color, var(--default-question-background-color));\n border-radius: 4px;\n transition: transform 500ms ease 0ms, opacity 200ms ease 0ms;\n box-shadow: 0px 12px 15px rgba(18, 52, 77, 0.03);\n margin-bottom: 28px;\n padding: 28px;\n grid-gap: 28px;\n gap: 28px;\n position: relative;\n height: -webkit-fit-content;\n height: -moz-fit-content;\n height: fit-content;\n transition: opacity 50ms ease-out;\n overflow: auto;\n}\n.freemium-survey-components .hide-question-container {\n opacity: 0;\n}\n.freemium-survey-components .question-text {\n font-size: 1rem;\n font-weight: 600;\n line-height: 1.8;\n width: 100%;\n text-align: left;\n color: var(--default-question-text-color);\n color: var(--question-text-color, var(--default-question-text-color));\n}\n.freemium-survey-components .autofocus-button {\n border: none;\n width: 0;\n height: 0;\n opacity: 0;\n margin-top: -12px;\n margin-left: -12px;\n position: absolute;\n}\n@-webkit-keyframes opac {\n 0%, 50% {\n opacity: 0;\n }\n 100% {\n opacity: 1;\n }\n}\n@keyframes opac {\n 0%, 50% {\n opacity: 0;\n }\n 100% {\n opacity: 1;\n }\n}\n.freemium-survey-components .question-footer {\n display: flex;\n justify-content: flex-end;\n grid-gap: 40px;\n gap: 40px;\n width: 100%;\n align-items: center;\n}\n.freemium-survey-components .question-footer:empty {\n display: none;\n}\n.freemium-survey-components .action-buttons {\n display: flex;\n grid-gap: 20px;\n gap: 20px;\n flex-direction: row-reverse;\n}\n.freemium-survey-components .action-buttons:empty {\n display: none;\n}\n.freemium-survey-components .skip-button {\n font-weight: 400;\n cursor: pointer;\n background: transparent;\n border: none;\n min-width: 40px;\n padding: 8px 16px;\n border-radius: 4px;\n color: var(--default-secondary-button-text-color);\n color: var(--secondary-button-text-color, var(--default-secondary-button-text-color));\n letter-spacing: 0.05rem;\n line-height: 1.5;\n border: 1px solid transparent;\n}\n.freemium-survey-components .skip-button:hover {\n background-color: #f3f3f3;\n}\n.freemium-survey-components .next-button {\n color: var(--default-button-text-color);\n color: var(--button-text-color, var(--default-button-text-color));\n}\n.freemium-survey-components .submit {\n max-width: 700px;\n margin: 0 auto;\n text-align: left;\n background: transparent;\n box-shadow: none;\n color: var(--default-button-text-color);\n color: var(--button-text-color, var(--default-button-text-color));\n}\n.freemium-survey-components .thankyou {\n display: flex;\n align-items: center;\n justify-content: center;\n grid-gap: 20px;\n gap: 20px;\n min-height: 180px;\n}\n.freemium-survey-components .thankyou .heading {\n font-weight: 600;\n font-size: 28px;\n}\n.freemium-survey-components .thankyou .text {\n white-space: pre-wrap;\n font-weight: 500;\n font-size: 0.875rem;\n line-height: 1.6;\n color: #12344d;\n width: 75%;\n}\n.freemium-survey-components .thankyou .redirection-text {\n color: #929292;\n margin-bottom: 12px;\n font-weight: 300;\n}\n.freemium-survey-components .thankyou .link {\n width: 100%;\n display: inline-block;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n color: #666;\n font-weight: 500;\n text-decoration: underline;\n}\n.freemium-survey-components .responsive-text-field {\n width: 100%;\n}\n.freemium-survey-components .responsive-text-field .textarea-container {\n display: none;\n}\n.freemium-survey-components .message-container:empty {\n display: none;\n}\n\n@media (max-width: 550px) {\n .freemium-survey-component .responsive-text-field .input-container,\n.card-survey-style .responsive-text-field .input-container {\n display: none;\n }\n .freemium-survey-component .responsive-text-field .textarea-container,\n.card-survey-style .responsive-text-field .textarea-container {\n display: flex;\n }\n}\ndiv.widget-survey-components.compact-style .freemium-survey-step-navigation {\n padding: 0 2px;\n margin-left: 4px;\n box-shadow: 0px 0px 6px #eee;\n margin-top: 4px;\n}\ndiv.widget-survey-components.compact-style .nps-container .footer {\n padding-top: 12px;\n}\ndiv.widget-survey-components.compact-style .nps-container .choices {\n grid-gap: 12px;\n gap: 12px;\n}\n\ndiv.widget-survey-components,\ndiv.card-survey-style {\n display: flex;\n flex-direction: column;\n grid-gap: 28px;\n gap: 28px;\n flex-grow: 1;\n font-size: 0.875rem;\n overflow: hidden;\n}\ndiv.widget-survey-components .questions,\ndiv.card-survey-style .questions {\n min-width: 100%;\n max-width: 100%;\n display: flex;\n height: 100%;\n position: relative;\n max-height: 560px;\n max-height: var(--compact-widget-max-height);\n}\ndiv.widget-survey-components .question-text,\ndiv.card-survey-style .question-text {\n width: 100%;\n text-align: left;\n}\ndiv.widget-survey-components .focus-lock,\ndiv.card-survey-style .focus-lock {\n width: 100%;\n}\ndiv.widget-survey-components .question-container,\ndiv.card-survey-style .question-container {\n height: -webkit-fit-content;\n height: -moz-fit-content;\n height: fit-content;\n min-width: 100%;\n max-width: 100%;\n margin-bottom: 0;\n padding: 16px 28px;\n grid-gap: 16px;\n gap: 16px;\n flex-grow: 1;\n}\ndiv.widget-survey-components .question-footer,\ndiv.card-survey-style .question-footer {\n margin: 0px auto;\n justify-content: space-between;\n bottom: 0;\n padding-bottom: 20px;\n}\ndiv.widget-survey-components .submit,\ndiv.card-survey-style .submit {\n padding-bottom: 0;\n margin: unset;\n}\ndiv.widget-survey-components .nps-container .footer,\ndiv.card-survey-style .nps-container .footer {\n padding-top: 12px;\n}\ndiv.widget-survey-components .nps-container .widget .choices,\ndiv.card-survey-style .nps-container .widget .choices {\n grid-gap: 8px;\n gap: 8px;\n}\ndiv.widget-survey-components .radio-group,\ndiv.card-survey-style .radio-group {\n width: 100%;\n}\ndiv.widget-survey-components .checkbox-group,\ndiv.card-survey-style .checkbox-group {\n width: 100%;\n flex-wrap: nowrap;\n}\n\ndiv.widget-survey-components .question-container {\n box-shadow: none;\n border-radius: 0;\n}\ndiv.widget-survey-components .question-text {\n font-size: 0.875rem;\n}\ndiv.widget-survey-components .progressbar-container {\n position: absolute;\n}\ndiv.widget-survey-components .progressbar-container .progressbar {\n border-radius: 3px 0 0 0;\n}\ndiv.widget-survey-components .textarea-container .end-max-length {\n padding: 4px;\n}\ndiv.widget-survey-components .responsive-text-field .input-container {\n display: none;\n}\ndiv.widget-survey-components .responsive-text-field .textarea-container {\n display: flex;\n}\ndiv.widget-survey-components div.thankyou {\n min-height: unset;\n}\ndiv.widget-survey-components div.thankyou .text {\n width: 85%;\n}\ndiv.widget-survey-components div.thankyou svg {\n width: 140px;\n height: 120px;\n}\n\ndiv.widget-survey-components.default-style .freemium-survey-step-navigation {\n margin: 0;\n}\ndiv.widget-survey-components.default-style .questions {\n max-height: 400px;\n max-height: var(--default-widget-max-height);\n}\ndiv.widget-survey-components.default-style .question-container {\n padding: 12px 28px;\n}\ndiv.widget-survey-components.default-style .question-footer {\n justify-content: space-between;\n}\ndiv.widget-survey-components.default-style .nps-container .footer {\n padding-top: 12px;\n}\ndiv.widget-survey-components.default-style .nps-container .choices {\n flex-wrap: unset;\n grid-gap: 12px;\n gap: 12px;\n}\ndiv.widget-survey-components.default-style .action-button {\n line-height: 1.2;\n}\ndiv.widget-survey-components.default-style .radio-group {\n flex-direction: row;\n flex-wrap: wrap;\n}\ndiv.widget-survey-components.default-style .radio-group .radio-label {\n padding: 12px 16px;\n min-width: 160px;\n font-size: 0.9rem;\n}\ndiv.widget-survey-components.default-style .checkbox-group {\n flex-direction: row;\n flex-wrap: wrap;\n}\ndiv.widget-survey-components.default-style .checkbox-group .checkbox-label {\n padding: 12px 16px;\n min-width: 160px;\n font-size: 0.9rem;\n}\ndiv.widget-survey-components.default-style textarea {\n min-height: 84px;\n}\ndiv.widget-survey-components.default-style .end-max-length {\n font-size: 0.8rem;\n font-weight: 300;\n padding: 4px;\n}\n\n.widget-survey-components.cozy-style .freemium-survey-step-navigation {\n margin: 0;\n}\n.widget-survey-components.cozy-style .questions {\n max-height: 380px;\n max-height: var(--cozy-widget-max-height);\n}\n.widget-survey-components.cozy-style .question-text {\n font-size: 1rem;\n}\n.widget-survey-components.cozy-style .question-text.nps {\n text-align: center;\n width: 60%;\n min-width: 600px;\n margin: auto;\n}\n.widget-survey-components.cozy-style .question-container {\n padding: 12px 28px;\n}\n.widget-survey-components.cozy-style .question-footer {\n justify-content: space-between;\n}\n.widget-survey-components.cozy-style .nps-container {\n grid-gap: 44px;\n gap: 44px;\n}\n.widget-survey-components.cozy-style .nps-container .widget {\n display: flex;\n justify-content: center;\n}\n.widget-survey-components.cozy-style .nps-container .button-container {\n width: 60%;\n min-width: 600px;\n margin: 0 auto;\n}\n.widget-survey-components.cozy-style .nps-container .button-container .choices {\n justify-content: space-around;\n}\n.widget-survey-components.cozy-style .nps-container .footer {\n padding-top: 8px;\n}\n.widget-survey-components.cozy-style .action-button {\n line-height: 1.2;\n}\n.widget-survey-components.cozy-style .radio-group {\n flex-direction: row;\n flex-wrap: wrap;\n}\n.widget-survey-components.cozy-style .radio-group .radio-label {\n padding: 12px 16px;\n min-width: 160px;\n font-size: 0.9rem;\n}\n.widget-survey-components.cozy-style .checkbox-group {\n flex-direction: row;\n flex-wrap: wrap;\n}\n.widget-survey-components.cozy-style .checkbox-group .checkbox-label {\n padding: 12px 16px;\n min-width: 160px;\n font-size: 0.9rem;\n}\n.widget-survey-components.cozy-style textarea {\n min-height: 60px;\n}\n.widget-survey-components.cozy-style .end-max-length {\n font-size: 0.8rem;\n font-weight: 300;\n padding: 4px;\n}\n\n.freemium-survey-components.mobile-preview .thankyou .text {\n width: unset;\n}");const E=["RANGE","NPS","RADIO","DROPDOWN"],_=200,C=({thankYouQuestion:e,preview:o,placeholders:r,npsValue:a})=>(n.useEffect((()=>{o||e.type_info.meta?.redirectUrl&&setTimeout((()=>{window.location.href=e.type_info.meta?.redirectUrl}),1e3*(e.type_info.meta?.redirectDelay??10))}),[]),t.createElement("div",{className:"question-container thankyou"},t.createElement("div",{className:"heading"},"Thank you!"),t.createElement("div",{className:"text",dangerouslySetInnerHTML:{__html:q(e.text,r,a)}}),e.type_info.meta?.redirectUrl&&t.createElement("div",{style:{width:"100%"}},t.createElement("div",{className:"redirection-text"},"You will be redirected to the below URL automatically in"," ",e.type_info.meta?.redirectDelay," seconds.",t.createElement("br",null)),t.createElement("a",{className:"link",href:e.type_info.meta?.redirectUrl},e?.type_info.meta?.redirectUrl)))),N=({currentBlockIndex:e,currentBlockIndexOfBlocksWithQns:n,blocksWithQns:o,blocks:r,setHorizontalScrollUnits:a,preventQuestionAnimation:i})=>t.createElement("div",{className:"freemium-survey-step-navigation","data-navigation-element":"1"},t.createElement("button",{disabled:0==n.current,className:"navigation-button",onClick:()=>{n.current=Math.max(n.current-1,0),e.current=r.findIndex((e=>e.name===o[n.current].name)),i.current=!1,a(n.current)}},t.createElement(w,null)),t.createElement("button",{className:"navigation-button",disabled:n.current>=o.length-1,onClick:()=>{i.current=!1,n.current=Math.min(n.current+1,o.length-1),e.current=r.findIndex((e=>e.name===o[n.current].name)),a(n.current)}},t.createElement(g,null))),z=({widget:e,widgetStyle:n,surveyStyle:o,formValues:r,othersMeta:a,blocksWithQns:i,blocks:s,thankYouQuestion:c,currentBlockIndexOfBlocksWithQns:u,currentBlockIndexOfBlocks:l,currentEditingBlock:d,isSubmitting:p,isValuesCommitted:m,isCurrentBlockFinal:f,setHorizontalScrollUnits:x,handleFormValues:v,skipBlock:h,setIsSubmitting:y,onSubmit:g,setIsSurveyCompleted:w,preventQuestionAnimation:k,preview:q,closePreview:_,...C})=>{const z=C.blockIndex??u.current,S=C.question??i[z].question,R=()=>S.name===d.current.question.name&&!E.includes(S.type_info.question_type)&&!f(),I=()=>"RANGE"!==S.type_info.question_type&&!S.required&&S.name===d.current.question.name&&!f(),O=()=>"DROPDOWN"===S.type_info.question_type&&S.name!==d.current.question.name&&!S.required&&null!=r[S.name],T=()=>f()&&(e||"standard"!==o)&&S.name===d.current.question.name,F="MULTI_SELECT"===d.current.question.type_info.question_type&&r[d.current.question.name]?.includes("others")&&(!a[d.current.question.name]||""===a[d.current.question.name]);return t.createElement("div",{className:"question-footer"},!(!e&&"standard"===o||0===z&&!r[S.name]||"compact"===n)&&t.createElement(N,{currentBlockIndex:l,currentBlockIndexOfBlocksWithQns:u,blocksWithQns:i,blocks:s,setHorizontalScrollUnits:x,preventQuestionAnimation:k}),(R()||O()||I()||T())&&t.createElement("div",{className:"action-buttons"},R()&&t.createElement(b,{onClick:()=>{v(i[z],null,!0)},disabled:d.current.question.required&&(!r[d.current.question.name]||Array.isArray(r[d.current.question.name])&&0===r[d.current.question.name].length)||d.current.question.type_info.meta?.othersRequired&&F,className:"next-button"},"Next"),I()&&t.createElement("button",{className:"skip-button",onClick:()=>h(S)},"Skip"),O()&&t.createElement("button",{className:"skip-button",onClick:()=>{d.current=i[z],l.current=s.findIndex((e=>e.name===i[z].name)),h(S)}},"Clear selection"),T()&&t.createElement("div",{className:"submit"},t.createElement(b,{disabled:(d.current.question.required||d.current.question.type_info.pivot_question)&&(null==r[d.current.question.name]||0===r[d.current.question.name]?.length)||d.current.question.type_info.meta?.othersRequired&&F||p,onClick:()=>{y(!0),g({...r,others_meta:a},(()=>{c?.type_info.meta?.skipThankYouPage?q?setTimeout((()=>{_?.()}),300):window.location.href=c?.type_info.meta?.redirectUrl:w(!0)}))}},p?"Submitting":"Submit Survey"))))},S=({survey:e,surveyStyle:r="standard",placeholders:a,onSubmit:i,widget:s,npsValue:c,widgetStyle:u,widgetNavigatorQuerySelector:l,preview:d,mobilePreview:p,closePreview:m})=>{const f=e.question_details?.questions||[],x=e.meta?.blocks||[],[v,y]=n.useState(null),[g,w]=n.useState({}),[S,R]=n.useState(!1),[I,O]=n.useState([]),[T,F]=n.useState(0),[B,L]=n.useState(!1),[$,D]=n.useState(null),[A,V]=n.useState({}),j=n.useRef(null),H=n.useRef(null),Q=n.useRef(-1),U=n.useRef(null),P=n.useRef(0),M=n.useRef(0),G=n.useRef(!1),W=n.useRef([]),Y=t.useRef(!!c&&"card"===r),K=n.useRef(null),X=n.useRef([]);n.useEffect((()=>{x&&(K.current=x.find((e=>"TY"===e.name)),y(x.filter((e=>"TY"!==e.name))))}),[x]),n.useEffect((()=>{if(v)if(H.current=f.find((e=>e.type_info?.pivot_question))??f.find((e=>"RANGE"===e.type_info?.question_type))??f[0],null!=c){Q.current=c;const e=f.find((e=>e.name===v[0].question_names[0]));j.current={...v[0],question:e},W.current=[...W.current,{...v[0],question:e}],O(W.current),w({Q_1:c})}else if(!j.current&&v.length>0)return j.current=v[0],void J(v[0])}),[v,c]),t.useEffect((()=>{I.length&&(W.current=I,M.current=I.length-1),s||"standard"!==r?(U.current&&(U.current.style.maxHeight="unset"),X.current[P.current]=U.current?.scrollHeight||X.current[P.current]||0,U.current&&(U.current.style.maxHeight="100%")):U.current?.scrollIntoView({block:"center",behavior:"smooth"}),F(I.length-1)}),[I]),n.useEffect((()=>{Object.keys(g).length>0&&j.current.question&&(E.includes(j.current.question.type_info.question_type)||G.current)&&!Z()&&ee()}),[g]),n.useEffect((()=>{if(null!=g?.[H.current?.name])if(K.current?.is_based_on_score){const e=H.current?.type_info?.choices[g?.[H.current?.name]]?.dependent_question_names,n=K.current?.question_names.find((n=>e?.includes(n))),t=f.find((e=>e.name===n));D(t)}else{const e=f.find((e=>e.name==K.current?.question_names[0]));D(e)}}),[g?.[H.current?.name]]);const Z=()=>P.current===v.length-1||"end"===j.current.branchOption,J=e=>{let n={};if(e.is_based_on_score){const t=H.current?.type_info?.choices[g?.[H.current?.name]]?.dependent_question_names,o=e.question_names.find((e=>t?.includes(e)));n=f.find((e=>e.name===o))}else n=f.find((n=>n.name===e.question_names[0]));j.current.question=n;W.current.find((e=>e.question.name===n.name))?(F(T+1),M.current+=1):O([...W.current,{...e,question:n}])},ee=()=>{if(Z())R(!0);else{if(j.current.nextBlock)P.current=v.findIndex((e=>e.name===j.current.nextBlock));else if(j.current.question.type_info?.meta?.branches){const e=j.current.question.type_info?.meta?.branches,n=g[j.current.question.name];let t;if(t="RANGE"===j.current.question.type_info.question_type?e.find((e=>n>=e.min&&n<=e.max)):e.find((e=>n===e.value)),t?.nextBlock){if("TY"===t.nextBlock)return void R(!0);P.current=v.findIndex((e=>e.name===t.nextBlock))}else P.current+=1}else P.current+=1;j.current=v[P.current],J(v[P.current])}},ne=e=>{G.current=!0,delete g[e.name],w({...g})},te=(e,n,t)=>{if(Y.current=!1,t){if(G.current=!0,null!=g[e.question.name]&&e.name!==I[I.length-1].name){const[t,o]=(e=>{const n=I.findIndex((n=>n.name===e.name)),t=I.slice(0,n+1),o=t.reduce(((e,n)=>(e[n.question.name]=g[n.question.name],e)),{});return P.current=v.findIndex((n=>n.name===e.name)),[t,o]})(e);w({...o,...null!=n&&{[e.question.name]:n}}),W.current=t}else w({...g,...null!=n&&{[e.question.name]:n}});H?.current?.name==e?.question?.name&&(Q.current=n)}else w({...g,...null!=n&&{[e.question.name]:n}})},oe=(e,n)=>{V({...A,[e]:n})};return j.current&&j.current.question?S?t.createElement("div",{className:`freemium-survey-components ${s?"widget-survey-components":""} ${u}-style ${p?"mobile-preview":""} ${r}-survey-style`,id:"freemium-survey"},t.createElement(C,{thankYouQuestion:$,preview:d,placeholders:a,npsValue:Q.current})):t.createElement("div",{className:`freemium-survey-components ${s?"widget-survey-components":""} ${u}-style ${p?"mobile-preview":""} ${r}-survey-style`,id:"freemium-survey"},t.createElement(h,{totalSteps:v.length,completedSteps:P.current}),s&&"compact"===u&&document.querySelector(l)&&t.createElement(t.Fragment,null,o.createPortal(t.createElement("div",null,t.createElement(N,{currentBlockIndex:P,currentBlockIndexOfBlocksWithQns:M,blocksWithQns:I,blocks:v,setHorizontalScrollUnits:F,preventQuestionAnimation:Y})),document.querySelector(l))),t.createElement("div",{style:s||"card"===r?{transform:`translateX(calc(-${T} * 100%))`,height:`${X.current[P.current]}px`,transition:Y.current||I?.length<=1?"none":`all ${_}ms ease-out 0ms`}:{},className:"questions"},I.map(((e,n)=>t.createElement("div",{key:e.question.name,ref:U,className:"question-container "+(!s&&"card"!==r||M.current===n?"":"hide-question-container")},t.createElement("div",{className:"question-text "+(0===n?"nps":""),dangerouslySetInnerHTML:{__html:q(e.question.text,a,Q.current)},title:`question-${n}`,role:"heading","aria-level":1}),t.createElement("button",{disabled:!s&&"standard"===r,className:"autofocus-button",onKeyDown:e=>{"Tab"===e.key&&(e.stopPropagation(),e.preventDefault())}}),t.createElement(k,{question:e.question,formValues:g,othersMeta:A,autoFocus:M.current===n,autoFocusDelay:"standard"===r?350:20,saveOthersValue:oe,onChangeHandler:n=>{G.current=!1,P.current=v.findIndex((n=>n.name===e.name)),j.current=e,te(e,n,E.includes(e.question.type_info.question_type)&&!Z())}}),t.createElement("button",{disabled:!s&&"standard"===r,className:"autofocus-button",onKeyDown:e=>{"Tab"===e.key&&(e.stopPropagation(),e.preventDefault())}}),t.createElement(z,{question:e.question,blockIndex:n,widget:s,widgetStyle:u,surveyStyle:r,formValues:g,othersMeta:A,blocksWithQns:I,blocks:v,thankYouQuestion:$,currentBlockIndexOfBlocksWithQns:M,currentBlockIndexOfBlocks:P,currentEditingBlock:j,isSubmitting:B,isValuesCommitted:G,isCurrentBlockFinal:Z,setHorizontalScrollUnits:F,handleFormValues:te,skipBlock:ne,setIsSubmitting:L,onSubmit:i,setIsSurveyCompleted:R,preventQuestionAnimation:Y,preview:d,closePreview:m})))),!s&&"card"!==r&&Z()&&t.createElement("div",{className:"submit"},t.createElement(b,{disabled:(j.current.question.required||j.current.question.type_info.pivot_question)&&(null==g[j.current.question.name]||0===g[j.current.question.name]?.length)||j.current.question.type_info.meta?.othersRequired&&"MULTI_SELECT"===j.current.question.type_info.question_type&&g[j.current.question.name]?.includes("")||B,onClick:()=>{L(!0),i({...g,others_meta:A},(()=>{$?.type_info.meta?.skipThankYouPage?d?setTimeout((()=>{m?.()}),300):window.location.href=$?.type_info.meta?.redirectUrl:R(!0)}))}},B?"Submitting":"Submit Survey")))):null};exports.ACTIVE_FOCUS_LOCK_GROUP="active-focus-lock-1",exports.AUTO_REDIRECT_DELAY=10,exports.BUTTON_SIZE_VARIANTS={LARGE:"large",MINI:"mini",NORMAL:"normal"},exports.Button=b,exports.CheckboxGroup=m,exports.Input=l,exports.NPS=a,exports.ProgressBar=h,exports.Radio=v,exports.RadioGroup=x,exports.Survey=e=>{const{survey:o}=e,r=n.useMemo((()=>{const e=JSON.parse(JSON.stringify(o)),n=[];return(e.question_details?.questions||[]).forEach((e=>{const t=e.type_info?.meta?.block;t&&(t.question_names||(t.question_names=[e.name]),n.push(t))})),{...e,meta:{...e.meta,blocks:n}}}),[o]);return t.createElement(S,Object.assign({},e,{survey:r}))},exports.TRANSITION_DURATION=_,exports.TextArea=d;
|
|
1
|
+
"use strict";function e(e){return e&&"object"==typeof e&&"default"in e?e.default:e}Object.defineProperty(exports,"__esModule",{value:!0});var n=require("react"),t=e(n),o=e(require("react-dom"));function r(e,n){void 0===n&&(n={});var t=n.insertAt;if(e&&"undefined"!=typeof document){var o=document.head||document.getElementsByTagName("head")[0],r=document.createElement("style");r.type="text/css","top"===t&&o.firstChild?o.insertBefore(r,o.firstChild):o.appendChild(r),r.styleSheet?r.styleSheet.cssText=e:r.appendChild(document.createTextNode(e))}}r(".freemium-survey-components .nps-container {\n margin: 0 auto;\n width: 100%;\n display: flex;\n flex-direction: column;\n grid-gap: 28px;\n gap: 28px;\n}\n.freemium-survey-components .nps-container .footer {\n border-top: 1px solid var(--default-background-color);\n border-top: 1px solid var(--background-color, var(--default-background-color));\n padding-top: 20px;\n display: flex;\n justify-content: center;\n font-size: 0.875rem;\n line-height: 1.5;\n color: #666;\n}\n.freemium-survey-components .nps-container .footer:empty {\n display: none;\n}\n.freemium-survey-components .nps-container .nps-scale {\n position: relative;\n}\n.freemium-survey-components .nps-container .nps-scale .button-container {\n display: flex;\n border-radius: 4px;\n justify-content: space-between;\n background: var(--default-background-color);\n background: var(--background-color, var(--default-background-color));\n position: relative;\n margin-bottom: 40px;\n}\n.freemium-survey-components .nps-container .nps-scale .positive-text {\n position: absolute;\n color: #475867;\n bottom: -40px;\n font-size: 12px;\n right: 0px;\n text-align: right;\n}\n.freemium-survey-components .nps-container .nps-scale .negative-text {\n position: absolute;\n color: #475867;\n bottom: -40px;\n font-size: 12px;\n left: 0;\n text-align: left;\n}\n.freemium-survey-components .nps-container .nps-scale span {\n color: #aaa;\n font-size: 0.75rem;\n}\n.freemium-survey-components .nps-container .nps-scale button {\n display: inline-block;\n font-size: 1rem;\n white-space: nowrap;\n vertical-align: middle;\n background: none;\n border: none;\n box-shadow: none;\n cursor: pointer;\n text-align: center;\n font-weight: 400;\n border-radius: 4px;\n margin: 0;\n outline: none;\n margin-left: -1px;\n width: 40px;\n height: 40px;\n transform: scale(1);\n}\n.freemium-survey-components .nps-container .nps-scale button:hover {\n transition: background 0.2s ease-in, color 0.2s ease-in, border-color 0.2s ease-in, transform 0.2s cubic-bezier(0.5, 2, 0.5, 0.75);\n}\n.freemium-survey-components .nps-container .nps-scale button:hover, .freemium-survey-components .nps-container .nps-scale button:focus {\n color: white;\n transform: scale(1.2);\n z-index: 2;\n position: relative;\n}\n.freemium-survey-components .nps-container .nps-scale button.active {\n color: white;\n transform: scale(1.2);\n z-index: 2;\n position: relative;\n}\n.freemium-survey-components .nps-container .nps-scale.rounded button {\n border-radius: 50%;\n}\n.freemium-survey-components .nps-container .nps-scale.square button {\n border-radius: 0;\n}\n.freemium-survey-components .nps-container .nps-scale.curved button {\n border-radius: 3px;\n}\n.freemium-survey-components .nps-container .nps-scale.highlighted button:hover, .freemium-survey-components .nps-container .nps-scale.highlighted button:focus, .freemium-survey-components .nps-container .nps-scale.highlighted button.active {\n background: var(--default-brand-color) !important;\n background: var(--brand-color, var(--default-brand-color)) !important;\n}\n.freemium-survey-components .nps-container .nps-scale .choices {\n width: 100%;\n display: flex;\n justify-content: space-between;\n font-weight: 500;\n}\n.freemium-survey-components .nps-container .nps-scale.standard .button-container {\n background-color: transparent;\n}\n.freemium-survey-components .nps-container .nps-scale.standard .choice {\n background: #E43E3D;\n color: #fff;\n}\n.freemium-survey-components .nps-container .nps-scale.standard .choice:nth-last-child(1), .freemium-survey-components .nps-container .nps-scale.standard .choice:nth-last-child(2) {\n background: #00AF50;\n}\n.freemium-survey-components .nps-container .nps-scale.standard .choice:nth-last-child(3), .freemium-survey-components .nps-container .nps-scale.standard .choice:nth-last-child(4) {\n background: #F8C43E;\n}\n.freemium-survey-components .nps-container .nps-scale.standard .choice:hover, .freemium-survey-components .nps-container .nps-scale.standard .choice:focus, .freemium-survey-components .nps-container .nps-scale.standard .choice.active {\n transform: scale(1.2);\n}\n\n.freemium-survey-components.mobile-preview .nps-container .nps-scale .button-container {\n background: transparent;\n}\n.freemium-survey-components.mobile-preview .nps-container .nps-scale .choices {\n flex-wrap: wrap;\n justify-content: center;\n grid-gap: 16px;\n gap: 16px;\n background: transparent;\n}\n.freemium-survey-components.mobile-preview .nps-container .nps-scale button {\n border-radius: 50%;\n background: #ebeff3;\n}\n\n@media (max-width: 550px) {\n .freemium-survey-components .nps-container .nps-scale .button-container,\n.card-survey-style .nps-container .nps-scale .button-container {\n background: transparent;\n }\n .freemium-survey-components .nps-container .nps-scale .choices,\n.card-survey-style .nps-container .nps-scale .choices {\n flex-wrap: wrap;\n justify-content: center;\n grid-gap: 16px;\n gap: 16px;\n background: transparent;\n }\n .freemium-survey-components .nps-container .nps-scale button,\n.card-survey-style .nps-container .nps-scale button {\n border-radius: 50%;\n background: #ebeff3;\n }\n}\n.widget-survey-components .nps-container .nps-scale .button-container {\n background: transparent;\n}\n.widget-survey-components .nps-container .nps-scale .choices {\n flex-wrap: wrap;\n justify-content: center;\n grid-gap: 16px;\n gap: 16px;\n background: transparent;\n}\n.widget-survey-components .nps-container .nps-scale button {\n border-radius: 50%;\n background: #ebeff3;\n}");const a=e=>{const{type_info:{linear_scale:{button_style:o="highlighted",button_shape:r="rounded"}={},score_presets:{start:a="Very unlikely",end:i="Very likely"}={},validation:{min:s},footer_text:c}}=e,u=e=>{switch(e){case e<=6:return"detractor";case e<=8:return"passive";default:return"promoter"}},l=n.useRef(Array.from({length:10+(0===s?1:0)},((e,n)=>n+s)));return t.createElement("div",{className:"nps-container","data-test-input":"nps"},t.createElement("div",{className:`nps-scale ${r} ${o}`},t.createElement("div",{className:"button-container"},t.createElement("span",{className:"negative-text",role:"note"},`${s} - ${a}`),t.createElement("span",{className:"positive-text",role:"note"},`${l.current[l.current.length-1]} - ${i}`),t.createElement("div",{className:"choices",role:"radiogroup","aria-required":!0},l.current.map((n=>t.createElement("button",{role:"radio","aria-checked":e.npsValue===n,key:n,"data-test-nps-choice":n,onClick:t=>{e.onChangeHandler(n)},className:`choice ${u(n)} ${e.npsValue===n&&"active"}`},n)))))),t.createElement("div",{className:"footer",role:"note"},c))},i=(e,n)=>(e.defaultProps=n,e);r('.freemium-survey-components .input-container,\n.freemium-survey-components .textarea-container {\n display: flex;\n flex-direction: column;\n width: 100%;\n border-radius: 4px;\n position: relative;\n}\n.freemium-survey-components label.input-label {\n display: inline-block;\n padding-bottom: 8px;\n padding-left: 2px;\n font-size: 0.75rem;\n font-weight: 400;\n}\n.freemium-survey-components label.required::after {\n content: "*";\n position: relative;\n top: 2px;\n font-weight: 500;\n font-size: 0.85rem;\n padding-left: 3px;\n color: #d72d30;\n}\n.freemium-survey-components .input-basic {\n width: 100%;\n display: flex;\n align-items: center;\n border-radius: 4px;\n border: 1px solid var(--default-brand-color);\n border: 1px solid var(--brand-color, var(--default-brand-color));\n transition: border-color 0.2s linear;\n background: #fff;\n}\n.freemium-survey-components .textarea-container .input-basic {\n flex-direction: column;\n align-items: unset;\n}\n.freemium-survey-components .input-basic.error {\n border: 1px solid #d72d30;\n}\n.freemium-survey-components .input-basic.error:hover {\n border: 1px solid #d72d30;\n}\n.freemium-survey-components .input-basic.error[focus-within] {\n box-shadow: none;\n}\n.freemium-survey-components .input-basic.error:focus-within {\n box-shadow: none;\n}\n.freemium-survey-components .input-basic:hover {\n border-color: var(--default-brand-color);\n border-color: var(--brand-color, var(--default-brand-color));\n transition: 0.2s linear;\n}\n.freemium-survey-components .input-basic[focus-within] {\n border: 1px solid transparent;\n box-shadow: 0 0 0 2px var(--default-brand-color);\n box-shadow: 0 0 0 2px var(--brand-color, var(--default-brand-color));\n}\n.freemium-survey-components .input-basic:focus-within {\n border: 1px solid transparent;\n box-shadow: 0 0 0 2px var(--default-brand-color);\n box-shadow: 0 0 0 2px var(--brand-color, var(--default-brand-color));\n}\n.freemium-survey-components .end-max-length {\n padding: 0 8px;\n font-size: 0.75rem;\n color: #264966;\n}\n.freemium-survey-components .textarea-container .end-max-length {\n padding: 8px;\n align-self: flex-end;\n}\n.freemium-survey-components span.input-error {\n display: block;\n padding-left: 2px;\n padding-top: 4px;\n font-size: 0.9rem;\n color: #d72d30;\n}\n.freemium-survey-components input[type=text] {\n padding: 6px 12px;\n flex: 1;\n border: unset;\n height: 32px;\n font-size: 1rem;\n /* line-height: ${typography.input.text.lineHeight}; */\n border-radius: 4px;\n}\n.freemium-survey-components input[type=text],\n.freemium-survey-components textarea {\n outline: none;\n border: none;\n}\n.freemium-survey-components input[type=text]::-moz-placeholder {\n color: #92a2b2;\n font-weight: 400;\n font-size: 0.85rem;\n}\n.freemium-survey-components input[type=text]:-ms-input-placeholder {\n color: #92a2b2;\n font-weight: 400;\n font-size: 0.85rem;\n}\n.freemium-survey-components input[type=text]::placeholder {\n color: #92a2b2;\n font-weight: 400;\n font-size: 0.85rem;\n}\n.freemium-survey-components textarea {\n min-height: 116px;\n padding: 12px;\n flex: 1;\n border: unset;\n resize: none;\n font-size: 1rem;\n /* line-height: ${typography.input.text.lineHeight}; */\n border-radius: 4px;\n}\n.freemium-survey-components textarea::-moz-placeholder {\n color: #92a2b2;\n font-weight: 400;\n font-size: 0.85rem;\n}\n.freemium-survey-components textarea:-ms-input-placeholder {\n color: #92a2b2;\n font-weight: 400;\n font-size: 0.85rem;\n}\n.freemium-survey-components textarea::placeholder {\n color: #92a2b2;\n font-weight: 400;\n font-size: 0.85rem;\n}');const s=["RANGE","NPS","RADIO","DROPDOWN"],c={isRequired:!1,showCount:!0,isErrored:!1,inline:!1,spellCheck:!1,autoFocusInput:!0},u=n.forwardRef(((e,o)=>{const r=n.useRef(null);n.useEffect((()=>{e.autoFocusInput&&setTimeout((()=>{r.current?.focus()}),600+e.autoFocusDelay)}),[e.autoFocusInput]);const{inputStyle:a,style:i,className:s,showCount:c,isErrored:u,startLabel:l,isRequired:d,errorText:p,endLabel:m,maxLength:f=300,onChange:x,autoFocusInput:v,...h}=e;return t.createElement("div",{className:"input-container",style:i},e.label&&t.createElement("label",{className:"input-label "+(d?"required":"")},e.label),t.createElement("div",null,l&&t.createElement("div",{className:"start-label"},l),t.createElement("div",{className:`input-basic ${u?"error":""}${s||""}`},t.createElement("input",Object.assign({},h,{type:"text",autoComplete:"off",ref:r,style:a,onChange:e=>{e.target.value?.length>f||x?.(e)}})),c&&f>0&&t.createElement("div",{className:"end-max-length"},`${e.value&&e.value.length||0}/${f}`)),m&&t.createElement("div",{className:"end-label"},m)),u&&p&&t.createElement("span",{className:"input-error"},e.errorText))})),l=n.forwardRef(((e,o)=>{const r=n.useRef(null);n.useEffect((()=>{e.autoFocusInput&&setTimeout((()=>{r.current?.focus()}),600+e.autoFocusDelay)}),[e.autoFocusInput]);const{inputStyle:a,style:i,className:s,showCount:c,maxLength:u=1500,startLabel:l,isRequired:d,autoFocusInput:p,onChange:m,...f}=e;return t.createElement(t.Fragment,null,t.createElement("div",{className:"textarea-container",style:i},e.label&&t.createElement("label",{className:"input-label "+(d?"required":"")},e.label),l&&t.createElement("div",{className:"start-label"},l),t.createElement("div",{className:`input-basic ${s||""}`},t.createElement("textarea",Object.assign({},f,{autoComplete:"off",ref:r,style:a,onChange:e=>{e.target.value?.length>u||m?.(e)}})),c&&u&&u>0&&t.createElement("div",{className:"end-max-length"},`${e.value&&e.value.length||0}/${u}`)),e.endLabel&&t.createElement("div",{className:"end-label"},e.endLabel)))})),d=i(u,c),p=i(l,c);r('.freemium-survey-components .checkbox-group {\n width: 100%;\n display: flex;\n grid-gap: 12px;\n gap: 12px;\n flex-direction: column;\n white-space: nowrap;\n flex-wrap: wrap;\n}\n.freemium-survey-components .icon-container {\n display: inline-block;\n flex: 0 0 12px;\n width: 12px;\n height: 12px;\n min-width: 12px;\n min-height: 12px;\n color: inherit;\n position: absolute;\n left: 1px;\n top: 2px;\n}\n.freemium-survey-components .tick-icon {\n position: absolute;\n top: 0;\n right: 0;\n bottom: 0;\n left: 0;\n height: 100%;\n width: 100%;\n color: inherit;\n fill: currentColor;\n}\n.freemium-survey-components input[type=checkbox] {\n position: absolute;\n clip: rect(0px 0px 0px 0px);\n width: 0px;\n height: 0px;\n}\n.freemium-survey-components input[type=checkbox]:focus ~ .checkbox {\n /* box-shadow: ${pseudo.focus} 0px 0px 0px 2px; */\n box-shadow: var(--default-brand-color) 0px 0px 0px 2px;\n box-shadow: var(--brand-color, var(--default-brand-color)) 0px 0px 0px 2px;\n border-color: transparent;\n}\n.freemium-survey-components .checkbox-label {\n display: flex;\n align-items: baseline;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n text-align: left;\n opacity: 1;\n line-height: 1.2;\n cursor: pointer;\n font-size: 1rem;\n padding: 16px 24px;\n min-width: 200px;\n border: 1px solid #ebeff3;\n box-shadow: 0px 2px 5px rgba(18, 52, 77, 0.06);\n border-radius: 4px;\n white-space: pre-wrap;\n}\n.freemium-survey-components .checkbox-label:hover .checkbox {\n border-color: var(--default-brand-color);\n border-color: var(--brand-color, var(--default-brand-color));\n box-shadow: var(--default-background-color) 0px 0px 0px 5px;\n box-shadow: var(--background-color, var(--default-background-color)) 0px 0px 0px 5px;\n}\n.freemium-survey-components .checkbox-label.disabled {\n opacity: 0.5;\n cursor: "not-allowed";\n}\n.freemium-survey-components .checkbox {\n transition: background-color ease-in 0.2s;\n min-width: 14px;\n min-height: 14px;\n min-height: 14px;\n max-height: 14px;\n border-radius: 2px;\n position: relative;\n margin-right: 16px;\n background-color: #fff;\n border: 1px solid;\n text-align: left;\n border-color: var(--default-brand-color);\n border-color: var(--brand-color, var(--default-brand-color));\n}\n.freemium-survey-components .checkbox:hover {\n border-color: var(--default-brand-color);\n border-color: var(--brand-color, var(--default-brand-color));\n box-shadow: var(--default-background-color) 0px 0px 0px 5px;\n box-shadow: var(--background-color, var(--default-background-color)) 0px 0px 0px 5px;\n}\n.freemium-survey-components input[type=checkbox]:checked ~ .checkbox {\n background-color: var(--default-brand-color);\n background-color: var(--brand-color, var(--default-brand-color));\n border-color: var(--default-brand-color);\n border-color: var(--brand-color, var(--default-brand-color));\n}\n.freemium-survey-components input[type=checkbox]:checked ~ .checkbox:hover {\n border-color: var(--default-brand-color);\n border-color: var(--brand-color, var(--default-brand-color));\n}\n.freemium-survey-components input[type=checkbox]:disabled ~ .checkbox:hover {\n box-shadow: unset;\n border-color: unset;\n}');const m=()=>t.createElement("svg",{id:"tick",className:"tick-icon",xmlns:"http://www.w3.org/2000/svg","aria-labelledby":"title",viewBox:"0 0 10 10"},t.createElement("path",{d:"M3 5.87c-.18666814.00267463-.36667109-.06932655-.5-.2L.21 3.41c-.1786328-.17863279-.24839684-.43899577-.1830127-.6830127.06538414-.24401694.25598306-.43461586.5-.5C.77100423 2.16160316 1.0313672 2.23136721 1.21 2.41L3 4.18 6.8.33c.27679776-.27455556.72320224-.27455556 1 0 .13696438.13025306.21450026.31098915.21450026.5S7.93696438 1.19974694 7.8 1.33L3.45 5.67c-.12082534.11896945-.28072735.19003701-.45.2Z",fill:"#fff",fillRule:"evenodd"})),f=({values:e=[],othersValue:o="",options:r,name:a,autoFocusGroup:i,autoFocusDelay:s,onChangeHandler:c,saveOthersValue:u,othersOption:l,othersRequired:p})=>{const[m,f]=n.useState(!1),v=n.useRef(null);return n.useEffect((()=>{i&&setTimeout((()=>{v.current?.focus()}),600+s)}),[i]),t.createElement("div",{className:"checkbox-group"},t.createElement("button",{ref:v,className:"autofocus-button","aria-hidden":!0}),r?.map(((n,o)=>t.createElement(x,{key:n.id,checked:e?.includes(n.value),name:n.value,id:n.id,onChange:(t,o)=>{if(o)c([...e||[],n.value]);else{const t=e.indexOf(n.value);t>-1&&e.splice(t,1),c([...e])}}},n.value))),l&&t.createElement(x,{key:"others",checked:m,name:"others",id:"others",onChange:(n,t)=>{if(f(t),t)c([...e,"others"]);else{const n=e.findIndex((e=>"others"===e));e.splice(n,1),c(e)}}},"Others"),m&&t.createElement(t.Fragment,null,t.createElement(d,{placeholder:"Enter your comment",value:o[a],onChange:e=>{u(a,e.target.value)},autoFocusDelay:10,label:""})))},x=i((e=>{const o=n.useRef(null);return n.useEffect((()=>{e.autoFocus&&setTimeout((()=>{o.current?.focus()}),620)}),[]),t.createElement("label",{className:`checkbox-label ${e.disabled&&"disabled"}`},t.createElement("input",{ref:o,id:e.id,type:"checkbox",name:e.name,readOnly:e.readOnly,disabled:e.disabled,"aria-disabled":e.disabled,checked:e.checked,onChange:e.readOnly?()=>{}:n=>e.onChange(n,n.target.checked)}),t.createElement("div",{className:"checkbox"},e.checked&&t.createElement("div",{className:"icon-container"},t.createElement(m,null)," ")),t.createElement("div",null,e.children))}),{checked:!1});r('.freemium-survey-components .radio-group {\n display: flex;\n grid-gap: 12px;\n gap: 12px;\n white-space: nowrap;\n flex-direction: column;\n width: 100%;\n}\n.freemium-survey-components .radio {\n background-color: #fff;\n border: 1px solid;\n border-color: var(--default-brand-color);\n border-color: var(--brand-color, var(--default-brand-color));\n transition: background-color ease-in 0.2s;\n min-width: 18px;\n max-width: 18px;\n min-height: 18px;\n max-height: 18px;\n border-radius: 50%;\n position: relative;\n margin-right: 16px;\n text-align: left;\n}\n.freemium-survey-components .radio:before {\n left: 3px;\n top: 3px;\n content: "";\n position: absolute;\n width: 10px;\n height: 10px;\n border-radius: 50%;\n transition: all ease-in 0.2s;\n background-color: #fff;\n}\n.freemium-survey-components .radio-label {\n display: flex;\n align-items: baseline;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n text-align: left;\n cursor: pointer;\n line-height: 1.2;\n font-size: 1rem;\n font-weight: 400;\n padding: 16px 24px;\n min-width: 200px;\n border: 1px solid #ebeff3;\n box-shadow: 0px 2px 5px rgba(18, 52, 77, 0.06);\n border-radius: 4px;\n white-space: pre-wrap;\n}\n.freemium-survey-components input[type=radio] {\n position: absolute;\n clip: rect(0, 0, 0, 0);\n width: 0px;\n height: 0px;\n}\n.freemium-survey-components input[type=radio]:focus ~ .radio {\n /* box-shadow: ${pseudo.focus} 0px 0px 0px 3px; */\n box-shadow: var(--default-brand-color) 0px 0px 0px 3px;\n box-shadow: var(--brand-color, var(--default-brand-color)) 0px 0px 0px 3px;\n border-color: transparent;\n}\n.freemium-survey-components input[type=radio]:checked ~ .radio:before {\n background-color: var(--default-brand-color);\n background-color: var(--brand-color, var(--default-brand-color));\n}\n.freemium-survey-components .radio-label:hover .radio {\n border-color: var(--default-brand-color);\n border-color: var(--brand-color, var(--default-brand-color));\n box-shadow: var(--default-background-color) 0px 0px 0px 5px;\n box-shadow: var(--background-color, var(--default-background-color)) 0px 0px 0px 5px;\n}');const v=({name:e,options:o,value:r,autoFocusGroup:a,autoFocusDelay:i,onChangeHandler:s,saveOthersValue:c,othersOption:u,othersRequired:l,othersValue:p})=>{const[m,f]=n.useState(p??""),[x,v]=n.useState(r),y=n.useRef(null);return n.useEffect((()=>{a&&setTimeout((()=>{y.current?.focus()}),600+i)}),[a]),n.useEffect((()=>{r||f("")}),[r]),n.useEffect((()=>{x&&o.find((e=>e.value===x))&&x!==r&&s(x)}),[x]),t.createElement("div",{className:"radio-group",role:"radiogroup"},t.createElement("button",{ref:y,className:"autofocus-button","aria-hidden":!0,tabIndex:-1}),o?.map(((n,o)=>t.createElement(h,{key:n.value,value:n.value,name:e,onChange:e=>{v(e.currentTarget.value)},checked:x===n.value},n.value))),u&&t.createElement(h,{key:"others",value:"others",name:e,onChange:e=>{v("others")},checked:"others"===x},"Others"),"others"===x&&t.createElement(t.Fragment,null,t.createElement(d,{value:m,onChange:e=>f(e.target.value),placeholder:"Enter your comment",label:"",autoFocusDelay:10}),m!==r&&t.createElement(g,{inline:!0,disabled:l&&0===m.length,onClick:()=>{s("others"),c(e,m)}},"Next")))},h=i((e=>{const o=n.useRef(null);return n.useEffect((()=>{e.autoFocus&&setTimeout((()=>{o.current?.focus()}),620)}),[]),t.createElement("label",{className:"radio-label"},t.createElement("input",{ref:o,type:"radio",name:e.name,value:e.value,checked:e.checked,onChange:e.onChange}),t.createElement("div",{className:"radio"}),t.createElement("div",null,e.children))}),{checked:!1,autoFocus:!1});r(".progressbar-container {\n width: 100%;\n height: 4px;\n position: fixed;\n top: 0;\n left: 0;\n z-index: 1;\n text-align: left;\n}\n\n.progressbar {\n transition: transform 0.25s linear;\n transform-origin: left;\n height: 100%;\n background-color: var(--default-brand-color);\n background-color: var(--brand-color, var(--default-brand-color));\n}");const y=e=>{const{totalSteps:n,completedSteps:o}=e;return t.createElement("div",{className:"progressbar-container"},t.createElement("div",{className:"progressbar",style:{width:(o>0?100/n:0)+"%",transform:`scaleX(${o})`}}))};r(".freemium-survey-components .action-button {\n width: auto;\n display: block;\n padding: 8px 16px;\n cursor: pointer;\n line-height: 1.5;\n text-align: center;\n font-weight: 500;\n letter-spacing: 0.3px;\n border-radius: 4px;\n white-space: nowrap;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n color: --default-button-text-color;\n color: var(--button-text-color, --default-button-text-color);\n background: var(--default-brand-color);\n background: var(--brand-color, var(--default-brand-color));\n border: 1px solid var(--default-brand-color);\n border: 1px solid var(--brand-color, var(--default-brand-color));\n border-radius: 4px;\n min-width: 200px;\n max-width: -webkit-fit-content;\n max-width: -moz-fit-content;\n max-width: fit-content;\n transform: translateY(0px);\n transition: transform ease 0.2s;\n}\n.freemium-survey-components .action-button:not([disabled]):hover {\n transform: translateY(-4px);\n}\n.freemium-survey-components .action-button[disabled] {\n cursor: not-allowed;\n opacity: 0.6;\n}\n.freemium-survey-components button:focus:not(:active) {\n /* box-shadow: 0 0 0 2px ${pseudo.focus}; */\n}\n\n@media (max-width: 550px) {\n .freemium-survey-components .action-button {\n min-width: 120px;\n }\n}\n.widget-survey-components .action-button {\n min-width: 120px;\n}\n\n.freemium-survey-components.mobile-preview .action-button {\n min-width: 120px;\n}");const b=()=>t.createElement(t.Fragment,null,"..."),g=e=>{const{inline:n=!1,children:o,disabled:r,className:a="",htmlType:i,type:s="primary",onClick:c,size:u,overrideStyleClassName:l="",loading:d=!1,...p}=e;return t.createElement("button",Object.assign({style:n?{display:"inline-block"}:{},disabled:r,className:`action-button ${a} ${l}`,type:i,onClick:c},p),d?t.createElement(b,null):o)},w=()=>t.createElement("svg",{style:{display:"block"},width:"9",height:"14",viewBox:"0 0 10 16",fill:"none",xmlns:"http://www.w3.org/2000/svg"},t.createElement("path",{d:"M7.82585 6.15754C7.98999 6.32147 8.08232 6.54389 8.08252 6.77587L8.08252 7.2192C8.07983 7.45069 7.98788 7.6722 7.82585 7.83754L1.82919 13.8225C1.77496 13.8772 1.71044 13.9206 1.63936 13.9502C1.56827 13.9798 1.49203 13.9951 1.41502 13.9951C1.33801 13.9951 1.26177 13.9798 1.19068 13.9502C1.1196 13.9206 1.05508 13.8772 1.00085 13.8225L0.172521 12.9942C0.118197 12.941 0.0750381 12.8774 0.0455752 12.8073C0.0161124 12.7372 0.000937578 12.6619 0.000937585 12.5859C0.000937592 12.5098 0.0161125 12.4345 0.0455753 12.3644C0.0750381 12.2943 0.118197 12.2308 0.172521 12.1775L5.36419 6.99754L0.172522 1.81754C0.117847 1.76331 0.0744506 1.69879 0.0448352 1.62771C0.0152208 1.55662 -2.75162e-05 1.48038 -2.75094e-05 1.40337C-2.75027e-05 1.32636 0.0152208 1.25012 0.0448353 1.17904C0.0744507 1.10795 0.117847 1.04343 0.172522 0.989205L1.00086 0.172537C1.05508 0.117862 1.1196 0.0744661 1.19069 0.0448507C1.26177 0.0152353 1.33801 -1.20337e-05 1.41502 -1.2027e-05C1.49203 -1.20203e-05 1.56827 0.0152353 1.63936 0.0448507C1.71044 0.0744661 1.77496 0.117862 1.82919 0.172537L7.82585 6.15754Z",fill:"#6B6B6B"})),k=()=>t.createElement("svg",{style:{display:"block"},width:"9",height:"14",viewBox:"0 0 10 16",fill:"none",xmlns:"http://www.w3.org/2000/svg"},t.createElement("path",{d:"M0.256667 7.83755C0.0925257 7.67361 0.000204227 7.4512 0 7.21921V6.77588C0.00268801 6.5444 0.0946357 6.32289 0.256667 6.15755L6.25333 0.172549C6.30756 0.117874 6.37208 0.0744776 6.44316 0.0448625C6.51425 0.0152474 6.59049 0 6.6675 0C6.74451 0 6.82075 0.0152474 6.89184 0.0448625C6.96292 0.0744776 7.02744 0.117874 7.08167 0.172549L7.91 1.00088C7.96432 1.05411 8.00748 1.11764 8.03694 1.18776C8.06641 1.25787 8.08158 1.33316 8.08158 1.40922C8.08158 1.48527 8.06641 1.56056 8.03694 1.63067C8.00748 1.70079 7.96432 1.76432 7.91 1.81755L2.71833 6.99755L7.91 12.1775C7.96467 12.2318 8.00807 12.2963 8.03769 12.3674C8.0673 12.4385 8.08255 12.5147 8.08255 12.5917C8.08255 12.6687 8.0673 12.745 8.03769 12.8161C8.00807 12.8871 7.96467 12.9517 7.91 13.0059L7.08167 13.8225C7.02744 13.8772 6.96292 13.9206 6.89184 13.9502C6.82075 13.9799 6.74451 13.9951 6.6675 13.9951C6.59049 13.9951 6.51425 13.9799 6.44316 13.9502C6.37208 13.9206 6.30756 13.8772 6.25333 13.8225L0.256667 7.83755Z",fill:"#6B6B6B"})),q=({question:e,formValues:n,othersMeta:o,onChangeHandler:r,saveOthersValue:i,autoFocus:s,autoFocusDelay:c})=>{switch(e.type_info.question_type){case"RANGE":return t.createElement(a,{type_info:e.type_info,onChangeHandler:r,npsValue:n[e.name]});case"CHECKBOX":case"MULTI_SELECT":return t.createElement(f,{name:e.name,autoFocusGroup:s,values:n[e.name],othersValue:o[e.name],options:e.type_info.choices,onChangeHandler:r,saveOthersValue:i,othersOption:e.type_info.meta?.othersOption,othersRequired:e.type_info.meta?.othersRequired,autoFocusDelay:c});case"RADIO":case"DROPDOWN":return t.createElement(v,{autoFocusGroup:s,autoFocusDelay:c,name:e.name,onChangeHandler:r,saveOthersValue:i,options:e.type_info.choices,value:n[e.name],othersValue:o[e.name],othersOption:e.type_info.meta?.othersOption,othersRequired:e.type_info.meta?.othersRequired});case"INPUT":case"TEXT":return e.type_info?.meta?.readOnly?t.createElement("div",{className:"message-container"},e.type_info?.meta?.value):t.createElement("div",{className:"responsive-text-field"},t.createElement(d,{autoFocusInput:s,autoFocusDelay:c,label:"",isRequired:e.is_required,value:n[e.name]||"",placeholder:e.type_info?.meta?.placeholder??"",onChange:e=>r(e.target.value)}),t.createElement(p,{autoFocusInput:s,autoFocusDelay:c,label:"",isRequired:e.is_required,placeholder:e.type_info?.meta?.placeholder??"",value:n[e.name]||"",onChange:e=>r(e.target.value)}));case"PARAGRAPH":return t.createElement(p,{autoFocusInput:s,autoFocusDelay:c,label:"",isRequired:e.is_required,placeholder:e.type_info?.meta?.placeholder??"",value:n[e.name]||"",onChange:e=>r(e.target.value)});default:return console.error(`Question type ${e.type_info.question_type} not found`),null}},E=(e,n,t)=>{if(e){let o={"{{nps.score}}":t};n&&(o={...o,...n});const r=new RegExp(Object.keys(o).join("|"),"gi");e=e.replace(r,(function(e){return o[e.toLowerCase()]}))}return e};r(":root {\n --default-brand-color: #264966;\n --default-question-text-color: #000;\n --default-question-background-color: #fff;\n --default-background-color: #f8f8f8;\n --default-button-text-color: #fff;\n --default-secondary-button-text-color: #000;\n --default-input-placeholder-color: #92a2b1;\n --compact-widget-max-height: 560px;\n --default-widget-max-height: 400px;\n --cozy-widget-max-height: 380px;\n}\n\n.freemium-survey-step-navigation {\n padding: 0 2px;\n box-shadow: 0px 0px 6px #eee;\n white-space: nowrap;\n}\n.freemium-survey-step-navigation .navigation-button {\n width: 38px;\n text-align: -webkit-center;\n height: 38px;\n background-color: #fff;\n border: none;\n cursor: pointer;\n border-radius: 0 3px 3px 0;\n}\n.freemium-survey-step-navigation .navigation-button:first-of-type {\n border-right: 1px solid #d9d9d9;\n border-radius: 3px 0 0 3px;\n}\n.freemium-survey-step-navigation .navigation-button:disabled {\n cursor: not-allowed;\n opacity: 0.5;\n}\n.freemium-survey-step-navigation .navigation-button:focus {\n position: relative;\n z-index: 1;\n}\n\n.freemium-survey-components .question-container {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n text-align: center;\n max-width: 700px;\n margin: 0 auto;\n background: var(--default-question-background-color);\n background: var(--question-background-color, var(--default-question-background-color));\n border-radius: 4px;\n transition: transform 500ms ease 0ms, opacity 800ms ease 0ms;\n box-shadow: 0px 12px 15px rgba(18, 52, 77, 0.03);\n margin-bottom: 28px;\n padding: 28px;\n grid-gap: 28px;\n gap: 28px;\n position: relative;\n height: -webkit-fit-content;\n height: -moz-fit-content;\n height: fit-content;\n overflow: auto;\n opacity: 1;\n}\n.freemium-survey-components .hide-question-container {\n pointer-events: none;\n opacity: 0;\n}\n.freemium-survey-components .question-text {\n font-size: 1rem;\n font-weight: 600;\n line-height: 1.8;\n width: 100%;\n text-align: left;\n color: var(--default-question-text-color);\n color: var(--question-text-color, var(--default-question-text-color));\n}\n.freemium-survey-components .autofocus-button {\n border: none;\n width: 0;\n height: 0;\n opacity: 0;\n margin-top: -12px;\n margin-left: -12px;\n position: absolute;\n}\n@-webkit-keyframes opac {\n 0%, 50% {\n opacity: 0;\n }\n 100% {\n opacity: 1;\n }\n}\n@keyframes opac {\n 0%, 50% {\n opacity: 0;\n }\n 100% {\n opacity: 1;\n }\n}\n.freemium-survey-components .question-footer {\n display: flex;\n justify-content: flex-end;\n grid-gap: 40px;\n gap: 40px;\n width: 100%;\n align-items: center;\n}\n.freemium-survey-components .question-footer:empty {\n display: none;\n}\n.freemium-survey-components .action-buttons {\n display: flex;\n grid-gap: 20px;\n gap: 20px;\n flex-direction: row-reverse;\n}\n.freemium-survey-components .action-buttons:empty {\n display: none;\n}\n.freemium-survey-components .skip-button {\n font-weight: 400;\n cursor: pointer;\n background: transparent;\n border: none;\n min-width: 40px;\n padding: 8px 16px;\n border-radius: 4px;\n color: var(--default-secondary-button-text-color);\n color: var(--secondary-button-text-color, var(--default-secondary-button-text-color));\n letter-spacing: 0.05rem;\n line-height: 1.5;\n border: 1px solid transparent;\n}\n.freemium-survey-components .skip-button:hover {\n background-color: #f3f3f3;\n}\n.freemium-survey-components .next-button {\n color: var(--default-button-text-color);\n color: var(--button-text-color, var(--default-button-text-color));\n}\n.freemium-survey-components .submit {\n max-width: 700px;\n margin: 0 auto;\n text-align: left;\n background: transparent;\n box-shadow: none;\n color: var(--default-button-text-color);\n color: var(--button-text-color, var(--default-button-text-color));\n}\n.freemium-survey-components .thankyou {\n display: flex;\n align-items: center;\n justify-content: center;\n grid-gap: 20px;\n gap: 20px;\n min-height: 180px;\n}\n.freemium-survey-components .thankyou .heading {\n font-weight: 600;\n font-size: 28px;\n}\n.freemium-survey-components .thankyou .text {\n white-space: pre-wrap;\n font-weight: 500;\n font-size: 0.875rem;\n line-height: 1.6;\n color: #12344d;\n width: 75%;\n}\n.freemium-survey-components .thankyou .redirection-text {\n color: #929292;\n margin-bottom: 12px;\n font-weight: 300;\n}\n.freemium-survey-components .thankyou .link {\n width: 100%;\n display: inline-block;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n color: #666;\n font-weight: 500;\n text-decoration: underline;\n}\n.freemium-survey-components .responsive-text-field {\n width: 100%;\n}\n.freemium-survey-components .responsive-text-field .textarea-container {\n display: none;\n}\n.freemium-survey-components .message-container:empty {\n display: none;\n}\n\n@media (max-width: 550px) {\n .freemium-survey-component .responsive-text-field .input-container,\n.card-survey-style .responsive-text-field .input-container {\n display: none;\n }\n .freemium-survey-component .responsive-text-field .textarea-container,\n.card-survey-style .responsive-text-field .textarea-container {\n display: flex;\n }\n}\ndiv.widget-survey-components.compact-style .freemium-survey-step-navigation {\n padding: 0 2px;\n margin-left: 4px;\n box-shadow: 0px 0px 6px #eee;\n margin-top: 4px;\n}\ndiv.widget-survey-components.compact-style .nps-container .footer {\n padding-top: 12px;\n}\ndiv.widget-survey-components.compact-style .nps-container .choices {\n grid-gap: 12px;\n gap: 12px;\n}\n\ndiv.widget-survey-components,\ndiv.card-survey-style {\n display: flex;\n flex-direction: column;\n grid-gap: 28px;\n gap: 28px;\n flex-grow: 1;\n font-size: 0.875rem;\n overflow: hidden;\n}\ndiv.widget-survey-components .questions,\ndiv.card-survey-style .questions {\n min-width: 100%;\n max-width: 100%;\n display: flex;\n height: 100%;\n position: relative;\n max-height: 560px;\n max-height: var(--compact-widget-max-height);\n}\ndiv.widget-survey-components .question-text,\ndiv.card-survey-style .question-text {\n width: 100%;\n text-align: left;\n}\ndiv.widget-survey-components .focus-lock,\ndiv.card-survey-style .focus-lock {\n width: 100%;\n}\ndiv.widget-survey-components .question-container,\ndiv.card-survey-style .question-container {\n height: -webkit-fit-content;\n height: -moz-fit-content;\n height: fit-content;\n min-width: 100%;\n max-width: 100%;\n margin-bottom: 0;\n padding: 16px 28px;\n grid-gap: 16px;\n gap: 16px;\n flex-grow: 1;\n}\ndiv.widget-survey-components .question-footer,\ndiv.card-survey-style .question-footer {\n margin: 0px auto;\n justify-content: space-between;\n bottom: 0;\n padding-bottom: 20px;\n}\ndiv.widget-survey-components .submit,\ndiv.card-survey-style .submit {\n padding-bottom: 0;\n margin: unset;\n}\ndiv.widget-survey-components .nps-container .footer,\ndiv.card-survey-style .nps-container .footer {\n padding-top: 12px;\n}\ndiv.widget-survey-components .nps-container .widget .choices,\ndiv.card-survey-style .nps-container .widget .choices {\n grid-gap: 8px;\n gap: 8px;\n}\ndiv.widget-survey-components .radio-group,\ndiv.card-survey-style .radio-group {\n width: 100%;\n}\ndiv.widget-survey-components .checkbox-group,\ndiv.card-survey-style .checkbox-group {\n width: 100%;\n flex-wrap: nowrap;\n}\n\ndiv.widget-survey-components .question-container {\n box-shadow: none;\n border-radius: 0;\n}\ndiv.widget-survey-components .question-text {\n font-size: 0.875rem;\n}\ndiv.widget-survey-components .progressbar-container {\n position: absolute;\n}\ndiv.widget-survey-components .progressbar-container .progressbar {\n border-radius: 3px 0 0 0;\n}\ndiv.widget-survey-components .textarea-container .end-max-length {\n padding: 4px;\n}\ndiv.widget-survey-components .responsive-text-field .input-container {\n display: none;\n}\ndiv.widget-survey-components .responsive-text-field .textarea-container {\n display: flex;\n}\ndiv.widget-survey-components div.thankyou {\n min-height: unset;\n}\ndiv.widget-survey-components div.thankyou .text {\n width: 85%;\n}\ndiv.widget-survey-components div.thankyou svg {\n width: 140px;\n height: 120px;\n}\n\ndiv.widget-survey-components.default-style .freemium-survey-step-navigation {\n margin: 0;\n}\ndiv.widget-survey-components.default-style .questions {\n max-height: 400px;\n max-height: var(--default-widget-max-height);\n}\ndiv.widget-survey-components.default-style .question-container {\n padding: 12px 28px;\n}\ndiv.widget-survey-components.default-style .question-footer {\n justify-content: space-between;\n}\ndiv.widget-survey-components.default-style .nps-container .footer {\n padding-top: 12px;\n}\ndiv.widget-survey-components.default-style .nps-container .choices {\n flex-wrap: unset;\n grid-gap: 12px;\n gap: 12px;\n}\ndiv.widget-survey-components.default-style .action-button {\n line-height: 1.2;\n}\ndiv.widget-survey-components.default-style .radio-group {\n flex-direction: row;\n flex-wrap: wrap;\n}\ndiv.widget-survey-components.default-style .radio-group .radio-label {\n padding: 12px 16px;\n min-width: 160px;\n font-size: 0.9rem;\n}\ndiv.widget-survey-components.default-style .checkbox-group {\n flex-direction: row;\n flex-wrap: wrap;\n}\ndiv.widget-survey-components.default-style .checkbox-group .checkbox-label {\n padding: 12px 16px;\n min-width: 160px;\n font-size: 0.9rem;\n}\ndiv.widget-survey-components.default-style textarea {\n min-height: 84px;\n}\ndiv.widget-survey-components.default-style .end-max-length {\n font-size: 0.8rem;\n font-weight: 300;\n padding: 4px;\n}\n\n.widget-survey-components.cozy-style .freemium-survey-step-navigation {\n margin: 0;\n}\n.widget-survey-components.cozy-style .questions {\n max-height: 380px;\n max-height: var(--cozy-widget-max-height);\n}\n.widget-survey-components.cozy-style .question-text {\n font-size: 1rem;\n}\n.widget-survey-components.cozy-style .question-text.nps {\n text-align: center;\n width: 60%;\n min-width: 600px;\n margin: auto;\n}\n.widget-survey-components.cozy-style .question-container {\n padding: 12px 28px;\n}\n.widget-survey-components.cozy-style .question-footer {\n justify-content: space-between;\n}\n.widget-survey-components.cozy-style .nps-container {\n grid-gap: 44px;\n gap: 44px;\n}\n.widget-survey-components.cozy-style .nps-container .widget {\n display: flex;\n justify-content: center;\n}\n.widget-survey-components.cozy-style .nps-container .button-container {\n width: 60%;\n min-width: 600px;\n margin: 0 auto;\n}\n.widget-survey-components.cozy-style .nps-container .button-container .choices {\n justify-content: space-around;\n}\n.widget-survey-components.cozy-style .nps-container .footer {\n padding-top: 8px;\n}\n.widget-survey-components.cozy-style .action-button {\n line-height: 1.2;\n}\n.widget-survey-components.cozy-style .radio-group {\n flex-direction: row;\n flex-wrap: wrap;\n}\n.widget-survey-components.cozy-style .radio-group .radio-label {\n padding: 12px 16px;\n min-width: 160px;\n font-size: 0.9rem;\n}\n.widget-survey-components.cozy-style .checkbox-group {\n flex-direction: row;\n flex-wrap: wrap;\n}\n.widget-survey-components.cozy-style .checkbox-group .checkbox-label {\n padding: 12px 16px;\n min-width: 160px;\n font-size: 0.9rem;\n}\n.widget-survey-components.cozy-style textarea {\n min-height: 60px;\n}\n.widget-survey-components.cozy-style .end-max-length {\n font-size: 0.8rem;\n font-weight: 300;\n padding: 4px;\n}\n\n.freemium-survey-components.mobile-preview .thankyou .text {\n width: unset;\n}");const C=({thankYouQuestion:e,preview:o,placeholders:r,npsValue:a})=>(n.useEffect((()=>{o||e.type_info.meta?.redirectUrl&&setTimeout((()=>{window.location.href=e.type_info.meta?.redirectUrl}),1e3*(e.type_info.meta?.redirectDelay??1e4))}),[]),t.createElement("div",{className:"question-container thankyou"},t.createElement("div",{className:"heading"},"Thank you!"),t.createElement("div",{className:"text",dangerouslySetInnerHTML:{__html:E(e.text,r,a)}}),e.type_info.meta?.redirectUrl&&t.createElement("div",{style:{width:"100%"}},t.createElement("div",{className:"redirection-text"},"You will be redirected to the below URL automatically in"," ",e.type_info.meta?.redirectDelay," seconds.",t.createElement("br",null)),t.createElement("a",{className:"link",href:e.type_info.meta?.redirectUrl},e?.type_info.meta?.redirectUrl)))),_=({currentBlockIndex:e,currentBlockIndexOfBlocksWithQns:n,blocksWithQns:o,blocks:r,setHorizontalScrollUnits:a,preventQuestionAnimation:i})=>t.createElement("div",{className:"freemium-survey-step-navigation","data-navigation-element":"1"},t.createElement("button",{disabled:0==n.current,className:"navigation-button",onClick:()=>{n.current=Math.max(n.current-1,0),e.current=r.findIndex((e=>e.name===o[n.current].name)),i.current=!1,a(n.current)}},t.createElement(k,null)),t.createElement("button",{className:"navigation-button",disabled:n.current>=o.length-1,onClick:()=>{i.current=!1,n.current=Math.min(n.current+1,o.length-1),e.current=r.findIndex((e=>e.name===o[n.current].name)),a(n.current)}},t.createElement(w,null))),N=({widget:e,widgetStyle:n,surveyStyle:o,formValues:r,othersMeta:a,blocksWithQns:i,blocks:c,thankYouQuestion:u,currentBlockIndexOfBlocksWithQns:l,currentBlockIndexOfBlocks:d,currentEditingBlock:p,isSubmitting:m,isValuesCommitted:f,isCurrentBlockFinal:x,setHorizontalScrollUnits:v,handleFormValues:h,skipBlock:y,setIsSubmitting:b,onSubmit:w,setIsSurveyCompleted:k,preventQuestionAnimation:q,preview:E,closePreview:C,...N})=>{const z=N.blockIndex??l.current,S=N.question??i[z].question,R=()=>S.name===p.current.question.name&&!s.includes(S.type_info.question_type)&&!x(),I=()=>"RANGE"!==S.type_info.question_type&&!S.required&&S.name===p.current.question.name&&!x(),O=()=>"DROPDOWN"===S.type_info.question_type&&S.name!==p.current.question.name&&!S.required&&null!=r[S.name],B=()=>x()&&(e||"standard"!==o)&&S.name===p.current.question.name,F="MULTI_SELECT"===p.current.question.type_info.question_type&&r[p.current.question.name]?.includes("others")&&(!a[p.current.question.name]||""===a[p.current.question.name]);return t.createElement("div",{className:"question-footer"},!(!e&&"standard"===o||0===z&&!r[S.name]||"compact"===n)&&t.createElement(_,{currentBlockIndex:d,currentBlockIndexOfBlocksWithQns:l,blocksWithQns:i,blocks:c,setHorizontalScrollUnits:v,preventQuestionAnimation:q}),(R()||O()||I()||B())&&t.createElement("div",{className:"action-buttons"},R()&&t.createElement(g,{onClick:()=>{h(i[z],null,!0)},disabled:p.current.question.required&&(!r[p.current.question.name]||Array.isArray(r[p.current.question.name])&&0===r[p.current.question.name].length)||p.current.question.type_info.meta?.othersRequired&&F,className:"next-button"},"Next"),I()&&t.createElement("button",{className:"skip-button",onClick:()=>y(S)},"Skip"),O()&&t.createElement("button",{className:"skip-button",onClick:()=>{p.current=i[z],d.current=c.findIndex((e=>e.name===i[z].name)),y(S)}},"Clear selection"),B()&&t.createElement("div",{className:"submit"},t.createElement(g,{disabled:(p.current.question.required||p.current.question.type_info.pivot_question)&&(null==r[p.current.question.name]||0===r[p.current.question.name]?.length)||p.current.question.type_info.meta?.othersRequired&&F||m,onClick:()=>{b(!0),w({...r,others_meta:a},(()=>{u?.type_info.meta?.skipThankYouPage?E?setTimeout((()=>{C?.()}),300):window.location.href=u?.type_info.meta?.redirectUrl:k(!0)}))}},m?"Submitting":"Submit Survey"))))};exports.BUTTON_SIZE_VARIANTS={LARGE:"large",MINI:"mini",NORMAL:"normal"},exports.Button=g,exports.CheckboxGroup=f,exports.Input=d,exports.NPS=a,exports.ProgressBar=y,exports.Radio=h,exports.RadioGroup=v,exports.StandardSurvey=({survey:e,surveyStyle:r="standard",placeholders:a,onSubmit:i,widget:c,npsValue:u,widgetStyle:l,widgetNavigatorQuerySelector:d,preview:p,mobilePreview:m,closePreview:f})=>{const x=e.question_details?.questions||[],v=e.meta?.blocks||[],[h,b]=n.useState(null),[w,k]=n.useState({}),[z,S]=n.useState(!1),[R,I]=n.useState([]),[O,B]=n.useState(0),[F,T]=n.useState(!1),[$,L]=n.useState(null),[V,D]=n.useState({}),A=n.useRef(null),H=n.useRef(null),Q=n.useRef(-1),j=n.useRef(null),P=n.useRef(0),U=n.useRef(0),M=n.useRef(!1),G=n.useRef([]),W=n.useRef(!!u&&"card"===r),Y=n.useRef(null),X=n.useRef([]);n.useEffect((()=>{v&&(Y.current=v.find((e=>"TY"===e.name)),b(v.filter((e=>"TY"!==e.name))))}),[v]),n.useEffect((()=>{if(h)if(H.current=x.find((e=>e.type_info?.pivot_question))??x.find((e=>"RANGE"===e.type_info?.question_type))??x[0],null!=u){Q.current=u;const e=x.find((e=>e.name===h[0].question_names[0]));A.current={...h[0],question:e},G.current=[...G.current,{...h[0],question:e}],I(G.current),k({Q_1:u})}else if(!A.current&&h.length>0)return A.current=h[0],void K(h[0])}),[h,u]),n.useEffect((()=>{R.length&&(G.current=R,U.current=R.length-1),c||"standard"!==r?(j.current&&(j.current.style.maxHeight="unset"),X.current[P.current]=j.current?.scrollHeight||X.current[P.current]||0,j.current&&(j.current.style.maxHeight="100%")):j.current?.scrollIntoView({block:"center",behavior:"smooth"}),B(R.length-1)}),[R]),n.useEffect((()=>{Object.keys(w).length>0&&A.current.question&&(s.includes(A.current.question.type_info.question_type)||M.current)&&!Z()&&J()}),[w]),n.useEffect((()=>{if(null!=w?.[H.current?.name])if(Y.current?.is_based_on_score){const e=H.current?.type_info?.choices[w?.[H.current?.name]]?.dependent_question_names,n=Y.current?.question_names.find((n=>e?.includes(n))),t=x.find((e=>e.name===n));L(t)}else{const e=x.find((e=>e.name==Y.current?.question_names[0]));L(e)}}),[w?.[H.current?.name]]);const Z=()=>P.current===h.length-1||"end"===A.current.branchOption,K=e=>{let n={};if(e.is_based_on_score){const t=H.current?.type_info?.choices[w?.[H.current?.name]]?.dependent_question_names,o=e.question_names.find((e=>t?.includes(e)));n=x.find((e=>e.name===o))}else n=x.find((n=>n.name===e.question_names[0]));A.current.question=n;G.current.find((e=>e.question.name===n.name))?(B(O+1),U.current+=1):I([...G.current,{...e,question:n}])},J=()=>{if(Z())S(!0);else{if(A.current.nextBlock)P.current=h.findIndex((e=>e.name===A.current.nextBlock));else if(A.current.question.type_info?.meta?.branches){const e=A.current.question.type_info?.meta?.branches,n=w[A.current.question.name];let t;if(t="RANGE"===A.current.question.type_info.question_type?e.find((e=>n>=e.min&&n<=e.max)):e.find((e=>n===e.value)),t?.nextBlock){if("TY"===t.nextBlock)return void S(!0);P.current=h.findIndex((e=>e.name===t.nextBlock))}else P.current+=1}else P.current+=1;A.current=h[P.current],K(h[P.current])}},ee=e=>{M.current=!0,delete w[e.name],k({...w})},ne=(e,n,t)=>{if(W.current=!1,t){if(M.current=!0,null!=w[e.question.name]&&e.name!==R[R.length-1].name){const[t,o]=(e=>{const n=R.findIndex((n=>n.name===e.name)),t=R.slice(0,n+1),o=t.reduce(((e,n)=>(e[n.question.name]=w[n.question.name],e)),{});return P.current=h.findIndex((n=>n.name===e.name)),[t,o]})(e);k({...o,...null!=n&&{[e.question.name]:n}}),G.current=t}else k({...w,...null!=n&&{[e.question.name]:n}});H?.current?.name==e?.question?.name&&(Q.current=n)}else k({...w,...null!=n&&{[e.question.name]:n}})},te=(e,n)=>{D({...V,[e]:n})};return A.current&&A.current.question?z?t.createElement("div",{className:`freemium-survey-components ${c?"widget-survey-components":""} ${l}-style ${m?"mobile-preview":""} ${r}-survey-style`,id:"freemium-survey"},t.createElement(C,{thankYouQuestion:$,preview:p,placeholders:a,npsValue:Q.current})):t.createElement("div",{className:`freemium-survey-components ${c?"widget-survey-components":""} ${l}-style ${m?"mobile-preview":""} ${r}-survey-style`,id:"freemium-survey"},t.createElement(y,{totalSteps:h.length,completedSteps:P.current}),c&&"compact"===l&&document.querySelector(d)&&t.createElement(t.Fragment,null,o.createPortal(t.createElement("div",null,t.createElement(_,{currentBlockIndex:P,currentBlockIndexOfBlocksWithQns:U,blocksWithQns:R,blocks:h,setHorizontalScrollUnits:B,preventQuestionAnimation:W})),document.querySelector(d))),t.createElement("div",{style:c||"card"===r?{transform:`translateX(calc(-${O} * 100%))`,height:`${X.current[P.current]}px`,transition:W.current||R?.length<=1?"none":"all 600ms ease-out 0ms"}:{},className:"questions"},R.map(((e,n)=>t.createElement("div",{key:e.question.name,ref:j,className:"question-container "+(!c&&"card"!==r||U.current===n?"":"hide-question-container")},t.createElement("div",{className:"question-text "+(0===n?"nps":""),dangerouslySetInnerHTML:{__html:E(e.question.text,a,Q.current)},title:`question-${n}`,role:"heading","aria-level":1}),t.createElement("button",{disabled:!c&&"standard"===r,className:"autofocus-button",onKeyDown:e=>{"Tab"===e.key&&(e.stopPropagation(),e.preventDefault())}}),t.createElement(q,{question:e.question,formValues:w,othersMeta:V,autoFocus:U.current===n,autoFocusDelay:"standard"===r?350:20,saveOthersValue:te,onChangeHandler:n=>{M.current=!1,P.current=h.findIndex((n=>n.name===e.name)),A.current=e,ne(e,n,s.includes(e.question.type_info.question_type)&&!Z())}}),t.createElement("button",{disabled:!c&&"standard"===r,className:"autofocus-button",onKeyDown:e=>{"Tab"===e.key&&(e.stopPropagation(),e.preventDefault())}}),t.createElement(N,{question:e.question,blockIndex:n,widget:c,widgetStyle:l,surveyStyle:r,formValues:w,othersMeta:V,blocksWithQns:R,blocks:h,thankYouQuestion:$,currentBlockIndexOfBlocksWithQns:U,currentBlockIndexOfBlocks:P,currentEditingBlock:A,isSubmitting:F,isValuesCommitted:M,isCurrentBlockFinal:Z,setHorizontalScrollUnits:B,handleFormValues:ne,skipBlock:ee,setIsSubmitting:T,onSubmit:i,setIsSurveyCompleted:S,preventQuestionAnimation:W,preview:p,closePreview:f})))),!c&&"card"!==r&&Z()&&t.createElement("div",{className:"submit"},t.createElement(g,{disabled:(A.current.question.required||A.current.question.type_info.pivot_question)&&(null==w[A.current.question.name]||0===w[A.current.question.name]?.length)||A.current.question.type_info.meta?.othersRequired&&"MULTI_SELECT"===A.current.question.type_info.question_type&&w[A.current.question.name]?.includes("")||F,onClick:()=>{T(!0),i({...w,others_meta:V},(()=>{$?.type_info.meta?.skipThankYouPage?p?setTimeout((()=>{f?.()}),300):window.location.href=$?.type_info.meta?.redirectUrl:S(!0)}))}},F?"Submitting":"Submit Survey")))):null},exports.TextArea=p;
|
package/lib/index.esm.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import e,{useRef as n,forwardRef as t,useEffect as o,useState as r,useMemo as a}from"react";import i from"react-dom";function s(e,n){void 0===n&&(n={});var t=n.insertAt;if(e&&"undefined"!=typeof document){var o=document.head||document.getElementsByTagName("head")[0],r=document.createElement("style");r.type="text/css","top"===t&&o.firstChild?o.insertBefore(r,o.firstChild):o.appendChild(r),r.styleSheet?r.styleSheet.cssText=e:r.appendChild(document.createTextNode(e))}}s(".freemium-survey-components .nps-container {\n margin: 0 auto;\n width: 100%;\n display: flex;\n flex-direction: column;\n grid-gap: 28px;\n gap: 28px;\n}\n.freemium-survey-components .nps-container .footer {\n border-top: 1px solid var(--default-background-color);\n border-top: 1px solid var(--background-color, var(--default-background-color));\n padding-top: 20px;\n display: flex;\n justify-content: center;\n font-size: 0.875rem;\n line-height: 1.5;\n color: #666;\n}\n.freemium-survey-components .nps-container .footer:empty {\n display: none;\n}\n.freemium-survey-components .nps-container .nps-scale {\n position: relative;\n}\n.freemium-survey-components .nps-container .nps-scale .button-container {\n display: flex;\n border-radius: 4px;\n justify-content: space-between;\n background: var(--default-background-color);\n background: var(--background-color, var(--default-background-color));\n position: relative;\n margin-bottom: 40px;\n}\n.freemium-survey-components .nps-container .nps-scale .positive-text {\n position: absolute;\n color: #475867;\n bottom: -40px;\n font-size: 12px;\n right: 0px;\n text-align: right;\n}\n.freemium-survey-components .nps-container .nps-scale .negative-text {\n position: absolute;\n color: #475867;\n bottom: -40px;\n font-size: 12px;\n left: 0;\n text-align: left;\n}\n.freemium-survey-components .nps-container .nps-scale span {\n color: #aaa;\n font-size: 0.75rem;\n}\n.freemium-survey-components .nps-container .nps-scale button {\n display: inline-block;\n font-size: 1rem;\n white-space: nowrap;\n vertical-align: middle;\n background: none;\n border: none;\n box-shadow: none;\n cursor: pointer;\n text-align: center;\n font-weight: 400;\n border-radius: 4px;\n margin: 0;\n outline: none;\n margin-left: -1px;\n width: 40px;\n height: 40px;\n transform: scale(1);\n}\n.freemium-survey-components .nps-container .nps-scale button:hover {\n transition: background 0.2s ease-in, color 0.2s ease-in, border-color 0.2s ease-in, transform 0.2s cubic-bezier(0.5, 2, 0.5, 0.75);\n}\n.freemium-survey-components .nps-container .nps-scale button:hover, .freemium-survey-components .nps-container .nps-scale button:focus {\n color: white;\n transform: scale(1.2);\n z-index: 2;\n position: relative;\n}\n.freemium-survey-components .nps-container .nps-scale button.active {\n color: white;\n transform: scale(1.2);\n z-index: 2;\n position: relative;\n}\n.freemium-survey-components .nps-container .nps-scale.rounded button {\n border-radius: 50%;\n}\n.freemium-survey-components .nps-container .nps-scale.square button {\n border-radius: 0;\n}\n.freemium-survey-components .nps-container .nps-scale.curved button {\n border-radius: 3px;\n}\n.freemium-survey-components .nps-container .nps-scale.highlighted button:hover, .freemium-survey-components .nps-container .nps-scale.highlighted button:focus, .freemium-survey-components .nps-container .nps-scale.highlighted button.active {\n background: var(--default-brand-color) !important;\n background: var(--brand-color, var(--default-brand-color)) !important;\n}\n.freemium-survey-components .nps-container .nps-scale .choices {\n width: 100%;\n display: flex;\n justify-content: space-between;\n font-weight: 500;\n}\n.freemium-survey-components .nps-container .nps-scale.standard .button-container {\n background-color: transparent;\n}\n.freemium-survey-components .nps-container .nps-scale.standard .choice {\n background: #E43E3D;\n color: #fff;\n}\n.freemium-survey-components .nps-container .nps-scale.standard .choice:nth-last-child(1), .freemium-survey-components .nps-container .nps-scale.standard .choice:nth-last-child(2) {\n background: #00AF50;\n}\n.freemium-survey-components .nps-container .nps-scale.standard .choice:nth-last-child(3), .freemium-survey-components .nps-container .nps-scale.standard .choice:nth-last-child(4) {\n background: #F8C43E;\n}\n.freemium-survey-components .nps-container .nps-scale.standard .choice:hover, .freemium-survey-components .nps-container .nps-scale.standard .choice:focus, .freemium-survey-components .nps-container .nps-scale.standard .choice.active {\n transform: scale(1.2);\n}\n\n.freemium-survey-components.mobile-preview .nps-container .nps-scale .button-container {\n background: transparent;\n}\n.freemium-survey-components.mobile-preview .nps-container .nps-scale .choices {\n flex-wrap: wrap;\n justify-content: center;\n grid-gap: 16px;\n gap: 16px;\n background: transparent;\n}\n.freemium-survey-components.mobile-preview .nps-container .nps-scale button {\n border-radius: 50%;\n background: #ebeff3;\n}\n\n@media (max-width: 550px) {\n .freemium-survey-components .nps-container .nps-scale .button-container,\n.card-survey-style .nps-container .nps-scale .button-container {\n background: transparent;\n }\n .freemium-survey-components .nps-container .nps-scale .choices,\n.card-survey-style .nps-container .nps-scale .choices {\n flex-wrap: wrap;\n justify-content: center;\n grid-gap: 16px;\n gap: 16px;\n background: transparent;\n }\n .freemium-survey-components .nps-container .nps-scale button,\n.card-survey-style .nps-container .nps-scale button {\n border-radius: 50%;\n background: #ebeff3;\n }\n}\n.widget-survey-components .nps-container .nps-scale .button-container {\n background: transparent;\n}\n.widget-survey-components .nps-container .nps-scale .choices {\n flex-wrap: wrap;\n justify-content: center;\n grid-gap: 16px;\n gap: 16px;\n background: transparent;\n}\n.widget-survey-components .nps-container .nps-scale button {\n border-radius: 50%;\n background: #ebeff3;\n}");const c=t=>{const{type_info:{linear_scale:{button_style:o="highlighted",button_shape:r="rounded"}={},score_presets:{start:a="Very unlikely",end:i="Very likely"}={},validation:{min:s},footer_text:c}}=t,l=e=>{switch(e){case e<=6:return"detractor";case e<=8:return"passive";default:return"promoter"}},u=n(Array.from({length:10+(0===s?1:0)},((e,n)=>n+s)));return e.createElement("div",{className:"nps-container","data-test-input":"nps"},e.createElement("div",{className:`nps-scale ${r} ${o}`},e.createElement("div",{className:"button-container"},e.createElement("span",{className:"negative-text",role:"note"},`${s} - ${a}`),e.createElement("span",{className:"positive-text",role:"note"},`${u.current[u.current.length-1]} - ${i}`),e.createElement("div",{className:"choices",role:"radiogroup","aria-required":!0},u.current.map((n=>e.createElement("button",{role:"radio","aria-checked":t.npsValue===n,key:n,"data-test-nps-choice":n,onClick:e=>{t.onChangeHandler(n)},className:`choice ${l(n)} ${t.npsValue===n&&"active"}`},n)))))),e.createElement("div",{className:"footer",role:"note"},c))},l=(e,n)=>(e.defaultProps=n,e);s('.freemium-survey-components .input-container,\n.freemium-survey-components .textarea-container {\n display: flex;\n flex-direction: column;\n width: 100%;\n border-radius: 4px;\n position: relative;\n}\n.freemium-survey-components label.input-label {\n display: inline-block;\n padding-bottom: 8px;\n padding-left: 2px;\n font-size: 0.75rem;\n font-weight: 400;\n}\n.freemium-survey-components label.required::after {\n content: "*";\n position: relative;\n top: 2px;\n font-weight: 500;\n font-size: 0.85rem;\n padding-left: 3px;\n color: #d72d30;\n}\n.freemium-survey-components .input-basic {\n width: 100%;\n display: flex;\n align-items: center;\n border-radius: 4px;\n border: 1px solid var(--default-brand-color);\n border: 1px solid var(--brand-color, var(--default-brand-color));\n transition: border-color 0.2s linear;\n background: #fff;\n}\n.freemium-survey-components .textarea-container .input-basic {\n flex-direction: column;\n align-items: unset;\n}\n.freemium-survey-components .input-basic.error {\n border: 1px solid #d72d30;\n}\n.freemium-survey-components .input-basic.error:hover {\n border: 1px solid #d72d30;\n}\n.freemium-survey-components .input-basic.error[focus-within] {\n box-shadow: none;\n}\n.freemium-survey-components .input-basic.error:focus-within {\n box-shadow: none;\n}\n.freemium-survey-components .input-basic:hover {\n border-color: var(--default-brand-color);\n border-color: var(--brand-color, var(--default-brand-color));\n transition: 0.2s linear;\n}\n.freemium-survey-components .input-basic[focus-within] {\n border: 1px solid transparent;\n box-shadow: 0 0 0 2px var(--default-brand-color);\n box-shadow: 0 0 0 2px var(--brand-color, var(--default-brand-color));\n}\n.freemium-survey-components .input-basic:focus-within {\n border: 1px solid transparent;\n box-shadow: 0 0 0 2px var(--default-brand-color);\n box-shadow: 0 0 0 2px var(--brand-color, var(--default-brand-color));\n}\n.freemium-survey-components .end-max-length {\n padding: 0 8px;\n font-size: 0.75rem;\n color: #264966;\n}\n.freemium-survey-components .textarea-container .end-max-length {\n padding: 8px;\n align-self: flex-end;\n}\n.freemium-survey-components span.input-error {\n display: block;\n padding-left: 2px;\n padding-top: 4px;\n font-size: 0.9rem;\n color: #d72d30;\n}\n.freemium-survey-components input[type=text] {\n padding: 6px 12px;\n flex: 1;\n border: unset;\n height: 32px;\n font-size: 1rem;\n /* line-height: ${typography.input.text.lineHeight}; */\n border-radius: 4px;\n}\n.freemium-survey-components input[type=text],\n.freemium-survey-components textarea {\n outline: none;\n border: none;\n}\n.freemium-survey-components input[type=text]::-moz-placeholder {\n color: #92a2b2;\n font-weight: 400;\n font-size: 0.85rem;\n}\n.freemium-survey-components input[type=text]:-ms-input-placeholder {\n color: #92a2b2;\n font-weight: 400;\n font-size: 0.85rem;\n}\n.freemium-survey-components input[type=text]::placeholder {\n color: #92a2b2;\n font-weight: 400;\n font-size: 0.85rem;\n}\n.freemium-survey-components textarea {\n min-height: 116px;\n padding: 12px;\n flex: 1;\n border: unset;\n resize: none;\n font-size: 1rem;\n /* line-height: ${typography.input.text.lineHeight}; */\n border-radius: 4px;\n}\n.freemium-survey-components textarea::-moz-placeholder {\n color: #92a2b2;\n font-weight: 400;\n font-size: 0.85rem;\n}\n.freemium-survey-components textarea:-ms-input-placeholder {\n color: #92a2b2;\n font-weight: 400;\n font-size: 0.85rem;\n}\n.freemium-survey-components textarea::placeholder {\n color: #92a2b2;\n font-weight: 400;\n font-size: 0.85rem;\n}');const u={isRequired:!1,showCount:!0,isErrored:!1,inline:!1,spellCheck:!1,autoFocusInput:!0},d=t(((t,r)=>{const a=n(null);o((()=>{t.autoFocusInput&&setTimeout((()=>{a.current?.focus()}),S+t.autoFocusDelay)}),[t.autoFocusInput]);const{inputStyle:i,style:s,className:c,showCount:l,isErrored:u,startLabel:d,isRequired:p,errorText:m,endLabel:f,maxLength:v=300,onChange:h,autoFocusInput:x,...y}=t;return e.createElement("div",{className:"input-container",style:s},t.label&&e.createElement("label",{className:"input-label "+(p?"required":"")},t.label),e.createElement("div",null,d&&e.createElement("div",{className:"start-label"},d),e.createElement("div",{className:`input-basic ${u?"error":""}${c||""}`},e.createElement("input",Object.assign({},y,{type:"text",autoComplete:"off",ref:a,style:i,onChange:e=>{e.target.value?.length>v||h?.(e)}})),l&&v>0&&e.createElement("div",{className:"end-max-length"},`${t.value&&t.value.length||0}/${v}`)),f&&e.createElement("div",{className:"end-label"},f)),u&&m&&e.createElement("span",{className:"input-error"},t.errorText))})),p=t(((t,r)=>{const a=n(null);o((()=>{t.autoFocusInput&&setTimeout((()=>{a.current?.focus()}),S+t.autoFocusDelay)}),[t.autoFocusInput]);const{inputStyle:i,style:s,className:c,showCount:l,maxLength:u=1500,startLabel:d,isRequired:p,autoFocusInput:m,onChange:f,...v}=t;return e.createElement(e.Fragment,null,e.createElement("div",{className:"textarea-container",style:s},t.label&&e.createElement("label",{className:"input-label "+(p?"required":"")},t.label),d&&e.createElement("div",{className:"start-label"},d),e.createElement("div",{className:`input-basic ${c||""}`},e.createElement("textarea",Object.assign({},v,{autoComplete:"off",ref:a,style:i,onChange:e=>{e.target.value?.length>u||f?.(e)}})),l&&u&&u>0&&e.createElement("div",{className:"end-max-length"},`${t.value&&t.value.length||0}/${u}`)),t.endLabel&&e.createElement("div",{className:"end-label"},t.endLabel)))})),m=l(d,u),f=l(p,u);s('.freemium-survey-components .checkbox-group {\n width: 100%;\n display: flex;\n grid-gap: 12px;\n gap: 12px;\n flex-direction: column;\n white-space: nowrap;\n flex-wrap: wrap;\n}\n.freemium-survey-components .icon-container {\n display: inline-block;\n flex: 0 0 12px;\n width: 12px;\n height: 12px;\n min-width: 12px;\n min-height: 12px;\n color: inherit;\n position: absolute;\n left: 1px;\n top: 2px;\n}\n.freemium-survey-components .tick-icon {\n position: absolute;\n top: 0;\n right: 0;\n bottom: 0;\n left: 0;\n height: 100%;\n width: 100%;\n color: inherit;\n fill: currentColor;\n}\n.freemium-survey-components input[type=checkbox] {\n position: absolute;\n clip: rect(0px 0px 0px 0px);\n width: 0px;\n height: 0px;\n}\n.freemium-survey-components input[type=checkbox]:focus ~ .checkbox {\n /* box-shadow: ${pseudo.focus} 0px 0px 0px 2px; */\n box-shadow: var(--default-brand-color) 0px 0px 0px 2px;\n box-shadow: var(--brand-color, var(--default-brand-color)) 0px 0px 0px 2px;\n border-color: transparent;\n}\n.freemium-survey-components .checkbox-label {\n display: flex;\n align-items: baseline;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n text-align: left;\n opacity: 1;\n line-height: 1.2;\n cursor: pointer;\n font-size: 1rem;\n padding: 16px 24px;\n min-width: 200px;\n border: 1px solid #ebeff3;\n box-shadow: 0px 2px 5px rgba(18, 52, 77, 0.06);\n border-radius: 4px;\n white-space: pre-wrap;\n}\n.freemium-survey-components .checkbox-label:hover .checkbox {\n border-color: var(--default-brand-color);\n border-color: var(--brand-color, var(--default-brand-color));\n box-shadow: var(--default-background-color) 0px 0px 0px 5px;\n box-shadow: var(--background-color, var(--default-background-color)) 0px 0px 0px 5px;\n}\n.freemium-survey-components .checkbox-label.disabled {\n opacity: 0.5;\n cursor: "not-allowed";\n}\n.freemium-survey-components .checkbox {\n transition: background-color ease-in 0.2s;\n min-width: 14px;\n min-height: 14px;\n min-height: 14px;\n max-height: 14px;\n border-radius: 2px;\n position: relative;\n margin-right: 16px;\n background-color: #fff;\n border: 1px solid;\n text-align: left;\n border-color: var(--default-brand-color);\n border-color: var(--brand-color, var(--default-brand-color));\n}\n.freemium-survey-components .checkbox:hover {\n border-color: var(--default-brand-color);\n border-color: var(--brand-color, var(--default-brand-color));\n box-shadow: var(--default-background-color) 0px 0px 0px 5px;\n box-shadow: var(--background-color, var(--default-background-color)) 0px 0px 0px 5px;\n}\n.freemium-survey-components input[type=checkbox]:checked ~ .checkbox {\n background-color: var(--default-brand-color);\n background-color: var(--brand-color, var(--default-brand-color));\n border-color: var(--default-brand-color);\n border-color: var(--brand-color, var(--default-brand-color));\n}\n.freemium-survey-components input[type=checkbox]:checked ~ .checkbox:hover {\n border-color: var(--default-brand-color);\n border-color: var(--brand-color, var(--default-brand-color));\n}\n.freemium-survey-components input[type=checkbox]:disabled ~ .checkbox:hover {\n box-shadow: unset;\n border-color: unset;\n}');const v=()=>e.createElement("svg",{id:"tick",className:"tick-icon",xmlns:"http://www.w3.org/2000/svg","aria-labelledby":"title",viewBox:"0 0 10 10"},e.createElement("path",{d:"M3 5.87c-.18666814.00267463-.36667109-.06932655-.5-.2L.21 3.41c-.1786328-.17863279-.24839684-.43899577-.1830127-.6830127.06538414-.24401694.25598306-.43461586.5-.5C.77100423 2.16160316 1.0313672 2.23136721 1.21 2.41L3 4.18 6.8.33c.27679776-.27455556.72320224-.27455556 1 0 .13696438.13025306.21450026.31098915.21450026.5S7.93696438 1.19974694 7.8 1.33L3.45 5.67c-.12082534.11896945-.28072735.19003701-.45.2Z",fill:"#fff",fillRule:"evenodd"})),h=({values:t=[],othersValue:a="",options:i,name:s,autoFocusGroup:c,autoFocusDelay:l,onChangeHandler:u,saveOthersValue:d,othersOption:p,othersRequired:f})=>{const[v,h]=r(!1),y=n(null);return o((()=>{c&&setTimeout((()=>{y.current?.focus()}),S+l)}),[c]),e.createElement("div",{className:"checkbox-group"},e.createElement("button",{ref:y,className:"autofocus-button","aria-hidden":!0}),i?.map(((n,o)=>e.createElement(x,{key:n.id,checked:t?.includes(n.value),name:n.value,id:n.id,onChange:(e,o)=>{if(o)u([...t||[],n.value]);else{const e=t.indexOf(n.value);e>-1&&t.splice(e,1),u([...t])}}},n.value))),p&&e.createElement(x,{key:"others",checked:v,name:"others",id:"others",onChange:(e,n)=>{if(h(n),n)u([...t,"others"]);else{const e=t.findIndex((e=>"others"===e));t.splice(e,1),u(t)}}},"Others"),v&&e.createElement(e.Fragment,null,e.createElement(m,{placeholder:"Enter your comment",value:a[s],onChange:e=>{d(s,e.target.value)},autoFocusDelay:10,label:""})))},x=l((t=>{const r=n(null);return o((()=>{t.autoFocus&&setTimeout((()=>{r.current?.focus()}),S+20)}),[]),e.createElement("label",{className:`checkbox-label ${t.disabled&&"disabled"}`},e.createElement("input",{ref:r,id:t.id,type:"checkbox",name:t.name,readOnly:t.readOnly,disabled:t.disabled,"aria-disabled":t.disabled,checked:t.checked,onChange:t.readOnly?()=>{}:e=>t.onChange(e,e.target.checked)}),e.createElement("div",{className:"checkbox"},t.checked&&e.createElement("div",{className:"icon-container"},e.createElement(v,null)," ")),e.createElement("div",null,t.children))}),{checked:!1});s('.freemium-survey-components .radio-group {\n display: flex;\n grid-gap: 12px;\n gap: 12px;\n white-space: nowrap;\n flex-direction: column;\n width: 100%;\n}\n.freemium-survey-components .radio {\n background-color: #fff;\n border: 1px solid;\n border-color: var(--default-brand-color);\n border-color: var(--brand-color, var(--default-brand-color));\n transition: background-color ease-in 0.2s;\n min-width: 18px;\n max-width: 18px;\n min-height: 18px;\n max-height: 18px;\n border-radius: 50%;\n position: relative;\n margin-right: 16px;\n text-align: left;\n}\n.freemium-survey-components .radio:before {\n left: 3px;\n top: 3px;\n content: "";\n position: absolute;\n width: 10px;\n height: 10px;\n border-radius: 50%;\n transition: all ease-in 0.2s;\n background-color: #fff;\n}\n.freemium-survey-components .radio-label {\n display: flex;\n align-items: baseline;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n text-align: left;\n cursor: pointer;\n line-height: 1.2;\n font-size: 1rem;\n font-weight: 400;\n padding: 16px 24px;\n min-width: 200px;\n border: 1px solid #ebeff3;\n box-shadow: 0px 2px 5px rgba(18, 52, 77, 0.06);\n border-radius: 4px;\n white-space: pre-wrap;\n}\n.freemium-survey-components input[type=radio] {\n position: absolute;\n clip: rect(0, 0, 0, 0);\n width: 0px;\n height: 0px;\n}\n.freemium-survey-components input[type=radio]:focus ~ .radio {\n /* box-shadow: ${pseudo.focus} 0px 0px 0px 3px; */\n box-shadow: var(--default-brand-color) 0px 0px 0px 3px;\n box-shadow: var(--brand-color, var(--default-brand-color)) 0px 0px 0px 3px;\n border-color: transparent;\n}\n.freemium-survey-components input[type=radio]:checked ~ .radio:before {\n background-color: var(--default-brand-color);\n background-color: var(--brand-color, var(--default-brand-color));\n}\n.freemium-survey-components .radio-label:hover .radio {\n border-color: var(--default-brand-color);\n border-color: var(--brand-color, var(--default-brand-color));\n box-shadow: var(--default-background-color) 0px 0px 0px 5px;\n box-shadow: var(--background-color, var(--default-background-color)) 0px 0px 0px 5px;\n}');const y=({name:t,options:a,value:i,autoFocusGroup:s,autoFocusDelay:c,onChangeHandler:l,saveOthersValue:u,othersOption:d,othersRequired:p})=>{const[f,v]=r(""),[h,x]=r(""),y=n(null);return o((()=>{s&&setTimeout((()=>{y.current?.focus()}),S+c)}),[s]),o((()=>{i||(x(""),v(""))}),[i]),o((()=>{h&&a.find((e=>e.value===h))&&l(h)}),[h]),e.createElement("div",{className:"radio-group",role:"radiogroup"},e.createElement("button",{ref:y,className:"autofocus-button","aria-hidden":!0,tabIndex:-1}),a?.map(((n,o)=>e.createElement(b,{key:n.value,value:n.value,name:t,onChange:e=>{x(e.currentTarget.value)},checked:h===n.value},n.value))),d&&e.createElement(b,{key:"others",value:"others",name:t,onChange:e=>{x("others")},checked:"others"===h},"Others"),"others"===h&&e.createElement(e.Fragment,null,e.createElement(m,{value:f,onChange:e=>v(e.target.value),placeholder:"Enter your comment",label:"",autoFocusDelay:10}),f!==i&&e.createElement(q,{inline:!0,disabled:p&&0===f.length,onClick:()=>{l("others"),u(t,f)}},"Next")))},b=l((t=>{const r=n(null);return o((()=>{t.autoFocus&&setTimeout((()=>{r.current?.focus()}),S+20)}),[]),e.createElement("label",{className:"radio-label"},e.createElement("input",{ref:r,type:"radio",name:t.name,value:t.value,checked:t.checked,onChange:t.onChange}),e.createElement("div",{className:"radio"}),e.createElement("div",null,t.children))}),{checked:!1,autoFocus:!1});s(".progressbar-container {\n width: 100%;\n height: 4px;\n position: fixed;\n top: 0;\n left: 0;\n z-index: 1;\n text-align: left;\n}\n\n.progressbar {\n transition: transform 0.25s linear;\n transform-origin: left;\n height: 100%;\n background-color: var(--default-brand-color);\n background-color: var(--brand-color, var(--default-brand-color));\n}");const g=n=>{const{totalSteps:t,completedSteps:o}=n;return e.createElement("div",{className:"progressbar-container"},e.createElement("div",{className:"progressbar",style:{width:(o>0?100/t:0)+"%",transform:`scaleX(${o})`}}))};s(".freemium-survey-components .action-button {\n width: auto;\n display: block;\n padding: 8px 16px;\n cursor: pointer;\n line-height: 1.5;\n text-align: center;\n font-weight: 500;\n letter-spacing: 0.3px;\n border-radius: 4px;\n white-space: nowrap;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n color: --default-button-text-color;\n color: var(--button-text-color, --default-button-text-color);\n background: var(--default-brand-color);\n background: var(--brand-color, var(--default-brand-color));\n border: 1px solid var(--default-brand-color);\n border: 1px solid var(--brand-color, var(--default-brand-color));\n border-radius: 4px;\n min-width: 200px;\n max-width: -webkit-fit-content;\n max-width: -moz-fit-content;\n max-width: fit-content;\n transform: translateY(0px);\n transition: transform ease 0.2s;\n}\n.freemium-survey-components .action-button:not([disabled]):hover {\n transform: translateY(-4px);\n}\n.freemium-survey-components .action-button[disabled] {\n cursor: not-allowed;\n opacity: 0.6;\n}\n.freemium-survey-components button:focus:not(:active) {\n /* box-shadow: 0 0 0 2px ${pseudo.focus}; */\n}\n\n@media (max-width: 550px) {\n .freemium-survey-components .action-button {\n min-width: 120px;\n }\n}\n.widget-survey-components .action-button {\n min-width: 120px;\n}\n\n.freemium-survey-components.mobile-preview .action-button {\n min-width: 120px;\n}");const w=()=>e.createElement(e.Fragment,null,"..."),k={LARGE:"large",MINI:"mini",NORMAL:"normal"},q=n=>{const{inline:t=!1,children:o,disabled:r,className:a="",htmlType:i,type:s="primary",onClick:c,size:l,overrideStyleClassName:u="",loading:d=!1,...p}=n;return e.createElement("button",Object.assign({style:t?{display:"inline-block"}:{},disabled:r,className:`action-button ${a} ${u}`,type:i,onClick:c},p),d?e.createElement(w,null):o)},E=()=>e.createElement("svg",{style:{display:"block"},width:"9",height:"14",viewBox:"0 0 10 16",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e.createElement("path",{d:"M7.82585 6.15754C7.98999 6.32147 8.08232 6.54389 8.08252 6.77587L8.08252 7.2192C8.07983 7.45069 7.98788 7.6722 7.82585 7.83754L1.82919 13.8225C1.77496 13.8772 1.71044 13.9206 1.63936 13.9502C1.56827 13.9798 1.49203 13.9951 1.41502 13.9951C1.33801 13.9951 1.26177 13.9798 1.19068 13.9502C1.1196 13.9206 1.05508 13.8772 1.00085 13.8225L0.172521 12.9942C0.118197 12.941 0.0750381 12.8774 0.0455752 12.8073C0.0161124 12.7372 0.000937578 12.6619 0.000937585 12.5859C0.000937592 12.5098 0.0161125 12.4345 0.0455753 12.3644C0.0750381 12.2943 0.118197 12.2308 0.172521 12.1775L5.36419 6.99754L0.172522 1.81754C0.117847 1.76331 0.0744506 1.69879 0.0448352 1.62771C0.0152208 1.55662 -2.75162e-05 1.48038 -2.75094e-05 1.40337C-2.75027e-05 1.32636 0.0152208 1.25012 0.0448353 1.17904C0.0744507 1.10795 0.117847 1.04343 0.172522 0.989205L1.00086 0.172537C1.05508 0.117862 1.1196 0.0744661 1.19069 0.0448507C1.26177 0.0152353 1.33801 -1.20337e-05 1.41502 -1.2027e-05C1.49203 -1.20203e-05 1.56827 0.0152353 1.63936 0.0448507C1.71044 0.0744661 1.77496 0.117862 1.82919 0.172537L7.82585 6.15754Z",fill:"#6B6B6B"})),C=()=>e.createElement("svg",{style:{display:"block"},width:"9",height:"14",viewBox:"0 0 10 16",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e.createElement("path",{d:"M0.256667 7.83755C0.0925257 7.67361 0.000204227 7.4512 0 7.21921V6.77588C0.00268801 6.5444 0.0946357 6.32289 0.256667 6.15755L6.25333 0.172549C6.30756 0.117874 6.37208 0.0744776 6.44316 0.0448625C6.51425 0.0152474 6.59049 0 6.6675 0C6.74451 0 6.82075 0.0152474 6.89184 0.0448625C6.96292 0.0744776 7.02744 0.117874 7.08167 0.172549L7.91 1.00088C7.96432 1.05411 8.00748 1.11764 8.03694 1.18776C8.06641 1.25787 8.08158 1.33316 8.08158 1.40922C8.08158 1.48527 8.06641 1.56056 8.03694 1.63067C8.00748 1.70079 7.96432 1.76432 7.91 1.81755L2.71833 6.99755L7.91 12.1775C7.96467 12.2318 8.00807 12.2963 8.03769 12.3674C8.0673 12.4385 8.08255 12.5147 8.08255 12.5917C8.08255 12.6687 8.0673 12.745 8.03769 12.8161C8.00807 12.8871 7.96467 12.9517 7.91 13.0059L7.08167 13.8225C7.02744 13.8772 6.96292 13.9206 6.89184 13.9502C6.82075 13.9799 6.74451 13.9951 6.6675 13.9951C6.59049 13.9951 6.51425 13.9799 6.44316 13.9502C6.37208 13.9206 6.30756 13.8772 6.25333 13.8225L0.256667 7.83755Z",fill:"#6B6B6B"})),_=({question:n,formValues:t,othersMeta:o,onChangeHandler:r,saveOthersValue:a,autoFocus:i,autoFocusDelay:s})=>{switch(n.type_info.question_type){case"RANGE":return e.createElement(c,{type_info:n.type_info,onChangeHandler:r,npsValue:t[n.name]});case"CHECKBOX":case"MULTI_SELECT":return e.createElement(h,{name:n.name,autoFocusGroup:i,values:t[n.name],othersValue:o[n.name],options:n.type_info.choices,onChangeHandler:r,saveOthersValue:a,othersOption:n.type_info.meta?.othersOption,othersRequired:n.type_info.meta?.othersRequired,autoFocusDelay:s});case"RADIO":case"DROPDOWN":return e.createElement(y,{autoFocusGroup:i,autoFocusDelay:s,name:n.name,onChangeHandler:r,saveOthersValue:a,options:n.type_info.choices,value:t[n.name],othersOption:n.type_info.meta?.othersOption,othersRequired:n.type_info.meta?.othersRequired});case"INPUT":case"TEXT":return n.type_info?.meta?.readOnly?e.createElement("div",{className:"message-container"},n.type_info?.meta?.value):e.createElement("div",{className:"responsive-text-field"},e.createElement(m,{autoFocusInput:i,autoFocusDelay:s,label:"",isRequired:n.is_required,value:t[n.name]||"",placeholder:n.type_info?.meta?.placeholder??"",onChange:e=>r(e.target.value)}),e.createElement(f,{autoFocusInput:i,autoFocusDelay:s,label:"",isRequired:n.is_required,placeholder:n.type_info?.meta?.placeholder??"",value:t[n.name]||"",onChange:e=>r(e.target.value)}));case"PARAGRAPH":return e.createElement(f,{autoFocusInput:i,autoFocusDelay:s,label:"",isRequired:n.is_required,placeholder:n.type_info?.meta?.placeholder??"",value:t[n.name]||"",onChange:e=>r(e.target.value)});default:return console.error(`Question type ${n.type_info.question_type} not found`),null}},N=(e,n,t)=>{if(e){let o={"{{nps.score}}":t};n&&(o={...o,...n});const r=new RegExp(Object.keys(o).join("|"),"gi");e=e.replace(r,(function(e){return o[e.toLowerCase()]}))}return e};s(":root {\n --default-brand-color: #264966;\n --default-question-text-color: #000;\n --default-question-background-color: #fff;\n --default-background-color: #f8f8f8;\n --default-button-text-color: #fff;\n --default-secondary-button-text-color: #000;\n --default-input-placeholder-color: #92a2b1;\n --compact-widget-max-height: 560px;\n --default-widget-max-height: 400px;\n --cozy-widget-max-height: 380px;\n}\n\n.freemium-survey-step-navigation {\n padding: 0 2px;\n box-shadow: 0px 0px 6px #eee;\n white-space: nowrap;\n}\n.freemium-survey-step-navigation .navigation-button {\n width: 38px;\n text-align: -webkit-center;\n height: 38px;\n background-color: #fff;\n border: none;\n cursor: pointer;\n border-radius: 0 3px 3px 0;\n}\n.freemium-survey-step-navigation .navigation-button:first-of-type {\n border-right: 1px solid #d9d9d9;\n border-radius: 3px 0 0 3px;\n}\n.freemium-survey-step-navigation .navigation-button:disabled {\n cursor: not-allowed;\n opacity: 0.5;\n}\n.freemium-survey-step-navigation .navigation-button:focus {\n position: relative;\n z-index: 1;\n}\n\n.freemium-survey-components .question-container {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n text-align: center;\n max-width: 700px;\n margin: 0 auto;\n background: var(--default-question-background-color);\n background: var(--question-background-color, var(--default-question-background-color));\n border-radius: 4px;\n transition: transform 500ms ease 0ms, opacity 200ms ease 0ms;\n box-shadow: 0px 12px 15px rgba(18, 52, 77, 0.03);\n margin-bottom: 28px;\n padding: 28px;\n grid-gap: 28px;\n gap: 28px;\n position: relative;\n height: -webkit-fit-content;\n height: -moz-fit-content;\n height: fit-content;\n transition: opacity 50ms ease-out;\n overflow: auto;\n}\n.freemium-survey-components .hide-question-container {\n opacity: 0;\n}\n.freemium-survey-components .question-text {\n font-size: 1rem;\n font-weight: 600;\n line-height: 1.8;\n width: 100%;\n text-align: left;\n color: var(--default-question-text-color);\n color: var(--question-text-color, var(--default-question-text-color));\n}\n.freemium-survey-components .autofocus-button {\n border: none;\n width: 0;\n height: 0;\n opacity: 0;\n margin-top: -12px;\n margin-left: -12px;\n position: absolute;\n}\n@-webkit-keyframes opac {\n 0%, 50% {\n opacity: 0;\n }\n 100% {\n opacity: 1;\n }\n}\n@keyframes opac {\n 0%, 50% {\n opacity: 0;\n }\n 100% {\n opacity: 1;\n }\n}\n.freemium-survey-components .question-footer {\n display: flex;\n justify-content: flex-end;\n grid-gap: 40px;\n gap: 40px;\n width: 100%;\n align-items: center;\n}\n.freemium-survey-components .question-footer:empty {\n display: none;\n}\n.freemium-survey-components .action-buttons {\n display: flex;\n grid-gap: 20px;\n gap: 20px;\n flex-direction: row-reverse;\n}\n.freemium-survey-components .action-buttons:empty {\n display: none;\n}\n.freemium-survey-components .skip-button {\n font-weight: 400;\n cursor: pointer;\n background: transparent;\n border: none;\n min-width: 40px;\n padding: 8px 16px;\n border-radius: 4px;\n color: var(--default-secondary-button-text-color);\n color: var(--secondary-button-text-color, var(--default-secondary-button-text-color));\n letter-spacing: 0.05rem;\n line-height: 1.5;\n border: 1px solid transparent;\n}\n.freemium-survey-components .skip-button:hover {\n background-color: #f3f3f3;\n}\n.freemium-survey-components .next-button {\n color: var(--default-button-text-color);\n color: var(--button-text-color, var(--default-button-text-color));\n}\n.freemium-survey-components .submit {\n max-width: 700px;\n margin: 0 auto;\n text-align: left;\n background: transparent;\n box-shadow: none;\n color: var(--default-button-text-color);\n color: var(--button-text-color, var(--default-button-text-color));\n}\n.freemium-survey-components .thankyou {\n display: flex;\n align-items: center;\n justify-content: center;\n grid-gap: 20px;\n gap: 20px;\n min-height: 180px;\n}\n.freemium-survey-components .thankyou .heading {\n font-weight: 600;\n font-size: 28px;\n}\n.freemium-survey-components .thankyou .text {\n white-space: pre-wrap;\n font-weight: 500;\n font-size: 0.875rem;\n line-height: 1.6;\n color: #12344d;\n width: 75%;\n}\n.freemium-survey-components .thankyou .redirection-text {\n color: #929292;\n margin-bottom: 12px;\n font-weight: 300;\n}\n.freemium-survey-components .thankyou .link {\n width: 100%;\n display: inline-block;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n color: #666;\n font-weight: 500;\n text-decoration: underline;\n}\n.freemium-survey-components .responsive-text-field {\n width: 100%;\n}\n.freemium-survey-components .responsive-text-field .textarea-container {\n display: none;\n}\n.freemium-survey-components .message-container:empty {\n display: none;\n}\n\n@media (max-width: 550px) {\n .freemium-survey-component .responsive-text-field .input-container,\n.card-survey-style .responsive-text-field .input-container {\n display: none;\n }\n .freemium-survey-component .responsive-text-field .textarea-container,\n.card-survey-style .responsive-text-field .textarea-container {\n display: flex;\n }\n}\ndiv.widget-survey-components.compact-style .freemium-survey-step-navigation {\n padding: 0 2px;\n margin-left: 4px;\n box-shadow: 0px 0px 6px #eee;\n margin-top: 4px;\n}\ndiv.widget-survey-components.compact-style .nps-container .footer {\n padding-top: 12px;\n}\ndiv.widget-survey-components.compact-style .nps-container .choices {\n grid-gap: 12px;\n gap: 12px;\n}\n\ndiv.widget-survey-components,\ndiv.card-survey-style {\n display: flex;\n flex-direction: column;\n grid-gap: 28px;\n gap: 28px;\n flex-grow: 1;\n font-size: 0.875rem;\n overflow: hidden;\n}\ndiv.widget-survey-components .questions,\ndiv.card-survey-style .questions {\n min-width: 100%;\n max-width: 100%;\n display: flex;\n height: 100%;\n position: relative;\n max-height: 560px;\n max-height: var(--compact-widget-max-height);\n}\ndiv.widget-survey-components .question-text,\ndiv.card-survey-style .question-text {\n width: 100%;\n text-align: left;\n}\ndiv.widget-survey-components .focus-lock,\ndiv.card-survey-style .focus-lock {\n width: 100%;\n}\ndiv.widget-survey-components .question-container,\ndiv.card-survey-style .question-container {\n height: -webkit-fit-content;\n height: -moz-fit-content;\n height: fit-content;\n min-width: 100%;\n max-width: 100%;\n margin-bottom: 0;\n padding: 16px 28px;\n grid-gap: 16px;\n gap: 16px;\n flex-grow: 1;\n}\ndiv.widget-survey-components .question-footer,\ndiv.card-survey-style .question-footer {\n margin: 0px auto;\n justify-content: space-between;\n bottom: 0;\n padding-bottom: 20px;\n}\ndiv.widget-survey-components .submit,\ndiv.card-survey-style .submit {\n padding-bottom: 0;\n margin: unset;\n}\ndiv.widget-survey-components .nps-container .footer,\ndiv.card-survey-style .nps-container .footer {\n padding-top: 12px;\n}\ndiv.widget-survey-components .nps-container .widget .choices,\ndiv.card-survey-style .nps-container .widget .choices {\n grid-gap: 8px;\n gap: 8px;\n}\ndiv.widget-survey-components .radio-group,\ndiv.card-survey-style .radio-group {\n width: 100%;\n}\ndiv.widget-survey-components .checkbox-group,\ndiv.card-survey-style .checkbox-group {\n width: 100%;\n flex-wrap: nowrap;\n}\n\ndiv.widget-survey-components .question-container {\n box-shadow: none;\n border-radius: 0;\n}\ndiv.widget-survey-components .question-text {\n font-size: 0.875rem;\n}\ndiv.widget-survey-components .progressbar-container {\n position: absolute;\n}\ndiv.widget-survey-components .progressbar-container .progressbar {\n border-radius: 3px 0 0 0;\n}\ndiv.widget-survey-components .textarea-container .end-max-length {\n padding: 4px;\n}\ndiv.widget-survey-components .responsive-text-field .input-container {\n display: none;\n}\ndiv.widget-survey-components .responsive-text-field .textarea-container {\n display: flex;\n}\ndiv.widget-survey-components div.thankyou {\n min-height: unset;\n}\ndiv.widget-survey-components div.thankyou .text {\n width: 85%;\n}\ndiv.widget-survey-components div.thankyou svg {\n width: 140px;\n height: 120px;\n}\n\ndiv.widget-survey-components.default-style .freemium-survey-step-navigation {\n margin: 0;\n}\ndiv.widget-survey-components.default-style .questions {\n max-height: 400px;\n max-height: var(--default-widget-max-height);\n}\ndiv.widget-survey-components.default-style .question-container {\n padding: 12px 28px;\n}\ndiv.widget-survey-components.default-style .question-footer {\n justify-content: space-between;\n}\ndiv.widget-survey-components.default-style .nps-container .footer {\n padding-top: 12px;\n}\ndiv.widget-survey-components.default-style .nps-container .choices {\n flex-wrap: unset;\n grid-gap: 12px;\n gap: 12px;\n}\ndiv.widget-survey-components.default-style .action-button {\n line-height: 1.2;\n}\ndiv.widget-survey-components.default-style .radio-group {\n flex-direction: row;\n flex-wrap: wrap;\n}\ndiv.widget-survey-components.default-style .radio-group .radio-label {\n padding: 12px 16px;\n min-width: 160px;\n font-size: 0.9rem;\n}\ndiv.widget-survey-components.default-style .checkbox-group {\n flex-direction: row;\n flex-wrap: wrap;\n}\ndiv.widget-survey-components.default-style .checkbox-group .checkbox-label {\n padding: 12px 16px;\n min-width: 160px;\n font-size: 0.9rem;\n}\ndiv.widget-survey-components.default-style textarea {\n min-height: 84px;\n}\ndiv.widget-survey-components.default-style .end-max-length {\n font-size: 0.8rem;\n font-weight: 300;\n padding: 4px;\n}\n\n.widget-survey-components.cozy-style .freemium-survey-step-navigation {\n margin: 0;\n}\n.widget-survey-components.cozy-style .questions {\n max-height: 380px;\n max-height: var(--cozy-widget-max-height);\n}\n.widget-survey-components.cozy-style .question-text {\n font-size: 1rem;\n}\n.widget-survey-components.cozy-style .question-text.nps {\n text-align: center;\n width: 60%;\n min-width: 600px;\n margin: auto;\n}\n.widget-survey-components.cozy-style .question-container {\n padding: 12px 28px;\n}\n.widget-survey-components.cozy-style .question-footer {\n justify-content: space-between;\n}\n.widget-survey-components.cozy-style .nps-container {\n grid-gap: 44px;\n gap: 44px;\n}\n.widget-survey-components.cozy-style .nps-container .widget {\n display: flex;\n justify-content: center;\n}\n.widget-survey-components.cozy-style .nps-container .button-container {\n width: 60%;\n min-width: 600px;\n margin: 0 auto;\n}\n.widget-survey-components.cozy-style .nps-container .button-container .choices {\n justify-content: space-around;\n}\n.widget-survey-components.cozy-style .nps-container .footer {\n padding-top: 8px;\n}\n.widget-survey-components.cozy-style .action-button {\n line-height: 1.2;\n}\n.widget-survey-components.cozy-style .radio-group {\n flex-direction: row;\n flex-wrap: wrap;\n}\n.widget-survey-components.cozy-style .radio-group .radio-label {\n padding: 12px 16px;\n min-width: 160px;\n font-size: 0.9rem;\n}\n.widget-survey-components.cozy-style .checkbox-group {\n flex-direction: row;\n flex-wrap: wrap;\n}\n.widget-survey-components.cozy-style .checkbox-group .checkbox-label {\n padding: 12px 16px;\n min-width: 160px;\n font-size: 0.9rem;\n}\n.widget-survey-components.cozy-style textarea {\n min-height: 60px;\n}\n.widget-survey-components.cozy-style .end-max-length {\n font-size: 0.8rem;\n font-weight: 300;\n padding: 4px;\n}\n\n.freemium-survey-components.mobile-preview .thankyou .text {\n width: unset;\n}");const z=["RANGE","NPS","RADIO","DROPDOWN"],S=200,I=10,O="active-focus-lock-1",F=({thankYouQuestion:n,preview:t,placeholders:r,npsValue:a})=>(o((()=>{t||n.type_info.meta?.redirectUrl&&setTimeout((()=>{window.location.href=n.type_info.meta?.redirectUrl}),1e3*(n.type_info.meta?.redirectDelay??10))}),[]),e.createElement("div",{className:"question-container thankyou"},e.createElement("div",{className:"heading"},"Thank you!"),e.createElement("div",{className:"text",dangerouslySetInnerHTML:{__html:N(n.text,r,a)}}),n.type_info.meta?.redirectUrl&&e.createElement("div",{style:{width:"100%"}},e.createElement("div",{className:"redirection-text"},"You will be redirected to the below URL automatically in"," ",n.type_info.meta?.redirectDelay," seconds.",e.createElement("br",null)),e.createElement("a",{className:"link",href:n.type_info.meta?.redirectUrl},n?.type_info.meta?.redirectUrl)))),B=({currentBlockIndex:n,currentBlockIndexOfBlocksWithQns:t,blocksWithQns:o,blocks:r,setHorizontalScrollUnits:a,preventQuestionAnimation:i})=>e.createElement("div",{className:"freemium-survey-step-navigation","data-navigation-element":"1"},e.createElement("button",{disabled:0==t.current,className:"navigation-button",onClick:()=>{t.current=Math.max(t.current-1,0),n.current=r.findIndex((e=>e.name===o[t.current].name)),i.current=!1,a(t.current)}},e.createElement(C,null)),e.createElement("button",{className:"navigation-button",disabled:t.current>=o.length-1,onClick:()=>{i.current=!1,t.current=Math.min(t.current+1,o.length-1),n.current=r.findIndex((e=>e.name===o[t.current].name)),a(t.current)}},e.createElement(E,null))),$=({widget:n,widgetStyle:t,surveyStyle:o,formValues:r,othersMeta:a,blocksWithQns:i,blocks:s,thankYouQuestion:c,currentBlockIndexOfBlocksWithQns:l,currentBlockIndexOfBlocks:u,currentEditingBlock:d,isSubmitting:p,isValuesCommitted:m,isCurrentBlockFinal:f,setHorizontalScrollUnits:v,handleFormValues:h,skipBlock:x,setIsSubmitting:y,onSubmit:b,setIsSurveyCompleted:g,preventQuestionAnimation:w,preview:k,closePreview:E,...C})=>{const _=C.blockIndex??l.current,N=C.question??i[_].question,S=()=>N.name===d.current.question.name&&!z.includes(N.type_info.question_type)&&!f(),I=()=>"RANGE"!==N.type_info.question_type&&!N.required&&N.name===d.current.question.name&&!f(),O=()=>"DROPDOWN"===N.type_info.question_type&&N.name!==d.current.question.name&&!N.required&&null!=r[N.name],F=()=>f()&&(n||"standard"!==o)&&N.name===d.current.question.name,$="MULTI_SELECT"===d.current.question.type_info.question_type&&r[d.current.question.name]?.includes("others")&&(!a[d.current.question.name]||""===a[d.current.question.name]);return e.createElement("div",{className:"question-footer"},!(!n&&"standard"===o||0===_&&!r[N.name]||"compact"===t)&&e.createElement(B,{currentBlockIndex:u,currentBlockIndexOfBlocksWithQns:l,blocksWithQns:i,blocks:s,setHorizontalScrollUnits:v,preventQuestionAnimation:w}),(S()||O()||I()||F())&&e.createElement("div",{className:"action-buttons"},S()&&e.createElement(q,{onClick:()=>{h(i[_],null,!0)},disabled:d.current.question.required&&(!r[d.current.question.name]||Array.isArray(r[d.current.question.name])&&0===r[d.current.question.name].length)||d.current.question.type_info.meta?.othersRequired&&$,className:"next-button"},"Next"),I()&&e.createElement("button",{className:"skip-button",onClick:()=>x(N)},"Skip"),O()&&e.createElement("button",{className:"skip-button",onClick:()=>{d.current=i[_],u.current=s.findIndex((e=>e.name===i[_].name)),x(N)}},"Clear selection"),F()&&e.createElement("div",{className:"submit"},e.createElement(q,{disabled:(d.current.question.required||d.current.question.type_info.pivot_question)&&(null==r[d.current.question.name]||0===r[d.current.question.name]?.length)||d.current.question.type_info.meta?.othersRequired&&$||p,onClick:()=>{y(!0),b({...r,others_meta:a},(()=>{c?.type_info.meta?.skipThankYouPage?k?setTimeout((()=>{E?.()}),300):window.location.href=c?.type_info.meta?.redirectUrl:g(!0)}))}},p?"Submitting":"Submit Survey"))))},L=({survey:t,surveyStyle:a="standard",placeholders:s,onSubmit:c,widget:l,npsValue:u,widgetStyle:d,widgetNavigatorQuerySelector:p,preview:m,mobilePreview:f,closePreview:v})=>{const h=t.question_details?.questions||[],x=t.meta?.blocks||[],[y,b]=r(null),[w,k]=r({}),[E,C]=r(!1),[I,O]=r([]),[L,T]=r(0),[R,D]=r(!1),[V,A]=r(null),[H,Q]=r({}),j=n(null),P=n(null),U=n(-1),M=n(null),W=n(0),Y=n(0),G=n(!1),X=n([]),K=e.useRef(!!u&&"card"===a),Z=n(null),J=n([]);o((()=>{x&&(Z.current=x.find((e=>"TY"===e.name)),b(x.filter((e=>"TY"!==e.name))))}),[x]),o((()=>{if(y)if(P.current=h.find((e=>e.type_info?.pivot_question))??h.find((e=>"RANGE"===e.type_info?.question_type))??h[0],null!=u){U.current=u;const e=h.find((e=>e.name===y[0].question_names[0]));j.current={...y[0],question:e},X.current=[...X.current,{...y[0],question:e}],O(X.current),k({Q_1:u})}else if(!j.current&&y.length>0)return j.current=y[0],void ne(y[0])}),[y,u]),e.useEffect((()=>{I.length&&(X.current=I,Y.current=I.length-1),l||"standard"!==a?(M.current&&(M.current.style.maxHeight="unset"),J.current[W.current]=M.current?.scrollHeight||J.current[W.current]||0,M.current&&(M.current.style.maxHeight="100%")):M.current?.scrollIntoView({block:"center",behavior:"smooth"}),T(I.length-1)}),[I]),o((()=>{Object.keys(w).length>0&&j.current.question&&(z.includes(j.current.question.type_info.question_type)||G.current)&&!ee()&&te()}),[w]),o((()=>{if(null!=w?.[P.current?.name])if(Z.current?.is_based_on_score){const e=P.current?.type_info?.choices[w?.[P.current?.name]]?.dependent_question_names,n=Z.current?.question_names.find((n=>e?.includes(n))),t=h.find((e=>e.name===n));A(t)}else{const e=h.find((e=>e.name==Z.current?.question_names[0]));A(e)}}),[w?.[P.current?.name]]);const ee=()=>W.current===y.length-1||"end"===j.current.branchOption,ne=e=>{let n={};if(e.is_based_on_score){const t=P.current?.type_info?.choices[w?.[P.current?.name]]?.dependent_question_names,o=e.question_names.find((e=>t?.includes(e)));n=h.find((e=>e.name===o))}else n=h.find((n=>n.name===e.question_names[0]));j.current.question=n;X.current.find((e=>e.question.name===n.name))?(T(L+1),Y.current+=1):O([...X.current,{...e,question:n}])},te=()=>{if(ee())C(!0);else{if(j.current.nextBlock)W.current=y.findIndex((e=>e.name===j.current.nextBlock));else if(j.current.question.type_info?.meta?.branches){const e=j.current.question.type_info?.meta?.branches,n=w[j.current.question.name];let t;if(t="RANGE"===j.current.question.type_info.question_type?e.find((e=>n>=e.min&&n<=e.max)):e.find((e=>n===e.value)),t?.nextBlock){if("TY"===t.nextBlock)return void C(!0);W.current=y.findIndex((e=>e.name===t.nextBlock))}else W.current+=1}else W.current+=1;j.current=y[W.current],ne(y[W.current])}},oe=e=>{G.current=!0,delete w[e.name],k({...w})},re=(e,n,t)=>{if(K.current=!1,t){if(G.current=!0,null!=w[e.question.name]&&e.name!==I[I.length-1].name){const[t,o]=(e=>{const n=I.findIndex((n=>n.name===e.name)),t=I.slice(0,n+1),o=t.reduce(((e,n)=>(e[n.question.name]=w[n.question.name],e)),{});return W.current=y.findIndex((n=>n.name===e.name)),[t,o]})(e);k({...o,...null!=n&&{[e.question.name]:n}}),X.current=t}else k({...w,...null!=n&&{[e.question.name]:n}});P?.current?.name==e?.question?.name&&(U.current=n)}else k({...w,...null!=n&&{[e.question.name]:n}})},ae=(e,n)=>{Q({...H,[e]:n})};return j.current&&j.current.question?E?e.createElement("div",{className:`freemium-survey-components ${l?"widget-survey-components":""} ${d}-style ${f?"mobile-preview":""} ${a}-survey-style`,id:"freemium-survey"},e.createElement(F,{thankYouQuestion:V,preview:m,placeholders:s,npsValue:U.current})):e.createElement("div",{className:`freemium-survey-components ${l?"widget-survey-components":""} ${d}-style ${f?"mobile-preview":""} ${a}-survey-style`,id:"freemium-survey"},e.createElement(g,{totalSteps:y.length,completedSteps:W.current}),l&&"compact"===d&&document.querySelector(p)&&e.createElement(e.Fragment,null,i.createPortal(e.createElement("div",null,e.createElement(B,{currentBlockIndex:W,currentBlockIndexOfBlocksWithQns:Y,blocksWithQns:I,blocks:y,setHorizontalScrollUnits:T,preventQuestionAnimation:K})),document.querySelector(p))),e.createElement("div",{style:l||"card"===a?{transform:`translateX(calc(-${L} * 100%))`,height:`${J.current[W.current]}px`,transition:K.current||I?.length<=1?"none":`all ${S}ms ease-out 0ms`}:{},className:"questions"},I.map(((n,t)=>e.createElement("div",{key:n.question.name,ref:M,className:"question-container "+(!l&&"card"!==a||Y.current===t?"":"hide-question-container")},e.createElement("div",{className:"question-text "+(0===t?"nps":""),dangerouslySetInnerHTML:{__html:N(n.question.text,s,U.current)},title:`question-${t}`,role:"heading","aria-level":1}),e.createElement("button",{disabled:!l&&"standard"===a,className:"autofocus-button",onKeyDown:e=>{"Tab"===e.key&&(e.stopPropagation(),e.preventDefault())}}),e.createElement(_,{question:n.question,formValues:w,othersMeta:H,autoFocus:Y.current===t,autoFocusDelay:"standard"===a?350:20,saveOthersValue:ae,onChangeHandler:e=>{G.current=!1,W.current=y.findIndex((e=>e.name===n.name)),j.current=n,re(n,e,z.includes(n.question.type_info.question_type)&&!ee())}}),e.createElement("button",{disabled:!l&&"standard"===a,className:"autofocus-button",onKeyDown:e=>{"Tab"===e.key&&(e.stopPropagation(),e.preventDefault())}}),e.createElement($,{question:n.question,blockIndex:t,widget:l,widgetStyle:d,surveyStyle:a,formValues:w,othersMeta:H,blocksWithQns:I,blocks:y,thankYouQuestion:V,currentBlockIndexOfBlocksWithQns:Y,currentBlockIndexOfBlocks:W,currentEditingBlock:j,isSubmitting:R,isValuesCommitted:G,isCurrentBlockFinal:ee,setHorizontalScrollUnits:T,handleFormValues:re,skipBlock:oe,setIsSubmitting:D,onSubmit:c,setIsSurveyCompleted:C,preventQuestionAnimation:K,preview:m,closePreview:v})))),!l&&"card"!==a&&ee()&&e.createElement("div",{className:"submit"},e.createElement(q,{disabled:(j.current.question.required||j.current.question.type_info.pivot_question)&&(null==w[j.current.question.name]||0===w[j.current.question.name]?.length)||j.current.question.type_info.meta?.othersRequired&&"MULTI_SELECT"===j.current.question.type_info.question_type&&w[j.current.question.name]?.includes("")||R,onClick:()=>{D(!0),c({...w,others_meta:H},(()=>{V?.type_info.meta?.skipThankYouPage?m?setTimeout((()=>{v?.()}),300):window.location.href=V?.type_info.meta?.redirectUrl:C(!0)}))}},R?"Submitting":"Submit Survey")))):null},T=n=>{const{survey:t}=n,o=a((()=>{const e=JSON.parse(JSON.stringify(t)),n=[];return(e.question_details?.questions||[]).forEach((e=>{const t=e.type_info?.meta?.block;t&&(t.question_names||(t.question_names=[e.name]),n.push(t))})),{...e,meta:{...e.meta,blocks:n}}}),[t]);return e.createElement(L,Object.assign({},n,{survey:o}))};export{O as ACTIVE_FOCUS_LOCK_GROUP,I as AUTO_REDIRECT_DELAY,k as BUTTON_SIZE_VARIANTS,q as Button,h as CheckboxGroup,m as Input,c as NPS,g as ProgressBar,b as Radio,y as RadioGroup,T as Survey,S as TRANSITION_DURATION,f as TextArea};
|
|
1
|
+
import e,{useRef as n,forwardRef as t,useEffect as o,useState as r}from"react";import a from"react-dom";function i(e,n){void 0===n&&(n={});var t=n.insertAt;if(e&&"undefined"!=typeof document){var o=document.head||document.getElementsByTagName("head")[0],r=document.createElement("style");r.type="text/css","top"===t&&o.firstChild?o.insertBefore(r,o.firstChild):o.appendChild(r),r.styleSheet?r.styleSheet.cssText=e:r.appendChild(document.createTextNode(e))}}i(".freemium-survey-components .nps-container {\n margin: 0 auto;\n width: 100%;\n display: flex;\n flex-direction: column;\n grid-gap: 28px;\n gap: 28px;\n}\n.freemium-survey-components .nps-container .footer {\n border-top: 1px solid var(--default-background-color);\n border-top: 1px solid var(--background-color, var(--default-background-color));\n padding-top: 20px;\n display: flex;\n justify-content: center;\n font-size: 0.875rem;\n line-height: 1.5;\n color: #666;\n}\n.freemium-survey-components .nps-container .footer:empty {\n display: none;\n}\n.freemium-survey-components .nps-container .nps-scale {\n position: relative;\n}\n.freemium-survey-components .nps-container .nps-scale .button-container {\n display: flex;\n border-radius: 4px;\n justify-content: space-between;\n background: var(--default-background-color);\n background: var(--background-color, var(--default-background-color));\n position: relative;\n margin-bottom: 40px;\n}\n.freemium-survey-components .nps-container .nps-scale .positive-text {\n position: absolute;\n color: #475867;\n bottom: -40px;\n font-size: 12px;\n right: 0px;\n text-align: right;\n}\n.freemium-survey-components .nps-container .nps-scale .negative-text {\n position: absolute;\n color: #475867;\n bottom: -40px;\n font-size: 12px;\n left: 0;\n text-align: left;\n}\n.freemium-survey-components .nps-container .nps-scale span {\n color: #aaa;\n font-size: 0.75rem;\n}\n.freemium-survey-components .nps-container .nps-scale button {\n display: inline-block;\n font-size: 1rem;\n white-space: nowrap;\n vertical-align: middle;\n background: none;\n border: none;\n box-shadow: none;\n cursor: pointer;\n text-align: center;\n font-weight: 400;\n border-radius: 4px;\n margin: 0;\n outline: none;\n margin-left: -1px;\n width: 40px;\n height: 40px;\n transform: scale(1);\n}\n.freemium-survey-components .nps-container .nps-scale button:hover {\n transition: background 0.2s ease-in, color 0.2s ease-in, border-color 0.2s ease-in, transform 0.2s cubic-bezier(0.5, 2, 0.5, 0.75);\n}\n.freemium-survey-components .nps-container .nps-scale button:hover, .freemium-survey-components .nps-container .nps-scale button:focus {\n color: white;\n transform: scale(1.2);\n z-index: 2;\n position: relative;\n}\n.freemium-survey-components .nps-container .nps-scale button.active {\n color: white;\n transform: scale(1.2);\n z-index: 2;\n position: relative;\n}\n.freemium-survey-components .nps-container .nps-scale.rounded button {\n border-radius: 50%;\n}\n.freemium-survey-components .nps-container .nps-scale.square button {\n border-radius: 0;\n}\n.freemium-survey-components .nps-container .nps-scale.curved button {\n border-radius: 3px;\n}\n.freemium-survey-components .nps-container .nps-scale.highlighted button:hover, .freemium-survey-components .nps-container .nps-scale.highlighted button:focus, .freemium-survey-components .nps-container .nps-scale.highlighted button.active {\n background: var(--default-brand-color) !important;\n background: var(--brand-color, var(--default-brand-color)) !important;\n}\n.freemium-survey-components .nps-container .nps-scale .choices {\n width: 100%;\n display: flex;\n justify-content: space-between;\n font-weight: 500;\n}\n.freemium-survey-components .nps-container .nps-scale.standard .button-container {\n background-color: transparent;\n}\n.freemium-survey-components .nps-container .nps-scale.standard .choice {\n background: #E43E3D;\n color: #fff;\n}\n.freemium-survey-components .nps-container .nps-scale.standard .choice:nth-last-child(1), .freemium-survey-components .nps-container .nps-scale.standard .choice:nth-last-child(2) {\n background: #00AF50;\n}\n.freemium-survey-components .nps-container .nps-scale.standard .choice:nth-last-child(3), .freemium-survey-components .nps-container .nps-scale.standard .choice:nth-last-child(4) {\n background: #F8C43E;\n}\n.freemium-survey-components .nps-container .nps-scale.standard .choice:hover, .freemium-survey-components .nps-container .nps-scale.standard .choice:focus, .freemium-survey-components .nps-container .nps-scale.standard .choice.active {\n transform: scale(1.2);\n}\n\n.freemium-survey-components.mobile-preview .nps-container .nps-scale .button-container {\n background: transparent;\n}\n.freemium-survey-components.mobile-preview .nps-container .nps-scale .choices {\n flex-wrap: wrap;\n justify-content: center;\n grid-gap: 16px;\n gap: 16px;\n background: transparent;\n}\n.freemium-survey-components.mobile-preview .nps-container .nps-scale button {\n border-radius: 50%;\n background: #ebeff3;\n}\n\n@media (max-width: 550px) {\n .freemium-survey-components .nps-container .nps-scale .button-container,\n.card-survey-style .nps-container .nps-scale .button-container {\n background: transparent;\n }\n .freemium-survey-components .nps-container .nps-scale .choices,\n.card-survey-style .nps-container .nps-scale .choices {\n flex-wrap: wrap;\n justify-content: center;\n grid-gap: 16px;\n gap: 16px;\n background: transparent;\n }\n .freemium-survey-components .nps-container .nps-scale button,\n.card-survey-style .nps-container .nps-scale button {\n border-radius: 50%;\n background: #ebeff3;\n }\n}\n.widget-survey-components .nps-container .nps-scale .button-container {\n background: transparent;\n}\n.widget-survey-components .nps-container .nps-scale .choices {\n flex-wrap: wrap;\n justify-content: center;\n grid-gap: 16px;\n gap: 16px;\n background: transparent;\n}\n.widget-survey-components .nps-container .nps-scale button {\n border-radius: 50%;\n background: #ebeff3;\n}");const s=t=>{const{type_info:{linear_scale:{button_style:o="highlighted",button_shape:r="rounded"}={},score_presets:{start:a="Very unlikely",end:i="Very likely"}={},validation:{min:s},footer_text:c}}=t,l=e=>{switch(e){case e<=6:return"detractor";case e<=8:return"passive";default:return"promoter"}},u=n(Array.from({length:10+(0===s?1:0)},((e,n)=>n+s)));return e.createElement("div",{className:"nps-container","data-test-input":"nps"},e.createElement("div",{className:`nps-scale ${r} ${o}`},e.createElement("div",{className:"button-container"},e.createElement("span",{className:"negative-text",role:"note"},`${s} - ${a}`),e.createElement("span",{className:"positive-text",role:"note"},`${u.current[u.current.length-1]} - ${i}`),e.createElement("div",{className:"choices",role:"radiogroup","aria-required":!0},u.current.map((n=>e.createElement("button",{role:"radio","aria-checked":t.npsValue===n,key:n,"data-test-nps-choice":n,onClick:e=>{t.onChangeHandler(n)},className:`choice ${l(n)} ${t.npsValue===n&&"active"}`},n)))))),e.createElement("div",{className:"footer",role:"note"},c))},c=(e,n)=>(e.defaultProps=n,e);i('.freemium-survey-components .input-container,\n.freemium-survey-components .textarea-container {\n display: flex;\n flex-direction: column;\n width: 100%;\n border-radius: 4px;\n position: relative;\n}\n.freemium-survey-components label.input-label {\n display: inline-block;\n padding-bottom: 8px;\n padding-left: 2px;\n font-size: 0.75rem;\n font-weight: 400;\n}\n.freemium-survey-components label.required::after {\n content: "*";\n position: relative;\n top: 2px;\n font-weight: 500;\n font-size: 0.85rem;\n padding-left: 3px;\n color: #d72d30;\n}\n.freemium-survey-components .input-basic {\n width: 100%;\n display: flex;\n align-items: center;\n border-radius: 4px;\n border: 1px solid var(--default-brand-color);\n border: 1px solid var(--brand-color, var(--default-brand-color));\n transition: border-color 0.2s linear;\n background: #fff;\n}\n.freemium-survey-components .textarea-container .input-basic {\n flex-direction: column;\n align-items: unset;\n}\n.freemium-survey-components .input-basic.error {\n border: 1px solid #d72d30;\n}\n.freemium-survey-components .input-basic.error:hover {\n border: 1px solid #d72d30;\n}\n.freemium-survey-components .input-basic.error[focus-within] {\n box-shadow: none;\n}\n.freemium-survey-components .input-basic.error:focus-within {\n box-shadow: none;\n}\n.freemium-survey-components .input-basic:hover {\n border-color: var(--default-brand-color);\n border-color: var(--brand-color, var(--default-brand-color));\n transition: 0.2s linear;\n}\n.freemium-survey-components .input-basic[focus-within] {\n border: 1px solid transparent;\n box-shadow: 0 0 0 2px var(--default-brand-color);\n box-shadow: 0 0 0 2px var(--brand-color, var(--default-brand-color));\n}\n.freemium-survey-components .input-basic:focus-within {\n border: 1px solid transparent;\n box-shadow: 0 0 0 2px var(--default-brand-color);\n box-shadow: 0 0 0 2px var(--brand-color, var(--default-brand-color));\n}\n.freemium-survey-components .end-max-length {\n padding: 0 8px;\n font-size: 0.75rem;\n color: #264966;\n}\n.freemium-survey-components .textarea-container .end-max-length {\n padding: 8px;\n align-self: flex-end;\n}\n.freemium-survey-components span.input-error {\n display: block;\n padding-left: 2px;\n padding-top: 4px;\n font-size: 0.9rem;\n color: #d72d30;\n}\n.freemium-survey-components input[type=text] {\n padding: 6px 12px;\n flex: 1;\n border: unset;\n height: 32px;\n font-size: 1rem;\n /* line-height: ${typography.input.text.lineHeight}; */\n border-radius: 4px;\n}\n.freemium-survey-components input[type=text],\n.freemium-survey-components textarea {\n outline: none;\n border: none;\n}\n.freemium-survey-components input[type=text]::-moz-placeholder {\n color: #92a2b2;\n font-weight: 400;\n font-size: 0.85rem;\n}\n.freemium-survey-components input[type=text]:-ms-input-placeholder {\n color: #92a2b2;\n font-weight: 400;\n font-size: 0.85rem;\n}\n.freemium-survey-components input[type=text]::placeholder {\n color: #92a2b2;\n font-weight: 400;\n font-size: 0.85rem;\n}\n.freemium-survey-components textarea {\n min-height: 116px;\n padding: 12px;\n flex: 1;\n border: unset;\n resize: none;\n font-size: 1rem;\n /* line-height: ${typography.input.text.lineHeight}; */\n border-radius: 4px;\n}\n.freemium-survey-components textarea::-moz-placeholder {\n color: #92a2b2;\n font-weight: 400;\n font-size: 0.85rem;\n}\n.freemium-survey-components textarea:-ms-input-placeholder {\n color: #92a2b2;\n font-weight: 400;\n font-size: 0.85rem;\n}\n.freemium-survey-components textarea::placeholder {\n color: #92a2b2;\n font-weight: 400;\n font-size: 0.85rem;\n}');const l=["RANGE","NPS","RADIO","DROPDOWN"],u={isRequired:!1,showCount:!0,isErrored:!1,inline:!1,spellCheck:!1,autoFocusInput:!0},d=t(((t,r)=>{const a=n(null);o((()=>{t.autoFocusInput&&setTimeout((()=>{a.current?.focus()}),600+t.autoFocusDelay)}),[t.autoFocusInput]);const{inputStyle:i,style:s,className:c,showCount:l,isErrored:u,startLabel:d,isRequired:p,errorText:m,endLabel:f,maxLength:v=300,onChange:h,autoFocusInput:x,...y}=t;return e.createElement("div",{className:"input-container",style:s},t.label&&e.createElement("label",{className:"input-label "+(p?"required":"")},t.label),e.createElement("div",null,d&&e.createElement("div",{className:"start-label"},d),e.createElement("div",{className:`input-basic ${u?"error":""}${c||""}`},e.createElement("input",Object.assign({},y,{type:"text",autoComplete:"off",ref:a,style:i,onChange:e=>{e.target.value?.length>v||h?.(e)}})),l&&v>0&&e.createElement("div",{className:"end-max-length"},`${t.value&&t.value.length||0}/${v}`)),f&&e.createElement("div",{className:"end-label"},f)),u&&m&&e.createElement("span",{className:"input-error"},t.errorText))})),p=t(((t,r)=>{const a=n(null);o((()=>{t.autoFocusInput&&setTimeout((()=>{a.current?.focus()}),600+t.autoFocusDelay)}),[t.autoFocusInput]);const{inputStyle:i,style:s,className:c,showCount:l,maxLength:u=1500,startLabel:d,isRequired:p,autoFocusInput:m,onChange:f,...v}=t;return e.createElement(e.Fragment,null,e.createElement("div",{className:"textarea-container",style:s},t.label&&e.createElement("label",{className:"input-label "+(p?"required":"")},t.label),d&&e.createElement("div",{className:"start-label"},d),e.createElement("div",{className:`input-basic ${c||""}`},e.createElement("textarea",Object.assign({},v,{autoComplete:"off",ref:a,style:i,onChange:e=>{e.target.value?.length>u||f?.(e)}})),l&&u&&u>0&&e.createElement("div",{className:"end-max-length"},`${t.value&&t.value.length||0}/${u}`)),t.endLabel&&e.createElement("div",{className:"end-label"},t.endLabel)))})),m=c(d,u),f=c(p,u);i('.freemium-survey-components .checkbox-group {\n width: 100%;\n display: flex;\n grid-gap: 12px;\n gap: 12px;\n flex-direction: column;\n white-space: nowrap;\n flex-wrap: wrap;\n}\n.freemium-survey-components .icon-container {\n display: inline-block;\n flex: 0 0 12px;\n width: 12px;\n height: 12px;\n min-width: 12px;\n min-height: 12px;\n color: inherit;\n position: absolute;\n left: 1px;\n top: 2px;\n}\n.freemium-survey-components .tick-icon {\n position: absolute;\n top: 0;\n right: 0;\n bottom: 0;\n left: 0;\n height: 100%;\n width: 100%;\n color: inherit;\n fill: currentColor;\n}\n.freemium-survey-components input[type=checkbox] {\n position: absolute;\n clip: rect(0px 0px 0px 0px);\n width: 0px;\n height: 0px;\n}\n.freemium-survey-components input[type=checkbox]:focus ~ .checkbox {\n /* box-shadow: ${pseudo.focus} 0px 0px 0px 2px; */\n box-shadow: var(--default-brand-color) 0px 0px 0px 2px;\n box-shadow: var(--brand-color, var(--default-brand-color)) 0px 0px 0px 2px;\n border-color: transparent;\n}\n.freemium-survey-components .checkbox-label {\n display: flex;\n align-items: baseline;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n text-align: left;\n opacity: 1;\n line-height: 1.2;\n cursor: pointer;\n font-size: 1rem;\n padding: 16px 24px;\n min-width: 200px;\n border: 1px solid #ebeff3;\n box-shadow: 0px 2px 5px rgba(18, 52, 77, 0.06);\n border-radius: 4px;\n white-space: pre-wrap;\n}\n.freemium-survey-components .checkbox-label:hover .checkbox {\n border-color: var(--default-brand-color);\n border-color: var(--brand-color, var(--default-brand-color));\n box-shadow: var(--default-background-color) 0px 0px 0px 5px;\n box-shadow: var(--background-color, var(--default-background-color)) 0px 0px 0px 5px;\n}\n.freemium-survey-components .checkbox-label.disabled {\n opacity: 0.5;\n cursor: "not-allowed";\n}\n.freemium-survey-components .checkbox {\n transition: background-color ease-in 0.2s;\n min-width: 14px;\n min-height: 14px;\n min-height: 14px;\n max-height: 14px;\n border-radius: 2px;\n position: relative;\n margin-right: 16px;\n background-color: #fff;\n border: 1px solid;\n text-align: left;\n border-color: var(--default-brand-color);\n border-color: var(--brand-color, var(--default-brand-color));\n}\n.freemium-survey-components .checkbox:hover {\n border-color: var(--default-brand-color);\n border-color: var(--brand-color, var(--default-brand-color));\n box-shadow: var(--default-background-color) 0px 0px 0px 5px;\n box-shadow: var(--background-color, var(--default-background-color)) 0px 0px 0px 5px;\n}\n.freemium-survey-components input[type=checkbox]:checked ~ .checkbox {\n background-color: var(--default-brand-color);\n background-color: var(--brand-color, var(--default-brand-color));\n border-color: var(--default-brand-color);\n border-color: var(--brand-color, var(--default-brand-color));\n}\n.freemium-survey-components input[type=checkbox]:checked ~ .checkbox:hover {\n border-color: var(--default-brand-color);\n border-color: var(--brand-color, var(--default-brand-color));\n}\n.freemium-survey-components input[type=checkbox]:disabled ~ .checkbox:hover {\n box-shadow: unset;\n border-color: unset;\n}');const v=()=>e.createElement("svg",{id:"tick",className:"tick-icon",xmlns:"http://www.w3.org/2000/svg","aria-labelledby":"title",viewBox:"0 0 10 10"},e.createElement("path",{d:"M3 5.87c-.18666814.00267463-.36667109-.06932655-.5-.2L.21 3.41c-.1786328-.17863279-.24839684-.43899577-.1830127-.6830127.06538414-.24401694.25598306-.43461586.5-.5C.77100423 2.16160316 1.0313672 2.23136721 1.21 2.41L3 4.18 6.8.33c.27679776-.27455556.72320224-.27455556 1 0 .13696438.13025306.21450026.31098915.21450026.5S7.93696438 1.19974694 7.8 1.33L3.45 5.67c-.12082534.11896945-.28072735.19003701-.45.2Z",fill:"#fff",fillRule:"evenodd"})),h=({values:t=[],othersValue:a="",options:i,name:s,autoFocusGroup:c,autoFocusDelay:l,onChangeHandler:u,saveOthersValue:d,othersOption:p,othersRequired:f})=>{const[v,h]=r(!1),y=n(null);return o((()=>{c&&setTimeout((()=>{y.current?.focus()}),600+l)}),[c]),e.createElement("div",{className:"checkbox-group"},e.createElement("button",{ref:y,className:"autofocus-button","aria-hidden":!0}),i?.map(((n,o)=>e.createElement(x,{key:n.id,checked:t?.includes(n.value),name:n.value,id:n.id,onChange:(e,o)=>{if(o)u([...t||[],n.value]);else{const e=t.indexOf(n.value);e>-1&&t.splice(e,1),u([...t])}}},n.value))),p&&e.createElement(x,{key:"others",checked:v,name:"others",id:"others",onChange:(e,n)=>{if(h(n),n)u([...t,"others"]);else{const e=t.findIndex((e=>"others"===e));t.splice(e,1),u(t)}}},"Others"),v&&e.createElement(e.Fragment,null,e.createElement(m,{placeholder:"Enter your comment",value:a[s],onChange:e=>{d(s,e.target.value)},autoFocusDelay:10,label:""})))},x=c((t=>{const r=n(null);return o((()=>{t.autoFocus&&setTimeout((()=>{r.current?.focus()}),620)}),[]),e.createElement("label",{className:`checkbox-label ${t.disabled&&"disabled"}`},e.createElement("input",{ref:r,id:t.id,type:"checkbox",name:t.name,readOnly:t.readOnly,disabled:t.disabled,"aria-disabled":t.disabled,checked:t.checked,onChange:t.readOnly?()=>{}:e=>t.onChange(e,e.target.checked)}),e.createElement("div",{className:"checkbox"},t.checked&&e.createElement("div",{className:"icon-container"},e.createElement(v,null)," ")),e.createElement("div",null,t.children))}),{checked:!1});i('.freemium-survey-components .radio-group {\n display: flex;\n grid-gap: 12px;\n gap: 12px;\n white-space: nowrap;\n flex-direction: column;\n width: 100%;\n}\n.freemium-survey-components .radio {\n background-color: #fff;\n border: 1px solid;\n border-color: var(--default-brand-color);\n border-color: var(--brand-color, var(--default-brand-color));\n transition: background-color ease-in 0.2s;\n min-width: 18px;\n max-width: 18px;\n min-height: 18px;\n max-height: 18px;\n border-radius: 50%;\n position: relative;\n margin-right: 16px;\n text-align: left;\n}\n.freemium-survey-components .radio:before {\n left: 3px;\n top: 3px;\n content: "";\n position: absolute;\n width: 10px;\n height: 10px;\n border-radius: 50%;\n transition: all ease-in 0.2s;\n background-color: #fff;\n}\n.freemium-survey-components .radio-label {\n display: flex;\n align-items: baseline;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n text-align: left;\n cursor: pointer;\n line-height: 1.2;\n font-size: 1rem;\n font-weight: 400;\n padding: 16px 24px;\n min-width: 200px;\n border: 1px solid #ebeff3;\n box-shadow: 0px 2px 5px rgba(18, 52, 77, 0.06);\n border-radius: 4px;\n white-space: pre-wrap;\n}\n.freemium-survey-components input[type=radio] {\n position: absolute;\n clip: rect(0, 0, 0, 0);\n width: 0px;\n height: 0px;\n}\n.freemium-survey-components input[type=radio]:focus ~ .radio {\n /* box-shadow: ${pseudo.focus} 0px 0px 0px 3px; */\n box-shadow: var(--default-brand-color) 0px 0px 0px 3px;\n box-shadow: var(--brand-color, var(--default-brand-color)) 0px 0px 0px 3px;\n border-color: transparent;\n}\n.freemium-survey-components input[type=radio]:checked ~ .radio:before {\n background-color: var(--default-brand-color);\n background-color: var(--brand-color, var(--default-brand-color));\n}\n.freemium-survey-components .radio-label:hover .radio {\n border-color: var(--default-brand-color);\n border-color: var(--brand-color, var(--default-brand-color));\n box-shadow: var(--default-background-color) 0px 0px 0px 5px;\n box-shadow: var(--background-color, var(--default-background-color)) 0px 0px 0px 5px;\n}');const y=({name:t,options:a,value:i,autoFocusGroup:s,autoFocusDelay:c,onChangeHandler:l,saveOthersValue:u,othersOption:d,othersRequired:p,othersValue:f})=>{const[v,h]=r(f??""),[x,y]=r(i),g=n(null);return o((()=>{s&&setTimeout((()=>{g.current?.focus()}),600+c)}),[s]),o((()=>{i||h("")}),[i]),o((()=>{x&&a.find((e=>e.value===x))&&x!==i&&l(x)}),[x]),e.createElement("div",{className:"radio-group",role:"radiogroup"},e.createElement("button",{ref:g,className:"autofocus-button","aria-hidden":!0,tabIndex:-1}),a?.map(((n,o)=>e.createElement(b,{key:n.value,value:n.value,name:t,onChange:e=>{y(e.currentTarget.value)},checked:x===n.value},n.value))),d&&e.createElement(b,{key:"others",value:"others",name:t,onChange:e=>{y("others")},checked:"others"===x},"Others"),"others"===x&&e.createElement(e.Fragment,null,e.createElement(m,{value:v,onChange:e=>h(e.target.value),placeholder:"Enter your comment",label:"",autoFocusDelay:10}),v!==i&&e.createElement(q,{inline:!0,disabled:p&&0===v.length,onClick:()=>{l("others"),u(t,v)}},"Next")))},b=c((t=>{const r=n(null);return o((()=>{t.autoFocus&&setTimeout((()=>{r.current?.focus()}),620)}),[]),e.createElement("label",{className:"radio-label"},e.createElement("input",{ref:r,type:"radio",name:t.name,value:t.value,checked:t.checked,onChange:t.onChange}),e.createElement("div",{className:"radio"}),e.createElement("div",null,t.children))}),{checked:!1,autoFocus:!1});i(".progressbar-container {\n width: 100%;\n height: 4px;\n position: fixed;\n top: 0;\n left: 0;\n z-index: 1;\n text-align: left;\n}\n\n.progressbar {\n transition: transform 0.25s linear;\n transform-origin: left;\n height: 100%;\n background-color: var(--default-brand-color);\n background-color: var(--brand-color, var(--default-brand-color));\n}");const g=n=>{const{totalSteps:t,completedSteps:o}=n;return e.createElement("div",{className:"progressbar-container"},e.createElement("div",{className:"progressbar",style:{width:(o>0?100/t:0)+"%",transform:`scaleX(${o})`}}))};i(".freemium-survey-components .action-button {\n width: auto;\n display: block;\n padding: 8px 16px;\n cursor: pointer;\n line-height: 1.5;\n text-align: center;\n font-weight: 500;\n letter-spacing: 0.3px;\n border-radius: 4px;\n white-space: nowrap;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n color: --default-button-text-color;\n color: var(--button-text-color, --default-button-text-color);\n background: var(--default-brand-color);\n background: var(--brand-color, var(--default-brand-color));\n border: 1px solid var(--default-brand-color);\n border: 1px solid var(--brand-color, var(--default-brand-color));\n border-radius: 4px;\n min-width: 200px;\n max-width: -webkit-fit-content;\n max-width: -moz-fit-content;\n max-width: fit-content;\n transform: translateY(0px);\n transition: transform ease 0.2s;\n}\n.freemium-survey-components .action-button:not([disabled]):hover {\n transform: translateY(-4px);\n}\n.freemium-survey-components .action-button[disabled] {\n cursor: not-allowed;\n opacity: 0.6;\n}\n.freemium-survey-components button:focus:not(:active) {\n /* box-shadow: 0 0 0 2px ${pseudo.focus}; */\n}\n\n@media (max-width: 550px) {\n .freemium-survey-components .action-button {\n min-width: 120px;\n }\n}\n.widget-survey-components .action-button {\n min-width: 120px;\n}\n\n.freemium-survey-components.mobile-preview .action-button {\n min-width: 120px;\n}");const w=()=>e.createElement(e.Fragment,null,"..."),k={LARGE:"large",MINI:"mini",NORMAL:"normal"},q=n=>{const{inline:t=!1,children:o,disabled:r,className:a="",htmlType:i,type:s="primary",onClick:c,size:l,overrideStyleClassName:u="",loading:d=!1,...p}=n;return e.createElement("button",Object.assign({style:t?{display:"inline-block"}:{},disabled:r,className:`action-button ${a} ${u}`,type:i,onClick:c},p),d?e.createElement(w,null):o)},E=()=>e.createElement("svg",{style:{display:"block"},width:"9",height:"14",viewBox:"0 0 10 16",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e.createElement("path",{d:"M7.82585 6.15754C7.98999 6.32147 8.08232 6.54389 8.08252 6.77587L8.08252 7.2192C8.07983 7.45069 7.98788 7.6722 7.82585 7.83754L1.82919 13.8225C1.77496 13.8772 1.71044 13.9206 1.63936 13.9502C1.56827 13.9798 1.49203 13.9951 1.41502 13.9951C1.33801 13.9951 1.26177 13.9798 1.19068 13.9502C1.1196 13.9206 1.05508 13.8772 1.00085 13.8225L0.172521 12.9942C0.118197 12.941 0.0750381 12.8774 0.0455752 12.8073C0.0161124 12.7372 0.000937578 12.6619 0.000937585 12.5859C0.000937592 12.5098 0.0161125 12.4345 0.0455753 12.3644C0.0750381 12.2943 0.118197 12.2308 0.172521 12.1775L5.36419 6.99754L0.172522 1.81754C0.117847 1.76331 0.0744506 1.69879 0.0448352 1.62771C0.0152208 1.55662 -2.75162e-05 1.48038 -2.75094e-05 1.40337C-2.75027e-05 1.32636 0.0152208 1.25012 0.0448353 1.17904C0.0744507 1.10795 0.117847 1.04343 0.172522 0.989205L1.00086 0.172537C1.05508 0.117862 1.1196 0.0744661 1.19069 0.0448507C1.26177 0.0152353 1.33801 -1.20337e-05 1.41502 -1.2027e-05C1.49203 -1.20203e-05 1.56827 0.0152353 1.63936 0.0448507C1.71044 0.0744661 1.77496 0.117862 1.82919 0.172537L7.82585 6.15754Z",fill:"#6B6B6B"})),C=()=>e.createElement("svg",{style:{display:"block"},width:"9",height:"14",viewBox:"0 0 10 16",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e.createElement("path",{d:"M0.256667 7.83755C0.0925257 7.67361 0.000204227 7.4512 0 7.21921V6.77588C0.00268801 6.5444 0.0946357 6.32289 0.256667 6.15755L6.25333 0.172549C6.30756 0.117874 6.37208 0.0744776 6.44316 0.0448625C6.51425 0.0152474 6.59049 0 6.6675 0C6.74451 0 6.82075 0.0152474 6.89184 0.0448625C6.96292 0.0744776 7.02744 0.117874 7.08167 0.172549L7.91 1.00088C7.96432 1.05411 8.00748 1.11764 8.03694 1.18776C8.06641 1.25787 8.08158 1.33316 8.08158 1.40922C8.08158 1.48527 8.06641 1.56056 8.03694 1.63067C8.00748 1.70079 7.96432 1.76432 7.91 1.81755L2.71833 6.99755L7.91 12.1775C7.96467 12.2318 8.00807 12.2963 8.03769 12.3674C8.0673 12.4385 8.08255 12.5147 8.08255 12.5917C8.08255 12.6687 8.0673 12.745 8.03769 12.8161C8.00807 12.8871 7.96467 12.9517 7.91 13.0059L7.08167 13.8225C7.02744 13.8772 6.96292 13.9206 6.89184 13.9502C6.82075 13.9799 6.74451 13.9951 6.6675 13.9951C6.59049 13.9951 6.51425 13.9799 6.44316 13.9502C6.37208 13.9206 6.30756 13.8772 6.25333 13.8225L0.256667 7.83755Z",fill:"#6B6B6B"})),_=({question:n,formValues:t,othersMeta:o,onChangeHandler:r,saveOthersValue:a,autoFocus:i,autoFocusDelay:c})=>{switch(n.type_info.question_type){case"RANGE":return e.createElement(s,{type_info:n.type_info,onChangeHandler:r,npsValue:t[n.name]});case"CHECKBOX":case"MULTI_SELECT":return e.createElement(h,{name:n.name,autoFocusGroup:i,values:t[n.name],othersValue:o[n.name],options:n.type_info.choices,onChangeHandler:r,saveOthersValue:a,othersOption:n.type_info.meta?.othersOption,othersRequired:n.type_info.meta?.othersRequired,autoFocusDelay:c});case"RADIO":case"DROPDOWN":return e.createElement(y,{autoFocusGroup:i,autoFocusDelay:c,name:n.name,onChangeHandler:r,saveOthersValue:a,options:n.type_info.choices,value:t[n.name],othersValue:o[n.name],othersOption:n.type_info.meta?.othersOption,othersRequired:n.type_info.meta?.othersRequired});case"INPUT":case"TEXT":return n.type_info?.meta?.readOnly?e.createElement("div",{className:"message-container"},n.type_info?.meta?.value):e.createElement("div",{className:"responsive-text-field"},e.createElement(m,{autoFocusInput:i,autoFocusDelay:c,label:"",isRequired:n.is_required,value:t[n.name]||"",placeholder:n.type_info?.meta?.placeholder??"",onChange:e=>r(e.target.value)}),e.createElement(f,{autoFocusInput:i,autoFocusDelay:c,label:"",isRequired:n.is_required,placeholder:n.type_info?.meta?.placeholder??"",value:t[n.name]||"",onChange:e=>r(e.target.value)}));case"PARAGRAPH":return e.createElement(f,{autoFocusInput:i,autoFocusDelay:c,label:"",isRequired:n.is_required,placeholder:n.type_info?.meta?.placeholder??"",value:t[n.name]||"",onChange:e=>r(e.target.value)});default:return console.error(`Question type ${n.type_info.question_type} not found`),null}},N=(e,n,t)=>{if(e){let o={"{{nps.score}}":t};n&&(o={...o,...n});const r=new RegExp(Object.keys(o).join("|"),"gi");e=e.replace(r,(function(e){return o[e.toLowerCase()]}))}return e};i(":root {\n --default-brand-color: #264966;\n --default-question-text-color: #000;\n --default-question-background-color: #fff;\n --default-background-color: #f8f8f8;\n --default-button-text-color: #fff;\n --default-secondary-button-text-color: #000;\n --default-input-placeholder-color: #92a2b1;\n --compact-widget-max-height: 560px;\n --default-widget-max-height: 400px;\n --cozy-widget-max-height: 380px;\n}\n\n.freemium-survey-step-navigation {\n padding: 0 2px;\n box-shadow: 0px 0px 6px #eee;\n white-space: nowrap;\n}\n.freemium-survey-step-navigation .navigation-button {\n width: 38px;\n text-align: -webkit-center;\n height: 38px;\n background-color: #fff;\n border: none;\n cursor: pointer;\n border-radius: 0 3px 3px 0;\n}\n.freemium-survey-step-navigation .navigation-button:first-of-type {\n border-right: 1px solid #d9d9d9;\n border-radius: 3px 0 0 3px;\n}\n.freemium-survey-step-navigation .navigation-button:disabled {\n cursor: not-allowed;\n opacity: 0.5;\n}\n.freemium-survey-step-navigation .navigation-button:focus {\n position: relative;\n z-index: 1;\n}\n\n.freemium-survey-components .question-container {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n text-align: center;\n max-width: 700px;\n margin: 0 auto;\n background: var(--default-question-background-color);\n background: var(--question-background-color, var(--default-question-background-color));\n border-radius: 4px;\n transition: transform 500ms ease 0ms, opacity 800ms ease 0ms;\n box-shadow: 0px 12px 15px rgba(18, 52, 77, 0.03);\n margin-bottom: 28px;\n padding: 28px;\n grid-gap: 28px;\n gap: 28px;\n position: relative;\n height: -webkit-fit-content;\n height: -moz-fit-content;\n height: fit-content;\n overflow: auto;\n opacity: 1;\n}\n.freemium-survey-components .hide-question-container {\n pointer-events: none;\n opacity: 0;\n}\n.freemium-survey-components .question-text {\n font-size: 1rem;\n font-weight: 600;\n line-height: 1.8;\n width: 100%;\n text-align: left;\n color: var(--default-question-text-color);\n color: var(--question-text-color, var(--default-question-text-color));\n}\n.freemium-survey-components .autofocus-button {\n border: none;\n width: 0;\n height: 0;\n opacity: 0;\n margin-top: -12px;\n margin-left: -12px;\n position: absolute;\n}\n@-webkit-keyframes opac {\n 0%, 50% {\n opacity: 0;\n }\n 100% {\n opacity: 1;\n }\n}\n@keyframes opac {\n 0%, 50% {\n opacity: 0;\n }\n 100% {\n opacity: 1;\n }\n}\n.freemium-survey-components .question-footer {\n display: flex;\n justify-content: flex-end;\n grid-gap: 40px;\n gap: 40px;\n width: 100%;\n align-items: center;\n}\n.freemium-survey-components .question-footer:empty {\n display: none;\n}\n.freemium-survey-components .action-buttons {\n display: flex;\n grid-gap: 20px;\n gap: 20px;\n flex-direction: row-reverse;\n}\n.freemium-survey-components .action-buttons:empty {\n display: none;\n}\n.freemium-survey-components .skip-button {\n font-weight: 400;\n cursor: pointer;\n background: transparent;\n border: none;\n min-width: 40px;\n padding: 8px 16px;\n border-radius: 4px;\n color: var(--default-secondary-button-text-color);\n color: var(--secondary-button-text-color, var(--default-secondary-button-text-color));\n letter-spacing: 0.05rem;\n line-height: 1.5;\n border: 1px solid transparent;\n}\n.freemium-survey-components .skip-button:hover {\n background-color: #f3f3f3;\n}\n.freemium-survey-components .next-button {\n color: var(--default-button-text-color);\n color: var(--button-text-color, var(--default-button-text-color));\n}\n.freemium-survey-components .submit {\n max-width: 700px;\n margin: 0 auto;\n text-align: left;\n background: transparent;\n box-shadow: none;\n color: var(--default-button-text-color);\n color: var(--button-text-color, var(--default-button-text-color));\n}\n.freemium-survey-components .thankyou {\n display: flex;\n align-items: center;\n justify-content: center;\n grid-gap: 20px;\n gap: 20px;\n min-height: 180px;\n}\n.freemium-survey-components .thankyou .heading {\n font-weight: 600;\n font-size: 28px;\n}\n.freemium-survey-components .thankyou .text {\n white-space: pre-wrap;\n font-weight: 500;\n font-size: 0.875rem;\n line-height: 1.6;\n color: #12344d;\n width: 75%;\n}\n.freemium-survey-components .thankyou .redirection-text {\n color: #929292;\n margin-bottom: 12px;\n font-weight: 300;\n}\n.freemium-survey-components .thankyou .link {\n width: 100%;\n display: inline-block;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n color: #666;\n font-weight: 500;\n text-decoration: underline;\n}\n.freemium-survey-components .responsive-text-field {\n width: 100%;\n}\n.freemium-survey-components .responsive-text-field .textarea-container {\n display: none;\n}\n.freemium-survey-components .message-container:empty {\n display: none;\n}\n\n@media (max-width: 550px) {\n .freemium-survey-component .responsive-text-field .input-container,\n.card-survey-style .responsive-text-field .input-container {\n display: none;\n }\n .freemium-survey-component .responsive-text-field .textarea-container,\n.card-survey-style .responsive-text-field .textarea-container {\n display: flex;\n }\n}\ndiv.widget-survey-components.compact-style .freemium-survey-step-navigation {\n padding: 0 2px;\n margin-left: 4px;\n box-shadow: 0px 0px 6px #eee;\n margin-top: 4px;\n}\ndiv.widget-survey-components.compact-style .nps-container .footer {\n padding-top: 12px;\n}\ndiv.widget-survey-components.compact-style .nps-container .choices {\n grid-gap: 12px;\n gap: 12px;\n}\n\ndiv.widget-survey-components,\ndiv.card-survey-style {\n display: flex;\n flex-direction: column;\n grid-gap: 28px;\n gap: 28px;\n flex-grow: 1;\n font-size: 0.875rem;\n overflow: hidden;\n}\ndiv.widget-survey-components .questions,\ndiv.card-survey-style .questions {\n min-width: 100%;\n max-width: 100%;\n display: flex;\n height: 100%;\n position: relative;\n max-height: 560px;\n max-height: var(--compact-widget-max-height);\n}\ndiv.widget-survey-components .question-text,\ndiv.card-survey-style .question-text {\n width: 100%;\n text-align: left;\n}\ndiv.widget-survey-components .focus-lock,\ndiv.card-survey-style .focus-lock {\n width: 100%;\n}\ndiv.widget-survey-components .question-container,\ndiv.card-survey-style .question-container {\n height: -webkit-fit-content;\n height: -moz-fit-content;\n height: fit-content;\n min-width: 100%;\n max-width: 100%;\n margin-bottom: 0;\n padding: 16px 28px;\n grid-gap: 16px;\n gap: 16px;\n flex-grow: 1;\n}\ndiv.widget-survey-components .question-footer,\ndiv.card-survey-style .question-footer {\n margin: 0px auto;\n justify-content: space-between;\n bottom: 0;\n padding-bottom: 20px;\n}\ndiv.widget-survey-components .submit,\ndiv.card-survey-style .submit {\n padding-bottom: 0;\n margin: unset;\n}\ndiv.widget-survey-components .nps-container .footer,\ndiv.card-survey-style .nps-container .footer {\n padding-top: 12px;\n}\ndiv.widget-survey-components .nps-container .widget .choices,\ndiv.card-survey-style .nps-container .widget .choices {\n grid-gap: 8px;\n gap: 8px;\n}\ndiv.widget-survey-components .radio-group,\ndiv.card-survey-style .radio-group {\n width: 100%;\n}\ndiv.widget-survey-components .checkbox-group,\ndiv.card-survey-style .checkbox-group {\n width: 100%;\n flex-wrap: nowrap;\n}\n\ndiv.widget-survey-components .question-container {\n box-shadow: none;\n border-radius: 0;\n}\ndiv.widget-survey-components .question-text {\n font-size: 0.875rem;\n}\ndiv.widget-survey-components .progressbar-container {\n position: absolute;\n}\ndiv.widget-survey-components .progressbar-container .progressbar {\n border-radius: 3px 0 0 0;\n}\ndiv.widget-survey-components .textarea-container .end-max-length {\n padding: 4px;\n}\ndiv.widget-survey-components .responsive-text-field .input-container {\n display: none;\n}\ndiv.widget-survey-components .responsive-text-field .textarea-container {\n display: flex;\n}\ndiv.widget-survey-components div.thankyou {\n min-height: unset;\n}\ndiv.widget-survey-components div.thankyou .text {\n width: 85%;\n}\ndiv.widget-survey-components div.thankyou svg {\n width: 140px;\n height: 120px;\n}\n\ndiv.widget-survey-components.default-style .freemium-survey-step-navigation {\n margin: 0;\n}\ndiv.widget-survey-components.default-style .questions {\n max-height: 400px;\n max-height: var(--default-widget-max-height);\n}\ndiv.widget-survey-components.default-style .question-container {\n padding: 12px 28px;\n}\ndiv.widget-survey-components.default-style .question-footer {\n justify-content: space-between;\n}\ndiv.widget-survey-components.default-style .nps-container .footer {\n padding-top: 12px;\n}\ndiv.widget-survey-components.default-style .nps-container .choices {\n flex-wrap: unset;\n grid-gap: 12px;\n gap: 12px;\n}\ndiv.widget-survey-components.default-style .action-button {\n line-height: 1.2;\n}\ndiv.widget-survey-components.default-style .radio-group {\n flex-direction: row;\n flex-wrap: wrap;\n}\ndiv.widget-survey-components.default-style .radio-group .radio-label {\n padding: 12px 16px;\n min-width: 160px;\n font-size: 0.9rem;\n}\ndiv.widget-survey-components.default-style .checkbox-group {\n flex-direction: row;\n flex-wrap: wrap;\n}\ndiv.widget-survey-components.default-style .checkbox-group .checkbox-label {\n padding: 12px 16px;\n min-width: 160px;\n font-size: 0.9rem;\n}\ndiv.widget-survey-components.default-style textarea {\n min-height: 84px;\n}\ndiv.widget-survey-components.default-style .end-max-length {\n font-size: 0.8rem;\n font-weight: 300;\n padding: 4px;\n}\n\n.widget-survey-components.cozy-style .freemium-survey-step-navigation {\n margin: 0;\n}\n.widget-survey-components.cozy-style .questions {\n max-height: 380px;\n max-height: var(--cozy-widget-max-height);\n}\n.widget-survey-components.cozy-style .question-text {\n font-size: 1rem;\n}\n.widget-survey-components.cozy-style .question-text.nps {\n text-align: center;\n width: 60%;\n min-width: 600px;\n margin: auto;\n}\n.widget-survey-components.cozy-style .question-container {\n padding: 12px 28px;\n}\n.widget-survey-components.cozy-style .question-footer {\n justify-content: space-between;\n}\n.widget-survey-components.cozy-style .nps-container {\n grid-gap: 44px;\n gap: 44px;\n}\n.widget-survey-components.cozy-style .nps-container .widget {\n display: flex;\n justify-content: center;\n}\n.widget-survey-components.cozy-style .nps-container .button-container {\n width: 60%;\n min-width: 600px;\n margin: 0 auto;\n}\n.widget-survey-components.cozy-style .nps-container .button-container .choices {\n justify-content: space-around;\n}\n.widget-survey-components.cozy-style .nps-container .footer {\n padding-top: 8px;\n}\n.widget-survey-components.cozy-style .action-button {\n line-height: 1.2;\n}\n.widget-survey-components.cozy-style .radio-group {\n flex-direction: row;\n flex-wrap: wrap;\n}\n.widget-survey-components.cozy-style .radio-group .radio-label {\n padding: 12px 16px;\n min-width: 160px;\n font-size: 0.9rem;\n}\n.widget-survey-components.cozy-style .checkbox-group {\n flex-direction: row;\n flex-wrap: wrap;\n}\n.widget-survey-components.cozy-style .checkbox-group .checkbox-label {\n padding: 12px 16px;\n min-width: 160px;\n font-size: 0.9rem;\n}\n.widget-survey-components.cozy-style textarea {\n min-height: 60px;\n}\n.widget-survey-components.cozy-style .end-max-length {\n font-size: 0.8rem;\n font-weight: 300;\n padding: 4px;\n}\n\n.freemium-survey-components.mobile-preview .thankyou .text {\n width: unset;\n}");const z=({thankYouQuestion:n,preview:t,placeholders:r,npsValue:a})=>(o((()=>{t||n.type_info.meta?.redirectUrl&&setTimeout((()=>{window.location.href=n.type_info.meta?.redirectUrl}),1e3*(n.type_info.meta?.redirectDelay??1e4))}),[]),e.createElement("div",{className:"question-container thankyou"},e.createElement("div",{className:"heading"},"Thank you!"),e.createElement("div",{className:"text",dangerouslySetInnerHTML:{__html:N(n.text,r,a)}}),n.type_info.meta?.redirectUrl&&e.createElement("div",{style:{width:"100%"}},e.createElement("div",{className:"redirection-text"},"You will be redirected to the below URL automatically in"," ",n.type_info.meta?.redirectDelay," seconds.",e.createElement("br",null)),e.createElement("a",{className:"link",href:n.type_info.meta?.redirectUrl},n?.type_info.meta?.redirectUrl)))),I=({currentBlockIndex:n,currentBlockIndexOfBlocksWithQns:t,blocksWithQns:o,blocks:r,setHorizontalScrollUnits:a,preventQuestionAnimation:i})=>e.createElement("div",{className:"freemium-survey-step-navigation","data-navigation-element":"1"},e.createElement("button",{disabled:0==t.current,className:"navigation-button",onClick:()=>{t.current=Math.max(t.current-1,0),n.current=r.findIndex((e=>e.name===o[t.current].name)),i.current=!1,a(t.current)}},e.createElement(C,null)),e.createElement("button",{className:"navigation-button",disabled:t.current>=o.length-1,onClick:()=>{i.current=!1,t.current=Math.min(t.current+1,o.length-1),n.current=r.findIndex((e=>e.name===o[t.current].name)),a(t.current)}},e.createElement(E,null))),S=({widget:n,widgetStyle:t,surveyStyle:o,formValues:r,othersMeta:a,blocksWithQns:i,blocks:s,thankYouQuestion:c,currentBlockIndexOfBlocksWithQns:u,currentBlockIndexOfBlocks:d,currentEditingBlock:p,isSubmitting:m,isValuesCommitted:f,isCurrentBlockFinal:v,setHorizontalScrollUnits:h,handleFormValues:x,skipBlock:y,setIsSubmitting:b,onSubmit:g,setIsSurveyCompleted:w,preventQuestionAnimation:k,preview:E,closePreview:C,..._})=>{const N=_.blockIndex??u.current,z=_.question??i[N].question,S=()=>z.name===p.current.question.name&&!l.includes(z.type_info.question_type)&&!v(),F=()=>"RANGE"!==z.type_info.question_type&&!z.required&&z.name===p.current.question.name&&!v(),O=()=>"DROPDOWN"===z.type_info.question_type&&z.name!==p.current.question.name&&!z.required&&null!=r[z.name],B=()=>v()&&(n||"standard"!==o)&&z.name===p.current.question.name,$="MULTI_SELECT"===p.current.question.type_info.question_type&&r[p.current.question.name]?.includes("others")&&(!a[p.current.question.name]||""===a[p.current.question.name]);return e.createElement("div",{className:"question-footer"},!(!n&&"standard"===o||0===N&&!r[z.name]||"compact"===t)&&e.createElement(I,{currentBlockIndex:d,currentBlockIndexOfBlocksWithQns:u,blocksWithQns:i,blocks:s,setHorizontalScrollUnits:h,preventQuestionAnimation:k}),(S()||O()||F()||B())&&e.createElement("div",{className:"action-buttons"},S()&&e.createElement(q,{onClick:()=>{x(i[N],null,!0)},disabled:p.current.question.required&&(!r[p.current.question.name]||Array.isArray(r[p.current.question.name])&&0===r[p.current.question.name].length)||p.current.question.type_info.meta?.othersRequired&&$,className:"next-button"},"Next"),F()&&e.createElement("button",{className:"skip-button",onClick:()=>y(z)},"Skip"),O()&&e.createElement("button",{className:"skip-button",onClick:()=>{p.current=i[N],d.current=s.findIndex((e=>e.name===i[N].name)),y(z)}},"Clear selection"),B()&&e.createElement("div",{className:"submit"},e.createElement(q,{disabled:(p.current.question.required||p.current.question.type_info.pivot_question)&&(null==r[p.current.question.name]||0===r[p.current.question.name]?.length)||p.current.question.type_info.meta?.othersRequired&&$||m,onClick:()=>{b(!0),g({...r,others_meta:a},(()=>{c?.type_info.meta?.skipThankYouPage?E?setTimeout((()=>{C?.()}),300):window.location.href=c?.type_info.meta?.redirectUrl:w(!0)}))}},m?"Submitting":"Submit Survey"))))},F=({survey:t,surveyStyle:i="standard",placeholders:s,onSubmit:c,widget:u,npsValue:d,widgetStyle:p,widgetNavigatorQuerySelector:m,preview:f,mobilePreview:v,closePreview:h})=>{const x=t.question_details?.questions||[],y=t.meta?.blocks||[],[b,w]=r(null),[k,E]=r({}),[C,F]=r(!1),[O,B]=r([]),[$,L]=r(0),[T,R]=r(!1),[D,V]=r(null),[A,H]=r({}),Q=n(null),j=n(null),P=n(-1),U=n(null),M=n(0),W=n(0),Y=n(!1),G=n([]),X=n(!!d&&"card"===i),K=n(null),Z=n([]);o((()=>{y&&(K.current=y.find((e=>"TY"===e.name)),w(y.filter((e=>"TY"!==e.name))))}),[y]),o((()=>{if(b)if(j.current=x.find((e=>e.type_info?.pivot_question))??x.find((e=>"RANGE"===e.type_info?.question_type))??x[0],null!=d){P.current=d;const e=x.find((e=>e.name===b[0].question_names[0]));Q.current={...b[0],question:e},G.current=[...G.current,{...b[0],question:e}],B(G.current),E({Q_1:d})}else if(!Q.current&&b.length>0)return Q.current=b[0],void ee(b[0])}),[b,d]),o((()=>{O.length&&(G.current=O,W.current=O.length-1),u||"standard"!==i?(U.current&&(U.current.style.maxHeight="unset"),Z.current[M.current]=U.current?.scrollHeight||Z.current[M.current]||0,U.current&&(U.current.style.maxHeight="100%")):U.current?.scrollIntoView({block:"center",behavior:"smooth"}),L(O.length-1)}),[O]),o((()=>{Object.keys(k).length>0&&Q.current.question&&(l.includes(Q.current.question.type_info.question_type)||Y.current)&&!J()&&ne()}),[k]),o((()=>{if(null!=k?.[j.current?.name])if(K.current?.is_based_on_score){const e=j.current?.type_info?.choices[k?.[j.current?.name]]?.dependent_question_names,n=K.current?.question_names.find((n=>e?.includes(n))),t=x.find((e=>e.name===n));V(t)}else{const e=x.find((e=>e.name==K.current?.question_names[0]));V(e)}}),[k?.[j.current?.name]]);const J=()=>M.current===b.length-1||"end"===Q.current.branchOption,ee=e=>{let n={};if(e.is_based_on_score){const t=j.current?.type_info?.choices[k?.[j.current?.name]]?.dependent_question_names,o=e.question_names.find((e=>t?.includes(e)));n=x.find((e=>e.name===o))}else n=x.find((n=>n.name===e.question_names[0]));Q.current.question=n;G.current.find((e=>e.question.name===n.name))?(L($+1),W.current+=1):B([...G.current,{...e,question:n}])},ne=()=>{if(J())F(!0);else{if(Q.current.nextBlock)M.current=b.findIndex((e=>e.name===Q.current.nextBlock));else if(Q.current.question.type_info?.meta?.branches){const e=Q.current.question.type_info?.meta?.branches,n=k[Q.current.question.name];let t;if(t="RANGE"===Q.current.question.type_info.question_type?e.find((e=>n>=e.min&&n<=e.max)):e.find((e=>n===e.value)),t?.nextBlock){if("TY"===t.nextBlock)return void F(!0);M.current=b.findIndex((e=>e.name===t.nextBlock))}else M.current+=1}else M.current+=1;Q.current=b[M.current],ee(b[M.current])}},te=e=>{Y.current=!0,delete k[e.name],E({...k})},oe=(e,n,t)=>{if(X.current=!1,t){if(Y.current=!0,null!=k[e.question.name]&&e.name!==O[O.length-1].name){const[t,o]=(e=>{const n=O.findIndex((n=>n.name===e.name)),t=O.slice(0,n+1),o=t.reduce(((e,n)=>(e[n.question.name]=k[n.question.name],e)),{});return M.current=b.findIndex((n=>n.name===e.name)),[t,o]})(e);E({...o,...null!=n&&{[e.question.name]:n}}),G.current=t}else E({...k,...null!=n&&{[e.question.name]:n}});j?.current?.name==e?.question?.name&&(P.current=n)}else E({...k,...null!=n&&{[e.question.name]:n}})},re=(e,n)=>{H({...A,[e]:n})};return Q.current&&Q.current.question?C?e.createElement("div",{className:`freemium-survey-components ${u?"widget-survey-components":""} ${p}-style ${v?"mobile-preview":""} ${i}-survey-style`,id:"freemium-survey"},e.createElement(z,{thankYouQuestion:D,preview:f,placeholders:s,npsValue:P.current})):e.createElement("div",{className:`freemium-survey-components ${u?"widget-survey-components":""} ${p}-style ${v?"mobile-preview":""} ${i}-survey-style`,id:"freemium-survey"},e.createElement(g,{totalSteps:b.length,completedSteps:M.current}),u&&"compact"===p&&document.querySelector(m)&&e.createElement(e.Fragment,null,a.createPortal(e.createElement("div",null,e.createElement(I,{currentBlockIndex:M,currentBlockIndexOfBlocksWithQns:W,blocksWithQns:O,blocks:b,setHorizontalScrollUnits:L,preventQuestionAnimation:X})),document.querySelector(m))),e.createElement("div",{style:u||"card"===i?{transform:`translateX(calc(-${$} * 100%))`,height:`${Z.current[M.current]}px`,transition:X.current||O?.length<=1?"none":"all 600ms ease-out 0ms"}:{},className:"questions"},O.map(((n,t)=>e.createElement("div",{key:n.question.name,ref:U,className:"question-container "+(!u&&"card"!==i||W.current===t?"":"hide-question-container")},e.createElement("div",{className:"question-text "+(0===t?"nps":""),dangerouslySetInnerHTML:{__html:N(n.question.text,s,P.current)},title:`question-${t}`,role:"heading","aria-level":1}),e.createElement("button",{disabled:!u&&"standard"===i,className:"autofocus-button",onKeyDown:e=>{"Tab"===e.key&&(e.stopPropagation(),e.preventDefault())}}),e.createElement(_,{question:n.question,formValues:k,othersMeta:A,autoFocus:W.current===t,autoFocusDelay:"standard"===i?350:20,saveOthersValue:re,onChangeHandler:e=>{Y.current=!1,M.current=b.findIndex((e=>e.name===n.name)),Q.current=n,oe(n,e,l.includes(n.question.type_info.question_type)&&!J())}}),e.createElement("button",{disabled:!u&&"standard"===i,className:"autofocus-button",onKeyDown:e=>{"Tab"===e.key&&(e.stopPropagation(),e.preventDefault())}}),e.createElement(S,{question:n.question,blockIndex:t,widget:u,widgetStyle:p,surveyStyle:i,formValues:k,othersMeta:A,blocksWithQns:O,blocks:b,thankYouQuestion:D,currentBlockIndexOfBlocksWithQns:W,currentBlockIndexOfBlocks:M,currentEditingBlock:Q,isSubmitting:T,isValuesCommitted:Y,isCurrentBlockFinal:J,setHorizontalScrollUnits:L,handleFormValues:oe,skipBlock:te,setIsSubmitting:R,onSubmit:c,setIsSurveyCompleted:F,preventQuestionAnimation:X,preview:f,closePreview:h})))),!u&&"card"!==i&&J()&&e.createElement("div",{className:"submit"},e.createElement(q,{disabled:(Q.current.question.required||Q.current.question.type_info.pivot_question)&&(null==k[Q.current.question.name]||0===k[Q.current.question.name]?.length)||Q.current.question.type_info.meta?.othersRequired&&"MULTI_SELECT"===Q.current.question.type_info.question_type&&k[Q.current.question.name]?.includes("")||T,onClick:()=>{R(!0),c({...k,others_meta:A},(()=>{D?.type_info.meta?.skipThankYouPage?f?setTimeout((()=>{h?.()}),300):window.location.href=D?.type_info.meta?.redirectUrl:F(!0)}))}},T?"Submitting":"Submit Survey")))):null};export{k as BUTTON_SIZE_VARIANTS,q as Button,h as CheckboxGroup,m as Input,s as NPS,g as ProgressBar,b as Radio,y as RadioGroup,F as StandardSurvey,f as TextArea};
|
|
@@ -24,8 +24,9 @@ interface RadioGroupInterface {
|
|
|
24
24
|
saveOthersValue: (questionName: string, inputValue: string) => void;
|
|
25
25
|
othersOption?: boolean;
|
|
26
26
|
othersRequired?: boolean;
|
|
27
|
+
othersValue: string;
|
|
27
28
|
}
|
|
28
|
-
declare const RadioGroup: ({ name, options, value, autoFocusGroup, autoFocusDelay, onChangeHandler, saveOthersValue, othersOption, othersRequired, }: RadioGroupInterface) => JSX.Element;
|
|
29
|
+
declare const RadioGroup: ({ name, options, value, autoFocusGroup, autoFocusDelay, onChangeHandler, saveOthersValue, othersOption, othersRequired, othersValue, }: RadioGroupInterface) => JSX.Element;
|
|
29
30
|
declare const Radio: React.ComponentType<Partial<{
|
|
30
31
|
checked: boolean;
|
|
31
32
|
autoFocus: boolean;
|
package/lib/types/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from './survey';
|
|
1
|
+
export * from './survey/standard';
|
|
2
2
|
export * from './components';
|
package/lib/types/mock.d.ts
CHANGED
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
export declare const newSurvey: {
|
|
2
|
-
id: string;
|
|
3
2
|
name: string;
|
|
4
3
|
desc: string;
|
|
5
4
|
type: string;
|
|
6
5
|
state: string;
|
|
7
|
-
is_active: boolean;
|
|
8
6
|
is_template: boolean;
|
|
9
7
|
question_details: {
|
|
10
8
|
questions: ({
|
|
@@ -14,8 +12,8 @@ export declare const newSurvey: {
|
|
|
14
12
|
position: number;
|
|
15
13
|
required: boolean;
|
|
16
14
|
type_info: {
|
|
17
|
-
driver: boolean;
|
|
18
15
|
comment: boolean;
|
|
16
|
+
driver: boolean;
|
|
19
17
|
question_type: string;
|
|
20
18
|
validation: {
|
|
21
19
|
min: number;
|
|
@@ -50,8 +48,9 @@ export declare const newSurvey: {
|
|
|
50
48
|
id: string;
|
|
51
49
|
}[];
|
|
52
50
|
branchType: string;
|
|
53
|
-
|
|
54
|
-
|
|
51
|
+
othersRequired?: undefined;
|
|
52
|
+
othersOption?: undefined;
|
|
53
|
+
placeholder?: undefined;
|
|
55
54
|
};
|
|
56
55
|
pivot_question: boolean;
|
|
57
56
|
};
|
|
@@ -62,13 +61,17 @@ export declare const newSurvey: {
|
|
|
62
61
|
position: number;
|
|
63
62
|
required: boolean;
|
|
64
63
|
type_info: {
|
|
65
|
-
driver: boolean;
|
|
66
64
|
comment: boolean;
|
|
65
|
+
driver: boolean;
|
|
67
66
|
question_type: string;
|
|
68
67
|
validation: null;
|
|
69
68
|
linear_scale: null;
|
|
70
69
|
score_presets: null;
|
|
71
|
-
choices:
|
|
70
|
+
choices: {
|
|
71
|
+
id: string;
|
|
72
|
+
position: string;
|
|
73
|
+
value: string;
|
|
74
|
+
}[];
|
|
72
75
|
footer_text: null;
|
|
73
76
|
meta: {
|
|
74
77
|
block: {
|
|
@@ -77,10 +80,11 @@ export declare const newSurvey: {
|
|
|
77
80
|
is_based_on_score: boolean;
|
|
78
81
|
question_names: string[];
|
|
79
82
|
};
|
|
83
|
+
othersRequired: boolean;
|
|
84
|
+
othersOption: boolean;
|
|
80
85
|
branches?: undefined;
|
|
81
86
|
branchType?: undefined;
|
|
82
|
-
|
|
83
|
-
redirectDelay?: undefined;
|
|
87
|
+
placeholder?: undefined;
|
|
84
88
|
};
|
|
85
89
|
pivot_question: boolean;
|
|
86
90
|
};
|
|
@@ -91,13 +95,17 @@ export declare const newSurvey: {
|
|
|
91
95
|
position: number;
|
|
92
96
|
required: boolean;
|
|
93
97
|
type_info: {
|
|
94
|
-
driver: boolean;
|
|
95
98
|
comment: boolean;
|
|
99
|
+
driver: boolean;
|
|
96
100
|
question_type: string;
|
|
97
101
|
validation: null;
|
|
98
102
|
linear_scale: null;
|
|
99
103
|
score_presets: null;
|
|
100
|
-
choices:
|
|
104
|
+
choices: {
|
|
105
|
+
id: string;
|
|
106
|
+
position: string;
|
|
107
|
+
value: string;
|
|
108
|
+
}[];
|
|
101
109
|
footer_text: null;
|
|
102
110
|
meta: null;
|
|
103
111
|
pivot_question: boolean;
|
|
@@ -109,8 +117,38 @@ export declare const newSurvey: {
|
|
|
109
117
|
position: number;
|
|
110
118
|
required: boolean;
|
|
111
119
|
type_info: {
|
|
120
|
+
comment: boolean;
|
|
112
121
|
driver: boolean;
|
|
122
|
+
question_type: string;
|
|
123
|
+
validation: null;
|
|
124
|
+
linear_scale: null;
|
|
125
|
+
score_presets: null;
|
|
126
|
+
choices: null;
|
|
127
|
+
footer_text: null;
|
|
128
|
+
meta: {
|
|
129
|
+
block: {
|
|
130
|
+
name: string;
|
|
131
|
+
title: string;
|
|
132
|
+
is_based_on_score: boolean;
|
|
133
|
+
question_names?: undefined;
|
|
134
|
+
};
|
|
135
|
+
placeholder: string;
|
|
136
|
+
branches?: undefined;
|
|
137
|
+
branchType?: undefined;
|
|
138
|
+
othersRequired?: undefined;
|
|
139
|
+
othersOption?: undefined;
|
|
140
|
+
};
|
|
141
|
+
pivot_question: boolean;
|
|
142
|
+
};
|
|
143
|
+
} | {
|
|
144
|
+
id: string;
|
|
145
|
+
text: string;
|
|
146
|
+
name: string;
|
|
147
|
+
position: number;
|
|
148
|
+
required: boolean;
|
|
149
|
+
type_info: {
|
|
113
150
|
comment: boolean;
|
|
151
|
+
driver: boolean;
|
|
114
152
|
question_type: string;
|
|
115
153
|
validation: null;
|
|
116
154
|
linear_scale: null;
|
|
@@ -124,10 +162,45 @@ export declare const newSurvey: {
|
|
|
124
162
|
is_based_on_score: boolean;
|
|
125
163
|
question_names?: undefined;
|
|
126
164
|
};
|
|
127
|
-
redirectUrl: string;
|
|
128
|
-
redirectDelay: string;
|
|
129
165
|
branches?: undefined;
|
|
130
166
|
branchType?: undefined;
|
|
167
|
+
othersRequired?: undefined;
|
|
168
|
+
othersOption?: undefined;
|
|
169
|
+
placeholder?: undefined;
|
|
170
|
+
};
|
|
171
|
+
pivot_question: boolean;
|
|
172
|
+
};
|
|
173
|
+
} | {
|
|
174
|
+
id: string;
|
|
175
|
+
text: string;
|
|
176
|
+
name: string;
|
|
177
|
+
position: number;
|
|
178
|
+
required: boolean;
|
|
179
|
+
type_info: {
|
|
180
|
+
comment: boolean;
|
|
181
|
+
driver: boolean;
|
|
182
|
+
question_type: string;
|
|
183
|
+
validation: null;
|
|
184
|
+
linear_scale: null;
|
|
185
|
+
score_presets: null;
|
|
186
|
+
choices: {
|
|
187
|
+
id: string;
|
|
188
|
+
position: string;
|
|
189
|
+
value: string;
|
|
190
|
+
}[];
|
|
191
|
+
footer_text: null;
|
|
192
|
+
meta: {
|
|
193
|
+
block: {
|
|
194
|
+
name: string;
|
|
195
|
+
title: string;
|
|
196
|
+
is_based_on_score: boolean;
|
|
197
|
+
question_names?: undefined;
|
|
198
|
+
};
|
|
199
|
+
branches?: undefined;
|
|
200
|
+
branchType?: undefined;
|
|
201
|
+
othersRequired?: undefined;
|
|
202
|
+
othersOption?: undefined;
|
|
203
|
+
placeholder?: undefined;
|
|
131
204
|
};
|
|
132
205
|
pivot_question: boolean;
|
|
133
206
|
};
|
|
@@ -1,133 +1,5 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
|
-
import './card.scss';
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
export
|
|
6
|
-
export declare const ACTIVE_FOCUS_LOCK_GROUP = "active-focus-lock-1";
|
|
7
|
-
interface SurveyProps {
|
|
8
|
-
survey: SurveyType;
|
|
9
|
-
surveyStyle?: 'standard' | 'card';
|
|
10
|
-
placeholders?: any;
|
|
11
|
-
npsValue?: number;
|
|
12
|
-
widget?: boolean;
|
|
13
|
-
widgetNavigatorQuerySelector?: string;
|
|
14
|
-
onSubmit: (data: {
|
|
15
|
-
[key: string]: any;
|
|
16
|
-
}, callback?: Function) => void;
|
|
17
|
-
widgetStyle?: 'default' | 'cozy' | 'compact';
|
|
18
|
-
preview?: boolean;
|
|
19
|
-
mobilePreview?: boolean;
|
|
20
|
-
closePreview?: () => void;
|
|
21
|
-
}
|
|
22
|
-
declare const Survey: {
|
|
23
|
-
(props: SurveyProps): JSX.Element;
|
|
24
|
-
displayName: string;
|
|
25
|
-
__docgenInfo: {
|
|
26
|
-
description: string;
|
|
27
|
-
displayName: string;
|
|
28
|
-
props: {
|
|
29
|
-
survey: {
|
|
30
|
-
defaultValue: null;
|
|
31
|
-
description: string;
|
|
32
|
-
name: string;
|
|
33
|
-
required: boolean;
|
|
34
|
-
type: {
|
|
35
|
-
name: string;
|
|
36
|
-
};
|
|
37
|
-
};
|
|
38
|
-
surveyStyle: {
|
|
39
|
-
defaultValue: {
|
|
40
|
-
value: string;
|
|
41
|
-
};
|
|
42
|
-
description: string;
|
|
43
|
-
name: string;
|
|
44
|
-
required: boolean;
|
|
45
|
-
type: {
|
|
46
|
-
name: string;
|
|
47
|
-
};
|
|
48
|
-
};
|
|
49
|
-
placeholders: {
|
|
50
|
-
defaultValue: null;
|
|
51
|
-
description: string;
|
|
52
|
-
name: string;
|
|
53
|
-
required: boolean;
|
|
54
|
-
type: {
|
|
55
|
-
name: string;
|
|
56
|
-
};
|
|
57
|
-
};
|
|
58
|
-
npsValue: {
|
|
59
|
-
defaultValue: null;
|
|
60
|
-
description: string;
|
|
61
|
-
name: string;
|
|
62
|
-
required: boolean;
|
|
63
|
-
type: {
|
|
64
|
-
name: string;
|
|
65
|
-
};
|
|
66
|
-
};
|
|
67
|
-
widget: {
|
|
68
|
-
defaultValue: null;
|
|
69
|
-
description: string;
|
|
70
|
-
name: string;
|
|
71
|
-
required: boolean;
|
|
72
|
-
type: {
|
|
73
|
-
name: string;
|
|
74
|
-
};
|
|
75
|
-
};
|
|
76
|
-
widgetNavigatorQuerySelector: {
|
|
77
|
-
defaultValue: null;
|
|
78
|
-
description: string;
|
|
79
|
-
name: string;
|
|
80
|
-
required: boolean;
|
|
81
|
-
type: {
|
|
82
|
-
name: string;
|
|
83
|
-
};
|
|
84
|
-
};
|
|
85
|
-
onSubmit: {
|
|
86
|
-
defaultValue: null;
|
|
87
|
-
description: string;
|
|
88
|
-
name: string;
|
|
89
|
-
required: boolean;
|
|
90
|
-
type: {
|
|
91
|
-
name: string;
|
|
92
|
-
};
|
|
93
|
-
};
|
|
94
|
-
widgetStyle: {
|
|
95
|
-
defaultValue: null;
|
|
96
|
-
description: string;
|
|
97
|
-
name: string;
|
|
98
|
-
required: boolean;
|
|
99
|
-
type: {
|
|
100
|
-
name: string;
|
|
101
|
-
};
|
|
102
|
-
};
|
|
103
|
-
preview: {
|
|
104
|
-
defaultValue: null;
|
|
105
|
-
description: string;
|
|
106
|
-
name: string;
|
|
107
|
-
required: boolean;
|
|
108
|
-
type: {
|
|
109
|
-
name: string;
|
|
110
|
-
};
|
|
111
|
-
};
|
|
112
|
-
mobilePreview: {
|
|
113
|
-
defaultValue: null;
|
|
114
|
-
description: string;
|
|
115
|
-
name: string;
|
|
116
|
-
required: boolean;
|
|
117
|
-
type: {
|
|
118
|
-
name: string;
|
|
119
|
-
};
|
|
120
|
-
};
|
|
121
|
-
closePreview: {
|
|
122
|
-
defaultValue: null;
|
|
123
|
-
description: string;
|
|
124
|
-
name: string;
|
|
125
|
-
required: boolean;
|
|
126
|
-
type: {
|
|
127
|
-
name: string;
|
|
128
|
-
};
|
|
129
|
-
};
|
|
130
|
-
};
|
|
131
|
-
};
|
|
132
|
-
};
|
|
133
|
-
export { Survey };
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import './card.scss';
|
|
3
|
+
import { SurveyProps } from '../types';
|
|
4
|
+
declare const CardSurvey: ({ survey, surveyStyle, placeholders, onSubmit, widget, npsValue, widgetStyle, widgetNavigatorQuerySelector, preview, mobilePreview, closePreview, }: SurveyProps) => JSX.Element | null;
|
|
5
|
+
export { CardSurvey };
|
|
@@ -1,25 +1,4 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import '
|
|
3
|
-
import { SurveyType } from '../types';
|
|
4
|
-
export declare const TRANSITION_DURATION: number;
|
|
5
|
-
export declare const AUTO_REDIRECT_DELAY = 10;
|
|
6
|
-
export declare const ACTIVE_FOCUS_LOCK_GROUP = "active-focus-lock-1";
|
|
7
|
-
interface SurveyProps {
|
|
8
|
-
survey: SurveyType;
|
|
9
|
-
surveyStyle?: 'standard' | 'card';
|
|
10
|
-
placeholders?: any;
|
|
11
|
-
npsValue?: number;
|
|
12
|
-
widget?: boolean;
|
|
13
|
-
widgetNavigatorQuerySelector?: string;
|
|
14
|
-
onSubmit: (data: {
|
|
15
|
-
[key: string]: any;
|
|
16
|
-
}, othersMeta: {
|
|
17
|
-
[key: string]: any;
|
|
18
|
-
}, callback?: Function) => void;
|
|
19
|
-
widgetStyle?: 'default' | 'cozy' | 'compact';
|
|
20
|
-
preview?: boolean;
|
|
21
|
-
mobilePreview?: boolean;
|
|
22
|
-
closePreview?: () => void;
|
|
23
|
-
}
|
|
2
|
+
import { SurveyProps } from '../types';
|
|
24
3
|
declare const Survey: (props: SurveyProps) => JSX.Element;
|
|
25
4
|
export { Survey };
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import './style.scss';
|
|
3
|
+
import { SurveyProps } from '../types';
|
|
4
|
+
declare const StandardSurvey: ({ survey, surveyStyle, placeholders, onSubmit, widget, npsValue, widgetStyle, widgetNavigatorQuerySelector, preview, mobilePreview, closePreview, }: SurveyProps) => JSX.Element | null;
|
|
5
|
+
export { StandardSurvey };
|
package/lib/types/types.d.ts
CHANGED
|
@@ -1,3 +1,18 @@
|
|
|
1
|
+
export interface SurveyProps {
|
|
2
|
+
survey: SurveyType;
|
|
3
|
+
surveyStyle?: 'standard' | 'card';
|
|
4
|
+
placeholders?: any;
|
|
5
|
+
npsValue?: number;
|
|
6
|
+
widget?: boolean;
|
|
7
|
+
widgetNavigatorQuerySelector?: string;
|
|
8
|
+
onSubmit: (data: {
|
|
9
|
+
[key: string]: any;
|
|
10
|
+
}, callback?: Function) => void;
|
|
11
|
+
widgetStyle?: 'default' | 'cozy' | 'compact';
|
|
12
|
+
preview?: boolean;
|
|
13
|
+
mobilePreview?: boolean;
|
|
14
|
+
closePreview?: () => void;
|
|
15
|
+
}
|
|
1
16
|
export declare type BlockType = {
|
|
2
17
|
name?: string;
|
|
3
18
|
title?: string;
|