@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.
package/dist/index.d.mts CHANGED
@@ -762,12 +762,12 @@ type TesterVendor = {
762
762
  tryVisitorFeatures: boolean;
763
763
  completeFeedbackQuestionnaire: boolean;
764
764
  /** Social Media Appearance */
765
- sendPhotoForSocialMedia: boolean;
766
- appearInVideoIntroduction: boolean;
765
+ sendPhotoForSocialMedia?: boolean;
766
+ appearInVideoIntroduction?: boolean;
767
767
  socialMediaFeatureReason?: string;
768
768
  /** Open Questions */
769
- excitementAboutApp: string;
770
- usefulnessExpectations: string;
769
+ excitementAboutApp?: string;
770
+ usefulnessExpectations?: string;
771
771
  testingPeriodConcerns?: string;
772
772
  };
773
773
  };
package/dist/index.d.ts CHANGED
@@ -762,12 +762,12 @@ type TesterVendor = {
762
762
  tryVisitorFeatures: boolean;
763
763
  completeFeedbackQuestionnaire: boolean;
764
764
  /** Social Media Appearance */
765
- sendPhotoForSocialMedia: boolean;
766
- appearInVideoIntroduction: boolean;
765
+ sendPhotoForSocialMedia?: boolean;
766
+ appearInVideoIntroduction?: boolean;
767
767
  socialMediaFeatureReason?: string;
768
768
  /** Open Questions */
769
- excitementAboutApp: string;
770
- usefulnessExpectations: string;
769
+ excitementAboutApp?: string;
770
+ usefulnessExpectations?: string;
771
771
  testingPeriodConcerns?: string;
772
772
  };
773
773
  };
package/dist/index.mjs CHANGED
@@ -94,11 +94,11 @@ var EnumPartnerType = /* @__PURE__ */ ((EnumPartnerType2) => {
94
94
  EnumPartnerType2["SUPPORTING_PARTNER"] = "Supporting_Partner";
95
95
  return EnumPartnerType2;
96
96
  })(EnumPartnerType || {});
97
- var EnumOSPlatform = /* @__PURE__ */ ((EnumOSPlatform2) => {
98
- EnumOSPlatform2["ANDROID"] = "android";
99
- EnumOSPlatform2["IOS"] = "ios";
100
- EnumOSPlatform2["WEB"] = "web";
101
- return EnumOSPlatform2;
97
+ var EnumOSPlatform = /* @__PURE__ */ ((EnumOSPlatform3) => {
98
+ EnumOSPlatform3["ANDROID"] = "android";
99
+ EnumOSPlatform3["IOS"] = "ios";
100
+ EnumOSPlatform3["WEB"] = "web";
101
+ return EnumOSPlatform3;
102
102
  })(EnumOSPlatform || {});
103
103
  var EnumRelationResource = /* @__PURE__ */ ((EnumRelationResource2) => {
104
104
  EnumRelationResource2["EVENT_INVITE_VENDOR"] = "event_invite_vendor";
@@ -5482,16 +5482,16 @@ var testerVendorSchema = yup6.object().shape({
5482
5482
  ).min(1, "At least one market must be provided").required("Markets attended are required"),
5483
5483
  productsOrServices: yup6.string().trim().required("Products or services description is required"),
5484
5484
  questionary: yup6.object().shape({
5485
- appearInVideoIntroduction: yup6.boolean().required("Appear in video introduction is required"),
5485
+ appearInVideoIntroduction: yup6.boolean().optional(),
5486
5486
  applyToAtLeastOneMarket: yup6.boolean().required("Apply to at least one market commitment is required"),
5487
5487
  completeFeedbackQuestionnaire: yup6.boolean().required("Complete feedback questionnaire commitment is required"),
5488
- excitementAboutApp: yup6.string().trim().required("Excitement about app is required"),
5489
- sendPhotoForSocialMedia: yup6.boolean().required("Send photo for social media is required"),
5488
+ excitementAboutApp: yup6.string().trim().optional(),
5489
+ sendPhotoForSocialMedia: yup6.boolean().optional(),
5490
5490
  socialMediaFeatureReason: yup6.string().trim().optional(),
5491
5491
  testingPeriodConcerns: yup6.string().trim().optional(),
5492
5492
  tryVisitorFeatures: yup6.boolean().required("Try visitor features commitment is required"),
5493
5493
  uploadStallProfileFirstWeek: yup6.boolean().required("Upload stall profile first week commitment is required"),
5494
- usefulnessExpectations: yup6.string().trim().required("Usefulness expectations is required")
5494
+ usefulnessExpectations: yup6.string().trim().optional()
5495
5495
  }),
5496
5496
  sellingFrequency: yup6.mixed().oneOf(
5497
5497
  Object.values(VendorSellingFrequency),
@@ -5530,7 +5530,7 @@ var testerSchema = yup6.object().shape({
5530
5530
  event: yup6.object().when("resourceType", {
5531
5531
  is: (resourceType) => resourceType === "event" /* EVENT */,
5532
5532
  otherwise: (schema) => schema.nullable().optional(),
5533
- then: () => testerEventSchema.required("Event information is required")
5533
+ then: () => testerEventSchema
5534
5534
  }),
5535
5535
  firstName: yup6.string().required("First name is required"),
5536
5536
  lastName: yup6.string().required("Last name is required"),
@@ -5541,7 +5541,7 @@ var testerSchema = yup6.object().shape({
5541
5541
  // skip empty values
5542
5542
  ),
5543
5543
  osType: yup6.mixed().oneOf(Object.values(EnumOSPlatform), "Please select Android or iOS").required("OS Type is required"),
5544
- privacyConsent: yup6.boolean().oneOf([true], "You must accept the privacy policy").required("Privacy consent is required"),
5544
+ privacyConsent: yup6.boolean().oneOf([true], "You must accept the Privacy Policy").required("Privacy consent is required"),
5545
5545
  region: yup6.string().required("Region is required"),
5546
5546
  resourceType: yup6.mixed().oneOf(
5547
5547
  Object.values(EnumResourceType),
@@ -5550,7 +5550,7 @@ var testerSchema = yup6.object().shape({
5550
5550
  vendor: yup6.object().when("resourceType", {
5551
5551
  is: (resourceType) => resourceType === "vendor" /* VENDOR */,
5552
5552
  otherwise: (schema) => schema.nullable().optional(),
5553
- then: () => testerVendorSchema.required("Stallholder information is required")
5553
+ then: () => testerVendorSchema
5554
5554
  })
5555
5555
  });
5556
5556
 
@@ -6365,10 +6365,13 @@ function useTesterForm(data) {
6365
6365
  handleSubmit,
6366
6366
  reset,
6367
6367
  setValue,
6368
+ trigger,
6368
6369
  watch
6369
6370
  } = useForm11({
6370
6371
  defaultValues: defaultValues7,
6371
- resolver: yupResolver11(testerSchema)
6372
+ mode: "onChange",
6373
+ resolver: yupResolver11(testerSchema),
6374
+ reValidateMode: "onChange"
6372
6375
  });
6373
6376
  React6.useEffect(() => {
6374
6377
  if (data) {
@@ -6388,34 +6391,80 @@ function useTesterForm(data) {
6388
6391
  } else {
6389
6392
  reset(defaultValues7);
6390
6393
  }
6391
- }, [data]);
6394
+ }, [data, reset]);
6395
+ const resourceType = watch("resourceType");
6396
+ const vendor = watch("vendor");
6397
+ const event = watch("event");
6398
+ React6.useEffect(() => {
6399
+ if (resourceType === "vendor" /* VENDOR */ && vendor === null) {
6400
+ const emptyVendor = {
6401
+ categories: [],
6402
+ marketsAttended: [],
6403
+ productsOrServices: "",
6404
+ questionary: {
6405
+ applyToAtLeastOneMarket: false,
6406
+ completeFeedbackQuestionnaire: false,
6407
+ tryVisitorFeatures: false,
6408
+ uploadStallProfileFirstWeek: false
6409
+ }
6410
+ };
6411
+ setValue("vendor", emptyVendor, { shouldValidate: true });
6412
+ } else if (resourceType === "event" /* EVENT */ && vendor !== null) {
6413
+ setValue("vendor", null, { shouldValidate: true });
6414
+ }
6415
+ }, [resourceType, vendor, setValue]);
6416
+ React6.useEffect(() => {
6417
+ if (resourceType === "event" /* EVENT */ && event === null) {
6418
+ const emptyEvent = {
6419
+ allowMarketingAppearance: false,
6420
+ completeFinalQuestionnaire: false,
6421
+ dailyCoordinationNeeds: "",
6422
+ interestedInCharityInitiative: false,
6423
+ inviteAtLeastFiveStallholders: false,
6424
+ manageApplicationsAndCommunication: false,
6425
+ markets: [],
6426
+ organizerExpectations: "",
6427
+ registerMarketsFirstWeek: false
6428
+ };
6429
+ setValue("event", emptyEvent, { shouldValidate: true });
6430
+ } else if (resourceType === "vendor" /* VENDOR */ && event !== null) {
6431
+ setValue("event", null, { shouldValidate: true });
6432
+ }
6433
+ }, [resourceType, event, setValue]);
6434
+ React6.useEffect(() => {
6435
+ if (resourceType === "vendor" /* VENDOR */ && vendor !== null) {
6436
+ trigger("vendor");
6437
+ }
6438
+ }, [resourceType, vendor, trigger]);
6439
+ React6.useEffect(() => {
6440
+ if (resourceType === "event" /* EVENT */ && event !== null) {
6441
+ trigger("event");
6442
+ }
6443
+ }, [resourceType, event, trigger]);
6392
6444
  const {
6393
6445
  businessName,
6394
6446
  email,
6395
- event,
6396
6447
  firstName,
6397
6448
  lastName,
6398
6449
  mobilePhone,
6399
6450
  osType,
6400
6451
  privacyConsent,
6401
- region,
6402
- resourceType,
6403
- vendor
6452
+ region
6404
6453
  } = getValues();
6405
6454
  return {
6406
6455
  control,
6407
6456
  fields: {
6408
6457
  businessName,
6409
6458
  email,
6410
- event,
6459
+ event: event || null,
6411
6460
  firstName,
6412
6461
  lastName,
6413
6462
  mobilePhone,
6414
6463
  osType,
6415
6464
  privacyConsent,
6416
6465
  region,
6417
- resourceType,
6418
- vendor
6466
+ resourceType: resourceType || "",
6467
+ vendor: vendor || null
6419
6468
  },
6420
6469
  formState: { errors },
6421
6470
  handleSubmit,