@mirai/core 0.4.173 → 0.4.174
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.
|
@@ -5,6 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.bookingResponse = void 0;
|
|
7
7
|
var _dataSources = require("@mirai/data-sources");
|
|
8
|
+
var _locale = require("@mirai/locale");
|
|
8
9
|
var _helpers = require("../../../../components/helpers");
|
|
9
10
|
var _helpers2 = require("../../../../helpers");
|
|
10
11
|
var _legacy = require("../helpers/legacy");
|
|
@@ -40,8 +41,12 @@ const bookingResponse = async function () {
|
|
|
40
41
|
const value = {
|
|
41
42
|
hotelId,
|
|
42
43
|
transactionId: idReservation,
|
|
43
|
-
checkin: checkin,
|
|
44
|
-
|
|
44
|
+
checkin: checkin ? (0, _locale.dateFormat)((0, _locale.parseDate)(checkin, 'DD/MM/YYYY'), {
|
|
45
|
+
format: 'YYYY/MM/DD'
|
|
46
|
+
}) : undefined,
|
|
47
|
+
checkout: checkout ? (0, _locale.dateFormat)((0, _locale.parseDate)(checkout, 'DD/MM/YYYY'), {
|
|
48
|
+
format: 'YYYY/MM/DD'
|
|
49
|
+
}) : undefined,
|
|
45
50
|
nights,
|
|
46
51
|
totalPriceWithTaxes: (0, _legacy.formatPrice)(totalPriceWithTaxes, hotelCurrency),
|
|
47
52
|
totalPriceWithoutTaxes: (0, _legacy.formatPrice)(totalPriceWithoutTaxes, hotelCurrency),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bookingResponse.js","names":["_dataSources","require","_helpers","_helpers2","_legacy","bookingResponse","response","tracking","store","hotel","id","hotelId","arguments","length","undefined","bookingValues","checkin","checkout","nights","hotelInfo","idReservation","totalNumAdults","totalNumChildren","totalNumRooms","totalPriceWithTaxes","totalPriceWithoutTaxes","currency","hotelCurrency","value","transactionId","formatPrice","code","rooms","guests","window","MiraiMeta","IS_JEST","loadScript","src","concat","process","env","SERVICE_BOOKING","catch","error","request","credentials","endpoint","name","message","hostname","method","exports"],"sources":["../../../../../src/contexts/PerformanceManager/providers/mirai/bookingResponse.js"],"sourcesContent":["import { request } from '@mirai/data-sources';\n\nimport { IS_JEST } from '../../../../components/helpers';\nimport { loadScript } from '../../../../helpers';\nimport { formatPrice } from '../helpers/legacy';\n\nexport const bookingResponse = async ({\n response: { tracking = {} } = {},\n store: { hotel: { id: hotelId } = {} } = {},\n} = {}) => {\n // ! -- TODO: use of tracking should be a temporary approach ---------------------------------------------------------\n const {\n bookingValues: { checkin, checkout, nights } = {},\n hotelInfo = {},\n idReservation,\n totalNumAdults = 0,\n totalNumChildren = 0,\n totalNumRooms,\n totalPriceWithTaxes,\n totalPriceWithoutTaxes,\n } = tracking;\n\n const { currency: hotelCurrency = {} } = hotelInfo;\n\n const value = {\n hotelId,\n transactionId: idReservation,\n checkin: checkin,\n checkout: checkout,\n nights,\n totalPriceWithTaxes: formatPrice(totalPriceWithTaxes, hotelCurrency),\n totalPriceWithoutTaxes: formatPrice(totalPriceWithoutTaxes, hotelCurrency),\n currency: hotelCurrency.code,\n rooms: totalNumRooms,\n guests: totalNumAdults + totalNumChildren,\n };\n\n window.MiraiMeta = { ...window.MiraiMeta, ...value };\n\n !IS_JEST &&\n (await loadScript({\n id: 'mirai-pixel',\n src: `${process.env.SERVICE_BOOKING}/miraiConversionTracking?hotelId=${hotelId}&reservationId=${idReservation}&utm_source=`,\n }).catch((error = {}) => {\n request({\n credentials: 'include',\n endpoint: `trackPixelError?o=GTM_MIRAI&t=${idReservation}&n=${error.name}&m=${error.message}`,\n hostname: process.env.SERVICE_BOOKING,\n method: 'GET',\n });\n }));\n\n return value;\n};\n"],"mappings":";;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;
|
|
1
|
+
{"version":3,"file":"bookingResponse.js","names":["_dataSources","require","_locale","_helpers","_helpers2","_legacy","bookingResponse","response","tracking","store","hotel","id","hotelId","arguments","length","undefined","bookingValues","checkin","checkout","nights","hotelInfo","idReservation","totalNumAdults","totalNumChildren","totalNumRooms","totalPriceWithTaxes","totalPriceWithoutTaxes","currency","hotelCurrency","value","transactionId","dateFormat","parseDate","format","formatPrice","code","rooms","guests","window","MiraiMeta","IS_JEST","loadScript","src","concat","process","env","SERVICE_BOOKING","catch","error","request","credentials","endpoint","name","message","hostname","method","exports"],"sources":["../../../../../src/contexts/PerformanceManager/providers/mirai/bookingResponse.js"],"sourcesContent":["import { request } from '@mirai/data-sources';\nimport { parseDate, dateFormat } from '@mirai/locale';\n\nimport { IS_JEST } from '../../../../components/helpers';\nimport { loadScript } from '../../../../helpers';\nimport { formatPrice } from '../helpers/legacy';\n\nexport const bookingResponse = async ({\n response: { tracking = {} } = {},\n store: { hotel: { id: hotelId } = {} } = {},\n} = {}) => {\n // ! -- TODO: use of tracking should be a temporary approach ---------------------------------------------------------\n const {\n bookingValues: { checkin, checkout, nights } = {},\n hotelInfo = {},\n idReservation,\n totalNumAdults = 0,\n totalNumChildren = 0,\n totalNumRooms,\n totalPriceWithTaxes,\n totalPriceWithoutTaxes,\n } = tracking;\n\n const { currency: hotelCurrency = {} } = hotelInfo;\n\n const value = {\n hotelId,\n transactionId: idReservation,\n checkin: checkin ? dateFormat(parseDate(checkin, 'DD/MM/YYYY'), { format: 'YYYY/MM/DD' }) : undefined,\n checkout: checkout ? dateFormat(parseDate(checkout, 'DD/MM/YYYY'), { format: 'YYYY/MM/DD' }) : undefined,\n nights,\n totalPriceWithTaxes: formatPrice(totalPriceWithTaxes, hotelCurrency),\n totalPriceWithoutTaxes: formatPrice(totalPriceWithoutTaxes, hotelCurrency),\n currency: hotelCurrency.code,\n rooms: totalNumRooms,\n guests: totalNumAdults + totalNumChildren,\n };\n\n window.MiraiMeta = { ...window.MiraiMeta, ...value };\n\n !IS_JEST &&\n (await loadScript({\n id: 'mirai-pixel',\n src: `${process.env.SERVICE_BOOKING}/miraiConversionTracking?hotelId=${hotelId}&reservationId=${idReservation}&utm_source=`,\n }).catch((error = {}) => {\n request({\n credentials: 'include',\n endpoint: `trackPixelError?o=GTM_MIRAI&t=${idReservation}&n=${error.name}&m=${error.message}`,\n hostname: process.env.SERVICE_BOOKING,\n method: 'GET',\n });\n }));\n\n return value;\n};\n"],"mappings":";;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AAEA,IAAAE,QAAA,GAAAF,OAAA;AACA,IAAAG,SAAA,GAAAH,OAAA;AACA,IAAAI,OAAA,GAAAJ,OAAA;AAEO,MAAMK,eAAe,GAAG,eAAAA,CAAA,EAGpB;EAAA,IAH2B;IACpCC,QAAQ,EAAE;MAAEC,QAAQ,GAAG,CAAC;IAAE,CAAC,GAAG,CAAC,CAAC;IAChCC,KAAK,EAAE;MAAEC,KAAK,EAAE;QAAEC,EAAE,EAAEC;MAAQ,CAAC,GAAG,CAAC;IAAE,CAAC,GAAG,CAAC;EAC5C,CAAC,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,CAAC,CAAC;EACJ;EACA,MAAM;IACJG,aAAa,EAAE;MAAEC,OAAO;MAAEC,QAAQ;MAAEC;IAAO,CAAC,GAAG,CAAC,CAAC;IACjDC,SAAS,GAAG,CAAC,CAAC;IACdC,aAAa;IACbC,cAAc,GAAG,CAAC;IAClBC,gBAAgB,GAAG,CAAC;IACpBC,aAAa;IACbC,mBAAmB;IACnBC;EACF,CAAC,GAAGlB,QAAQ;EAEZ,MAAM;IAAEmB,QAAQ,EAAEC,aAAa,GAAG,CAAC;EAAE,CAAC,GAAGR,SAAS;EAElD,MAAMS,KAAK,GAAG;IACZjB,OAAO;IACPkB,aAAa,EAAET,aAAa;IAC5BJ,OAAO,EAAEA,OAAO,GAAG,IAAAc,kBAAU,EAAC,IAAAC,iBAAS,EAACf,OAAO,EAAE,YAAY,CAAC,EAAE;MAAEgB,MAAM,EAAE;IAAa,CAAC,CAAC,GAAGlB,SAAS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