@goodhood-web/nebenan-base 4.5.0-development.21 → 4.5.0-development.22

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 (3) hide show
  1. package/index.js +1 -1
  2. package/index.mjs +7 -6
  3. package/package.json +1 -1
package/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  "use strict";var hC=Object.defineProperty;var mC=(t,e,n)=>e in t?hC(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;var Pe=(t,e,n)=>mC(t,typeof e!="symbol"?e+"":e,n);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const h=require("react/jsx-runtime"),b=require("react"),E=require("@goodhood-web/ui"),gt=require("@goodhood-web/api/core"),Qm=require("@goodhood-web/services/chargebee"),tf=require("lodash"),fe=require("react-hook-form"),Ym=require("@zxcvbn-ts/core"),j2=require("@hookform/resolvers"),Bn=require("@goodhood-web/services/analytics"),Xm=require("@goodhood-web/services/snowplow"),Ae=require("@goodhood-web/api/core_v2"),de=require("zod"),Cl=require("react-dom"),gC=require("@tanstack/react-query"),pC=require("@goodhood-web/services/engagement");var ds=typeof document<"u"?document.currentScript:null;function L5(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 k=L5(b),vC=L5(Cl);function j5(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=j5(t[e]))&&(i&&(i+=" "),i+=n)}else for(n in t)t[n]&&(i&&(i+=" "),i+=n);return i}function ee(){for(var t,e,n=0,i="",r=arguments.length;n<r;n++)(t=arguments[n])&&(e=j5(t))&&(i&&(i+=" "),i+=e);return i}const bC="_accordionBtnWrapper_o75yb_146",wC="_heading_o75yb_151",kC="_title_o75yb_163",yC="_icon_o75yb_180",xC="_iconExpanded_o75yb_186",SC="_panel_o75yb_194",fs={accordionBtnWrapper:bC,heading:wC,title:kC,icon:yC,iconExpanded:xC,panel:SC},CC=({children:t,id:e,isOpen:n=!1,onClick:i,title:r})=>{const[a,s]=b.useState(n),o=()=>{s(l=>!l),i&&i()};return h.jsxs(h.Fragment,{children:[h.jsx("div",{className:fs.accordionBtnWrapper,children:h.jsxs("button",{id:`accordion-header-${e}`,className:ee(fs.heading),"aria-expanded":a,"aria-controls":`accordion-panel-${e}`,"data-expanded":a,onClick:o,children:[h.jsx(E.Typography,{type:"body-semibold",as:"h3",className:fs.title,"data-expanded":a,children:r}),h.jsx(E.Icon,{name:"chevron_down",size:"24",className:ee(fs.icon,{[fs.iconExpanded]:a})})]})}),h.jsx("div",{id:`accordion-panel-${e}`,className:ee(fs.panel),"data-expanded":a,"aria-labelledby":`accordion-header-${e}`,hidden:!a,children:t})]})},EC="_root_14q7u_146",TC="_button_14q7u_149",MC="_thumbnail_14q7u_152",AC="_card_14q7u_155",PC="_cardBody_14q7u_164",FC="_text_14q7u_172",zC="_text__withIcon_14q7u_178",LC="_rightIcon_14q7u_182",Cr={root:EC,button:TC,thumbnail:MC,card:AC,cardBody:PC,text:FC,text__withIcon:zC,rightIcon:LC},$m=({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:Cr.root,children:[h.jsx(E.Button,{className:Cr.button,onClick:i,href:o,target:"_blank",children:h.jsx(E.Card,{borderRadius:!0,withoutPadding:!0,className:Cr.card,children:h.jsxs(E.CardBody,{className:Cr.cardBody,children:[n&&h.jsx(E.Thumbnail,{className:Cr.thumbnail,shape:"square",size:"64",alt:n.alt,src:n.src}),h.jsxs("div",{className:ee(Cr.text,{[Cr.text__withIcon]:s}),children:[h.jsx(E.Typography,{type:"body-semibold",children:e}),h.jsx(E.Typography,{type:"detail-regular",children:a}),h.jsx(E.Typography,{type:"detail-regular",children:t})]})]})})}),s&&r&&h.jsx("div",{className:Cr.rightIcon,children:h.jsx(E.IconButton,{icon:"cross_circle",size:"medium",ariaLabel:"delete attachment",onClick:r})})]})};var ge=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Vn(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function jC(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 RC(t){var e=typeof t;return t!=null&&(e=="object"||e=="function")}var eg=RC,IC=typeof ge=="object"&&ge&&ge.Object===Object&&ge,NC=IC,DC=NC,OC=typeof self=="object"&&self&&self.Object===Object&&self,BC=DC||OC||Function("return this")(),R5=BC,HC=R5,WC=function(){return HC.Date.now()},VC=WC,GC=/\s/;function UC(t){for(var e=t.length;e--&&GC.test(t.charAt(e)););return e}var qC=UC,KC=qC,ZC=/^\s+/;function _C(t){return t&&t.slice(0,KC(t)+1).replace(ZC,"")}var JC=_C,QC=R5,YC=QC.Symbol,I5=YC,R2=I5,N5=Object.prototype,XC=N5.hasOwnProperty,$C=N5.toString,Po=R2?R2.toStringTag:void 0;function eE(t){var e=XC.call(t,Po),n=t[Po];try{t[Po]=void 0;var i=!0}catch{}var r=$C.call(t);return i&&(e?t[Po]=n:delete t[Po]),r}var tE=eE,nE=Object.prototype,iE=nE.toString;function rE(t){return iE.call(t)}var aE=rE,I2=I5,sE=tE,oE=aE,lE="[object Null]",uE="[object Undefined]",N2=I2?I2.toStringTag:void 0;function cE(t){return t==null?t===void 0?uE:lE:N2&&N2 in Object(t)?sE(t):oE(t)}var dE=cE;function fE(t){return t!=null&&typeof t=="object"}var hE=fE,mE=dE,gE=hE,pE="[object Symbol]";function vE(t){return typeof t=="symbol"||gE(t)&&mE(t)==pE}var bE=vE,wE=JC,D2=eg,kE=bE,O2=NaN,yE=/^[-+]0x[0-9a-f]+$/i,xE=/^0b[01]+$/i,SE=/^0o[0-7]+$/i,CE=parseInt;function EE(t){if(typeof t=="number")return t;if(kE(t))return O2;if(D2(t)){var e=typeof t.valueOf=="function"?t.valueOf():t;t=D2(e)?e+"":e}if(typeof t!="string")return t===0?t:+t;t=wE(t);var n=xE.test(t);return n||SE.test(t)?CE(t.slice(2),n?2:8):yE.test(t)?O2:+t}var TE=EE,ME=eg,o1=VC,B2=TE,AE="Expected a function",PE=Math.max,FE=Math.min;function zE(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(AE);e=B2(e)||0,ME(n)&&(c=!!n.leading,f="maxWait"in n,a=f?PE(B2(n.maxWait)||0,e):a,d="trailing"in n?!!n.trailing:d);function m(A){var F=i,P=r;return i=r=void 0,u=A,s=t.apply(P,F),s}function g(A){return u=A,o=setTimeout(w,e),c?m(A):s}function p(A){var F=A-l,P=A-u,z=e-F;return f?FE(z,a-P):z}function v(A){var F=A-l,P=A-u;return l===void 0||F>=e||F<0||f&&P>=a}function w(){var A=o1();if(v(A))return y(A);o=setTimeout(w,p(A))}function y(A){return o=void 0,d&&i?m(A):(i=r=void 0,s)}function x(){o!==void 0&&clearTimeout(o),u=0,i=l=r=o=void 0}function C(){return o===void 0?s:y(o1())}function M(){var A=o1(),F=v(A);if(i=arguments,r=this,l=A,F){if(o===void 0)return g(l);if(f)return clearTimeout(o),o=setTimeout(w,e),m(l)}return o===void 0&&(o=setTimeout(w,e)),s}return M.cancel=x,M.flush=C,M}var D5=zE;const O5=Vn(D5);var LE=D5,jE=eg,RE="Expected a function";function IE(t,e,n){var i=!0,r=!0;if(typeof t!="function")throw new TypeError(RE);return jE(n)&&(i="leading"in n?!!n.leading:i,r="trailing"in n?!!n.trailing:r),LE(t,e,{leading:i,maxWait:e,trailing:r})}var NE=IE;const DE=Vn(NE),lo=799,OE=690,Bt=(t=lo)=>{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=OE)=>{const[e,n]=b.useState(void 0),i=b.useCallback(DE(()=>{typeof window<"u"&&n(window.matchMedia(`(min-width: ${t}px)`).matches)},300),[t]);return b.useEffect(()=>{if(typeof window<"u")return i(),window.addEventListener("resize",i),()=>{window.removeEventListener("resize",i)}},[t,i]),e},B5=t=>{if(!t)return 0;const e=t.split("/").pop(),n=Number(e);return isNaN(n)?0:n},BE=(t,e="de-DE")=>new Intl.NumberFormat(e,{currency:"EUR",style:"currency"}).format(t/100),ol=t=>typeof t=="string"?t:t.src,He=(t,e="de-DE")=>t[e],yn=(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)},HE=(t,e,n="keypress")=>{b.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 n0(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 WE(t){const e=n0(t);return(e==null?void 0:e.numericId)??null}function VE(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 GE(t,e="Zu verschenken"){return!t||t===0?e:VE(t)}function UE(){}var qE=UE;const el=Vn(qE),H5=b.createContext({navigate:()=>el}),Mt=()=>{const{navigate:t}=b.useContext(H5);return b.useCallback((e,n)=>{t(e,n)},[t])},W5="data:image/webp;base64,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",KE="_sheet__header_104d1_146",ZE="_sheet__content_104d1_153",_E="_sheet__content__sticker_104d1_166",JE="_sheet__content__headline_104d1_169",QE="_sheet__content__label_104d1_178",YE="_sheet__content__button_104d1_181",XE="_sheet__image_104d1_188",xn={sheet__header:KE,sheet__content:ZE,sheet__content__sticker:_E,sheet__content__headline:JE,"sheet__content__headline--error":"_sheet__content__headline--error_104d1_172",sheet__content__label:QE,sheet__content__button:YE,sheet__image:XE},$E={"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"}}},Ma=He($E),eT=()=>h.jsxs(h.Fragment,{children:[h.jsx("div",{className:xn.sheet__image,children:h.jsx(E.Image,{src:ol(W5),alt:"highlight illustration"})}),h.jsx("div",{className:xn.sheet__content,children:h.jsx(E.Typography,{type:"h3",className:xn.sheet__content__label,children:Ma.loading.title})})]}),tT=()=>{const t=Mt(),e=()=>t("/feed/marketplace");return h.jsxs("div",{className:xn.sheet__content,children:[h.jsx("div",{className:xn.sheet__content__sticker,children:h.jsx(E.Sticker,{icon:"checkmark",size:"large",color:"green"})}),h.jsx(E.Typography,{type:"body-large",className:xn.sheet__content__label,children:Ma.success.label}),h.jsx(E.Typography,{type:"h3",className:xn.sheet__content__headline,children:Ma.success.title}),h.jsx("div",{className:xn.sheet__content__button,children:h.jsx(E.ButtonPrimary,{text:Ma.success.cta,onClick:e,size:"medium"})})]})},nT=({onClick:t})=>h.jsxs("div",{className:xn.sheet__content,children:[h.jsx("div",{className:xn.sheet__content__sticker,children:h.jsx(E.Sticker,{icon:"error",size:"large",color:"orange"})}),h.jsxs("div",{className:xn["sheet__content__headline--error"],children:[h.jsx(E.Typography,{type:"h3",children:Ma.error.title}),h.jsx(E.Typography,{type:"body-regular",markdown:!0,children:Ma.error.text})]}),h.jsx("div",{className:xn.sheet__content__button,children:h.jsx(E.ButtonSecondary,{text:Ma.error.cta,onClick:t,size:"medium",color:"lavender"})})]}),V5=({isLoading:t,onCheckout:e,onDismiss:n,open:i,paymentInterrupted:r})=>{const a=ot(800);return h.jsx(E.Sheet,{open:i,onDismiss:n,header:h.jsx("div",{className:xn.sheet__header,children:!t&&h.jsx(E.IconButton,{icon:"cross",size:"medium",onClick:n})}),content:r?h.jsx(nT,{onClick:e}):t?h.jsx(eT,{}):h.jsx(tT,{}),footer:h.jsx(h.Fragment,{}),bottomSheet:!a,breakpoint:"800"})},iT=async(t,e)=>(await gt.API.getApi().POST("/api/core/v3/posts/{post_id}/payment_intent",{body:{payment_intent:{product_id:e}},params:{path:{post_id:Number(t)}}})).data,rT=async t=>{const e=await gt.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}},G5=()=>{const[t,e]=b.useState(!1),[n,i]=b.useState(!1),[r,a]=b.useState(""),[s,o]=b.useState(null),l=Qm.useOpenCheckout(),u=b.useCallback(async(m,g)=>{if(o({postId:m,productId:g}),!l){console.error("Chargebee checkout instance not available");return}let p=r;if(!r){if(!m||!g){console.error("Post ID or Product ID not provided");return}e(!0);try{const v=await iT(m,g);if(!v)return console.error("No payment intent ID returned from API");p=v.id,a(p)}catch{i(!0)}finally{e(!1)}}l({getHostedPage:async()=>rT(p),layout:"in_app",onClose:()=>i(!0),onError:()=>i(!0)})},[l,r]),c=()=>{i(!1),s&&u(s.postId,s.productId)},f=()=>i(!1);return{PremiumFeatureCheckoutModal:h.jsx(V5,{isLoading:t,open:t||n,onDismiss:f,onCheckout:c,paymentInterrupted:n}),startCheckout:u}},aT=async t=>(await gt.API.getApi().GET("/api/core/v3/posts/{post_id}/payment_intent",{params:{path:{post_id:Number(t)}}})).data,sT=async(t,e)=>{const n=await gt.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},oT=t=>{const[e,n]=b.useState(!1),[i,r]=b.useState(!0);b.useEffect(()=>{const o=new URLSearchParams(window.location.search),l=o.get("state"),u=o.get("id");if(!t||u===null)return r(!1);(async()=>{try{const f=await aT(t);if(!f)throw new Error("No payment intent found");const d=await sT(u,f.id);throw l==="succeeded"&&d&&(r(!1),n(!0)),new Error("Payment confirmation failed")}catch(f){console.log("Error confirming checkout:",f),r(!1)}})()},[t]);const a=()=>n(!1);return{PremiumFeatureCompletionModal:h.jsx(V5,{isLoading:!1,open:e,onDismiss:a,onCheckout:()=>tf.noop,paymentInterrupted:!1}),loading:i}},lT="_root_1ytpj_146",uT="_root__search_1ytpj_149",H2={root:lT,root__search:uT};/*! *****************************************************************************
2
+ Schließe jetzt deine Zahlung ab.`,title:"Zahlung unterbrochen",cta:"Zahlung abschließen"}}},Ma=He($E),eT=()=>h.jsxs(h.Fragment,{children:[h.jsx("div",{className:xn.sheet__image,children:h.jsx(E.Image,{src:ol(W5),alt:"highlight illustration"})}),h.jsx("div",{className:xn.sheet__content,children:h.jsx(E.Typography,{type:"h3",className:xn.sheet__content__label,children:Ma.loading.title})})]}),tT=()=>{const t=Mt(),e=()=>t("/feed/marketplace");return h.jsxs("div",{className:xn.sheet__content,children:[h.jsx("div",{className:xn.sheet__content__sticker,children:h.jsx(E.Sticker,{icon:"checkmark",size:"large",color:"green"})}),h.jsx(E.Typography,{type:"body-large",className:xn.sheet__content__label,children:Ma.success.label}),h.jsx(E.Typography,{type:"h3",className:xn.sheet__content__headline,children:Ma.success.title}),h.jsx("div",{className:xn.sheet__content__button,children:h.jsx(E.ButtonPrimary,{text:Ma.success.cta,onClick:e,size:"medium"})})]})},nT=({onClick:t})=>h.jsxs("div",{className:xn.sheet__content,children:[h.jsx("div",{className:xn.sheet__content__sticker,children:h.jsx(E.Sticker,{icon:"error",size:"large",color:"orange"})}),h.jsxs("div",{className:xn["sheet__content__headline--error"],children:[h.jsx(E.Typography,{type:"h3",children:Ma.error.title}),h.jsx(E.Typography,{type:"body-regular",markdown:!0,children:Ma.error.text})]}),h.jsx("div",{className:xn.sheet__content__button,children:h.jsx(E.ButtonSecondary,{text:Ma.error.cta,onClick:t,size:"medium",color:"lavender"})})]}),V5=({isLoading:t,onCheckout:e,onDismiss:n,open:i,paymentInterrupted:r})=>{const a=ot(800);return h.jsx(E.Sheet,{open:i,onDismiss:n,header:h.jsx("div",{className:xn.sheet__header,children:!t&&h.jsx(E.IconButton,{icon:"cross",size:"medium",onClick:n})}),content:r?h.jsx(nT,{onClick:e}):t?h.jsx(eT,{}):h.jsx(tT,{}),footer:h.jsx(h.Fragment,{}),bottomSheet:!a,breakpoint:"800"})},iT=async(t,e)=>(await gt.API.getApi().POST("/api/core/v3/posts/{post_id}/payment_intent",{body:{payment_intent:{product_id:e}},params:{path:{post_id:Number(t)}}})).data,rT=async t=>{const e=await gt.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}},G5=()=>{const[t,e]=b.useState(!1),[n,i]=b.useState(!1),[r,a]=b.useState(""),[s,o]=b.useState(null),l=Qm.useOpenCheckout(),u=b.useCallback(async(m,g)=>{const p=g!==(s==null?void 0:s.productId);if(o({postId:m,productId:g}),!l){console.error("Chargebee checkout instance not available");return}let v=r;if(!r||p){if(!m||!g){console.error("Post ID or Product ID not provided");return}e(!0);try{const w=await iT(m,g);if(!w)return console.error("No payment intent ID returned from API");v=w.id,a(v)}catch{i(!0)}finally{e(!1)}}l({getHostedPage:async()=>rT(v),layout:"in_app",onClose:()=>i(!0),onError:()=>i(!0)})},[l,r]),c=()=>{i(!1),s&&u(s.postId,s.productId)},f=()=>i(!1);return{PremiumFeatureCheckoutModal:h.jsx(V5,{isLoading:t,open:t||n,onDismiss:f,onCheckout:c,paymentInterrupted:n}),startCheckout:u}},aT=async t=>(await gt.API.getApi().GET("/api/core/v3/posts/{post_id}/payment_intent",{params:{path:{post_id:Number(t)}}})).data,sT=async(t,e)=>{const n=await gt.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},oT=t=>{const[e,n]=b.useState(!1),[i,r]=b.useState(!0);b.useEffect(()=>{const o=new URLSearchParams(window.location.search),l=o.get("state"),u=o.get("id");if(!t||u===null)return r(!1);(async()=>{try{const f=await aT(t);if(!f)throw new Error("No payment intent found");const d=await sT(u,f.id);throw l==="succeeded"&&d&&(r(!1),n(!0)),new Error("Payment confirmation failed")}catch(f){console.log("Error confirming checkout:",f),r(!1)}})()},[t]);const a=()=>n(!1);return{PremiumFeatureCompletionModal:h.jsx(V5,{isLoading:!1,open:e,onDismiss:a,onCheckout:()=>tf.noop,paymentInterrupted:!1}),loading:i}},lT="_root_1ytpj_146",uT="_root__search_1ytpj_149",H2={root:lT,root__search:uT};/*! *****************************************************************************
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
@@ -496,21 +496,22 @@ const Al = /* @__PURE__ */ ri(HM), jw = ya({
496
496
  null
497
497
  ), l = PE(), u = we(
498
498
  async (h, m) => {
499
+ const p = m !== (o == null ? void 0 : o.productId);
499
500
  if (s({ postId: h, productId: m }), !l) {
500
501
  console.error("Chargebee checkout instance not available");
501
502
  return;
502
503
  }
503
- let p = r;
504
- if (!r) {
504
+ let v = r;
505
+ if (!r || p) {
505
506
  if (!h || !m) {
506
507
  console.error("Post ID or Product ID not provided");
507
508
  return;
508
509
  }
509
510
  e(!0);
510
511
  try {
511
- const v = await YM(h, m);
512
- if (!v) return console.error("No payment intent ID returned from API");
513
- p = v.id, a(p);
512
+ const b = await YM(h, m);
513
+ if (!b) return console.error("No payment intent ID returned from API");
514
+ v = b.id, a(v);
514
515
  } catch {
515
516
  i(!0);
516
517
  } finally {
@@ -518,7 +519,7 @@ const Al = /* @__PURE__ */ ri(HM), jw = ya({
518
519
  }
519
520
  }
520
521
  l({
521
- getHostedPage: async () => XM(p),
522
+ getHostedPage: async () => XM(v),
522
523
  layout: "in_app",
523
524
  onClose: () => i(!0),
524
525
  onError: () => i(!0)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@goodhood-web/nebenan-base",
3
- "version": "4.5.0-development.21",
3
+ "version": "4.5.0-development.22",
4
4
  "main": "./index.js",
5
5
  "types": "./index.d.ts",
6
6
  "repository": "https://github.com/good-hood-gmbh/goodhood-web",