@timardex/cluemart-shared 1.2.88 → 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.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";
@@ -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,