capacitor-meili
v7.0.0
Published
Meili SDK
Maintainers
Readme
capacitor-meili
Capacitor plugin that uses the Meili Mobile App SDKs to present a Meili car rental flow within a native modal.
Install
npm install capacitor-meili
npx cap syncAndroid Instructions
The following is required in order to use the Android SDK.
🔐 GitHub Packages Authentication
To access this library, define the following environment variables before building.:
export MEILI_GITHUB_USERNAME=your_github_username
export MEILI_GITHUB_TOKEN=your_github_tokenFor local development, we recommend storing this in ~/.gradle/gradle.properties
API
openModal(...)addListener(EventName, ...)addListener('all_events', ...)addListener('android_web_events', ...)- Interfaces
- Type Aliases
- Enums
openModal(...)
openModal(params: MeiliParams) => anyOpen a Meili flow in a modal
| Param | Type |
| ------------ | --------------------------------------------------- |
| params | MeiliParams |
Returns: any
addListener(EventName, ...)
addListener(eventName: EventName, listenerFunc: (data: any) => void) => anyiOS only: Listen for specific events within the Meili flow
| Param | Type |
| ------------------ | ----------------------------------------------- |
| eventName | EventName |
| listenerFunc | (data: any) => void |
Returns: any
addListener('all_events', ...)
addListener(eventName: 'all_events', listenerFunc: (event: { eventName: EventName; data: any; }) => void) => anyiOS only: Listen for all events within the Meili flow
| Param | Type |
| ------------------ | ---------------------------------------------------------------------------------------------- |
| eventName | 'all_events' |
| listenerFunc | (event: { eventName: EventName; data: any; }) => void |
Returns: any
addListener('android_web_events', ...)
addListener(eventName: 'android_web_events', listenerFunc: (event: { type: WebEventName; data: any; }) => void) => anyAndroid only: Listen for all events within the Meili flow
| Param | Type |
| ------------------ | ----------------------------------------------------------------------------------------------- |
| eventName | 'android_web_events' |
| listenerFunc | (event: { type: WebEventName; data: any; }) => void |
Returns: any
Interfaces
PluginListenerHandle
| Prop | Type |
| ------------ | ------------------------- |
| remove | () => any |
Type Aliases
MeiliParams
{ /** * @example "100.9" * / ptid: string; /* * The flow to use * * Possible values are: * - 'direct' (MeiliFlow.Direct) * - 'connect' (MeiliFlow.Connect) * - 'bookingManager' (MeiliFlow.BookingManager) / flow: MeiliFlow; /* * The API environment to use * * Possible values are: * - 'prod' (MeiliEnvironment.Prod) * - 'preProd' (MeiliEnvironment.PreProd) * - 'uat' (MeiliEnvironment.Uat) * - 'dev' (MeiliEnvironment.Dev) / env: MeiliEnvironment; /* * The locale to use e.g. "en-GB". * The user's device locale is used by default. / locale?: string; availParams?: AvailParams; additionalParams?: AdditionalParams; /* * Android only: Background hex color of the toolbar. / toolbarColor?: string; /* * Android only: The title for the toolbar / toolbarTitle?: string; /* * Android only: Color of the title that shows in the toolbar / toolbarTitleColor?: string; /* * Android only: Elevation value of the toolbar / toolbarElevation?: number; /* * Android only: Color of the close button in the toolbar */ toolbarCloseIconColor?: string; }
AvailParams
{ /** * The location where the pickup occurs e.g. "BCN" * * Required for the connect flow / pickupLocation?: string; /* * The location where the dropoff occurs e.g. "BCN" * * Required for the connect flow / dropoffLocation?: string; /* * The date for the pickup in yyyy-MM-dd format e.g. "2024-10-28" * * Required for the connect flow * / pickupDate?: string; /* * The time for the pickup in HH:mm format e.g. "14:30" * * Required for the connect flow / pickupTime?: string; /* * The date for the dropoff in yyyy-MM-dd format e.g. "2024-10-28" * * Required for the connect flow / dropoffDate?: string; /* * The time for the dropoff in HH:mm format e.g. "14:30" * * Required for the connect flow / dropoffTime?: string; /* * The age of the driver e.g. 30 * * Required for the connect flow / driverAge?: number; /* * The currency code to use e.g. 'GBP' / currencyCode?: string; /* * The residency of the driver e.g. "GB" */ residency?: string; }
AdditionalParams
{ prefillOnly?: boolean; confirmationId?: string; lastName?: string; firstName?: string; /** * Android only. */ givenName?: string; partnerLoyaltyAccount?: string; partnerLoyaltyAccountTier?: string; numberOfPassengers?: number; customerPartnerCode?: string; flightNumber?: string; passengerNameRecord?: string; superPassengerNameRecord?: string; infant?: number; child?: number; teenager?: number; supplierLoyaltyAccounts?: string[]; fareTypeAndFlex?: string; departureAirport?: string; arrivalAirport?: string; ancillaryActivity?: string; airlineFareAmount?: number; airlineFareCurrency?: string; partnerCustomerID?: string; email?: string; phoneNumbers?: number[]; companyName?: string; corporateCode?: string; addressLine1?: string; postCode?: string; city?: string; state?: string; }
EventName
'screen_viewed' | 'search_button_pressed' | 'view_deal_pressed' | 'criteria_searched' | 'show_more_benefits_button_pressed' | 'important_info_button_pressed' | 'sort_options_selected' | 'filter_option_updated' | 'items_scrolled' | 'protection_selected' | 'extra_added' | 'show_more_extra_button_pressed' | 'protection_details_popup_shown' | 'scrolled_to_end' | 'checkout_summary_displayed' | 'checkout_succeeded' | 'checkout_time_taken' | 'flow_started' | 'booking_succeeded' | 'sdk_config_loaded' | (string & {})
WebEventName
'MEILI_EVENT_SELECTION_ADD' | 'MEILI_EVENT_SELECTION_REMOVE' | 'MEILI_EVENT_BOOKING_SUCCESS' | 'MEILI_POST_MESSAGE'
Enums
MeiliFlow
| Members | Value |
| -------------------- | ----------------------------- |
| Direct | 'direct' |
| Connect | 'connect' |
| BookingManager | 'bookingManager' |
MeiliEnvironment
| Members | Value |
| ------------- | ---------------------- |
| Prod | 'prod' |
| PreProd | 'preProd' |
| Uat | 'uat' |
| Dev | 'dev' |
