@timardex/cluemart-shared 1.7.0 → 1.7.2
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/ad-BUYzE6zx.d.ts +181 -0
- package/dist/ad-BhLoEul3.d.mts +181 -0
- package/dist/affiliate-BbtjeUP4.d.mts +73 -0
- package/dist/affiliate-C51nzKsw.d.ts +73 -0
- package/dist/apollo/index.cjs +1383 -0
- package/dist/apollo/index.cjs.map +1 -0
- package/dist/apollo/index.d.mts +323 -0
- package/dist/apollo/index.d.ts +323 -0
- package/dist/apollo/index.mjs +1295 -0
- package/dist/apollo/index.mjs.map +1 -0
- package/dist/auth/index.cjs +1727 -0
- package/dist/auth/index.cjs.map +1 -0
- package/dist/auth/index.d.mts +166 -0
- package/dist/auth/index.d.ts +166 -0
- package/dist/auth/index.mjs +380 -0
- package/dist/auth/index.mjs.map +1 -0
- package/dist/chunk-32MKHJTX.mjs +1207 -0
- package/dist/chunk-32MKHJTX.mjs.map +1 -0
- package/dist/{chunk-HZMP7GXC.mjs → chunk-447EYKHL.mjs} +1010 -2671
- package/dist/chunk-447EYKHL.mjs.map +1 -0
- package/dist/{chunk-RKIRWZCH.mjs → chunk-AYO3E4DM.mjs} +39 -183
- package/dist/chunk-AYO3E4DM.mjs.map +1 -0
- package/dist/{chunk-ZZJSCYJK.mjs → chunk-BIJ5NDXW.mjs} +46 -42
- package/dist/chunk-BIJ5NDXW.mjs.map +1 -0
- package/dist/chunk-DQ7ZHIXW.mjs +26 -0
- package/dist/chunk-DQ7ZHIXW.mjs.map +1 -0
- package/dist/{chunk-MVQ3CFQR.mjs → chunk-ILILH7E2.mjs} +12 -23
- package/dist/chunk-ILILH7E2.mjs.map +1 -0
- package/dist/{chunk-TAECMXM4.mjs → chunk-LBEJECG3.mjs} +249 -219
- package/dist/{chunk-TAECMXM4.mjs.map → chunk-LBEJECG3.mjs.map} +1 -1
- package/dist/chunk-RAYUJODN.mjs +45 -0
- package/dist/chunk-RAYUJODN.mjs.map +1 -0
- package/dist/chunk-SD42WIMV.mjs +297 -0
- package/dist/chunk-SD42WIMV.mjs.map +1 -0
- package/dist/chunk-VPANTTZI.mjs +262 -0
- package/dist/chunk-VPANTTZI.mjs.map +1 -0
- package/dist/{chunk-KZTOISPA.mjs → chunk-X3OLM35T.mjs} +14 -8
- package/dist/chunk-X3OLM35T.mjs.map +1 -0
- package/dist/{contactUs-H7799pWe.d.ts → contactUs--NoohZBu.d.ts} +1 -1
- package/dist/{contactUs-DGrDzJaM.d.mts → contactUs-CBWzefUS.d.mts} +1 -1
- package/dist/enums/index.cjs +13 -7
- package/dist/enums/index.cjs.map +1 -1
- package/dist/enums/index.d.mts +15 -9
- package/dist/enums/index.d.ts +15 -9
- package/dist/enums/index.mjs +1 -1
- package/dist/formFields/index.cjs +136 -73
- package/dist/formFields/index.cjs.map +1 -1
- package/dist/formFields/index.d.mts +3 -2
- package/dist/formFields/index.d.ts +3 -2
- package/dist/formFields/index.mjs +9 -4
- package/dist/{global-fKbMmluy.d.ts → global-CUYYxpy2.d.ts} +12 -11
- package/dist/{global-BUUfmCo7.d.mts → global-DePDtOFt.d.mts} +12 -11
- package/dist/graphql/index.cjs +734 -1271
- package/dist/graphql/index.cjs.map +1 -1
- package/dist/graphql/index.d.mts +434 -176
- package/dist/graphql/index.d.ts +434 -176
- package/dist/graphql/index.mjs +37 -23
- package/dist/hooks/index.cjs +947 -309
- package/dist/hooks/index.cjs.map +1 -1
- package/dist/hooks/index.d.mts +10 -4
- package/dist/hooks/index.d.ts +10 -4
- package/dist/hooks/index.mjs +170 -58
- package/dist/hooks/index.mjs.map +1 -1
- package/dist/images/apple-maps-icon.webp.d.ts +8 -1
- package/dist/images/banner-horizontal.webp.d.ts +8 -1
- package/dist/images/banner-vertical.webp.d.ts +8 -1
- package/dist/images/cluiTui.webp.d.ts +8 -1
- package/dist/images/corporate.webp.d.ts +8 -1
- package/dist/images/facebook.webp.d.ts +8 -1
- package/dist/images/gazebo-top.webp.d.ts +8 -1
- package/dist/images/google-maps-icon.webp.d.ts +8 -1
- package/dist/images/googleMaps-logo-dark.webp.d.ts +8 -1
- package/dist/images/googleMaps-logo-light.webp.d.ts +8 -1
- package/dist/images/instagram.webp.d.ts +8 -1
- package/dist/images/logo-atr.webp.d.ts +8 -1
- package/dist/images/logo-dark.webp.d.ts +8 -1
- package/dist/images/logo.webp.d.ts +8 -1
- package/dist/images/meet.webp.d.ts +8 -1
- package/dist/images/mini-market1.webp.d.ts +8 -1
- package/dist/images/mini-market2.webp.d.ts +8 -1
- package/dist/images/mini-market3.webp.d.ts +8 -1
- package/dist/images/mini-market4.webp.d.ts +8 -1
- package/dist/images/mini-market5.webp.d.ts +8 -1
- package/dist/images/poll.webp.d.ts +8 -1
- package/dist/images/poster1.webp.d.ts +8 -1
- package/dist/images/poster2.webp.d.ts +8 -1
- package/dist/images/poster3.webp.d.ts +8 -1
- package/dist/images/poster4.webp.d.ts +8 -1
- package/dist/images/private.webp.d.ts +8 -1
- package/dist/images/qr-code.webp.d.ts +8 -1
- package/dist/images/school.webp.d.ts +8 -1
- package/dist/images/sima.webp.d.ts +8 -1
- package/dist/images/store-android.webp.d.ts +8 -1
- package/dist/images/store-ios.webp.d.ts +8 -1
- package/dist/images/tablas.webp.d.ts +8 -1
- package/dist/images/telefonos.webp.d.ts +8 -1
- package/dist/images/tiktok.webp.d.ts +8 -1
- package/dist/images/tip.webp.d.ts +8 -1
- package/dist/images/ugralos.webp.d.ts +8 -1
- package/dist/images/waze-maps-icon.webp.d.ts +8 -1
- package/dist/images/website.webp.d.ts +8 -1
- package/dist/images/youtube.webp.d.ts +8 -1
- package/dist/index.cjs +1751 -1781
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +665 -243
- package/dist/index.d.ts +665 -243
- package/dist/index.mjs +1711 -1779
- package/dist/index.mjs.map +1 -1
- package/dist/map/index.cjs +14 -9
- package/dist/map/index.cjs.map +1 -1
- package/dist/map/index.d.mts +16 -13
- package/dist/map/index.d.ts +16 -13
- package/dist/map/index.mjs +14 -9
- package/dist/map/index.mjs.map +1 -1
- package/dist/{resourceActivities-BL_12IAo.d.ts → resourceActivities-CMUcn2P7.d.ts} +9 -4
- package/dist/{resourceActivities-zczOntNk.d.mts → resourceActivities-CwbJFGIp.d.mts} +9 -4
- package/dist/sharing/index.cjs +39 -1252
- package/dist/sharing/index.cjs.map +1 -1
- package/dist/sharing/index.d.mts +17 -5
- package/dist/sharing/index.d.ts +17 -5
- package/dist/sharing/index.mjs +34 -30
- package/dist/subscription-BU8GvH2K.d.ts +12 -0
- package/dist/subscription-bmAdrnfi.d.mts +12 -0
- package/dist/types/index.cjs +15 -2
- package/dist/types/index.cjs.map +1 -1
- package/dist/types/index.d.mts +10 -23
- package/dist/types/index.d.ts +10 -23
- package/dist/types/index.mjs +9 -5
- package/dist/user-D47MLFyH.d.ts +134 -0
- package/dist/user-DE8edl3u.d.mts +134 -0
- package/dist/utils/index.cjs +355 -136
- package/dist/utils/index.cjs.map +1 -1
- package/dist/utils/index.d.mts +87 -35
- package/dist/utils/index.d.ts +87 -35
- package/dist/utils/index.mjs +42 -15
- package/package.json +31 -10
- package/dist/ad-CVkVX_z5.d.ts +0 -296
- package/dist/ad-DA9ECAhK.d.mts +0 -296
- package/dist/affiliate-1RtkLnLP.d.ts +0 -35
- package/dist/affiliate-Cos2Syz5.d.mts +0 -35
- package/dist/chunk-HZMP7GXC.mjs.map +0 -1
- package/dist/chunk-KZTOISPA.mjs.map +0 -1
- package/dist/chunk-MVQ3CFQR.mjs.map +0 -1
- package/dist/chunk-RKIRWZCH.mjs.map +0 -1
- package/dist/chunk-ZZJSCYJK.mjs.map +0 -1
package/dist/hooks/index.d.mts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
import { L as LocationType,
|
|
2
|
-
import { U as UserFormData, C as CreateUserFormData
|
|
3
|
-
import { C as
|
|
1
|
+
import { L as LocationType, m as VendorFormData, n as CreateVendorFormData, o as VendorInfoFormData, p as CreateVendorInfoFormData, q as UnregisteredVendorFormData, r as CreateUnregisteredVendorFormData, s as EventFormData, t as CreateEventFormData, u as EventInfoFormData, v as CreateEventInfoFormData, B as BaseResourceTypeFormData, w as PostFormData, x as CreatePostFormData } from '../global-DePDtOFt.mjs';
|
|
2
|
+
import { U as UserFormData, C as CreateUserFormData } from '../user-DE8edl3u.mjs';
|
|
3
|
+
import { C as CreateLoginFormData, d as CreateRegisterFormData, e as CreateRequestPasswordResetFormData, f as CreateValidateVerificationTokenFormData, g as CreateResetPasswordFormData, h as PartnerFormData, i as AdFormData, j as CreateAdFormState, k as CreatePartnerFormData, l as AppSettingsFormData, m as CreateAppSettingsFormData, n as SchoolFormData, o as CreateSchoolFormData } from '../ad-BhLoEul3.mjs';
|
|
4
|
+
import { a as AffiliateFormData, A as AffiliateType, C as CreateAffiliateFormData } from '../affiliate-BbtjeUP4.mjs';
|
|
5
|
+
import { C as ContactUsFormData, a as CreateContactUsFormData } from '../contactUs-CBWzefUS.mjs';
|
|
4
6
|
import 'react-hook-form';
|
|
5
7
|
import '../enums/index.mjs';
|
|
6
8
|
import '../images/index.mjs';
|
|
@@ -90,6 +92,8 @@ declare const defaultEventInfoFormValues: EventInfoFormData;
|
|
|
90
92
|
declare const defaultVendorFormValues: VendorFormData;
|
|
91
93
|
declare const defaultUnregisteredVendorFormValues: UnregisteredVendorFormData;
|
|
92
94
|
declare const defaultVendorInfoFormValues: VendorInfoFormData;
|
|
95
|
+
declare const defaultAffiliateFormValues: AffiliateFormData;
|
|
96
|
+
declare function mapAffiliateToFormData(affiliate: Pick<AffiliateType, "affiliateDetails">): AffiliateFormData;
|
|
93
97
|
declare function mapBaseResourceTypeToFormData(data: BaseResourceTypeFormData): BaseResourceTypeFormData;
|
|
94
98
|
|
|
95
99
|
declare function useContactUsForm(data?: ContactUsFormData): CreateContactUsFormData;
|
|
@@ -110,4 +114,6 @@ declare function useAppSettingsForm(data?: AppSettingsFormData): CreateAppSettin
|
|
|
110
114
|
|
|
111
115
|
declare function useSchoolForm(data?: SchoolFormData): CreateSchoolFormData;
|
|
112
116
|
|
|
113
|
-
|
|
117
|
+
declare function useAffiliateForm(data: AffiliateFormData): CreateAffiliateFormData;
|
|
118
|
+
|
|
119
|
+
export { type PlacePrediction, defaultAffiliateFormValues, defaultEventFormValues, defaultEventInfoFormValues, defaultLocation, defaultPartnerFormValues, defaultUnregisteredVendorFormValues, defaultVendorFormValues, defaultVendorInfoFormValues, globalDefaultValues, mapAffiliateToFormData, mapBaseResourceTypeToFormData, useAdForm, useAffiliateForm, useAppSettingsForm, useContactUsForm, useEventForm, useEventInfoForm, useLocationSearch, useLoginForm, usePartnerForm, usePostForm, useRegisterForm, useRequestPasswordResetForm, useResetPasswordForm, useSchoolForm, useUnregisteredVendorForm, useUserForm, useValidateVerificationTokenForm, useVendorForm, useVendorInfoForm };
|
package/dist/hooks/index.d.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
import { L as LocationType,
|
|
2
|
-
import { U as UserFormData, C as CreateUserFormData
|
|
3
|
-
import { C as
|
|
1
|
+
import { L as LocationType, m as VendorFormData, n as CreateVendorFormData, o as VendorInfoFormData, p as CreateVendorInfoFormData, q as UnregisteredVendorFormData, r as CreateUnregisteredVendorFormData, s as EventFormData, t as CreateEventFormData, u as EventInfoFormData, v as CreateEventInfoFormData, B as BaseResourceTypeFormData, w as PostFormData, x as CreatePostFormData } from '../global-CUYYxpy2.js';
|
|
2
|
+
import { U as UserFormData, C as CreateUserFormData } from '../user-D47MLFyH.js';
|
|
3
|
+
import { C as CreateLoginFormData, d as CreateRegisterFormData, e as CreateRequestPasswordResetFormData, f as CreateValidateVerificationTokenFormData, g as CreateResetPasswordFormData, h as PartnerFormData, i as AdFormData, j as CreateAdFormState, k as CreatePartnerFormData, l as AppSettingsFormData, m as CreateAppSettingsFormData, n as SchoolFormData, o as CreateSchoolFormData } from '../ad-BUYzE6zx.js';
|
|
4
|
+
import { a as AffiliateFormData, A as AffiliateType, C as CreateAffiliateFormData } from '../affiliate-C51nzKsw.js';
|
|
5
|
+
import { C as ContactUsFormData, a as CreateContactUsFormData } from '../contactUs--NoohZBu.js';
|
|
4
6
|
import 'react-hook-form';
|
|
5
7
|
import '../enums/index.js';
|
|
6
8
|
import '../images/index.js';
|
|
@@ -90,6 +92,8 @@ declare const defaultEventInfoFormValues: EventInfoFormData;
|
|
|
90
92
|
declare const defaultVendorFormValues: VendorFormData;
|
|
91
93
|
declare const defaultUnregisteredVendorFormValues: UnregisteredVendorFormData;
|
|
92
94
|
declare const defaultVendorInfoFormValues: VendorInfoFormData;
|
|
95
|
+
declare const defaultAffiliateFormValues: AffiliateFormData;
|
|
96
|
+
declare function mapAffiliateToFormData(affiliate: Pick<AffiliateType, "affiliateDetails">): AffiliateFormData;
|
|
93
97
|
declare function mapBaseResourceTypeToFormData(data: BaseResourceTypeFormData): BaseResourceTypeFormData;
|
|
94
98
|
|
|
95
99
|
declare function useContactUsForm(data?: ContactUsFormData): CreateContactUsFormData;
|
|
@@ -110,4 +114,6 @@ declare function useAppSettingsForm(data?: AppSettingsFormData): CreateAppSettin
|
|
|
110
114
|
|
|
111
115
|
declare function useSchoolForm(data?: SchoolFormData): CreateSchoolFormData;
|
|
112
116
|
|
|
113
|
-
|
|
117
|
+
declare function useAffiliateForm(data: AffiliateFormData): CreateAffiliateFormData;
|
|
118
|
+
|
|
119
|
+
export { type PlacePrediction, defaultAffiliateFormValues, defaultEventFormValues, defaultEventInfoFormValues, defaultLocation, defaultPartnerFormValues, defaultUnregisteredVendorFormValues, defaultVendorFormValues, defaultVendorInfoFormValues, globalDefaultValues, mapAffiliateToFormData, mapBaseResourceTypeToFormData, useAdForm, useAffiliateForm, useAppSettingsForm, useContactUsForm, useEventForm, useEventInfoForm, useLocationSearch, useLoginForm, usePartnerForm, usePostForm, useRegisterForm, useRequestPasswordResetForm, useResetPasswordForm, useSchoolForm, useUnregisteredVendorForm, useUserForm, useValidateVerificationTokenForm, useVendorForm, useVendorInfoForm };
|
package/dist/hooks/index.mjs
CHANGED
|
@@ -1,22 +1,30 @@
|
|
|
1
|
+
import "../chunk-AYO3E4DM.mjs";
|
|
1
2
|
import "../chunk-VA5YN2K3.mjs";
|
|
2
|
-
import "../chunk-
|
|
3
|
-
import "../chunk-
|
|
4
|
-
import "../chunk-
|
|
5
|
-
import "../chunk-RKIRWZCH.mjs";
|
|
3
|
+
import "../chunk-VPANTTZI.mjs";
|
|
4
|
+
import "../chunk-DWO35OY4.mjs";
|
|
5
|
+
import "../chunk-BIJ5NDXW.mjs";
|
|
6
6
|
import {
|
|
7
7
|
SCHOOL_MIN_STUDENT_COUNT,
|
|
8
|
+
isValidIrdNumber,
|
|
9
|
+
normalizeUrl
|
|
10
|
+
} from "../chunk-LBEJECG3.mjs";
|
|
11
|
+
import {
|
|
8
12
|
dateFormat,
|
|
9
|
-
normalizeUrl,
|
|
10
13
|
timeFormat
|
|
11
|
-
} from "../chunk-
|
|
14
|
+
} from "../chunk-SD42WIMV.mjs";
|
|
12
15
|
import {
|
|
13
16
|
EnumAdShowOn,
|
|
14
17
|
EnumAdStatus,
|
|
15
18
|
EnumAdStyle,
|
|
16
19
|
EnumAdType,
|
|
20
|
+
EnumAffiliateParticipantType,
|
|
17
21
|
EnumPostContentType,
|
|
18
22
|
EnumPostType
|
|
19
|
-
} from "../chunk-
|
|
23
|
+
} from "../chunk-ILILH7E2.mjs";
|
|
24
|
+
import "../chunk-RAYUJODN.mjs";
|
|
25
|
+
import "../chunk-DQ7ZHIXW.mjs";
|
|
26
|
+
import "../chunk-447EYKHL.mjs";
|
|
27
|
+
import "../chunk-32MKHJTX.mjs";
|
|
20
28
|
import {
|
|
21
29
|
EnumEventDateStatus,
|
|
22
30
|
EnumEventType,
|
|
@@ -25,11 +33,9 @@ import {
|
|
|
25
33
|
EnumPaymentMethod,
|
|
26
34
|
EnumResourceType,
|
|
27
35
|
EnumSocialMedia,
|
|
28
|
-
EnumUserLicence,
|
|
29
|
-
EnumUserRole,
|
|
30
36
|
EnumVendorType
|
|
31
|
-
} from "../chunk-
|
|
32
|
-
import "../chunk-
|
|
37
|
+
} from "../chunk-X3OLM35T.mjs";
|
|
38
|
+
import "../chunk-NPFJ2CN2.mjs";
|
|
33
39
|
|
|
34
40
|
// src/hooks/useLocationSearch.ts
|
|
35
41
|
var handleApiError = (error, message) => {
|
|
@@ -142,10 +148,9 @@ import customParseFormat from "dayjs/plugin/customParseFormat.js";
|
|
|
142
148
|
import isSameOrAfter from "dayjs/plugin/isSameOrAfter.js";
|
|
143
149
|
import * as yup from "yup";
|
|
144
150
|
var nzBankAccountRegex = /^\d{2}-\d{4}-\d{7}-\d{2}$/;
|
|
151
|
+
var nzIrdNumberRegex = /^\d{3}-\d{3}-\d{2,3}$/;
|
|
145
152
|
var nzbnRegex = /^94\d{11}$/;
|
|
146
153
|
var normalizedUrlTransform = () => yup.string().trim().transform(
|
|
147
|
-
(value) => typeof value === "string" ? value.toLowerCase() : value
|
|
148
|
-
).transform(
|
|
149
154
|
(value) => typeof value === "string" ? normalizeUrl(value) : value
|
|
150
155
|
);
|
|
151
156
|
var noLeadingZeros = (fieldName, options = {}) => {
|
|
@@ -320,19 +325,7 @@ var globalResourceSchema = yup.object().shape({
|
|
|
320
325
|
description: yup.string().label("Description").trim().min(50).required("Description is required"),
|
|
321
326
|
name: yup.string().label("Name").trim().min(3).required("Name is required"),
|
|
322
327
|
region: yup.string().label("Region").required("Region is required"),
|
|
323
|
-
socialMedia: yup.array().of(socialMediaSchema).nullable().default(null)
|
|
324
|
-
associates: yup.array().of(
|
|
325
|
-
yup.object().shape({
|
|
326
|
-
email: emailRequiredSchema,
|
|
327
|
-
resourceId: yup.string().label("Resource ID").required("Resource ID is required"),
|
|
328
|
-
resourceType: yup.mixed().oneOf(Object.values(EnumResourceType)).label("Resource Type").required("Resource Type is required"),
|
|
329
|
-
licence: yup.object({
|
|
330
|
-
expiryDate: yup.date().required("Expiry Date is required"),
|
|
331
|
-
issuedDate: yup.date().required("Issued Date is required"),
|
|
332
|
-
licenceType: yup.mixed().oneOf(Object.values(EnumUserLicence)).label("Licence Type").required("Licence Type is required")
|
|
333
|
-
})
|
|
334
|
-
})
|
|
335
|
-
).nullable().default(null)
|
|
328
|
+
socialMedia: yup.array().of(socialMediaSchema).nullable().default(null)
|
|
336
329
|
});
|
|
337
330
|
var categorySchema = yup.array().of(
|
|
338
331
|
yup.object().shape({
|
|
@@ -468,7 +461,7 @@ var vendorInfoSchema = yup3.object().shape({
|
|
|
468
461
|
max: yup3.string().required("Max price is required").test(
|
|
469
462
|
"is-number",
|
|
470
463
|
"Max price must be a valid number",
|
|
471
|
-
(value) => value !== void 0 && value !== "" && !isNaN(Number(value))
|
|
464
|
+
(value) => value !== void 0 && value !== "" && !Number.isNaN(Number(value))
|
|
472
465
|
).test(
|
|
473
466
|
"is-greater",
|
|
474
467
|
"Max price must be greater than or equal to Min price",
|
|
@@ -477,14 +470,14 @@ var vendorInfoSchema = yup3.object().shape({
|
|
|
477
470
|
if (!max || !min) return true;
|
|
478
471
|
const maxNum = Number(max);
|
|
479
472
|
const minNum = Number(min);
|
|
480
|
-
if (isNaN(maxNum) || isNaN(minNum)) return true;
|
|
473
|
+
if (Number.isNaN(maxNum) || Number.isNaN(minNum)) return true;
|
|
481
474
|
return maxNum >= minNum;
|
|
482
475
|
}
|
|
483
476
|
),
|
|
484
477
|
min: yup3.string().required("Min price is required").test(
|
|
485
478
|
"is-number",
|
|
486
479
|
"Min price must be a valid number",
|
|
487
|
-
(value) => value !== void 0 && value !== "" && !isNaN(Number(value))
|
|
480
|
+
(value) => value !== void 0 && value !== "" && !Number.isNaN(Number(value))
|
|
488
481
|
)
|
|
489
482
|
}),
|
|
490
483
|
producedIn: yup3.array().of(yup3.string().defined()).min(1, "Produced in list must contain at least one item").required("Produced in is required")
|
|
@@ -526,7 +519,7 @@ var vendorInfoSchema = yup3.object().shape({
|
|
|
526
519
|
depth: yup3.string().required("Depth is required").test(
|
|
527
520
|
"is-number",
|
|
528
521
|
"Depth must be a valid number",
|
|
529
|
-
(value) => value !== void 0 && value !== "" && !isNaN(Number(value))
|
|
522
|
+
(value) => value !== void 0 && value !== "" && !Number.isNaN(Number(value))
|
|
530
523
|
).test(
|
|
531
524
|
"is-positive",
|
|
532
525
|
"Depth must be greater than 0",
|
|
@@ -535,7 +528,7 @@ var vendorInfoSchema = yup3.object().shape({
|
|
|
535
528
|
width: yup3.string().required("Width is required").test(
|
|
536
529
|
"is-number",
|
|
537
530
|
"Width must be a valid number",
|
|
538
|
-
(value) => value !== void 0 && value !== "" && !isNaN(Number(value))
|
|
531
|
+
(value) => value !== void 0 && value !== "" && !Number.isNaN(Number(value))
|
|
539
532
|
).test(
|
|
540
533
|
"is-positive",
|
|
541
534
|
"Width must be greater than 0",
|
|
@@ -561,8 +554,7 @@ var userSchema = yup4.object().shape({
|
|
|
561
554
|
// only necessary if password typed
|
|
562
555
|
then: (schema) => schema.required("Confirm Password is required").oneOf([yup4.ref("password")], "Passwords must match"),
|
|
563
556
|
otherwise: (schema) => schema.notRequired()
|
|
564
|
-
})
|
|
565
|
-
role: yup4.mixed().oneOf(Object.values(EnumUserRole)).required("Role is required")
|
|
557
|
+
})
|
|
566
558
|
});
|
|
567
559
|
|
|
568
560
|
// src/yupSchema/auth.ts
|
|
@@ -677,7 +669,8 @@ var appSettingsSchema = yup9.object({
|
|
|
677
669
|
/^\d+\.\d+\.\d+$/,
|
|
678
670
|
"App Version must be in the format X.Y.Z (e.g. 1.12.50)"
|
|
679
671
|
).required("App Version is required"),
|
|
680
|
-
isOfflineMode: yup9.boolean().label("Is Offline Mode").required("Is Offline Mode is required")
|
|
672
|
+
isOfflineMode: yup9.boolean().label("Is Offline Mode").required("Is Offline Mode is required"),
|
|
673
|
+
minimumRedeemableAffiliatePoints: yup9.number().label("Minimum Redeemable Affiliate Points").min(0, "Minimum Redeemable Affiliate Points must be greater than 0").required("Minimum Redeemable Affiliate Points is required")
|
|
681
674
|
});
|
|
682
675
|
|
|
683
676
|
// src/hooks/utils.ts
|
|
@@ -696,7 +689,6 @@ var defaultLocation = {
|
|
|
696
689
|
};
|
|
697
690
|
var globalDefaultValues = {
|
|
698
691
|
active: false,
|
|
699
|
-
associates: null,
|
|
700
692
|
contactDetails: {
|
|
701
693
|
email: null,
|
|
702
694
|
landlinePhone: null,
|
|
@@ -793,11 +785,40 @@ var defaultVendorInfoFormValues = {
|
|
|
793
785
|
},
|
|
794
786
|
vendorId: ""
|
|
795
787
|
};
|
|
788
|
+
var defaultAffiliateFormValues = {
|
|
789
|
+
bankAccountDetails: {
|
|
790
|
+
accountHolderName: "",
|
|
791
|
+
accountNumber: ""
|
|
792
|
+
},
|
|
793
|
+
contactDetails: {
|
|
794
|
+
mobilePhone: ""
|
|
795
|
+
},
|
|
796
|
+
irdNumber: "",
|
|
797
|
+
location: defaultLocation,
|
|
798
|
+
participantType: "",
|
|
799
|
+
socialMedia: null,
|
|
800
|
+
termsAgreement: null
|
|
801
|
+
};
|
|
802
|
+
function mapAffiliateToFormData(affiliate) {
|
|
803
|
+
return {
|
|
804
|
+
bankAccountDetails: affiliate.affiliateDetails?.bankAccountDetails ?? {
|
|
805
|
+
accountHolderName: "",
|
|
806
|
+
accountNumber: ""
|
|
807
|
+
},
|
|
808
|
+
contactDetails: affiliate.affiliateDetails?.contactDetails ?? {
|
|
809
|
+
mobilePhone: ""
|
|
810
|
+
},
|
|
811
|
+
irdNumber: affiliate.affiliateDetails?.irdNumber ?? "",
|
|
812
|
+
location: affiliate.affiliateDetails?.location ?? defaultLocation,
|
|
813
|
+
participantType: affiliate.affiliateDetails?.participantType ?? "",
|
|
814
|
+
socialMedia: affiliate.affiliateDetails?.socialMedia ?? null,
|
|
815
|
+
termsAgreement: affiliate.affiliateDetails?.termsAgreement ?? null
|
|
816
|
+
};
|
|
817
|
+
}
|
|
796
818
|
function mapBaseResourceTypeToFormData(data) {
|
|
797
819
|
return {
|
|
798
820
|
_id: data._id,
|
|
799
821
|
active: data.active,
|
|
800
|
-
associates: data.associates,
|
|
801
822
|
contactDetails: data.contactDetails,
|
|
802
823
|
cover: data.cover,
|
|
803
824
|
coverUpload: data.coverUpload ?? null,
|
|
@@ -807,7 +828,6 @@ function mapBaseResourceTypeToFormData(data) {
|
|
|
807
828
|
logo: data.logo,
|
|
808
829
|
logoUpload: data.logoUpload ?? null,
|
|
809
830
|
name: data.name,
|
|
810
|
-
owner: data.owner,
|
|
811
831
|
promoCodes: data.promoCodes,
|
|
812
832
|
region: data.region,
|
|
813
833
|
socialMedia: data.socialMedia,
|
|
@@ -849,7 +869,6 @@ function useVendorForm(data) {
|
|
|
849
869
|
const {
|
|
850
870
|
_id,
|
|
851
871
|
active,
|
|
852
|
-
associates,
|
|
853
872
|
availability,
|
|
854
873
|
calendar,
|
|
855
874
|
categories,
|
|
@@ -864,7 +883,6 @@ function useVendorForm(data) {
|
|
|
864
883
|
logo,
|
|
865
884
|
logoUpload,
|
|
866
885
|
name,
|
|
867
|
-
owner,
|
|
868
886
|
products,
|
|
869
887
|
promoCodes,
|
|
870
888
|
region,
|
|
@@ -878,7 +896,6 @@ function useVendorForm(data) {
|
|
|
878
896
|
fields: {
|
|
879
897
|
_id,
|
|
880
898
|
active,
|
|
881
|
-
associates,
|
|
882
899
|
availability,
|
|
883
900
|
calendar,
|
|
884
901
|
categories,
|
|
@@ -893,7 +910,6 @@ function useVendorForm(data) {
|
|
|
893
910
|
logo,
|
|
894
911
|
logoUpload,
|
|
895
912
|
name,
|
|
896
|
-
owner,
|
|
897
913
|
products,
|
|
898
914
|
promoCodes,
|
|
899
915
|
region,
|
|
@@ -1064,7 +1080,6 @@ function useEventForm(data) {
|
|
|
1064
1080
|
const {
|
|
1065
1081
|
_id,
|
|
1066
1082
|
active,
|
|
1067
|
-
associates,
|
|
1068
1083
|
claimed,
|
|
1069
1084
|
contactDetails,
|
|
1070
1085
|
cover,
|
|
@@ -1080,7 +1095,6 @@ function useEventForm(data) {
|
|
|
1080
1095
|
logoUpload,
|
|
1081
1096
|
name,
|
|
1082
1097
|
nzbn,
|
|
1083
|
-
owner,
|
|
1084
1098
|
promoCodes,
|
|
1085
1099
|
provider,
|
|
1086
1100
|
rainOrShine,
|
|
@@ -1094,7 +1108,6 @@ function useEventForm(data) {
|
|
|
1094
1108
|
fields: {
|
|
1095
1109
|
_id,
|
|
1096
1110
|
active,
|
|
1097
|
-
associates,
|
|
1098
1111
|
claimed,
|
|
1099
1112
|
contactDetails,
|
|
1100
1113
|
cover,
|
|
@@ -1110,7 +1123,6 @@ function useEventForm(data) {
|
|
|
1110
1123
|
logoUpload,
|
|
1111
1124
|
name,
|
|
1112
1125
|
nzbn,
|
|
1113
|
-
owner,
|
|
1114
1126
|
promoCodes,
|
|
1115
1127
|
provider,
|
|
1116
1128
|
rainOrShine,
|
|
@@ -1210,8 +1222,7 @@ var defaultValues = {
|
|
|
1210
1222
|
lastName: "",
|
|
1211
1223
|
location: null,
|
|
1212
1224
|
password: null,
|
|
1213
|
-
preferredRegion: ""
|
|
1214
|
-
role: "customer" /* CUSTOMER */
|
|
1225
|
+
preferredRegion: ""
|
|
1215
1226
|
};
|
|
1216
1227
|
function useUserForm(data) {
|
|
1217
1228
|
const {
|
|
@@ -1240,7 +1251,6 @@ function useUserForm(data) {
|
|
|
1240
1251
|
location: data.location,
|
|
1241
1252
|
password: data.password,
|
|
1242
1253
|
preferredRegion: data.preferredRegion,
|
|
1243
|
-
role: data.role,
|
|
1244
1254
|
termsAgreement: data.termsAgreement
|
|
1245
1255
|
});
|
|
1246
1256
|
} else {
|
|
@@ -1259,7 +1269,6 @@ function useUserForm(data) {
|
|
|
1259
1269
|
location,
|
|
1260
1270
|
password,
|
|
1261
1271
|
preferredRegion,
|
|
1262
|
-
role,
|
|
1263
1272
|
termsAgreement
|
|
1264
1273
|
} = getValues();
|
|
1265
1274
|
return {
|
|
@@ -1276,7 +1285,6 @@ function useUserForm(data) {
|
|
|
1276
1285
|
location,
|
|
1277
1286
|
password,
|
|
1278
1287
|
preferredRegion,
|
|
1279
|
-
role,
|
|
1280
1288
|
termsAgreement
|
|
1281
1289
|
},
|
|
1282
1290
|
formState,
|
|
@@ -1657,7 +1665,6 @@ function usePartnerForm(data) {
|
|
|
1657
1665
|
const {
|
|
1658
1666
|
_id,
|
|
1659
1667
|
active,
|
|
1660
|
-
associates,
|
|
1661
1668
|
contactDetails,
|
|
1662
1669
|
cover,
|
|
1663
1670
|
coverUpload,
|
|
@@ -1669,7 +1676,6 @@ function usePartnerForm(data) {
|
|
|
1669
1676
|
logoUpload,
|
|
1670
1677
|
name,
|
|
1671
1678
|
nzbn,
|
|
1672
|
-
owner,
|
|
1673
1679
|
partnerType,
|
|
1674
1680
|
promoCodes,
|
|
1675
1681
|
region,
|
|
@@ -1681,7 +1687,6 @@ function usePartnerForm(data) {
|
|
|
1681
1687
|
fields: {
|
|
1682
1688
|
_id,
|
|
1683
1689
|
active,
|
|
1684
|
-
associates,
|
|
1685
1690
|
contactDetails,
|
|
1686
1691
|
cover,
|
|
1687
1692
|
coverUpload,
|
|
@@ -1693,7 +1698,6 @@ function usePartnerForm(data) {
|
|
|
1693
1698
|
logoUpload,
|
|
1694
1699
|
name,
|
|
1695
1700
|
nzbn,
|
|
1696
|
-
owner,
|
|
1697
1701
|
partnerType,
|
|
1698
1702
|
promoCodes,
|
|
1699
1703
|
region,
|
|
@@ -1793,7 +1797,8 @@ import React11 from "react";
|
|
|
1793
1797
|
import { useForm as useForm16 } from "react-hook-form";
|
|
1794
1798
|
var defaultValues10 = {
|
|
1795
1799
|
appVersion: "",
|
|
1796
|
-
isOfflineMode: false
|
|
1800
|
+
isOfflineMode: false,
|
|
1801
|
+
minimumRedeemableAffiliatePoints: 0
|
|
1797
1802
|
};
|
|
1798
1803
|
function useAppSettingsForm(data) {
|
|
1799
1804
|
const {
|
|
@@ -1812,18 +1817,20 @@ function useAppSettingsForm(data) {
|
|
|
1812
1817
|
if (data) {
|
|
1813
1818
|
reset({
|
|
1814
1819
|
appVersion: data.appVersion,
|
|
1815
|
-
isOfflineMode: data.isOfflineMode
|
|
1820
|
+
isOfflineMode: data.isOfflineMode,
|
|
1821
|
+
minimumRedeemableAffiliatePoints: data.minimumRedeemableAffiliatePoints
|
|
1816
1822
|
});
|
|
1817
1823
|
} else {
|
|
1818
1824
|
reset(defaultValues10);
|
|
1819
1825
|
}
|
|
1820
1826
|
}, [data]);
|
|
1821
|
-
const { appVersion, isOfflineMode } = getValues();
|
|
1827
|
+
const { appVersion, isOfflineMode, minimumRedeemableAffiliatePoints } = getValues();
|
|
1822
1828
|
return {
|
|
1823
1829
|
control,
|
|
1824
1830
|
fields: {
|
|
1825
1831
|
appVersion,
|
|
1826
|
-
isOfflineMode
|
|
1832
|
+
isOfflineMode,
|
|
1833
|
+
minimumRedeemableAffiliatePoints
|
|
1827
1834
|
},
|
|
1828
1835
|
formState,
|
|
1829
1836
|
getValues,
|
|
@@ -1936,7 +1943,110 @@ function useSchoolForm(data) {
|
|
|
1936
1943
|
watch
|
|
1937
1944
|
};
|
|
1938
1945
|
}
|
|
1946
|
+
|
|
1947
|
+
// src/hooks/useAffiliateForm.ts
|
|
1948
|
+
import { yupResolver as yupResolver18 } from "@hookform/resolvers/yup";
|
|
1949
|
+
import { useEffect as useEffect9 } from "react";
|
|
1950
|
+
import { useForm as useForm18 } from "react-hook-form";
|
|
1951
|
+
|
|
1952
|
+
// src/yupSchema/affiliate.ts
|
|
1953
|
+
import * as yup12 from "yup";
|
|
1954
|
+
var affiliateContactDetailsSchema = yup12.object({
|
|
1955
|
+
mobilePhone: yup12.string().trim().required("Mobile phone is required").test(
|
|
1956
|
+
"mobile-phone",
|
|
1957
|
+
"Mobile must start with 02 and be 9\u201311 digits",
|
|
1958
|
+
(value) => mobileRegex.test(value)
|
|
1959
|
+
)
|
|
1960
|
+
});
|
|
1961
|
+
var bankAccountDetailsSchema = yup12.object({
|
|
1962
|
+
accountHolderName: yup12.string().required("Account holder name is required"),
|
|
1963
|
+
accountNumber: yup12.string().required("Account number is required for bank transfer").matches(
|
|
1964
|
+
nzBankAccountRegex,
|
|
1965
|
+
"Account number must be in format: XX-XXXX-XXXXXXX-XX"
|
|
1966
|
+
).trim()
|
|
1967
|
+
});
|
|
1968
|
+
var affiliateSchema = yup12.object().shape({
|
|
1969
|
+
bankAccountDetails: bankAccountDetailsSchema.required(
|
|
1970
|
+
"Bank account details are required"
|
|
1971
|
+
),
|
|
1972
|
+
contactDetails: affiliateContactDetailsSchema.required(
|
|
1973
|
+
"Contact details are required"
|
|
1974
|
+
),
|
|
1975
|
+
irdNumber: yup12.string().trim().required("IRD number is required").matches(
|
|
1976
|
+
nzIrdNumberRegex,
|
|
1977
|
+
"IRD number must be in format: XXX-XXX-XX or XXX-XXX-XXX"
|
|
1978
|
+
).test(
|
|
1979
|
+
"ird-number",
|
|
1980
|
+
"Enter a valid IRD number",
|
|
1981
|
+
(value) => !!value && isValidIrdNumber(value)
|
|
1982
|
+
),
|
|
1983
|
+
location: locationSchema.required("Location is required"),
|
|
1984
|
+
participantType: yup12.mixed().oneOf(
|
|
1985
|
+
Object.values(EnumAffiliateParticipantType),
|
|
1986
|
+
"Please select a valid participant type"
|
|
1987
|
+
).required("Participant type is required"),
|
|
1988
|
+
socialMedia: yup12.array().of(socialMediaSchema).nullable().default(null)
|
|
1989
|
+
});
|
|
1990
|
+
|
|
1991
|
+
// src/hooks/useAffiliateForm.ts
|
|
1992
|
+
function useAffiliateForm(data) {
|
|
1993
|
+
const {
|
|
1994
|
+
control,
|
|
1995
|
+
formState,
|
|
1996
|
+
getValues,
|
|
1997
|
+
handleSubmit,
|
|
1998
|
+
reset,
|
|
1999
|
+
setValue,
|
|
2000
|
+
watch
|
|
2001
|
+
} = useForm18({
|
|
2002
|
+
defaultValues: defaultAffiliateFormValues,
|
|
2003
|
+
resolver: yupResolver18(affiliateSchema)
|
|
2004
|
+
});
|
|
2005
|
+
useEffect9(() => {
|
|
2006
|
+
if (data) {
|
|
2007
|
+
reset({
|
|
2008
|
+
bankAccountDetails: data.bankAccountDetails,
|
|
2009
|
+
contactDetails: data.contactDetails,
|
|
2010
|
+
irdNumber: data.irdNumber,
|
|
2011
|
+
location: data.location,
|
|
2012
|
+
participantType: data.participantType,
|
|
2013
|
+
socialMedia: data.socialMedia,
|
|
2014
|
+
termsAgreement: data.termsAgreement
|
|
2015
|
+
});
|
|
2016
|
+
} else {
|
|
2017
|
+
reset(defaultAffiliateFormValues);
|
|
2018
|
+
}
|
|
2019
|
+
}, [data]);
|
|
2020
|
+
const {
|
|
2021
|
+
bankAccountDetails,
|
|
2022
|
+
contactDetails,
|
|
2023
|
+
irdNumber,
|
|
2024
|
+
location,
|
|
2025
|
+
participantType,
|
|
2026
|
+
socialMedia,
|
|
2027
|
+
termsAgreement
|
|
2028
|
+
} = getValues();
|
|
2029
|
+
return {
|
|
2030
|
+
control,
|
|
2031
|
+
fields: {
|
|
2032
|
+
bankAccountDetails,
|
|
2033
|
+
contactDetails,
|
|
2034
|
+
irdNumber,
|
|
2035
|
+
location,
|
|
2036
|
+
participantType,
|
|
2037
|
+
socialMedia,
|
|
2038
|
+
termsAgreement
|
|
2039
|
+
},
|
|
2040
|
+
formState,
|
|
2041
|
+
getValues,
|
|
2042
|
+
handleSubmit,
|
|
2043
|
+
reset,
|
|
2044
|
+
setValue,
|
|
2045
|
+
watch
|
|
2046
|
+
};
|
|
2047
|
+
}
|
|
1939
2048
|
export {
|
|
2049
|
+
defaultAffiliateFormValues,
|
|
1940
2050
|
defaultEventFormValues,
|
|
1941
2051
|
defaultEventInfoFormValues,
|
|
1942
2052
|
defaultLocation,
|
|
@@ -1945,8 +2055,10 @@ export {
|
|
|
1945
2055
|
defaultVendorFormValues,
|
|
1946
2056
|
defaultVendorInfoFormValues,
|
|
1947
2057
|
globalDefaultValues,
|
|
2058
|
+
mapAffiliateToFormData,
|
|
1948
2059
|
mapBaseResourceTypeToFormData,
|
|
1949
2060
|
useAdForm,
|
|
2061
|
+
useAffiliateForm,
|
|
1950
2062
|
useAppSettingsForm,
|
|
1951
2063
|
useContactUsForm,
|
|
1952
2064
|
useEventForm,
|