@tripian/core 4.3.0 → 5.0.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 CHANGED
@@ -91,21 +91,27 @@ declare class Random {
91
91
  * random trip profile
92
92
  *
93
93
  */
94
- static randomTripProfile: (cityId?: number, allAnswers?: number[]) => Model.TripProfile;
94
+ static randomTripProfile: (cityId?: number) => Model.TripProfile;
95
95
  /**
96
96
  * random reservation
97
97
  *
98
98
  */
99
- static randomNewUserReservation: (poiId: number, tripHash?: string) => Model.UserReservationRequest;
99
+ static randomNewUserReservation: (poiId: number, tripHash: string) => Model.UserReservationRequest;
100
+ /**
101
+ * random password
102
+ * @returns {string} random username start with pass
103
+ */
104
+ static randomPassword: () => string;
100
105
  /**
101
106
  * random user update request.
102
107
  *
103
108
  */
104
109
  static randomUser: (allAnswers?: number[]) => Model.UserUpdateRequest;
110
+ static randomUserPassword: () => Model.UserUpdateRequest;
105
111
  /**
106
- * random password
107
- * @returns {string} random username start with pass
112
+ * random register request.
113
+ *
108
114
  */
109
- static randomPassword: () => string;
115
+ static randomNewUser: () => Model.RegisterRequest;
110
116
  }
111
117
  export default Random;
package/api/API.d.ts CHANGED
@@ -16,52 +16,49 @@ declare class API {
16
16
  citiesPage: (page: number, limit?: number) => Promise<Model.DataPayload<Model.City[]>>;
17
17
  citiesAll: () => Promise<Model.City[]>;
18
18
  city: (cityId: number) => Promise<Model.City>;
19
+ citiesSearch: (name: string) => Promise<Model.City[]>;
19
20
  /**
20
21
  * POI
21
22
  */
22
23
  poiCategories: (limit?: number) => Promise<Model.PoiCategory[]>;
23
24
  poisSearch: (poisRequest: Model.PoisRequest) => Promise<Model.DataPayload<Model.Poi[]>>;
24
- poisNameSearch: ({ cityId, name, poiCategories, limit, page }: Model.PoisRequestName) => Promise<Model.DataPayload<Model.Poi[]>>;
25
+ poisNameSearch: ({ cityId, search, poiCategories, limit, page, }: Model.PoisRequestName) => Promise<Model.DataPayload<Model.Poi[]>>;
25
26
  poisCoordinateSearch: ({ poiCategories, coordinate, distance, bounds, limit }: Model.PoisRequestCoordinate) => Promise<Model.Poi[]>;
26
27
  poisMustTrySearch: ({ cityId, mustTryIds, limit }: Model.PoisRequestMustTry) => Promise<Model.Poi[]>;
27
- pois: (poiIds: number[]) => Promise<Model.Poi[]>;
28
+ pois: (poiIds: number[], cityId?: number) => Promise<Model.Poi[]>;
28
29
  poi: (poiId: number) => Promise<Model.Poi>;
29
30
  /**
30
- * Questions
31
- */
32
- private questions;
33
- questionsTrip: (languageCode?: string) => Promise<Model.Question[]>;
34
- questionsProfile: (languageCode?: string) => Promise<Model.Question[]>;
35
- questionsCompanion: (languageCode?: string) => Promise<Model.Question[]>;
36
- questionsAll: (languageCode?: string) => Promise<Model.Question[]>;
37
- /**
38
- * Recommendations
31
+ * Top 10
39
32
  */
33
+ topTen: (cityId: number, poiCategories?: string) => Promise<Model.TopTen[]>;
40
34
  /**
41
35
  * Registers
42
36
  */
43
- private register;
44
- registerEmail: (email: string, password: string, firstName?: string, lastName?: string, profile?: Model.UserProfile) => Promise<Model.User>;
45
- registerUsername: (uniqueUserId: string, firstName?: string, lastName?: string, profile?: Model.UserProfile) => Promise<Model.User>;
37
+ register: (registerRequest: Model.RegisterRequest) => Promise<Model.Token>;
46
38
  /**
47
39
  * Logins
48
40
  */
49
- refreshToken: (force?: boolean) => Promise<Model.Token>;
50
41
  private login;
51
42
  loginEmail: (email: string, password: string) => Promise<Model.Token>;
52
- loginUsername: (uniqueUserId: string) => Promise<Model.Token>;
53
- loginTripHash: (tripHash: string) => Promise<Model.Token>;
43
+ loginCognito: (code: string, redirectUrl: string, device: Model.Device) => Promise<Model.Token>;
44
+ logout: () => Promise<Model.DeleteUpdateResponse>;
45
+ refreshToken: (force?: boolean) => Promise<Model.Token>;
54
46
  /**
55
47
  * User
56
48
  */
57
49
  user: (force?: boolean) => Promise<Model.User>;
58
50
  userUpdate: (userUpdateRequest: Model.UserUpdateRequest) => Promise<Model.User>;
51
+ userDelete: () => Promise<Model.DeleteUpdateResponse>;
52
+ userResetPassword: (email: string) => Promise<Model.UserResetPassword>;
53
+ userUpdatePassword: (password: string, hash: string) => Promise<Model.UserResetPassword>;
59
54
  /**
60
- * Favorites
55
+ * Notifications
61
56
  */
62
- favorites: (cityId: number) => Promise<Model.Favorite[]>;
63
- favoriteAdd: (hash: string, poiId: number) => Promise<Model.Favorite>;
64
- favoriteDelete: (favoriteId: number) => Promise<number>;
57
+ notifications: () => Promise<Model.Notification[]>;
58
+ notificationsUnseen: () => Promise<Model.NotificationUnseen>;
59
+ notificationsUpdateUnseen: () => Promise<Model.DeleteUpdateResponse>;
60
+ notificationsSettings: () => Promise<Model.NotificationSettings[]>;
61
+ notificationsUpdateSettings: (settingId: number, checked: number) => Promise<Model.DeleteUpdateResponse>;
65
62
  /**
66
63
  * Companions
67
64
  */
@@ -70,20 +67,24 @@ declare class API {
70
67
  companionUpdate: (companion: Model.Companion) => Promise<Model.Companion>;
71
68
  companionDelete: (companionId: number) => Promise<number>;
72
69
  /**
73
- * Trips
70
+ * Favorites
74
71
  */
75
- tripRefs: (limit?: number) => Promise<Model.TripReference[]>;
76
- tripRef: (hash: string) => Promise<Model.TripReference>;
77
- trip: (hash: string, minDayIndex?: number, force?: boolean, sleepMs?: number) => Promise<Model.Trip>;
78
- tripAdd: (tripProfile: Model.TripProfile, minDayIndex?: number) => Promise<Model.Trip>;
79
- tripUpdate: (tripHash: string, tripProfile: Model.TripProfile, minDayIndex?: number) => Promise<Model.Trip>;
80
- tripDelete: (hash: string) => Promise<number>;
72
+ favorites: (cityId: number) => Promise<Model.Favorite[]>;
73
+ favoriteAdd: (poiId: number, tripHash?: string) => Promise<Model.Favorite>;
74
+ favoriteDelete: (favoriteId: number) => Promise<number>;
75
+ /**
76
+ * Reactions
77
+ */
78
+ reactions: (tripHash: string, reaction?: Model.REACTION, page?: number) => Promise<Model.UserReaction[]>;
79
+ reactionAdd: (reactionRequest: Model.UserReactionRequest) => Promise<Model.UserReaction>;
80
+ reactionUpdate: (id: number, comment: string) => Promise<Model.UserReaction>;
81
+ reactionDelete: (reactionId: number) => Promise<number>;
81
82
  /**
82
83
  * Plan
83
84
  */
84
85
  plan: (planId: number, generate?: boolean, sleepMs?: number) => Promise<Model.Plan>;
85
86
  private planUpdate;
86
- planUpdateOrders: (planId: number, orders: number[]) => Promise<Model.Plan>;
87
+ planUpdateOrders: (planId: number, stepOrders: number[]) => Promise<Model.Plan>;
87
88
  planUpdateTime: (planId: number, startTime: string, endTime: string) => Promise<Model.Plan>;
88
89
  /**
89
90
  * Step
@@ -92,30 +93,60 @@ declare class API {
92
93
  stepReplace: (stepId: number, newPoiId: number) => Promise<Model.Step>;
93
94
  stepDelete: (stepId: number) => Promise<number>;
94
95
  /**
95
- * Reservations
96
- */
97
- reservations: (cityId?: number, hash?: string, poiId?: number, provider?: string, from?: string, to?: string, limit?: number) => Promise<Model.UserReservation[]>;
98
- reservationAdd: (reservationRequest: Model.UserReservationRequest) => Promise<Model.UserReservation>;
99
- reservationUpdate: (reservation: Model.UserReservation) => Promise<Model.UserReservation>;
100
- reservationDelete: (reservationId: number) => Promise<number>;
101
- /**
102
- * Reactions
96
+ * Questions
103
97
  */
104
- reactions: (hash: string, reaction?: Model.REACTION, from?: string, to?: string, page?: number) => Promise<Model.UserReaction[]>;
105
- reactionAdd: (reactionRequest: Model.UserReactionRequest) => Promise<Model.UserReaction>;
106
- reactionUpdate: (reaction: Model.UserReaction) => Promise<Model.UserReaction>;
107
- reactionDelete: (reactionId: number) => Promise<number>;
98
+ private questions;
99
+ questionsTrip: (cityId?: number, languageCode?: string) => Promise<Model.Question[]>;
100
+ questionsProfile: (cityId?: number, languageCode?: string) => Promise<Model.Question[]>;
101
+ questionsCompanion: (cityId?: number, languageCode?: string) => Promise<Model.Question[]>;
102
+ questionsAll: (cityId?: number, languageCode?: string) => Promise<Model.Question[]>;
108
103
  /**
109
- * Top 10
104
+ * Trips
110
105
  */
111
- topTen: (cityId: number, categoryIds?: number[]) => Promise<Model.TopTen[]>;
106
+ tripRefs: (limit?: number) => Promise<Model.TripReference[]>;
107
+ tripRef: (hash: string) => Promise<Model.TripReference>;
108
+ trip: (tripHash: string, minDayIndex?: number, force?: boolean, sleepMs?: number) => Promise<Model.Trip>;
109
+ tripAdd: (tripProfile: Model.TripProfile, minDayIndex?: number) => Promise<Model.Trip>;
110
+ tripUpdate: (tripHash: string, tripProfile: Model.TripProfile, minDayIndex?: number) => Promise<Model.Trip>;
111
+ tripDelete: (tripHash: string) => Promise<number>;
112
112
  /**
113
- * Alternatives (TODO)
113
+ * Reservations
114
114
  */
115
+ reservations: (cityId?: number, tripHash?: string, poiId?: number, provider?: string, startDate?: string, endDate?: string, limit?: number) => Promise<Model.UserReservation[]>;
116
+ reservationAdd: (reservationRequest: Model.UserReservationRequest) => Promise<Model.UserReservation>;
117
+ reservationUpdate: (reservation: Model.UserReservation) => Promise<Model.UserReservation>;
118
+ reservationDelete: (reservationId: number) => Promise<number>;
115
119
  /**
116
- * Feedback
120
+ * Offers
121
+ */
122
+ productTypes: () => Promise<Model.OfferProductType[]>;
123
+ offerSearch: (dateFrom: string, dateTo: string, boundary: string) => Promise<Model.Poi[]>;
124
+ offerSearchNew: (dateFrom: string, dateTo: string, boundary: string) => Promise<Model.DataPayload<Model.Poi[]>>;
125
+ offers: (dateFrom?: string, dateTo?: string) => Promise<Model.Poi[]>;
126
+ offerUpdateOptIn: (offerId: number, offerClaimDate: string) => Promise<Model.DeleteUpdateResponse>;
127
+ offerDelete: (offerId: number) => Promise<Model.DeleteUpdateResponse>;
128
+ /**
129
+ * Small Business Tools
130
+ */
131
+ businessSearch: (q: string, bounds: string, cityId: number) => Promise<Model.BusinessSearch[]>;
132
+ startVerify: (to_: string, channel: Model.VERIFY_CHANNEL) => Promise<Model.BusinessVerify>;
133
+ checkVerify: (to_: string, channel: Model.VERIFY_CHANNEL, code: string) => Promise<Model.BusinessVerify>;
134
+ business: () => Promise<Model.Business>;
135
+ businessUpdate: (image: {
136
+ url: string;
137
+ }) => Promise<Model.Business>;
138
+ businessOffers: (status: Model.OFFER_STATUS, page?: number, limit?: number) => Promise<Model.DataPayload<Model.Offer[]>>;
139
+ businessOfferAdd: (offerAddRequest: Model.OfferAddRequest) => Promise<Model.Offer>;
140
+ businessOffer: (offerId: number) => Promise<Model.Offer>;
141
+ businessOfferUpdate: (offerId: number, status: Model.OFFER_STATUS) => Promise<Model.Offer>;
142
+ businessOfferDelete: (offerId: number) => Promise<Model.DeleteUpdateResponse>;
143
+ businessOfferCustomers: (offerId: number) => Promise<Model.OfferCustomer[]>;
144
+ businessOfferFileUpload: (file: string) => Promise<{
145
+ url: string;
146
+ }>;
147
+ /**
148
+ * COMBO
117
149
  */
118
- logout: () => void;
119
150
  combo: {
120
151
  /**
121
152
  *
@@ -143,7 +174,7 @@ declare class API {
143
174
  *
144
175
  * Favorite Combo
145
176
  */
146
- favoriteAdd: (hash: string, poiId: number, cityId: number) => Promise<Model.Favorite[]>;
177
+ favoriteAdd: (tripHash: string, poiId: number, cityId: number) => Promise<Model.Favorite[]>;
147
178
  favoriteDelete: (favoriteId: number, cityId: number) => Promise<Model.Favorite[]>;
148
179
  /**
149
180
  *
@@ -167,7 +198,6 @@ declare class API {
167
198
  * Reaction Combo
168
199
  */
169
200
  reactionAdd: (newReaction: Model.UserReactionRequest, tripHash: string) => Promise<Model.UserReaction[]>;
170
- reactionUpdate: (reaction: Model.UserReaction, tripHash: string) => Promise<Model.UserReaction[]>;
171
201
  };
172
202
  }
173
203
  export default API;
@@ -14,38 +14,69 @@ interface ApiConstModel {
14
14
  POI_CATEGORIES: ApiConst;
15
15
  POIS: ApiConst;
16
16
  POI: ApiConst;
17
- QUESTIONS: ApiConst;
17
+ TOP_TEN: ApiConst;
18
18
  REGISTER: ApiConst;
19
+ LOGIN_COGNITO: ApiConst;
19
20
  LOGIN: ApiConst;
20
- REFRESH_TOKEN: ApiConst;
21
+ LOGOUT: ApiConst;
21
22
  USER: ApiConst;
22
23
  USER_UPDATE: ApiConst;
23
- FAVORITES: ApiConst;
24
- FAVORITE_ADD: ApiConst;
25
- FAVORITE_DELETE: ApiConst;
24
+ USER_DELETE: ApiConst;
25
+ REFRESH_TOKEN: ApiConst;
26
+ USER_RESET_PASSWORD: ApiConst;
27
+ USER_UPDATE_PASSWORD: ApiConst;
28
+ NOTIFICATIONS: ApiConst;
29
+ NOTIFICATIONS_UNSEEN: ApiConst;
30
+ NOTIFICATIONS_UPDATE_UNSEEN: ApiConst;
31
+ NOTIFICATIONS_SETTINGS: ApiConst;
32
+ NOTIFICATIONS_UPDATE_SETTINGS: ApiConst;
26
33
  COMPANIONS: ApiConst;
27
34
  COMPANION_ADD: ApiConst;
28
35
  COMPANION_UPDATE: ApiConst;
29
36
  COMPANION_DELETE: ApiConst;
37
+ FAVORITES: ApiConst;
38
+ FAVORITE_ADD: ApiConst;
39
+ FAVORITE_DELETE: ApiConst;
40
+ REACTIONS: ApiConst;
41
+ REACTION_ADD: ApiConst;
42
+ REACTION_UPDATE: ApiConst;
43
+ REACTION_DELETE: ApiConst;
44
+ PLAN: ApiConst;
45
+ PLAN_UPDATE: ApiConst;
46
+ STEP_ALTERNATIVES: ApiConst;
47
+ STEP_ADD: ApiConst;
48
+ STEP_UPDATE: ApiConst;
49
+ STEP_DELETE: ApiConst;
50
+ QUESTIONS: ApiConst;
30
51
  TRIPS: ApiConst;
31
52
  TRIP_WITH_HASH: ApiConst;
32
53
  TRIP: ApiConst;
33
54
  TRIP_ADD: ApiConst;
34
55
  TRIP_UPDATE: ApiConst;
35
56
  TRIP_DELETE: ApiConst;
36
- PLAN: ApiConst;
37
- PLAN_UPDATE: ApiConst;
38
- STEP_ADD: ApiConst;
39
- STEP_UPDATE: ApiConst;
40
- STEP_DELETE: ApiConst;
41
57
  RESERVATIONS: ApiConst;
42
58
  RESERVATION_ADD: ApiConst;
43
59
  RESERVATION_UPDATE: ApiConst;
44
60
  RESERVATION_DELETE: ApiConst;
45
- REACTIONS: ApiConst;
46
- REACTION_ADD: ApiConst;
47
- REACTION_UPDATE: ApiConst;
48
- REACTION_DELETE: ApiConst;
49
- TOP_TEN: ApiConst;
61
+ OFFER_PRODUCT_TYPES: ApiConst;
62
+ OFFERS: ApiConst;
63
+ OFFER: ApiConst;
64
+ OFFER_UPDATE: ApiConst;
65
+ OFFER_DELETE: ApiConst;
66
+ OFFERS_OPT_IN: ApiConst;
67
+ BUSINESS_SEARCH: ApiConst;
68
+ BUSINESS_USER_ASSIGN: ApiConst;
69
+ BUSINESS_VERIFY_START: ApiConst;
70
+ BUSINESS_VERIFY_CHECK: ApiConst;
71
+ BUSINESS: ApiConst;
72
+ BUSINESS_UPDATE: ApiConst;
73
+ BUSINESS_OFFERS: ApiConst;
74
+ BUSINESS_OFFER_ADD: ApiConst;
75
+ BUSINESS_OFFER: ApiConst;
76
+ BUSINESS_OFFER_UPDATE: ApiConst;
77
+ BUSINESS_OFFER_DELETE: ApiConst;
78
+ BUSINESS_OFFER_CUSTOMERS: ApiConst;
79
+ BUSINESS_OFFER_FILE_UPLOAD: ApiConst;
80
+ RECOMMENDATIONS: ApiConst;
50
81
  }
51
82
  export { ApiConst, ApiConstModel };
@@ -5,15 +5,16 @@ export interface DataModel {
5
5
  errors: any[];
6
6
  logs: any[];
7
7
  cities?: Model.City[];
8
- poiCategories?: Model.PoiCategory[];
8
+ poiCategories: Model.PoiCategory[] | undefined;
9
9
  pois: Model.Poi[];
10
10
  questions: Model.Question[];
11
11
  questionsTrip: Model.Question[];
12
12
  questionsProfile: Model.Question[];
13
13
  questionsCompanion: Model.Question[];
14
- recommendations?: Model.Recommendation[];
15
- register?: Model.User;
16
- token?: Model.Token;
14
+ topTens: {
15
+ cityId: number;
16
+ topTen: Model.TopTen[];
17
+ }[];
17
18
  user?: Model.User;
18
19
  favorites: {
19
20
  cityId: number;
@@ -31,10 +32,6 @@ export interface DataModel {
31
32
  tripRefs?: Model.TripReference[];
32
33
  trips: Model.Trip[];
33
34
  trip?: Model.Trip;
34
- topTens: {
35
- cityId: number;
36
- topTen: Model.TopTen[];
37
- }[];
38
35
  poisAll: {
39
36
  cityId: number;
40
37
  categoryGroup: Model.POI_CATEGORY_GROUP;
package/easy/easy.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import MainModel from '@tripian/model';
1
+ import Model from '@tripian/model';
2
2
  declare const easy: {
3
3
  /**
4
4
  * Replace stringQuery, param.key with param.value.
@@ -16,7 +16,7 @@ declare const easy: {
16
16
  * @param {number} id
17
17
  * @returns {string} stringQuery.replace('{id}', id);
18
18
  */
19
- setParameterId: (stringQuery: string, id: number) => string;
19
+ setParameterId: (stringQuery: string, id: number, key: string) => string;
20
20
  /**
21
21
  * Replace stringQuery, all param.key with all param.value foreach params parameter
22
22
  * @param {string} stringQuery
@@ -27,9 +27,9 @@ declare const easy: {
27
27
  key: string;
28
28
  value: string;
29
29
  }[]) => string;
30
- parseAccessToken: (accessToken: string) => MainModel.TokenPayload | undefined;
31
- parseToken: (token: MainModel.Token) => MainModel.TokenPayload | undefined;
32
- accessTokenExpSecond: (tokenPayload: MainModel.TokenPayload) => number;
33
- refreshTokenExpSecond: (tokenPayload: MainModel.TokenPayload) => number;
30
+ parseAccessToken: (idToken: string) => Model.TokenPayload | undefined;
31
+ parseToken: (token: Model.Token) => Model.TokenPayload | undefined;
32
+ accessTokenExpSecond: (tokenPayload: Model.TokenPayload) => number;
33
+ refreshTokenExpSecond: (tokenPayload: Model.TokenPayload) => number;
34
34
  };
35
35
  export default easy;
@@ -45,6 +45,12 @@ declare class Cached {
45
45
  *
46
46
  */
47
47
  static companions: () => Model.Companion[] | undefined;
48
+ /**
49
+ ******************************************************************************
50
+ *
51
+ * Notifications
52
+ *
53
+ */
48
54
  /**
49
55
  ******************************************************************************
50
56
  *
package/index.d.ts CHANGED
@@ -2,6 +2,7 @@ import Model, { Providers } from '@tripian/model';
2
2
  import random from './Random';
3
3
  import data from './data/data';
4
4
  import API from './api/API';
5
+ import easy from './easy/easy';
5
6
  import ProvidersYelpAPI from './providers/yelp/API';
6
7
  import ProvidersGlxAPI from './providers/glx/API';
7
8
  import ProvidersGygAPI from './providers/gyg/API';
@@ -14,14 +15,6 @@ declare const ENV: {
14
15
  url: string;
15
16
  xApiKey: string;
16
17
  };
17
- TEST: {
18
- url: string;
19
- xApiKey: string;
20
- };
21
- PROD: {
22
- url: string;
23
- xApiKey: string;
24
- };
25
18
  };
26
19
  declare let api: API;
27
20
  /**
@@ -40,4 +33,4 @@ declare type Providers = {
40
33
  };
41
34
  declare const providers: Providers;
42
35
  declare const ver: string;
43
- export { ver, random, data, api, init, ENV, providers };
36
+ export { ver, random, data, api, init, easy, ENV, providers };