@hanzo/booker 0.1.0

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 (124) hide show
  1. package/README.md +78 -0
  2. package/dist/cjs/Booker.cjs +153 -0
  3. package/dist/cjs/Booker.native.js +158 -0
  4. package/dist/cjs/Booker.native.js.map +1 -0
  5. package/dist/cjs/BookingForm.cjs +197 -0
  6. package/dist/cjs/BookingForm.native.js +203 -0
  7. package/dist/cjs/BookingForm.native.js.map +1 -0
  8. package/dist/cjs/CalendarEmbed.cjs +121 -0
  9. package/dist/cjs/CalendarEmbed.native.js +125 -0
  10. package/dist/cjs/CalendarEmbed.native.js.map +1 -0
  11. package/dist/cjs/Confirmation.cjs +177 -0
  12. package/dist/cjs/Confirmation.native.js +185 -0
  13. package/dist/cjs/Confirmation.native.js.map +1 -0
  14. package/dist/cjs/EventHeader.cjs +112 -0
  15. package/dist/cjs/EventHeader.native.js +118 -0
  16. package/dist/cjs/EventHeader.native.js.map +1 -0
  17. package/dist/cjs/MonthCalendar.cjs +177 -0
  18. package/dist/cjs/MonthCalendar.native.js +191 -0
  19. package/dist/cjs/MonthCalendar.native.js.map +1 -0
  20. package/dist/cjs/TimeSlots.cjs +119 -0
  21. package/dist/cjs/TimeSlots.native.js +126 -0
  22. package/dist/cjs/TimeSlots.native.js.map +1 -0
  23. package/dist/cjs/client.cjs +136 -0
  24. package/dist/cjs/client.native.js +267 -0
  25. package/dist/cjs/client.native.js.map +1 -0
  26. package/dist/cjs/hooks.cjs +193 -0
  27. package/dist/cjs/hooks.native.js +221 -0
  28. package/dist/cjs/hooks.native.js.map +1 -0
  29. package/dist/cjs/index.cjs +71 -0
  30. package/dist/cjs/index.native.js +74 -0
  31. package/dist/cjs/index.native.js.map +1 -0
  32. package/dist/cjs/time.cjs +145 -0
  33. package/dist/cjs/time.native.js +150 -0
  34. package/dist/cjs/time.native.js.map +1 -0
  35. package/dist/cjs/useBooker.cjs +151 -0
  36. package/dist/cjs/useBooker.native.js +173 -0
  37. package/dist/cjs/useBooker.native.js.map +1 -0
  38. package/dist/esm/Booker.mjs +128 -0
  39. package/dist/esm/Booker.mjs.map +1 -0
  40. package/dist/esm/Booker.native.js +130 -0
  41. package/dist/esm/Booker.native.js.map +1 -0
  42. package/dist/esm/BookingForm.mjs +172 -0
  43. package/dist/esm/BookingForm.mjs.map +1 -0
  44. package/dist/esm/BookingForm.native.js +175 -0
  45. package/dist/esm/BookingForm.native.js.map +1 -0
  46. package/dist/esm/CalendarEmbed.mjs +96 -0
  47. package/dist/esm/CalendarEmbed.mjs.map +1 -0
  48. package/dist/esm/CalendarEmbed.native.js +97 -0
  49. package/dist/esm/CalendarEmbed.native.js.map +1 -0
  50. package/dist/esm/Confirmation.mjs +152 -0
  51. package/dist/esm/Confirmation.mjs.map +1 -0
  52. package/dist/esm/Confirmation.native.js +157 -0
  53. package/dist/esm/Confirmation.native.js.map +1 -0
  54. package/dist/esm/EventHeader.mjs +87 -0
  55. package/dist/esm/EventHeader.mjs.map +1 -0
  56. package/dist/esm/EventHeader.native.js +90 -0
  57. package/dist/esm/EventHeader.native.js.map +1 -0
  58. package/dist/esm/MonthCalendar.mjs +152 -0
  59. package/dist/esm/MonthCalendar.mjs.map +1 -0
  60. package/dist/esm/MonthCalendar.native.js +163 -0
  61. package/dist/esm/MonthCalendar.native.js.map +1 -0
  62. package/dist/esm/TimeSlots.mjs +94 -0
  63. package/dist/esm/TimeSlots.mjs.map +1 -0
  64. package/dist/esm/TimeSlots.native.js +98 -0
  65. package/dist/esm/TimeSlots.native.js.map +1 -0
  66. package/dist/esm/client.mjs +104 -0
  67. package/dist/esm/client.mjs.map +1 -0
  68. package/dist/esm/client.native.js +232 -0
  69. package/dist/esm/client.native.js.map +1 -0
  70. package/dist/esm/hooks.mjs +165 -0
  71. package/dist/esm/hooks.mjs.map +1 -0
  72. package/dist/esm/hooks.native.js +190 -0
  73. package/dist/esm/hooks.native.js.map +1 -0
  74. package/dist/esm/index.js +13 -0
  75. package/dist/esm/index.js.map +1 -0
  76. package/dist/esm/index.mjs +13 -0
  77. package/dist/esm/index.mjs.map +1 -0
  78. package/dist/esm/index.native.js +13 -0
  79. package/dist/esm/index.native.js.map +1 -0
  80. package/dist/esm/time.mjs +107 -0
  81. package/dist/esm/time.mjs.map +1 -0
  82. package/dist/esm/time.native.js +109 -0
  83. package/dist/esm/time.native.js.map +1 -0
  84. package/dist/esm/useBooker.mjs +126 -0
  85. package/dist/esm/useBooker.mjs.map +1 -0
  86. package/dist/esm/useBooker.native.js +145 -0
  87. package/dist/esm/useBooker.native.js.map +1 -0
  88. package/package.json +61 -0
  89. package/src/Booker.tsx +152 -0
  90. package/src/BookingForm.tsx +180 -0
  91. package/src/CalendarEmbed.tsx +111 -0
  92. package/src/Confirmation.tsx +145 -0
  93. package/src/EventHeader.tsx +85 -0
  94. package/src/MonthCalendar.tsx +179 -0
  95. package/src/TimeSlots.tsx +102 -0
  96. package/src/client.ts +218 -0
  97. package/src/hooks.ts +180 -0
  98. package/src/index.ts +72 -0
  99. package/src/time.ts +131 -0
  100. package/src/useBooker.ts +187 -0
  101. package/types/Booker.d.ts +16 -0
  102. package/types/Booker.d.ts.map +1 -0
  103. package/types/BookingForm.d.ts +13 -0
  104. package/types/BookingForm.d.ts.map +1 -0
  105. package/types/CalendarEmbed.d.ts +15 -0
  106. package/types/CalendarEmbed.d.ts.map +1 -0
  107. package/types/Confirmation.d.ts +12 -0
  108. package/types/Confirmation.d.ts.map +1 -0
  109. package/types/EventHeader.d.ts +10 -0
  110. package/types/EventHeader.d.ts.map +1 -0
  111. package/types/MonthCalendar.d.ts +14 -0
  112. package/types/MonthCalendar.d.ts.map +1 -0
  113. package/types/TimeSlots.d.ts +15 -0
  114. package/types/TimeSlots.d.ts.map +1 -0
  115. package/types/client.d.ts +77 -0
  116. package/types/client.d.ts.map +1 -0
  117. package/types/hooks.d.ts +43 -0
  118. package/types/hooks.d.ts.map +1 -0
  119. package/types/index.d.ts +12 -0
  120. package/types/index.d.ts.map +1 -0
  121. package/types/time.d.ts +38 -0
  122. package/types/time.d.ts.map +1 -0
  123. package/types/useBooker.d.ts +41 -0
  124. package/types/useBooker.d.ts.map +1 -0
@@ -0,0 +1,185 @@
1
+ "use strict";
2
+
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __export = (target, all) => {
8
+ for (var name in all) __defProp(target, name, {
9
+ get: all[name],
10
+ enumerable: true
11
+ });
12
+ };
13
+ var __copyProps = (to, from, except, desc) => {
14
+ if (from && typeof from === "object" || typeof from === "function") {
15
+ for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
16
+ get: () => from[key],
17
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
18
+ });
19
+ }
20
+ return to;
21
+ };
22
+ var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
23
+ value: true
24
+ }), mod);
25
+ var Confirmation_exports = {};
26
+ __export(Confirmation_exports, {
27
+ Confirmation: () => Confirmation
28
+ });
29
+ module.exports = __toCommonJS(Confirmation_exports);
30
+ var import_jsx_runtime = require("react/jsx-runtime");
31
+ var import_hanzogui = require("hanzogui");
32
+ var import_client = require("./client.native.js");
33
+ var import_hooks = require("./hooks.native.js");
34
+ var import_time = require("./time.native.js");
35
+ var import_time2 = require("./time.native.js");
36
+ function Confirmation(param) {
37
+ var {
38
+ booking,
39
+ uid,
40
+ apiUrl,
41
+ timeZone,
42
+ onDone
43
+ } = param;
44
+ var _data_attendees;
45
+ var api = apiUrl !== null && apiUrl !== void 0 ? apiUrl : import_client.DEFAULT_API_URL;
46
+ var tz = timeZone !== null && timeZone !== void 0 ? timeZone : (0, import_time.visitorTimeZone)();
47
+ var fetched = (0, import_hooks.useBooking)(api, booking ? void 0 : uid);
48
+ var data = booking !== null && booking !== void 0 ? booking : fetched.data;
49
+ if (!data && fetched.loading) {
50
+ return /* @__PURE__ */(0, import_jsx_runtime.jsxs)(import_hanzogui.YStack, {
51
+ alignItems: "center",
52
+ justifyContent: "center",
53
+ padding: "$6",
54
+ gap: "$3",
55
+ minHeight: 200,
56
+ children: [/* @__PURE__ */(0, import_jsx_runtime.jsx)(import_hanzogui.Spinner, {
57
+ size: "large",
58
+ color: "$color9"
59
+ }), /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_hanzogui.SizableText, {
60
+ size: "$3",
61
+ color: "$color10",
62
+ children: "Loading your booking\u2026"
63
+ })]
64
+ });
65
+ }
66
+ if (!data) {
67
+ var _fetched_error;
68
+ return /* @__PURE__ */(0, import_jsx_runtime.jsxs)(import_hanzogui.YStack, {
69
+ alignItems: "center",
70
+ justifyContent: "center",
71
+ padding: "$6",
72
+ gap: "$2",
73
+ minHeight: 200,
74
+ children: [/* @__PURE__ */(0, import_jsx_runtime.jsx)(import_hanzogui.SizableText, {
75
+ size: "$4",
76
+ fontWeight: "600",
77
+ color: "$color12",
78
+ children: "Booking not found"
79
+ }), /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_hanzogui.SizableText, {
80
+ size: "$3",
81
+ color: "$color10",
82
+ textAlign: "center",
83
+ children: (_fetched_error = fetched.error) !== null && _fetched_error !== void 0 ? _fetched_error : "We could not load this booking."
84
+ })]
85
+ });
86
+ }
87
+ var attendee = (_data_attendees = data.attendees) === null || _data_attendees === void 0 ? void 0 : _data_attendees[0];
88
+ var location = data.location;
89
+ var _attendee_email;
90
+ return /* @__PURE__ */(0, import_jsx_runtime.jsxs)(import_hanzogui.YStack, {
91
+ gap: "$3",
92
+ padding: "$1",
93
+ alignItems: "center",
94
+ children: [/* @__PURE__ */(0, import_jsx_runtime.jsx)(import_hanzogui.YStack, {
95
+ width: 52,
96
+ height: 52,
97
+ borderRadius: 9999,
98
+ backgroundColor: "$green4",
99
+ alignItems: "center",
100
+ justifyContent: "center",
101
+ children: /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_hanzogui.SizableText, {
102
+ size: "$8",
103
+ color: "$green11",
104
+ children: "\u2713"
105
+ })
106
+ }), /* @__PURE__ */(0, import_jsx_runtime.jsxs)(import_hanzogui.YStack, {
107
+ gap: "$1",
108
+ alignItems: "center",
109
+ children: [/* @__PURE__ */(0, import_jsx_runtime.jsx)(import_hanzogui.SizableText, {
110
+ size: "$7",
111
+ fontWeight: "700",
112
+ color: "$color12",
113
+ textAlign: "center",
114
+ children: "You're booked"
115
+ }), /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_hanzogui.SizableText, {
116
+ size: "$4",
117
+ color: "$color11",
118
+ textAlign: "center",
119
+ children: data.title
120
+ })]
121
+ }), /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_hanzogui.Separator, {
122
+ width: "100%"
123
+ }), /* @__PURE__ */(0, import_jsx_runtime.jsxs)(import_hanzogui.YStack, {
124
+ gap: "$2.5",
125
+ width: "100%",
126
+ maxWidth: 420,
127
+ children: [/* @__PURE__ */(0, import_jsx_runtime.jsx)(Row, {
128
+ label: "When",
129
+ value: (0, import_time2.formatBookingWhen)(data.start, tz)
130
+ }), location ? /* @__PURE__ */(0, import_jsx_runtime.jsx)(Row, {
131
+ label: "Where",
132
+ value: location
133
+ }) : null, (attendee === null || attendee === void 0 ? void 0 : attendee.email) ? /* @__PURE__ */(0, import_jsx_runtime.jsx)(Row, {
134
+ label: "Guest",
135
+ value: attendee.email
136
+ }) : null, /* @__PURE__ */(0, import_jsx_runtime.jsx)(Row, {
137
+ label: "Status",
138
+ value: titleCase(data.status)
139
+ }), /* @__PURE__ */(0, import_jsx_runtime.jsx)(Row, {
140
+ label: "Reference",
141
+ value: data.uid
142
+ })]
143
+ }), /* @__PURE__ */(0, import_jsx_runtime.jsxs)(import_hanzogui.Paragraph, {
144
+ size: "$2",
145
+ color: "$color10",
146
+ textAlign: "center",
147
+ marginTop: "$1",
148
+ children: ["A calendar invite is on its way to ", (_attendee_email = attendee === null || attendee === void 0 ? void 0 : attendee.email) !== null && _attendee_email !== void 0 ? _attendee_email : "your inbox", "."]
149
+ }), onDone ? /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_hanzogui.Button, {
150
+ size: "$3",
151
+ chromeless: true,
152
+ onPress: onDone,
153
+ marginTop: "$1",
154
+ children: "Book another time"
155
+ }) : null]
156
+ });
157
+ }
158
+ function Row(param) {
159
+ var {
160
+ label,
161
+ value
162
+ } = param;
163
+ return /* @__PURE__ */(0, import_jsx_runtime.jsxs)(import_hanzogui.XStack, {
164
+ justifyContent: "space-between",
165
+ gap: "$3",
166
+ alignItems: "flex-start",
167
+ children: [/* @__PURE__ */(0, import_jsx_runtime.jsx)(import_hanzogui.SizableText, {
168
+ size: "$3",
169
+ color: "$color10",
170
+ children: label
171
+ }), /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_hanzogui.SizableText, {
172
+ size: "$3",
173
+ color: "$color12",
174
+ fontWeight: "500",
175
+ textAlign: "right",
176
+ flexShrink: 1,
177
+ children: value
178
+ })]
179
+ });
180
+ }
181
+ function titleCase(s) {
182
+ if (!s) return "";
183
+ return s.charAt(0).toUpperCase() + s.slice(1).toLowerCase();
184
+ }
185
+ //# sourceMappingURL=Confirmation.native.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["__toCommonJS","mod","__copyProps","__defProp","value","Confirmation_exports","__export","Confirmation","module","exports","import_jsx_runtime","require","import_hanzogui","import_client","import_hooks","import_time","import_time2","param","booking","uid","apiUrl","timeZone","onDone","_data_attendees","api","DEFAULT_API_URL","tz","visitorTimeZone","fetched","useBooking","data","loading","jsxs","YStack","alignItems","justifyContent","padding","gap","minHeight","children","jsx","Spinner","size","color","SizableText","_fetched_error","fontWeight","textAlign","error","attendee","attendees","location","_attendee_email","width","height","borderRadius","backgroundColor","title","Separator"],"sources":["../../src/Confirmation.tsx"],"sourcesContent":[null],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA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7B,kBAAA,CAAAsB,IAAA,EAAApB,eAAA,CAAAqB,MAAA;MACtEI,GAAA;MAECH,UACC;MAIJK,QAAA,GAEJ,mBAAA7B,kBAAA,CAAA8B,GAAA,EAAA5B,eAAA,CAAAgC,WAAA;QAESF,IAAM,MAAO;QAElBI,UAAA;QACEH,KAAA;QAGAI,SAAA;QAACR,QAAA;MAAA,IACC,eAAK,IAAA7B,kBAAA,CAAA8B,GAAA,EAAA5B,eAAA,CAAAgC,WAAA;QACLF,IAAM;QACNC,KAAA,YAAW;QACXI,SAAU;QACVR,QAAY,EAAAT,IAAA,CAAA2B;MAEX;IACH,IACF,mBAAA/C,kBAAA,CAAA8B,GAAA,EAAA5B,eAAA,CAAA8C,SAAA;MAEJL,KAAA;IAEA,IACM,eAAW,IAAA3C,kBAAA,CAAAsB,IAAA,EAAApB,eAAA,CAAAqB,MAAA;MACfI,GAAS,QAAQ;MACnBgB,KAAA","ignoreList":[]}
@@ -0,0 +1,112 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all) __defProp(target, name, {
7
+ get: all[name],
8
+ enumerable: true
9
+ });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
14
+ get: () => from[key],
15
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
16
+ });
17
+ }
18
+ return to;
19
+ };
20
+ var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
21
+ value: true
22
+ }), mod);
23
+ var EventHeader_exports = {};
24
+ __export(EventHeader_exports, {
25
+ EventHeader: () => EventHeader
26
+ });
27
+ module.exports = __toCommonJS(EventHeader_exports);
28
+ var import_hanzogui = require("hanzogui");
29
+ var import_jsx_runtime = require("react/jsx-runtime");
30
+ function EventHeader({
31
+ event,
32
+ host,
33
+ timeZone,
34
+ compact
35
+ }) {
36
+ const name = event.profile?.name || host;
37
+ const initial = (name?.[0] || "H").toUpperCase();
38
+ return /* @__PURE__ */(0, import_jsx_runtime.jsxs)(import_hanzogui.YStack, {
39
+ gap: "$2",
40
+ children: [/* @__PURE__ */(0, import_jsx_runtime.jsxs)(import_hanzogui.XStack, {
41
+ alignItems: "center",
42
+ gap: "$2.5",
43
+ children: [/* @__PURE__ */(0, import_jsx_runtime.jsx)(import_hanzogui.YStack, {
44
+ width: 28,
45
+ height: 28,
46
+ borderRadius: 9999,
47
+ backgroundColor: "$color5",
48
+ alignItems: "center",
49
+ justifyContent: "center",
50
+ children: /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_hanzogui.SizableText, {
51
+ size: "$2",
52
+ color: "$color11",
53
+ fontWeight: "600",
54
+ children: initial
55
+ })
56
+ }), /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_hanzogui.SizableText, {
57
+ size: "$3",
58
+ color: "$color10",
59
+ children: name
60
+ })]
61
+ }), /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_hanzogui.SizableText, {
62
+ size: compact ? "$6" : "$8",
63
+ fontWeight: "700",
64
+ color: "$color12",
65
+ children: event.title
66
+ }), /* @__PURE__ */(0, import_jsx_runtime.jsxs)(import_hanzogui.XStack, {
67
+ gap: "$2",
68
+ alignItems: "center",
69
+ flexWrap: "wrap",
70
+ children: [/* @__PURE__ */(0, import_jsx_runtime.jsxs)(Pill, {
71
+ children: [event.length, " min"]
72
+ }), /* @__PURE__ */(0, import_jsx_runtime.jsx)(Pill, {
73
+ children: shortZone(timeZone)
74
+ }), event.locations?.[0]?.type ? /* @__PURE__ */(0, import_jsx_runtime.jsx)(Pill, {
75
+ children: prettyLocation(event.locations[0].type)
76
+ }) : null]
77
+ }), !compact && event.description ? /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_hanzogui.Paragraph, {
78
+ size: "$3",
79
+ color: "$color11",
80
+ marginTop: "$1",
81
+ children: event.description
82
+ }) : null]
83
+ });
84
+ }
85
+ function Pill({
86
+ children
87
+ }) {
88
+ return /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_hanzogui.XStack, {
89
+ backgroundColor: "$color3",
90
+ paddingHorizontal: "$2.5",
91
+ paddingVertical: "$1",
92
+ borderRadius: "$10",
93
+ alignItems: "center",
94
+ children: /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_hanzogui.SizableText, {
95
+ size: "$1",
96
+ color: "$color11",
97
+ children
98
+ })
99
+ });
100
+ }
101
+ function shortZone(tz) {
102
+ const city = tz.split("/").pop() || tz;
103
+ return city.replace(/_/g, " ");
104
+ }
105
+ function prettyLocation(type) {
106
+ const t = type.toLowerCase();
107
+ if (t.includes("google")) return "Google Meet";
108
+ if (t.includes("zoom")) return "Zoom";
109
+ if (t.includes("phone")) return "Phone";
110
+ if (t.includes("person")) return "In person";
111
+ return "Video call";
112
+ }
@@ -0,0 +1,118 @@
1
+ "use strict";
2
+
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __export = (target, all) => {
8
+ for (var name in all) __defProp(target, name, {
9
+ get: all[name],
10
+ enumerable: true
11
+ });
12
+ };
13
+ var __copyProps = (to, from, except, desc) => {
14
+ if (from && typeof from === "object" || typeof from === "function") {
15
+ for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
16
+ get: () => from[key],
17
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
18
+ });
19
+ }
20
+ return to;
21
+ };
22
+ var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
23
+ value: true
24
+ }), mod);
25
+ var EventHeader_exports = {};
26
+ __export(EventHeader_exports, {
27
+ EventHeader: () => EventHeader
28
+ });
29
+ module.exports = __toCommonJS(EventHeader_exports);
30
+ var import_jsx_runtime = require("react/jsx-runtime");
31
+ var import_hanzogui = require("hanzogui");
32
+ function EventHeader(param) {
33
+ var {
34
+ event,
35
+ host,
36
+ timeZone,
37
+ compact
38
+ } = param;
39
+ var _event_profile, _event_locations_, _event_locations;
40
+ var name = ((_event_profile = event.profile) === null || _event_profile === void 0 ? void 0 : _event_profile.name) || host;
41
+ var initial = ((name === null || name === void 0 ? void 0 : name[0]) || "H").toUpperCase();
42
+ return /* @__PURE__ */(0, import_jsx_runtime.jsxs)(import_hanzogui.YStack, {
43
+ gap: "$2",
44
+ children: [/* @__PURE__ */(0, import_jsx_runtime.jsxs)(import_hanzogui.XStack, {
45
+ alignItems: "center",
46
+ gap: "$2.5",
47
+ children: [/* @__PURE__ */(0, import_jsx_runtime.jsx)(import_hanzogui.YStack, {
48
+ width: 28,
49
+ height: 28,
50
+ borderRadius: 9999,
51
+ backgroundColor: "$color5",
52
+ alignItems: "center",
53
+ justifyContent: "center",
54
+ children: /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_hanzogui.SizableText, {
55
+ size: "$2",
56
+ color: "$color11",
57
+ fontWeight: "600",
58
+ children: initial
59
+ })
60
+ }), /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_hanzogui.SizableText, {
61
+ size: "$3",
62
+ color: "$color10",
63
+ children: name
64
+ })]
65
+ }), /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_hanzogui.SizableText, {
66
+ size: compact ? "$6" : "$8",
67
+ fontWeight: "700",
68
+ color: "$color12",
69
+ children: event.title
70
+ }), /* @__PURE__ */(0, import_jsx_runtime.jsxs)(import_hanzogui.XStack, {
71
+ gap: "$2",
72
+ alignItems: "center",
73
+ flexWrap: "wrap",
74
+ children: [/* @__PURE__ */(0, import_jsx_runtime.jsxs)(Pill, {
75
+ children: [event.length, " min"]
76
+ }), /* @__PURE__ */(0, import_jsx_runtime.jsx)(Pill, {
77
+ children: shortZone(timeZone)
78
+ }), ((_event_locations = event.locations) === null || _event_locations === void 0 ? void 0 : (_event_locations_ = _event_locations[0]) === null || _event_locations_ === void 0 ? void 0 : _event_locations_.type) ? /* @__PURE__ */(0, import_jsx_runtime.jsx)(Pill, {
79
+ children: prettyLocation(event.locations[0].type)
80
+ }) : null]
81
+ }), !compact && event.description ? /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_hanzogui.Paragraph, {
82
+ size: "$3",
83
+ color: "$color11",
84
+ marginTop: "$1",
85
+ children: event.description
86
+ }) : null]
87
+ });
88
+ }
89
+ function Pill(param) {
90
+ var {
91
+ children
92
+ } = param;
93
+ return /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_hanzogui.XStack, {
94
+ backgroundColor: "$color3",
95
+ paddingHorizontal: "$2.5",
96
+ paddingVertical: "$1",
97
+ borderRadius: "$10",
98
+ alignItems: "center",
99
+ children: /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_hanzogui.SizableText, {
100
+ size: "$1",
101
+ color: "$color11",
102
+ children
103
+ })
104
+ });
105
+ }
106
+ function shortZone(tz) {
107
+ var city = tz.split("/").pop() || tz;
108
+ return city.replace(/_/g, " ");
109
+ }
110
+ function prettyLocation(type) {
111
+ var t = type.toLowerCase();
112
+ if (t.includes("google")) return "Google Meet";
113
+ if (t.includes("zoom")) return "Zoom";
114
+ if (t.includes("phone")) return "Phone";
115
+ if (t.includes("person")) return "In person";
116
+ return "Video call";
117
+ }
118
+ //# sourceMappingURL=EventHeader.native.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["__toCommonJS","mod","__copyProps","__defProp","value","EventHeader_exports","__export","EventHeader","module","exports","import_jsx_runtime","require","import_hanzogui","param","event","host","timeZone","compact","_event_profile","_event_locations_","_event_locations","name","profile","initial","toUpperCase","jsxs","YStack","gap","children","XStack","alignItems","jsx","width","height","borderRadius","backgroundColor","justifyContent","SizableText","size","color","fontWeight","title","flexWrap","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A;UAAIZ,QAAA,EAAAL;QACxB;MACC,EAAM,EAGT,mBAAAb,kBAAA,CAAAqB,GAAA,EAAAnB,eAAA,CAAAyB,WAAA;QAEEC,IAAW,MAAM;QAKrBC,KAAA;QAEJX,QAAA,EAAAP;MAES;IAEJ,uBAAAX,kBAAA,CAAAqB,GAAA,EAAAnB,eAAA,CAAAyB,WAAA;MACCC,IAAA,EAAArB,OAAA,GAAgB;MAChBuB,UAAA,OAAkB;MAClBD,KAAA,YAAgB;MAChBX,QAAA,EAAAd,KAAa,CAAA2B;IACb,IAEA,mBAAA/B,kBAAA,CAAAe,IAAA,EAAAb,eAAC,CAAAiB,MAAA;MAEDF,GAAA;MACFG,UAAA;MAEJY,QAAA;MAEAd,QAAS,GACD,eAAgB,CAAG,GAAElB,kBAAS,CAAAe,IAAA,EAAAkB,IAAA;QAC7Bf,QAAK,EAAQ,CACtBd,KAAA,CAAA8B,MAAA,EAES;MAED,IACA,eAAkB,IAAAlC,kBAAO,CAAAqB,GAAA,EAAAY,IAAA;QACzBf,QAAS,EAAAiB,SAAU,CAAA7B,QAAO;MAC1B,IACC,EAAAI,gBAAA,GAAAN,KAAA,CAAAgC,SAAA,cAAA1B,gBAAA,wBAAAD,iBAAA,GAAAC,gBAAA,iBAAAD,iBAAA,uBAAAA,iBAAA,CAAA4B,IAAA,uBAAArC,kBAAA,CAAAqB,GAAA,EAAAY,IAAA;QACTf,QAAA,EAAAoB,cAAA,CAAAlC,KAAA,CAAAgC,SAAA,IAAAC,IAAA","ignoreList":[]}
@@ -0,0 +1,177 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all) __defProp(target, name, {
7
+ get: all[name],
8
+ enumerable: true
9
+ });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
14
+ get: () => from[key],
15
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
16
+ });
17
+ }
18
+ return to;
19
+ };
20
+ var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
21
+ value: true
22
+ }), mod);
23
+ var MonthCalendar_exports = {};
24
+ __export(MonthCalendar_exports, {
25
+ MonthCalendar: () => MonthCalendar
26
+ });
27
+ module.exports = __toCommonJS(MonthCalendar_exports);
28
+ var import_hanzogui = require("hanzogui");
29
+ var import_time = require("./time.cjs");
30
+ var import_jsx_runtime = require("react/jsx-runtime");
31
+ function MonthCalendar({
32
+ viewDate,
33
+ availableKeys,
34
+ selectedDay,
35
+ onSelectDay,
36
+ onPrev,
37
+ onNext,
38
+ atFirstMonth,
39
+ weekStartsOn = 0,
40
+ loading
41
+ }) {
42
+ const cells = (0, import_time.monthMatrix)(viewDate, weekStartsOn);
43
+ const rows = [];
44
+ for (let i = 0; i < cells.length; i += 7) rows.push(cells.slice(i, i + 7));
45
+ const labels = (0, import_time.weekdayLabels)(weekStartsOn);
46
+ return /* @__PURE__ */(0, import_jsx_runtime.jsxs)(import_hanzogui.YStack, {
47
+ gap: "$2",
48
+ flex: 1,
49
+ minWidth: 260,
50
+ children: [/* @__PURE__ */(0, import_jsx_runtime.jsxs)(import_hanzogui.XStack, {
51
+ alignItems: "center",
52
+ justifyContent: "space-between",
53
+ paddingVertical: "$1",
54
+ children: [/* @__PURE__ */(0, import_jsx_runtime.jsx)(NavArrow, {
55
+ label: "Previous month",
56
+ disabled: atFirstMonth,
57
+ onPress: onPrev,
58
+ children: "\u2039"
59
+ }), /* @__PURE__ */(0, import_jsx_runtime.jsxs)(import_hanzogui.XStack, {
60
+ alignItems: "center",
61
+ gap: "$2",
62
+ children: [/* @__PURE__ */(0, import_jsx_runtime.jsx)(import_hanzogui.SizableText, {
63
+ size: "$5",
64
+ fontWeight: "700",
65
+ color: "$color12",
66
+ children: (0, import_time.formatMonthLabel)(viewDate)
67
+ }), loading ? /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_hanzogui.Spinner, {
68
+ size: "small",
69
+ color: "$color9"
70
+ }) : null]
71
+ }), /* @__PURE__ */(0, import_jsx_runtime.jsx)(NavArrow, {
72
+ label: "Next month",
73
+ onPress: onNext,
74
+ children: "\u203A"
75
+ })]
76
+ }), /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_hanzogui.XStack, {
77
+ children: labels.map(l => /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_hanzogui.YStack, {
78
+ flexBasis: 0,
79
+ flexGrow: 1,
80
+ alignItems: "center",
81
+ paddingVertical: "$1",
82
+ children: /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_hanzogui.SizableText, {
83
+ size: "$1",
84
+ color: "$color10",
85
+ children: l
86
+ })
87
+ }, l))
88
+ }), /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_hanzogui.YStack, {
89
+ gap: "$1.5",
90
+ children: rows.map((row, r) => /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_hanzogui.XStack, {
91
+ gap: "$1.5",
92
+ children: row.map(cell => /* @__PURE__ */(0, import_jsx_runtime.jsx)(DayCell, {
93
+ cell,
94
+ available: availableKeys.has(cell.key),
95
+ past: (0, import_time.isBeforeToday)(cell.key),
96
+ selected: selectedDay === cell.key,
97
+ onSelectDay
98
+ }, cell.key))
99
+ }, r))
100
+ })]
101
+ });
102
+ }
103
+ function DayCell({
104
+ cell,
105
+ available,
106
+ past,
107
+ selected,
108
+ onSelectDay
109
+ }) {
110
+ const selectable = cell.inMonth && available && !past;
111
+ const dayNum = cell.date.getDate();
112
+ return /* @__PURE__ */(0, import_jsx_runtime.jsxs)(import_hanzogui.YStack, {
113
+ flexBasis: 0,
114
+ flexGrow: 1,
115
+ aspectRatio: 1,
116
+ alignItems: "center",
117
+ justifyContent: "center",
118
+ borderRadius: "$4",
119
+ borderWidth: 1,
120
+ borderColor: selected ? "$color12" : selectable ? "$color5" : "transparent",
121
+ backgroundColor: selected ? "$color12" : selectable ? "$color2" : "transparent",
122
+ opacity: cell.inMonth ? 1 : 0,
123
+ cursor: selectable ? "pointer" : "default",
124
+ hoverStyle: selectable && !selected ? {
125
+ backgroundColor: "$color4"
126
+ } : void 0,
127
+ pressStyle: selectable ? {
128
+ backgroundColor: "$color6"
129
+ } : void 0,
130
+ onPress: selectable ? () => onSelectDay(cell.key) : void 0,
131
+ "aria-label": selectable ? `Select ${cell.key}` : void 0,
132
+ role: selectable ? "button" : void 0,
133
+ children: [/* @__PURE__ */(0, import_jsx_runtime.jsx)(import_hanzogui.SizableText, {
134
+ size: "$3",
135
+ fontWeight: selectable ? "600" : "400",
136
+ color: selected ? "$color1" : selectable ? "$color12" : "$color8",
137
+ children: dayNum
138
+ }), selectable && !selected ? /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_hanzogui.YStack, {
139
+ position: "absolute",
140
+ bottom: 4,
141
+ width: 4,
142
+ height: 4,
143
+ borderRadius: 9999,
144
+ backgroundColor: "$color10"
145
+ }) : null]
146
+ });
147
+ }
148
+ function NavArrow({
149
+ children,
150
+ onPress,
151
+ disabled,
152
+ label
153
+ }) {
154
+ return /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_hanzogui.YStack, {
155
+ width: 34,
156
+ height: 34,
157
+ alignItems: "center",
158
+ justifyContent: "center",
159
+ borderRadius: "$4",
160
+ opacity: disabled ? 0.35 : 1,
161
+ cursor: disabled ? "default" : "pointer",
162
+ hoverStyle: disabled ? void 0 : {
163
+ backgroundColor: "$color4"
164
+ },
165
+ pressStyle: disabled ? void 0 : {
166
+ backgroundColor: "$color6"
167
+ },
168
+ onPress: disabled ? void 0 : onPress,
169
+ "aria-label": label,
170
+ role: "button",
171
+ children: /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_hanzogui.SizableText, {
172
+ size: "$6",
173
+ color: "$color11",
174
+ children
175
+ })
176
+ });
177
+ }