@opexa/portal-components 0.0.897 → 0.0.898

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.
@@ -2,6 +2,7 @@
2
2
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
3
  import { Capacitor } from '@capacitor/core';
4
4
  import { zodResolver } from '@hookform/resolvers/zod';
5
+ import { ObjectId } from '@opexa/object-id';
5
6
  import { useRouter } from 'next/navigation';
6
7
  import { useEffect } from 'react';
7
8
  import { Controller, useForm } from 'react-hook-form';
@@ -16,6 +17,7 @@ import { useSignOutMutation } from '../../../client/hooks/useSignOutMutation.js'
16
17
  import { useUpdateMemberVerificationMutation } from '../../../client/hooks/useUpdateMemberVerificationMutation.js';
17
18
  import { getSession } from '../../../client/services/getSession.js';
18
19
  import { toaster } from '../../../client/utils/toaster.js';
20
+ import { ObjectType } from '../../../services/ObjectType.js';
19
21
  import { unregisterFCMDevice } from '../../../services/trigger.js';
20
22
  import { Button } from '../../../ui/Button/index.js';
21
23
  import { Dialog } from '../../../ui/Dialog/index.js';
@@ -106,6 +108,7 @@ export function IdentityVerification() {
106
108
  },
107
109
  });
108
110
  async function onSubmit(values) {
111
+ //if member verification id is not available (first time doing kyc to trigger notifications)
109
112
  if (!memberId) {
110
113
  createMemberVerification({
111
114
  selfieImage: values.selfieImage,
@@ -117,7 +120,10 @@ export function IdentityVerification() {
117
120
  placeOfBirth: '',
118
121
  sourceOfIncome: '',
119
122
  });
123
+ const id = ObjectId.generate(ObjectType.MemberVerification).toString();
124
+ await approveMemberVerificationMutation.mutateAsync(id);
120
125
  }
126
+ //if member verification id is available (updating kyc)
121
127
  else {
122
128
  updateMemberVerification({
123
129
  id: memberId,
@@ -1,9 +1,19 @@
1
1
  import { type CSSProperties } from 'react';
2
2
  export interface ClassNameEntries {
3
3
  root?: string;
4
+ completedBadgeRoot?: string;
5
+ completedBadgeLabel?: string;
6
+ failedBadgeRoot?: string;
7
+ failedBadgeLabel?: string;
8
+ progressRoot?: string;
9
+ progressTrack?: string;
10
+ progressRange?: string;
11
+ progressLabel?: string;
4
12
  checkboxName?: string;
5
13
  checkboxBonus?: string;
6
14
  dialogRoot?: string;
15
+ dialogTitle?: string;
16
+ dialogDescription?: string;
7
17
  dialogMilestone?: string;
8
18
  dialogMilestoneName?: string;
9
19
  dialogMilestoneDescription?: string;
@@ -85,13 +85,20 @@ export function JourneyQuest(props) {
85
85
  disclosure.setOpen(true);
86
86
  }, [disclosure]);
87
87
  const localeInfo = useLocaleInfo();
88
- return (_jsxs(_Fragment, { children: [_jsxs("div", { className: twMerge('flex h-full w-full flex-col space-y-6 rounded-2xl border border-border-primary bg-bg-tertiary px-4 pt-5 pb-6', classNames?.root), children: [_jsxs("div", { className: "flex flex-col space-y-2", children: [_jsxs("div", { className: "flex max-h-7.5 items-center justify-between", children: [_jsx(RemainingTime, { endOfDay: true }), quest.status === 'COMPLETED' && (_jsx(Badge.Root, { colorScheme: "success", size: "lg", round: false, children: _jsxs(Badge.Label, { children: ["Final Bonus:", ' ', formatNumber(quest.bonus, {
88
+ return (_jsxs(_Fragment, { children: [_jsxs("div", { className: twMerge('flex h-full w-full flex-col space-y-6 rounded-2xl border border-border-primary bg-bg-tertiary px-4 pt-5 pb-6', classNames?.root), children: [_jsxs("div", { className: "flex flex-col space-y-2", children: [_jsxs("div", { className: "flex max-h-7.5 items-center justify-between", children: [_jsx(RemainingTime, { endOfDay: true, className: {
89
+ completedBadgeRoot: classNames?.completedBadgeRoot,
90
+ completedBadgeLabel: classNames?.completedBadgeLabel,
91
+ failedBadgeRoot: classNames?.failedBadgeRoot,
92
+ failedBadgeLabel: classNames?.failedBadgeLabel,
93
+ } }), quest.status === 'COMPLETED' && (_jsx(Badge.Root, { colorScheme: "success", size: "lg", round: false, children: _jsxs(Badge.Label, { children: ["Final Bonus:", ' ', formatNumber(quest.bonus, {
89
94
  currency: localeInfo.currency.code,
90
- })] }) }))] }), _jsx("p", { className: "font-semibold text-xl", children: quest?.name || 'Journey Quest' }), _jsxs("div", { className: "flex w-full items-center space-x-2", children: [_jsx(Progress.Root, { max: 100, className: "h-2 rounded-full bg-bg-primary", value: progressValue, children: _jsx(Progress.Track, { children: _jsx(Progress.Range, {}) }) }), _jsxs("p", { className: "text-text-quarterary-brand text-xs", children: [currentMilestone, "/", totalMilestones] })] }), _jsx("div", { className: "flex w-full flex-col space-y-3", children: milestones.map((milestone, index) => (_jsx(QuestMilestone, { label: milestone.label, bonus: milestone.bonus, isCompleted: milestone.isCompleted, checkboxControlStyle: props.checkboxControlStyle, className: {
95
+ })] }) }))] }), _jsx("p", { className: "font-semibold text-xl", children: quest?.name || 'Journey Quest' }), _jsxs("div", { className: "flex w-full items-center space-x-2", children: [_jsx(Progress.Root, { max: 100, className: twMerge('h-2 rounded-full bg-bg-primary', classNames?.progressRoot), value: progressValue, children: _jsx(Progress.Track, { className: classNames?.progressTrack, children: _jsx(Progress.Range, { className: classNames?.progressRange }) }) }), _jsxs("p", { className: twMerge('text-text-quarterary-brand text-xs', classNames?.progressLabel), children: [currentMilestone, "/", totalMilestones] })] }), _jsx("div", { className: "flex w-full flex-col space-y-3", children: milestones.map((milestone, index) => (_jsx(QuestMilestone, { label: milestone.label, bonus: milestone.bonus, isCompleted: milestone.isCompleted, checkboxControlStyle: props.checkboxControlStyle, className: {
91
96
  name: classNames?.checkboxName,
92
97
  bonus: classNames?.checkboxBonus,
93
98
  } }, index))) })] }), _jsx("div", { className: "flex h-full items-end", children: _jsx(Button, { size: "sm", onClick: handleViewDetails, "aria-label": "View Details", disabled: false, className: "disabled:bg-bg-primary disabled:text-text-disabled", children: "View Details" }) })] }), _jsx(Rules, { open: disclosure.open, onOpenChange: disclosure.setOpen, quest: quest, milestones: milestones, className: {
94
99
  root: classNames?.dialogRoot,
100
+ title: classNames?.dialogTitle,
101
+ description: classNames?.dialogDescription,
95
102
  milestone: classNames?.dialogMilestone,
96
103
  milestoneName: classNames?.dialogMilestoneName,
97
104
  milestoneDescription: classNames?.dialogMilestoneDescription,
@@ -124,9 +131,9 @@ function Rules(props) {
124
131
  }, [milestones]);
125
132
  const sessionQuery = useSessionQuery();
126
133
  const session = sessionQuery.data;
127
- return (_jsx(Dialog.Root, { lazyMount: true, unmountOnExit: true, open: open, onOpenChange: (details) => setOpen(details.open), closeOnEscape: false, closeOnInteractOutside: false, children: _jsxs(Portal, { children: [_jsx(Dialog.Backdrop, { className: "!z-[calc(var(--z-dialog)+1)]" }), _jsx(Dialog.Positioner, { className: "!z-[calc(var(--z-dialog)+2)] flex items-center justify-center p-4", children: _jsxs(Dialog.Content, { className: twMerge('mx-auto max-h-[80vh] min-h-auto min-w-[21.438rem] max-w-[400px] overflow-y-auto rounded-xl px-4 py-10 md:scrollbar:h-2 md:scrollbar:w-2 md:scrollbar-thumb:rounded-full md:scrollbar-thumb:bg-bg-quaternary md:scrollbar-track:bg-transparent', props.className?.root), children: [_jsx(Dialog.CloseTrigger, { children: _jsx(XIcon, {}) }), _jsxs("div", { className: "group flex flex-col space-y-5 text-sm text-text-quarterary-brand", children: [_jsx("h2", { className: "font-semibold text-lg text-text-primary-900", children: quest?.name || 'Quest' }), _jsxs("div", { className: "relative", children: [_jsx("div", { className: "max-h-[30vh] overflow-y-auto", children: quest?.description ? (_jsx(Prose, { dangerouslySetInnerHTML: {
128
- __html: quest.description,
129
- }, className: "mb-3" })) : (_jsx("p", { children: "Ready for a challenge? Complete them all and get amazing rewards!" })) }), _jsx("div", { className: "pointer-events-none absolute inset-x-0 bottom-safe-area-inset-bottom h-8 bg-gradient-to-t from-bg-primary to-transparent" })] }), milestones.map((milestone) => {
134
+ return (_jsx(Dialog.Root, { lazyMount: true, unmountOnExit: true, open: open, onOpenChange: (details) => setOpen(details.open), closeOnEscape: false, closeOnInteractOutside: false, children: _jsxs(Portal, { children: [_jsx(Dialog.Backdrop, { className: "!z-[calc(var(--z-dialog)+1)]" }), _jsx(Dialog.Positioner, { className: "!z-[calc(var(--z-dialog)+2)] flex items-center justify-center p-4", children: _jsxs(Dialog.Content, { className: twMerge('mx-auto max-h-[80vh] min-h-auto min-w-[21.438rem] max-w-[400px] overflow-y-auto rounded-xl px-4 py-10 md:scrollbar:h-2 md:scrollbar:w-2 md:scrollbar-thumb:rounded-full md:scrollbar-thumb:bg-bg-quaternary md:scrollbar-track:bg-transparent', props.className?.root), children: [_jsx(Dialog.CloseTrigger, { children: _jsx(XIcon, {}) }), _jsxs("div", { className: "group flex flex-col space-y-5 text-sm text-text-quarterary-brand", children: [_jsx("h2", { className: twMerge('font-semibold text-lg text-text-primary-900', props.className?.title), children: quest?.name || 'Quest' }), _jsx("div", { className: "relative", children: _jsx("div", { className: "max-h-[30vh] overflow-y-auto", children: quest?.description ? (_jsx(Prose, { dangerouslySetInnerHTML: {
135
+ __html: quest.description,
136
+ }, className: twMerge('mb-3', props.className?.description) })) : (_jsx("p", { className: twMerge(props.className?.description), children: "Ready for a challenge? Complete them all and get amazing rewards!" })) }) }), milestones.map((milestone) => {
130
137
  const milestoneType = quest?.milestones?.find((m) => m.id === milestone.id)?.type;
131
138
  const accountVerificationMessage = milestoneType === 'ACCOUNT_VERIFICATION'
132
139
  ? verificationStatus === 'PENDING'
@@ -1,5 +1,11 @@
1
1
  interface RemainingTimeProps {
2
2
  endOfDay?: boolean;
3
+ className?: {
4
+ completedBadgeRoot?: string;
5
+ completedBadgeLabel?: string;
6
+ failedBadgeRoot?: string;
7
+ failedBadgeLabel?: string;
8
+ };
3
9
  }
4
- export declare function RemainingTime({ endOfDay: useEndOfDay, }: RemainingTimeProps): import("react/jsx-runtime").JSX.Element;
10
+ export declare function RemainingTime({ endOfDay: useEndOfDay, className, }: RemainingTimeProps): import("react/jsx-runtime").JSX.Element;
5
11
  export {};
@@ -4,17 +4,17 @@ import { useRemainingTime } from '../../client/hooks/useRemainingTime.js';
4
4
  import { ClockStopWatchIcon } from '../../icons/ClockStopWatchIcon.js';
5
5
  import { Badge } from '../../ui/Badge/index.js';
6
6
  import { useQuestContext } from './QuestsContext.js';
7
- export function RemainingTime({ endOfDay: useEndOfDay = false, }) {
7
+ export function RemainingTime({ endOfDay: useEndOfDay = false, className, }) {
8
8
  const quest = useQuestContext();
9
9
  const targetDateTime = useEndOfDay
10
10
  ? endOfDay(new Date(quest.endDateTime)).toISOString()
11
11
  : quest.endDateTime;
12
12
  const remainingTime = useRemainingTime(targetDateTime);
13
13
  if (quest.status === 'COMPLETED') {
14
- return (_jsx(Badge.Root, { size: "lg", colorScheme: "success", round: false, children: _jsx(Badge.Label, { children: "Completed" }) }));
14
+ return (_jsx(Badge.Root, { size: "lg", colorScheme: "success", round: false, className: className?.completedBadgeRoot, children: _jsx(Badge.Label, { className: className?.completedBadgeLabel, children: "Completed" }) }));
15
15
  }
16
16
  if (quest.status === 'FAILED' || remainingTime.expired) {
17
- return (_jsx(Badge.Root, { size: "lg", colorScheme: "danger", round: false, children: _jsx(Badge.Label, { children: "Failed" }) }));
17
+ return (_jsx(Badge.Root, { size: "lg", colorScheme: "danger", round: false, className: className?.failedBadgeRoot, children: _jsx(Badge.Label, { className: className?.failedBadgeLabel, children: "Failed" }) }));
18
18
  }
19
19
  return (_jsxs(Badge.Root, { size: "lg", colorScheme: "brand", round: false, children: [_jsx(Badge.Icon, { children: _jsx(ClockStopWatchIcon, {}) }), _jsx(Badge.Label, { children: remainingTime.toString() })] }));
20
20
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opexa/portal-components",
3
- "version": "0.0.897",
3
+ "version": "0.0.898",
4
4
  "exports": {
5
5
  "./ui/*": {
6
6
  "types": "./dist/ui/*/index.d.ts",