@eventlook/sdk 1.4.24 → 1.4.28
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.
|
@@ -10,11 +10,14 @@ var reactHookForm = require('react-hook-form');
|
|
|
10
10
|
|
|
11
11
|
const TicketSelectionMap = ({ event }) => {
|
|
12
12
|
const { t, seatingIframeUrl } = useGlobal.default();
|
|
13
|
-
const { setValue } = reactHookForm.useFormContext();
|
|
13
|
+
const { setValue, watch } = reactHookForm.useFormContext();
|
|
14
|
+
const uuid = watch('uuid');
|
|
15
|
+
if (!uuid)
|
|
16
|
+
return;
|
|
14
17
|
const onSelect = (seats) => {
|
|
15
18
|
const tickets = [];
|
|
16
19
|
const groupedSeatsByZone = seats.reduce((tickets, seat) => {
|
|
17
|
-
const zoneIndex = tickets.findIndex((ticket) => ticket.seat.
|
|
20
|
+
const zoneIndex = tickets.findIndex((ticket) => ticket.seat.id === seat.locationId);
|
|
18
21
|
if (zoneIndex !== -1) {
|
|
19
22
|
tickets[zoneIndex].quantity += 1;
|
|
20
23
|
}
|
|
@@ -43,7 +46,7 @@ const TicketSelectionMap = ({ event }) => {
|
|
|
43
46
|
extraFields: [],
|
|
44
47
|
location: {
|
|
45
48
|
id: groupedSeat.seat.id,
|
|
46
|
-
type:
|
|
49
|
+
type: groupedSeat.seat.type,
|
|
47
50
|
locationDescription: groupedSeat.seat.locationDescription,
|
|
48
51
|
},
|
|
49
52
|
});
|
|
@@ -56,6 +59,7 @@ const TicketSelectionMap = ({ event }) => {
|
|
|
56
59
|
eventId: String(event.id),
|
|
57
60
|
onSelect,
|
|
58
61
|
baseUrl: seatingIframeUrl,
|
|
62
|
+
clientId: uuid,
|
|
59
63
|
}) }, t('form.labels.open_map')));
|
|
60
64
|
};
|
|
61
65
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TicketSelectionMap.js","sources":["../../../src/form/TicketSelectionMap.tsx"],"sourcesContent":["import React from 'react';\nimport useGlobal from '@hooks/useGlobal.ts';\nimport { IEvent } from '@utils/types/event.type.ts';\nimport { Button } from '@mui/material';\nimport { iframe, TicketSelection } from '@seat-picker/seat-picker-sdk';\nimport { useFormContext } from 'react-hook-form';\nimport { ITicketForm, ITicketFormTicket, ITicketLocation } from '@utils/types/ticket.type.ts';\n\ninterface Props {\n event: IEvent;\n}\n\nconst TicketSelectionMap: React.FC<Props> = ({ event }) => {\n const { t, seatingIframeUrl } = useGlobal();\n const { setValue } = useFormContext<ITicketForm>();\n\n const onSelect = (seats: TicketSelection) => {\n const tickets: ITicketFormTicket[] = [];\n const groupedSeatsByZone = seats.reduce(\n (tickets, seat) => {\n const zoneIndex = tickets.findIndex((ticket) => ticket.seat.
|
|
1
|
+
{"version":3,"file":"TicketSelectionMap.js","sources":["../../../src/form/TicketSelectionMap.tsx"],"sourcesContent":["import React from 'react';\nimport useGlobal from '@hooks/useGlobal.ts';\nimport { IEvent } from '@utils/types/event.type.ts';\nimport { Button } from '@mui/material';\nimport { iframe, TicketSelection } from '@seat-picker/seat-picker-sdk';\nimport { useFormContext } from 'react-hook-form';\nimport { ITicketForm, ITicketFormTicket, ITicketLocation } from '@utils/types/ticket.type.ts';\n\ninterface Props {\n event: IEvent;\n}\n\nconst TicketSelectionMap: React.FC<Props> = ({ event }) => {\n const { t, seatingIframeUrl } = useGlobal();\n const { setValue, watch } = useFormContext<ITicketForm>();\n const uuid = watch('uuid');\n\n if (!uuid) return;\n\n const onSelect = (seats: TicketSelection) => {\n const tickets: ITicketFormTicket[] = [];\n const groupedSeatsByZone = seats.reduce(\n (tickets, seat) => {\n const zoneIndex = tickets.findIndex((ticket) => ticket.seat.id === seat.locationId);\n if (zoneIndex !== -1) {\n tickets[zoneIndex].quantity += 1;\n } else {\n tickets.push({\n seat: {\n id: seat.locationId,\n type: seat.locationType,\n locationDescription: seat.locationTypeDescription,\n },\n quantity: 1,\n ticket: seat.ticket,\n });\n }\n\n return tickets;\n },\n // TODO: fix types\n [] as { quantity: number; seat: ITicketLocation; ticket: any }[]\n );\n\n for (const groupedSeat of groupedSeatsByZone) {\n tickets.push({\n releaseId: groupedSeat.ticket.id,\n price: groupedSeat.ticket.price,\n quantity: groupedSeat.quantity,\n itemName: `${groupedSeat.ticket.releaseCategoryName} - ${groupedSeat.ticket.name}`,\n products: [],\n extraFields: [],\n location: {\n id: groupedSeat.seat.id,\n type: groupedSeat.seat.type,\n locationDescription: groupedSeat.seat.locationDescription,\n },\n });\n }\n\n setValue(`tickets.${event.id}`, tickets);\n };\n\n if (!seatingIframeUrl) return null;\n\n return (\n <Button\n variant=\"contained\"\n onClick={() =>\n iframe.openPicker({\n eventId: String(event.id),\n onSelect,\n baseUrl: seatingIframeUrl,\n clientId: uuid,\n })\n }\n >\n {t('form.labels.open_map')}\n </Button>\n );\n};\n\nexport default TicketSelectionMap;\n"],"names":["useGlobal","useFormContext","Button","iframe"],"mappings":";;;;;;;;;;AAYA,MAAM,kBAAkB,GAAoB,CAAC,EAAE,KAAK,EAAE,KAAI;IACxD,MAAM,EAAE,CAAC,EAAE,gBAAgB,EAAE,GAAGA,iBAAS,EAAE;IAC3C,MAAM,EAAE,QAAQ,EAAE,KAAK,EAAE,GAAGC,4BAAc,EAAe;AACzD,IAAA,MAAM,IAAI,GAAG,KAAK,CAAC,MAAM,CAAC;AAE1B,IAAA,IAAI,CAAC,IAAI;QAAE;AAEX,IAAA,MAAM,QAAQ,GAAG,CAAC,KAAsB,KAAI;QAC1C,MAAM,OAAO,GAAwB,EAAE;QACvC,MAAM,kBAAkB,GAAG,KAAK,CAAC,MAAM,CACrC,CAAC,OAAO,EAAE,IAAI,KAAI;YAChB,MAAM,SAAS,GAAG,OAAO,CAAC,SAAS,CAAC,CAAC,MAAM,KAAK,MAAM,CAAC,IAAI,CAAC,EAAE,KAAK,IAAI,CAAC,UAAU,CAAC;AACnF,YAAA,IAAI,SAAS,KAAK,EAAE,EAAE;AACpB,gBAAA,OAAO,CAAC,SAAS,CAAC,CAAC,QAAQ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OAAO,EAAE,MACPC,oBAAM,CAAC,UAAU,CAAC;AAChB,YAAA,OAAO,EAAE,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC;YACzB,QAAQ;AACR,YAAA,OAAO,EAAE,gBAAgB;AACzB,YAAA,QAAQ,EAAE,IAAI;AACf,SAAA,CAAC,IAGH,CAAC,CAAC,sBAAsB,CAAC,CACnB;AAEb;;;;"}
|
|
@@ -6,11 +6,14 @@ import { useFormContext } from 'react-hook-form';
|
|
|
6
6
|
|
|
7
7
|
const TicketSelectionMap = ({ event }) => {
|
|
8
8
|
const { t, seatingIframeUrl } = useGlobal();
|
|
9
|
-
const { setValue } = useFormContext();
|
|
9
|
+
const { setValue, watch } = useFormContext();
|
|
10
|
+
const uuid = watch('uuid');
|
|
11
|
+
if (!uuid)
|
|
12
|
+
return;
|
|
10
13
|
const onSelect = (seats) => {
|
|
11
14
|
const tickets = [];
|
|
12
15
|
const groupedSeatsByZone = seats.reduce((tickets, seat) => {
|
|
13
|
-
const zoneIndex = tickets.findIndex((ticket) => ticket.seat.
|
|
16
|
+
const zoneIndex = tickets.findIndex((ticket) => ticket.seat.id === seat.locationId);
|
|
14
17
|
if (zoneIndex !== -1) {
|
|
15
18
|
tickets[zoneIndex].quantity += 1;
|
|
16
19
|
}
|
|
@@ -39,7 +42,7 @@ const TicketSelectionMap = ({ event }) => {
|
|
|
39
42
|
extraFields: [],
|
|
40
43
|
location: {
|
|
41
44
|
id: groupedSeat.seat.id,
|
|
42
|
-
type:
|
|
45
|
+
type: groupedSeat.seat.type,
|
|
43
46
|
locationDescription: groupedSeat.seat.locationDescription,
|
|
44
47
|
},
|
|
45
48
|
});
|
|
@@ -52,6 +55,7 @@ const TicketSelectionMap = ({ event }) => {
|
|
|
52
55
|
eventId: String(event.id),
|
|
53
56
|
onSelect,
|
|
54
57
|
baseUrl: seatingIframeUrl,
|
|
58
|
+
clientId: uuid,
|
|
55
59
|
}) }, t('form.labels.open_map')));
|
|
56
60
|
};
|
|
57
61
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TicketSelectionMap.js","sources":["../../../src/form/TicketSelectionMap.tsx"],"sourcesContent":["import React from 'react';\nimport useGlobal from '@hooks/useGlobal.ts';\nimport { IEvent } from '@utils/types/event.type.ts';\nimport { Button } from '@mui/material';\nimport { iframe, TicketSelection } from '@seat-picker/seat-picker-sdk';\nimport { useFormContext } from 'react-hook-form';\nimport { ITicketForm, ITicketFormTicket, ITicketLocation } from '@utils/types/ticket.type.ts';\n\ninterface Props {\n event: IEvent;\n}\n\nconst TicketSelectionMap: React.FC<Props> = ({ event }) => {\n const { t, seatingIframeUrl } = useGlobal();\n const { setValue } = useFormContext<ITicketForm>();\n\n const onSelect = (seats: TicketSelection) => {\n const tickets: ITicketFormTicket[] = [];\n const groupedSeatsByZone = seats.reduce(\n (tickets, seat) => {\n const zoneIndex = tickets.findIndex((ticket) => ticket.seat.
|
|
1
|
+
{"version":3,"file":"TicketSelectionMap.js","sources":["../../../src/form/TicketSelectionMap.tsx"],"sourcesContent":["import React from 'react';\nimport useGlobal from '@hooks/useGlobal.ts';\nimport { IEvent } from '@utils/types/event.type.ts';\nimport { Button } from '@mui/material';\nimport { iframe, TicketSelection } from '@seat-picker/seat-picker-sdk';\nimport { useFormContext } from 'react-hook-form';\nimport { ITicketForm, ITicketFormTicket, ITicketLocation } from '@utils/types/ticket.type.ts';\n\ninterface Props {\n event: IEvent;\n}\n\nconst TicketSelectionMap: React.FC<Props> = ({ event }) => {\n const { t, seatingIframeUrl } = useGlobal();\n const { setValue, watch } = useFormContext<ITicketForm>();\n const uuid = watch('uuid');\n\n if (!uuid) return;\n\n const onSelect = (seats: TicketSelection) => {\n const tickets: ITicketFormTicket[] = [];\n const groupedSeatsByZone = seats.reduce(\n (tickets, seat) => {\n const zoneIndex = tickets.findIndex((ticket) => ticket.seat.id === seat.locationId);\n if (zoneIndex !== -1) {\n tickets[zoneIndex].quantity += 1;\n } else {\n tickets.push({\n seat: {\n id: seat.locationId,\n type: seat.locationType,\n locationDescription: seat.locationTypeDescription,\n },\n quantity: 1,\n ticket: seat.ticket,\n });\n }\n\n return tickets;\n },\n // TODO: fix types\n [] as { quantity: number; seat: ITicketLocation; ticket: any }[]\n );\n\n for (const groupedSeat of groupedSeatsByZone) {\n tickets.push({\n releaseId: groupedSeat.ticket.id,\n price: groupedSeat.ticket.price,\n quantity: groupedSeat.quantity,\n itemName: `${groupedSeat.ticket.releaseCategoryName} - ${groupedSeat.ticket.name}`,\n products: [],\n extraFields: [],\n location: {\n id: groupedSeat.seat.id,\n type: groupedSeat.seat.type,\n locationDescription: groupedSeat.seat.locationDescription,\n },\n });\n }\n\n setValue(`tickets.${event.id}`, tickets);\n };\n\n if (!seatingIframeUrl) return null;\n\n return (\n <Button\n variant=\"contained\"\n onClick={() =>\n iframe.openPicker({\n eventId: String(event.id),\n onSelect,\n baseUrl: seatingIframeUrl,\n clientId: uuid,\n })\n }\n >\n {t('form.labels.open_map')}\n </Button>\n );\n};\n\nexport default TicketSelectionMap;\n"],"names":[],"mappings":";;;;;;AAYA,MAAM,kBAAkB,GAAoB,CAAC,EAAE,KAAK,EAAE,KAAI;IACxD,MAAM,EAAE,CAAC,EAAE,gBAAgB,EAAE,GAAG,SAAS,EAAE;IAC3C,MAAM,EAAE,QAAQ,EAAE,KAAK,EAAE,GAAG,cAAc,EAAe;AACzD,IAAA,MAAM,IAAI,GAAG,KAAK,CAAC,MAAM,CAAC;AAE1B,IAAA,IAAI,CAAC,IAAI;QAAE;AAEX,IAAA,MAAM,QAAQ,GAAG,CAAC,KAAsB,KAAI;QAC1C,MAAM,OAAO,GAAwB,EAAE;QACvC,MAAM,kBAAkB,GAAG,KAAK,CAAC,MAAM,CACrC,CAAC,OAAO,EAAE,IAAI,KAAI;YAChB,MAAM,SAAS,GAAG,OAAO,CAAC,SAAS,CAAC,CAAC,MAAM,KAAK,MAAM,CAAC,IAAI,CAAC,EAAE,KAAK,IAAI,CAAC,UAAU,CAAC;AAC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IAAI;AAElC,IAAA,QACE,KAAA,CAAA,aAAA,CAAC,MAAM,EAAA,EACL,OAAO,EAAC,WAAW,EACnB,OAAO,EAAE,MACP,MAAM,CAAC,UAAU,CAAC;AAChB,YAAA,OAAO,EAAE,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC;YACzB,QAAQ;AACR,YAAA,OAAO,EAAE,gBAAgB;AACzB,YAAA,QAAQ,EAAE,IAAI;AACf,SAAA,CAAC,IAGH,CAAC,CAAC,sBAAsB,CAAC,CACnB;AAEb;;;;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eventlook/sdk",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.28",
|
|
4
4
|
"main": "dist/cjs/index.js",
|
|
5
5
|
"module": "dist/esm/index.js",
|
|
6
6
|
"types": "dist/types/index.d.ts",
|
|
@@ -65,7 +65,7 @@
|
|
|
65
65
|
"@rollup/plugin-node-resolve": "^15.0.0",
|
|
66
66
|
"@rollup/plugin-replace": "^6.0.2",
|
|
67
67
|
"@rollup/plugin-typescript": "^11.0.0",
|
|
68
|
-
"@seat-picker/seat-picker-sdk": "^1.0
|
|
68
|
+
"@seat-picker/seat-picker-sdk": "^1.1.0",
|
|
69
69
|
"@types/js-cookie": "^3.0.6",
|
|
70
70
|
"@types/lodash": "^4.17.20",
|
|
71
71
|
"@types/numeral": "^2.0.5",
|
|
@@ -12,13 +12,16 @@ interface Props {
|
|
|
12
12
|
|
|
13
13
|
const TicketSelectionMap: React.FC<Props> = ({ event }) => {
|
|
14
14
|
const { t, seatingIframeUrl } = useGlobal();
|
|
15
|
-
const { setValue } = useFormContext<ITicketForm>();
|
|
15
|
+
const { setValue, watch } = useFormContext<ITicketForm>();
|
|
16
|
+
const uuid = watch('uuid');
|
|
17
|
+
|
|
18
|
+
if (!uuid) return;
|
|
16
19
|
|
|
17
20
|
const onSelect = (seats: TicketSelection) => {
|
|
18
21
|
const tickets: ITicketFormTicket[] = [];
|
|
19
22
|
const groupedSeatsByZone = seats.reduce(
|
|
20
23
|
(tickets, seat) => {
|
|
21
|
-
const zoneIndex = tickets.findIndex((ticket) => ticket.seat.
|
|
24
|
+
const zoneIndex = tickets.findIndex((ticket) => ticket.seat.id === seat.locationId);
|
|
22
25
|
if (zoneIndex !== -1) {
|
|
23
26
|
tickets[zoneIndex].quantity += 1;
|
|
24
27
|
} else {
|
|
@@ -49,7 +52,7 @@ const TicketSelectionMap: React.FC<Props> = ({ event }) => {
|
|
|
49
52
|
extraFields: [],
|
|
50
53
|
location: {
|
|
51
54
|
id: groupedSeat.seat.id,
|
|
52
|
-
type:
|
|
55
|
+
type: groupedSeat.seat.type,
|
|
53
56
|
locationDescription: groupedSeat.seat.locationDescription,
|
|
54
57
|
},
|
|
55
58
|
});
|
|
@@ -68,6 +71,7 @@ const TicketSelectionMap: React.FC<Props> = ({ event }) => {
|
|
|
68
71
|
eventId: String(event.id),
|
|
69
72
|
onSelect,
|
|
70
73
|
baseUrl: seatingIframeUrl,
|
|
74
|
+
clientId: uuid,
|
|
71
75
|
})
|
|
72
76
|
}
|
|
73
77
|
>
|