tabexseriescomponents 0.2.1283 → 0.2.1284
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/index.cjs.js +186 -1
- package/dist/index.esm.js +186 -1
- package/dist/index.umd.js +186 -1
- package/package.json +1 -1
package/dist/index.cjs.js
CHANGED
|
@@ -74664,6 +74664,191 @@ var MapsSection = function MapsSection(props) {
|
|
|
74664
74664
|
}))));
|
|
74665
74665
|
};
|
|
74666
74666
|
|
|
74667
|
+
// const gifts = [
|
|
74668
|
+
// { label: '10% OFF', color: colorTheme.wheelSegments[0] },
|
|
74669
|
+
// { label: 'Free Shipping', color: colorTheme.wheelSegments[1] },
|
|
74670
|
+
// { label: '15% OFF', color: colorTheme.wheelSegments[2] },
|
|
74671
|
+
// { label: 'Buy 1 Get 1', color: colorTheme.wheelSegments[3] },
|
|
74672
|
+
// { label: '20% OFF', color: colorTheme.wheelSegments[4] },
|
|
74673
|
+
// { label: 'Free Gift Box', color: colorTheme.wheelSegments[5] },
|
|
74674
|
+
// { label: '$5 Coupon', color: colorTheme.wheelSegments[6] },
|
|
74675
|
+
// { label: 'Try Again', color: colorTheme.wheelSegments[7] },
|
|
74676
|
+
// ];
|
|
74677
|
+
|
|
74678
|
+
var WheelSpin = function WheelSpin(props) {
|
|
74679
|
+
var GeneralAPIMutationContext = props.actions.GeneralAPIMutationContext;
|
|
74680
|
+
var ApplyPromoCodeMutationContext = props.actions.ApplyPromoCodeMutationContext;
|
|
74681
|
+
var _useState = React.useState(false),
|
|
74682
|
+
_useState2 = _slicedToArray__default["default"](_useState, 2),
|
|
74683
|
+
isOpen = _useState2[0],
|
|
74684
|
+
setIsOpen = _useState2[1];
|
|
74685
|
+
var _useState3 = React.useState(0),
|
|
74686
|
+
_useState4 = _slicedToArray__default["default"](_useState3, 2),
|
|
74687
|
+
rotation = _useState4[0],
|
|
74688
|
+
setRotation = _useState4[1];
|
|
74689
|
+
var _useState5 = React.useState(null),
|
|
74690
|
+
_useState6 = _slicedToArray__default["default"](_useState5, 2),
|
|
74691
|
+
selectedGift = _useState6[0],
|
|
74692
|
+
setSelectedGift = _useState6[1];
|
|
74693
|
+
var _useState7 = React.useState(false),
|
|
74694
|
+
_useState8 = _slicedToArray__default["default"](_useState7, 2),
|
|
74695
|
+
isSpinning = _useState8[0],
|
|
74696
|
+
setIsSpinning = _useState8[1];
|
|
74697
|
+
var _useState9 = React.useState(false),
|
|
74698
|
+
_useState0 = _slicedToArray__default["default"](_useState9, 2),
|
|
74699
|
+
showCelebration = _useState0[0],
|
|
74700
|
+
setShowCelebration = _useState0[1];
|
|
74701
|
+
var _useState1 = React.useState([]),
|
|
74702
|
+
_useState10 = _slicedToArray__default["default"](_useState1, 2),
|
|
74703
|
+
gifts = _useState10[0],
|
|
74704
|
+
setgifts = _useState10[1];
|
|
74705
|
+
var segmentAngle = 360 / gifts.length;
|
|
74706
|
+
var wheelBackground = "conic-gradient(".concat(gifts.map(function (gift, index) {
|
|
74707
|
+
var start = index * segmentAngle;
|
|
74708
|
+
var end = start + segmentAngle;
|
|
74709
|
+
return "".concat(gift.spinner_color, " ").concat(start, "deg ").concat(end, "deg");
|
|
74710
|
+
}).join(', '), ")");
|
|
74711
|
+
var handleSpin = function handleSpin() {
|
|
74712
|
+
if (isSpinning) {
|
|
74713
|
+
return;
|
|
74714
|
+
}
|
|
74715
|
+
var randomIndex = Math.floor(Math.random() * gifts.length);
|
|
74716
|
+
var extraTurns = 360 * (5 + Math.floor(Math.random() * 3));
|
|
74717
|
+
var landingAngle = randomIndex * segmentAngle + segmentAngle / 2;
|
|
74718
|
+
var targetRotation = extraTurns + (360 - landingAngle);
|
|
74719
|
+
setIsSpinning(true);
|
|
74720
|
+
setSelectedGift(null);
|
|
74721
|
+
setShowCelebration(false);
|
|
74722
|
+
setRotation(function (previousRotation) {
|
|
74723
|
+
return previousRotation + targetRotation;
|
|
74724
|
+
});
|
|
74725
|
+
window.setTimeout(function () {
|
|
74726
|
+
var chosen_gift = gifts[randomIndex];
|
|
74727
|
+
if (chosen_gift.copounid == 'tryagain') {
|
|
74728
|
+
setIsOpen(false);
|
|
74729
|
+
} else {
|
|
74730
|
+
setSelectedGift(chosen_gift);
|
|
74731
|
+
setIsSpinning(false);
|
|
74732
|
+
setShowCelebration(true);
|
|
74733
|
+
ApplyPromoCodeMutationContext.mutate({
|
|
74734
|
+
couponname: chosen_gift.couponname,
|
|
74735
|
+
functype: 'add'
|
|
74736
|
+
});
|
|
74737
|
+
}
|
|
74738
|
+
}, 5200);
|
|
74739
|
+
};
|
|
74740
|
+
var handleClose = function handleClose() {
|
|
74741
|
+
if (isSpinning) {
|
|
74742
|
+
return;
|
|
74743
|
+
}
|
|
74744
|
+
setIsOpen(false);
|
|
74745
|
+
};
|
|
74746
|
+
var fetchGifts_Api = function fetchGifts_Api() {
|
|
74747
|
+
GeneralAPIMutationContext.mutate({
|
|
74748
|
+
endpointurl: '/fetch_coupons_spinner',
|
|
74749
|
+
// productid: productid,
|
|
74750
|
+
// reviewpayloadobj: reviewpayloadobj,
|
|
74751
|
+
mutateSuccesscallback: function mutateSuccesscallback(data, variables) {
|
|
74752
|
+
if (data.data.status) {
|
|
74753
|
+
var gifts_array_temp = data.data.data;
|
|
74754
|
+
gifts_array_temp.push({
|
|
74755
|
+
copounid: 'tryagain',
|
|
74756
|
+
spinner_color: 'black',
|
|
74757
|
+
description_en: 'Better luck next time'
|
|
74758
|
+
});
|
|
74759
|
+
setgifts(gifts_array_temp);
|
|
74760
|
+
// var data_gifts = data.data.data
|
|
74761
|
+
|
|
74762
|
+
// alert(JSON.stringify(data.data));
|
|
74763
|
+
// NotificationManager.success('', 'Success');
|
|
74764
|
+
// addreviewcallback();
|
|
74765
|
+
// window.location.reload();
|
|
74766
|
+
} else {
|
|
74767
|
+
NotificationManager.warning('', data.data.reason);
|
|
74768
|
+
}
|
|
74769
|
+
}
|
|
74770
|
+
});
|
|
74771
|
+
};
|
|
74772
|
+
var handleOpen = function handleOpen() {
|
|
74773
|
+
fetchGifts_Api();
|
|
74774
|
+
setSelectedGift(null);
|
|
74775
|
+
setRotation(0);
|
|
74776
|
+
setIsSpinning(false);
|
|
74777
|
+
setShowCelebration(false);
|
|
74778
|
+
setIsOpen(true);
|
|
74779
|
+
};
|
|
74780
|
+
return /*#__PURE__*/React__default["default"].createElement("div", {
|
|
74781
|
+
className: "wheel-spin-section"
|
|
74782
|
+
}, /*#__PURE__*/React__default["default"].createElement("button", {
|
|
74783
|
+
className: "open-popup-button",
|
|
74784
|
+
onClick: handleOpen,
|
|
74785
|
+
type: "button",
|
|
74786
|
+
"aria-label": "Open lucky wheel"
|
|
74787
|
+
}, "Spin"), isOpen ? /*#__PURE__*/React__default["default"].createElement("div", {
|
|
74788
|
+
className: "popup-overlay",
|
|
74789
|
+
onClick: handleClose
|
|
74790
|
+
}, /*#__PURE__*/React__default["default"].createElement("div", {
|
|
74791
|
+
className: "content-card",
|
|
74792
|
+
onClick: function onClick(event) {
|
|
74793
|
+
return event.stopPropagation();
|
|
74794
|
+
}
|
|
74795
|
+
}, /*#__PURE__*/React__default["default"].createElement("button", {
|
|
74796
|
+
className: "close-button",
|
|
74797
|
+
onClick: handleClose,
|
|
74798
|
+
disabled: isSpinning,
|
|
74799
|
+
type: "button"
|
|
74800
|
+
}, "\xD7"), !showCelebration ? /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, /*#__PURE__*/React__default["default"].createElement("h2", null, "Spin the wheel and unlock your surprise gift"), /*#__PURE__*/React__default["default"].createElement("p", null, "Tap the button, watch the wheel rotate, and get a random reward."), /*#__PURE__*/React__default["default"].createElement("div", {
|
|
74801
|
+
className: "wheel-stage"
|
|
74802
|
+
}, /*#__PURE__*/React__default["default"].createElement("div", {
|
|
74803
|
+
className: "pointer"
|
|
74804
|
+
}), /*#__PURE__*/React__default["default"].createElement("div", {
|
|
74805
|
+
className: "wheel",
|
|
74806
|
+
style: {
|
|
74807
|
+
transform: "rotate(".concat(rotation, "deg)"),
|
|
74808
|
+
background: wheelBackground
|
|
74809
|
+
}
|
|
74810
|
+
}, gifts.map(function (gift, index) {
|
|
74811
|
+
return /*#__PURE__*/React__default["default"].createElement("div", {
|
|
74812
|
+
className: "label",
|
|
74813
|
+
key: gift.description_en,
|
|
74814
|
+
style: {
|
|
74815
|
+
transform: "rotate(".concat(index * segmentAngle + segmentAngle / 2, "deg)")
|
|
74816
|
+
}
|
|
74817
|
+
}, /*#__PURE__*/React__default["default"].createElement("span", {
|
|
74818
|
+
style: {
|
|
74819
|
+
transform: 'translateX(-50%)'
|
|
74820
|
+
}
|
|
74821
|
+
}, gift.description_en));
|
|
74822
|
+
}), /*#__PURE__*/React__default["default"].createElement("div", {
|
|
74823
|
+
className: "wheel-center"
|
|
74824
|
+
}, /*#__PURE__*/React__default["default"].createElement("span", null, "WIN")))), /*#__PURE__*/React__default["default"].createElement("button", {
|
|
74825
|
+
className: "spin-button",
|
|
74826
|
+
onClick: handleSpin,
|
|
74827
|
+
disabled: isSpinning,
|
|
74828
|
+
type: "button"
|
|
74829
|
+
}, isSpinning ? 'Spinning...' : 'Spin Now')) : /*#__PURE__*/React__default["default"].createElement("div", {
|
|
74830
|
+
className: "celebration-card"
|
|
74831
|
+
}, /*#__PURE__*/React__default["default"].createElement("div", {
|
|
74832
|
+
className: "confetti confetti-one"
|
|
74833
|
+
}), /*#__PURE__*/React__default["default"].createElement("div", {
|
|
74834
|
+
className: "confetti confetti-two"
|
|
74835
|
+
}), /*#__PURE__*/React__default["default"].createElement("div", {
|
|
74836
|
+
className: "confetti confetti-three"
|
|
74837
|
+
}), /*#__PURE__*/React__default["default"].createElement("div", {
|
|
74838
|
+
className: "confetti confetti-four"
|
|
74839
|
+
}), /*#__PURE__*/React__default["default"].createElement("div", {
|
|
74840
|
+
className: "success-badge"
|
|
74841
|
+
}, "Congratulations"), /*#__PURE__*/React__default["default"].createElement("h2", null, "You unlocked a special reward"), /*#__PURE__*/React__default["default"].createElement("p", {
|
|
74842
|
+
className: "celebration-copy"
|
|
74843
|
+
}, "Your lucky spin landed on", /*#__PURE__*/React__default["default"].createElement("strong", null, " ", selectedGift.description_en)), /*#__PURE__*/React__default["default"].createElement("div", {
|
|
74844
|
+
className: "prize-highlight"
|
|
74845
|
+
}, /*#__PURE__*/React__default["default"].createElement("span", null, selectedGift.description_en)), /*#__PURE__*/React__default["default"].createElement("button", {
|
|
74846
|
+
className: "claim-button",
|
|
74847
|
+
onClick: handleClose,
|
|
74848
|
+
type: "button"
|
|
74849
|
+
}, "Awesome")))) : null);
|
|
74850
|
+
};
|
|
74851
|
+
|
|
74667
74852
|
var css_248z$j = ".Freetext-module_background__oUp-J {\r\n background-size: cover !important;\r\n background-position: center !important;\r\n background-attachment: fixed !important;\r\n background-repeat: no-repeat !important;\r\n -webkit-background-size: cover !important;\r\n -moz-background-size: cover !important;\r\n}\r\n@media (max-width: 800px) {\r\n .Freetext-module_background__oUp-J {\r\n background-size: contain !important;\r\n background-position: center !important;\r\n background-attachment: initial !important;\r\n background-repeat: no-repeat !important;\r\n -webkit-background-size: contain !important;\r\n -moz-background-size: contain !important;\r\n }\r\n}\r\n";
|
|
74668
74853
|
var sectionstyles$2 = {"background":"Freetext-module_background__oUp-J"};
|
|
74669
74854
|
styleInject(css_248z$j);
|
|
@@ -98405,7 +98590,7 @@ var returnLibrary = function returnLibrary() {
|
|
|
98405
98590
|
VideosSection: VideosSection,
|
|
98406
98591
|
FullVideoSection: FullVideoSection,
|
|
98407
98592
|
Popupcomponent: Popupcomponent,
|
|
98408
|
-
|
|
98593
|
+
WheelSpin: WheelSpin,
|
|
98409
98594
|
PopupCountryComponent: PopupCountryComponent,
|
|
98410
98595
|
TextSectionConnectToWA: TextSectionConnectToWA,
|
|
98411
98596
|
DynamicForm: DynamicForm,
|
package/dist/index.esm.js
CHANGED
|
@@ -74613,6 +74613,191 @@ var MapsSection = function MapsSection(props) {
|
|
|
74613
74613
|
}))));
|
|
74614
74614
|
};
|
|
74615
74615
|
|
|
74616
|
+
// const gifts = [
|
|
74617
|
+
// { label: '10% OFF', color: colorTheme.wheelSegments[0] },
|
|
74618
|
+
// { label: 'Free Shipping', color: colorTheme.wheelSegments[1] },
|
|
74619
|
+
// { label: '15% OFF', color: colorTheme.wheelSegments[2] },
|
|
74620
|
+
// { label: 'Buy 1 Get 1', color: colorTheme.wheelSegments[3] },
|
|
74621
|
+
// { label: '20% OFF', color: colorTheme.wheelSegments[4] },
|
|
74622
|
+
// { label: 'Free Gift Box', color: colorTheme.wheelSegments[5] },
|
|
74623
|
+
// { label: '$5 Coupon', color: colorTheme.wheelSegments[6] },
|
|
74624
|
+
// { label: 'Try Again', color: colorTheme.wheelSegments[7] },
|
|
74625
|
+
// ];
|
|
74626
|
+
|
|
74627
|
+
var WheelSpin = function WheelSpin(props) {
|
|
74628
|
+
var GeneralAPIMutationContext = props.actions.GeneralAPIMutationContext;
|
|
74629
|
+
var ApplyPromoCodeMutationContext = props.actions.ApplyPromoCodeMutationContext;
|
|
74630
|
+
var _useState = useState(false),
|
|
74631
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
74632
|
+
isOpen = _useState2[0],
|
|
74633
|
+
setIsOpen = _useState2[1];
|
|
74634
|
+
var _useState3 = useState(0),
|
|
74635
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
74636
|
+
rotation = _useState4[0],
|
|
74637
|
+
setRotation = _useState4[1];
|
|
74638
|
+
var _useState5 = useState(null),
|
|
74639
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
74640
|
+
selectedGift = _useState6[0],
|
|
74641
|
+
setSelectedGift = _useState6[1];
|
|
74642
|
+
var _useState7 = useState(false),
|
|
74643
|
+
_useState8 = _slicedToArray(_useState7, 2),
|
|
74644
|
+
isSpinning = _useState8[0],
|
|
74645
|
+
setIsSpinning = _useState8[1];
|
|
74646
|
+
var _useState9 = useState(false),
|
|
74647
|
+
_useState0 = _slicedToArray(_useState9, 2),
|
|
74648
|
+
showCelebration = _useState0[0],
|
|
74649
|
+
setShowCelebration = _useState0[1];
|
|
74650
|
+
var _useState1 = useState([]),
|
|
74651
|
+
_useState10 = _slicedToArray(_useState1, 2),
|
|
74652
|
+
gifts = _useState10[0],
|
|
74653
|
+
setgifts = _useState10[1];
|
|
74654
|
+
var segmentAngle = 360 / gifts.length;
|
|
74655
|
+
var wheelBackground = "conic-gradient(".concat(gifts.map(function (gift, index) {
|
|
74656
|
+
var start = index * segmentAngle;
|
|
74657
|
+
var end = start + segmentAngle;
|
|
74658
|
+
return "".concat(gift.spinner_color, " ").concat(start, "deg ").concat(end, "deg");
|
|
74659
|
+
}).join(', '), ")");
|
|
74660
|
+
var handleSpin = function handleSpin() {
|
|
74661
|
+
if (isSpinning) {
|
|
74662
|
+
return;
|
|
74663
|
+
}
|
|
74664
|
+
var randomIndex = Math.floor(Math.random() * gifts.length);
|
|
74665
|
+
var extraTurns = 360 * (5 + Math.floor(Math.random() * 3));
|
|
74666
|
+
var landingAngle = randomIndex * segmentAngle + segmentAngle / 2;
|
|
74667
|
+
var targetRotation = extraTurns + (360 - landingAngle);
|
|
74668
|
+
setIsSpinning(true);
|
|
74669
|
+
setSelectedGift(null);
|
|
74670
|
+
setShowCelebration(false);
|
|
74671
|
+
setRotation(function (previousRotation) {
|
|
74672
|
+
return previousRotation + targetRotation;
|
|
74673
|
+
});
|
|
74674
|
+
window.setTimeout(function () {
|
|
74675
|
+
var chosen_gift = gifts[randomIndex];
|
|
74676
|
+
if (chosen_gift.copounid == 'tryagain') {
|
|
74677
|
+
setIsOpen(false);
|
|
74678
|
+
} else {
|
|
74679
|
+
setSelectedGift(chosen_gift);
|
|
74680
|
+
setIsSpinning(false);
|
|
74681
|
+
setShowCelebration(true);
|
|
74682
|
+
ApplyPromoCodeMutationContext.mutate({
|
|
74683
|
+
couponname: chosen_gift.couponname,
|
|
74684
|
+
functype: 'add'
|
|
74685
|
+
});
|
|
74686
|
+
}
|
|
74687
|
+
}, 5200);
|
|
74688
|
+
};
|
|
74689
|
+
var handleClose = function handleClose() {
|
|
74690
|
+
if (isSpinning) {
|
|
74691
|
+
return;
|
|
74692
|
+
}
|
|
74693
|
+
setIsOpen(false);
|
|
74694
|
+
};
|
|
74695
|
+
var fetchGifts_Api = function fetchGifts_Api() {
|
|
74696
|
+
GeneralAPIMutationContext.mutate({
|
|
74697
|
+
endpointurl: '/fetch_coupons_spinner',
|
|
74698
|
+
// productid: productid,
|
|
74699
|
+
// reviewpayloadobj: reviewpayloadobj,
|
|
74700
|
+
mutateSuccesscallback: function mutateSuccesscallback(data, variables) {
|
|
74701
|
+
if (data.data.status) {
|
|
74702
|
+
var gifts_array_temp = data.data.data;
|
|
74703
|
+
gifts_array_temp.push({
|
|
74704
|
+
copounid: 'tryagain',
|
|
74705
|
+
spinner_color: 'black',
|
|
74706
|
+
description_en: 'Better luck next time'
|
|
74707
|
+
});
|
|
74708
|
+
setgifts(gifts_array_temp);
|
|
74709
|
+
// var data_gifts = data.data.data
|
|
74710
|
+
|
|
74711
|
+
// alert(JSON.stringify(data.data));
|
|
74712
|
+
// NotificationManager.success('', 'Success');
|
|
74713
|
+
// addreviewcallback();
|
|
74714
|
+
// window.location.reload();
|
|
74715
|
+
} else {
|
|
74716
|
+
NotificationManager.warning('', data.data.reason);
|
|
74717
|
+
}
|
|
74718
|
+
}
|
|
74719
|
+
});
|
|
74720
|
+
};
|
|
74721
|
+
var handleOpen = function handleOpen() {
|
|
74722
|
+
fetchGifts_Api();
|
|
74723
|
+
setSelectedGift(null);
|
|
74724
|
+
setRotation(0);
|
|
74725
|
+
setIsSpinning(false);
|
|
74726
|
+
setShowCelebration(false);
|
|
74727
|
+
setIsOpen(true);
|
|
74728
|
+
};
|
|
74729
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
74730
|
+
className: "wheel-spin-section"
|
|
74731
|
+
}, /*#__PURE__*/React.createElement("button", {
|
|
74732
|
+
className: "open-popup-button",
|
|
74733
|
+
onClick: handleOpen,
|
|
74734
|
+
type: "button",
|
|
74735
|
+
"aria-label": "Open lucky wheel"
|
|
74736
|
+
}, "Spin"), isOpen ? /*#__PURE__*/React.createElement("div", {
|
|
74737
|
+
className: "popup-overlay",
|
|
74738
|
+
onClick: handleClose
|
|
74739
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
74740
|
+
className: "content-card",
|
|
74741
|
+
onClick: function onClick(event) {
|
|
74742
|
+
return event.stopPropagation();
|
|
74743
|
+
}
|
|
74744
|
+
}, /*#__PURE__*/React.createElement("button", {
|
|
74745
|
+
className: "close-button",
|
|
74746
|
+
onClick: handleClose,
|
|
74747
|
+
disabled: isSpinning,
|
|
74748
|
+
type: "button"
|
|
74749
|
+
}, "\xD7"), !showCelebration ? /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("h2", null, "Spin the wheel and unlock your surprise gift"), /*#__PURE__*/React.createElement("p", null, "Tap the button, watch the wheel rotate, and get a random reward."), /*#__PURE__*/React.createElement("div", {
|
|
74750
|
+
className: "wheel-stage"
|
|
74751
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
74752
|
+
className: "pointer"
|
|
74753
|
+
}), /*#__PURE__*/React.createElement("div", {
|
|
74754
|
+
className: "wheel",
|
|
74755
|
+
style: {
|
|
74756
|
+
transform: "rotate(".concat(rotation, "deg)"),
|
|
74757
|
+
background: wheelBackground
|
|
74758
|
+
}
|
|
74759
|
+
}, gifts.map(function (gift, index) {
|
|
74760
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
74761
|
+
className: "label",
|
|
74762
|
+
key: gift.description_en,
|
|
74763
|
+
style: {
|
|
74764
|
+
transform: "rotate(".concat(index * segmentAngle + segmentAngle / 2, "deg)")
|
|
74765
|
+
}
|
|
74766
|
+
}, /*#__PURE__*/React.createElement("span", {
|
|
74767
|
+
style: {
|
|
74768
|
+
transform: 'translateX(-50%)'
|
|
74769
|
+
}
|
|
74770
|
+
}, gift.description_en));
|
|
74771
|
+
}), /*#__PURE__*/React.createElement("div", {
|
|
74772
|
+
className: "wheel-center"
|
|
74773
|
+
}, /*#__PURE__*/React.createElement("span", null, "WIN")))), /*#__PURE__*/React.createElement("button", {
|
|
74774
|
+
className: "spin-button",
|
|
74775
|
+
onClick: handleSpin,
|
|
74776
|
+
disabled: isSpinning,
|
|
74777
|
+
type: "button"
|
|
74778
|
+
}, isSpinning ? 'Spinning...' : 'Spin Now')) : /*#__PURE__*/React.createElement("div", {
|
|
74779
|
+
className: "celebration-card"
|
|
74780
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
74781
|
+
className: "confetti confetti-one"
|
|
74782
|
+
}), /*#__PURE__*/React.createElement("div", {
|
|
74783
|
+
className: "confetti confetti-two"
|
|
74784
|
+
}), /*#__PURE__*/React.createElement("div", {
|
|
74785
|
+
className: "confetti confetti-three"
|
|
74786
|
+
}), /*#__PURE__*/React.createElement("div", {
|
|
74787
|
+
className: "confetti confetti-four"
|
|
74788
|
+
}), /*#__PURE__*/React.createElement("div", {
|
|
74789
|
+
className: "success-badge"
|
|
74790
|
+
}, "Congratulations"), /*#__PURE__*/React.createElement("h2", null, "You unlocked a special reward"), /*#__PURE__*/React.createElement("p", {
|
|
74791
|
+
className: "celebration-copy"
|
|
74792
|
+
}, "Your lucky spin landed on", /*#__PURE__*/React.createElement("strong", null, " ", selectedGift.description_en)), /*#__PURE__*/React.createElement("div", {
|
|
74793
|
+
className: "prize-highlight"
|
|
74794
|
+
}, /*#__PURE__*/React.createElement("span", null, selectedGift.description_en)), /*#__PURE__*/React.createElement("button", {
|
|
74795
|
+
className: "claim-button",
|
|
74796
|
+
onClick: handleClose,
|
|
74797
|
+
type: "button"
|
|
74798
|
+
}, "Awesome")))) : null);
|
|
74799
|
+
};
|
|
74800
|
+
|
|
74616
74801
|
var css_248z$j = ".Freetext-module_background__oUp-J {\r\n background-size: cover !important;\r\n background-position: center !important;\r\n background-attachment: fixed !important;\r\n background-repeat: no-repeat !important;\r\n -webkit-background-size: cover !important;\r\n -moz-background-size: cover !important;\r\n}\r\n@media (max-width: 800px) {\r\n .Freetext-module_background__oUp-J {\r\n background-size: contain !important;\r\n background-position: center !important;\r\n background-attachment: initial !important;\r\n background-repeat: no-repeat !important;\r\n -webkit-background-size: contain !important;\r\n -moz-background-size: contain !important;\r\n }\r\n}\r\n";
|
|
74617
74802
|
var sectionstyles$2 = {"background":"Freetext-module_background__oUp-J"};
|
|
74618
74803
|
styleInject(css_248z$j);
|
|
@@ -98354,7 +98539,7 @@ var returnLibrary = function returnLibrary() {
|
|
|
98354
98539
|
VideosSection: VideosSection,
|
|
98355
98540
|
FullVideoSection: FullVideoSection,
|
|
98356
98541
|
Popupcomponent: Popupcomponent,
|
|
98357
|
-
|
|
98542
|
+
WheelSpin: WheelSpin,
|
|
98358
98543
|
PopupCountryComponent: PopupCountryComponent,
|
|
98359
98544
|
TextSectionConnectToWA: TextSectionConnectToWA,
|
|
98360
98545
|
DynamicForm: DynamicForm,
|
package/dist/index.umd.js
CHANGED
|
@@ -74470,6 +74470,191 @@
|
|
|
74470
74470
|
}))));
|
|
74471
74471
|
};
|
|
74472
74472
|
|
|
74473
|
+
// const gifts = [
|
|
74474
|
+
// { label: '10% OFF', color: colorTheme.wheelSegments[0] },
|
|
74475
|
+
// { label: 'Free Shipping', color: colorTheme.wheelSegments[1] },
|
|
74476
|
+
// { label: '15% OFF', color: colorTheme.wheelSegments[2] },
|
|
74477
|
+
// { label: 'Buy 1 Get 1', color: colorTheme.wheelSegments[3] },
|
|
74478
|
+
// { label: '20% OFF', color: colorTheme.wheelSegments[4] },
|
|
74479
|
+
// { label: 'Free Gift Box', color: colorTheme.wheelSegments[5] },
|
|
74480
|
+
// { label: '$5 Coupon', color: colorTheme.wheelSegments[6] },
|
|
74481
|
+
// { label: 'Try Again', color: colorTheme.wheelSegments[7] },
|
|
74482
|
+
// ];
|
|
74483
|
+
|
|
74484
|
+
var WheelSpin = function WheelSpin(props) {
|
|
74485
|
+
var GeneralAPIMutationContext = props.actions.GeneralAPIMutationContext;
|
|
74486
|
+
var ApplyPromoCodeMutationContext = props.actions.ApplyPromoCodeMutationContext;
|
|
74487
|
+
var _useState = React.useState(false),
|
|
74488
|
+
_useState2 = _slicedToArray__default["default"](_useState, 2),
|
|
74489
|
+
isOpen = _useState2[0],
|
|
74490
|
+
setIsOpen = _useState2[1];
|
|
74491
|
+
var _useState3 = React.useState(0),
|
|
74492
|
+
_useState4 = _slicedToArray__default["default"](_useState3, 2),
|
|
74493
|
+
rotation = _useState4[0],
|
|
74494
|
+
setRotation = _useState4[1];
|
|
74495
|
+
var _useState5 = React.useState(null),
|
|
74496
|
+
_useState6 = _slicedToArray__default["default"](_useState5, 2),
|
|
74497
|
+
selectedGift = _useState6[0],
|
|
74498
|
+
setSelectedGift = _useState6[1];
|
|
74499
|
+
var _useState7 = React.useState(false),
|
|
74500
|
+
_useState8 = _slicedToArray__default["default"](_useState7, 2),
|
|
74501
|
+
isSpinning = _useState8[0],
|
|
74502
|
+
setIsSpinning = _useState8[1];
|
|
74503
|
+
var _useState9 = React.useState(false),
|
|
74504
|
+
_useState0 = _slicedToArray__default["default"](_useState9, 2),
|
|
74505
|
+
showCelebration = _useState0[0],
|
|
74506
|
+
setShowCelebration = _useState0[1];
|
|
74507
|
+
var _useState1 = React.useState([]),
|
|
74508
|
+
_useState10 = _slicedToArray__default["default"](_useState1, 2),
|
|
74509
|
+
gifts = _useState10[0],
|
|
74510
|
+
setgifts = _useState10[1];
|
|
74511
|
+
var segmentAngle = 360 / gifts.length;
|
|
74512
|
+
var wheelBackground = "conic-gradient(".concat(gifts.map(function (gift, index) {
|
|
74513
|
+
var start = index * segmentAngle;
|
|
74514
|
+
var end = start + segmentAngle;
|
|
74515
|
+
return "".concat(gift.spinner_color, " ").concat(start, "deg ").concat(end, "deg");
|
|
74516
|
+
}).join(', '), ")");
|
|
74517
|
+
var handleSpin = function handleSpin() {
|
|
74518
|
+
if (isSpinning) {
|
|
74519
|
+
return;
|
|
74520
|
+
}
|
|
74521
|
+
var randomIndex = Math.floor(Math.random() * gifts.length);
|
|
74522
|
+
var extraTurns = 360 * (5 + Math.floor(Math.random() * 3));
|
|
74523
|
+
var landingAngle = randomIndex * segmentAngle + segmentAngle / 2;
|
|
74524
|
+
var targetRotation = extraTurns + (360 - landingAngle);
|
|
74525
|
+
setIsSpinning(true);
|
|
74526
|
+
setSelectedGift(null);
|
|
74527
|
+
setShowCelebration(false);
|
|
74528
|
+
setRotation(function (previousRotation) {
|
|
74529
|
+
return previousRotation + targetRotation;
|
|
74530
|
+
});
|
|
74531
|
+
window.setTimeout(function () {
|
|
74532
|
+
var chosen_gift = gifts[randomIndex];
|
|
74533
|
+
if (chosen_gift.copounid == 'tryagain') {
|
|
74534
|
+
setIsOpen(false);
|
|
74535
|
+
} else {
|
|
74536
|
+
setSelectedGift(chosen_gift);
|
|
74537
|
+
setIsSpinning(false);
|
|
74538
|
+
setShowCelebration(true);
|
|
74539
|
+
ApplyPromoCodeMutationContext.mutate({
|
|
74540
|
+
couponname: chosen_gift.couponname,
|
|
74541
|
+
functype: 'add'
|
|
74542
|
+
});
|
|
74543
|
+
}
|
|
74544
|
+
}, 5200);
|
|
74545
|
+
};
|
|
74546
|
+
var handleClose = function handleClose() {
|
|
74547
|
+
if (isSpinning) {
|
|
74548
|
+
return;
|
|
74549
|
+
}
|
|
74550
|
+
setIsOpen(false);
|
|
74551
|
+
};
|
|
74552
|
+
var fetchGifts_Api = function fetchGifts_Api() {
|
|
74553
|
+
GeneralAPIMutationContext.mutate({
|
|
74554
|
+
endpointurl: '/fetch_coupons_spinner',
|
|
74555
|
+
// productid: productid,
|
|
74556
|
+
// reviewpayloadobj: reviewpayloadobj,
|
|
74557
|
+
mutateSuccesscallback: function mutateSuccesscallback(data, variables) {
|
|
74558
|
+
if (data.data.status) {
|
|
74559
|
+
var gifts_array_temp = data.data.data;
|
|
74560
|
+
gifts_array_temp.push({
|
|
74561
|
+
copounid: 'tryagain',
|
|
74562
|
+
spinner_color: 'black',
|
|
74563
|
+
description_en: 'Better luck next time'
|
|
74564
|
+
});
|
|
74565
|
+
setgifts(gifts_array_temp);
|
|
74566
|
+
// var data_gifts = data.data.data
|
|
74567
|
+
|
|
74568
|
+
// alert(JSON.stringify(data.data));
|
|
74569
|
+
// NotificationManager.success('', 'Success');
|
|
74570
|
+
// addreviewcallback();
|
|
74571
|
+
// window.location.reload();
|
|
74572
|
+
} else {
|
|
74573
|
+
NotificationManager.warning('', data.data.reason);
|
|
74574
|
+
}
|
|
74575
|
+
}
|
|
74576
|
+
});
|
|
74577
|
+
};
|
|
74578
|
+
var handleOpen = function handleOpen() {
|
|
74579
|
+
fetchGifts_Api();
|
|
74580
|
+
setSelectedGift(null);
|
|
74581
|
+
setRotation(0);
|
|
74582
|
+
setIsSpinning(false);
|
|
74583
|
+
setShowCelebration(false);
|
|
74584
|
+
setIsOpen(true);
|
|
74585
|
+
};
|
|
74586
|
+
return /*#__PURE__*/React__default["default"].createElement("div", {
|
|
74587
|
+
className: "wheel-spin-section"
|
|
74588
|
+
}, /*#__PURE__*/React__default["default"].createElement("button", {
|
|
74589
|
+
className: "open-popup-button",
|
|
74590
|
+
onClick: handleOpen,
|
|
74591
|
+
type: "button",
|
|
74592
|
+
"aria-label": "Open lucky wheel"
|
|
74593
|
+
}, "Spin"), isOpen ? /*#__PURE__*/React__default["default"].createElement("div", {
|
|
74594
|
+
className: "popup-overlay",
|
|
74595
|
+
onClick: handleClose
|
|
74596
|
+
}, /*#__PURE__*/React__default["default"].createElement("div", {
|
|
74597
|
+
className: "content-card",
|
|
74598
|
+
onClick: function onClick(event) {
|
|
74599
|
+
return event.stopPropagation();
|
|
74600
|
+
}
|
|
74601
|
+
}, /*#__PURE__*/React__default["default"].createElement("button", {
|
|
74602
|
+
className: "close-button",
|
|
74603
|
+
onClick: handleClose,
|
|
74604
|
+
disabled: isSpinning,
|
|
74605
|
+
type: "button"
|
|
74606
|
+
}, "\xD7"), !showCelebration ? /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, /*#__PURE__*/React__default["default"].createElement("h2", null, "Spin the wheel and unlock your surprise gift"), /*#__PURE__*/React__default["default"].createElement("p", null, "Tap the button, watch the wheel rotate, and get a random reward."), /*#__PURE__*/React__default["default"].createElement("div", {
|
|
74607
|
+
className: "wheel-stage"
|
|
74608
|
+
}, /*#__PURE__*/React__default["default"].createElement("div", {
|
|
74609
|
+
className: "pointer"
|
|
74610
|
+
}), /*#__PURE__*/React__default["default"].createElement("div", {
|
|
74611
|
+
className: "wheel",
|
|
74612
|
+
style: {
|
|
74613
|
+
transform: "rotate(".concat(rotation, "deg)"),
|
|
74614
|
+
background: wheelBackground
|
|
74615
|
+
}
|
|
74616
|
+
}, gifts.map(function (gift, index) {
|
|
74617
|
+
return /*#__PURE__*/React__default["default"].createElement("div", {
|
|
74618
|
+
className: "label",
|
|
74619
|
+
key: gift.description_en,
|
|
74620
|
+
style: {
|
|
74621
|
+
transform: "rotate(".concat(index * segmentAngle + segmentAngle / 2, "deg)")
|
|
74622
|
+
}
|
|
74623
|
+
}, /*#__PURE__*/React__default["default"].createElement("span", {
|
|
74624
|
+
style: {
|
|
74625
|
+
transform: 'translateX(-50%)'
|
|
74626
|
+
}
|
|
74627
|
+
}, gift.description_en));
|
|
74628
|
+
}), /*#__PURE__*/React__default["default"].createElement("div", {
|
|
74629
|
+
className: "wheel-center"
|
|
74630
|
+
}, /*#__PURE__*/React__default["default"].createElement("span", null, "WIN")))), /*#__PURE__*/React__default["default"].createElement("button", {
|
|
74631
|
+
className: "spin-button",
|
|
74632
|
+
onClick: handleSpin,
|
|
74633
|
+
disabled: isSpinning,
|
|
74634
|
+
type: "button"
|
|
74635
|
+
}, isSpinning ? 'Spinning...' : 'Spin Now')) : /*#__PURE__*/React__default["default"].createElement("div", {
|
|
74636
|
+
className: "celebration-card"
|
|
74637
|
+
}, /*#__PURE__*/React__default["default"].createElement("div", {
|
|
74638
|
+
className: "confetti confetti-one"
|
|
74639
|
+
}), /*#__PURE__*/React__default["default"].createElement("div", {
|
|
74640
|
+
className: "confetti confetti-two"
|
|
74641
|
+
}), /*#__PURE__*/React__default["default"].createElement("div", {
|
|
74642
|
+
className: "confetti confetti-three"
|
|
74643
|
+
}), /*#__PURE__*/React__default["default"].createElement("div", {
|
|
74644
|
+
className: "confetti confetti-four"
|
|
74645
|
+
}), /*#__PURE__*/React__default["default"].createElement("div", {
|
|
74646
|
+
className: "success-badge"
|
|
74647
|
+
}, "Congratulations"), /*#__PURE__*/React__default["default"].createElement("h2", null, "You unlocked a special reward"), /*#__PURE__*/React__default["default"].createElement("p", {
|
|
74648
|
+
className: "celebration-copy"
|
|
74649
|
+
}, "Your lucky spin landed on", /*#__PURE__*/React__default["default"].createElement("strong", null, " ", selectedGift.description_en)), /*#__PURE__*/React__default["default"].createElement("div", {
|
|
74650
|
+
className: "prize-highlight"
|
|
74651
|
+
}, /*#__PURE__*/React__default["default"].createElement("span", null, selectedGift.description_en)), /*#__PURE__*/React__default["default"].createElement("button", {
|
|
74652
|
+
className: "claim-button",
|
|
74653
|
+
onClick: handleClose,
|
|
74654
|
+
type: "button"
|
|
74655
|
+
}, "Awesome")))) : null);
|
|
74656
|
+
};
|
|
74657
|
+
|
|
74473
74658
|
var css_248z$j = ".Freetext-module_background__oUp-J {\r\n background-size: cover !important;\r\n background-position: center !important;\r\n background-attachment: fixed !important;\r\n background-repeat: no-repeat !important;\r\n -webkit-background-size: cover !important;\r\n -moz-background-size: cover !important;\r\n}\r\n@media (max-width: 800px) {\r\n .Freetext-module_background__oUp-J {\r\n background-size: contain !important;\r\n background-position: center !important;\r\n background-attachment: initial !important;\r\n background-repeat: no-repeat !important;\r\n -webkit-background-size: contain !important;\r\n -moz-background-size: contain !important;\r\n }\r\n}\r\n";
|
|
74474
74659
|
var sectionstyles$2 = {"background":"Freetext-module_background__oUp-J"};
|
|
74475
74660
|
styleInject(css_248z$j);
|
|
@@ -98211,7 +98396,7 @@
|
|
|
98211
98396
|
VideosSection: VideosSection,
|
|
98212
98397
|
FullVideoSection: FullVideoSection,
|
|
98213
98398
|
Popupcomponent: Popupcomponent,
|
|
98214
|
-
|
|
98399
|
+
WheelSpin: WheelSpin,
|
|
98215
98400
|
PopupCountryComponent: PopupCountryComponent,
|
|
98216
98401
|
TextSectionConnectToWA: TextSectionConnectToWA,
|
|
98217
98402
|
DynamicForm: DynamicForm,
|