@opexa/portal-components 0.0.1096 → 0.0.1098

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.
@@ -95,7 +95,6 @@ export function AurixPayGrabPayDeposit() {
95
95
  const paymentSettings = paymentSettingsQuery.data;
96
96
  console.log({ paymentSettings });
97
97
  const gatewaySettings = paymentSettings?.aurixPayGrabPayDepositGatewaySettings;
98
- console.log({ gatewaySettings });
99
98
  const maximumAmount = parseDecimal(gatewaySettings?.maximumAmount, 0);
100
99
  const minimumAmount = depositsCount <= 0
101
100
  ? parseDecimal(paymentSettingsQuery.data?.minimumFirstDepositAmount, 0)
@@ -30,6 +30,7 @@ import { Select } from '../../../../ui/Select/index.js';
30
30
  import { parseDecimal } from '../../../../utils/parseDecimal.js';
31
31
  import { AmountChoices } from '../../AmountChoices.js';
32
32
  import { useDepositWithdrawalPropsContext } from '../../DepositWithdrawalContext.js';
33
+ import { explainError } from '../../utils.js';
33
34
  import { ActiveTurnoverRequirement } from '../ActiveTurnoverRequirement.js';
34
35
  import { RequireFirstDeposit } from '../RequireFirstDeposit.js';
35
36
  import { TransactionPasswordNotSet } from '../TransactionPasswordNotSet.js';
@@ -249,7 +250,7 @@ export function VentajaWithdrawal() {
249
250
  }, lazyMount: true, unmountOnExit: true, children: _jsxs(Portal, { children: [_jsx(AlertDialog.Backdrop, { className: "!z-[calc(var(--z-dialog)+2)]" }), _jsx(AlertDialog.Positioner, { className: "!z-[calc(var(--z-dialog)+3)]", children: _jsxs(AlertDialog.Content, { children: [_jsx(AlertDialog.CloseTrigger, { disabled: status === 'processing', children: _jsx(XIcon, {}) }), _jsxs(AlertDialog.Header, { children: [status === 'processing' && (_jsx(SpinnerIcon, { className: "size-12 text-text-brand-primary-600" })), status === 'success' && (_jsx("div", { className: "flex size-12 items-center justify-center rounded-full bg-bg-success-secondary text-text-featured-icon-light-success", children: _jsx(AlertCircleIcon, {}) })), status === 'failed' && (_jsx("div", { className: "flex size-12 items-center justify-center rounded-full bg-bg-error-secondary text-text-featured-icon-light-error", children: _jsx(AlertCircleIcon, {}) }))] }), _jsxs(AlertDialog.Body, { children: [_jsxs(AlertDialog.Title, { children: [status === 'processing' && 'Processing Withdraw', status === 'success' && 'Withdrawal Submitted', status === 'failed' && 'Withdraw Failed'] }), _jsxs(AlertDialog.Description, { children: [status === 'processing' &&
250
251
  "We're verifying your account and amount. Please hold a moment.", status === 'success' &&
251
252
  'Your withdrawal request has been submitted successfully and is awaiting confirmation. You won’t have to wait long — once approved, the funds will be credited to your account.', status === 'failed' &&
252
- 'First deposit is required before making a withdrawal.'] })] }), (status === 'failed' || status === 'success') && (_jsx(AlertDialog.Footer, { children: _jsx(AlertDialog.Context, { children: (api) => (_jsx(Button, { onClick: () => {
253
+ explainError(createWithdrawalMutation.error?.name)] })] }), (status === 'failed' || status === 'success') && (_jsx(AlertDialog.Footer, { children: _jsx(AlertDialog.Context, { children: (api) => (_jsx(Button, { onClick: () => {
253
254
  api.setOpen(false);
254
255
  }, children: status === 'failed' ? 'Try Again' : 'Ok' })) }) }))] }) })] }) })] }));
255
256
  }
@@ -45,6 +45,7 @@ export function MessagesPopup() {
45
45
  const isVerificationLocked = accountQuery.data?.status === 'VERIFICATION_LOCKED';
46
46
  const [paused, setPaused] = useState(false);
47
47
  const [numberOfUnreadMessages, setNumberOfUnreadMessages] = useState(0);
48
+ const [activeMessages, setActiveMessages] = useState([]);
48
49
  useInterval(() => {
49
50
  setPaused(false);
50
51
  }, paused
@@ -55,7 +56,9 @@ export function MessagesPopup() {
55
56
  const disclosure = useDisclosure({
56
57
  onOpenChange(open) {
57
58
  if (open) {
58
- const message = messages.at(0);
59
+ const currentMessages = messages;
60
+ setActiveMessages(currentMessages);
61
+ const message = currentMessages.at(0);
59
62
  if (!message)
60
63
  return;
61
64
  if (message.markedAsRead)
@@ -65,6 +68,7 @@ export function MessagesPopup() {
65
68
  else {
66
69
  setIndex_(0);
67
70
  setNumberOfUnreadMessages(messages.length);
71
+ setActiveMessages([]);
68
72
  setPaused(true);
69
73
  }
70
74
  },
@@ -99,7 +103,7 @@ export function MessagesPopup() {
99
103
  const [index, setIndex_] = useState(0);
100
104
  const setIndex = (newIndex) => {
101
105
  setIndex_(newIndex);
102
- const message = messages.at(newIndex);
106
+ const message = activeMessages.at(newIndex);
103
107
  if (!message)
104
108
  return;
105
109
  if (message.markedAsRead)
@@ -111,17 +115,18 @@ export function MessagesPopup() {
111
115
  return;
112
116
  disclosure.setOpen(true);
113
117
  }, !disclosure.open && !paused && !isVerificationLocked ? 3000 : null);
114
- // Resume showing messages if the number of unread messages changes
115
- if (messages.length > numberOfUnreadMessages && paused) {
116
- setPaused(false);
117
- }
118
+ useEffect(() => {
119
+ if (messages.length > numberOfUnreadMessages && paused) {
120
+ setPaused(false);
121
+ }
122
+ }, [messages.length, numberOfUnreadMessages, paused]);
118
123
  const transformContent = (content) => {
119
124
  const QUOTE_REGEX = /["\u201C]([^"\u201D]+)["\u201D]/g;
120
125
  const defaultContentFormat = 'Your journey continues with . Complete this quest to earn exclusive rewards and advance your progress.';
121
126
  const isDefaultContent = content.replace(/“.*?”/, '').includes(defaultContentFormat) ?? false;
122
127
  const match = QUOTE_REGEX.exec(content ?? '');
123
128
  if (match && isDefaultContent) {
124
- return `<p class="text-center">${content?.replace(QUOTE_REGEX, `<span class="!text-brand-500 !w-fit">“${match[1]}”</span>`)}</p>`;
129
+ return `<p class="text-center">${content?.replace(QUOTE_REGEX, (_m, p1) => `<span class="!text-brand-500 !w-fit">“${p1}”</span>`)}</p>`;
125
130
  }
126
131
  return content;
127
132
  };
@@ -141,7 +146,7 @@ export function MessagesPopup() {
141
146
  disclosure.setOpen(details.open);
142
147
  }, closeOnInteractOutside: false, lazyMount: true, unmountOnExit: true, children: _jsxs(Portal, { children: [_jsx(Dialog.Backdrop, { className: "!z-[calc(var(--z-dialog)+3)]" }), _jsx(Dialog.Positioner, { className: "!z-[calc(var(--z-dialog)+4)] flex items-center justify-center", children: _jsxs(Dialog.Content, { className: "mx-auto max-h-[80vh] min-w-[21.438rem] max-w-[21.438rem] overflow-y-auto rounded-xl p-3xl lg:min-w-[25rem] lg:max-w-[25rem]", children: [_jsx(Dialog.CloseTrigger, { children: _jsx(XIcon, {}) }), _jsxs(Carousel.Root, { page: index, onPageChange: (details) => {
143
148
  setIndex(details.page);
144
- }, slideCount: messages.length, allowMouseDrag: true, autoplay: false, children: [_jsx(Carousel.ItemGroup, { children: messages.map((message, index) => (_jsxs(Carousel.Item, { index: index, className: "select-none", children: [_jsx("div", { className: "mx-auto flex size-12 items-center justify-center rounded-full bg-bg-brand-secondary text-text-brand", children: _jsx(MessageIcon, { type: message.icon, className: "size-6" }) }), _jsx("h2", { className: "mt-lg text-center font-semibold text-lg xl:mt-xl", children: message.title }), message.content && (_jsx("div", { dangerouslySetInnerHTML: {
149
+ }, slideCount: activeMessages.length, allowMouseDrag: true, autoplay: false, children: [_jsx(Carousel.ItemGroup, { children: activeMessages.map((message, index) => (_jsxs(Carousel.Item, { index: index, className: "select-none", children: [_jsx("div", { className: "mx-auto flex size-12 items-center justify-center rounded-full bg-bg-brand-secondary text-text-brand", children: _jsx(MessageIcon, { type: message.icon, className: "size-6" }) }), _jsx("h2", { className: "mt-lg text-center font-semibold text-lg xl:mt-xl", children: message.title }), message.content && (_jsx("div", { dangerouslySetInnerHTML: {
145
150
  __html: transformContent(message.content),
146
151
  }, className: "mt-xs pb-5 text-center text-sm text-text-secondary-700 [&_li>ol]:list-decimal [&_li>ol]:pl-5 [&_li>ul]:list-disc [&_li>ul]:pl-5 [&_li]:mb-1 [&_ol]:list-decimal [&_ol]:pl-5 [&_ul]:list-disc [&_ul]:pl-5" })), message.image && (_jsx("div", { className: "mt-5 pb-5", children: _jsx(Image, { src: message.image, alt: "", width: 400, height: 250, loading: "lazy", unoptimized: true, className: "h-auto w-full rounded-sm" }) })), message.actions.length ? (_jsx("div", { className: "mt-3xl flex flex-col gap-2 text-center lg:mt-4xl", children: message.actions.map((action, index) => (_jsx(Button, { asChild: true, children: _jsx(Link, { href: normalizeActionUrl(action.url, session?.token || '', {
147
152
  questsPageUrl,
@@ -153,5 +158,5 @@ export function MessagesPopup() {
153
158
  window.location.href =
154
159
  e.currentTarget.getAttribute('href') ?? '#';
155
160
  }
156
- }, children: action.name }) }, index))) })) : null] }, message.id))) }), _jsxs(Carousel.Control, { className: "mt-5 flex items-center lg:mt-3xl", children: [_jsxs(Carousel.PrevTrigger, { className: "hidden items-center gap-md font-semibold text-text-quarterary-500 disabled:invisible lg:flex", children: [_jsx(ChevronLeftIcon, { className: "size-5" }), "Back"] }), _jsx(Carousel.IndicatorGroup, { className: "flex grow justify-center gap-xs", children: messages.map((message, index) => (_jsx(Carousel.Indicator, { index: index, className: "size-2.5 ui-current:w-5 rounded-full bg-bg-quaternary ui-current:bg-brand-400 transition-all duration-150" }, message.id))) }), _jsxs(Carousel.NextTrigger, { className: "hidden items-center gap-md font-semibold text-text-quarterary-500 disabled:invisible lg:flex", children: ["Next", _jsx(ChevronRightIcon, { className: "size-5" })] })] })] })] }) })] }) }));
161
+ }, children: action.name }) }, index))) })) : null] }, message.id))) }), _jsxs(Carousel.Control, { className: "mt-5 flex items-center lg:mt-3xl", children: [_jsxs(Carousel.PrevTrigger, { className: "hidden items-center gap-md font-semibold text-text-quarterary-500 disabled:invisible lg:flex", children: [_jsx(ChevronLeftIcon, { className: "size-5" }), "Back"] }), _jsx(Carousel.IndicatorGroup, { className: "flex grow justify-center gap-xs", children: activeMessages.map((message, index) => (_jsx(Carousel.Indicator, { index: index, className: "size-2.5 ui-current:w-5 rounded-full bg-bg-quaternary ui-current:bg-brand-400 transition-all duration-150" }, message.id))) }), _jsxs(Carousel.NextTrigger, { className: "hidden items-center gap-md font-semibold text-text-quarterary-500 disabled:invisible lg:flex", children: ["Next", _jsx(ChevronRightIcon, { className: "size-5" })] })] })] })] }) })] }) }));
157
162
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opexa/portal-components",
3
- "version": "0.0.1096",
3
+ "version": "0.0.1098",
4
4
  "exports": {
5
5
  "./ui/*": {
6
6
  "types": "./dist/ui/*/index.d.ts",