@timardex/cluemart-shared 1.2.89 → 1.2.90
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/hooks/index.cjs +18 -67
- package/dist/hooks/index.cjs.map +1 -1
- package/dist/hooks/index.mjs +13 -62
- package/dist/hooks/index.mjs.map +1 -1
- package/dist/index.cjs +18 -67
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +18 -67
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/hooks/index.mjs
CHANGED
|
@@ -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
|
|
543
|
+
then: (schema) => schema.required("Event information is required").shape(testerEventSchema.fields)
|
|
544
544
|
}),
|
|
545
545
|
firstName: yup6.string().required("First name is required"),
|
|
546
546
|
lastName: yup6.string().required("Last name is required"),
|
|
@@ -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
|
|
563
|
+
then: (schema) => schema.required("Vendor information is required").shape(testerVendorSchema.fields)
|
|
564
564
|
})
|
|
565
565
|
});
|
|
566
566
|
|
|
@@ -1330,7 +1330,7 @@ import { useForm as useForm11 } from "react-hook-form";
|
|
|
1330
1330
|
var defaultValues7 = {
|
|
1331
1331
|
businessName: "",
|
|
1332
1332
|
email: "",
|
|
1333
|
-
event:
|
|
1333
|
+
event: {},
|
|
1334
1334
|
firstName: "",
|
|
1335
1335
|
lastName: "",
|
|
1336
1336
|
mobilePhone: "",
|
|
@@ -1338,7 +1338,7 @@ var defaultValues7 = {
|
|
|
1338
1338
|
privacyConsent: false,
|
|
1339
1339
|
region: "",
|
|
1340
1340
|
resourceType: "",
|
|
1341
|
-
vendor:
|
|
1341
|
+
vendor: {}
|
|
1342
1342
|
};
|
|
1343
1343
|
function useTesterForm(data) {
|
|
1344
1344
|
const {
|
|
@@ -1348,13 +1348,10 @@ function useTesterForm(data) {
|
|
|
1348
1348
|
handleSubmit,
|
|
1349
1349
|
reset,
|
|
1350
1350
|
setValue,
|
|
1351
|
-
trigger,
|
|
1352
1351
|
watch
|
|
1353
1352
|
} = useForm11({
|
|
1354
1353
|
defaultValues: defaultValues7,
|
|
1355
|
-
|
|
1356
|
-
resolver: yupResolver11(testerSchema),
|
|
1357
|
-
reValidateMode: "onChange"
|
|
1354
|
+
resolver: yupResolver11(testerSchema)
|
|
1358
1355
|
});
|
|
1359
1356
|
React6.useEffect(() => {
|
|
1360
1357
|
if (data) {
|
|
@@ -1374,80 +1371,34 @@ function useTesterForm(data) {
|
|
|
1374
1371
|
} else {
|
|
1375
1372
|
reset(defaultValues7);
|
|
1376
1373
|
}
|
|
1377
|
-
}, [data
|
|
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]);
|
|
1374
|
+
}, [data]);
|
|
1427
1375
|
const {
|
|
1428
1376
|
businessName,
|
|
1429
1377
|
email,
|
|
1378
|
+
event,
|
|
1430
1379
|
firstName,
|
|
1431
1380
|
lastName,
|
|
1432
1381
|
mobilePhone,
|
|
1433
1382
|
osType,
|
|
1434
1383
|
privacyConsent,
|
|
1435
|
-
region
|
|
1384
|
+
region,
|
|
1385
|
+
resourceType,
|
|
1386
|
+
vendor
|
|
1436
1387
|
} = getValues();
|
|
1437
1388
|
return {
|
|
1438
1389
|
control,
|
|
1439
1390
|
fields: {
|
|
1440
1391
|
businessName,
|
|
1441
1392
|
email,
|
|
1442
|
-
event
|
|
1393
|
+
event,
|
|
1443
1394
|
firstName,
|
|
1444
1395
|
lastName,
|
|
1445
1396
|
mobilePhone,
|
|
1446
1397
|
osType,
|
|
1447
1398
|
privacyConsent,
|
|
1448
1399
|
region,
|
|
1449
|
-
resourceType
|
|
1450
|
-
vendor
|
|
1400
|
+
resourceType,
|
|
1401
|
+
vendor
|
|
1451
1402
|
},
|
|
1452
1403
|
formState: { errors },
|
|
1453
1404
|
handleSubmit,
|