@deallony/shared 1.2.80 → 1.2.82

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 (117) hide show
  1. package/dist/cjs/constants/events/EventBirthday.d.ts +2 -0
  2. package/dist/cjs/constants/events/EventBirthday.js +12 -0
  3. package/dist/cjs/constants/events/EventCustomization.d.ts +21 -0
  4. package/dist/cjs/constants/events/EventCustomization.js +23 -2
  5. package/dist/cjs/constants/events/EventDressCode.d.ts +65 -0
  6. package/dist/cjs/constants/events/EventDressCode.js +56 -0
  7. package/dist/cjs/constants/events/EventGuests.d.ts +3 -0
  8. package/dist/cjs/constants/events/EventGuests.js +6 -0
  9. package/dist/cjs/constants/events/EventHost.d.ts +79 -0
  10. package/dist/cjs/constants/events/EventHost.js +155 -0
  11. package/dist/cjs/constants/events/EventOccasion.d.ts +63 -0
  12. package/dist/cjs/constants/events/EventOccasion.js +242 -0
  13. package/dist/cjs/constants/events/EventPreview.d.ts +3 -0
  14. package/dist/cjs/constants/events/EventPreview.js +9 -1
  15. package/dist/cjs/constants/events/EventTemplate.d.ts +518 -10
  16. package/dist/cjs/constants/events/EventTemplate.js +81 -11
  17. package/dist/cjs/constants/events/EventTextPolicy.d.ts +7 -0
  18. package/dist/cjs/constants/events/EventTextPolicy.js +66 -0
  19. package/dist/cjs/constants/events/EventType.d.ts +273 -8
  20. package/dist/cjs/constants/events/EventType.js +38 -2
  21. package/dist/cjs/constants/events/EventVisibility.d.ts +19 -0
  22. package/dist/cjs/constants/events/EventVisibility.js +18 -0
  23. package/dist/cjs/constants/events/EventWedding.js +3 -0
  24. package/dist/cjs/constants/events/EventWeddingReligion.d.ts +72 -0
  25. package/dist/cjs/constants/events/EventWeddingReligion.js +126 -0
  26. package/dist/cjs/constants/events/index.d.ts +8 -0
  27. package/dist/cjs/constants/events/index.js +8 -0
  28. package/dist/cjs/constants/routes/app.d.ts +49 -0
  29. package/dist/cjs/constants/routes/app.js +16 -0
  30. package/dist/cjs/dto/events/EventBirthday.dto.d.ts +3 -0
  31. package/dist/cjs/dto/events/EventBirthday.dto.js +2 -0
  32. package/dist/cjs/dto/events/EventHost.dto.d.ts +7 -0
  33. package/dist/cjs/dto/events/EventHost.dto.js +2 -0
  34. package/dist/cjs/dto/events/EventOccasion.dto.d.ts +3 -0
  35. package/dist/cjs/dto/events/EventOccasion.dto.js +2 -0
  36. package/dist/cjs/dto/events/index.d.ts +3 -0
  37. package/dist/cjs/dto/events/index.js +3 -0
  38. package/dist/cjs/schema/communication/ai-conversation.schema.d.ts +55 -3
  39. package/dist/cjs/schema/communication/ai-conversation.schema.js +28 -3
  40. package/dist/cjs/schema/communication/offer.schema.d.ts +3 -3
  41. package/dist/cjs/schema/communication/support-ticket.schema.d.ts +136 -0
  42. package/dist/cjs/schema/communication/support-ticket.schema.js +47 -2
  43. package/dist/cjs/schema/events/Event.schema.d.ts +326 -0
  44. package/dist/cjs/schema/events/Event.schema.js +55 -1
  45. package/dist/cjs/schema/events/EventBirthday.schema.d.ts +19 -0
  46. package/dist/cjs/schema/events/EventBirthday.schema.js +17 -0
  47. package/dist/cjs/schema/events/EventHost.schema.d.ts +36 -0
  48. package/dist/cjs/schema/events/EventHost.schema.js +44 -0
  49. package/dist/cjs/schema/events/EventOccasion.schema.d.ts +22 -0
  50. package/dist/cjs/schema/events/EventOccasion.schema.js +31 -0
  51. package/dist/cjs/schema/events/EventRsvp.schema.d.ts +4 -0
  52. package/dist/cjs/schema/events/EventRsvp.schema.js +1 -0
  53. package/dist/cjs/schema/events/EventTimeline.schema.d.ts +5 -0
  54. package/dist/cjs/schema/events/EventTimeline.schema.js +14 -1
  55. package/dist/cjs/schema/events/EventWedding.schema.d.ts +32 -0
  56. package/dist/cjs/schema/events/EventWedding.schema.js +11 -0
  57. package/dist/cjs/schema/events/index.d.ts +3 -0
  58. package/dist/cjs/schema/events/index.js +3 -0
  59. package/dist/cjs/types/communication/Notification.d.ts +21 -2
  60. package/dist/cjs/types/communication/Notification.js +17 -0
  61. package/dist/cjs/types/events/Event.d.ts +38 -1
  62. package/dist/cjs/types/events/EventBirthday.d.ts +17 -0
  63. package/dist/cjs/types/events/EventBirthday.js +2 -0
  64. package/dist/cjs/types/events/EventCustomization.d.ts +4 -0
  65. package/dist/cjs/types/events/EventDressCode.d.ts +13 -0
  66. package/dist/cjs/types/events/EventDressCode.js +2 -0
  67. package/dist/cjs/types/events/EventHost.d.ts +29 -0
  68. package/dist/cjs/types/events/EventHost.js +2 -0
  69. package/dist/cjs/types/events/EventOccasion.d.ts +24 -0
  70. package/dist/cjs/types/events/EventOccasion.js +2 -0
  71. package/dist/cjs/types/events/EventRsvp.d.ts +2 -0
  72. package/dist/cjs/types/events/EventTimeline.d.ts +2 -0
  73. package/dist/cjs/types/events/EventWedding.d.ts +7 -0
  74. package/dist/cjs/types/events/index.d.ts +4 -0
  75. package/dist/cjs/types/events/index.js +4 -0
  76. package/dist/cjs/types/index.d.ts +4 -0
  77. package/dist/cjs/types/index.js +6 -2
  78. package/dist/cjs/types/user/SavedSearch.d.ts +38 -0
  79. package/dist/cjs/types/user/SavedSearch.js +11 -0
  80. package/dist/esm/constants/events/EventBirthday.js +9 -0
  81. package/dist/esm/constants/events/EventCustomization.js +21 -1
  82. package/dist/esm/constants/events/EventDressCode.js +49 -0
  83. package/dist/esm/constants/events/EventGuests.js +3 -0
  84. package/dist/esm/constants/events/EventHost.js +147 -0
  85. package/dist/esm/constants/events/EventOccasion.js +235 -0
  86. package/dist/esm/constants/events/EventPreview.js +7 -0
  87. package/dist/esm/constants/events/EventTemplate.js +78 -10
  88. package/dist/esm/constants/events/EventTextPolicy.js +61 -0
  89. package/dist/esm/constants/events/EventType.js +34 -1
  90. package/dist/esm/constants/events/EventVisibility.js +15 -0
  91. package/dist/esm/constants/events/EventWedding.js +3 -0
  92. package/dist/esm/constants/events/EventWeddingReligion.js +118 -0
  93. package/dist/esm/constants/events/index.js +8 -0
  94. package/dist/esm/constants/routes/app.js +16 -0
  95. package/dist/esm/dto/events/EventBirthday.dto.js +1 -0
  96. package/dist/esm/dto/events/EventHost.dto.js +1 -0
  97. package/dist/esm/dto/events/EventOccasion.dto.js +1 -0
  98. package/dist/esm/dto/events/index.js +3 -0
  99. package/dist/esm/schema/communication/ai-conversation.schema.js +27 -2
  100. package/dist/esm/schema/communication/support-ticket.schema.js +46 -1
  101. package/dist/esm/schema/events/Event.schema.js +55 -1
  102. package/dist/esm/schema/events/EventBirthday.schema.js +14 -0
  103. package/dist/esm/schema/events/EventHost.schema.js +41 -0
  104. package/dist/esm/schema/events/EventOccasion.schema.js +28 -0
  105. package/dist/esm/schema/events/EventRsvp.schema.js +1 -0
  106. package/dist/esm/schema/events/EventTimeline.schema.js +14 -1
  107. package/dist/esm/schema/events/EventWedding.schema.js +11 -0
  108. package/dist/esm/schema/events/index.js +3 -0
  109. package/dist/esm/types/communication/Notification.js +17 -0
  110. package/dist/esm/types/events/EventBirthday.js +1 -0
  111. package/dist/esm/types/events/EventDressCode.js +1 -0
  112. package/dist/esm/types/events/EventHost.js +1 -0
  113. package/dist/esm/types/events/EventOccasion.js +1 -0
  114. package/dist/esm/types/events/index.js +4 -0
  115. package/dist/esm/types/index.js +4 -0
  116. package/dist/esm/types/user/SavedSearch.js +8 -0
  117. package/package.json +1 -1
@@ -0,0 +1,2 @@
1
+ import { TYPES } from '../..';
2
+ export declare const emptyEventBirthday: TYPES.EventBirthday.IEventBirthday;
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.emptyEventBirthday = void 0;
4
+ exports.emptyEventBirthday = {
5
+ id: 0,
6
+ event_id: 0,
7
+ cover: null,
8
+ celebrant_name: null,
9
+ age: null,
10
+ host_name: null,
11
+ phone: null,
12
+ };
@@ -40,6 +40,8 @@ export type EventCustomizationTrack = {
40
40
  };
41
41
  /** Path on the event site */
42
42
  src: string;
43
+ /** Event types the track is offered for */
44
+ event_types: string[];
43
45
  };
44
46
  /** Music the owner can pick; add a track here once its file is on the event site under /music */
45
47
  export declare const EventCustomizationTracks: EventCustomizationTrack[];
@@ -50,6 +52,7 @@ export declare const EventCustomizationSection: {
50
52
  readonly GALLERY: "gallery";
51
53
  readonly RSVP: "rsvp";
52
54
  readonly MUSIC: "music";
55
+ readonly DRESS_CODE: "dress_code";
53
56
  };
54
57
  export type EventCustomizationSectionKey = (typeof EventCustomizationSection)[keyof typeof EventCustomizationSection];
55
58
  export declare const EventCustomizationSectionOptions: {
@@ -60,10 +63,28 @@ export declare const EventCustomizationSectionOptions: {
60
63
  };
61
64
  }[];
62
65
  export declare const EVENT_CUSTOMIZATION_TEXT_MAX = 160;
66
+ /** How the invitation opens for a guest; no value keeps the template's own opening */
67
+ export declare const EventCustomizationOpening: {
68
+ readonly NONE: "none";
69
+ readonly ENVELOPE: "envelope";
70
+ readonly CURTAIN: "curtain";
71
+ readonly CARD: "card";
72
+ };
73
+ export type EventCustomizationOpeningValue = (typeof EventCustomizationOpening)[keyof typeof EventCustomizationOpening];
74
+ export declare const EventCustomizationOpeningOptions: {
75
+ value: EventCustomizationOpeningValue;
76
+ name: {
77
+ en: string;
78
+ ar: string;
79
+ };
80
+ }[];
63
81
  export declare const EventCustomizationPaletteValues: [string, ...string[]];
64
82
  export declare const EventCustomizationFontValues: [string, ...string[]];
65
83
  export declare const EventCustomizationTrackValues: [string, ...string[]];
66
84
  export declare const EventCustomizationSectionValues: [EventCustomizationSectionKey, ...EventCustomizationSectionKey[]];
85
+ export declare const EventCustomizationOpeningValues: [EventCustomizationOpeningValue, ...EventCustomizationOpeningValue[]];
67
86
  export declare const findEventCustomizationPalette: (value: string | null | undefined) => EventCustomizationPalette | null;
68
87
  export declare const findEventCustomizationFont: (value: string | null | undefined) => EventCustomizationFont | null;
88
+ /** Tracks offered for an event type; events without a type are weddings */
89
+ export declare const eventCustomizationTracksFor: (eventType: string | null | undefined) => EventCustomizationTrack[];
69
90
  export declare const findEventCustomizationTrack: (value: string | null | undefined) => EventCustomizationTrack | null;
@@ -4,7 +4,7 @@
4
4
  * Every field is optional: an empty value keeps the chosen template's own look.
5
5
  */
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.findEventCustomizationTrack = exports.findEventCustomizationFont = exports.findEventCustomizationPalette = exports.EventCustomizationSectionValues = exports.EventCustomizationTrackValues = exports.EventCustomizationFontValues = exports.EventCustomizationPaletteValues = exports.EVENT_CUSTOMIZATION_TEXT_MAX = exports.EventCustomizationSectionOptions = exports.EventCustomizationSection = exports.EventCustomizationTracks = exports.EventCustomizationFonts = exports.EventCustomizationPalettes = void 0;
7
+ exports.findEventCustomizationTrack = exports.eventCustomizationTracksFor = exports.findEventCustomizationFont = exports.findEventCustomizationPalette = exports.EventCustomizationOpeningValues = exports.EventCustomizationSectionValues = exports.EventCustomizationTrackValues = exports.EventCustomizationFontValues = exports.EventCustomizationPaletteValues = exports.EventCustomizationOpeningOptions = exports.EventCustomizationOpening = exports.EVENT_CUSTOMIZATION_TEXT_MAX = exports.EventCustomizationSectionOptions = exports.EventCustomizationSection = exports.EventCustomizationTracks = exports.EventCustomizationFonts = exports.EventCustomizationPalettes = void 0;
8
8
  exports.EventCustomizationPalettes = [
9
9
  { value: "night", name: { en: "Night", ar: "ليلي" }, background: "#0f0c18", surface: "#1b1628", text: "#efe8f6", accent: "#d6b36a", is_dark: true },
10
10
  { value: "ivory", name: { en: "Ivory", ar: "عاجي" }, background: "#fbf6ee", surface: "#ffffff", text: "#2a2118", accent: "#9c6b3c", is_dark: false },
@@ -20,7 +20,9 @@ exports.EventCustomizationFonts = [
20
20
  ];
21
21
  /** Music the owner can pick; add a track here once its file is on the event site under /music */
22
22
  exports.EventCustomizationTracks = [
23
- { value: "wedding-theme", name: { en: "Wedding theme", ar: "لحن الزفاف" }, src: "/music/wedding-theme.mp3" },
23
+ { value: "wedding-theme", name: { en: "Wedding theme", ar: "لحن الزفاف" }, src: "/music/wedding-theme.mp3", event_types: ["wedding", "engagement", "marriage", "proposal", "valentine"] },
24
+ { value: "birthday-theme", name: { en: "Happy birthday", ar: "لحن عيد الميلاد" }, src: "/music/birthday-theme.mp3", event_types: ["birthday"] },
25
+ { value: "celebration-theme", name: { en: "Celebration", ar: "لحن الاحتفال" }, src: "/music/celebration-theme.mp3", event_types: ["bachelor", "newborn", "gender_reveal", "circumcision", "graduation", "hajj", "mothers_day", "valentine", "opening", "general", "proposal", "engagement", "marriage"] },
24
26
  ];
25
27
  exports.EventCustomizationSection = {
26
28
  COUNTDOWN: "countdown",
@@ -29,6 +31,7 @@ exports.EventCustomizationSection = {
29
31
  GALLERY: "gallery",
30
32
  RSVP: "rsvp",
31
33
  MUSIC: "music",
34
+ DRESS_CODE: "dress_code",
32
35
  };
33
36
  exports.EventCustomizationSectionOptions = [
34
37
  { value: "countdown", name: { en: "Countdown", ar: "العد التنازلي" } },
@@ -37,15 +40,33 @@ exports.EventCustomizationSectionOptions = [
37
40
  { value: "gallery", name: { en: "Photos", ar: "الصور" } },
38
41
  { value: "rsvp", name: { en: "RSVP", ar: "تأكيد الحضور" } },
39
42
  { value: "music", name: { en: "Music", ar: "الموسيقى" } },
43
+ { value: "dress_code", name: { en: "Dress code", ar: "اللباس المطلوب" } },
40
44
  ];
41
45
  exports.EVENT_CUSTOMIZATION_TEXT_MAX = 160;
46
+ /** How the invitation opens for a guest; no value keeps the template's own opening */
47
+ exports.EventCustomizationOpening = {
48
+ NONE: "none",
49
+ ENVELOPE: "envelope",
50
+ CURTAIN: "curtain",
51
+ CARD: "card",
52
+ };
53
+ exports.EventCustomizationOpeningOptions = [
54
+ { value: "none", name: { en: "None", ar: "بدون" } },
55
+ { value: "envelope", name: { en: "Envelope", ar: "ظرف" } },
56
+ { value: "curtain", name: { en: "Curtain", ar: "ستارة" } },
57
+ { value: "card", name: { en: "Card", ar: "بطاقة" } },
58
+ ];
42
59
  exports.EventCustomizationPaletteValues = exports.EventCustomizationPalettes.map((p) => p.value);
43
60
  exports.EventCustomizationFontValues = exports.EventCustomizationFonts.map((f) => f.value);
44
61
  exports.EventCustomizationTrackValues = exports.EventCustomizationTracks.map((t) => t.value);
45
62
  exports.EventCustomizationSectionValues = exports.EventCustomizationSectionOptions.map((s) => s.value);
63
+ exports.EventCustomizationOpeningValues = exports.EventCustomizationOpeningOptions.map((o) => o.value);
46
64
  const findEventCustomizationPalette = (value) => { var _a; return (_a = exports.EventCustomizationPalettes.find((p) => p.value === value)) !== null && _a !== void 0 ? _a : null; };
47
65
  exports.findEventCustomizationPalette = findEventCustomizationPalette;
48
66
  const findEventCustomizationFont = (value) => { var _a; return (_a = exports.EventCustomizationFonts.find((f) => f.value === value)) !== null && _a !== void 0 ? _a : null; };
49
67
  exports.findEventCustomizationFont = findEventCustomizationFont;
68
+ /** Tracks offered for an event type; events without a type are weddings */
69
+ const eventCustomizationTracksFor = (eventType) => exports.EventCustomizationTracks.filter((t) => t.event_types.includes(eventType || "wedding"));
70
+ exports.eventCustomizationTracksFor = eventCustomizationTracksFor;
50
71
  const findEventCustomizationTrack = (value) => { var _a; return (_a = exports.EventCustomizationTracks.find((t) => t.value === value)) !== null && _a !== void 0 ? _a : null; };
51
72
  exports.findEventCustomizationTrack = findEventCustomizationTrack;
@@ -0,0 +1,65 @@
1
+ /** Optional dress code an event owner can show on the invitation (all event types) */
2
+ export declare const EventDressCodeStyleValues: readonly ["formal", "evening", "semi_formal", "smart_casual", "traditional", "custom"];
3
+ export type EventDressCodeStyle = (typeof EventDressCodeStyleValues)[number];
4
+ export declare const EventDressCodeStyleOptions: {
5
+ value: EventDressCodeStyle;
6
+ name: {
7
+ en: string;
8
+ ar: string;
9
+ };
10
+ }[];
11
+ /** wear = colours guests are asked to wear, avoid = colours guests should not wear */
12
+ export declare const EventDressCodeColorModeValues: readonly ["wear", "avoid"];
13
+ export type EventDressCodeColorMode = (typeof EventDressCodeColorModeValues)[number];
14
+ export declare const EventDressCodeColorModeNames: Record<EventDressCodeColorMode, {
15
+ en: string;
16
+ ar: string;
17
+ }>;
18
+ /** Heading shown on the invitation above the colour dots */
19
+ export declare const EventDressCodeColorModeTitles: Record<EventDressCodeColorMode, {
20
+ en: string;
21
+ ar: string;
22
+ }>;
23
+ export declare const EventDressCodeColors: {
24
+ value: string;
25
+ hex: string;
26
+ name: {
27
+ en: string;
28
+ ar: string;
29
+ };
30
+ }[];
31
+ export declare const EventDressCodeColorValues: [string, ...string[]];
32
+ /** @deprecated colours are no longer limited; kept for older imports */
33
+ export declare const EVENT_DRESS_CODE_MAX_COLORS = 9;
34
+ export declare const EVENT_DRESS_CODE_NOTE_MAX = 120;
35
+ export declare const findEventDressCodeStyle: (value: string | null | undefined) => {
36
+ value: EventDressCodeStyle;
37
+ name: {
38
+ en: string;
39
+ ar: string;
40
+ };
41
+ } | null;
42
+ export declare const findEventDressCodeColor: (value: string | null | undefined) => {
43
+ value: string;
44
+ hex: string;
45
+ name: {
46
+ en: string;
47
+ ar: string;
48
+ };
49
+ } | null;
50
+ /** True when the owner filled at least one part of the dress code */
51
+ export declare const hasEventDressCode: (dc: {
52
+ style?: string | null;
53
+ colors?: string[] | null;
54
+ avoid_colors?: string[] | null;
55
+ note?: string | null;
56
+ } | null | undefined) => boolean;
57
+ /** Wanted and avoided colours, reading old saves where color_mode "avoid" marked `colors` */
58
+ export declare const eventDressCodeColorLists: (dc: {
59
+ colors?: string[] | null;
60
+ avoid_colors?: string[] | null;
61
+ color_mode?: string | null;
62
+ } | null | undefined) => {
63
+ wear: string[];
64
+ avoid: string[];
65
+ };
@@ -0,0 +1,56 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.eventDressCodeColorLists = exports.hasEventDressCode = exports.findEventDressCodeColor = exports.findEventDressCodeStyle = exports.EVENT_DRESS_CODE_NOTE_MAX = exports.EVENT_DRESS_CODE_MAX_COLORS = exports.EventDressCodeColorValues = exports.EventDressCodeColors = exports.EventDressCodeColorModeTitles = exports.EventDressCodeColorModeNames = exports.EventDressCodeColorModeValues = exports.EventDressCodeStyleOptions = exports.EventDressCodeStyleValues = void 0;
4
+ /** Optional dress code an event owner can show on the invitation (all event types) */
5
+ exports.EventDressCodeStyleValues = ["formal", "evening", "semi_formal", "smart_casual", "traditional", "custom"];
6
+ exports.EventDressCodeStyleOptions = [
7
+ { value: "formal", name: { en: "Formal", ar: "رسمي" } },
8
+ { value: "evening", name: { en: "Evening wear", ar: "سهرة" } },
9
+ { value: "semi_formal", name: { en: "Semi-formal", ar: "شبه رسمي" } },
10
+ { value: "smart_casual", name: { en: "Smart casual", ar: "كاجوال أنيق" } },
11
+ { value: "traditional", name: { en: "Traditional", ar: "تقليدي" } },
12
+ { value: "custom", name: { en: "Custom text", ar: "نص خاص" } },
13
+ ];
14
+ /** wear = colours guests are asked to wear, avoid = colours guests should not wear */
15
+ exports.EventDressCodeColorModeValues = ["wear", "avoid"];
16
+ exports.EventDressCodeColorModeNames = {
17
+ wear: { en: "Colours to wear", ar: "ألوان مرغوبة" },
18
+ avoid: { en: "Colours to avoid", ar: "ألوان يجب تجنبها" },
19
+ };
20
+ /** Heading shown on the invitation above the colour dots */
21
+ exports.EventDressCodeColorModeTitles = {
22
+ wear: { en: "Suggested colours", ar: "ألوان مقترحة" },
23
+ avoid: { en: "Please avoid", ar: "نرجو تجنّب" },
24
+ };
25
+ exports.EventDressCodeColors = [
26
+ { value: "white", hex: "#FFFFFF", name: { en: "White", ar: "أبيض" } },
27
+ { value: "black", hex: "#000000", name: { en: "Black", ar: "أسود" } },
28
+ { value: "gold", hex: "#D4AF37", name: { en: "Gold", ar: "ذهبي" } },
29
+ { value: "beige", hex: "#C9C0B3", name: { en: "Beige", ar: "بيج" } },
30
+ { value: "navy", hex: "#1F3A5F", name: { en: "Navy", ar: "كحلي" } },
31
+ { value: "burgundy", hex: "#7A1F2B", name: { en: "Burgundy", ar: "عنابي" } },
32
+ { value: "sage", hex: "#B7C9A8", name: { en: "Light green", ar: "أخضر فاتح" } },
33
+ { value: "pink", hex: "#E8B4BC", name: { en: "Pink", ar: "وردي" } },
34
+ { value: "grey", hex: "#9AA5B1", name: { en: "Grey", ar: "رمادي" } },
35
+ ];
36
+ exports.EventDressCodeColorValues = exports.EventDressCodeColors.map((c) => c.value);
37
+ /** @deprecated colours are no longer limited; kept for older imports */
38
+ exports.EVENT_DRESS_CODE_MAX_COLORS = 9;
39
+ exports.EVENT_DRESS_CODE_NOTE_MAX = 120;
40
+ const findEventDressCodeStyle = (value) => { var _a; return (_a = exports.EventDressCodeStyleOptions.find((s) => s.value === value)) !== null && _a !== void 0 ? _a : null; };
41
+ exports.findEventDressCodeStyle = findEventDressCodeStyle;
42
+ const findEventDressCodeColor = (value) => { var _a; return (_a = exports.EventDressCodeColors.find((c) => c.value === value)) !== null && _a !== void 0 ? _a : null; };
43
+ exports.findEventDressCodeColor = findEventDressCodeColor;
44
+ /** True when the owner filled at least one part of the dress code */
45
+ const hasEventDressCode = (dc) => { var _a, _b, _c; return !!dc && (!!dc.style || !!((_a = dc.colors) === null || _a === void 0 ? void 0 : _a.length) || !!((_b = dc.avoid_colors) === null || _b === void 0 ? void 0 : _b.length) || !!((_c = dc.note) === null || _c === void 0 ? void 0 : _c.trim())); };
46
+ exports.hasEventDressCode = hasEventDressCode;
47
+ /** Wanted and avoided colours, reading old saves where color_mode "avoid" marked `colors` */
48
+ const eventDressCodeColorLists = (dc) => {
49
+ var _a, _b, _c;
50
+ const legacyAvoid = (dc === null || dc === void 0 ? void 0 : dc.color_mode) === "avoid";
51
+ return {
52
+ wear: legacyAvoid ? [] : ((_a = dc === null || dc === void 0 ? void 0 : dc.colors) !== null && _a !== void 0 ? _a : []),
53
+ avoid: [...(legacyAvoid ? ((_b = dc === null || dc === void 0 ? void 0 : dc.colors) !== null && _b !== void 0 ? _b : []) : []), ...((_c = dc === null || dc === void 0 ? void 0 : dc.avoid_colors) !== null && _c !== void 0 ? _c : [])],
54
+ };
55
+ };
56
+ exports.eventDressCodeColorLists = eventDressCodeColorLists;
@@ -0,0 +1,3 @@
1
+ /** Limits of the expected guest count asked when creating an event */
2
+ export declare const EVENT_EXPECTED_GUESTS_MIN = 1;
3
+ export declare const EVENT_EXPECTED_GUESTS_MAX = 100000;
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.EVENT_EXPECTED_GUESTS_MAX = exports.EVENT_EXPECTED_GUESTS_MIN = void 0;
4
+ /** Limits of the expected guest count asked when creating an event */
5
+ exports.EVENT_EXPECTED_GUESTS_MIN = 1;
6
+ exports.EVENT_EXPECTED_GUESTS_MAX = 100000;
@@ -0,0 +1,79 @@
1
+ /**
2
+ * People of an event other than its creator: who they are (a slot of the event type),
3
+ * what they may do (role) and the permission map shared by the backend check and the app.
4
+ */
5
+ type Text = {
6
+ en: string;
7
+ ar: string;
8
+ };
9
+ /** organiser: full control like the owner; guests: the event's guests only */
10
+ export declare const EventHostRoleValues: readonly ["organiser", "guests"];
11
+ export type EventHostRole = (typeof EventHostRoleValues)[number];
12
+ export declare const EventHostRole: {
13
+ readonly ORGANISER: "organiser";
14
+ readonly GUESTS: "guests";
15
+ };
16
+ export declare const EventHostRoleNames: Record<EventHostRole, Text>;
17
+ export declare const EventHostRoleHints: Record<EventHostRole, Text>;
18
+ export declare const EventHostRoleOptions: {
19
+ value: "organiser" | "guests";
20
+ name: Text;
21
+ hint: Text;
22
+ }[];
23
+ /** pending: waiting for the person to sign in and accept; active: accepted */
24
+ export declare const EventHostStatusValues: readonly ["pending", "active", "declined", "left", "removed"];
25
+ export type EventHostStatus = (typeof EventHostStatusValues)[number];
26
+ export declare const EventHostStatus: {
27
+ readonly PENDING: "pending";
28
+ readonly ACTIVE: "active";
29
+ readonly DECLINED: "declined";
30
+ readonly LEFT: "left";
31
+ readonly REMOVED: "removed";
32
+ };
33
+ export declare const EventHostStatusNames: Record<EventHostStatus, Text>;
34
+ /** Statuses that still hold the number on the event (one row per number) */
35
+ export declare const EventHostOpenStatusValues: EventHostStatus[];
36
+ /** What the signed-in user is on an event */
37
+ export declare const EventAccessRoleValues: readonly ["owner", "organiser", "guests"];
38
+ export type EventAccessRole = (typeof EventAccessRoleValues)[number];
39
+ export declare const EventPermissionValues: readonly ["event.view", "event.edit", "event.publish", "event.delete", "guests.manage", "hosts.manage"];
40
+ export type EventPermission = (typeof EventPermissionValues)[number];
41
+ export declare const EventRolePermissions: Record<EventAccessRole, readonly EventPermission[]>;
42
+ export declare const hasEventPermission: (role: EventAccessRole | null | undefined, permission: EventPermission) => boolean;
43
+ export declare const EventAccessRoleNames: Record<EventAccessRole, Text>;
44
+ /** Old single-number fields a slot is kept in sync with */
45
+ export type EventPeopleSlotMirror = "wedding.bride_phone" | "wedding.groom_phone" | "occasion.phone";
46
+ /** A suggested person of an event type: one optional phone field in the form */
47
+ export type EventPeopleSlot = {
48
+ key: string;
49
+ label: Text;
50
+ /** Role they get unless the owner changes it */
51
+ role: EventHostRole;
52
+ /** The existing form field that already holds this number */
53
+ mirrors?: EventPeopleSlotMirror;
54
+ /** Hidden from them until the event ends when the type's details.surprise is "yes" */
55
+ surprise_when_details_surprise?: boolean;
56
+ };
57
+ /**
58
+ * Suggested people of each event type. The person the event is for manages guests;
59
+ * whoever organises or invites gets full control. Anyone else is added by hand.
60
+ */
61
+ export declare const EventPeopleSlots: Record<string, EventPeopleSlot[]>;
62
+ /** Suggested people of a type (a type without its own list gets the organiser only) */
63
+ export declare const findEventPeopleSlots: (eventType: string | null | undefined) => EventPeopleSlot[];
64
+ export declare const findEventPeopleSlot: (eventType: string | null | undefined, key: string | null | undefined) => EventPeopleSlot | undefined;
65
+ /** Answers to «من أنت في هذه المناسبة؟» besides the type's slots */
66
+ export declare const EventCreatorRoleExtra: {
67
+ readonly COMPANY: "company";
68
+ readonly OTHER: "other";
69
+ };
70
+ export declare const EventCreatorRoleExtraNames: Record<(typeof EventCreatorRoleExtra)[keyof typeof EventCreatorRoleExtra], Text>;
71
+ /** Label of the person a host row (or the creator) is: slot label, or the free text */
72
+ export declare const eventPersonLabel: (eventType: string | null | undefined, slotKey: string | null | undefined, fallback?: string | null) => Text | null;
73
+ export declare const EVENT_HOST_LABEL_MAX = 60;
74
+ /**
75
+ * One spelling for a phone number so numbers typed differently still match:
76
+ * digits only with a leading +, 00 → +, and no 0 right after a known country code.
77
+ */
78
+ export declare const normalizeEventPhone: (value: string | null | undefined) => string | null;
79
+ export {};
@@ -0,0 +1,155 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.normalizeEventPhone = exports.EVENT_HOST_LABEL_MAX = exports.eventPersonLabel = exports.EventCreatorRoleExtraNames = exports.EventCreatorRoleExtra = exports.findEventPeopleSlot = exports.findEventPeopleSlots = exports.EventPeopleSlots = exports.EventAccessRoleNames = exports.hasEventPermission = exports.EventRolePermissions = exports.EventPermissionValues = exports.EventAccessRoleValues = exports.EventHostOpenStatusValues = exports.EventHostStatusNames = exports.EventHostStatus = exports.EventHostStatusValues = exports.EventHostRoleOptions = exports.EventHostRoleHints = exports.EventHostRoleNames = exports.EventHostRole = exports.EventHostRoleValues = void 0;
4
+ /** organiser: full control like the owner; guests: the event's guests only */
5
+ exports.EventHostRoleValues = ["organiser", "guests"];
6
+ exports.EventHostRole = {
7
+ ORGANISER: "organiser",
8
+ GUESTS: "guests",
9
+ };
10
+ exports.EventHostRoleNames = {
11
+ organiser: { ar: "منظم", en: "Organiser" },
12
+ guests: { ar: "إدارة المدعوين", en: "Manages guests" },
13
+ };
14
+ exports.EventHostRoleHints = {
15
+ organiser: { ar: "يدير المناسبة كاملة", en: "Manages the whole event" },
16
+ guests: { ar: "يدير المدعوين ويرسل الدعوات ويتابع الردود", en: "Manages guests, sends invitations and follows replies" },
17
+ };
18
+ exports.EventHostRoleOptions = exports.EventHostRoleValues.map((value) => ({
19
+ value,
20
+ name: exports.EventHostRoleNames[value],
21
+ hint: exports.EventHostRoleHints[value],
22
+ }));
23
+ /** pending: waiting for the person to sign in and accept; active: accepted */
24
+ exports.EventHostStatusValues = ["pending", "active", "declined", "left", "removed"];
25
+ exports.EventHostStatus = {
26
+ PENDING: "pending",
27
+ ACTIVE: "active",
28
+ DECLINED: "declined",
29
+ LEFT: "left",
30
+ REMOVED: "removed",
31
+ };
32
+ exports.EventHostStatusNames = {
33
+ pending: { ar: "بانتظار القبول", en: "Waiting to accept" },
34
+ active: { ar: "انضم", en: "Joined" },
35
+ declined: { ar: "رفض", en: "Declined" },
36
+ left: { ar: "غادر", en: "Left" },
37
+ removed: { ar: "أزيل", en: "Removed" },
38
+ };
39
+ /** Statuses that still hold the number on the event (one row per number) */
40
+ exports.EventHostOpenStatusValues = ["pending", "active"];
41
+ /** What the signed-in user is on an event */
42
+ exports.EventAccessRoleValues = ["owner", "organiser", "guests"];
43
+ exports.EventPermissionValues = [
44
+ /** See the event (drafts included) and its invitation link */
45
+ "event.view",
46
+ /** Details, names, date, timeline, dress code, design, photos, visibility, preview */
47
+ "event.edit",
48
+ /** Publish (pay), unpublish */
49
+ "event.publish",
50
+ "event.delete",
51
+ /** Guests: add, edit, remove, send links, read status, replies, check-in, guest reports */
52
+ "guests.manage",
53
+ /** Add/remove people of the event and change their role */
54
+ "hosts.manage",
55
+ ];
56
+ exports.EventRolePermissions = {
57
+ owner: exports.EventPermissionValues,
58
+ organiser: exports.EventPermissionValues,
59
+ guests: ["event.view", "guests.manage"],
60
+ };
61
+ const hasEventPermission = (role, permission) => !!role && exports.EventRolePermissions[role].includes(permission);
62
+ exports.hasEventPermission = hasEventPermission;
63
+ exports.EventAccessRoleNames = {
64
+ owner: { ar: "المالك", en: "Owner" },
65
+ organiser: exports.EventHostRoleNames.organiser,
66
+ guests: exports.EventHostRoleNames.guests,
67
+ };
68
+ const slot = (key, ar, en, role, extra = {}) => ({ key, label: { ar, en }, role, ...extra });
69
+ const organiser = (ar = "المنظم", en = "Organiser") => slot("organiser", ar, en, "organiser", { mirrors: "occasion.phone" });
70
+ const weddingPeople = [
71
+ slot("bride", "العروس", "Bride", "guests", { mirrors: "wedding.bride_phone" }),
72
+ slot("groom", "العريس", "Groom", "guests", { mirrors: "wedding.groom_phone" }),
73
+ slot("organiser", "المنظم", "Organiser", "organiser"),
74
+ ];
75
+ /**
76
+ * Suggested people of each event type. The person the event is for manages guests;
77
+ * whoever organises or invites gets full control. Anyone else is added by hand.
78
+ */
79
+ exports.EventPeopleSlots = {
80
+ wedding: weddingPeople,
81
+ engagement: weddingPeople,
82
+ marriage: weddingPeople,
83
+ proposal: [
84
+ slot("proposer", "من سيطلب", "Who is proposing", "organiser"),
85
+ slot("partner", "الشريك", "Partner", "guests", { surprise_when_details_surprise: true }),
86
+ organiser(),
87
+ ],
88
+ bachelor: [slot("celebrant", "العروس أو العريس", "Bride or groom", "guests"), organiser()],
89
+ birthday: [slot("celebrant", "صاحب عيد الميلاد", "Birthday person", "guests"), organiser("من يدعو", "Who is inviting")],
90
+ newborn: [slot("mother", "الأم", "Mother", "organiser", { mirrors: "occasion.phone" }), slot("father", "الأب", "Father", "organiser")],
91
+ gender_reveal: [slot("mother", "الأم", "Mother", "organiser", { mirrors: "occasion.phone" }), slot("father", "الأب", "Father", "organiser")],
92
+ circumcision: [slot("mother", "الأم", "Mother", "organiser", { mirrors: "occasion.phone" }), slot("father", "الأب", "Father", "organiser")],
93
+ graduation: [slot("graduate", "الخريج", "Graduate", "guests"), organiser("من يدعو", "Who is inviting")],
94
+ hajj: [
95
+ slot("pilgrim", "الحاج أو الحاجة", "Pilgrim", "guests"),
96
+ slot("pilgrim2", "الحاج الثاني", "Second pilgrim", "guests"),
97
+ organiser("من يدعو", "Who is inviting"),
98
+ ],
99
+ mothers_day: [slot("mother", "الأم", "Mother", "guests"), organiser("من يدعو", "Who is inviting")],
100
+ valentine: [
101
+ slot("first", "الشخص الأول", "First person", "guests"),
102
+ slot("second", "الشخص الثاني", "Second person", "guests"),
103
+ organiser("من يدعو", "Who is inviting"),
104
+ ],
105
+ opening: [slot("shop_owner", "صاحب المحل", "Business owner", "organiser", { mirrors: "occasion.phone" })],
106
+ general: [organiser()],
107
+ };
108
+ const DEFAULT_PEOPLE = [organiser()];
109
+ /** Suggested people of a type (a type without its own list gets the organiser only) */
110
+ const findEventPeopleSlots = (eventType) => (eventType && exports.EventPeopleSlots[eventType]) || DEFAULT_PEOPLE;
111
+ exports.findEventPeopleSlots = findEventPeopleSlots;
112
+ const findEventPeopleSlot = (eventType, key) => key ? (0, exports.findEventPeopleSlots)(eventType).find((s) => s.key === key) : undefined;
113
+ exports.findEventPeopleSlot = findEventPeopleSlot;
114
+ /** Answers to «من أنت في هذه المناسبة؟» besides the type's slots */
115
+ exports.EventCreatorRoleExtra = {
116
+ COMPANY: "company",
117
+ OTHER: "other",
118
+ };
119
+ exports.EventCreatorRoleExtraNames = {
120
+ company: { ar: "شركة", en: "A company" },
121
+ other: { ar: "شخص آخر", en: "Someone else" },
122
+ };
123
+ /** Label of the person a host row (or the creator) is: slot label, or the free text */
124
+ const eventPersonLabel = (eventType, slotKey, fallback) => {
125
+ const s = (0, exports.findEventPeopleSlot)(eventType, slotKey);
126
+ if (s)
127
+ return s.label;
128
+ if (slotKey === "company" || slotKey === "other")
129
+ return exports.EventCreatorRoleExtraNames[slotKey];
130
+ return fallback ? { ar: fallback, en: fallback } : null;
131
+ };
132
+ exports.eventPersonLabel = eventPersonLabel;
133
+ exports.EVENT_HOST_LABEL_MAX = 60;
134
+ /**
135
+ * One spelling for a phone number so numbers typed differently still match:
136
+ * digits only with a leading +, 00 → +, and no 0 right after a known country code.
137
+ */
138
+ const normalizeEventPhone = (value) => {
139
+ if (!value)
140
+ return null;
141
+ let digits = String(value).trim().replace(/[^\d+]/g, "");
142
+ if (digits.startsWith("00"))
143
+ digits = "+" + digits.slice(2);
144
+ if (!digits.startsWith("+"))
145
+ digits = "+" + digits.replace(/\+/g, "");
146
+ digits = "+" + digits.slice(1).replace(/\+/g, "");
147
+ for (const code of ["+963", "+971", "+965", "+961", "+90", "+966", "+962", "+974"]) {
148
+ if (digits.startsWith(code + "0")) {
149
+ digits = code + digits.slice(code.length + 1);
150
+ break;
151
+ }
152
+ }
153
+ return digits.length > 4 ? digits : null;
154
+ };
155
+ exports.normalizeEventPhone = normalizeEventPhone;
@@ -0,0 +1,63 @@
1
+ import type { IEventOccasion } from "../../types/events/EventOccasion";
2
+ type Text = {
3
+ en: string;
4
+ ar: string;
5
+ };
6
+ /** Where a field is saved: a column of event.occasion, or a key inside its `details` */
7
+ export type EventOccasionFieldKey = "primary_name" | "secondary_name" | "host_name" | `details.${string}`;
8
+ export type EventOccasionField = {
9
+ key: EventOccasionFieldKey;
10
+ label: Text;
11
+ /** text (default), multiline, number, date (YYYY-MM-DD) or choice */
12
+ input?: "text" | "multiline" | "number" | "date" | "choice";
13
+ required?: boolean;
14
+ hint?: Text;
15
+ placeholder?: Text;
16
+ options?: {
17
+ value: string;
18
+ label: Text;
19
+ }[];
20
+ min?: number;
21
+ max?: number;
22
+ };
23
+ /** Form and wording of an occasion type (every type whose details live in event.occasion) */
24
+ export type EventOccasionTypeConfig = {
25
+ type: string;
26
+ /** Short line on the type card */
27
+ description: Text;
28
+ /** Name fields first, then the type's own details */
29
+ fields: EventOccasionField[];
30
+ /** Title in lists and page titles; {name} is primary_name (or its fallback) */
31
+ title: Text;
32
+ /** Used for {name} while primary_name is empty */
33
+ name_fallback: Text;
34
+ /** First line of the invitation; {host} is host_name */
35
+ invite_line: {
36
+ with_host: Text;
37
+ without_host: Text;
38
+ };
39
+ /** Default welcome text under the name */
40
+ welcome: Text;
41
+ /** Default text above the RSVP form */
42
+ rsvp: Text;
43
+ /** New events of this type are public (listed, indexed) unless the owner changes it */
44
+ default_public?: boolean;
45
+ };
46
+ export declare const EVENT_OCCASION_TEXT_MAX = 255;
47
+ export declare const EVENT_OCCASION_LONG_TEXT_MAX = 500;
48
+ export declare const EVENT_BIRTHDAY_AGE_LIMIT = 120;
49
+ export declare const EventOccasionTypeConfigs: Record<string, EventOccasionTypeConfig>;
50
+ export declare const findEventOccasionConfig: (eventType: string | null | undefined) => EventOccasionTypeConfig | null;
51
+ /** Value of a field (column or details key) */
52
+ export declare const eventOccasionFieldValue: (occasion: Partial<IEventOccasion> | null | undefined, key: EventOccasionFieldKey) => unknown;
53
+ /** «تخرج أحمد», «افتتاح بن الشام» */
54
+ export declare const eventOccasionTitle: (eventType: string | null | undefined, occasion: Partial<IEventOccasion> | null | undefined, lang?: "ar" | "en") => string;
55
+ /** First line of the invitation, e.g. «عائلة أحمد يدعونكم لحفل تخرج» */
56
+ export declare const eventOccasionInviteLine: (eventType: string | null | undefined, occasion: Partial<IEventOccasion> | null | undefined, lang?: "ar" | "en") => string;
57
+ /** Answer keys a guest can send with an RSVP */
58
+ export declare const EventRsvpAnswerKeys: {
59
+ /** Gender reveal guess: boy | girl */
60
+ readonly GENDER_GUESS: "gender_guess";
61
+ };
62
+ export declare const emptyEventOccasion: IEventOccasion;
63
+ export {};