@movmo/express-checkout-button 1.1.5 → 1.1.7
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/dts/api.d.ts +1 -1
- 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/dts/api.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { AxiosInstance } from 'axios';
|
|
2
|
-
export declare const createAxiosClient: (apiKey: string, isProd?: boolean) => AxiosInstance;
|
|
2
|
+
export declare const createAxiosClient: (apiKey: string, airlineRef: string, isProd?: boolean) => AxiosInstance;
|
|
3
3
|
export declare const saveProviderOffer: (providerID: string, rawOffer: object, client: AxiosInstance) => Promise<string | null>;
|
package/dist/index.cjs.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @movmo/express-checkout-button v1.1.
|
|
2
|
+
* @movmo/express-checkout-button v1.1.7
|
|
3
3
|
* React component plugin for embedding Movmo Express Checkout on airline websites.
|
|
4
4
|
* (c) 2025 Movmo
|
|
5
5
|
* @license MIT
|
|
6
6
|
*/
|
|
7
|
-
"use strict";var
|
|
7
|
+
"use strict";var o=require("react/jsx-runtime"),e=require("react"),t=require("axios");const n=(o,e,n=!1)=>{const i=`${n?"https://flights.movmo.io":"https://flights.e2e.movmo.io"}/v1/proxy`,r=t.create({baseURL:i,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 r.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})),r};function i(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=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),window.addEventListener("message",(o=>{const t=function(o,e){const t=["https://flights.movmo.io"],n=["https://flights.e2e.movmo.io","http://localhost:3000"];return e?t.includes(o):n.includes(o)}(o.origin,e);if(t&&"MOVMO_BOOKING_COMPLETE"===o.data?.type){const{bookingId:e,airlineRef:t,providerId:n}=o.data;e&&window.history.pushState({checkoutOpen:!0,bookingComplete:!0,bookingId:e,providerId:n},"",`/movmo/checkout/booking/${e}?airlineRef=${t||""}&providerId=${n||""}`)}}))}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){i(window.location.search.substring(1),function(){const o=window.location.hostname;return!o.includes("e2e")&&!o.includes("localhost")}())}}));exports.MovmoCheckoutButton=({iataCode:t,apiKey:r,providerID:s,flightOffer:c,flightOfferID:d,isProd:a=!1})=>{const[h,l]=e.useState(!1),m=n(r,t,a),u=`\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 `.trim(),p="\n ml-2 px-2 py-1\n bg-white \n text-[#171412] \n rounded-md \n text-lg\n ".trim();return o.jsxs("button",{onClick:async()=>{let o=d;if(!o&&c){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)))(s,c,m);if(!e)return;o=e}if(!o)return;const e=new URLSearchParams({offerId:o,providerId:s,airlineRef:t}).toString();window.history.pushState({checkoutOpen:!0},"",`/movmo/checkout?${e}`),i(e,a)},onMouseEnter:()=>l(!0),onMouseLeave:()=>l(!1),className:u,children:["Express Checkout",o.jsx("span",{className:p,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\nexport const createAxiosClient = (apiKey: string, isProd: boolean = false) => {\n // Use CloudFront distribution URLs to ensure X-Movmo-Proxy-Auth header is added\n const baseUrl = isProd ? 'https://flights.movmo.io' : 'https://flights.e2e.movmo.io';\n\n const client = axios.create({\n baseURL: baseUrl,\n headers: {\n Accept: 'application/json',\n 'Content-Type': 'application/json',\n 'x-api-key': apiKey,\n },\n // Allow cookies to be sent with requests\n withCredentials: true,\n timeout: 30000,\n });\n\n // Request interceptor to add CSRF token for authenticated requests\n client.interceptors.request.use((config) => {\n // Add CSRF token for CSRF protection\n // Read token from cookie (backend sets cookie with appropriate domain)\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","export 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\n const baseUrl = 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 // Setup communication channel with iframe\n window.addEventListener('message', (event) => {\n // Check if the origin is allowed\n const isAllowedOrigin = checkAllowedOrigin(event.origin, isProd);\n\n if (isAllowedOrigin && event.data?.type === 'MOVMO_BOOKING_COMPLETE') {\n const { bookingId, airlineRef, providerId } = event.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 }\n }\n });\n}\n\n/**\n * Check if an origin is allowed based on environment\n * - Production: Only flights.movmo.io is allowed\n * - Development: Allows flights.e2e.movmo.io and localhost:3000 only\n */\nfunction checkAllowedOrigin(origin: string, isProd: boolean): boolean {\n // Production origins (only used in production)\n const productionOrigins = ['https://flights.movmo.io'];\n\n // Development specific domains\n const devSpecificDomains = [\n 'https://flights.e2e.movmo.io',\n 'http://localhost:3000', // Specifically port 3000 for local development\n ];\n\n if (isProd) {\n // In production, only allow production origins\n return productionOrigins.includes(origin);\n } else {\n // In development, only allow development specific domains\n return devSpecificDomains.includes(origin);\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}\n\nexport const MovmoCheckoutButton: React.FC<MovmoCheckoutButtonProps> = ({\n iataCode,\n apiKey,\n providerID,\n flightOffer,\n flightOfferID,\n isProd = false,\n}) => {\n const [isHovered, setIsHovered] = useState(false);\n const client = createAxiosClient(apiKey, 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 `.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}>\n Movmo\n </span>\n </button>\n );\n};\n"],"names":["createAxiosClient","apiKey","isProd","baseUrl","client","axios","create","baseURL","headers","Accept","withCredentials","timeout","interceptors","request","use","config","token","name","cookies","document","cookie","split","i","length","trim","startsWith","decodeURIComponent","substring","getCookie","showMovmoOverlay","queryParams","getElementById","container","createElement","id","style","cssText","iframeUrl","window","location","pathname","includes","bookingId","pop","urlParams","URLSearchParams","search","get","history","replaceState","checkoutOpen","bookingComplete","href","iframe","src","width","height","border","appendChild","body","addEventListener","event","isAllowedOrigin","origin","productionOrigins","devSpecificDomains","checkAllowedOrigin","data","type","airlineRef","providerId","pushState","state","remove","isBookingConfirmation","isCheckoutPath","hostname","isProductionEnvironment","iataCode","providerID","flightOffer","flightOfferID","isHovered","setIsHovered","useState","buttonClasses","badgeClasses","_jsxs","onClick","async","offerId","savedOfferId","rawOffer","post","then","res","offer_id","catch","err","saveProviderOffer","toString","onMouseEnter","onMouseLeave","className","children","_jsx"],"mappings":";;;;;;sFAGA,MAaaA,EAAoB,CAACC,EAAgBC,GAAkB,KAElE,MAAMC,EAAUD,EAAS,2BAA6B,+BAEhDE,EAASC,EAAMC,OAAO,CAC1BC,QAASJ,EACTK,QAAS,CACPC,OAAQ,mBACR,eAAgB,mBAChB,YAAaR,GAGfS,iBAAiB,EACjBC,QAAS,MAeX,OAXAP,EAAOQ,aAAaC,QAAQC,KAAKC,IAG/B,MAAMC,EAjCQ,CAACC,IACjB,MACMC,EADeC,SAASC,OACDC,MAAM,KACnC,IAAK,IAAIC,EAAI,EAAGA,EAAIJ,EAAQK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EAGd,IAAKD,EAGD,OAGJ,MAAM5D,EAAc,IAAIe,gBAAgB,CACpC6C,UACApB,WAAYS,EACZV,WAAYS,IACbsB,WAEH9D,OAAOU,QAAQuB,UAAU,CAAErB,cAAc,GAAQ,GAAI,mBAAmBpB,KACxED,EAAiBC,EAAa5B,EAAO,EA0BjCmG,aAAc,IAAMlB,GAAa,GACjCmB,aAAc,IAAMnB,GAAa,GACjCoB,UAAWlB,EAAamB,SAAA,CAAA,mBAGxBC,cAAMF,UAAWjB,EAEVkB,SAAA,YACF"}
|
|
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 const proxyBaseUrl = `${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","export 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\n const baseUrl = 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 // Setup communication channel with iframe\n window.addEventListener('message', (event) => {\n // Check if the origin is allowed\n const isAllowedOrigin = checkAllowedOrigin(event.origin, isProd);\n\n if (isAllowedOrigin && event.data?.type === 'MOVMO_BOOKING_COMPLETE') {\n const { bookingId, airlineRef, providerId } = event.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 }\n }\n });\n}\n\n/**\n * Check if an origin is allowed based on environment\n * - Production: Only flights.movmo.io is allowed\n * - Development: Allows flights.e2e.movmo.io and localhost:3000 only\n */\nfunction checkAllowedOrigin(origin: string, isProd: boolean): boolean {\n // Production origins (only used in production)\n const productionOrigins = ['https://flights.movmo.io'];\n\n // Development specific domains\n const devSpecificDomains = [\n 'https://flights.e2e.movmo.io',\n 'http://localhost:3000', // Specifically port 3000 for local development\n ];\n\n if (isProd) {\n // In production, only allow production origins\n return productionOrigins.includes(origin);\n } else {\n // In development, only allow development specific domains\n return devSpecificDomains.includes(origin);\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}\n\nexport const MovmoCheckoutButton: React.FC<MovmoCheckoutButtonProps> = ({\n iataCode,\n apiKey,\n providerID,\n flightOffer,\n flightOfferID,\n isProd = false,\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 `.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","proxyBaseUrl","client","axios","create","baseURL","headers","Accept","window","location","host","hostname","process","env","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","showMovmoOverlay","queryParams","getElementById","container","createElement","id","style","cssText","baseUrl","iframeUrl","pathname","includes","bookingId","pop","urlParams","URLSearchParams","search","get","history","replaceState","checkoutOpen","bookingComplete","href","iframe","src","width","height","border","appendChild","body","addEventListener","event","isAllowedOrigin","origin","productionOrigins","devSpecificDomains","checkAllowedOrigin","data","type","providerId","pushState","state","remove","isBookingConfirmation","isCheckoutPath","isProductionEnvironment","iataCode","providerID","flightOffer","flightOfferID","isHovered","setIsHovered","useState","buttonClasses","badgeClasses","_jsxs","onClick","async","offerId","savedOfferId","rawOffer","post","then","res","offer_id","catch","err","saveProviderOffer","toString","onMouseEnter","onMouseLeave","className","children","_jsx"],"mappings":";;;;;;sFAGA,MAiBaA,EAAoB,CAACC,EAAgBC,EAAoBC,GAAkB,KACtF,MACMC,EAAe,GADLD,EAAS,2BAA6B,0CAGhDE,EAASC,EAAMC,OAAO,CAC1BC,QAASJ,EACTK,QAAS,CACPC,OAAQ,mBACR,eAAgB,mBAChB,YAAaT,EACb,mBAAsC,oBAAXU,OAAyBA,OAAOC,SAASC,KAAO,GAC3E,oBAAqBX,KAdP,oBAAXS,QACuB,cAA7BA,OAAOC,SAASE,UAAyD,cAA7BH,OAAOC,SAASE,WAcpCC,QAAQC,IAAIC,0CAE7B,GADA,CAAE,qBAAsBF,QAAQC,IAAIC,4CAG1CC,iBAAiB,EACjBC,QAAS,MAeX,OAZAd,EAAOe,aAAaC,QAAQC,KAAKC,IAC3BA,EAAOd,SAASe,sBACXD,EA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K,yBAAyBd,WAAqBa,GACnDE,MAAMC,GAAQA,EAAI1B,KAAK2B,WACvBC,OAAOC,GAEC,OElCoBC,CAAkBpB,EAAYC,EAAajF,GACtE,IAAK4F,EAEH,OAEFD,EAAUC,EAGZ,IAAKD,EAGH,OAGF,MAAMzD,EAAc,IAAIc,gBAAgB,CACtC2C,UACAnB,WAAYQ,EACZnF,WAAYkF,IACXsB,WAEH/F,OAAO6C,QAAQsB,UAAU,CAAEpB,cAAc,GAAQ,GAAI,mBAAmBnB,KACxED,EAAiBC,EAAapC,EAAO,EA0BnCwG,aAAc,IAAMlB,GAAa,GACjCmB,aAAc,IAAMnB,GAAa,GACjCoB,UAAWlB,EAAamB,SAAA,CAAA,mBAGxBC,cAAMF,UAAWjB,EAA0BkB,SAAA,YACpC"}
|
package/dist/index.d.ts
CHANGED
package/dist/index.es.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @movmo/express-checkout-button v1.1.
|
|
2
|
+
* @movmo/express-checkout-button v1.1.7
|
|
3
3
|
* React component plugin for embedding Movmo Express Checkout on airline websites.
|
|
4
4
|
* (c) 2025 Movmo
|
|
5
5
|
* @license MIT
|
|
6
6
|
*/
|
|
7
|
-
import{jsxs as o,jsx as
|
|
7
|
+
import{jsxs as o,jsx as e}from"react/jsx-runtime";import{useState as t}from"react";import n from"axios";const i=(o,e,t=!1)=>{const i=`${t?"https://flights.movmo.io":"https://flights.e2e.movmo.io"}/v1/proxy`,r=n.create({baseURL:i,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 r.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})),r};function r(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=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),window.addEventListener("message",(o=>{const t=function(o,e){const t=["https://flights.movmo.io"],n=["https://flights.e2e.movmo.io","http://localhost:3000"];return e?t.includes(o):n.includes(o)}(o.origin,e);if(t&&"MOVMO_BOOKING_COMPLETE"===o.data?.type){const{bookingId:e,airlineRef:t,providerId:n}=o.data;e&&window.history.pushState({checkoutOpen:!0,bookingComplete:!0,bookingId:e,providerId:n},"",`/movmo/checkout/booking/${e}?airlineRef=${t||""}&providerId=${n||""}`)}}))}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){r(window.location.search.substring(1),function(){const o=window.location.hostname;return!o.includes("e2e")&&!o.includes("localhost")}())}}));const s=({iataCode:n,apiKey:s,providerID:c,flightOffer:d,flightOfferID:a,isProd:h=!1})=>{const[m,l]=t(!1),p=i(s,n,h),u=`\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 ${m?"bg-gradient-hover":"bg-gradient-normal"}\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&&d){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)))(c,d,p);if(!e)return;o=e}if(!o)return;const e=new URLSearchParams({offerId:o,providerId:c,airlineRef:n}).toString();window.history.pushState({checkoutOpen:!0},"",`/movmo/checkout?${e}`),r(e,h)},onMouseEnter:()=>l(!0),onMouseLeave:()=>l(!1),className:u,children:["Express Checkout",e("span",{className:f,children:"Movmo"})]})};export{s 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\nexport const createAxiosClient = (apiKey: string, isProd: boolean = false) => {\n // Use CloudFront distribution URLs to ensure X-Movmo-Proxy-Auth header is added\n const baseUrl = isProd ? 'https://flights.movmo.io' : 'https://flights.e2e.movmo.io';\n\n const client = axios.create({\n baseURL: baseUrl,\n headers: {\n Accept: 'application/json',\n 'Content-Type': 'application/json',\n 'x-api-key': apiKey,\n },\n // Allow cookies to be sent with requests\n withCredentials: true,\n timeout: 30000,\n });\n\n // Request interceptor to add CSRF token for authenticated requests\n client.interceptors.request.use((config) => {\n // Add CSRF token for CSRF protection\n // Read token from cookie (backend sets cookie with appropriate domain)\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","export 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\n const baseUrl = 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 // Setup communication channel with iframe\n window.addEventListener('message', (event) => {\n // Check if the origin is allowed\n const isAllowedOrigin = checkAllowedOrigin(event.origin, isProd);\n\n if (isAllowedOrigin && event.data?.type === 'MOVMO_BOOKING_COMPLETE') {\n const { bookingId, airlineRef, providerId } = event.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 }\n }\n });\n}\n\n/**\n * Check if an origin is allowed based on environment\n * - Production: Only flights.movmo.io is allowed\n * - Development: Allows flights.e2e.movmo.io and localhost:3000 only\n */\nfunction checkAllowedOrigin(origin: string, isProd: boolean): boolean {\n // Production origins (only used in production)\n const productionOrigins = ['https://flights.movmo.io'];\n\n // Development specific domains\n const devSpecificDomains = [\n 'https://flights.e2e.movmo.io',\n 'http://localhost:3000', // Specifically port 3000 for local development\n ];\n\n if (isProd) {\n // In production, only allow production origins\n return productionOrigins.includes(origin);\n } else {\n // In development, only allow development specific domains\n return devSpecificDomains.includes(origin);\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}\n\nexport const MovmoCheckoutButton: React.FC<MovmoCheckoutButtonProps> = ({\n iataCode,\n apiKey,\n providerID,\n flightOffer,\n flightOfferID,\n isProd = false,\n}) => {\n const [isHovered, setIsHovered] = useState(false);\n const client = createAxiosClient(apiKey, 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 `.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}>\n Movmo\n </span>\n </button>\n );\n};\n"],"names":["createAxiosClient","apiKey","isProd","baseUrl","client","axios","create","baseURL","headers","Accept","withCredentials","timeout","interceptors","request","use","config","token","name","cookies","document","cookie","split","i","length","trim","startsWith","decodeURIComponent","substring","getCookie","showMovmoOverlay","queryParams","getElementById","container","createElement","id","style","cssText","iframeUrl","window","location","pathname","includes","bookingId","pop","urlParams","URLSearchParams","search","get","history","replaceState","checkoutOpen","bookingComplete","href","iframe","src","width","height","border","appendChild","body","addEventListener","event","isAllowedOrigin","origin","productionOrigins","devSpecificDomains","checkAllowedOrigin","data","type","airlineRef","providerId","pushState","state","remove","isBookingConfirmation","isCheckoutPath","hostname","isProductionEnvironment","MovmoCheckoutButton","iataCode","providerID","flightOffer","flightOfferID","isHovered","setIsHovered","useState","buttonClasses","badgeClasses","_jsxs","onClick","async","offerId","savedOfferId","rawOffer","post","then","res","offer_id","catch","err","saveProviderOffer","toString","onMouseEnter","onMouseLeave","className","children","_jsx"],"mappings":";;;;;;wGAGA,MAaaA,EAAoB,CAACC,EAAgBC,GAAkB,KAElE,MAAMC,EAAUD,EAAS,2BAA6B,+BAEhDE,EAASC,EAAMC,OAAO,CAC1BC,QAASJ,EACTK,QAAS,CACPC,OAAQ,mBACR,eAAgB,mBAChB,YAAaR,GAGfS,iBAAiB,EACjBC,QAAS,MAeX,OAXAP,EAAOQ,aAAaC,QAAQC,KAAKC,IAG/B,MAAMC,EAjCQ,CAACC,IACjB,MACMC,EADeC,SAASC,OACDC,MAAM,KACnC,IAAK,IAAIC,EAAI,EAAGA,EAAIJ,EAAQK,OAAQD,IAAK,CACv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,OAGJ,MAAM7D,EAAc,IAAIe,gBAAgB,CACpC8C,UACArB,WAAYU,EACZX,WAAYU,IACbsB,WAEH/D,OAAOU,QAAQuB,UAAU,CAAErB,cAAc,GAAQ,GAAI,mBAAmBpB,KACxED,EAAiBC,EAAa5B,EAAO,EA0BjCoG,aAAc,IAAMlB,GAAa,GACjCmB,aAAc,IAAMnB,GAAa,GACjCoB,UAAWlB,EAAamB,SAAA,CAAA,mBAGxBC,UAAMF,UAAWjB,EAEVkB,SAAA,YACF"}
|
|
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 const proxyBaseUrl = `${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","export 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\n const baseUrl = 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 // Setup communication channel with iframe\n window.addEventListener('message', (event) => {\n // Check if the origin is allowed\n const isAllowedOrigin = checkAllowedOrigin(event.origin, isProd);\n\n if (isAllowedOrigin && event.data?.type === 'MOVMO_BOOKING_COMPLETE') {\n const { bookingId, airlineRef, providerId } = event.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 }\n }\n });\n}\n\n/**\n * Check if an origin is allowed based on environment\n * - Production: Only flights.movmo.io is allowed\n * - Development: Allows flights.e2e.movmo.io and localhost:3000 only\n */\nfunction checkAllowedOrigin(origin: string, isProd: boolean): boolean {\n // Production origins (only used in production)\n const productionOrigins = ['https://flights.movmo.io'];\n\n // Development specific domains\n const devSpecificDomains = [\n 'https://flights.e2e.movmo.io',\n 'http://localhost:3000', // Specifically port 3000 for local development\n ];\n\n if (isProd) {\n // In production, only allow production origins\n return productionOrigins.includes(origin);\n } else {\n // In development, only allow development specific domains\n return devSpecificDomains.includes(origin);\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}\n\nexport const MovmoCheckoutButton: React.FC<MovmoCheckoutButtonProps> = ({\n iataCode,\n apiKey,\n providerID,\n flightOffer,\n flightOfferID,\n isProd = false,\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 `.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","proxyBaseUrl","client","axios","create","baseURL","headers","Accept","window","location","host","hostname","process","env","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","showMovmoOverlay","queryParams","getElementById","container","createElement","id","style","cssText","baseUrl","iframeUrl","pathname","includes","bookingId","pop","urlParams","URLSearchParams","search","get","history","replaceState","checkoutOpen","bookingComplete","href","iframe","src","width","height","border","appendChild","body","addEventListener","event","isAllowedOrigin","origin","productionOrigins","devSpecificDomains","checkAllowedOrigin","data","type","providerId","pushState","state","remove","isBookingConfirmation","isCheckoutPath","isProductionEnvironment","MovmoCheckoutButton","iataCode","providerID","flightOffer","flightOfferID","isHovered","setIsHovered","useState","buttonClasses","badgeClasses","_jsxs","onClick","async","offerId","savedOfferId","rawOffer","post","then","res","offer_id","catch","err","saveProviderOffer","toString","onMouseEnter","onMouseLeave","className","children","_jsx"],"mappings":";;;;;;wGAGA,MAiBaA,EAAoB,CAACC,EAAgBC,EAAoBC,GAAkB,KACtF,MACMC,EAAe,GADLD,EAAS,2BAA6B,0CAGhDE,EAASC,EAAMC,OAAO,CAC1BC,QAASJ,EACTK,QAAS,CACPC,OAAQ,mBACR,eAAgB,mBAChB,YAAaT,EACb,mBAAsC,oBAAXU,OAAyBA,OAAOC,SAASC,KAAO,GAC3E,oBAAqBX,KAdP,oBAAXS,QACuB,cAA7BA,OAAOC,SAASE,UAAyD,cAA7BH,OAAOC,SAASE,WAcpCC,QAAQC,IAAIC,0CAE7B,GADA,CAAE,qBAAsBF,QAAQC,IAAIC,4CAG1CC,iBAAiB,EACjBC,QAAS,MAeX,OAZAd,EAAOe,aAAaC,QAAQC,KAAKC,IAC3BA,EAAOd,SAASe,sBACXD,EAAOd,Q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