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