@roomstay/frontend 2.6.41 → 2.6.43
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/dist/839.bundle.js +1 -1
- package/dist/main.bundle.js +1 -1
- package/dist/src/components/generic/modal/SigninModal/AuthenticatedUserModal.d.ts +0 -1
- package/dist/src/components/generic/modal/SigninModal/AuthenticatedUserModal.js +2 -2
- package/dist/src/components/generic/modal/SigninModal/AuthenticatedUserModal.js.map +1 -1
- package/dist/src/components/steps/room/AvailableUpgradesModal.js +9 -4
- package/dist/src/components/steps/room/AvailableUpgradesModal.js.map +1 -1
- package/dist/src/components/steps/room/roomDetails/RoomDetails.js +9 -2
- package/dist/src/components/steps/room/roomDetails/RoomDetails.js.map +1 -1
- package/dist/src/components/steps/room/roomDetails/roomRates/ReadMoreRoomRateRow.js +5 -1
- package/dist/src/components/steps/room/roomDetails/roomRates/ReadMoreRoomRateRow.js.map +1 -1
- package/dist/src/components/steps/room/roomDetails/roomRates/RoomRateRow.js +5 -2
- package/dist/src/components/steps/room/roomDetails/roomRates/RoomRateRow.js.map +1 -1
- package/dist/src/contexts/BasketContext/BasketContextType.js.map +1 -1
- package/dist/src/contexts/CompanyContext/CompanyContextWrapper.js +5 -16
- package/dist/src/contexts/CompanyContext/CompanyContextWrapper.js.map +1 -1
- package/dist/src/contexts/FullPageEngineContext/EnginePageLayout.js +32 -1
- package/dist/src/contexts/FullPageEngineContext/EnginePageLayout.js.map +1 -1
- package/dist/src/contexts/FullPageEngineContext/FullPageEngineContextWrapper.js.map +1 -1
- package/dist/src/engines/MemberPortalWidget/MemberPortalWidget.d.ts +3 -4
- package/dist/src/engines/MemberPortalWidget/MemberPortalWidget.js +1 -0
- package/dist/src/engines/MemberPortalWidget/MemberPortalWidget.js.map +1 -1
- package/dist/src/engines/MemberPortalWidget/MemberPortalWidgetElement.d.ts +2 -2
- package/dist/src/engines/MemberPortalWidget/MemberPortalWidgetElement.js +20 -9
- package/dist/src/engines/MemberPortalWidget/MemberPortalWidgetElement.js.map +1 -1
- package/dist/src/index.d.ts +1 -0
- package/dist/src/index.js +4 -2
- package/dist/src/index.js.map +1 -1
- package/dist/src/models/Api/HotelDTO.d.ts +2 -0
- package/dist/src/models/Api/HotelDTO.js.map +1 -1
- package/dist/src/models/Client/Hotel/Hotel.d.ts +1 -0
- package/dist/src/models/Client/Hotel/Hotel.js.map +1 -1
- package/dist/src/models/Room/Room.d.ts +4 -1
- package/dist/src/models/Room/Room.js +6 -1
- package/dist/src/models/Room/Room.js.map +1 -1
- package/dist/src/models/Room/RoomRate.d.ts +6 -1
- package/dist/src/models/Room/RoomRate.js +12 -1
- package/dist/src/models/Room/RoomRate.js.map +1 -1
- package/dist/src/models/Room/RoomRateSortable.d.ts +2 -1
- package/dist/src/models/Room/RoomRateSortable.js.map +1 -1
- package/dist/src/pages/findReservation/FindReservationResults.js +6 -1
- package/dist/src/pages/findReservation/FindReservationResults.js.map +1 -1
- package/dist/src/pages/findReservation/ReservationRow.js +1 -1
- package/dist/src/pages/findReservation/ReservationRow.js.map +1 -1
- package/dist/src/providers/RoomSortProvider.js +6 -2
- package/dist/src/providers/RoomSortProvider.js.map +1 -1
- package/dist/src/util/Analytics/Analytics.d.ts +31 -0
- package/dist/src/util/Analytics/Analytics.js +22 -0
- package/dist/src/util/Analytics/Analytics.js.map +1 -0
- package/dist/src/util/Analytics/GoogleAnalytics4.d.ts +127 -0
- package/dist/src/util/Analytics/GoogleAnalytics4.js +217 -0
- package/dist/src/util/Analytics/GoogleAnalytics4.js.map +1 -0
- package/dist/src/util/Analytics/UniversalAnalytics.d.ts +110 -0
- package/dist/src/util/Analytics/UniversalAnalytics.js +210 -0
- package/dist/src/util/Analytics/UniversalAnalytics.js.map +1 -0
- package/dist/src/util/DataLayer.d.ts +33 -29
- package/dist/src/util/DataLayer.js +78 -233
- package/dist/src/util/DataLayer.js.map +1 -1
- package/dist/test.bundle.js +1 -1
- package/dist/tests/jest/models/RoomRate.test.js +1 -1
- package/dist/tests/jest/models/RoomRate.test.js.map +1 -1
- package/dist/tests/offline/entry/OfflineEngineDefaults.js +4 -0
- package/dist/tests/offline/entry/OfflineEngineDefaults.js.map +1 -1
- package/package.json +2 -2
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import ReservationsDTO, { ReservationDTO } from '../../models/Api/ReservationsDTO';
|
|
2
|
+
import BasketAddonRow from '../../models/BasketAddonRow';
|
|
3
|
+
import BasketRow from '../../models/BasketRow';
|
|
4
|
+
import { DateRange, GenericAnalyticsAccommodation } from '../DataLayer';
|
|
5
|
+
import { Analytics } from './Analytics';
|
|
6
|
+
declare class UniversalAnalytics extends Analytics {
|
|
7
|
+
private getProductInfo;
|
|
8
|
+
private generateAddonProductInfo;
|
|
9
|
+
generateRoomImpressionMessageObject(impressions: GenericAnalyticsAccommodation[]): {
|
|
10
|
+
event: string;
|
|
11
|
+
ecommerce: {
|
|
12
|
+
currencyCode: string;
|
|
13
|
+
impressions: Product[];
|
|
14
|
+
};
|
|
15
|
+
};
|
|
16
|
+
generateProductClickMessageObject(product: GenericAnalyticsAccommodation): {
|
|
17
|
+
event: string;
|
|
18
|
+
ecommerce: {
|
|
19
|
+
currencyCode: string;
|
|
20
|
+
click: {
|
|
21
|
+
products: Product[];
|
|
22
|
+
};
|
|
23
|
+
StartDate: string;
|
|
24
|
+
EndDate: string;
|
|
25
|
+
};
|
|
26
|
+
};
|
|
27
|
+
generateDateSelectionMessageObject(dateRange: DateRange, adults: number, children: number, infants?: number | undefined): {
|
|
28
|
+
event: string;
|
|
29
|
+
arrivalDate: string;
|
|
30
|
+
departureDate: string;
|
|
31
|
+
adultQty: string | null;
|
|
32
|
+
childQty: string | null;
|
|
33
|
+
infantQty: string | null;
|
|
34
|
+
};
|
|
35
|
+
generateAddToCartMessageObject(product: GenericAnalyticsAccommodation): {
|
|
36
|
+
event: string;
|
|
37
|
+
ecommerce: {
|
|
38
|
+
currencyCode: string;
|
|
39
|
+
add: {
|
|
40
|
+
products: Product[];
|
|
41
|
+
};
|
|
42
|
+
StartDate: string;
|
|
43
|
+
EndDate: string;
|
|
44
|
+
};
|
|
45
|
+
};
|
|
46
|
+
generateUpsellConfirmedMessageObject(oldProduct: GenericAnalyticsAccommodation, newProduct: GenericAnalyticsAccommodation): {
|
|
47
|
+
event: string;
|
|
48
|
+
priceDifference: number;
|
|
49
|
+
old: {
|
|
50
|
+
products: Product[];
|
|
51
|
+
};
|
|
52
|
+
new: {
|
|
53
|
+
products: Product[];
|
|
54
|
+
};
|
|
55
|
+
} | null;
|
|
56
|
+
generateUpsellCancelledMessageObject(product: GenericAnalyticsAccommodation): {
|
|
57
|
+
event: string;
|
|
58
|
+
item: Product[];
|
|
59
|
+
};
|
|
60
|
+
generateCheckoutViewMessageObject(basketRows: BasketRow[], addonRows: BasketAddonRow[]): {
|
|
61
|
+
event: string;
|
|
62
|
+
ecommerce: {
|
|
63
|
+
currencyCode: string;
|
|
64
|
+
checkout: {
|
|
65
|
+
actionField: {
|
|
66
|
+
step: number;
|
|
67
|
+
};
|
|
68
|
+
products: Product[];
|
|
69
|
+
};
|
|
70
|
+
StartDate: string | undefined;
|
|
71
|
+
EndDate: string | undefined;
|
|
72
|
+
PageType: string;
|
|
73
|
+
};
|
|
74
|
+
};
|
|
75
|
+
generateRoomPurchaseMessageObject(basketRows: BasketRow[], addonRows: BasketAddonRow[], reservations: ReservationsDTO): ({
|
|
76
|
+
event: string;
|
|
77
|
+
ecommerce: {
|
|
78
|
+
checkoutUpsell?: any;
|
|
79
|
+
currencyCode: string;
|
|
80
|
+
purchase: {
|
|
81
|
+
actionField: {
|
|
82
|
+
id: string;
|
|
83
|
+
revenue: number;
|
|
84
|
+
tax: number;
|
|
85
|
+
coupon: string;
|
|
86
|
+
};
|
|
87
|
+
products: Product[];
|
|
88
|
+
};
|
|
89
|
+
StartDate: string;
|
|
90
|
+
EndDate: string;
|
|
91
|
+
BookingDate: string;
|
|
92
|
+
PageType: string;
|
|
93
|
+
paymentType: import("@roomstay/core").EBookingPaymentMethod | undefined;
|
|
94
|
+
};
|
|
95
|
+
} | undefined)[];
|
|
96
|
+
generateRefundMessageObject(reservation: ReservationDTO): any;
|
|
97
|
+
}
|
|
98
|
+
declare const ua: UniversalAnalytics;
|
|
99
|
+
export { ua as UniversalAnalytics };
|
|
100
|
+
type Product = {
|
|
101
|
+
name: string;
|
|
102
|
+
id: string;
|
|
103
|
+
price: number;
|
|
104
|
+
brand: string;
|
|
105
|
+
category: string;
|
|
106
|
+
variant?: string;
|
|
107
|
+
list?: string;
|
|
108
|
+
position?: number;
|
|
109
|
+
quantity?: number;
|
|
110
|
+
};
|
|
@@ -0,0 +1,210 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.UniversalAnalytics = void 0;
|
|
7
|
+
const dayjs_1 = __importDefault(require("dayjs"));
|
|
8
|
+
const Analytics_1 = require("./Analytics");
|
|
9
|
+
const DATALAYER_DATE_FORMAT = 'YYYY-M-D';
|
|
10
|
+
class UniversalAnalytics extends Analytics_1.Analytics {
|
|
11
|
+
getProductInfo(room, rate, listPosition, quantity) {
|
|
12
|
+
var _a, _b, _c;
|
|
13
|
+
const providerId = (_a = this.hotel) === null || _a === void 0 ? void 0 : _a.providerHotelID;
|
|
14
|
+
const price = rate ? rate.getAveragePrice() : room.getLowestPrice();
|
|
15
|
+
const nameParts = [room.name];
|
|
16
|
+
const idParts = [providerId, room.code];
|
|
17
|
+
if (rate) {
|
|
18
|
+
nameParts.push(rate.name);
|
|
19
|
+
idParts.push(rate.code);
|
|
20
|
+
}
|
|
21
|
+
const product = {
|
|
22
|
+
name: nameParts.join(' - '),
|
|
23
|
+
id: idParts.join(' - '),
|
|
24
|
+
price: price,
|
|
25
|
+
brand: [(_b = this.hotel) === null || _b === void 0 ? void 0 : _b.name, providerId, (_c = this.company) === null || _c === void 0 ? void 0 : _c.brandSuffix].filter(Boolean).join(' - '),
|
|
26
|
+
category: room.name,
|
|
27
|
+
};
|
|
28
|
+
if (rate) {
|
|
29
|
+
product.variant = rate.name;
|
|
30
|
+
}
|
|
31
|
+
if (listPosition !== undefined) {
|
|
32
|
+
product.list = 'BE List';
|
|
33
|
+
product.position = listPosition;
|
|
34
|
+
}
|
|
35
|
+
if (quantity !== undefined) {
|
|
36
|
+
product.quantity = quantity;
|
|
37
|
+
}
|
|
38
|
+
return product;
|
|
39
|
+
}
|
|
40
|
+
generateAddonProductInfo(addonRow) {
|
|
41
|
+
var _a, _b, _c;
|
|
42
|
+
const addon = addonRow.getAddon();
|
|
43
|
+
return {
|
|
44
|
+
name: addon.name,
|
|
45
|
+
id: addon.code,
|
|
46
|
+
price: addonRow.getTotalPrice(),
|
|
47
|
+
brand: [(_a = this.hotel) === null || _a === void 0 ? void 0 : _a.name, (_b = this.hotel) === null || _b === void 0 ? void 0 : _b.providerHotelID, (_c = this.company) === null || _c === void 0 ? void 0 : _c.brandSuffix].filter(Boolean).join(' - '),
|
|
48
|
+
category: addon.category,
|
|
49
|
+
quantity: addonRow.getTotalQuantity(),
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
generateRoomImpressionMessageObject(impressions) {
|
|
53
|
+
return {
|
|
54
|
+
event: 'Product impressions',
|
|
55
|
+
ecommerce: {
|
|
56
|
+
currencyCode: this.currency.original,
|
|
57
|
+
impressions: impressions.map((item, index) => {
|
|
58
|
+
const { room, quantity } = item;
|
|
59
|
+
return this.getProductInfo(room, undefined, index, quantity);
|
|
60
|
+
}),
|
|
61
|
+
},
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
generateProductClickMessageObject(product) {
|
|
65
|
+
const { room, rate, quantity } = product;
|
|
66
|
+
return {
|
|
67
|
+
event: 'productClick',
|
|
68
|
+
ecommerce: {
|
|
69
|
+
currencyCode: this.currency.original,
|
|
70
|
+
click: {
|
|
71
|
+
products: [this.getProductInfo(room, rate, undefined, quantity)],
|
|
72
|
+
},
|
|
73
|
+
StartDate: product.dateRange.from.format(DATALAYER_DATE_FORMAT),
|
|
74
|
+
EndDate: product.dateRange.to.format(DATALAYER_DATE_FORMAT),
|
|
75
|
+
},
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
generateDateSelectionMessageObject(dateRange, adults, children, infants) {
|
|
79
|
+
return {
|
|
80
|
+
event: 'dateSelection',
|
|
81
|
+
arrivalDate: dateRange.from.format(DATALAYER_DATE_FORMAT),
|
|
82
|
+
departureDate: dateRange.to.format(DATALAYER_DATE_FORMAT),
|
|
83
|
+
adultQty: Number.isInteger(adults) ? `${adults}` : null,
|
|
84
|
+
childQty: Number.isInteger(children) ? `${children}` : null,
|
|
85
|
+
infantQty: Number.isInteger(infants) ? `${infants}` : null,
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
generateAddToCartMessageObject(product) {
|
|
89
|
+
const productInfo = this.getProductInfo(product.room, product.rate, undefined, product.quantity);
|
|
90
|
+
return {
|
|
91
|
+
event: 'addToCart',
|
|
92
|
+
ecommerce: {
|
|
93
|
+
currencyCode: this.currency.original,
|
|
94
|
+
add: {
|
|
95
|
+
products: [productInfo],
|
|
96
|
+
},
|
|
97
|
+
StartDate: product.dateRange.from.format(DATALAYER_DATE_FORMAT),
|
|
98
|
+
EndDate: product.dateRange.to.format(DATALAYER_DATE_FORMAT),
|
|
99
|
+
},
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
generateUpsellConfirmedMessageObject(oldProduct, newProduct) {
|
|
103
|
+
const newRate = newProduct.rate;
|
|
104
|
+
const oldRate = oldProduct.rate;
|
|
105
|
+
if (!newRate || !oldRate) {
|
|
106
|
+
return null;
|
|
107
|
+
}
|
|
108
|
+
const oldConvertedProduct = this.getProductInfo(oldRate.getRoom(), oldRate);
|
|
109
|
+
const newConvertedProduct = this.getProductInfo(newRate.getRoom(), newRate);
|
|
110
|
+
return {
|
|
111
|
+
event: 'upsellConfirmed',
|
|
112
|
+
priceDifference: newRate.getTotalPrice() - oldRate.getTotalPrice(),
|
|
113
|
+
old: {
|
|
114
|
+
products: [oldConvertedProduct],
|
|
115
|
+
},
|
|
116
|
+
new: {
|
|
117
|
+
products: [newConvertedProduct],
|
|
118
|
+
},
|
|
119
|
+
};
|
|
120
|
+
}
|
|
121
|
+
generateUpsellCancelledMessageObject(product) {
|
|
122
|
+
const { room, rate, quantity } = product;
|
|
123
|
+
const productInfo = this.getProductInfo(room, rate, undefined, quantity);
|
|
124
|
+
return {
|
|
125
|
+
event: 'upsellCancelled',
|
|
126
|
+
item: [productInfo],
|
|
127
|
+
};
|
|
128
|
+
}
|
|
129
|
+
generateCheckoutViewMessageObject(basketRows, addonRows) {
|
|
130
|
+
const products = [];
|
|
131
|
+
let startDate = undefined;
|
|
132
|
+
let endDate = undefined;
|
|
133
|
+
basketRows.forEach((row) => {
|
|
134
|
+
startDate = row.getStartDate();
|
|
135
|
+
endDate = row.getEndDate();
|
|
136
|
+
products.push(this.getProductInfo(row.getRoom(), row.getRate(), undefined, row.getNumberOfDays()));
|
|
137
|
+
});
|
|
138
|
+
addonRows.forEach((row) => {
|
|
139
|
+
products.push(this.generateAddonProductInfo(row));
|
|
140
|
+
});
|
|
141
|
+
return {
|
|
142
|
+
event: 'checkout',
|
|
143
|
+
ecommerce: {
|
|
144
|
+
currencyCode: this.currency.original,
|
|
145
|
+
checkout: {
|
|
146
|
+
actionField: { step: 1 },
|
|
147
|
+
products,
|
|
148
|
+
},
|
|
149
|
+
StartDate: startDate === null || startDate === void 0 ? void 0 : startDate.format(DATALAYER_DATE_FORMAT),
|
|
150
|
+
EndDate: endDate === null || endDate === void 0 ? void 0 : endDate.format(DATALAYER_DATE_FORMAT),
|
|
151
|
+
PageType: 'conversionintent',
|
|
152
|
+
},
|
|
153
|
+
};
|
|
154
|
+
}
|
|
155
|
+
generateRoomPurchaseMessageObject(basketRows, addonRows, reservations) {
|
|
156
|
+
let i = 0;
|
|
157
|
+
return basketRows.map((row) => {
|
|
158
|
+
var _a;
|
|
159
|
+
const products = [this.getProductInfo(row.getRoom(), row.getRate(), undefined, row.getNumberOfDays())];
|
|
160
|
+
if (i === 0) {
|
|
161
|
+
addonRows.forEach((addonRow) => {
|
|
162
|
+
products.push(this.generateAddonProductInfo(addonRow));
|
|
163
|
+
});
|
|
164
|
+
}
|
|
165
|
+
try {
|
|
166
|
+
const upsellPrevRoom = row.getUpsellPrevRoom();
|
|
167
|
+
const extraData = {};
|
|
168
|
+
if (upsellPrevRoom) {
|
|
169
|
+
extraData.checkoutUpsell = {
|
|
170
|
+
active: true,
|
|
171
|
+
oldRoom: upsellPrevRoom.code,
|
|
172
|
+
newRoom: row.getRoom().code,
|
|
173
|
+
priceDifference: (((_a = row.getRate()) === null || _a === void 0 ? void 0 : _a.getTotalPrice()) || 0) - (upsellPrevRoom.price || 0),
|
|
174
|
+
};
|
|
175
|
+
}
|
|
176
|
+
return {
|
|
177
|
+
event: 'roomPurchase',
|
|
178
|
+
ecommerce: Object.assign({ currencyCode: this.currency.original, purchase: {
|
|
179
|
+
actionField: {
|
|
180
|
+
id: reservations.reservations[i].reservationNumber,
|
|
181
|
+
revenue: reservations.reservations[i].total.afterTax,
|
|
182
|
+
tax: reservations.reservations[i].total.afterTax - reservations.reservations[i].total.beforeTax,
|
|
183
|
+
coupon: row.getPromoCode(),
|
|
184
|
+
},
|
|
185
|
+
products,
|
|
186
|
+
}, StartDate: row.getStartDate().format(DATALAYER_DATE_FORMAT), EndDate: row.getEndDate().format(DATALAYER_DATE_FORMAT), BookingDate: (0, dayjs_1.default)().format(DATALAYER_DATE_FORMAT), PageType: 'conversion', paymentType: reservations.reservations[i].paymentMethod }, extraData),
|
|
187
|
+
};
|
|
188
|
+
}
|
|
189
|
+
catch (e) {
|
|
190
|
+
// test
|
|
191
|
+
}
|
|
192
|
+
i++;
|
|
193
|
+
});
|
|
194
|
+
}
|
|
195
|
+
generateRefundMessageObject(reservation) {
|
|
196
|
+
return {
|
|
197
|
+
event: 'refund',
|
|
198
|
+
ecommerce: {
|
|
199
|
+
refund: {
|
|
200
|
+
actionField: {
|
|
201
|
+
id: reservation.reservationNumber,
|
|
202
|
+
},
|
|
203
|
+
},
|
|
204
|
+
},
|
|
205
|
+
};
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
const ua = new UniversalAnalytics();
|
|
209
|
+
exports.UniversalAnalytics = ua;
|
|
210
|
+
//# sourceMappingURL=UniversalAnalytics.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"UniversalAnalytics.js","sourceRoot":"/","sources":["src/util/Analytics/UniversalAnalytics.ts"],"names":[],"mappings":";;;;;;AAAA,kDAAqC;AASrC,2CAAwC;AAExC,MAAM,qBAAqB,GAAG,UAAU,CAAC;AAEzC,MAAM,kBAAmB,SAAQ,qBAAS;IAC9B,cAAc,CAAC,IAAU,EAAE,IAAe,EAAE,YAAqB,EAAE,QAAiB;;QACxF,MAAM,UAAU,GAAG,MAAA,IAAI,CAAC,KAAK,0CAAE,eAAe,CAAC;QAE/C,MAAM,KAAK,GAAG,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,eAAe,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,cAAc,EAAE,CAAC;QACpE,MAAM,SAAS,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAC9B,MAAM,OAAO,GAAG,CAAC,UAAU,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC;QACxC,IAAI,IAAI,EAAE;YACN,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YAC1B,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;SAC3B;QAED,MAAM,OAAO,GAAY;YACrB,IAAI,EAAE,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC;YAC3B,EAAE,EAAE,OAAO,CAAC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B;qBACpC;iBACJ;aACJ;SACJ,CAAC;IACN,CAAC;CACJ;AAED,MAAM,EAAE,GAAG,IAAI,kBAAkB,EAAE,CAAC;AAErB,gCAAkB","sourcesContent":["import dayjs, { Dayjs } from 'dayjs';\n\nimport ReservationsDTO, { ReservationDTO } from '@/models/Api/ReservationsDTO';\nimport BasketAddonRow from '@/models/BasketAddonRow';\nimport BasketRow from '@/models/BasketRow';\nimport { Room } from '@/models/Room/Room';\nimport { RoomRate } from '@/models/Room/RoomRate';\n\nimport { DateRange, GenericAnalyticsAccommodation } from '../DataLayer';\nimport { Analytics } from './Analytics';\n\nconst DATALAYER_DATE_FORMAT = 'YYYY-M-D';\n\nclass UniversalAnalytics extends Analytics {\n private getProductInfo(room: Room, rate?: RoomRate, listPosition?: number, quantity?: number): Product {\n const providerId = this.hotel?.providerHotelID;\n\n const price = rate ? rate.getAveragePrice() : room.getLowestPrice();\n const nameParts = [room.name];\n const idParts = [providerId, room.code];\n if (rate) {\n nameParts.push(rate.name);\n idParts.push(rate.code);\n }\n\n const product: Product = {\n name: nameParts.join(' - '),\n id: idParts.join(' - '),\n price: price,\n brand: [this.hotel?.name, providerId, this.company?.brandSuffix].filter(Boolean).join(' - '),\n category: room.name as string,\n };\n\n if (rate) {\n product.variant = rate.name;\n }\n\n if (listPosition !== undefined) {\n product.list = 'BE List';\n product.position = listPosition;\n }\n\n if (quantity !== undefined) {\n product.quantity = quantity;\n }\n\n return product;\n }\n\n private generateAddonProductInfo(addonRow: BasketAddonRow): Product {\n const addon = addonRow.getAddon();\n return {\n name: addon.name,\n id: addon.code,\n price: addonRow.getTotalPrice(),\n brand: [this.hotel?.name, this.hotel?.providerHotelID, this.company?.brandSuffix].filter(Boolean).join(' - '),\n category: addon.category,\n quantity: addonRow.getTotalQuantity(),\n };\n }\n\n public generateRoomImpressionMessageObject(impressions: GenericAnalyticsAccommodation[]) {\n return {\n event: 'Product impressions',\n ecommerce: {\n currencyCode: this.currency.original,\n impressions: impressions.map((item, index) => {\n const { room, quantity } = item;\n return this.getProductInfo(room, undefined, index, quantity);\n }),\n },\n };\n }\n\n public generateProductClickMessageObject(product: GenericAnalyticsAccommodation) {\n const { room, rate, quantity } = product;\n return {\n event: 'productClick',\n ecommerce: {\n currencyCode: this.currency.original,\n click: {\n products: [this.getProductInfo(room, rate, undefined, quantity)],\n },\n StartDate: product.dateRange.from.format(DATALAYER_DATE_FORMAT),\n EndDate: product.dateRange.to.format(DATALAYER_DATE_FORMAT),\n },\n };\n }\n\n public generateDateSelectionMessageObject(dateRange: DateRange, adults: number, children: number, infants?: number | undefined) {\n return {\n event: 'dateSelection',\n arrivalDate: dateRange.from.format(DATALAYER_DATE_FORMAT),\n departureDate: dateRange.to.format(DATALAYER_DATE_FORMAT),\n adultQty: Number.isInteger(adults) ? `${adults}` : null,\n childQty: Number.isInteger(children) ? `${children}` : null,\n infantQty: Number.isInteger(infants) ? `${infants}` : null,\n };\n }\n\n public generateAddToCartMessageObject(product: GenericAnalyticsAccommodation) {\n const productInfo = this.getProductInfo(product.room, product.rate, undefined, product.quantity);\n\n return {\n event: 'addToCart',\n ecommerce: {\n currencyCode: this.currency.original,\n add: {\n products: [productInfo],\n },\n StartDate: product.dateRange.from.format(DATALAYER_DATE_FORMAT),\n EndDate: product.dateRange.to.format(DATALAYER_DATE_FORMAT),\n },\n };\n }\n\n public generateUpsellConfirmedMessageObject(oldProduct: GenericAnalyticsAccommodation, newProduct: GenericAnalyticsAccommodation) {\n const newRate = newProduct.rate;\n const oldRate = oldProduct.rate;\n\n if (!newRate || !oldRate) {\n return null;\n }\n\n const oldConvertedProduct = this.getProductInfo(oldRate.getRoom(), oldRate);\n const newConvertedProduct = this.getProductInfo(newRate.getRoom(), newRate);\n\n return {\n event: 'upsellConfirmed',\n priceDifference: newRate.getTotalPrice() - oldRate.getTotalPrice(),\n old: {\n products: [oldConvertedProduct],\n },\n new: {\n products: [newConvertedProduct],\n },\n };\n }\n\n public generateUpsellCancelledMessageObject(product: GenericAnalyticsAccommodation) {\n const { room, rate, quantity } = product;\n\n const productInfo = this.getProductInfo(room, rate, undefined, quantity);\n\n return {\n event: 'upsellCancelled',\n item: [productInfo],\n };\n }\n\n public generateCheckoutViewMessageObject(basketRows: BasketRow[], addonRows: BasketAddonRow[]) {\n const products: Product[] = [];\n\n let startDate: Dayjs | undefined = undefined;\n let endDate: Dayjs | undefined = undefined;\n\n basketRows.forEach((row) => {\n startDate = row.getStartDate();\n endDate = row.getEndDate();\n products.push(this.getProductInfo(row.getRoom(), row.getRate() as RoomRate, undefined, row.getNumberOfDays()));\n });\n\n addonRows.forEach((row) => {\n products.push(this.generateAddonProductInfo(row));\n });\n\n return {\n event: 'checkout',\n ecommerce: {\n currencyCode: this.currency.original,\n checkout: {\n actionField: { step: 1 },\n products,\n },\n StartDate: (startDate as Dayjs | undefined)?.format(DATALAYER_DATE_FORMAT),\n EndDate: (endDate as Dayjs | undefined)?.format(DATALAYER_DATE_FORMAT),\n PageType: 'conversionintent',\n },\n };\n }\n\n public generateRoomPurchaseMessageObject(basketRows: BasketRow[], addonRows: BasketAddonRow[], reservations: ReservationsDTO) {\n let i = 0;\n return basketRows.map((row) => {\n const products = [this.getProductInfo(row.getRoom(), row.getRate() as RoomRate, undefined, row.getNumberOfDays())];\n\n if (i === 0) {\n addonRows.forEach((addonRow) => {\n products.push(this.generateAddonProductInfo(addonRow));\n });\n }\n\n try {\n const upsellPrevRoom = row.getUpsellPrevRoom();\n const extraData: { checkoutUpsell?: any } = {};\n if (upsellPrevRoom) {\n extraData.checkoutUpsell = {\n active: true,\n oldRoom: upsellPrevRoom.code,\n newRoom: row.getRoom().code,\n priceDifference: (row.getRate()?.getTotalPrice() || 0) - (upsellPrevRoom.price || 0),\n };\n }\n\n return {\n event: 'roomPurchase',\n ecommerce: {\n currencyCode: this.currency.original,\n purchase: {\n actionField: {\n id: reservations.reservations[i].reservationNumber,\n revenue: reservations.reservations[i].total.afterTax,\n tax: reservations.reservations[i].total.afterTax - reservations.reservations[i].total.beforeTax,\n coupon: row.getPromoCode(),\n },\n products,\n },\n StartDate: row.getStartDate().format(DATALAYER_DATE_FORMAT),\n EndDate: row.getEndDate().format(DATALAYER_DATE_FORMAT),\n BookingDate: dayjs().format(DATALAYER_DATE_FORMAT),\n PageType: 'conversion',\n paymentType: reservations.reservations[i].paymentMethod,\n ...extraData,\n },\n };\n } catch (e) {\n // test\n }\n\n i++;\n });\n }\n\n public generateRefundMessageObject(reservation: ReservationDTO): any {\n return {\n event: 'refund',\n ecommerce: {\n refund: {\n actionField: {\n id: reservation.reservationNumber,\n },\n },\n },\n };\n }\n}\n\nconst ua = new UniversalAnalytics();\n\nexport { ua as UniversalAnalytics };\n\ntype Product = {\n name: string; // <Put the Room Variant here example - ‘BAE - Best Available Everyday - Superoo’>\n id: string; // <Put the SKU for Room variant here example - ‘62991 - VEK - 04BAE’>\n price: number; // <Put the PER DAY price of room>\n brand: string; // <Put the hotel brand here example - ‘Australia - Ovolo Woolloomooloo - 62991’>\n category: string; // <Put the Category of room here example - ‘Superoo’>\n variant?: string; // <Put the Variant of room here example - ‘BAE - Best Available Everyday - Prepaid Rate’>\n list?: string; // <Put ‘BE List’ if shown in Booking Engine else put ‘Hotel List’>\n position?: number; // <Put the position of hotel in the list here example 1’>\n quantity?: number; // <Put the rooms X nights>\n};\n"]}
|
|
@@ -1,39 +1,55 @@
|
|
|
1
1
|
import { Dayjs } from 'dayjs';
|
|
2
|
-
import ReservationsDTO from '../models/Api/ReservationsDTO';
|
|
2
|
+
import ReservationsDTO, { ReservationDTO } from '../models/Api/ReservationsDTO';
|
|
3
3
|
import BasketAddonRow from '../models/BasketAddonRow';
|
|
4
4
|
import BasketRow from '../models/BasketRow';
|
|
5
|
-
import { ConfigCompany
|
|
5
|
+
import { ConfigCompany } from '../models/Client/Hotel/Company';
|
|
6
6
|
import { Room } from '../models/Room/Room';
|
|
7
7
|
import { RoomRate } from '../models/Room/RoomRate';
|
|
8
|
+
import { Hotel } from '..';
|
|
9
|
+
import { Analytics } from './Analytics/Analytics';
|
|
10
|
+
export declare enum DatalayerAnalyticsMode {
|
|
11
|
+
UniversalAnaltics = "UniversalAnalytics",
|
|
12
|
+
GoogleAnalytics4 = "GoogleAnalytics4"
|
|
13
|
+
}
|
|
14
|
+
export type GenericAnalyticsAccommodation = {
|
|
15
|
+
room: Room;
|
|
16
|
+
dateRange: {
|
|
17
|
+
from: Dayjs;
|
|
18
|
+
to: Dayjs;
|
|
19
|
+
};
|
|
20
|
+
rate?: RoomRate;
|
|
21
|
+
quantity?: number;
|
|
22
|
+
promoCode?: string;
|
|
23
|
+
};
|
|
24
|
+
export interface DateRange {
|
|
25
|
+
from: Dayjs;
|
|
26
|
+
to: Dayjs;
|
|
27
|
+
}
|
|
8
28
|
export default class DataLayer {
|
|
9
29
|
static instance: DataLayer;
|
|
10
30
|
private enableLogging;
|
|
11
|
-
private hotelName;
|
|
12
|
-
private providerHotelID;
|
|
13
31
|
private originalCurrencyCode?;
|
|
32
|
+
private currentCurrencyCode;
|
|
14
33
|
private impressions;
|
|
15
|
-
private
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
34
|
+
private hotel?;
|
|
35
|
+
private company?;
|
|
36
|
+
initialiseGTM(company: ConfigCompany, hotel?: Hotel): void;
|
|
37
|
+
setAnalyticsMode(mode: Analytics): void;
|
|
19
38
|
setCurrencyCodes(currentCurrencyCode: string, originalCurrencyCode?: string): void;
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
generateAddonProductInfo(addonRow: BasketAddonRow): Product;
|
|
23
|
-
addRoomImpression(room: Room): void;
|
|
24
|
-
addRoomRateImpression(room: Room, rate: RoomRate): void;
|
|
39
|
+
addRoomImpression(room: Room, dateRange: DateRange, promoCode: string): void;
|
|
40
|
+
addRoomRateImpression(room: Room, rate: RoomRate, dateRange: DateRange, promoCode: string): void;
|
|
25
41
|
sendRoomImpressions(): void;
|
|
26
|
-
sendRoomClick(room: Room, startDate: Dayjs, endDate: Dayjs): void;
|
|
42
|
+
sendRoomClick(room: Room, startDate: Dayjs, endDate: Dayjs, promoCode?: string): void;
|
|
27
43
|
sendAwayWindowOpen(): void;
|
|
28
44
|
sendRoomRateAddToCart(rate: RoomRate, quantity: number, startDate: Dayjs, endDate: Dayjs): void;
|
|
29
|
-
|
|
30
|
-
|
|
45
|
+
sendUpsellConfirmed(dateRange: DateRange, oldRate: RoomRate, newRate: RoomRate): void;
|
|
46
|
+
sendUpsellCancelled(dateRange: DateRange, rate: RoomRate): void;
|
|
31
47
|
sendRoomView(startDate: Dayjs, endDate: Dayjs): void;
|
|
32
48
|
sendCheckoutView(basketRows: BasketRow[], addonRows: BasketAddonRow[]): void;
|
|
33
49
|
sendReservationConfirmed(basketRows: BasketRow[], addonRows: BasketAddonRow[], reservations: ReservationsDTO): void;
|
|
50
|
+
sendCancellation(reservationNumber: ReservationDTO): void;
|
|
34
51
|
sendMemberSignUp(): void;
|
|
35
52
|
sendInteraction(name: string, type: InteractionType, step: InteractionStep): void;
|
|
36
|
-
sendCancellation(reservationNumber: string): void;
|
|
37
53
|
sendDateSelection({ startDate, endDate, adult, children, infant }: {
|
|
38
54
|
startDate: Dayjs;
|
|
39
55
|
endDate: Dayjs;
|
|
@@ -43,17 +59,6 @@ export default class DataLayer {
|
|
|
43
59
|
}): void;
|
|
44
60
|
protected log(...output: any): void;
|
|
45
61
|
}
|
|
46
|
-
type Product = {
|
|
47
|
-
name: string;
|
|
48
|
-
id: string;
|
|
49
|
-
price: number;
|
|
50
|
-
brand: string;
|
|
51
|
-
category: string;
|
|
52
|
-
variant?: string;
|
|
53
|
-
list?: string;
|
|
54
|
-
position?: number;
|
|
55
|
-
quantity?: number;
|
|
56
|
-
};
|
|
57
62
|
export declare enum InteractionType {
|
|
58
63
|
NUMBER_INPUT = "+-widget",
|
|
59
64
|
CALENDAR = "Calendar",
|
|
@@ -69,4 +74,3 @@ export declare enum InteractionStep {
|
|
|
69
74
|
ROOMS = "Rooms",
|
|
70
75
|
GUEST_DETAILS = "Guest Details"
|
|
71
76
|
}
|
|
72
|
-
export {};
|