@tripian/core 4.2.0 → 4.6.1
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/Random.d.ts +111 -111
- package/api/API.d.ts +173 -173
- package/api/const/APICONST.d.ts +3 -3
- package/api/const/ApiConstModel.d.ts +51 -51
- package/data/data.d.ts +6 -6
- package/data/dataClear.d.ts +2 -2
- package/data/dataModel.d.ts +43 -43
- package/easy/easy.d.ts +35 -35
- package/easy/handle/cache/Cached.d.ts +87 -87
- package/easy/handle/cache/cache.d.ts +9 -9
- package/easy/handle/cache/cacheCommon.d.ts +2 -2
- package/easy/handle/cache/cacheHelper.d.ts +79 -79
- package/easy/handle/handle.d.ts +21 -21
- package/index.d.ts +43 -43
- package/index.html +115 -115
- package/index.js +282 -282
- package/index.js.map +1 -1
- package/package.json +28 -66
- package/providers/bb/API.d.ts +20 -19
- package/providers/glx/API.d.ts +15 -15
- package/providers/glx/demoData.d.ts +3 -3
- package/providers/glx/handle.d.ts +8 -8
- package/providers/gyg/API.d.ts +25 -25
- package/providers/gyg/allCategories.d.ts +3 -3
- package/providers/gyg/catalogCategoryIds.d.ts +6 -6
- package/providers/gyg/handle.d.ts +16 -16
- package/providers/gyg/mockTour.d.ts +3 -3
- package/providers/yelp/API.d.ts +16 -16
- package/providers/yelp/data/business_test.d.ts +3 -3
- package/providers/yelp/data/hold_test.d.ts +3 -3
- package/providers/yelp/data/openings_test.d.ts +3 -3
- package/providers/yelp/data/reservation_test.d.ts +3 -3
- package/tcore.umd.js +282 -282
- package/tcore.umd.js.map +1 -1
- package/xhr/IXhrOptions.d.ts +7 -7
- package/xhr/xhr.d.ts +21 -21
package/easy/handle/handle.d.ts
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
import { AxiosError } from 'axios';
|
|
2
|
-
import Model from '@tripian/model';
|
|
3
|
-
/**
|
|
4
|
-
* All successfully (axios response status code) resolved promises firstly handles by this function. easy.log calling.
|
|
5
|
-
* If dataKey exist and httpResponse.data.success is true, httpResponse.data.data is saving to tripian.data[dataKey]
|
|
6
|
-
* @param {AxiosResponse} httpResponse axios response object
|
|
7
|
-
* @param {string} dataKey
|
|
8
|
-
* @returns {any} httpResponse.data axios httpResponse.data
|
|
9
|
-
*/
|
|
10
|
-
declare const handleHttpResponseSuccess: <T>(httpResponse: Model.SuccessResponse<T>, dataKey: string, params?: any) => Model.DataPayload<T>;
|
|
11
|
-
/**
|
|
12
|
-
* All failed (axios response status code) promises firstly handles by this function.
|
|
13
|
-
* setting tripian.data.hasError to true
|
|
14
|
-
* easy.log calling.
|
|
15
|
-
* If dataKey exist (and dataKey !== 'trip') and httpResponse.data.success is true, httpResponse.data.data is saving to tripian.data[dataKey]
|
|
16
|
-
* @param {AxiosError} errorResponse is axios error response object
|
|
17
|
-
* @param {string} dataKey
|
|
18
|
-
* @returns {AxiosError} errorResponse is axios error response object
|
|
19
|
-
*/
|
|
20
|
-
declare const handleHttpResponseError: (errorResponse: AxiosError<Model.ErrorResponse>, dataKey: string, params?: any) => never;
|
|
21
|
-
export { handleHttpResponseSuccess, handleHttpResponseError };
|
|
1
|
+
import { AxiosError } from 'axios';
|
|
2
|
+
import Model from '@tripian/model';
|
|
3
|
+
/**
|
|
4
|
+
* All successfully (axios response status code) resolved promises firstly handles by this function. easy.log calling.
|
|
5
|
+
* If dataKey exist and httpResponse.data.success is true, httpResponse.data.data is saving to tripian.data[dataKey]
|
|
6
|
+
* @param {AxiosResponse} httpResponse axios response object
|
|
7
|
+
* @param {string} dataKey
|
|
8
|
+
* @returns {any} httpResponse.data axios httpResponse.data
|
|
9
|
+
*/
|
|
10
|
+
declare const handleHttpResponseSuccess: <T>(httpResponse: Model.SuccessResponse<T>, dataKey: string, params?: any) => Model.DataPayload<T>;
|
|
11
|
+
/**
|
|
12
|
+
* All failed (axios response status code) promises firstly handles by this function.
|
|
13
|
+
* setting tripian.data.hasError to true
|
|
14
|
+
* easy.log calling.
|
|
15
|
+
* If dataKey exist (and dataKey !== 'trip') and httpResponse.data.success is true, httpResponse.data.data is saving to tripian.data[dataKey]
|
|
16
|
+
* @param {AxiosError} errorResponse is axios error response object
|
|
17
|
+
* @param {string} dataKey
|
|
18
|
+
* @returns {AxiosError} errorResponse is axios error response object
|
|
19
|
+
*/
|
|
20
|
+
declare const handleHttpResponseError: (errorResponse: AxiosError<Model.ErrorResponse>, dataKey: string, params?: any) => never;
|
|
21
|
+
export { handleHttpResponseSuccess, handleHttpResponseError };
|
package/index.d.ts
CHANGED
|
@@ -1,43 +1,43 @@
|
|
|
1
|
-
import Model, { Providers } from '@tripian/model';
|
|
2
|
-
import random from './Random';
|
|
3
|
-
import data from './data/data';
|
|
4
|
-
import API from './api/API';
|
|
5
|
-
import ProvidersYelpAPI from './providers/yelp/API';
|
|
6
|
-
import ProvidersGlxAPI from './providers/glx/API';
|
|
7
|
-
import ProvidersGygAPI from './providers/gyg/API';
|
|
8
|
-
import ProvidersBbAPI from './providers/bb/API';
|
|
9
|
-
/**
|
|
10
|
-
* Env
|
|
11
|
-
*/
|
|
12
|
-
declare const ENV: {
|
|
13
|
-
DEV: {
|
|
14
|
-
url: string;
|
|
15
|
-
xApiKey: string;
|
|
16
|
-
};
|
|
17
|
-
TEST: {
|
|
18
|
-
url: string;
|
|
19
|
-
xApiKey: string;
|
|
20
|
-
};
|
|
21
|
-
PROD: {
|
|
22
|
-
url: string;
|
|
23
|
-
xApiKey: string;
|
|
24
|
-
};
|
|
25
|
-
};
|
|
26
|
-
declare let api: API;
|
|
27
|
-
/**
|
|
28
|
-
* This function initilize for web sdk.
|
|
29
|
-
*/
|
|
30
|
-
declare const init: (url: string, xApiKey: string, token?: Model.Token
|
|
31
|
-
declare type Providers = {
|
|
32
|
-
yelp?: ProvidersYelpAPI;
|
|
33
|
-
glx?: ProvidersGlxAPI;
|
|
34
|
-
gyg?: ProvidersGygAPI;
|
|
35
|
-
bb?: ProvidersBbAPI;
|
|
36
|
-
yelpInit: (sandbox?: boolean) => void;
|
|
37
|
-
glxInit: () => Promise<Providers.Glx.Token>;
|
|
38
|
-
gygInit: (sandbox?: boolean) => void;
|
|
39
|
-
bbInit: (sandbox?: boolean) => Promise<void>;
|
|
40
|
-
};
|
|
41
|
-
declare const providers: Providers;
|
|
42
|
-
declare const ver: string;
|
|
43
|
-
export { ver, random, data, api, init, ENV, providers };
|
|
1
|
+
import Model, { Providers } from '@tripian/model';
|
|
2
|
+
import random from './Random';
|
|
3
|
+
import data from './data/data';
|
|
4
|
+
import API from './api/API';
|
|
5
|
+
import ProvidersYelpAPI from './providers/yelp/API';
|
|
6
|
+
import ProvidersGlxAPI from './providers/glx/API';
|
|
7
|
+
import ProvidersGygAPI from './providers/gyg/API';
|
|
8
|
+
import ProvidersBbAPI from './providers/bb/API';
|
|
9
|
+
/**
|
|
10
|
+
* Env
|
|
11
|
+
*/
|
|
12
|
+
declare const ENV: {
|
|
13
|
+
DEV: {
|
|
14
|
+
url: string;
|
|
15
|
+
xApiKey: string;
|
|
16
|
+
};
|
|
17
|
+
TEST: {
|
|
18
|
+
url: string;
|
|
19
|
+
xApiKey: string;
|
|
20
|
+
};
|
|
21
|
+
PROD: {
|
|
22
|
+
url: string;
|
|
23
|
+
xApiKey: string;
|
|
24
|
+
};
|
|
25
|
+
};
|
|
26
|
+
declare let api: API;
|
|
27
|
+
/**
|
|
28
|
+
* This function initilize for web sdk.
|
|
29
|
+
*/
|
|
30
|
+
declare const init: (url: string, xApiKey: string, token?: Model.Token, useCahce?: boolean) => void;
|
|
31
|
+
declare type Providers = {
|
|
32
|
+
yelp?: ProvidersYelpAPI;
|
|
33
|
+
glx?: ProvidersGlxAPI;
|
|
34
|
+
gyg?: ProvidersGygAPI;
|
|
35
|
+
bb?: ProvidersBbAPI;
|
|
36
|
+
yelpInit: (sandbox?: boolean) => void;
|
|
37
|
+
glxInit: () => Promise<Providers.Glx.Token>;
|
|
38
|
+
gygInit: (sandbox?: boolean) => void;
|
|
39
|
+
bbInit: (sandbox?: boolean) => Promise<void>;
|
|
40
|
+
};
|
|
41
|
+
declare const providers: Providers;
|
|
42
|
+
declare const ver: string;
|
|
43
|
+
export { ver, random, data, api, init, ENV, providers };
|
package/index.html
CHANGED
|
@@ -1,115 +1,115 @@
|
|
|
1
|
-
<!DOCTYPE html>
|
|
2
|
-
<html>
|
|
3
|
-
<head>
|
|
4
|
-
<meta charset="UTF-8" />
|
|
5
|
-
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
6
|
-
<title>Tripian Web Core Test</title>
|
|
7
|
-
<!-- <script src="https://unpkg.com/@tripian/core@latest/tcore.umd.js"></script> -->
|
|
8
|
-
<script src="tcore.umd.js"></script>
|
|
9
|
-
</head>
|
|
10
|
-
<body></body>
|
|
11
|
-
<script>
|
|
12
|
-
const url = tcore.ENV.DEV.url; // 'https://fgzpwfdoy1.execute-api.eu-west-1.amazonaws.com/api'
|
|
13
|
-
const xApiKey = tcore.ENV.DEV.xApiKey; // 'oPkgR28N5W1xmZs705Lhf72HnZjj4q2p6KySXuyb'
|
|
14
|
-
|
|
15
|
-
// const url = tcore.ENV.PROD.url; // 'https://0gke6jmyse.execute-api.eu-west-1.amazonaws.com/api'
|
|
16
|
-
// const xApiKey = tcore.ENV.PROD.xApiKey; // '7cq5PBc7Qd2dKkbkTP7Gj3uecDODPtof8CZ3pLNZ'
|
|
17
|
-
|
|
18
|
-
// (url: string, xApiKey: string, token?: Model.Token, useCahce: boolean = true)
|
|
19
|
-
tcore.init(url, xApiKey, undefined, true);
|
|
20
|
-
|
|
21
|
-
// Cities
|
|
22
|
-
// tcore.api.citiesAll().then((cities) => console.log('cities', cities));
|
|
23
|
-
|
|
24
|
-
// Register
|
|
25
|
-
// tcore.api
|
|
26
|
-
// .register({
|
|
27
|
-
// email: '35@35.com',
|
|
28
|
-
// first_name: 'Otuz',
|
|
29
|
-
// last_name: 'Beş',
|
|
30
|
-
// password: 'Tripian*123',
|
|
31
|
-
// profile: {
|
|
32
|
-
// age: 18,
|
|
33
|
-
// answers: [],
|
|
34
|
-
// },
|
|
35
|
-
// })
|
|
36
|
-
// .then(() => {
|
|
37
|
-
// Login
|
|
38
|
-
tcore.api.login({ email: '35@35.com', password: 'Tripian*123' }).then(() => {
|
|
39
|
-
// User Trips
|
|
40
|
-
tcore.api.tripRefs().then((tripRefs) => {
|
|
41
|
-
console.log('tripRefs', tripRefs);
|
|
42
|
-
// User Trips is not empty
|
|
43
|
-
if (tripRefs.length > 0) {
|
|
44
|
-
// First Trip Data
|
|
45
|
-
tcore.api.trip(tripRefs[0].trip_hash).then((trip) => {
|
|
46
|
-
console.log('trip', trip);
|
|
47
|
-
// Trip City Top 10 Pois
|
|
48
|
-
tcore.api.topTen(tripRefs[0].city.id).then((topTenArray) => {
|
|
49
|
-
if (topTenArray.length > 0) console.log('topTen', topTenArray[0].top_ten_poi);
|
|
50
|
-
});
|
|
51
|
-
});
|
|
52
|
-
}
|
|
53
|
-
});
|
|
54
|
-
});
|
|
55
|
-
// });
|
|
56
|
-
|
|
57
|
-
/* Yelp Test
|
|
58
|
-
tcore.providers.yelpInit(undefined, false);
|
|
59
|
-
tcore.providers.yelp.bussiness('gR9DTbKCvezQlqvD7_FzPw').then((bussiness) => {
|
|
60
|
-
console.log('html yelp bussiness', bussiness);
|
|
61
|
-
tcore.providers.yelp.openings('rC5mIHMNF5C1Jtpb2obSkA', '2020-06-15', '12:00', 2).then((openings) => {
|
|
62
|
-
console.log('html yelp openings', openings);
|
|
63
|
-
tcore.providers.yelp.hold('rC5mIHMNF5C1Jtpb2obSkA', '2020-06-15', '12:00', 2, 'unique_mi_unique').then((hold) => {
|
|
64
|
-
console.log('html yelp hold', hold);
|
|
65
|
-
tcore.providers.yelp
|
|
66
|
-
.reservation(
|
|
67
|
-
'rC5mIHMNF5C1Jtpb2obSkA',
|
|
68
|
-
'2020-06-15',
|
|
69
|
-
'12:00',
|
|
70
|
-
2,
|
|
71
|
-
'unique_mi_unique',
|
|
72
|
-
hold.hold_id,
|
|
73
|
-
'Cenan',
|
|
74
|
-
'Yunusoglu',
|
|
75
|
-
'cenan@tripian.com',
|
|
76
|
-
'+1-555-66-777',
|
|
77
|
-
)
|
|
78
|
-
.then((reservation) => {
|
|
79
|
-
console.log('html yelp reservation', reservation);
|
|
80
|
-
});
|
|
81
|
-
});
|
|
82
|
-
});
|
|
83
|
-
});
|
|
84
|
-
*/
|
|
85
|
-
|
|
86
|
-
// tcore.init(tcore.ENV.PROD.url, tcore.ENV.PROD.xApiKey);
|
|
87
|
-
// tcore.api.login({ email: 'umut@tripian.com', password: 'tripiaN123' }).then(() => {
|
|
88
|
-
// tcore.api.trip('f106b4e6dd8148778dd70f552965f686').then(() => {
|
|
89
|
-
// tcore.api.trip('f106b4e6dd8148778dd70f552965f686').then(() => {
|
|
90
|
-
// console.log('trip');
|
|
91
|
-
// console.log(tcore.data.trip.plans[0].steps);
|
|
92
|
-
|
|
93
|
-
// tcore.api.stepAdd({ plan_id: plan_id, poi_id: add_poi }).then(() => {
|
|
94
|
-
// console.log('stepAdd');
|
|
95
|
-
// console.log(tcore.data.trip.plans[0].steps);
|
|
96
|
-
|
|
97
|
-
// newStepId = tcore.data.trip.plans[0].steps[tcore.data.trip.plans[0].steps.length - 1].id;
|
|
98
|
-
|
|
99
|
-
// tcore.api.stepReplace(newStepId, { poi_id: update_poi }).then(() => {
|
|
100
|
-
// console.log('stepReplace');
|
|
101
|
-
// console.log(tcore.data.trip.plans[0].steps);
|
|
102
|
-
|
|
103
|
-
// tcore.api.stepDelete(newStepId).then(() => {
|
|
104
|
-
// console.log('stepDelete');
|
|
105
|
-
// console.log(tcore.data.trip.plans[0].steps);
|
|
106
|
-
|
|
107
|
-
// console.log('son');
|
|
108
|
-
// });
|
|
109
|
-
// });
|
|
110
|
-
// });
|
|
111
|
-
// });
|
|
112
|
-
// });
|
|
113
|
-
// });
|
|
114
|
-
</script>
|
|
115
|
-
</html>
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html>
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8" />
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
6
|
+
<title>Tripian Web Core Test</title>
|
|
7
|
+
<!-- <script src="https://unpkg.com/@tripian/core@latest/tcore.umd.js"></script> -->
|
|
8
|
+
<script src="tcore.umd.js"></script>
|
|
9
|
+
</head>
|
|
10
|
+
<body></body>
|
|
11
|
+
<script>
|
|
12
|
+
const url = tcore.ENV.DEV.url; // 'https://fgzpwfdoy1.execute-api.eu-west-1.amazonaws.com/api'
|
|
13
|
+
const xApiKey = tcore.ENV.DEV.xApiKey; // 'oPkgR28N5W1xmZs705Lhf72HnZjj4q2p6KySXuyb'
|
|
14
|
+
|
|
15
|
+
// const url = tcore.ENV.PROD.url; // 'https://0gke6jmyse.execute-api.eu-west-1.amazonaws.com/api'
|
|
16
|
+
// const xApiKey = tcore.ENV.PROD.xApiKey; // '7cq5PBc7Qd2dKkbkTP7Gj3uecDODPtof8CZ3pLNZ'
|
|
17
|
+
|
|
18
|
+
// (url: string, xApiKey: string, token?: Model.Token, useCahce: boolean = true)
|
|
19
|
+
tcore.init(url, xApiKey, undefined, true);
|
|
20
|
+
|
|
21
|
+
// Cities
|
|
22
|
+
// tcore.api.citiesAll().then((cities) => console.log('cities', cities));
|
|
23
|
+
|
|
24
|
+
// Register
|
|
25
|
+
// tcore.api
|
|
26
|
+
// .register({
|
|
27
|
+
// email: '35@35.com',
|
|
28
|
+
// first_name: 'Otuz',
|
|
29
|
+
// last_name: 'Beş',
|
|
30
|
+
// password: 'Tripian*123',
|
|
31
|
+
// profile: {
|
|
32
|
+
// age: 18,
|
|
33
|
+
// answers: [],
|
|
34
|
+
// },
|
|
35
|
+
// })
|
|
36
|
+
// .then(() => {
|
|
37
|
+
// Login
|
|
38
|
+
tcore.api.login({ email: '35@35.com', password: 'Tripian*123' }).then(() => {
|
|
39
|
+
// User Trips
|
|
40
|
+
tcore.api.tripRefs().then((tripRefs) => {
|
|
41
|
+
console.log('tripRefs', tripRefs);
|
|
42
|
+
// User Trips is not empty
|
|
43
|
+
if (tripRefs.length > 0) {
|
|
44
|
+
// First Trip Data
|
|
45
|
+
tcore.api.trip(tripRefs[0].trip_hash).then((trip) => {
|
|
46
|
+
console.log('trip', trip);
|
|
47
|
+
// Trip City Top 10 Pois
|
|
48
|
+
tcore.api.topTen(tripRefs[0].city.id).then((topTenArray) => {
|
|
49
|
+
if (topTenArray.length > 0) console.log('topTen', topTenArray[0].top_ten_poi);
|
|
50
|
+
});
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
});
|
|
55
|
+
// });
|
|
56
|
+
|
|
57
|
+
/* Yelp Test
|
|
58
|
+
tcore.providers.yelpInit(undefined, false);
|
|
59
|
+
tcore.providers.yelp.bussiness('gR9DTbKCvezQlqvD7_FzPw').then((bussiness) => {
|
|
60
|
+
console.log('html yelp bussiness', bussiness);
|
|
61
|
+
tcore.providers.yelp.openings('rC5mIHMNF5C1Jtpb2obSkA', '2020-06-15', '12:00', 2).then((openings) => {
|
|
62
|
+
console.log('html yelp openings', openings);
|
|
63
|
+
tcore.providers.yelp.hold('rC5mIHMNF5C1Jtpb2obSkA', '2020-06-15', '12:00', 2, 'unique_mi_unique').then((hold) => {
|
|
64
|
+
console.log('html yelp hold', hold);
|
|
65
|
+
tcore.providers.yelp
|
|
66
|
+
.reservation(
|
|
67
|
+
'rC5mIHMNF5C1Jtpb2obSkA',
|
|
68
|
+
'2020-06-15',
|
|
69
|
+
'12:00',
|
|
70
|
+
2,
|
|
71
|
+
'unique_mi_unique',
|
|
72
|
+
hold.hold_id,
|
|
73
|
+
'Cenan',
|
|
74
|
+
'Yunusoglu',
|
|
75
|
+
'cenan@tripian.com',
|
|
76
|
+
'+1-555-66-777',
|
|
77
|
+
)
|
|
78
|
+
.then((reservation) => {
|
|
79
|
+
console.log('html yelp reservation', reservation);
|
|
80
|
+
});
|
|
81
|
+
});
|
|
82
|
+
});
|
|
83
|
+
});
|
|
84
|
+
*/
|
|
85
|
+
|
|
86
|
+
// tcore.init(tcore.ENV.PROD.url, tcore.ENV.PROD.xApiKey);
|
|
87
|
+
// tcore.api.login({ email: 'umut@tripian.com', password: 'tripiaN123' }).then(() => {
|
|
88
|
+
// tcore.api.trip('f106b4e6dd8148778dd70f552965f686').then(() => {
|
|
89
|
+
// tcore.api.trip('f106b4e6dd8148778dd70f552965f686').then(() => {
|
|
90
|
+
// console.log('trip');
|
|
91
|
+
// console.log(tcore.data.trip.plans[0].steps);
|
|
92
|
+
|
|
93
|
+
// tcore.api.stepAdd({ plan_id: plan_id, poi_id: add_poi }).then(() => {
|
|
94
|
+
// console.log('stepAdd');
|
|
95
|
+
// console.log(tcore.data.trip.plans[0].steps);
|
|
96
|
+
|
|
97
|
+
// newStepId = tcore.data.trip.plans[0].steps[tcore.data.trip.plans[0].steps.length - 1].id;
|
|
98
|
+
|
|
99
|
+
// tcore.api.stepReplace(newStepId, { poi_id: update_poi }).then(() => {
|
|
100
|
+
// console.log('stepReplace');
|
|
101
|
+
// console.log(tcore.data.trip.plans[0].steps);
|
|
102
|
+
|
|
103
|
+
// tcore.api.stepDelete(newStepId).then(() => {
|
|
104
|
+
// console.log('stepDelete');
|
|
105
|
+
// console.log(tcore.data.trip.plans[0].steps);
|
|
106
|
+
|
|
107
|
+
// console.log('son');
|
|
108
|
+
// });
|
|
109
|
+
// });
|
|
110
|
+
// });
|
|
111
|
+
// });
|
|
112
|
+
// });
|
|
113
|
+
// });
|
|
114
|
+
</script>
|
|
115
|
+
</html>
|