@opexa/portal-components 0.0.916 → 0.0.918

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.
@@ -9,6 +9,7 @@ interface BaseAccountInfoProps {
9
9
  facebookSso?: boolean;
10
10
  /** Avatar image source */
11
11
  avatar?: string;
12
+ variant?: string;
12
13
  }
13
14
  interface WithoutBranchCode extends BaseAccountInfoProps {
14
15
  shouldShowBranchCode?: false;
@@ -37,6 +37,7 @@ import { IconButton } from '../../ui/IconButton/index.js';
37
37
  import { Portal } from '../../ui/Portal/index.js';
38
38
  import { getQueryClient } from '../../utils/getQueryClient.js';
39
39
  import { getAccountQueryKey, getProfileCompletionQueryKey, } from '../../utils/queryKeys.js';
40
+ import PhoneIcon from './icons/PhoneIcon.js';
40
41
  const accountSchema = z.object({
41
42
  name: z
42
43
  .string()
@@ -45,7 +46,7 @@ const accountSchema = z.object({
45
46
  .regex(/^[a-zA-Z0-9]+$/, 'Username can only contain letters and numbers'),
46
47
  });
47
48
  export function AccountInfo(props) {
48
- return (_jsxs("div", { className: twMerge('space-y-3xl', props.className), children: [_jsx(ProfileInfo, { avatar: props.avatar }), _jsx(ContactInfo, {}), _jsx(PersonalInfo, { shouldShowBranchCode: props.shouldShowBranchCode, branchCodes: props.branchCodes }), _jsx(SSO, { google: props.googleSso, facebook: props.facebookSso })] }));
49
+ return (_jsxs("div", { className: twMerge('space-y-3xl', props.className), children: [_jsx(ProfileInfo, { avatar: props.avatar }), _jsx(ContactInfo, { variant: props.variant }), _jsx(PersonalInfo, { shouldShowBranchCode: props.shouldShowBranchCode, branchCodes: props.branchCodes }), _jsx(SSO, { google: props.googleSso, facebook: props.facebookSso })] }));
49
50
  }
50
51
  function ProfileInfo({ avatar }) {
51
52
  const [edit, setEdit] = useState(false);
@@ -155,7 +156,7 @@ function PersonalInfo(props) {
155
156
  });
156
157
  }), children: [_jsxs("div", { className: "px-4 py-5 lg:px-3xl lg:py-5", children: [_jsxs(Field.Root, { invalid: !!form.formState.errors.realName, readOnly: !!account?.realName, children: [_jsx(Field.Label, { children: "Full name" }), _jsx(Field.Input, { ...form.register('realName') }), _jsx(Field.ErrorText, { children: form.formState.errors.realName?.message })] }), _jsxs(Field.Root, { className: "mt-6", invalid: !!form.formState.errors.birthDay, readOnly: !!account?.birthDay, children: [_jsx(Field.Label, { children: "Date of birth" }), _jsx(Field.Input, { type: "date", ...form.register('birthDay'), className: twMerge('h-full py-2.5', account?.birthDay && 'pointer-events-none') }), _jsx(Field.ErrorText, { children: form.formState.errors.birthDay?.message })] }), props.shouldShowBranchCode && (_jsxs(Field.Root, { className: "mt-6", invalid: !!form.formState.errors.birthDay, readOnly: !!account?.birthDay, children: [_jsx(Field.Label, { children: "Branch Code" }), _jsx(Field.Input, { type: "text", disabled: true, value: displayBranchName ?? account?.branchCode ?? '' })] }))] }), form.formState.isDirty && (_jsxs("div", { className: "flex justify-end gap-lg border-border-secondary border-t px-xl py-lg lg:px-3xl lg:py-xl", children: [_jsx(Button, { size: "sm", variant: "outline", fullWidth: false, disabled: updateAccountMutation.isPending, onClick: () => form.reset(), children: "Cancel" }), _jsx(Button, { type: "submit", size: "sm", fullWidth: false, disabled: !form.formState.isValid || updateAccountMutation.isPending, children: "Save Changes" })] }))] })] }));
157
158
  }
158
- function ContactInfo() {
159
+ function ContactInfo({ variant }) {
159
160
  const localeInfo = useLocaleInfo();
160
161
  const accountQuery = useAccountQuery();
161
162
  const profileCompletionQuery = useProfileCompletionQuery();
@@ -215,7 +216,7 @@ function ContactInfo() {
215
216
  ? format(data.mobileNumber)
216
217
  : undefined,
217
218
  });
218
- }), children: [_jsxs("div", { className: "px-xl py-5 lg:px-3xl lg:py-5", children: [_jsxs(Field.Root, { invalid: !!form.formState.errors.mobileNumber, children: [_jsx(Field.Label, { children: "Mobile Number" }), _jsxs("div", { className: "relative", children: [_jsx(localeInfo.country.flag, { className: "-translate-y-1/2 pointer-events-none absolute top-1/2 left-3.5 size-5" }), _jsx(Field.Input, { className: "pl-10.5", readOnly: account?.mobileNumber != null, ...form.register('mobileNumber') })] }), _jsx(Field.ErrorText, { children: form.formState.errors.mobileNumber?.message })] }), _jsxs(Field.Root, { className: "mt-6", invalid: !!form.formState.errors.emailAddress, children: [_jsx(Field.Label, { children: "Email address" }), _jsx(Field.Input, { ...form.register('emailAddress') }), _jsx(Field.ErrorText, { children: form.formState.errors.emailAddress?.message })] })] }), form.formState.isDirty && (_jsxs("div", { className: "flex justify-end gap-lg border-border-secondary border-t px-xl py-lg lg:px-3xl lg:py-xl", children: [_jsx(Button, { size: "sm", variant: "outline", fullWidth: false, disabled: updateAccountMutation.isPending, onClick: () => form.reset(), children: "Cancel" }), _jsx(Button, { type: "submit", size: "sm", fullWidth: false, disabled: updateAccountMutation.isPending || !form.formState.isValid, children: "Save Changes" })] }))] })] }));
219
+ }), children: [_jsxs("div", { className: "px-xl py-5 lg:px-3xl lg:py-5", children: [_jsxs(Field.Root, { invalid: !!form.formState.errors.mobileNumber, children: [_jsx(Field.Label, { children: "Mobile Number" }), _jsxs("div", { className: "relative", children: [variant === 'ofwin' ? (_jsx(PhoneIcon, {})) : (_jsx(localeInfo.country.flag, { className: "-translate-y-1/2 pointer-events-none absolute top-1/2 left-3.5 size-5" })), _jsx(Field.Input, { className: "pl-10.5", readOnly: account?.mobileNumber != null, ...form.register('mobileNumber') })] }), _jsx(Field.ErrorText, { children: form.formState.errors.mobileNumber?.message })] }), _jsxs(Field.Root, { className: "mt-6", invalid: !!form.formState.errors.emailAddress, children: [_jsx(Field.Label, { children: "Email address" }), _jsx(Field.Input, { ...form.register('emailAddress') }), _jsx(Field.ErrorText, { children: form.formState.errors.emailAddress?.message })] })] }), form.formState.isDirty && (_jsxs("div", { className: "flex justify-end gap-lg border-border-secondary border-t px-xl py-lg lg:px-3xl lg:py-xl", children: [_jsx(Button, { size: "sm", variant: "outline", fullWidth: false, disabled: updateAccountMutation.isPending, onClick: () => form.reset(), children: "Cancel" }), _jsx(Button, { type: "submit", size: "sm", fullWidth: false, disabled: updateAccountMutation.isPending || !form.formState.isValid, children: "Save Changes" })] }))] })] }));
219
220
  }
220
221
  function SSO({ google, facebook }) {
221
222
  const googleClientIdQuery = useGoogleClientIdQuery({ enabled: !!google });
@@ -0,0 +1,2 @@
1
+ declare const PhoneIcon: () => import("react/jsx-runtime").JSX.Element;
2
+ export default PhoneIcon;
@@ -0,0 +1,5 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ const PhoneIcon = () => {
3
+ return (_jsx("svg", { width: "100%", height: "100%", viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg", className: "-translate-y-1/2 pointer-events-none absolute top-1/2 left-3.5 size-5", children: _jsx("path", { d: "M12 17.5H12.01M8.2 22H15.8C16.9201 22 17.4802 22 17.908 21.782C18.2843 21.5903 18.5903 21.2843 18.782 20.908C19 20.4802 19 19.9201 19 18.8V5.2C19 4.07989 19 3.51984 18.782 3.09202C18.5903 2.71569 18.2843 2.40973 17.908 2.21799C17.4802 2 16.9201 2 15.8 2H8.2C7.0799 2 6.51984 2 6.09202 2.21799C5.71569 2.40973 5.40973 2.71569 5.21799 3.09202C5 3.51984 5 4.0799 5 5.2V18.8C5 19.9201 5 20.4802 5.21799 20.908C5.40973 21.2843 5.71569 21.5903 6.09202 21.782C6.51984 22 7.07989 22 8.2 22ZM12.5 17.5C12.5 17.7761 12.2761 18 12 18C11.7239 18 11.5 17.7761 11.5 17.5C11.5 17.2239 11.7239 17 12 17C12.2761 17 12.5 17.2239 12.5 17.5Z", stroke: "currentColor", "stroke-width": "2", "stroke-linecap": "round", "stroke-linejoin": "round" }) }));
4
+ };
5
+ export default PhoneIcon;
@@ -48,11 +48,7 @@ export function Deposit() {
48
48
  const paymentSettingsQuery = usePaymentSettingsQuery();
49
49
  const paymentSettings = paymentSettingsQuery.data;
50
50
  const featureFlag = useFeatureFlag();
51
- const nodeEnv = (process.env.NEXT_PUBLIC_ENVIRONMENT ?? '');
52
- const enableAurix = nodeEnv === 'development' || nodeEnv === 'staging';
53
51
  const aurixComponents = useMemo(() => {
54
- if (!enableAurix)
55
- return null;
56
52
  return {
57
53
  gcash: lazy(() => import('./AurixPayGCashDeposit/AurixPayGCashDeposit.js').then((m) => ({
58
54
  default: m.AurixPayGCashDeposit,
@@ -67,7 +63,7 @@ export function Deposit() {
67
63
  default: m.AurixPayQRPHDeposit,
68
64
  }))),
69
65
  };
70
- }, [enableAurix]);
66
+ }, []);
71
67
  const enabledPaymentMethods = useMemo(() => {
72
68
  const l = [];
73
69
  if (onMaya) {
@@ -129,27 +125,19 @@ export function Deposit() {
129
125
  },
130
126
  {
131
127
  method: 'AURIX_PAY_GCASH',
132
- enabled: enableAurix &&
133
- paymentSettings?.aurixPayGCashDepositGatewaySettings?.[enabledKey] &&
134
- featureFlag.enabled,
128
+ enabled: paymentSettings?.aurixPayGCashDepositGatewaySettings?.[enabledKey],
135
129
  },
136
130
  {
137
131
  method: 'AURIX_PAY_GRAB_PAY',
138
- enabled: enableAurix &&
139
- paymentSettings?.aurixPayGrabPayDepositGatewaySettings?.[enabledKey] &&
140
- featureFlag.enabled,
132
+ enabled: paymentSettings?.aurixPayGrabPayDepositGatewaySettings?.[enabledKey],
141
133
  },
142
134
  {
143
135
  method: 'AURIX_PAY_PAYMAYA',
144
- enabled: enableAurix &&
145
- paymentSettings?.aurixPayPayMayaDepositGatewaySettings?.[enabledKey] &&
146
- featureFlag.enabled,
136
+ enabled: paymentSettings?.aurixPayPayMayaDepositGatewaySettings?.[enabledKey],
147
137
  },
148
138
  {
149
139
  method: 'AURIX_PAY_QRPH',
150
- enabled: enableAurix &&
151
- paymentSettings?.aurixPayQrphDepositGatewaySettings?.[enabledKey] &&
152
- featureFlag.enabled,
140
+ enabled: paymentSettings?.aurixPayQrphDepositGatewaySettings?.[enabledKey],
153
141
  },
154
142
  ];
155
143
  paymentMethods.forEach((o) => {
@@ -158,7 +146,7 @@ export function Deposit() {
158
146
  }
159
147
  });
160
148
  return l;
161
- }, [enableAurix, featureFlag.enabled, onMaya, paymentSettings]);
149
+ }, [featureFlag.enabled, onMaya, paymentSettings]);
162
150
  const [paymentMethod, setPaymentMethod] = useState();
163
151
  useEffect(() => {
164
152
  if (enabledPaymentMethods.length > 0 && !paymentMethod) {
@@ -183,15 +171,7 @@ export function Deposit() {
183
171
  const AurixPayPayMayaDeposit = aurixComponents?.payMaya;
184
172
  const AurixPayGrabPayDeposit = aurixComponents?.grabPay;
185
173
  const AurixPayQRPHDeposit = aurixComponents?.qrph;
186
- return (_jsxs(_Fragment, { children: [_jsx(PaymentMethods, { value: paymentMethod, onChange: handlePaymentMethodChange, options: enabledPaymentMethods }), _jsxs(Suspense, { fallback: _jsx(SpinnerIcon, { className: "mx-auto size-6" }), children: [paymentMethod === 'QRPH' && _jsx(QRPHDeposit, {}), paymentMethod === 'GCASH' && _jsx(GCashDeposit, {}), paymentMethod === 'MAYA' && _jsx(MayaDeposit, {}), paymentMethod === 'MAYA_APP' && _jsx(MayaAppDeposit, {}), paymentMethod === 'ONLINE_BANK' && _jsx(OnlineBankDeposit, {}), paymentMethod === 'LIBANGAN_PAY_IN' && _jsx(LibanganDeposit, {}), paymentMethod === 'PISO_PAY' && _jsx(PisoPayDeposit, {}), paymentMethod === 'AIO_GCASH' && _jsx(AiOGCashDeposit, {}), paymentMethod === 'AIO_PAY_MAYA' && _jsx(AiOPayMayaDeposit, {}), paymentMethod === 'AIO_GRAB_PAY' && _jsx(AiOGrabPayDeposit, {}), paymentMethod === 'AIO_PALAWAN_PAY' && _jsx(AiOPalawanPayDeposit, {}), paymentMethod === 'GCASH_WEBPAY' && _jsx(GCashWebpayDeposit, {}), paymentMethod === 'MAYA_WEBPAY' && _jsx(MayaWebpayDeposit, {}), enableAurix &&
187
- paymentMethod === 'AURIX_PAY_GCASH' &&
188
- AurixPayGCashDeposit && _jsx(AurixPayGCashDeposit, {}), enableAurix &&
189
- paymentMethod === 'AURIX_PAY_PAYMAYA' &&
190
- AurixPayPayMayaDeposit && _jsx(AurixPayPayMayaDeposit, {}), enableAurix &&
191
- paymentMethod === 'AURIX_PAY_GRAB_PAY' &&
192
- AurixPayGrabPayDeposit && _jsx(AurixPayGrabPayDeposit, {}), enableAurix &&
193
- paymentMethod === 'AURIX_PAY_QRPH' &&
194
- AurixPayQRPHDeposit && _jsx(AurixPayQRPHDeposit, {})] })] }));
174
+ return (_jsxs(_Fragment, { children: [_jsx(PaymentMethods, { value: paymentMethod, onChange: handlePaymentMethodChange, options: enabledPaymentMethods }), _jsxs(Suspense, { fallback: _jsx(SpinnerIcon, { className: "mx-auto size-6" }), children: [paymentMethod === 'QRPH' && _jsx(QRPHDeposit, {}), paymentMethod === 'GCASH' && _jsx(GCashDeposit, {}), paymentMethod === 'MAYA' && _jsx(MayaDeposit, {}), paymentMethod === 'MAYA_APP' && _jsx(MayaAppDeposit, {}), paymentMethod === 'ONLINE_BANK' && _jsx(OnlineBankDeposit, {}), paymentMethod === 'LIBANGAN_PAY_IN' && _jsx(LibanganDeposit, {}), paymentMethod === 'PISO_PAY' && _jsx(PisoPayDeposit, {}), paymentMethod === 'AIO_GCASH' && _jsx(AiOGCashDeposit, {}), paymentMethod === 'AIO_PAY_MAYA' && _jsx(AiOPayMayaDeposit, {}), paymentMethod === 'AIO_GRAB_PAY' && _jsx(AiOGrabPayDeposit, {}), paymentMethod === 'AIO_PALAWAN_PAY' && _jsx(AiOPalawanPayDeposit, {}), paymentMethod === 'GCASH_WEBPAY' && _jsx(GCashWebpayDeposit, {}), paymentMethod === 'MAYA_WEBPAY' && _jsx(MayaWebpayDeposit, {}), paymentMethod === 'AURIX_PAY_GCASH' && AurixPayGCashDeposit && (_jsx(AurixPayGCashDeposit, {})), paymentMethod === 'AURIX_PAY_PAYMAYA' && AurixPayPayMayaDeposit && (_jsx(AurixPayPayMayaDeposit, {})), paymentMethod === 'AURIX_PAY_GRAB_PAY' && AurixPayGrabPayDeposit && (_jsx(AurixPayGrabPayDeposit, {})), paymentMethod === 'AURIX_PAY_QRPH' && AurixPayQRPHDeposit && (_jsx(AurixPayQRPHDeposit, {}))] })] }));
195
175
  }
196
176
  function MayaSessionSessionExpired() {
197
177
  return (_jsxs("div", { className: "py-xl", children: [_jsx("div", { className: "mx-auto flex size-12 items-center justify-center rounded-full bg-bg-warning-secondary", children: _jsx(AlertCircleIcon, { className: "size-6 text-text-featured-icon-light-warning" }) }), _jsx("h2", { className: "mt-lg text-center font-semibold text-lg", children: "Session Expired" }), _jsx("p", { className: "mx-auto mt-xs max-w-[25rem] text-center text-sm text-text-tertiary-600", children: "Your session has timed out. To continue with deposits or withdrawals, Please try reloading the app." })] }));
@@ -48,7 +48,7 @@ export declare const CREATE_AIO_QRPH_DEPOSIT = "\n mutation CreateAIOQRPHDeposi
48
48
  export declare const CREATE_AIO_ONLINE_BANK_DEPOSIT = "\n mutation CreateAIOOnlineBankDeposit(\n $input: CreateAIOOnlineBankDepositInput!\n ) {\n createAIOOnlineBankDeposit(input: $input) {\n ... on DepositPromoMaximumAmountExceededError {\n name: __typename\n message\n }\n ... on DepositPromoMinimumAmountNotMetError {\n name: __typename\n message\n }\n ... on MaximumDepositAmountExceededError {\n name: __typename\n message\n }\n ... on MinimumDepositAmountNotMetError {\n name: __typename\n message\n }\n ... on MinimumFirstDepositAmountNotMetError {\n name: __typename\n message\n }\n ... on PromoNotEnabledError {\n name: __typename\n message\n }\n ... on WalletDoesNotExistError {\n name: __typename\n message\n }\n }\n }\n";
49
49
  export declare const CREATE_MANUAL_BANK_DEPOSIT = "\n mutation CreateManualBankDeposit($input: CreateManualBankDepositInput!) {\n createManualBankDeposit(input: $input) {\n ... on WalletDoesNotExistError {\n name: __typename\n message\n }\n ... on MinimumFirstDepositAmountNotMetError {\n name: __typename\n message\n }\n ... on MinimumDepositAmountNotMetError {\n name: __typename\n message\n }\n ... on PromoNotEnabledError {\n name: __typename\n message\n }\n ... on DepositPromoMinimumAmountNotMetError {\n name: __typename\n message\n }\n ... on DepositPromoMaximumAmountExceededError {\n name: __typename\n message\n }\n ... on MaximumDepositAmountExceededError {\n name: __typename\n message\n }\n ... on FileDoesNotExistError {\n name: __typename\n message\n }\n ... on FileNotReadyError {\n name: __typename\n message\n }\n }\n }\n";
50
50
  export declare const CREATE_MANUAL_UPI_DEPOSIT = "\n mutation CreateManualUPIDeposit($input: CreateManualUPIDepositInput!) {\n createManualUPIDeposit(input: $input) {\n ... on DepositPromoMaximumAmountExceededError {\n name: __typename\n message\n }\n ... on DepositPromoMinimumAmountNotMetError {\n name: __typename\n message\n }\n ... on MaximumDepositAmountExceededError {\n name: __typename\n message\n }\n ... on MinimumDepositAmountNotMetError {\n name: __typename\n message\n }\n ... on MinimumFirstDepositAmountNotMetError {\n name: __typename\n message\n }\n ... on PromoNotEnabledError {\n name: __typename\n message\n }\n ... on WalletDoesNotExistError {\n name: __typename\n message\n }\n ... on UPIReferenceNotAvailableError {\n name: __typename\n message\n }\n }\n }\n";
51
- export declare const DEPOSIT: string;
51
+ export declare const DEPOSIT = "\n query Deposit($id: ObjectId!) {\n node(id: $id) {\n ... on GCashDeposit {\n id\n type\n status\n checkoutUrl\n error\n }\n ... on MayaDeposit {\n id\n type\n status\n checkoutUrl\n }\n ... on MayaAppDeposit {\n id\n type\n status\n error\n }\n ... on BankDeposit {\n id\n type\n status\n error\n }\n ... on ManualDeposit {\n id\n type\n status\n error\n }\n ... on QRPHDeposit {\n id\n type\n status\n qrCode\n error\n }\n ... on OnlineBankDeposit {\n id\n type\n status\n vca\n error\n }\n ... on GCashWebpayDeposit {\n id\n type\n status\n checkoutUrl\n error\n }\n ... on LibanganPayInDeposit {\n id\n type\n status\n checkoutUrl\n error\n }\n ... on PisoPayCheckoutDeposit {\n id\n type\n status\n checkoutUrl\n error\n }\n ... on AiOGCashDeposit {\n id\n type\n status\n checkoutUrl\n error\n } \n ... on AiOGrabPayDeposit {\n id\n type\n status\n checkoutUrl\n error\n } \n ... on AiOPalawanPayDeposit {\n id\n type\n status\n checkoutUrl\n error\n } \n ... on AiOPayMayaDeposit {\n id\n type\n status\n checkoutUrl\n error\n }\n ... on MayaWebpayDeposit {\n id\n type\n status\n checkoutUrl\n error\n }\n ... on AurixPayQRPHDeposit {\n id\n type\n status\n qrCode\n error\n }\n ... on AurixPayGCashDeposit {\n id\n type\n status\n checkoutUrl\n error\n }\n ... on AurixPayPayMayaDeposit {\n id\n type\n status\n checkoutUrl\n error\n }\n ... on AurixPayGrabPayDeposit {\n id\n type\n status\n checkoutUrl\n error\n }\n }\n }\n";
52
52
  export declare const DEPOSITS_COUNT = "\n query DepositsCount {\n member {\n depositsCount\n }\n }\n";
53
53
  export declare const TOUCH_GCASH_DEPOSIT = "\n mutation TouchGCashDeposit($input: TouchGCashDepositInput!) {\n touchGCashDeposit(input: $input)\n }\n";
54
54
  export declare const TOUCH_QRPH_DEPOSIT = "\n mutation TouchQRPHDeposit($input: TouchQRPHDepositInput!) {\n touchQRPHDeposit(input: $input)\n }\n";
@@ -1698,9 +1698,6 @@ export const DEPOSIT = /* GraphQL */ `
1698
1698
  checkoutUrl
1699
1699
  error
1700
1700
  }
1701
- ${process.env.NEXT_PUBLIC_ENVIRONMENT === 'development' ||
1702
- process.env.NEXT_PUBLIC_ENVIRONMENT === 'staging'
1703
- ? `
1704
1701
  ... on AurixPayQRPHDeposit {
1705
1702
  id
1706
1703
  type
@@ -1729,8 +1726,6 @@ export const DEPOSIT = /* GraphQL */ `
1729
1726
  checkoutUrl
1730
1727
  error
1731
1728
  }
1732
- `
1733
- : ''}
1734
1729
  }
1735
1730
  }
1736
1731
  `;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opexa/portal-components",
3
- "version": "0.0.916",
3
+ "version": "0.0.918",
4
4
  "exports": {
5
5
  "./ui/*": {
6
6
  "types": "./dist/ui/*/index.d.ts",