@movmo/express-checkout-button 1.4.0 → 1.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs.js +2 -2
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.es.js +2 -2
- package/dist/index.es.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @movmo/express-checkout-button v1.
|
|
2
|
+
* @movmo/express-checkout-button v1.5.0
|
|
3
3
|
* React component plugin for embedding Movmo Express Checkout on airline websites.
|
|
4
4
|
* (c) 2026 Movmo
|
|
5
5
|
* @license MIT
|
|
6
6
|
*/
|
|
7
|
-
"use strict";var e=require("react/jsx-runtime"),o=require("react"),t=require("axios"),n=require("@movmo_app/types");const i=(e,o,n=!1)=>{const i=n?"https://flights.movmo.io":"https://flights.e2e.movmo.io",r=process.env.REACT_APP_MOVMO_CHECKOUT_API_URL||`${i}/v1/proxy`,s=t.create({baseURL:r,headers:{Accept:"application/json","Content-Type":"application/json","x-api-key":e,"X-Forwarded-Host":"undefined"!=typeof window?window.location.host:"","movmo-customer-id":o,..."undefined"==typeof window||"localhost"!==window.location.hostname&&"127.0.0.1"!==window.location.hostname||!process.env.REACT_APP_CLOUD_FRONT_PROXY_SECRET_HEADER?{}:{"X-Movmo-Proxy-Auth":process.env.REACT_APP_CLOUD_FRONT_PROXY_SECRET_HEADER}},withCredentials:!0,timeout:3e4});return s.interceptors.request.use((e=>{e.headers?.Authorization&&delete e.headers.Authorization;const o=(e=>{const o=document.cookie.split(";");for(let t=0;t<o.length;t++){const n=o[t].trim();if(n.startsWith(e+"="))return decodeURIComponent(n.substring(e.length+1))}return null})("movmo_csrf_token");return o&&(e.headers["X-CSRF-Token"]=o),e})),s};let r=!1,s=!1;function c(e){const o=[process.env.REACT_APP_MOVMO_CHECKOUT_URL];if(!n.isTrustedOrigin(e.origin,n.MOVMO_FLIGHTS_ORIGINS,{isProd:s,extraOrigins:o}))return;const t=e.data;if(t?.type)switch(t.type){case n.MovmoFrameMessageType.READY:{const o={type:n.MovmoFrameMessageType.INIT,parentOrigin:window.location.origin};e.source?.postMessage(o,e.origin);break}case n.MovmoFrameMessageType.BOOKING_COMPLETE:{const{bookingId:e,airlineRef:o,providerId:n}=t;e&&window.history.pushState({checkoutOpen:!0,bookingComplete:!0,bookingId:e,providerId:n},"",`/movmo/checkout/booking/${e}?airlineRef=${o||""}&providerId=${n||""}`);break}case n.MovmoFrameMessageType.BOOKING_FAILED:window.history.state?.checkoutOpen?window.history.back():document.getElementById("movmo-checkout")?.remove()}}function a(e,o=!1){if(document.getElementById("movmo-checkout"))return;const t=document.createElement("div");t.id="movmo-checkout",t.style.cssText="\n position: fixed;\n top: 0;\n left: 0;\n width: 100vw;\n height: 100vh;\n background: white;\n z-index: 9999;\n ";const n=process.env.REACT_APP_MOVMO_CHECKOUT_URL||(o?"https://flights.movmo.io":"https://flights.e2e.movmo.io");let i=`${n}/index.html#/booking?${e}`;if(window.location.pathname.includes("/movmo/checkout/booking/")){const e=window.location.pathname.split("/").pop(),o=new URLSearchParams(window.location.search);i=`${n}/index.html#/booking/${e}?airlineRef=${o.get("airlineRef")||""}&providerId=${o.get("providerId")||""}`,window.history.replaceState({checkoutOpen:!0,bookingComplete:!0},"",window.location.href)}const a=document.createElement("iframe");a.src=i,a.width="100%",a.height="100%",a.style.border="none",a.id="movmo-checkout-iframe",t.appendChild(a),document.body.appendChild(t),s=o,r||(window.addEventListener("message",c),r=!0)}window.addEventListener("popstate",(()=>{const e=document.getElementById("movmo-checkout");!window.history.state?.checkoutOpen&&e&&e.remove()})),"undefined"!=typeof window&&window.addEventListener("DOMContentLoaded",(()=>{const e=window.location.pathname.includes("/movmo/checkout/booking/"),o=window.location.pathname.startsWith("/movmo/checkout");if(e||o){a(window.location.search.substring(1),function(){const e=window.location.hostname;return!e.includes("e2e")&&!e.includes("localhost")}())}}));exports.MovmoCheckoutButton=({iataCode:t,apiKey:n,providerID:r,flightOffer:s,flightOfferID:c,isProd:d=!1,className:m})=>{const[h,
|
|
7
|
+
"use strict";var e=require("react/jsx-runtime"),o=require("react"),t=require("axios"),n=require("@movmo_app/types");const i=(e,o,n=!1)=>{const i=n?"https://flights.movmo.io":"https://flights.e2e.movmo.io",r=process.env.REACT_APP_MOVMO_CHECKOUT_API_URL||`${i}/v1/proxy`,s=t.create({baseURL:r,headers:{Accept:"application/json","Content-Type":"application/json","x-api-key":e,"X-Forwarded-Host":"undefined"!=typeof window?window.location.host:"","movmo-customer-id":o,..."undefined"==typeof window||"localhost"!==window.location.hostname&&"127.0.0.1"!==window.location.hostname||!process.env.REACT_APP_CLOUD_FRONT_PROXY_SECRET_HEADER?{}:{"X-Movmo-Proxy-Auth":process.env.REACT_APP_CLOUD_FRONT_PROXY_SECRET_HEADER}},withCredentials:!0,timeout:3e4});return s.interceptors.request.use((e=>{e.headers?.Authorization&&delete e.headers.Authorization;const o=(e=>{const o=document.cookie.split(";");for(let t=0;t<o.length;t++){const n=o[t].trim();if(n.startsWith(e+"="))return decodeURIComponent(n.substring(e.length+1))}return null})("movmo_csrf_token");return o&&(e.headers["X-CSRF-Token"]=o),e})),s};let r=!1,s=!1;function c(e){const o=[process.env.REACT_APP_MOVMO_CHECKOUT_URL];if(!n.isTrustedOrigin(e.origin,n.MOVMO_FLIGHTS_ORIGINS,{isProd:s,extraOrigins:o}))return;const t=e.data;if(t?.type)switch(t.type){case n.MovmoFrameMessageType.READY:{const o={type:n.MovmoFrameMessageType.INIT,parentOrigin:window.location.origin};e.source?.postMessage(o,e.origin);break}case n.MovmoFrameMessageType.BOOKING_COMPLETE:{const{bookingId:e,airlineRef:o,providerId:n}=t;e&&window.history.pushState({checkoutOpen:!0,bookingComplete:!0,bookingId:e,providerId:n},"",`/movmo/checkout/booking/${e}?airlineRef=${o||""}&providerId=${n||""}`);break}case n.MovmoFrameMessageType.BOOKING_FAILED:window.history.state?.checkoutOpen?window.history.back():document.getElementById("movmo-checkout")?.remove()}}function a(e,o=!1){if(document.getElementById("movmo-checkout"))return;const t=document.createElement("div");t.id="movmo-checkout",t.style.cssText="\n position: fixed;\n top: 0;\n left: 0;\n width: 100vw;\n height: 100vh;\n background: white;\n z-index: 9999;\n ";const n=process.env.REACT_APP_MOVMO_CHECKOUT_URL||(o?"https://flights.movmo.io":"https://flights.e2e.movmo.io");let i=`${n}/index.html#/booking?${e}`;if(window.location.pathname.includes("/movmo/checkout/booking/")){const e=window.location.pathname.split("/").pop(),o=new URLSearchParams(window.location.search);i=`${n}/index.html#/booking/${e}?airlineRef=${o.get("airlineRef")||""}&providerId=${o.get("providerId")||""}`,window.history.replaceState({checkoutOpen:!0,bookingComplete:!0},"",window.location.href)}const a=document.createElement("iframe");a.src=i,a.width="100%",a.height="100%",a.style.border="none",a.id="movmo-checkout-iframe",a.setAttribute("allow","storage-access"),t.appendChild(a),document.body.appendChild(t),s=o,r||(window.addEventListener("message",c),r=!0)}window.addEventListener("popstate",(()=>{const e=document.getElementById("movmo-checkout");!window.history.state?.checkoutOpen&&e&&e.remove()})),"undefined"!=typeof window&&window.addEventListener("DOMContentLoaded",(()=>{const e=window.location.pathname.includes("/movmo/checkout/booking/"),o=window.location.pathname.startsWith("/movmo/checkout");if(e||o){a(window.location.search.substring(1),function(){const e=window.location.hostname;return!e.includes("e2e")&&!e.includes("localhost")}())}}));exports.MovmoCheckoutButton=({iataCode:t,apiKey:n,providerID:r,flightOffer:s,flightOfferID:c,isProd:d=!1,className:m})=>{const[h,l]=o.useState(!1),u=i(n,t,d),p=`\n px-7 py-5 \n font-inter font-semibold text-lg \n rounded-xl \n text-white \n border-none\n cursor-pointer\n transition-all duration-200\n outline-none focus:ring-2 focus:ring-[#F63D68] focus:ring-opacity-50\n ${h?"bg-gradient-hover":"bg-gradient-normal"}\n ${m??""}\n `.trim(),w="\n ml-2 px-2 py-1\n bg-white \n text-[#171412] \n rounded-md \n text-lg\n ".trim();return e.jsxs("button",{onClick:async()=>{let e=c;if(!e&&s){const o=await(async(e,o,t)=>await t.post(`/v1/flights/providers/${e}/offers`,o).then((e=>e.data.offer_id)).catch((e=>null)))(r,s,u);if(!o)return;e=o}if(!e)return;const o=new URLSearchParams({offerId:e,providerId:r,airlineRef:t}).toString();window.history.pushState({checkoutOpen:!0},"",`/movmo/checkout?${o}`),a(o,d)},onMouseEnter:()=>l(!0),onMouseLeave:()=>l(!1),className:p,children:["Express Checkout",e.jsx("span",{className:w,children:"Movmo"})]})};
|
|
8
8
|
//# sourceMappingURL=index.cjs.js.map
|
package/dist/index.cjs.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs.js","sources":["../src/api.ts","../src/MovmoCheckoutOverlay.tsx","../src/MovmoCheckoutButton.tsx"],"sourcesContent":["import axios, { AxiosInstance } from 'axios';\n\n// Helper function to read cookie value from document.cookie\nconst getCookie = (name: string): string | null => {\n const cookieString = document.cookie;\n const cookies = cookieString.split(';');\n for (let i = 0; i < cookies.length; i++) {\n const cookie = cookies[i].trim();\n if (cookie.startsWith(name + '=')) {\n // URL-decode the cookie value to match what backend expects\n return decodeURIComponent(cookie.substring(name.length + 1));\n }\n }\n return null;\n};\n\nconst isLocalHost = () =>\n typeof window !== 'undefined' &&\n (window.location.hostname === 'localhost' || window.location.hostname === '127.0.0.1');\n\nexport const createAxiosClient = (apiKey: string, airlineRef: string, isProd: boolean = false) => {\n const baseUrl = isProd ? 'https://flights.movmo.io' : 'https://flights.e2e.movmo.io';\n // REACT_APP_MOVMO_CHECKOUT_API_URL overrides the API base (e.g. the offline demo\n // talks directly to the local monolith-api at http://localhost:8080, bypassing the\n // CloudFront /v1/proxy hop). Defaults are unchanged when the env var is unset.\n const proxyBaseUrl =\n process.env.REACT_APP_MOVMO_CHECKOUT_API_URL || `${baseUrl}/v1/proxy`;\n\n const client = axios.create({\n baseURL: proxyBaseUrl,\n headers: {\n Accept: 'application/json',\n 'Content-Type': 'application/json',\n 'x-api-key': apiKey,\n 'X-Forwarded-Host': typeof window !== 'undefined' ? window.location.host : '',\n 'movmo-customer-id': airlineRef,\n ...(isLocalHost() && process.env.REACT_APP_CLOUD_FRONT_PROXY_SECRET_HEADER\n ? { 'X-Movmo-Proxy-Auth': process.env.REACT_APP_CLOUD_FRONT_PROXY_SECRET_HEADER }\n : {}),\n },\n withCredentials: true,\n timeout: 30000,\n });\n\n client.interceptors.request.use((config) => {\n if (config.headers?.Authorization) {\n delete config.headers.Authorization;\n }\n const token = getCookie('movmo_csrf_token');\n if (token) {\n config.headers['X-CSRF-Token'] = token;\n }\n\n return config;\n });\n\n return client;\n};\n\nexport const saveProviderOffer = async (\n providerID: string,\n rawOffer: object,\n client: AxiosInstance,\n): Promise<string | null> => {\n return await client\n .post(`/v1/flights/providers/${providerID}/offers`, rawOffer)\n .then((res) => res.data.offer_id)\n .catch((err) => {\n console.error(err);\n return null;\n });\n};\n","import {\n MOVMO_FLIGHTS_ORIGINS,\n MovmoFrameMessage,\n MovmoFrameMessageType,\n MovmoInitMessage,\n isTrustedOrigin,\n} from '@movmo_app/types';\n\n// A single message listener for the page lifetime, attached on the first overlay open and\n// never re-added. Re-adding per call would stack orphaned listeners every time the overlay\n// is torn down and reopened — each would reply to READY (duplicate INIT handshakes the\n// iframe can't disambiguate) and push duplicate history entries on BOOKING_COMPLETE.\nlet messageListenerAttached = false;\nlet overlayIsProd = false;\n\nfunction handleIframeMessage(event: MessageEvent) {\n // Only ever trust messages from a Movmo flights-ui origin. REACT_APP_MOVMO_CHECKOUT_URL\n // widens the non-prod allowlist for the offline demo; prod keeps its hardcoded list.\n const extraOrigins = [process.env.REACT_APP_MOVMO_CHECKOUT_URL];\n if (\n !isTrustedOrigin(event.origin, MOVMO_FLIGHTS_ORIGINS, { isProd: overlayIsProd, extraOrigins })\n ) {\n return;\n }\n\n const data = event.data as MovmoFrameMessage | undefined;\n if (!data?.type) return;\n\n switch (data.type) {\n case MovmoFrameMessageType.READY: {\n // Handshake: reply with our origin so the iframe can target us directly on\n // subsequent messages instead of broadcasting to \"*\".\n const initMessage: MovmoInitMessage = {\n type: MovmoFrameMessageType.INIT,\n parentOrigin: window.location.origin,\n };\n (event.source as Window | null)?.postMessage(initMessage, event.origin);\n break;\n }\n case MovmoFrameMessageType.BOOKING_COMPLETE: {\n const { bookingId, airlineRef, providerId } = data;\n if (bookingId) {\n // Update the parent URL to reflect booking completion\n window.history.pushState(\n { checkoutOpen: true, bookingComplete: true, bookingId, providerId },\n '',\n `/movmo/checkout/booking/${bookingId}?airlineRef=${airlineRef || ''}&providerId=${providerId || ''}`,\n );\n } else {\n console.warn(\n '[movmo] BOOKING_COMPLETE received without a bookingId; leaving the overlay in place',\n );\n }\n break;\n }\n case MovmoFrameMessageType.BOOKING_FAILED: {\n // Dismiss the overlay so the user returns to the airline site to start a new search.\n // history.back() triggers the popstate cleanup below.\n if (window.history.state?.checkoutOpen) {\n window.history.back();\n } else {\n document.getElementById('movmo-checkout')?.remove();\n }\n break;\n }\n default: {\n console.warn('[movmo] ignoring unexpected message type from a trusted origin:', data.type);\n }\n }\n}\n\nexport function showMovmoOverlay(queryParams: string, isProd: boolean = false) {\n if (document.getElementById('movmo-checkout')) return;\n\n const container = document.createElement('div');\n container.id = 'movmo-checkout';\n container.style.cssText = `\n position: fixed;\n top: 0;\n left: 0;\n width: 100vw;\n height: 100vh;\n background: white;\n z-index: 9999;\n `;\n\n // Use production or development URL based on isProd flag. REACT_APP_MOVMO_CHECKOUT_URL\n // overrides both (e.g. the offline demo points the overlay at http://localhost:3000);\n // defaults are unchanged when the env var is unset.\n const baseUrl =\n process.env.REACT_APP_MOVMO_CHECKOUT_URL ||\n (isProd ? 'https://flights.movmo.io' : 'https://flights.e2e.movmo.io');\n\n // Load index.html explicitly and use hash routing to avoid CloudFront error response issues\n // This ensures we load a file that actually exists in S3, then let React Router handle navigation\n let iframeUrl = `${baseUrl}/index.html#/booking?${queryParams}`;\n\n // If the URL indicates we're on a booking confirmation page, load that instead\n if (window.location.pathname.includes('/movmo/checkout/booking/')) {\n const bookingId = window.location.pathname.split('/').pop();\n const urlParams = new URLSearchParams(window.location.search);\n const airlineRef = urlParams.get('airlineRef') || '';\n const providerId = urlParams.get('providerId') || '';\n\n // Direct the iframe to the booking confirmation page using hash routing\n iframeUrl = `${baseUrl}/index.html#/booking/${bookingId}?airlineRef=${airlineRef}&providerId=${providerId}`;\n\n // Ensure we maintain the checkout state\n window.history.replaceState(\n { checkoutOpen: true, bookingComplete: true },\n '',\n window.location.href,\n );\n }\n\n // Create iframe element imperatively to prevent XSS (APP-XSS-001 fix)\n const iframe = document.createElement('iframe');\n iframe.src = iframeUrl;\n iframe.width = '100%';\n iframe.height = '100%';\n iframe.style.border = 'none';\n iframe.id = 'movmo-checkout-iframe';\n\n container.appendChild(iframe);\n\n document.body.appendChild(container);\n\n // Keep the (single, page-lifetime) message listener's environment current, then attach\n // it exactly once. See handleIframeMessage above for why it's not re-added per call.\n overlayIsProd = isProd;\n if (!messageListenerAttached) {\n window.addEventListener('message', handleIframeMessage);\n messageListenerAttached = true;\n }\n}\n\n// Clean up when back button is used\nwindow.addEventListener('popstate', () => {\n const container = document.getElementById('movmo-checkout');\n if (!window.history.state?.checkoutOpen && container) {\n container.remove();\n }\n});\n\n/**\n * Determine if the current environment is production based on hostname\n * - Production: hostname contains neither 'e2e' nor 'localhost'\n * - Development/Testing: hostname contains 'e2e' or 'localhost'\n */\nfunction isProductionEnvironment(): boolean {\n const hostname = window.location.hostname;\n // Check if we're on production (neither e2e nor localhost)\n return !hostname.includes('e2e') && !hostname.includes('localhost');\n}\n\n// Handle page refresh or direct navigation to a booking confirmation URL\nif (typeof window !== 'undefined') {\n window.addEventListener('DOMContentLoaded', () => {\n const isBookingConfirmation = window.location.pathname.includes('/movmo/checkout/booking/');\n const isCheckoutPath = window.location.pathname.startsWith('/movmo/checkout');\n\n if (isBookingConfirmation || isCheckoutPath) {\n const queryParams = window.location.search.substring(1);\n const isProd = isProductionEnvironment();\n showMovmoOverlay(queryParams, isProd);\n }\n });\n}\n","import React, { useState } from 'react';\n\nimport { createAxiosClient, saveProviderOffer } from './api';\nimport { showMovmoOverlay } from './MovmoCheckoutOverlay';\n\ninterface MovmoCheckoutButtonProps {\n iataCode: string;\n apiKey: string;\n providerID: string;\n // TODO: support fare splitting\n flightOffer?: object;\n flightOfferID?: string;\n isProd?: boolean;\n className?: string;\n}\n\nexport const MovmoCheckoutButton: React.FC<MovmoCheckoutButtonProps> = ({\n iataCode,\n apiKey,\n providerID,\n flightOffer,\n flightOfferID,\n isProd = false,\n className,\n}) => {\n const [isHovered, setIsHovered] = useState(false);\n const client = createAxiosClient(apiKey, iataCode, isProd);\n\n const handleClick = async () => {\n let offerId = flightOfferID;\n\n // If no pre-saved offer ID, save the raw offer\n if (!offerId && flightOffer) {\n const savedOfferId = await saveProviderOffer(providerID, flightOffer, client);\n if (!savedOfferId) {\n // TODO: handle error by displaying a message to the user\n return;\n }\n offerId = savedOfferId;\n }\n\n if (!offerId) {\n // TODO: handle error - neither flightOfferID nor flightOffer provided\n console.error('Neither flightOfferID nor flightOffer provided');\n return;\n }\n\n const queryParams = new URLSearchParams({\n offerId,\n providerId: providerID,\n airlineRef: iataCode,\n }).toString();\n\n window.history.pushState({ checkoutOpen: true }, '', `/movmo/checkout?${queryParams}`);\n showMovmoOverlay(queryParams, isProd);\n };\n\n const buttonClasses = `\n px-7 py-5 \n font-inter font-semibold text-lg \n rounded-xl \n text-white \n border-none\n cursor-pointer\n transition-all duration-200\n outline-none focus:ring-2 focus:ring-[#F63D68] focus:ring-opacity-50\n ${isHovered ? 'bg-gradient-hover' : 'bg-gradient-normal'}\n ${className ?? ''}\n `.trim();\n\n const badgeClasses = `\n ml-2 px-2 py-1\n bg-white \n text-[#171412] \n rounded-md \n text-lg\n `.trim();\n\n return (\n <button\n onClick={handleClick}\n onMouseEnter={() => setIsHovered(true)}\n onMouseLeave={() => setIsHovered(false)}\n className={buttonClasses}\n >\n Express Checkout\n <span className={badgeClasses}>Movmo</span>\n </button>\n );\n};\n"],"names":["createAxiosClient","apiKey","airlineRef","isProd","baseUrl","proxyBaseUrl","process","env","REACT_APP_MOVMO_CHECKOUT_API_URL","client","axios","create","baseURL","headers","Accept","window","location","host","hostname","REACT_APP_CLOUD_FRONT_PROXY_SECRET_HEADER","withCredentials","timeout","interceptors","request","use","config","Authorization","token","name","cookies","document","cookie","split","i","length","trim","startsWith","decodeURIComponent","substring","getCookie","messageListenerAttached","overlayIsProd","handleIframeMessage","event","extraOrigins","REACT_APP_MOVMO_CHECKOUT_URL","isTrustedOrigin","origin","MOVMO_FLIGHTS_ORIGINS","data","type","MovmoFrameMessageType","READY","initMessage","INIT","parentOrigin","source","postMessage","BOOKING_COMPLETE","bookingId","providerId","history","pushState","checkoutOpen","bookingComplete","BOOKING_FAILED","state","back","getElementById","remove","showMovmoOverlay","queryParams","container","createElement","id","style","cssText","iframeUrl","pathname","includes","pop","urlParams","URLSearchParams","search","get","replaceState","href","iframe","src","width","height","border","appendChild","body","addEventListener","isBookingConfirmation","isCheckoutPath","isProductionEnvironment","iataCode","providerID","flightOffer","flightOfferID","className","isHovered","setIsHovered","useState","buttonClasses","badgeClasses","_jsxs","onClick","async","offerId","savedOfferId","rawOffer","post","then","res","offer_id","catch","err","saveProviderOffer","toString","onMouseEnter","onMouseLeave","children","_jsx"],"mappings":";;;;;;oHAGA,MAiBaA,EAAoB,CAACC,EAAgBC,EAAoBC,GAAkB,KACtF,MAAMC,EAAUD,EAAS,2BAA6B,+BAIhDE,EACJC,QAAQC,IAAIC,kCAAoC,GAAGJ,aAE/CK,EAASC,EAAMC,OAAO,CAC1BC,QAASP,EACTQ,QAAS,CACPC,OAAQ,mBACR,eAAgB,mBAChB,YAAab,EACb,mBAAsC,oBAAXc,OAAyBA,OAAOC,SAASC,KAAO,GAC3E,oBAAqBf,KAlBP,oBAAXa,QACuB,cAA7BA,OAAOC,SAASE,UAAyD,cA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heckoutOverlay.tsx","../src/MovmoCheckoutButton.tsx"],"sourcesContent":["import axios, { AxiosInstance } from 'axios';\n\n// Helper function to read cookie value from document.cookie\nconst getCookie = (name: string): string | null => {\n const cookieString = document.cookie;\n const cookies = cookieString.split(';');\n for (let i = 0; i < cookies.length; i++) {\n const cookie = cookies[i].trim();\n if (cookie.startsWith(name + '=')) {\n // URL-decode the cookie value to match what backend expects\n return decodeURIComponent(cookie.substring(name.length + 1));\n }\n }\n return null;\n};\n\nconst isLocalHost = () =>\n typeof window !== 'undefined' &&\n (window.location.hostname === 'localhost' || window.location.hostname === '127.0.0.1');\n\nexport const createAxiosClient = (apiKey: string, airlineRef: string, isProd: boolean = false) => {\n const baseUrl = isProd ? 'https://flights.movmo.io' : 'https://flights.e2e.movmo.io';\n // REACT_APP_MOVMO_CHECKOUT_API_URL overrides the API base (e.g. the offline demo\n // talks directly to the local monolith-api at http://localhost:8080, bypassing the\n // CloudFront /v1/proxy hop). Defaults are unchanged when the env var is unset.\n const proxyBaseUrl =\n process.env.REACT_APP_MOVMO_CHECKOUT_API_URL || `${baseUrl}/v1/proxy`;\n\n const client = axios.create({\n baseURL: proxyBaseUrl,\n headers: {\n Accept: 'application/json',\n 'Content-Type': 'application/json',\n 'x-api-key': apiKey,\n 'X-Forwarded-Host': typeof window !== 'undefined' ? window.location.host : '',\n 'movmo-customer-id': airlineRef,\n ...(isLocalHost() && process.env.REACT_APP_CLOUD_FRONT_PROXY_SECRET_HEADER\n ? { 'X-Movmo-Proxy-Auth': process.env.REACT_APP_CLOUD_FRONT_PROXY_SECRET_HEADER }\n : {}),\n },\n withCredentials: true,\n timeout: 30000,\n });\n\n client.interceptors.request.use((config) => {\n if (config.headers?.Authorization) {\n delete config.headers.Authorization;\n }\n const token = getCookie('movmo_csrf_token');\n if (token) {\n config.headers['X-CSRF-Token'] = token;\n }\n\n return config;\n });\n\n return client;\n};\n\nexport const saveProviderOffer = async (\n providerID: string,\n rawOffer: object,\n client: AxiosInstance,\n): Promise<string | null> => {\n return await client\n .post(`/v1/flights/providers/${providerID}/offers`, rawOffer)\n .then((res) => res.data.offer_id)\n .catch((err) => {\n console.error(err);\n return null;\n });\n};\n","import {\n MOVMO_FLIGHTS_ORIGINS,\n MovmoFrameMessage,\n MovmoFrameMessageType,\n MovmoInitMessage,\n isTrustedOrigin,\n} from '@movmo_app/types';\n\n// A single message listener for the page lifetime, attached on the first overlay open and\n// never re-added. Re-adding per call would stack orphaned listeners every time the overlay\n// is torn down and reopened — each would reply to READY (duplicate INIT handshakes the\n// iframe can't disambiguate) and push duplicate history entries on BOOKING_COMPLETE.\nlet messageListenerAttached = false;\nlet overlayIsProd = false;\n\nfunction handleIframeMessage(event: MessageEvent) {\n // Only ever trust messages from a Movmo flights-ui origin. REACT_APP_MOVMO_CHECKOUT_URL\n // widens the non-prod allowlist for the offline demo; prod keeps its hardcoded list.\n const extraOrigins = [process.env.REACT_APP_MOVMO_CHECKOUT_URL];\n if (\n !isTrustedOrigin(event.origin, MOVMO_FLIGHTS_ORIGINS, { isProd: overlayIsProd, extraOrigins })\n ) {\n return;\n }\n\n const data = event.data as MovmoFrameMessage | undefined;\n if (!data?.type) return;\n\n switch (data.type) {\n case MovmoFrameMessageType.READY: {\n // Handshake: reply with our origin so the iframe can target us directly on\n // subsequent messages instead of broadcasting to \"*\".\n const initMessage: MovmoInitMessage = {\n type: MovmoFrameMessageType.INIT,\n parentOrigin: window.location.origin,\n };\n (event.source as Window | null)?.postMessage(initMessage, event.origin);\n break;\n }\n case MovmoFrameMessageType.BOOKING_COMPLETE: {\n const { bookingId, airlineRef, providerId } = data;\n if (bookingId) {\n // Update the parent URL to reflect booking completion\n window.history.pushState(\n { checkoutOpen: true, bookingComplete: true, bookingId, providerId },\n '',\n `/movmo/checkout/booking/${bookingId}?airlineRef=${airlineRef || ''}&providerId=${providerId || ''}`,\n );\n } else {\n console.warn(\n '[movmo] BOOKING_COMPLETE received without a bookingId; leaving the overlay in place',\n );\n }\n break;\n }\n case MovmoFrameMessageType.BOOKING_FAILED: {\n // Dismiss the overlay so the user returns to the airline site to start a new search.\n // history.back() triggers the popstate cleanup below.\n if (window.history.state?.checkoutOpen) {\n window.history.back();\n } else {\n document.getElementById('movmo-checkout')?.remove();\n }\n break;\n }\n default: {\n console.warn('[movmo] ignoring unexpected message type from a trusted origin:', data.type);\n }\n }\n}\n\nexport function showMovmoOverlay(queryParams: string, isProd: boolean = false) {\n if (document.getElementById('movmo-checkout')) return;\n\n const container = document.createElement('div');\n container.id = 'movmo-checkout';\n container.style.cssText = `\n position: fixed;\n top: 0;\n left: 0;\n width: 100vw;\n height: 100vh;\n background: white;\n z-index: 9999;\n `;\n\n // Use production or development URL based on isProd flag. REACT_APP_MOVMO_CHECKOUT_URL\n // overrides both (e.g. the offline demo points the overlay at http://localhost:3000);\n // defaults are unchanged when the env var is unset.\n const baseUrl =\n process.env.REACT_APP_MOVMO_CHECKOUT_URL ||\n (isProd ? 'https://flights.movmo.io' : 'https://flights.e2e.movmo.io');\n\n // Load index.html explicitly and use hash routing to avoid CloudFront error response issues\n // This ensures we load a file that actually exists in S3, then let React Router handle navigation\n let iframeUrl = `${baseUrl}/index.html#/booking?${queryParams}`;\n\n // If the URL indicates we're on a booking confirmation page, load that instead\n if (window.location.pathname.includes('/movmo/checkout/booking/')) {\n const bookingId = window.location.pathname.split('/').pop();\n const urlParams = new URLSearchParams(window.location.search);\n const airlineRef = urlParams.get('airlineRef') || '';\n const providerId = urlParams.get('providerId') || '';\n\n // Direct the iframe to the booking confirmation page using hash routing\n iframeUrl = `${baseUrl}/index.html#/booking/${bookingId}?airlineRef=${airlineRef}&providerId=${providerId}`;\n\n // Ensure we maintain the checkout state\n window.history.replaceState(\n { checkoutOpen: true, bookingComplete: true },\n '',\n window.location.href,\n );\n }\n\n // Create iframe element imperatively to prevent XSS (APP-XSS-001 fix)\n const iframe = document.createElement('iframe');\n iframe.src = iframeUrl;\n iframe.width = '100%';\n iframe.height = '100%';\n iframe.style.border = 'none';\n iframe.id = 'movmo-checkout-iframe';\n // Permit the embedded flights-ui document to call document.requestStorageAccess()\n // for cross-site Movmo recognition (MOVMO-427/429; the in-iframe request this\n // enables is MOVMO-428). WebKit rejects the request outright unless the\n // embedding iframe carries `allow=\"storage-access\"`.\n iframe.setAttribute('allow', 'storage-access');\n\n container.appendChild(iframe);\n\n document.body.appendChild(container);\n\n // Keep the (single, page-lifetime) message listener's environment current, then attach\n // it exactly once. See handleIframeMessage above for why it's not re-added per call.\n overlayIsProd = isProd;\n if (!messageListenerAttached) {\n window.addEventListener('message', handleIframeMessage);\n messageListenerAttached = true;\n }\n}\n\n// Clean up when back button is used\nwindow.addEventListener('popstate', () => {\n const container = document.getElementById('movmo-checkout');\n if (!window.history.state?.checkoutOpen && container) {\n container.remove();\n }\n});\n\n/**\n * Determine if the current environment is production based on hostname\n * - Production: hostname contains neither 'e2e' nor 'localhost'\n * - Development/Testing: hostname contains 'e2e' or 'localhost'\n */\nfunction isProductionEnvironment(): boolean {\n const hostname = window.location.hostname;\n // Check if we're on production (neither e2e nor localhost)\n return !hostname.includes('e2e') && !hostname.includes('localhost');\n}\n\n// Handle page refresh or direct navigation to a booking confirmation URL\nif (typeof window !== 'undefined') {\n window.addEventListener('DOMContentLoaded', () => {\n const isBookingConfirmation = window.location.pathname.includes('/movmo/checkout/booking/');\n const isCheckoutPath = window.location.pathname.startsWith('/movmo/checkout');\n\n if (isBookingConfirmation || isCheckoutPath) {\n const queryParams = window.location.search.substring(1);\n const isProd = isProductionEnvironment();\n showMovmoOverlay(queryParams, isProd);\n }\n });\n}\n","import React, { useState } from 'react';\n\nimport { createAxiosClient, saveProviderOffer } from './api';\nimport { showMovmoOverlay } from './MovmoCheckoutOverlay';\n\ninterface MovmoCheckoutButtonProps {\n iataCode: string;\n apiKey: string;\n providerID: string;\n // TODO: support fare splitting\n flightOffer?: object;\n flightOfferID?: string;\n isProd?: boolean;\n className?: string;\n}\n\nexport const MovmoCheckoutButton: React.FC<MovmoCheckoutButtonProps> = ({\n iataCode,\n apiKey,\n providerID,\n flightOffer,\n flightOfferID,\n isProd = false,\n className,\n}) => {\n const [isHovered, setIsHovered] = useState(false);\n const client = createAxiosClient(apiKey, iataCode, isProd);\n\n const handleClick = async () => {\n let offerId = flightOfferID;\n\n // If no pre-saved offer ID, save the raw offer\n if (!offerId && flightOffer) {\n const savedOfferId = await saveProviderOffer(providerID, flightOffer, client);\n if (!savedOfferId) {\n // TODO: handle error by displaying a message to the user\n return;\n }\n offerId = savedOfferId;\n }\n\n if (!offerId) {\n // TODO: handle error - neither flightOfferID nor flightOffer provided\n console.error('Neither flightOfferID nor flightOffer provided');\n return;\n }\n\n const queryParams = new URLSearchParams({\n offerId,\n providerId: providerID,\n airlineRef: iataCode,\n }).toString();\n\n window.history.pushState({ checkoutOpen: true }, '', `/movmo/checkout?${queryParams}`);\n showMovmoOverlay(queryParams, isProd);\n };\n\n const buttonClasses = `\n px-7 py-5 \n font-inter font-semibold text-lg \n rounded-xl \n text-white \n border-none\n cursor-pointer\n transition-all duration-200\n outline-none focus:ring-2 focus:ring-[#F63D68] focus:ring-opacity-50\n ${isHovered ? 'bg-gradient-hover' : 'bg-gradient-normal'}\n ${className ?? ''}\n `.trim();\n\n const badgeClasses = `\n ml-2 px-2 py-1\n bg-white \n text-[#171412] \n rounded-md \n text-lg\n `.trim();\n\n return (\n <button\n onClick={handleClick}\n onMouseEnter={() => setIsHovered(true)}\n onMouseLeave={() => setIsHovered(false)}\n className={buttonClasses}\n >\n Express Checkout\n <span className={badgeClasses}>Movmo</span>\n </button>\n );\n};\n"],"names":["createAxiosClient","apiKey","airlineRef","isProd","baseUrl","proxyBaseUrl","process","env","REACT_APP_MOVMO_CHECKOUT_API_URL","client","axios","create","baseURL","headers","Accept","window","location","host","hostname","REACT_APP_CLOUD_FRONT_PROXY_SECRET_HEADER","withCredentials","timeout","interceptors","request","use","config","Authorization","token","name","cookies","document","cookie","split","i","length","trim","startsWith","decodeURIComponent","substring","getCookie","messageListenerAttached","overlayIsProd","handleIframeMessage","event","extraOrigins","REACT_APP_MOVMO_CHECKOUT_URL","isTrustedOrigin","origin","MOVMO_FLIGHTS_ORIGINS","data","type","MovmoFrameMessageType","READY","initMessage","INIT","parentOrigin","source","postMessage","BOOKING_COMPLETE","bookingId","providerId","history","pushState","checkoutOpen","bookingComplete","BOOKING_FAILED","state","back","getElementById","remove","showMovmoOverlay","queryParams","container","createElement","id","style","cssText","iframeUrl","pathname","includes","pop","urlParams","URLSearchParams","search","get","replaceState","href","iframe","src","width","height","border","setAttribute","appendChild","body","addEventListener","isBookingConfirmation","isCheckoutPath","isProductionEnvironment","iataCode","providerID","flightOffer","flightOfferID","className","isHovered","setIsHovered","useState","buttonClasses","badgeClasses","_jsxs","onClick","async","offerId","savedOfferId","rawOffer","post","then","res","offer_id","catch","err","saveProviderOffer","toString","onMouseEnter","onMouseLeave","children","_jsx"],"mappings":";;;;;;oHAGA,MAiBaA,EAAoB,CAACC,EAAgBC,EAAoBC,GAAkB,KACtF,MAAMC,EAAUD,EAAS,2BAA6B,+BAIhDE,EACJC,QAAQC,IAAIC,kCAAoC,GAAGJ,aAE/CK,EAASC,EAAMC,OAAO,CAC1BC,QAASP,EACTQ,QAAS,CACPC,OAAQ,mBACR,eAAgB,mBAChB,YAAab,EACb,mBAAsC,oBAAXc,OAAyBA,OAAOC,SAASC,KAAO,GAC3E,oBAAqBf,KAlBP,oBAAXa,QACuB,cAA7BA,OAAOC,SAASE,UAAyD,cAA7BH,OAAOC,SAASE,WAkBpCZ,QAAQC,IAAIY,0CAE7B,GADA,CAAE,qBAAsBb,QAAQC,IAAIY,4CAG1CC,iBAAiB,EACjBC,QAAS,MAeX,OAZAZ,EAAOa,aAAaC,QAAQC,KAAKC,IAC3BA,EAAOZ,SAASa,sBACXD,EAAOZ,QAAQa,cAExB,MAAMC,EA7CQ,CAACC,IACjB,MACMC,EADeC,SAASC,OACDC,MAAM,KACnC,IAAK,IAAIC,EAAI,EAAGA,EAAIJ,EAAQK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C1JmE,EACrEC,WACAlG,SACAmG,aACAC,cACAC,gBACAnG,UAAS,EACToG,gBAEA,MAAOC,EAAWC,GAAgBC,EAAAA,UAAS,GACrCjG,EAAST,EAAkBC,EAAQkG,EAAUhG,GA+B7CwG,EAAgB,sRASdH,EAAY,oBAAsB,iCAClCD,GAAa,WACjBpE,OAEEyE,EAAe,mHAMjBzE,OAEJ,OACE0E,OAAA,SAAA,CACEC,QApDgBC,UAClB,IAAIC,EAAUV,EAGd,IAAKU,GAAWX,EAAa,CAC3B,MAAMY,OF0BqBF,OAC/BX,EACAc,EACAzG,UAEaA,EACV0G,KAAK,yBAAyBf,WAAqBc,GACnDE,MAAMC,GAAQA,EAAIpE,KAAKqE,WACvBC,OAAOC,GAEC,OEpCoBC,CAAkBrB,EAAYC,EAAa5F,GACtE,IAAKwG,EAEH,OAEFD,EAAUC,CACZ,CAEA,IAAKD,EAGH,OAGF,MAAMzC,EAAc,IAAIW,gBAAgB,CACtC8B,UACApD,WAAYwC,EACZlG,WAAYiG,IACXuB,WAEH3G,OAAO8C,QAAQC,UAAU,CAAEC,cAAc,GAAQ,GAAI,mBAAmBQ,KACxED,EAAiBC,EAAapE,EAAO,EA2BnCwH,aAAc,IAAMlB,GAAa,GACjCmB,aAAc,IAAMnB,GAAa,GACjCF,UAAWI,EAAakB,SAAA,CAAA,mBAGxBC,EAAAA,YAAMvB,UAAWK,EAAYiB,SAAA,YACtB"}
|
package/dist/index.d.ts
CHANGED
package/dist/index.es.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @movmo/express-checkout-button v1.
|
|
2
|
+
* @movmo/express-checkout-button v1.5.0
|
|
3
3
|
* React component plugin for embedding Movmo Express Checkout on airline websites.
|
|
4
4
|
* (c) 2026 Movmo
|
|
5
5
|
* @license MIT
|
|
6
6
|
*/
|
|
7
|
-
import{jsxs as o,jsx as e}from"react/jsx-runtime";import{useState as t}from"react";import n from"axios";import{isTrustedOrigin as i,MOVMO_FLIGHTS_ORIGINS as r,MovmoFrameMessageType as s}from"@movmo_app/types";const c=(o,e,t=!1)=>{const i=t?"https://flights.movmo.io":"https://flights.e2e.movmo.io",r=process.env.REACT_APP_MOVMO_CHECKOUT_API_URL||`${i}/v1/proxy`,s=n.create({baseURL:r,headers:{Accept:"application/json","Content-Type":"application/json","x-api-key":o,"X-Forwarded-Host":"undefined"!=typeof window?window.location.host:"","movmo-customer-id":e,..."undefined"==typeof window||"localhost"!==window.location.hostname&&"127.0.0.1"!==window.location.hostname||!process.env.REACT_APP_CLOUD_FRONT_PROXY_SECRET_HEADER?{}:{"X-Movmo-Proxy-Auth":process.env.REACT_APP_CLOUD_FRONT_PROXY_SECRET_HEADER}},withCredentials:!0,timeout:3e4});return s.interceptors.request.use((o=>{o.headers?.Authorization&&delete o.headers.Authorization;const e=(o=>{const e=document.cookie.split(";");for(let t=0;t<e.length;t++){const n=e[t].trim();if(n.startsWith(o+"="))return decodeURIComponent(n.substring(o.length+1))}return null})("movmo_csrf_token");return e&&(o.headers["X-CSRF-Token"]=e),o})),s};let a=!1,d=!1;function m(o){const e=[process.env.REACT_APP_MOVMO_CHECKOUT_URL];if(!i(o.origin,r,{isProd:d,extraOrigins:e}))return;const t=o.data;if(t?.type)switch(t.type){case s.READY:{const e={type:s.INIT,parentOrigin:window.location.origin};o.source?.postMessage(e,o.origin);break}case s.BOOKING_COMPLETE:{const{bookingId:o,airlineRef:e,providerId:n}=t;o&&window.history.pushState({checkoutOpen:!0,bookingComplete:!0,bookingId:o,providerId:n},"",`/movmo/checkout/booking/${o}?airlineRef=${e||""}&providerId=${n||""}`);break}case s.BOOKING_FAILED:window.history.state?.checkoutOpen?window.history.back():document.getElementById("movmo-checkout")?.remove()}}function h(o,e=!1){if(document.getElementById("movmo-checkout"))return;const t=document.createElement("div");t.id="movmo-checkout",t.style.cssText="\n position: fixed;\n top: 0;\n left: 0;\n width: 100vw;\n height: 100vh;\n background: white;\n z-index: 9999;\n ";const n=process.env.REACT_APP_MOVMO_CHECKOUT_URL||(e?"https://flights.movmo.io":"https://flights.e2e.movmo.io");let i=`${n}/index.html#/booking?${o}`;if(window.location.pathname.includes("/movmo/checkout/booking/")){const o=window.location.pathname.split("/").pop(),e=new URLSearchParams(window.location.search);i=`${n}/index.html#/booking/${o}?airlineRef=${e.get("airlineRef")||""}&providerId=${e.get("providerId")||""}`,window.history.replaceState({checkoutOpen:!0,bookingComplete:!0},"",window.location.href)}const r=document.createElement("iframe");r.src=i,r.width="100%",r.height="100%",r.style.border="none",r.id="movmo-checkout-iframe",t.appendChild(r),document.body.appendChild(t),d=e,a||(window.addEventListener("message",m),a=!0)}window.addEventListener("popstate",(()=>{const o=document.getElementById("movmo-checkout");!window.history.state?.checkoutOpen&&o&&o.remove()})),"undefined"!=typeof window&&window.addEventListener("DOMContentLoaded",(()=>{const o=window.location.pathname.includes("/movmo/checkout/booking/"),e=window.location.pathname.startsWith("/movmo/checkout");if(o||e){h(window.location.search.substring(1),function(){const o=window.location.hostname;return!o.includes("e2e")&&!o.includes("localhost")}())}}));const
|
|
7
|
+
import{jsxs as o,jsx as e}from"react/jsx-runtime";import{useState as t}from"react";import n from"axios";import{isTrustedOrigin as i,MOVMO_FLIGHTS_ORIGINS as r,MovmoFrameMessageType as s}from"@movmo_app/types";const c=(o,e,t=!1)=>{const i=t?"https://flights.movmo.io":"https://flights.e2e.movmo.io",r=process.env.REACT_APP_MOVMO_CHECKOUT_API_URL||`${i}/v1/proxy`,s=n.create({baseURL:r,headers:{Accept:"application/json","Content-Type":"application/json","x-api-key":o,"X-Forwarded-Host":"undefined"!=typeof window?window.location.host:"","movmo-customer-id":e,..."undefined"==typeof window||"localhost"!==window.location.hostname&&"127.0.0.1"!==window.location.hostname||!process.env.REACT_APP_CLOUD_FRONT_PROXY_SECRET_HEADER?{}:{"X-Movmo-Proxy-Auth":process.env.REACT_APP_CLOUD_FRONT_PROXY_SECRET_HEADER}},withCredentials:!0,timeout:3e4});return s.interceptors.request.use((o=>{o.headers?.Authorization&&delete o.headers.Authorization;const e=(o=>{const e=document.cookie.split(";");for(let t=0;t<e.length;t++){const n=e[t].trim();if(n.startsWith(o+"="))return decodeURIComponent(n.substring(o.length+1))}return null})("movmo_csrf_token");return e&&(o.headers["X-CSRF-Token"]=e),o})),s};let a=!1,d=!1;function m(o){const e=[process.env.REACT_APP_MOVMO_CHECKOUT_URL];if(!i(o.origin,r,{isProd:d,extraOrigins:e}))return;const t=o.data;if(t?.type)switch(t.type){case s.READY:{const e={type:s.INIT,parentOrigin:window.location.origin};o.source?.postMessage(e,o.origin);break}case s.BOOKING_COMPLETE:{const{bookingId:o,airlineRef:e,providerId:n}=t;o&&window.history.pushState({checkoutOpen:!0,bookingComplete:!0,bookingId:o,providerId:n},"",`/movmo/checkout/booking/${o}?airlineRef=${e||""}&providerId=${n||""}`);break}case s.BOOKING_FAILED:window.history.state?.checkoutOpen?window.history.back():document.getElementById("movmo-checkout")?.remove()}}function h(o,e=!1){if(document.getElementById("movmo-checkout"))return;const t=document.createElement("div");t.id="movmo-checkout",t.style.cssText="\n position: fixed;\n top: 0;\n left: 0;\n width: 100vw;\n height: 100vh;\n background: white;\n z-index: 9999;\n ";const n=process.env.REACT_APP_MOVMO_CHECKOUT_URL||(e?"https://flights.movmo.io":"https://flights.e2e.movmo.io");let i=`${n}/index.html#/booking?${o}`;if(window.location.pathname.includes("/movmo/checkout/booking/")){const o=window.location.pathname.split("/").pop(),e=new URLSearchParams(window.location.search);i=`${n}/index.html#/booking/${o}?airlineRef=${e.get("airlineRef")||""}&providerId=${e.get("providerId")||""}`,window.history.replaceState({checkoutOpen:!0,bookingComplete:!0},"",window.location.href)}const r=document.createElement("iframe");r.src=i,r.width="100%",r.height="100%",r.style.border="none",r.id="movmo-checkout-iframe",r.setAttribute("allow","storage-access"),t.appendChild(r),document.body.appendChild(t),d=e,a||(window.addEventListener("message",m),a=!0)}window.addEventListener("popstate",(()=>{const o=document.getElementById("movmo-checkout");!window.history.state?.checkoutOpen&&o&&o.remove()})),"undefined"!=typeof window&&window.addEventListener("DOMContentLoaded",(()=>{const o=window.location.pathname.includes("/movmo/checkout/booking/"),e=window.location.pathname.startsWith("/movmo/checkout");if(o||e){h(window.location.search.substring(1),function(){const o=window.location.hostname;return!o.includes("e2e")&&!o.includes("localhost")}())}}));const l=({iataCode:n,apiKey:i,providerID:r,flightOffer:s,flightOfferID:a,isProd:d=!1,className:m})=>{const[l,p]=t(!1),u=c(i,n,d),w=`\n px-7 py-5 \n font-inter font-semibold text-lg \n rounded-xl \n text-white \n border-none\n cursor-pointer\n transition-all duration-200\n outline-none focus:ring-2 focus:ring-[#F63D68] focus:ring-opacity-50\n ${l?"bg-gradient-hover":"bg-gradient-normal"}\n ${m??""}\n `.trim(),f="\n ml-2 px-2 py-1\n bg-white \n text-[#171412] \n rounded-md \n text-lg\n ".trim();return o("button",{onClick:async()=>{let o=a;if(!o&&s){const e=await(async(o,e,t)=>await t.post(`/v1/flights/providers/${o}/offers`,e).then((o=>o.data.offer_id)).catch((o=>null)))(r,s,u);if(!e)return;o=e}if(!o)return;const e=new URLSearchParams({offerId:o,providerId:r,airlineRef:n}).toString();window.history.pushState({checkoutOpen:!0},"",`/movmo/checkout?${e}`),h(e,d)},onMouseEnter:()=>p(!0),onMouseLeave:()=>p(!1),className:w,children:["Express Checkout",e("span",{className:f,children:"Movmo"})]})};export{l as MovmoCheckoutButton};
|
|
8
8
|
//# sourceMappingURL=index.es.js.map
|
package/dist/index.es.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.es.js","sources":["../src/api.ts","../src/MovmoCheckoutOverlay.tsx","../src/MovmoCheckoutButton.tsx"],"sourcesContent":["import axios, { AxiosInstance } from 'axios';\n\n// Helper function to read cookie value from document.cookie\nconst getCookie = (name: string): string | null => {\n const cookieString = document.cookie;\n const cookies = cookieString.split(';');\n for (let i = 0; i < cookies.length; i++) {\n const cookie = cookies[i].trim();\n if (cookie.startsWith(name + '=')) {\n // URL-decode the cookie value to match what backend expects\n return decodeURIComponent(cookie.substring(name.length + 1));\n }\n }\n return null;\n};\n\nconst isLocalHost = () =>\n typeof window !== 'undefined' &&\n (window.location.hostname === 'localhost' || window.location.hostname === '127.0.0.1');\n\nexport const createAxiosClient = (apiKey: string, airlineRef: string, isProd: boolean = false) => {\n const baseUrl = isProd ? 'https://flights.movmo.io' : 'https://flights.e2e.movmo.io';\n // REACT_APP_MOVMO_CHECKOUT_API_URL overrides the API base (e.g. the offline demo\n // talks directly to the local monolith-api at http://localhost:8080, bypassing the\n // CloudFront /v1/proxy hop). Defaults are unchanged when the env var is unset.\n const proxyBaseUrl =\n process.env.REACT_APP_MOVMO_CHECKOUT_API_URL || `${baseUrl}/v1/proxy`;\n\n const client = axios.create({\n baseURL: proxyBaseUrl,\n headers: {\n Accept: 'application/json',\n 'Content-Type': 'application/json',\n 'x-api-key': apiKey,\n 'X-Forwarded-Host': typeof window !== 'undefined' ? window.location.host : '',\n 'movmo-customer-id': airlineRef,\n ...(isLocalHost() && process.env.REACT_APP_CLOUD_FRONT_PROXY_SECRET_HEADER\n ? { 'X-Movmo-Proxy-Auth': process.env.REACT_APP_CLOUD_FRONT_PROXY_SECRET_HEADER }\n : {}),\n },\n withCredentials: true,\n timeout: 30000,\n });\n\n client.interceptors.request.use((config) => {\n if (config.headers?.Authorization) {\n delete config.headers.Authorization;\n }\n const token = getCookie('movmo_csrf_token');\n if (token) {\n config.headers['X-CSRF-Token'] = token;\n }\n\n return config;\n });\n\n return client;\n};\n\nexport const saveProviderOffer = async (\n providerID: string,\n rawOffer: object,\n client: AxiosInstance,\n): Promise<string | null> => {\n return await client\n .post(`/v1/flights/providers/${providerID}/offers`, rawOffer)\n .then((res) => res.data.offer_id)\n .catch((err) => {\n console.error(err);\n return null;\n });\n};\n","import {\n MOVMO_FLIGHTS_ORIGINS,\n MovmoFrameMessage,\n MovmoFrameMessageType,\n MovmoInitMessage,\n isTrustedOrigin,\n} from '@movmo_app/types';\n\n// A single message listener for the page lifetime, attached on the first overlay open and\n// never re-added. Re-adding per call would stack orphaned listeners every time the overlay\n// is torn down and reopened — each would reply to READY (duplicate INIT handshakes the\n// iframe can't disambiguate) and push duplicate history entries on BOOKING_COMPLETE.\nlet messageListenerAttached = false;\nlet overlayIsProd = false;\n\nfunction handleIframeMessage(event: MessageEvent) {\n // Only ever trust messages from a Movmo flights-ui origin. REACT_APP_MOVMO_CHECKOUT_URL\n // widens the non-prod allowlist for the offline demo; prod keeps its hardcoded list.\n const extraOrigins = [process.env.REACT_APP_MOVMO_CHECKOUT_URL];\n if (\n !isTrustedOrigin(event.origin, MOVMO_FLIGHTS_ORIGINS, { isProd: overlayIsProd, extraOrigins })\n ) {\n return;\n }\n\n const data = event.data as MovmoFrameMessage | undefined;\n if (!data?.type) return;\n\n switch (data.type) {\n case MovmoFrameMessageType.READY: {\n // Handshake: reply with our origin so the iframe can target us directly on\n // subsequent messages instead of broadcasting to \"*\".\n const initMessage: MovmoInitMessage = {\n type: MovmoFrameMessageType.INIT,\n parentOrigin: window.location.origin,\n };\n (event.source as Window | null)?.postMessage(initMessage, event.origin);\n break;\n }\n case MovmoFrameMessageType.BOOKING_COMPLETE: {\n const { bookingId, airlineRef, providerId } = data;\n if (bookingId) {\n // Update the parent URL to reflect booking completion\n window.history.pushState(\n { checkoutOpen: true, bookingComplete: true, bookingId, providerId },\n '',\n `/movmo/checkout/booking/${bookingId}?airlineRef=${airlineRef || ''}&providerId=${providerId || ''}`,\n );\n } else {\n console.warn(\n '[movmo] BOOKING_COMPLETE received without a bookingId; leaving the overlay in place',\n );\n }\n break;\n }\n case MovmoFrameMessageType.BOOKING_FAILED: {\n // Dismiss the overlay so the user returns to the airline site to start a new search.\n // history.back() triggers the popstate cleanup below.\n if (window.history.state?.checkoutOpen) {\n window.history.back();\n } else {\n document.getElementById('movmo-checkout')?.remove();\n }\n break;\n }\n default: {\n console.warn('[movmo] ignoring unexpected message type from a trusted origin:', data.type);\n }\n }\n}\n\nexport function showMovmoOverlay(queryParams: string, isProd: boolean = false) {\n if (document.getElementById('movmo-checkout')) return;\n\n const container = document.createElement('div');\n container.id = 'movmo-checkout';\n container.style.cssText = `\n position: fixed;\n top: 0;\n left: 0;\n width: 100vw;\n height: 100vh;\n background: white;\n z-index: 9999;\n `;\n\n // Use production or development URL based on isProd flag. REACT_APP_MOVMO_CHECKOUT_URL\n // overrides both (e.g. the offline demo points the overlay at http://localhost:3000);\n // defaults are unchanged when the env var is unset.\n const baseUrl =\n process.env.REACT_APP_MOVMO_CHECKOUT_URL ||\n (isProd ? 'https://flights.movmo.io' : 'https://flights.e2e.movmo.io');\n\n // Load index.html explicitly and use hash routing to avoid CloudFront error response issues\n // This ensures we load a file that actually exists in S3, then let React Router handle navigation\n let iframeUrl = `${baseUrl}/index.html#/booking?${queryParams}`;\n\n // If the URL indicates we're on a booking confirmation page, load that instead\n if (window.location.pathname.includes('/movmo/checkout/booking/')) {\n const bookingId = window.location.pathname.split('/').pop();\n const urlParams = new URLSearchParams(window.location.search);\n const airlineRef = urlParams.get('airlineRef') || '';\n const providerId = urlParams.get('providerId') || '';\n\n // Direct the iframe to the booking confirmation page using hash routing\n iframeUrl = `${baseUrl}/index.html#/booking/${bookingId}?airlineRef=${airlineRef}&providerId=${providerId}`;\n\n // Ensure we maintain the checkout state\n window.history.replaceState(\n { checkoutOpen: true, bookingComplete: true },\n '',\n window.location.href,\n );\n }\n\n // Create iframe element imperatively to prevent XSS (APP-XSS-001 fix)\n const iframe = document.createElement('iframe');\n iframe.src = iframeUrl;\n iframe.width = '100%';\n iframe.height = '100%';\n iframe.style.border = 'none';\n iframe.id = 'movmo-checkout-iframe';\n\n container.appendChild(iframe);\n\n document.body.appendChild(container);\n\n // Keep the (single, page-lifetime) message listener's environment current, then attach\n // it exactly once. See handleIframeMessage above for why it's not re-added per call.\n overlayIsProd = isProd;\n if (!messageListenerAttached) {\n window.addEventListener('message', handleIframeMessage);\n messageListenerAttached = true;\n }\n}\n\n// Clean up when back button is used\nwindow.addEventListener('popstate', () => {\n const container = document.getElementById('movmo-checkout');\n if (!window.history.state?.checkoutOpen && container) {\n container.remove();\n }\n});\n\n/**\n * Determine if the current environment is production based on hostname\n * - Production: hostname contains neither 'e2e' nor 'localhost'\n * - Development/Testing: hostname contains 'e2e' or 'localhost'\n */\nfunction isProductionEnvironment(): boolean {\n const hostname = window.location.hostname;\n // Check if we're on production (neither e2e nor localhost)\n return !hostname.includes('e2e') && !hostname.includes('localhost');\n}\n\n// Handle page refresh or direct navigation to a booking confirmation URL\nif (typeof window !== 'undefined') {\n window.addEventListener('DOMContentLoaded', () => {\n const isBookingConfirmation = window.location.pathname.includes('/movmo/checkout/booking/');\n const isCheckoutPath = window.location.pathname.startsWith('/movmo/checkout');\n\n if (isBookingConfirmation || isCheckoutPath) {\n const queryParams = window.location.search.substring(1);\n const isProd = isProductionEnvironment();\n showMovmoOverlay(queryParams, isProd);\n }\n });\n}\n","import React, { useState } from 'react';\n\nimport { createAxiosClient, saveProviderOffer } from './api';\nimport { showMovmoOverlay } from './MovmoCheckoutOverlay';\n\ninterface MovmoCheckoutButtonProps {\n iataCode: string;\n apiKey: string;\n providerID: string;\n // TODO: support fare splitting\n flightOffer?: object;\n flightOfferID?: string;\n isProd?: boolean;\n className?: string;\n}\n\nexport const MovmoCheckoutButton: React.FC<MovmoCheckoutButtonProps> = ({\n iataCode,\n apiKey,\n providerID,\n flightOffer,\n flightOfferID,\n isProd = false,\n className,\n}) => {\n const [isHovered, setIsHovered] = useState(false);\n const client = createAxiosClient(apiKey, iataCode, isProd);\n\n const handleClick = async () => {\n let offerId = flightOfferID;\n\n // If no pre-saved offer ID, save the raw offer\n if (!offerId && flightOffer) {\n const savedOfferId = await saveProviderOffer(providerID, flightOffer, client);\n if (!savedOfferId) {\n // TODO: handle error by displaying a message to the user\n return;\n }\n offerId = savedOfferId;\n }\n\n if (!offerId) {\n // TODO: handle error - neither flightOfferID nor flightOffer provided\n console.error('Neither flightOfferID nor flightOffer provided');\n return;\n }\n\n const queryParams = new URLSearchParams({\n offerId,\n providerId: providerID,\n airlineRef: iataCode,\n }).toString();\n\n window.history.pushState({ checkoutOpen: true }, '', `/movmo/checkout?${queryParams}`);\n showMovmoOverlay(queryParams, isProd);\n };\n\n const buttonClasses = `\n px-7 py-5 \n font-inter font-semibold text-lg \n rounded-xl \n text-white \n border-none\n cursor-pointer\n transition-all duration-200\n outline-none focus:ring-2 focus:ring-[#F63D68] focus:ring-opacity-50\n ${isHovered ? 'bg-gradient-hover' : 'bg-gradient-normal'}\n ${className ?? ''}\n `.trim();\n\n const badgeClasses = `\n ml-2 px-2 py-1\n bg-white \n text-[#171412] \n rounded-md \n text-lg\n `.trim();\n\n return (\n <button\n onClick={handleClick}\n onMouseEnter={() => setIsHovered(true)}\n onMouseLeave={() => setIsHovered(false)}\n className={buttonClasses}\n >\n Express Checkout\n <span className={badgeClasses}>Movmo</span>\n </button>\n );\n};\n"],"names":["createAxiosClient","apiKey","airlineRef","isProd","baseUrl","proxyBaseUrl","process","env","REACT_APP_MOVMO_CHECKOUT_API_URL","client","axios","create","baseURL","headers","Accept","window","location","host","hostname","REACT_APP_CLOUD_FRONT_PROXY_SECRET_HEADER","withCredentials","timeout","interceptors","request","use","config","Authorization","token","name","cookies","document","cookie","split","i","length","trim","startsWith","decodeURIComponent","substring","getCookie","messageListenerAttached","overlayIsProd","handleIframeMessage","event","extraOrigins","REACT_APP_MOVMO_CHECKOUT_URL","isTrustedOrigin","origin","MOVMO_FLIGHTS_ORIGINS","data","type","MovmoFrameMessageType","READY","initMessage","INIT","parentOrigin","source","postMessage","BOOKING_COMPLETE","bookingId","providerId","history","pushState","checkoutOpen","bookingComplete","BOOKING_FAILED","state","back","getElementById","remove","showMovmoOverlay","queryParams","container","createElement","id","style","cssText","iframeUrl","pathname","includes","pop","urlParams","URLSearchParams","search","get","replaceState","href","iframe","src","width","height","border","appendChild","body","addEventListener","isBookingConfirmation","isCheckoutPath","isProductionEnvironment","MovmoCheckoutButton","iataCode","providerID","flightOffer","flightOfferID","className","isHovered","setIsHovered","useState","buttonClasses","badgeClasses","_jsxs","onClick","async","offerId","savedOfferId","rawOffer","post","then","res","offer_id","catch","err","saveProviderOffer","toString","onMouseEnter","onMouseLeave","children","_jsx"],"mappings":";;;;;;iNAGA,MAiBaA,EAAoB,CAACC,EAAgBC,EAAoBC,GAAkB,KACtF,MAAMC,EAAUD,EAAS,2BAA6B,+BAIhDE,EACJC,QAAQC,IAAIC,kCAAoC,GAAGJ,aAE/CK,EAASC,EAAMC,OAAO,CAC1BC,QAASP,EACTQ,QAAS,CACPC,OAAQ,mBACR,eAAgB,mBAChB,YAAab,EACb,mBAAsC,oBAAXc,OAAyBA,OAAOC,SAASC,KAAO,GAC3E,oBAAqBf,KAlBP,oBAAXa,QACuB,cAA7BA,OAAOC,SAASE,UAAyD,cAA7BH,OAAOC,SAASE,WAkBpCZ,QAAQC,IAAIY,0CAE7B,GADA,CAAE,qBAAsBb,QAAQC,IAAIY,4CAG1CC,iBAAiB,EACjBC,QAAS,MAeX,OAZAZ,EAAOa,aAAaC,QAAQC,KAAKC,IAC3BA,EAAOZ,SAASa,sBACXD,EAAOZ,QAAQa,cAExB,MAAMC,EA7CQ,CAACC,IACjB,MACMC,EADeC,SAASC,OACDC,MAAM,KACnC,IAAK,IAAIC,EAAI,EAAGA,EAAIJ,EAAQK,OAAQD,IAAK,CACvC,MAAMF,EAASF,EAAQI,GAAGE,OAC1B,GAAIJ,EAAOK,WAAWR,EAAO,KAE3B,OAAOS,mBAAmBN,EAAOO,UAAUV,EAAKM,OAAS,GAE7D,CACA,OAAO,IAAI,EAmCKK,CAAU,oBAKxB,OAJIZ,IACFF,EAAOZ,QAAQ,gBAAkBc,GAG5BF,CAAM,IAGRhB,CAAM,EC5Cf,IAAI+B,GAA0B,EAC1BC,GAAgB,EAEpB,SAASC,EAAoBC,GAG3B,MAAMC,EAAe,CAACtC,QAAQC,IAAIsC,8BAClC,IACGC,EAAgBH,EAAMI,OAAQ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C,CAAkBrB,EAAYC,EAAa5F,GACtE,IAAKwG,EAEH,OAEFD,EAAUC,CACZ,CAEA,IAAKD,EAGH,OAGF,MAAMzC,EAAc,IAAIW,gBAAgB,CACtC8B,UACApD,WAAYwC,EACZlG,WAAYiG,IACXuB,WAEH3G,OAAO8C,QAAQC,UAAU,CAAEC,cAAc,GAAQ,GAAI,mBAAmBQ,KACxED,EAAiBC,EAAapE,EAAO,EA2BnCwH,aAAc,IAAMlB,GAAa,GACjCmB,aAAc,IAAMnB,GAAa,GACjCF,UAAWI,EAAakB,SAAA,CAAA,mBAGxBC,UAAMvB,UAAWK,EAAYiB,SAAA,YACtB"}
|
|
1
|
+
{"version":3,"file":"index.es.js","sources":["../src/api.ts","../src/MovmoCheckoutOverlay.tsx","../src/MovmoCheckoutButton.tsx"],"sourcesContent":["import axios, { AxiosInstance } from 'axios';\n\n// Helper function to read cookie value from document.cookie\nconst getCookie = (name: string): string | null => {\n const cookieString = document.cookie;\n const cookies = cookieString.split(';');\n for (let i = 0; i < cookies.length; i++) {\n const cookie = cookies[i].trim();\n if (cookie.startsWith(name + '=')) {\n // URL-decode the cookie value to match what backend expects\n return decodeURIComponent(cookie.substring(name.length + 1));\n }\n }\n return null;\n};\n\nconst isLocalHost = () =>\n typeof window !== 'undefined' &&\n (window.location.hostname === 'localhost' || window.location.hostname === '127.0.0.1');\n\nexport const createAxiosClient = (apiKey: string, airlineRef: string, isProd: boolean = false) => {\n const baseUrl = isProd ? 'https://flights.movmo.io' : 'https://flights.e2e.movmo.io';\n // REACT_APP_MOVMO_CHECKOUT_API_URL overrides the API base (e.g. the offline demo\n // talks directly to the local monolith-api at http://localhost:8080, bypassing the\n // CloudFront /v1/proxy hop). Defaults are unchanged when the env var is unset.\n const proxyBaseUrl =\n process.env.REACT_APP_MOVMO_CHECKOUT_API_URL || `${baseUrl}/v1/proxy`;\n\n const client = axios.create({\n baseURL: proxyBaseUrl,\n headers: {\n Accept: 'application/json',\n 'Content-Type': 'application/json',\n 'x-api-key': apiKey,\n 'X-Forwarded-Host': typeof window !== 'undefined' ? window.location.host : '',\n 'movmo-customer-id': airlineRef,\n ...(isLocalHost() && process.env.REACT_APP_CLOUD_FRONT_PROXY_SECRET_HEADER\n ? { 'X-Movmo-Proxy-Auth': process.env.REACT_APP_CLOUD_FRONT_PROXY_SECRET_HEADER }\n : {}),\n },\n withCredentials: true,\n timeout: 30000,\n });\n\n client.interceptors.request.use((config) => {\n if (config.headers?.Authorization) {\n delete config.headers.Authorization;\n }\n const token = getCookie('movmo_csrf_token');\n if (token) {\n config.headers['X-CSRF-Token'] = token;\n }\n\n return config;\n });\n\n return client;\n};\n\nexport const saveProviderOffer = async (\n providerID: string,\n rawOffer: object,\n client: AxiosInstance,\n): Promise<string | null> => {\n return await client\n .post(`/v1/flights/providers/${providerID}/offers`, rawOffer)\n .then((res) => res.data.offer_id)\n .catch((err) => {\n console.error(err);\n return null;\n });\n};\n","import {\n MOVMO_FLIGHTS_ORIGINS,\n MovmoFrameMessage,\n MovmoFrameMessageType,\n MovmoInitMessage,\n isTrustedOrigin,\n} from '@movmo_app/types';\n\n// A single message listener for the page lifetime, attached on the first overlay open and\n// never re-added. Re-adding per call would stack orphaned listeners every time the overlay\n// is torn down and reopened — each would reply to READY (duplicate INIT handshakes the\n// iframe can't disambiguate) and push duplicate history entries on BOOKING_COMPLETE.\nlet messageListenerAttached = false;\nlet overlayIsProd = false;\n\nfunction handleIframeMessage(event: MessageEvent) {\n // Only ever trust messages from a Movmo flights-ui origin. REACT_APP_MOVMO_CHECKOUT_URL\n // widens the non-prod allowlist for the offline demo; prod keeps its hardcoded list.\n const extraOrigins = [process.env.REACT_APP_MOVMO_CHECKOUT_URL];\n if (\n !isTrustedOrigin(event.origin, MOVMO_FLIGHTS_ORIGINS, { isProd: overlayIsProd, extraOrigins })\n ) {\n return;\n }\n\n const data = event.data as MovmoFrameMessage | undefined;\n if (!data?.type) return;\n\n switch (data.type) {\n case MovmoFrameMessageType.READY: {\n // Handshake: reply with our origin so the iframe can target us directly on\n // subsequent messages instead of broadcasting to \"*\".\n const initMessage: MovmoInitMessage = {\n type: MovmoFrameMessageType.INIT,\n parentOrigin: window.location.origin,\n };\n (event.source as Window | null)?.postMessage(initMessage, event.origin);\n break;\n }\n case MovmoFrameMessageType.BOOKING_COMPLETE: {\n const { bookingId, airlineRef, providerId } = data;\n if (bookingId) {\n // Update the parent URL to reflect booking completion\n window.history.pushState(\n { checkoutOpen: true, bookingComplete: true, bookingId, providerId },\n '',\n `/movmo/checkout/booking/${bookingId}?airlineRef=${airlineRef || ''}&providerId=${providerId || ''}`,\n );\n } else {\n console.warn(\n '[movmo] BOOKING_COMPLETE received without a bookingId; leaving the overlay in place',\n );\n }\n break;\n }\n case MovmoFrameMessageType.BOOKING_FAILED: {\n // Dismiss the overlay so the user returns to the airline site to start a new search.\n // history.back() triggers the popstate cleanup below.\n if (window.history.state?.checkoutOpen) {\n window.history.back();\n } else {\n document.getElementById('movmo-checkout')?.remove();\n }\n break;\n }\n default: {\n console.warn('[movmo] ignoring unexpected message type from a trusted origin:', data.type);\n }\n }\n}\n\nexport function showMovmoOverlay(queryParams: string, isProd: boolean = false) {\n if (document.getElementById('movmo-checkout')) return;\n\n const container = document.createElement('div');\n container.id = 'movmo-checkout';\n container.style.cssText = `\n position: fixed;\n top: 0;\n left: 0;\n width: 100vw;\n height: 100vh;\n background: white;\n z-index: 9999;\n `;\n\n // Use production or development URL based on isProd flag. REACT_APP_MOVMO_CHECKOUT_URL\n // overrides both (e.g. the offline demo points the overlay at http://localhost:3000);\n // defaults are unchanged when the env var is unset.\n const baseUrl =\n process.env.REACT_APP_MOVMO_CHECKOUT_URL ||\n (isProd ? 'https://flights.movmo.io' : 'https://flights.e2e.movmo.io');\n\n // Load index.html explicitly and use hash routing to avoid CloudFront error response issues\n // This ensures we load a file that actually exists in S3, then let React Router handle navigation\n let iframeUrl = `${baseUrl}/index.html#/booking?${queryParams}`;\n\n // If the URL indicates we're on a booking confirmation page, load that instead\n if (window.location.pathname.includes('/movmo/checkout/booking/')) {\n const bookingId = window.location.pathname.split('/').pop();\n const urlParams = new URLSearchParams(window.location.search);\n const airlineRef = urlParams.get('airlineRef') || '';\n const providerId = urlParams.get('providerId') || '';\n\n // Direct the iframe to the booking confirmation page using hash routing\n iframeUrl = `${baseUrl}/index.html#/booking/${bookingId}?airlineRef=${airlineRef}&providerId=${providerId}`;\n\n // Ensure we maintain the checkout state\n window.history.replaceState(\n { checkoutOpen: true, bookingComplete: true },\n '',\n window.location.href,\n );\n }\n\n // Create iframe element imperatively to prevent XSS (APP-XSS-001 fix)\n const iframe = document.createElement('iframe');\n iframe.src = iframeUrl;\n iframe.width = '100%';\n iframe.height = '100%';\n iframe.style.border = 'none';\n iframe.id = 'movmo-checkout-iframe';\n // Permit the embedded flights-ui document to call document.requestStorageAccess()\n // for cross-site Movmo recognition (MOVMO-427/429; the in-iframe request this\n // enables is MOVMO-428). WebKit rejects the request outright unless the\n // embedding iframe carries `allow=\"storage-access\"`.\n iframe.setAttribute('allow', 'storage-access');\n\n container.appendChild(iframe);\n\n document.body.appendChild(container);\n\n // Keep the (single, page-lifetime) message listener's environment current, then attach\n // it exactly once. See handleIframeMessage above for why it's not re-added per call.\n overlayIsProd = isProd;\n if (!messageListenerAttached) {\n window.addEventListener('message', handleIframeMessage);\n messageListenerAttached = true;\n }\n}\n\n// Clean up when back button is used\nwindow.addEventListener('popstate', () => {\n const container = document.getElementById('movmo-checkout');\n if (!window.history.state?.checkoutOpen && container) {\n container.remove();\n }\n});\n\n/**\n * Determine if the current environment is production based on hostname\n * - Production: hostname contains neither 'e2e' nor 'localhost'\n * - Development/Testing: hostname contains 'e2e' or 'localhost'\n */\nfunction isProductionEnvironment(): boolean {\n const hostname = window.location.hostname;\n // Check if we're on production (neither e2e nor localhost)\n return !hostname.includes('e2e') && !hostname.includes('localhost');\n}\n\n// Handle page refresh or direct navigation to a booking confirmation URL\nif (typeof window !== 'undefined') {\n window.addEventListener('DOMContentLoaded', () => {\n const isBookingConfirmation = window.location.pathname.includes('/movmo/checkout/booking/');\n const isCheckoutPath = window.location.pathname.startsWith('/movmo/checkout');\n\n if (isBookingConfirmation || isCheckoutPath) {\n const queryParams = window.location.search.substring(1);\n const isProd = isProductionEnvironment();\n showMovmoOverlay(queryParams, isProd);\n }\n });\n}\n","import React, { useState } from 'react';\n\nimport { createAxiosClient, saveProviderOffer } from './api';\nimport { showMovmoOverlay } from './MovmoCheckoutOverlay';\n\ninterface MovmoCheckoutButtonProps {\n iataCode: string;\n apiKey: string;\n providerID: string;\n // TODO: support fare splitting\n flightOffer?: object;\n flightOfferID?: string;\n isProd?: boolean;\n className?: string;\n}\n\nexport const MovmoCheckoutButton: React.FC<MovmoCheckoutButtonProps> = ({\n iataCode,\n apiKey,\n providerID,\n flightOffer,\n flightOfferID,\n isProd = false,\n className,\n}) => {\n const [isHovered, setIsHovered] = useState(false);\n const client = createAxiosClient(apiKey, iataCode, isProd);\n\n const handleClick = async () => {\n let offerId = flightOfferID;\n\n // If no pre-saved offer ID, save the raw offer\n if (!offerId && flightOffer) {\n const savedOfferId = await saveProviderOffer(providerID, flightOffer, client);\n if (!savedOfferId) {\n // TODO: handle error by displaying a message to the user\n return;\n }\n offerId = savedOfferId;\n }\n\n if (!offerId) {\n // TODO: handle error - neither flightOfferID nor flightOffer provided\n console.error('Neither flightOfferID nor flightOffer provided');\n return;\n }\n\n const queryParams = new URLSearchParams({\n offerId,\n providerId: providerID,\n airlineRef: iataCode,\n }).toString();\n\n window.history.pushState({ checkoutOpen: true }, '', `/movmo/checkout?${queryParams}`);\n showMovmoOverlay(queryParams, isProd);\n };\n\n const buttonClasses = `\n px-7 py-5 \n font-inter font-semibold text-lg \n rounded-xl \n text-white \n border-none\n cursor-pointer\n transition-all duration-200\n outline-none focus:ring-2 focus:ring-[#F63D68] focus:ring-opacity-50\n ${isHovered ? 'bg-gradient-hover' : 'bg-gradient-normal'}\n ${className ?? ''}\n `.trim();\n\n const badgeClasses = `\n ml-2 px-2 py-1\n bg-white \n text-[#171412] \n rounded-md \n text-lg\n `.trim();\n\n return (\n <button\n onClick={handleClick}\n onMouseEnter={() => setIsHovered(true)}\n onMouseLeave={() => setIsHovered(false)}\n className={buttonClasses}\n >\n Express Checkout\n <span className={badgeClasses}>Movmo</span>\n </button>\n );\n};\n"],"names":["createAxiosClient","apiKey","airlineRef","isProd","baseUrl","proxyBaseUrl","process","env","REACT_APP_MOVMO_CHECKOUT_API_URL","client","axios","create","baseURL","headers","Accept","window","location","host","hostname","REACT_APP_CLOUD_FRONT_PROXY_SECRET_HEADER","withCredentials","timeout","interceptors","request","use","config","Authorization","token","name","cookies","document","cookie","split","i","length","trim","startsWith","decodeURIComponent","substring","getCookie","messageListenerAttached","overlayIsProd","handleIframeMessage","event","extraOrigins","REACT_APP_MOVMO_CHECKOUT_URL","isTrustedOrigin","origin","MOVMO_FLIGHTS_ORIGINS","data","type","MovmoFrameMessageType","READY","initMessage","INIT","parentOrigin","source","postMessage","BOOKING_COMPLETE","bookingId","providerId","history","pushState","checkoutOpen","bookingComplete","BOOKING_FAILED","state","back","getElementById","remove","showMovmoOverlay","queryParams","container","createElement","id","style","cssText","iframeUrl","pathname","includes","pop","urlParams","URLSearchParams","search","get","replaceState","href","iframe","src","width","height","border","setAttribute","appendChild","body","addEventListener","isBookingConfirmation","isCheckoutPath","isProductionEnvironment","MovmoCheckoutButton","iataCode","providerID","flightOffer","flightOfferID","className","isHovered","setIsHovered","useState","buttonClasses","badgeClasses","_jsxs","onClick","async","offerId","savedOfferId","rawOffer","post","then","res","offer_id","catch","err","saveProviderOffer","toString","onMouseEnter","onMouseLeave","children","_jsx"],"mappings":";;;;;;iNAGA,MAiBaA,EAAoB,CAACC,EAAgBC,EAAoBC,GAAkB,KACtF,MAAMC,EAAUD,EAAS,2BAA6B,+BAIhDE,EACJC,QAAQC,IAAIC,kCAAoC,GAAGJ,aAE/CK,EAASC,EAAMC,OAAO,CAC1BC,QAASP,EACTQ,QAAS,C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