@timardex/cluemart-shared 1.2.87 → 1.2.89

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.
@@ -1,6 +1,6 @@
1
1
  import { L as LocationType, h as VendorFormData, i as CreateVendorFormData, j as VendorInfoFormData, k as CreateVendorInfoFormData, l as EventFormData, m as CreateEventFormData, n as EventInfoFormData, o as CreateEventInfoFormData, p as UserFormData, q as CreateUserFormData, B as BaseResourceTypeFormData } from '../global-CLsysATK.mjs';
2
2
  import { C as CreateLoginFormData, a as CreateRegisterFormData, b as CreateRequestPasswordResetFormData, c as CreateValidateVerificationTokenFormData, d as CreateResetPasswordFormData, e as ContactUsFormData, f as CreateContactUsFormData } from '../auth-zy1P_DKw.mjs';
3
- import { a as PartnerFormData, b as TesterFormData, C as CreateTesterFormData, c as AdFormData, d as CreateAdFormData, e as CreatePartnerFormData } from '../ad-Cnah2g5Z.mjs';
3
+ import { a as PartnerFormData, b as TesterFormData, C as CreateTesterFormData, c as AdFormData, d as CreateAdFormData, e as CreatePartnerFormData } from '../ad-ClzcYPuT.mjs';
4
4
  import 'react-hook-form';
5
5
  import '../enums/index.mjs';
6
6
 
@@ -1,6 +1,6 @@
1
1
  import { L as LocationType, h as VendorFormData, i as CreateVendorFormData, j as VendorInfoFormData, k as CreateVendorInfoFormData, l as EventFormData, m as CreateEventFormData, n as EventInfoFormData, o as CreateEventInfoFormData, p as UserFormData, q as CreateUserFormData, B as BaseResourceTypeFormData } from '../global-BYQMdxtO.js';
2
2
  import { C as CreateLoginFormData, a as CreateRegisterFormData, b as CreateRequestPasswordResetFormData, c as CreateValidateVerificationTokenFormData, d as CreateResetPasswordFormData, e as ContactUsFormData, f as CreateContactUsFormData } from '../auth-D0FKzjLe.js';
3
- import { a as PartnerFormData, b as TesterFormData, C as CreateTesterFormData, c as AdFormData, d as CreateAdFormData, e as CreatePartnerFormData } from '../ad-DOKicc6e.js';
3
+ import { a as PartnerFormData, b as TesterFormData, C as CreateTesterFormData, c as AdFormData, d as CreateAdFormData, e as CreatePartnerFormData } from '../ad-CIaDLRVX.js';
4
4
  import 'react-hook-form';
5
5
  import '../enums/index.js';
6
6
 
@@ -6,7 +6,7 @@ import {
6
6
  OrganizedMarketCount,
7
7
  OrganizerMarketFrequency,
8
8
  VendorSellingFrequency
9
- } from "../chunk-74DMNP4I.mjs";
9
+ } from "../chunk-66MS2SVX.mjs";
10
10
  import {
11
11
  dateFormat,
12
12
  normalizeUrl,
@@ -492,16 +492,16 @@ var testerVendorSchema = yup6.object().shape({
492
492
  ).min(1, "At least one market must be provided").required("Markets attended are required"),
493
493
  productsOrServices: yup6.string().trim().required("Products or services description is required"),
494
494
  questionary: yup6.object().shape({
495
- appearInVideoIntroduction: yup6.boolean().required("Appear in video introduction is required"),
495
+ appearInVideoIntroduction: yup6.boolean().optional(),
496
496
  applyToAtLeastOneMarket: yup6.boolean().required("Apply to at least one market commitment is required"),
497
497
  completeFeedbackQuestionnaire: yup6.boolean().required("Complete feedback questionnaire commitment is required"),
498
- excitementAboutApp: yup6.string().trim().required("Excitement about app is required"),
499
- sendPhotoForSocialMedia: yup6.boolean().required("Send photo for social media is required"),
498
+ excitementAboutApp: yup6.string().trim().optional(),
499
+ sendPhotoForSocialMedia: yup6.boolean().optional(),
500
500
  socialMediaFeatureReason: yup6.string().trim().optional(),
501
501
  testingPeriodConcerns: yup6.string().trim().optional(),
502
502
  tryVisitorFeatures: yup6.boolean().required("Try visitor features commitment is required"),
503
503
  uploadStallProfileFirstWeek: yup6.boolean().required("Upload stall profile first week commitment is required"),
504
- usefulnessExpectations: yup6.string().trim().required("Usefulness expectations is required")
504
+ usefulnessExpectations: yup6.string().trim().optional()
505
505
  }),
506
506
  sellingFrequency: yup6.mixed().oneOf(
507
507
  Object.values(VendorSellingFrequency),
@@ -540,7 +540,7 @@ var testerSchema = yup6.object().shape({
540
540
  event: yup6.object().when("resourceType", {
541
541
  is: (resourceType) => resourceType === "event" /* EVENT */,
542
542
  otherwise: (schema) => schema.nullable().optional(),
543
- then: () => testerEventSchema.required("Event information is required")
543
+ then: () => testerEventSchema
544
544
  }),
545
545
  firstName: yup6.string().required("First name is required"),
546
546
  lastName: yup6.string().required("Last name is required"),
@@ -551,7 +551,7 @@ var testerSchema = yup6.object().shape({
551
551
  // skip empty values
552
552
  ),
553
553
  osType: yup6.mixed().oneOf(Object.values(EnumOSPlatform), "Please select Android or iOS").required("OS Type is required"),
554
- privacyConsent: yup6.boolean().oneOf([true], "You must accept the privacy policy").required("Privacy consent is required"),
554
+ privacyConsent: yup6.boolean().oneOf([true], "You must accept the Privacy Policy").required("Privacy consent is required"),
555
555
  region: yup6.string().required("Region is required"),
556
556
  resourceType: yup6.mixed().oneOf(
557
557
  Object.values(EnumResourceType),
@@ -560,7 +560,7 @@ var testerSchema = yup6.object().shape({
560
560
  vendor: yup6.object().when("resourceType", {
561
561
  is: (resourceType) => resourceType === "vendor" /* VENDOR */,
562
562
  otherwise: (schema) => schema.nullable().optional(),
563
- then: () => testerVendorSchema.required("Stallholder information is required")
563
+ then: () => testerVendorSchema
564
564
  })
565
565
  });
566
566
 
@@ -1348,10 +1348,13 @@ function useTesterForm(data) {
1348
1348
  handleSubmit,
1349
1349
  reset,
1350
1350
  setValue,
1351
+ trigger,
1351
1352
  watch
1352
1353
  } = useForm11({
1353
1354
  defaultValues: defaultValues7,
1354
- resolver: yupResolver11(testerSchema)
1355
+ mode: "onChange",
1356
+ resolver: yupResolver11(testerSchema),
1357
+ reValidateMode: "onChange"
1355
1358
  });
1356
1359
  React6.useEffect(() => {
1357
1360
  if (data) {
@@ -1371,34 +1374,80 @@ function useTesterForm(data) {
1371
1374
  } else {
1372
1375
  reset(defaultValues7);
1373
1376
  }
1374
- }, [data]);
1377
+ }, [data, reset]);
1378
+ const resourceType = watch("resourceType");
1379
+ const vendor = watch("vendor");
1380
+ const event = watch("event");
1381
+ React6.useEffect(() => {
1382
+ if (resourceType === "vendor" /* VENDOR */ && vendor === null) {
1383
+ const emptyVendor = {
1384
+ categories: [],
1385
+ marketsAttended: [],
1386
+ productsOrServices: "",
1387
+ questionary: {
1388
+ applyToAtLeastOneMarket: false,
1389
+ completeFeedbackQuestionnaire: false,
1390
+ tryVisitorFeatures: false,
1391
+ uploadStallProfileFirstWeek: false
1392
+ }
1393
+ };
1394
+ setValue("vendor", emptyVendor, { shouldValidate: true });
1395
+ } else if (resourceType === "event" /* EVENT */ && vendor !== null) {
1396
+ setValue("vendor", null, { shouldValidate: true });
1397
+ }
1398
+ }, [resourceType, vendor, setValue]);
1399
+ React6.useEffect(() => {
1400
+ if (resourceType === "event" /* EVENT */ && event === null) {
1401
+ const emptyEvent = {
1402
+ allowMarketingAppearance: false,
1403
+ completeFinalQuestionnaire: false,
1404
+ dailyCoordinationNeeds: "",
1405
+ interestedInCharityInitiative: false,
1406
+ inviteAtLeastFiveStallholders: false,
1407
+ manageApplicationsAndCommunication: false,
1408
+ markets: [],
1409
+ organizerExpectations: "",
1410
+ registerMarketsFirstWeek: false
1411
+ };
1412
+ setValue("event", emptyEvent, { shouldValidate: true });
1413
+ } else if (resourceType === "vendor" /* VENDOR */ && event !== null) {
1414
+ setValue("event", null, { shouldValidate: true });
1415
+ }
1416
+ }, [resourceType, event, setValue]);
1417
+ React6.useEffect(() => {
1418
+ if (resourceType === "vendor" /* VENDOR */ && vendor !== null) {
1419
+ trigger("vendor");
1420
+ }
1421
+ }, [resourceType, vendor, trigger]);
1422
+ React6.useEffect(() => {
1423
+ if (resourceType === "event" /* EVENT */ && event !== null) {
1424
+ trigger("event");
1425
+ }
1426
+ }, [resourceType, event, trigger]);
1375
1427
  const {
1376
1428
  businessName,
1377
1429
  email,
1378
- event,
1379
1430
  firstName,
1380
1431
  lastName,
1381
1432
  mobilePhone,
1382
1433
  osType,
1383
1434
  privacyConsent,
1384
- region,
1385
- resourceType,
1386
- vendor
1435
+ region
1387
1436
  } = getValues();
1388
1437
  return {
1389
1438
  control,
1390
1439
  fields: {
1391
1440
  businessName,
1392
1441
  email,
1393
- event,
1442
+ event: event || null,
1394
1443
  firstName,
1395
1444
  lastName,
1396
1445
  mobilePhone,
1397
1446
  osType,
1398
1447
  privacyConsent,
1399
1448
  region,
1400
- resourceType,
1401
- vendor
1449
+ resourceType: resourceType || "",
1450
+ vendor: vendor || null
1402
1451
  },
1403
1452
  formState: { errors },
1404
1453
  handleSubmit,