@s_mart/nps 4.0.1 → 4.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/package.json +3 -3
  2. package/dist/index.js +0 -21
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@s_mart/nps",
3
- "version": "4.0.1",
3
+ "version": "4.0.2",
4
4
  "main": "./dist/index.js",
5
5
  "module": "./dist/index.mjs",
6
6
  "types": "./dist/index.d.ts",
@@ -10,8 +10,8 @@
10
10
  "dist/**"
11
11
  ],
12
12
  "scripts": {
13
- "build": "tsup src/index.tsx --minify --format esm,cjs --dts --external react",
14
- "dev": "tsup src/index.tsx --format esm,cjs --watch --dts --external react",
13
+ "build": "tsup src/index.tsx --minify --format esm --dts --external react",
14
+ "dev": "tsup src/index.tsx --format esm --watch --dts --external react",
15
15
  "lint": "eslint src/**/*.ts* --fix"
16
16
  },
17
17
  "dependencies": {
package/dist/index.js DELETED
@@ -1,21 +0,0 @@
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
- display: flex;
3
- flex-direction: column;
4
- gap: 1rem;
5
-
6
- padding: 1.5rem;
7
- border-radius: 0.375rem;
8
- box-shadow: 0px 0px 4px 0px rgba(0, 0, 0, 0.25);
9
- border: 1px solid ${({theme:o})=>o.palette.primary?.main};
10
- background: ${F.colorPalette.neutral[0]};
11
-
12
- position: absolute;
13
- bottom: 1.5rem;
14
- right: 1.75rem;
15
- z-index: 102;
16
-
17
- @media (max-width: 650px) {
18
- right: 1.25rem;
19
- left: 1.25rem;
20
- }
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});