@strapi/admin 4.13.2 → 4.13.4

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.
@@ -79,8 +79,11 @@ const checkIfShouldShowSurvey = (settings) => {
79
79
  // Note that submitting a response resets the dismissal counts.
80
80
  // Checks 3 and 4 should not be reversed, since the first dismissal will also exist if the user has dismissed the survey twice or more before.
81
81
 
82
- // User hasn't enabled NPS feature
83
- if (!enabled) {
82
+ // For users who had created an account before the NPS feature was introduced,
83
+ // we assume that they would have enabled the NPS feature if they had the chance.
84
+
85
+ // User chose not to enable the NPS feature when signing up
86
+ if (enabled === false) {
84
87
  return false;
85
88
  }
86
89
 
@@ -1,4 +1,4 @@
1
- "use strict";(self.webpackChunk_strapi_admin=self.webpackChunk_strapi_admin||[]).push([[801],{7805:function(z,I,n){n.r(I),n.d(I,{default:function(){return _t}});var e=n(32735),o=n(45509),Z=n(33795),U=n.n(Z),C=n(20108),P={i8:"4.13.2"},D=n(79652),x=n(90869),b=n(87107),B=n(71933),p=n(87933),f=n(49372),v=n(72850),ae=n(50563),se=n(76437),oe=n(3685),Oe=n(98275),xe=n(33475),Q=n(41415),H=n(35331),re=n(92802),W=n(67879),S=n(8471),Y=n(24346),ke=n(22773);const Ne=(0,S.ZP)(b.g)`
1
+ "use strict";(self.webpackChunk_strapi_admin=self.webpackChunk_strapi_admin||[]).push([[801],{7805:function(z,I,n){n.r(I),n.d(I,{default:function(){return _t}});var e=n(32735),o=n(45509),Z=n(33795),U=n.n(Z),C=n(20108),P={i8:"4.13.4"},D=n(79652),x=n(90869),b=n(87107),B=n(71933),p=n(87933),f=n(49372),v=n(72850),ae=n(50563),se=n(76437),oe=n(3685),Oe=n(98275),xe=n(33475),Q=n(41415),H=n(35331),re=n(92802),W=n(67879),S=n(8471),Y=n(24346),ke=n(22773);const Ne=(0,S.ZP)(b.g)`
2
2
  height: ${32/16}rem;
3
3
  width: ${32/16}rem;
4
4
 
@@ -31,7 +31,7 @@
31
31
  background-color: ${({theme:t})=>t.colors.neutral0};
32
32
  border-color: ${({theme:t})=>t.colors.primary700};
33
33
  }
34
- `,K={postResponse:90*24*60*60*1e3,postFirstDismissal:7*24*60*60*1e3,postSubsequentDismissal:90*24*60*60*1e3,display:5*60*1e3},Ze=[...Array(11).keys()],Be=t=>{const{enabled:a,lastResponseDate:s,firstDismissalDate:i,lastDismissalDate:d}=t;return a?s?Date.now()-new Date(s).getTime()>=K.postResponse:d?Date.now()-new Date(d).getTime()>=K.postSubsequentDismissal:i?Date.now()-new Date(i).getTime()>=K.postFirstDismissal:!0:!1};var We=()=>{const t=(0,S.Fg)(),{formatMessage:a}=(0,W.Z)(),{npsSurveySettings:s,setNpsSurveySettings:i}=(0,ke.$)(),[d,u]=e.useState(!1),E=(0,o.lm)(),{currentEnvironment:m,strapiVersion:h}=(0,o.L7)(),{mutate:c,isLoading:M}=(0,C.useMutation)(async g=>{const y=await fetch("https://analytics.strapi.io/submit-nps",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(g)});if(!y.ok)throw new Error("Failed to submit NPS survey");return y},{onSuccess(){i(g=>({...g,lastResponseDate:new Date,firstDismissalDate:null,lastDismissalDate:null})),u(!0),setTimeout(()=>{k(!1)},3e3)},onError(){E({type:"warning",message:a({id:"notification.error"})})}}),[O,k]=e.useState(Be(s)),[F,N]=e.useState(!1);if(e.useEffect(()=>{const g=setTimeout(()=>{N(!0)},K.display);return()=>{clearTimeout(g)}},[]),!F||!O)return null;const R=({npsSurveyRating:g,npsSurveyFeedback:y})=>{const{email:A}=o.I8.getUserInfo();c({email:A,rating:g,comment:y,environment:m,version:h,license:window.strapi.projectType})},G=()=>{i(g=>{const y={...g,lastResponseDate:null};return g.firstDismissalDate?y.lastDismissalDate=new Date:y.firstDismissalDate=new Date,y}),k(!1)};return e.createElement(B.h,null,e.createElement(re.J9,{initialValues:{npsSurveyFeedback:"",npsSurveyRating:null},onSubmit:R,validationSchema:Y.Ry({npsSurveyFeedback:Y.Z_(),npsSurveyRating:Y.Rx().required()})},({values:g,handleChange:y,setFieldValue:A})=>e.createElement(re.l0,{name:"npsSurveyForm"},e.createElement(p.k,{hasRadius:!0,direction:"column",padding:4,borderColor:"primary200",background:"neutral0",shadow:"popupShadow",position:"fixed",bottom:0,left:"50%",transform:"translateX(-50%)",zIndex:t.zIndices[2],width:"50%"},d?e.createElement(f.Z,{fontWeight:"semiBold"},a({id:"app.components.NpsSurvey.feedback-response",defaultMessage:"Thank you very much for your feedback!"})):e.createElement(v.x,{as:"fieldset",width:"100%"},e.createElement(p.k,{justifyContent:"space-between",width:"100%"},e.createElement(v.x,{marginLeft:"auto",marginRight:"auto"},e.createElement(f.Z,{fontWeight:"semiBold",as:"legend"},a({id:"app.components.NpsSurvey.banner-title",defaultMessage:"How likely are you to recommend Strapi to a friend or colleague?"}))),e.createElement(ae.h,{onClick:G,"aria-label":a({id:"app.components.NpsSurvey.dismiss-survey-label",defaultMessage:"Dismiss survey"}),icon:e.createElement(H.Z,null)})),e.createElement(p.k,{gap:2,marginTop:2,marginBottom:2,justifyContent:"center"},e.createElement(f.Z,{variant:"pi",textColor:"neutral600"},a({id:"app.components.NpsSurvey.no-recommendation",defaultMessage:"Not at all likely"})),Ze.map(r=>e.createElement(Ne,{key:r,className:g.npsSurveyRating===r?"selected":null,hasRadius:!0,background:"primary100",borderColor:"primary200",color:"primary600",position:"relative",cursor:"pointer"},e.createElement(se.Q,{htmlFor:`nps-survey-rating-${r}-input`},e.createElement(oe.T,null,e.createElement(Oe._,{type:"radio",id:`nps-survey-rating-${r}-input`,name:"npsSurveyRating",checked:g.npsSurveyRating===r,onChange:L=>A("npsSurveyRating",parseInt(L.target.value,10)),value:r})),r))),e.createElement(f.Z,{variant:"pi",textColor:"neutral600"},a({id:"app.components.NpsSurvey.happy-to-recommend",defaultMessage:"Extremely likely"}))),g.npsSurveyRating!==null&&e.createElement(p.k,{direction:"column"},e.createElement(v.x,{marginTop:2},e.createElement(se.Q,{htmlFor:"npsSurveyFeedback",fontWeight:"semiBold",fontSize:2},a({id:"app.components.NpsSurvey.feedback-question",defaultMessage:"Do you have any suggestion for improvements?"}))),e.createElement(v.x,{width:"62%",marginTop:3,marginBottom:4},e.createElement(xe.g,{id:"npsSurveyFeedback",width:"100%",onChange:y},g.npsSurveyFeedback)),e.createElement(Q.z,{marginBottom:2,type:"submit",loading:M},a({id:"app.components.NpsSurvey.submit-feedback",defaultMessage:"Submit Feedback"}))))))))},Fe=n(74506),Ge=n(51968),V=n(15062),T=n(53038),Ue=n(88311),ie=n.n(Ue),$e=n(75974),le=n(67563),je=n(60216),l=n.n(je);const we=(0,S.ZP)(p.k)`
34
+ `,K={postResponse:90*24*60*60*1e3,postFirstDismissal:7*24*60*60*1e3,postSubsequentDismissal:90*24*60*60*1e3,display:5*60*1e3},Ze=[...Array(11).keys()],Be=t=>{const{enabled:a,lastResponseDate:s,firstDismissalDate:i,lastDismissalDate:d}=t;return a===!1?!1:s?Date.now()-new Date(s).getTime()>=K.postResponse:d?Date.now()-new Date(d).getTime()>=K.postSubsequentDismissal:i?Date.now()-new Date(i).getTime()>=K.postFirstDismissal:!0};var We=()=>{const t=(0,S.Fg)(),{formatMessage:a}=(0,W.Z)(),{npsSurveySettings:s,setNpsSurveySettings:i}=(0,ke.$)(),[d,u]=e.useState(!1),E=(0,o.lm)(),{currentEnvironment:m,strapiVersion:h}=(0,o.L7)(),{mutate:c,isLoading:M}=(0,C.useMutation)(async g=>{const y=await fetch("https://analytics.strapi.io/submit-nps",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(g)});if(!y.ok)throw new Error("Failed to submit NPS survey");return y},{onSuccess(){i(g=>({...g,lastResponseDate:new Date,firstDismissalDate:null,lastDismissalDate:null})),u(!0),setTimeout(()=>{k(!1)},3e3)},onError(){E({type:"warning",message:a({id:"notification.error"})})}}),[O,k]=e.useState(Be(s)),[F,N]=e.useState(!1);if(e.useEffect(()=>{const g=setTimeout(()=>{N(!0)},K.display);return()=>{clearTimeout(g)}},[]),!F||!O)return null;const R=({npsSurveyRating:g,npsSurveyFeedback:y})=>{const{email:A}=o.I8.getUserInfo();c({email:A,rating:g,comment:y,environment:m,version:h,license:window.strapi.projectType})},G=()=>{i(g=>{const y={...g,lastResponseDate:null};return g.firstDismissalDate?y.lastDismissalDate=new Date:y.firstDismissalDate=new Date,y}),k(!1)};return e.createElement(B.h,null,e.createElement(re.J9,{initialValues:{npsSurveyFeedback:"",npsSurveyRating:null},onSubmit:R,validationSchema:Y.Ry({npsSurveyFeedback:Y.Z_(),npsSurveyRating:Y.Rx().required()})},({values:g,handleChange:y,setFieldValue:A})=>e.createElement(re.l0,{name:"npsSurveyForm"},e.createElement(p.k,{hasRadius:!0,direction:"column",padding:4,borderColor:"primary200",background:"neutral0",shadow:"popupShadow",position:"fixed",bottom:0,left:"50%",transform:"translateX(-50%)",zIndex:t.zIndices[2],width:"50%"},d?e.createElement(f.Z,{fontWeight:"semiBold"},a({id:"app.components.NpsSurvey.feedback-response",defaultMessage:"Thank you very much for your feedback!"})):e.createElement(v.x,{as:"fieldset",width:"100%"},e.createElement(p.k,{justifyContent:"space-between",width:"100%"},e.createElement(v.x,{marginLeft:"auto",marginRight:"auto"},e.createElement(f.Z,{fontWeight:"semiBold",as:"legend"},a({id:"app.components.NpsSurvey.banner-title",defaultMessage:"How likely are you to recommend Strapi to a friend or colleague?"}))),e.createElement(ae.h,{onClick:G,"aria-label":a({id:"app.components.NpsSurvey.dismiss-survey-label",defaultMessage:"Dismiss survey"}),icon:e.createElement(H.Z,null)})),e.createElement(p.k,{gap:2,marginTop:2,marginBottom:2,justifyContent:"center"},e.createElement(f.Z,{variant:"pi",textColor:"neutral600"},a({id:"app.components.NpsSurvey.no-recommendation",defaultMessage:"Not at all likely"})),Ze.map(r=>e.createElement(Ne,{key:r,className:g.npsSurveyRating===r?"selected":null,hasRadius:!0,background:"primary100",borderColor:"primary200",color:"primary600",position:"relative",cursor:"pointer"},e.createElement(se.Q,{htmlFor:`nps-survey-rating-${r}-input`},e.createElement(oe.T,null,e.createElement(Oe._,{type:"radio",id:`nps-survey-rating-${r}-input`,name:"npsSurveyRating",checked:g.npsSurveyRating===r,onChange:L=>A("npsSurveyRating",parseInt(L.target.value,10)),value:r})),r))),e.createElement(f.Z,{variant:"pi",textColor:"neutral600"},a({id:"app.components.NpsSurvey.happy-to-recommend",defaultMessage:"Extremely likely"}))),g.npsSurveyRating!==null&&e.createElement(p.k,{direction:"column"},e.createElement(v.x,{marginTop:2},e.createElement(se.Q,{htmlFor:"npsSurveyFeedback",fontWeight:"semiBold",fontSize:2},a({id:"app.components.NpsSurvey.feedback-question",defaultMessage:"Do you have any suggestion for improvements?"}))),e.createElement(v.x,{width:"62%",marginTop:3,marginBottom:4},e.createElement(xe.g,{id:"npsSurveyFeedback",width:"100%",onChange:y},g.npsSurveyFeedback)),e.createElement(Q.z,{marginBottom:2,type:"submit",loading:M},a({id:"app.components.NpsSurvey.submit-feedback",defaultMessage:"Submit Feedback"}))))))))},Fe=n(74506),Ge=n(51968),V=n(15062),T=n(53038),Ue=n(88311),ie=n.n(Ue),$e=n(75974),le=n(67563),je=n(60216),l=n.n(je);const we=(0,S.ZP)(p.k)`
35
35
  position: fixed;
36
36
  z-index: 4;
37
37
  inset: 0;
package/build/index.html CHANGED
@@ -1 +1 @@
1
- <!doctype html><html lang="en"><head><meta charset="utf-8"/><meta name="viewport" content="width=device-width,initial-scale=1"/><meta name="mobile-web-app-capable" content="yes"/><title>Strapi Admin</title><script defer="defer" src="/admin/runtime~main.ec4717bd.js"></script><script defer="defer" src="/admin/main.0b88b960.js"></script></head><body><div style="min-height:100%" id="app"></div></body></html>
1
+ <!doctype html><html lang="en"><head><meta charset="utf-8"/><meta name="viewport" content="width=device-width,initial-scale=1"/><meta name="mobile-web-app-capable" content="yes"/><title>Strapi Admin</title><script defer="defer" src="/admin/runtime~main.de9b894e.js"></script><script defer="defer" src="/admin/main.5a7255d6.js"></script></head><body><div style="min-height:100%" id="app"></div></body></html>