@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.cjs CHANGED
@@ -345,11 +345,11 @@ var EnumPartnerType = /* @__PURE__ */ ((EnumPartnerType2) => {
345
345
  EnumPartnerType2["SUPPORTING_PARTNER"] = "Supporting_Partner";
346
346
  return EnumPartnerType2;
347
347
  })(EnumPartnerType || {});
348
- var EnumOSPlatform = /* @__PURE__ */ ((EnumOSPlatform2) => {
349
- EnumOSPlatform2["ANDROID"] = "android";
350
- EnumOSPlatform2["IOS"] = "ios";
351
- EnumOSPlatform2["WEB"] = "web";
352
- return EnumOSPlatform2;
348
+ var EnumOSPlatform = /* @__PURE__ */ ((EnumOSPlatform3) => {
349
+ EnumOSPlatform3["ANDROID"] = "android";
350
+ EnumOSPlatform3["IOS"] = "ios";
351
+ EnumOSPlatform3["WEB"] = "web";
352
+ return EnumOSPlatform3;
353
353
  })(EnumOSPlatform || {});
354
354
  var EnumRelationResource = /* @__PURE__ */ ((EnumRelationResource2) => {
355
355
  EnumRelationResource2["EVENT_INVITE_VENDOR"] = "event_invite_vendor";
@@ -5733,16 +5733,16 @@ var testerVendorSchema = yup6.object().shape({
5733
5733
  ).min(1, "At least one market must be provided").required("Markets attended are required"),
5734
5734
  productsOrServices: yup6.string().trim().required("Products or services description is required"),
5735
5735
  questionary: yup6.object().shape({
5736
- appearInVideoIntroduction: yup6.boolean().required("Appear in video introduction is required"),
5736
+ appearInVideoIntroduction: yup6.boolean().optional(),
5737
5737
  applyToAtLeastOneMarket: yup6.boolean().required("Apply to at least one market commitment is required"),
5738
5738
  completeFeedbackQuestionnaire: yup6.boolean().required("Complete feedback questionnaire commitment is required"),
5739
- excitementAboutApp: yup6.string().trim().required("Excitement about app is required"),
5740
- sendPhotoForSocialMedia: yup6.boolean().required("Send photo for social media is required"),
5739
+ excitementAboutApp: yup6.string().trim().optional(),
5740
+ sendPhotoForSocialMedia: yup6.boolean().optional(),
5741
5741
  socialMediaFeatureReason: yup6.string().trim().optional(),
5742
5742
  testingPeriodConcerns: yup6.string().trim().optional(),
5743
5743
  tryVisitorFeatures: yup6.boolean().required("Try visitor features commitment is required"),
5744
5744
  uploadStallProfileFirstWeek: yup6.boolean().required("Upload stall profile first week commitment is required"),
5745
- usefulnessExpectations: yup6.string().trim().required("Usefulness expectations is required")
5745
+ usefulnessExpectations: yup6.string().trim().optional()
5746
5746
  }),
5747
5747
  sellingFrequency: yup6.mixed().oneOf(
5748
5748
  Object.values(VendorSellingFrequency),
@@ -5781,7 +5781,7 @@ var testerSchema = yup6.object().shape({
5781
5781
  event: yup6.object().when("resourceType", {
5782
5782
  is: (resourceType) => resourceType === "event" /* EVENT */,
5783
5783
  otherwise: (schema) => schema.nullable().optional(),
5784
- then: () => testerEventSchema.required("Event information is required")
5784
+ then: () => testerEventSchema
5785
5785
  }),
5786
5786
  firstName: yup6.string().required("First name is required"),
5787
5787
  lastName: yup6.string().required("Last name is required"),
@@ -5792,7 +5792,7 @@ var testerSchema = yup6.object().shape({
5792
5792
  // skip empty values
5793
5793
  ),
5794
5794
  osType: yup6.mixed().oneOf(Object.values(EnumOSPlatform), "Please select Android or iOS").required("OS Type is required"),
5795
- privacyConsent: yup6.boolean().oneOf([true], "You must accept the privacy policy").required("Privacy consent is required"),
5795
+ privacyConsent: yup6.boolean().oneOf([true], "You must accept the Privacy Policy").required("Privacy consent is required"),
5796
5796
  region: yup6.string().required("Region is required"),
5797
5797
  resourceType: yup6.mixed().oneOf(
5798
5798
  Object.values(EnumResourceType),
@@ -5801,7 +5801,7 @@ var testerSchema = yup6.object().shape({
5801
5801
  vendor: yup6.object().when("resourceType", {
5802
5802
  is: (resourceType) => resourceType === "vendor" /* VENDOR */,
5803
5803
  otherwise: (schema) => schema.nullable().optional(),
5804
- then: () => testerVendorSchema.required("Stallholder information is required")
5804
+ then: () => testerVendorSchema
5805
5805
  })
5806
5806
  });
5807
5807
 
@@ -6616,10 +6616,13 @@ function useTesterForm(data) {
6616
6616
  handleSubmit,
6617
6617
  reset,
6618
6618
  setValue,
6619
+ trigger,
6619
6620
  watch
6620
6621
  } = (0, import_react_hook_form11.useForm)({
6621
6622
  defaultValues: defaultValues7,
6622
- resolver: (0, import_yup11.yupResolver)(testerSchema)
6623
+ mode: "onChange",
6624
+ resolver: (0, import_yup11.yupResolver)(testerSchema),
6625
+ reValidateMode: "onChange"
6623
6626
  });
6624
6627
  import_react.default.useEffect(() => {
6625
6628
  if (data) {
@@ -6639,34 +6642,80 @@ function useTesterForm(data) {
6639
6642
  } else {
6640
6643
  reset(defaultValues7);
6641
6644
  }
6642
- }, [data]);
6645
+ }, [data, reset]);
6646
+ const resourceType = watch("resourceType");
6647
+ const vendor = watch("vendor");
6648
+ const event = watch("event");
6649
+ import_react.default.useEffect(() => {
6650
+ if (resourceType === "vendor" /* VENDOR */ && vendor === null) {
6651
+ const emptyVendor = {
6652
+ categories: [],
6653
+ marketsAttended: [],
6654
+ productsOrServices: "",
6655
+ questionary: {
6656
+ applyToAtLeastOneMarket: false,
6657
+ completeFeedbackQuestionnaire: false,
6658
+ tryVisitorFeatures: false,
6659
+ uploadStallProfileFirstWeek: false
6660
+ }
6661
+ };
6662
+ setValue("vendor", emptyVendor, { shouldValidate: true });
6663
+ } else if (resourceType === "event" /* EVENT */ && vendor !== null) {
6664
+ setValue("vendor", null, { shouldValidate: true });
6665
+ }
6666
+ }, [resourceType, vendor, setValue]);
6667
+ import_react.default.useEffect(() => {
6668
+ if (resourceType === "event" /* EVENT */ && event === null) {
6669
+ const emptyEvent = {
6670
+ allowMarketingAppearance: false,
6671
+ completeFinalQuestionnaire: false,
6672
+ dailyCoordinationNeeds: "",
6673
+ interestedInCharityInitiative: false,
6674
+ inviteAtLeastFiveStallholders: false,
6675
+ manageApplicationsAndCommunication: false,
6676
+ markets: [],
6677
+ organizerExpectations: "",
6678
+ registerMarketsFirstWeek: false
6679
+ };
6680
+ setValue("event", emptyEvent, { shouldValidate: true });
6681
+ } else if (resourceType === "vendor" /* VENDOR */ && event !== null) {
6682
+ setValue("event", null, { shouldValidate: true });
6683
+ }
6684
+ }, [resourceType, event, setValue]);
6685
+ import_react.default.useEffect(() => {
6686
+ if (resourceType === "vendor" /* VENDOR */ && vendor !== null) {
6687
+ trigger("vendor");
6688
+ }
6689
+ }, [resourceType, vendor, trigger]);
6690
+ import_react.default.useEffect(() => {
6691
+ if (resourceType === "event" /* EVENT */ && event !== null) {
6692
+ trigger("event");
6693
+ }
6694
+ }, [resourceType, event, trigger]);
6643
6695
  const {
6644
6696
  businessName,
6645
6697
  email,
6646
- event,
6647
6698
  firstName,
6648
6699
  lastName,
6649
6700
  mobilePhone,
6650
6701
  osType,
6651
6702
  privacyConsent,
6652
- region,
6653
- resourceType,
6654
- vendor
6703
+ region
6655
6704
  } = getValues();
6656
6705
  return {
6657
6706
  control,
6658
6707
  fields: {
6659
6708
  businessName,
6660
6709
  email,
6661
- event,
6710
+ event: event || null,
6662
6711
  firstName,
6663
6712
  lastName,
6664
6713
  mobilePhone,
6665
6714
  osType,
6666
6715
  privacyConsent,
6667
6716
  region,
6668
- resourceType,
6669
- vendor
6717
+ resourceType: resourceType || "",
6718
+ vendor: vendor || null
6670
6719
  },
6671
6720
  formState: { errors },
6672
6721
  handleSubmit,