PluginProbe
Booktics – Appointment Booking Calendar for Service Businesses / 1.0.3
Booktics – Appointment Booking Calendar for Service Businesses v1.0.3
1.0.29 1.0.28 1.0.27 1.0.26 1.0.25 1.0.24 1.0.23 1.0.22 1.0.21 1.0.20 1.0.19 trunk 1.0.0 1.0.1 1.0.10 1.0.11 1.0.12 1.0.13 1.0.14 1.0.15 1.0.16 1.0.17 1.0.18 1.0.2 1.0.3 All 31 releases
booktics / assets / build / chunks / js / 472.js

472.js in Booktics – Appointment Booking Calendar for Service Businesses 1.0.3, at assets/build/chunks/js/472.js

368 lines 23.7 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 (globalThis.webpackChunkbooktics=globalThis.webpackChunkbooktics||[]).push([[472],{4623:(e,t,a)=>{"use strict";a.d(t,{BU:()=>u,eP:()=>h,mc:()=>p,vq:()=>g});var r=a(52762),n=a(59e3),i=a(22564),s=a(75778);const l=r.css`
2 .bkt-semi-bold-text {
3 font-weight: 600;
4 font-size: 16px;
5 }
6 `,o=r.css`
7 .bkt-hidden-input {
8 height: 0;
9 margin-top: -22px;
10
11 .ant-form-item-control-input {
12 display: none;
13 }
14 }
15 `,c=r.css`
16 .ant-form-item .ant-form-item-label > label.ant-form-item-required {
17 &::before {
18 display: none;
19 }
20
21 &::after {
22 display: inline-block;
23 margin-inline-end: 4px;
24 color: #ff4d4f;
25 font-size: 14px;
26 font-family: SimSun, sans-serif;
27 line-height: 1;
28 content: "*";
29 visibility: visible;
30 }
31 }
32 `,d=r.css`
33 @media (max-width: ${s.a?.xl}px) {
34 padding: 20px;
35 }
36 `,m=r.css`
37 .bkt-container-row {
38 max-width: 1200px;
39 }
40 `,p=(0,n.A)(i.Flex)`
41 width: 100%;
42 height: 100%;
43 margin: 0 auto;
44 padding: 45px;
45 color: ${({theme:e})=>e.colors.neutralLightDark};
46
47 .bkt-row-layout {
48 min-height: 600px;
49 }
50
51 ${m}
52 ${l}
53 ${d}
54 ${o}
55 ${c}
56 `,u=(0,n.A)(i.Flex)`
57 min-height: 100%;
58 margin: 0 auto;
59 padding: 45px 100px;
60 max-width: 1200px;
61 color: ${({theme:e})=>e.colors.neutralLightDark};
62
63 .bkt-row-layout {
64 min-height: 500px;
65 }
66
67 ${m}
68 ${l}
69 ${d}
70 ${o}
71 ${c}
72 `,h=(0,n.A)(i.SelectInput)`
73 min-width: 143px;
74 `,g=(0,n.A)(i.Modal)`
75 &.ant-modal {
76 width: 90% !important;
77 max-width: 1000px;
78 }
79
80 .ant-modal-content {
81 border: 1px solid ${({theme:e})=>e.colors.inputBorder};
82 border-radius: 10px;
83 }
84
85 .ant-modal-body {
86 padding: 0;
87
88 .bkt-row-layout {
89 min-height: 600px;
90
91 @media (max-width: ${s.a?.xxl}px) {
92 min-height: 500px;
93 }
94 }
95
96 ${o}
97 ${c}
98 }
99 `},13722:(e,t,a)=>{var r={"./af.js":65662,"./am.js":82355,"./ar-dz.js":48361,"./ar-iq.js":13309,"./ar-kw.js":79865,"./ar-ly.js":85592,"./ar-ma.js":81289,"./ar-sa.js":40539,"./ar-tn.js":54405,"./ar.js":2338,"./az.js":51130,"./be.js":51532,"./bg.js":39990,"./bi.js":95944,"./bm.js":71092,"./bn-bd.js":64608,"./bn.js":92509,"./bo.js":59294,"./br.js":72745,"./bs.js":25530,"./ca.js":25993,"./cs.js":9751,"./cv.js":4780,"./cy.js":95681,"./da.js":20325,"./de-at.js":32878,"./de-ch.js":13672,"./de.js":50494,"./dv.js":82187,"./el.js":54072,"./en-au.js":59881,"./en-ca.js":21995,"./en-gb.js":72026,"./en-ie.js":17329,"./en-il.js":97690,"./en-in.js":60912,"./en-nz.js":35571,"./en-sg.js":12673,"./en-tt.js":2619,"./en.js":65826,"./eo.js":33713,"./es-do.js":61219,"./es-mx.js":64719,"./es-pr.js":3532,"./es-us.js":32498,"./es.js":47317,"./et.js":4288,"./eu.js":94007,"./fa.js":90292,"./fi.js":89964,"./fo.js":17674,"./fr-ca.js":86290,"./fr-ch.js":73433,"./fr.js":813,"./fy.js":59836,"./ga.js":54061,"./gd.js":68418,"./gl.js":33562,"./gom-latn.js":78660,"./gu.js":57409,"./he.js":92010,"./hi.js":52830,"./hr.js":15811,"./ht.js":8809,"./hu.js":38298,"./hy-am.js":94309,"./id.js":87420,"./is.js":15513,"./it-ch.js":19286,"./it.js":33900,"./ja.js":50952,"./jv.js":77741,"./ka.js":46481,"./kk.js":11335,"./km.js":36101,"./kn.js":6364,"./ko.js":88003,"./ku.js":16605,"./ky.js":34457,"./lb.js":88615,"./lo.js":73860,"./lt.js":34485,"./lv.js":76467,"./me.js":80623,"./mi.js":32739,"./mk.js":75877,"./ml.js":75376,"./mn.js":12698,"./mr.js":46462,"./ms-my.js":26400,"./ms.js":79677,"./mt.js":77083,"./my.js":46803,"./nb.js":7205,"./ne.js":40880,"./nl-be.js":60465,"./nl.js":69423,"./nn.js":23473,"./oc-lnc.js":70225,"./pa-in.js":39252,"./pl.js":63225,"./pt-br.js":92218,"./pt.js":72369,"./rn.js":34509,"./ro.js":24334,"./ru.js":62796,"./rw.js":35414,"./sd.js":63222,"./se.js":55285,"./si.js":65665,"./sk.js":46847,"./sl.js":39998,"./sq.js":95977,"./sr-cyrl.js":27439,"./sr.js":45616,"./ss.js":52487,"./sv-fi.js":9160,"./sv.js":21340,"./sw.js":2979,"./ta.js":77250,"./te.js":87406,"./tet.js":18928,"./tg.js":15012,"./th.js":47081,"./tk.js":62544,"./tl-ph.js":78142,"./tlh.js":60321,"./tr.js":4895,"./tzl.js":3187,"./tzm-latn.js":58804,"./tzm.js":95084,"./ug-cn.js":79911,"./uk.js":34173,"./ur.js":51750,"./uz-latn.js":80950,"./uz.js":54734,"./vi.js":40860,"./x-pseudo.js":83379,"./yo.js":87933,"./zh-cn.js":16033,"./zh-hk.js":87741,"./zh-tw.js":31349,"./zh.js":56007};function n(e){var t=i(e);return a(t)}function i(e){if(!a.o(r,e)){var t=new Error("Cannot find module '"+e+"'");throw t.code="MODULE_NOT_FOUND",t}return r[e]}n.keys=function(){return Object.keys(r)},n.resolve=i,e.exports=n,n.id=13722},44512:(e,t,a)=>{"use strict";a.d(t,{A:()=>s});var r=a(47143),n=a(11534),i=a(60532);const s=function(){const{invoiceData:e}=(0,r.useSelect)(e=>e(i.H).getFrontendState(),[]),{setFrontendState:t,resetFrontend:a}=(0,r.useDispatch)(i.H);return{reschedule:async(a={})=>{const{id:r,...i}=a;try{const a=await(n.A?.appointment?.appointmentReschedule(r,i));a?.success&&t({openRescheduleModal:!1,invoiceData:{...e,items:e?.items?.map(e=>e?.id===r?{...e,...i}:e)}})}catch(e){console.error(e)}},cancel:async()=>{const t=e?.items[0]?.id;try{const e=await(n.A?.appointment?.appointmentCancel(t));e?.success&&a()}catch(e){console.error("Error fetching services:",e)}}}}},46079:(e,t,a)=>{"use strict";a.d(t,{A:()=>A});var r=a(51609),n=a(86087),i=a(22564),s=a(57010),l=a(47143),o=a(60532),c=a(59e3),d=a(75778);const m=c.A.div`
100 padding-right: 10px;
101
102 .bkt-flatpickr-input {
103 display: none;
104 }
105
106 .flatpickr-rContainer {
107 width: 100%;
108 }
109
110 .flatpickr-calendar {
111 width: 100%;
112 box-shadow: none;
113 background: transparent;
114
115 .dayContainer {
116 width: 100%;
117 min-width: 100%;
118 max-width: 100%;
119 }
120
121 .flatpickr-days,
122 .flatpickr-day {
123 width: 100%;
124 max-width: 100%;
125 }
126
127 .flatpickr-day {
128 height: 50px;
129 line-height: 50px;
130 border-radius: 6px;
131 color: #0a1018;
132 font-weight: 600;
133
134 &.selected {
135 color: #fff;
136 border: none;
137 background: ${({theme:e})=>e.colors.primary};
138 }
139
140 &.today {
141 border-color: transparent;
142
143 &::before {
144 content: "";
145 position: absolute;
146 bottom: 5px;
147 left: 50%;
148 transform: translateX(-50%);
149 background: ${({theme:e})=>e.colors.primary};
150 width: 5px;
151 height: 5px;
152 border-radius: 100vmax;
153 }
154 }
155
156 &.flatpickr-disabled,
157 &.flatpickr-disabled:hover {
158 color: ${({theme:e})=>e.colors.secondary};
159 opacity: 0.4;
160 }
161 }
162
163 @media (max-width: ${d.a.xxl}px) {
164 max-height: 380px;
165
166 .flatpickr-day {
167 height: 40px;
168 line-height: 40px;
169 }
170 }
171 }
172
173 .flatpickr-disabled {
174 opacity: 0.4;
175 }
176
177 .flatpickr-months {
178 padding-bottom: 20px;
179 border-bottom: 1px solid #eaeaea;
180 margin-bottom: 20px;
181 display: flex;
182 align-items: center;
183
184 .flatpickr-month,
185 .flatpickr-current-month {
186 text-align: left;
187 }
188
189 .flatpickr-current-month {
190 display: flex;
191 align-items: center;
192 left: 0;
193 padding-top: 0;
194 }
195
196 .flatpickr-prev-month,
197 .flatpickr-next-month {
198 display: flex;
199 justify-content: center;
200 align-items: center;
201 top: 8px;
202 height: 20px;
203 width: 20px;
204 padding: 0;
205 line-height: 20px;
206 border-radius: 100vmax;
207 background-color: #0c274a;
208
209 svg {
210 stroke: #ffffff;
211 stroke-width: 2px;
212 fill: transparent;
213 width: 10px;
214 height: 10px;
215 }
216
217 &.flatpickr-disabled {
218 cursor: no-drop;
219 }
220 }
221
222 .flatpickr-prev-month.flatpickr-prev-month,
223 .flatpickr-next-month.flatpickr-prev-month {
224 left: auto;
225 right: 40px;
226 }
227
228 .cur-year,
229 .cur-month {
230 font-weight: 600 !important;
231
232 &:hover,
233 &:focus {
234 background: transparent;
235 }
236 }
237 }
238 `;var p=a(74353),u=a.n(p),h=a(95358),g=a(48602),x=a(44512);const f=function(){const{setFrontendState:e}=(0,l.useDispatch)(o.H),t=(0,l.useSelect)(e=>e(o.H).getFrontendState(),[]),{currentStep:a,selectedData:r=[],availability:n,invoiceData:i}=t,{getTimeSlot:c}=(0,s.A)(),{addToCart:d,editCartItem:m}=(0,g.A)(),{reschedule:p}=(0,x.A)();return{selectDate:(t,a)=>{const n=r.map((e,t)=>t===r.length-1?{...e,date:a}:e);e({selectedData:n,currentSelectedData:n?.[n?.length-1]||{}})},selectMonth:(e,__,t)=>{const a=u()().month(t.currentMonth),r=a.startOf("month").format("YYYY-MM-DD"),n=a.startOf("month").add(60,"day").format("YYYY-MM-DD");c({startDate:r,endDate:n})},toggleTimeFormat:t=>{e({availability:{...n,timeSlots:(0,h.convertScheduleTimeFormat)({timeSlots:n?.timeSlots,to24Hour:t})},use24h:t})},selectTime:({slot:t})=>{if(!t?.is_available)return;const{start:n,end:s}=t,l=[...r],o=l.length-1;o>=0&&(l[o]={...l[o],start_time:n,end_time:s});const c=l[o]||{},{service:u,additional_duration:h,team:g,date:x,total:f,extraServices:b,group_booking:j}=c;e({selectedData:l,currentSelectedData:c,...!i&&{currentStep:a+1}});const k={team_member_id:g?.id,service_id:u?.id,date:x,start_time:n,end_time:s,additional_duration_id:h?.id,extra_services:b,price:h?.charge_amount,total:f,group_booking:j};if(i)p({id:i?.items?.[i?.items?.length-1]?.id,date:x,start_time:n,end_time:s});else{let e=c?.uuid;if(e)return void m(e,k);d(k)}}}},b=window.booktics.locale_name;if(b)try{a(13722)(`./${b}.js`),u().locale(b)}catch(e){const t=b.split("-")[0];a(13722)(`./${t}.js`),u().locale(t)}const j=()=>{const{availability:e}=(0,l.useSelect)(e=>e(o.H).getFrontendState(),[]),{fp:t}=(()=>{const e=(0,l.useSelect)(e=>e(o.H).getFrontendState(),[]),{settings:t,currentSelectedData:a,availability:r}=e,{disabledDates:i=[]}=r||{},s=(0,n.useRef)(null),c=(0,n.useRef)(null),{date:d}=a||{},{selectDate:m,selectMonth:p}=f();return(0,n.useEffect)(()=>{if("undefined"!=typeof window&&window.flatpickr&&!c.current){const e=s.current;t?.calendar_locale&&window.flatpickr.localize(window.flatpickr.l10ns[t?.calendar_locale]),c.current=window.flatpickr(e,{defaultDate:d,inline:!0,altFormat:"F j, Y",dateFormat:"Y-m-d",minDate:"today",monthSelectorType:"static",disable:i,locale:{firstDayOfWeek:Number(window?.booktics?.start_of_week)},onChange:m,onMonthChange:p})}return()=>{c.current?.destroy(),c.current=null}},[]),(0,n.useEffect)(()=>{c.current&&c.current.set("disable",i)},[i]),{fp:s}})();return(0,r.createElement)(i.Spin,{spinning:!e||e?.loading},(0,r.createElement)(m,null,(0,r.createElement)("input",{ref:t,type:"text",className:"bkt-flatpickr-input"})))};var k=a(46714);const{__}=wp?.i18n||{},v=(0,c.A)(i.Flex)`
239 width: 100%;
240 height: 450px;
241 padding: 8px 16px;
242 border-left: 1px solid #e2ecf4;
243 font-weight: 500;
244 ${({hasSlot:e})=>e?"justify-content: start;":"justify-content: center; align-items: center;"}
245
246 .bkt-slot-heading {
247 font-size: 16px;
248 }
249
250 @media (max-width: ${d.a.xxl}px) {
251 height: 350px;
252 }
253 `,w=(0,c.A)(i.Flex)`
254 overflow-y: auto;
255 max-height: 350px;
256 padding-right: 8px;
257
258 /* Optional custom scrollbar */
259 &::-webkit-scrollbar {
260 width: 6px;
261 }
262 &::-webkit-scrollbar-thumb {
263 background-color: #d9d9d9;
264 border-radius: 3px;
265 }
266 `,E=(0,c.A)(i.Button)`
267 &.ant-btn {
268 border-radius: 4px;
269 font-weight: 600;
270 }
271
272 width: 100%;
273 padding: 10px 12px;
274 border: ${({active:e,theme:t})=>`${e?"2px":"1px"} solid ${e?t.colors.primary:"#E2ECF4"}`};
275 opacity: ${({disabled:e})=>e?.4:1};
276 position: relative;
277 font-size: 16px;
278 justify-content: ${({active:e})=>e?"start":"center"};
279 cursor: ${({disabled:e})=>e?"not-allowed":"pointer"};
280 transition: 0.3s ease;
281
282 &:hover {
283 border-color: ${({disabled:e})=>e?"#d9d9d9":"#40a9ff"};
284 }
285
286 svg {
287 position: absolute;
288 right: 10px;
289 color: ${({theme:e})=>e.colors.primary};
290 }
291 `,y=(0,c.A)(i.Switch)`
292 background: #f7f7f7;
293 width: 36px;
294 height: 18px;
295
296 .ant-switch-handle::before {
297 top: -7px;
298 background-color: #fff;
299 border-radius: 50%;
300 border: 2px solid #e2ecf4;
301 height: 22px;
302 width: 22px;
303 }
304 `,{CheckCircleFilled:_}=window?.booktics?.libraryIcons||{},S=({selectedTime:e,slot:t})=>{const{selectTime:a}=f(),{start:n,is_available:s}=t||{},l=e===n;return(0,r.createElement)(E,{onClick:()=>a({slot:t}),disabled:!s,active:l,text:(0,r.createElement)(i.Flex,null,n,l?(0,r.createElement)(_,null):null)})},{__:D}=wp?.i18n||{},F=()=>{const e=(0,l.useSelect)(e=>e(o.H).getFrontendState(),[]),{availability:t,use24h:a,currentSelectedData:n}=e,s=n?.start_time,c=t?.timeSlots?.[n?.date]||[],{toggleTimeFormat:d}=f();return(0,r.createElement)(v,{vertical:!0,gap:"large",hasSlot:!!c?.length},c?.length?(0,r.createElement)(r.Fragment,null,(0,r.createElement)(i.Space,{align:"center"},(0,r.createElement)("span",null,D("12h","booktics")),(0,r.createElement)(y,{checked:a,onChange:d}),(0,r.createElement)("span",null,D("24h","booktics"))),(0,r.createElement)(w,{vertical:!0,gap:"small"},c?.filter(e=>e?.is_available)?.map(e=>(0,r.createElement)(S,{key:e?.start,slot:e,selectedTime:s})))):(0,r.createElement)(k.EmptyGridIcon,null))},{__:T}=wp?.i18n||{},A=()=>{const{getTimeSlot:e}=(0,s.A)();return(0,n.useEffect)(()=>{e()},[]),(0,r.createElement)(i.Flex,{vertical:!0,gap:20},(0,r.createElement)(i.Title,{level:3,text:T("Select Date & Time","booktics")}),(0,r.createElement)(i.Row,null,(0,r.createElement)(i.Col,{xs:24,sm:24,md:16,lg:16},(0,r.createElement)(j,null)),(0,r.createElement)(i.Col,{xs:24,sm:24,md:8,lg:8},(0,r.createElement)(F,null))))}},48602:(e,t,a)=>{"use strict";a.d(t,{A:()=>s});var r=a(47143),n=a(11534),i=a(60532);const s=function(){const{setFrontendState:e}=(0,r.useDispatch)(i.H),t=(0,r.useSelect)(e=>e(i.H).getFrontendState(),[]),{selectedData:a=[],orderDetails:s=[],currentSelectedData:l}=t,o=e=>({...e,service:l?.service,extraServices:l?.extraServices,team:l?.team});return{addToCart:async t=>{try{const r=await(n.A?.cart?.addToCart(t));if(r?.success){const t=a.map((e,t)=>t===a.length-1?{...e,uuid:r?.data?.uuid}:e);e({orderDetails:[...s,o(r?.data)],selectedData:t,currentSelectedData:t?.[t?.length-1]||{}})}}catch(e){console.error("Error adding to cart:",e)}},removeFromCart:async t=>{try{const r=await(n.A?.cart?.deleteCartItem(t));if(r?.success){const r=a.map(e=>e?.uuid===t?{...e,uuid:null}:e);e({orderDetails:s?.filter(e=>e?.uuid!==t),selectedData:r,currentSelectedData:r?.[r?.length-1]||{}})}}catch(e){console.error("Error removing from cart:",e)}},getCartItems:async()=>{if(!s)try{const t=await(n.A?.cart?.getCartItems());t?.success&&e({orderDetails:t?.data?.items?.map(e=>o(e))})}catch(e){console.error("Error retrieving cart items:",e)}},editCartItem:async(t,a)=>{try{const r=await(n.A?.cart?.editCart(t,a));if(r?.success){const a=s.map(e=>e?.uuid===t?{...e,...o(r?.data)}:e);e({orderDetails:a})}}catch(e){console.error("Error editing cart item:",e)}}}}},57010:(e,t,a)=>{"use strict";a.d(t,{A:()=>o});var r=a(47143),n=a(86087),i=a(11534),s=a(60532),l=a(95358);const o=function(){const{setFrontendState:e}=(0,r.useDispatch)(s.H),t=(0,r.useSelect)(e=>e(s.H).getFrontendState(),[]),a=(0,n.useRef)(t);return(0,n.useEffect)(()=>{a.current=t},[t]),{getTimeSlot:async t=>{var r;const{currentSelectedData:n,calendarFilter:s,availability:o,use24h:c}=a.current,{service:d,additional_duration:m,team:p}=n||{};if(!t&&d?.id===o?.service_id&&p?.id===o?.team_member_id)return;const u=t?.startDate||s?.startDate,h=t?.endDate||s?.endDate,g={service_id:t?.service_id||d?.id,team_member_id:t?.team_member_id||p?.id,start_date:u,end_date:h,additional_duration_id:t?.additional_duration_id||m?.id},x=null!==(r=o?.timeSlots)&&void 0!==r?r:{};if(x[u]&&x[h])return;let f;try{e({availability:{...o,loading:!0}});const a=await(i.A?.appointment?.getTimeSlot(g));if(a?.success){let e=(0,l.convertScheduleTimeFormat)({timeSlots:a?.data?.slots,to24Hour:c});t&&(e={...o?.timeSlots,...e});const r=Object.entries(e).filter(([,e])=>Array.isArray(e)&&0===e.length).map(([e])=>e);f={...g,timeSlots:e,disabledDates:r}}}catch(e){console.error("Error fetching services:",e)}finally{e({availability:{...f||o,loading:!1}})}}}}},87927:(e,t,a)=>{"use strict";a.d(t,{D7:()=>l,It:()=>d,QP:()=>s,TQ:()=>c,_1:()=>i,fq:()=>o});var r=a(59e3),n=a(22564);const i=(0,r.A)(n.Flex)`
305 padding: 30px 20px;
306 height: 100%;
307 ${({hasBorder:e,theme:t})=>e&&`border-right: 1px solid ${t.colors.inputBorder};`}
308
309 .bkt-booking-service-item {
310 font-weight: 500;
311 }
312 `,s=(0,r.A)(n.Text)`
313 font-size: 14px;
314 font-weight: 500;
315 `,l=(0,r.A)(n.Text)`
316 font-size: 12px;
317 `,o=((0,r.A)(n.Text)`
318 font-size: 14px;
319 font-weight: 500;
320 `,(0,r.A)(s)`
321 &::before {
322 content: "•";
323 margin-right: 8px;
324 }
325 `),c=(0,r.A)(n.Divider)`
326 && {
327 margin: 16px 0;
328 }
329 `,d=(0,r.A)(n.Flex)`
330 font-weight: bold;
331 font-size: 16px;
332 color: #000;
333 `},99472:(e,t,a)=>{"use strict";a.r(t),a.d(t,{default:()=>M});var r=a(51609),n=a(47143),i=a(86087),s=a(60532),l=a(22564),o=a(4623),c=a(47767),d=a(11534);var m=a(59e3);const p=(0,m.A)(l.Card)`
334 max-width: 580px;
335 width: 100%;
336 height: 100%;
337 font-size: 16px;
338 min-height: 500px;
339
340 .bkt-order-no {
341 font-size: 18px;
342 font-weight: 500;
343 }
344
345 .bkt-customer-email {
346 font-weight: 500;
347 }
348 `,u=(0,m.A)(l.Flex)`
349 font-size: 16px;
350
351 .bkt-reschedule,
352 .bkt-cancel {
353 font-weight: 500;
354 }
355
356 .bkt-reschedule {
357 color: #009959;
358 }
359
360 .bkt-cancel {
361 color: #ed695e;
362 }
363 `,h=(0,m.A)(l.Modal)`
364 &.ant-modal {
365 width: 90% !important;
366 max-width: 600px;
367 }
368 `;var g=a(87927);const{__}=wp?.i18n||{},x=({extraServices:e,settings:t,attendeeCount:a})=>(0,r.createElement)(l.Flex,{vertical:!0},(0,r.createElement)(g.D7,{text:__("Extra Service","booktics")}),e?.map(e=>(0,r.createElement)(l.Flex,{key:e?.id,gap:"small",justify:"space-between"},(0,r.createElement)(l.Flex,{gap:"small",wrap:!0},(0,r.createElement)(g.fq,{text:e?.title}),(a>1||e?.quantity>1)&&(0,r.createElement)(l.Space,{size:2},"(",a>1?`${a} x`:null,e?.quantity>1?`${e?.quantity} x`:null,(0,r.createElement)(l.Pricing,{settings:t,price:e?.charge_amount}),")")),(0,r.createElement)(l.Text,{text:(0,r.createElement)(l.Pricing,{settings:t,price:Number(e?.price)*e?.quantity*a})}))),(0,r.createElement)(g.TQ,null)),{__:f}=wp?.i18n||{},b=({data:e,settings:t})=>{const{attendee_count:a,charge_per_attendee:n}=e?.group_booking||{},i=n?1:a||1;return(0,r.createElement)(l.Flex,{vertical:!0,key:e.id},(0,r.createElement)(l.Flex,{vertical:!0},(0,r.createElement)(g.D7,{text:f("Service","booktics")}),(0,r.createElement)(l.Flex,{gap:"small",justify:"space-between"},(0,r.createElement)(l.Flex,{gap:"small",wrap:!0},(0,r.createElement)(g.fq,{text:e?.service?.title}),i>1&&(0,r.createElement)(Space,{size:2},"(",i," x",(0,r.createElement)(l.Pricing,{settings:t,price:e.price}),")")),(0,r.createElement)(l.Text,{text:(0,r.createElement)(l.Pricing,{settings:t,price:Number(e.price||0)*i})})),(0,r.createElement)(g.TQ,null)),e?.extra_services?.length&&(0,r.createElement)(x,{extraServices:e?.extra_services,settings:t,attendeeCount:i}))},{__:j}=wp?.i18n||{},k=({invoiceData:e})=>{const{settings:t}=(0,n.useSelect)(e=>e(s.H).getFrontendState(),[]);return(0,r.createElement)(l.Flex,{vertical:!0,gap:"small"},(0,r.createElement)(l.Text,{className:"bkt-semi-bold-text",text:j("Cost Breakdown","booktics")}),(0,r.createElement)(g.TQ,null),e?.items?.map(e=>(0,r.createElement)(b,{key:e.id,data:e,settings:t})),(0,r.createElement)(l.Flex,{className:"bkt-semi-bold-text",justify:"space-between",gap:"small"},(0,r.createElement)(l.Text,{text:j("Total","booktics")}),(0,r.createElement)(l.Pricing,{settings:t,price:e?.total})))},v=({invoiceData:e})=>{const{settings:t}=(0,n.useSelect)(e=>e(s.H).getFrontendState(),[]);return(0,r.createElement)(l.Flex,{vertical:!0,gap:"small"},e?.items?.map(e=>(0,r.createElement)(l.SingleBookingBox,{key:e?.id,settings:t,bookingItem:e})))},{__:w}=wp?.i18n||{},E=({invoiceData:e})=>(0,r.createElement)(l.Flex,{vertical:!0,gap:"small"},(0,r.createElement)(l.Title,{level:3,text:w("Your booking confirmed","booktics")}),(0,r.createElement)(l.Text,{className:"bkt-order-no",text:e?.order_no}),(0,r.createElement)(l.Space,{size:4},(0,r.createElement)(l.Text,{text:w("An email confirmation was sent to","booktics")}),(0,r.createElement)(l.Text,{className:"bkt-customer-email",text:e?.customer?.email})),(0,r.createElement)(g.TQ,null));var y=a(44512),_=a(95358);const{__:S}=wp?.i18n||{},D=({cancellation_restriction:e,date:t,start_time:a})=>{const n=(0,_.isRestrictedToUpdateBooking)({date:t,start_time:a,settings:e}),{cancel:i}=(0,y.A)();return(0,r.createElement)(l.Button,{disabled:n,type:"text",className:"bkt-cancel",text:S("Cancel","booktics"),size:"small",onClick:i})};var F=a(46079),T=a(57010);const A=()=>{const{invoiceData:e,selectedData:t,openRescheduleModal:a}=(0,n.useSelect)(e=>e(s.H).getFrontendState(),[]),{setFrontendState:l}=(0,n.useDispatch)(s.H),{getTimeSlot:o}=(0,T.A)();return(0,i.useEffect)(()=>{const a=e?.items?.[0]||{};t||l({selectedData:e?.items});const{service:r,team:n}=a;o({service_id:r?.id,team_member_id:n?.id,additional_duration_id:r?.additional_duration?.id})},[]),(0,r.createElement)(h,{onCancel:()=>l({openRescheduleModal:!1}),open:a,centered:!0,footer:null,maskClosable:!1,destroyOnHidden:!0,className:"bkt-booking-modal"},(0,r.createElement)(F.A,null))},{__:$}=wp?.i18n||{},C=({reschedule_restriction:e,date:t,start_time:a})=>{const{setFrontendState:i}=(0,n.useDispatch)(s.H),o=(0,_.isRestrictedToUpdateBooking)({date:t,start_time:a,settings:e});return(0,r.createElement)(r.Fragment,null,(0,r.createElement)(l.Button,{disabled:o,type:"text",className:"bkt-reschedule",text:$("Reschedule","booktics"),size:"small",onClick:()=>i({openRescheduleModal:!0})}),(0,r.createElement)(A,null))},{__:z}=wp?.i18n||{},H=()=>{const{settings:e,invoiceData:t}=(0,n.useSelect)(e=>e(s.H).getFrontendState(),[]),{allow_customer_cancellation:a,allow_customer_rescheduling:i,reschedule_restriction:o,cancellation_restriction:c}=e;if(!i&&!a)return;const{date:d,start_time:m}=t?.items?.[0]||{};return(0,r.createElement)("div",null,(0,r.createElement)(g.TQ,null),(0,r.createElement)(u,{gap:"small",wrap:!0,align:"center"},(0,r.createElement)(l.Text,{text:z("Need to make a change?","booktics")}),(0,r.createElement)(l.Space,{size:4},(0,r.createElement)(C,{reschedule_restriction:o,date:d,start_time:m}),i&&a?(0,r.createElement)(l.Text,{text:z("or","booktics")}):null,(0,r.createElement)(D,{cancellation_restriction:c,date:d,start_time:m}))))},M=()=>{const{invoiceData:e}=(0,n.useSelect)(e=>e(s.H).getFrontendState(),[]),{getInvoice:t}=function(){const{invoiceId:e}=(0,n.useSelect)(e=>e(s.H).getFrontendState(),[]),{setFrontendState:t}=(0,n.useDispatch)(s.H),{id:a}=(0,c.g)();return{getInvoice:async()=>{try{const r=await(d.A?.orders?.singleOrder(a||e));r?.success&&t({invoiceData:r?.data})}catch(e){console.error("Error fetching services:",e)}}}}();return(0,i.useEffect)(()=>{t()},[]),(0,r.createElement)(o.mc,{vertical:!0,gap:24},(0,r.createElement)(l.Flex,{justify:"center"},(0,r.createElement)(p,null,(0,r.createElement)(l.RowSkeleton,{loading:!e},(0,r.createElement)(l.Flex,{vertical:!0,gap:"middle"},(0,r.createElement)(E,{invoiceData:e}),(0,r.createElement)(v,{invoiceData:e}),(0,r.createElement)(k,{invoiceData:e}),(0,r.createElement)(H,null))))))}}}]);