@revolugo/common 6.12.1-beta.5 → 6.12.1-beta.50

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.
@@ -0,0 +1,153 @@
1
+ import { pick } from '../utils/pick.ts'
2
+
3
+ import { CurrencyCode } from './constants.ts'
4
+ import { CURRENCIES } from './currencies.ts'
5
+
6
+ export const STRIPE_CURRENCY_CODES = [
7
+ CurrencyCode.AED,
8
+ CurrencyCode.AFN,
9
+ CurrencyCode.ALL,
10
+ CurrencyCode.AMD,
11
+ CurrencyCode.ANG,
12
+ CurrencyCode.AOA,
13
+ CurrencyCode.ARS,
14
+ CurrencyCode.AUD,
15
+ CurrencyCode.AWG,
16
+ CurrencyCode.AZN,
17
+ CurrencyCode.BAM,
18
+ CurrencyCode.BBD,
19
+ CurrencyCode.BDT,
20
+ CurrencyCode.BHD,
21
+ CurrencyCode.BGN,
22
+ CurrencyCode.BIF,
23
+ CurrencyCode.BMD,
24
+ CurrencyCode.BND,
25
+ CurrencyCode.BOB,
26
+ CurrencyCode.BRL,
27
+ CurrencyCode.BSD,
28
+ CurrencyCode.BWP,
29
+ CurrencyCode.BZD,
30
+ CurrencyCode.CAD,
31
+ CurrencyCode.CDF,
32
+ CurrencyCode.CHF,
33
+ CurrencyCode.CLP,
34
+ CurrencyCode.CNY,
35
+ CurrencyCode.COP,
36
+ CurrencyCode.CRC,
37
+ CurrencyCode.CVE,
38
+ CurrencyCode.CZK,
39
+ CurrencyCode.DJF,
40
+ CurrencyCode.DKK,
41
+ CurrencyCode.DOP,
42
+ CurrencyCode.DZD,
43
+ CurrencyCode.EGP,
44
+ CurrencyCode.ETB,
45
+ CurrencyCode.EUR,
46
+ CurrencyCode.FJD,
47
+ CurrencyCode.FKP,
48
+ CurrencyCode.GBP,
49
+ CurrencyCode.GEL,
50
+ CurrencyCode.GIP,
51
+ CurrencyCode.GMD,
52
+ CurrencyCode.GNF,
53
+ CurrencyCode.GTQ,
54
+ CurrencyCode.GYD,
55
+ CurrencyCode.HKD,
56
+ CurrencyCode.HNL,
57
+ CurrencyCode.HTG,
58
+ CurrencyCode.HUF,
59
+ CurrencyCode.IDR,
60
+ CurrencyCode.ILS,
61
+ CurrencyCode.INR,
62
+ CurrencyCode.ISK,
63
+ CurrencyCode.JMD,
64
+ CurrencyCode.JOD,
65
+ CurrencyCode.JPY,
66
+ CurrencyCode.KES,
67
+ CurrencyCode.KGS,
68
+ CurrencyCode.KHR,
69
+ CurrencyCode.KMF,
70
+ CurrencyCode.KRW,
71
+ CurrencyCode.KWD,
72
+ CurrencyCode.KYD,
73
+ CurrencyCode.KZT,
74
+ CurrencyCode.LAK,
75
+ CurrencyCode.LBP,
76
+ CurrencyCode.LKR,
77
+ CurrencyCode.LRD,
78
+ CurrencyCode.LSL,
79
+ CurrencyCode.MAD,
80
+ CurrencyCode.MDL,
81
+ CurrencyCode.MGA,
82
+ CurrencyCode.MKD,
83
+ CurrencyCode.MMK,
84
+ CurrencyCode.MNT,
85
+ CurrencyCode.MOP,
86
+ CurrencyCode.MRU,
87
+ CurrencyCode.MUR,
88
+ CurrencyCode.MVR,
89
+ CurrencyCode.MWK,
90
+ CurrencyCode.MXN,
91
+ CurrencyCode.MYR,
92
+ CurrencyCode.MZN,
93
+ CurrencyCode.NAD,
94
+ CurrencyCode.NGN,
95
+ CurrencyCode.NIO,
96
+ CurrencyCode.NOK,
97
+ CurrencyCode.NPR,
98
+ CurrencyCode.NZD,
99
+ CurrencyCode.OMR,
100
+ CurrencyCode.PAB,
101
+ CurrencyCode.PEN,
102
+ CurrencyCode.PGK,
103
+ CurrencyCode.PHP,
104
+ CurrencyCode.PKR,
105
+ CurrencyCode.PLN,
106
+ CurrencyCode.PYG,
107
+ CurrencyCode.QAR,
108
+ CurrencyCode.RON,
109
+ CurrencyCode.RSD,
110
+ CurrencyCode.RUB,
111
+ CurrencyCode.RWF,
112
+ CurrencyCode.SAR,
113
+ CurrencyCode.SBD,
114
+ CurrencyCode.SCR,
115
+ CurrencyCode.SEK,
116
+ CurrencyCode.SGD,
117
+ CurrencyCode.SHP,
118
+ CurrencyCode.SLL,
119
+ CurrencyCode.SOS,
120
+ CurrencyCode.SRD,
121
+ CurrencyCode.STD,
122
+ CurrencyCode.SZL,
123
+ CurrencyCode.THB,
124
+ CurrencyCode.TJS,
125
+ CurrencyCode.TND,
126
+ CurrencyCode.TOP,
127
+ CurrencyCode.TRY,
128
+ CurrencyCode.TTD,
129
+ CurrencyCode.TWD,
130
+ CurrencyCode.TZS,
131
+ CurrencyCode.UAH,
132
+ CurrencyCode.USD,
133
+ CurrencyCode.UYU,
134
+ CurrencyCode.UZS,
135
+ CurrencyCode.VND,
136
+ CurrencyCode.VUV,
137
+ CurrencyCode.WST,
138
+ CurrencyCode.XAF,
139
+ CurrencyCode.XCD,
140
+ CurrencyCode.XOF,
141
+ CurrencyCode.XPF,
142
+ CurrencyCode.YER,
143
+ CurrencyCode.ZAR,
144
+ CurrencyCode.ZMW,
145
+ ] as const
146
+
147
+ export const STRIPE_CURRENCIES = pick(CURRENCIES, STRIPE_CURRENCY_CODES)
148
+
149
+ export const STRIPE_ZERO_DECIMAL_CURRENCIES = Object.values(CURRENCIES)
150
+ .filter(
151
+ currency => currency.zeroDecimal && currency.code in STRIPE_CURRENCIES,
152
+ )
153
+ .map(currency => currency.code)
@@ -1,5 +1,7 @@
1
- export interface ICurrency<T extends string> {
2
- code: T
1
+ import type { CurrencyCode } from './constants.ts'
2
+
3
+ export interface ICurrency {
4
+ code: CurrencyCode
3
5
  decimalDigits: number
4
6
  name: string
5
7
  namePlural: string
@@ -1,9 +1,9 @@
1
- import { CURRENCIES_MAP } from '../currencies/index.ts'
1
+ import { CURRENCIES } from './currencies.ts'
2
2
 
3
- import type { CurrencyCode } from '../constants/currencies.ts'
3
+ import type { CurrencyCode } from './constants.ts'
4
4
 
5
5
  export function getCurrencySymbol(currency: CurrencyCode): string {
6
- const symbol = CURRENCIES_MAP[currency]?.symbol
6
+ const symbol = CURRENCIES[currency]?.symbol
7
7
 
8
8
  if (!symbol) {
9
9
  throw new Error('Requested currency is not listed as valid currency')
@@ -13,16 +13,12 @@ export function getCurrencySymbol(currency: CurrencyCode): string {
13
13
  }
14
14
 
15
15
  export function isZeroDecimal(currency: CurrencyCode): boolean {
16
- return (
17
- (CURRENCIES_MAP[currency] && CURRENCIES_MAP[currency].zeroDecimal) || false
18
- )
16
+ return (CURRENCIES[currency] && CURRENCIES[currency].zeroDecimal) || false
19
17
  }
20
18
 
21
19
  export function isThreeDecimal(currency: CurrencyCode): boolean {
22
20
  return (
23
- (CURRENCIES_MAP[currency] &&
24
- CURRENCIES_MAP[currency].decimalDigits === 3) ||
25
- false
21
+ (CURRENCIES[currency] && CURRENCIES[currency].decimalDigits === 3) || false
26
22
  )
27
23
  }
28
24
 
@@ -83,7 +79,6 @@ export function formatAmount({
83
79
  )
84
80
  }
85
81
 
86
- /* @__PURE__ */
87
82
  export class MoneyCalculator {
88
83
  private amount: number
89
84
  private currency: CurrencyCode
@@ -0,0 +1,212 @@
1
+ export const ICONS_NAME = Object.freeze({
2
+ airplane: 'ph:airplane',
3
+ archive: 'ph:archive',
4
+ arrowDown: 'ph:arrow-down',
5
+ arrowRight: 'ph:arrow-right',
6
+ baby: 'ph:baby',
7
+ bag: 'ph:bag',
8
+ bank: 'ph:bank',
9
+ bed: 'ph:bed',
10
+ bell: 'ph:bell',
11
+ bicycle: 'ph:bicycle',
12
+ book: 'ph:book',
13
+ bookOpen: 'ph:book-open',
14
+ bowlingBall: 'ph:bowling-ball',
15
+ building: 'ph:building',
16
+ buildings: 'ph:buildings',
17
+ bus: 'ph:bus',
18
+ cake: 'ph:cake',
19
+ calculator: 'ph:calculator',
20
+ calendar: 'ph:calendar-blank',
21
+ car: 'ph:car',
22
+ caretDown: 'ph:caret-down',
23
+ caretRight: 'ph:caret-right',
24
+ caretUp: 'ph:caret-up',
25
+ caretUpDown: 'ph:caret-up-down',
26
+ chair: 'ph:chair',
27
+ chalkboard: 'ph:chalkboard',
28
+ champagne: 'ph:champagne',
29
+ chatOff: 'ph:chat-circle-slash',
30
+ check: 'ph:check',
31
+ checkCircle: 'ph:check-circle',
32
+ checkFat: 'ph:check-fat',
33
+ checks: 'ph:checks',
34
+ cheers: 'ph:cheers',
35
+ church: 'ph:church',
36
+ circle: 'ph:circle',
37
+ circleNotch: 'ph:circle-notch',
38
+ clock: 'ph:clock',
39
+ close: 'ph:x',
40
+ closeCircle: 'ph:x-circle',
41
+ cloud: 'ph:cloud',
42
+ cloudDown: 'ph:cloud-arrow-down',
43
+ cloudUp: 'ph:cloud-arrow-up',
44
+ coffee: 'ph:coffee',
45
+ coinVertical: 'ph:coin-vertical',
46
+ comment: 'ph:chat-teardrop',
47
+ copy: 'ph:copy',
48
+ cross: 'ph:cross',
49
+ desktop: 'ph:desktop',
50
+ deviceMobile: 'ph:device-mobile',
51
+ deviceTablet: 'ph:device-tablet',
52
+ diceSix: 'ph:dice-six',
53
+ doorOpen: 'ph:door-open',
54
+ dotsThree: 'ph:dots-three',
55
+ download: 'ph:download-simple',
56
+ egg: 'ph:egg',
57
+ elevator: 'ph:elevator',
58
+ envelope: 'ph:envelope',
59
+ euro: 'ph:currency-eur',
60
+ exclamation: 'ph:exclamation-mark',
61
+ expand: 'ph:arrows-out-simple',
62
+ external: 'ph:arrow-square-out',
63
+ eye: 'ph:eye',
64
+ eyeClosed: 'ph:eye-closed',
65
+ eyeSlash: 'ph:eye-slash',
66
+ file: 'ph:file',
67
+ fileJpg: 'ph:file-jpg',
68
+ filePdf: 'ph:file-pdf',
69
+ filePng: 'ph:file-png',
70
+ fileSearch: 'ph:file-search',
71
+ fileText: 'ph:file-text',
72
+ fileXls: 'ph:file-xls',
73
+ filmReel: 'ph:film-reel',
74
+ fire: 'ph:fire',
75
+ fish: 'ph:fish',
76
+ flag: 'ph:flag',
77
+ floppyDisk: 'ph:floppy-disk',
78
+ flower: 'ph:flower',
79
+ forkKnife: 'ph:fork-knife',
80
+ funnelSimple: 'ph:funnel-simple',
81
+ gameController: 'ph:game-controller',
82
+ gasPump: 'ph:gas-pump',
83
+ gavel: 'ph:gavel',
84
+ gear: 'ph:gear',
85
+ globe: 'ph:globe',
86
+ graph: 'ph:graph',
87
+ gym: 'ph:barbell',
88
+ hammer: 'ph:hammer',
89
+ handPeace: 'ph:hand-peace',
90
+ heart: 'ph:heart',
91
+ hospital: 'ph:hospital',
92
+ house: 'ph:house',
93
+ idBadge: 'ph:identification-badge',
94
+ image: 'ph:image',
95
+ images: 'ph:images',
96
+ info: 'ph:info',
97
+ key: 'ph:key',
98
+ leaf: 'ph:leaf',
99
+ lightning: 'ph:lightning',
100
+ link: 'ph:link',
101
+ linkBreak: 'ph:link-break',
102
+ lock: 'ph:lock',
103
+ lockKey: 'ph:lock-key',
104
+ lockKeyOpen: 'ph:lock-key-open',
105
+ lockOpen: 'ph:lock-open',
106
+ magnifyingGlass: 'ph:magnifying-glass',
107
+ mapPin: 'ph:map-pin',
108
+ mapPinArea: 'ph:map-pin-area',
109
+ mapPinSimpleArea: 'ph:map-pin-simple-area',
110
+ medical: 'ph:first-aid-kit',
111
+ minus: 'ph:minus',
112
+ minusCircle: 'ph:minus-circle',
113
+ money: 'ph:money',
114
+ mosque: 'ph:mosque',
115
+ musicNotes: 'ph:music-notes',
116
+ note: 'ph:note',
117
+ paintBrush: 'ph:paint-brush',
118
+ palette: 'ph:palette',
119
+ paperPlaneTilt: 'ph:paper-plane-tilt',
120
+ parkingSign: 'ph:letter-circle-p',
121
+ pauseCircle: 'ph:pause-circle',
122
+ pawPrint: 'ph:paw-print',
123
+ pencil: 'ph:pencil',
124
+ phone: 'ph:phone',
125
+ pill: 'ph:pill',
126
+ plus: 'ph:plus',
127
+ plusCircle: 'ph:plus-circle',
128
+ policeCar: 'ph:police-car',
129
+ praying: 'ph:hands-praying',
130
+ questionMark: 'ph:question-mark',
131
+ refresh: 'ph:arrows-counter-clockwise',
132
+ running: 'ph:person-simple-run',
133
+ scissors: 'ph:scissors',
134
+ shield: 'ph:shield',
135
+ shirt: 'ph:shirt-folded',
136
+ shoppingCart: 'ph:shopping-cart',
137
+ shrink: 'ph:arrows-in-simple',
138
+ signOut: 'ph:sign-out',
139
+ sneakerMove: 'ph:sneaker-move',
140
+ soccerBall: 'ph:soccer-ball',
141
+ spinner: 'ph:spinner',
142
+ star: 'ph:star',
143
+ starHalf: 'ph:star-half',
144
+ stethoscope: 'ph:stethoscope',
145
+ stop: 'ph:stop',
146
+ storefront: 'ph:storefront',
147
+ student: 'ph:student',
148
+ subway: 'ph:subway',
149
+ synagogue: 'ph:synagogue',
150
+ tShirt: 'ph:t-shirt',
151
+ taxi: 'ph:taxi',
152
+ tent: 'ph:tent',
153
+ thumbsUp: 'ph:thumbs-up',
154
+ tooth: 'ph:tooth',
155
+ train: 'ph:train',
156
+ trash: 'ph:trash',
157
+ tree: 'ph:tree',
158
+ trendDown: 'ph:trend-down',
159
+ trendUp: 'ph:trend-up',
160
+ truck: 'ph:truck',
161
+ upload: 'ph:upload-simple',
162
+ uploadThick: 'ph:arrow-fat-line-up',
163
+ user: 'ph:user',
164
+ users: 'ph:users',
165
+ usersThree: 'ph:users-three',
166
+ van: 'ph:van',
167
+ walking: 'ph:person-simple-walk',
168
+ warning: 'ph:warning',
169
+ warningCircle: 'ph:warning-circle',
170
+ wifiHigh: 'ph:wifi-high',
171
+ wifiSlash: 'ph:wifi-slash',
172
+ wine: 'ph:wine',
173
+ wrench: 'ph:wrench',
174
+ })
175
+
176
+ export const ICON_NAMES = Object.keys(ICONS_NAME)
177
+
178
+ export const ICONS_TO_FA_ICONS: Partial<
179
+ Record<keyof typeof ICONS_NAME, string>
180
+ > = {
181
+ baby: 'child',
182
+ bus: 'bus',
183
+ clock: 'clock',
184
+ coffee: 'mug-saucer',
185
+ euro: 'euro-sign',
186
+ handPeace: 'hand-peace',
187
+ heart: 'heart',
188
+ house: 'house',
189
+ idBadge: 'id-badge',
190
+ leaf: 'leaf',
191
+ running: 'person-running',
192
+ shirt: 'shirt',
193
+ star: 'star',
194
+ van: 'van-shuttle',
195
+ }
196
+
197
+ export const FA_ICONS_TO_ICONS = {
198
+ bus: ICONS_NAME.bus,
199
+ child: ICONS_NAME.baby,
200
+ clock: ICONS_NAME.clock,
201
+ 'euro-sign': ICONS_NAME.euro,
202
+ 'hand-peace': ICONS_NAME.handPeace,
203
+ heart: ICONS_NAME.heart,
204
+ house: ICONS_NAME.house,
205
+ 'id-badge': ICONS_NAME.idBadge,
206
+ leaf: ICONS_NAME.leaf,
207
+ 'mug-hot': ICONS_NAME.coffee,
208
+ 'person-running': ICONS_NAME.running,
209
+ shirt: ICONS_NAME.shirt,
210
+ star: ICONS_NAME.star,
211
+ 'van-shuttle': ICONS_NAME.van,
212
+ }
@@ -1,4 +1,4 @@
1
1
  // eslint-disable-next-line no-restricted-imports
2
- import type { CurrencyCode } from '../../currencies/index.ts'
2
+ import type { CurrencyCode } from '../../currencies/constants.ts'
3
3
 
4
4
  export type CurrencyType = `${CurrencyCode}`
@@ -6,7 +6,7 @@ import type { HotelRoomOffer } from './hotel-room-offer.ts'
6
6
  import type { Tag } from './tag.ts'
7
7
  import type { TravelTimeItem } from './travel-times.ts'
8
8
  // eslint-disable-next-line no-restricted-imports
9
- import type { CurrencyCode } from '../../currencies/index.ts'
9
+ import type { CurrencyCode } from '../../currencies/constants.ts'
10
10
 
11
11
  export interface HotelOffer {
12
12
  /**
@@ -0,0 +1,10 @@
1
+ import type { CurrencyType } from './currency.ts'
2
+ // eslint-disable-next-line no-restricted-imports
3
+ import type { Locale } from '../../constants/index.ts'
4
+
5
+ export interface HotelRoomOffersListPayload {
6
+ currency: CurrencyType
7
+ hotelRoomOfferRequestId: string
8
+ lang?: Locale
9
+ limit?: number | null
10
+ }
@@ -138,3 +138,6 @@ export type HotelRoomOfferRequestCreate = Pick<
138
138
  | 'roomCount'
139
139
  | 'sourceMarket'
140
140
  >
141
+ export interface HotelRoomOfferRequestsCreatePayload {
142
+ hotelRoomOfferRequestCreateApi?: HotelRoomOfferRequestCreate
143
+ }
@@ -22,3 +22,4 @@ export * from './contact-person.ts'
22
22
  export type * from './hotel-review-rating.ts'
23
23
  export type * from './travel-times.ts'
24
24
  export * from './hotel-offer-list.ts'
25
+ export type * from './hotel-room-offer-list.ts'
@@ -22,6 +22,12 @@ export interface MetaPollingResponse {
22
22
  * @memberof MetaApiPollingResponse
23
23
  */
24
24
  startingAfter?: string | null
25
+ /**
26
+ *
27
+ * @type {number}
28
+ * @memberof HotelOffersApiResponseMeta
29
+ */
30
+ totalCount?: number | null
25
31
  /**
26
32
  *
27
33
  * @type {PollerType}
@@ -1,10 +1,10 @@
1
1
  export type * from '../countries/types.ts'
2
+ export type * from '../currencies/types.ts'
2
3
 
3
4
  export type * from './api.ts'
4
5
  export * from './booking.ts'
5
6
  export type * from './calendar.ts'
6
7
  export type * from './cancellation-policy.ts'
7
- export type * from './currency.ts'
8
8
  export type * from './date.ts'
9
9
  export type * from './event.ts'
10
10
  export type * from './geo-coordinates.ts'
@@ -14,6 +14,7 @@ export enum PaymentProvider {
14
14
  Stripe = 'STRIPE',
15
15
  Qonto = 'QONTO',
16
16
  IbanFirst = 'IBANFIRST',
17
+ Revolut = 'REVOLUT',
17
18
  }
18
19
 
19
20
  export enum PublicPaymentMethod {
@@ -8,7 +8,6 @@ export * from './compact.ts'
8
8
  export * from './compute-margin-rate.ts'
9
9
  export * from './compute-selling-price.ts'
10
10
  export * from './create-composite-key.ts'
11
- export * from './currency.ts'
12
11
  export * from './dates.ts'
13
12
  export * from './dayjs.ts'
14
13
  export * from './debounce.ts'