@mediquo/elements 0.3.1 → 0.4.0

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 (62) hide show
  1. package/README.md +166 -15
  2. package/dist/chunks/{api-chat-client-BTBtu01T.js → api-chat-client-C8SqZtCa.js} +1 -1
  3. package/dist/chunks/{apple-pay-outcomes-BlytM6W-.js → apple-pay-outcomes-BNkcTbbM.js} +1 -1
  4. package/dist/chunks/create-component-BB-6Gu6l.js +1 -0
  5. package/dist/chunks/exports-G_7Ih_GH.js +1 -0
  6. package/dist/chunks/{index-B9iWdvW3.js → index-BJcdB5MT.js} +1 -1
  7. package/dist/chunks/index-DiqYAEHW.js +1 -0
  8. package/dist/chunks/{mq-layout-DpzeL9_i.js → mq-layout-CpIZTsV2.js} +1 -1
  9. package/dist/chunks/{price-Dtdjx70D.js → price-tImUmtpX.js} +1 -1
  10. package/dist/chunks/{refund-cancel-policy-Bm5djPds.js → refund-cancel-policy-CnbrIqH0.js} +1 -1
  11. package/dist/chunks/{telemetry-client-CKCb9Gnf.js → telemetry-client-BRVJU-fZ.js} +1 -1
  12. package/dist/env.js +1 -1
  13. package/dist/i18n.js +1 -1
  14. package/dist/mq-apple-pay-checkout.js +1 -1
  15. package/dist/mq-appointment-checkout.js +1 -1
  16. package/dist/mq-chat-room.js +1 -1
  17. package/dist/mq-checkout.js +1 -1
  18. package/dist/mq-google-pay-checkout.js +1 -1
  19. package/dist/mq-immediate-videocall-checkout.js +1 -1
  20. package/dist/mq-my-appointments.d.ts +6 -6
  21. package/dist/mq-my-appointments.js +1 -1
  22. package/dist/mq-schedule-success.js +2 -2
  23. package/dist/mq-schedule.d.ts +3 -3
  24. package/dist/mq-schedule.js +1 -1
  25. package/dist/mq-socket-provider.js +1 -1
  26. package/dist/mq-support-chat.d.ts +1 -1
  27. package/dist/mq-support-chat.js +1 -1
  28. package/dist/mq-videocall.js +1 -1
  29. package/dist/react/mq-apple-pay-checkout.d.ts +15 -0
  30. package/dist/react/mq-apple-pay-checkout.js +2 -0
  31. package/dist/react/mq-appointment-checkout.d.ts +17 -0
  32. package/dist/react/mq-appointment-checkout.js +2 -0
  33. package/dist/react/mq-chat-room.d.ts +19 -0
  34. package/dist/react/mq-chat-room.js +2 -0
  35. package/dist/react/mq-checkout.d.ts +18 -0
  36. package/dist/react/mq-checkout.js +2 -0
  37. package/dist/react/mq-google-pay-checkout.d.ts +15 -0
  38. package/dist/react/mq-google-pay-checkout.js +2 -0
  39. package/dist/react/mq-immediate-videocall-checkout.d.ts +16 -0
  40. package/dist/react/mq-immediate-videocall-checkout.js +2 -0
  41. package/dist/react/mq-my-appointments.d.ts +29 -0
  42. package/dist/react/mq-my-appointments.js +2 -0
  43. package/dist/react/mq-query-client-provider.d.ts +8 -0
  44. package/dist/react/mq-query-client-provider.js +2 -0
  45. package/dist/react/mq-schedule-success.d.ts +26 -0
  46. package/dist/react/mq-schedule-success.js +2 -0
  47. package/dist/react/mq-schedule.d.ts +31 -0
  48. package/dist/react/mq-schedule.js +2 -0
  49. package/dist/react/mq-socket-provider.d.ts +9 -0
  50. package/dist/react/mq-socket-provider.js +2 -0
  51. package/dist/react/mq-support-chat.d.ts +15 -0
  52. package/dist/react/mq-support-chat.js +2 -0
  53. package/dist/react/mq-theme-provider.d.ts +8 -0
  54. package/dist/react/mq-theme-provider.js +2 -0
  55. package/dist/react/mq-videocall.d.ts +25 -0
  56. package/dist/react/mq-videocall.js +2 -0
  57. package/dist/ui/mq-calendar.js +1 -1
  58. package/dist/ui/mq-clamped-text.js +1 -1
  59. package/dist/ui/mq-toast.js +1 -1
  60. package/package.json +25 -4
  61. package/dist/chunks/exports-XZaVrMLd.js +0 -1
  62. package/dist/chunks/index-BYHKNPG2.js +0 -1
@@ -1 +1 @@
1
- import{_ as t,t as e}from"./custom-element-DA9Fxvxd.js";import{E as s,i,a as o,x as n}from"./lit-element-DiWJYFwC.js";import{n as r}from"./property-scuRaFcM.js";import{r as l}from"./state-LQivXIgA.js";import{e as a}from"./class-map-Co76I6aw.js";import{i as d,t as c,e as p}from"./directive-2EDmOukv.js";import{o as v}from"./style-map-CIdqdn7C.js";import"../ui/mq-text-button.js";const u=(t,e)=>{const s=t._$AN;if(void 0===s)return!1;for(const t of s)t._$AO?.(e,!1),u(t,e);return!0},m=t=>{let e,s;do{if(void 0===(e=t._$AM))break;s=e._$AN,s.delete(t),t=e}while(0===s?.size)},b=t=>{for(let e;e=t._$AM;t=e){let s=e._$AN;if(void 0===s)e._$AN=s=new Set;else if(s.has(t))break;s.add(t),g(e)}};function x(t){void 0!==this._$AN?(m(this),this._$AM=t,b(this)):this._$AM=t}function $(t,e=!1,s=0){const i=this._$AH,o=this._$AN;if(void 0!==o&&0!==o.size)if(e)if(Array.isArray(i))for(let t=s;t<i.length;t++)u(i[t],!1),m(i[t]);else null!=i&&(u(i,!1),m(i));else u(this,t)}const g=t=>{t.type==c.CHILD&&(t._$AP??=$,t._$AQ??=x)};class f extends d{constructor(){super(...arguments),this._$AN=void 0}_$AT(t,e,s){super._$AT(t,e,s),b(this),this.isConnected=t._$AU}_$AO(t,e=!0){t!==this.isConnected&&(this.isConnected=t,t?this.reconnected?.():this.disconnected?.()),e&&(u(this,t),m(this))}setValue(t){if((t=>void 0===t.strings)(this._$Ct))this._$Ct._$AI(t,this);else{const e=[...this._$Ct._$AH];e[this._$Ci]=t,this._$Ct._$AI(e,this,0)}}disconnected(){}reconnected(){}}class h{}const _=new WeakMap,A=p(class extends f{render(t){return s}update(t,[e]){const i=e!==this.G;return i&&void 0!==this.G&&this.rt(void 0),(i||this.lt!==this.ct)&&(this.G=e,this.ht=t.options?.host,this.rt(this.ct=t.element)),s}rt(t){if(this.isConnected||(t=void 0),"function"==typeof this.G){const e=this.ht??globalThis;let s=_.get(e);void 0===s&&(s=new WeakMap,_.set(e,s)),void 0!==s.get(this.G)&&this.G.call(this.ht,void 0),s.set(this.G,t),void 0!==t&&this.G.call(this.ht,t)}else this.G.value=t}get lt(){return"function"==typeof this.G?_.get(this.ht??globalThis)?.get(this.G):this.G?.value}disconnected(){this.lt===this.ct&&this.rt(void 0)}reconnected(){this.rt(this.ct)}}),y=i`:host{display:flex;flex-direction:column;gap:var(--sp-1)}.text{margin:0}.text.is-clamped{display:-webkit-box;-webkit-box-orient:vertical;overflow:hidden}.toggle{align-self:flex-start}`;let w=class MqClampedText extends o{constructor(){super(...arguments),this.lines=2,this.expandLabel="",this.collapseLabel="",this.expanded=!1,this.overflowing=!1,this.textRef=new h,this.measure=()=>{const t=this.textRef.value;if(!t||this.expanded)return;const e=t.scrollHeight-t.clientHeight>1;e!==this.overflowing&&(this.overflowing=e)}}static{this.styles=y}updated(){const t=this.textRef.value;t&&!this.resizeObserver&&(this.resizeObserver=new ResizeObserver(()=>this.measure()),this.resizeObserver.observe(t)),this.measure()}disconnectedCallback(){super.disconnectedCallback(),this.resizeObserver?.disconnect(),this.resizeObserver=void 0}render(){return n`<div ${A(this.textRef)} class="text ${a({"is-clamped":!this.expanded})}" style="${v({"-webkit-line-clamp":this.expanded?"":String(this.lines)})}"><slot @slotchange="${this.measure}"></slot></div>${this.expanded||this.overflowing?n`<mq-text-button class="toggle" type="button" size="sm" fontWeight="normal" underlined @click="${()=>{this.expanded=!this.expanded}}">${this.expanded?this.collapseLabel:this.expandLabel}</mq-text-button>`:s}`}};t([r({type:Number})],w.prototype,"lines",void 0),t([r({type:String,attribute:"expand-label"})],w.prototype,"expandLabel",void 0),t([r({type:String,attribute:"collapse-label"})],w.prototype,"collapseLabel",void 0),t([l()],w.prototype,"expanded",void 0),t([l()],w.prototype,"overflowing",void 0),w=t([e("mq-clamped-text")],w);export{w as M,f};
1
+ import{_ as t,t as e}from"./custom-element-DA9Fxvxd.js";import{E as s,i,a as o,x as n}from"./lit-element-DiWJYFwC.js";import{n as r}from"./property-scuRaFcM.js";import{r as l}from"./state-LQivXIgA.js";import{e as a}from"./class-map-Co76I6aw.js";import{i as d,t as c,e as p}from"./directive-2EDmOukv.js";import{o as v}from"./style-map-CIdqdn7C.js";import"../ui/mq-text-button.js";const u=(t,e)=>{const s=t._$AN;if(void 0===s)return!1;for(const t of s)t._$AO?.(e,!1),u(t,e);return!0},m=t=>{let e,s;do{if(void 0===(e=t._$AM))break;s=e._$AN,s.delete(t),t=e}while(0===s?.size)},x=t=>{for(let e;e=t._$AM;t=e){let s=e._$AN;if(void 0===s)e._$AN=s=new Set;else if(s.has(t))break;s.add(t),g(e)}};function $(t){void 0!==this._$AN?(m(this),this._$AM=t,x(this)):this._$AM=t}function b(t,e=!1,s=0){const i=this._$AH,o=this._$AN;if(void 0!==o&&0!==o.size)if(e)if(Array.isArray(i))for(let t=s;t<i.length;t++)u(i[t],!1),m(i[t]);else null!=i&&(u(i,!1),m(i));else u(this,t)}const g=t=>{t.type==c.CHILD&&(t._$AP??=b,t._$AQ??=$)};class f extends d{constructor(){super(...arguments),this._$AN=void 0}_$AT(t,e,s){super._$AT(t,e,s),x(this),this.isConnected=t._$AU}_$AO(t,e=!0){t!==this.isConnected&&(this.isConnected=t,t?this.reconnected?.():this.disconnected?.()),e&&(u(this,t),m(this))}setValue(t){if((t=>void 0===t.strings)(this._$Ct))this._$Ct._$AI(t,this);else{const e=[...this._$Ct._$AH];e[this._$Ci]=t,this._$Ct._$AI(e,this,0)}}disconnected(){}reconnected(){}}class h{}const _=new WeakMap,A=p(class extends f{render(t){return s}update(t,[e]){const i=e!==this.G;return i&&void 0!==this.G&&this.rt(void 0),(i||this.lt!==this.ct)&&(this.G=e,this.ht=t.options?.host,this.rt(this.ct=t.element)),s}rt(t){if(this.isConnected||(t=void 0),"function"==typeof this.G){const e=this.ht??globalThis;let s=_.get(e);void 0===s&&(s=new WeakMap,_.set(e,s)),void 0!==s.get(this.G)&&this.G.call(this.ht,void 0),s.set(this.G,t),void 0!==t&&this.G.call(this.ht,t)}else this.G.value=t}get lt(){return"function"==typeof this.G?_.get(this.ht??globalThis)?.get(this.G):this.G?.value}disconnected(){this.lt===this.ct&&this.rt(void 0)}reconnected(){this.rt(this.ct)}}),y=i`:host{display:flex;flex-direction:column;gap:var(--sp-1)}.text{margin:0}.text.is-clamped{display:-webkit-box;-webkit-box-orient:vertical;overflow:hidden}.toggle{align-self:flex-start}`;let w=class MqClampedText extends o{constructor(){super(...arguments),this.lines=2,this.expandLabel="",this.collapseLabel="",this.expanded=!1,this.overflowing=!1,this.textRef=new h,this.measure=()=>{const t=this.textRef.value;if(!t||this.expanded)return;const e=t.scrollHeight-t.clientHeight>1;e!==this.overflowing&&(this.overflowing=e)}}static{this.styles=y}updated(){const t=this.textRef.value;t&&!this.resizeObserver&&(this.resizeObserver=new ResizeObserver(()=>this.measure()),this.resizeObserver.observe(t)),this.measure()}disconnectedCallback(){super.disconnectedCallback(),this.resizeObserver?.disconnect(),this.resizeObserver=void 0}render(){return n`<div ${A(this.textRef)} class="text ${a({"is-clamped":!this.expanded})}" style="${v({"-webkit-line-clamp":this.expanded?"":String(this.lines)})}"><slot @slotchange="${this.measure}"></slot></div>${this.expanded||this.overflowing?n`<mq-text-button class="toggle" type="button" size="sm" fontWeight="normal" underlined @click="${()=>{this.expanded=!this.expanded}}">${this.expanded?this.collapseLabel:this.expandLabel}</mq-text-button>`:s}`}};t([r({type:Number})],w.prototype,"lines",void 0),t([r({type:String,attribute:"expand-label"})],w.prototype,"expandLabel",void 0),t([r({type:String,attribute:"collapse-label"})],w.prototype,"collapseLabel",void 0),t([l()],w.prototype,"expanded",void 0),t([l()],w.prototype,"overflowing",void 0),w=t([e("mq-clamped-text")],w);export{w as M,f};
@@ -0,0 +1 @@
1
+ import{_ as t,t as e}from"./custom-element-DA9Fxvxd.js";import{m as a}from"./runtime-Bg1WXVCx.js";import{t as r,c as n,n as s,g as o,p as i,a as l,s as d,l as c}from"./parseISO-jT42c8Ob.js";import{i as v,a as h,x as u}from"./lit-element-DiWJYFwC.js";import{n as p}from"./property-scuRaFcM.js";import{r as g}from"./state-LQivXIgA.js";import{e as m}from"./class-map-Co76I6aw.js";import{chevronLeftIcon as y}from"../ui/icons/chevron-left-icon.js";import{chevronRightIcon as b}from"../ui/icons/chevron-right-icon.js";import{spinnerIcon as f}from"../ui/icons/spinner-icon.js";import{i as D}from"./isSameDay-DPfclwIL.js";import{i as k}from"./isBefore-Cof0D841.js";function w(t,e,a){const s=r(t,a?.in);if(isNaN(e))return n(t,NaN);if(!e)return s;const o=s.getDate(),i=n(t,s.getTime());i.setMonth(s.getMonth()+e+1,0);return o>=i.getDate()?i:(s.setFullYear(i.getFullYear(),i.getMonth(),o),s)}function M(t,e){const a=r(t,e?.in),n=a.getMonth();return a.setFullYear(a.getFullYear(),n+1,0),a.setHours(23,59,59,999),a}function S(t,e){const{start:a,end:r}=function(t,e){const[a,r]=s(t,e.start,e.end);return{start:a,end:r}}(e?.in,t);let o=+a>+r;const i=o?+a:+r,l=o?r:a;l.setHours(0,0,0,0);const d=[];for(;+l<=i;)d.push(n(a,l)),l.setDate(l.getDate()+1),l.setHours(0,0,0,0);return o?d.reverse():d}function x(t,e){const a=r(t,e?.in);return a.setDate(1),a.setHours(0,0,0,0),a}function E(t,e){const a=o(),n=e?.weekStartsOn??e?.locale?.options?.weekStartsOn??a.weekStartsOn??a.locale?.options?.weekStartsOn??0,s=r(t,e?.in),i=s.getDay(),l=6+(i<n?-7:0)-(i-n);return s.setDate(s.getDate()+l),s.setHours(23,59,59,999),s}function j(t,e){return+r(t)>+r(e)}function $(t,e){return D(n(t,t),function(t){return n(t,Date.now())}(t))}const N=v`:host{display:block;font-family:var(--font-body)}.calendar{background:var(--color-card);border-radius:var(--border-radius-lg);user-select:none}.calendar-header{display:flex;align-items:center;justify-content:space-between;background:var(--color-primary-background-extraWeak);padding:var(--sp-4);border-radius:var(--border-radius-lg) var(--border-radius-lg) 0 0}.calendar-header-title{font-family:var(--font-titles);font-size:var(--text-lg);font-weight:var(--font-weight-bold);color:var(--color-gray-darkest)}.calendar-body{position:relative;transition:opacity .2s}.calendar-body.loading{opacity:.4;pointer-events:none}.calendar-nav{display:flex;gap:var(--sp-2)}.calendar-nav-button{display:flex;align-items:center;justify-content:center;width:var(--size-8);height:var(--size-8);border:none;background:0 0;border-radius:var(--border-radius-md);cursor:pointer;transition:background-color .2s;color:var(--color-gray-darkest);padding:0}.calendar-nav-button:hover{background:var(--color-background-primary-light)}.calendar-nav-button:disabled{opacity:.3;cursor:not-allowed}.calendar-weekdays{display:grid;grid-template-columns:repeat(7,var(--sp-11));justify-content:space-between;padding:var(--sp-4) var(--sp-4) var(--sp-2) var(--sp-4)}.calendar-weekday{text-align:center;font-size:var(--text-sm);font-weight:var(--font-weight-bold);color:var(--color-gray-darkest);padding:var(--sp-2)}.calendar-days{display:grid;gap:var(--sp-1);grid-template-columns:repeat(7,var(--sp-11));justify-content:space-between;padding:0 var(--sp-4) var(--sp-4) var(--sp-4)}.calendar-day{width:var(--sp-11);height:var(--sp-11);display:flex;align-items:center;justify-content:center;border:none;background:0 0;border-radius:var(--border-radius-full);cursor:pointer;font-family:var(--font-body);font-size:var(--text-sm);font-weight:var(--font-weight-medium);color:var(--color-gray-darkest);transition:all .2s;padding:0;position:relative}.calendar-day:hover:not(:disabled):not(.other-month){background:var(--color-gray-lighter)}.calendar-day.other-month{color:var(--color-gray-medium);background:0 0}.calendar-day:disabled{color:var(--color-gray-medium);background:0 0;cursor:not-allowed}.calendar-day.available:not(.selected){background:var(--color-primary);color:var(--color-white);font-weight:var(--font-weight-semibold)}.calendar-day.available:hover:not(:disabled):not(.selected){background:var(--color-primary-dark)}.calendar-day.selected{background:var(--color-primary);color:var(--color-white);font-weight:var(--font-weight-bold)}.calendar-day.selected:hover:not(:disabled){background:var(--color-primary-dark)}.calendar-day-empty{width:var(--sp-11);height:var(--sp-11)}.calendar-spinner{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);display:flex;align-items:center;justify-content:center;pointer-events:none;z-index:10}@media (min-width:640px){.calendar-weekdays{gap:var(--sp-2)}.calendar-days{gap:var(--sp-2)}}@media (min-width:768px){.calendar-weekdays{gap:var(--sp-3)}.calendar-days{gap:var(--sp-3)}}@media (min-width:1024px){.calendar-weekdays{gap:var(--sp-4)}.calendar-days{gap:var(--sp-4)}}`;class DateSelectEvent extends Event{static{this.eventName="date-select"}constructor(t){super(DateSelectEvent.eventName,{bubbles:!0,composed:!0}),this.detail=t}}class PrevMonthEvent extends Event{static{this.eventName="prev-month"}constructor(t){super(PrevMonthEvent.eventName,{bubbles:!0,composed:!0}),this.detail=t}}class NextMonthEvent extends Event{static{this.eventName="next-month"}constructor(t){super(NextMonthEvent.eventName,{bubbles:!0,composed:!0}),this.detail=t}}let C=class MqCalendar extends h{constructor(){super(...arguments),this.locale="es-ES",this.isLoading=!1,this.handlePrevMonth=()=>{const t=this.getCurrentMonthDate(),e=w(t,-1,a);var a;this.dispatchEvent(new PrevMonthEvent({currentMonth:e.toISOString()}))},this.handleNextMonth=()=>{const t=w(this.getCurrentMonthDate(),1);this.dispatchEvent(new NextMonthEvent({currentMonth:t.toISOString()}))},this.handleDayClick=t=>{t.isDisabled||(this.selectedDate=t.date,this.value=t.date.toISOString(),this.dispatchEvent(new DateSelectEvent({date:t.date.toISOString()})),this.requestUpdate())}}static{this.styles=[N]}connectedCallback(){super.connectedCallback(),this.value&&(this.selectedDate=i(this.value))}getMonthYear(){const t=this.getCurrentMonthDate();return new Intl.DateTimeFormat(this.locale,{month:"long",year:"numeric"}).format(t)}getCurrentMonthDate(){return this.currentMonth?i(this.currentMonth):new Date}getWeekdays(){const t=l(new Date(2024,0,1),{weekStartsOn:1}),e=S({start:t,end:E(t,{weekStartsOn:1})}),a=new Intl.DateTimeFormat(this.locale,{weekday:"narrow"});return e.map(t=>a.format(t).toUpperCase())}getDaysInMonth(){const t=this.getCurrentMonthDate(),e=x(t),a=M(t);return S({start:l(e,{weekStartsOn:1}),end:E(a,{weekStartsOn:1})}).map(e=>{const a=function(t,e,a){const[r,n]=s(a?.in,t,e);return r.getFullYear()===n.getFullYear()&&r.getMonth()===n.getMonth()}(e,t);return this.createCalendarDay(e,a)})}createCalendarDay(t,e){const a=d(t),r=$(a),n=this.isDateAvailable(a);return{date:a,isCurrentMonth:e,isToday:r,isDisabled:this.isDateDisabled(a,n),isSelected:!!this.selectedDate&&D(a,this.selectedDate),isAvailable:n}}isDateAvailable(t){if(!this.availableDays||0===this.availableDays.length)return!1;const e=d(t);return this.availableDays.some(t=>{const a=d(i(t));return D(e,a)})}isDateDisabled(t,e){const a=d(t);if(this.availableDays&&this.availableDays.length>0)return!e;if(this.minDate){const t=d(i(this.minDate));if(k(a,t))return!0}if(this.maxDate){if(j(a,d(i(this.maxDate))))return!0}return!1}render(){const t=this.getDaysInMonth(),e=this.getWeekdays();return u`<div class="calendar"><div class="calendar-header"><button class="calendar-nav-button" @click="${this.handlePrevMonth}" aria-label="${a("Mes anterior")}">${y({size:24})}</button><div class="calendar-header-title">${this.getMonthYear()}</div><button class="calendar-nav-button" @click="${this.handleNextMonth}" aria-label="${a("Mes siguiente")}">${b({size:24})}</button></div><div class="calendar-body ${this.isLoading?"loading":""}"><div class="calendar-weekdays">${e.map(t=>u`<div class="calendar-weekday">${t}</div>`)}</div><div class="calendar-days">${t.map(t=>t.isCurrentMonth?u`<button class="${m({"calendar-day":!0,"other-month":!t.isCurrentMonth,today:t.isToday,selected:t.isSelected,available:t.isAvailable})}" ?disabled="${t.isDisabled||this.isLoading}" @click="${()=>this.handleDayClick(t)}" aria-label="${t.date.toLocaleDateString(this.locale)}">${t.date.getDate()}</button>`:u`<div class="calendar-day-empty"></div>`)}</div>${this.isLoading?u`<div class="calendar-spinner">${f({size:40,color:"var(--color-primary)"})}</div>`:""}</div></div>`}};t([p({type:String})],C.prototype,"locale",void 0),t([p({type:String,attribute:"min-date"})],C.prototype,"minDate",void 0),t([p({type:String,attribute:"max-date"})],C.prototype,"maxDate",void 0),t([p({type:String})],C.prototype,"value",void 0),t([p({type:Boolean,attribute:"is-loading"})],C.prototype,"isLoading",void 0),t([p({type:String,attribute:"current-month"})],C.prototype,"currentMonth",void 0),t([p({type:Array,attribute:"available-days"})],C.prototype,"availableDays",void 0),t([g()],C.prototype,"selectedDate",void 0),C=t([c(),e("mq-calendar")],C);export{DateSelectEvent as D,C as M,NextMonthEvent as N,PrevMonthEvent as P,M as e,j as i,x as s};
@@ -1 +1 @@
1
- import{_ as t,t as o}from"./custom-element-DA9Fxvxd.js";import{m as C}from"./runtime-Bg1WXVCx.js";import{l as a}from"./parseISO-jT42c8Ob.js";import{a as r,i as n,x as e}from"./lit-element-DiWJYFwC.js";import{n as i}from"./property-scuRaFcM.js";let d=class MQLayout extends r{constructor(){super(...arguments),this.background="default",this.variant="default",this.showMediquoBranding=!0}static{this.styles=n`:host{--content-max-width:560px;display:flex;flex-direction:column;height:100%;width:100%;max-width:var(--content-max-width);margin:0 auto;background-color:var(--color-background)}:host([background=solid]){background-color:var(--color-background)}:host([background=transparent]){background-color:transparent}:host([variant=wide]){--content-max-width:1000px}.content{flex:1;padding:var(--mq-layout-padding,0)}footer{display:flex;flex-direction:column;align-items:center;gap:var(--sp-4);padding-top:var(--sp-10);padding-bottom:var(--sp-3);padding-inline:var(--mq-layout-padding,0);margin-bottom:var(--sp-3);text-align:center}.branding{display:flex;justify-content:center;align-items:center;gap:var(--size-2);font-family:var(--font-body);font-size:var(--text-sm);line-height:normal;font-weight:var(--font-weight-normal);color:var(--color-neutrals-text-default)}`}render(){return this.showMediquoBranding?e`<div class="content"><slot></slot></div><footer><div class="branding">${C("Servicio y plataforma prestados por")} ${e`<svg width="82" height="16" viewBox="0 0 82 16" fill="none" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" clip-rule="evenodd" d="M52.4506 8.97739V10.5665C52.4506 11.1054 52.0077 11.5477 51.4682 11.5477C50.9288 11.5477 50.486 11.1054 50.486 10.5665V8.97739H48.8531C48.3276 8.97739 47.8984 8.54894 47.8984 8.02383C47.8984 7.49893 48.3276 7.07053 48.8531 7.07053H50.486V5.48128C50.486 4.94243 50.9288 4.5002 51.4682 4.5002C52.0077 4.5002 52.4506 4.94243 52.4506 5.48128V7.07053H54.0836C54.609 7.07053 55.0379 7.49893 55.0379 8.02383C55.0379 8.54894 54.609 8.97739 54.0836 8.97739H52.4506ZM56.8563 5.46693C56.055 3.75203 54.5229 2.55033 52.6531 2.16979C52.3272 2.10809 51.9339 2.06818 51.5273 2.05679C48.7327 2.10005 46.4191 3.93204 45.7665 6.6209C45.397 8.13705 45.6843 9.78156 46.555 11.134C47.4258 12.4867 48.8053 13.431 50.3396 13.7243C51.7168 13.9883 53.0199 13.8046 54.2312 13.1767L54.2853 13.1506C54.554 13.0306 54.8304 12.9977 55.1481 13.0559L55.2243 13.0728C55.8277 13.2312 56.4308 13.389 57.0345 13.5467C56.8787 12.9784 56.7231 12.4168 56.5656 11.86L56.5512 11.8035C56.4673 11.4258 56.5163 11.0837 56.7011 10.7579C57.5947 9.11014 57.6548 7.17549 56.8563 5.46693ZM59.2901 15.5846C59.0891 15.8486 58.7811 16 58.4446 16C58.2872 16 58.1621 15.967 58.0617 15.9405L57.0944 15.6878C56.3739 15.4997 55.6553 15.312 54.936 15.1233C53.8594 15.6379 52.7204 15.8988 51.5464 15.8988C51.0243 15.8988 50.4877 15.8466 49.9521 15.7439C47.8668 15.3452 45.9973 14.0703 44.823 12.2461C43.6488 10.4223 43.2634 8.19505 43.7656 6.13553C44.6446 2.51324 47.7615 0.0472629 51.5211 0.000260881L51.5409 0L51.5605 0.000391321C52.0913 0.0140876 52.5926 0.0651767 53.0508 0.152094C55.5798 0.666768 57.6424 2.28597 58.7224 4.59729C59.7655 6.82947 59.7232 9.34593 58.6144 11.5401C58.8921 12.5275 59.1643 13.5268 59.4414 14.5471C59.4869 14.7106 59.6124 15.1611 59.2901 15.5846ZM79.7577 8.77869C79.7577 7.05748 78.5162 5.63246 76.7557 5.63246C74.9582 5.63246 73.8092 7.03887 73.8092 8.7416V8.77869C73.8092 10.4814 75.0508 11.9064 76.7927 11.9064C78.6089 11.9064 79.7577 10.4999 79.7577 8.81573V8.77869ZM76.7557 13.868C73.7722 13.868 71.5669 11.5915 71.5669 8.81573V8.77869C71.5669 5.98404 73.7907 3.67068 76.7927 3.67068C79.7949 3.67068 82 5.94717 82 8.7416V8.77869C82 11.5545 79.7764 13.868 76.7557 13.868ZM68.7934 13.7387C68.1816 13.7387 67.6628 13.2571 67.6628 12.6281V12.1285C67.0328 13.0538 66.1247 13.8495 64.6051 13.8495C62.4 13.8495 61.1213 12.3691 61.1213 10.0925V4.89208C61.1213 4.2631 61.6216 3.76329 62.2331 3.76329C62.8633 3.76329 63.3637 4.2631 63.3637 4.89208V9.42637C63.3637 10.944 64.1233 11.7951 65.4575 11.7951C66.7547 11.7951 67.6628 10.9071 67.6628 9.38919V4.89208C67.6628 4.2631 68.1631 3.76329 68.7934 3.76329C69.4048 3.76329 69.9236 4.2631 69.9236 4.89208V12.6281C69.9236 13.2386 69.4233 13.7387 68.7934 13.7387ZM40.4153 3.76329C41.0454 3.76329 41.5457 4.2631 41.5457 4.89208V12.6281C41.5457 13.2571 41.0454 13.7387 40.4153 13.7387C39.8038 13.7387 39.3034 13.2571 39.3034 12.6281V4.89208C39.3034 4.2631 39.7852 3.76329 40.4153 3.76329ZM40.4153 2.4678C39.6925 2.4678 39.1368 2.02361 39.1368 1.35732V1.2464C39.1368 0.580156 39.6925 0.154442 40.4153 0.154442C41.1379 0.154442 41.694 0.580156 41.694 1.2464V1.35732C41.694 2.02361 41.1379 2.4678 40.4153 2.4678ZM34.7693 8.7416C34.7693 6.85382 33.435 5.6139 31.9339 5.6139C30.3961 5.6139 29.1173 6.79821 29.1173 8.7416V8.77869C29.1173 10.6665 30.4145 11.9064 31.9339 11.9064C33.435 11.9064 34.7693 10.6476 34.7693 8.77869V8.7416ZM35.8627 13.7387C35.2325 13.7387 34.7321 13.2571 34.7321 12.6281V12.0172C34.0095 13.0353 32.9903 13.8495 31.3966 13.8495C29.0988 13.8495 26.8566 12.0172 26.8566 8.77869V8.7416C26.8566 5.50298 29.0616 3.67068 31.3966 3.67068C33.0088 3.67068 34.028 4.4665 34.7321 5.39189V1.15383C34.7321 0.524632 35.2325 0.0434802 35.8439 0.0434802C36.4742 0.0434802 36.9745 0.524632 36.9745 1.15383V12.6281C36.9745 13.2571 36.4742 13.7387 35.8627 13.7387ZM21.0065 5.50298C19.6353 5.50298 18.6718 6.55763 18.4678 8.07548H23.4897C23.3416 6.63203 22.4892 5.50298 21.0065 5.50298ZM24.6203 9.55589H18.4864C18.7272 11.1477 19.8578 12.0357 21.3032 12.0357C22.2482 12.0357 22.9895 11.7028 23.6196 11.1846C23.7863 11.0548 23.9346 10.981 24.194 10.981C24.6945 10.981 25.0836 11.3698 25.0836 11.8879C25.0836 12.1654 24.9539 12.406 24.787 12.5727C23.8975 13.3683 22.7858 13.868 21.2662 13.868C18.4308 13.868 16.244 11.8136 16.244 8.79712V8.76021C16.244 5.96556 18.227 3.67068 21.0253 3.67068C24.1384 3.67068 25.6765 6.22475 25.6765 8.48246C25.6765 9.1117 25.1948 9.55589 24.6203 9.55589ZM13.7686 13.7387C13.1387 13.7387 12.6382 13.2571 12.6382 12.6281V8.09396C12.6382 6.53915 11.9155 5.70655 10.6555 5.70655C9.43232 5.70655 8.56142 6.55763 8.56142 8.13083V12.6281C8.56142 13.2571 8.06108 13.7387 7.44958 13.7387C6.81941 13.7387 6.3192 13.2571 6.3192 12.6281V8.07548C6.3192 6.55763 5.57796 5.70655 4.33625 5.70655C3.09479 5.70655 2.24235 6.63203 2.24235 8.13083V12.6281C2.24235 13.2571 1.74205 13.7387 1.1118 13.7387C0.500341 13.7387 0 13.2571 0 12.6281V4.89208C0 4.2631 0.481844 3.76329 1.1118 3.76329C1.74205 3.76329 2.24235 4.2631 2.24235 4.89208V5.35475C2.87235 4.48511 3.72475 3.67068 5.22586 3.67068C6.63431 3.67068 7.63481 4.35545 8.15378 5.39189C8.93198 4.35545 9.96987 3.67068 11.4522 3.67068C13.5833 3.67068 14.8804 5.02183 14.8804 7.40919V12.6281C14.8804 13.2571 14.3988 13.7387 13.7686 13.7387Z" fill="#0A0A22"/></svg>`}</div></footer>`:e`<div class="content"><slot></slot></div>`}};t([i({type:String})],d.prototype,"background",void 0),t([i()],d.prototype,"variant",void 0),t([i({type:Boolean,attribute:"show-mediquo-branding"})],d.prototype,"showMediquoBranding",void 0),d=t([a(),o("mq-layout")],d);
1
+ import{_ as t,t as o}from"./custom-element-DA9Fxvxd.js";import{m as C}from"./runtime-Bg1WXVCx.js";import{l as a}from"./parseISO-jT42c8Ob.js";import{a as r,i as n,x as e}from"./lit-element-DiWJYFwC.js";import{n as i}from"./property-scuRaFcM.js";let s=class MQLayout extends r{constructor(){super(...arguments),this.background="default",this.variant="default",this.showMediquoBranding=!0}static{this.styles=n`:host{--content-max-width:560px;display:flex;flex-direction:column;height:100%;width:100%;max-width:var(--content-max-width);margin:0 auto;background-color:var(--color-background)}:host([background=solid]){background-color:var(--color-background)}:host([background=transparent]){background-color:transparent}:host([variant=wide]){--content-max-width:1000px}.content{flex:1;padding:var(--mq-layout-padding,0)}footer{display:flex;flex-direction:column;align-items:center;gap:var(--sp-4);padding-top:var(--sp-10);padding-bottom:var(--sp-3);padding-inline:var(--mq-layout-padding,0);margin-bottom:var(--sp-3);text-align:center}.branding{display:flex;justify-content:center;align-items:center;gap:var(--size-2);font-family:var(--font-body);font-size:var(--text-sm);line-height:normal;font-weight:var(--font-weight-normal);color:var(--color-neutrals-text-default)}`}render(){return this.showMediquoBranding?e`<div class="content"><slot></slot></div><footer><div class="branding">${C("Servicio y plataforma prestados por")} ${e`<svg width="82" height="16" viewBox="0 0 82 16" fill="none" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" clip-rule="evenodd" d="M52.4506 8.97739V10.5665C52.4506 11.1054 52.0077 11.5477 51.4682 11.5477C50.9288 11.5477 50.486 11.1054 50.486 10.5665V8.97739H48.8531C48.3276 8.97739 47.8984 8.54894 47.8984 8.02383C47.8984 7.49893 48.3276 7.07053 48.8531 7.07053H50.486V5.48128C50.486 4.94243 50.9288 4.5002 51.4682 4.5002C52.0077 4.5002 52.4506 4.94243 52.4506 5.48128V7.07053H54.0836C54.609 7.07053 55.0379 7.49893 55.0379 8.02383C55.0379 8.54894 54.609 8.97739 54.0836 8.97739H52.4506ZM56.8563 5.46693C56.055 3.75203 54.5229 2.55033 52.6531 2.16979C52.3272 2.10809 51.9339 2.06818 51.5273 2.05679C48.7327 2.10005 46.4191 3.93204 45.7665 6.6209C45.397 8.13705 45.6843 9.78156 46.555 11.134C47.4258 12.4867 48.8053 13.431 50.3396 13.7243C51.7168 13.9883 53.0199 13.8046 54.2312 13.1767L54.2853 13.1506C54.554 13.0306 54.8304 12.9977 55.1481 13.0559L55.2243 13.0728C55.8277 13.2312 56.4308 13.389 57.0345 13.5467C56.8787 12.9784 56.7231 12.4168 56.5656 11.86L56.5512 11.8035C56.4673 11.4258 56.5163 11.0837 56.7011 10.7579C57.5947 9.11014 57.6548 7.17549 56.8563 5.46693ZM59.2901 15.5846C59.0891 15.8486 58.7811 16 58.4446 16C58.2872 16 58.1621 15.967 58.0617 15.9405L57.0944 15.6878C56.3739 15.4997 55.6553 15.312 54.936 15.1233C53.8594 15.6379 52.7204 15.8988 51.5464 15.8988C51.0243 15.8988 50.4877 15.8466 49.9521 15.7439C47.8668 15.3452 45.9973 14.0703 44.823 12.2461C43.6488 10.4223 43.2634 8.19505 43.7656 6.13553C44.6446 2.51324 47.7615 0.0472629 51.5211 0.000260881L51.5409 0L51.5605 0.000391321C52.0913 0.0140876 52.5926 0.0651767 53.0508 0.152094C55.5798 0.666768 57.6424 2.28597 58.7224 4.59729C59.7655 6.82947 59.7232 9.34593 58.6144 11.5401C58.8921 12.5275 59.1643 13.5268 59.4414 14.5471C59.4869 14.7106 59.6124 15.1611 59.2901 15.5846ZM79.7577 8.77869C79.7577 7.05748 78.5162 5.63246 76.7557 5.63246C74.9582 5.63246 73.8092 7.03887 73.8092 8.7416V8.77869C73.8092 10.4814 75.0508 11.9064 76.7927 11.9064C78.6089 11.9064 79.7577 10.4999 79.7577 8.81573V8.77869ZM76.7557 13.868C73.7722 13.868 71.5669 11.5915 71.5669 8.81573V8.77869C71.5669 5.98404 73.7907 3.67068 76.7927 3.67068C79.7949 3.67068 82 5.94717 82 8.7416V8.77869C82 11.5545 79.7764 13.868 76.7557 13.868ZM68.7934 13.7387C68.1816 13.7387 67.6628 13.2571 67.6628 12.6281V12.1285C67.0328 13.0538 66.1247 13.8495 64.6051 13.8495C62.4 13.8495 61.1213 12.3691 61.1213 10.0925V4.89208C61.1213 4.2631 61.6216 3.76329 62.2331 3.76329C62.8633 3.76329 63.3637 4.2631 63.3637 4.89208V9.42637C63.3637 10.944 64.1233 11.7951 65.4575 11.7951C66.7547 11.7951 67.6628 10.9071 67.6628 9.38919V4.89208C67.6628 4.2631 68.1631 3.76329 68.7934 3.76329C69.4048 3.76329 69.9236 4.2631 69.9236 4.89208V12.6281C69.9236 13.2386 69.4233 13.7387 68.7934 13.7387ZM40.4153 3.76329C41.0454 3.76329 41.5457 4.2631 41.5457 4.89208V12.6281C41.5457 13.2571 41.0454 13.7387 40.4153 13.7387C39.8038 13.7387 39.3034 13.2571 39.3034 12.6281V4.89208C39.3034 4.2631 39.7852 3.76329 40.4153 3.76329ZM40.4153 2.4678C39.6925 2.4678 39.1368 2.02361 39.1368 1.35732V1.2464C39.1368 0.580156 39.6925 0.154442 40.4153 0.154442C41.1379 0.154442 41.694 0.580156 41.694 1.2464V1.35732C41.694 2.02361 41.1379 2.4678 40.4153 2.4678ZM34.7693 8.7416C34.7693 6.85382 33.435 5.6139 31.9339 5.6139C30.3961 5.6139 29.1173 6.79821 29.1173 8.7416V8.77869C29.1173 10.6665 30.4145 11.9064 31.9339 11.9064C33.435 11.9064 34.7693 10.6476 34.7693 8.77869V8.7416ZM35.8627 13.7387C35.2325 13.7387 34.7321 13.2571 34.7321 12.6281V12.0172C34.0095 13.0353 32.9903 13.8495 31.3966 13.8495C29.0988 13.8495 26.8566 12.0172 26.8566 8.77869V8.7416C26.8566 5.50298 29.0616 3.67068 31.3966 3.67068C33.0088 3.67068 34.028 4.4665 34.7321 5.39189V1.15383C34.7321 0.524632 35.2325 0.0434802 35.8439 0.0434802C36.4742 0.0434802 36.9745 0.524632 36.9745 1.15383V12.6281C36.9745 13.2571 36.4742 13.7387 35.8627 13.7387ZM21.0065 5.50298C19.6353 5.50298 18.6718 6.55763 18.4678 8.07548H23.4897C23.3416 6.63203 22.4892 5.50298 21.0065 5.50298ZM24.6203 9.55589H18.4864C18.7272 11.1477 19.8578 12.0357 21.3032 12.0357C22.2482 12.0357 22.9895 11.7028 23.6196 11.1846C23.7863 11.0548 23.9346 10.981 24.194 10.981C24.6945 10.981 25.0836 11.3698 25.0836 11.8879C25.0836 12.1654 24.9539 12.406 24.787 12.5727C23.8975 13.3683 22.7858 13.868 21.2662 13.868C18.4308 13.868 16.244 11.8136 16.244 8.79712V8.76021C16.244 5.96556 18.227 3.67068 21.0253 3.67068C24.1384 3.67068 25.6765 6.22475 25.6765 8.48246C25.6765 9.1117 25.1948 9.55589 24.6203 9.55589ZM13.7686 13.7387C13.1387 13.7387 12.6382 13.2571 12.6382 12.6281V8.09396C12.6382 6.53915 11.9155 5.70655 10.6555 5.70655C9.43232 5.70655 8.56142 6.55763 8.56142 8.13083V12.6281C8.56142 13.2571 8.06108 13.7387 7.44958 13.7387C6.81941 13.7387 6.3192 13.2571 6.3192 12.6281V8.07548C6.3192 6.55763 5.57796 5.70655 4.33625 5.70655C3.09479 5.70655 2.24235 6.63203 2.24235 8.13083V12.6281C2.24235 13.2571 1.74205 13.7387 1.1118 13.7387C0.500341 13.7387 0 13.2571 0 12.6281V4.89208C0 4.2631 0.481844 3.76329 1.1118 3.76329C1.74205 3.76329 2.24235 4.2631 2.24235 4.89208V5.35475C2.87235 4.48511 3.72475 3.67068 5.22586 3.67068C6.63431 3.67068 7.63481 4.35545 8.15378 5.39189C8.93198 4.35545 9.96987 3.67068 11.4522 3.67068C13.5833 3.67068 14.8804 5.02183 14.8804 7.40919V12.6281C14.8804 13.2571 14.3988 13.7387 13.7686 13.7387Z" fill="#0A0A22"/></svg>`}</div></footer>`:e`<div class="content"><slot></slot></div>`}};t([i({type:String})],s.prototype,"background",void 0),t([i()],s.prototype,"variant",void 0),t([i({type:Boolean,attribute:"show-mediquo-branding"})],s.prototype,"showMediquoBranding",void 0),s=t([a(),o("mq-layout")],s);
@@ -1 +1 @@
1
- import{_ as t,t as e}from"./custom-element-DA9Fxvxd.js";import{m as i}from"./runtime-Bg1WXVCx.js";import{l as n}from"./parseISO-jT42c8Ob.js";import{g as o}from"./api-chat-client-BTBtu01T.js";import{a as r}from"./telemetry-client-CKCb9Gnf.js";import{i as a,a as s,E as l,x as p}from"./lit-element-DiWJYFwC.js";import{n as m}from"./property-scuRaFcM.js";import{e as c}from"./class-map-Co76I6aw.js";import{getLocale as h}from"../i18n.js";import{briefcaseIcon as d}from"../ui/icons/briefcase-icon.js";import{calendarIcon as u}from"../ui/icons/calendar-icon.js";import{clockIcon as f}from"../ui/icons/clock-icon.js";import{messageBubbleIcon as v}from"../ui/icons/message-bubble-icon.js";import{phoneIcon as w}from"../ui/icons/phone-icon.js";const y=a`.appointment-details{display:flex;flex-direction:column;gap:var(--sp-3)}.detail-row{display:inline-flex;width:fit-content;align-items:center;gap:var(--sp-2);color:var(--color-neutrals-text-default);font-family:var(--font-body);font-size:var(--text-sm);line-height:var(--text-sm--line-height);font-weight:var(--font-weight-bold)}.detail-row svg{flex-shrink:0}.detail-row span::first-letter{text-transform:uppercase}.detail-row.full-width{width:100%}:host([strike-through]) .detail-row span{text-decoration:line-through}@media (min-width:768px){.appointment-details.wide{flex-direction:row;flex-wrap:wrap}}`;let g=class AppointmentDetails extends s{constructor(){super(...arguments),this.channel=void 0,this.variant="default",this.strikeThrough=!1,this.timezone=void 0,this._appointmentChannelToLabel=t=>{switch(t){case"videocall":return i("Videoconsulta");case"chat":return i("Chat");case"phonecall":return i("Consulta telefónica");default:return""}},this._appointmentChannelToIcon=t=>{switch(t){case"videocall":return d({size:24});case"chat":return v({size:24});case"phonecall":return w({size:24});default:return l}}}static{this.styles=y}render(){const t=h().replace("_","-"),e=new Intl.DateTimeFormat(t,{weekday:"long",year:"numeric",month:"long",day:"numeric",...this.timezone?{timeZone:this.timezone}:{}}),i=new Intl.DateTimeFormat(t,{timeStyle:"short",...this.timezone?{timeZone:this.timezone}:{}}),n=new Date(this.startsAt),a=r(n,this.duration),s=e.format(n),m=i.format(n),d=i.format(a),v=this.timezone?o(this.timezone,n):"";return p`<div class="${c({"appointment-details":!0,wide:"wide"===this.variant})}"><div class="detail-row">${u({size:24})} <span>${s}</span></div><div class="detail-row">${f({size:24})} <span>${m} - ${d}${v?` (${v})`:""}</span></div>${this.channel?p`<div class="detail-row full-width">${this._appointmentChannelToIcon(this.channel)} <span>${this._appointmentChannelToLabel(this.channel)}</span></div>`:l}</div>`}};function j(t){return t/100}function x(t,e){const i=e.replaceAll("_","-");return new Intl.NumberFormat(i,{style:"currency",currency:t.currency}).format(j(t.amount))}function z(t){return null!=t&&t.amount>0}t([m({type:String})],g.prototype,"startsAt",void 0),t([m({type:Number})],g.prototype,"duration",void 0),t([m({type:String})],g.prototype,"channel",void 0),t([m({type:String})],g.prototype,"variant",void 0),t([m({type:Boolean,attribute:"strike-through"})],g.prototype,"strikeThrough",void 0),t([m({type:String})],g.prototype,"timezone",void 0),g=t([n(),e("appointment-details")],g);export{g as A,j as c,x as f,z as h};
1
+ import{_ as t,t as e}from"./custom-element-DA9Fxvxd.js";import{m as i}from"./runtime-Bg1WXVCx.js";import{l as n}from"./parseISO-jT42c8Ob.js";import{g as o}from"./api-chat-client-C8SqZtCa.js";import{a as r}from"./telemetry-client-BRVJU-fZ.js";import{i as a,a as s,E as l,x as p}from"./lit-element-DiWJYFwC.js";import{n as m}from"./property-scuRaFcM.js";import{e as c}from"./class-map-Co76I6aw.js";import{getLocale as h}from"../i18n.js";import{briefcaseIcon as d}from"../ui/icons/briefcase-icon.js";import{calendarIcon as u}from"../ui/icons/calendar-icon.js";import{clockIcon as f}from"../ui/icons/clock-icon.js";import{messageBubbleIcon as v}from"../ui/icons/message-bubble-icon.js";import{phoneIcon as w}from"../ui/icons/phone-icon.js";const y=a`.appointment-details{display:flex;flex-direction:column;gap:var(--sp-3)}.detail-row{display:inline-flex;width:fit-content;align-items:center;gap:var(--sp-2);color:var(--color-neutrals-text-default);font-family:var(--font-body);font-size:var(--text-sm);line-height:var(--text-sm--line-height);font-weight:var(--font-weight-bold)}.detail-row svg{flex-shrink:0}.detail-row span::first-letter{text-transform:uppercase}.detail-row.full-width{width:100%}:host([strike-through]) .detail-row span{text-decoration:line-through}@media (min-width:768px){.appointment-details.wide{flex-direction:row;flex-wrap:wrap}}`;let g=class AppointmentDetails extends s{constructor(){super(...arguments),this.channel=void 0,this.variant="default",this.strikeThrough=!1,this.timezone=void 0,this._appointmentChannelToLabel=t=>{switch(t){case"videocall":return i("Videoconsulta");case"chat":return i("Chat");case"phonecall":return i("Consulta telefónica");default:return""}},this._appointmentChannelToIcon=t=>{switch(t){case"videocall":return d({size:24});case"chat":return v({size:24});case"phonecall":return w({size:24});default:return l}}}static{this.styles=y}render(){const t=h().replace("_","-"),e=new Intl.DateTimeFormat(t,{weekday:"long",year:"numeric",month:"long",day:"numeric",...this.timezone?{timeZone:this.timezone}:{}}),i=new Intl.DateTimeFormat(t,{timeStyle:"short",...this.timezone?{timeZone:this.timezone}:{}}),n=new Date(this.startsAt),a=r(n,this.duration),s=e.format(n),m=i.format(n),d=i.format(a),v=this.timezone?o(this.timezone,n):"";return p`<div class="${c({"appointment-details":!0,wide:"wide"===this.variant})}"><div class="detail-row">${u({size:24})} <span>${s}</span></div><div class="detail-row">${f({size:24})} <span>${m} - ${d}${v?` (${v})`:""}</span></div>${this.channel?p`<div class="detail-row full-width">${this._appointmentChannelToIcon(this.channel)} <span>${this._appointmentChannelToLabel(this.channel)}</span></div>`:l}</div>`}};function j(t){return t/100}function x(t,e){const i=e.replaceAll("_","-");return new Intl.NumberFormat(i,{style:"currency",currency:t.currency}).format(j(t.amount))}function z(t){return null!=t&&t.amount>0}t([m({type:String})],g.prototype,"startsAt",void 0),t([m({type:Number})],g.prototype,"duration",void 0),t([m({type:String})],g.prototype,"channel",void 0),t([m({type:String})],g.prototype,"variant",void 0),t([m({type:Boolean,attribute:"strike-through"})],g.prototype,"strikeThrough",void 0),t([m({type:String})],g.prototype,"timezone",void 0),g=t([n(),e("appointment-details")],g);export{g as A,j as c,x as f,z as h};
@@ -1 +1 @@
1
- import{c as e}from"./api-chat-client-BTBtu01T.js";import{t}from"./parseISO-jT42c8Ob.js";function n(e,n,r){const s=function(e,n){return+t(e)-+t(n)}(e,n)/1e3;return(c=r?.roundingMethod,e=>{const t=(c?Math[c]:Math.trunc)(e);return 0===t?0:t})(s);var c}function r(e){return{queryKey:["schedule-services"],queryFn:()=>e.schedules.getScheduleServices()}}function s(t){const{startsAtIso:r,refundPolicySeconds:s,now:c=new Date}=t,o=n(e(r),c);return!(o<0)&&(null==s||o>=s)}export{s as c,r as g};
1
+ import{a as e}from"./api-chat-client-C8SqZtCa.js";import{t}from"./parseISO-jT42c8Ob.js";function n(e,n,r){const s=function(e,n){return+t(e)-+t(n)}(e,n)/1e3;return(c=r?.roundingMethod,e=>{const t=(c?Math[c]:Math.trunc)(e);return 0===t?0:t})(s);var c}function r(e){return{queryKey:["schedule-services"],queryFn:()=>e.schedules.getScheduleServices()}}function s(t){const{startsAtIso:r,refundPolicySeconds:s,now:c=new Date}=t,o=n(e(r),c);return!(o<0)&&(null==s||o>=s)}export{s as c,r as g};
@@ -1 +1 @@
1
- import{c as t,t as e,l as a}from"./parseISO-jT42c8Ob.js";import{_ as i,t as n}from"./custom-element-DA9Fxvxd.js";import{m as o,s}from"./runtime-Bg1WXVCx.js";import{i as r,a as p,x as l,E as c}from"./lit-element-DiWJYFwC.js";import{n as d}from"./property-scuRaFcM.js";import{r as u}from"./state-LQivXIgA.js";import{getLocale as _}from"../i18n.js";import{chevronDownIcon as h}from"../ui/icons/chevron-down-icon.js";import"../ui/mq-text-button.js";import"../ui/mq-avatar.js";function y(a,i,n){return function(a,i){return t(a,+e(a)+i)}(a,1e3*i)}function v(t,e){return{queryKey:["organization-specialties"],queryFn:()=>t.organizations.getOrganizationSpecialties(),...e}}const m=r`.header{display:flex;align-items:center;gap:var(--sp-4);margin-bottom:0}.header.expanded{margin-bottom:var(--sp-4)}@media (max-width:768px){.header{--avatar-size-lg:var(--avatar-size-md)}}.professional-info{flex:1}.professional-name{font-family:var(--font-titles);font-size:var(--text-lg);line-height:var(--text-lg--line-height);font-weight:var(--font-weight-bold);color:var(--color-neutral-link-dark);margin:0}.professional-specialty{font-family:var(--font-body);font-size:var(--text-sm);line-height:var(--text-sm--line-height);font-weight:var(--font-weight-normal);color:var(--color-neutral-text-default);margin:0}.collegiate-number{font-family:var(--font-body);font-size:var(--text-xs);line-height:var(--text-xs--line-height);color:var(--color-neutrals-text-medium);margin:0;text-transform:uppercase}.languages{display:flex;flex-wrap:wrap;gap:var(--sp-3)}.language-pill{display:inline-block;background-color:#e5e5e5;color:var(--colors-neutral-text-default);font-family:var(--font-body);font-size:var(--text-xs);line-height:var(--text-xs--line-height);font-weight:var(--font-weight-medium);padding:var(--sp-1) var(--sp-2);border-radius:26px;text-transform:uppercase}.description{font-family:var(--font-body);font-size:var(--text-xs);line-height:var(--text-xs--line-height);font-weight:var(--font-weight-normal);margin-bottom:0;color:var(--color-neutrals-text-medium)}.icon{transition:transform .1s ease-in-out}.rotate-180{transform:rotate(180deg)}.details{display:grid;grid-template-rows:0fr;transition:grid-template-rows .2s ease-out;overflow:hidden}.details[data-expanded=true]{grid-template-rows:1fr}.details-content{overflow:hidden}.details-content>:not(:first-child){margin-top:var(--sp-3)}@media (min-width:769px){:host([always-expanded-on-desktop]) .details{grid-template-rows:1fr}:host([always-expanded-on-desktop]) mq-text-button{display:none}:host([always-expanded-on-desktop]) .header{margin-bottom:var(--sp-4)}}`;let g=class ProfessionalOverview extends p{constructor(){super(...arguments),this.alwaysExpandedOnDesktop=!1,this.detailsExpanded=!1}static{this.styles=m}render(){const t=_().replace("_","-"),e=this.languages.map(e=>l`<span class="language-pill">${new Intl.DisplayNames(t,{type:"language"}).of(e)}</span>`);return l`<div class="header ${this.detailsExpanded?"expanded":""}"><mq-avatar src="${this.avatar}" fallback="${this.name}" alt="${this.name}" size="lg"></mq-avatar><div class="professional-info"><h2 class="professional-name">${this.name}</h2>${this.specialtyName?l`<p class="professional-specialty">${this.specialtyName}</p>`:c}<mq-text-button type="button" size="sm" fontWeight="bold" @click="${()=>{this.detailsExpanded=!this.detailsExpanded}}">${this.detailsExpanded?o("Ocultar detalles"):o("Ver detalles")} ${h({size:24,className:"icon "+(this.detailsExpanded?"rotate-180":"")})}</mq-text-button></div></div><div class="details" data-expanded="${this.detailsExpanded}"><div class="details-content"><div class="languages">${e}</div>${this.collegiateNumber?l`<p class="collegiate-number">${o(s`Nº COL. ${this.collegiateNumber}`)}</p>`:c}<p class="description">${this.description}</p></div></div>`}};i([d({type:String})],g.prototype,"name",void 0),i([d({type:String})],g.prototype,"specialtyName",void 0),i([d({type:String})],g.prototype,"collegiateNumber",void 0),i([d({type:String})],g.prototype,"description",void 0),i([d({type:Array})],g.prototype,"languages",void 0),i([d({type:String})],g.prototype,"avatar",void 0),i([d({type:Boolean,reflect:!0,attribute:"always-expanded-on-desktop"})],g.prototype,"alwaysExpandedOnDesktop",void 0),i([u()],g.prototype,"detailsExpanded",void 0),g=i([a(),n("professional-overview")],g);var f={digestive_system:{de_DE:"Verdauungssystem",en_US:"Digestive System",es_ES:"Aparato Digestivo",ca_ES:"Aparell Digestiu",pt_PT:"Aparelho Digestivo"},orthopedic_surgery_traumatology:{de_DE:"Traumatologie und Orthopädische Chirurgie",en_US:"Traumatology and Orthopedic Surgery",es_ES:"Traumatología y Cirugía Ortopédica",ca_ES:"Traumatologia i Cirurgia Ortopèdica",pt_PT:"Traumatologia e Cirurgia Ortopédica"},gynecology:{de_DE:"Gynäkologie",en_US:"Gynecology",es_ES:"Ginecología",ca_ES:"Ginecologia",pt_PT:"Ginecologia"},endocrinology:{de_DE:"Endokrinologie",en_US:"Endocrinology",es_ES:"Endocrinología",ca_ES:"Endocrinologia",pt_PT:"Endocrinologia"},psychiatry:{de_DE:"Psychiatrie",en_US:"Psychiatry",es_ES:"Psiquiatría",ca_ES:"Psiquiatria",pt_PT:"Psiquiatria"}},x={videocall:{de_DE:"Videosprechstunde",en_US:"Videocall",es_ES:"Videoconsulta",ca_ES:"Videoconsulta",pt_PT:"Videoconsulta"},phonecall:{de_DE:"Telefonische Behandlung",en_US:"Phone consultation",es_ES:"Consulta telefónica",ca_ES:"Consulta telefònica",pt_PT:"Consulta telefónica"}},b={de_DE:"Konsultationspreis",en_US:"Consultation price",es_ES:"Precio de consulta",ca_ES:"Preu de consulta",pt_PT:"Preço da consulta"},w={videocall:"videocall",phonecall:"phonecall",adeslas_videocall:"videocall",adeslas_prod_videocall:"videocall",adeslas_phonecall:"phonecall",adeslas_prod_phonecall:"phonecall"};function E(t,e,a){if(!t)return a??"";const i=w[t];return i?x[i][e]:a??b[e]}var S={consulta_telefonica:"phonecall",videoconsulta:"videocall"},k={"aparato-digestivo":"digestive_system","cirugia-ortopedica-y-traumatologia":"orthopedic_surgery_traumatology",ginecologia:"gynecology",endocrinologia:"endocrinology",psiquiatria:"psychiatry"};function T(t,e,a){const i=a?.trim();if(i)return i;const n=f[t]?.[e];return void 0!==n?n:t}function P(t,e){return{action_type:"event",event_type:"access to videocall button click",patient_hash:t,id_appointment:e}}function q(t,e){return{action_type:"event",event_type:"open chat button click",patient_hash:t,id_appointment:e}}function $(t,e){return{action_type:"event",event_type:"modify appoinment button click",patient_hash:t,id_appointment:e}}function D(t,e){return{action_type:"event",event_type:"cancel appoinment button click",patient_hash:t,id_appointment:e}}function z(t,e){return{action_type:"event",event_type:"view appointment document list button click",patient_hash:t,id_appointment:e}}function C(t,e){return{action_type:"event",event_type:"repeat appointment button click",patient_hash:t,id_appointment:e}}function O(t,e){return{action_type:"event",event_type:"open chat button click",patient_hash:t,id_appointment:e}}function j(t,e){return{action_type:"event",event_type:"access to videocall button click",patient_hash:t,id_appointment:e}}function K(t,e){return{action_type:"event",event_type:"add to calendar button click",patient_hash:t,id_appointment:e}}function N(t,e){return{action_type:"pageview",event_type:"appointment success page view",patient_hash:t,id_appointment:e}}function U(t,e){return{action_type:"event",event_type:"open chat button click",patient_hash:t,id_appointment:e}}function A(t,e){return{action_type:"event",event_type:"update documentation",patient_hash:t,id_appointment:e}}function V(t,e){return{action_type:"pageview",event_type:"documentation page view",patient_hash:t,id_appointment:e}}function G(t,e,a){return{action_type:"event",event_type:"find availability button click",patient_hash:t,speciality_id:e,service_id:a}}function B(t,e,a,i,n,o,s){return{action_type:"debug",event_type:"find availability result",patient_hash:t,speciality_id:e,service_id:a,first_slot_date:i,first_slot_professional_hash:n,total_professionals:o,total_slots:s}}function H(t,e,a,i,n){return{action_type:"event",event_type:"professional schedule slot button click",patient_hash:t,professional_hash:e,start_date:a,speciality_id:i,service_id:n}}function I(t,e,a,i){return{action_type:"event",event_type:"professional availability button click",patient_hash:t,professional_hash:e,speciality_id:a,service_id:i}}function M(t,e,a,i,n){return{action_type:"event",event_type:"confirm appointment button click",patient_hash:t,professional_hash:e,start_date:a,speciality_id:i,service_id:n}}function F(t){return{action_type:"pageview",event_type:"select professional step page view",patient_hash:t}}function J(t,e){return{action_type:"pageview",event_type:"not time yet pageview",patient_hash:t,id_appointment:e}}function L(t,e){return{action_type:"event",event_type:"open chat button click",patient_hash:t,id_appointment:e}}function W(t,e){return{action_type:"pageview",event_type:"waiting room pageview",patient_hash:t,id_appointment:e}}function Q(t,e){return{action_type:"pageview",event_type:"videocall pageview",patient_hash:t,id_appointment:e}}class HttpTransport{endpoint;apiKey;constructor(t,e){this.endpoint=t,this.apiKey=e}send(t){fetch(this.endpoint,{method:"POST",headers:{"Content-Type":"application/json","x-api-key":this.apiKey},body:JSON.stringify(t)}).catch(()=>{})}}class MediquoTelemetryClient{_apiKey=null;_transport=null;setApiKey(t){this._apiKey=t,this._buildTransport()}track(t){null!==this._transport&&this._transport.send(t)}_buildTransport(){null!==this._apiKey&&(this._transport=new HttpTransport("https://tracking.____.mediquo.com/sdk",this._apiKey))}}const R=new class AppTelemetryClient extends MediquoTelemetryClient{track(t){}};export{H as A,I as B,B as C,F as D,g as P,S,y as a,N as b,T as c,K as d,O as e,j as f,v as g,$ as h,D as i,C as j,P as k,z as l,q as m,L as n,W as o,Q as p,V as q,A as r,U as s,R as t,k as u,J as v,E as w,M as x,G as y,f as z};
1
+ import{c as t,t as e,l as a}from"./parseISO-jT42c8Ob.js";import{_ as i,t as n}from"./custom-element-DA9Fxvxd.js";import{m as o,s}from"./runtime-Bg1WXVCx.js";import{i as r,a as p,x as l,E as c}from"./lit-element-DiWJYFwC.js";import{n as d}from"./property-scuRaFcM.js";import{r as u}from"./state-LQivXIgA.js";import{getLocale as _}from"../i18n.js";import{chevronDownIcon as h}from"../ui/icons/chevron-down-icon.js";import"../ui/mq-text-button.js";import"../ui/mq-avatar.js";function y(a,i,n){return function(a,i){return t(a,+e(a)+i)}(a,1e3*i)}function v(t,e){return{queryKey:["organization-specialties"],queryFn:()=>t.organizations.getOrganizationSpecialties(),...e}}const m=r`.header{display:flex;align-items:center;gap:var(--sp-4);margin-bottom:0}.header.expanded{margin-bottom:var(--sp-4)}@media (max-width:768px){.header{--avatar-size-lg:var(--avatar-size-md)}}.professional-info{flex:1}.professional-name{font-family:var(--font-titles);font-size:var(--text-lg);line-height:var(--text-lg--line-height);font-weight:var(--font-weight-bold);color:var(--color-neutral-link-dark);margin:0}.professional-specialty{font-family:var(--font-body);font-size:var(--text-sm);line-height:var(--text-sm--line-height);font-weight:var(--font-weight-normal);color:var(--color-neutral-text-default);margin:0}.collegiate-number{font-family:var(--font-body);font-size:var(--text-xs);line-height:var(--text-xs--line-height);color:var(--color-neutrals-text-medium);margin:0;text-transform:uppercase}.languages{display:flex;flex-wrap:wrap;gap:var(--sp-3)}.language-pill{display:inline-block;background-color:#e5e5e5;color:var(--colors-neutral-text-default);font-family:var(--font-body);font-size:var(--text-xs);line-height:var(--text-xs--line-height);font-weight:var(--font-weight-medium);padding:var(--sp-1) var(--sp-2);border-radius:26px;text-transform:uppercase}.description{font-family:var(--font-body);font-size:var(--text-xs);line-height:var(--text-xs--line-height);font-weight:var(--font-weight-normal);margin-bottom:0;color:var(--color-neutrals-text-medium)}.icon{transition:transform .1s ease-in-out}.rotate-180{transform:rotate(180deg)}.details{display:grid;grid-template-rows:0fr;transition:grid-template-rows .2s ease-out;overflow:hidden}.details[data-expanded=true]{grid-template-rows:1fr}.details-content{overflow:hidden}.details-content>:not(:first-child){margin-top:var(--sp-3)}@media (min-width:769px){:host([always-expanded-on-desktop]) .details{grid-template-rows:1fr}:host([always-expanded-on-desktop]) mq-text-button{display:none}:host([always-expanded-on-desktop]) .header{margin-bottom:var(--sp-4)}}`;let g=class ProfessionalOverview extends p{constructor(){super(...arguments),this.alwaysExpandedOnDesktop=!1,this.detailsExpanded=!1}static{this.styles=m}render(){const t=_().replace("_","-"),e=this.languages.map(e=>l`<span class="language-pill">${new Intl.DisplayNames(t,{type:"language"}).of(e)}</span>`);return l`<div class="header ${this.detailsExpanded?"expanded":""}"><mq-avatar src="${this.avatar}" fallback="${this.name}" alt="${this.name}" size="lg"></mq-avatar><div class="professional-info"><h2 class="professional-name">${this.name}</h2>${this.specialtyName?l`<p class="professional-specialty">${this.specialtyName}</p>`:c}<mq-text-button type="button" size="sm" fontWeight="bold" @click="${()=>{this.detailsExpanded=!this.detailsExpanded}}">${this.detailsExpanded?o("Ocultar detalles"):o("Ver detalles")} ${h({size:24,className:"icon "+(this.detailsExpanded?"rotate-180":"")})}</mq-text-button></div></div><div class="details" data-expanded="${this.detailsExpanded}"><div class="details-content"><div class="languages">${e}</div>${this.collegiateNumber?l`<p class="collegiate-number">${o(s`Nº COL. ${this.collegiateNumber}`)}</p>`:c}<p class="description">${this.description}</p></div></div>`}};i([d({type:String})],g.prototype,"name",void 0),i([d({type:String})],g.prototype,"specialtyName",void 0),i([d({type:String})],g.prototype,"collegiateNumber",void 0),i([d({type:String})],g.prototype,"description",void 0),i([d({type:Array})],g.prototype,"languages",void 0),i([d({type:String})],g.prototype,"avatar",void 0),i([d({type:Boolean,reflect:!0,attribute:"always-expanded-on-desktop"})],g.prototype,"alwaysExpandedOnDesktop",void 0),i([u()],g.prototype,"detailsExpanded",void 0),g=i([a(),n("professional-overview")],g);var f={digestive_system:{de_DE:"Verdauungssystem",en_US:"Digestive System",es_ES:"Aparato Digestivo",ca_ES:"Aparell Digestiu",pt_PT:"Aparelho Digestivo"},orthopedic_surgery_traumatology:{de_DE:"Traumatologie und Orthopädische Chirurgie",en_US:"Traumatology and Orthopedic Surgery",es_ES:"Traumatología y Cirugía Ortopédica",ca_ES:"Traumatologia i Cirurgia Ortopèdica",pt_PT:"Traumatologia e Cirurgia Ortopédica"},gynecology:{de_DE:"Gynäkologie",en_US:"Gynecology",es_ES:"Ginecología",ca_ES:"Ginecologia",pt_PT:"Ginecologia"},endocrinology:{de_DE:"Endokrinologie",en_US:"Endocrinology",es_ES:"Endocrinología",ca_ES:"Endocrinologia",pt_PT:"Endocrinologia"},psychiatry:{de_DE:"Psychiatrie",en_US:"Psychiatry",es_ES:"Psiquiatría",ca_ES:"Psiquiatria",pt_PT:"Psiquiatria"}},x={videocall:{de_DE:"Videosprechstunde",en_US:"Videocall",es_ES:"Videoconsulta",ca_ES:"Videoconsulta",pt_PT:"Videoconsulta"},phonecall:{de_DE:"Telefonische Behandlung",en_US:"Phone consultation",es_ES:"Consulta telefónica",ca_ES:"Consulta telefònica",pt_PT:"Consulta telefónica"}},b={de_DE:"Konsultationspreis",en_US:"Consultation price",es_ES:"Precio de consulta",ca_ES:"Preu de consulta",pt_PT:"Preço da consulta"},w={videocall:"videocall",phonecall:"phonecall",adeslas_videocall:"videocall",adeslas_prod_videocall:"videocall",adeslas_phonecall:"phonecall",adeslas_prod_phonecall:"phonecall"};function E(t,e,a){if(!t)return a??"";const i=w[t];return i?x[i][e]:a??b[e]}var S={consulta_telefonica:"phonecall",videoconsulta:"videocall"},k={"aparato-digestivo":"digestive_system","cirugia-ortopedica-y-traumatologia":"orthopedic_surgery_traumatology",ginecologia:"gynecology",endocrinologia:"endocrinology",psiquiatria:"psychiatry"};function T(t,e,a){const i=a?.trim();if(i)return i;const n=f[t]?.[e];return void 0!==n?n:t}function P(t,e){return{action_type:"event",event_type:"access to videocall button click",patient_hash:t,id_appointment:e}}function q(t,e){return{action_type:"event",event_type:"open chat button click",patient_hash:t,id_appointment:e}}function $(t,e){return{action_type:"event",event_type:"modify appoinment button click",patient_hash:t,id_appointment:e}}function D(t,e){return{action_type:"event",event_type:"cancel appoinment button click",patient_hash:t,id_appointment:e}}function z(t,e){return{action_type:"event",event_type:"view appointment document list button click",patient_hash:t,id_appointment:e}}function C(t,e){return{action_type:"event",event_type:"repeat appointment button click",patient_hash:t,id_appointment:e}}function O(t,e){return{action_type:"event",event_type:"open chat button click",patient_hash:t,id_appointment:e}}function j(t,e){return{action_type:"event",event_type:"access to videocall button click",patient_hash:t,id_appointment:e}}function K(t,e){return{action_type:"event",event_type:"add to calendar button click",patient_hash:t,id_appointment:e}}function N(t,e){return{action_type:"pageview",event_type:"appointment success page view",patient_hash:t,id_appointment:e}}function U(t,e){return{action_type:"event",event_type:"open chat button click",patient_hash:t,id_appointment:e}}function A(t,e){return{action_type:"event",event_type:"update documentation",patient_hash:t,id_appointment:e}}function V(t,e){return{action_type:"pageview",event_type:"documentation page view",patient_hash:t,id_appointment:e}}function G(t,e,a){return{action_type:"event",event_type:"find availability button click",patient_hash:t,speciality_id:e,service_id:a}}function B(t,e,a,i,n,o,s){return{action_type:"debug",event_type:"find availability result",patient_hash:t,speciality_id:e,service_id:a,first_slot_date:i,first_slot_professional_hash:n,total_professionals:o,total_slots:s}}function H(t,e,a,i,n){return{action_type:"event",event_type:"professional schedule slot button click",patient_hash:t,professional_hash:e,start_date:a,speciality_id:i,service_id:n}}function I(t,e,a,i){return{action_type:"event",event_type:"professional availability button click",patient_hash:t,professional_hash:e,speciality_id:a,service_id:i}}function M(t,e,a,i,n){return{action_type:"event",event_type:"confirm appointment button click",patient_hash:t,professional_hash:e,start_date:a,speciality_id:i,service_id:n}}function F(t){return{action_type:"pageview",event_type:"select professional step page view",patient_hash:t}}function J(t,e){return{action_type:"pageview",event_type:"not time yet pageview",patient_hash:t,id_appointment:e}}function L(t,e){return{action_type:"event",event_type:"open chat button click",patient_hash:t,id_appointment:e}}function W(t,e){return{action_type:"pageview",event_type:"waiting room pageview",patient_hash:t,id_appointment:e}}function Q(t,e){return{action_type:"pageview",event_type:"videocall pageview",patient_hash:t,id_appointment:e}}class HttpTransport{endpoint;apiKey;constructor(t,e){this.endpoint=t,this.apiKey=e}send(t){fetch(this.endpoint,{method:"POST",headers:{"Content-Type":"application/json","x-api-key":this.apiKey},body:JSON.stringify(t)}).catch(()=>{})}}class MediquoTelemetryClient{_apiKey=null;_transport=null;setApiKey(t){this._apiKey=t,this._buildTransport()}track(t){null!==this._transport&&this._transport.send(t)}_buildTransport(){null!==this._apiKey&&(this._transport=new HttpTransport("https://tracking.____.mediquo.com/sdk",this._apiKey))}}const R=new class AppTelemetryClient extends MediquoTelemetryClient{track(t){}};export{Q as A,V as B,A as C,U as D,g as P,S,y as a,N as b,T as c,K as d,O as e,j as f,v as g,$ as h,D as i,C as j,P as k,z as l,q as m,k as n,E as o,G as p,f as q,H as r,M as s,R as t,I as u,B as v,F as w,J as x,L as y,W as z};
package/dist/env.js CHANGED
@@ -1 +1 @@
1
- const E="https://mediquo-landing.s3.eu-central-1.amazonaws.com/sdk-web/elements",o="production",e="0.3.1",n={development:{MODE:"development",MQ_DEFAULT_ENV:o,MQ_ELEMENTS_VERSION:e,OPENTOK_API_KEY:"47836441",ASSETS_BASE_URL:E},production:{MODE:"production",MQ_DEFAULT_ENV:o,MQ_ELEMENTS_VERSION:e,OPENTOK_API_KEY:"46655102",ASSETS_BASE_URL:E}};let t=o;const _=new Proxy({},{get:(E,o)=>n[t??"production"][o]});function S(E){t=E}export{E as ASSETS_BASE_URL,_ as env,S as setEnv};
1
+ const E="https://mediquo-landing.s3.eu-central-1.amazonaws.com/sdk-web/elements",o="production",e="0.4.0",n={development:{MODE:"development",MQ_DEFAULT_ENV:o,MQ_ELEMENTS_VERSION:e,OPENTOK_API_KEY:"47836441",ASSETS_BASE_URL:E},production:{MODE:"production",MQ_DEFAULT_ENV:o,MQ_ELEMENTS_VERSION:e,OPENTOK_API_KEY:"46655102",ASSETS_BASE_URL:E}};let t=o;const _=new Proxy({},{get:(E,o)=>n[t??"production"][o]});function S(E){t=E}export{E as ASSETS_BASE_URL,_ as env,S as setEnv};
package/dist/i18n.js CHANGED
@@ -1 +1 @@
1
- import{c as e}from"./chunks/runtime-Bg1WXVCx.js";import{z as t,l as n}from"./chunks/external-zAbuzxDj.js";const c=["ca_ES","de_DE","en_US","pt_PT"],s=t.enum(["en_US","pt_PT","de_DE","es_ES","ca_ES"]);function a(e){return s.safeParse(e).success}const o="__mqElementsLocalization__";function i(){const e=globalThis;return e[o]||(e[o]={initialized:!1}),e[o]}function r(){const t=i();if(!t.initialized){t.initialized=!0;try{const{setLocale:n,getLocale:s}=e({sourceLocale:"es_ES",targetLocales:c,loadLocale:async e=>{switch(e){case"en_US":default:return import("./chunks/en_US-BslWF9nj.js");case"pt_PT":return import("./chunks/pt_PT-CFbbWowX.js");case"de_DE":return import("./chunks/de_DE-CrwfSJnS.js");case"ca_ES":return import("./chunks/ca_ES-nttMFJzr.js")}}});t.setLocale=n,t.getLocale=s}catch(e){n.warn("Localization was already configured on this page.",e)}}}const u="Localization not initialized yet.";async function l(e){const{setLocale:t}=i();if(t)return t(e);n.warn(u)}function _(){const{getLocale:e}=i();return e?e():(n.warn(u),"es_ES")}export{_ as getLocale,r as initLocalization,a as isValidLocale,l as setLocale};
1
+ import{c as e}from"./chunks/runtime-Bg1WXVCx.js";import{z as t,l as n}from"./chunks/external-zAbuzxDj.js";const c=["ca_ES","de_DE","en_US","pt_PT"],a=t.enum(["en_US","pt_PT","de_DE","es_ES","ca_ES"]);function s(e){return a.safeParse(e).success}const o="__mqElementsLocalization__";function i(){const e=globalThis;return e[o]||(e[o]={initialized:!1}),e[o]}function r(){const t=i();if(!t.initialized){t.initialized=!0;try{const{setLocale:n,getLocale:a}=e({sourceLocale:"es_ES",targetLocales:c,loadLocale:async e=>{switch(e){case"en_US":default:return import("./chunks/en_US-BslWF9nj.js");case"pt_PT":return import("./chunks/pt_PT-CFbbWowX.js");case"de_DE":return import("./chunks/de_DE-CrwfSJnS.js");case"ca_ES":return import("./chunks/ca_ES-nttMFJzr.js")}}});t.setLocale=n,t.getLocale=a}catch(e){n.warn("Localization was already configured on this page.",e)}}}const u="Localization not initialized yet.";async function l(e){const{setLocale:t}=i();if(t)return t(e);n.warn(u)}function _(){const{getLocale:e}=i();return e?e():(n.warn(u),"es_ES")}export{_ as getLocale,r as initLocalization,s as isValidLocale,l as setLocale};
@@ -1 +1 @@
1
- import{_ as e,t}from"./chunks/custom-element-DA9Fxvxd.js";import{m as a}from"./chunks/runtime-Bg1WXVCx.js";import{l as s}from"./chunks/parseISO-jT42c8Ob.js";import{L as i}from"./chunks/login-token-task-BI-L2zSV.js";import{l as n}from"./chunks/external-zAbuzxDj.js";import{i as o,a as r,x as p}from"./chunks/lit-element-DiWJYFwC.js";import{n as l}from"./chunks/property-scuRaFcM.js";import{r as c}from"./chunks/state-LQivXIgA.js";import{setEnv as h}from"./env.js";import{initLocalization as u,isValidLocale as y,setLocale as d}from"./i18n.js";import{a as m}from"./chunks/api-chat-client-BTBtu01T.js";import{u as v,s as b,r as f}from"./chunks/apple-pay-outcomes-BlytM6W-.js";import"./chunks/task-Bj8p7kJX.js";import"./chunks/format-Cm3B1GMy.js";import"./chunks/isBefore-Cof0D841.js";function k(){if("undefined"==typeof navigator)return!1;const e=navigator.userAgent;return/Safari/i.test(e)&&!/Chrome|Chromium|Edg|OPR|Firefox|FxiOS/i.test(e)}async function P(e){if("undefined"==typeof window||!window.isSecureContext)return{available:!1,reason:"unsupported"};if(!function(){if("undefined"==typeof window)return!1;const e="undefined"!=typeof ApplePaySession&&"function"==typeof ApplePaySession.canMakePayments,t="undefined"!=typeof customElements&&void 0!==customElements.get("apple-pay-button");return e&&t}())return{available:!1,reason:"sdk-missing"};if(!e.trim())return{available:!1,reason:"merchant-id-missing"};const t=ApplePaySession;if(function(e){return"function"==typeof e.applePayCapabilities}(t))try{return function(e){switch(e){case"applePayUnsupported":return{available:!1,reason:"unsupported"};case"paymentCredentialsUnavailable":case"paymentCredentialsAvailable":case"paymentCredentialStatusUnknown":return{available:!0,usesQrFlow:!k()}}}((await t.applePayCapabilities(e)).paymentCredentialStatus)}catch{return t.canMakePayments()?{available:!0,usesQrFlow:!k()}:{available:!1,reason:"unsupported"}}return t.canMakePayments()?{available:!0,usesQrFlow:!k()}:{available:!1,reason:"unsupported"}}const g={es_ES:"es-ES",en_US:"en-US",pt_PT:"pt-PT",de_DE:"de-DE",ca_ES:"ca-ES"};try{u()}catch{}const E=["visa","masterCard","amex"],_=["supports3DS"],S=o`:host{display:flex;flex-direction:column;align-items:stretch;justify-content:center;gap:12px;width:100%;min-height:48px}.helper{margin:0;text-align:center;font-family:system-ui,sans-serif;font-size:13px;line-height:1.4;color:#6e6e73}.pay-row{display:block;width:100%}.pay-row--paying{opacity:.55;pointer-events:none}apple-pay-button{--apple-pay-button-width:100%;--apple-pay-button-height:48px;--apple-pay-button-border-radius:10px;--apple-pay-button-padding:0;display:block;width:100%;min-height:48px;cursor:pointer}.state{text-align:center;font-family:system-ui,sans-serif;font-size:15px;color:#86868b;margin:0}`;class ApplePayCheckoutSuccessEvent extends Event{static{this.eventName="payment-success"}constructor(e){super(ApplePayCheckoutSuccessEvent.eventName,{bubbles:!0,composed:!0}),this.detail=e}}class ApplePayCheckoutDeniedEvent extends Event{static{this.eventName="payment-denied"}constructor(e){super(ApplePayCheckoutDeniedEvent.eventName,{bubbles:!0,composed:!0}),this.detail=e}}class ApplePayCheckoutErrorEvent extends Event{static{this.eventName="payment-error"}constructor(e){super(ApplePayCheckoutErrorEvent.eventName,{bubbles:!0,composed:!0}),this.detail=e}}function A(e,t){n.warn(e,{error:t instanceof Error?t.message:String(t)})}let w=class MqApplePayCheckout extends r{constructor(){super(...arguments),this._availabilityPhase="checking",this._showQrHelper=!1,this._paying=!1,this._suppressCancelEvent=!1,this._availabilityGeneration=0,this._loginTokenTask=new i(this,m,{args:()=>[this.apiKey,this.token],onComplete:e=>{m.setAuthToken(e.access_token),this._refreshAvailability()},onError:()=>{this.dispatchEvent(new ApplePayCheckoutErrorEvent({reason:"auth"}))}}),this._onPayClick=()=>{if(this._paying||"ready"!==this._availabilityPhase)return;let e;try{e=new ApplePaySession(3,this._buildPaymentRequest())}catch(e){return A("mq-apple-pay-checkout: failed to create ApplePaySession",e),void this.dispatchEvent(new ApplePayCheckoutErrorEvent({reason:"unsupported"}))}this._paying=!0,this._suppressCancelEvent=!1,e.onvalidatemerchant=async t=>{try{const a=await m.payments.validateApplePayMerchant({order_id:this.sessionId,validation_url:t.validationURL});e.completeMerchantValidation(v(a))}catch(t){A("mq-apple-pay-checkout: validate-merchant failed",t),this._suppressCancelEvent=!0,this.dispatchEvent(new ApplePayCheckoutErrorEvent({reason:"merchant"})),e.abort(),this._paying=!1}},e.onpaymentauthorized=async t=>{try{const a=await m.payments.authorizeApplePay({order_id:this.sessionId,token:b(t.payment.token)}),{status:s,consultation_id:i}=a.data,n=f(s,i,this.sessionId);switch(n.kind){case"success":e.completePayment(ApplePaySession.STATUS_SUCCESS),this.dispatchEvent(new ApplePayCheckoutSuccessEvent({sessionId:n.sessionId,reference:n.reference}));break;case"denied":e.completePayment(ApplePaySession.STATUS_FAILURE),this.dispatchEvent(new ApplePayCheckoutDeniedEvent({sessionId:n.sessionId}));break;case"error":e.completePayment(ApplePaySession.STATUS_FAILURE),this.dispatchEvent(new ApplePayCheckoutErrorEvent({reason:n.reason}))}}catch(t){A("mq-apple-pay-checkout: authorize failed",t),e.completePayment(ApplePaySession.STATUS_FAILURE),this.dispatchEvent(new ApplePayCheckoutErrorEvent({reason:"authorize"}))}finally{this._paying=!1}},e.oncancel=()=>{this._paying=!1,this._suppressCancelEvent?this._suppressCancelEvent=!1:this.dispatchEvent(new ApplePayCheckoutErrorEvent({reason:"cancelled"}))};try{e.begin()}catch(e){A("mq-apple-pay-checkout: session.begin() failed",e),this._paying=!1,this.dispatchEvent(new ApplePayCheckoutErrorEvent({reason:"unsupported"}))}}}static{this.styles=S}willUpdate(e){if(e.has("env")&&this.env&&h(this.env),e.has("apiKey")&&m.setApiKey(this.apiKey),e.has("locale")){const e=y(this.locale)?this.locale:"es_ES";d(e),m.setLanguage(e)}e.has("merchantId")&&this._loginTokenTask.value&&this._refreshAvailability()}async _refreshAvailability(){const e=++this._availabilityGeneration;this._availabilityPhase="checking",this._showQrHelper=!1;const t=await P(this.merchantId??"");e===this._availabilityGeneration&&(t.available?(this._availabilityPhase="ready",this._showQrHelper=t.usesQrFlow):this._availabilityPhase="unavailable")}get _resolvedLocale(){return y(this.locale)?this.locale:"es_ES"}_buildPaymentRequest(){return{countryCode:this.country,currencyCode:this.currency,supportedNetworks:[...E],merchantCapabilities:[..._],total:{label:this.label,amount:this.amount}}}_renderUnavailable(){return this.merchantId?.trim()?"undefined"==typeof ApplePaySession?p`<p class="state">${a("No se ha podido cargar Apple Pay. Comprueba la configuración del sitio e inténtalo de nuevo.")}</p>`:p`<p class="state">${a("Apple Pay no está disponible")}</p>`:p`<p class="state">${a("Falta el identificador de comercio de Apple Pay")}</p>`}render(){return this._loginTokenTask.render({pending:()=>p`<p class="state">${a("Preparando Apple Pay…")}</p>`,error:()=>p`<p class="state">${a("No hemos podido iniciar el pago")}</p>`,complete:()=>{return"checking"===this._availabilityPhase?p`<p class="state">${a("Comprobando Apple Pay…")}</p>`:"unavailable"===this._availabilityPhase?this._renderUnavailable():p`${this._showQrHelper?p`<p class="helper">${a("Para pagar con Apple Pay, escanea el código QR con tu iPhone (iOS 18 o posterior) y confirma el pago.")}</p>`:null}<div class="pay-row ${this._paying?"pay-row--paying":""}"><apple-pay-button buttonstyle="black" type="pay" locale="${e=this._resolvedLocale,g[e]??"es-ES"}" aria-label="${a("Pagar con Apple Pay")}" @click="${this._onPayClick}"></apple-pay-button></div>`;var e}})}};e([l({type:String,attribute:"env"})],w.prototype,"env",void 0),e([l({type:String,attribute:"api-key"})],w.prototype,"apiKey",void 0),e([l({type:String,attribute:"token"})],w.prototype,"token",void 0),e([l({type:String,attribute:"locale",reflect:!0})],w.prototype,"locale",void 0),e([l({type:String,attribute:"merchant-id"})],w.prototype,"merchantId",void 0),e([l({type:String,attribute:"session-id"})],w.prototype,"sessionId",void 0),e([l({type:String,attribute:"amount"})],w.prototype,"amount",void 0),e([l({type:String,attribute:"currency"})],w.prototype,"currency",void 0),e([l({type:String,attribute:"country"})],w.prototype,"country",void 0),e([l({type:String,attribute:"label"})],w.prototype,"label",void 0),e([c()],w.prototype,"_availabilityPhase",void 0),e([c()],w.prototype,"_showQrHelper",void 0),e([c()],w.prototype,"_paying",void 0),w=e([s(),t("mq-apple-pay-checkout")],w);export{ApplePayCheckoutDeniedEvent,ApplePayCheckoutErrorEvent,ApplePayCheckoutSuccessEvent,w as MqApplePayCheckout};
1
+ import{_ as e,t}from"./chunks/custom-element-DA9Fxvxd.js";import{m as a}from"./chunks/runtime-Bg1WXVCx.js";import{l as s}from"./chunks/parseISO-jT42c8Ob.js";import{L as i}from"./chunks/login-token-task-BI-L2zSV.js";import{l as n}from"./chunks/external-zAbuzxDj.js";import{i as o,a as r,x as p}from"./chunks/lit-element-DiWJYFwC.js";import{n as l}from"./chunks/property-scuRaFcM.js";import{r as c}from"./chunks/state-LQivXIgA.js";import{setEnv as h}from"./env.js";import{initLocalization as u,isValidLocale as y,setLocale as d}from"./i18n.js";import{b as m}from"./chunks/api-chat-client-C8SqZtCa.js";import{u as v,s as b,r as f}from"./chunks/apple-pay-outcomes-BNkcTbbM.js";import"./chunks/task-Bj8p7kJX.js";import"./chunks/format-Cm3B1GMy.js";import"./chunks/isBefore-Cof0D841.js";function k(){if("undefined"==typeof navigator)return!1;const e=navigator.userAgent;return/Safari/i.test(e)&&!/Chrome|Chromium|Edg|OPR|Firefox|FxiOS/i.test(e)}async function P(e){if("undefined"==typeof window||!window.isSecureContext)return{available:!1,reason:"unsupported"};if(!function(){if("undefined"==typeof window)return!1;const e="undefined"!=typeof ApplePaySession&&"function"==typeof ApplePaySession.canMakePayments,t="undefined"!=typeof customElements&&void 0!==customElements.get("apple-pay-button");return e&&t}())return{available:!1,reason:"sdk-missing"};if(!e.trim())return{available:!1,reason:"merchant-id-missing"};const t=ApplePaySession;if(function(e){return"function"==typeof e.applePayCapabilities}(t))try{return function(e){switch(e){case"applePayUnsupported":return{available:!1,reason:"unsupported"};case"paymentCredentialsUnavailable":case"paymentCredentialsAvailable":case"paymentCredentialStatusUnknown":return{available:!0,usesQrFlow:!k()}}}((await t.applePayCapabilities(e)).paymentCredentialStatus)}catch{return t.canMakePayments()?{available:!0,usesQrFlow:!k()}:{available:!1,reason:"unsupported"}}return t.canMakePayments()?{available:!0,usesQrFlow:!k()}:{available:!1,reason:"unsupported"}}const g={es_ES:"es-ES",en_US:"en-US",pt_PT:"pt-PT",de_DE:"de-DE",ca_ES:"ca-ES"};try{u()}catch{}const E=["visa","masterCard","amex"],_=["supports3DS"],S=o`:host{display:flex;flex-direction:column;align-items:stretch;justify-content:center;gap:12px;width:100%;min-height:48px}.helper{margin:0;text-align:center;font-family:system-ui,sans-serif;font-size:13px;line-height:1.4;color:#6e6e73}.pay-row{display:block;width:100%}.pay-row--paying{opacity:.55;pointer-events:none}apple-pay-button{--apple-pay-button-width:100%;--apple-pay-button-height:48px;--apple-pay-button-border-radius:10px;--apple-pay-button-padding:0;display:block;width:100%;min-height:48px;cursor:pointer}.state{text-align:center;font-family:system-ui,sans-serif;font-size:15px;color:#86868b;margin:0}`;class ApplePayCheckoutSuccessEvent extends Event{static{this.eventName="payment-success"}constructor(e){super(ApplePayCheckoutSuccessEvent.eventName,{bubbles:!0,composed:!0}),this.detail=e}}class ApplePayCheckoutDeniedEvent extends Event{static{this.eventName="payment-denied"}constructor(e){super(ApplePayCheckoutDeniedEvent.eventName,{bubbles:!0,composed:!0}),this.detail=e}}class ApplePayCheckoutErrorEvent extends Event{static{this.eventName="payment-error"}constructor(e){super(ApplePayCheckoutErrorEvent.eventName,{bubbles:!0,composed:!0}),this.detail=e}}function A(e,t){n.warn(e,{error:t instanceof Error?t.message:String(t)})}let w=class MqApplePayCheckout extends r{constructor(){super(...arguments),this._availabilityPhase="checking",this._showQrHelper=!1,this._paying=!1,this._suppressCancelEvent=!1,this._availabilityGeneration=0,this._loginTokenTask=new i(this,m,{args:()=>[this.apiKey,this.token],onComplete:e=>{m.setAuthToken(e.access_token),this._refreshAvailability()},onError:()=>{this.dispatchEvent(new ApplePayCheckoutErrorEvent({reason:"auth"}))}}),this._onPayClick=()=>{if(this._paying||"ready"!==this._availabilityPhase)return;let e;try{e=new ApplePaySession(3,this._buildPaymentRequest())}catch(e){return A("mq-apple-pay-checkout: failed to create ApplePaySession",e),void this.dispatchEvent(new ApplePayCheckoutErrorEvent({reason:"unsupported"}))}this._paying=!0,this._suppressCancelEvent=!1,e.onvalidatemerchant=async t=>{try{const a=await m.payments.validateApplePayMerchant({order_id:this.sessionId,validation_url:t.validationURL});e.completeMerchantValidation(v(a))}catch(t){A("mq-apple-pay-checkout: validate-merchant failed",t),this._suppressCancelEvent=!0,this.dispatchEvent(new ApplePayCheckoutErrorEvent({reason:"merchant"})),e.abort(),this._paying=!1}},e.onpaymentauthorized=async t=>{try{const a=await m.payments.authorizeApplePay({order_id:this.sessionId,token:b(t.payment.token)}),{status:s,consultation_id:i}=a.data,n=f(s,i,this.sessionId);switch(n.kind){case"success":e.completePayment(ApplePaySession.STATUS_SUCCESS),this.dispatchEvent(new ApplePayCheckoutSuccessEvent({sessionId:n.sessionId,reference:n.reference}));break;case"denied":e.completePayment(ApplePaySession.STATUS_FAILURE),this.dispatchEvent(new ApplePayCheckoutDeniedEvent({sessionId:n.sessionId}));break;case"error":e.completePayment(ApplePaySession.STATUS_FAILURE),this.dispatchEvent(new ApplePayCheckoutErrorEvent({reason:n.reason}))}}catch(t){A("mq-apple-pay-checkout: authorize failed",t),e.completePayment(ApplePaySession.STATUS_FAILURE),this.dispatchEvent(new ApplePayCheckoutErrorEvent({reason:"authorize"}))}finally{this._paying=!1}},e.oncancel=()=>{this._paying=!1,this._suppressCancelEvent?this._suppressCancelEvent=!1:this.dispatchEvent(new ApplePayCheckoutErrorEvent({reason:"cancelled"}))};try{e.begin()}catch(e){A("mq-apple-pay-checkout: session.begin() failed",e),this._paying=!1,this.dispatchEvent(new ApplePayCheckoutErrorEvent({reason:"unsupported"}))}}}static{this.styles=S}willUpdate(e){if(e.has("env")&&this.env&&h(this.env),e.has("apiKey")&&m.setApiKey(this.apiKey),e.has("locale")){const e=y(this.locale)?this.locale:"es_ES";d(e),m.setLanguage(e)}e.has("merchantId")&&this._loginTokenTask.value&&this._refreshAvailability()}async _refreshAvailability(){const e=++this._availabilityGeneration;this._availabilityPhase="checking",this._showQrHelper=!1;const t=await P(this.merchantId??"");e===this._availabilityGeneration&&(t.available?(this._availabilityPhase="ready",this._showQrHelper=t.usesQrFlow):this._availabilityPhase="unavailable")}get _resolvedLocale(){return y(this.locale)?this.locale:"es_ES"}_buildPaymentRequest(){return{countryCode:this.country,currencyCode:this.currency,supportedNetworks:[...E],merchantCapabilities:[..._],total:{label:this.label,amount:this.amount}}}_renderUnavailable(){return this.merchantId?.trim()?"undefined"==typeof ApplePaySession?p`<p class="state">${a("No se ha podido cargar Apple Pay. Comprueba la configuración del sitio e inténtalo de nuevo.")}</p>`:p`<p class="state">${a("Apple Pay no está disponible")}</p>`:p`<p class="state">${a("Falta el identificador de comercio de Apple Pay")}</p>`}render(){return this._loginTokenTask.render({pending:()=>p`<p class="state">${a("Preparando Apple Pay…")}</p>`,error:()=>p`<p class="state">${a("No hemos podido iniciar el pago")}</p>`,complete:()=>{return"checking"===this._availabilityPhase?p`<p class="state">${a("Comprobando Apple Pay…")}</p>`:"unavailable"===this._availabilityPhase?this._renderUnavailable():p`${this._showQrHelper?p`<p class="helper">${a("Para pagar con Apple Pay, escanea el código QR con tu iPhone (iOS 18 o posterior) y confirma el pago.")}</p>`:null}<div class="pay-row ${this._paying?"pay-row--paying":""}"><apple-pay-button buttonstyle="black" type="pay" locale="${e=this._resolvedLocale,g[e]??"es-ES"}" aria-label="${a("Pagar con Apple Pay")}" @click="${this._onPayClick}"></apple-pay-button></div>`;var e}})}};e([l({type:String,attribute:"env"})],w.prototype,"env",void 0),e([l({type:String,attribute:"api-key"})],w.prototype,"apiKey",void 0),e([l({type:String,attribute:"token"})],w.prototype,"token",void 0),e([l({type:String,attribute:"locale",reflect:!0})],w.prototype,"locale",void 0),e([l({type:String,attribute:"merchant-id"})],w.prototype,"merchantId",void 0),e([l({type:String,attribute:"session-id"})],w.prototype,"sessionId",void 0),e([l({type:String,attribute:"amount"})],w.prototype,"amount",void 0),e([l({type:String,attribute:"currency"})],w.prototype,"currency",void 0),e([l({type:String,attribute:"country"})],w.prototype,"country",void 0),e([l({type:String,attribute:"label"})],w.prototype,"label",void 0),e([c()],w.prototype,"_availabilityPhase",void 0),e([c()],w.prototype,"_showQrHelper",void 0),e([c()],w.prototype,"_paying",void 0),w=e([s(),t("mq-apple-pay-checkout")],w);export{ApplePayCheckoutDeniedEvent,ApplePayCheckoutErrorEvent,ApplePayCheckoutSuccessEvent,w as MqApplePayCheckout};
@@ -1 +1 @@
1
- import{_ as t,t as e}from"./chunks/custom-element-DA9Fxvxd.js";import{a as o,x as i}from"./chunks/lit-element-DiWJYFwC.js";import{n as s}from"./chunks/property-scuRaFcM.js";import{o as n}from"./chunks/if-defined-BYeVdwgd.js";import{a as p}from"./chunks/api-chat-client-BTBtu01T.js";import"./mq-checkout.js";import"./chunks/external-zAbuzxDj.js";import"./chunks/parseISO-jT42c8Ob.js";import"./chunks/runtime-Bg1WXVCx.js";import"./chunks/format-Cm3B1GMy.js";import"./chunks/isBefore-Cof0D841.js";import"./env.js";import"./chunks/task-Bj8p7kJX.js";import"./chunks/login-token-task-BI-L2zSV.js";import"./chunks/state-LQivXIgA.js";import"./theme.js";import"./i18n.js";import"./ui/mq-skeleton.js";import"./chunks/style-map-CIdqdn7C.js";import"./chunks/directive-2EDmOukv.js";class AppointmentPaidEvent extends Event{static{this.eventName="payment-success"}constructor(t){super(AppointmentPaidEvent.eventName,{bubbles:!0,composed:!0}),this.detail=t}}let r=class MqAppointmentCheckout extends o{constructor(){super(...arguments),this._provideSession=async()=>{const t=await p.payments.createPaymentLink({slot_id:this.slotId,service_id:this.serviceId,specialty_id:this.specialtyId,consultation_reason:this.consultationReason,discount_code:this.discountCode,preconsultation_documents:this.preconsultationDocuments});return{sessionId:t.session_id,paymentUrl:t.payment_link}},this._onSuccess=t=>{t.stopPropagation(),this.dispatchEvent(new AppointmentPaidEvent({appointmentId:t.detail.reference}))}}render(){return i`<mq-checkout env="${n(this.env)}" api-key="${this.apiKey}" token="${this.token}" locale="${this.locale}" .provideSession="${this._provideSession}" @payment-success="${this._onSuccess}"></mq-checkout>`}};t([s({type:String,attribute:"env"})],r.prototype,"env",void 0),t([s({type:String,attribute:"api-key"})],r.prototype,"apiKey",void 0),t([s({type:String,attribute:"token"})],r.prototype,"token",void 0),t([s({type:String,attribute:"locale",reflect:!0})],r.prototype,"locale",void 0),t([s({type:String,attribute:"slot-id"})],r.prototype,"slotId",void 0),t([s({type:String,attribute:"service-id"})],r.prototype,"serviceId",void 0),t([s({type:String,attribute:"specialty-id"})],r.prototype,"specialtyId",void 0),t([s({type:String,attribute:"consultation-reason"})],r.prototype,"consultationReason",void 0),t([s({type:String,attribute:"discount-code"})],r.prototype,"discountCode",void 0),t([s({attribute:!1})],r.prototype,"preconsultationDocuments",void 0),r=t([e("mq-appointment-checkout")],r);export{AppointmentPaidEvent,r as MqAppointmentCheckout};
1
+ import{_ as t,t as e}from"./chunks/custom-element-DA9Fxvxd.js";import{a as i,x as o}from"./chunks/lit-element-DiWJYFwC.js";import{n as s}from"./chunks/property-scuRaFcM.js";import{o as n}from"./chunks/if-defined-BYeVdwgd.js";import{b as p}from"./chunks/api-chat-client-C8SqZtCa.js";import"./mq-checkout.js";import"./chunks/external-zAbuzxDj.js";import"./chunks/parseISO-jT42c8Ob.js";import"./chunks/runtime-Bg1WXVCx.js";import"./chunks/format-Cm3B1GMy.js";import"./chunks/isBefore-Cof0D841.js";import"./env.js";import"./chunks/task-Bj8p7kJX.js";import"./chunks/login-token-task-BI-L2zSV.js";import"./chunks/state-LQivXIgA.js";import"./theme.js";import"./i18n.js";import"./ui/mq-skeleton.js";import"./chunks/style-map-CIdqdn7C.js";import"./chunks/directive-2EDmOukv.js";class AppointmentPaidEvent extends Event{static{this.eventName="payment-success"}constructor(t){super(AppointmentPaidEvent.eventName,{bubbles:!0,composed:!0}),this.detail=t}}let r=class MqAppointmentCheckout extends i{constructor(){super(...arguments),this._provideSession=async()=>{const t=await p.payments.createPaymentLink({slot_id:this.slotId,service_id:this.serviceId,specialty_id:this.specialtyId,consultation_reason:this.consultationReason,discount_code:this.discountCode,preconsultation_documents:this.preconsultationDocuments});return{sessionId:t.session_id,paymentUrl:t.payment_link}},this._onSuccess=t=>{t.stopPropagation(),this.dispatchEvent(new AppointmentPaidEvent({appointmentId:t.detail.reference}))}}render(){return o`<mq-checkout env="${n(this.env)}" api-key="${this.apiKey}" token="${this.token}" locale="${this.locale}" .provideSession="${this._provideSession}" @payment-success="${this._onSuccess}"></mq-checkout>`}};t([s({type:String,attribute:"env"})],r.prototype,"env",void 0),t([s({type:String,attribute:"api-key"})],r.prototype,"apiKey",void 0),t([s({type:String,attribute:"token"})],r.prototype,"token",void 0),t([s({type:String,attribute:"locale",reflect:!0})],r.prototype,"locale",void 0),t([s({type:String,attribute:"slot-id"})],r.prototype,"slotId",void 0),t([s({type:String,attribute:"service-id"})],r.prototype,"serviceId",void 0),t([s({type:String,attribute:"specialty-id"})],r.prototype,"specialtyId",void 0),t([s({type:String,attribute:"consultation-reason"})],r.prototype,"consultationReason",void 0),t([s({type:String,attribute:"discount-code"})],r.prototype,"discountCode",void 0),t([s({attribute:!1})],r.prototype,"preconsultationDocuments",void 0),r=t([e("mq-appointment-checkout")],r);export{AppointmentPaidEvent,r as MqAppointmentCheckout};
@@ -1 +1 @@
1
- export{M as MqChatRoom,b as MqChatRoomCloseEvent,c as MqChatRoomProfileEvent}from"./chunks/exports-XZaVrMLd.js";import"./chunks/custom-element-DA9Fxvxd.js";import"./chunks/provide-CfT7g_Zi.js";import"./chunks/context-provider-CiMFpvDA.js";import"./chunks/context-request-event-Dfydf1ub.js";import"./chunks/mutation-controller-OVT8NEt6.js";import"./chunks/query-QJ1INUTG.js";import"./chunks/parseISO-jT42c8Ob.js";import"./chunks/runtime-Bg1WXVCx.js";import"./chunks/lit-element-DiWJYFwC.js";import"./chunks/property-scuRaFcM.js";import"./chunks/state-LQivXIgA.js";import"./theme.js";import"./chunks/api-chat-client-BTBtu01T.js";import"./chunks/external-zAbuzxDj.js";import"./chunks/format-Cm3B1GMy.js";import"./chunks/isBefore-Cof0D841.js";import"./env.js";import"./ui/icons/x-icon.js";import"./ui/icons/types.js";import"./ui/mq-avatar.js";import"./chunks/class-map-Co76I6aw.js";import"./chunks/directive-2EDmOukv.js";import"./ui/mq-button.js";import"./ui/mq-skeleton.js";import"./chunks/style-map-CIdqdn7C.js";import"./chunks/if-defined-BYeVdwgd.js";import"./ui/icons/chevron-left-icon.js";import"./chunks/query-CeeutdfT.js";import"./events.js";import"./ui/icons/check-double-icon.js";import"./ui/icons/check-icon.js";import"./i18n.js";import"./chunks/chunk-YTQUGGS3-DN-JZpgG.js";
1
+ export{M as MqChatRoom,b as MqChatRoomCloseEvent,c as MqChatRoomProfileEvent}from"./chunks/exports-G_7Ih_GH.js";import"./chunks/custom-element-DA9Fxvxd.js";import"./chunks/provide-CfT7g_Zi.js";import"./chunks/context-provider-CiMFpvDA.js";import"./chunks/context-request-event-Dfydf1ub.js";import"./chunks/mutation-controller-OVT8NEt6.js";import"./chunks/query-QJ1INUTG.js";import"./chunks/parseISO-jT42c8Ob.js";import"./chunks/runtime-Bg1WXVCx.js";import"./chunks/lit-element-DiWJYFwC.js";import"./chunks/property-scuRaFcM.js";import"./chunks/state-LQivXIgA.js";import"./theme.js";import"./chunks/api-chat-client-C8SqZtCa.js";import"./chunks/external-zAbuzxDj.js";import"./chunks/format-Cm3B1GMy.js";import"./chunks/isBefore-Cof0D841.js";import"./env.js";import"./ui/icons/x-icon.js";import"./ui/icons/types.js";import"./ui/mq-avatar.js";import"./chunks/class-map-Co76I6aw.js";import"./chunks/directive-2EDmOukv.js";import"./ui/mq-button.js";import"./ui/mq-skeleton.js";import"./chunks/style-map-CIdqdn7C.js";import"./chunks/if-defined-BYeVdwgd.js";import"./ui/icons/chevron-left-icon.js";import"./chunks/query-CeeutdfT.js";import"./events.js";import"./ui/icons/check-double-icon.js";import"./ui/icons/check-icon.js";import"./i18n.js";import"./chunks/chunk-YTQUGGS3-DN-JZpgG.js";
@@ -1 +1 @@
1
- import{_ as e,t}from"./chunks/custom-element-DA9Fxvxd.js";import{m as s}from"./chunks/runtime-Bg1WXVCx.js";import{l as i}from"./chunks/parseISO-jT42c8Ob.js";import{h as o}from"./chunks/task-Bj8p7kJX.js";import{a as n,P as r}from"./chunks/api-chat-client-BTBtu01T.js";import{L as a}from"./chunks/login-token-task-BI-L2zSV.js";import{l as h}from"./chunks/external-zAbuzxDj.js";import{i as d,a as l,x as c}from"./chunks/lit-element-DiWJYFwC.js";import{n as p}from"./chunks/property-scuRaFcM.js";import{r as m}from"./chunks/state-LQivXIgA.js";import{setEnv as u}from"./env.js";import{tokens as v}from"./theme.js";import{initLocalization as _,isValidLocale as f,setLocale as y}from"./i18n.js";import"./ui/mq-skeleton.js";import"./chunks/format-Cm3B1GMy.js";import"./chunks/isBefore-Cof0D841.js";import"./chunks/style-map-CIdqdn7C.js";import"./chunks/directive-2EDmOukv.js";var g=class{constructor(e,t){this.host=e,this.options=t,this._deadline=0,this._timedOut=!1,this.host.addController(this)}get timedOut(){return this._timedOut}hostConnected(){const e=this.options.intervalMs??1e3,t=void 0!==this.options.startDelayMs?this.options.startDelayMs:e;this._deadline=Date.now()+this.options.timeoutMs,this._timedOut=!1,this._startTimeoutId=setTimeout(()=>{this._startTimeoutId=void 0,this._poll(),this._intervalId=setInterval(()=>{this._poll()},e)},t)}hostDisconnected(){this._stop()}stop(){this._stop()}async _poll(){if(Date.now()>=this._deadline)return this._stop(),this._timedOut=!0,this.host.requestUpdate(),void this.options.onTimeout?.();try{const e=await this.options.refetchFn();this.options.shouldComplete(e)&&(this._stop(),this.options.onComplete?.(e))}catch{}}_stop(){void 0!==this._intervalId&&(clearInterval(this._intervalId),this._intervalId=void 0),void 0!==this._startTimeoutId&&(clearTimeout(this._startTimeoutId),this._startTimeoutId=void 0)}};try{_()}catch{}const k=d`:host{height:100%;min-height:0;display:flex;flex-direction:column;flex:1}.payment-frame{position:relative;width:100%;min-width:0;display:flex;flex-direction:column;flex:1;min-height:0}.payment-frame iframe:not(.loaded){position:absolute;width:1px;height:1px;opacity:0;pointer-events:none;border:none}.payment-frame iframe.loaded{flex:none;display:block;width:100%;border:none;min-height:1050px}.state{display:flex;flex-direction:column;align-items:center;justify-content:center;flex:1;gap:var(--sp-4);padding:var(--sp-8);text-align:center}.state-title{font-family:var(--font-titles);font-size:var(--text-2xl);line-height:var(--text-2xl--line-height);font-weight:var(--font-weight-bold);color:var(--color-neutrals-text-default);margin:0}.state-message{font-family:var(--font-body);font-size:var(--text-base);line-height:var(--text-base--line-height);color:var(--color-neutrals-text-default);margin:0}`,E="mediquo:payment:retry",b="mediquo:payment:resize";class CheckoutSuccessEvent extends Event{static{this.eventName="payment-success"}constructor(e){super(CheckoutSuccessEvent.eventName,{bubbles:!0,composed:!0}),this.detail=e}}class CheckoutDeniedEvent extends Event{static{this.eventName="payment-denied"}constructor(e){super(CheckoutDeniedEvent.eventName,{bubbles:!0,composed:!0}),this.detail=e}}class CheckoutErrorEvent extends Event{static{this.eventName="payment-error"}constructor(e){super(CheckoutErrorEvent.eventName,{bubbles:!0,composed:!0}),this.detail=e}}class CheckoutRetryEvent extends Event{static{this.eventName="payment-retry"}constructor(){super(CheckoutRetryEvent.eventName,{bubbles:!0,composed:!0})}}let w=class MqCheckout extends l{constructor(){super(...arguments),this._iframeLoaded=!1,this._iframeHeight=null,this._sessionEpoch=0,this._currentSessionId=null,this._paymentOrigin=null,this._loginTokenTask=new a(this,n,{args:()=>[this.apiKey,this.token],onComplete:e=>{n.setAuthToken(e.access_token),this._sessionTask.run()},onError:()=>{this.dispatchEvent(new CheckoutErrorEvent({reason:"auth"}))}}),this._sessionTask=new o(this,{task:async()=>{if("function"!=typeof this.provideSession)throw new Error("mq-checkout: `provideSession` property is required");return this.provideSession()},args:()=>[this._sessionEpoch],autoRun:!1,onComplete:e=>{this._currentSessionId=e.sessionId,this._iframeLoaded=!1,this._iframeHeight=null;try{this._paymentOrigin=new URL(e.paymentUrl).origin}catch{this._paymentOrigin=null,h.warn(`mq-checkout: invalid paymentUrl "${e.paymentUrl}"`)}},onError:()=>{this.dispatchEvent(new CheckoutErrorEvent({reason:"session"}))}}),this._paymentPoll=new g(this,{startDelayMs:5e3,intervalMs:3e3,timeoutMs:6e5,refetchFn:async()=>{if(!this._currentSessionId)throw new Error("mq-checkout: session not ready");const e=await n.payments.getPaymentSession(this._currentSessionId);return e.status===r.Denied&&(this._paymentPoll.stop(),this.dispatchEvent(new CheckoutDeniedEvent({sessionId:this._currentSessionId}))),e},shouldComplete:e=>e.status===r.Paid,onComplete:e=>{this.dispatchEvent(new CheckoutSuccessEvent({sessionId:this._currentSessionId??"",reference:e.consultation_id}))},onTimeout:()=>{this.dispatchEvent(new CheckoutErrorEvent({reason:"timeout"}))}}),this._onMessage=e=>{if(!this._paymentOrigin||e.origin===this._paymentOrigin)switch(e.data?.type){case E:return this.dispatchEvent(new CheckoutRetryEvent),this._sessionEpoch+=1,void this._sessionTask.run();case b:return void("number"==typeof e.data.height&&(this._iframeHeight=e.data.height))}}}static{this.styles=[v,k]}get _timedOut(){return this._paymentPoll.timedOut}connectedCallback(){super.connectedCallback(),window.addEventListener("message",this._onMessage)}disconnectedCallback(){window.removeEventListener("message",this._onMessage),super.disconnectedCallback()}willUpdate(e){if(e.has("env")&&this.env&&u(this.env),e.has("apiKey")&&n.setApiKey(this.apiKey),e.has("locale")){const e=f(this.locale)?this.locale:"es_ES";y(e),n.setLanguage(e)}}_onIframeLoad(){this._iframeLoaded=!0}_renderState(e,t){return c`<div class="state"><p class="state-title">${e}</p>${t?c`<p class="state-message">${t}</p>`:null}</div>`}_renderLoading(){return c`<div class="payment-frame"><mq-skeleton width="100%" height="600px" border-radius="md" role="status" aria-live="polite" aria-label="${s("Cargando portal de pago")}"></mq-skeleton></div>`}_renderFrame(e){return c`<div class="payment-frame">${this._iframeLoaded?null:this._renderLoading()}<iframe class="${this._iframeLoaded?"loaded":""}" src="${e}" title="${s("Portal de pago")}" style="${null!==this._iframeHeight?`min-height: ${this._iframeHeight}px; height: ${this._iframeHeight}px;`:""}" @load="${this._onIframeLoad}"></iframe></div>`}render(){return this._timedOut?this._renderState(s("No hemos podido confirmar tu pago"),s("Ha ocurrido un problema al verificar el estado de tu pago. Por favor, contacta con soporte si el cargo se ha realizado.")):this._loginTokenTask.render({pending:()=>this._renderLoading(),error:()=>this._renderState(s("No hemos podido iniciar el pago"),s("Por favor, inténtalo de nuevo más tarde.")),complete:()=>this._sessionTask.render({initial:()=>this._renderLoading(),pending:()=>this._renderLoading(),error:()=>this._renderState(s("No hemos podido iniciar el pago"),s("Por favor, inténtalo de nuevo más tarde.")),complete:e=>this._renderFrame(e.paymentUrl)})})}};e([p({type:String,attribute:"env"})],w.prototype,"env",void 0),e([p({type:String,attribute:"api-key"})],w.prototype,"apiKey",void 0),e([p({type:String,attribute:"token"})],w.prototype,"token",void 0),e([p({type:String,attribute:"locale",reflect:!0})],w.prototype,"locale",void 0),e([p({attribute:!1})],w.prototype,"provideSession",void 0),e([m()],w.prototype,"_iframeLoaded",void 0),e([m()],w.prototype,"_iframeHeight",void 0),e([m()],w.prototype,"_sessionEpoch",void 0),w=e([i(),t("mq-checkout")],w);export{CheckoutDeniedEvent,CheckoutErrorEvent,CheckoutRetryEvent,CheckoutSuccessEvent,w as MqCheckout};
1
+ import{_ as e,t}from"./chunks/custom-element-DA9Fxvxd.js";import{m as s}from"./chunks/runtime-Bg1WXVCx.js";import{l as i}from"./chunks/parseISO-jT42c8Ob.js";import{h as o}from"./chunks/task-Bj8p7kJX.js";import{b as n,P as r}from"./chunks/api-chat-client-C8SqZtCa.js";import{L as a}from"./chunks/login-token-task-BI-L2zSV.js";import{l as h}from"./chunks/external-zAbuzxDj.js";import{i as d,a as l,x as c}from"./chunks/lit-element-DiWJYFwC.js";import{n as p}from"./chunks/property-scuRaFcM.js";import{r as m}from"./chunks/state-LQivXIgA.js";import{setEnv as u}from"./env.js";import{tokens as v}from"./theme.js";import{initLocalization as _,isValidLocale as f,setLocale as y}from"./i18n.js";import"./ui/mq-skeleton.js";import"./chunks/format-Cm3B1GMy.js";import"./chunks/isBefore-Cof0D841.js";import"./chunks/style-map-CIdqdn7C.js";import"./chunks/directive-2EDmOukv.js";var g=class{constructor(e,t){this.host=e,this.options=t,this._deadline=0,this._timedOut=!1,this.host.addController(this)}get timedOut(){return this._timedOut}hostConnected(){const e=this.options.intervalMs??1e3,t=void 0!==this.options.startDelayMs?this.options.startDelayMs:e;this._deadline=Date.now()+this.options.timeoutMs,this._timedOut=!1,this._startTimeoutId=setTimeout(()=>{this._startTimeoutId=void 0,this._poll(),this._intervalId=setInterval(()=>{this._poll()},e)},t)}hostDisconnected(){this._stop()}stop(){this._stop()}async _poll(){if(Date.now()>=this._deadline)return this._stop(),this._timedOut=!0,this.host.requestUpdate(),void this.options.onTimeout?.();try{const e=await this.options.refetchFn();this.options.shouldComplete(e)&&(this._stop(),this.options.onComplete?.(e))}catch{}}_stop(){void 0!==this._intervalId&&(clearInterval(this._intervalId),this._intervalId=void 0),void 0!==this._startTimeoutId&&(clearTimeout(this._startTimeoutId),this._startTimeoutId=void 0)}};try{_()}catch{}const k=d`:host{height:100%;min-height:0;display:flex;flex-direction:column;flex:1}.payment-frame{position:relative;width:100%;min-width:0;display:flex;flex-direction:column;flex:1;min-height:0}.payment-frame iframe:not(.loaded){position:absolute;width:1px;height:1px;opacity:0;pointer-events:none;border:none}.payment-frame iframe.loaded{flex:none;display:block;width:100%;border:none;min-height:1050px}.state{display:flex;flex-direction:column;align-items:center;justify-content:center;flex:1;gap:var(--sp-4);padding:var(--sp-8);text-align:center}.state-title{font-family:var(--font-titles);font-size:var(--text-2xl);line-height:var(--text-2xl--line-height);font-weight:var(--font-weight-bold);color:var(--color-neutrals-text-default);margin:0}.state-message{font-family:var(--font-body);font-size:var(--text-base);line-height:var(--text-base--line-height);color:var(--color-neutrals-text-default);margin:0}`,E="mediquo:payment:retry",b="mediquo:payment:resize";class CheckoutSuccessEvent extends Event{static{this.eventName="payment-success"}constructor(e){super(CheckoutSuccessEvent.eventName,{bubbles:!0,composed:!0}),this.detail=e}}class CheckoutDeniedEvent extends Event{static{this.eventName="payment-denied"}constructor(e){super(CheckoutDeniedEvent.eventName,{bubbles:!0,composed:!0}),this.detail=e}}class CheckoutErrorEvent extends Event{static{this.eventName="payment-error"}constructor(e){super(CheckoutErrorEvent.eventName,{bubbles:!0,composed:!0}),this.detail=e}}class CheckoutRetryEvent extends Event{static{this.eventName="payment-retry"}constructor(){super(CheckoutRetryEvent.eventName,{bubbles:!0,composed:!0})}}let w=class MqCheckout extends l{constructor(){super(...arguments),this._iframeLoaded=!1,this._iframeHeight=null,this._sessionEpoch=0,this._currentSessionId=null,this._paymentOrigin=null,this._loginTokenTask=new a(this,n,{args:()=>[this.apiKey,this.token],onComplete:e=>{n.setAuthToken(e.access_token),this._sessionTask.run()},onError:()=>{this.dispatchEvent(new CheckoutErrorEvent({reason:"auth"}))}}),this._sessionTask=new o(this,{task:async()=>{if("function"!=typeof this.provideSession)throw new Error("mq-checkout: `provideSession` property is required");return this.provideSession()},args:()=>[this._sessionEpoch],autoRun:!1,onComplete:e=>{this._currentSessionId=e.sessionId,this._iframeLoaded=!1,this._iframeHeight=null;try{this._paymentOrigin=new URL(e.paymentUrl).origin}catch{this._paymentOrigin=null,h.warn(`mq-checkout: invalid paymentUrl "${e.paymentUrl}"`)}},onError:()=>{this.dispatchEvent(new CheckoutErrorEvent({reason:"session"}))}}),this._paymentPoll=new g(this,{startDelayMs:5e3,intervalMs:3e3,timeoutMs:6e5,refetchFn:async()=>{if(!this._currentSessionId)throw new Error("mq-checkout: session not ready");const e=await n.payments.getPaymentSession(this._currentSessionId);return e.status===r.Denied&&(this._paymentPoll.stop(),this.dispatchEvent(new CheckoutDeniedEvent({sessionId:this._currentSessionId}))),e},shouldComplete:e=>e.status===r.Paid,onComplete:e=>{this.dispatchEvent(new CheckoutSuccessEvent({sessionId:this._currentSessionId??"",reference:e.consultation_id}))},onTimeout:()=>{this.dispatchEvent(new CheckoutErrorEvent({reason:"timeout"}))}}),this._onMessage=e=>{if(!this._paymentOrigin||e.origin===this._paymentOrigin)switch(e.data?.type){case E:return this.dispatchEvent(new CheckoutRetryEvent),this._sessionEpoch+=1,void this._sessionTask.run();case b:return void("number"==typeof e.data.height&&(this._iframeHeight=e.data.height))}}}static{this.styles=[v,k]}get _timedOut(){return this._paymentPoll.timedOut}connectedCallback(){super.connectedCallback(),window.addEventListener("message",this._onMessage)}disconnectedCallback(){window.removeEventListener("message",this._onMessage),super.disconnectedCallback()}willUpdate(e){if(e.has("env")&&this.env&&u(this.env),e.has("apiKey")&&n.setApiKey(this.apiKey),e.has("locale")){const e=f(this.locale)?this.locale:"es_ES";y(e),n.setLanguage(e)}}_onIframeLoad(){this._iframeLoaded=!0}_renderState(e,t){return c`<div class="state"><p class="state-title">${e}</p>${t?c`<p class="state-message">${t}</p>`:null}</div>`}_renderLoading(){return c`<div class="payment-frame"><mq-skeleton width="100%" height="600px" border-radius="md" role="status" aria-live="polite" aria-label="${s("Cargando portal de pago")}"></mq-skeleton></div>`}_renderFrame(e){return c`<div class="payment-frame">${this._iframeLoaded?null:this._renderLoading()}<iframe class="${this._iframeLoaded?"loaded":""}" src="${e}" title="${s("Portal de pago")}" style="${null!==this._iframeHeight?`min-height: ${this._iframeHeight}px; height: ${this._iframeHeight}px;`:""}" @load="${this._onIframeLoad}"></iframe></div>`}render(){return this._timedOut?this._renderState(s("No hemos podido confirmar tu pago"),s("Ha ocurrido un problema al verificar el estado de tu pago. Por favor, contacta con soporte si el cargo se ha realizado.")):this._loginTokenTask.render({pending:()=>this._renderLoading(),error:()=>this._renderState(s("No hemos podido iniciar el pago"),s("Por favor, inténtalo de nuevo más tarde.")),complete:()=>this._sessionTask.render({initial:()=>this._renderLoading(),pending:()=>this._renderLoading(),error:()=>this._renderState(s("No hemos podido iniciar el pago"),s("Por favor, inténtalo de nuevo más tarde.")),complete:e=>this._renderFrame(e.paymentUrl)})})}};e([p({type:String,attribute:"env"})],w.prototype,"env",void 0),e([p({type:String,attribute:"api-key"})],w.prototype,"apiKey",void 0),e([p({type:String,attribute:"token"})],w.prototype,"token",void 0),e([p({type:String,attribute:"locale",reflect:!0})],w.prototype,"locale",void 0),e([p({attribute:!1})],w.prototype,"provideSession",void 0),e([m()],w.prototype,"_iframeLoaded",void 0),e([m()],w.prototype,"_iframeHeight",void 0),e([m()],w.prototype,"_sessionEpoch",void 0),w=e([i(),t("mq-checkout")],w);export{CheckoutDeniedEvent,CheckoutErrorEvent,CheckoutRetryEvent,CheckoutSuccessEvent,w as MqCheckout};
@@ -1 +1 @@
1
- import{_ as t,t as e}from"./chunks/custom-element-DA9Fxvxd.js";import{m as a}from"./chunks/runtime-Bg1WXVCx.js";import{l as n}from"./chunks/parseISO-jT42c8Ob.js";import{L as o}from"./chunks/login-token-task-BI-L2zSV.js";import{l as i}from"./chunks/external-zAbuzxDj.js";import{i as s,a as r,x as l}from"./chunks/lit-element-DiWJYFwC.js";import{n as c}from"./chunks/property-scuRaFcM.js";import{r as h}from"./chunks/state-LQivXIgA.js";import{setEnv as u}from"./env.js";import{initLocalization as p,isValidLocale as y,setLocale as d}from"./i18n.js";import{i as m,a as g}from"./chunks/api-chat-client-BTBtu01T.js";import{r as v}from"./chunks/apple-pay-outcomes-BlytM6W-.js";import"./chunks/task-Bj8p7kJX.js";import"./chunks/format-Cm3B1GMy.js";import"./chunks/isBefore-Cof0D841.js";function b(){return"undefined"!=typeof google&&"function"==typeof google.payments?.api?.PaymentsClient}const _=["PAN_ONLY","CRYPTOGRAM_3DS"],k=["VISA","MASTERCARD","AMEX"];function f(t){return{type:"PAYMENT_GATEWAY",parameters:{gateway:"globalpayments",gatewayMerchantId:t}}}function C(t){return{type:"CARD",parameters:{allowedAuthMethods:[..._],allowedCardNetworks:[...k]},tokenizationSpecification:f(t)}}function w(t){return[C(t)]}function E(t,e){return"test"===e?"TEST":"production"===e?"PRODUCTION":"development"===t?"TEST":"PRODUCTION"}function P(t,e){return function(t,e){return{apiVersion:2,apiVersionMinor:0,allowedPaymentMethods:w(t.gatewayMerchantId),merchantInfo:{merchantId:t.merchantId,merchantName:t.merchantName},transactionInfo:{totalPriceStatus:"FINAL",totalPrice:e.amount,currencyCode:e.currencyCode,countryCode:e.countryCode}}}(t,e)}async function I(t,e,a,n={}){if("undefined"==typeof window||!window.isSecureContext)return i.warn("google-pay: unavailable outside a secure context"),{available:!1,reason:"unsupported"};if(!t.trim())return i.warn("google-pay: missing merchant id"),{available:!1,reason:"merchant-id-missing"};if(!e.trim())return i.warn("google-pay: missing gateway merchant id"),{available:!1,reason:"gateway-merchant-id-missing"};if(!await function(t=8e3,e){return b()?Promise.resolve(!0):t<=0||e?.aborted?Promise.resolve(!1):new Promise(a=>{const n=Date.now()+t,o=t=>{clearInterval(s),e?.removeEventListener("abort",i),a(t)},i=()=>o(!1),s=setInterval(()=>{b()?o(!0):Date.now()>=n&&o(!1)},100);e?.addEventListener("abort",i,{once:!0})})}(n.sdkWaitTimeoutMs,n.signal))return i.warn("google-pay: pay.js was not loaded by the host page"),{available:!1,reason:"sdk-missing"};const o=E(a,n.gatewayEnvironment);try{const t=new google.payments.api.PaymentsClient({environment:o}),a=await t.isReadyToPay(function(t){return{apiVersion:2,apiVersionMinor:0,allowedPaymentMethods:w(t)}}(e));return a.result?{available:!0}:(i.warn("google-pay: isReadyToPay returned false",{environment:o}),{available:!1,reason:"unsupported"})}catch(t){return i.warn("google-pay: isReadyToPay threw",{environment:o,error:t instanceof Error?t.message:String(t)}),{available:!1,reason:"unsupported"}}}function G(t,e){return function(t){if(function(t){return"object"==typeof t&&null!==t&&"statusCode"in t&&"string"==typeof t.statusCode}(t)){const e=t.statusCode.toUpperCase();if("CANCELED"===e||"CANCELLED"===e)return!0}if(t instanceof Error){const e=t.message.toLowerCase();return e.includes("cancel")||e.includes("closed")||e.includes("abort")}return!1}(t)?{kind:"cancelled"}:m(t)&&400===t.response?.status?{kind:"denied",sessionId:e}:{kind:"authorize"}}function S(t){if(null!==t&&"object"==typeof t){const e=t.paymentMethodData?.tokenizationData,a=e?.token;if("string"==typeof a&&a.length>0)return a}throw new Error("Invalid Google Pay payment data: missing tokenizationData.token")}try{p()}catch{}const A=s`:host{display:flex;flex-direction:column;align-items:stretch;justify-content:center;gap:12px;width:100%;min-height:48px}.pay-row{display:block;width:100%}.pay-row--paying{opacity:.55;pointer-events:none}::slotted([slot=google-pay-button]){display:block;width:100%;height:var(--mq-google-pay-button-height,48px)}.state{text-align:center;font-family:system-ui,sans-serif;font-size:15px;color:#86868b;margin:0}`;class GooglePayCheckoutSuccessEvent extends Event{static{this.eventName="payment-success"}constructor(t){super(GooglePayCheckoutSuccessEvent.eventName,{bubbles:!0,composed:!0}),this.detail=t}}class GooglePayCheckoutDeniedEvent extends Event{static{this.eventName="payment-denied"}constructor(t){super(GooglePayCheckoutDeniedEvent.eventName,{bubbles:!0,composed:!0}),this.detail=t}}class GooglePayCheckoutErrorEvent extends Event{static{this.eventName="payment-error"}constructor(t){super(GooglePayCheckoutErrorEvent.eventName,{bubbles:!0,composed:!0}),this.detail=t}}const T=new Set(["sdk-missing","unsupported"]);function D(t,e){i.warn(t,{error:e instanceof Error?e.message:String(e)})}let N=class MqGooglePayCheckout extends r{constructor(){super(...arguments),this._availabilityPhase="checking",this._unavailableReason=null,this._paying=!1,this._paymentsClient=null,this._paymentsClientEnvironment=null,this._buttonHost=null,this._availabilityGeneration=0,this._availabilityAbortController=null,this._terminalErrorDispatched=!1,this._loginTokenTask=new o(this,g,{args:()=>[this.apiKey,this.token],onComplete:t=>{g.setAuthToken(t.access_token),this._refreshAvailability()},onError:()=>{this.dispatchEvent(new GooglePayCheckoutErrorEvent({reason:"auth"}))}}),this._onPayClick=()=>{this._paying||"ready"!==this._availabilityPhase||this._processPayment()}}static{this.styles=A}willUpdate(t){if(t.has("env")&&(this.env&&u(this.env),this._resetPaymentsClient()),t.has("gatewayEnvironment")&&this._resetPaymentsClient(),t.has("apiKey")&&g.setApiKey(this.apiKey),t.has("locale")){const t=y(this.locale)?this.locale:"es_ES";d(t),g.setLanguage(t)}(t.has("merchantId")||t.has("gatewayMerchantId")||t.has("env")||t.has("gatewayEnvironment"))&&this._loginTokenTask.value&&this._refreshAvailability()}connectedCallback(){super.connectedCallback(),this._availabilityAbortController=new AbortController,this._terminalErrorDispatched=!1}disconnectedCallback(){this._availabilityAbortController?.abort(),this._availabilityAbortController=null,this._resetPaymentsClient(),super.disconnectedCallback()}_dispatchTerminalError(){this._terminalErrorDispatched||(this._terminalErrorDispatched=!0,this.dispatchEvent(new GooglePayCheckoutErrorEvent({reason:"unsupported"})))}_resetPaymentsClient(){this._paymentsClient=null,this._paymentsClientEnvironment=null,this._removeButtonHost()}_getPaymentsClient(){const t=E(this.env,this.gatewayEnvironment);return this._paymentsClient&&this._paymentsClientEnvironment===t||(this._paymentsClient=new google.payments.api.PaymentsClient({environment:t}),this._paymentsClientEnvironment=t,this._buttonHost=null),this._paymentsClient}async _refreshAvailability(){const t=++this._availabilityGeneration;this._availabilityPhase="checking",this._unavailableReason=null,this._removeButtonHost();const e=await I(this.merchantId??"",this.gatewayMerchantId??"",this.env,{signal:this._availabilityAbortController?.signal,gatewayEnvironment:this.gatewayEnvironment});if(t===this._availabilityGeneration&&this.isConnected){if(!e.available)return this._availabilityPhase="unavailable",this._unavailableReason=e.reason,void(T.has(e.reason)&&this._dispatchTerminalError());this._availabilityPhase="ready",this._unavailableReason=null}}_ensureButtonHost(){const t=this.querySelector(':scope > [slot="google-pay-button"]');if(t)return t;const e=document.createElement("div");return e.slot="google-pay-button",this.appendChild(e),e}_removeButtonHost(){this.querySelector(':scope > [slot="google-pay-button"]')?.remove(),this._buttonHost=null}_mountGooglePayButton(){if(this._buttonHost||"ready"!==this._availabilityPhase)return;const t=this._ensureButtonHost();try{const e=this._getPaymentsClient().createButton({onClick:this._onPayClick,buttonColor:"black",buttonType:"pay",buttonSizeMode:"fill"});t.replaceChildren(e),this._buttonHost=t}catch(t){D("mq-google-pay-checkout: failed to create Google Pay button",t),this._removeButtonHost(),this._availabilityPhase="unavailable",this._unavailableReason="unsupported",this._dispatchTerminalError()}}updated(t){super.updated(t),"ready"===this._availabilityPhase&&this._mountGooglePayButton()}async _processPayment(){this._paying=!0;try{const t=await this._getPaymentsClient().loadPaymentData(P({merchantId:this.merchantId,gatewayMerchantId:this.gatewayMerchantId,merchantName:this.merchantName||this.label},{amount:this.amount,currencyCode:this.currency,countryCode:this.country})),e=await g.payments.authorizeGooglePay({order_id:this.sessionId,token:S(t)}),{status:a,consultation_id:n}=e.data,o=v(a,n,this.sessionId);switch(o.kind){case"success":this.dispatchEvent(new GooglePayCheckoutSuccessEvent({sessionId:o.sessionId,reference:o.reference}));break;case"denied":this.dispatchEvent(new GooglePayCheckoutDeniedEvent({sessionId:o.sessionId}));break;case"error":this.dispatchEvent(new GooglePayCheckoutErrorEvent({reason:o.reason}))}}catch(t){const e=G(t,this.sessionId);switch(e.kind){case"cancelled":this.dispatchEvent(new GooglePayCheckoutErrorEvent({reason:"cancelled"}));break;case"denied":this.dispatchEvent(new GooglePayCheckoutDeniedEvent({sessionId:e.sessionId}));break;case"authorize":D("mq-google-pay-checkout: authorize failed",t),this.dispatchEvent(new GooglePayCheckoutErrorEvent({reason:"authorize"}))}}finally{this._paying=!1}}_renderUnavailable(){switch(this._unavailableReason){case"merchant-id-missing":return l`<p class="state">${a("Falta el identificador de comercio de Google Pay")}</p>`;case"gateway-merchant-id-missing":return l`<p class="state">${a("Falta el identificador de pasarela de Google Pay")}</p>`;case"sdk-missing":return l`<p class="state">${a("No se ha podido cargar Google Pay. Comprueba la configuración del sitio e inténtalo de nuevo.")}</p>`;default:return l`<p class="state">${a("Google Pay no está disponible. Prueba con tarjeta u otro método de pago.")}</p>`}}render(){return this._loginTokenTask.render({pending:()=>l`<p class="state">${a("Preparando Google Pay…")}</p>`,error:()=>l`<p class="state">${a("No hemos podido iniciar el pago")}</p>`,complete:()=>"checking"===this._availabilityPhase?l`<p class="state">${a("Comprobando Google Pay…")}</p>`:"unavailable"===this._availabilityPhase?this._renderUnavailable():l`<div class="pay-row ${this._paying?"pay-row--paying":""}"><slot name="google-pay-button"></slot></div>`})}};t([c({type:String,attribute:"env"})],N.prototype,"env",void 0),t([c({type:String,attribute:"gateway-environment"})],N.prototype,"gatewayEnvironment",void 0),t([c({type:String,attribute:"api-key"})],N.prototype,"apiKey",void 0),t([c({type:String,attribute:"token"})],N.prototype,"token",void 0),t([c({type:String,attribute:"locale",reflect:!0})],N.prototype,"locale",void 0),t([c({type:String,attribute:"merchant-id"})],N.prototype,"merchantId",void 0),t([c({type:String,attribute:"gateway-merchant-id"})],N.prototype,"gatewayMerchantId",void 0),t([c({type:String,attribute:"merchant-name"})],N.prototype,"merchantName",void 0),t([c({type:String,attribute:"session-id"})],N.prototype,"sessionId",void 0),t([c({type:String,attribute:"amount"})],N.prototype,"amount",void 0),t([c({type:String,attribute:"currency"})],N.prototype,"currency",void 0),t([c({type:String,attribute:"country"})],N.prototype,"country",void 0),t([c({type:String,attribute:"label"})],N.prototype,"label",void 0),t([h()],N.prototype,"_availabilityPhase",void 0),t([h()],N.prototype,"_unavailableReason",void 0),t([h()],N.prototype,"_paying",void 0),N=t([n(),e("mq-google-pay-checkout")],N);export{GooglePayCheckoutDeniedEvent,GooglePayCheckoutErrorEvent,GooglePayCheckoutSuccessEvent,N as MqGooglePayCheckout};
1
+ import{_ as t,t as e}from"./chunks/custom-element-DA9Fxvxd.js";import{m as a}from"./chunks/runtime-Bg1WXVCx.js";import{l as n}from"./chunks/parseISO-jT42c8Ob.js";import{L as o}from"./chunks/login-token-task-BI-L2zSV.js";import{l as i}from"./chunks/external-zAbuzxDj.js";import{i as s,a as r,x as l}from"./chunks/lit-element-DiWJYFwC.js";import{n as c}from"./chunks/property-scuRaFcM.js";import{r as h}from"./chunks/state-LQivXIgA.js";import{setEnv as u}from"./env.js";import{initLocalization as p,isValidLocale as y,setLocale as d}from"./i18n.js";import{i as m,b as g}from"./chunks/api-chat-client-C8SqZtCa.js";import{r as v}from"./chunks/apple-pay-outcomes-BNkcTbbM.js";import"./chunks/task-Bj8p7kJX.js";import"./chunks/format-Cm3B1GMy.js";import"./chunks/isBefore-Cof0D841.js";function b(){return"undefined"!=typeof google&&"function"==typeof google.payments?.api?.PaymentsClient}const _=["PAN_ONLY","CRYPTOGRAM_3DS"],f=["VISA","MASTERCARD","AMEX"];function k(t){return{type:"PAYMENT_GATEWAY",parameters:{gateway:"globalpayments",gatewayMerchantId:t}}}function C(t){return{type:"CARD",parameters:{allowedAuthMethods:[..._],allowedCardNetworks:[...f]},tokenizationSpecification:k(t)}}function w(t){return[C(t)]}function E(t,e){return"test"===e?"TEST":"production"===e?"PRODUCTION":"development"===t?"TEST":"PRODUCTION"}function P(t,e){return function(t,e){return{apiVersion:2,apiVersionMinor:0,allowedPaymentMethods:w(t.gatewayMerchantId),merchantInfo:{merchantId:t.merchantId,merchantName:t.merchantName},transactionInfo:{totalPriceStatus:"FINAL",totalPrice:e.amount,currencyCode:e.currencyCode,countryCode:e.countryCode}}}(t,e)}async function I(t,e,a,n={}){if("undefined"==typeof window||!window.isSecureContext)return i.warn("google-pay: unavailable outside a secure context"),{available:!1,reason:"unsupported"};if(!t.trim())return i.warn("google-pay: missing merchant id"),{available:!1,reason:"merchant-id-missing"};if(!e.trim())return i.warn("google-pay: missing gateway merchant id"),{available:!1,reason:"gateway-merchant-id-missing"};if(!await function(t=8e3,e){return b()?Promise.resolve(!0):t<=0||e?.aborted?Promise.resolve(!1):new Promise(a=>{const n=Date.now()+t,o=t=>{clearInterval(s),e?.removeEventListener("abort",i),a(t)},i=()=>o(!1),s=setInterval(()=>{b()?o(!0):Date.now()>=n&&o(!1)},100);e?.addEventListener("abort",i,{once:!0})})}(n.sdkWaitTimeoutMs,n.signal))return i.warn("google-pay: pay.js was not loaded by the host page"),{available:!1,reason:"sdk-missing"};const o=E(a,n.gatewayEnvironment);try{const t=new google.payments.api.PaymentsClient({environment:o}),a=await t.isReadyToPay(function(t){return{apiVersion:2,apiVersionMinor:0,allowedPaymentMethods:w(t)}}(e));return a.result?{available:!0}:(i.warn("google-pay: isReadyToPay returned false",{environment:o}),{available:!1,reason:"unsupported"})}catch(t){return i.warn("google-pay: isReadyToPay threw",{environment:o,error:t instanceof Error?t.message:String(t)}),{available:!1,reason:"unsupported"}}}function G(t,e){return function(t){if(function(t){return"object"==typeof t&&null!==t&&"statusCode"in t&&"string"==typeof t.statusCode}(t)){const e=t.statusCode.toUpperCase();if("CANCELED"===e||"CANCELLED"===e)return!0}if(t instanceof Error){const e=t.message.toLowerCase();return e.includes("cancel")||e.includes("closed")||e.includes("abort")}return!1}(t)?{kind:"cancelled"}:m(t)&&400===t.response?.status?{kind:"denied",sessionId:e}:{kind:"authorize"}}function S(t){if(null!==t&&"object"==typeof t){const e=t.paymentMethodData?.tokenizationData,a=e?.token;if("string"==typeof a&&a.length>0)return a}throw new Error("Invalid Google Pay payment data: missing tokenizationData.token")}try{p()}catch{}const A=s`:host{display:flex;flex-direction:column;align-items:stretch;justify-content:center;gap:12px;width:100%;min-height:48px}.pay-row{display:block;width:100%}.pay-row--paying{opacity:.55;pointer-events:none}::slotted([slot=google-pay-button]){display:block;width:100%;height:var(--mq-google-pay-button-height,48px)}.state{text-align:center;font-family:system-ui,sans-serif;font-size:15px;color:#86868b;margin:0}`;class GooglePayCheckoutSuccessEvent extends Event{static{this.eventName="payment-success"}constructor(t){super(GooglePayCheckoutSuccessEvent.eventName,{bubbles:!0,composed:!0}),this.detail=t}}class GooglePayCheckoutDeniedEvent extends Event{static{this.eventName="payment-denied"}constructor(t){super(GooglePayCheckoutDeniedEvent.eventName,{bubbles:!0,composed:!0}),this.detail=t}}class GooglePayCheckoutErrorEvent extends Event{static{this.eventName="payment-error"}constructor(t){super(GooglePayCheckoutErrorEvent.eventName,{bubbles:!0,composed:!0}),this.detail=t}}const T=new Set(["sdk-missing","unsupported"]);function D(t,e){i.warn(t,{error:e instanceof Error?e.message:String(e)})}let N=class MqGooglePayCheckout extends r{constructor(){super(...arguments),this._availabilityPhase="checking",this._unavailableReason=null,this._paying=!1,this._paymentsClient=null,this._paymentsClientEnvironment=null,this._buttonHost=null,this._availabilityGeneration=0,this._availabilityAbortController=null,this._terminalErrorDispatched=!1,this._loginTokenTask=new o(this,g,{args:()=>[this.apiKey,this.token],onComplete:t=>{g.setAuthToken(t.access_token),this._refreshAvailability()},onError:()=>{this.dispatchEvent(new GooglePayCheckoutErrorEvent({reason:"auth"}))}}),this._onPayClick=()=>{this._paying||"ready"!==this._availabilityPhase||this._processPayment()}}static{this.styles=A}willUpdate(t){if(t.has("env")&&(this.env&&u(this.env),this._resetPaymentsClient()),t.has("gatewayEnvironment")&&this._resetPaymentsClient(),t.has("apiKey")&&g.setApiKey(this.apiKey),t.has("locale")){const t=y(this.locale)?this.locale:"es_ES";d(t),g.setLanguage(t)}(t.has("merchantId")||t.has("gatewayMerchantId")||t.has("env")||t.has("gatewayEnvironment"))&&this._loginTokenTask.value&&this._refreshAvailability()}connectedCallback(){super.connectedCallback(),this._availabilityAbortController=new AbortController,this._terminalErrorDispatched=!1}disconnectedCallback(){this._availabilityAbortController?.abort(),this._availabilityAbortController=null,this._resetPaymentsClient(),super.disconnectedCallback()}_dispatchTerminalError(){this._terminalErrorDispatched||(this._terminalErrorDispatched=!0,this.dispatchEvent(new GooglePayCheckoutErrorEvent({reason:"unsupported"})))}_resetPaymentsClient(){this._paymentsClient=null,this._paymentsClientEnvironment=null,this._removeButtonHost()}_getPaymentsClient(){const t=E(this.env,this.gatewayEnvironment);return this._paymentsClient&&this._paymentsClientEnvironment===t||(this._paymentsClient=new google.payments.api.PaymentsClient({environment:t}),this._paymentsClientEnvironment=t,this._buttonHost=null),this._paymentsClient}async _refreshAvailability(){const t=++this._availabilityGeneration;this._availabilityPhase="checking",this._unavailableReason=null,this._removeButtonHost();const e=await I(this.merchantId??"",this.gatewayMerchantId??"",this.env,{signal:this._availabilityAbortController?.signal,gatewayEnvironment:this.gatewayEnvironment});if(t===this._availabilityGeneration&&this.isConnected){if(!e.available)return this._availabilityPhase="unavailable",this._unavailableReason=e.reason,void(T.has(e.reason)&&this._dispatchTerminalError());this._availabilityPhase="ready",this._unavailableReason=null}}_ensureButtonHost(){const t=this.querySelector(':scope > [slot="google-pay-button"]');if(t)return t;const e=document.createElement("div");return e.slot="google-pay-button",this.appendChild(e),e}_removeButtonHost(){this.querySelector(':scope > [slot="google-pay-button"]')?.remove(),this._buttonHost=null}_mountGooglePayButton(){if(this._buttonHost||"ready"!==this._availabilityPhase)return;const t=this._ensureButtonHost();try{const e=this._getPaymentsClient().createButton({onClick:this._onPayClick,buttonColor:"black",buttonType:"pay",buttonSizeMode:"fill"});t.replaceChildren(e),this._buttonHost=t}catch(t){D("mq-google-pay-checkout: failed to create Google Pay button",t),this._removeButtonHost(),this._availabilityPhase="unavailable",this._unavailableReason="unsupported",this._dispatchTerminalError()}}updated(t){super.updated(t),"ready"===this._availabilityPhase&&this._mountGooglePayButton()}async _processPayment(){this._paying=!0;try{const t=await this._getPaymentsClient().loadPaymentData(P({merchantId:this.merchantId,gatewayMerchantId:this.gatewayMerchantId,merchantName:this.merchantName||this.label},{amount:this.amount,currencyCode:this.currency,countryCode:this.country})),e=await g.payments.authorizeGooglePay({order_id:this.sessionId,token:S(t)}),{status:a,consultation_id:n}=e.data,o=v(a,n,this.sessionId);switch(o.kind){case"success":this.dispatchEvent(new GooglePayCheckoutSuccessEvent({sessionId:o.sessionId,reference:o.reference}));break;case"denied":this.dispatchEvent(new GooglePayCheckoutDeniedEvent({sessionId:o.sessionId}));break;case"error":this.dispatchEvent(new GooglePayCheckoutErrorEvent({reason:o.reason}))}}catch(t){const e=G(t,this.sessionId);switch(e.kind){case"cancelled":this.dispatchEvent(new GooglePayCheckoutErrorEvent({reason:"cancelled"}));break;case"denied":this.dispatchEvent(new GooglePayCheckoutDeniedEvent({sessionId:e.sessionId}));break;case"authorize":D("mq-google-pay-checkout: authorize failed",t),this.dispatchEvent(new GooglePayCheckoutErrorEvent({reason:"authorize"}))}}finally{this._paying=!1}}_renderUnavailable(){switch(this._unavailableReason){case"merchant-id-missing":return l`<p class="state">${a("Falta el identificador de comercio de Google Pay")}</p>`;case"gateway-merchant-id-missing":return l`<p class="state">${a("Falta el identificador de pasarela de Google Pay")}</p>`;case"sdk-missing":return l`<p class="state">${a("No se ha podido cargar Google Pay. Comprueba la configuración del sitio e inténtalo de nuevo.")}</p>`;default:return l`<p class="state">${a("Google Pay no está disponible. Prueba con tarjeta u otro método de pago.")}</p>`}}render(){return this._loginTokenTask.render({pending:()=>l`<p class="state">${a("Preparando Google Pay…")}</p>`,error:()=>l`<p class="state">${a("No hemos podido iniciar el pago")}</p>`,complete:()=>"checking"===this._availabilityPhase?l`<p class="state">${a("Comprobando Google Pay…")}</p>`:"unavailable"===this._availabilityPhase?this._renderUnavailable():l`<div class="pay-row ${this._paying?"pay-row--paying":""}"><slot name="google-pay-button"></slot></div>`})}};t([c({type:String,attribute:"env"})],N.prototype,"env",void 0),t([c({type:String,attribute:"gateway-environment"})],N.prototype,"gatewayEnvironment",void 0),t([c({type:String,attribute:"api-key"})],N.prototype,"apiKey",void 0),t([c({type:String,attribute:"token"})],N.prototype,"token",void 0),t([c({type:String,attribute:"locale",reflect:!0})],N.prototype,"locale",void 0),t([c({type:String,attribute:"merchant-id"})],N.prototype,"merchantId",void 0),t([c({type:String,attribute:"gateway-merchant-id"})],N.prototype,"gatewayMerchantId",void 0),t([c({type:String,attribute:"merchant-name"})],N.prototype,"merchantName",void 0),t([c({type:String,attribute:"session-id"})],N.prototype,"sessionId",void 0),t([c({type:String,attribute:"amount"})],N.prototype,"amount",void 0),t([c({type:String,attribute:"currency"})],N.prototype,"currency",void 0),t([c({type:String,attribute:"country"})],N.prototype,"country",void 0),t([c({type:String,attribute:"label"})],N.prototype,"label",void 0),t([h()],N.prototype,"_availabilityPhase",void 0),t([h()],N.prototype,"_unavailableReason",void 0),t([h()],N.prototype,"_paying",void 0),N=t([n(),e("mq-google-pay-checkout")],N);export{GooglePayCheckoutDeniedEvent,GooglePayCheckoutErrorEvent,GooglePayCheckoutSuccessEvent,N as MqGooglePayCheckout};
@@ -1 +1 @@
1
- import{_ as e,t}from"./chunks/custom-element-DA9Fxvxd.js";import{a as i,x as s}from"./chunks/lit-element-DiWJYFwC.js";import{n as o}from"./chunks/property-scuRaFcM.js";import{o as n}from"./chunks/if-defined-BYeVdwgd.js";import{a}from"./chunks/api-chat-client-BTBtu01T.js";import"./mq-checkout.js";import"./chunks/external-zAbuzxDj.js";import"./chunks/parseISO-jT42c8Ob.js";import"./chunks/runtime-Bg1WXVCx.js";import"./chunks/format-Cm3B1GMy.js";import"./chunks/isBefore-Cof0D841.js";import"./env.js";import"./chunks/task-Bj8p7kJX.js";import"./chunks/login-token-task-BI-L2zSV.js";import"./chunks/state-LQivXIgA.js";import"./theme.js";import"./i18n.js";import"./ui/mq-skeleton.js";import"./chunks/style-map-CIdqdn7C.js";import"./chunks/directive-2EDmOukv.js";class ImmediateVideocallPaidEvent extends Event{static{this.eventName="payment-success"}constructor(e){super(ImmediateVideocallPaidEvent.eventName,{bubbles:!0,composed:!0}),this.detail=e}}let r=class MqImmediateVideocallCheckout extends i{constructor(){super(...arguments),this._provideSession=async()=>{const e=await a.payments.createImmediateVideocallPaymentLink({video_call_schedule_id:this.videoCallScheduleId});return{sessionId:e.session_id,paymentUrl:e.payment_link}},this._onSuccess=e=>{e.stopPropagation(),this.dispatchEvent(new ImmediateVideocallPaidEvent({videoCallId:e.detail.reference}))}}render(){return s`<mq-checkout env="${n(this.env)}" api-key="${this.apiKey}" token="${this.token}" locale="${this.locale}" .provideSession="${this._provideSession}" @payment-success="${this._onSuccess}"></mq-checkout>`}};e([o({type:String,attribute:"env"})],r.prototype,"env",void 0),e([o({type:String,attribute:"api-key"})],r.prototype,"apiKey",void 0),e([o({type:String,attribute:"token"})],r.prototype,"token",void 0),e([o({type:String,attribute:"locale",reflect:!0})],r.prototype,"locale",void 0),e([o({type:String,attribute:"video-call-schedule-id"})],r.prototype,"videoCallScheduleId",void 0),r=e([t("mq-immediate-videocall-checkout")],r);export{ImmediateVideocallPaidEvent,r as MqImmediateVideocallCheckout};
1
+ import{_ as e,t}from"./chunks/custom-element-DA9Fxvxd.js";import{a as i,x as s}from"./chunks/lit-element-DiWJYFwC.js";import{n as o}from"./chunks/property-scuRaFcM.js";import{o as n}from"./chunks/if-defined-BYeVdwgd.js";import{b as r}from"./chunks/api-chat-client-C8SqZtCa.js";import"./mq-checkout.js";import"./chunks/external-zAbuzxDj.js";import"./chunks/parseISO-jT42c8Ob.js";import"./chunks/runtime-Bg1WXVCx.js";import"./chunks/format-Cm3B1GMy.js";import"./chunks/isBefore-Cof0D841.js";import"./env.js";import"./chunks/task-Bj8p7kJX.js";import"./chunks/login-token-task-BI-L2zSV.js";import"./chunks/state-LQivXIgA.js";import"./theme.js";import"./i18n.js";import"./ui/mq-skeleton.js";import"./chunks/style-map-CIdqdn7C.js";import"./chunks/directive-2EDmOukv.js";class ImmediateVideocallPaidEvent extends Event{static{this.eventName="payment-success"}constructor(e){super(ImmediateVideocallPaidEvent.eventName,{bubbles:!0,composed:!0}),this.detail=e}}let a=class MqImmediateVideocallCheckout extends i{constructor(){super(...arguments),this._provideSession=async()=>{const e=await r.payments.createImmediateVideocallPaymentLink({video_call_schedule_id:this.videoCallScheduleId});return{sessionId:e.session_id,paymentUrl:e.payment_link}},this._onSuccess=e=>{e.stopPropagation(),this.dispatchEvent(new ImmediateVideocallPaidEvent({videoCallId:e.detail.reference}))}}render(){return s`<mq-checkout env="${n(this.env)}" api-key="${this.apiKey}" token="${this.token}" locale="${this.locale}" .provideSession="${this._provideSession}" @payment-success="${this._onSuccess}"></mq-checkout>`}};e([o({type:String,attribute:"env"})],a.prototype,"env",void 0),e([o({type:String,attribute:"api-key"})],a.prototype,"apiKey",void 0),e([o({type:String,attribute:"token"})],a.prototype,"token",void 0),e([o({type:String,attribute:"locale",reflect:!0})],a.prototype,"locale",void 0),e([o({type:String,attribute:"video-call-schedule-id"})],a.prototype,"videoCallScheduleId",void 0),a=e([t("mq-immediate-videocall-checkout")],a);export{ImmediateVideocallPaidEvent,a as MqImmediateVideocallCheckout};
@@ -58,11 +58,11 @@ declare const LoginTokenResponseSchema: z.ZodObject<{
58
58
  }>;
59
59
  }, "strip", z.ZodTypeAny, {
60
60
  hash: string;
61
+ name: string;
61
62
  country_code: string;
62
63
  timezone: string;
63
64
  first_name: string;
64
65
  last_name: string;
65
- name: string;
66
66
  birth_date: string;
67
67
  email: string;
68
68
  language_code: string;
@@ -79,11 +79,11 @@ declare const LoginTokenResponseSchema: z.ZodObject<{
79
79
  };
80
80
  }, {
81
81
  hash: string;
82
+ name: string;
82
83
  country_code: string;
83
84
  timezone: string;
84
85
  first_name: string;
85
86
  last_name: string;
86
- name: string;
87
87
  birth_date: string;
88
88
  email: string;
89
89
  language_code: string;
@@ -100,14 +100,13 @@ declare const LoginTokenResponseSchema: z.ZodObject<{
100
100
  };
101
101
  }>;
102
102
  }, "strip", z.ZodTypeAny, {
103
- access_token: string;
104
103
  patient: {
105
104
  hash: string;
105
+ name: string;
106
106
  country_code: string;
107
107
  timezone: string;
108
108
  first_name: string;
109
109
  last_name: string;
110
- name: string;
111
110
  birth_date: string;
112
111
  email: string;
113
112
  language_code: string;
@@ -123,15 +122,15 @@ declare const LoginTokenResponseSchema: z.ZodObject<{
123
122
  organization_name: string;
124
123
  };
125
124
  };
126
- }, {
127
125
  access_token: string;
126
+ }, {
128
127
  patient: {
129
128
  hash: string;
129
+ name: string;
130
130
  country_code: string;
131
131
  timezone: string;
132
132
  first_name: string;
133
133
  last_name: string;
134
- name: string;
135
134
  birth_date: string;
136
135
  email: string;
137
136
  language_code: string;
@@ -147,6 +146,7 @@ declare const LoginTokenResponseSchema: z.ZodObject<{
147
146
  organization_name: string;
148
147
  };
149
148
  };
149
+ access_token: string;
150
150
  }>;
151
151
  type LoginTokenResponse = z.infer<typeof LoginTokenResponseSchema>;
152
152