@trafilea/afrodita-components 6.21.2 → 6.21.4

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/build/index.d.ts CHANGED
@@ -2928,6 +2928,7 @@ interface CouponProps {
2928
2928
  btnText?: string;
2929
2929
  couponCode?: string;
2930
2930
  offerLink?: string;
2931
+ onClickHandler?: () => void;
2931
2932
  }
2932
2933
  declare const CouponCard: FC<CouponProps>;
2933
2934
 
@@ -3673,6 +3674,7 @@ declare type VideoProps = {
3673
3674
  thumbnail: string;
3674
3675
  source: string;
3675
3676
  height?: string;
3677
+ withProgressBar?: boolean;
3676
3678
  } & DetailedHTMLProps<VideoHTMLAttributes<HTMLVideoElement>, HTMLVideoElement>;
3677
3679
  declare const Video: React.FC<VideoProps>;
3678
3680
 
@@ -5198,16 +5198,14 @@ var RightSide = newStyled.div(templateObject_4$O || (templateObject_4$O = __make
5198
5198
  var FlexStart = newStyled.div(templateObject_5$A || (templateObject_5$A = __makeTemplateObject(["\n display: flex;\n flex-direction: column;\n align-items: start;\n gap: 5px;\n width: 100%;\n padding: 12px;\n"], ["\n display: flex;\n flex-direction: column;\n align-items: start;\n gap: 5px;\n width: 100%;\n padding: 12px;\n"])));
5199
5199
  var templateObject_1$1R, templateObject_2$1g, templateObject_3$$, templateObject_4$O, templateObject_5$A;
5200
5200
 
5201
- var _this$1 = undefined;
5202
5201
  var CouponCard = function (_a) {
5203
- var image = _a.image, title = _a.title, content = _a.content, couponCode = _a.couponCode, offerLink = _a.offerLink, width = _a.width, height = _a.height, _b = _a.btnText, btnText = _b === void 0 ? 'Redeem Offer' : _b;
5202
+ var image = _a.image, title = _a.title, content = _a.content, couponCode = _a.couponCode, offerLink = _a.offerLink, width = _a.width, height = _a.height, _b = _a.btnText, btnText = _b === void 0 ? 'Redeem Offer' : _b, onClickHandler = _a.onClickHandler;
5204
5203
  var _c = useState(false), showCoupon = _c[0], setShowCoupon = _c[1];
5205
- var handleCopy = useCallback(function (couponCode) { return (couponCode ? navigator.clipboard.writeText(couponCode) : undefined); }, []);
5206
5204
  return (jsxs$1(Container$1a, __assign$1({ height: height, width: width }, { children: [jsx$1(LeftSide, { children: jsx$1(Image$3, { objectFit: "cover", src: image.src, alt: image.alt, width: "100%", height: "100%", borderRadius: "8px 0 0 8px" }, void 0) }, void 0), jsxs$1(RightSide, { children: [jsxs$1(FlexStart, { children: [jsx$1(Text$7, __assign$1({ variant: "body", weight: "bold", size: "small" }, { children: title }), void 0), content] }, void 0), jsx$1(FlexCentered, { children: !showCoupon ? (jsx$1(ButtonPrimary, { type: "button", text: btnText, wide: true, size: ComponentSize.Large, onClick: function () { return setShowCoupon(function (prev) { return !prev; }); } }, void 0)) : (jsxs$1(Fragment$2, { children: [jsx$1(ButtonSecondaryOutline, { "data-testid": "coupon-code-btn", testId: "coupon-code-btn", type: "button", text: couponCode !== null && couponCode !== void 0 ? couponCode : '', wide: true, size: ComponentSize.Small, icon: {
5207
5205
  name: 'actions/copy_outlined',
5208
5206
  position: 'right',
5209
5207
  margin: '10px',
5210
- }, onClick: handleCopy.bind(_this$1, couponCode !== null && couponCode !== void 0 ? couponCode : '') }, void 0), jsx$1(Text$7, __assign$1({ variant: "link", weight: "demi", underline: true, href: offerLink }, { children: "Go to offer" }), void 0)] }, void 0)) }, void 0)] }, void 0)] }), void 0));
5208
+ }, onClick: function () { return onClickHandler && onClickHandler(); } }, void 0), jsx$1(Text$7, __assign$1({ variant: "link", weight: "demi", underline: true, href: offerLink }, { children: "Go to offer" }), void 0)] }, void 0)) }, void 0)] }, void 0)] }), void 0));
5211
5209
  };
5212
5210
 
5213
5211
  // Partner titles
@@ -13591,12 +13589,12 @@ var templateObject_1$11, templateObject_2$J, templateObject_3$A, templateObject_
13591
13589
 
13592
13590
  var Video$1 = function (_a) {
13593
13591
  var _b, _c, _d, _e;
13594
- var source = _a.source, thumbnail = _a.thumbnail, height = _a.height, className = _a.className, rest = __rest(_a, ["source", "thumbnail", "height", "className"]);
13592
+ var source = _a.source, thumbnail = _a.thumbnail, height = _a.height, className = _a.className, _f = _a.withProgressBar, withProgressBar = _f === void 0 ? true : _f, rest = __rest(_a, ["source", "thumbnail", "height", "className", "withProgressBar"]);
13595
13593
  var videoRef = useRef(null);
13596
- var _f = useState(true), isLoading = _f[0], setIsLoading = _f[1];
13597
- var _g = useState(false), isPlaying = _g[0], setIsPlaying = _g[1];
13598
- var _h = useState(0), videoProgress = _h[0], setVideoProgress = _h[1];
13599
- var _j = useState(false), debouncePlay = _j[0], setDebouncePlay = _j[1];
13594
+ var _g = useState(true), isLoading = _g[0], setIsLoading = _g[1];
13595
+ var _h = useState(false), isPlaying = _h[0], setIsPlaying = _h[1];
13596
+ var _j = useState(0), videoProgress = _j[0], setVideoProgress = _j[1];
13597
+ var _k = useState(false), debouncePlay = _k[0], setDebouncePlay = _k[1];
13600
13598
  var isStarted = videoProgress > 0;
13601
13599
  var progress = videoProgress / ((_c = (_b = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _b === void 0 ? void 0 : _b.duration) !== null && _c !== void 0 ? _c : 0);
13602
13600
  var hideProgressBar = videoProgress === ((_e = (_d = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _d === void 0 ? void 0 : _d.duration) !== null && _e !== void 0 ? _e : 0) || videoProgress === 0;
@@ -13626,7 +13624,7 @@ var Video$1 = function (_a) {
13626
13624
  setVideoProgress(videoRef.current.currentTime);
13627
13625
  }
13628
13626
  };
13629
- return (jsxs$1(Container$O, __assign$1({ className: className }, { children: [!isLoading && jsx$1(ProgressBar$1, { progress: progress, hide: hideProgressBar }, void 0), !isPlaying ? (jsx$1(PlayContainer, __assign$1({ "data-testid": "play", onClick: handlePlayClick }, { children: isStarted && jsx$1(PlayIcon, {}, void 0) }), void 0)) : (jsx$1(PauseContainer, { "data-testid": "pause", onClick: handlePauseClick }, void 0)), jsxs$1(HTMLVideo, __assign$1({}, rest, { "data-testid": "video", poster: thumbnail, playsInline: true, ref: videoRef, onTimeUpdate: onTimeUpdate, onCanPlay: function () { return setIsLoading(false); }, onLoadedData: function () { return setIsLoading(false); }, onPause: function () { return setIsPlaying(false); }, onPlaying: function () { return setIsPlaying(true); }, height: height || 'auto' }, { children: [jsx$1("track", { kind: "captions" }, void 0), jsx$1("source", { src: source }, void 0)] }), void 0)] }), void 0));
13627
+ return (jsxs$1(Container$O, __assign$1({ className: className }, { children: [!isLoading && withProgressBar && jsx$1(ProgressBar$1, { progress: progress, hide: hideProgressBar }, void 0), !isPlaying ? (jsx$1(PlayContainer, __assign$1({ "data-testid": "play", onClick: handlePlayClick }, { children: isStarted && jsx$1(PlayIcon, {}, void 0) }), void 0)) : (jsx$1(PauseContainer, { "data-testid": "pause", onClick: handlePauseClick }, void 0)), jsxs$1(HTMLVideo, __assign$1({}, rest, { "data-testid": "video", poster: thumbnail, playsInline: true, ref: videoRef, onTimeUpdate: onTimeUpdate, onCanPlay: function () { return setIsLoading(false); }, onLoadedData: function () { return setIsLoading(false); }, onPause: function () { return setIsPlaying(false); }, onPlaying: function () { return setIsPlaying(true); }, height: height || 'auto' }, { children: [jsx$1("track", { kind: "captions" }, void 0), jsx$1("source", { src: source }, void 0)] }), void 0)] }), void 0));
13630
13628
  };
13631
13629
 
13632
13630
  var Container$N = newStyled.div(templateObject_1$10 || (templateObject_1$10 = __makeTemplateObject(["\n ", "\n z-index: 0;\n position: relative;\n height: fit-content;\n /* &.styleforhorizontal {\n height: 30rem;\n } */\n display: block;\n overflow: hidden;\n white-space: nowrap;\n grid-area: 1/2;\n width: 100%;\n max-width: max-content;\n"], ["\n ", "\n z-index: 0;\n position: relative;\n height: fit-content;\n /* &.styleforhorizontal {\n height: 30rem;\n } */\n display: block;\n overflow: hidden;\n white-space: nowrap;\n grid-area: 1/2;\n width: 100%;\n max-width: max-content;\n"])), function (_a) {