@mirai/core 0.4.33 → 0.4.35

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.
@@ -33,7 +33,7 @@ const bookingResponse = function () {
33
33
  // ! -- TODO: Try to get all data from store -------------------------------------------------------------------------
34
34
  const {
35
35
  idchain,
36
- idtokenprovider: hotelId
36
+ idHotel: hotelId
37
37
  } = (0, _helpers.fetchUrlParams)(location.search);
38
38
 
39
39
  // ! -- TODO: use of tracking should be a temporary approach ---------------------------------------------------------
@@ -41,10 +41,10 @@ const bookingResponse = function () {
41
41
  bookingValues: {
42
42
  checkin,
43
43
  checkout,
44
+ country,
44
45
  coupon: promocode = '',
45
46
  nights
46
47
  } = {},
47
- country,
48
48
  guestData: {
49
49
  country: nationality,
50
50
  email,
@@ -58,7 +58,7 @@ const bookingResponse = function () {
58
58
  propertyName,
59
59
  propertyType
60
60
  } = {},
61
- reservationCode,
61
+ idReservation: reservationCode,
62
62
  reservationDate,
63
63
  reservedExtras = {},
64
64
  reservedRooms = [],
@@ -140,7 +140,7 @@ const bookingResponse = function () {
140
140
  checkin,
141
141
  checkout,
142
142
  city: hotelCity,
143
- cityZone: undefined,
143
+ cityZone: '',
144
144
  coupon: promocode,
145
145
  currency: hotelCurrency.code,
146
146
  device: mobile ? 'MOBILE' : 'DESKTOP_TABLET',
@@ -169,18 +169,39 @@ const bookingResponse = function () {
169
169
  state_provice: hotelProvince,
170
170
  step,
171
171
  surname: lastName,
172
+ nationality,
172
173
  totalCommission: (0, _legacy.formatPrice)(totalPriceCommission, hotelCurrency),
173
174
  totalExtrasTaxes: (0, _legacy.formatPrice)(totalExtrasTaxes, hotelCurrency),
174
- totalExtrasWithTaxes: (0, _legacy.formatPrice)(totalExtrasWithTaxes, hotelCurrency),
175
175
  totalExtrasWithoutTaxes: (0, _legacy.formatPrice)(totalExtrasWithoutTaxes, hotelCurrency),
176
+ totalExtrasWithTaxes: (0, _legacy.formatPrice)(totalExtrasWithTaxes, hotelCurrency),
176
177
  totalPrice: (0, _legacy.formatPrice)(totalPriceWithTaxes, hotelCurrency),
177
178
  totalPriceWithoutTaxes: (0, _legacy.formatPrice)(totalPriceWithoutTaxes, hotelCurrency),
178
- totalPriceWithTaxesWithExtras: (0, _legacy.formatPrice)(totalPriceWithTaxes, hotelCurrency),
179
- totalPriceWithTaxesWithoutExtras: (0, _legacy.formatPrice)(totalPriceWithTaxesWithoutExtras, hotelCurrency),
180
179
  totalPriceWithoutTaxesWithExtras: (0, _legacy.formatPrice)(totalPriceWithoutTaxes, hotelCurrency),
181
180
  totalPriceWithoutTaxesWithoutExtras: (0, _legacy.formatPrice)(totalPriceWithoutTaxesWithoutExtras, hotelCurrency),
181
+ totalPriceWithTaxesWithExtras: (0, _legacy.formatPrice)(totalPriceWithTaxes, hotelCurrency),
182
+ totalPriceWithTaxesWithoutExtras: (0, _legacy.formatPrice)(totalPriceWithTaxesWithoutExtras, hotelCurrency),
182
183
  totalTaxes: (0, _legacy.formatPrice)(totalTaxes, hotelCurrency),
183
- nationality,
184
+ transactionAffiliation: propertyName,
185
+ transactionId: 'Reservation code ' + reservationCode,
186
+ transactionProducts: [...reservedRooms.map(function () {
187
+ let room = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
188
+ return {
189
+ sku: room.defaultMediumName,
190
+ name: propertyName,
191
+ category: room.defaultBoardDescription,
192
+ price: (0, _legacy.formatPrice)(room.averagePriceWithoutTaxes, hotelCurrency),
193
+ quantity: nights * room.numRoomsToReserve
194
+ };
195
+ }), ...Object.values(reservedExtras).map(extra => ({
196
+ sku: extra.name,
197
+ name: propertyName,
198
+ category: 'Extra',
199
+ price: (0, _legacy.formatPrice)(extra.unitaryPriceWithoutTaxes, hotelCurrency),
200
+ quantity: extra.multiplierPrice
201
+ }))],
202
+ transactionShipping: parseFloat(totalPriceCommission),
203
+ transactionTax: (0, _legacy.formatPrice)(totalTaxes, hotelCurrency),
204
+ transactionTotal: (0, _legacy.formatPrice)(totalPriceWithoutTaxes, hotelCurrency),
184
205
  userCountry: country,
185
206
  userCurrency: currency,
186
207
  userLogged: !!session
@@ -1 +1 @@
1
- {"version":3,"file":"bookingResponse.js","names":["_duetto","require","_Core","_helpers","_helpers2","_helpers3","_legacy","ACCOMMODATION_TYPE_NAME","Object","keys","ACCOMMODATION_TYPE","bookingResponse","_variants$hotelId","device","mobile","response","tracking","store","currency","hotel","accommodationType","variants","language","session","arguments","length","undefined","idchain","idtokenprovider","hotelId","fetchUrlParams","location","search","bookingValues","checkin","checkout","coupon","promocode","nights","country","guestData","nationality","email","firstName","lastName","hotelInfo","hotelCity","hotelProvince","hotelCurrency","propertyName","propertyType","reservationCode","reservationDate","reservedExtras","reservedRooms","step","totalPriceCommission","totalExtrasTaxes","totalExtrasWithTaxes","totalExtrasWithoutTaxes","totalNumAdults","totalNumChildren","totalNumRooms","totalPriceWithTaxes","totalPriceWithTaxesWithoutExtras","totalPriceWithoutTaxes","totalPriceWithoutTaxesWithoutExtras","totalTaxes","rooms","map","averagePriceWithoutTaxes","daysPriceBoard","defaultBoardDescription","numRoomsToReserve","occupation","numAdults","numBabies","totalChildren","numChildren","rateId","rateName","roomTypeName","priceWithTaxes","priceWithoutTaxes","forEach","day","boardName","numRooms","roomName","unitaryPriceWithoutTaxes","formatPrice","extras","values","amount","id","name","nightsToApply","unitaryPriceWithTaxes","extraId","extraName","dataLayer","chainId","city","cityZone","code","emailSHA256","SHA256","event","home","document","hostname","lodgingDenomination","products","state_provice","surname","totalCommission","totalPrice","totalPriceWithTaxesWithExtras","totalPriceWithoutTaxesWithExtras","userCountry","userCurrency","userLogged","dataLayerPush","duettoBookingResponse","exports"],"sources":["../../../../../src/contexts/PerformanceManager/providers/gtm/bookingResponse.js"],"sourcesContent":["import { bookingResponse as duettoBookingResponse } from './duetto';\nimport { ACCOMMODATION_TYPE } from '../../../../Core.constants';\nimport { fetchUrlParams } from '../../../../helpers';\nimport { dataLayerPush } from '../../helpers';\nimport { SHA256 } from '../helpers';\nimport { formatPrice } from '../helpers/legacy';\n\nconst ACCOMMODATION_TYPE_NAME = Object.keys(ACCOMMODATION_TYPE);\n\nexport const bookingResponse = ({\n device: { mobile } = {},\n response: { tracking = {} } = {},\n store: { currency, hotel: { accommodationType, variants = {} } = {}, language, session } = {},\n} = {}) => {\n // ! -- TODO: Try to get all data from store -------------------------------------------------------------------------\n const { idchain, idtokenprovider: hotelId } = fetchUrlParams(location.search);\n\n // ! -- TODO: use of tracking should be a temporary approach ---------------------------------------------------------\n const {\n bookingValues: { checkin, checkout, coupon: promocode = '', nights } = {},\n country,\n guestData: { country: nationality, email, firstName, lastName } = {},\n hotelInfo: { hotelCity, hotelProvince, currency: hotelCurrency = {}, propertyName, propertyType } = {},\n reservationCode,\n reservationDate,\n reservedExtras = {},\n reservedRooms = [],\n step,\n totalPriceCommission,\n totalExtrasTaxes,\n totalExtrasWithTaxes,\n totalExtrasWithoutTaxes,\n totalNumAdults,\n totalNumChildren,\n totalNumRooms,\n totalPriceWithTaxes,\n totalPriceWithTaxesWithoutExtras,\n totalPriceWithoutTaxes,\n totalPriceWithoutTaxesWithoutExtras,\n totalTaxes,\n } = tracking;\n\n const rooms = reservedRooms.map(\n ({\n averagePriceWithoutTaxes,\n daysPriceBoard = [],\n defaultBoardDescription,\n numRoomsToReserve,\n occupation: { numAdults, numBabies, totalChildren: numChildren } = {},\n rateId,\n rateName,\n roomTypeName,\n } = {}) => {\n let priceWithTaxes = 0;\n let priceWithoutTaxes = 0;\n daysPriceBoard.forEach((day) => {\n priceWithTaxes += day.priceWithTaxes;\n priceWithoutTaxes += day.priceWithoutTaxes;\n });\n\n return {\n boardName: defaultBoardDescription,\n numRooms: numRoomsToReserve,\n occupation: { numAdults, numChildren, numBabies },\n rateId,\n rateName,\n roomName: roomTypeName,\n priceWithTaxes,\n priceWithoutTaxes,\n unitaryPriceWithoutTaxes: formatPrice(averagePriceWithoutTaxes, hotelCurrency),\n };\n },\n );\n\n const extras = Object.values(reservedExtras).map(\n ({\n amount,\n id,\n name,\n nightsToApply,\n totalPriceWithTaxes,\n totalPriceWithoutTaxes,\n unitaryPriceWithTaxes,\n unitaryPriceWithoutTaxes,\n } = {}) => ({\n amount,\n extraId: id,\n extraName: name,\n nightsToApply,\n totalPriceWithTaxes,\n totalPriceWithoutTaxes,\n unitaryPriceWithTaxes,\n unitaryPriceWithoutTaxes,\n }),\n );\n\n const dataLayer = {\n chainId: idchain,\n checkin,\n checkout,\n city: hotelCity,\n cityZone: undefined,\n coupon: promocode,\n currency: hotelCurrency.code,\n device: mobile ? 'MOBILE' : 'DESKTOP_TABLET',\n email,\n emailSHA256: SHA256(email),\n event: 'init',\n home: document.location.hostname,\n hotelId,\n language,\n lodgingDenomination: ACCOMMODATION_TYPE_NAME[variants[hotelId]?.accommodationType || accommodationType],\n name: firstName,\n nights,\n numAdults: totalNumAdults,\n numChildren: totalNumChildren,\n numRooms: totalNumRooms,\n products: { rooms, extras, checkin, checkout },\n propertyName,\n propertyType,\n reservationCode,\n reservationDate,\n state_provice: hotelProvince,\n step,\n surname: lastName,\n totalCommission: formatPrice(totalPriceCommission, hotelCurrency),\n totalExtrasTaxes: formatPrice(totalExtrasTaxes, hotelCurrency),\n totalExtrasWithTaxes: formatPrice(totalExtrasWithTaxes, hotelCurrency),\n totalExtrasWithoutTaxes: formatPrice(totalExtrasWithoutTaxes, hotelCurrency),\n totalPrice: formatPrice(totalPriceWithTaxes, hotelCurrency),\n totalPriceWithoutTaxes: formatPrice(totalPriceWithoutTaxes, hotelCurrency),\n totalPriceWithTaxesWithExtras: formatPrice(totalPriceWithTaxes, hotelCurrency),\n totalPriceWithTaxesWithoutExtras: formatPrice(totalPriceWithTaxesWithoutExtras, hotelCurrency),\n totalPriceWithoutTaxesWithExtras: formatPrice(totalPriceWithoutTaxes, hotelCurrency),\n totalPriceWithoutTaxesWithoutExtras: formatPrice(totalPriceWithoutTaxesWithoutExtras, hotelCurrency),\n totalTaxes: formatPrice(totalTaxes, hotelCurrency),\n nationality,\n userCountry: country,\n userCurrency: currency,\n userLogged: !!session,\n };\n\n dataLayerPush(dataLayer);\n duettoBookingResponse({ checkin, checkout, hotelCurrency, reservedRooms, ...tracking });\n\n return dataLayer;\n};\n"],"mappings":";;;;;;AAAA,IAAAA,OAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA;AACA,IAAAG,SAAA,GAAAH,OAAA;AACA,IAAAI,SAAA,GAAAJ,OAAA;AACA,IAAAK,OAAA,GAAAL,OAAA;AAEA,MAAMM,uBAAuB,GAAGC,MAAM,CAACC,IAAI,CAACC,wBAAkB,CAAC;AAExD,MAAMC,eAAe,GAAG,SAAAA,CAAA,EAIpB;EAAA,IAAAC,iBAAA;EAAA,IAJqB;IAC9BC,MAAM,EAAE;MAAEC;IAAO,CAAC,GAAG,CAAC,CAAC;IACvBC,QAAQ,EAAE;MAAEC,QAAQ,GAAG,CAAC;IAAE,CAAC,GAAG,CAAC,CAAC;IAChCC,KAAK,EAAE;MAAEC,QAAQ;MAAEC,KAAK,EAAE;QAAEC,iBAAiB;QAAEC,QAAQ,GAAG,CAAC;MAAE,CAAC,GAAG,CAAC,CAAC;MAAEC,QAAQ;MAAEC;IAAQ,CAAC,GAAG,CAAC;EAC9F,CAAC,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,CAAC,CAAC;EACJ;EACA,MAAM;IAAEG,OAAO;IAAEC,eAAe,EAAEC;EAAQ,CAAC,GAAG,IAAAC,uBAAc,EAACC,QAAQ,CAACC,MAAM,CAAC;;EAE7E;EACA,MAAM;IACJC,aAAa,EAAE;MAAEC,OAAO;MAAEC,QAAQ;MAAEC,MAAM,EAAEC,SAAS,GAAG,EAAE;MAAEC;IAAO,CAAC,GAAG,CAAC,CAAC;IACzEC,OAAO;IACPC,SAAS,EAAE;MAAED,OAAO,EAAEE,WAAW;MAAEC,KAAK;MAAEC,SAAS;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AC;EAED,IAAAmG,uBAAa,EAACtB,SAAS,CAAC;EACxB,IAAAuB,uBAAqB,EAAC;IAAEzF,OAAO;IAAEC,QAAQ;IAAEa,aAAa;IAAEM,aAAa;IAAE,GAAGtC;EAAS,CAAC,CAAC;EAEvF,OAAOoF,SAAS;AAClB,CAAC;AAACwB,OAAA,CAAAjH,eAAA,GAAAA,eAAA"}
1
+ {"version":3,"file":"bookingResponse.js","names":["_duetto","require","_Core","_helpers","_helpers2","_helpers3","_legacy","ACCOMMODATION_TYPE_NAME","Object","keys","ACCOMMODATION_TYPE","bookingResponse","_variants$hotelId","device","mobile","response","tracking","store","currency","hotel","accommodationType","variants","language","session","arguments","length","undefined","idchain","idHotel","hotelId","fetchUrlParams","location","search","bookingValues","checkin","checkout","country","coupon","promocode","nights","guestData","nationality","email","firstName","lastName","hotelInfo","hotelCity","hotelProvince","hotelCurrency","propertyName","propertyType","idReservation","reservationCode","reservationDate","reservedExtras","reservedRooms","step","totalPriceCommission","totalExtrasTaxes","totalExtrasWithTaxes","totalExtrasWithoutTaxes","totalNumAdults","totalNumChildren","totalNumRooms","totalPriceWithTaxes","totalPriceWithTaxesWithoutExtras","totalPriceWithoutTaxes","totalPriceWithoutTaxesWithoutExtras","totalTaxes","rooms","map","averagePriceWithoutTaxes","daysPriceBoard","defaultBoardDescription","numRoomsToReserve","occupation","numAdults","numBabies","totalChildren","numChildren","rateId","rateName","roomTypeName","priceWithTaxes","priceWithoutTaxes","forEach","day","boardName","numRooms","roomName","unitaryPriceWithoutTaxes","formatPrice","extras","values","amount","id","name","nightsToApply","unitaryPriceWithTaxes","extraId","extraName","dataLayer","chainId","city","cityZone","code","emailSHA256","SHA256","event","home","document","hostname","lodgingDenomination","products","state_provice","surname","totalCommission","totalPrice","totalPriceWithoutTaxesWithExtras","totalPriceWithTaxesWithExtras","transactionAffiliation","transactionId","transactionProducts","room","sku","defaultMediumName","category","price","quantity","extra","multiplierPrice","transactionShipping","parseFloat","transactionTax","transactionTotal","userCountry","userCurrency","userLogged","dataLayerPush","duettoBookingResponse","exports"],"sources":["../../../../../src/contexts/PerformanceManager/providers/gtm/bookingResponse.js"],"sourcesContent":["import { bookingResponse as duettoBookingResponse } from './duetto';\nimport { ACCOMMODATION_TYPE } from '../../../../Core.constants';\nimport { fetchUrlParams } from '../../../../helpers';\nimport { dataLayerPush } from '../../helpers';\nimport { SHA256 } from '../helpers';\nimport { formatPrice } from '../helpers/legacy';\n\nconst ACCOMMODATION_TYPE_NAME = Object.keys(ACCOMMODATION_TYPE);\n\nexport const bookingResponse = ({\n device: { mobile } = {},\n response: { tracking = {} } = {},\n store: { currency, hotel: { accommodationType, variants = {} } = {}, language, session } = {},\n} = {}) => {\n // ! -- TODO: Try to get all data from store -------------------------------------------------------------------------\n const { idchain, idHotel: hotelId } = fetchUrlParams(location.search);\n\n // ! -- TODO: use of tracking should be a temporary approach ---------------------------------------------------------\n const {\n bookingValues: { checkin, checkout, country, coupon: promocode = '', nights } = {},\n guestData: { country: nationality, email, firstName, lastName } = {},\n hotelInfo: { hotelCity, hotelProvince, currency: hotelCurrency = {}, propertyName, propertyType } = {},\n idReservation: reservationCode,\n reservationDate,\n reservedExtras = {},\n reservedRooms = [],\n step,\n totalPriceCommission,\n totalExtrasTaxes,\n totalExtrasWithTaxes,\n totalExtrasWithoutTaxes,\n totalNumAdults,\n totalNumChildren,\n totalNumRooms,\n totalPriceWithTaxes,\n totalPriceWithTaxesWithoutExtras,\n totalPriceWithoutTaxes,\n totalPriceWithoutTaxesWithoutExtras,\n totalTaxes,\n } = tracking;\n\n const rooms = reservedRooms.map(\n ({\n averagePriceWithoutTaxes,\n daysPriceBoard = [],\n defaultBoardDescription,\n numRoomsToReserve,\n occupation: { numAdults, numBabies, totalChildren: numChildren } = {},\n rateId,\n rateName,\n roomTypeName,\n } = {}) => {\n let priceWithTaxes = 0;\n let priceWithoutTaxes = 0;\n daysPriceBoard.forEach((day) => {\n priceWithTaxes += day.priceWithTaxes;\n priceWithoutTaxes += day.priceWithoutTaxes;\n });\n\n return {\n boardName: defaultBoardDescription,\n numRooms: numRoomsToReserve,\n occupation: { numAdults, numChildren, numBabies },\n rateId,\n rateName,\n roomName: roomTypeName,\n priceWithTaxes,\n priceWithoutTaxes,\n unitaryPriceWithoutTaxes: formatPrice(averagePriceWithoutTaxes, hotelCurrency),\n };\n },\n );\n\n const extras = Object.values(reservedExtras).map(\n ({\n amount,\n id,\n name,\n nightsToApply,\n totalPriceWithTaxes,\n totalPriceWithoutTaxes,\n unitaryPriceWithTaxes,\n unitaryPriceWithoutTaxes,\n } = {}) => ({\n amount,\n extraId: id,\n extraName: name,\n nightsToApply,\n totalPriceWithTaxes,\n totalPriceWithoutTaxes,\n unitaryPriceWithTaxes,\n unitaryPriceWithoutTaxes,\n }),\n );\n\n const dataLayer = {\n chainId: idchain,\n checkin,\n checkout,\n city: hotelCity,\n cityZone: '',\n coupon: promocode,\n currency: hotelCurrency.code,\n device: mobile ? 'MOBILE' : 'DESKTOP_TABLET',\n email,\n emailSHA256: SHA256(email),\n event: 'init',\n home: document.location.hostname,\n hotelId,\n language,\n lodgingDenomination: ACCOMMODATION_TYPE_NAME[variants[hotelId]?.accommodationType || accommodationType],\n name: firstName,\n nights,\n numAdults: totalNumAdults,\n numChildren: totalNumChildren,\n numRooms: totalNumRooms,\n products: { rooms, extras, checkin, checkout },\n propertyName,\n propertyType,\n reservationCode,\n reservationDate,\n state_provice: hotelProvince,\n step,\n surname: lastName,\n nationality,\n totalCommission: formatPrice(totalPriceCommission, hotelCurrency),\n totalExtrasTaxes: formatPrice(totalExtrasTaxes, hotelCurrency),\n totalExtrasWithoutTaxes: formatPrice(totalExtrasWithoutTaxes, hotelCurrency),\n totalExtrasWithTaxes: formatPrice(totalExtrasWithTaxes, hotelCurrency),\n totalPrice: formatPrice(totalPriceWithTaxes, hotelCurrency),\n totalPriceWithoutTaxes: formatPrice(totalPriceWithoutTaxes, hotelCurrency),\n totalPriceWithoutTaxesWithExtras: formatPrice(totalPriceWithoutTaxes, hotelCurrency),\n totalPriceWithoutTaxesWithoutExtras: formatPrice(totalPriceWithoutTaxesWithoutExtras, hotelCurrency),\n totalPriceWithTaxesWithExtras: formatPrice(totalPriceWithTaxes, hotelCurrency),\n totalPriceWithTaxesWithoutExtras: formatPrice(totalPriceWithTaxesWithoutExtras, hotelCurrency),\n totalTaxes: formatPrice(totalTaxes, hotelCurrency),\n transactionAffiliation: propertyName,\n transactionId: 'Reservation code ' + reservationCode,\n transactionProducts: [\n ...reservedRooms.map((room = {}) => ({\n sku: room.defaultMediumName,\n name: propertyName,\n category: room.defaultBoardDescription,\n price: formatPrice(room.averagePriceWithoutTaxes, hotelCurrency),\n quantity: nights * room.numRoomsToReserve,\n })),\n ...Object.values(reservedExtras).map((extra) => ({\n sku: extra.name,\n name: propertyName,\n category: 'Extra',\n price: formatPrice(extra.unitaryPriceWithoutTaxes, hotelCurrency),\n quantity: extra.multiplierPrice,\n })),\n ],\n transactionShipping: parseFloat(totalPriceCommission),\n transactionTax: formatPrice(totalTaxes, hotelCurrency),\n transactionTotal: formatPrice(totalPriceWithoutTaxes, hotelCurrency),\n userCountry: country,\n userCurrency: currency,\n userLogged: !!session,\n };\n\n dataLayerPush(dataLayer);\n duettoBookingResponse({ checkin, checkout, hotelCurrency, reservedRooms, ...tracking });\n\n return dataLayer;\n};\n"],"mappings":";;;;;;AAAA,IAAAA,OAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA;AACA,IAAAG,SAAA,GAAAH,OAAA;AACA,IAAAI,SAAA,GAAAJ,OAAA;AACA,IAAAK,OAAA,GAAAL,OAAA;AAEA,MAAMM,uBAAuB,GAAGC,MAAM,CAACC,IAAI,CAACC,wBAAkB,CAAC;AAExD,MAAMC,eAAe,GAAG,SAAAA,CAAA,EAIpB;EAAA,IAAAC,iBAAA;EAAA,IAJqB;IAC9BC,MAAM,EAAE;MAAEC;IAAO,CAAC,GAAG,CAAC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;MAC/CL,GAAG,EAAEK,KAAK,CAACjC,IAAI;MACfA,IAAI,EAAE/C,YAAY;MAClB6E,QAAQ,EAAE,OAAO;MACjBC,KAAK,EAAE,IAAApC,mBAAW,EAACsC,KAAK,CAACvC,wBAAwB,EAAE1C,aAAa,CAAC;MACjEgF,QAAQ,EAAEC,KAAK,CAACC;IAClB,CAAC,CAAC,CAAC,CACJ;IACDC,mBAAmB,EAAEC,UAAU,CAAC3E,oBAAoB,CAAC;IACrD4E,cAAc,EAAE,IAAA1C,mBAAW,EAACvB,UAAU,EAAEpB,aAAa,CAAC;IACtDsF,gBAAgB,EAAE,IAAA3C,mBAAW,EAACzB,sBAAsB,EAAElB,aAAa,CAAC;IACpEuF,WAAW,EAAEnG,OAAO;IACpBoG,YAAY,EAAEtH,QAAQ;IACtBuH,UAAU,EAAE,CAAC,CAAClH;EAChB,CAAC;EAED,IAAAmH,uBAAa,EAACrC,SAAS,CAAC;EACxB,IAAAsC,uBAAqB,EAAC;IAAEzG,OAAO;IAAEC,QAAQ;IAAEa,aAAa;IAAEO,aAAa;IAAE,GAAGvC;EAAS,CAAC,CAAC;EAEvF,OAAOqF,SAAS;AAClB,CAAC;AAACuC,OAAA,CAAAjI,eAAA,GAAAA,eAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mirai/core",
3
- "version": "0.4.33",
3
+ "version": "0.4.35",
4
4
  "source": "src/index.js",
5
5
  "repository": "https://gitlab.com/miraicorp/dev/frontend/core",
6
6
  "author": "JΛVI <hello@soyjavi.com>",
@@ -86,6 +86,9 @@ export const Container = ({ children }) => {
86
86
  <Action inline small onPress={() => setLocation('/deals')}>
87
87
  Deals
88
88
  </Action>
89
+ <Action inline small onPress={() => setLocation('/finder')}>
90
+ Finder
91
+ </Action>
89
92
  </View>
90
93
 
91
94
  <View>
package/public/App.jsx CHANGED
@@ -3,7 +3,7 @@ import ReactDOM from 'react-dom';
3
3
  import { useLocation, Route, Switch } from 'wouter';
4
4
 
5
5
  import { Container } from './App.Container';
6
- import { Deals, Home, NotFound, Profile, Signup, Step1, Step2, Step3 } from './routes';
6
+ import { Deals, Finder, Home, NotFound, Profile, Signup, Step1, Step2, Step3 } from './routes';
7
7
 
8
8
  const App = () => {
9
9
  const [location] = useLocation();
@@ -20,6 +20,7 @@ const App = () => {
20
20
  <Route path={'/signup'} component={Signup} />
21
21
  <Route path={'/profile'} component={Profile} />
22
22
  <Route path={'/deals'} component={Deals} />
23
+ <Route path={'/finder'} component={Finder} />
23
24
  <Route path={'/step0-accommodations'} component={undefined} />
24
25
  <Route path={'/step1-rates'} component={Step1} />
25
26
  <Route path={'/step2-checkout'} component={Step2} />
@@ -0,0 +1,19 @@
1
+ import { Text, View } from '@mirai/ui';
2
+ import React from 'react';
3
+
4
+ import * as style from './routes.module.css';
5
+
6
+ export const Finder = () => (
7
+ <>
8
+ <View tag="section" className={[style.section, style.box, style.accent]}>
9
+ <View className={(style.wrapper, style.centered)}>
10
+ <Text bold headline level={1}>
11
+ Finder
12
+ </Text>
13
+ </View>
14
+ </View>
15
+ <View className={[style.wrapper, style.box]}>
16
+ <View data-mirai-component="finder" data-layout="column" className={style.column} />
17
+ </View>
18
+ </>
19
+ );
@@ -1,4 +1,5 @@
1
1
  export * from './Deals';
2
+ export * from './Finder';
2
3
  export * from './Home';
3
4
  export * from './NotFound';
4
5
  export * from './Profile';
@@ -142,7 +142,9 @@
142
142
  [data-mirai-component='finder'].column {
143
143
  background-color: var(--mirai-ui-content-background);
144
144
  max-width: calc(var(--mirai-ui-breakpoint-S) - var(--mirai-ui-space-M));
145
+ margin: var(--mirai-ui-space-M);
145
146
  padding: var(--mirai-ui-space-M);
147
+ align-self: center;
146
148
  }
147
149
 
148
150
  @media only screen and (max-width: 480px) {