esoftplay-event 0.0.1 → 0.0.2-b

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 (86) hide show
  1. package/config.json +1 -1
  2. package/event/artist.tsx +11 -7
  3. package/event/artist_detail.tsx +3 -5
  4. package/event/artist_detailv2.tsx +386 -0
  5. package/event/artistv2.tsx +162 -0
  6. package/event/button_order_detail.tsx +43 -0
  7. package/event/countdown_base.tsx +16 -3
  8. package/event/countdown_event.tsx +48 -0
  9. package/event/detail.tsx +30 -37
  10. package/event/detail2.tsx +354 -0
  11. package/event/exchange_ticket.tsx +1 -1
  12. package/event/exchange_ticket_list.tsx +2 -3
  13. package/event/exchange_ticket_result.tsx +1 -1
  14. package/event/firebase_socket.ts +21 -11
  15. package/event/loading_page.tsx +4 -2
  16. package/event/order.tsx +23 -36
  17. package/event/order_detail.tsx +204 -61
  18. package/event/order_detail_upgrade.tsx +8 -5
  19. package/event/order_detail_upgrade_payment.tsx +17 -11
  20. package/event/order_detail_visitor.tsx +33 -33
  21. package/event/order_detail_waiting.tsx +45 -20
  22. package/event/order_item.tsx +1 -1
  23. package/event/order_lottery.tsx +49 -37
  24. package/event/order_reschedule.tsx +50 -52
  25. package/event/order_share_to.tsx +11 -24
  26. package/event/order_share_to_detail.tsx +8 -3
  27. package/event/order_waiting.tsx +1 -1
  28. package/event/queue_pricing.tsx +16 -3
  29. package/event/refresh_button.tsx +3 -5
  30. package/event/scan_item.tsx +2 -2
  31. package/event/seat.tsx +34 -13
  32. package/event/seat_map_new.tsx +316 -0
  33. package/event/secure_page.debug.tsx +34 -0
  34. package/event/secure_page.live.tsx +35 -0
  35. package/event/secure_page.tsx +6 -5
  36. package/event/test.tsx +240 -155
  37. package/event/ticket_list.tsx +48 -20
  38. package/event/ticket_list2.tsx +112 -39
  39. package/event/tms_check_code.tsx +6 -0
  40. package/event/tms_check_ticket_result.tsx +51 -13
  41. package/event/tms_dashboard.tsx +85 -3
  42. package/event/tms_gate.tsx +6 -0
  43. package/event/tms_home.tsx +1 -4
  44. package/event/tms_in_failed.tsx +1 -1
  45. package/event/tms_in_hall.tsx +4 -1
  46. package/event/tms_in_hall_failed.tsx +8 -10
  47. package/event/tms_in_log.tsx +2 -0
  48. package/event/tms_in_success.tsx +1 -1
  49. package/event/tms_log.tsx +10 -25
  50. package/event/tms_out.tsx +1 -1
  51. package/event/tms_out_failed.tsx +1 -1
  52. package/event/visitor_input.tsx +22 -5
  53. package/event/visitor_inputv2.tsx +453 -0
  54. package/event/voucher.tsx +2 -0
  55. package/event/voucher2.tsx +14 -6
  56. package/id.json +43 -9
  57. package/package.json +1 -1
  58. package/event/entrance.tsx +0 -215
  59. package/event/entrance_again.tsx +0 -199
  60. package/event/entrance_failed.tsx +0 -190
  61. package/event/entrance_idcard.tsx +0 -199
  62. package/event/entrance_list.tsx +0 -264
  63. package/event/entrance_list_item.tsx +0 -88
  64. package/event/entrance_log.tsx +0 -130
  65. package/event/entrance_success.tsx +0 -153
  66. package/event/entrance_warning.tsx +0 -91
  67. package/event/exit.tsx +0 -91
  68. package/event/exit_failed.tsx +0 -135
  69. package/event/exit_list.tsx +0 -118
  70. package/event/exit_log.tsx +0 -130
  71. package/event/exit_success.tsx +0 -143
  72. package/event/exit_temporary.tsx +0 -226
  73. package/event/firebase_socket.debug.ts +0 -260
  74. package/event/firebase_socket.live.ts +0 -335
  75. package/event/hall_in.tsx +0 -148
  76. package/event/hall_in_failed.tsx +0 -270
  77. package/event/hall_in_list.tsx +0 -222
  78. package/event/hall_in_log.tsx +0 -134
  79. package/event/hall_in_success.tsx +0 -132
  80. package/event/hall_out.tsx +0 -143
  81. package/event/hall_out_failed.tsx +0 -133
  82. package/event/hall_out_list.tsx +0 -215
  83. package/event/hall_out_log.tsx +0 -133
  84. package/event/hall_out_success.tsx +0 -130
  85. package/event/log.tsx +0 -433
  86. package/event/seat_map_test.tsx +0 -401
@@ -0,0 +1,316 @@
1
+ // withHooks
2
+ import { Canvas, Group, RoundedRect, Text, useFont } from '@shopify/react-native-skia';
3
+ import { EventButton } from 'esoftplay/cache/event/button/import';
4
+ import { EventHeader } from 'esoftplay/cache/event/header/import';
5
+ import { EventMessage } from 'esoftplay/cache/event/message/import';
6
+ import { LibCurl } from 'esoftplay/cache/lib/curl/import';
7
+ import { LibIcon } from 'esoftplay/cache/lib/icon/import';
8
+ import { LibNavigation } from 'esoftplay/cache/lib/navigation/import';
9
+ import { LibStyle } from 'esoftplay/cache/lib/style/import';
10
+ import { LibTextstyle } from 'esoftplay/cache/lib/textstyle/import';
11
+ import { LibToastProperty } from 'esoftplay/cache/lib/toast/import';
12
+ import { UseMap } from 'esoftplay/cache/use/map/import';
13
+ import esp from 'esoftplay/esp';
14
+ import useSafeState from 'esoftplay/state';
15
+ import React, { useCallback, useEffect, useState } from 'react';
16
+ import { Dimensions, Pressable, ScrollView, View } from 'react-native';
17
+ import { TapGestureHandler, TapGestureHandlerStateChangeEvent } from 'react-native-gesture-handler';
18
+
19
+
20
+ export interface EventSeat_map_newArgs {
21
+
22
+ }
23
+ export interface EventSeat_map_newProps {
24
+
25
+ }
26
+ export default function m(props: any): any {
27
+ const { dataTicket, url } = LibNavigation.getArgsAll<any>(props)
28
+ const qty = dataTicket?.qty
29
+
30
+ const deviceWidth = Dimensions.get('window').width;
31
+ const [scale, setScale] = useState(1);
32
+ const [boundingBox, setBoundingBox] = useSafeState({ "x1": 1, "x2": 2, "y1": 1, "y2": 2 })
33
+ const [data, setData, getData] = useSafeState<[number, number, string, number][]>([])
34
+ const initialBoxSize = 30;
35
+ const contentWidth = (boundingBox.x2 - (boundingBox.x1 - 1.1)) * initialBoxSize
36
+ const [, setSelectedSeat, getSelectedSeat] = useSafeState<any>([])
37
+ const [errBookedSeat, setErrBookedSeat] = useSafeState()
38
+
39
+ // Scale boxSize so that contentWidth fits deviceWidth
40
+ const scaleToFit = deviceWidth / contentWidth;
41
+ const boxSize = initialBoxSize * scaleToFit;
42
+
43
+ // Recalculate xs, ys, width, height with scaled boxSize
44
+ const xsScaled = getData()?.map(([x]) => isNaN(x) ? 0 : (boxSize) + (x * boxSize));
45
+ const ysScaled = getData()?.map(([_, y]) => isNaN(y) ? 0 : (boxSize) + (y * boxSize));
46
+
47
+ const width = Math.max(deviceWidth, xsScaled.length && xsScaled.every(v => !isNaN(v)) ? Math.max(...xsScaled) + boxSize : boxSize * 2);
48
+ const height = ysScaled.length && ysScaled.every(v => !isNaN(v)) ? Math.max(...ysScaled) + boxSize : boxSize * 2;
49
+
50
+
51
+ // Preload all possible fonts at top level (to avoid render hook errors)
52
+ const fontSizes = [boxSize * 0.35, boxSize * 0.30, boxSize * 0.27, boxSize * 0.25, boxSize * 0.20];
53
+ const fonts = fontSizes.map(size => useFont(esp.assets('fonts/MonoSpace.ttf'), size));
54
+
55
+ const getFontByLength = (length: number) => {
56
+ if (length <= 2) return fonts[0];
57
+ if (length == 3) return fonts[1];
58
+ if (length == 4) return fonts[2];
59
+ if (length == 5) return fonts[3];
60
+ return fonts[4];
61
+ };
62
+
63
+ const getFontSizeByLength = (length: number) => {
64
+ if (length <= 2) return fontSizes[0];
65
+ if (length == 3) return fontSizes[1];
66
+ if (length == 4) return fontSizes[2];
67
+ if (length == 5) return fontSizes[3];
68
+ return fontSizes[4];
69
+ };
70
+
71
+
72
+ // const size: any = {
73
+ // 1: useFont(esp.assets('fonts/MonoSpace.ttf'), boxSize * 0.3),
74
+ // 2: useFont(esp.assets('fonts/MonoSpace.ttf'), boxSize * 0.3),
75
+ // 3: useFont(esp.assets('fonts/MonoSpace.ttf'), boxSize * 0.25),
76
+ // 4: useFont(esp.assets('fonts/MonoSpace.ttf'), boxSize * 0.27),
77
+ // 5: useFont(esp.assets('fonts/MonoSpace.ttf'), boxSize * 0.25),
78
+ // 6: useFont(esp.assets('fonts/MonoSpace.ttf'), boxSize * 0.15),
79
+ // }
80
+
81
+ const handleTap = useCallback((event: TapGestureHandlerStateChangeEvent) => {
82
+ if (event.nativeEvent.state !== 5) return;
83
+ // Adjust tap coordinates for scale
84
+ const x = event.nativeEvent.x / scale;
85
+ const y = event.nativeEvent.y / scale;
86
+ for (let i = 0; i < getData()?.length; i++) {
87
+ const [sx, sy, seatName, status] = getData()?.[i];
88
+ const xSize = (boxSize / 2) + (sx * boxSize);
89
+ const ySize = (boxSize / 2) + (sy * boxSize);
90
+
91
+ if (x >= xSize && x <= xSize + boxSize && y >= ySize && y <= ySize + boxSize) {
92
+ if (status == 0) {
93
+ setSelectedSeat((prev: any) => {
94
+ if (!prev?.includes(seatName)) {
95
+ if (prev?.length < qty) {
96
+ return [...prev, seatName];
97
+ }
98
+ LibToastProperty.show(esp.lang("event/seat_map", "max_seat", qty))
99
+ return prev;
100
+ }
101
+ return prev.filter((s: string) => s != seatName);
102
+ });
103
+ }
104
+ return;
105
+ }
106
+
107
+ }
108
+ }, [data, boxSize, scale]);
109
+
110
+ useEffect(() => {
111
+ loadDataSeatmapBooked()
112
+ return () => LibNavigation.cancelBackResult(LibNavigation.getResultKey(props))
113
+ }, [])
114
+
115
+ function updateIndexByRes(data: any, res: any) {
116
+ const resArr = res.split(",").map((item: any) => item.trim()); // biar aman dari spasi
117
+ return data.map((row: any) => {
118
+ if (resArr.includes(row[2])) {
119
+ return [row[0], row[1], row[2], 3];
120
+ }
121
+ return row;
122
+ });
123
+ }
124
+
125
+ function loadDataSeatmap(seatBooked: any) {
126
+ new LibCurl("v3/event_seat", {
127
+ event_id: dataTicket?.event_id,
128
+ price_id: dataTicket?.selected_ticket?.price_id,
129
+ ondate: dataTicket?.ondate || dataTicket?.selected_ticket?.list?.ondate
130
+ }, (res, msg) => {
131
+ // esp.log(res);
132
+ setBoundingBox(res.metadata.bounding_box)
133
+ let x = res.layout.split(';').map((item: any) => item.split(',')).map(([x, y, seatName, status]: any) => [Number(x), Number(y), seatName, Number(status)])
134
+ let updated = updateIndexByRes(x, seatBooked)
135
+ setData(updated)
136
+ })
137
+ }
138
+
139
+ function loadDataSeatmapBooked() {
140
+ new LibCurl("v3/event_seat_booked", {
141
+ event_id: dataTicket?.event_id,
142
+ price_id: dataTicket?.selected_ticket?.price_id,
143
+ ondate: dataTicket?.ondate || dataTicket?.selected_ticket?.list?.ondate
144
+ }, (res, msg) => {
145
+ loadDataSeatmap(res)
146
+ setErrBookedSeat(undefined)
147
+ }, (err) => {
148
+ setErrBookedSeat(err?.message)
149
+ })
150
+ }
151
+
152
+ if (errBookedSeat) {
153
+ return (
154
+ <View style={{ flex: 1, backgroundColor: LibStyle.colorBgGrey }}>
155
+ <EventHeader title={esp.lang("event/seat_map", "header_title")} />
156
+ <View style={{ flex: 1 }}>
157
+ <EventMessage
158
+ message={errBookedSeat}
159
+ children={
160
+ <EventButton
161
+ label='Coba lagi'
162
+ style={{ marginHorizontal: 15 }}
163
+ onPress={() => {
164
+ loadDataSeatmapBooked()
165
+ }}
166
+ />
167
+ }
168
+ />
169
+ </View>
170
+ </View>
171
+ )
172
+ }
173
+
174
+ return (
175
+ <View key={scale} style={{ flex: 1, backgroundColor: LibStyle.colorBgGrey }} >
176
+ <EventHeader title={esp.lang("event/seat_map", "header_title")} />
177
+ <View style={{ flex: 1 }}>
178
+ <View style={{ marginBottom: 5, }}>
179
+ <ScrollView style={{ padding: 10, paddingLeft: 0, }} horizontal>
180
+ <UseMap
181
+ data={getLegends()}
182
+ renderItem={(item) => (
183
+ <View style={{ flexDirection: 'row', alignItems: 'center', marginLeft: 15, marginRight: 5 }} >
184
+ <View style={{ height: 20, width: 20, borderRadius: 2, borderWidth: 0.5, backgroundColor: item[0], marginRight: 8 }} />
185
+ <LibTextstyle textStyle='caption1' text={item[1]} />
186
+ </View>
187
+ )}
188
+ />
189
+ </ScrollView>
190
+ </View>
191
+ <ScrollView horizontal >
192
+ <ScrollView >
193
+ <TapGestureHandler onHandlerStateChange={handleTap}>
194
+ <View>
195
+ <Canvas
196
+ style={{
197
+ width: width * scale,
198
+ height: height * scale,
199
+ padding: 10,
200
+ backgroundColor: LibStyle.colorBgGrey,
201
+
202
+ }}>
203
+ {
204
+ getData()?.map(([x, y, name, status], i) => {
205
+ let newName = name?.replace(/^.*#/, "")
206
+ const isSelected = getSelectedSeat()?.includes(name)
207
+ const color = isSelected ? "#8EF67B" : getColorByStatus(status)
208
+ const xSize = (boxSize / 2) + (x * boxSize)
209
+ const ySize = (boxSize / 2) + (y * boxSize)
210
+
211
+ const fontSize = getFontSizeByLength(newName?.length);
212
+ const font = getFontByLength(newName?.length);
213
+
214
+ const textWidthApprox = fontSize * newName?.length * 0.6;
215
+ const textX = xSize + (boxSize - textWidthApprox) / 2;
216
+
217
+ return (
218
+ <Group key={i}>
219
+ <RoundedRect
220
+ x={xSize - 1}
221
+ r={(boxSize + 2) * 0.1}
222
+ y={ySize - 1}
223
+ width={boxSize + 2}
224
+ transform={[{ scale }]}
225
+ height={boxSize + 2}
226
+ color={"#999"} />
227
+ <RoundedRect
228
+ x={xSize}
229
+ r={boxSize * 0.1}
230
+ y={ySize}
231
+ width={boxSize}
232
+ transform={[{ scale }]}
233
+ height={boxSize}
234
+ color={color} />
235
+ {name && font && (
236
+ <Text
237
+ x={textX}
238
+ y={(ySize) + boxSize * 0.60}
239
+ color={"#020202"}
240
+ text={newName}
241
+ transform={[{ scale }]}
242
+ font={font} />
243
+ )}
244
+ </Group>
245
+ )
246
+ })
247
+ }
248
+ </Canvas>
249
+ </View>
250
+ </TapGestureHandler>
251
+ </ScrollView>
252
+ </ScrollView>
253
+ <View style={{ flexDirection: 'row', marginHorizontal: 12, height: 40, borderColor: '#060606', borderWidth: 1, borderRadius: 5, alignItems: 'center' }} >
254
+ <Pressable onPress={() => setScale((x) => x - 0.3)} style={{ height: 40, width: 40, alignItems: 'center', justifyContent: 'center' }} >
255
+ <LibIcon.SimpleLineIcons name='magnifier-remove' />
256
+ </Pressable>
257
+ <Pressable onPress={() => setScale((x) => x + 0.3)} style={{ height: 40, width: 40, alignItems: 'center', justifyContent: 'center' }} >
258
+ <LibIcon.SimpleLineIcons name='magnifier-add' />
259
+ </Pressable>
260
+ <View style={{ height: 40, width: 1, backgroundColor: '#060606', marginRight: 12 }} />
261
+ {/* <Text style={{}} >{esp.lang("event/seat_map", "selected", String(data.filter((x) => x == -1).length), qty)}</Text> */}
262
+ <LibTextstyle textStyle='callout'>{esp.lang("event/seat_map", "selected", String(getSelectedSeat().length), qty)}</LibTextstyle>
263
+ </View>
264
+ <EventButton
265
+ backgroundColor={getSelectedSeat()?.length < qty ? "#999" : LibStyle.colorPrimary}
266
+ testID={"save_btn"}
267
+ style={{ margin: 7 }}
268
+ label={esp.lang("event/seat_map", "save")}
269
+ onPress={() => {
270
+ let value = {
271
+ seat_label: getSelectedSeat()
272
+ }
273
+ esp.log({ value });
274
+ // return
275
+ if (getSelectedSeat()?.length < qty) {
276
+ LibToastProperty.show(esp.lang("event/seat_map", "seat_more", (qty - (getSelectedSeat()?.length)).toString()))
277
+ } else {
278
+ LibNavigation.sendBackResult(value, LibNavigation.getResultKey(props))
279
+ }
280
+ }}
281
+ />
282
+ </View>
283
+ </View>
284
+ )
285
+ }
286
+
287
+ function getLegends() {
288
+ const colors: any = [
289
+ ["#fff", esp.lang("event/seat_map", "available"), 0],
290
+ ["#8EF67B", esp.lang("event/seat_map", "chosen"), "-1"],
291
+ ["#2EBBE8", esp.lang("event/seat_map", "reserved"), 3],
292
+ ["#6C432C", esp.lang("event/seat_map", "chosen_by"), 7],
293
+ ["#f1f2f3", esp.lang("event/seat_map", "way"), 5],
294
+ ["#9FA1A4", esp.lang("event/seat_map", "not_sold"), 1],
295
+ ["#6B71E6", esp.lang("event/seat_map", "seat_hold"), 2],
296
+ ["#FF4866", esp.lang("event/seat_map", "wall"), 6],
297
+ ["#FFA601", esp.lang("event/seat_map", "other_type"), 4],
298
+ ["purple", esp.lang("event/seat_map", "stage"), 8]
299
+ ]
300
+ return colors
301
+ }
302
+
303
+ function getColorByStatus(statuses: number) {
304
+ const colors: any = {
305
+ 8: 'purple',
306
+ 0: '#fff',
307
+ 1: "#9FA1A4",
308
+ 2: "#6B71E6",
309
+ 3: "#2EBBE8",
310
+ 4: "#FFA601",
311
+ 5: "#fff",
312
+ 6: "#FF4866",
313
+ 7: "#6C432C"
314
+ }
315
+ return colors[statuses]
316
+ }
@@ -0,0 +1,34 @@
1
+ // // useLibs
2
+
3
+ // import { UserClass } from 'esoftplay/cache/user/class/import';
4
+ // import { useEffect } from 'react';
5
+ // import { CaptureProtection } from 'react-native-capture-protection';
6
+
7
+
8
+ // export interface EventSecure_pageProps {
9
+
10
+ // }
11
+ // export default function m(): any {
12
+ // const can_screencapture = UserClass.state().get('config', 'can_screencapture')
13
+ // // const focus = useIsFocused()
14
+
15
+ // useEffect(() => {
16
+ // let subs: any
17
+ // if (!__DEV__)
18
+ // if (can_screencapture != 1) {
19
+ // CaptureProtection.prevent();
20
+ // // subs = RNPrevent?.addListener?.(() => { })
21
+ // }
22
+ // return () => {
23
+ // if (!__DEV__)
24
+ // if (can_screencapture != 1) {
25
+ // setTimeout(() => {
26
+ // CaptureProtection.allow();
27
+ // }, 500);
28
+ // // subs?.remove?.()
29
+ // }
30
+ // }
31
+ // }, [])
32
+
33
+ // return null
34
+ // }
@@ -0,0 +1,35 @@
1
+ // // useLibs
2
+
3
+ // import { UserClass } from 'esoftplay/cache/user/class/import';
4
+ // import { useEffect } from 'react';
5
+ // import RNPrevent from "react-native-screenshot-prevent";
6
+
7
+ // export interface EventSecure_pageProps {
8
+
9
+ // }
10
+ // export default function m(): any {
11
+ // const can_screencapture = UserClass.state().get('config', 'can_screencapture')
12
+ // // const focus = useIsFocused()
13
+
14
+ // useEffect(() => {
15
+ // let subs: any
16
+ // if (!__DEV__)
17
+ // if (can_screencapture != 1) {
18
+ // RNPrevent?.enabled?.(true)
19
+ // RNPrevent?.enableSecureView?.()
20
+ // // subs = RNPrevent?.addListener?.(() => { })
21
+ // }
22
+ // return () => {
23
+ // if (!__DEV__)
24
+ // if (can_screencapture != 1) {
25
+ // setTimeout(() => {
26
+ // RNPrevent?.disableSecureView?.()
27
+ // RNPrevent?.enabled?.(false)
28
+ // }, 500)
29
+ // // subs?.remove?.()
30
+ // }
31
+ // }
32
+ // }, [])
33
+
34
+ // return null
35
+ // }
@@ -2,7 +2,8 @@
2
2
 
3
3
  import { UserClass } from 'esoftplay/cache/user/class/import';
4
4
  import { useEffect } from 'react';
5
- import RNPrevent from "react-native-screenshot-prevent";
5
+ import { CaptureProtection } from 'react-native-capture-protection';
6
+
6
7
 
7
8
  export interface EventSecure_pageProps {
8
9
 
@@ -15,15 +16,15 @@ export default function m(): any {
15
16
  let subs: any
16
17
  if (!__DEV__)
17
18
  if (can_screencapture != 1) {
18
- RNPrevent?.enabled?.(true)
19
- RNPrevent?.enableSecureView?.()
19
+ CaptureProtection.prevent();
20
20
  // subs = RNPrevent?.addListener?.(() => { })
21
21
  }
22
22
  return () => {
23
23
  if (!__DEV__)
24
24
  if (can_screencapture != 1) {
25
- RNPrevent?.disableSecureView?.()
26
- RNPrevent?.enabled?.(false)
25
+ setTimeout(() => {
26
+ CaptureProtection.allow();
27
+ }, 500);
27
28
  // subs?.remove?.()
28
29
  }
29
30
  }