@movmo/express-checkout-button 0.1.3 → 0.1.4
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/README.md +102 -102
- package/dist/index.cjs.js +1 -1
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.es.js +1 -1
- package/dist/index.es.js.map +1 -1
- package/package.json +82 -82
package/README.md
CHANGED
|
@@ -1,102 +1,102 @@
|
|
|
1
|
-
# Movmo Express Checkout Button
|
|
2
|
-
|
|
3
|
-
A React component for integrating Movmo's Express Checkout functionality into airline websites.
|
|
4
|
-
|
|
5
|
-
## Installation
|
|
6
|
-
|
|
7
|
-
```bash
|
|
8
|
-
npm install @movmo/express-checkout-button
|
|
9
|
-
```
|
|
10
|
-
|
|
11
|
-
or
|
|
12
|
-
|
|
13
|
-
```bash
|
|
14
|
-
yarn add @movmo/express-checkout-button
|
|
15
|
-
```
|
|
16
|
-
|
|
17
|
-
## Usage
|
|
18
|
-
|
|
19
|
-
### Basic Example
|
|
20
|
-
|
|
21
|
-
```jsx
|
|
22
|
-
import React from 'react';
|
|
23
|
-
import { MovmoCheckoutButton } from '@movmo/express-checkout-button';
|
|
24
|
-
import { DataSource } from '@movmo/express-checkout-button';
|
|
25
|
-
|
|
26
|
-
function MyBookingPage() {
|
|
27
|
-
// Flight offer data retrieved from your booking system
|
|
28
|
-
const flightOffer = {
|
|
29
|
-
// Your flight offer data
|
|
30
|
-
};
|
|
31
|
-
|
|
32
|
-
return (
|
|
33
|
-
<div className="booking-page">
|
|
34
|
-
<h1>Complete your booking</h1>
|
|
35
|
-
|
|
36
|
-
<MovmoCheckoutButton
|
|
37
|
-
customerId="your-airline-id"
|
|
38
|
-
apiKey="your-movmo-api-key"
|
|
39
|
-
dataSource={DataSource.AMADEUS}
|
|
40
|
-
flightOffer={flightOffer}
|
|
41
|
-
isProd={false} // Set to true for production
|
|
42
|
-
/>
|
|
43
|
-
</div>
|
|
44
|
-
);
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
export default MyBookingPage;
|
|
48
|
-
```
|
|
49
|
-
|
|
50
|
-
## Props
|
|
51
|
-
|
|
52
|
-
| Prop | Type | Required | Description |
|
|
53
|
-
|------|------|----------|-------------|
|
|
54
|
-
| `customerId` | string | Yes | The unique identifier for your airline |
|
|
55
|
-
| `apiKey` | string | Yes | Your Movmo API key |
|
|
56
|
-
| `dataSource` | DataSource | Yes | The source of flight data (AMADEUS, SABRE) |
|
|
57
|
-
| `flightOffer` | object | Yes | The flight offer data object |
|
|
58
|
-
| `isProd` | boolean | No | Whether to use production environment (default: false) |
|
|
59
|
-
|
|
60
|
-
## Data Source Options
|
|
61
|
-
|
|
62
|
-
```jsx
|
|
63
|
-
import { DataSource } from '@movmo/express-checkout-button';
|
|
64
|
-
|
|
65
|
-
// Available options
|
|
66
|
-
DataSource.AMADEUS // For Amadeus flight data
|
|
67
|
-
```
|
|
68
|
-
|
|
69
|
-
## Development
|
|
70
|
-
|
|
71
|
-
### Running Storybook
|
|
72
|
-
|
|
73
|
-
To run the component in a local development environment with interactive documentation:
|
|
74
|
-
|
|
75
|
-
```bash
|
|
76
|
-
# Install dependencies
|
|
77
|
-
npm install
|
|
78
|
-
|
|
79
|
-
# Start Storybook
|
|
80
|
-
npm run storybook
|
|
81
|
-
```
|
|
82
|
-
|
|
83
|
-
This will launch Storybook at [http://localhost:6006](http://localhost:6006) where you can explore and interact with the component.
|
|
84
|
-
|
|
85
|
-
### Building the Component
|
|
86
|
-
|
|
87
|
-
```bash
|
|
88
|
-
npm run build
|
|
89
|
-
```
|
|
90
|
-
|
|
91
|
-
### Storybook Examples
|
|
92
|
-
|
|
93
|
-
The Storybook includes several examples:
|
|
94
|
-
|
|
95
|
-
1. **Default**: Standard implementation of the checkout button
|
|
96
|
-
2. **Development Environment**: Example configured for development environment
|
|
97
|
-
3. **Production Environment**: Example configured for production environment
|
|
98
|
-
4. **Custom-Styled Button**: Example showing how to create a custom styled button
|
|
99
|
-
|
|
100
|
-
## License
|
|
101
|
-
|
|
102
|
-
MIT
|
|
1
|
+
# Movmo Express Checkout Button
|
|
2
|
+
|
|
3
|
+
A React component for integrating Movmo's Express Checkout functionality into airline websites.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install @movmo/express-checkout-button
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
or
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
yarn add @movmo/express-checkout-button
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## Usage
|
|
18
|
+
|
|
19
|
+
### Basic Example
|
|
20
|
+
|
|
21
|
+
```jsx
|
|
22
|
+
import React from 'react';
|
|
23
|
+
import { MovmoCheckoutButton } from '@movmo/express-checkout-button';
|
|
24
|
+
import { DataSource } from '@movmo/express-checkout-button';
|
|
25
|
+
|
|
26
|
+
function MyBookingPage() {
|
|
27
|
+
// Flight offer data retrieved from your booking system
|
|
28
|
+
const flightOffer = {
|
|
29
|
+
// Your flight offer data
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
return (
|
|
33
|
+
<div className="booking-page">
|
|
34
|
+
<h1>Complete your booking</h1>
|
|
35
|
+
|
|
36
|
+
<MovmoCheckoutButton
|
|
37
|
+
customerId="your-airline-id"
|
|
38
|
+
apiKey="your-movmo-api-key"
|
|
39
|
+
dataSource={DataSource.AMADEUS}
|
|
40
|
+
flightOffer={flightOffer}
|
|
41
|
+
isProd={false} // Set to true for production
|
|
42
|
+
/>
|
|
43
|
+
</div>
|
|
44
|
+
);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export default MyBookingPage;
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
## Props
|
|
51
|
+
|
|
52
|
+
| Prop | Type | Required | Description |
|
|
53
|
+
|------|------|----------|-------------|
|
|
54
|
+
| `customerId` | string | Yes | The unique identifier for your airline |
|
|
55
|
+
| `apiKey` | string | Yes | Your Movmo API key |
|
|
56
|
+
| `dataSource` | DataSource | Yes | The source of flight data (AMADEUS, SABRE) |
|
|
57
|
+
| `flightOffer` | object | Yes | The flight offer data object |
|
|
58
|
+
| `isProd` | boolean | No | Whether to use production environment (default: false) |
|
|
59
|
+
|
|
60
|
+
## Data Source Options
|
|
61
|
+
|
|
62
|
+
```jsx
|
|
63
|
+
import { DataSource } from '@movmo/express-checkout-button';
|
|
64
|
+
|
|
65
|
+
// Available options
|
|
66
|
+
DataSource.AMADEUS // For Amadeus flight data
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
## Development
|
|
70
|
+
|
|
71
|
+
### Running Storybook
|
|
72
|
+
|
|
73
|
+
To run the component in a local development environment with interactive documentation:
|
|
74
|
+
|
|
75
|
+
```bash
|
|
76
|
+
# Install dependencies
|
|
77
|
+
npm install
|
|
78
|
+
|
|
79
|
+
# Start Storybook
|
|
80
|
+
npm run storybook
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
This will launch Storybook at [http://localhost:6006](http://localhost:6006) where you can explore and interact with the component.
|
|
84
|
+
|
|
85
|
+
### Building the Component
|
|
86
|
+
|
|
87
|
+
```bash
|
|
88
|
+
npm run build
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
### Storybook Examples
|
|
92
|
+
|
|
93
|
+
The Storybook includes several examples:
|
|
94
|
+
|
|
95
|
+
1. **Default**: Standard implementation of the checkout button
|
|
96
|
+
2. **Development Environment**: Example configured for development environment
|
|
97
|
+
3. **Production Environment**: Example configured for production environment
|
|
98
|
+
4. **Custom-Styled Button**: Example showing how to create a custom styled button
|
|
99
|
+
|
|
100
|
+
## License
|
|
101
|
+
|
|
102
|
+
MIT
|
package/dist/index.cjs.js
CHANGED
package/dist/index.cjs.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs.js","sources":["../src/MovmoCheckoutOverlay.tsx","../src/index.ts","../src/MovmoCheckoutButton.tsx","../src/api.ts"],"sourcesContent":[
|
|
1
|
+
{"version":3,"file":"index.cjs.js","sources":["../src/MovmoCheckoutOverlay.tsx","../src/index.ts","../src/MovmoCheckoutButton.tsx","../src/api.ts"],"sourcesContent":["export function showMovmoOverlay(queryParams: string) {\r\n if (document.getElementById('movmo-checkout')) return;\r\n\r\n const container = document.createElement('div');\r\n container.id = 'movmo-checkout';\r\n container.style.cssText = `\r\n position: fixed;\r\n top: 0;\r\n left: 0;\r\n width: 100vw;\r\n height: 100vh;\r\n background: white;\r\n z-index: 9999;\r\n `;\r\n\r\n container.innerHTML = `\r\n <iframe \r\n src=\"https://booking.e2e.movmo.io/booking?${queryParams}\"\r\n width=\"100%\" \r\n height=\"100%\" \r\n style=\"border: none;\">\r\n </iframe>\r\n `;\r\n\r\n document.body.appendChild(container);\r\n}\r\n\r\n// Clean up when back button is used\r\nwindow.addEventListener('popstate', () => {\r\n const container = document.getElementById('movmo-checkout');\r\n if (!window.history.state?.checkoutOpen && container) {\r\n container.remove();\r\n }\r\n});\r\n\r\n// Show overlay again if loaded directly\r\nwindow.addEventListener('DOMContentLoaded', () => {\r\n const isMovmoPath = window.location.pathname.startsWith('/movmo/checkout');\r\n if (isMovmoPath) {\r\n const queryParams = window.location.search.substring(1);\r\n window.history.replaceState({ checkoutOpen: true }, '', window.location.href);\r\n showMovmoOverlay(queryParams);\r\n }\r\n});\r\n","function loadInterFont() {\r\n if (typeof document !== 'undefined') {\r\n const link = document.createElement('link');\r\n link.href = 'https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap';\r\n link.rel = 'stylesheet';\r\n document.head.appendChild(link);\r\n }\r\n}\r\n\r\nloadInterFont();\r\n\r\n// Export components\r\nexport { MovmoCheckoutButton } from './MovmoCheckoutButton';\r\n","import React, { useState } from 'react';\r\n\r\nimport { createAxiosClient, FlightOfferRequest, saveFlightOffer } from './api';\r\nimport { showMovmoOverlay } from './MovmoCheckoutOverlay';\r\n\r\ninterface MovmoCheckoutButtonProps {\r\n customerId: string;\r\n apiKey: string;\r\n dataSource: \"amadeus\" | \"sabre\";\r\n // TODO: support fare splitting\r\n flightOffer: object;\r\n isProd?: boolean;\r\n}\r\n\r\nexport const MovmoCheckoutButton: React.FC<MovmoCheckoutButtonProps> = ({\r\n customerId,\r\n apiKey,\r\n dataSource,\r\n flightOffer,\r\n isProd = false,\r\n}) => {\r\n const [isHovered, setIsHovered] = useState(false);\r\n const client = createAxiosClient(apiKey, isProd);\r\n\r\n const handleClick = async () => {\r\n const payload: FlightOfferRequest = {\r\n dataSource,\r\n rawOffer: flightOffer,\r\n };\r\n const offerId = await saveFlightOffer(payload, client);\r\n if (!offerId) {\r\n // TODO: handle error by displaying a message to the user\r\n return;\r\n }\r\n\r\n const queryParams = new URLSearchParams({\r\n offerId,\r\n airlineRef: customerId,\r\n }).toString();\r\n\r\n window.history.pushState({ checkoutOpen: true }, '', `/movmo/checkout?${queryParams}`);\r\n showMovmoOverlay(queryParams);\r\n };\r\n\r\n const buttonClasses = `\r\n px-7 py-5 \r\n font-inter font-semibold text-lg \r\n rounded-xl \r\n text-white \r\n border-none\r\n cursor-pointer\r\n transition-all duration-200\r\n outline-none focus:ring-2 focus:ring-[#F63D68] focus:ring-opacity-50\r\n ${isHovered ? 'bg-gradient-hover' : 'bg-gradient-normal'}\r\n `.trim();\r\n\r\n const badgeClasses = `\r\n ml-2 px-2 py-1\r\n bg-white \r\n text-[#171412] \r\n rounded-md \r\n text-lg\r\n `.trim();\r\n\r\n return (\r\n <button\r\n onClick={handleClick}\r\n onMouseEnter={() => setIsHovered(true)}\r\n onMouseLeave={() => setIsHovered(false)}\r\n className={buttonClasses}\r\n >\r\n Express Checkout\r\n <span className={badgeClasses}>\r\n Movmo\r\n </span>\r\n </button>\r\n );\r\n};\r\n","import axios, { AxiosInstance } from \"axios\";\r\n\r\n\r\nexport const createAxiosClient = (apiKey: string, isProd: boolean = false) => {\r\n const baseUrl = isProd ? \"https://api.movmo.io\" : \"https://e2e.api.movmo.io\";\r\n\r\n const client = axios.create({\r\n baseURL: baseUrl,\r\n headers: {\r\n Accept: \"application/json\",\r\n \"Content-Type\": \"application/json\",\r\n \"x-api-key\": apiKey,\r\n },\r\n // Allow cookies to be sent with requests\r\n withCredentials: true,\r\n timeout: 30000,\r\n });\r\n\r\n return client;\r\n};\r\n\r\nexport interface FlightOfferRequest {\r\n dataSource: string;\r\n // The raw offer object from the data source; does not currently support fare splitting\r\n rawOffer: object;\r\n}\r\n\r\nexport const saveFlightOffer = async (payload: FlightOfferRequest, client: AxiosInstance): Promise<string | null> => {\r\n return await client.post(\"/v1/flight_offers\", payload)\r\n .then((res) => res.data.id)\r\n .catch((err) => {\r\n console.error(err);\r\n return null;\r\n });\r\n};\r\n"],"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,mBACv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ts
CHANGED
package/dist/index.es.js
CHANGED
package/dist/index.es.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.es.js","sources":["../src/MovmoCheckoutOverlay.tsx","../src/MovmoCheckoutButton.tsx","../src/api.ts","../src/index.ts"],"sourcesContent":[
|
|
1
|
+
{"version":3,"file":"index.es.js","sources":["../src/MovmoCheckoutOverlay.tsx","../src/MovmoCheckoutButton.tsx","../src/api.ts","../src/index.ts"],"sourcesContent":["export function showMovmoOverlay(queryParams: string) {\r\n if (document.getElementById('movmo-checkout')) return;\r\n\r\n const container = document.createElement('div');\r\n container.id = 'movmo-checkout';\r\n container.style.cssText = `\r\n position: fixed;\r\n top: 0;\r\n left: 0;\r\n width: 100vw;\r\n height: 100vh;\r\n background: white;\r\n z-index: 9999;\r\n `;\r\n\r\n container.innerHTML = `\r\n <iframe \r\n src=\"https://booking.e2e.movmo.io/booking?${queryParams}\"\r\n width=\"100%\" \r\n height=\"100%\" \r\n style=\"border: none;\">\r\n </iframe>\r\n `;\r\n\r\n document.body.appendChild(container);\r\n}\r\n\r\n// Clean up when back button is used\r\nwindow.addEventListener('popstate', () => {\r\n const container = document.getElementById('movmo-checkout');\r\n if (!window.history.state?.checkoutOpen && container) {\r\n container.remove();\r\n }\r\n});\r\n\r\n// Show overlay again if loaded directly\r\nwindow.addEventListener('DOMContentLoaded', () => {\r\n const isMovmoPath = window.location.pathname.startsWith('/movmo/checkout');\r\n if (isMovmoPath) {\r\n const queryParams = window.location.search.substring(1);\r\n window.history.replaceState({ checkoutOpen: true }, '', window.location.href);\r\n showMovmoOverlay(queryParams);\r\n }\r\n});\r\n","import React, { useState } from 'react';\r\n\r\nimport { createAxiosClient, FlightOfferRequest, saveFlightOffer } from './api';\r\nimport { showMovmoOverlay } from './MovmoCheckoutOverlay';\r\n\r\ninterface MovmoCheckoutButtonProps {\r\n customerId: string;\r\n apiKey: string;\r\n dataSource: \"amadeus\" | \"sabre\";\r\n // TODO: support fare splitting\r\n flightOffer: object;\r\n isProd?: boolean;\r\n}\r\n\r\nexport const MovmoCheckoutButton: React.FC<MovmoCheckoutButtonProps> = ({\r\n customerId,\r\n apiKey,\r\n dataSource,\r\n flightOffer,\r\n isProd = false,\r\n}) => {\r\n const [isHovered, setIsHovered] = useState(false);\r\n const client = createAxiosClient(apiKey, isProd);\r\n\r\n const handleClick = async () => {\r\n const payload: FlightOfferRequest = {\r\n dataSource,\r\n rawOffer: flightOffer,\r\n };\r\n const offerId = await saveFlightOffer(payload, client);\r\n if (!offerId) {\r\n // TODO: handle error by displaying a message to the user\r\n return;\r\n }\r\n\r\n const queryParams = new URLSearchParams({\r\n offerId,\r\n airlineRef: customerId,\r\n }).toString();\r\n\r\n window.history.pushState({ checkoutOpen: true }, '', `/movmo/checkout?${queryParams}`);\r\n showMovmoOverlay(queryParams);\r\n };\r\n\r\n const buttonClasses = `\r\n px-7 py-5 \r\n font-inter font-semibold text-lg \r\n rounded-xl \r\n text-white \r\n border-none\r\n cursor-pointer\r\n transition-all duration-200\r\n outline-none focus:ring-2 focus:ring-[#F63D68] focus:ring-opacity-50\r\n ${isHovered ? 'bg-gradient-hover' : 'bg-gradient-normal'}\r\n `.trim();\r\n\r\n const badgeClasses = `\r\n ml-2 px-2 py-1\r\n bg-white \r\n text-[#171412] \r\n rounded-md \r\n text-lg\r\n `.trim();\r\n\r\n return (\r\n <button\r\n onClick={handleClick}\r\n onMouseEnter={() => setIsHovered(true)}\r\n onMouseLeave={() => setIsHovered(false)}\r\n className={buttonClasses}\r\n >\r\n Express Checkout\r\n <span className={badgeClasses}>\r\n Movmo\r\n </span>\r\n </button>\r\n );\r\n};\r\n","import axios, { AxiosInstance } from \"axios\";\r\n\r\n\r\nexport const createAxiosClient = (apiKey: string, isProd: boolean = false) => {\r\n const baseUrl = isProd ? \"https://api.movmo.io\" : \"https://e2e.api.movmo.io\";\r\n\r\n const client = axios.create({\r\n baseURL: baseUrl,\r\n headers: {\r\n Accept: \"application/json\",\r\n \"Content-Type\": \"application/json\",\r\n \"x-api-key\": apiKey,\r\n },\r\n // Allow cookies to be sent with requests\r\n withCredentials: true,\r\n timeout: 30000,\r\n });\r\n\r\n return client;\r\n};\r\n\r\nexport interface FlightOfferRequest {\r\n dataSource: string;\r\n // The raw offer object from the data source; does not currently support fare splitting\r\n rawOffer: object;\r\n}\r\n\r\nexport const saveFlightOffer = async (payload: FlightOfferRequest, client: AxiosInstance): Promise<string | null> => {\r\n return await client.post(\"/v1/flight_offers\", payload)\r\n .then((res) => res.data.id)\r\n .catch((err) => {\r\n console.error(err);\r\n return null;\r\n });\r\n};\r\n","function loadInterFont() {\r\n if (typeof document !== 'undefined') {\r\n const link = document.createElement('link');\r\n link.href = 'https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap';\r\n link.rel = 'stylesheet';\r\n document.head.appendChild(link);\r\n }\r\n}\r\n\r\nloadInterFont();\r\n\r\n// Export components\r\nexport { MovmoCheckoutButton } from './MovmoCheckoutButton';\r\n"],"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,C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,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
|
@@ -1,82 +1,82 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@movmo/express-checkout-button",
|
|
3
|
-
"version": "0.1.
|
|
4
|
-
"description": "React component plugin for embedding Movmo Express Checkout on airline websites.",
|
|
5
|
-
"type": "module",
|
|
6
|
-
"main": "dist/index.cjs.js",
|
|
7
|
-
"module": "dist/index.es.js",
|
|
8
|
-
"types": "dist/index.d.ts",
|
|
9
|
-
"publishConfig": {
|
|
10
|
-
"access": "public"
|
|
11
|
-
},
|
|
12
|
-
"files": [
|
|
13
|
-
"/dist"
|
|
14
|
-
],
|
|
15
|
-
"scripts": {
|
|
16
|
-
"build": "rollup -c && tsc --emitDeclarationOnly",
|
|
17
|
-
"storybook": "storybook dev -p 6006",
|
|
18
|
-
"build-storybook": "storybook build"
|
|
19
|
-
},
|
|
20
|
-
"keywords": [
|
|
21
|
-
"movmo",
|
|
22
|
-
"checkout",
|
|
23
|
-
"plugin",
|
|
24
|
-
"airline",
|
|
25
|
-
"react",
|
|
26
|
-
"iframe"
|
|
27
|
-
],
|
|
28
|
-
"dependencies": {
|
|
29
|
-
"axios": "^1.0.0"
|
|
30
|
-
},
|
|
31
|
-
"devDependencies": {
|
|
32
|
-
"@chromatic-com/storybook": "^3.0.0",
|
|
33
|
-
"@rollup/plugin-commonjs": "^25.0.0",
|
|
34
|
-
"@rollup/plugin-node-resolve": "^15.0.0",
|
|
35
|
-
"@rollup/plugin-terser": "^0.4.0",
|
|
36
|
-
"@rollup/plugin-typescript": "^11.0.0",
|
|
37
|
-
"@storybook/addon-essentials": "^8.6.0",
|
|
38
|
-
"@storybook/addon-interactions": "^8.6.0",
|
|
39
|
-
"@storybook/addon-links": "^8.6.0",
|
|
40
|
-
"@storybook/addon-onboarding": "^8.6.0",
|
|
41
|
-
"@storybook/blocks": "^8.6.0",
|
|
42
|
-
"@storybook/react": "^8.6.0",
|
|
43
|
-
"@storybook/react-vite": "^8.6.0",
|
|
44
|
-
"@storybook/test": "^8.6.0",
|
|
45
|
-
"@types/node": "^22.15.3",
|
|
46
|
-
"@types/react": "^17.0.0 || ^18.0.0",
|
|
47
|
-
"@types/react-dom": "^17.0.0 || ^18.0.0",
|
|
48
|
-
"autoprefixer": "^10.4.16",
|
|
49
|
-
"postcss": "^8.4.32",
|
|
50
|
-
"rollup": "^4.0.0",
|
|
51
|
-
"rollup-plugin-dts": "^6.0.0",
|
|
52
|
-
"rollup-plugin-peer-deps-external": "^2.2.4",
|
|
53
|
-
"storybook": "^8.6.0",
|
|
54
|
-
"tailwindcss": "^3.4.0",
|
|
55
|
-
"tailwindcss-animate": "^1.0.0",
|
|
56
|
-
"tailwindcss-font-inter": "^4.0.0",
|
|
57
|
-
"typescript": "^4.0.0 || ^5.0.0",
|
|
58
|
-
"vite": "^6.2.1"
|
|
59
|
-
},
|
|
60
|
-
"peerDependencies": {
|
|
61
|
-
"react": "^16.8.0 || ^17.0.0 || ^18.0.0",
|
|
62
|
-
"react-dom": "^16.8.0 || ^17.0.0 || ^18.0.0"
|
|
63
|
-
},
|
|
64
|
-
"peerDependenciesMeta": {
|
|
65
|
-
"react": {
|
|
66
|
-
"optional": false
|
|
67
|
-
},
|
|
68
|
-
"react-dom": {
|
|
69
|
-
"optional": false
|
|
70
|
-
}
|
|
71
|
-
},
|
|
72
|
-
"repository": {
|
|
73
|
-
"type": "git",
|
|
74
|
-
"url": "git+https://github.com/movmo-app/react-js-packages.git"
|
|
75
|
-
},
|
|
76
|
-
"author": "Movmo",
|
|
77
|
-
"license": "MIT",
|
|
78
|
-
"bugs": {
|
|
79
|
-
"url": "https://github.com/movmo-app/react-js-packages/issues"
|
|
80
|
-
},
|
|
81
|
-
"homepage": "https://github.com/movmo-app/react-js-packages/blob/main/packages/@movmo/express-checkout-button/README.md"
|
|
82
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@movmo/express-checkout-button",
|
|
3
|
+
"version": "0.1.4",
|
|
4
|
+
"description": "React component plugin for embedding Movmo Express Checkout on airline websites.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "dist/index.cjs.js",
|
|
7
|
+
"module": "dist/index.es.js",
|
|
8
|
+
"types": "dist/index.d.ts",
|
|
9
|
+
"publishConfig": {
|
|
10
|
+
"access": "public"
|
|
11
|
+
},
|
|
12
|
+
"files": [
|
|
13
|
+
"/dist"
|
|
14
|
+
],
|
|
15
|
+
"scripts": {
|
|
16
|
+
"build": "rollup -c && tsc --emitDeclarationOnly",
|
|
17
|
+
"storybook": "storybook dev -p 6006",
|
|
18
|
+
"build-storybook": "storybook build"
|
|
19
|
+
},
|
|
20
|
+
"keywords": [
|
|
21
|
+
"movmo",
|
|
22
|
+
"checkout",
|
|
23
|
+
"plugin",
|
|
24
|
+
"airline",
|
|
25
|
+
"react",
|
|
26
|
+
"iframe"
|
|
27
|
+
],
|
|
28
|
+
"dependencies": {
|
|
29
|
+
"axios": "^1.0.0"
|
|
30
|
+
},
|
|
31
|
+
"devDependencies": {
|
|
32
|
+
"@chromatic-com/storybook": "^3.0.0",
|
|
33
|
+
"@rollup/plugin-commonjs": "^25.0.0",
|
|
34
|
+
"@rollup/plugin-node-resolve": "^15.0.0",
|
|
35
|
+
"@rollup/plugin-terser": "^0.4.0",
|
|
36
|
+
"@rollup/plugin-typescript": "^11.0.0",
|
|
37
|
+
"@storybook/addon-essentials": "^8.6.0",
|
|
38
|
+
"@storybook/addon-interactions": "^8.6.0",
|
|
39
|
+
"@storybook/addon-links": "^8.6.0",
|
|
40
|
+
"@storybook/addon-onboarding": "^8.6.0",
|
|
41
|
+
"@storybook/blocks": "^8.6.0",
|
|
42
|
+
"@storybook/react": "^8.6.0",
|
|
43
|
+
"@storybook/react-vite": "^8.6.0",
|
|
44
|
+
"@storybook/test": "^8.6.0",
|
|
45
|
+
"@types/node": "^22.15.3",
|
|
46
|
+
"@types/react": "^17.0.0 || ^18.0.0",
|
|
47
|
+
"@types/react-dom": "^17.0.0 || ^18.0.0",
|
|
48
|
+
"autoprefixer": "^10.4.16",
|
|
49
|
+
"postcss": "^8.4.32",
|
|
50
|
+
"rollup": "^4.0.0",
|
|
51
|
+
"rollup-plugin-dts": "^6.0.0",
|
|
52
|
+
"rollup-plugin-peer-deps-external": "^2.2.4",
|
|
53
|
+
"storybook": "^8.6.0",
|
|
54
|
+
"tailwindcss": "^3.4.0",
|
|
55
|
+
"tailwindcss-animate": "^1.0.0",
|
|
56
|
+
"tailwindcss-font-inter": "^4.0.0",
|
|
57
|
+
"typescript": "^4.0.0 || ^5.0.0",
|
|
58
|
+
"vite": "^6.2.1"
|
|
59
|
+
},
|
|
60
|
+
"peerDependencies": {
|
|
61
|
+
"react": "^16.8.0 || ^17.0.0 || ^18.0.0",
|
|
62
|
+
"react-dom": "^16.8.0 || ^17.0.0 || ^18.0.0"
|
|
63
|
+
},
|
|
64
|
+
"peerDependenciesMeta": {
|
|
65
|
+
"react": {
|
|
66
|
+
"optional": false
|
|
67
|
+
},
|
|
68
|
+
"react-dom": {
|
|
69
|
+
"optional": false
|
|
70
|
+
}
|
|
71
|
+
},
|
|
72
|
+
"repository": {
|
|
73
|
+
"type": "git",
|
|
74
|
+
"url": "git+https://github.com/movmo-app/react-js-packages.git"
|
|
75
|
+
},
|
|
76
|
+
"author": "Movmo",
|
|
77
|
+
"license": "MIT",
|
|
78
|
+
"bugs": {
|
|
79
|
+
"url": "https://github.com/movmo-app/react-js-packages/issues"
|
|
80
|
+
},
|
|
81
|
+
"homepage": "https://github.com/movmo-app/react-js-packages/blob/main/packages/@movmo/express-checkout-button/README.md"
|
|
82
|
+
}
|