@movmo/express-checkout-button 0.1.2 → 0.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/dts/MovmoCheckoutButton.d.ts +1 -2
- package/dist/dts/api.d.ts +1 -4
- package/dist/dts/index.d.ts +0 -2
- package/dist/index.cjs.js +2 -2
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +3 -7
- 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,10 +1,7 @@
|
|
|
1
1
|
import { AxiosInstance } from "axios";
|
|
2
2
|
export declare const createAxiosClient: (apiKey: string, isProd?: boolean) => AxiosInstance;
|
|
3
|
-
export declare enum DataSource {
|
|
4
|
-
AMADEUS = "amadeus"
|
|
5
|
-
}
|
|
6
3
|
export interface FlightOfferRequest {
|
|
7
|
-
dataSource:
|
|
4
|
+
dataSource: string;
|
|
8
5
|
rawOffer: object;
|
|
9
6
|
}
|
|
10
7
|
export declare const saveFlightOffer: (payload: FlightOfferRequest, client: AxiosInstance) => Promise<string | null>;
|
package/dist/dts/index.d.ts
CHANGED
package/dist/index.cjs.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @movmo/express-checkout-button v0.1.
|
|
2
|
+
* @movmo/express-checkout-button v0.1.3
|
|
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 e=require("
|
|
7
|
+
"use strict";var e=require("react/jsx-runtime"),t=require("react"),n=require("axios");function o(e){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 ",t.innerHTML=`\n <iframe \n src="https://booking.e2e.movmo.io/booking?${e}"\n width="100%" \n height="100%" \n style="border: none;">\n </iframe>\n `,document.body.appendChild(t)}window.addEventListener("popstate",(()=>{const e=document.getElementById("movmo-checkout");!window.history.state?.checkoutOpen&&e&&e.remove()})),window.addEventListener("DOMContentLoaded",(()=>{if(window.location.pathname.startsWith("/movmo/checkout")){const e=window.location.search.substring(1);window.history.replaceState({checkoutOpen:!0},"",window.location.href),o(e)}}));!function(){if("undefined"!=typeof document){const e=document.createElement("link");e.href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap",e.rel="stylesheet",document.head.appendChild(e)}}(),exports.MovmoCheckoutButton=({customerId:i,apiKey:r,dataSource:a,flightOffer:s,isProd:c=!1})=>{const[d,u]=t.useState(!1),h=((e,t=!1)=>{const o=t?"https://api.movmo.io":"https://e2e.api.movmo.io";return n.create({baseURL:o,headers:{Accept:"application/json","Content-Type":"application/json","x-api-key":e},withCredentials:!0,timeout:3e4})})(r,c),m=`\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 ${d?"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 e.jsxs("button",{onClick:async()=>{const e={dataSource:a,rawOffer:s},t=await(async(e,t)=>await t.post("/v1/flight_offers",e).then((e=>e.data.id)).catch((e=>null)))(e,h);if(!t)return;const n=new URLSearchParams({offerId:t,airlineRef:i}).toString();window.history.pushState({checkoutOpen:!0},"",`/movmo/checkout?${n}`),o(n)},onMouseEnter:()=>u(!0),onMouseLeave:()=>u(!1),className:m,children:["Express Checkout",e.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/
|
|
1
|
+
{"version":3,"file":"index.cjs.js","sources":["../src/MovmoCheckoutOverlay.tsx","../src/index.ts","../src/MovmoCheckoutButton.tsx","../src/api.ts"],"sourcesContent":[null,null,null,null],"names":["showMovmoOverlay","queryParams","document","getElementById","container","createElement","id","style","cssText","innerHTML","body","appendChild","window","addEventListener","history","state","checkoutOpen","remove","location","pathname","startsWith","search","substring","replaceState","href","link","rel","head","loadInterFont","customerId","apiKey","dataSource","flightOffer","isProd","isHovered","setIsHovered","useState","client","baseUrl","axios","create","baseURL","headers","Accept","withCredentials","timeout","createAxiosClient","buttonClasses","trim","badgeClasses","_jsxs","onClick","async","payload","rawOffer","offerId","post","then","res","data","catch","err","saveFlightOffer","URLSearchParams","airlineRef","toString","pushState","onMouseEnter","onMouseLeave","className","children","_jsx"],"mappings":";;;;;;sFAAM,SAAUA,EAAiBC,GAC7B,GAAIC,SAASC,eAAe,kBAAmB,OAE/C,MAAMC,EAAYF,SAASG,cAAc,OACzCD,EAAUE,GAAK,iBACfF,EAAUG,MAAMC,QAAU,yKAU1BJ,EAAUK,UAAY,6EAE8BR,yHAOpDC,SAASQ,KAAKC,YAAYP,EAC9B,CAGAQ,OAAOC,iBAAiB,YAAY,KAChC,MAAMT,EAAYF,SAASC,eAAe,mBACrCS,OAAOE,QAAQC,OAAOC,cAAgBZ,GACvCA,EAAUa,YAKlBL,OAAOC,iBAAiB,oBAAoB,KAExC,GADoBD,OAAOM,SAASC,SAASC,WAAW,mBACvC,CACb,MAAMnB,EAAcW,OAAOM,SAASG,OAAOC,UAAU,GACrDV,OAAOE,QAAQS,aAAa,CAAEP,cAAc,GAAQ,GAAIJ,OAAOM,SAASM,MACxExB,EAAiBC,QCzCzB,WACI,GAAwB,oBAAbC,SAA0B,CACjC,MAAMuB,EAAOvB,SAASG,cAAc,QACpCoB,EAAKD,KAAO,mFACZC,EAAKC,IAAM,aACXxB,SAASyB,KAAKhB,YAAYc,GAElC,CAEAG,+BCKuE,EACnEC,aACAC,SACAC,aACAC,cACAC,UAAS,MAET,MAAOC,EAAWC,GAAgBC,EAAAA,UAAS,GACrCC,ECnBuB,EAACP,EAAgBG,GAAkB,KAChE,MAAMK,EAAUL,EAAS,uBAAyB,2BAclD,OAZeM,EAAMC,OAAO,CACxBC,QAASH,EACTI,QAAS,CACLC,OAAQ,mBACR,eAAgB,mBAChB,YAAab,GAGjBc,iBAAiB,EACjBC,QAAS,KAGA,EDIEC,CAAkBhB,EAAQG,GAsBnCc,EAAgB,sRAShBb,EAAY,oBAAsB,6BACtCc,OAEIC,EAAe,mHAMnBD,OAEF,OACIE,OACI,SAAA,CAAAC,QA1CYC,UAChB,MAAMC,EAA8B,CAChCtB,aACAuB,SAAUtB,GAERuB,OCFiBH,OAAOC,EAA6BhB,UAClDA,EAAOmB,KAAK,oBAAqBH,GACzCI,MAAMC,GAAQA,EAAIC,KAAKrD,KACvBsD,OAAOC,GAEG,ODHWC,CAAgBT,EAAShB,GAC/C,IAAKkB,EAED,OAGJ,MAAMtD,EAAc,IAAI8D,gBAAgB,CACpCR,UACAS,WAAYnC,IACboC,WAEHrD,OAAOE,QAAQoD,UAAU,CAAElD,cAAc,GAAQ,GAAI,mBAAmBf,KACxED,EAAiBC,EAAY,EA0BzBkE,aAAc,IAAMhC,GAAa,GACjCiC,aAAc,IAAMjC,GAAa,GACjCkC,UAAWtB,EAAauB,SAAA,CAAA,mBAGxBC,cAAMF,UAAWpB,EAEVqB,SAAA,YACF"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,22 +1,18 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @movmo/express-checkout-button v0.1.
|
|
2
|
+
* @movmo/express-checkout-button v0.1.3
|
|
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
7
|
import React from 'react';
|
|
8
8
|
|
|
9
|
-
declare enum DataSource {
|
|
10
|
-
AMADEUS = "amadeus"
|
|
11
|
-
}
|
|
12
|
-
|
|
13
9
|
interface MovmoCheckoutButtonProps {
|
|
14
10
|
customerId: string;
|
|
15
11
|
apiKey: string;
|
|
16
|
-
dataSource:
|
|
12
|
+
dataSource: "amadeus" | "sabre";
|
|
17
13
|
flightOffer: object;
|
|
18
14
|
isProd?: boolean;
|
|
19
15
|
}
|
|
20
16
|
declare const MovmoCheckoutButton: React.FC<MovmoCheckoutButtonProps>;
|
|
21
17
|
|
|
22
|
-
export {
|
|
18
|
+
export { MovmoCheckoutButton };
|
package/dist/index.es.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @movmo/express-checkout-button v0.1.
|
|
2
|
+
* @movmo/express-checkout-button v0.1.3
|
|
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
|
|
7
|
+
import{jsxs as e,jsx as t}from"react/jsx-runtime";import{useState as n}from"react";import o from"axios";function i(e){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 ",t.innerHTML=`\n <iframe \n src="https://booking.e2e.movmo.io/booking?${e}"\n width="100%" \n height="100%" \n style="border: none;">\n </iframe>\n `,document.body.appendChild(t)}window.addEventListener("popstate",(()=>{const e=document.getElementById("movmo-checkout");!window.history.state?.checkoutOpen&&e&&e.remove()})),window.addEventListener("DOMContentLoaded",(()=>{if(window.location.pathname.startsWith("/movmo/checkout")){const e=window.location.search.substring(1);window.history.replaceState({checkoutOpen:!0},"",window.location.href),i(e)}}));const r=({customerId:r,apiKey:a,dataSource:c,flightOffer:s,isProd:d=!1})=>{const[m,h]=n(!1),p=((e,t=!1)=>{const n=t?"https://api.movmo.io":"https://e2e.api.movmo.io";return o.create({baseURL:n,headers:{Accept:"application/json","Content-Type":"application/json","x-api-key":e},withCredentials:!0,timeout:3e4})})(a,d),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(),l="\n ml-2 px-2 py-1\n bg-white \n text-[#171412] \n rounded-md \n text-lg\n ".trim();return e("button",{onClick:async()=>{const e={dataSource:c,rawOffer:s},t=await(async(e,t)=>await t.post("/v1/flight_offers",e).then((e=>e.data.id)).catch((e=>null)))(e,p);if(!t)return;const n=new URLSearchParams({offerId:t,airlineRef:r}).toString();window.history.pushState({checkoutOpen:!0},"",`/movmo/checkout?${n}`),i(n)},onMouseEnter:()=>h(!0),onMouseLeave:()=>h(!1),className:u,children:["Express Checkout",t("span",{className:l,children:"Movmo"})]})};!function(){if("undefined"!=typeof document){const e=document.createElement("link");e.href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap",e.rel="stylesheet",document.head.appendChild(e)}}();export{r 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/
|
|
1
|
+
{"version":3,"file":"index.es.js","sources":["../src/MovmoCheckoutOverlay.tsx","../src/MovmoCheckoutButton.tsx","../src/api.ts","../src/index.ts"],"sourcesContent":[null,null,null,null],"names":["showMovmoOverlay","queryParams","document","getElementById","container","createElement","id","style","cssText","innerHTML","body","appendChild","window","addEventListener","history","state","checkoutOpen","remove","location","pathname","startsWith","search","substring","replaceState","href","MovmoCheckoutButton","customerId","apiKey","dataSource","flightOffer","isProd","isHovered","setIsHovered","useState","client","baseUrl","axios","create","baseURL","headers","Accept","withCredentials","timeout","createAxiosClient","buttonClasses","trim","badgeClasses","_jsxs","onClick","async","payload","rawOffer","offerId","post","then","res","data","catch","err","saveFlightOffer","URLSearchParams","airlineRef","toString","pushState","onMouseEnter","onMouseLeave","className","children","_jsx","link","rel","head","loadInterFont"],"mappings":";;;;;;wGAAM,SAAUA,EAAiBC,GAC7B,GAAIC,SAASC,eAAe,kBAAmB,OAE/C,MAAMC,EAAYF,SAASG,cAAc,OACzCD,EAAUE,GAAK,iBACfF,EAAUG,MAAMC,QAAU,yKAU1BJ,EAAUK,UAAY,6EAE8BR,yHAOpDC,SAASQ,KAAKC,YAAYP,EAC9B,CAGAQ,OAAOC,iBAAiB,YAAY,KAChC,MAAMT,EAAYF,SAASC,eAAe,mBACrCS,OAAOE,QAAQC,OAAOC,cAAgBZ,GACvCA,EAAUa,YAKlBL,OAAOC,iBAAiB,oBAAoB,KAExC,GADoBD,OAAOM,SAASC,SAASC,WAAW,mBACvC,CACb,MAAMnB,EAAcW,OAAOM,SAASG,OAAOC,UAAU,GACrDV,OAAOE,QAAQS,aAAa,CAAEP,cAAc,GAAQ,GAAIJ,OAAOM,SAASM,MACxExB,EAAiBC,OC3BZ,MAAAwB,EAA0D,EACnEC,aACAC,SACAC,aACAC,cACAC,UAAS,MAET,MAAOC,EAAWC,GAAgBC,GAAS,GACrCC,ECnBuB,EAACP,EAAgBG,GAAkB,KAChE,MAAMK,EAAUL,EAAS,uBAAyB,2BAclD,OAZeM,EAAMC,OAAO,CACxBC,QAASH,EACTI,QAAS,CACLC,OAAQ,mBACR,eAAgB,mBAChB,YAAab,GAGjBc,iBAAiB,EACjBC,QAAS,KAGA,EDIEC,CAAkBhB,EAAQG,GAsBnCc,EAAgB,sRAShBb,EAAY,oBAAsB,6BACtCc,OAEIC,EAAe,mHAMnBD,OAEF,OACIE,EACI,SAAA,CAAAC,QA1CYC,UAChB,MAAMC,EAA8B,CAChCtB,aACAuB,SAAUtB,GAERuB,OCFiBH,OAAOC,EAA6BhB,UAClDA,EAAOmB,KAAK,oBAAqBH,GACzCI,MAAMC,GAAQA,EAAIC,KAAKlD,KACvBmD,OAAOC,GAEG,ODHWC,CAAgBT,EAAShB,GAC/C,IAAKkB,EAED,OAGJ,MAAMnD,EAAc,IAAI2D,gBAAgB,CACpCR,UACAS,WAAYnC,IACboC,WAEHlD,OAAOE,QAAQiD,UAAU,CAAE/C,cAAc,GAAQ,GAAI,mBAAmBf,KACxED,EAAiBC,EAAY,EA0BzB+D,aAAc,IAAMhC,GAAa,GACjCiC,aAAc,IAAMjC,GAAa,GACjCkC,UAAWtB,EAAauB,SAAA,CAAA,mBAGxBC,UAAMF,UAAWpB,EAEVqB,SAAA,YACF,GE3EjB,WACI,GAAwB,oBAAbjE,SAA0B,CACjC,MAAMmE,EAAOnE,SAASG,cAAc,QACpCgE,EAAK7C,KAAO,mFACZ6C,EAAKC,IAAM,aACXpE,SAASqE,KAAK5D,YAAY0D,GAElC,CAEAG"}
|
package/package.json
CHANGED