tabexseriescomponents 0.2.1283 → 0.2.1285

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 CHANGED
@@ -74664,6 +74664,197 @@ 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: "spin-wheel-content-card",
74792
+ onClick: function onClick(event) {
74793
+ return event.stopPropagation();
74794
+ }
74795
+ }, /*#__PURE__*/React__default["default"].createElement("button", {
74796
+ className: "spin-wheel-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", {
74801
+ "class": "spin-wheel-h2"
74802
+ }, "Spin the wheel and unlock your surprise gift"), /*#__PURE__*/React__default["default"].createElement("p", {
74803
+ "class": "spin-wheel-p"
74804
+ }, "Tap the button, watch the wheel rotate, and get a random reward."), /*#__PURE__*/React__default["default"].createElement("div", {
74805
+ className: "wheel-stage"
74806
+ }, /*#__PURE__*/React__default["default"].createElement("div", {
74807
+ className: "spin-wheel-pointer"
74808
+ }), /*#__PURE__*/React__default["default"].createElement("div", {
74809
+ className: "wheel",
74810
+ style: {
74811
+ transform: "rotate(".concat(rotation, "deg)"),
74812
+ background: wheelBackground
74813
+ }
74814
+ }, gifts.map(function (gift, index) {
74815
+ return /*#__PURE__*/React__default["default"].createElement("div", {
74816
+ className: "spin-wheel-label",
74817
+ key: gift.description_en,
74818
+ style: {
74819
+ transform: "rotate(".concat(index * segmentAngle + segmentAngle / 2, "deg)")
74820
+ }
74821
+ }, /*#__PURE__*/React__default["default"].createElement("span", {
74822
+ style: {
74823
+ transform: 'translateX(-50%)'
74824
+ }
74825
+ }, gift.description_en));
74826
+ }), /*#__PURE__*/React__default["default"].createElement("div", {
74827
+ className: "wheel-center"
74828
+ }, /*#__PURE__*/React__default["default"].createElement("span", null, "WIN")))), /*#__PURE__*/React__default["default"].createElement("button", {
74829
+ className: "spin-button",
74830
+ onClick: handleSpin,
74831
+ disabled: isSpinning,
74832
+ type: "button"
74833
+ }, isSpinning ? 'Spinning...' : 'Spin Now')) : /*#__PURE__*/React__default["default"].createElement("div", {
74834
+ className: "celebration-card"
74835
+ }, /*#__PURE__*/React__default["default"].createElement("div", {
74836
+ className: "confetti confetti-one"
74837
+ }), /*#__PURE__*/React__default["default"].createElement("div", {
74838
+ className: "confetti confetti-two"
74839
+ }), /*#__PURE__*/React__default["default"].createElement("div", {
74840
+ className: "confetti confetti-three"
74841
+ }), /*#__PURE__*/React__default["default"].createElement("div", {
74842
+ className: "confetti confetti-four"
74843
+ }), /*#__PURE__*/React__default["default"].createElement("div", {
74844
+ className: "success-badge"
74845
+ }, "Congratulations"), /*#__PURE__*/React__default["default"].createElement("h2", {
74846
+ "class": "spin-wheel-h2"
74847
+ }, "You unlocked a special reward"), /*#__PURE__*/React__default["default"].createElement("p", {
74848
+ className: "celebration-copy spin-wheel-p"
74849
+ }, "Your lucky spin landed on", /*#__PURE__*/React__default["default"].createElement("strong", null, " ", selectedGift.description_en)), /*#__PURE__*/React__default["default"].createElement("div", {
74850
+ className: "prize-highlight"
74851
+ }, /*#__PURE__*/React__default["default"].createElement("span", null, selectedGift.description_en)), /*#__PURE__*/React__default["default"].createElement("button", {
74852
+ className: "claim-button",
74853
+ onClick: handleClose,
74854
+ type: "button"
74855
+ }, "Awesome")))) : null);
74856
+ };
74857
+
74667
74858
  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
74859
  var sectionstyles$2 = {"background":"Freetext-module_background__oUp-J"};
74669
74860
  styleInject(css_248z$j);
@@ -98405,7 +98596,7 @@ var returnLibrary = function returnLibrary() {
98405
98596
  VideosSection: VideosSection,
98406
98597
  FullVideoSection: FullVideoSection,
98407
98598
  Popupcomponent: Popupcomponent,
98408
- // WheelSpin: WheelSpin,
98599
+ WheelSpin: WheelSpin,
98409
98600
  PopupCountryComponent: PopupCountryComponent,
98410
98601
  TextSectionConnectToWA: TextSectionConnectToWA,
98411
98602
  DynamicForm: DynamicForm,
package/dist/index.esm.js CHANGED
@@ -74613,6 +74613,197 @@ 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: "spin-wheel-content-card",
74741
+ onClick: function onClick(event) {
74742
+ return event.stopPropagation();
74743
+ }
74744
+ }, /*#__PURE__*/React.createElement("button", {
74745
+ className: "spin-wheel-close-button",
74746
+ onClick: handleClose,
74747
+ disabled: isSpinning,
74748
+ type: "button"
74749
+ }, "\xD7"), !showCelebration ? /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("h2", {
74750
+ "class": "spin-wheel-h2"
74751
+ }, "Spin the wheel and unlock your surprise gift"), /*#__PURE__*/React.createElement("p", {
74752
+ "class": "spin-wheel-p"
74753
+ }, "Tap the button, watch the wheel rotate, and get a random reward."), /*#__PURE__*/React.createElement("div", {
74754
+ className: "wheel-stage"
74755
+ }, /*#__PURE__*/React.createElement("div", {
74756
+ className: "spin-wheel-pointer"
74757
+ }), /*#__PURE__*/React.createElement("div", {
74758
+ className: "wheel",
74759
+ style: {
74760
+ transform: "rotate(".concat(rotation, "deg)"),
74761
+ background: wheelBackground
74762
+ }
74763
+ }, gifts.map(function (gift, index) {
74764
+ return /*#__PURE__*/React.createElement("div", {
74765
+ className: "spin-wheel-label",
74766
+ key: gift.description_en,
74767
+ style: {
74768
+ transform: "rotate(".concat(index * segmentAngle + segmentAngle / 2, "deg)")
74769
+ }
74770
+ }, /*#__PURE__*/React.createElement("span", {
74771
+ style: {
74772
+ transform: 'translateX(-50%)'
74773
+ }
74774
+ }, gift.description_en));
74775
+ }), /*#__PURE__*/React.createElement("div", {
74776
+ className: "wheel-center"
74777
+ }, /*#__PURE__*/React.createElement("span", null, "WIN")))), /*#__PURE__*/React.createElement("button", {
74778
+ className: "spin-button",
74779
+ onClick: handleSpin,
74780
+ disabled: isSpinning,
74781
+ type: "button"
74782
+ }, isSpinning ? 'Spinning...' : 'Spin Now')) : /*#__PURE__*/React.createElement("div", {
74783
+ className: "celebration-card"
74784
+ }, /*#__PURE__*/React.createElement("div", {
74785
+ className: "confetti confetti-one"
74786
+ }), /*#__PURE__*/React.createElement("div", {
74787
+ className: "confetti confetti-two"
74788
+ }), /*#__PURE__*/React.createElement("div", {
74789
+ className: "confetti confetti-three"
74790
+ }), /*#__PURE__*/React.createElement("div", {
74791
+ className: "confetti confetti-four"
74792
+ }), /*#__PURE__*/React.createElement("div", {
74793
+ className: "success-badge"
74794
+ }, "Congratulations"), /*#__PURE__*/React.createElement("h2", {
74795
+ "class": "spin-wheel-h2"
74796
+ }, "You unlocked a special reward"), /*#__PURE__*/React.createElement("p", {
74797
+ className: "celebration-copy spin-wheel-p"
74798
+ }, "Your lucky spin landed on", /*#__PURE__*/React.createElement("strong", null, " ", selectedGift.description_en)), /*#__PURE__*/React.createElement("div", {
74799
+ className: "prize-highlight"
74800
+ }, /*#__PURE__*/React.createElement("span", null, selectedGift.description_en)), /*#__PURE__*/React.createElement("button", {
74801
+ className: "claim-button",
74802
+ onClick: handleClose,
74803
+ type: "button"
74804
+ }, "Awesome")))) : null);
74805
+ };
74806
+
74616
74807
  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
74808
  var sectionstyles$2 = {"background":"Freetext-module_background__oUp-J"};
74618
74809
  styleInject(css_248z$j);
@@ -98354,7 +98545,7 @@ var returnLibrary = function returnLibrary() {
98354
98545
  VideosSection: VideosSection,
98355
98546
  FullVideoSection: FullVideoSection,
98356
98547
  Popupcomponent: Popupcomponent,
98357
- // WheelSpin: WheelSpin,
98548
+ WheelSpin: WheelSpin,
98358
98549
  PopupCountryComponent: PopupCountryComponent,
98359
98550
  TextSectionConnectToWA: TextSectionConnectToWA,
98360
98551
  DynamicForm: DynamicForm,
package/dist/index.umd.js CHANGED
@@ -74470,6 +74470,197 @@
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: "spin-wheel-content-card",
74598
+ onClick: function onClick(event) {
74599
+ return event.stopPropagation();
74600
+ }
74601
+ }, /*#__PURE__*/React__default["default"].createElement("button", {
74602
+ className: "spin-wheel-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", {
74607
+ "class": "spin-wheel-h2"
74608
+ }, "Spin the wheel and unlock your surprise gift"), /*#__PURE__*/React__default["default"].createElement("p", {
74609
+ "class": "spin-wheel-p"
74610
+ }, "Tap the button, watch the wheel rotate, and get a random reward."), /*#__PURE__*/React__default["default"].createElement("div", {
74611
+ className: "wheel-stage"
74612
+ }, /*#__PURE__*/React__default["default"].createElement("div", {
74613
+ className: "spin-wheel-pointer"
74614
+ }), /*#__PURE__*/React__default["default"].createElement("div", {
74615
+ className: "wheel",
74616
+ style: {
74617
+ transform: "rotate(".concat(rotation, "deg)"),
74618
+ background: wheelBackground
74619
+ }
74620
+ }, gifts.map(function (gift, index) {
74621
+ return /*#__PURE__*/React__default["default"].createElement("div", {
74622
+ className: "spin-wheel-label",
74623
+ key: gift.description_en,
74624
+ style: {
74625
+ transform: "rotate(".concat(index * segmentAngle + segmentAngle / 2, "deg)")
74626
+ }
74627
+ }, /*#__PURE__*/React__default["default"].createElement("span", {
74628
+ style: {
74629
+ transform: 'translateX(-50%)'
74630
+ }
74631
+ }, gift.description_en));
74632
+ }), /*#__PURE__*/React__default["default"].createElement("div", {
74633
+ className: "wheel-center"
74634
+ }, /*#__PURE__*/React__default["default"].createElement("span", null, "WIN")))), /*#__PURE__*/React__default["default"].createElement("button", {
74635
+ className: "spin-button",
74636
+ onClick: handleSpin,
74637
+ disabled: isSpinning,
74638
+ type: "button"
74639
+ }, isSpinning ? 'Spinning...' : 'Spin Now')) : /*#__PURE__*/React__default["default"].createElement("div", {
74640
+ className: "celebration-card"
74641
+ }, /*#__PURE__*/React__default["default"].createElement("div", {
74642
+ className: "confetti confetti-one"
74643
+ }), /*#__PURE__*/React__default["default"].createElement("div", {
74644
+ className: "confetti confetti-two"
74645
+ }), /*#__PURE__*/React__default["default"].createElement("div", {
74646
+ className: "confetti confetti-three"
74647
+ }), /*#__PURE__*/React__default["default"].createElement("div", {
74648
+ className: "confetti confetti-four"
74649
+ }), /*#__PURE__*/React__default["default"].createElement("div", {
74650
+ className: "success-badge"
74651
+ }, "Congratulations"), /*#__PURE__*/React__default["default"].createElement("h2", {
74652
+ "class": "spin-wheel-h2"
74653
+ }, "You unlocked a special reward"), /*#__PURE__*/React__default["default"].createElement("p", {
74654
+ className: "celebration-copy spin-wheel-p"
74655
+ }, "Your lucky spin landed on", /*#__PURE__*/React__default["default"].createElement("strong", null, " ", selectedGift.description_en)), /*#__PURE__*/React__default["default"].createElement("div", {
74656
+ className: "prize-highlight"
74657
+ }, /*#__PURE__*/React__default["default"].createElement("span", null, selectedGift.description_en)), /*#__PURE__*/React__default["default"].createElement("button", {
74658
+ className: "claim-button",
74659
+ onClick: handleClose,
74660
+ type: "button"
74661
+ }, "Awesome")))) : null);
74662
+ };
74663
+
74473
74664
  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
74665
  var sectionstyles$2 = {"background":"Freetext-module_background__oUp-J"};
74475
74666
  styleInject(css_248z$j);
@@ -98211,7 +98402,7 @@
98211
98402
  VideosSection: VideosSection,
98212
98403
  FullVideoSection: FullVideoSection,
98213
98404
  Popupcomponent: Popupcomponent,
98214
- // WheelSpin: WheelSpin,
98405
+ WheelSpin: WheelSpin,
98215
98406
  PopupCountryComponent: PopupCountryComponent,
98216
98407
  TextSectionConnectToWA: TextSectionConnectToWA,
98217
98408
  DynamicForm: DynamicForm,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tabexseriescomponents",
3
- "version": "0.2.1283",
3
+ "version": "0.2.1285",
4
4
  "type": "module",
5
5
  "description": "your description",
6
6
  "main": "dist/index.cjs.js",