@timardex/cluemart-shared 1.0.14 → 1.0.16

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.
Files changed (54) hide show
  1. package/dist/auth-CdcH8nqw.d.mts +84 -0
  2. package/dist/auth-TM_XttY3.d.ts +84 -0
  3. package/dist/chat-NGx5Emrr.d.mts +27 -0
  4. package/dist/chat-NGx5Emrr.d.ts +27 -0
  5. package/dist/chunk-K5NK2CK5.mjs +133 -0
  6. package/dist/chunk-K5NK2CK5.mjs.map +1 -0
  7. package/dist/chunk-L2H5WFGC.mjs +100 -0
  8. package/dist/chunk-L2H5WFGC.mjs.map +1 -0
  9. package/dist/enums/index.cjs +134 -0
  10. package/dist/enums/index.cjs.map +1 -0
  11. package/dist/enums/index.d.mts +75 -0
  12. package/dist/enums/index.d.ts +75 -0
  13. package/dist/enums/index.mjs +27 -0
  14. package/dist/enums/index.mjs.map +1 -0
  15. package/dist/formFields/index.cjs +888 -0
  16. package/dist/formFields/index.cjs.map +1 -0
  17. package/dist/formFields/index.d.mts +60 -0
  18. package/dist/formFields/index.d.ts +60 -0
  19. package/dist/formFields/index.mjs +754 -0
  20. package/dist/formFields/index.mjs.map +1 -0
  21. package/dist/global-B7gB8cvC.d.ts +338 -0
  22. package/dist/global-B8kYikwQ.d.mts +338 -0
  23. package/dist/graphql/index.cjs +1634 -0
  24. package/dist/graphql/index.cjs.map +1 -0
  25. package/dist/graphql/index.d.mts +299 -0
  26. package/dist/graphql/index.d.ts +299 -0
  27. package/dist/graphql/index.mjs +1558 -0
  28. package/dist/graphql/index.mjs.map +1 -0
  29. package/dist/hooks/index.cjs +1090 -0
  30. package/dist/hooks/index.cjs.map +1 -0
  31. package/dist/hooks/index.d.mts +78 -0
  32. package/dist/hooks/index.d.ts +78 -0
  33. package/dist/hooks/index.mjs +970 -0
  34. package/dist/hooks/index.mjs.map +1 -0
  35. package/dist/index.cjs +89 -83
  36. package/dist/index.cjs.map +1 -0
  37. package/dist/index.d.mts +16 -299
  38. package/dist/index.d.ts +16 -299
  39. package/dist/index.mjs +87 -60
  40. package/dist/index.mjs.map +1 -1
  41. package/dist/types/index.cjs +19 -0
  42. package/dist/types/index.cjs.map +1 -0
  43. package/dist/types/index.d.mts +12 -0
  44. package/dist/types/index.d.ts +12 -0
  45. package/dist/types/index.mjs +1 -0
  46. package/dist/types/index.mjs.map +1 -0
  47. package/dist/utils/index.cjs +215 -0
  48. package/dist/utils/index.cjs.map +1 -0
  49. package/dist/utils/index.d.mts +66 -0
  50. package/dist/utils/index.d.ts +66 -0
  51. package/dist/utils/index.mjs +38 -0
  52. package/dist/utils/index.mjs.map +1 -0
  53. package/package.json +37 -4
  54. package/dist/index.js.map +0 -1
package/dist/index.d.ts CHANGED
@@ -1,27 +1,25 @@
1
1
  import { Control, FieldErrors, UseFormHandleSubmit, UseFormReset, UseFormSetValue, UseFormWatch } from 'react-hook-form';
2
- import * as yup from 'yup';
3
- import { TestFunction } from 'yup';
4
2
  import * as _apollo_client from '@apollo/client';
5
3
 
6
4
  declare enum EnumInviteStatus {
7
5
  ACCEPTED = "Accepted",
8
6
  COMPLETED = "Completed",
9
7
  EXPIRED = "Expired",
10
- NO_STATUS = "No Status",
8
+ NO_STATUS = "No_Status",
11
9
  PENDING = "Pending",
12
10
  REJECTED = "Rejected",
13
- WAITING = "waiting"
11
+ WAITING = "Waiting"
14
12
  }
15
13
  declare enum EnumRejectionPolicy {
16
- SINGLE_DATE_ALLOWED = "Single date allowed",
17
- MULTI_DATE_ALLOWED = "Multi date allowed"
14
+ SINGLE_DATE_ALLOWED = "single_date_allowed",
15
+ MULTI_DATE_ALLOWED = "multi_date_allowed"
18
16
  }
19
17
  declare enum EnumPaymentMethod {
20
- CASH = "Cash",
21
- EFTPOS = "Eftpos",
22
- BANK_TRANSFER = "Bank Transfer",
23
- PAYPAL = "PayPal",
24
- STRIPE = "Stripe"
18
+ CASH = "cash",
19
+ EFTPOS = "eftpos",
20
+ BANK_TRANSFER = "bank_transfer",
21
+ PAYPAL = "paypal",
22
+ STRIPE = "stripe"
25
23
  }
26
24
  declare enum EnumResourceType {
27
25
  MARKET = "market",
@@ -220,7 +218,11 @@ type StallApplicationInfoType = {
220
218
  applicationDeadlineHours: number;
221
219
  paymentDueHours: number;
222
220
  paymentMethod: EnumPaymentMethod;
223
- paymentTarget: string;
221
+ paymentTarget: {
222
+ accountHolderName?: string;
223
+ accountNumber?: string;
224
+ link?: string;
225
+ };
224
226
  rejectionPolicy: EnumRejectionPolicy;
225
227
  stallCapacity: number;
226
228
  };
@@ -651,290 +653,6 @@ declare const defaultMarketFormValues: MarketFormData;
651
653
  declare const defaultStallholderFormValues: StallholderFormData;
652
654
  declare const defaultStallholderApplyFormValues: StallholderApplyFormFormData;
653
655
 
654
- type NoLeadingZerosOptions = {
655
- allowDecimal?: boolean;
656
- };
657
- declare const noLeadingZeros: (fieldName: string, options?: NoLeadingZerosOptions) => TestFunction<number | undefined>;
658
- declare const endDateNotInPastTest: yup.StringSchema<string | undefined, yup.AnyObject, undefined, "">;
659
- declare const startDateNotInPastTest: yup.StringSchema<string | undefined, yup.AnyObject, undefined, "">;
660
- declare const endDateAfterStartDateTest: yup.StringSchema<string | undefined, yup.AnyObject, undefined, "">;
661
- declare const endTimeMustBeAfterStartTimeTest: yup.StringSchema<string | undefined, yup.AnyObject, undefined, "">;
662
- declare const startTimeCannotBeInPastTest: yup.StringSchema<string | undefined, yup.AnyObject, undefined, "">;
663
- declare const dateTimeSchema: yup.ObjectSchema<{
664
- endDate: string;
665
- endTime: string;
666
- marketPrice: number;
667
- startDate: string;
668
- startTime: string;
669
- }, yup.AnyObject, {
670
- endDate: undefined;
671
- endTime: undefined;
672
- marketPrice: undefined;
673
- startDate: undefined;
674
- startTime: undefined;
675
- }, "">;
676
- declare const locationSchema: yup.ObjectSchema<{
677
- city: string;
678
- coordinates: number[];
679
- country: string;
680
- fullAddress: string;
681
- latitude: number;
682
- longitude: number;
683
- region: string;
684
- type: "Point";
685
- }, yup.AnyObject, {
686
- city: undefined;
687
- coordinates: "";
688
- country: undefined;
689
- fullAddress: undefined;
690
- latitude: undefined;
691
- longitude: undefined;
692
- region: undefined;
693
- type: "Point";
694
- }, "">;
695
- declare const emailSchema: yup.StringSchema<string, yup.AnyObject, undefined, "">;
696
- declare const passwordSchema: yup.StringSchema<string, yup.AnyObject, undefined, "">;
697
- declare const globalResourceSchema: yup.ObjectSchema<{
698
- active: NonNullable<boolean | undefined>;
699
- cover: {
700
- source: string;
701
- title: string;
702
- };
703
- description: string;
704
- name: string;
705
- region: string;
706
- }, yup.AnyObject, {
707
- active: undefined;
708
- cover: {
709
- source: undefined;
710
- title: undefined;
711
- };
712
- description: undefined;
713
- name: undefined;
714
- region: undefined;
715
- }, "">;
716
-
717
- declare const marketSchema: yup.ObjectSchema<{
718
- active: NonNullable<boolean | undefined>;
719
- cover: {
720
- source: string;
721
- title: string;
722
- };
723
- description: string;
724
- name: string;
725
- region: string;
726
- dateTime: {
727
- endDate: string;
728
- endTime: string;
729
- startDate: string;
730
- startTime: string;
731
- marketPrice: number;
732
- }[];
733
- location: {
734
- region: string;
735
- latitude: number;
736
- longitude: number;
737
- city: string;
738
- coordinates: number[];
739
- country: string;
740
- fullAddress: string;
741
- type: "Point";
742
- };
743
- provider: string;
744
- stallApplicationInfo: {
745
- paymentMethod: NonNullable<EnumPaymentMethod | undefined>;
746
- applicationDeadlineHours: number;
747
- paymentDueHours: number;
748
- paymentTarget: string;
749
- rejectionPolicy: NonNullable<EnumRejectionPolicy | undefined>;
750
- stallCapacity: number;
751
- };
752
- tags: string[] | null | undefined;
753
- }, yup.AnyObject, {
754
- active: undefined;
755
- cover: {
756
- source: undefined;
757
- title: undefined;
758
- };
759
- description: undefined;
760
- name: undefined;
761
- region: undefined;
762
- dateTime: "";
763
- location: {
764
- city: undefined;
765
- coordinates: "";
766
- country: undefined;
767
- fullAddress: undefined;
768
- latitude: undefined;
769
- longitude: undefined;
770
- region: undefined;
771
- type: "Point";
772
- };
773
- provider: undefined;
774
- stallApplicationInfo: {
775
- applicationDeadlineHours: undefined;
776
- paymentDueHours: undefined;
777
- paymentMethod: undefined;
778
- paymentTarget: undefined;
779
- rejectionPolicy: undefined;
780
- stallCapacity: undefined;
781
- };
782
- tags: "";
783
- }, "">;
784
-
785
- declare const stallHolderSchema: yup.ObjectSchema<{
786
- active: NonNullable<boolean | undefined>;
787
- cover: {
788
- source: string;
789
- title: string;
790
- };
791
- description: string;
792
- name: string;
793
- region: string;
794
- categories: {
795
- subcategories?: {
796
- items?: string[] | null | undefined;
797
- name: string;
798
- id: string;
799
- }[] | null | undefined;
800
- name: string;
801
- id: string;
802
- }[];
803
- multiLocation: NonNullable<boolean | undefined>;
804
- products: string[];
805
- }, yup.AnyObject, {
806
- active: undefined;
807
- cover: {
808
- source: undefined;
809
- title: undefined;
810
- };
811
- description: undefined;
812
- name: undefined;
813
- region: undefined;
814
- categories: "";
815
- multiLocation: undefined;
816
- products: "";
817
- }, "">;
818
- declare const stallholderApplyFormSchema: yup.ObjectSchema<{
819
- active: NonNullable<boolean | undefined>;
820
- electricity: {
821
- details?: string | null | undefined;
822
- isRequired: NonNullable<boolean | undefined>;
823
- };
824
- foodSafetyGradeFiles: string[] | null | undefined;
825
- foodSafetyGradeFilesUpload: string[] | null | undefined;
826
- gazebo: {
827
- details?: string | null | undefined;
828
- isRequired: NonNullable<boolean | undefined>;
829
- };
830
- packaging: string[];
831
- paymentMethod: NonNullable<EnumPaymentMethod | undefined>;
832
- priceRange: {
833
- max: number;
834
- min: number;
835
- };
836
- producedIn: string[];
837
- stallSize: {
838
- depth: number;
839
- width: number;
840
- };
841
- table: {
842
- details?: string | null | undefined;
843
- isRequired: NonNullable<boolean | undefined>;
844
- };
845
- }, yup.AnyObject, {
846
- active: undefined;
847
- electricity: {
848
- details: undefined;
849
- isRequired: undefined;
850
- };
851
- foodSafetyGradeFiles: "";
852
- foodSafetyGradeFilesUpload: "";
853
- gazebo: {
854
- details: undefined;
855
- isRequired: undefined;
856
- };
857
- packaging: "";
858
- paymentMethod: undefined;
859
- priceRange: {
860
- max: undefined;
861
- min: undefined;
862
- };
863
- producedIn: "";
864
- stallSize: {
865
- depth: undefined;
866
- width: undefined;
867
- };
868
- table: {
869
- details: undefined;
870
- isRequired: undefined;
871
- };
872
- }, "">;
873
-
874
- declare const userSchema: yup.ObjectSchema<{
875
- active: NonNullable<boolean | undefined>;
876
- email: string;
877
- firstName: string;
878
- lastName: string;
879
- password: string;
880
- preferredRegion: string;
881
- confirmPassword: string;
882
- role: NonNullable<EnumUserRole | undefined>;
883
- }, yup.AnyObject, {
884
- active: undefined;
885
- email: undefined;
886
- firstName: undefined;
887
- lastName: undefined;
888
- password: undefined;
889
- preferredRegion: undefined;
890
- confirmPassword: undefined;
891
- role: undefined;
892
- }, "">;
893
-
894
- declare const loginSchema: yup.ObjectSchema<{
895
- email: string;
896
- password: string;
897
- }, yup.AnyObject, {
898
- email: undefined;
899
- password: undefined;
900
- }, "">;
901
- declare const registerSchema: yup.ObjectSchema<{
902
- email: string;
903
- firstName: string;
904
- lastName: string;
905
- password: string;
906
- preferredRegion: string;
907
- role: NonNullable<EnumUserRole | undefined>;
908
- }, yup.AnyObject, {
909
- email: undefined;
910
- firstName: undefined;
911
- lastName: undefined;
912
- password: undefined;
913
- preferredRegion: undefined;
914
- role: undefined;
915
- }, "">;
916
- declare const requestPasswordResetSchema: yup.ObjectSchema<{
917
- email: string;
918
- }, yup.AnyObject, {
919
- email: undefined;
920
- }, "">;
921
- declare const resetPasswordSchema: yup.ObjectSchema<{
922
- email: string;
923
- password: string;
924
- confirmPassword: string;
925
- }, yup.AnyObject, {
926
- email: undefined;
927
- password: undefined;
928
- confirmPassword: undefined;
929
- }, "">;
930
- declare const validateTokenSchema: yup.ObjectSchema<{
931
- email: string;
932
- token: string;
933
- }, yup.AnyObject, {
934
- email: undefined;
935
- token: undefined;
936
- }, "">;
937
-
938
656
  declare const useLogin: () => {
939
657
  error: _apollo_client.ApolloError | undefined;
940
658
  loading: boolean;
@@ -1263,8 +981,7 @@ declare const producedIngOptions: OptionItem[];
1263
981
 
1264
982
  declare const marketBasicInfoFields: FormField[];
1265
983
  declare const stallApplicationInfo: FormField[];
1266
- declare const stallApplicationInfoPaymentTarget: FormField;
1267
- declare const stallApplicationInfoDropdowns: FormField[];
984
+ declare const stallApplicationInfoPaymentTarget: FormField[];
1268
985
  declare const marketStartDateFields: FormDateField[];
1269
986
  declare const marketPriceByDateFields: FormField[];
1270
987
  declare const marketEndDateFields: FormDateField[];
@@ -1283,4 +1000,4 @@ declare const profileFields: FormField[];
1283
1000
  declare const availableCategories: Category[];
1284
1001
  declare const categoryColors: Record<string, string>;
1285
1002
 
1286
- export { type BaseResourceType, type BaseResourceTypeFormData, type Category, type ChatInput, type ChatMessageInput, type ChatMessageType, type ChatType, type CreateLoginFormData, type CreateMarketFormData, type CreateRegisterFormData, type CreateRequestPasswordResetFormData, type CreateResetPasswordFormData, type CreateStallholderApplyFormFormData, type CreateStallholderFormData, type CreateUserFormData, type CreateValidateTokenFormData, type DateTimeType, type DateTimeWithPrice, EnumInviteStatus, EnumNotification, EnumPaymentMethod, EnumRegions, EnumRejectionPolicy, EnumRelationResource, EnumResourceType, EnumResourceTypeIcon, EnumUserLicence, EnumUserRole, type FormDateField, type FormField, type GeocodeLocation, type ImageObjectType, ImageTypeEnum, type LocationType, type LoginFormData, type MapMultiLocation, type MarketFormData, type MarketType, type MarketWithConnectionDatesType, type NotificationType, type Nullable, type OptionItem, type PlacePrediction, type PosterInputType, type Region, type RegisterFormData, type RelationDate, type RelationLog, type RelationType, type RequestPasswordResetFormData, type ResetPasswordFormData, type ResourceConnectionsType, type ResourceImageType, type SatllholderWithConnectionDatesType, type StallApplicationInfoType, type StallholderApplyFormFormData, type StallholderApplyFormType, type StallholderAttributes, type StallholderFormData, type StallholderLocation, type StallholderType, type Subcategory, type UserFormData, type UserType, type ValidateTokenFormData, availableCategories, availableCityOptions, availableRegionOptions, availableRegionTypes, availableTagTypes, capitalizeFirstLetter, categoryColors, dateFormat, dateTimeSchema, defaultMarketFormValues, defaultRegion, defaultStallholderApplyFormValues, defaultStallholderFormValues, emailSchema, endDateAfterStartDateTest, endDateNotInPastTest, endTimeMustBeAfterStartTimeTest, formatDate, formatTimestamp, getCurrentAndFutureDates, getFutureDatesAfterThreshold, globalDefaultValues, globalResourceSchema, locationSchema, loginFields, loginSchema, mapArrayToOptions, marketBasicInfoFields, marketEndDateFields, marketPriceByDateFields, marketSchema, marketStartDateFields, noLeadingZeros, packagingOptions, passwordSchema, paymentMethodOptions, producedIngOptions, profileFields, registerFields, registerSchema, rejectionPolicyOptions, removeTypename, requestPasswordResetFields, requestPasswordResetSchema, resetPasswordFields, resetPasswordSchema, sortDatesByProximity, stallApplicationInfo, stallApplicationInfoDropdowns, stallApplicationInfoPaymentTarget, stallHolderSchema, stallholderApplyFormSchema, stallholderBasicInfoFields, stallholderElectricity, stallholderEndDateFields, stallholderFullAddress, stallholderGazebo, stallholderLocationDescription, stallholderMultiLocation, stallholderPackaging, stallholderPaymentMethod, stallholderPriceRange, stallholderProducedIn, stallholderStallSize, stallholderStartDateFields, stallholderTable, startDateNotInPastTest, startTimeCannotBeInPastTest, statusOptions, tagOptions, timeFormat, truncateText, useAddParticipantToChat, useAddUserFavouriteResource, useCreateChat, useCreateMarket, useCreatePoster, useCreateRelation, useCreateStallholder, useCreateStallholderApplyForm, useCreateUser, useDeleteChat, useDeleteMarket, useDeleteRelation, useDeleteStallholder, useGetChat, useGetChatSubscription, useGetMarket, useGetMarketRelations, useGetMarkets, useGetMarketsByRegion, useGetMarketsNearMe, useGetNotification, useGetRelation, useGetRelationByMarketAndStallholder, useGetResourceConnections, useGetStallholder, useGetStallholderApplyForm, useGetStallholderRelations, useGetStallholders, useGetStallholdersByRegion, useGetUser, useGetUserChats, useGetUserFavourites, useGetUserMarkets, useGetUserNotifications, useGetUsers, useLocationSearch, useLogin, useLoginForm, useMarketForm, useRegister, useRegisterForm, useRemoveParticipantFromChat, useRemoveUserFavouriteResource, useRequestPasswordReset, useRequestPasswordResetForm, useResetPassword, useResetPasswordForm, useSearchMarkets, useSearchStallholders, useSendChatMessage, useStallholderApplyForm, useStallholderForm, useUpdateMarket, useUpdateRelation, useUpdateStallholder, useUpdateStallholderApplyForm, useUpdateUser, useUserForm, useValidateToken, useValidateTokenForm, userSchema, validateTokenFields, validateTokenSchema };
1003
+ export { type BaseResourceType, type BaseResourceTypeFormData, type Category, type ChatInput, type ChatMessageInput, type ChatMessageType, type ChatType, type CreateLoginFormData, type CreateMarketFormData, type CreateRegisterFormData, type CreateRequestPasswordResetFormData, type CreateResetPasswordFormData, type CreateStallholderApplyFormFormData, type CreateStallholderFormData, type CreateUserFormData, type CreateValidateTokenFormData, type DateTimeType, type DateTimeWithPrice, EnumInviteStatus, EnumNotification, EnumPaymentMethod, EnumRegions, EnumRejectionPolicy, EnumRelationResource, EnumResourceType, EnumResourceTypeIcon, EnumUserLicence, EnumUserRole, type FormDateField, type FormField, type GeocodeLocation, type ImageObjectType, ImageTypeEnum, type LocationType, type LoginFormData, type MapMultiLocation, type MarketFormData, type MarketType, type MarketWithConnectionDatesType, type NotificationType, type Nullable, type OptionItem, type PlacePrediction, type PosterInputType, type Region, type RegisterFormData, type RelationDate, type RelationLog, type RelationType, type RequestPasswordResetFormData, type ResetPasswordFormData, type ResourceConnectionsType, type ResourceImageType, type SatllholderWithConnectionDatesType, type StallApplicationInfoType, type StallholderApplyFormFormData, type StallholderApplyFormType, type StallholderAttributes, type StallholderFormData, type StallholderLocation, type StallholderType, type Subcategory, type UserFormData, type UserType, type ValidateTokenFormData, availableCategories, availableCityOptions, availableRegionOptions, availableRegionTypes, availableTagTypes, capitalizeFirstLetter, categoryColors, dateFormat, defaultMarketFormValues, defaultRegion, defaultStallholderApplyFormValues, defaultStallholderFormValues, formatDate, formatTimestamp, getCurrentAndFutureDates, getFutureDatesAfterThreshold, globalDefaultValues, loginFields, mapArrayToOptions, marketBasicInfoFields, marketEndDateFields, marketPriceByDateFields, marketStartDateFields, packagingOptions, paymentMethodOptions, producedIngOptions, profileFields, registerFields, rejectionPolicyOptions, removeTypename, requestPasswordResetFields, resetPasswordFields, sortDatesByProximity, stallApplicationInfo, stallApplicationInfoPaymentTarget, stallholderBasicInfoFields, stallholderElectricity, stallholderEndDateFields, stallholderFullAddress, stallholderGazebo, stallholderLocationDescription, stallholderMultiLocation, stallholderPackaging, stallholderPaymentMethod, stallholderPriceRange, stallholderProducedIn, stallholderStallSize, stallholderStartDateFields, stallholderTable, statusOptions, tagOptions, timeFormat, truncateText, useAddParticipantToChat, useAddUserFavouriteResource, useCreateChat, useCreateMarket, useCreatePoster, useCreateRelation, useCreateStallholder, useCreateStallholderApplyForm, useCreateUser, useDeleteChat, useDeleteMarket, useDeleteRelation, useDeleteStallholder, useGetChat, useGetChatSubscription, useGetMarket, useGetMarketRelations, useGetMarkets, useGetMarketsByRegion, useGetMarketsNearMe, useGetNotification, useGetRelation, useGetRelationByMarketAndStallholder, useGetResourceConnections, useGetStallholder, useGetStallholderApplyForm, useGetStallholderRelations, useGetStallholders, useGetStallholdersByRegion, useGetUser, useGetUserChats, useGetUserFavourites, useGetUserMarkets, useGetUserNotifications, useGetUsers, useLocationSearch, useLogin, useLoginForm, useMarketForm, useRegister, useRegisterForm, useRemoveParticipantFromChat, useRemoveUserFavouriteResource, useRequestPasswordReset, useRequestPasswordResetForm, useResetPassword, useResetPasswordForm, useSearchMarkets, useSearchStallholders, useSendChatMessage, useStallholderApplyForm, useStallholderForm, useUpdateMarket, useUpdateRelation, useUpdateStallholder, useUpdateStallholderApplyForm, useUpdateUser, useUserForm, useValidateToken, useValidateTokenForm, validateTokenFields };
package/dist/index.mjs CHANGED
@@ -1,31 +1,32 @@
1
- // src/utils.ts
1
+ // src/utils/index.ts
2
2
  import dayjs, { extend } from "dayjs";
3
3
  import customParseFormat from "dayjs/plugin/customParseFormat";
4
+ import isSameOrAfter from "dayjs/plugin/isSameOrAfter";
4
5
  import timezone from "dayjs/plugin/timezone";
5
6
  import utc from "dayjs/plugin/utc";
6
7
 
7
- // src/enums.ts
8
+ // src/enums/index.ts
8
9
  var EnumInviteStatus = /* @__PURE__ */ ((EnumInviteStatus2) => {
9
10
  EnumInviteStatus2["ACCEPTED"] = "Accepted";
10
11
  EnumInviteStatus2["COMPLETED"] = "Completed";
11
12
  EnumInviteStatus2["EXPIRED"] = "Expired";
12
- EnumInviteStatus2["NO_STATUS"] = "No Status";
13
+ EnumInviteStatus2["NO_STATUS"] = "No_Status";
13
14
  EnumInviteStatus2["PENDING"] = "Pending";
14
15
  EnumInviteStatus2["REJECTED"] = "Rejected";
15
- EnumInviteStatus2["WAITING"] = "waiting";
16
+ EnumInviteStatus2["WAITING"] = "Waiting";
16
17
  return EnumInviteStatus2;
17
18
  })(EnumInviteStatus || {});
18
19
  var EnumRejectionPolicy = /* @__PURE__ */ ((EnumRejectionPolicy2) => {
19
- EnumRejectionPolicy2["SINGLE_DATE_ALLOWED"] = "Single date allowed";
20
- EnumRejectionPolicy2["MULTI_DATE_ALLOWED"] = "Multi date allowed";
20
+ EnumRejectionPolicy2["SINGLE_DATE_ALLOWED"] = "single_date_allowed";
21
+ EnumRejectionPolicy2["MULTI_DATE_ALLOWED"] = "multi_date_allowed";
21
22
  return EnumRejectionPolicy2;
22
23
  })(EnumRejectionPolicy || {});
23
24
  var EnumPaymentMethod = /* @__PURE__ */ ((EnumPaymentMethod3) => {
24
- EnumPaymentMethod3["CASH"] = "Cash";
25
- EnumPaymentMethod3["EFTPOS"] = "Eftpos";
26
- EnumPaymentMethod3["BANK_TRANSFER"] = "Bank Transfer";
27
- EnumPaymentMethod3["PAYPAL"] = "PayPal";
28
- EnumPaymentMethod3["STRIPE"] = "Stripe";
25
+ EnumPaymentMethod3["CASH"] = "cash";
26
+ EnumPaymentMethod3["EFTPOS"] = "eftpos";
27
+ EnumPaymentMethod3["BANK_TRANSFER"] = "bank_transfer";
28
+ EnumPaymentMethod3["PAYPAL"] = "paypal";
29
+ EnumPaymentMethod3["STRIPE"] = "stripe";
29
30
  return EnumPaymentMethod3;
30
31
  })(EnumPaymentMethod || {});
31
32
  var EnumResourceType = /* @__PURE__ */ ((EnumResourceType2) => {
@@ -90,12 +91,13 @@ var EnumUserRole = /* @__PURE__ */ ((EnumUserRole2) => {
90
91
  return EnumUserRole2;
91
92
  })(EnumUserRole || {});
92
93
 
93
- // src/utils.ts
94
+ // src/utils/index.ts
94
95
  var dateFormat = "DD-MM-YYYY";
95
96
  var timeFormat = "HH:mm";
96
97
  extend(customParseFormat);
97
98
  extend(utc);
98
99
  extend(timezone);
100
+ extend(isSameOrAfter);
99
101
  var formatDate = (dateStr, display = "datetime", timeStr) => {
100
102
  const dateTimeStr = timeStr ? `${dateStr} ${timeStr}` : dateStr;
101
103
  const dateTime = timeStr ? dayjs(dateTimeStr, `${dateFormat} ${timeFormat}`) : dayjs(dateStr, dateFormat);
@@ -160,8 +162,8 @@ var truncateText = (text, maxLength = 30) => {
160
162
  return text.length > maxLength ? text.substring(0, maxLength) + "..." : text;
161
163
  };
162
164
  var mapArrayToOptions = (items) => items.map((item) => ({
163
- label: item,
164
- value: item
165
+ label: item.replace(/_/g, " "),
166
+ value: item.replace(/\s+/g, "_").toLowerCase()
165
167
  }));
166
168
  var capitalizeFirstLetter = (str) => {
167
169
  return str.split(" ").map((word) => word.charAt(0).toUpperCase() + word.slice(1).toLowerCase()).join(" ");
@@ -274,7 +276,7 @@ import { useForm } from "react-hook-form";
274
276
  // src/yupSchema/global.ts
275
277
  import dayjs2, { extend as extend2 } from "dayjs";
276
278
  import customParseFormat2 from "dayjs/plugin/customParseFormat";
277
- import isSameOrAfter from "dayjs/plugin/isSameOrAfter";
279
+ import isSameOrAfter2 from "dayjs/plugin/isSameOrAfter";
278
280
  import * as yup from "yup";
279
281
  var noLeadingZeros = (fieldName, options = {}) => {
280
282
  return function(value, context) {
@@ -288,7 +290,7 @@ var noLeadingZeros = (fieldName, options = {}) => {
288
290
  return true;
289
291
  };
290
292
  };
291
- extend2(isSameOrAfter);
293
+ extend2(isSameOrAfter2);
292
294
  extend2(customParseFormat2);
293
295
  var now = dayjs2();
294
296
  var endDateNotInPastTest = yup.string().test("not-in-past", "End date cannot be in the past", (value) => {
@@ -383,6 +385,7 @@ var globalResourceSchema = yup.object().shape({
383
385
 
384
386
  // src/yupSchema/market.ts
385
387
  import * as yup2 from "yup";
388
+ var nzBankAccountRegex = /^\d{2}-\d{4}-\d{7}-\d{2}$/;
386
389
  var marketSchema = globalResourceSchema.shape({
387
390
  dateTime: yup2.array().of(dateTimeSchema).required("DateTime is required"),
388
391
  location: locationSchema,
@@ -395,7 +398,33 @@ var marketSchema = globalResourceSchema.shape({
395
398
  ),
396
399
  paymentDueHours: yup2.number().typeError("Payment due hours must be a number").min(1, "Payment due hours must be at least 1").required("Payment due hours is required").test("no-leading-zeros", "", noLeadingZeros("Payment due hours")),
397
400
  paymentMethod: yup2.mixed().oneOf(Object.values(EnumPaymentMethod)).required("Please select a Payment method"),
398
- paymentTarget: yup2.string().trim().required("Payment target is required"),
401
+ paymentTarget: yup2.object().when("paymentMethod", (paymentMethod, schema) => {
402
+ const isBankTransfer = paymentMethod.includes(
403
+ "bank_transfer" /* BANK_TRANSFER */
404
+ );
405
+ if (!isBankTransfer) {
406
+ return schema.shape({
407
+ accountHolderName: yup2.string().notRequired(),
408
+ accountNumber: yup2.string().notRequired(),
409
+ link: yup2.string().trim().required("Link is required for PayPal/Stripe")
410
+ });
411
+ } else if (isBankTransfer) {
412
+ return schema.shape({
413
+ accountHolderName: yup2.string().trim().required("Account holder name is required for bank transfer"),
414
+ accountNumber: yup2.string().trim().required("Account number is required for bank transfer").matches(
415
+ nzBankAccountRegex,
416
+ "Account number must be in format: XX-XXXX-XXXXXXX-XX"
417
+ ),
418
+ link: yup2.string().notRequired()
419
+ });
420
+ } else {
421
+ return schema.shape({
422
+ accountHolderName: yup2.string().notRequired(),
423
+ accountNumber: yup2.string().notRequired(),
424
+ link: yup2.string().notRequired()
425
+ });
426
+ }
427
+ }),
399
428
  rejectionPolicy: yup2.mixed().oneOf(Object.values(EnumRejectionPolicy)).required("Rejection policy is required"),
400
429
  stallCapacity: yup2.number().typeError("Stall capacity must be a number").min(1, "Stall capacity must be at least 1").integer("Stall capacity must be a whole number").required("Stall capacity is required").test("no-leading-zeros", "", noLeadingZeros("Stall capacity"))
401
430
  }),
@@ -560,8 +589,12 @@ var defaultMarketFormValues = {
560
589
  applicationDeadlineHours: 0,
561
590
  paymentDueHours: 0,
562
591
  paymentMethod: "",
563
- paymentTarget: "",
564
- rejectionPolicy: "Multi date allowed" /* MULTI_DATE_ALLOWED */,
592
+ paymentTarget: {
593
+ accountHolderName: "",
594
+ accountNumber: "",
595
+ link: ""
596
+ },
597
+ rejectionPolicy: "multi_date_allowed" /* MULTI_DATE_ALLOWED */,
565
598
  stallCapacity: 0
566
599
  },
567
600
  tags: null
@@ -1454,6 +1487,26 @@ var MARKET_LOCATION_FIELDS_FRAGMENT = gql5`
1454
1487
  type
1455
1488
  }
1456
1489
  `;
1490
+ var PAYMENT_TARGET_FIELDS_FRAGMENT = gql5`
1491
+ fragment PaymentTargetFields on PaymentTargetType {
1492
+ accountHolderName
1493
+ accountNumber
1494
+ link
1495
+ }
1496
+ `;
1497
+ var STALL_APPLICATION_INFO_FIELDS_FRAGMENT = gql5`
1498
+ fragment StallApplicationInfoFields on StallApplicationInfoType {
1499
+ applicationDeadlineHours
1500
+ paymentDueHours
1501
+ paymentMethod
1502
+ paymentTarget {
1503
+ ...PaymentTargetFields
1504
+ }
1505
+ rejectionPolicy
1506
+ stallCapacity
1507
+ }
1508
+ ${PAYMENT_TARGET_FIELDS_FRAGMENT}
1509
+ `;
1457
1510
  var MARKET = gql5`
1458
1511
  fragment MarketFields on MarketType {
1459
1512
  _id
@@ -1484,12 +1537,7 @@ var MARKET = gql5`
1484
1537
  region
1485
1538
  relationIds
1486
1539
  stallApplicationInfo {
1487
- applicationDeadlineHours
1488
- paymentDueHours
1489
- paymentMethod
1490
- paymentTarget
1491
- rejectionPolicy
1492
- stallCapacity
1540
+ ...StallApplicationInfoFields
1493
1541
  }
1494
1542
  tags
1495
1543
  updatedAt
@@ -1498,6 +1546,7 @@ var MARKET = gql5`
1498
1546
  ${MARKET_LOCATION_FIELDS_FRAGMENT}
1499
1547
  ${OWNER_FIELDS_FRAGMENT}
1500
1548
  ${RESOURCE_IMAGE_FIELDS_FRAGMENT}
1549
+ ${STALL_APPLICATION_INFO_FIELDS_FRAGMENT}
1501
1550
  `;
1502
1551
  var GET_MARKETS = gql5`
1503
1552
  query getMarkets {
@@ -2808,22 +2857,21 @@ var stallApplicationInfo = [
2808
2857
  placeholder: "Payment Due Hours"
2809
2858
  }
2810
2859
  ];
2811
- var stallApplicationInfoPaymentTarget = {
2812
- helperText: "Payment Target of the Market *",
2813
- isTextArea: true,
2814
- name: "stallApplicationInfo.paymentTarget",
2815
- placeholder: "Payment Target"
2816
- };
2817
- var stallApplicationInfoDropdowns = [
2860
+ var stallApplicationInfoPaymentTarget = [
2861
+ {
2862
+ helperText: "Account holder name *",
2863
+ name: "stallApplicationInfo.paymentTarget.accountHolderName",
2864
+ placeholder: "Account holder name"
2865
+ },
2818
2866
  {
2819
- helperText: "Select payment method *",
2820
- name: "stallApplicationInfo.paymentMethod",
2821
- placeholder: "Choose Payment Method"
2867
+ helperText: "Account number *",
2868
+ name: "stallApplicationInfo.paymentTarget.accountNumber",
2869
+ placeholder: "Account number"
2822
2870
  },
2823
2871
  {
2824
- helperText: "Rejection Policy *",
2825
- name: "stallApplicationInfo.rejectionPolicy",
2826
- placeholder: "Choose Rejection Policy"
2872
+ helperText: "Link to payment target *",
2873
+ name: "stallApplicationInfo.paymentTarget.link",
2874
+ placeholder: "Link to payment target"
2827
2875
  }
2828
2876
  ];
2829
2877
  var marketStartDateFields = [
@@ -3326,50 +3374,33 @@ export {
3326
3374
  capitalizeFirstLetter,
3327
3375
  categoryColors,
3328
3376
  dateFormat,
3329
- dateTimeSchema,
3330
3377
  defaultMarketFormValues,
3331
3378
  defaultRegion,
3332
3379
  defaultStallholderApplyFormValues,
3333
3380
  defaultStallholderFormValues,
3334
- emailSchema,
3335
- endDateAfterStartDateTest,
3336
- endDateNotInPastTest,
3337
- endTimeMustBeAfterStartTimeTest,
3338
3381
  formatDate,
3339
3382
  formatTimestamp,
3340
3383
  getCurrentAndFutureDates,
3341
3384
  getFutureDatesAfterThreshold,
3342
3385
  globalDefaultValues,
3343
- globalResourceSchema,
3344
- locationSchema,
3345
3386
  loginFields,
3346
- loginSchema,
3347
3387
  mapArrayToOptions,
3348
3388
  marketBasicInfoFields,
3349
3389
  marketEndDateFields,
3350
3390
  marketPriceByDateFields,
3351
- marketSchema,
3352
3391
  marketStartDateFields,
3353
- noLeadingZeros,
3354
3392
  packagingOptions,
3355
- passwordSchema,
3356
3393
  paymentMethodOptions,
3357
3394
  producedIngOptions,
3358
3395
  profileFields,
3359
3396
  registerFields,
3360
- registerSchema,
3361
3397
  rejectionPolicyOptions,
3362
3398
  removeTypename,
3363
3399
  requestPasswordResetFields,
3364
- requestPasswordResetSchema,
3365
3400
  resetPasswordFields,
3366
- resetPasswordSchema,
3367
3401
  sortDatesByProximity,
3368
3402
  stallApplicationInfo,
3369
- stallApplicationInfoDropdowns,
3370
3403
  stallApplicationInfoPaymentTarget,
3371
- stallHolderSchema,
3372
- stallholderApplyFormSchema,
3373
3404
  stallholderBasicInfoFields,
3374
3405
  stallholderElectricity,
3375
3406
  stallholderEndDateFields,
@@ -3384,8 +3415,6 @@ export {
3384
3415
  stallholderStallSize,
3385
3416
  stallholderStartDateFields,
3386
3417
  stallholderTable,
3387
- startDateNotInPastTest,
3388
- startTimeCannotBeInPastTest,
3389
3418
  statusOptions,
3390
3419
  tagOptions,
3391
3420
  timeFormat,
@@ -3450,8 +3479,6 @@ export {
3450
3479
  useUserForm,
3451
3480
  useValidateToken,
3452
3481
  useValidateTokenForm,
3453
- userSchema,
3454
- validateTokenFields,
3455
- validateTokenSchema
3482
+ validateTokenFields
3456
3483
  };
3457
3484
  //# sourceMappingURL=index.mjs.map