@timardex/cluemart-shared 1.2.89 → 1.2.91

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.
@@ -59,11 +59,11 @@ type TesterEvent = {
59
59
  manageApplicationsAndCommunication: boolean;
60
60
  completeFinalQuestionnaire: boolean;
61
61
  /** Promotion Support */
62
- allowMarketingAppearance: boolean;
62
+ allowMarketingAppearance?: boolean;
63
63
  /** Open Questions */
64
- organizerExpectations: string;
65
- dailyCoordinationNeeds: string;
66
- interestedInCharityInitiative: boolean;
64
+ organizerExpectations?: string;
65
+ dailyCoordinationNeeds?: string;
66
+ interestedInCharityInitiative?: boolean;
67
67
  };
68
68
  interface TesterFormData {
69
69
  businessName: string;
@@ -59,11 +59,11 @@ type TesterEvent = {
59
59
  manageApplicationsAndCommunication: boolean;
60
60
  completeFinalQuestionnaire: boolean;
61
61
  /** Promotion Support */
62
- allowMarketingAppearance: boolean;
62
+ allowMarketingAppearance?: boolean;
63
63
  /** Open Questions */
64
- organizerExpectations: string;
65
- dailyCoordinationNeeds: string;
66
- interestedInCharityInitiative: boolean;
64
+ organizerExpectations?: string;
65
+ dailyCoordinationNeeds?: string;
66
+ interestedInCharityInitiative?: boolean;
67
67
  };
68
68
  interface TesterFormData {
69
69
  businessName: string;
@@ -55,4 +55,4 @@ export {
55
55
  EnumAdType,
56
56
  EnumAdStyle
57
57
  };
58
- //# sourceMappingURL=chunk-66MS2SVX.mjs.map
58
+ //# sourceMappingURL=chunk-VK2BLRBY.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/types/tester.ts","../src/types/ad.ts"],"sourcesContent":["import { EnumOSPlatform, EnumResourceType } from \"src/enums\";\n\nimport { Category, CreateFormData } from \"./global\";\n\nexport enum OrganizedMarketCount {\n ONE = \"One\",\n TWO_TO_THREE = \"Two_to_Three\",\n FOUR_TO_FIVE = \"Four_to_Five\",\n MORE_THAN_FIVE = \"More_than_Five\",\n}\n\nexport enum VendorSellingFrequency {\n TWICE_A_WEEK = \"Two_to_Three_times_a_week\",\n ONCE_A_WEEK = \"Once_a_week\",\n ONE_TO_TWO_TIMES_A_MONTH = \"One_to_Two_times_a_month\",\n LESS_OFTEN = \"Less_often\",\n}\n\nexport enum OrganizerMarketFrequency {\n WEEKLY = \"Weekly\",\n FORTNIGHTLY = \"Fortnightly\",\n MONTHLY = \"Monthly\",\n SEASONAL = \"Seasonal\",\n}\n\nexport type TesterVendor = {\n categories: Category[];\n marketsAttended: { name: string; city: string }[];\n productsOrServices: string;\n sellingFrequency: VendorSellingFrequency;\n yearlySellingApprox: number;\n questionary: {\n /** Test Period Commitments */\n uploadStallProfileFirstWeek: boolean; // Q10\n applyToAtLeastOneMarket: boolean; // Q11\n tryVisitorFeatures: boolean; // Q12\n completeFeedbackQuestionnaire: boolean; // Q13\n\n /** Social Media Appearance */\n sendPhotoForSocialMedia?: boolean; // Q14 (Yes / No)\n appearInVideoIntroduction?: boolean; // Q15 (Yes / No)\n socialMediaFeatureReason?: string; // Q16 (optional free text)\n\n /** Open Questions */\n excitementAboutApp?: string; // Q17\n usefulnessExpectations?: string; // Q18\n testingPeriodConcerns?: string; // Q19 (optional)\n };\n};\n\nexport type TesterEvent = {\n /** Organizer background */\n organizedMarketCount: OrganizedMarketCount;\n\n markets: {\n name: string;\n cityOrVenue: string;\n frequency: OrganizerMarketFrequency;\n averageStallCount: number;\n }[];\n\n /** Test Period Participation */\n registerMarketsFirstWeek: boolean;\n inviteAtLeastFiveStallholders: boolean;\n manageApplicationsAndCommunication: boolean;\n completeFinalQuestionnaire: boolean;\n\n /** Promotion Support */\n allowMarketingAppearance?: boolean; // Yes / No\n\n /** Open Questions */\n organizerExpectations?: string;\n dailyCoordinationNeeds?: string;\n interestedInCharityInitiative?: boolean;\n};\n\nexport interface TesterFormData {\n businessName: string;\n email: string;\n event?: TesterEvent | null;\n firstName: string;\n lastName: string;\n mobilePhone: string;\n osType: EnumOSPlatform;\n privacyConsent: boolean;\n region: string;\n resourceType: EnumResourceType;\n vendor?: TesterVendor | null;\n}\n\nexport type CreateTesterFormData = CreateFormData<TesterFormData>;\n\nexport interface TesterType extends TesterFormData {\n _id: string;\n active: boolean;\n approved: boolean;\n createdAt: Date;\n updatedAt: Date | null;\n}\n","import { EnumResourceType } from \"src/enums\";\n\nimport { CreateFormData, SocialMediaType } from \"./global\";\n\nexport enum EnumAdShowOn {\n EVENTS_PAGE = \"Events_page\",\n FRONT_PAGE = \"Front_page\",\n PARTNERS_PAGE = \"Partners_page\",\n VENDORS_PAGE = \"Vendors_page\",\n}\n\nexport enum EnumAdStatus {\n ACTIVE = \"Active\",\n PAUSED = \"Paused\",\n EXPIRED = \"Expired\",\n}\n\nexport enum EnumAdType {\n SPONSORED = \"Sponsored\",\n FREE = \"Free\",\n}\n\nexport enum EnumAdStyle {\n BLOOM = \"Bloom\",\n RISE = \"Rise\",\n}\n\nexport interface AdFormData {\n active: boolean;\n adStyle: EnumAdStyle;\n adType: EnumAdType;\n clui?: string | null;\n end: Date; // ISO date string\n resourceCover: string;\n resourceDescription: string;\n resourceId: string;\n resourceLogo?: string | null;\n resourceName: string;\n resourceRegion: string;\n resourceType: EnumResourceType;\n showOn: EnumAdShowOn;\n socialMedia?: SocialMediaType[] | null;\n start?: Date; // ISO date string\n status: EnumAdStatus;\n targetRegion?: string | null;\n}\n\nexport type CreateAdFormData = CreateFormData<AdFormData>;\n\nexport interface AdType extends AdFormData {\n _id: string;\n clicks?: number; // How many times the ad was clicked\n createdAt: Date;\n impressions?: number; // How often the ad was seen\n start: Date; // ISO date string\n updatedAt: Date | null;\n}\n"],"mappings":";AAIO,IAAK,uBAAL,kBAAKA,0BAAL;AACL,EAAAA,sBAAA,SAAM;AACN,EAAAA,sBAAA,kBAAe;AACf,EAAAA,sBAAA,kBAAe;AACf,EAAAA,sBAAA,oBAAiB;AAJP,SAAAA;AAAA,GAAA;AAOL,IAAK,yBAAL,kBAAKC,4BAAL;AACL,EAAAA,wBAAA,kBAAe;AACf,EAAAA,wBAAA,iBAAc;AACd,EAAAA,wBAAA,8BAA2B;AAC3B,EAAAA,wBAAA,gBAAa;AAJH,SAAAA;AAAA,GAAA;AAOL,IAAK,2BAAL,kBAAKC,8BAAL;AACL,EAAAA,0BAAA,YAAS;AACT,EAAAA,0BAAA,iBAAc;AACd,EAAAA,0BAAA,aAAU;AACV,EAAAA,0BAAA,cAAW;AAJD,SAAAA;AAAA,GAAA;;;ACdL,IAAK,eAAL,kBAAKC,kBAAL;AACL,EAAAA,cAAA,iBAAc;AACd,EAAAA,cAAA,gBAAa;AACb,EAAAA,cAAA,mBAAgB;AAChB,EAAAA,cAAA,kBAAe;AAJL,SAAAA;AAAA,GAAA;AAOL,IAAK,eAAL,kBAAKC,kBAAL;AACL,EAAAA,cAAA,YAAS;AACT,EAAAA,cAAA,YAAS;AACT,EAAAA,cAAA,aAAU;AAHA,SAAAA;AAAA,GAAA;AAML,IAAK,aAAL,kBAAKC,gBAAL;AACL,EAAAA,YAAA,eAAY;AACZ,EAAAA,YAAA,UAAO;AAFG,SAAAA;AAAA,GAAA;AAKL,IAAK,cAAL,kBAAKC,iBAAL;AACL,EAAAA,aAAA,WAAQ;AACR,EAAAA,aAAA,UAAO;AAFG,SAAAA;AAAA,GAAA;","names":["OrganizedMarketCount","VendorSellingFrequency","OrganizerMarketFrequency","EnumAdShowOn","EnumAdStatus","EnumAdType","EnumAdStyle"]}
@@ -2,7 +2,7 @@ import * as _apollo_client from '@apollo/client';
2
2
  import { EnumResourceType } from '../enums/index.mjs';
3
3
  import { C as ChatType, N as NotificationType, a as NotificationCount, R as ResourceActivityType } from '../resourceActivities-CJRTZROh.mjs';
4
4
  import { E as EventType, b as EventInfoType, c as RelationType, d as ResourceConnectionsType, V as VendorType, e as VendorInfoType, U as UserLicenceType, f as UserType, g as SubscriptionStatusData } from '../global-CLsysATK.mjs';
5
- import { T as TesterType, A as AdType, E as EnumAdStatus, P as PartnerType } from '../ad-ClzcYPuT.mjs';
5
+ import { T as TesterType, A as AdType, E as EnumAdStatus, P as PartnerType } from '../ad-B89WhTMq.mjs';
6
6
  import 'react-hook-form';
7
7
 
8
8
  declare const useAdminUpdateResourceType: () => {
@@ -2,7 +2,7 @@ import * as _apollo_client from '@apollo/client';
2
2
  import { EnumResourceType } from '../enums/index.js';
3
3
  import { C as ChatType, N as NotificationType, a as NotificationCount, R as ResourceActivityType } from '../resourceActivities-CVwxvGeC.js';
4
4
  import { E as EventType, b as EventInfoType, c as RelationType, d as ResourceConnectionsType, V as VendorType, e as VendorInfoType, U as UserLicenceType, f as UserType, g as SubscriptionStatusData } from '../global-BYQMdxtO.js';
5
- import { T as TesterType, A as AdType, E as EnumAdStatus, P as PartnerType } from '../ad-CIaDLRVX.js';
5
+ import { T as TesterType, A as AdType, E as EnumAdStatus, P as PartnerType } from '../ad-Dc3Cdtpm.js';
6
6
  import 'react-hook-form';
7
7
 
8
8
  declare const useAdminUpdateResourceType: () => {
@@ -192,11 +192,11 @@ var EnumPartnerType = /* @__PURE__ */ ((EnumPartnerType2) => {
192
192
  EnumPartnerType2["SUPPORTING_PARTNER"] = "Supporting_Partner";
193
193
  return EnumPartnerType2;
194
194
  })(EnumPartnerType || {});
195
- var EnumOSPlatform = /* @__PURE__ */ ((EnumOSPlatform3) => {
196
- EnumOSPlatform3["ANDROID"] = "android";
197
- EnumOSPlatform3["IOS"] = "ios";
198
- EnumOSPlatform3["WEB"] = "web";
199
- return EnumOSPlatform3;
195
+ var EnumOSPlatform = /* @__PURE__ */ ((EnumOSPlatform2) => {
196
+ EnumOSPlatform2["ANDROID"] = "android";
197
+ EnumOSPlatform2["IOS"] = "ios";
198
+ EnumOSPlatform2["WEB"] = "web";
199
+ return EnumOSPlatform2;
200
200
  })(EnumOSPlatform || {});
201
201
  var EnumRegions = /* @__PURE__ */ ((EnumRegions2) => {
202
202
  EnumRegions2["Auckland"] = "Auckland";
@@ -689,7 +689,7 @@ var OrganizerMarketFrequency = /* @__PURE__ */ ((OrganizerMarketFrequency2) => {
689
689
 
690
690
  // src/yupSchema/tester.ts
691
691
  var testerVendorSchema = yup6.object().shape({
692
- categories: categorySchema,
692
+ categories: categorySchema.min(1, "Category list must contain at least one item").required("Categories are required"),
693
693
  marketsAttended: yup6.array().of(
694
694
  yup6.object().shape({
695
695
  city: yup6.string().trim().required("City is required"),
@@ -699,29 +699,29 @@ var testerVendorSchema = yup6.object().shape({
699
699
  productsOrServices: yup6.string().trim().required("Products or services description is required"),
700
700
  questionary: yup6.object().shape({
701
701
  appearInVideoIntroduction: yup6.boolean().optional(),
702
- applyToAtLeastOneMarket: yup6.boolean().required("Apply to at least one market commitment is required"),
703
- completeFeedbackQuestionnaire: yup6.boolean().required("Complete feedback questionnaire commitment is required"),
702
+ applyToAtLeastOneMarket: yup6.boolean().required("Required field"),
703
+ completeFeedbackQuestionnaire: yup6.boolean().required("Required field"),
704
704
  excitementAboutApp: yup6.string().trim().optional(),
705
705
  sendPhotoForSocialMedia: yup6.boolean().optional(),
706
706
  socialMediaFeatureReason: yup6.string().trim().optional(),
707
707
  testingPeriodConcerns: yup6.string().trim().optional(),
708
- tryVisitorFeatures: yup6.boolean().required("Try visitor features commitment is required"),
709
- uploadStallProfileFirstWeek: yup6.boolean().required("Upload stall profile first week commitment is required"),
708
+ tryVisitorFeatures: yup6.boolean().required("Required field"),
709
+ uploadStallProfileFirstWeek: yup6.boolean().required("Required field"),
710
710
  usefulnessExpectations: yup6.string().trim().optional()
711
711
  }),
712
712
  sellingFrequency: yup6.mixed().oneOf(
713
713
  Object.values(VendorSellingFrequency),
714
714
  "Please select a valid selling frequency"
715
- ).required("Selling frequency is required"),
715
+ ).required("Required field"),
716
716
  yearlySellingApprox: yup6.number().label("Yearly Selling Approx").min(0, "Yearly selling approximate must be at least 0").integer("Yearly selling approximate must be a whole number").required("Yearly selling approximate is required").test("no-leading-zeros", "", noLeadingZeros("Yearly selling approximate"))
717
717
  });
718
718
  var testerEventSchema = yup6.object().shape({
719
- allowMarketingAppearance: yup6.boolean().required("Allow marketing appearance is required"),
720
- completeFinalQuestionnaire: yup6.boolean().required("Complete final questionnaire commitment is required"),
721
- dailyCoordinationNeeds: yup6.string().trim().required("Daily coordination needs is required"),
722
- interestedInCharityInitiative: yup6.boolean().required("Interest in charity initiative is required"),
723
- inviteAtLeastFiveStallholders: yup6.boolean().required("Invite at least five stallholders commitment is required"),
724
- manageApplicationsAndCommunication: yup6.boolean().required("Manage applications and communication commitment is required"),
719
+ allowMarketingAppearance: yup6.boolean().optional(),
720
+ completeFinalQuestionnaire: yup6.boolean().required("Required field"),
721
+ dailyCoordinationNeeds: yup6.string().trim().optional(),
722
+ interestedInCharityInitiative: yup6.boolean().optional(),
723
+ inviteAtLeastFiveStallholders: yup6.boolean().required("Required field"),
724
+ manageApplicationsAndCommunication: yup6.boolean().required("Required field"),
725
725
  markets: yup6.array().of(
726
726
  yup6.object().shape({
727
727
  averageStallCount: yup6.number().label("Average Stall Count").min(1, "Average stall count must be at least 1").integer("Average stall count must be a whole number").required("Average stall count is required").test("no-leading-zeros", "", noLeadingZeros("Average stall count")),
@@ -737,8 +737,8 @@ var testerEventSchema = yup6.object().shape({
737
737
  Object.values(OrganizedMarketCount),
738
738
  "Please select a valid market count"
739
739
  ).required("Organized market count is required"),
740
- organizerExpectations: yup6.string().trim().required("Organizer expectations is required"),
741
- registerMarketsFirstWeek: yup6.boolean().required("Register markets first week commitment is required")
740
+ organizerExpectations: yup6.string().trim().optional(),
741
+ registerMarketsFirstWeek: yup6.boolean().required("Required field")
742
742
  });
743
743
  var testerSchema = yup6.object().shape({
744
744
  businessName: yup6.string().required("Business name is required"),
@@ -746,7 +746,7 @@ var testerSchema = yup6.object().shape({
746
746
  event: yup6.object().when("resourceType", {
747
747
  is: (resourceType) => resourceType === "event" /* EVENT */,
748
748
  otherwise: (schema) => schema.nullable().optional(),
749
- then: () => testerEventSchema
749
+ then: (schema) => schema.required("Event information is required").shape(testerEventSchema.fields)
750
750
  }),
751
751
  firstName: yup6.string().required("First name is required"),
752
752
  lastName: yup6.string().required("Last name is required"),
@@ -766,7 +766,7 @@ var testerSchema = yup6.object().shape({
766
766
  vendor: yup6.object().when("resourceType", {
767
767
  is: (resourceType) => resourceType === "vendor" /* VENDOR */,
768
768
  otherwise: (schema) => schema.nullable().optional(),
769
- then: () => testerVendorSchema
769
+ then: (schema) => schema.required("Vendor information is required").shape(testerVendorSchema.fields)
770
770
  })
771
771
  });
772
772
 
@@ -1563,7 +1563,7 @@ var import_react_hook_form11 = require("react-hook-form");
1563
1563
  var defaultValues7 = {
1564
1564
  businessName: "",
1565
1565
  email: "",
1566
- event: null,
1566
+ event: {},
1567
1567
  firstName: "",
1568
1568
  lastName: "",
1569
1569
  mobilePhone: "",
@@ -1571,7 +1571,7 @@ var defaultValues7 = {
1571
1571
  privacyConsent: false,
1572
1572
  region: "",
1573
1573
  resourceType: "",
1574
- vendor: null
1574
+ vendor: {}
1575
1575
  };
1576
1576
  function useTesterForm(data) {
1577
1577
  const {
@@ -1581,13 +1581,10 @@ function useTesterForm(data) {
1581
1581
  handleSubmit,
1582
1582
  reset,
1583
1583
  setValue,
1584
- trigger,
1585
1584
  watch
1586
1585
  } = (0, import_react_hook_form11.useForm)({
1587
1586
  defaultValues: defaultValues7,
1588
- mode: "onChange",
1589
- resolver: (0, import_yup11.yupResolver)(testerSchema),
1590
- reValidateMode: "onChange"
1587
+ resolver: (0, import_yup11.yupResolver)(testerSchema)
1591
1588
  });
1592
1589
  import_react.default.useEffect(() => {
1593
1590
  if (data) {
@@ -1607,80 +1604,34 @@ function useTesterForm(data) {
1607
1604
  } else {
1608
1605
  reset(defaultValues7);
1609
1606
  }
1610
- }, [data, reset]);
1611
- const resourceType = watch("resourceType");
1612
- const vendor = watch("vendor");
1613
- const event = watch("event");
1614
- import_react.default.useEffect(() => {
1615
- if (resourceType === "vendor" /* VENDOR */ && vendor === null) {
1616
- const emptyVendor = {
1617
- categories: [],
1618
- marketsAttended: [],
1619
- productsOrServices: "",
1620
- questionary: {
1621
- applyToAtLeastOneMarket: false,
1622
- completeFeedbackQuestionnaire: false,
1623
- tryVisitorFeatures: false,
1624
- uploadStallProfileFirstWeek: false
1625
- }
1626
- };
1627
- setValue("vendor", emptyVendor, { shouldValidate: true });
1628
- } else if (resourceType === "event" /* EVENT */ && vendor !== null) {
1629
- setValue("vendor", null, { shouldValidate: true });
1630
- }
1631
- }, [resourceType, vendor, setValue]);
1632
- import_react.default.useEffect(() => {
1633
- if (resourceType === "event" /* EVENT */ && event === null) {
1634
- const emptyEvent = {
1635
- allowMarketingAppearance: false,
1636
- completeFinalQuestionnaire: false,
1637
- dailyCoordinationNeeds: "",
1638
- interestedInCharityInitiative: false,
1639
- inviteAtLeastFiveStallholders: false,
1640
- manageApplicationsAndCommunication: false,
1641
- markets: [],
1642
- organizerExpectations: "",
1643
- registerMarketsFirstWeek: false
1644
- };
1645
- setValue("event", emptyEvent, { shouldValidate: true });
1646
- } else if (resourceType === "vendor" /* VENDOR */ && event !== null) {
1647
- setValue("event", null, { shouldValidate: true });
1648
- }
1649
- }, [resourceType, event, setValue]);
1650
- import_react.default.useEffect(() => {
1651
- if (resourceType === "vendor" /* VENDOR */ && vendor !== null) {
1652
- trigger("vendor");
1653
- }
1654
- }, [resourceType, vendor, trigger]);
1655
- import_react.default.useEffect(() => {
1656
- if (resourceType === "event" /* EVENT */ && event !== null) {
1657
- trigger("event");
1658
- }
1659
- }, [resourceType, event, trigger]);
1607
+ }, [data]);
1660
1608
  const {
1661
1609
  businessName,
1662
1610
  email,
1611
+ event,
1663
1612
  firstName,
1664
1613
  lastName,
1665
1614
  mobilePhone,
1666
1615
  osType,
1667
1616
  privacyConsent,
1668
- region
1617
+ region,
1618
+ resourceType,
1619
+ vendor
1669
1620
  } = getValues();
1670
1621
  return {
1671
1622
  control,
1672
1623
  fields: {
1673
1624
  businessName,
1674
1625
  email,
1675
- event: event || null,
1626
+ event,
1676
1627
  firstName,
1677
1628
  lastName,
1678
1629
  mobilePhone,
1679
1630
  osType,
1680
1631
  privacyConsent,
1681
1632
  region,
1682
- resourceType: resourceType || "",
1683
- vendor: vendor || null
1633
+ resourceType,
1634
+ vendor
1684
1635
  },
1685
1636
  formState: { errors },
1686
1637
  handleSubmit,