@sikka/hawa 0.14.11-next → 0.14.12-next

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.d.mts CHANGED
@@ -1360,16 +1360,20 @@ type TConfirmation = {
1360
1360
  weSentCode?: string;
1361
1361
  didntGetCode?: string;
1362
1362
  resendCode?: string;
1363
+ resendCodeTimer?: string;
1363
1364
  codeRequiredText?: string;
1364
1365
  codeTooShort?: string;
1365
1366
  confirm?: string;
1366
1367
  cancel?: string;
1368
+ seconds?: string;
1367
1369
  };
1368
1370
  showError?: any;
1369
1371
  errorTitle?: any;
1370
1372
  errorText?: any;
1371
1373
  phoneNumber?: string;
1374
+ confirmLoading?: boolean;
1372
1375
  handleConfirm?: any;
1376
+ handleResend?: any;
1373
1377
  };
1374
1378
  declare const CodeConfirmation: FC<TConfirmation>;
1375
1379
 
package/dist/index.d.ts CHANGED
@@ -1360,16 +1360,20 @@ type TConfirmation = {
1360
1360
  weSentCode?: string;
1361
1361
  didntGetCode?: string;
1362
1362
  resendCode?: string;
1363
+ resendCodeTimer?: string;
1363
1364
  codeRequiredText?: string;
1364
1365
  codeTooShort?: string;
1365
1366
  confirm?: string;
1366
1367
  cancel?: string;
1368
+ seconds?: string;
1367
1369
  };
1368
1370
  showError?: any;
1369
1371
  errorTitle?: any;
1370
1372
  errorText?: any;
1371
1373
  phoneNumber?: string;
1374
+ confirmLoading?: boolean;
1372
1375
  handleConfirm?: any;
1376
+ handleResend?: any;
1373
1377
  };
1374
1378
  declare const CodeConfirmation: FC<TConfirmation>;
1375
1379
 
package/dist/index.js CHANGED
@@ -8545,7 +8545,7 @@ var import_react_hook_form5 = require("react-hook-form");
8545
8545
  var import_zod5 = require("@hookform/resolvers/zod");
8546
8546
  var z5 = __toESM(require("zod"));
8547
8547
  var CodeConfirmation = function(props) {
8548
- var _props_texts, _props_texts1, _props_texts2, _props_texts3, _props_texts4, _props_texts5, _props_texts6, _props_texts7;
8548
+ var _props_texts, _props_texts1, _props_texts2, _props_texts3, _props_texts4, _props_texts5, _props_texts6, _props_texts7, _props_texts8, _props_texts9;
8549
8549
  var formSchema = z5.object({
8550
8550
  otp_code: z5.string({
8551
8551
  required_error: (_props_texts = props.texts) === null || _props_texts === void 0 ? void 0 : _props_texts.codeRequiredText
@@ -8556,6 +8556,37 @@ var CodeConfirmation = function(props) {
8556
8556
  var _ref = (0, import_react_hook_form5.useForm)({
8557
8557
  resolver: (0, import_zod5.zodResolver)(formSchema)
8558
8558
  }), handleSubmit = _ref.handleSubmit, control = _ref.control, formState = _ref.formState, setValue = _ref.setValue;
8559
+ var _ref1 = _sliced_to_array((0, import_react50.useState)(null), 2), resendTimer = _ref1[0], setResendTimer = _ref1[1];
8560
+ var _ref2 = _sliced_to_array((0, import_react50.useState)(0), 2), remainingTime = _ref2[0], setRemainingTime = _ref2[1];
8561
+ var _ref3 = _sliced_to_array((0, import_react50.useState)(false), 2), showResendTimer = _ref3[0], setShowResendTimer = _ref3[1];
8562
+ var startResendTimer = function() {
8563
+ if (resendTimer !== null) {
8564
+ clearInterval(resendTimer);
8565
+ setResendTimer(null);
8566
+ }
8567
+ var timerDuration = 60;
8568
+ setRemainingTime(timerDuration);
8569
+ setShowResendTimer(true);
8570
+ var newTimer = window.setInterval(function() {
8571
+ setRemainingTime(function(prevTime) {
8572
+ if (prevTime > 0) {
8573
+ return prevTime - 1;
8574
+ } else {
8575
+ clearInterval(newTimer);
8576
+ setShowResendTimer(false);
8577
+ return 0;
8578
+ }
8579
+ });
8580
+ }, 1e3);
8581
+ setResendTimer(newTimer);
8582
+ };
8583
+ (0, import_react50.useEffect)(function() {
8584
+ return function() {
8585
+ if (resendTimer !== null) {
8586
+ clearInterval(resendTimer);
8587
+ }
8588
+ };
8589
+ }, []);
8559
8590
  var _props_texts_didntGetCode;
8560
8591
  return /* @__PURE__ */ import_react50.default.createElement(Card, null, /* @__PURE__ */ import_react50.default.createElement(CardContent, {
8561
8592
  headless: true
@@ -8593,15 +8624,23 @@ var CodeConfirmation = function(props) {
8593
8624
  helperText: (_formState_errors_otp_code = formState.errors.otp_code) === null || _formState_errors_otp_code === void 0 ? void 0 : _formState_errors_otp_code.message
8594
8625
  });
8595
8626
  }
8596
- }), /* @__PURE__ */ import_react50.default.createElement("div", {
8627
+ }), showResendTimer ? /* @__PURE__ */ import_react50.default.createElement("div", {
8597
8628
  className: " hawa-py-2 hawa-text-center hawa-text-xs hawa-text-muted-foreground"
8598
- }, /* @__PURE__ */ import_react50.default.createElement("span", null, (_props_texts_didntGetCode = (_props_texts4 = props.texts) === null || _props_texts4 === void 0 ? void 0 : _props_texts4.didntGetCode) !== null && _props_texts_didntGetCode !== void 0 ? _props_texts_didntGetCode : "Didn't get the code?"), " ", /* @__PURE__ */ import_react50.default.createElement("span", {
8599
- className: "clickable-link"
8600
- }, ((_props_texts5 = props.texts) === null || _props_texts5 === void 0 ? void 0 : _props_texts5.resendCode) || "Click to resend")), /* @__PURE__ */ import_react50.default.createElement("div", {
8629
+ }, (_props_texts4 = props.texts) === null || _props_texts4 === void 0 ? void 0 : _props_texts4.resendCodeTimer, " ", /* @__PURE__ */ import_react50.default.createElement("strong", null, remainingTime), " ", (_props_texts5 = props.texts) === null || _props_texts5 === void 0 ? void 0 : _props_texts5.seconds) : /* @__PURE__ */ import_react50.default.createElement("div", {
8630
+ className: " hawa-py-2 hawa-text-center hawa-text-xs hawa-text-muted-foreground"
8631
+ }, /* @__PURE__ */ import_react50.default.createElement("span", null, (_props_texts_didntGetCode = (_props_texts6 = props.texts) === null || _props_texts6 === void 0 ? void 0 : _props_texts6.didntGetCode) !== null && _props_texts_didntGetCode !== void 0 ? _props_texts_didntGetCode : "Didn't get the code?"), " ", /* @__PURE__ */ import_react50.default.createElement("span", {
8632
+ className: "clickable-link",
8633
+ onClick: function() {
8634
+ startResendTimer();
8635
+ props.handleResend();
8636
+ }
8637
+ }, ((_props_texts7 = props.texts) === null || _props_texts7 === void 0 ? void 0 : _props_texts7.resendCode) || "Click to resend")), /* @__PURE__ */ import_react50.default.createElement("div", {
8601
8638
  className: "hawa-mt-4 hawa-grid hawa-grid-cols-2 hawa-gap-2"
8602
8639
  }, /* @__PURE__ */ import_react50.default.createElement(Button, {
8603
8640
  variant: "secondary"
8604
- }, ((_props_texts6 = props.texts) === null || _props_texts6 === void 0 ? void 0 : _props_texts6.cancel) || "Cancel"), /* @__PURE__ */ import_react50.default.createElement(Button, null, ((_props_texts7 = props.texts) === null || _props_texts7 === void 0 ? void 0 : _props_texts7.confirm) || "Confirm")))));
8641
+ }, ((_props_texts8 = props.texts) === null || _props_texts8 === void 0 ? void 0 : _props_texts8.cancel) || "Cancel"), /* @__PURE__ */ import_react50.default.createElement(Button, {
8642
+ isLoading: props.confirmLoading
8643
+ }, ((_props_texts9 = props.texts) === null || _props_texts9 === void 0 ? void 0 : _props_texts9.confirm) || "Confirm")))));
8605
8644
  };
8606
8645
  // components/blocks/feedback/UserReferralSource.tsx
8607
8646
  var import_react51 = __toESM(require("react"));
package/dist/index.mjs CHANGED
@@ -8621,7 +8621,7 @@ var ResetPasswordForm = (props) => {
8621
8621
  };
8622
8622
 
8623
8623
  // components/blocks/auth/CodeConfirmation.tsx
8624
- import React75 from "react";
8624
+ import React75, { useEffect as useEffect20, useState as useState30 } from "react";
8625
8625
  import { Controller as Controller5, useForm as useForm5 } from "react-hook-form";
8626
8626
  import { zodResolver as zodResolver5 } from "@hookform/resolvers/zod";
8627
8627
  import * as z5 from "zod";
@@ -8632,6 +8632,37 @@ var CodeConfirmation = (props) => {
8632
8632
  const { handleSubmit, control, formState, setValue } = useForm5({
8633
8633
  resolver: zodResolver5(formSchema)
8634
8634
  });
8635
+ const [resendTimer, setResendTimer] = useState30(null);
8636
+ const [remainingTime, setRemainingTime] = useState30(0);
8637
+ const [showResendTimer, setShowResendTimer] = useState30(false);
8638
+ const startResendTimer = () => {
8639
+ if (resendTimer !== null) {
8640
+ clearInterval(resendTimer);
8641
+ setResendTimer(null);
8642
+ }
8643
+ const timerDuration = 60;
8644
+ setRemainingTime(timerDuration);
8645
+ setShowResendTimer(true);
8646
+ const newTimer = window.setInterval(() => {
8647
+ setRemainingTime((prevTime) => {
8648
+ if (prevTime > 0) {
8649
+ return prevTime - 1;
8650
+ } else {
8651
+ clearInterval(newTimer);
8652
+ setShowResendTimer(false);
8653
+ return 0;
8654
+ }
8655
+ });
8656
+ }, 1e3);
8657
+ setResendTimer(newTimer);
8658
+ };
8659
+ useEffect20(() => {
8660
+ return () => {
8661
+ if (resendTimer !== null) {
8662
+ clearInterval(resendTimer);
8663
+ }
8664
+ };
8665
+ }, []);
8635
8666
  return /* @__PURE__ */ React75.createElement(Card, null, /* @__PURE__ */ React75.createElement(CardContent, { headless: true }, props.showError && /* @__PURE__ */ React75.createElement(
8636
8667
  Alert,
8637
8668
  {
@@ -8669,13 +8700,23 @@ var CodeConfirmation = (props) => {
8669
8700
  )
8670
8701
  }
8671
8702
  ),
8672
- /* @__PURE__ */ React75.createElement("div", { className: " hawa-py-2 hawa-text-center hawa-text-xs hawa-text-muted-foreground" }, /* @__PURE__ */ React75.createElement("span", null, props.texts?.didntGetCode ?? "Didn't get the code?"), " ", /* @__PURE__ */ React75.createElement("span", { className: "clickable-link" }, props.texts?.resendCode || "Click to resend")),
8673
- /* @__PURE__ */ React75.createElement("div", { className: "hawa-mt-4 hawa-grid hawa-grid-cols-2 hawa-gap-2" }, /* @__PURE__ */ React75.createElement(Button, { variant: "secondary" }, props.texts?.cancel || "Cancel"), /* @__PURE__ */ React75.createElement(Button, null, props.texts?.confirm || "Confirm"))
8703
+ showResendTimer ? /* @__PURE__ */ React75.createElement("div", { className: " hawa-py-2 hawa-text-center hawa-text-xs hawa-text-muted-foreground" }, props.texts?.resendCodeTimer, " ", /* @__PURE__ */ React75.createElement("strong", null, remainingTime), " ", props.texts?.seconds) : /* @__PURE__ */ React75.createElement("div", { className: " hawa-py-2 hawa-text-center hawa-text-xs hawa-text-muted-foreground" }, /* @__PURE__ */ React75.createElement("span", null, props.texts?.didntGetCode ?? "Didn't get the code?"), " ", /* @__PURE__ */ React75.createElement(
8704
+ "span",
8705
+ {
8706
+ className: "clickable-link",
8707
+ onClick: () => {
8708
+ startResendTimer();
8709
+ props.handleResend();
8710
+ }
8711
+ },
8712
+ props.texts?.resendCode || "Click to resend"
8713
+ )),
8714
+ /* @__PURE__ */ React75.createElement("div", { className: "hawa-mt-4 hawa-grid hawa-grid-cols-2 hawa-gap-2" }, /* @__PURE__ */ React75.createElement(Button, { variant: "secondary" }, props.texts?.cancel || "Cancel"), /* @__PURE__ */ React75.createElement(Button, { isLoading: props.confirmLoading }, props.texts?.confirm || "Confirm"))
8674
8715
  )));
8675
8716
  };
8676
8717
 
8677
8718
  // components/blocks/feedback/UserReferralSource.tsx
8678
- import React76, { useRef as useRef11, useState as useState30 } from "react";
8719
+ import React76, { useRef as useRef11, useState as useState31 } from "react";
8679
8720
  import { Controller as Controller6, useForm as useForm6 } from "react-hook-form";
8680
8721
  import { zodResolver as zodResolver6 } from "@hookform/resolvers/zod";
8681
8722
  import * as z6 from "zod";
@@ -8684,7 +8725,7 @@ var UserReferralSource = ({
8684
8725
  options = [],
8685
8726
  ...props
8686
8727
  }) => {
8687
- const [closed, setClosed] = useState30(false);
8728
+ const [closed, setClosed] = useState31(false);
8688
8729
  const popUpRef = useRef11(null);
8689
8730
  const formSchema = z6.object({
8690
8731
  source: z6.string({ required_error: props.texts?.pleaseSelectOption }),
@@ -8812,22 +8853,22 @@ var UserReferralSource = ({
8812
8853
  };
8813
8854
 
8814
8855
  // components/blocks/feedback/FeedbackRating.tsx
8815
- import React77, { useEffect as useEffect21, useRef as useRef12, useState as useState31 } from "react";
8856
+ import React77, { useEffect as useEffect22, useRef as useRef12, useState as useState32 } from "react";
8816
8857
  import clsx11 from "clsx";
8817
8858
  var FeedbackRating = ({
8818
8859
  position = "bottom-right",
8819
8860
  ...props
8820
8861
  }) => {
8821
- const [closed, setClosed] = useState31(false);
8822
- const [answered, setAnswered] = useState31(false);
8823
- const [clickedOption, setClickedOption] = useState31(null);
8824
- const [closingTimer, setClosingTimer] = useState31(5);
8862
+ const [closed, setClosed] = useState32(false);
8863
+ const [answered, setAnswered] = useState32(false);
8864
+ const [clickedOption, setClickedOption] = useState32(null);
8865
+ const [closingTimer, setClosingTimer] = useState32(5);
8825
8866
  const popUpRef = useRef12(null);
8826
8867
  const boxPosition = {
8827
8868
  "bottom-right": "hawa-right-4",
8828
8869
  "bottom-left": "hawa-left-4"
8829
8870
  };
8830
- useEffect21(() => {
8871
+ useEffect22(() => {
8831
8872
  const timeoutHide = setTimeout(() => {
8832
8873
  if (closingTimer >= 0) {
8833
8874
  setClosingTimer(closingTimer - 1);
@@ -8926,12 +8967,12 @@ var FeedbackRating = ({
8926
8967
  };
8927
8968
 
8928
8969
  // components/blocks/feedback/FeedbackEmoji.tsx
8929
- import React78, { useState as useState32 } from "react";
8970
+ import React78, { useState as useState33 } from "react";
8930
8971
  var FeedbackEmoji = (props) => {
8931
- const [selectedEmoji, setSelectedEmoji] = useState32(null);
8932
- const [loadingSubmit, setLoadingSubmit] = useState32(false);
8933
- const [feedbackText, setFeedbackText] = useState32("");
8934
- const [helperText, setHelperText] = useState32(false);
8972
+ const [selectedEmoji, setSelectedEmoji] = useState33(null);
8973
+ const [loadingSubmit, setLoadingSubmit] = useState33(false);
8974
+ const [feedbackText, setFeedbackText] = useState33("");
8975
+ const [helperText, setHelperText] = useState33(false);
8935
8976
  let emojis = [
8936
8977
  { icon: /* @__PURE__ */ React78.createElement(VeryGoodEmoji, null), value: "very-good" },
8937
8978
  { icon: /* @__PURE__ */ React78.createElement(GoodEmoji, null), value: "good" },
@@ -9392,7 +9433,7 @@ var PricingPlans = (props) => {
9392
9433
  };
9393
9434
 
9394
9435
  // components/blocks/pricing/ComparingPlans.tsx
9395
- import React88, { useState as useState33 } from "react";
9436
+ import React88, { useState as useState34 } from "react";
9396
9437
  var CheckMark = () => /* @__PURE__ */ React88.createElement(
9397
9438
  "svg",
9398
9439
  {
@@ -9428,8 +9469,8 @@ var UncheckMark = () => /* @__PURE__ */ React88.createElement(
9428
9469
  )
9429
9470
  );
9430
9471
  var ComparingPlans = (props) => {
9431
- const [currentCurrency, setCurrentCurrency] = useState33("sar");
9432
- const [currentCycle, setCurrentCycle] = useState33("month");
9472
+ const [currentCurrency, setCurrentCurrency] = useState34("sar");
9473
+ const [currentCycle, setCurrentCycle] = useState34("month");
9433
9474
  return /* @__PURE__ */ React88.createElement("div", { id: "detailed-pricing", className: "hawa-w-full hawa-overflow-x-auto" }, /* @__PURE__ */ React88.createElement("div", { className: "hawa-mb-2 hawa-flex hawa-w-full hawa-justify-between" }, /* @__PURE__ */ React88.createElement(
9434
9475
  Radio,
9435
9476
  {
@@ -9487,10 +9528,10 @@ var ComparingPlans = (props) => {
9487
9528
  };
9488
9529
 
9489
9530
  // components/blocks/pricing/HorizontalPricing.tsx
9490
- import React89, { useState as useState34 } from "react";
9531
+ import React89, { useState as useState35 } from "react";
9491
9532
  import clsx12 from "clsx";
9492
9533
  var HorizontalPricing = (props) => {
9493
- const [selectedCard, setSelectedCard] = useState34("");
9534
+ const [selectedCard, setSelectedCard] = useState35("");
9494
9535
  let data = [
9495
9536
  { title: "basic", price: "$49", cycle: "/mo" },
9496
9537
  { title: "business", price: "$99", cycle: "/mo" },
@@ -9601,22 +9642,22 @@ var Usage = (props) => {
9601
9642
  };
9602
9643
 
9603
9644
  // components/hooks/useDiscloser.ts
9604
- import { useState as useState35 } from "react";
9645
+ import { useState as useState36 } from "react";
9605
9646
 
9606
9647
  // components/hooks/useHover.ts
9607
- import { useEffect as useEffect22, useRef as useRef13, useState as useState36 } from "react";
9648
+ import { useEffect as useEffect23, useRef as useRef13, useState as useState37 } from "react";
9608
9649
 
9609
9650
  // components/hooks/useCarousel.ts
9610
- import { useState as useState37, useRef as useRef14 } from "react";
9651
+ import { useState as useState38, useRef as useRef14 } from "react";
9611
9652
 
9612
9653
  // components/hooks/useWindowSize.ts
9613
- import { useEffect as useEffect23, useState as useState38 } from "react";
9654
+ import { useEffect as useEffect24, useState as useState39 } from "react";
9614
9655
  var useWindowSize = () => {
9615
- const [windowSize, setWindowSize] = useState38({
9656
+ const [windowSize, setWindowSize] = useState39({
9616
9657
  width: void 0,
9617
9658
  height: void 0
9618
9659
  });
9619
- useEffect23(() => {
9660
+ useEffect24(() => {
9620
9661
  function handleResize() {
9621
9662
  setWindowSize({
9622
9663
  width: window.innerWidth,
@@ -9631,7 +9672,7 @@ var useWindowSize = () => {
9631
9672
  };
9632
9673
 
9633
9674
  // components/hooks/useFocusWithin.ts
9634
- import { useRef as useRef15, useState as useState39, useEffect as useEffect24 } from "react";
9675
+ import { useRef as useRef15, useState as useState40, useEffect as useEffect25 } from "react";
9635
9676
  function containsRelatedTarget(event) {
9636
9677
  if (event.currentTarget instanceof HTMLElement && event.relatedTarget instanceof HTMLElement) {
9637
9678
  return event.currentTarget.contains(event.relatedTarget);
@@ -9643,7 +9684,7 @@ function useFocusWithin({
9643
9684
  onFocus
9644
9685
  } = {}) {
9645
9686
  const ref = useRef15(null);
9646
- const [focused, _setFocused] = useState39(false);
9687
+ const [focused, _setFocused] = useState40(false);
9647
9688
  const focusedRef = useRef15(false);
9648
9689
  const setFocused = (value) => {
9649
9690
  _setFocused(value);
@@ -9661,7 +9702,7 @@ function useFocusWithin({
9661
9702
  onBlur?.(event);
9662
9703
  }
9663
9704
  };
9664
- useEffect24(() => {
9705
+ useEffect25(() => {
9665
9706
  if (ref.current) {
9666
9707
  ref.current.addEventListener("focusin", handleFocusIn);
9667
9708
  ref.current.addEventListener("focusout", handleFocusOut);
@@ -9676,7 +9717,7 @@ function useFocusWithin({
9676
9717
  }
9677
9718
 
9678
9719
  // components/hooks/useMediaQuery.ts
9679
- import { useState as useState40, useEffect as useEffect25, useRef as useRef16 } from "react";
9720
+ import { useState as useState41, useEffect as useEffect26, useRef as useRef16 } from "react";
9680
9721
  function attachMediaListener(query, callback) {
9681
9722
  try {
9682
9723
  query.addEventListener("change", callback);
@@ -9698,11 +9739,11 @@ function getInitialValue(query, initialValue) {
9698
9739
  function useMediaQuery(query, initialValue, { getInitialValueInEffect } = {
9699
9740
  getInitialValueInEffect: true
9700
9741
  }) {
9701
- const [matches, setMatches] = useState40(
9742
+ const [matches, setMatches] = useState41(
9702
9743
  getInitialValueInEffect ? initialValue : getInitialValue(query, initialValue)
9703
9744
  );
9704
9745
  const queryRef = useRef16();
9705
- useEffect25(() => {
9746
+ useEffect26(() => {
9706
9747
  if ("matchMedia" in window) {
9707
9748
  queryRef.current = window.matchMedia(query);
9708
9749
  setMatches(queryRef.current.matches);
@@ -9717,16 +9758,16 @@ function useMediaQuery(query, initialValue, { getInitialValueInEffect } = {
9717
9758
  }
9718
9759
 
9719
9760
  // components/hooks/useScrollPosition.ts
9720
- import { useState as useState41, useEffect as useEffect26 } from "react";
9761
+ import { useState as useState42, useEffect as useEffect27 } from "react";
9721
9762
 
9722
9763
  // components/hooks/useTable.ts
9723
- import { useState as useState42, useEffect as useEffect27 } from "react";
9764
+ import { useState as useState43, useEffect as useEffect28 } from "react";
9724
9765
 
9725
9766
  // components/hooks/useTabs.ts
9726
- import { useEffect as useEffect28, useState as useState43 } from "react";
9767
+ import { useEffect as useEffect29, useState as useState44 } from "react";
9727
9768
  function useTabs(initialTab = "") {
9728
- const [activeTab, setActiveTab] = useState43(initialTab);
9729
- useEffect28(() => {
9769
+ const [activeTab, setActiveTab] = useState44(initialTab);
9770
+ useEffect29(() => {
9730
9771
  const handleHashChange = () => {
9731
9772
  const hash = window.location.hash.substring(1);
9732
9773
  setActiveTab(hash || initialTab);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sikka/hawa",
3
- "version": "0.14.11-next",
3
+ "version": "0.14.12-next",
4
4
  "main": "./dist/index.js",
5
5
  "types": "./dist/index.d.ts",
6
6
  "exports": {