@s_mart/nps 3.0.1 → 4.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +4 -4
- package/dist/index.mjs +4 -4
- package/package.json +7 -7
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var X=Object.create;var u=Object.defineProperty;var j=Object.getOwnPropertyDescriptor;var q=Object.getOwnPropertyNames;var I=Object.getPrototypeOf,Q=Object.prototype.hasOwnProperty;var R=(o,e)=>{for(var t in e)u(o,t,{get:e[t],enumerable:!0})},x=(o,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of q(e))!Q.call(o,i)&&i!==t&&u(o,i,{get:()=>e[i],enumerable:!(n=j(e,i))||n.enumerable});return o};var U=(o,e,t)=>(t=o!=null?X(I(o)):{},x(e||!o||!o.__esModule?u(t,"default",{value:o,enumerable:!0}):t,o)),H=o=>x(u({},"__esModule",{value:!0}),o);var K={};R(K,{NPS:()=>A});module.exports=H(K);var s=require("@s_mart/core"),y=require("@s_mart/form"),E=require("@s_mart/regular-icons");var c=require("@s_mart/core"),P=require("@s_mart/hooks"),b=require("@s_mart/tokens"),h=require("react-hook-form"),a=require("react/jsx-runtime"),L=({onSelecionarNota:o})=>{let{watch:e,setValue:t}=(0,h.useFormContext)(),n=(0,P.useMediaQuery)("(max-width: 500px)"),i=e("nota"),m=d=>{i!==d&&(t("nota",d),o?.(d))},l=(0,a.jsx)(c.Typography,{variant:"bodyXS",color:b.colorPalette.neutral[100],children:"Pouco prov\xE1vel"});return(0,a.jsxs)(a.Fragment,{children:[n&&(0,a.jsx)("div",{style:{marginBottom:"0.5rem"},children:l}),(0,a.jsx)("div",{style:{display:"flex",gap:"0.3rem",flexWrap:"wrap",justifyContent:"center"},children:Array(11).fill(void 0).map((d,p)=>(0,a.jsx)(c.Button,{variant:i===p?"contained":"outlined",style:{minWidth:"3rem"},onClick:()=>m(p),children:p},p))}),(0,a.jsxs)("div",{style:{display:"flex",justifyContent:"space-between",marginTop:"0.5rem"},children:[(0,a.jsx)("span",{children:!n&&l}),(0,a.jsx)(c.Typography,{variant:"bodyXS",color:b.colorPalette.neutral[100],children:"Muito prov\xE1vel"})]})]})},S=L;var g=require("@s_mart/form"),N=require("react/jsx-runtime"),O=({tipo:o,sistemaNome:e})=>(0,N.jsx)(g.TextField,{name:"feedback",placeholder:o==="promotor"?`Para mim o ${e} \xE9...`:"Eu acho que...",multiline:!0,size:"large",minRows:2}),k=O;var C=U(require("@emotion/styled")),F=require("@s_mart/tokens"),w=C.default.div`
|
|
2
2
|
display: flex;
|
|
3
3
|
flex-direction: column;
|
|
4
4
|
gap: 1rem;
|
|
@@ -6,8 +6,8 @@
|
|
|
6
6
|
padding: 1.5rem;
|
|
7
7
|
border-radius: 0.375rem;
|
|
8
8
|
box-shadow: 0px 0px 4px 0px rgba(0, 0, 0, 0.25);
|
|
9
|
-
border: 1px solid ${({theme:o})=>
|
|
10
|
-
background: ${
|
|
9
|
+
border: 1px solid ${({theme:o})=>o.palette.primary?.main};
|
|
10
|
+
background: ${F.colorPalette.neutral[0]};
|
|
11
11
|
|
|
12
12
|
position: absolute;
|
|
13
13
|
bottom: 1.5rem;
|
|
@@ -18,4 +18,4 @@
|
|
|
18
18
|
right: 1.25rem;
|
|
19
19
|
left: 1.25rem;
|
|
20
20
|
}
|
|
21
|
-
`;var
|
|
21
|
+
`;var z=require("react"),T=require("@s_mart/hooks"),_=({onEnviarNota:o})=>{let[e,t]=(0,z.useState)("selecionarNota"),n=(0,T.useNotification)();return{step:e,handleEnviar:(m,l)=>{e==="selecionarNota"?(o?.(m),m>=9?t("feedbackPromotor"):t("feedbackDetrator")):(l(),n.setNotification({variant:"success",title:"Avalia\xE7\xE3o enviada",message:"Agradecemos muito pela sua avalia\xE7\xE3o.",autoHideDuration:5e3}))}}},B=_;var f=require("zod"),G=f.z.object({nota:f.z.number(),feedback:f.z.string().optional(),autorizoPublicacao:f.z.coerce.boolean()}),$=G;var r=require("react/jsx-runtime"),J=({onFinalizar:o,mostrarBackdrop:e,sistemaNome:t,onClose:n,shouldCloseOnBackdropClick:i,onSelecionarNota:m,paperStyle:l,...d})=>{let{step:p,handleEnviar:V}=B(d),D={selecionarNota:`Qual a probabilidade de voc\xEA recomendar o ${t}?`,feedbackDetrator:`Como podemos melhorar a sua experi\xEAncia no ${t}?`,feedbackPromotor:`O que voc\xEA mais gosta no ${t}?`};return(0,r.jsx)(y.Form,{onSubmit:o,schema:$,children:({watch:M,onSubmit:W})=>{let v=M("nota");return(0,r.jsxs)(r.Fragment,{children:[!!e&&(0,r.jsx)(s.Backdrop,{open:!0,onClick:i?n:void 0,style:{zIndex:99}}),(0,r.jsxs)(w,{style:l,children:[(0,r.jsxs)("div",{style:{display:"flex",justifyContent:"space-between"},children:[(0,r.jsx)(s.Typography,{variant:"titleSM",children:D[p]}),(0,r.jsx)(s.LIcon,{icon:E.lineTimes,size:"25px",onClick:n,style:{cursor:"pointer"}})]}),(0,r.jsx)("div",{children:p==="selecionarNota"?(0,r.jsx)(S,{onSelecionarNota:m}):(0,r.jsx)(k,{tipo:p==="feedbackPromotor"?"promotor":"detrator",sistemaNome:t})}),(0,r.jsxs)("div",{style:{display:"flex",justifyContent:"space-between"},children:[(0,r.jsx)("div",{children:p==="feedbackPromotor"&&(0,r.jsx)(y.Checkbox,{name:"autorizoPublicacao",label:(0,r.jsxs)(s.Typography,{variant:"bodyXS",children:["Autorizo a publica\xE7\xE3o deste coment\xE1rio no site e em redes sociais do ",t]})})}),(0,r.jsx)(s.Button,{disabled:v===void 0,onClick:()=>V(v,W),children:"Enviar"})]})]})]})}})},A=J;0&&(module.exports={NPS});
|
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
import{Backdrop as I,Button as Q,LIcon as R,Typography as g}from"@s_mart/core";import{Checkbox as U,Form as H}from"@s_mart/form";import{lineTimes as L}from"@s_mart/regular-icons";import{Button as w,Typography as u}from"@s_mart/core";import{useMediaQuery as z}from"@s_mart/hooks";import{colorPalette as y}from"@s_mart/tokens";import{useFormContext as T}from"react-hook-form";import{Fragment as $,jsx as m,jsxs as b}from"react/jsx-runtime";var B=({onSelecionarNota:t})=>{let{watch:a,setValue:o}=T(),i=z("(max-width: 500px)"),l=a("nota"),n=s=>{l!==s&&(o("nota",s),t?.(s))},p=m(u,{variant:"bodyXS",color:y.neutral[100],children:"Pouco prov\xE1vel"});return b($,{children:[i&&m("div",{style:{marginBottom:"0.5rem"},children:p}),m("div",{style:{display:"flex",gap:"0.3rem",flexWrap:"wrap",justifyContent:"center"},children:Array(11).fill(void 0).map((s,r)=>m(w,{variant:l===r?"contained":"outlined",style:{minWidth:"3rem"},onClick:()=>n(r),children:r},r))}),b("div",{style:{display:"flex",justifyContent:"space-between",marginTop:"0.5rem"},children:[m("span",{children:!i&&p}),m(u,{variant:"bodyXS",color:y.neutral[100],children:"Muito prov\xE1vel"})]})]})},v=B;import{TextField as E}from"@s_mart/form";import{jsx as V}from"react/jsx-runtime";var A=({tipo:t,sistemaNome:a})=>V(E,{name:"feedback",placeholder:t==="promotor"?`Para mim o ${a} \xE9...`:"Eu acho que...",multiline:!0,size:"large",minRows:2}),x=A;import D from"@emotion/styled";import{colorPalette as M}from"@s_mart/tokens";var P=D.div`
|
|
2
2
|
display: flex;
|
|
3
3
|
flex-direction: column;
|
|
4
4
|
gap: 1rem;
|
|
@@ -6,8 +6,8 @@ var b=Object.getOwnPropertySymbols;var $=Object.prototype.hasOwnProperty,A=Objec
|
|
|
6
6
|
padding: 1.5rem;
|
|
7
7
|
border-radius: 0.375rem;
|
|
8
8
|
box-shadow: 0px 0px 4px 0px rgba(0, 0, 0, 0.25);
|
|
9
|
-
border: 1px solid ${({theme:
|
|
10
|
-
background: ${
|
|
9
|
+
border: 1px solid ${({theme:t})=>t.palette.primary?.main};
|
|
10
|
+
background: ${M.neutral[0]};
|
|
11
11
|
|
|
12
12
|
position: absolute;
|
|
13
13
|
bottom: 1.5rem;
|
|
@@ -18,4 +18,4 @@ var b=Object.getOwnPropertySymbols;var $=Object.prototype.hasOwnProperty,A=Objec
|
|
|
18
18
|
right: 1.25rem;
|
|
19
19
|
left: 1.25rem;
|
|
20
20
|
}
|
|
21
|
-
`;import{useState as
|
|
21
|
+
`;import{useState as W}from"react";import{useNotification as X}from"@s_mart/hooks";var j=({onEnviarNota:t})=>{let[a,o]=W("selecionarNota"),i=X();return{step:a,handleEnviar:(n,p)=>{a==="selecionarNota"?(t?.(n),n>=9?o("feedbackPromotor"):o("feedbackDetrator")):(p(),i.setNotification({variant:"success",title:"Avalia\xE7\xE3o enviada",message:"Agradecemos muito pela sua avalia\xE7\xE3o.",autoHideDuration:5e3}))}}},h=j;import{z as c}from"zod";var q=c.object({nota:c.number(),feedback:c.string().optional(),autorizoPublicacao:c.coerce.boolean()}),S=q;import{Fragment as G,jsx as e,jsxs as d}from"react/jsx-runtime";var O=({onFinalizar:t,mostrarBackdrop:a,sistemaNome:o,onClose:i,shouldCloseOnBackdropClick:l,onSelecionarNota:n,paperStyle:p,...s})=>{let{step:r,handleEnviar:k}=h(s),N={selecionarNota:`Qual a probabilidade de voc\xEA recomendar o ${o}?`,feedbackDetrator:`Como podemos melhorar a sua experi\xEAncia no ${o}?`,feedbackPromotor:`O que voc\xEA mais gosta no ${o}?`};return e(H,{onSubmit:t,schema:S,children:({watch:C,onSubmit:F})=>{let f=C("nota");return d(G,{children:[!!a&&e(I,{open:!0,onClick:l?i:void 0,style:{zIndex:99}}),d(P,{style:p,children:[d("div",{style:{display:"flex",justifyContent:"space-between"},children:[e(g,{variant:"titleSM",children:N[r]}),e(R,{icon:L,size:"25px",onClick:i,style:{cursor:"pointer"}})]}),e("div",{children:r==="selecionarNota"?e(v,{onSelecionarNota:n}):e(x,{tipo:r==="feedbackPromotor"?"promotor":"detrator",sistemaNome:o})}),d("div",{style:{display:"flex",justifyContent:"space-between"},children:[e("div",{children:r==="feedbackPromotor"&&e(U,{name:"autorizoPublicacao",label:d(g,{variant:"bodyXS",children:["Autorizo a publica\xE7\xE3o deste coment\xE1rio no site e em redes sociais do ",o]})})}),e(Q,{disabled:f===void 0,onClick:()=>k(f,F),children:"Enviar"})]})]})]})}})},_=O;export{_ as NPS};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@s_mart/nps",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "4.0.1",
|
|
4
4
|
"main": "./dist/index.js",
|
|
5
5
|
"module": "./dist/index.mjs",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -16,8 +16,8 @@
|
|
|
16
16
|
},
|
|
17
17
|
"dependencies": {
|
|
18
18
|
"tsup": "^6.7.0",
|
|
19
|
-
"typescript": "^5.
|
|
20
|
-
"@types/react": "18.2.
|
|
19
|
+
"typescript": "^5.2.2",
|
|
20
|
+
"@types/react": "^18.2.21",
|
|
21
21
|
"@types/react-dom": "18.2.4",
|
|
22
22
|
"@s_mart/core": "*",
|
|
23
23
|
"@s_mart/form": "*",
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
"react-dom": ">=18.2.0",
|
|
31
31
|
"react-hook-form": ">=7.36.1",
|
|
32
32
|
"@types/react": ">=18.2.5",
|
|
33
|
-
"@types/react-dom": ">=18.2.
|
|
33
|
+
"@types/react-dom": ">=18.2.7",
|
|
34
34
|
"@emotion/react": ">=11.10.8",
|
|
35
35
|
"@emotion/styled": ">=11.10.8",
|
|
36
36
|
"@s_mart/core": "*",
|
|
@@ -42,12 +42,12 @@
|
|
|
42
42
|
"zod": ">=3.21.4"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
|
-
"@s_mart/eslint": "*",
|
|
46
45
|
"@s_mart/tsconfig": "*",
|
|
47
46
|
"@s_mart/typed": "*",
|
|
48
|
-
"eslint": "^8.
|
|
47
|
+
"eslint": "^8.47.0",
|
|
48
|
+
"eslint-config-smarten": "*"
|
|
49
49
|
},
|
|
50
50
|
"publishConfig": {
|
|
51
51
|
"access": "public"
|
|
52
52
|
}
|
|
53
|
-
}
|
|
53
|
+
}
|