@tripian/react 5.0.3 → 5.0.6
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.
|
@@ -2,7 +2,9 @@ import React from 'react';
|
|
|
2
2
|
import Model from '@tripian/model';
|
|
3
3
|
interface IOfferCard {
|
|
4
4
|
offer: Model.Offer;
|
|
5
|
-
|
|
5
|
+
optedIn: boolean;
|
|
6
|
+
isLoadingOffer: (offerId: number) => boolean;
|
|
7
|
+
clicked: (optIn: boolean, id: number) => void;
|
|
6
8
|
}
|
|
7
9
|
declare const OfferCard: React.FC<IOfferCard>;
|
|
8
10
|
export default OfferCard;
|
|
@@ -21,7 +21,9 @@ interface IPoiInfo {
|
|
|
21
21
|
getTourInfo?: (productId: string) => void;
|
|
22
22
|
TOUR_PROVIDER_ID?: Model.PROVIDER_ID;
|
|
23
23
|
TICKET_PROVIDER_ID?: Model.PROVIDER_ID;
|
|
24
|
-
|
|
24
|
+
myOffers: Model.Poi[];
|
|
25
|
+
isLoadingOffer: (offerId: number) => boolean;
|
|
26
|
+
offerButtonClick: (optIn: boolean, offerId: number, offerClaimDate: string) => void;
|
|
25
27
|
}
|
|
26
28
|
declare const PoiInfo: React.FC<IPoiInfo>;
|
|
27
29
|
export default PoiInfo;
|
|
@@ -17,6 +17,9 @@ interface IStepInfo {
|
|
|
17
17
|
getTourInfo?: (productId: string) => void;
|
|
18
18
|
TOUR_PROVIDER_ID?: Model.PROVIDER_ID;
|
|
19
19
|
TICKET_PROVIDER_ID?: Model.PROVIDER_ID;
|
|
20
|
+
myOffers: Model.Poi[];
|
|
21
|
+
isLoadingOffer: (offerId: number) => boolean;
|
|
22
|
+
offerButtonClick: (optIn: boolean, offerId: number, offerClaimDate: string) => void;
|
|
20
23
|
}
|
|
21
24
|
declare const StepInfo: React.FC<IStepInfo>;
|
|
22
25
|
export default StepInfo;
|
package/index.js
CHANGED
|
@@ -16293,10 +16293,12 @@ var DatePicker = function (_a) {
|
|
|
16293
16293
|
react_1.default.createElement("div", { className: "date-picker-year" },
|
|
16294
16294
|
react_1.default.createElement("select", { className: "date-picker-select", value: month.year(), onChange: function (e) { return onYearSelect(month, e.target.value); } }, years))));
|
|
16295
16295
|
};
|
|
16296
|
-
return (react_1.default.createElement(react_dates_1.SingleDatePicker, { id: "datepicker", date: date, displayFormat: "YYYY-MM-DD", hideKeyboardShortcutsPanel: true, focused: focus,
|
|
16296
|
+
return (react_1.default.createElement(react_dates_1.SingleDatePicker, { id: "datepicker", date: date, displayFormat: "YYYY-MM-DD", hideKeyboardShortcutsPanel: true, focused: focus,
|
|
16297
|
+
// orientation={smallDevice ? 'vertical' : 'horizontal'}
|
|
16298
|
+
withFullScreenPortal: smallDevice, onDateChange: function (selectedDate) {
|
|
16297
16299
|
setDate(selectedDate);
|
|
16298
16300
|
onchanged(selectedDate);
|
|
16299
|
-
}, renderMonthElement: showMonthSelection ? renderMonthElement : undefined, openDirection: openDirection, block: true, numberOfMonths:
|
|
16301
|
+
}, renderMonthElement: showMonthSelection ? renderMonthElement : undefined, openDirection: openDirection, block: true, numberOfMonths: 1, onFocusChange: function (_a) {
|
|
16300
16302
|
var focused = _a.focused;
|
|
16301
16303
|
return setFocus(focused);
|
|
16302
16304
|
}, isOutsideRange: function (day) {
|
|
@@ -44067,7 +44069,7 @@ var FormTemplateCompanion = function (_a) {
|
|
|
44067
44069
|
};
|
|
44068
44070
|
var callbackNumber = function (num) {
|
|
44069
44071
|
var newCompanionState = model_1.helper.deepCopy(userCompanion);
|
|
44070
|
-
newCompanionState.age = num
|
|
44072
|
+
newCompanionState.age = num || 1;
|
|
44071
44073
|
callbackFormTemplateCompanion(newCompanionState);
|
|
44072
44074
|
};
|
|
44073
44075
|
var userCompanionQuestionOnChange = function (selectedAnswers) {
|
|
@@ -44652,7 +44654,7 @@ var POI_CARD_ACTION;
|
|
|
44652
44654
|
})(POI_CARD_ACTION || (POI_CARD_ACTION = {}));
|
|
44653
44655
|
var PoiInfo = function (_a) {
|
|
44654
44656
|
var _b, _c;
|
|
44655
|
-
var poi = _a.poi, favorite = _a.favorite, toggleFavorite = _a.toggleFavorite, close = _a.close, addRemoveReplacePoi = _a.addRemoveReplacePoi, dayNumbers = _a.dayNumbers, _d = _a.stepOrder, stepOrder = _d === void 0 ? -1 : _d, _e = _a.replace, replace = _e === void 0 ? false : _e, _f = _a.hideActionButtons, hideActionButtons = _f === void 0 ? false : _f, bookingButtonClick = _a.bookingButtonClick, planDate = _a.planDate, favoriteLoading = _a.favoriteLoading, reservationUrl = _a.reservationUrl, hideBookingButton = _a.hideBookingButton, _g = _a.square, square = _g === void 0 ? true : _g, hideTours = _a.hideTours, getTourInfo = _a.getTourInfo, TOUR_PROVIDER_ID = _a.TOUR_PROVIDER_ID, TICKET_PROVIDER_ID = _a.TICKET_PROVIDER_ID, offerButtonClick = _a.offerButtonClick;
|
|
44657
|
+
var poi = _a.poi, favorite = _a.favorite, toggleFavorite = _a.toggleFavorite, close = _a.close, addRemoveReplacePoi = _a.addRemoveReplacePoi, dayNumbers = _a.dayNumbers, _d = _a.stepOrder, stepOrder = _d === void 0 ? -1 : _d, _e = _a.replace, replace = _e === void 0 ? false : _e, _f = _a.hideActionButtons, hideActionButtons = _f === void 0 ? false : _f, bookingButtonClick = _a.bookingButtonClick, planDate = _a.planDate, favoriteLoading = _a.favoriteLoading, reservationUrl = _a.reservationUrl, hideBookingButton = _a.hideBookingButton, _g = _a.square, square = _g === void 0 ? true : _g, hideTours = _a.hideTours, getTourInfo = _a.getTourInfo, TOUR_PROVIDER_ID = _a.TOUR_PROVIDER_ID, TICKET_PROVIDER_ID = _a.TICKET_PROVIDER_ID, myOffers = _a.myOffers, isLoadingOffer = _a.isLoadingOffer, offerButtonClick = _a.offerButtonClick;
|
|
44656
44658
|
var _h = (0, react_1.useState)(false), openTours = _h[0], setOpenTours = _h[1];
|
|
44657
44659
|
var myRef = react_1.default.createRef();
|
|
44658
44660
|
(0, react_1.useEffect)(function () {
|
|
@@ -44666,101 +44668,6 @@ var PoiInfo = function (_a) {
|
|
|
44666
44668
|
};
|
|
44667
44669
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
44668
44670
|
}, [openTours]);
|
|
44669
|
-
var offers = [
|
|
44670
|
-
{
|
|
44671
|
-
id: 135,
|
|
44672
|
-
tripianPoiId: 0,
|
|
44673
|
-
businessId: 99,
|
|
44674
|
-
title: 'Patron Çıldırdı !!!',
|
|
44675
|
-
description: '',
|
|
44676
|
-
currency: model_1.default.OFFER_CURRENCY.CAD,
|
|
44677
|
-
caption: 'Buy 2 Margheritta Pizza and get 3 free.',
|
|
44678
|
-
productName: 'Margheritta Pizza',
|
|
44679
|
-
threshold: 2,
|
|
44680
|
-
discount: 100,
|
|
44681
|
-
discountedProductCount: 3,
|
|
44682
|
-
quantity: 9999,
|
|
44683
|
-
timeframe: {
|
|
44684
|
-
start: '2022-07-19 22:13:00',
|
|
44685
|
-
end: '2022-07-20 22:13:00',
|
|
44686
|
-
},
|
|
44687
|
-
image: {
|
|
44688
|
-
id: 319,
|
|
44689
|
-
url: 'https://poi-pics.s3-eu-west-1.amazonaws.com/Place/340/845386/fa616f230a051e8384dc6bc072c8b279.jpg',
|
|
44690
|
-
},
|
|
44691
|
-
productType: {
|
|
44692
|
-
id: 2,
|
|
44693
|
-
name: model_1.default.PRODUCT_TYPE_NAME.FOOD,
|
|
44694
|
-
receiveMethod: model_1.default.OFFER_RECEIVE_METHOD.TAKEOUT,
|
|
44695
|
-
},
|
|
44696
|
-
offerType: model_1.default.OFFER_TYPE.QUANTITY,
|
|
44697
|
-
usage: 0,
|
|
44698
|
-
optIn: false,
|
|
44699
|
-
status: model_1.default.OFFER_STATUS.ACTIVE,
|
|
44700
|
-
},
|
|
44701
|
-
{
|
|
44702
|
-
id: 137,
|
|
44703
|
-
tripianPoiId: 0,
|
|
44704
|
-
businessId: 99,
|
|
44705
|
-
title: 'Patron Çıldırdı !!!',
|
|
44706
|
-
description: '',
|
|
44707
|
-
currency: model_1.default.OFFER_CURRENCY.CAD,
|
|
44708
|
-
caption: 'Get $5.00 off your purchase when you spend $50 or more.',
|
|
44709
|
-
productName: '',
|
|
44710
|
-
threshold: 50,
|
|
44711
|
-
discount: 5,
|
|
44712
|
-
discountedProductCount: 1,
|
|
44713
|
-
quantity: 9999,
|
|
44714
|
-
timeframe: {
|
|
44715
|
-
start: '2022-07-07 22:13:00',
|
|
44716
|
-
end: '2022-07-08 22:13:00',
|
|
44717
|
-
},
|
|
44718
|
-
image: {
|
|
44719
|
-
id: 319,
|
|
44720
|
-
url: 'https://poi-pics.s3-eu-west-1.amazonaws.com/Place/340/845386/fa616f230a051e8384dc6bc072c8b279.jpg',
|
|
44721
|
-
},
|
|
44722
|
-
productType: {
|
|
44723
|
-
id: 3,
|
|
44724
|
-
name: model_1.default.PRODUCT_TYPE_NAME.DRINK,
|
|
44725
|
-
receiveMethod: model_1.default.OFFER_RECEIVE_METHOD.DINEIN,
|
|
44726
|
-
},
|
|
44727
|
-
offerType: model_1.default.OFFER_TYPE.AMOUNT,
|
|
44728
|
-
usage: 0,
|
|
44729
|
-
optIn: false,
|
|
44730
|
-
status: model_1.default.OFFER_STATUS.ACTIVE,
|
|
44731
|
-
},
|
|
44732
|
-
{
|
|
44733
|
-
id: 136,
|
|
44734
|
-
tripianPoiId: 0,
|
|
44735
|
-
businessId: 99,
|
|
44736
|
-
title: 'Patron Çıldırdı !!!',
|
|
44737
|
-
description: '',
|
|
44738
|
-
currency: model_1.default.OFFER_CURRENCY.CAD,
|
|
44739
|
-
caption: 'Get 5% off any purchase of you spend $50 or more.',
|
|
44740
|
-
productName: '',
|
|
44741
|
-
threshold: 50,
|
|
44742
|
-
discount: 5,
|
|
44743
|
-
discountedProductCount: 1,
|
|
44744
|
-
quantity: 9999,
|
|
44745
|
-
timeframe: {
|
|
44746
|
-
start: '2022-07-25 22:13:00',
|
|
44747
|
-
end: '2022-07-27 22:13:00',
|
|
44748
|
-
},
|
|
44749
|
-
image: {
|
|
44750
|
-
id: 319,
|
|
44751
|
-
url: 'https://poi-pics.s3-eu-west-1.amazonaws.com/Place/340/845386/fa616f230a051e8384dc6bc072c8b279.jpg',
|
|
44752
|
-
},
|
|
44753
|
-
productType: {
|
|
44754
|
-
id: 3,
|
|
44755
|
-
name: model_1.default.PRODUCT_TYPE_NAME.DRINK,
|
|
44756
|
-
receiveMethod: model_1.default.OFFER_RECEIVE_METHOD.DINEIN,
|
|
44757
|
-
},
|
|
44758
|
-
offerType: model_1.default.OFFER_TYPE.PERCENTAGE,
|
|
44759
|
-
usage: 0,
|
|
44760
|
-
optIn: true,
|
|
44761
|
-
status: model_1.default.OFFER_STATUS.ACTIVE,
|
|
44762
|
-
},
|
|
44763
|
-
];
|
|
44764
44671
|
var ticketProviderBooking = poi.bookings.find(function (booking) { return booking.providerId === TICKET_PROVIDER_ID; });
|
|
44765
44672
|
var ticketProducts = (_b = ticketProviderBooking === null || ticketProviderBooking === void 0 ? void 0 : ticketProviderBooking.products.filter(function (product) { return product.info.includes(model_1.default.BOOKING_PRODUCT_INFO.TICKET); }).reverse()) !== null && _b !== void 0 ? _b : [];
|
|
44766
44673
|
var tourProviderBooking = poi.bookings.find(function (booking) { return booking.providerId === TOUR_PROVIDER_ID; });
|
|
@@ -44785,13 +44692,6 @@ var PoiInfo = function (_a) {
|
|
|
44785
44692
|
else if (ACTION_FLAG === POI_CARD_ACTION.REMOVE) {
|
|
44786
44693
|
actionIconClasses.push(PoiInfo_scss_1.default.removeIcon);
|
|
44787
44694
|
}
|
|
44788
|
-
var offersData;
|
|
44789
|
-
if (poi.offers && poi.offers.length > 0) {
|
|
44790
|
-
offersData = poi.offers;
|
|
44791
|
-
}
|
|
44792
|
-
else {
|
|
44793
|
-
offersData = offers;
|
|
44794
|
-
}
|
|
44795
44695
|
return (react_1.default.createElement("div", { className: PoiInfo_scss_1.default.poi },
|
|
44796
44696
|
react_1.default.createElement("div", { className: PoiInfo_scss_1.default.poiImage },
|
|
44797
44697
|
react_1.default.createElement(PoiInfoImage_1.default, { poi: poi, favorite: favorite, favoriteClick: function (fav) {
|
|
@@ -44808,17 +44708,16 @@ var PoiInfo = function (_a) {
|
|
|
44808
44708
|
addRemoveReplacePoi(poi, 1);
|
|
44809
44709
|
} })) : null),
|
|
44810
44710
|
react_1.default.createElement(PoiInfoText_1.default, { poi: poi, dayNumbers: dayNumbers, planDate: planDate, reservationUrl: reservationUrl, hideBookingButton: hideBookingButton, bookingButtonClick: bookingButtonClick }),
|
|
44811
|
-
|
|
44711
|
+
poi.offers && poi.offers.length > 0 && (react_1.default.createElement("div", { className: "col col12 px5 pb5" }, poi.offers.map(function (offer, i) {
|
|
44812
44712
|
var _a, _b;
|
|
44813
44713
|
var offerStartDate = (0, moment_1.default)((_a = offer.timeframe) === null || _a === void 0 ? void 0 : _a.start);
|
|
44814
44714
|
var offerEndDate = (0, moment_1.default)((_b = offer.timeframe) === null || _b === void 0 ? void 0 : _b.end);
|
|
44815
44715
|
var planDateTimeNow = (0, moment_1.default)(planDate);
|
|
44816
|
-
if (planDateTimeNow.
|
|
44817
|
-
var offerClaimDate_1 =
|
|
44716
|
+
if (planDateTimeNow.isBetween(offerStartDate, offerEndDate)) {
|
|
44717
|
+
var offerClaimDate_1 = (0, moment_1.default)(planDate).format('YYYY-MM-DD');
|
|
44818
44718
|
return (react_1.default.createElement("div", { key: "offer-".concat(i), className: "py2" },
|
|
44819
|
-
react_1.default.createElement(OfferCard_1.default, { offer: offer, clicked: function (id) {
|
|
44820
|
-
|
|
44821
|
-
offerButtonClick(id, offerClaimDate_1);
|
|
44719
|
+
react_1.default.createElement(OfferCard_1.default, { offer: offer, optedIn: myOffers.some(function (p) { return p.offers.some(function (x) { return x.id === offer.id && x.optIn; }); }), isLoadingOffer: isLoadingOffer, clicked: function (optIn, id) {
|
|
44720
|
+
offerButtonClick(optIn, id, offerClaimDate_1);
|
|
44822
44721
|
} })));
|
|
44823
44722
|
}
|
|
44824
44723
|
return null;
|
|
@@ -65100,10 +64999,11 @@ var react_1 = __importDefault(__webpack_require__(0));
|
|
|
65100
64999
|
var moment_1 = __importDefault(__webpack_require__(1));
|
|
65101
65000
|
var OfferCard_scss_1 = __importDefault(__webpack_require__(675));
|
|
65102
65001
|
var Button_1 = __importDefault(__webpack_require__(5));
|
|
65002
|
+
var PreLoading_1 = __importDefault(__webpack_require__(12));
|
|
65103
65003
|
var OfferCard = function (_a) {
|
|
65104
65004
|
var _b, _c;
|
|
65105
|
-
var offer = _a.offer, clicked = _a.clicked;
|
|
65106
|
-
return (react_1.default.createElement("div", { className: OfferCard_scss_1.default.offerCard
|
|
65005
|
+
var offer = _a.offer, optedIn = _a.optedIn, isLoadingOffer = _a.isLoadingOffer, clicked = _a.clicked;
|
|
65006
|
+
return (react_1.default.createElement("div", { className: OfferCard_scss_1.default.offerCard },
|
|
65107
65007
|
react_1.default.createElement("div", { className: OfferCard_scss_1.default.offerCardImgDiv },
|
|
65108
65008
|
react_1.default.createElement("img", { className: OfferCard_scss_1.default.offerCardImg, src: offer.image.url, alt: "" })),
|
|
65109
65009
|
react_1.default.createElement("div", { className: OfferCard_scss_1.default.offerCardContent },
|
|
@@ -65116,8 +65016,12 @@ var OfferCard = function (_a) {
|
|
|
65116
65016
|
"To: ",
|
|
65117
65017
|
(0, moment_1.default)((_c = offer.timeframe) === null || _c === void 0 ? void 0 : _c.end).format('DD MMMM h:mm A'))),
|
|
65118
65018
|
react_1.default.createElement("div", { className: OfferCard_scss_1.default.offerCardCaption }, offer.caption),
|
|
65119
|
-
react_1.default.createElement("div", { className: OfferCard_scss_1.default.offerCardButton },
|
|
65120
|
-
|
|
65019
|
+
react_1.default.createElement("div", { className: OfferCard_scss_1.default.offerCardButton }, isLoadingOffer(offer.id) ? (react_1.default.createElement(PreLoading_1.default, null)) : (react_1.default.createElement(Button_1.default, { className: OfferCard_scss_1.default.offerButton, text: optedIn ? 'OPT-OUT' : 'OPT-IN', onClick: function () {
|
|
65020
|
+
if (optedIn)
|
|
65021
|
+
clicked(false, offer.id);
|
|
65022
|
+
else
|
|
65023
|
+
clicked(true, offer.id);
|
|
65024
|
+
}, color: "primary", size: "small" }))))));
|
|
65121
65025
|
};
|
|
65122
65026
|
exports.default = OfferCard;
|
|
65123
65027
|
|
|
@@ -65830,10 +65734,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
65830
65734
|
var react_1 = __importDefault(__webpack_require__(0));
|
|
65831
65735
|
var PoiInfo_1 = __importDefault(__webpack_require__(334));
|
|
65832
65736
|
var StepInfo = function (_a) {
|
|
65833
|
-
var step = _a.step, favorite = _a.favorite, toggleFavorite = _a.toggleFavorite, removeStep = _a.removeStep, close = _a.close, dayNumbers = _a.dayNumbers, hideRemoveStepButton = _a.hideRemoveStepButton, bookingButtonClick = _a.bookingButtonClick, planDate = _a.planDate, favoriteLoading = _a.favoriteLoading, reservationUrl = _a.reservationUrl, hideBookingButton = _a.hideBookingButton, hideTours = _a.hideTours, getTourInfo = _a.getTourInfo, TOUR_PROVIDER_ID = _a.TOUR_PROVIDER_ID, TICKET_PROVIDER_ID = _a.TICKET_PROVIDER_ID;
|
|
65737
|
+
var step = _a.step, favorite = _a.favorite, toggleFavorite = _a.toggleFavorite, removeStep = _a.removeStep, close = _a.close, dayNumbers = _a.dayNumbers, hideRemoveStepButton = _a.hideRemoveStepButton, bookingButtonClick = _a.bookingButtonClick, planDate = _a.planDate, favoriteLoading = _a.favoriteLoading, reservationUrl = _a.reservationUrl, hideBookingButton = _a.hideBookingButton, hideTours = _a.hideTours, getTourInfo = _a.getTourInfo, TOUR_PROVIDER_ID = _a.TOUR_PROVIDER_ID, TICKET_PROVIDER_ID = _a.TICKET_PROVIDER_ID, myOffers = _a.myOffers, isLoadingOffer = _a.isLoadingOffer, offerButtonClick = _a.offerButtonClick;
|
|
65834
65738
|
return (react_1.default.createElement(PoiInfo_1.default, { dayNumbers: dayNumbers, poi: step.poi, favorite: favorite, toggleFavorite: toggleFavorite, close: close, addRemoveReplacePoi: function () {
|
|
65835
65739
|
removeStep(step.id);
|
|
65836
|
-
}, stepOrder: step.order, hideActionButtons: hideRemoveStepButton, bookingButtonClick: bookingButtonClick, planDate: planDate, favoriteLoading: favoriteLoading, reservationUrl: reservationUrl, hideBookingButton: hideBookingButton, square: false, hideTours: hideTours, getTourInfo: getTourInfo, TOUR_PROVIDER_ID: TOUR_PROVIDER_ID, TICKET_PROVIDER_ID: TICKET_PROVIDER_ID }));
|
|
65740
|
+
}, stepOrder: step.order, hideActionButtons: hideRemoveStepButton, bookingButtonClick: bookingButtonClick, planDate: planDate, favoriteLoading: favoriteLoading, reservationUrl: reservationUrl, hideBookingButton: hideBookingButton, square: false, hideTours: hideTours, getTourInfo: getTourInfo, TOUR_PROVIDER_ID: TOUR_PROVIDER_ID, TICKET_PROVIDER_ID: TICKET_PROVIDER_ID, myOffers: myOffers, isLoadingOffer: isLoadingOffer, offerButtonClick: offerButtonClick }));
|
|
65837
65741
|
};
|
|
65838
65742
|
exports.default = StepInfo;
|
|
65839
65743
|
|