@movmo/express-checkout-button 0.1.1 → 0.1.2
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/index.d.ts +2 -1
- package/dist/index.cjs.js +2 -2
- package/dist/index.d.ts +1 -1
- package/dist/index.es.js +2 -2
- package/package.json +2 -2
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.2
|
|
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("axios"),t=require("react/jsx-runtime"),n=require("react");exports.DataSource=void 0,(exports.DataSource||(exports.DataSource={})).AMADEUS="amadeus";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]=n.useState(!1),h=((t,n=!1)=>{const o=n?"https://api.movmo.io":"https://e2e.api.movmo.io";return e.create({baseURL:o,headers:{Accept:"application/json","Content-Type":"application/json","x-api-key":t},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 t.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",t.jsx("span",{className:p,children:"Movmo"})]})};
|
|
8
8
|
//# sourceMappingURL=index.cjs.js.map
|
package/dist/index.d.ts
CHANGED
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.2
|
|
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
|
|
7
|
+
import e from"axios";import{jsxs as t,jsx as n}from"react/jsx-runtime";import{useState as o}from"react";var i;!function(e){e.AMADEUS="amadeus"}(i||(i={}));function r(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),r(e)}}));const a=({customerId:i,apiKey:a,dataSource:c,flightOffer:s,isProd:d=!1})=>{const[m,h]=o(!1),p=((t,n=!1)=>{const o=n?"https://api.movmo.io":"https://e2e.api.movmo.io";return e.create({baseURL:o,headers:{Accept:"application/json","Content-Type":"application/json","x-api-key":t},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 t("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:i}).toString();window.history.pushState({checkoutOpen:!0},"",`/movmo/checkout?${n}`),r(n)},onMouseEnter:()=>h(!0),onMouseLeave:()=>h(!1),className:u,children:["Express Checkout",n("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{i as DataSource,a as MovmoCheckoutButton};
|
|
8
8
|
//# sourceMappingURL=index.es.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@movmo/express-checkout-button",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2",
|
|
4
4
|
"description": "React component plugin for embedding Movmo Express Checkout on airline websites.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.cjs.js",
|
|
@@ -79,4 +79,4 @@
|
|
|
79
79
|
"url": "https://github.com/movmo-app/react-js-packages/issues"
|
|
80
80
|
},
|
|
81
81
|
"homepage": "https://github.com/movmo-app/react-js-packages/blob/main/packages/@movmo/express-checkout-button/README.md"
|
|
82
|
-
}
|
|
82
|
+
}
|