@duffel/components 1.3.1 → 2.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +0 -0
- package/dist/CardPayment.esm.js +2 -0
- package/dist/CardPayment.esm.js.LICENSE.txt +6 -0
- package/dist/CardPayment.js +2 -0
- package/dist/CardPayment.js.LICENSE.txt +6 -0
- package/dist/CardPayment.min.css +233 -0
- package/dist/CardPayment.umd.min.js +2 -0
- package/dist/CardPayment.umd.min.js.LICENSE.txt +63 -0
- package/dist/SeatSelection.esm.js +1 -0
- package/dist/SeatSelection.js +1 -0
- package/dist/SeatSelection.min.css +1043 -0
- package/dist/SeatSelection.umd.min.js +2 -0
- package/dist/SeatSelection.umd.min.js.LICENSE.txt +54 -0
- package/dist/duffel-components.d.ts +1 -8
- package/dist/duffel-components.esm.js +1 -1
- package/dist/duffel-components.js +1 -1
- package/dist/duffel-components.min.css +1089 -0
- package/dist/duffel-components.umd.min.js +1 -1
- package/package.json +60 -30
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/*
|
|
2
|
+
object-assign
|
|
3
|
+
(c) Sindre Sorhus
|
|
4
|
+
@license MIT
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
/*!
|
|
8
|
+
Copyright (c) 2018 Jed Watson.
|
|
9
|
+
Licensed under the MIT License (MIT), see
|
|
10
|
+
http://jedwatson.github.io/classnames
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
/*!
|
|
14
|
+
* The buffer module from node.js, for the browser.
|
|
15
|
+
*
|
|
16
|
+
* @author Feross Aboukhadijeh <feross@feross.org> <http://feross.org>
|
|
17
|
+
* @license MIT
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
/*!
|
|
21
|
+
* The buffer module from node.js, for the browser.
|
|
22
|
+
*
|
|
23
|
+
* @author Feross Aboukhadijeh <https://feross.org>
|
|
24
|
+
* @license MIT
|
|
25
|
+
*/
|
|
26
|
+
|
|
27
|
+
/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */
|
|
28
|
+
|
|
29
|
+
/** @license React v0.20.2
|
|
30
|
+
* scheduler.production.min.js
|
|
31
|
+
*
|
|
32
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
33
|
+
*
|
|
34
|
+
* This source code is licensed under the MIT license found in the
|
|
35
|
+
* LICENSE file in the root directory of this source tree.
|
|
36
|
+
*/
|
|
37
|
+
|
|
38
|
+
/** @license React v17.0.2
|
|
39
|
+
* react-dom.production.min.js
|
|
40
|
+
*
|
|
41
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
42
|
+
*
|
|
43
|
+
* This source code is licensed under the MIT license found in the
|
|
44
|
+
* LICENSE file in the root directory of this source tree.
|
|
45
|
+
*/
|
|
46
|
+
|
|
47
|
+
/** @license React v17.0.2
|
|
48
|
+
* react-jsx-runtime.production.min.js
|
|
49
|
+
*
|
|
50
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
51
|
+
*
|
|
52
|
+
* This source code is licensed under the MIT license found in the
|
|
53
|
+
* LICENSE file in the root directory of this source tree.
|
|
54
|
+
*/
|
|
55
|
+
|
|
56
|
+
/** @license React v17.0.2
|
|
57
|
+
* react.production.min.js
|
|
58
|
+
*
|
|
59
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
60
|
+
*
|
|
61
|
+
* This source code is licensed under the MIT license found in the
|
|
62
|
+
* LICENSE file in the root directory of this source tree.
|
|
63
|
+
*/
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var e={311:(e,s,t)=>{t.d(s,{z:()=>l,X:()=>c});var n=t(997),a=t(689),i=t(3),r=t.n(i),o=t(639);const l=a.forwardRef(((e,s)=>{let{className:t,disabled:a=!1,iconAfter:i,iconBefore:l,iconOnly:c,intent:d="PRIMARY",text:u,type:m="button",id:p,...v}=e;const g=r()("duffel-button","duffel-button--solid",t,{"duffel-button--primary":"PRIMARY"===d,"duffel-button--muted":"MUTED"===d,"duffel-button--icon-only":c,"duffel-button--is-disabled":a});return(0,n.jsxs)("button",{ref:s,type:m,className:g,disabled:a,"aria-label":u,"data-testid":p,id:p,...v,children:[l&&(0,n.jsx)(o.J,{className:"duffel-button__icon duffel-button__icon--before",name:l},void 0),c&&(0,n.jsx)(o.J,{className:"duffel-button__icon",name:c},void 0),!c&&(0,n.jsx)("span",{className:"duffel-button__text",children:u},void 0),i&&(0,n.jsx)(o.J,{className:"duffel-button__icon duffel-button__icon--after",name:i},void 0)]},void 0)})),c=e=>{let{className:s,children:t,...a}=e;const i=r()("chromeless-button",s);return(0,n.jsx)("button",{className:i,...a,children:t},void 0)}},639:(e,s,t)=>{t.d(s,{J:()=>c});var n=t(997),a=t(3),i=t.n(a),r=(t(689),t(108));const o={arrow_forward:(0,n.jsx)("path",{d:"M5 13h11.17l-4.88 4.88c-.39.39-.39 1.03 0 1.42.39.39 1.02.39 1.41 0l6.59-6.59c.39-.39.39-1.02 0-1.41l-6.58-6.6c-.39-.39-1.02-.39-1.41 0-.39.39-.39 1.02 0 1.41L16.17 11H5c-.55 0-1 .45-1 1s.45 1 1 1z"},void 0),bassinet:(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("path",{d:"M19 12C19 14.1217 18.1571 16.1566 16.6569 17.6569C15.1566 19.1571 13.1217 20 11 20C8.87827 20 6.84344 19.1571 5.34315 17.6569C3.84286 16.1566 3 14.1217 3 12L11 12H19Z"},void 0),(0,n.jsx)("path",{d:"M16.1347 5.86529L11 11V4C12.0506 4 13.0909 4.20693 14.0615 4.60896C14.8136 4.92052 15.5125 5.34451 16.1347 5.86529ZM16.8602 6.55405L12.4142 11H18.9373C18.8482 10.293 18.6649 9.59962 18.391 8.93853C18.0264 8.05823 17.5077 7.25087 16.8602 6.55405Z"},void 0)]},void 0),chevron:(0,n.jsx)("path",{d:"M5 13H16.17L11.29 17.88C10.9 18.27 10.9 18.91 11.29 19.3C11.68 19.69 12.31 19.69 12.7 19.3L19.29 12.71C19.68 12.32 19.68 11.69 19.29 11.3L12.71 4.7C12.32 4.31 11.69 4.31 11.3 4.7C10.91 5.09 10.91 5.72 11.3 6.11L16.17 11H5C4.45 11 4 11.45 4 12C4 12.55 4.45 13 5 13Z"},void 0),close:(0,n.jsx)("path",{d:"M18.3 5.71c-.39-.39-1.02-.39-1.41 0L12 10.59 7.11 5.7c-.39-.39-1.02-.39-1.41 0-.39.39-.39 1.02 0 1.41L10.59 12 5.7 16.89c-.39.39-.39 1.02 0 1.41.39.39 1.02.39 1.41 0L12 13.41l4.89 4.89c.39.39 1.02.39 1.41 0 .39-.39.39-1.02 0-1.41L13.41 12l4.89-4.89c.38-.38.38-1.02 0-1.4z"},void 0),closet:(0,n.jsx)("path",{d:"M12 4C11.0717 4 10.1815 4.36875 9.52513 5.02513C8.86875 5.6815 8.5 6.57174 8.5 7.5H10.5C10.5 7.10218 10.658 6.72064 10.9393 6.43934C11.2206 6.15804 11.6022 6 12 6C12.3978 6 12.7794 6.15804 13.0607 6.43934C13.342 6.72064 13.5 7.10218 13.5 7.5C13.5 7.89782 13.342 8.27936 13.0607 8.56066C12.7794 8.84196 12.3978 9 12 9C11.45 9 11 9.45 11 10V11.75L2.4 18.2C2.23209 18.3259 2.10807 18.5015 2.04549 18.7018C1.98291 18.9022 1.98495 19.1171 2.05132 19.3162C2.11769 19.5153 2.24502 19.6885 2.41529 19.8112C2.58556 19.934 2.79012 20 3 20H21C21.2099 20 21.4144 19.934 21.5847 19.8112C21.755 19.6885 21.8823 19.5153 21.9487 19.3162C22.0151 19.1171 22.0171 18.9022 21.9545 18.7018C21.8919 18.5015 21.7679 18.3259 21.6 18.2L13 11.75V10.85C13.7216 10.6349 14.3546 10.1927 14.805 9.58919C15.2554 8.98569 15.4991 8.25303 15.5 7.5C15.5 6.57174 15.1313 5.6815 14.4749 5.02513C13.8185 4.36875 12.9283 4 12 4ZM12 13.5L18 18H6L12 13.5Z"},void 0),exit_row:(0,n.jsx)("path",{d:"M20 11H6.83001L9.71001 8.12001C10.1 7.73001 10.1 7.10001 9.71001 6.71001C9.32001 6.32001 8.69001 6.32001 8.30001 6.71001L3.71001 11.3C3.32001 11.69 3.32001 12.32 3.71001 12.71L8.30001 17.3C8.69001 17.69 9.32001 17.69 9.71001 17.3C10.1 16.91 10.1 16.28 9.71001 15.89L6.83001 13H20C20.55 13 21 12.55 21 12C21 11.45 20.55 11 20 11Z"},void 0),exit_row_right:(0,n.jsx)("path",{d:"M4 11H17.17L14.29 8.12001C13.9 7.73001 13.9 7.10001 14.29 6.71001C14.68 6.32001 15.31 6.32001 15.7 6.71001L20.29 11.3C20.68 11.69 20.68 12.32 20.29 12.71L15.7 17.3C15.31 17.69 14.68 17.69 14.29 17.3C13.9 16.91 13.9 16.28 14.29 15.89L17.17 13H4C3.45 13 3 12.55 3 12C3 11.45 3.45 11 4 11Z"},void 0),galley:(0,n.jsx)("path",{d:"M20 3H4v10c0 2.21 1.79 4 4 4h6c2.21 0 4-1.79 4-4v-3h2c1.11 0 2-.9 2-2V5c0-1.11-.89-2-2-2zm0 5h-2V5h2v3zM4 19h16v2H4z"},void 0),lavatory:(0,n.jsx)("path",{d:"M5.5 22v-7.5H4V9c0-1.1.9-2 2-2h3c1.1 0 2 .9 2 2v5.5H9.5V22h-4zM18 22v-6h3l-2.54-7.63C18.18 7.55 17.42 7 16.56 7h-.12c-.86 0-1.63.55-1.9 1.37L12 16h3v6h3zM7.5 6c1.11 0 2-.89 2-2s-.89-2-2-2-2 .89-2 2 .89 2 2 2zm9 0c1.11 0 2-.89 2-2s-.89-2-2-2-2 .89-2 2 .89 2 2 2z"},void 0),lie_flat_seat:(0,n.jsx)("path",{d:"M6.16667 12.8333C6.81667 12.8333 7.45834 12.5833 7.95001 12.0833C8.91667 11.0916 8.90001 9.51659 7.91667 8.54992C7.42501 8.07492 6.79167 7.83325 6.16667 7.83325C5.51667 7.83325 4.87501 8.08325 4.38334 8.58325C3.41667 9.57492 3.43334 11.1499 4.41667 12.1166C4.90834 12.5916 5.54167 12.8333 6.16667 12.8333ZM5.57501 9.74992C5.73334 9.59159 5.94167 9.49992 6.16667 9.49992C6.38334 9.49992 6.59167 9.58325 6.75001 9.73325C7.08334 10.0583 7.08334 10.5749 6.76667 10.9083C6.60001 11.0749 6.39167 11.1666 6.16667 11.1666C5.95001 11.1666 5.74167 11.0833 5.58334 10.9333C5.25001 10.5999 5.25001 10.0833 5.57501 9.74992ZM17 7.83325H9.50001V12.8333H20.3333V11.1666C20.3333 9.32492 18.8417 7.83325 17 7.83325ZM11.1667 11.1666V9.49992H17C17.9167 9.49992 18.6667 10.2499 18.6667 11.1666H11.1667ZM3.66667 15.3333H8.66667V16.9999H15.3333V15.3333H20.3333V13.6666H3.66667V15.3333Z"},void 0),no_airplane:(0,n.jsx)("path",{d:"M14.6674 10.0001V2.66675C14.6674 1.56008 13.7741 0.666748 12.6674 0.666748C11.5607 0.666748 10.6674 1.56008 10.6674 2.66675V7.57341L21.1074 18.0134L25.3341 19.3334V16.6667L14.6674 10.0001ZM1.33407 5.02675L7.9874 11.6801L0.000732422 16.6667V19.3334L10.6674 16.0001V23.3334L8.00073 25.3334V27.3334L12.6674 26.0001L17.3341 27.3334V25.3334L14.6674 23.3334V18.3601L22.3074 26.0001L24.0007 24.3067L3.0274 3.33341L1.33407 5.02675Z"},void 0),no_seat:(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("path",{d:"M25.1667 21.9733L23.4733 23.6667L2.5 2.69333L4.19333 1L7.16667 3.97333L16.5267 13.3333L19.1933 16L24.5 21.3067L25.1667 21.9733Z"},void 0),(0,n.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M7.16667 24H3.16667V16H19.1933L24.5 21.3067V24H20.5V20H7.16667V24ZM27.1667 9.33333H23.1667V13.3333H27.1667V9.33333ZM4.5 9.33333H0.5V13.3333H4.5V9.33333ZM20.3333 13.3333H20.5V2.66667C20.5 1.2 19.3 0 17.8333 0H9.83333C9.05784 0 8.3569 0.335483 7.86848 0.868484L20.3333 13.3333ZM16.5267 13.3333L7.16667 3.97333V13.3333H16.5267Z"},void 0)]},void 0),seat:(0,n.jsx)("path",{d:"M7.59 5.41012C6.81 4.63012 6.81 3.36012 7.59 2.58012C8.37 1.80012 9.64 1.80012 10.42 2.58012C11.2 3.36012 11.2 4.63012 10.42 5.41012C9.63 6.20012 8.37 6.20012 7.59 5.41012ZM6 16.0001V8.00012C6 7.45012 5.55 7.00012 5 7.00012C4.45 7.00012 4 7.45012 4 8.00012V16.0001C4 18.7601 6.24 21.0001 9 21.0001H14C14.55 21.0001 15 20.5501 15 20.0001C15 19.4501 14.55 19.0001 14 19.0001H9C7.34 19.0001 6 17.6601 6 16.0001ZM19.28 19.3501L15.51 15.5801C15.14 15.2101 14.63 15.0001 14.1 15.0001H11.5V11.3201C12.59 12.2101 14.16 13.0201 15.7 13.3401C16.37 13.4801 17 12.9801 17 12.3001C17 11.7701 16.61 11.3401 16.08 11.2501C14.66 11.0101 13.2 10.2401 12.33 9.28012L10.93 7.73012C10.74 7.52012 10.5 7.35012 10.24 7.23012C9.95 7.09012 9.62 7.00012 9.28 7.00012H9.25C8.01 7.00012 7 8.01012 7 9.25012V15.0001C7 16.6601 8.34 18.0001 10 18.0001H15.07L17.85 20.7801C18.24 21.1701 18.89 21.1701 19.28 20.7801C19.68 20.3901 19.68 19.7501 19.28 19.3501Z"},void 0),seat_paid_indicator:(0,n.jsx)("path",{d:"M11.7686 0.731368C12.7766 -0.276576 14.5 0.437294 14.5 1.86274V10.8C14.5 12.5673 13.0673 14 11.3 14H2.36274C0.937294 14 0.223427 12.2766 1.23137 11.2686L11.7686 0.731368Z"},void 0),stairs:(0,n.jsx)("path",{d:"M19,3H5C3.9,3,3,3.9,3,5v14c0,1.1,0.9,2,2,2h14c1.1,0,2-0.9,2-2V5C21,3.9,20.1,3,19,3z M18,8h-2.42v3.33H13v3.33h-2.58 V18H6v-2h2.42v-3.33H11V9.33h2.58V6H18V8z"},void 0),wifi:(0,n.jsx)("path",{d:"M2.83333 9.50005L4.49999 11.1667C8.64166 7.02505 15.3583 7.02505 19.5 11.1667L21.1667 9.50005C16.1083 4.44172 7.89999 4.44172 2.83333 9.50005ZM9.49999 16.1667L12 18.6667L14.5 16.1667C13.125 14.7834 10.8833 14.7834 9.49999 16.1667ZM6.16666 12.8334L7.83333 14.5C10.1333 12.2 13.8667 12.2 16.1667 14.5L17.8333 12.8334C14.6167 9.61672 9.39166 9.61672 6.16666 12.8334Z"},void 0)},l=e=>e in o?o[e]:(r.warn("The icon ".concat(e)),null),c=e=>{let{name:s,size:t,className:a,viewBox:r}=e;return(0,n.jsx)("svg",{className:i()("ff-icon",a),width:t||24,height:t||24,viewBox:r||"0 0 24 24","aria-label":s,"data-testid":s,children:l(s)},void 0)}},108:(e,s,t)=>{var n=t(464),a=t(84);function i(){return(new Date).getTime()}var r,o=Array.prototype.slice,l={};r=void 0!==t.g&&t.g.console?t.g.console:"undefined"!=typeof window&&window.console?window.console:{};for(var c=[[function(){},"log"],[function(){r.log.apply(r,arguments)},"info"],[function(){r.log.apply(r,arguments)},"warn"],[function(){r.warn.apply(r,arguments)},"error"],[function(e){l[e]=i()},"time"],[function(e){var s=l[e];if(!s)throw new Error("No such label: "+e);delete l[e];var t=i()-s;r.log(e+": "+t+"ms")},"timeEnd"],[function(){var e=new Error;e.name="Trace",e.message=n.format.apply(null,arguments),r.error(e.stack)},"trace"],[function(e){r.log(n.inspect(e)+"\n")},"dir"],[function(e){if(!e){var s=o.call(arguments,1);a.ok(!1,n.format.apply(null,s))}},"assert"]],d=0;d<c.length;d++){var u=c[d],m=u[0],p=u[1];r[p]||(r[p]=m)}e.exports=r},84:e=>{e.exports=require("assert")},3:e=>{e.exports=require("classnames")},689:e=>{e.exports=require("react")},997:e=>{e.exports=require("react/jsx-runtime")},464:e=>{e.exports=require("util")}},s={};function t(n){var a=s[n];if(void 0!==a)return a.exports;var i=s[n]={exports:{}};return e[n](i,i.exports,t),i.exports}t.n=e=>{var s=e&&e.__esModule?()=>e.default:()=>e;return t.d(s,{a:s}),s},t.d=(e,s)=>{for(var n in s)t.o(s,n)&&!t.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:s[n]})},t.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),t.o=(e,s)=>Object.prototype.hasOwnProperty.call(e,s);var n={};(()=>{t.d(n,{w:()=>G,$:()=>K});var e=t(997),s=t(689),a=t.n(s);const i=require("react-dom");var r=t.n(i);const o=require("prop-types");var l=t.n(o);const c=require("smoothscroll-polyfill");var d=t.n(c),u=t(311),m=t(639);const p=require("react-popper"),v=()=>{const[e,s]=a().useState(null);return a().useEffect((()=>{null===e&&s(window.innerWidth);const t=()=>s(window.innerWidth);return t(),window.addEventListener("resize",t),()=>window.removeEventListener("resize",t)}),[]),null!=e?e:0};const g=e=>{let{id:t,children:n}=e;const a=function(e){const t=s.useRef(null);return s.useEffect((function(){const s=document.querySelector("#".concat(e)),n=s||function(e){const s=document.createElement("div");return s.setAttribute("id",e),s}(e);if(s||function(e){if(!document.body.lastElementChild)throw Error("document body not rendered");document.body.insertBefore(e,document.body.lastElementChild.nextElementSibling)}(n),!t.current)throw Error("elementRef not assigned");return n.appendChild(t.current),function(){if(!t.current)throw Error("elementRef not assigned");t.current.remove(),n.childElementCount||n.remove()}}),[e]),t.current||(t.current=document.createElement("div")),t.current}(t);return(0,i.createPortal)(n,a)},h=s.forwardRef(((s,t)=>{let{children:n,style:a,id:i="seat-selection__popover",...r}=s;return(0,e.jsx)(g,{id:i,children:(0,e.jsx)("div",{className:"duffel-components",children:(0,e.jsx)("div",{className:"popover-container",id:i,"data-testid":i,style:a,ref:t,...r,children:n},void 0)},void 0)},void 0)}));var _=t(3),f=t.n(_);function x(s){let{value:t,onChange:n,options:a}=s;return(0,e.jsx)("div",{className:"seat-map__tab-select",children:a.map((s=>(0,e.jsx)(u.X,{type:"button",className:f()("seat-map__tab-select-option",{"seat-map__tab-select-option--selected":s===t}),onClick:()=>t!==s&&n(s),children:s},s)))},void 0)}const j={error_loading:{title:"Error loading seat maps",message:"We weren’t able to load your seat maps.",iconName:"no_airplane"},error_unavailable:{title:"Seat selection unavailable",message:"Unfortunately seat selection is not available for this flight. A seat will be allocated by the airline.",iconName:"no_seat"}},C=s=>{let{errorType:t}=s;return(0,e.jsxs)("div",{className:"error-state__container","data-testid":t,children:[(0,e.jsx)("i",{className:"error-state__icon",children:(0,e.jsx)(m.J,{name:j[t].iconName},void 0)},void 0),(0,e.jsx)("h3",{className:"error-state__title",children:j[t].title},void 0),(0,e.jsx)("p",{className:"error-state__copy",children:j[t].message},void 0)]},void 0)};var y=t(108);class b extends s.Component{constructor(e){super(e),this.state={hasError:!1}}static getDerivedStateFromError(){return{hasError:!0}}componentDidCatch(e){y.error(e)}render(){return this.state.hasError?(0,e.jsx)("div",{className:"duffel-components",children:(0,e.jsx)(C,{errorType:"error_loading"},void 0)},void 0):this.props.children}}const N=require("lodash/cloneDeep");var w=t.n(N);const S=e=>e<768,L=function(e){let s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"en-GB",t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const n=new Intl.NumberFormat(s,{style:"currency",currency:e,...t});return e=>{const s=n.format(e);return t&&t.signDisplay&&("always"===t.signDisplay||"exceptZero"===t.signDisplay&&0!==e)?s.replace(/^([+-])/,"$1 "):s}},M=e=>e.reduce(((e,s)=>e+s),0),k=/P(?:([.,\d]+)D)?T(?:([.,\d]+)H)?(?:([.,\d]+)M)?/i,E=(e,s)=>(e.indexOf(s)+1)%e.length,H=t=>{let{origin:n,destination:a,duration:i,done:r}=t;const[o,l]=s.useState(!1),c=s.useRef(null);return s.useEffect((()=>{o&&r&&r()})),o?null:(0,e.jsxs)("div",{className:"loading-state__container",children:[(0,e.jsx)("span",{className:"loading-state__message",children:"Loading seat map"},void 0),(0,e.jsx)("div",{className:"loading-state__progress-indicator",children:(0,e.jsx)("span",{className:"loading-state__progress-indicator--status",ref:c,onAnimationEnd:()=>l(!0),"data-testid":"loading-state__progress-indicator--status"},void 0)},void 0),(0,e.jsxs)("div",{className:"loading-state__segment",children:[(0,e.jsx)("span",{className:"loading-state__segment--origin",children:n},void 0),(0,e.jsx)(m.J,{name:"arrow_forward",size:20},void 0),(0,e.jsx)("span",{className:"loading-state__segment--destination",children:a},void 0)]},void 0),(0,e.jsx)("span",{className:"loading-state__duration",children:i},void 0)]},void 0)},R=()=>({}),q=(0,s.createContext)({offer:{},seatMaps:[],passengers:[],segments:[],segmentId:"",passengerId:"",currentSelectedSegment:{},currentSelectedPassenger:{},seatSelection:{},size:"default",currentSeat:{},setCurrentSeat:R,onSelectSeat:R,onSelectPassenger:R,setIsLoading:R,extendedSeatInfo:[],setExtendedSeatInfo:R,currency:""}),V=()=>(0,s.useContext)(q),B=s=>{let{segment:t,passenger:n,passengerIndex:a}=s;const{seatSelection:i,segmentId:r,passengerId:o,onSelectPassenger:l,currentSelectedSegment:c,setIsLoading:d}=V(),u=i[t.id]&&i[t.id][n.id];return(0,e.jsxs)("button",{"data-testid":"passenger-".concat(n.id),type:"button",onClick:()=>{c.id!==t.id&&d(!0),l(n.id,t.id)},className:f()("passenger-selection-passenger",{"passenger-selection-passenger--selected":r===t.id&&o===n.id}),children:[(0,e.jsx)("span",{className:"passenger-selection-passenger__identifier",children:n.name||"Passenger ".concat(a+1)},void 0),u&&u.service?(0,e.jsxs)("span",{className:"passenger-selection-passenger__action",children:[(0,e.jsx)("span",{className:"passenger-selection-passenger__seat-designator",children:u.designator},void 0),(0,e.jsx)("span",{className:"passenger-selection-passenger__seat-price",children:L(u.service.total_currency)(+u.service.total_amount)},void 0)]},void 0):(0,e.jsx)("span",{className:"passenger-selection-passenger__action",children:"Unselected"},void 0)]},n.id)},I=s=>{let{segment:t,className:n}=s;return(0,e.jsxs)("h3",{className:f()(n,"passenger-segment__title"),children:[t.origin.iata_code,(0,e.jsx)(m.J,{name:"chevron",className:"passenger-segment__chevron",size:20},void 0),t.destination.iata_code]},void 0)},O=s=>{let{segment:t}=s;const{passengers:n}=V();return(0,e.jsxs)("li",{className:"passenger-selection-segment",children:[Object.keys(t).length>0&&(0,e.jsx)(I,{segment:t},void 0),n.map(((s,n)=>(0,e.jsx)(B,{segment:t,passenger:s,passengerIndex:n},s.id)))]},t.id)},z=()=>{const{segments:s}=V();return(0,e.jsx)("div",{className:"passenger-selection",children:(0,e.jsx)("ul",{className:"passenger-selection__segments",children:s.map((s=>(0,e.jsx)(O,{segment:s},s.id)))},void 0)},void 0)},Z=s=>{let{value:t,setValue:n}=s;const a=["Lower deck","Upper deck"];return(0,e.jsx)(x,{options:a,value:a[t],onChange:e=>n(a.indexOf(e))},void 0)},A=s=>{let{symbols:t}=s;return(0,e.jsxs)("div",{className:"seat-map__legend",children:[(0,e.jsxs)("span",{className:"seat-map__legend-item",children:[(0,e.jsx)("span",{className:"seat-map__legend-seat seat-map__legend-seat--fee-payable","aria-label":"Additional cost for seat",children:(0,e.jsx)(m.J,{name:"seat_paid_indicator",className:"seat-map__legend-seat--fee-payable-indicator",size:12},void 0)},void 0),"Additional Cost"]},void 0),(0,e.jsxs)("span",{className:"seat-map__legend-item",children:[(0,e.jsx)("span",{className:"seat-map__legend-seat seat-map__legend-seat--included","aria-label":"Included seat"},void 0),"Included"]},void 0),(0,e.jsxs)("span",{className:"seat-map__legend-item",children:[(0,e.jsx)("span",{className:"seat-map__legend-seat seat-map__legend-seat--selected","aria-label":"Selected seat"},void 0),"Selected"]},void 0),(0,e.jsxs)("span",{className:"seat-map__legend-item",children:[(0,e.jsx)("span",{className:"seat-map__legend-seat","aria-label":"Unavailable seat",children:(0,e.jsx)(m.J,{name:"close",size:14},void 0)},void 0),"Unavailable"]},void 0),[...t].map((s=>(0,e.jsxs)("span",{className:"seat-map__legend-item seat-map__legend-item--symbol",children:[(0,e.jsx)(m.J,{name:s,size:20},void 0),s.split("_")[0]]},s)))]},void 0)},P=["bassinet","exit_row"],F=s=>{let{type:t}=s;const n=v();return(0,e.jsx)("div",{className:f()("map-element map-element--amenity",{"map-element--wrapped":!P.includes(t)}),"aria-label":t.toString(),children:(0,e.jsx)(m.J,{name:t,size:S(n)?16:24},void 0)},void 0)},J=s=>{let{seat:t,service:n}=s;const a=n?L(n.total_currency)(+n.total_amount):"";return(0,e.jsxs)("div",{className:"seat-info",children:[(0,e.jsxs)("div",{className:"seat-info__details",children:[(0,e.jsx)("strong",{children:null==t?void 0:t.designator},void 0),(0,e.jsxs)("span",{children:[(null==t?void 0:t.name)||"Seat"," "]},void 0),(0,e.jsx)("strong",{children:a},void 0)]},void 0),null==t?void 0:t.disclosures.map(((s,t)=>(0,e.jsx)("div",{className:"seat-info__disclosure",children:s},t)))]},void 0)},T=t=>{let{seat:n}=t;const i=v(),[r,o]=s.useState(!1),{popper:{styles:l,attributes:c},setReferenceElement:d,setPopperElement:u}=((e,s,t,n)=>{const{shouldInsideClickClose:i}=Object.assign({},{shouldInsideClickClose:!1},{shouldInsideClickClose:!1}),[r,o]=a().useState(null),[l,c]=a().useState(null),[d,u]=a().useState(null),m={placement:"auto",modifiers:[{name:"arrow",options:{element:d}}],placement:"top",modifiers:[{name:"offset",options:{offset:[0,8]}}]},v=(0,p.usePopper)(r,l,m),g=a().useCallback((e=>{const t=!!l&&l.contains(e.target);t||s(),i&&t&&setTimeout(s,10)}),[l,s,i]),h=a().useCallback((e=>{"Escape"===e.key&&s()}),[s]);return a().useEffect((()=>{if(null!==document)return e&&(document.body.addEventListener("click",g),document.body.addEventListener("keydown",h)),()=>{document.body.removeEventListener("click",g),document.body.removeEventListener("keydown",h)}}),[e,g,h]),{popper:v,setReferenceElement:o,setPopperElement:c,setArrowElement:u}})(r,(()=>o(!1))),{passengers:g,passengerId:_,segmentId:x,seatSelection:j,currentSeat:C,setCurrentSeat:y,onSelectSeat:b,extendedSeatInfo:N,setExtendedSeatInfo:w}=V(),{service:M,isAvailable:k,selectedBy:E}=((e,s,t)=>{var n,a;const i=null===(n=e.available_services)||void 0===n?void 0:n.find((e=>e.passenger_id===s)),r=null===(a=e.available_services)||void 0===a?void 0:a.find((e=>{var s,n;return!!t&&(null===(s=t[e.passenger_id])||void 0===s||null===(n=s.service)||void 0===n?void 0:n.id)===e.id}));return{service:i,isAvailable:i&&!r||!1,selectedBy:null==r?void 0:r.passenger_id}})(n,_,j[x]),H=s.useMemo((()=>((e,s)=>{if(!s)return!1;let t="";return e.forEach(((e,n)=>{if(e.name){const n=new RegExp(/(\p{L}{1})\p{L}+/,"gu"),r=[...e.name.matchAll(n)]||[];var a,i;if(e.id===s)return t=(((null===(a=r.shift())||void 0===a?void 0:a[1])||"")+((null===(i=r.pop())||void 0===i?void 0:i[1])||"")).toUpperCase()}if(e.id===s)return t="P".concat(n+1)})),t})(g,E)),[g,E]),R="".concat(M&&L(M.total_currency)(+M.total_amount)),q=(null==M?void 0:M.total_amount)&&0!==parseInt(null==M?void 0:M.total_amount),B=E&&E!==_,I=s.useMemo((()=>e=>{if(null!==e){const{segment:s,seat:{designator:t}}=e;N.map((e=>e)).find((e=>e.segment===s&&e.seat.designator===t))?w(N.splice(N.findIndex((e=>e.segment!==s&&e.seat.designator!==t)))):M&&w([...N,{...e,service:M}])}}),[N,M,w]);return(0,e.jsx)(e.Fragment,{children:E||k?(0,e.jsxs)("button",{id:n.designator,type:"button",className:f()("map-element","map-element__seat",{"map-element--available":k&&!E,"map-element--selected":E,"map-element--actionable":k||E==_}),onClick:e=>{M&&I({segment:x,seat:n,service:M}),S(i)&&(C.seat===n?y({seat:null,service:void 0}):y({seat:n,service:M})),M&&!B&&(b(E===_?null:{designator:n.designator,service:M}),e.target.blur())},onMouseEnter:()=>!S(i)&&o(!0),onMouseLeave:()=>!S(i)&&o(!1),ref:d,"aria-label":"".concat(n.designator," ").concat(n.name||"Seat"," ").concat(R),children:[q&&(0,e.jsx)(m.J,{name:"seat_paid_indicator",className:"map-element--fee-payable",size:S(i)?16:24},void 0),E?H:n.designator.charAt(n.designator.length-1),r&&!B&&M&&!S(i)&&(0,e.jsx)(h,{ref:u,style:{...l.popper},...c.popper,children:(0,e.jsx)(J,{seat:n,service:M},void 0)},void 0)]},void 0):(0,e.jsx)("span",{className:"map-element map-element__seat","aria-label":"".concat(n.designator," ").concat(n.name||"Seat"," Unavailable"),children:(0,e.jsx)(m.J,{name:"close",size:S(i)?14:16},void 0)},void 0)},void 0)},D=(s,t,n)=>(0,e.jsx)(e.Fragment,{children:"seat"===s.type?(0,e.jsx)(T,{seat:s},t):"empty"===s.type?(0,e.jsx)("div",{className:"map-element map-element--empty"},t):"exit_row"===s.type?(0,e.jsx)("div",{className:f()("map-element map-element--exit",{"map-element--exit--right":n>0}),children:0===n?(0,e.jsx)(m.J,{name:"exit_row"},void 0):(0,e.jsx)(m.J,{name:"exit_row_right"},void 0)},t):(0,e.jsx)(F,{type:s.type},t)},void 0),U=t=>{let{row:n,hasWings:a}=t;const i=(e=>{const s=Object.values(e.sections).map((e=>e.elements)).reduce(((e,s)=>e.concat(s)),[]).filter((e=>"seat"===e.type));return s.length>0?s[0].designator.substring(0,s[0].designator.length-1):null})(n);return(0,e.jsx)(e.Fragment,{children:Object.values(n.sections).map(((t,r)=>{const o=Object.keys(n.sections).length,l=1===o;return(0,e.jsxs)(s.Fragment,{children:[(0,e.jsx)("div",{className:f()("map-section",{"map-section--left":0===r,"map-section--right":!l&&r===o-1,"map-section--wing":a}),"data-testid":"row-section-".concat(r),children:t.elements.length>0?t.elements.map(((t,n)=>(0,e.jsx)(s.Fragment,{children:D(t,n,r)},n))):D({type:"empty"},-1,r)},void 0),(r<o-1||l&&r<o)&&(0,e.jsx)("span",{className:"map-section__aisle",children:i},void 0),l&&r===n.sections.length-1&&D({type:"empty"},-1,r)]},r)}))},void 0)},W=()=>{const{segmentId:t,offer:n,seatMaps:a}=V(),[i,r]=s.useState(0),{cabin:o,hasMultipleDecks:l,anyHasWings:c}=((e,s,t,n)=>{const a=t.find((e=>e.segment_id===s));if(null==a||!a.cabins||0===(null==a?void 0:a.cabins.length))return{cabin:null};const i=n.slices.length>0&&n.slices[0].segments.length>0&&n.slices[0].segments[0].passengers.length>0&&n.slices[0].segments[0].passengers[0].cabin_class,r=null==a?void 0:a.cabins.filter((e=>e.cabin_class===i));return{cabin:r.find((s=>s.deck===e))||r[0]||(null==a?void 0:a.cabins[0]),hasMultipleDecks:r.length>1,anyHasWings:r.some((e=>e.wings))}})(i,t,a,n);if(!o)return(0,e.jsx)(C,{errorType:"error_unavailable"},void 0);const d=(e=>{const s=new Set;for(const t of e.rows)for(const e of t.sections)for(const t of e.elements)"seat"!==t.type&&"empty"!==t.type&&s.add(t.type);return s})(o);return(0,e.jsxs)("div",{"data-testid":"seat-map",className:f()("seat-map",{"seat-map--wings":c}),children:[l&&(0,e.jsx)(Z,{value:i,setValue:e=>{r(e)}},void 0),(0,e.jsx)("div",{className:"seat-map__legend-container",children:(0,e.jsx)(A,{symbols:d},void 0)},void 0),(0,e.jsx)("div",{className:"seat-map__map-container",style:{"--CABIN-AISLES":o.aisles},children:o.rows.map(((s,t)=>(0,e.jsx)(U,{row:s,hasWings:!!o.wings&&o.wings.first_row_index<=t&&o.wings.last_row_index>=t},t)))},void 0)]},void 0)},$=s=>{let{primaryButtonCopy:t,onBackClick:n,disableBackButton:a,onClick:i,iconAfter:r}=s;const o="summary-button-".concat(t.replace(" ","-").toLowerCase());return(0,e.jsxs)("div",{className:"summary__actions",children:[(0,e.jsx)(u.z,{text:"Previous passenger",onClick:n,disabled:a,intent:"MUTED",iconOnly:"chevron","aria-label":"Previous passenger",className:"summary__actions--previous"},void 0),(0,e.jsx)(u.z,{"data-testid":o,text:t,className:"summary__confirmation-btn",onClick:i,...r},void 0)]},void 0)},X=t=>{let{onClick:n,primaryButtonCopy:a,iconAfter:i,onBackClick:r,disableBackButton:o}=t;const{seatSelection:l,segments:c,passengers:d,currentSelectedPassenger:u,currentSelectedSegment:m,offer:p,currency:v}=V(),g=(h=l,Object.values(h).map((e=>Object.values(e))).map((e=>e.map((e=>(null==e?void 0:e.service)||null)))).flat().filter((e=>null!==e)));var h;const _=s.useMemo((()=>M(g.map((e=>parseFloat(e.total_amount))))),[g]),f=s.useMemo((()=>M(c.map((e=>e.passengers.length)))),[c]),x=g&&g.length,j=x>0?L(g[0].total_currency)(_):p?L(v)(0):"0",C=u&&d.findIndex((e=>e.id===(null==u?void 0:u.id))),y=null!=u&&u.name?u.name:C>=0?"Passenger ".concat(C+1):"";return(0,e.jsxs)(e.Fragment,{children:[(0,e.jsxs)("div",{className:"summary","data-testid":"seat-selection-summary",children:[(0,e.jsxs)("div",{className:"summary__description",children:[(0,e.jsx)("div",{className:"summary__description-title",children:"".concat(x," of ").concat(f," seat").concat(f>1?"s":""," selected")},void 0),(0,e.jsxs)("div",{className:"summary__description-cost",children:[j," will be added to the order"]},void 0)]},void 0),(0,e.jsx)($,{onBackClick:r,onClick:n,iconAfter:i,primaryButtonCopy:a,disableBackButton:o},void 0)]},void 0),(0,e.jsxs)("div",{className:"summary summary--mobile",children:[(0,e.jsxs)("div",{className:"summary__segment",children:[Object.keys(m).length>0&&(0,e.jsx)(I,{segment:m},"summary-".concat(m.id)),y&&(0,e.jsx)("h3",{className:"summary__segment-passenger",children:y},void 0)]},void 0),(0,e.jsxs)("div",{className:"summary__description-cost",children:["Total Price ",(0,e.jsx)("strong",{children:j},void 0)]},void 0),(0,e.jsx)($,{onBackClick:r,onClick:n,iconAfter:i,primaryButtonCopy:a,disableBackButton:o},void 0)]},void 0)]},void 0)},Y=t=>{let{seatMaps:n,offer:a,passengers:i,initialSeatSelection:r,initialSegmentId:o,onSubmit:l,currencyConversion:c}=t;const u=i.sort(((e,s)=>e.id.localeCompare(s.id))),m=((e,s)=>{if(null!=s&&s.rate&&null!=s&&s.currency){const t=w()(e);return t.forEach((e=>e.cabins.forEach((e=>e.rows.forEach((e=>e.sections.forEach((e=>e.elements.forEach((e=>{"seat"===e.type&&e.available_services.map((e=>{e.total_amount=(parseInt(e.total_amount)*s.rate).toFixed(2).toString(),e.total_currency=s.currency}))})))))))))),t}return e})(n,c),[p,g]=s.useState("Next Passenger"),[h,_]=s.useState(""),[f,x]=s.useState(o||""),[j,C]=s.useState(""),[y,N]=s.useState(""),[L,M]=s.useState(r||{}),[R,V]=s.useState(i.length>0?u[0].id:""),B=a.slices.length>0&&a.slices[0],I=B&&B.segments.length>0&&B.segments[0].id,[O,Z]=s.useState(o||I||""),[A,P]=s.useState("default"),[F,T]=s.useState({seat:null,service:void 0}),[D,U]=s.useState(!0),[$,Y]=s.useState([]);d().polyfill();const G=v(),K=s.useMemo((()=>a.slices.map((e=>e.segments)).flat().filter((e=>n.map((e=>e.segment_id)).includes(e.id)))),[a,n]),Q=s.useMemo((()=>u.map((e=>e.id)).sort(((e,s)=>e.localeCompare(s)))),[u]);s.useMemo((()=>{if(Object.keys(L).length<=0){const e=new Map(K.map((e=>{const s=new Map(e.passengers.map((e=>[e.passenger_id,null])));return[e.id,Object.fromEntries(new Map([...s.entries()].sort(((e,s)=>e[0].localeCompare(s[0])))))]}))),s=Object.fromEntries(e);s&&M(s)}}),[L,K]);const ee=s.useMemo((()=>K.find((e=>e.id===O))||{}),[K,O]);s.useEffect((()=>{const e=()=>{window.innerWidth<1024&&"small"!==A?P("small"):window.innerWidth>=1024&&"default"!==A&&P("default")};return window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)}),[A]),s.useEffect((()=>{const e=((e,s)=>Object.keys(s).reduce(((s,t)=>{const n=e.passengers;if(n){if(!(n.length>0)){const{[t]:e,...n}=s;return n}{const e=[];n.forEach((s=>{e.push(s.passenger_id)})),s={...s,[t]:e.sort(((e,s)=>e.localeCompare(s)))}}}return s}),{}))(ee,L),s=Object.keys(e),t=E(s,ee.id),n=e[O].indexOf(R),a=E(e[O],R),i=e[O][a],r=Object.keys(L).indexOf(O);return 0===s.length?g("Continue"):(C(i),n===ee.passengers.length-1?r===s.length-1?g("Continue"):(_(s[t]),g("Next Flight")):g("Next Passenger"))}),[ee,L,R,O]);const se=s.useMemo((()=>u.find((e=>{if(e.id===R)return{id:e.id,name:e.name||void 0}}))),[u,R]);if(0===u.length||!B||0===a.slices[0].segments.length)return null;const te=()=>{const e=Object.keys(L[O]);if(e[0]===R){U(!0),Z(f);const s=Object.keys(L[f])[e.length-1];V(s)}else{const e=Q.indexOf(R);0!==e&&V(Q[e-1])}const s=L[f][y],t=$.map((e=>e)).find((e=>e.segment===f&&e.seat.designator===(null==s?void 0:s.designator)));t&&T({seat:t.seat,service:t.service})};return(0,e.jsx)(q.Provider,{value:{offer:a,segments:K,seatMaps:m,passengers:u,segmentId:O,passengerId:R,currentSelectedPassenger:se,currentSelectedSegment:ee,seatSelection:L,size:A,onSelectSeat:e=>{const s=Object.assign({},L,{[O]:Object.assign({},L[O],{[R]:{...e}})});M(s)},onSelectPassenger:(e,s)=>{V(e),Z(s);const t=L[s]&&L[s][e];if(t&&null!==t.designator){const e=document.getElementById(t.designator);e&&!(e=>{const s=e.getBoundingClientRect(),t=Math.max(document.documentElement.clientHeight,window.innerHeight);return!(s.bottom<0||s.top-t>=0)})(e)&&(null==e||e.scrollIntoView({behavior:"smooth",block:"center"}))}},currentSeat:F,setCurrentSeat:T,setIsLoading:U,extendedSeatInfo:$,setExtendedSeatInfo:Y,currency:null!=c&&c.currency&&null!=c&&c.rate?c.currency:a.total_currency},children:(0,e.jsx)("div",{className:"duffel-components",children:(0,e.jsxs)("div",{className:"seat-selection",children:[(0,e.jsxs)("div",{className:"seat-selection__content",children:[!S(G)&&(0,e.jsx)("aside",{className:"seat-selection__content-child seat-selection__content-child--passengers",children:(0,e.jsx)(z,{},void 0)},void 0),(0,e.jsx)("div",{className:"seat-selection__content-child seat-selection__content-child--map",children:D?(()=>{const s=ee.origin.iata_code||"",t=ee.destination.iata_code||"",n=ee.duration&&(e=>{const s=e.match(k);if(!s)return e;const t=s[1]&&"0"!==s[1]?"".concat(s[1],"d"):"",n=s[2]&&"0"!==s[2]?"".concat(s[2].toString().padStart(2,"0"),"h"):"",a=s[3]&&"0"!==s[3]?"".concat(s[3].toString().padStart(2,"0"),"m"):"";return"".concat(t," ").concat(n," ").concat(a).trim()})(ee.duration)||"";return(0,e.jsx)(H,{origin:s,destination:t,duration:n,done:()=>U(!1)},void 0)})():(0,e.jsx)(b,{children:(0,e.jsx)(W,{},void 0)},void 0)},void 0)]},void 0),(()=>{const{seat:s,service:t}=F;return null!==s&&S(G)&&L[O]&&null!==L[O][R]?(0,e.jsx)("div",{className:"seat-selection__mobile-seat-info",children:(0,e.jsx)(J,{seat:s,service:t},void 0)},void 0):null})(),(0,e.jsx)("div",{className:"seat-selection__confirmation",children:(()=>{const s=O===I&&R===u[0].id||!1;switch(p){case"Continue":return(0,e.jsx)(X,{onClick:()=>{l(L),(()=>{const e=K[0];V(e.passengers[0].passenger_id),Z(e.id)})()},onBackClick:te,disableBackButton:s,primaryButtonCopy:p},void 0);case"Next Flight":return(0,e.jsx)(X,{onClick:()=>{U(!0),x(O),V(j),Z(h)},onBackClick:te,disableBackButton:s,primaryButtonCopy:S(G)?"Next":p,iconAfter:{iconAfter:"chevron"}},void 0);default:return(0,e.jsx)(X,{onClick:()=>{N(R),V(j)},onBackClick:te,disableBackButton:s,iconAfter:{iconAfter:"chevron"},primaryButtonCopy:S(G)?"Next":p},void 0)}})()},void 0)]},void 0)},void 0)},void 0)},G=s=>(0,e.jsx)(b,{children:(0,e.jsx)(Y,{...s},void 0)},void 0);G.propTypes={offer:l().shape({allowed_passenger_identity_document_types:l().array.isRequired,available_services:l().array.isRequired,base_amount:l().string.isRequired,base_currency:l().string.isRequired,conditions:l().object.isRequired,created_at:l().string.isRequired,expires_at:l().string.isRequired,id:l().string.isRequired,live_mode:l().bool.isRequired,owner:l().shape({name:l().string.isRequired,id:l().string.isRequired,iata_code:l().string.isRequired}).isRequired,passenger_identity_documents_required:l().bool.isRequired,passengers:l().array.isRequired,payment_requirements:l().shape({payment_required_by:l().string,price_guarantee_expires_at:l().string,requires_instant_payment:l().bool.isRequired}).isRequired,slices:l().array.isRequired,tax_amount:l().string.isRequired,tax_currency:l().string.isRequired,total_amount:l().string.isRequired,total_emissions_kg:l().string.isRequired,total_currency:l().string.isRequired,updated_at:l().string.isRequired}).isRequired,seatMaps:l().arrayOf(l().shape({id:l().string.isRequired,slice_id:l().string.isRequired,segment_id:l().string.isRequired,cabins:l().array.isRequired}).isRequired).isRequired,passengers:l().arrayOf(l().shape({id:l().string.isRequired,name:l().string}).isRequired).isRequired,onSubmit:l().func.isRequired};const K=(s,t)=>{r().render((0,e.jsx)(G,{...t},void 0),document.getElementById(s))}})();var a=n.w,i=n.$;export{a as SeatSelection,i as renderSeatSelectionComponent};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(()=>{var e={311:(e,s,t)=>{"use strict";t.d(s,{z:()=>l,X:()=>c});var n=t(997),a=t(689),i=t(3),r=t.n(i),o=t(639);const l=a.forwardRef(((e,s)=>{let{className:t,disabled:a=!1,iconAfter:i,iconBefore:l,iconOnly:c,intent:d="PRIMARY",text:u,type:m="button",id:p,...v}=e;const g=r()("duffel-button","duffel-button--solid",t,{"duffel-button--primary":"PRIMARY"===d,"duffel-button--muted":"MUTED"===d,"duffel-button--icon-only":c,"duffel-button--is-disabled":a});return(0,n.jsxs)("button",{ref:s,type:m,className:g,disabled:a,"aria-label":u,"data-testid":p,id:p,...v,children:[l&&(0,n.jsx)(o.J,{className:"duffel-button__icon duffel-button__icon--before",name:l},void 0),c&&(0,n.jsx)(o.J,{className:"duffel-button__icon",name:c},void 0),!c&&(0,n.jsx)("span",{className:"duffel-button__text",children:u},void 0),i&&(0,n.jsx)(o.J,{className:"duffel-button__icon duffel-button__icon--after",name:i},void 0)]},void 0)})),c=e=>{let{className:s,children:t,...a}=e;const i=r()("chromeless-button",s);return(0,n.jsx)("button",{className:i,...a,children:t},void 0)}},639:(e,s,t)=>{"use strict";t.d(s,{J:()=>c});var n=t(997),a=t(3),i=t.n(a),r=(t(689),t(108));const o={arrow_forward:(0,n.jsx)("path",{d:"M5 13h11.17l-4.88 4.88c-.39.39-.39 1.03 0 1.42.39.39 1.02.39 1.41 0l6.59-6.59c.39-.39.39-1.02 0-1.41l-6.58-6.6c-.39-.39-1.02-.39-1.41 0-.39.39-.39 1.02 0 1.41L16.17 11H5c-.55 0-1 .45-1 1s.45 1 1 1z"},void 0),bassinet:(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("path",{d:"M19 12C19 14.1217 18.1571 16.1566 16.6569 17.6569C15.1566 19.1571 13.1217 20 11 20C8.87827 20 6.84344 19.1571 5.34315 17.6569C3.84286 16.1566 3 14.1217 3 12L11 12H19Z"},void 0),(0,n.jsx)("path",{d:"M16.1347 5.86529L11 11V4C12.0506 4 13.0909 4.20693 14.0615 4.60896C14.8136 4.92052 15.5125 5.34451 16.1347 5.86529ZM16.8602 6.55405L12.4142 11H18.9373C18.8482 10.293 18.6649 9.59962 18.391 8.93853C18.0264 8.05823 17.5077 7.25087 16.8602 6.55405Z"},void 0)]},void 0),chevron:(0,n.jsx)("path",{d:"M5 13H16.17L11.29 17.88C10.9 18.27 10.9 18.91 11.29 19.3C11.68 19.69 12.31 19.69 12.7 19.3L19.29 12.71C19.68 12.32 19.68 11.69 19.29 11.3L12.71 4.7C12.32 4.31 11.69 4.31 11.3 4.7C10.91 5.09 10.91 5.72 11.3 6.11L16.17 11H5C4.45 11 4 11.45 4 12C4 12.55 4.45 13 5 13Z"},void 0),close:(0,n.jsx)("path",{d:"M18.3 5.71c-.39-.39-1.02-.39-1.41 0L12 10.59 7.11 5.7c-.39-.39-1.02-.39-1.41 0-.39.39-.39 1.02 0 1.41L10.59 12 5.7 16.89c-.39.39-.39 1.02 0 1.41.39.39 1.02.39 1.41 0L12 13.41l4.89 4.89c.39.39 1.02.39 1.41 0 .39-.39.39-1.02 0-1.41L13.41 12l4.89-4.89c.38-.38.38-1.02 0-1.4z"},void 0),closet:(0,n.jsx)("path",{d:"M12 4C11.0717 4 10.1815 4.36875 9.52513 5.02513C8.86875 5.6815 8.5 6.57174 8.5 7.5H10.5C10.5 7.10218 10.658 6.72064 10.9393 6.43934C11.2206 6.15804 11.6022 6 12 6C12.3978 6 12.7794 6.15804 13.0607 6.43934C13.342 6.72064 13.5 7.10218 13.5 7.5C13.5 7.89782 13.342 8.27936 13.0607 8.56066C12.7794 8.84196 12.3978 9 12 9C11.45 9 11 9.45 11 10V11.75L2.4 18.2C2.23209 18.3259 2.10807 18.5015 2.04549 18.7018C1.98291 18.9022 1.98495 19.1171 2.05132 19.3162C2.11769 19.5153 2.24502 19.6885 2.41529 19.8112C2.58556 19.934 2.79012 20 3 20H21C21.2099 20 21.4144 19.934 21.5847 19.8112C21.755 19.6885 21.8823 19.5153 21.9487 19.3162C22.0151 19.1171 22.0171 18.9022 21.9545 18.7018C21.8919 18.5015 21.7679 18.3259 21.6 18.2L13 11.75V10.85C13.7216 10.6349 14.3546 10.1927 14.805 9.58919C15.2554 8.98569 15.4991 8.25303 15.5 7.5C15.5 6.57174 15.1313 5.6815 14.4749 5.02513C13.8185 4.36875 12.9283 4 12 4ZM12 13.5L18 18H6L12 13.5Z"},void 0),exit_row:(0,n.jsx)("path",{d:"M20 11H6.83001L9.71001 8.12001C10.1 7.73001 10.1 7.10001 9.71001 6.71001C9.32001 6.32001 8.69001 6.32001 8.30001 6.71001L3.71001 11.3C3.32001 11.69 3.32001 12.32 3.71001 12.71L8.30001 17.3C8.69001 17.69 9.32001 17.69 9.71001 17.3C10.1 16.91 10.1 16.28 9.71001 15.89L6.83001 13H20C20.55 13 21 12.55 21 12C21 11.45 20.55 11 20 11Z"},void 0),exit_row_right:(0,n.jsx)("path",{d:"M4 11H17.17L14.29 8.12001C13.9 7.73001 13.9 7.10001 14.29 6.71001C14.68 6.32001 15.31 6.32001 15.7 6.71001L20.29 11.3C20.68 11.69 20.68 12.32 20.29 12.71L15.7 17.3C15.31 17.69 14.68 17.69 14.29 17.3C13.9 16.91 13.9 16.28 14.29 15.89L17.17 13H4C3.45 13 3 12.55 3 12C3 11.45 3.45 11 4 11Z"},void 0),galley:(0,n.jsx)("path",{d:"M20 3H4v10c0 2.21 1.79 4 4 4h6c2.21 0 4-1.79 4-4v-3h2c1.11 0 2-.9 2-2V5c0-1.11-.89-2-2-2zm0 5h-2V5h2v3zM4 19h16v2H4z"},void 0),lavatory:(0,n.jsx)("path",{d:"M5.5 22v-7.5H4V9c0-1.1.9-2 2-2h3c1.1 0 2 .9 2 2v5.5H9.5V22h-4zM18 22v-6h3l-2.54-7.63C18.18 7.55 17.42 7 16.56 7h-.12c-.86 0-1.63.55-1.9 1.37L12 16h3v6h3zM7.5 6c1.11 0 2-.89 2-2s-.89-2-2-2-2 .89-2 2 .89 2 2 2zm9 0c1.11 0 2-.89 2-2s-.89-2-2-2-2 .89-2 2 .89 2 2 2z"},void 0),lie_flat_seat:(0,n.jsx)("path",{d:"M6.16667 12.8333C6.81667 12.8333 7.45834 12.5833 7.95001 12.0833C8.91667 11.0916 8.90001 9.51659 7.91667 8.54992C7.42501 8.07492 6.79167 7.83325 6.16667 7.83325C5.51667 7.83325 4.87501 8.08325 4.38334 8.58325C3.41667 9.57492 3.43334 11.1499 4.41667 12.1166C4.90834 12.5916 5.54167 12.8333 6.16667 12.8333ZM5.57501 9.74992C5.73334 9.59159 5.94167 9.49992 6.16667 9.49992C6.38334 9.49992 6.59167 9.58325 6.75001 9.73325C7.08334 10.0583 7.08334 10.5749 6.76667 10.9083C6.60001 11.0749 6.39167 11.1666 6.16667 11.1666C5.95001 11.1666 5.74167 11.0833 5.58334 10.9333C5.25001 10.5999 5.25001 10.0833 5.57501 9.74992ZM17 7.83325H9.50001V12.8333H20.3333V11.1666C20.3333 9.32492 18.8417 7.83325 17 7.83325ZM11.1667 11.1666V9.49992H17C17.9167 9.49992 18.6667 10.2499 18.6667 11.1666H11.1667ZM3.66667 15.3333H8.66667V16.9999H15.3333V15.3333H20.3333V13.6666H3.66667V15.3333Z"},void 0),no_airplane:(0,n.jsx)("path",{d:"M14.6674 10.0001V2.66675C14.6674 1.56008 13.7741 0.666748 12.6674 0.666748C11.5607 0.666748 10.6674 1.56008 10.6674 2.66675V7.57341L21.1074 18.0134L25.3341 19.3334V16.6667L14.6674 10.0001ZM1.33407 5.02675L7.9874 11.6801L0.000732422 16.6667V19.3334L10.6674 16.0001V23.3334L8.00073 25.3334V27.3334L12.6674 26.0001L17.3341 27.3334V25.3334L14.6674 23.3334V18.3601L22.3074 26.0001L24.0007 24.3067L3.0274 3.33341L1.33407 5.02675Z"},void 0),no_seat:(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("path",{d:"M25.1667 21.9733L23.4733 23.6667L2.5 2.69333L4.19333 1L7.16667 3.97333L16.5267 13.3333L19.1933 16L24.5 21.3067L25.1667 21.9733Z"},void 0),(0,n.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M7.16667 24H3.16667V16H19.1933L24.5 21.3067V24H20.5V20H7.16667V24ZM27.1667 9.33333H23.1667V13.3333H27.1667V9.33333ZM4.5 9.33333H0.5V13.3333H4.5V9.33333ZM20.3333 13.3333H20.5V2.66667C20.5 1.2 19.3 0 17.8333 0H9.83333C9.05784 0 8.3569 0.335483 7.86848 0.868484L20.3333 13.3333ZM16.5267 13.3333L7.16667 3.97333V13.3333H16.5267Z"},void 0)]},void 0),seat:(0,n.jsx)("path",{d:"M7.59 5.41012C6.81 4.63012 6.81 3.36012 7.59 2.58012C8.37 1.80012 9.64 1.80012 10.42 2.58012C11.2 3.36012 11.2 4.63012 10.42 5.41012C9.63 6.20012 8.37 6.20012 7.59 5.41012ZM6 16.0001V8.00012C6 7.45012 5.55 7.00012 5 7.00012C4.45 7.00012 4 7.45012 4 8.00012V16.0001C4 18.7601 6.24 21.0001 9 21.0001H14C14.55 21.0001 15 20.5501 15 20.0001C15 19.4501 14.55 19.0001 14 19.0001H9C7.34 19.0001 6 17.6601 6 16.0001ZM19.28 19.3501L15.51 15.5801C15.14 15.2101 14.63 15.0001 14.1 15.0001H11.5V11.3201C12.59 12.2101 14.16 13.0201 15.7 13.3401C16.37 13.4801 17 12.9801 17 12.3001C17 11.7701 16.61 11.3401 16.08 11.2501C14.66 11.0101 13.2 10.2401 12.33 9.28012L10.93 7.73012C10.74 7.52012 10.5 7.35012 10.24 7.23012C9.95 7.09012 9.62 7.00012 9.28 7.00012H9.25C8.01 7.00012 7 8.01012 7 9.25012V15.0001C7 16.6601 8.34 18.0001 10 18.0001H15.07L17.85 20.7801C18.24 21.1701 18.89 21.1701 19.28 20.7801C19.68 20.3901 19.68 19.7501 19.28 19.3501Z"},void 0),seat_paid_indicator:(0,n.jsx)("path",{d:"M11.7686 0.731368C12.7766 -0.276576 14.5 0.437294 14.5 1.86274V10.8C14.5 12.5673 13.0673 14 11.3 14H2.36274C0.937294 14 0.223427 12.2766 1.23137 11.2686L11.7686 0.731368Z"},void 0),stairs:(0,n.jsx)("path",{d:"M19,3H5C3.9,3,3,3.9,3,5v14c0,1.1,0.9,2,2,2h14c1.1,0,2-0.9,2-2V5C21,3.9,20.1,3,19,3z M18,8h-2.42v3.33H13v3.33h-2.58 V18H6v-2h2.42v-3.33H11V9.33h2.58V6H18V8z"},void 0),wifi:(0,n.jsx)("path",{d:"M2.83333 9.50005L4.49999 11.1667C8.64166 7.02505 15.3583 7.02505 19.5 11.1667L21.1667 9.50005C16.1083 4.44172 7.89999 4.44172 2.83333 9.50005ZM9.49999 16.1667L12 18.6667L14.5 16.1667C13.125 14.7834 10.8833 14.7834 9.49999 16.1667ZM6.16666 12.8334L7.83333 14.5C10.1333 12.2 13.8667 12.2 16.1667 14.5L17.8333 12.8334C14.6167 9.61672 9.39166 9.61672 6.16666 12.8334Z"},void 0)},l=e=>e in o?o[e]:(r.warn("The icon ".concat(e)),null),c=e=>{let{name:s,size:t,className:a,viewBox:r}=e;return(0,n.jsx)("svg",{className:i()("ff-icon",a),width:t||24,height:t||24,viewBox:r||"0 0 24 24","aria-label":s,"data-testid":s,children:l(s)},void 0)}},108:(e,s,t)=>{var n=t(464),a=t(84);function i(){return(new Date).getTime()}var r,o=Array.prototype.slice,l={};r=void 0!==t.g&&t.g.console?t.g.console:"undefined"!=typeof window&&window.console?window.console:{};for(var c=[[function(){},"log"],[function(){r.log.apply(r,arguments)},"info"],[function(){r.log.apply(r,arguments)},"warn"],[function(){r.warn.apply(r,arguments)},"error"],[function(e){l[e]=i()},"time"],[function(e){var s=l[e];if(!s)throw new Error("No such label: "+e);delete l[e];var t=i()-s;r.log(e+": "+t+"ms")},"timeEnd"],[function(){var e=new Error;e.name="Trace",e.message=n.format.apply(null,arguments),r.error(e.stack)},"trace"],[function(e){r.log(n.inspect(e)+"\n")},"dir"],[function(e){if(!e){var s=o.call(arguments,1);a.ok(!1,n.format.apply(null,s))}},"assert"]],d=0;d<c.length;d++){var u=c[d],m=u[0],p=u[1];r[p]||(r[p]=m)}e.exports=r},84:e=>{"use strict";e.exports=require("assert")},3:e=>{"use strict";e.exports=require("classnames")},689:e=>{"use strict";e.exports=require("react")},997:e=>{"use strict";e.exports=require("react/jsx-runtime")},464:e=>{"use strict";e.exports=require("util")}},s={};function t(n){var a=s[n];if(void 0!==a)return a.exports;var i=s[n]={exports:{}};return e[n](i,i.exports,t),i.exports}t.n=e=>{var s=e&&e.__esModule?()=>e.default:()=>e;return t.d(s,{a:s}),s},t.d=(e,s)=>{for(var n in s)t.o(s,n)&&!t.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:s[n]})},t.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),t.o=(e,s)=>Object.prototype.hasOwnProperty.call(e,s),t.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var n={};(()=>{"use strict";t.r(n),t.d(n,{SeatSelection:()=>$,renderSeatSelectionComponent:()=>K});var e=t(997),s=t(689),a=t.n(s);const i=require("react-dom");var r=t.n(i);const o=require("prop-types");var l=t.n(o);const c=require("smoothscroll-polyfill");var d=t.n(c),u=t(311),m=t(639);const p=require("react-popper"),v=()=>{const[e,s]=a().useState(null);return a().useEffect((()=>{null===e&&s(window.innerWidth);const t=()=>s(window.innerWidth);return t(),window.addEventListener("resize",t),()=>window.removeEventListener("resize",t)}),[]),null!=e?e:0};const g=e=>{let{id:t,children:n}=e;const a=function(e){const t=s.useRef(null);return s.useEffect((function(){const s=document.querySelector("#".concat(e)),n=s||function(e){const s=document.createElement("div");return s.setAttribute("id",e),s}(e);if(s||function(e){if(!document.body.lastElementChild)throw Error("document body not rendered");document.body.insertBefore(e,document.body.lastElementChild.nextElementSibling)}(n),!t.current)throw Error("elementRef not assigned");return n.appendChild(t.current),function(){if(!t.current)throw Error("elementRef not assigned");t.current.remove(),n.childElementCount||n.remove()}}),[e]),t.current||(t.current=document.createElement("div")),t.current}(t);return(0,i.createPortal)(n,a)},h=s.forwardRef(((s,t)=>{let{children:n,style:a,id:i="seat-selection__popover",...r}=s;return(0,e.jsx)(g,{id:i,children:(0,e.jsx)("div",{className:"duffel-components",children:(0,e.jsx)("div",{className:"popover-container",id:i,"data-testid":i,style:a,ref:t,...r,children:n},void 0)},void 0)},void 0)}));var _=t(3),f=t.n(_);function x(s){let{value:t,onChange:n,options:a}=s;return(0,e.jsx)("div",{className:"seat-map__tab-select",children:a.map((s=>(0,e.jsx)(u.X,{type:"button",className:f()("seat-map__tab-select-option",{"seat-map__tab-select-option--selected":s===t}),onClick:()=>t!==s&&n(s),children:s},s)))},void 0)}const j={error_loading:{title:"Error loading seat maps",message:"We weren’t able to load your seat maps.",iconName:"no_airplane"},error_unavailable:{title:"Seat selection unavailable",message:"Unfortunately seat selection is not available for this flight. A seat will be allocated by the airline.",iconName:"no_seat"}},y=s=>{let{errorType:t}=s;return(0,e.jsxs)("div",{className:"error-state__container","data-testid":t,children:[(0,e.jsx)("i",{className:"error-state__icon",children:(0,e.jsx)(m.J,{name:j[t].iconName},void 0)},void 0),(0,e.jsx)("h3",{className:"error-state__title",children:j[t].title},void 0),(0,e.jsx)("p",{className:"error-state__copy",children:j[t].message},void 0)]},void 0)};var C=t(108);class b extends s.Component{constructor(e){super(e),this.state={hasError:!1}}static getDerivedStateFromError(){return{hasError:!0}}componentDidCatch(e){C.error(e)}render(){return this.state.hasError?(0,e.jsx)("div",{className:"duffel-components",children:(0,e.jsx)(y,{errorType:"error_loading"},void 0)},void 0):this.props.children}}const N=require("lodash/cloneDeep");var w=t.n(N);const S=e=>e<768,L=function(e){let s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"en-GB",t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const n=new Intl.NumberFormat(s,{style:"currency",currency:e,...t});return e=>{const s=n.format(e);return t&&t.signDisplay&&("always"===t.signDisplay||"exceptZero"===t.signDisplay&&0!==e)?s.replace(/^([+-])/,"$1 "):s}},M=e=>e.reduce(((e,s)=>e+s),0),k=/P(?:([.,\d]+)D)?T(?:([.,\d]+)H)?(?:([.,\d]+)M)?/i,E=(e,s)=>(e.indexOf(s)+1)%e.length,H=t=>{let{origin:n,destination:a,duration:i,done:r}=t;const[o,l]=s.useState(!1),c=s.useRef(null);return s.useEffect((()=>{o&&r&&r()})),o?null:(0,e.jsxs)("div",{className:"loading-state__container",children:[(0,e.jsx)("span",{className:"loading-state__message",children:"Loading seat map"},void 0),(0,e.jsx)("div",{className:"loading-state__progress-indicator",children:(0,e.jsx)("span",{className:"loading-state__progress-indicator--status",ref:c,onAnimationEnd:()=>l(!0),"data-testid":"loading-state__progress-indicator--status"},void 0)},void 0),(0,e.jsxs)("div",{className:"loading-state__segment",children:[(0,e.jsx)("span",{className:"loading-state__segment--origin",children:n},void 0),(0,e.jsx)(m.J,{name:"arrow_forward",size:20},void 0),(0,e.jsx)("span",{className:"loading-state__segment--destination",children:a},void 0)]},void 0),(0,e.jsx)("span",{className:"loading-state__duration",children:i},void 0)]},void 0)},R=()=>({}),q=(0,s.createContext)({offer:{},seatMaps:[],passengers:[],segments:[],segmentId:"",passengerId:"",currentSelectedSegment:{},currentSelectedPassenger:{},seatSelection:{},size:"default",currentSeat:{},setCurrentSeat:R,onSelectSeat:R,onSelectPassenger:R,setIsLoading:R,extendedSeatInfo:[],setExtendedSeatInfo:R,currency:""}),V=()=>(0,s.useContext)(q),B=s=>{let{segment:t,passenger:n,passengerIndex:a}=s;const{seatSelection:i,segmentId:r,passengerId:o,onSelectPassenger:l,currentSelectedSegment:c,setIsLoading:d}=V(),u=i[t.id]&&i[t.id][n.id];return(0,e.jsxs)("button",{"data-testid":"passenger-".concat(n.id),type:"button",onClick:()=>{c.id!==t.id&&d(!0),l(n.id,t.id)},className:f()("passenger-selection-passenger",{"passenger-selection-passenger--selected":r===t.id&&o===n.id}),children:[(0,e.jsx)("span",{className:"passenger-selection-passenger__identifier",children:n.name||"Passenger ".concat(a+1)},void 0),u&&u.service?(0,e.jsxs)("span",{className:"passenger-selection-passenger__action",children:[(0,e.jsx)("span",{className:"passenger-selection-passenger__seat-designator",children:u.designator},void 0),(0,e.jsx)("span",{className:"passenger-selection-passenger__seat-price",children:L(u.service.total_currency)(+u.service.total_amount)},void 0)]},void 0):(0,e.jsx)("span",{className:"passenger-selection-passenger__action",children:"Unselected"},void 0)]},n.id)},I=s=>{let{segment:t,className:n}=s;return(0,e.jsxs)("h3",{className:f()(n,"passenger-segment__title"),children:[t.origin.iata_code,(0,e.jsx)(m.J,{name:"chevron",className:"passenger-segment__chevron",size:20},void 0),t.destination.iata_code]},void 0)},O=s=>{let{segment:t}=s;const{passengers:n}=V();return(0,e.jsxs)("li",{className:"passenger-selection-segment",children:[Object.keys(t).length>0&&(0,e.jsx)(I,{segment:t},void 0),n.map(((s,n)=>(0,e.jsx)(B,{segment:t,passenger:s,passengerIndex:n},s.id)))]},t.id)},z=()=>{const{segments:s}=V();return(0,e.jsx)("div",{className:"passenger-selection",children:(0,e.jsx)("ul",{className:"passenger-selection__segments",children:s.map((s=>(0,e.jsx)(O,{segment:s},s.id)))},void 0)},void 0)},Z=s=>{let{value:t,setValue:n}=s;const a=["Lower deck","Upper deck"];return(0,e.jsx)(x,{options:a,value:a[t],onChange:e=>n(a.indexOf(e))},void 0)},P=s=>{let{symbols:t}=s;return(0,e.jsxs)("div",{className:"seat-map__legend",children:[(0,e.jsxs)("span",{className:"seat-map__legend-item",children:[(0,e.jsx)("span",{className:"seat-map__legend-seat seat-map__legend-seat--fee-payable","aria-label":"Additional cost for seat",children:(0,e.jsx)(m.J,{name:"seat_paid_indicator",className:"seat-map__legend-seat--fee-payable-indicator",size:12},void 0)},void 0),"Additional Cost"]},void 0),(0,e.jsxs)("span",{className:"seat-map__legend-item",children:[(0,e.jsx)("span",{className:"seat-map__legend-seat seat-map__legend-seat--included","aria-label":"Included seat"},void 0),"Included"]},void 0),(0,e.jsxs)("span",{className:"seat-map__legend-item",children:[(0,e.jsx)("span",{className:"seat-map__legend-seat seat-map__legend-seat--selected","aria-label":"Selected seat"},void 0),"Selected"]},void 0),(0,e.jsxs)("span",{className:"seat-map__legend-item",children:[(0,e.jsx)("span",{className:"seat-map__legend-seat","aria-label":"Unavailable seat",children:(0,e.jsx)(m.J,{name:"close",size:14},void 0)},void 0),"Unavailable"]},void 0),[...t].map((s=>(0,e.jsxs)("span",{className:"seat-map__legend-item seat-map__legend-item--symbol",children:[(0,e.jsx)(m.J,{name:s,size:20},void 0),s.split("_")[0]]},s)))]},void 0)},A=["bassinet","exit_row"],T=s=>{let{type:t}=s;const n=v();return(0,e.jsx)("div",{className:f()("map-element map-element--amenity",{"map-element--wrapped":!A.includes(t)}),"aria-label":t.toString(),children:(0,e.jsx)(m.J,{name:t,size:S(n)?16:24},void 0)},void 0)},F=s=>{let{seat:t,service:n}=s;const a=n?L(n.total_currency)(+n.total_amount):"";return(0,e.jsxs)("div",{className:"seat-info",children:[(0,e.jsxs)("div",{className:"seat-info__details",children:[(0,e.jsx)("strong",{children:null==t?void 0:t.designator},void 0),(0,e.jsxs)("span",{children:[(null==t?void 0:t.name)||"Seat"," "]},void 0),(0,e.jsx)("strong",{children:a},void 0)]},void 0),null==t?void 0:t.disclosures.map(((s,t)=>(0,e.jsx)("div",{className:"seat-info__disclosure",children:s},t)))]},void 0)},J=t=>{let{seat:n}=t;const i=v(),[r,o]=s.useState(!1),{popper:{styles:l,attributes:c},setReferenceElement:d,setPopperElement:u}=((e,s,t,n)=>{const{shouldInsideClickClose:i}=Object.assign({},{shouldInsideClickClose:!1},{shouldInsideClickClose:!1}),[r,o]=a().useState(null),[l,c]=a().useState(null),[d,u]=a().useState(null),m={placement:"auto",modifiers:[{name:"arrow",options:{element:d}}],placement:"top",modifiers:[{name:"offset",options:{offset:[0,8]}}]},v=(0,p.usePopper)(r,l,m),g=a().useCallback((e=>{const t=!!l&&l.contains(e.target);t||s(),i&&t&&setTimeout(s,10)}),[l,s,i]),h=a().useCallback((e=>{"Escape"===e.key&&s()}),[s]);return a().useEffect((()=>{if(null!==document)return e&&(document.body.addEventListener("click",g),document.body.addEventListener("keydown",h)),()=>{document.body.removeEventListener("click",g),document.body.removeEventListener("keydown",h)}}),[e,g,h]),{popper:v,setReferenceElement:o,setPopperElement:c,setArrowElement:u}})(r,(()=>o(!1))),{passengers:g,passengerId:_,segmentId:x,seatSelection:j,currentSeat:y,setCurrentSeat:C,onSelectSeat:b,extendedSeatInfo:N,setExtendedSeatInfo:w}=V(),{service:M,isAvailable:k,selectedBy:E}=((e,s,t)=>{var n,a;const i=null===(n=e.available_services)||void 0===n?void 0:n.find((e=>e.passenger_id===s)),r=null===(a=e.available_services)||void 0===a?void 0:a.find((e=>{var s,n;return!!t&&(null===(s=t[e.passenger_id])||void 0===s||null===(n=s.service)||void 0===n?void 0:n.id)===e.id}));return{service:i,isAvailable:i&&!r||!1,selectedBy:null==r?void 0:r.passenger_id}})(n,_,j[x]),H=s.useMemo((()=>((e,s)=>{if(!s)return!1;let t="";return e.forEach(((e,n)=>{if(e.name){const n=new RegExp(/(\p{L}{1})\p{L}+/,"gu"),r=[...e.name.matchAll(n)]||[];var a,i;if(e.id===s)return t=(((null===(a=r.shift())||void 0===a?void 0:a[1])||"")+((null===(i=r.pop())||void 0===i?void 0:i[1])||"")).toUpperCase()}if(e.id===s)return t="P".concat(n+1)})),t})(g,E)),[g,E]),R="".concat(M&&L(M.total_currency)(+M.total_amount)),q=(null==M?void 0:M.total_amount)&&0!==parseInt(null==M?void 0:M.total_amount),B=E&&E!==_,I=s.useMemo((()=>e=>{if(null!==e){const{segment:s,seat:{designator:t}}=e;N.map((e=>e)).find((e=>e.segment===s&&e.seat.designator===t))?w(N.splice(N.findIndex((e=>e.segment!==s&&e.seat.designator!==t)))):M&&w([...N,{...e,service:M}])}}),[N,M,w]);return(0,e.jsx)(e.Fragment,{children:E||k?(0,e.jsxs)("button",{id:n.designator,type:"button",className:f()("map-element","map-element__seat",{"map-element--available":k&&!E,"map-element--selected":E,"map-element--actionable":k||E==_}),onClick:e=>{M&&I({segment:x,seat:n,service:M}),S(i)&&(y.seat===n?C({seat:null,service:void 0}):C({seat:n,service:M})),M&&!B&&(b(E===_?null:{designator:n.designator,service:M}),e.target.blur())},onMouseEnter:()=>!S(i)&&o(!0),onMouseLeave:()=>!S(i)&&o(!1),ref:d,"aria-label":"".concat(n.designator," ").concat(n.name||"Seat"," ").concat(R),children:[q&&(0,e.jsx)(m.J,{name:"seat_paid_indicator",className:"map-element--fee-payable",size:S(i)?16:24},void 0),E?H:n.designator.charAt(n.designator.length-1),r&&!B&&M&&!S(i)&&(0,e.jsx)(h,{ref:u,style:{...l.popper},...c.popper,children:(0,e.jsx)(F,{seat:n,service:M},void 0)},void 0)]},void 0):(0,e.jsx)("span",{className:"map-element map-element__seat","aria-label":"".concat(n.designator," ").concat(n.name||"Seat"," Unavailable"),children:(0,e.jsx)(m.J,{name:"close",size:S(i)?14:16},void 0)},void 0)},void 0)},D=(s,t,n)=>(0,e.jsx)(e.Fragment,{children:"seat"===s.type?(0,e.jsx)(J,{seat:s},t):"empty"===s.type?(0,e.jsx)("div",{className:"map-element map-element--empty"},t):"exit_row"===s.type?(0,e.jsx)("div",{className:f()("map-element map-element--exit",{"map-element--exit--right":n>0}),children:0===n?(0,e.jsx)(m.J,{name:"exit_row"},void 0):(0,e.jsx)(m.J,{name:"exit_row_right"},void 0)},t):(0,e.jsx)(T,{type:s.type},t)},void 0),U=t=>{let{row:n,hasWings:a}=t;const i=(e=>{const s=Object.values(e.sections).map((e=>e.elements)).reduce(((e,s)=>e.concat(s)),[]).filter((e=>"seat"===e.type));return s.length>0?s[0].designator.substring(0,s[0].designator.length-1):null})(n);return(0,e.jsx)(e.Fragment,{children:Object.values(n.sections).map(((t,r)=>{const o=Object.keys(n.sections).length,l=1===o;return(0,e.jsxs)(s.Fragment,{children:[(0,e.jsx)("div",{className:f()("map-section",{"map-section--left":0===r,"map-section--right":!l&&r===o-1,"map-section--wing":a}),"data-testid":"row-section-".concat(r),children:t.elements.length>0?t.elements.map(((t,n)=>(0,e.jsx)(s.Fragment,{children:D(t,n,r)},n))):D({type:"empty"},-1,r)},void 0),(r<o-1||l&&r<o)&&(0,e.jsx)("span",{className:"map-section__aisle",children:i},void 0),l&&r===n.sections.length-1&&D({type:"empty"},-1,r)]},r)}))},void 0)},W=()=>{const{segmentId:t,offer:n,seatMaps:a}=V(),[i,r]=s.useState(0),{cabin:o,hasMultipleDecks:l,anyHasWings:c}=((e,s,t,n)=>{const a=t.find((e=>e.segment_id===s));if(null==a||!a.cabins||0===(null==a?void 0:a.cabins.length))return{cabin:null};const i=n.slices.length>0&&n.slices[0].segments.length>0&&n.slices[0].segments[0].passengers.length>0&&n.slices[0].segments[0].passengers[0].cabin_class,r=null==a?void 0:a.cabins.filter((e=>e.cabin_class===i));return{cabin:r.find((s=>s.deck===e))||r[0]||(null==a?void 0:a.cabins[0]),hasMultipleDecks:r.length>1,anyHasWings:r.some((e=>e.wings))}})(i,t,a,n);if(!o)return(0,e.jsx)(y,{errorType:"error_unavailable"},void 0);const d=(e=>{const s=new Set;for(const t of e.rows)for(const e of t.sections)for(const t of e.elements)"seat"!==t.type&&"empty"!==t.type&&s.add(t.type);return s})(o);return(0,e.jsxs)("div",{"data-testid":"seat-map",className:f()("seat-map",{"seat-map--wings":c}),children:[l&&(0,e.jsx)(Z,{value:i,setValue:e=>{r(e)}},void 0),(0,e.jsx)("div",{className:"seat-map__legend-container",children:(0,e.jsx)(P,{symbols:d},void 0)},void 0),(0,e.jsx)("div",{className:"seat-map__map-container",style:{"--CABIN-AISLES":o.aisles},children:o.rows.map(((s,t)=>(0,e.jsx)(U,{row:s,hasWings:!!o.wings&&o.wings.first_row_index<=t&&o.wings.last_row_index>=t},t)))},void 0)]},void 0)},X=s=>{let{primaryButtonCopy:t,onBackClick:n,disableBackButton:a,onClick:i,iconAfter:r}=s;const o="summary-button-".concat(t.replace(" ","-").toLowerCase());return(0,e.jsxs)("div",{className:"summary__actions",children:[(0,e.jsx)(u.z,{text:"Previous passenger",onClick:n,disabled:a,intent:"MUTED",iconOnly:"chevron","aria-label":"Previous passenger",className:"summary__actions--previous"},void 0),(0,e.jsx)(u.z,{"data-testid":o,text:t,className:"summary__confirmation-btn",onClick:i,...r},void 0)]},void 0)},Y=t=>{let{onClick:n,primaryButtonCopy:a,iconAfter:i,onBackClick:r,disableBackButton:o}=t;const{seatSelection:l,segments:c,passengers:d,currentSelectedPassenger:u,currentSelectedSegment:m,offer:p,currency:v}=V(),g=(h=l,Object.values(h).map((e=>Object.values(e))).map((e=>e.map((e=>(null==e?void 0:e.service)||null)))).flat().filter((e=>null!==e)));var h;const _=s.useMemo((()=>M(g.map((e=>parseFloat(e.total_amount))))),[g]),f=s.useMemo((()=>M(c.map((e=>e.passengers.length)))),[c]),x=g&&g.length,j=x>0?L(g[0].total_currency)(_):p?L(v)(0):"0",y=u&&d.findIndex((e=>e.id===(null==u?void 0:u.id))),C=null!=u&&u.name?u.name:y>=0?"Passenger ".concat(y+1):"";return(0,e.jsxs)(e.Fragment,{children:[(0,e.jsxs)("div",{className:"summary","data-testid":"seat-selection-summary",children:[(0,e.jsxs)("div",{className:"summary__description",children:[(0,e.jsx)("div",{className:"summary__description-title",children:"".concat(x," of ").concat(f," seat").concat(f>1?"s":""," selected")},void 0),(0,e.jsxs)("div",{className:"summary__description-cost",children:[j," will be added to the order"]},void 0)]},void 0),(0,e.jsx)(X,{onBackClick:r,onClick:n,iconAfter:i,primaryButtonCopy:a,disableBackButton:o},void 0)]},void 0),(0,e.jsxs)("div",{className:"summary summary--mobile",children:[(0,e.jsxs)("div",{className:"summary__segment",children:[Object.keys(m).length>0&&(0,e.jsx)(I,{segment:m},"summary-".concat(m.id)),C&&(0,e.jsx)("h3",{className:"summary__segment-passenger",children:C},void 0)]},void 0),(0,e.jsxs)("div",{className:"summary__description-cost",children:["Total Price ",(0,e.jsx)("strong",{children:j},void 0)]},void 0),(0,e.jsx)(X,{onBackClick:r,onClick:n,iconAfter:i,primaryButtonCopy:a,disableBackButton:o},void 0)]},void 0)]},void 0)},G=t=>{let{seatMaps:n,offer:a,passengers:i,initialSeatSelection:r,initialSegmentId:o,onSubmit:l,currencyConversion:c}=t;const u=i.sort(((e,s)=>e.id.localeCompare(s.id))),m=((e,s)=>{if(null!=s&&s.rate&&null!=s&&s.currency){const t=w()(e);return t.forEach((e=>e.cabins.forEach((e=>e.rows.forEach((e=>e.sections.forEach((e=>e.elements.forEach((e=>{"seat"===e.type&&e.available_services.map((e=>{e.total_amount=(parseInt(e.total_amount)*s.rate).toFixed(2).toString(),e.total_currency=s.currency}))})))))))))),t}return e})(n,c),[p,g]=s.useState("Next Passenger"),[h,_]=s.useState(""),[f,x]=s.useState(o||""),[j,y]=s.useState(""),[C,N]=s.useState(""),[L,M]=s.useState(r||{}),[R,V]=s.useState(i.length>0?u[0].id:""),B=a.slices.length>0&&a.slices[0],I=B&&B.segments.length>0&&B.segments[0].id,[O,Z]=s.useState(o||I||""),[P,A]=s.useState("default"),[T,J]=s.useState({seat:null,service:void 0}),[D,U]=s.useState(!0),[X,G]=s.useState([]);d().polyfill();const $=v(),K=s.useMemo((()=>a.slices.map((e=>e.segments)).flat().filter((e=>n.map((e=>e.segment_id)).includes(e.id)))),[a,n]),Q=s.useMemo((()=>u.map((e=>e.id)).sort(((e,s)=>e.localeCompare(s)))),[u]);s.useMemo((()=>{if(Object.keys(L).length<=0){const e=new Map(K.map((e=>{const s=new Map(e.passengers.map((e=>[e.passenger_id,null])));return[e.id,Object.fromEntries(new Map([...s.entries()].sort(((e,s)=>e[0].localeCompare(s[0])))))]}))),s=Object.fromEntries(e);s&&M(s)}}),[L,K]);const ee=s.useMemo((()=>K.find((e=>e.id===O))||{}),[K,O]);s.useEffect((()=>{const e=()=>{window.innerWidth<1024&&"small"!==P?A("small"):window.innerWidth>=1024&&"default"!==P&&A("default")};return window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)}),[P]),s.useEffect((()=>{const e=((e,s)=>Object.keys(s).reduce(((s,t)=>{const n=e.passengers;if(n){if(!(n.length>0)){const{[t]:e,...n}=s;return n}{const e=[];n.forEach((s=>{e.push(s.passenger_id)})),s={...s,[t]:e.sort(((e,s)=>e.localeCompare(s)))}}}return s}),{}))(ee,L),s=Object.keys(e),t=E(s,ee.id),n=e[O].indexOf(R),a=E(e[O],R),i=e[O][a],r=Object.keys(L).indexOf(O);return 0===s.length?g("Continue"):(y(i),n===ee.passengers.length-1?r===s.length-1?g("Continue"):(_(s[t]),g("Next Flight")):g("Next Passenger"))}),[ee,L,R,O]);const se=s.useMemo((()=>u.find((e=>{if(e.id===R)return{id:e.id,name:e.name||void 0}}))),[u,R]);if(0===u.length||!B||0===a.slices[0].segments.length)return null;const te=()=>{const e=Object.keys(L[O]);if(e[0]===R){U(!0),Z(f);const s=Object.keys(L[f])[e.length-1];V(s)}else{const e=Q.indexOf(R);0!==e&&V(Q[e-1])}const s=L[f][C],t=X.map((e=>e)).find((e=>e.segment===f&&e.seat.designator===(null==s?void 0:s.designator)));t&&J({seat:t.seat,service:t.service})};return(0,e.jsx)(q.Provider,{value:{offer:a,segments:K,seatMaps:m,passengers:u,segmentId:O,passengerId:R,currentSelectedPassenger:se,currentSelectedSegment:ee,seatSelection:L,size:P,onSelectSeat:e=>{const s=Object.assign({},L,{[O]:Object.assign({},L[O],{[R]:{...e}})});M(s)},onSelectPassenger:(e,s)=>{V(e),Z(s);const t=L[s]&&L[s][e];if(t&&null!==t.designator){const e=document.getElementById(t.designator);e&&!(e=>{const s=e.getBoundingClientRect(),t=Math.max(document.documentElement.clientHeight,window.innerHeight);return!(s.bottom<0||s.top-t>=0)})(e)&&(null==e||e.scrollIntoView({behavior:"smooth",block:"center"}))}},currentSeat:T,setCurrentSeat:J,setIsLoading:U,extendedSeatInfo:X,setExtendedSeatInfo:G,currency:null!=c&&c.currency&&null!=c&&c.rate?c.currency:a.total_currency},children:(0,e.jsx)("div",{className:"duffel-components",children:(0,e.jsxs)("div",{className:"seat-selection",children:[(0,e.jsxs)("div",{className:"seat-selection__content",children:[!S($)&&(0,e.jsx)("aside",{className:"seat-selection__content-child seat-selection__content-child--passengers",children:(0,e.jsx)(z,{},void 0)},void 0),(0,e.jsx)("div",{className:"seat-selection__content-child seat-selection__content-child--map",children:D?(()=>{const s=ee.origin.iata_code||"",t=ee.destination.iata_code||"",n=ee.duration&&(e=>{const s=e.match(k);if(!s)return e;const t=s[1]&&"0"!==s[1]?"".concat(s[1],"d"):"",n=s[2]&&"0"!==s[2]?"".concat(s[2].toString().padStart(2,"0"),"h"):"",a=s[3]&&"0"!==s[3]?"".concat(s[3].toString().padStart(2,"0"),"m"):"";return"".concat(t," ").concat(n," ").concat(a).trim()})(ee.duration)||"";return(0,e.jsx)(H,{origin:s,destination:t,duration:n,done:()=>U(!1)},void 0)})():(0,e.jsx)(b,{children:(0,e.jsx)(W,{},void 0)},void 0)},void 0)]},void 0),(()=>{const{seat:s,service:t}=T;return null!==s&&S($)&&L[O]&&null!==L[O][R]?(0,e.jsx)("div",{className:"seat-selection__mobile-seat-info",children:(0,e.jsx)(F,{seat:s,service:t},void 0)},void 0):null})(),(0,e.jsx)("div",{className:"seat-selection__confirmation",children:(()=>{const s=O===I&&R===u[0].id||!1;switch(p){case"Continue":return(0,e.jsx)(Y,{onClick:()=>{l(L),(()=>{const e=K[0];V(e.passengers[0].passenger_id),Z(e.id)})()},onBackClick:te,disableBackButton:s,primaryButtonCopy:p},void 0);case"Next Flight":return(0,e.jsx)(Y,{onClick:()=>{U(!0),x(O),V(j),Z(h)},onBackClick:te,disableBackButton:s,primaryButtonCopy:S($)?"Next":p,iconAfter:{iconAfter:"chevron"}},void 0);default:return(0,e.jsx)(Y,{onClick:()=>{N(R),V(j)},onBackClick:te,disableBackButton:s,iconAfter:{iconAfter:"chevron"},primaryButtonCopy:S($)?"Next":p},void 0)}})()},void 0)]},void 0)},void 0)},void 0)},$=s=>(0,e.jsx)(b,{children:(0,e.jsx)(G,{...s},void 0)},void 0);$.propTypes={offer:l().shape({allowed_passenger_identity_document_types:l().array.isRequired,available_services:l().array.isRequired,base_amount:l().string.isRequired,base_currency:l().string.isRequired,conditions:l().object.isRequired,created_at:l().string.isRequired,expires_at:l().string.isRequired,id:l().string.isRequired,live_mode:l().bool.isRequired,owner:l().shape({name:l().string.isRequired,id:l().string.isRequired,iata_code:l().string.isRequired}).isRequired,passenger_identity_documents_required:l().bool.isRequired,passengers:l().array.isRequired,payment_requirements:l().shape({payment_required_by:l().string,price_guarantee_expires_at:l().string,requires_instant_payment:l().bool.isRequired}).isRequired,slices:l().array.isRequired,tax_amount:l().string.isRequired,tax_currency:l().string.isRequired,total_amount:l().string.isRequired,total_emissions_kg:l().string.isRequired,total_currency:l().string.isRequired,updated_at:l().string.isRequired}).isRequired,seatMaps:l().arrayOf(l().shape({id:l().string.isRequired,slice_id:l().string.isRequired,segment_id:l().string.isRequired,cabins:l().array.isRequired}).isRequired).isRequired,passengers:l().arrayOf(l().shape({id:l().string.isRequired,name:l().string}).isRequired).isRequired,onSubmit:l().func.isRequired};const K=(s,t)=>{r().render((0,e.jsx)($,{...t},void 0),document.getElementById(s))}})();var a=exports;for(var i in n)a[i]=n[i];n.__esModule&&Object.defineProperty(a,"__esModule",{value:!0})})();
|