@eventlook/sdk 1.4.24 → 1.4.38

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 (85) hide show
  1. package/.env +1 -0
  2. package/dist/cjs/context/GlobalContext.js +1 -2
  3. package/dist/cjs/context/GlobalContext.js.map +1 -1
  4. package/dist/cjs/form/PaymentOverviewBox.js +31 -1
  5. package/dist/cjs/form/PaymentOverviewBox.js.map +1 -1
  6. package/dist/cjs/form/TicketForm.js +9 -5
  7. package/dist/cjs/form/TicketForm.js.map +1 -1
  8. package/dist/cjs/form/TicketSelection.js.map +1 -1
  9. package/dist/cjs/form/index.js +2 -2
  10. package/dist/cjs/form/index.js.map +1 -1
  11. package/dist/cjs/form/payment/PaymentOverviewCheckbox.js +48 -0
  12. package/dist/cjs/form/payment/PaymentOverviewCheckbox.js.map +1 -0
  13. package/dist/cjs/locales/cs.js +19 -1
  14. package/dist/cjs/locales/cs.js.map +1 -1
  15. package/dist/cjs/locales/en.js +12 -1
  16. package/dist/cjs/locales/en.js.map +1 -1
  17. package/dist/cjs/locales/es.js +12 -1
  18. package/dist/cjs/locales/es.js.map +1 -1
  19. package/dist/cjs/locales/pl.js +12 -1
  20. package/dist/cjs/locales/pl.js.map +1 -1
  21. package/dist/cjs/locales/sk.js +12 -1
  22. package/dist/cjs/locales/sk.js.map +1 -1
  23. package/dist/cjs/locales/uk.js +12 -1
  24. package/dist/cjs/locales/uk.js.map +1 -1
  25. package/dist/esm/context/GlobalContext.js +1 -2
  26. package/dist/esm/context/GlobalContext.js.map +1 -1
  27. package/dist/esm/form/PaymentOverviewBox.js +31 -1
  28. package/dist/esm/form/PaymentOverviewBox.js.map +1 -1
  29. package/dist/esm/form/TicketForm.js +9 -5
  30. package/dist/esm/form/TicketForm.js.map +1 -1
  31. package/dist/esm/form/TicketSelection.js.map +1 -1
  32. package/dist/esm/form/index.js +2 -2
  33. package/dist/esm/form/index.js.map +1 -1
  34. package/dist/esm/form/payment/PaymentOverviewCheckbox.js +44 -0
  35. package/dist/esm/form/payment/PaymentOverviewCheckbox.js.map +1 -0
  36. package/dist/esm/locales/cs.js +19 -1
  37. package/dist/esm/locales/cs.js.map +1 -1
  38. package/dist/esm/locales/en.js +12 -1
  39. package/dist/esm/locales/en.js.map +1 -1
  40. package/dist/esm/locales/es.js +12 -1
  41. package/dist/esm/locales/es.js.map +1 -1
  42. package/dist/esm/locales/pl.js +12 -1
  43. package/dist/esm/locales/pl.js.map +1 -1
  44. package/dist/esm/locales/sk.js +12 -1
  45. package/dist/esm/locales/sk.js.map +1 -1
  46. package/dist/esm/locales/uk.js +12 -1
  47. package/dist/esm/locales/uk.js.map +1 -1
  48. package/dist/types/context/GlobalContext.d.ts +1 -2
  49. package/dist/types/form/index.d.ts +0 -1
  50. package/dist/types/form/payment/PaymentOverviewCheckbox.d.ts +12 -0
  51. package/dist/types/locales/cs.d.ts +19 -1
  52. package/dist/types/locales/en.d.ts +12 -1
  53. package/dist/types/locales/es.d.ts +12 -1
  54. package/dist/types/locales/pl.d.ts +12 -1
  55. package/dist/types/locales/sk.d.ts +12 -1
  56. package/dist/types/locales/uk.d.ts +12 -1
  57. package/dist/types/utils/types/event.type.d.ts +0 -1
  58. package/dist/types/utils/types/global.type.d.ts +0 -1
  59. package/dist/types/utils/types/shopping-cart.type.d.ts +7 -0
  60. package/dist/types/utils/types/ticket.type.d.ts +8 -17
  61. package/package.json +3 -8
  62. package/rollup.config.mjs +1 -15
  63. package/src/context/GlobalContext.tsx +0 -3
  64. package/src/form/PaymentOverviewBox.tsx +83 -0
  65. package/src/form/TicketForm.tsx +9 -9
  66. package/src/form/TicketSelection.tsx +0 -1
  67. package/src/form/index.tsx +0 -3
  68. package/src/form/payment/PaymentOverviewCheckbox.tsx +87 -0
  69. package/src/locales/cs.tsx +22 -1
  70. package/src/locales/en.tsx +14 -1
  71. package/src/locales/es.tsx +14 -1
  72. package/src/locales/pl.tsx +14 -1
  73. package/src/locales/sk.tsx +14 -1
  74. package/src/locales/uk.tsx +14 -1
  75. package/src/utils/types/event.type.ts +0 -1
  76. package/src/utils/types/global.type.ts +0 -1
  77. package/src/utils/types/shopping-cart.type.ts +7 -0
  78. package/src/utils/types/ticket.type.ts +6 -20
  79. package/dev-frontend.sh +0 -32
  80. package/dist/cjs/form/TicketSelectionMap.js +0 -63
  81. package/dist/cjs/form/TicketSelectionMap.js.map +0 -1
  82. package/dist/esm/form/TicketSelectionMap.js +0 -59
  83. package/dist/esm/form/TicketSelectionMap.js.map +0 -1
  84. package/dist/types/form/TicketSelectionMap.d.ts +0 -7
  85. package/src/form/TicketSelectionMap.tsx +0 -79
@@ -15,6 +15,7 @@ const sk = {
15
15
  go_home: 'Prejsť na domovskú stránku',
16
16
  apple_wallet: 'Stiahnuť do Apple Wallet',
17
17
  google_wallet: 'Stiahnuť do Google Wallet',
18
+ more_info: 'Viac informácií',
18
19
  shipping_method: {
19
20
  types: {
20
21
  PACKETA: 'Packeta',
@@ -42,6 +43,7 @@ const sk = {
42
43
  with_fee: 'vrátane servisného poplatku',
43
44
  service_fee: 'Servisný poplatok',
44
45
  shipping_fee: 'Doručenie',
46
+ ticket_insurance: 'Poistenie vstupenky',
45
47
  price_including_service_fee: 'Cena zahŕňa servisný poplatok {{fee}}.',
46
48
  price_including_service_fee_percentage:
47
49
  'Cena zahŕňa servisný poplatok vo výške {{percentage}} z celkovej sumy.',
@@ -49,7 +51,6 @@ const sk = {
49
51
  original_price: 'Pôvodná cena',
50
52
  ticket: 'Vstupenka',
51
53
  category: 'Kategória',
52
- open_map: 'Otvoriť mapu',
53
54
  },
54
55
  validation: {
55
56
  required: 'Toto pole je povinné.',
@@ -102,6 +103,18 @@ const sk = {
102
103
  },
103
104
  terms_and_conditions:
104
105
  'Odoslaním objednávky súhlasím s <0>Obchodnými podmienkami</0> {{termsAndConditionsCompanies}} a beriem na vedomie <1>Zásady ochrany osobných údajov</1>.',
106
+ insurance: {
107
+ label: 'Poistenie vstupenky',
108
+ per_ticket: 'pc',
109
+ modal: {
110
+ title: 'Poistenie vstupenky',
111
+ description:
112
+ 'Poistenie vstupenky vám poskytuje ochranu v prípade, že sa nemôžete zúčastniť podujatia z dôvodu choroby, zranenia alebo iných nepredvídaných okolností.',
113
+ coverage:
114
+ 'Poistenie kryje: chorobu, zranenie, náhlu hospitalizáciu, karanténu alebo iné nepredvídané udalosti, ktoré vám zabránia zúčastniť sa podujatia.',
115
+ price: 'Cena poistenia',
116
+ },
117
+ },
105
118
  order_success: {
106
119
  title: 'Vstupenky boli úspešne rezervované. Teraz už len zaplatiť.',
107
120
  description:
@@ -15,6 +15,7 @@ const uk = {
15
15
  go_home: 'Перейти на головну',
16
16
  apple_wallet: 'Завантажити в Apple Wallet',
17
17
  google_wallet: 'Завантажити в Google Wallet',
18
+ more_info: 'Більше інформації',
18
19
  shipping_method: {
19
20
  types: {
20
21
  PACKETA: 'Packeta',
@@ -42,6 +43,7 @@ const uk = {
42
43
  with_fee: 'вкл. сервісний збір',
43
44
  service_fee: 'Сервісний збір',
44
45
  shipping_fee: 'Доставка',
46
+ ticket_insurance: 'Страхування квитка',
45
47
  price_including_service_fee: 'Ціна включає сервісний збір {{fee}}.',
46
48
  price_including_service_fee_percentage:
47
49
  'Ціна включає сервісний збір {{percentage}} від загальної суми.',
@@ -49,7 +51,6 @@ const uk = {
49
51
  original_price: 'Оригінальна ціна',
50
52
  ticket: 'Квиток',
51
53
  category: 'Категорія',
52
- open_map: 'Відкрити карту',
53
54
  },
54
55
  validation: {
55
56
  required: "Це поле обов'язкове.",
@@ -102,6 +103,18 @@ const uk = {
102
103
  },
103
104
  terms_and_conditions:
104
105
  'Надсилаючи замовлення, я погоджуюсь з <0>Правилами та умовами</0> {{termsAndConditionsCompanies}} та підтверджую <1>Політику конфіденційності</1>.',
106
+ insurance: {
107
+ label: 'Страхування квитка',
108
+ per_ticket: 'pc',
109
+ modal: {
110
+ title: 'Страхування квитка',
111
+ description:
112
+ 'Страхування квитка захищає вас у випадку, якщо ви не зможете відвідати подію через хворобу, травму або інші непередбачені обставини.',
113
+ coverage:
114
+ 'Страхування покриває: хворобу, травму, раптову госпіталізацію, карантин або інші непередбачені події, які перешкоджають вашій участі у заході.',
115
+ price: 'Ціна страхування',
116
+ },
117
+ },
105
118
  order_success: {
106
119
  title: 'Квитки успішно зарезервовані. Тепер залишилося оплатити.',
107
120
  description:
@@ -51,7 +51,6 @@ export interface IEvent extends IBase {
51
51
  type: EventType;
52
52
  parents: IEvent[];
53
53
  children: IEvent[];
54
- mapId: string | null;
55
54
  }
56
55
 
57
56
  export interface IEventCategory extends IBase {
@@ -14,7 +14,6 @@ export interface IGlobalContext {
14
14
  options?: IGlobalContextOptions;
15
15
  user?: IUser;
16
16
  content?: IContent;
17
- seatingIframeUrl?: string;
18
17
  }
19
18
 
20
19
  export interface IGlobalContextCallbacks {
@@ -25,6 +25,8 @@ export interface ICalculateShoppingCartDto {
25
25
  gender: string | null;
26
26
  paymentMethodOptionId: number | null;
27
27
  paymentMethodId: number | null;
28
+ ticketInsurance?: boolean;
29
+ smsNotification?: boolean;
28
30
  }
29
31
 
30
32
  export interface IShoppingCart {
@@ -60,4 +62,9 @@ export interface IShoppingCart {
60
62
  orderFeeValue: number | null;
61
63
  orderFeeType: OrderFeeType | null;
62
64
  shippingFee: number;
65
+ ticketInsurance?: boolean;
66
+ ticketInsurancePrice?: number;
67
+ ticketInsurancePricePerUnit?: number;
68
+ smsNotification?: boolean;
69
+ smsNotificationPrice?: number;
63
70
  }
@@ -33,31 +33,12 @@ export interface ITicketFormTicket {
33
33
  products: IEventProductForm[];
34
34
  extraFields: IExtraFieldForm[][];
35
35
  eventTimeslotId?: number | null;
36
- location?: ITicketLocation | null;
37
36
  }
38
37
 
39
- export interface ITicketLocation {
40
- id: string;
41
- type: LocationType;
42
- locationDescription?:
43
- | {
44
- type: BaseLocationDescriptionType | 'custom';
45
- label: string;
46
- value: string;
47
- }[]
48
- | null;
49
- }
50
-
51
- type BaseLocationDescriptionType = 'seatNumber' | 'rowNumber' | 'sectionName';
52
-
53
- type LocationType = 'seat' | 'zone';
54
-
55
- export type EventTicketsType = { [eventId: string]: ITicketFormTicket[] };
56
-
57
38
  export interface ITicketForm {
58
39
  uuid?: string | null;
59
40
  eventId: number;
60
- tickets: EventTicketsType;
41
+ tickets: { [eventId: string]: ITicketFormTicket[] };
61
42
  total: number;
62
43
  originalPrice: number;
63
44
  firstName: string;
@@ -70,6 +51,11 @@ export interface ITicketForm {
70
51
  paymentMethodId: number | null;
71
52
  paymentMethodOptionId: number | null;
72
53
  termsAndConditions: boolean;
54
+ ticketInsurance: boolean;
55
+ ticketInsurancePrice: number;
56
+ ticketInsurancePricePerUnit: number;
57
+ smsNotification: boolean;
58
+ smsNotificationPrice: number;
73
59
  iframeCampaignId?: number;
74
60
  promoCode: IPromoCode | null;
75
61
  products: { [eventId: string]: IEventProductForm[] };
package/dev-frontend.sh DELETED
@@ -1,32 +0,0 @@
1
- #!/bin/bash
2
-
3
- set -e
4
-
5
- FRONTEND_DIR="../frontend"
6
-
7
- echo "linking sdk to frontend for local development..."
8
- echo ""
9
-
10
- SDK_DIR="$(cd "$(dirname "$0")" && pwd)"
11
-
12
- if [ ! -d "$SDK_DIR/dist" ] || [ -z "$(ls -A $SDK_DIR/dist 2>/dev/null)" ]; then
13
- echo "building sdk first (dist/ directory not found)..."
14
- cd "$SDK_DIR"
15
- yarn build
16
- fi
17
-
18
- echo "pushing sdk to yalc..."
19
- cd "$SDK_DIR"
20
- yalc push --force
21
-
22
- cd "$FRONTEND_DIR"
23
-
24
- if [ -d "node_modules/@eventlook" ]; then
25
- echo "removing existing sdk link..."
26
- yalc remove @eventlook/sdk 2>/dev/null || true
27
- fi
28
-
29
- echo "adding sdk via yalc..."
30
- yalc add @eventlook/sdk
31
-
32
- echo "linked successfully"
@@ -1,63 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- var React = require('react');
6
- var useGlobal = require('../hooks/useGlobal.js');
7
- var material = require('@mui/material');
8
- var seatPickerSdk = require('@seat-picker/seat-picker-sdk');
9
- var reactHookForm = require('react-hook-form');
10
-
11
- const TicketSelectionMap = ({ event }) => {
12
- const { t, seatingIframeUrl } = useGlobal.default();
13
- const { setValue } = reactHookForm.useFormContext();
14
- const onSelect = (seats) => {
15
- const tickets = [];
16
- const groupedSeatsByZone = seats.reduce((tickets, seat) => {
17
- const zoneIndex = tickets.findIndex((ticket) => ticket.seat.type === seat.locationType);
18
- if (zoneIndex !== -1) {
19
- tickets[zoneIndex].quantity += 1;
20
- }
21
- else {
22
- tickets.push({
23
- seat: {
24
- id: seat.locationId,
25
- type: seat.locationType,
26
- locationDescription: seat.locationTypeDescription,
27
- },
28
- quantity: 1,
29
- ticket: seat.ticket,
30
- });
31
- }
32
- return tickets;
33
- },
34
- // TODO: fix types
35
- []);
36
- for (const groupedSeat of groupedSeatsByZone) {
37
- tickets.push({
38
- releaseId: groupedSeat.ticket.id,
39
- price: groupedSeat.ticket.price,
40
- quantity: groupedSeat.quantity,
41
- itemName: `${groupedSeat.ticket.releaseCategoryName} - ${groupedSeat.ticket.name}`,
42
- products: [],
43
- extraFields: [],
44
- location: {
45
- id: groupedSeat.seat.id,
46
- type: 'zone',
47
- locationDescription: groupedSeat.seat.locationDescription,
48
- },
49
- });
50
- }
51
- setValue(`tickets.${event.id}`, tickets);
52
- };
53
- if (!seatingIframeUrl)
54
- return null;
55
- return (React.createElement(material.Button, { variant: "contained", onClick: () => seatPickerSdk.iframe.openPicker({
56
- eventId: String(event.id),
57
- onSelect,
58
- baseUrl: seatingIframeUrl,
59
- }) }, t('form.labels.open_map')));
60
- };
61
-
62
- exports.default = TicketSelectionMap;
63
- //# sourceMappingURL=TicketSelectionMap.js.map
@@ -1 +0,0 @@
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.type === seat.locationType);\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: 'zone',\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 })\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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E,EAAE;AACZ,gBAAA,WAAW,EAAE,EAAE;AACf,gBAAA,QAAQ,EAAE;AACR,oBAAA,EAAE,EAAE,WAAW,CAAC,IAAI,CAAC,EAAE;AACvB,oBAAA,IAAI,EAAE,MAAM;AACZ,oBAAA,mBAAmB,EAAE,WAAW,CAAC,IAAI,CAAC,mBAAmB;AAC1D,iBAAA;AACF,aAAA,CAAC;;QAGJ,QAAQ,CAAC,WAAW,KAAK,CAAC,EAAE,CAAA,CAAE,EAAE,OAAO,CAAC;AAC1C,KAAC;AAED,IAAA,IAAI,CAAC,gBAAgB;AAAE,QAAA,OAAO,IAAI;AAElC,IAAA,QACE,KAAA,CAAA,aAAA,CAACC,eAAM,EAAA,EACL,OAAO,EAAC,WAAW,EACnB,OAAO,EAAE,MACPC,oBAAM,CAAC,UAAU,CAAC;AAChB,YAAA,OAAO,EAAE,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC;YACzB,QAAQ;AACR,YAAA,OAAO,EAAE,gBAAgB;AAC1B,SAAA,CAAC,IAGH,CAAC,CAAC,sBAAsB,CAAC,CACnB;AAEb;;;;"}
@@ -1,59 +0,0 @@
1
- import React from 'react';
2
- import useGlobal from '../hooks/useGlobal.js';
3
- import { Button } from '@mui/material';
4
- import { iframe } from '@seat-picker/seat-picker-sdk';
5
- import { useFormContext } from 'react-hook-form';
6
-
7
- const TicketSelectionMap = ({ event }) => {
8
- const { t, seatingIframeUrl } = useGlobal();
9
- const { setValue } = useFormContext();
10
- const onSelect = (seats) => {
11
- const tickets = [];
12
- const groupedSeatsByZone = seats.reduce((tickets, seat) => {
13
- const zoneIndex = tickets.findIndex((ticket) => ticket.seat.type === seat.locationType);
14
- if (zoneIndex !== -1) {
15
- tickets[zoneIndex].quantity += 1;
16
- }
17
- else {
18
- tickets.push({
19
- seat: {
20
- id: seat.locationId,
21
- type: seat.locationType,
22
- locationDescription: seat.locationTypeDescription,
23
- },
24
- quantity: 1,
25
- ticket: seat.ticket,
26
- });
27
- }
28
- return tickets;
29
- },
30
- // TODO: fix types
31
- []);
32
- for (const groupedSeat of groupedSeatsByZone) {
33
- tickets.push({
34
- releaseId: groupedSeat.ticket.id,
35
- price: groupedSeat.ticket.price,
36
- quantity: groupedSeat.quantity,
37
- itemName: `${groupedSeat.ticket.releaseCategoryName} - ${groupedSeat.ticket.name}`,
38
- products: [],
39
- extraFields: [],
40
- location: {
41
- id: groupedSeat.seat.id,
42
- type: 'zone',
43
- locationDescription: groupedSeat.seat.locationDescription,
44
- },
45
- });
46
- }
47
- setValue(`tickets.${event.id}`, tickets);
48
- };
49
- if (!seatingIframeUrl)
50
- return null;
51
- return (React.createElement(Button, { variant: "contained", onClick: () => iframe.openPicker({
52
- eventId: String(event.id),
53
- onSelect,
54
- baseUrl: seatingIframeUrl,
55
- }) }, t('form.labels.open_map')));
56
- };
57
-
58
- export { TicketSelectionMap as default };
59
- //# sourceMappingURL=TicketSelectionMap.js.map
@@ -1 +0,0 @@
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.type === seat.locationType);\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: 'zone',\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 })\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;AAC3C,IAAA,MAAM,EAAE,QAAQ,EAAE,GAAG,cAAc,EAAe;AAElD,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,IAAI,KAAK,IAAI,CAAC,YAAY,CAAC;AACvF,YAAA,IAAI,SAAS,KAAK,EAAE,EAAE;AACpB,gBAAA,OAAO,CAAC,SAAS,CAAC,CAAC,QAAQ,IAAI,CAAC;;iBAC3B;gBACL,OAAO,CAAC,IAAI,CAAC;A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K,CAAC,EAAE,CAAC;YACzB,QAAQ;AACR,YAAA,OAAO,EAAE,gBAAgB;AAC1B,SAAA,CAAC,IAGH,CAAC,CAAC,sBAAsB,CAAC,CACnB;AAEb;;;;"}
@@ -1,7 +0,0 @@
1
- import React from 'react';
2
- import { IEvent } from '@utils/types/event.type.ts';
3
- interface Props {
4
- event: IEvent;
5
- }
6
- declare const TicketSelectionMap: React.FC<Props>;
7
- export default TicketSelectionMap;
@@ -1,79 +0,0 @@
1
- import React from 'react';
2
- import useGlobal from '@hooks/useGlobal.ts';
3
- import { IEvent } from '@utils/types/event.type.ts';
4
- import { Button } from '@mui/material';
5
- import { iframe, TicketSelection } from '@seat-picker/seat-picker-sdk';
6
- import { useFormContext } from 'react-hook-form';
7
- import { ITicketForm, ITicketFormTicket, ITicketLocation } from '@utils/types/ticket.type.ts';
8
-
9
- interface Props {
10
- event: IEvent;
11
- }
12
-
13
- const TicketSelectionMap: React.FC<Props> = ({ event }) => {
14
- const { t, seatingIframeUrl } = useGlobal();
15
- const { setValue } = useFormContext<ITicketForm>();
16
-
17
- const onSelect = (seats: TicketSelection) => {
18
- const tickets: ITicketFormTicket[] = [];
19
- const groupedSeatsByZone = seats.reduce(
20
- (tickets, seat) => {
21
- const zoneIndex = tickets.findIndex((ticket) => ticket.seat.type === seat.locationType);
22
- if (zoneIndex !== -1) {
23
- tickets[zoneIndex].quantity += 1;
24
- } else {
25
- tickets.push({
26
- seat: {
27
- id: seat.locationId,
28
- type: seat.locationType,
29
- locationDescription: seat.locationTypeDescription,
30
- },
31
- quantity: 1,
32
- ticket: seat.ticket,
33
- });
34
- }
35
-
36
- return tickets;
37
- },
38
- // TODO: fix types
39
- [] as { quantity: number; seat: ITicketLocation; ticket: any }[]
40
- );
41
-
42
- for (const groupedSeat of groupedSeatsByZone) {
43
- tickets.push({
44
- releaseId: groupedSeat.ticket.id,
45
- price: groupedSeat.ticket.price,
46
- quantity: groupedSeat.quantity,
47
- itemName: `${groupedSeat.ticket.releaseCategoryName} - ${groupedSeat.ticket.name}`,
48
- products: [],
49
- extraFields: [],
50
- location: {
51
- id: groupedSeat.seat.id,
52
- type: 'zone',
53
- locationDescription: groupedSeat.seat.locationDescription,
54
- },
55
- });
56
- }
57
-
58
- setValue(`tickets.${event.id}`, tickets);
59
- };
60
-
61
- if (!seatingIframeUrl) return null;
62
-
63
- return (
64
- <Button
65
- variant="contained"
66
- onClick={() =>
67
- iframe.openPicker({
68
- eventId: String(event.id),
69
- onSelect,
70
- baseUrl: seatingIframeUrl,
71
- })
72
- }
73
- >
74
- {t('form.labels.open_map')}
75
- </Button>
76
- );
77
- };
78
-
79
- export default TicketSelectionMap;