@devtravelcode/widget-native 1.0.0 → 1.0.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/LICENSE +3 -3
- package/README.md +115 -0
- package/dist/{TravelHubWidget.d.ts → TravelCodeWidget.d.ts} +2 -2
- package/dist/{TravelHubWidget.js → TravelCodeWidget.js} +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.js +1 -1
- package/dist/locales/widgetTranslations.js +2 -2
- package/package.json +2 -2
package/LICENSE
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
PROPRIETARY SOFTWARE LICENSE
|
|
2
2
|
|
|
3
|
-
Copyright (c) 2026
|
|
3
|
+
Copyright (c) 2026 TravelCode. All rights reserved.
|
|
4
4
|
|
|
5
5
|
This software is proprietary and confidential.
|
|
6
6
|
|
|
7
7
|
Permission is granted solely to authorized licensees to use this package
|
|
8
|
-
in their applications, subject to a valid license agreement with
|
|
8
|
+
in their applications, subject to a valid license agreement with TravelCode.
|
|
9
9
|
|
|
10
10
|
The following actions are strictly prohibited without prior written consent:
|
|
11
11
|
- Copying, modifying, or distributing this software
|
|
12
12
|
- Reverse engineering, decompiling, or disassembling
|
|
13
13
|
- Sublicensing, selling, or transferring to third parties
|
|
14
|
-
- Using this software without a valid API token issued by
|
|
14
|
+
- Using this software without a valid API token issued by TravelCode
|
|
15
15
|
|
|
16
16
|
This software is provided "as is" without warranty of any kind.
|
|
17
17
|
|
package/README.md
ADDED
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
# @devtravelcode/widget-native
|
|
2
|
+
|
|
3
|
+
React Native widget for searching and booking flights and hotels. Powered by [Travel-Code.com](https://travel-code.com).
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Prerequisites
|
|
8
|
+
|
|
9
|
+
Before installing the widget, you need to become a Travel-Code client and set up your widget:
|
|
10
|
+
|
|
11
|
+
### Step 1: Register as a client
|
|
12
|
+
|
|
13
|
+
Sign up at [travel-code.com](https://travel-code.com) and get access to the partner dashboard.
|
|
14
|
+
|
|
15
|
+
### Step 2: Create and configure your widget
|
|
16
|
+
|
|
17
|
+
Go to [travel-code.com/user/search-widget-options](https://travel-code.com/user/search-widget-options) and:
|
|
18
|
+
|
|
19
|
+
- Create a new widget
|
|
20
|
+
- Choose which services to enable (flights, hotels)
|
|
21
|
+
- Customize colors, default language, and currency
|
|
22
|
+
- Configure commission settings
|
|
23
|
+
|
|
24
|
+
### Step 3: Get your API token
|
|
25
|
+
|
|
26
|
+
After saving the widget configuration, copy the **API token** from the widget settings page. You will need it to initialize the widget in your app.
|
|
27
|
+
|
|
28
|
+
---
|
|
29
|
+
|
|
30
|
+
## Installation
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
npm install @devtravelcode/widget-native
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
### Peer dependencies
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
npx expo install react-native-gesture-handler react-native-safe-area-context \
|
|
40
|
+
react-native-svg react-native-reanimated @react-native-async-storage/async-storage
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
Optional (for hotel map):
|
|
44
|
+
```bash
|
|
45
|
+
npx expo install react-native-maps
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
---
|
|
49
|
+
|
|
50
|
+
## Usage
|
|
51
|
+
|
|
52
|
+
```tsx
|
|
53
|
+
import { TravelCodeWidget } from '@devtravelcode/widget-native';
|
|
54
|
+
|
|
55
|
+
export default function App() {
|
|
56
|
+
return (
|
|
57
|
+
<TravelCodeWidget
|
|
58
|
+
token="YOUR_API_TOKEN"
|
|
59
|
+
lang="en"
|
|
60
|
+
currency="USD"
|
|
61
|
+
/>
|
|
62
|
+
);
|
|
63
|
+
}
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
### Props
|
|
67
|
+
|
|
68
|
+
| Prop | Type | Required | Default | Description |
|
|
69
|
+
|------|------|----------|---------|-------------|
|
|
70
|
+
| `token` | `string` | Yes | — | API token from your widget settings |
|
|
71
|
+
| `lang` | `string` | No | `"en"` | Language (`"en"`, `"ru"`) |
|
|
72
|
+
| `currency` | `string` | No | `"USD"` | Currency code (`"USD"`, `"GBP"`, `"EUR"`) |
|
|
73
|
+
| `onFlightSelect` | `(flight) => void` | No | — | Callback when user selects a flight |
|
|
74
|
+
| `onHotelSelect` | `(hotel) => void` | No | — | Callback when user selects a hotel |
|
|
75
|
+
| `style` | `ViewStyle` | No | — | Custom container style |
|
|
76
|
+
|
|
77
|
+
---
|
|
78
|
+
|
|
79
|
+
## Example
|
|
80
|
+
|
|
81
|
+
```tsx
|
|
82
|
+
import React from 'react';
|
|
83
|
+
import { SafeAreaProvider } from 'react-native-safe-area-context';
|
|
84
|
+
import { TravelCodeWidget } from '@devtravelcode/widget-native';
|
|
85
|
+
|
|
86
|
+
export default function App() {
|
|
87
|
+
return (
|
|
88
|
+
<SafeAreaProvider>
|
|
89
|
+
<TravelCodeWidget
|
|
90
|
+
token="your-token-here"
|
|
91
|
+
lang="en"
|
|
92
|
+
currency="USD"
|
|
93
|
+
onFlightSelect={(flight) => console.log('Flight selected:', flight)}
|
|
94
|
+
onHotelSelect={(hotel) => console.log('Hotel selected:', hotel)}
|
|
95
|
+
/>
|
|
96
|
+
</SafeAreaProvider>
|
|
97
|
+
);
|
|
98
|
+
}
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
---
|
|
102
|
+
|
|
103
|
+
## Requirements
|
|
104
|
+
|
|
105
|
+
- React Native >= 0.72
|
|
106
|
+
- React >= 18
|
|
107
|
+
- Expo SDK 49+ (recommended)
|
|
108
|
+
|
|
109
|
+
---
|
|
110
|
+
|
|
111
|
+
## Support
|
|
112
|
+
|
|
113
|
+
For technical support and licensing inquiries: **support@travel-code.com**
|
|
114
|
+
|
|
115
|
+
For widget configuration help, visit the [Travel-Code documentation](https://travel-code.com).
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
export type
|
|
2
|
+
export type TravelCodeWidgetProps = {
|
|
3
3
|
token: string;
|
|
4
4
|
lang?: string;
|
|
5
5
|
currency?: string;
|
|
@@ -9,4 +9,4 @@ export type TravelHubWidgetProps = {
|
|
|
9
9
|
onCarSelect?: (car: any) => void;
|
|
10
10
|
style?: any;
|
|
11
11
|
};
|
|
12
|
-
export declare const
|
|
12
|
+
export declare const TravelCodeWidget: React.FC<TravelCodeWidgetProps>;
|
|
@@ -10,7 +10,7 @@ import { setGlobalToken } from './utils/getToken';
|
|
|
10
10
|
import App from './App';
|
|
11
11
|
import { ErrorBoundary } from './components/ErrorBoundary';
|
|
12
12
|
const CONFIG_URL = 'https://api.travel-code.com/v1/user/widget-config';
|
|
13
|
-
export const
|
|
13
|
+
export const TravelCodeWidget = ({ token, lang = 'en', currency = 'USD', config: configProp, onFlightSelect, onHotelSelect, onCarSelect, style, }) => {
|
|
14
14
|
const [remoteConfig, setRemoteConfig] = useState(null);
|
|
15
15
|
const [configLoading, setConfigLoading] = useState(true);
|
|
16
16
|
setGlobalToken(token);
|
package/dist/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export {
|
|
2
|
-
export type {
|
|
1
|
+
export { TravelCodeWidget } from './TravelCodeWidget';
|
|
2
|
+
export type { TravelCodeWidgetProps } from './TravelCodeWidget';
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { TravelCodeWidget } from './TravelCodeWidget';
|
|
@@ -122,7 +122,7 @@ export const defaultTranslations = {
|
|
|
122
122
|
charter: "Charter",
|
|
123
123
|
company_tariff: "Company fare",
|
|
124
124
|
special_fare: "Special fare",
|
|
125
|
-
special_fare_tooltip: "Special fare available only on
|
|
125
|
+
special_fare_tooltip: "Special fare available only on TravelCode",
|
|
126
126
|
violates_policy: "Violates travel policy",
|
|
127
127
|
night_transfer: "Night transfer",
|
|
128
128
|
change_airport: "Change of airport",
|
|
@@ -482,7 +482,7 @@ export const defaultTranslations = {
|
|
|
482
482
|
charter: "Чартер",
|
|
483
483
|
company_tariff: "Тариф компании",
|
|
484
484
|
special_fare: "Специальный тариф",
|
|
485
|
-
special_fare_tooltip: "Специальный тариф, доступный только в
|
|
485
|
+
special_fare_tooltip: "Специальный тариф, доступный только в TravelCode",
|
|
486
486
|
violates_policy: "Нарушает тревел-политику",
|
|
487
487
|
night_transfer: "Ночная пересадка",
|
|
488
488
|
change_airport: "Смена аэропорта",
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@devtravelcode/widget-native",
|
|
3
|
-
"version": "1.0.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "1.0.2",
|
|
4
|
+
"description": "TravelCode search widget for React Native (flights, hotels)",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
7
7
|
"files": [
|