@goodhood-web/nebenan-base 4.13.0-development.8 → 4.13.0-development.9
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/index.js +1 -1
- package/index.mjs +5 -6
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use strict";var EE=Object.defineProperty;var TE=(t,e,n)=>e in t?EE(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;var q=(t,e,n)=>TE(t,typeof e!="symbol"?e+"":e,n);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const h=require("react/jsx-runtime"),v=require("react"),C=require("@goodhood-web/ui"),ct=require("@goodhood-web/api/core"),zp=require("@goodhood-web/services/chargebee"),Pf=require("lodash"),he=require("react-hook-form"),Fp=require("@zxcvbn-ts/core"),hv=require("@hookform/resolvers"),Un=require("@goodhood-web/services/analytics"),Qe=require("@goodhood-web/services/snowplow"),je=require("@goodhood-web/api/core_v2"),de=require("zod"),ql=require("react-dom"),Kl=require("uuid"),vw=require("@tanstack/react-query"),ME=require("@goodhood-web/services/engagement");var Es=typeof document<"u"?document.currentScript:null;function bw(t){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const n in t)if(n!=="default"){const i=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(e,n,i.get?i:{enumerable:!0,get:()=>t[n]})}}return e.default=t,Object.freeze(e)}const y=bw(v),AE=bw(ql);function ww(t){var e,n,i="";if(typeof t=="string"||typeof t=="number")i+=t;else if(typeof t=="object")if(Array.isArray(t)){var r=t.length;for(e=0;e<r;e++)t[e]&&(n=ww(t[e]))&&(i&&(i+=" "),i+=n)}else for(n in t)t[n]&&(i&&(i+=" "),i+=n);return i}function X(){for(var t,e,n=0,i="",r=arguments.length;n<r;n++)(t=arguments[n])&&(e=ww(t))&&(i&&(i+=" "),i+=e);return i}const PE="_accordionBtnWrapper_nc5qt_146",zE="_heading_nc5qt_151",FE="_title_nc5qt_163",LE="_icon_nc5qt_180",jE="_iconExpanded_nc5qt_186",IE="_panel_nc5qt_194",Ts={accordionBtnWrapper:PE,heading:zE,title:FE,icon:LE,iconExpanded:jE,panel:IE},RE=({children:t,id:e,isOpen:n=!1,onClick:i,title:r})=>{const[a,s]=v.useState(n),o=()=>{s(l=>!l),i&&i()};return h.jsxs(h.Fragment,{children:[h.jsx("div",{className:Ts.accordionBtnWrapper,children:h.jsxs("button",{id:`accordion-header-${e}`,className:X(Ts.heading),"aria-expanded":a,"aria-controls":`accordion-panel-${e}`,"data-expanded":a,onClick:o,children:[h.jsx(C.Typography,{type:"body-semibold",as:"h3",className:Ts.title,"data-expanded":a,children:r}),h.jsx(C.Icon,{name:"chevron_down",size:"24",className:X(Ts.icon,{[Ts.iconExpanded]:a})})]})}),h.jsx("div",{id:`accordion-panel-${e}`,className:X(Ts.panel),"data-expanded":a,"aria-labelledby":`accordion-header-${e}`,hidden:!a,children:t})]})},NE="_root_54kt0_146",DE="_button_54kt0_149",BE="_thumbnail_54kt0_152",OE="_card_54kt0_155",HE="_cardBody_54kt0_164",WE="_text_54kt0_172",_E="_text__withIcon_54kt0_178",VE="_rightIcon_54kt0_182",zr={root:NE,button:DE,thumbnail:BE,card:OE,cardBody:HE,text:WE,text__withIcon:_E,rightIcon:VE},Lp=({description:t,headline:e,image:n,onClick:i,onDelete:r,url:a,withDeleteIcon:s=!1})=>{const o=a!=null&&a.startsWith("http")?a:`https://${a}`;return h.jsxs("div",{className:zr.root,children:[h.jsx(C.Button,{className:zr.button,onClick:i,href:o,target:"_blank",children:h.jsx(C.Card,{borderRadius:!0,withoutPadding:!0,className:zr.card,children:h.jsxs(C.CardBody,{className:zr.cardBody,children:[n&&h.jsx(C.Thumbnail,{className:zr.thumbnail,shape:"square",size:"64",alt:n.alt,src:n.src}),h.jsxs("div",{className:X(zr.text,{[zr.text__withIcon]:s}),children:[h.jsx(C.Typography,{type:"body-semibold",children:e}),h.jsx(C.Typography,{type:"detail-regular",children:a}),h.jsx(C.Typography,{type:"detail-regular",children:t})]})]})})}),s&&r&&h.jsx("div",{className:zr.rightIcon,children:h.jsx(C.IconButton,{icon:"cross_circle",size:"medium",ariaLabel:"delete attachment",onClick:r})})]})};var ve=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Zn(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function GE(t){if(t.__esModule)return t;var e=t.default;if(typeof e=="function"){var n=function i(){return this instanceof i?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)};n.prototype=e.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(t).forEach(function(i){var r=Object.getOwnPropertyDescriptor(t,i);Object.defineProperty(n,i,r.get?r:{enumerable:!0,get:function(){return t[i]}})}),n}function UE(t){var e=typeof t;return t!=null&&(e=="object"||e=="function")}var jp=UE,qE=typeof ve=="object"&&ve&&ve.Object===Object&&ve,KE=qE,ZE=KE,JE=typeof self=="object"&&self&&self.Object===Object&&self,QE=ZE||JE||Function("return this")(),yw=QE,YE=yw,XE=function(){return YE.Date.now()},$E=XE,eT=/\s/;function tT(t){for(var e=t.length;e--&&eT.test(t.charAt(e)););return e}var nT=tT,iT=nT,rT=/^\s+/;function aT(t){return t&&t.slice(0,iT(t)+1).replace(rT,"")}var sT=aT,oT=yw,lT=oT.Symbol,kw=lT,mv=kw,xw=Object.prototype,uT=xw.hasOwnProperty,cT=xw.toString,Qo=mv?mv.toStringTag:void 0;function dT(t){var e=uT.call(t,Qo),n=t[Qo];try{t[Qo]=void 0;var i=!0}catch{}var r=cT.call(t);return i&&(e?t[Qo]=n:delete t[Qo]),r}var fT=dT,hT=Object.prototype,mT=hT.toString;function pT(t){return mT.call(t)}var gT=pT,pv=kw,vT=fT,bT=gT,wT="[object Null]",yT="[object Undefined]",gv=pv?pv.toStringTag:void 0;function kT(t){return t==null?t===void 0?yT:wT:gv&&gv in Object(t)?vT(t):bT(t)}var xT=kT;function ST(t){return t!=null&&typeof t=="object"}var CT=ST,ET=xT,TT=CT,MT="[object Symbol]";function AT(t){return typeof t=="symbol"||TT(t)&&ET(t)==MT}var PT=AT,zT=sT,vv=jp,FT=PT,bv=NaN,LT=/^[-+]0x[0-9a-f]+$/i,jT=/^0b[01]+$/i,IT=/^0o[0-7]+$/i,RT=parseInt;function NT(t){if(typeof t=="number")return t;if(FT(t))return bv;if(vv(t)){var e=typeof t.valueOf=="function"?t.valueOf():t;t=vv(e)?e+"":e}if(typeof t!="string")return t===0?t:+t;t=zT(t);var n=jT.test(t);return n||IT.test(t)?RT(t.slice(2),n?2:8):LT.test(t)?bv:+t}var DT=NT,BT=jp,L1=$E,wv=DT,OT="Expected a function",HT=Math.max,WT=Math.min;function _T(t,e,n){var i,r,a,s,o,l,u=0,c=!1,f=!1,d=!0;if(typeof t!="function")throw new TypeError(OT);e=wv(e)||0,BT(n)&&(c=!!n.leading,f="maxWait"in n,a=f?HT(wv(n.maxWait)||0,e):a,d="trailing"in n?!!n.trailing:d);function m(M){var F=i,P=r;return i=r=void 0,u=M,s=t.apply(P,F),s}function p(M){return u=M,o=setTimeout(w,e),c?m(M):s}function b(M){var F=M-l,P=M-u,z=e-F;return f?WT(z,a-P):z}function g(M){var F=M-l,P=M-u;return l===void 0||F>=e||F<0||f&&P>=a}function w(){var M=L1();if(g(M))return k(M);o=setTimeout(w,b(M))}function k(M){return o=void 0,d&&i?m(M):(i=r=void 0,s)}function x(){o!==void 0&&clearTimeout(o),u=0,i=l=r=o=void 0}function T(){return o===void 0?s:k(L1())}function E(){var M=L1(),F=g(M);if(i=arguments,r=this,l=M,F){if(o===void 0)return p(l);if(f)return clearTimeout(o),o=setTimeout(w,e),m(l)}return o===void 0&&(o=setTimeout(w,e)),s}return E.cancel=x,E.flush=T,E}var Sw=_T;const Cw=Zn(Sw);var VT=Sw,GT=jp,UT="Expected a function";function qT(t,e,n){var i=!0,r=!0;if(typeof t!="function")throw new TypeError(UT);return GT(n)&&(i="leading"in n?!!n.leading:i,r="trailing"in n?!!n.trailing:r),VT(t,e,{leading:i,maxWait:e,trailing:r})}var KT=qT;const ZT=Zn(KT),Ao=799,JT=690,Jt=(t=Ao)=>{if(typeof window>"u"||typeof document>"u")return!1;const e=document.documentElement.clientWidth<=t;return("ontouchstart"in window||navigator.maxTouchPoints>0)&&e},ot=(t=JT)=>{const[e,n]=v.useState(void 0),i=v.useCallback(ZT(()=>{typeof window<"u"&&n(window.matchMedia(`(min-width: ${t}px)`).matches)},300),[t]);return v.useEffect(()=>{if(typeof window<"u")return i(),window.addEventListener("resize",i),()=>{window.removeEventListener("resize",i)}},[t,i]),e},Ew=t=>{if(!t)return 0;const e=t.split("/").pop(),n=Number(e);return isNaN(n)?0:n},QT=(t,e="de-DE")=>new Intl.NumberFormat(e,{currency:"EUR",style:"currency"}).format(t/100),Pl=t=>typeof t=="string"?t:t.src,Ne=(t,e="de-DE")=>t[e],En=(t,e,n="*****")=>{if(typeof e=="string"){const i=new RegExp(`\\{${e}\\}`,"g");return t.replace(i,n)}else return Object.entries(e).reduce((i,[r,a])=>{const s=new RegExp(`\\{${r}\\}`,"g");return i.replace(s,a)},t)},YT=(t,e,n="keypress")=>{v.useEffect(()=>{const i=Array.isArray(t)?t:[t],r=a=>{i.includes(a.key)&&(a.preventDefault(),e(a))};return window.addEventListener(n,r),()=>{window.removeEventListener(n,r)}},[t,e,n])};function Sd(t){if(!t)return null;const e=t.match(/^gid:\/\/([^/]+)\/([^/]+)\/(.+)$/);if(!e)return null;const[,n,i,r]=e,a=/^\d+$/.test(r)?parseInt(r,10):void 0;return{id:r,model:i,namespace:n,numericId:a}}function XT(t){const e=Sd(t);return(e==null?void 0:e.numericId)??null}function $T(t,e="de-DE",n="EUR"){if(t==null)return"Zu verschenken";const i=t/100;return new Intl.NumberFormat(e,{currency:n,maximumFractionDigits:2,minimumFractionDigits:0,style:"currency"}).format(i)}function eM(t,e="Zu verschenken"){return!t||t===0?e:$T(t)}function tM(){}var nM=tM;const Sl=Zn(nM),Tw=v.createContext({navigate:()=>Sl}),St=()=>{const{navigate:t}=v.useContext(Tw);return v.useCallback((e,n)=>{t(e,n)},[t])},Mw="data:image/webp;base64,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",iM="_sheet__header_114fy_146",rM="_sheet__content_114fy_153",aM="_sheet__content__sticker_114fy_166",sM="_sheet__content__headline_114fy_169",oM="_sheet__content__label_114fy_178",lM="_sheet__content__button_114fy_181",uM="_sheet__image_114fy_188",Tn={sheet__header:iM,sheet__content:rM,sheet__content__sticker:aM,sheet__content__headline:sM,"sheet__content__headline--error":"_sheet__content__headline--error_114fy_172",sheet__content__label:oM,sheet__content__button:lM,sheet__image:uM},cM={"de-DE":{loading:{title:"Dein Beitrag wird gleich hervorgehoben."},success:{label:"Die Zahlung war erfolgreich.",title:"Dein Angebot wird jetzt hervorgehoben.",cta:"Zum Marktplatz"},error:{text:`**Dein Angebot ist online, aber ohne Hervorhebung.**
|
|
2
|
-
Schließe jetzt deine Zahlung ab.`,title:"Zahlung unterbrochen",cta:"Zahlung abschließen"}}},Wa=Ne(cM),dM=()=>h.jsxs(h.Fragment,{children:[h.jsx("div",{className:Tn.sheet__image,children:h.jsx(C.Image,{src:Pl(Mw),alt:"highlight illustration"})}),h.jsx("div",{className:Tn.sheet__content,children:h.jsx(C.Typography,{type:"h3",className:Tn.sheet__content__label,children:Wa.loading.title})})]}),fM=()=>{const t=St(),e=()=>t("/feed/marketplace");return h.jsxs("div",{className:Tn.sheet__content,children:[h.jsx("div",{className:Tn.sheet__content__sticker,children:h.jsx(C.Sticker,{icon:"checkmark",size:"large",color:"green"})}),h.jsx(C.Typography,{type:"body-large",className:Tn.sheet__content__label,children:Wa.success.label}),h.jsx(C.Typography,{type:"h3",className:Tn.sheet__content__headline,children:Wa.success.title}),h.jsx("div",{className:Tn.sheet__content__button,children:h.jsx(C.ButtonPrimary,{text:Wa.success.cta,onClick:e,size:"medium"})})]})},hM=({onClick:t})=>h.jsxs("div",{className:Tn.sheet__content,children:[h.jsx("div",{className:Tn.sheet__content__sticker,children:h.jsx(C.Sticker,{icon:"error",size:"large",color:"orange"})}),h.jsxs("div",{className:Tn["sheet__content__headline--error"],children:[h.jsx(C.Typography,{type:"h3",children:Wa.error.title}),h.jsx(C.Typography,{type:"body-regular",markdown:!0,children:Wa.error.text})]}),h.jsx("div",{className:Tn.sheet__content__button,children:h.jsx(C.ButtonSecondary,{text:Wa.error.cta,onClick:t,size:"medium",color:"lavender"})})]}),Aw=({isLoading:t,onCheckout:e,onDismiss:n,open:i,paymentInterrupted:r})=>{const a=ot(800);return h.jsx(C.Sheet,{open:i,onDismiss:n,header:h.jsx("div",{className:Tn.sheet__header,children:!t&&h.jsx(C.IconButton,{icon:"cross",size:"medium",onClick:n})}),content:r?h.jsx(hM,{onClick:e}):t?h.jsx(dM,{}):h.jsx(fM,{}),footer:h.jsx(h.Fragment,{}),bottomSheet:!a,breakpoint:"800"})},mM=async(t,e)=>(await ct.API.getApi().POST("/api/core/v3/posts/{post_id}/payment_intent",{body:{payment_intent:{product_id:e}},params:{path:{post_id:Number(t)}}})).data,pM=async t=>{const e=await ct.API.getApi().GET("/api/core/v3/payment_intents/{payment_intent_id}/chargebee_confirmation/new",{params:{path:{payment_intent_id:t}}});if(!(e!=null&&e.data))throw new Error("No data returned from chargebee confirmation endpoint");return{expires_at:e.data.expires_at,id:e.data.hosted_page_id,url:e.data.checkout_url}},Pw=t=>{const[e,n]=v.useState(!1),[i,r]=v.useState(!1),[a,s]=v.useState(""),[o,l]=v.useState(null),[u,c]=v.useState(null),f=zp.useOpenCheckout(),d=v.useCallback(async(w,k,x)=>{const T=k!==(u==null?void 0:u.productId);if(x&&l(x),c({postId:w,productId:k}),!f){console.error("Chargebee checkout instance not available");return}let E=a;if(!a||T){if(!w||!k){console.error("Post ID or Product ID not provided");return}n(!0);try{const M=await mM(w,k);if(!M)return console.error("No payment intent ID returned from API");E=M.id,s(E)}catch{r(!0)}finally{n(!1)}}f({getHostedPage:async()=>pM(E),layout:"in_app",onClose:m,onError:m})},[f,a]),m=()=>{setTimeout(()=>{r(!0)},0)},p=()=>{r(!1),u&&d(u.postId,u.productId)},b=()=>{r(!1),o&&(t==null||t(o))};return{PremiumFeatureCheckoutModal:h.jsx(Aw,{isLoading:e,open:e||i,onDismiss:b,onCheckout:p,paymentInterrupted:i}),startCheckout:d}},gM=async t=>(await ct.API.getApi().GET("/api/core/v3/posts/{post_id}/payment_intent",{params:{path:{post_id:Number(t)}}})).data,vM=async(t,e)=>{const n=await ct.API.getApi().POST("/api/core/v3/payment_intents/{payment_intent_id}/chargebee_confirmation",{body:{chargebee:{hosted_page_id:t}},params:{path:{payment_intent_id:e}}});return n==null?void 0:n.data},bM=(t,e)=>{const[n,i]=v.useState(!1),[r,a]=v.useState(!1),s=v.useRef(!1);return v.useEffect(()=>{if(s.current)return;const l=new URLSearchParams(window.location.search).get("id");if(!l)return;let u=t;if(!u){const f=window.location.pathname.match(/\/feed\/(\d+)/);u=f==null?void 0:f[1]}if(!u)return;s.current=!0,a(!0),(async()=>{const f=await gM(u);if(!f){const m=new Error("No payment intent found");e==null||e.captureException(m,{hostedPageId:l,postId:u}),a(!1);return}if(!await vM(l,f.id)){const m=new Error("Payment confirmation returned empty response");e==null||e.captureException(m,{hostedPageId:l,paymentIntentId:f.id,postId:u}),a(!1);return}a(!1),i(!0)})().catch(f=>{e==null||e.captureException(f,{hostedPageId:l,postId:u}),a(!1)})},[t,e]),{isSuccess:n,loading:r}},wM=({isSuccess:t,loading:e})=>{const[n,i]=v.useState(!1),r=v.useCallback(()=>{
|
|
2
|
+
Schließe jetzt deine Zahlung ab.`,title:"Zahlung unterbrochen",cta:"Zahlung abschließen"}}},Wa=Ne(cM),dM=()=>h.jsxs(h.Fragment,{children:[h.jsx("div",{className:Tn.sheet__image,children:h.jsx(C.Image,{src:Pl(Mw),alt:"highlight illustration"})}),h.jsx("div",{className:Tn.sheet__content,children:h.jsx(C.Typography,{type:"h3",className:Tn.sheet__content__label,children:Wa.loading.title})})]}),fM=()=>{const t=St(),e=()=>t("/feed/marketplace");return h.jsxs("div",{className:Tn.sheet__content,children:[h.jsx("div",{className:Tn.sheet__content__sticker,children:h.jsx(C.Sticker,{icon:"checkmark",size:"large",color:"green"})}),h.jsx(C.Typography,{type:"body-large",className:Tn.sheet__content__label,children:Wa.success.label}),h.jsx(C.Typography,{type:"h3",className:Tn.sheet__content__headline,children:Wa.success.title}),h.jsx("div",{className:Tn.sheet__content__button,children:h.jsx(C.ButtonPrimary,{text:Wa.success.cta,onClick:e,size:"medium"})})]})},hM=({onClick:t})=>h.jsxs("div",{className:Tn.sheet__content,children:[h.jsx("div",{className:Tn.sheet__content__sticker,children:h.jsx(C.Sticker,{icon:"error",size:"large",color:"orange"})}),h.jsxs("div",{className:Tn["sheet__content__headline--error"],children:[h.jsx(C.Typography,{type:"h3",children:Wa.error.title}),h.jsx(C.Typography,{type:"body-regular",markdown:!0,children:Wa.error.text})]}),h.jsx("div",{className:Tn.sheet__content__button,children:h.jsx(C.ButtonSecondary,{text:Wa.error.cta,onClick:t,size:"medium",color:"lavender"})})]}),Aw=({isLoading:t,onCheckout:e,onDismiss:n,open:i,paymentInterrupted:r})=>{const a=ot(800);return h.jsx(C.Sheet,{open:i,onDismiss:n,header:h.jsx("div",{className:Tn.sheet__header,children:!t&&h.jsx(C.IconButton,{icon:"cross",size:"medium",onClick:n})}),content:r?h.jsx(hM,{onClick:e}):t?h.jsx(dM,{}):h.jsx(fM,{}),footer:h.jsx(h.Fragment,{}),bottomSheet:!a,breakpoint:"800"})},mM=async(t,e)=>(await ct.API.getApi().POST("/api/core/v3/posts/{post_id}/payment_intent",{body:{payment_intent:{product_id:e}},params:{path:{post_id:Number(t)}}})).data,pM=async t=>{const e=await ct.API.getApi().GET("/api/core/v3/payment_intents/{payment_intent_id}/chargebee_confirmation/new",{params:{path:{payment_intent_id:t}}});if(!(e!=null&&e.data))throw new Error("No data returned from chargebee confirmation endpoint");return{expires_at:e.data.expires_at,id:e.data.hosted_page_id,url:e.data.checkout_url}},Pw=t=>{const[e,n]=v.useState(!1),[i,r]=v.useState(!1),[a,s]=v.useState(""),[o,l]=v.useState(null),[u,c]=v.useState(null),f=zp.useOpenCheckout(),d=v.useCallback(async(w,k,x)=>{const T=k!==(u==null?void 0:u.productId);if(x&&l(x),c({postId:w,productId:k}),!f){console.error("Chargebee checkout instance not available");return}let E=a;if(!a||T){if(!w||!k){console.error("Post ID or Product ID not provided");return}n(!0);try{const M=await mM(w,k);if(!M)return console.error("No payment intent ID returned from API");E=M.id,s(E)}catch{r(!0)}finally{n(!1)}}f({getHostedPage:async()=>pM(E),layout:"in_app",onClose:m,onError:m})},[f,a]),m=()=>{setTimeout(()=>{r(!0)},0)},p=()=>{r(!1),u&&d(u.postId,u.productId)},b=()=>{r(!1),o&&(t==null||t(o))};return{PremiumFeatureCheckoutModal:h.jsx(Aw,{isLoading:e,open:e||i,onDismiss:b,onCheckout:p,paymentInterrupted:i}),startCheckout:d}},gM=async t=>(await ct.API.getApi().GET("/api/core/v3/posts/{post_id}/payment_intent",{params:{path:{post_id:Number(t)}}})).data,vM=async(t,e)=>{const n=await ct.API.getApi().POST("/api/core/v3/payment_intents/{payment_intent_id}/chargebee_confirmation",{body:{chargebee:{hosted_page_id:t}},params:{path:{payment_intent_id:e}}});return n==null?void 0:n.data},bM=(t,e)=>{const[n,i]=v.useState(!1),[r,a]=v.useState(!1),s=v.useRef(!1);return v.useEffect(()=>{if(s.current)return;const l=new URLSearchParams(window.location.search).get("id");if(!l)return;let u=t;if(!u){const f=window.location.pathname.match(/\/feed\/(\d+)/);u=f==null?void 0:f[1]}if(!u)return;s.current=!0,a(!0),(async()=>{const f=await gM(u);if(!f){const m=new Error("No payment intent found");e==null||e.captureException(m,{hostedPageId:l,postId:u}),a(!1);return}if(!await vM(l,f.id)){const m=new Error("Payment confirmation returned empty response");e==null||e.captureException(m,{hostedPageId:l,paymentIntentId:f.id,postId:u}),a(!1);return}a(!1),i(!0)})().catch(f=>{e==null||e.captureException(f,{hostedPageId:l,postId:u}),a(!1)})},[t,e]),{isSuccess:n,loading:r}},wM=({isSuccess:t,loading:e})=>{const[n,i]=v.useState(!1),[r,a]=v.useState(t),s=v.useCallback(()=>{const o=new URL(window.location.href);o.searchParams.delete("id"),o.searchParams.delete("state"),window.history.replaceState({},"",o.toString()),i(!1),a(!1)},[]);return r&&!n&&i(!0),h.jsx(Aw,{isLoading:e,open:n,onDismiss:s,onCheckout:Pf.noop,paymentInterrupted:!1})},yM="_root_n6fil_146",kM="_root__search_n6fil_149",yv={root:yM,root__search:kM};/*! *****************************************************************************
|
|
3
3
|
Copyright (c) Microsoft Corporation. All rights reserved.
|
|
4
4
|
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
|
|
5
5
|
this file except in compliance with the License. You may obtain a copy of the
|
package/index.mjs
CHANGED
|
@@ -598,17 +598,16 @@ const Xl = /* @__PURE__ */ ci(KA), Mk = qr({
|
|
|
598
598
|
isSuccess: t,
|
|
599
599
|
loading: e
|
|
600
600
|
}) => {
|
|
601
|
-
const [n, i] = _(!1), r = ye(() => {
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
a.searchParams.delete("id"), a.searchParams.delete("state"), window.history.replaceState({}, "", a.toString());
|
|
601
|
+
const [n, i] = _(!1), [r, a] = _(t), o = ye(() => {
|
|
602
|
+
const s = new URL(window.location.href);
|
|
603
|
+
s.searchParams.delete("id"), s.searchParams.delete("state"), window.history.replaceState({}, "", s.toString()), i(!1), a(!1);
|
|
605
604
|
}, []);
|
|
606
|
-
return
|
|
605
|
+
return r && !n && i(!0), /* @__PURE__ */ p(
|
|
607
606
|
Pk,
|
|
608
607
|
{
|
|
609
608
|
isLoading: e,
|
|
610
609
|
open: n,
|
|
611
|
-
onDismiss:
|
|
610
|
+
onDismiss: o,
|
|
612
611
|
onCheckout: dk,
|
|
613
612
|
paymentInterrupted: !1
|
|
614
613
|
}
|