@mhosaic/feedback 0.12.0 → 0.12.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/embed.min.js CHANGED
@@ -158,6 +158,17 @@
158
158
  after the modal becomes visible get stable coordinates. 220ms
159
159
  ease-out is snappy enough that human users barely register it. */
160
160
  animation: mfb-modal-in 220ms ease-out;
161
+ /* Transition lives on the BASE rule with a SHORTER duration so the
162
+ "back" trip (Board \u2192 other tab, where .is-expanded is removed)
163
+ feels snappy. The grow direction overrides this with a slower
164
+ curve in .modal.is-expanded below \u2014 the asymmetry is intentional:
165
+ a slow grow reads as a transport, a slow shrink reads as
166
+ hesitation. */
167
+ transition:
168
+ width 200ms cubic-bezier(0.4, 0, 0.2, 1),
169
+ height 200ms cubic-bezier(0.4, 0, 0.2, 1),
170
+ max-height 200ms cubic-bezier(0.4, 0, 0.2, 1),
171
+ padding 200ms cubic-bezier(0.4, 0, 0.2, 1);
161
172
  }
162
173
 
163
174
  @keyframes mfb-modal-in {
@@ -201,6 +212,14 @@
201
212
  display: flex;
202
213
  flex-direction: column;
203
214
  gap: var(--mfb-space-5);
215
+ /* Match the entrance motion the Board/MineList/Changelog containers
216
+ * use so switching tabs (especially Board \u2192 Send, where the modal
217
+ * is mid-shrink) doesn't show a content snap behind the transition.
218
+ * 40ms delay lets the modal's shrink finish first. */
219
+ animation: mfb-board-in 220ms ease-out 40ms both;
220
+ }
221
+ @media (prefers-reduced-motion: reduce) {
222
+ .modal form { animation: none; }
204
223
  }
205
224
 
206
225
  .modal-close {
@@ -1638,5 +1657,5 @@
1638
1657
  @media (prefers-reduced-motion: reduce) {
1639
1658
  .skeleton-line { animation: none; }
1640
1659
  }
1641
- `;function Kt(e){let t=e.host.attachShadow({mode:"open"}),r=document.createElement("style");r.textContent=$t,t.appendChild(r);let n=document.createElement("div");t.appendChild(n);let a={open:!1,status:"idle",tab:"send"};function i(p){a=p,Ie(Fe(l,{state:p}),n)}function s(p){let{selectedReportId:c,...m}=p;return m}function l({state:p}){var g;let c=wt(async w=>{i({...a,status:"submitting"});try{await e.onSubmit(w),i({...a,status:"success"}),setTimeout(()=>i({...a,open:!1,status:"idle",tab:e.api?"mine":"send"}),1200)}catch(h){i({...a,status:"error",error:h instanceof Error?h.message:String(h)})}},[]),m=(g=e.getExternalId)==null?void 0:g.call(e),d=e.showFAB&&(e.getExternalId===void 0?!0:!!m),y=!!(e.api&&m);return o(H,{children:[d&&o(Pt,{label:e.strings["fab.label"],onClick:()=>i({...a,open:!0})}),p.open&&o(Wt,{onDismiss:()=>i(s({...a,open:!1,status:"idle"})),closeLabel:e.strings["form.close"],expanded:p.tab==="board",children:[y&&o("div",{class:"tab-strip",role:"tablist",children:[o("button",{type:"button",role:"tab","aria-selected":p.tab==="send",class:`tab-button ${p.tab==="send"?"is-active":""}`,onClick:()=>i(s({...a,tab:"send"})),children:e.strings["tab.send"]}),o("button",{type:"button",role:"tab","aria-selected":p.tab==="mine",class:`tab-button ${p.tab==="mine"?"is-active":""}`,onClick:()=>i(s({...a,tab:"mine"})),children:e.strings["tab.mine"]}),o("button",{type:"button",role:"tab","aria-selected":p.tab==="changelog",class:`tab-button ${p.tab==="changelog"?"is-active":""}`,onClick:()=>i(s({...a,tab:"changelog"})),children:e.strings["tab.changelog"]}),o("button",{type:"button",role:"tab","aria-selected":p.tab==="board",class:`tab-button tab-button--board ${p.tab==="board"?"is-active":""}`,onClick:()=>i(s({...a,tab:"board"})),children:e.strings["tab.board"]})]}),p.tab==="send"&&o(Lt,{strings:e.strings,onSubmit:c,onCancel:()=>i({...a,open:!1,status:"idle"}),status:p.status,...p.error!==void 0&&{errorMessage:p.error}}),p.tab==="mine"&&e.api&&m&&!p.selectedReportId&&o(Dt,{api:e.api,externalId:m,strings:e.strings,onSelect:w=>i({...a,selectedReportId:w.id})}),(p.tab==="mine"||p.tab==="changelog")&&e.api&&m&&p.selectedReportId&&o(ge,{api:e.api,externalId:m,reportId:p.selectedReportId,strings:e.strings,onBack:()=>i(s({...a}))}),p.tab==="changelog"&&e.api&&m&&!p.selectedReportId&&o(Tt,{api:e.api,externalId:m,strings:e.strings,onSelect:w=>i({...a,selectedReportId:w.id})}),p.tab==="board"&&e.api&&m&&o(Mt,{api:e.api,externalId:m,strings:e.strings})]})]})}return i(a),{open(){i({...a,open:!0})},close(){i({...a,open:!1,status:"idle"})},dispose(){Ie(null,n),e.host.innerHTML=""},notifyIdentityChanged(){i({...a})}}}function Ke(e){var g,w,h,b,u;let t=(g=e.env)!=null?g:"prod",r=(w=e.locale)!=null?w:typeof navigator!="undefined"?navigator.language:void 0,n=Je((h=e.translations)!=null?h:{},r!==void 0?{locale:r}:{}),a=Ze({...e.sanitizeUrl!==void 0&&{sanitizeUrl:e.sanitizeUrl}}),i=je({apiKey:e.apiKey,endpoint:e.endpoint,...e.fetchImpl!==void 0&&{fetch:e.fetchImpl},...e.beforeSend!==void 0&&{beforeSend:e.beforeSend}}),s=e.user,l=(b=e.metadata)!=null?b:{},p=[],c=document.createElement("div");if(c.className="mhosaic-feedback",e.attachTo){let f=typeof e.attachTo=="string"?document.querySelector(e.attachTo):e.attachTo;f==null||f.appendChild(c)}else document.body.appendChild(c);async function m(f){var R,z,I,j,G;let x=f.synthetic?void 0:f.screenshot,S=a.snapshot();s&&(S.user=s),l&&Object.keys(l).length>0&&(S.metadata={...l});let E=x?(R=f.capture_method)!=null?R:"manual":"none",F={description:f.description,feedback_type:(z=f.feedback_type)!=null?z:"bug",severity:(I=f.severity)!=null?I:"medium",env:t,page_url:window.location.href,user_agent:navigator.userAgent,capture_method:E,technical_context:S};F.widget_version="0.12.0",x&&(F.screenshot=x),f.synthetic&&(F.synthetic=!0),(s==null?void 0:s.id)!==void 0&&s.id!==null&&s.id!==""&&(F.user={id:String(s.id),...s.email!==void 0&&{email:s.email},...s.name!==void 0&&{name:s.name}});let B=F;for(let K of p)B=await K(B);try{let K=await i.submitReport(B);return(j=e.onSubmitSuccess)==null||j.call(e,K),a.clear(),K}catch(K){let U=K instanceof Error?K:new Error(String(K));throw(G=e.onError)==null||G.call(e,U),U}}let d=Kt({host:c,strings:n,showFAB:(u=e.showFAB)!=null?u:!0,onSubmit:async f=>{await m(f)},api:i,getExternalId:()=>(s==null?void 0:s.id)!==void 0&&s.id!==null&&s.id!==""?String(s.id):void 0}),y={show(){d.open()},hide(){d.close()},open(f){d.open()},async submit(f){return m({description:f.description,...f.feedback_type!==void 0&&{feedback_type:f.feedback_type},...f.severity!==void 0&&{severity:f.severity},...f.synthetic!==void 0&&{synthetic:f.synthetic},...f.screenshot!==void 0&&{screenshot:f.screenshot}})},identify(f){s=f,d.notifyIdentityChanged()},setMetadata(f){l={...l,...f}},shutdown(){d.dispose(),a.dispose(),c.remove();let f=window;f.mhosaicFeedback===y&&delete f.mhosaicFeedback},_registerTransformer(f){p.push(f)}};return window.mhosaicFeedback=y,y}var Ut=window;function mo(){let e=document.currentScript;if(!e)return null;let t=e.dataset.key,r=e.dataset.endpoint;if(!t||!r)return null;let n=e.dataset.env;return{apiKey:t,endpoint:r,...n!==void 0&&{env:n}}}var X=null,Nt,jt,_e=(jt=(Nt=Ut.Feedback)==null?void 0:Nt.q)!=null?jt:[];function Ot(e){let[t,r]=e;if(t==="init"){if(X)return;X=Ke(r);return}if(!X){_e.push(e);return}t==="identify"?X.identify(r):t==="setMetadata"?X.setMetadata(r):t==="open"&&X.open(r)}var Ht=mo();Ht&&(X=Ke(Ht));for(;_e.length>0;)Ot(_e.shift());var bo=Object.assign(function(t,r){Ot([t,r])},{q:_e});Ut.Feedback=bo;})();
1660
+ `;function Kt(e){let t=e.host.attachShadow({mode:"open"}),r=document.createElement("style");r.textContent=$t,t.appendChild(r);let n=document.createElement("div");t.appendChild(n);let a={open:!1,status:"idle",tab:"send"};function i(p){a=p,Ie(Fe(l,{state:p}),n)}function s(p){let{selectedReportId:c,...m}=p;return m}function l({state:p}){var g;let c=wt(async w=>{i({...a,status:"submitting"});try{await e.onSubmit(w),i({...a,status:"success"}),setTimeout(()=>i({...a,open:!1,status:"idle",tab:e.api?"mine":"send"}),1200)}catch(h){i({...a,status:"error",error:h instanceof Error?h.message:String(h)})}},[]),m=(g=e.getExternalId)==null?void 0:g.call(e),d=e.showFAB&&(e.getExternalId===void 0?!0:!!m),y=!!(e.api&&m);return o(H,{children:[d&&o(Pt,{label:e.strings["fab.label"],onClick:()=>i({...a,open:!0})}),p.open&&o(Wt,{onDismiss:()=>i(s({...a,open:!1,status:"idle"})),closeLabel:e.strings["form.close"],expanded:p.tab==="board",children:[y&&o("div",{class:"tab-strip",role:"tablist",children:[o("button",{type:"button",role:"tab","aria-selected":p.tab==="send",class:`tab-button ${p.tab==="send"?"is-active":""}`,onClick:()=>i(s({...a,tab:"send"})),children:e.strings["tab.send"]}),o("button",{type:"button",role:"tab","aria-selected":p.tab==="mine",class:`tab-button ${p.tab==="mine"?"is-active":""}`,onClick:()=>i(s({...a,tab:"mine"})),children:e.strings["tab.mine"]}),o("button",{type:"button",role:"tab","aria-selected":p.tab==="changelog",class:`tab-button ${p.tab==="changelog"?"is-active":""}`,onClick:()=>i(s({...a,tab:"changelog"})),children:e.strings["tab.changelog"]}),o("button",{type:"button",role:"tab","aria-selected":p.tab==="board",class:`tab-button tab-button--board ${p.tab==="board"?"is-active":""}`,onClick:()=>i(s({...a,tab:"board"})),children:e.strings["tab.board"]})]}),p.tab==="send"&&o(Lt,{strings:e.strings,onSubmit:c,onCancel:()=>i({...a,open:!1,status:"idle"}),status:p.status,...p.error!==void 0&&{errorMessage:p.error}}),p.tab==="mine"&&e.api&&m&&!p.selectedReportId&&o(Dt,{api:e.api,externalId:m,strings:e.strings,onSelect:w=>i({...a,selectedReportId:w.id})}),(p.tab==="mine"||p.tab==="changelog")&&e.api&&m&&p.selectedReportId&&o(ge,{api:e.api,externalId:m,reportId:p.selectedReportId,strings:e.strings,onBack:()=>i(s({...a}))}),p.tab==="changelog"&&e.api&&m&&!p.selectedReportId&&o(Tt,{api:e.api,externalId:m,strings:e.strings,onSelect:w=>i({...a,selectedReportId:w.id})}),p.tab==="board"&&e.api&&m&&o(Mt,{api:e.api,externalId:m,strings:e.strings})]})]})}return i(a),{open(){i({...a,open:!0})},close(){i({...a,open:!1,status:"idle"})},dispose(){Ie(null,n),e.host.innerHTML=""},notifyIdentityChanged(){i({...a})}}}function Ke(e){var g,w,h,b,u;let t=(g=e.env)!=null?g:"prod",r=(w=e.locale)!=null?w:typeof navigator!="undefined"?navigator.language:void 0,n=Je((h=e.translations)!=null?h:{},r!==void 0?{locale:r}:{}),a=Ze({...e.sanitizeUrl!==void 0&&{sanitizeUrl:e.sanitizeUrl}}),i=je({apiKey:e.apiKey,endpoint:e.endpoint,...e.fetchImpl!==void 0&&{fetch:e.fetchImpl},...e.beforeSend!==void 0&&{beforeSend:e.beforeSend}}),s=e.user,l=(b=e.metadata)!=null?b:{},p=[],c=document.createElement("div");if(c.className="mhosaic-feedback",e.attachTo){let f=typeof e.attachTo=="string"?document.querySelector(e.attachTo):e.attachTo;f==null||f.appendChild(c)}else document.body.appendChild(c);async function m(f){var R,z,I,j,G;let x=f.synthetic?void 0:f.screenshot,S=a.snapshot();s&&(S.user=s),l&&Object.keys(l).length>0&&(S.metadata={...l});let E=x?(R=f.capture_method)!=null?R:"manual":"none",F={description:f.description,feedback_type:(z=f.feedback_type)!=null?z:"bug",severity:(I=f.severity)!=null?I:"medium",env:t,page_url:window.location.href,user_agent:navigator.userAgent,capture_method:E,technical_context:S};F.widget_version="0.12.1",x&&(F.screenshot=x),f.synthetic&&(F.synthetic=!0),(s==null?void 0:s.id)!==void 0&&s.id!==null&&s.id!==""&&(F.user={id:String(s.id),...s.email!==void 0&&{email:s.email},...s.name!==void 0&&{name:s.name}});let B=F;for(let K of p)B=await K(B);try{let K=await i.submitReport(B);return(j=e.onSubmitSuccess)==null||j.call(e,K),a.clear(),K}catch(K){let U=K instanceof Error?K:new Error(String(K));throw(G=e.onError)==null||G.call(e,U),U}}let d=Kt({host:c,strings:n,showFAB:(u=e.showFAB)!=null?u:!0,onSubmit:async f=>{await m(f)},api:i,getExternalId:()=>(s==null?void 0:s.id)!==void 0&&s.id!==null&&s.id!==""?String(s.id):void 0}),y={show(){d.open()},hide(){d.close()},open(f){d.open()},async submit(f){return m({description:f.description,...f.feedback_type!==void 0&&{feedback_type:f.feedback_type},...f.severity!==void 0&&{severity:f.severity},...f.synthetic!==void 0&&{synthetic:f.synthetic},...f.screenshot!==void 0&&{screenshot:f.screenshot}})},identify(f){s=f,d.notifyIdentityChanged()},setMetadata(f){l={...l,...f}},shutdown(){d.dispose(),a.dispose(),c.remove();let f=window;f.mhosaicFeedback===y&&delete f.mhosaicFeedback},_registerTransformer(f){p.push(f)}};return window.mhosaicFeedback=y,y}var Ut=window;function mo(){let e=document.currentScript;if(!e)return null;let t=e.dataset.key,r=e.dataset.endpoint;if(!t||!r)return null;let n=e.dataset.env;return{apiKey:t,endpoint:r,...n!==void 0&&{env:n}}}var X=null,Nt,jt,_e=(jt=(Nt=Ut.Feedback)==null?void 0:Nt.q)!=null?jt:[];function Ot(e){let[t,r]=e;if(t==="init"){if(X)return;X=Ke(r);return}if(!X){_e.push(e);return}t==="identify"?X.identify(r):t==="setMetadata"?X.setMetadata(r):t==="open"&&X.open(r)}var Ht=mo();Ht&&(X=Ke(Ht));for(;_e.length>0;)Ot(_e.shift());var bo=Object.assign(function(t,r){Ot([t,r])},{q:_e});Ut.Feedback=bo;})();
1642
1661
  //# sourceMappingURL=embed.min.js.map