@passly-nl/data 1.4.3 → 1.5.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 (34) hide show
  1. package/dist/index.d.mts +37 -23
  2. package/dist/index.d.mts.map +1 -1
  3. package/dist/index.mjs +109 -55
  4. package/dist/index.mjs.map +1 -1
  5. package/package.json +1 -1
  6. package/src/adapter/EventAdapter.ts +9 -1
  7. package/src/adapter/OrderAdapter.ts +3 -2
  8. package/src/adapter/ProductAdapter.ts +2 -1
  9. package/src/adapter/PublicShopAdapter.ts +8 -1
  10. package/src/adapter/ReservationAdapter.ts +4 -2
  11. package/src/dto/event/ShopElementButtonDto.ts +3 -2
  12. package/src/dto/event/ShopElementDividerDto.ts +3 -2
  13. package/src/dto/event/ShopElementDto.ts +12 -2
  14. package/src/dto/event/ShopElementHeadingDto.ts +3 -3
  15. package/src/dto/event/ShopElementInformationDto.ts +3 -2
  16. package/src/dto/event/ShopElementNoticeDto.ts +3 -3
  17. package/src/dto/event/ShopElementProductDto.ts +3 -2
  18. package/src/dto/event/ShopElementTextDto.ts +3 -2
  19. package/src/dto/order/OrderProductDto.ts +12 -1
  20. package/src/dto/product/ProductDto.ts +11 -1
  21. package/src/dto/publicShop/PublicShopElementButtonDto.ts +3 -2
  22. package/src/dto/publicShop/PublicShopElementDividerDto.ts +3 -2
  23. package/src/dto/publicShop/PublicShopElementDto.ts +12 -2
  24. package/src/dto/publicShop/PublicShopElementHeadingDto.ts +3 -3
  25. package/src/dto/publicShop/PublicShopElementInformationDto.ts +3 -2
  26. package/src/dto/publicShop/PublicShopElementNoticeDto.ts +3 -3
  27. package/src/dto/publicShop/PublicShopElementProductDto.ts +3 -2
  28. package/src/dto/publicShop/PublicShopElementTextDto.ts +3 -2
  29. package/src/dto/reservation/ReservationProductDto.ts +23 -2
  30. package/src/service/MerchantEventProductService.ts +3 -2
  31. package/src/service/MerchantEventProductsService.ts +5 -2
  32. package/src/service/PublicShopService.ts +17 -2
  33. package/src/types/event.ts +4 -0
  34. package/src/types/product.ts +2 -1
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@passly-nl/data",
3
3
  "description": "API implementation for Passly.",
4
- "version": "1.4.3",
4
+ "version": "1.5.0",
5
5
  "type": "module",
6
6
  "license": "MIT",
7
7
  "funding": "https://github.com/sponsors/basmilius",
@@ -88,6 +88,7 @@ export class EventAdapter {
88
88
  case 'button':
89
89
  return new ShopElementButtonDto(
90
90
  data.id,
91
+ data.page,
91
92
  data.icon,
92
93
  data.text,
93
94
  data.url
@@ -96,6 +97,7 @@ export class EventAdapter {
96
97
  case 'divider':
97
98
  return new ShopElementDividerDto(
98
99
  data.id,
100
+ data.page,
99
101
  data.icon,
100
102
  data.text
101
103
  );
@@ -103,18 +105,21 @@ export class EventAdapter {
103
105
  case 'heading':
104
106
  return new ShopElementHeadingDto(
105
107
  data.id,
108
+ data.page,
106
109
  data.heading_level,
107
110
  data.title
108
111
  );
109
112
 
110
113
  case 'information':
111
114
  return new ShopElementInformationDto(
112
- data.id
115
+ data.id,
116
+ data.page
113
117
  );
114
118
 
115
119
  case 'notice':
116
120
  return new ShopElementNoticeDto(
117
121
  data.id,
122
+ data.page,
118
123
  data.icon,
119
124
  data.notice_type,
120
125
  data.title,
@@ -124,18 +129,21 @@ export class EventAdapter {
124
129
  case 'product':
125
130
  return new ShopElementProductDto(
126
131
  data.id,
132
+ data.page,
127
133
  ProductAdapter.parseProduct(data.product)
128
134
  );
129
135
 
130
136
  case 'text':
131
137
  return new ShopElementTextDto(
132
138
  data.id,
139
+ data.page,
133
140
  data.text
134
141
  );
135
142
  }
136
143
 
137
144
  return new ShopElementTextDto(
138
145
  'unknown',
146
+ data.page,
139
147
  'Unknown element type.'
140
148
  );
141
149
  }
@@ -1,5 +1,5 @@
1
1
  import { adapter, ForeignData } from '@basmilius/http-client';
2
- import { BuyerAdapter, DateTimeAdapter, EventAdapter, MarketingAttributionAdapter, PaymentAdapter, PublicShopAdapter } from '#data/adapter';
2
+ import { BuyerAdapter, DateTimeAdapter, EventAdapter, FileSystemAdapter, MarketingAttributionAdapter, PaymentAdapter, PublicShopAdapter } from '#data/adapter';
3
3
  import { OrderDto, OrderLineDto, OrderPaymentProviderDto, OrderProductDto } from '#data/dto';
4
4
  import { optional, optionalArray } from '#data/util';
5
5
 
@@ -54,7 +54,8 @@ export class OrderAdapter {
54
54
  data.id,
55
55
  data.name,
56
56
  data.description,
57
- data.image
57
+ optional(data.image, FileSystemAdapter.parsePicture),
58
+ data.type ?? 'ticket'
58
59
  );
59
60
  }
60
61
  }
@@ -28,7 +28,8 @@ export class ProductAdapter {
28
28
  optional(data.sale_starts_on, DateTimeAdapter.parseDateTime),
29
29
  optional(data.sale_ends_on, DateTimeAdapter.parseDateTime),
30
30
  data.availability,
31
- data.sold
31
+ data.sold,
32
+ data.is_scannable ?? true
32
33
  );
33
34
  }
34
35
  }
@@ -38,6 +38,7 @@ export class PublicShopAdapter {
38
38
  case 'button':
39
39
  return new PublicShopElementButtonDto(
40
40
  data.id,
41
+ data.page,
41
42
  data.icon,
42
43
  data.text,
43
44
  data.url
@@ -46,6 +47,7 @@ export class PublicShopAdapter {
46
47
  case 'divider':
47
48
  return new PublicShopElementDividerDto(
48
49
  data.id,
50
+ data.page,
49
51
  data.icon,
50
52
  data.text
51
53
  );
@@ -53,18 +55,21 @@ export class PublicShopAdapter {
53
55
  case 'heading':
54
56
  return new PublicShopElementHeadingDto(
55
57
  data.id,
58
+ data.page,
56
59
  data.heading_level,
57
60
  data.title
58
61
  );
59
62
 
60
63
  case 'information':
61
64
  return new PublicShopElementInformationDto(
62
- data.id
65
+ data.id,
66
+ data.page
63
67
  );
64
68
 
65
69
  case 'notice':
66
70
  return new PublicShopElementNoticeDto(
67
71
  data.id,
72
+ data.page,
68
73
  data.icon,
69
74
  data.notice_type,
70
75
  data.title,
@@ -74,12 +79,14 @@ export class PublicShopAdapter {
74
79
  case 'product':
75
80
  return new PublicShopElementProductDto(
76
81
  data.id,
82
+ data.page,
77
83
  PublicShopAdapter.parsePublicShopProduct(data.product)
78
84
  );
79
85
 
80
86
  case 'text':
81
87
  return new PublicShopElementTextDto(
82
88
  data.id,
89
+ data.page,
83
90
  data.text
84
91
  );
85
92
  }
@@ -1,5 +1,5 @@
1
1
  import { adapter, ForeignData } from '@basmilius/http-client';
2
- import { DateTimeAdapter, FileSystemAdapter, MarketingAttributionAdapter } from '#data/adapter';
2
+ import { DateTimeAdapter, FileSystemAdapter, MarketingAttributionAdapter, PaymentAdapter } from '#data/adapter';
3
3
  import { ReservationDto, ReservationItemDto, ReservationProductDto } from '#data/dto';
4
4
  import { optional, optionalArray } from '#data/util';
5
5
 
@@ -28,7 +28,9 @@ export class ReservationAdapter {
28
28
  data.id,
29
29
  data.name,
30
30
  data.description,
31
- optional(data.image, FileSystemAdapter.parsePicture)
31
+ optional(data.image, FileSystemAdapter.parsePicture),
32
+ PaymentAdapter.parseCost(data.price),
33
+ data.type ?? 'ticket'
32
34
  );
33
35
  }
34
36
  }
@@ -1,6 +1,7 @@
1
1
  import { dto } from '@basmilius/http-client';
2
2
  import type { FluxIconName } from '@flux-ui/types';
3
3
  import { ShopElementDto } from '#data/dto';
4
+ import type { ShopElementPage } from '#data/types';
4
5
 
5
6
  @dto
6
7
  export class ShopElementButtonDto extends ShopElementDto {
@@ -32,8 +33,8 @@ export class ShopElementButtonDto extends ShopElementDto {
32
33
  #text: string;
33
34
  #url: string;
34
35
 
35
- constructor(id: string, icon: FluxIconName | null, text: string, url: string) {
36
- super(id, 'button');
36
+ constructor(id: string, page: ShopElementPage, icon: FluxIconName | null, text: string, url: string) {
37
+ super(id, 'button', page);
37
38
  this.#icon = icon;
38
39
  this.#text = text;
39
40
  this.#url = url;
@@ -1,6 +1,7 @@
1
1
  import { dto } from '@basmilius/http-client';
2
2
  import type { FluxIconName } from '@flux-ui/types';
3
3
  import { ShopElementDto } from '#data/dto';
4
+ import type { ShopElementPage } from '#data/types';
4
5
 
5
6
  @dto
6
7
  export class ShopElementDividerDto extends ShopElementDto {
@@ -23,8 +24,8 @@ export class ShopElementDividerDto extends ShopElementDto {
23
24
  #icon: FluxIconName | null;
24
25
  #text: string | null;
25
26
 
26
- constructor(id: string, icon: FluxIconName | null, text: string | null) {
27
- super(id, 'divider');
27
+ constructor(id: string, page: ShopElementPage, icon: FluxIconName | null, text: string | null) {
28
+ super(id, 'divider', page);
28
29
  this.#icon = icon;
29
30
  this.#text = text;
30
31
  }
@@ -1,4 +1,4 @@
1
- import type { ShopElementType } from '#data/types';
1
+ import type { ShopElementPage, ShopElementType } from '#data/types';
2
2
 
3
3
  export abstract class ShopElementDto {
4
4
  get id(): string {
@@ -9,6 +9,14 @@ export abstract class ShopElementDto {
9
9
  this.#id = value;
10
10
  }
11
11
 
12
+ get page(): ShopElementPage {
13
+ return this.#page;
14
+ }
15
+
16
+ set page(value: ShopElementPage) {
17
+ this.#page = value;
18
+ }
19
+
12
20
  get type(): ShopElementType {
13
21
  return this.#type;
14
22
  }
@@ -18,10 +26,12 @@ export abstract class ShopElementDto {
18
26
  }
19
27
 
20
28
  #id: string;
29
+ #page: ShopElementPage;
21
30
  #type: ShopElementType;
22
31
 
23
- protected constructor(id: string, type: ShopElementType) {
32
+ protected constructor(id: string, type: ShopElementType, page: ShopElementPage) {
24
33
  this.#id = id;
34
+ this.#page = page;
25
35
  this.#type = type;
26
36
  }
27
37
  }
@@ -1,6 +1,6 @@
1
1
  import { dto } from '@basmilius/http-client';
2
2
  import { ShopElementDto } from '#data/dto';
3
- import type { HeadingLevel } from '#data/types';
3
+ import type { HeadingLevel, ShopElementPage } from '#data/types';
4
4
 
5
5
  @dto
6
6
  export class ShopElementHeadingDto extends ShopElementDto {
@@ -23,8 +23,8 @@ export class ShopElementHeadingDto extends ShopElementDto {
23
23
  #headingLevel: HeadingLevel;
24
24
  #title: string;
25
25
 
26
- constructor(id: string, headingLevel: HeadingLevel, title: string) {
27
- super(id, 'heading');
26
+ constructor(id: string, page: ShopElementPage, headingLevel: HeadingLevel, title: string) {
27
+ super(id, 'heading', page);
28
28
  this.#headingLevel = headingLevel;
29
29
  this.#title = title;
30
30
  }
@@ -1,9 +1,10 @@
1
1
  import { dto } from '@basmilius/http-client';
2
2
  import { ShopElementDto } from '#data/dto';
3
+ import type { ShopElementPage } from '#data/types';
3
4
 
4
5
  @dto
5
6
  export class ShopElementInformationDto extends ShopElementDto {
6
- constructor(id: string) {
7
- super(id, 'information');
7
+ constructor(id: string, page: ShopElementPage) {
8
+ super(id, 'information', page);
8
9
  }
9
10
  }
@@ -1,7 +1,7 @@
1
1
  import { dto } from '@basmilius/http-client';
2
2
  import type { FluxIconName } from '@flux-ui/types';
3
3
  import { ShopElementDto } from '#data/dto';
4
- import type { NoticeType } from '#data/types';
4
+ import type { NoticeType, ShopElementPage } from '#data/types';
5
5
 
6
6
  @dto
7
7
  export class ShopElementNoticeDto extends ShopElementDto {
@@ -42,8 +42,8 @@ export class ShopElementNoticeDto extends ShopElementDto {
42
42
  #title: string | null;
43
43
  #text: string;
44
44
 
45
- constructor(id: string, icon: FluxIconName, noticeType: NoticeType, title: string | null, text: string) {
46
- super(id, 'notice');
45
+ constructor(id: string, page: ShopElementPage, icon: FluxIconName, noticeType: NoticeType, title: string | null, text: string) {
46
+ super(id, 'notice', page);
47
47
  this.#icon = icon;
48
48
  this.#noticeType = noticeType;
49
49
  this.#title = title;
@@ -1,5 +1,6 @@
1
1
  import { dto } from '@basmilius/http-client';
2
2
  import { type ProductDto, ShopElementDto } from '#data/dto';
3
+ import type { ShopElementPage } from '#data/types';
3
4
 
4
5
  @dto
5
6
  export class ShopElementProductDto extends ShopElementDto {
@@ -13,8 +14,8 @@ export class ShopElementProductDto extends ShopElementDto {
13
14
 
14
15
  #product: ProductDto;
15
16
 
16
- constructor(id: string, product: ProductDto) {
17
- super(id, 'product');
17
+ constructor(id: string, page: ShopElementPage, product: ProductDto) {
18
+ super(id, 'product', page);
18
19
  this.#product = product;
19
20
  }
20
21
  }
@@ -1,5 +1,6 @@
1
1
  import { dto } from '@basmilius/http-client';
2
2
  import { ShopElementDto } from '#data/dto';
3
+ import type { ShopElementPage } from '#data/types';
3
4
 
4
5
  @dto
5
6
  export class ShopElementTextDto extends ShopElementDto {
@@ -13,8 +14,8 @@ export class ShopElementTextDto extends ShopElementDto {
13
14
 
14
15
  #text: string;
15
16
 
16
- constructor(id: string, text: string) {
17
- super(id, 'text');
17
+ constructor(id: string, page: ShopElementPage, text: string) {
18
+ super(id, 'text', page);
18
19
  this.#text = text;
19
20
  }
20
21
  }
@@ -1,5 +1,6 @@
1
1
  import { dto } from '@basmilius/http-client';
2
2
  import type { PictureDto } from '#data/dto';
3
+ import type { ProductType } from '#data/types';
3
4
 
4
5
  @dto
5
6
  export class OrderProductDto {
@@ -35,15 +36,25 @@ export class OrderProductDto {
35
36
  this.#image = value;
36
37
  }
37
38
 
39
+ get type(): ProductType {
40
+ return this.#type;
41
+ }
42
+
43
+ set type(value: ProductType) {
44
+ this.#type = value;
45
+ }
46
+
38
47
  #id: string;
39
48
  #name: string;
40
49
  #description: string;
41
50
  #image: PictureDto | null;
51
+ #type: ProductType;
42
52
 
43
- constructor(id: string, name: string, description: string, image: PictureDto | null) {
53
+ constructor(id: string, name: string, description: string, image: PictureDto | null, type: ProductType) {
44
54
  this.#id = id;
45
55
  this.#name = name;
46
56
  this.#description = description;
47
57
  this.#image = image;
58
+ this.#type = type;
48
59
  }
49
60
  }
@@ -69,6 +69,14 @@ export class ProductDto {
69
69
  this.#isPersonalizationRequired = value;
70
70
  }
71
71
 
72
+ get isScannable(): boolean {
73
+ return this.#isScannable;
74
+ }
75
+
76
+ set isScannable(value: boolean) {
77
+ this.#isScannable = value;
78
+ }
79
+
72
80
  get isSwappable(): boolean {
73
81
  return this.#isSwappable;
74
82
  }
@@ -203,8 +211,9 @@ export class ProductDto {
203
211
  #saleEndsOn: DateTime | null;
204
212
  #availability: ProductAvailability;
205
213
  #sold: number;
214
+ #isScannable: boolean;
206
215
 
207
- constructor(id: string, type: ProductType, name: string, description: string, price: CostDto, maxQuantity: number, isActive: boolean, isPersonalizationRequired: boolean, isSwappable: boolean, isTimeslotted: boolean, timeSlots: TimeSlotDto[], remainingStock: number, stock: StockPoolDto, hasSales: boolean, image: PictureDto, images: PictureDto[], ticketsReleasedOn: DateTime | null, showWhenUnavailable: boolean, saleStartsOn: DateTime | null, saleEndsOn: DateTime | null, availability: ProductAvailability, sold: number) {
216
+ constructor(id: string, type: ProductType, name: string, description: string, price: CostDto, maxQuantity: number, isActive: boolean, isPersonalizationRequired: boolean, isSwappable: boolean, isTimeslotted: boolean, timeSlots: TimeSlotDto[], remainingStock: number, stock: StockPoolDto, hasSales: boolean, image: PictureDto, images: PictureDto[], ticketsReleasedOn: DateTime | null, showWhenUnavailable: boolean, saleStartsOn: DateTime | null, saleEndsOn: DateTime | null, availability: ProductAvailability, sold: number, isScannable: boolean = true) {
208
217
  this.#id = id;
209
218
  this.#type = type;
210
219
  this.#name = name;
@@ -227,5 +236,6 @@ export class ProductDto {
227
236
  this.#saleEndsOn = saleEndsOn;
228
237
  this.#availability = availability;
229
238
  this.#sold = sold;
239
+ this.#isScannable = isScannable;
230
240
  }
231
241
  }
@@ -1,6 +1,7 @@
1
1
  import { dto } from '@basmilius/http-client';
2
2
  import type { FluxIconName } from '@flux-ui/types';
3
3
  import { PublicShopElementDto } from '#data/dto';
4
+ import type { ShopElementPage } from '#data/types';
4
5
 
5
6
  @dto
6
7
  export class PublicShopElementButtonDto extends PublicShopElementDto {
@@ -32,8 +33,8 @@ export class PublicShopElementButtonDto extends PublicShopElementDto {
32
33
  #text: string;
33
34
  #url: string;
34
35
 
35
- constructor(id: string, icon: FluxIconName | null, text: string, url: string) {
36
- super(id, 'button');
36
+ constructor(id: string, page: ShopElementPage, icon: FluxIconName | null, text: string, url: string) {
37
+ super(id, 'button', page);
37
38
  this.#icon = icon;
38
39
  this.#text = text;
39
40
  this.#url = url;
@@ -1,6 +1,7 @@
1
1
  import { dto } from '@basmilius/http-client';
2
2
  import type { FluxIconName } from '@flux-ui/types';
3
3
  import { PublicShopElementDto } from '#data/dto';
4
+ import type { ShopElementPage } from '#data/types';
4
5
 
5
6
  @dto
6
7
  export class PublicShopElementDividerDto extends PublicShopElementDto {
@@ -23,8 +24,8 @@ export class PublicShopElementDividerDto extends PublicShopElementDto {
23
24
  #icon: FluxIconName | null;
24
25
  #text: string | null;
25
26
 
26
- constructor(id: string, icon: FluxIconName | null, text: string | null) {
27
- super(id, 'divider');
27
+ constructor(id: string, page: ShopElementPage, icon: FluxIconName | null, text: string | null) {
28
+ super(id, 'divider', page);
28
29
  this.#icon = icon;
29
30
  this.#text = text;
30
31
  }
@@ -1,4 +1,4 @@
1
- import type { PublicShopElementType } from '#data/types';
1
+ import type { PublicShopElementType, ShopElementPage } from '#data/types';
2
2
 
3
3
  export abstract class PublicShopElementDto {
4
4
  get id(): string {
@@ -9,6 +9,14 @@ export abstract class PublicShopElementDto {
9
9
  this.#id = value;
10
10
  }
11
11
 
12
+ get page(): ShopElementPage {
13
+ return this.#page;
14
+ }
15
+
16
+ set page(value: ShopElementPage) {
17
+ this.#page = value;
18
+ }
19
+
12
20
  get type(): PublicShopElementType {
13
21
  return this.#type;
14
22
  }
@@ -18,10 +26,12 @@ export abstract class PublicShopElementDto {
18
26
  }
19
27
 
20
28
  #id: string;
29
+ #page: ShopElementPage;
21
30
  #type: PublicShopElementType;
22
31
 
23
- protected constructor(id: string, type: PublicShopElementType) {
32
+ protected constructor(id: string, type: PublicShopElementType, page: ShopElementPage) {
24
33
  this.#id = id;
34
+ this.#page = page;
25
35
  this.#type = type;
26
36
  }
27
37
  }
@@ -1,6 +1,6 @@
1
1
  import { dto } from '@basmilius/http-client';
2
2
  import { PublicShopElementDto } from '#data/dto';
3
- import type { HeadingLevel } from '#data/types';
3
+ import type { HeadingLevel, ShopElementPage } from '#data/types';
4
4
 
5
5
  @dto
6
6
  export class PublicShopElementHeadingDto extends PublicShopElementDto {
@@ -23,8 +23,8 @@ export class PublicShopElementHeadingDto extends PublicShopElementDto {
23
23
  #headingLevel: HeadingLevel;
24
24
  #title: string;
25
25
 
26
- constructor(id: string, headingLevel: HeadingLevel, title: string) {
27
- super(id, 'heading');
26
+ constructor(id: string, page: ShopElementPage, headingLevel: HeadingLevel, title: string) {
27
+ super(id, 'heading', page);
28
28
  this.#headingLevel = headingLevel;
29
29
  this.#title = title;
30
30
  }
@@ -1,9 +1,10 @@
1
1
  import { dto } from '@basmilius/http-client';
2
2
  import { PublicShopElementDto } from '#data/dto';
3
+ import type { ShopElementPage } from '#data/types';
3
4
 
4
5
  @dto
5
6
  export class PublicShopElementInformationDto extends PublicShopElementDto {
6
- constructor(id: string) {
7
- super(id, 'information');
7
+ constructor(id: string, page: ShopElementPage) {
8
+ super(id, 'information', page);
8
9
  }
9
10
  }
@@ -1,7 +1,7 @@
1
1
  import { dto } from '@basmilius/http-client';
2
2
  import type { FluxIconName } from '@flux-ui/types';
3
3
  import { PublicShopElementDto } from '#data/dto';
4
- import type { NoticeType } from '#data/types';
4
+ import type { NoticeType, ShopElementPage } from '#data/types';
5
5
 
6
6
  @dto
7
7
  export class PublicShopElementNoticeDto extends PublicShopElementDto {
@@ -42,8 +42,8 @@ export class PublicShopElementNoticeDto extends PublicShopElementDto {
42
42
  #title: string | null;
43
43
  #text: string;
44
44
 
45
- constructor(id: string, icon: FluxIconName, noticeType: NoticeType, title: string | null, text: string) {
46
- super(id, 'notice');
45
+ constructor(id: string, page: ShopElementPage, icon: FluxIconName, noticeType: NoticeType, title: string | null, text: string) {
46
+ super(id, 'notice', page);
47
47
  this.#icon = icon;
48
48
  this.#noticeType = noticeType;
49
49
  this.#title = title;
@@ -1,5 +1,6 @@
1
1
  import { dto } from '@basmilius/http-client';
2
2
  import { PublicShopElementDto, type PublicShopProductDto } from '#data/dto';
3
+ import type { ShopElementPage } from '#data/types';
3
4
 
4
5
  @dto
5
6
  export class PublicShopElementProductDto extends PublicShopElementDto {
@@ -13,8 +14,8 @@ export class PublicShopElementProductDto extends PublicShopElementDto {
13
14
 
14
15
  #product: PublicShopProductDto;
15
16
 
16
- constructor(id: string, product: PublicShopProductDto) {
17
- super(id, 'product');
17
+ constructor(id: string, page: ShopElementPage, product: PublicShopProductDto) {
18
+ super(id, 'product', page);
18
19
  this.#product = product;
19
20
  }
20
21
  }
@@ -1,5 +1,6 @@
1
1
  import { dto } from '@basmilius/http-client';
2
2
  import { PublicShopElementDto } from '#data/dto';
3
+ import type { ShopElementPage } from '#data/types';
3
4
 
4
5
  @dto
5
6
  export class PublicShopElementTextDto extends PublicShopElementDto {
@@ -13,8 +14,8 @@ export class PublicShopElementTextDto extends PublicShopElementDto {
13
14
 
14
15
  #text: string;
15
16
 
16
- constructor(id: string, text: string) {
17
- super(id, 'text');
17
+ constructor(id: string, page: ShopElementPage, text: string) {
18
+ super(id, 'text', page);
18
19
  this.#text = text;
19
20
  }
20
21
  }
@@ -1,5 +1,6 @@
1
1
  import { dto } from '@basmilius/http-client';
2
- import type { PictureDto } from '#data/dto';
2
+ import type { CostDto, PictureDto } from '#data/dto';
3
+ import type { ProductType } from '#data/types';
3
4
 
4
5
  @dto
5
6
  export class ReservationProductDto {
@@ -35,15 +36,35 @@ export class ReservationProductDto {
35
36
  this.#image = value;
36
37
  }
37
38
 
39
+ get price(): CostDto {
40
+ return this.#price;
41
+ }
42
+
43
+ set price(value: CostDto) {
44
+ this.#price = value;
45
+ }
46
+
47
+ get type(): ProductType {
48
+ return this.#type;
49
+ }
50
+
51
+ set type(value: ProductType) {
52
+ this.#type = value;
53
+ }
54
+
38
55
  #id: string;
39
56
  #name: string;
40
57
  #description: string;
41
58
  #image: PictureDto | null;
59
+ #price: CostDto;
60
+ #type: ProductType;
42
61
 
43
- constructor(id: string, name: string, description: string, image: PictureDto | null) {
62
+ constructor(id: string, name: string, description: string, image: PictureDto | null, price: CostDto, type: ProductType) {
44
63
  this.#id = id;
45
64
  this.#name = name;
46
65
  this.#description = description;
47
66
  this.#image = image;
67
+ this.#price = price;
68
+ this.#type = type;
48
69
  }
49
70
  }
@@ -42,7 +42,7 @@ export class MerchantEventProductService extends BaseService {
42
42
  .runAdapter(ProductAdapter.parseProduct);
43
43
  }
44
44
 
45
- async patchSales(merchantId: string, eventId: string, productId: string, price: number, maxQuantity: number, isSwappable: boolean, ticketsReleasedOn: DateTime | null, showWhenUnavailable: boolean, saleStartsOn: DateTime | null, saleEndsOn: DateTime | null): Promise<BaseResponse<ProductDto>> {
45
+ async patchSales(merchantId: string, eventId: string, productId: string, price: number, maxQuantity: number, isSwappable: boolean, ticketsReleasedOn: DateTime | null, showWhenUnavailable: boolean, saleStartsOn: DateTime | null, saleEndsOn: DateTime | null, isScannable: boolean | null = null): Promise<BaseResponse<ProductDto>> {
46
46
  return await this
47
47
  .request(`/merchants/${merchantId}/events/${eventId}/products/${productId}/sales`)
48
48
  .method('patch')
@@ -56,7 +56,8 @@ export class MerchantEventProductService extends BaseService {
56
56
  tickets_released_on: ticketsReleasedOn?.toISO() ?? null,
57
57
  show_when_unavailable: showWhenUnavailable,
58
58
  sale_starts_on: saleStartsOn?.toISO() ?? null,
59
- sale_ends_on: saleEndsOn?.toISO() ?? null
59
+ sale_ends_on: saleEndsOn?.toISO() ?? null,
60
+ is_scannable: isScannable
60
61
  })
61
62
  .runAdapter(ProductAdapter.parseProduct);
62
63
  }
@@ -3,6 +3,7 @@ import type { FluxFormSelectEntry } from '@flux-ui/types';
3
3
  import type { DateTime } from 'luxon';
4
4
  import { FluxAdapter, ProductAdapter } from '#data/adapter';
5
5
  import type { ProductDto } from '#data/dto';
6
+ import type { ProductType } from '#data/types';
6
7
  import type { ListParams } from '#data/types';
7
8
  import { buildListQuery } from '#data/util';
8
9
 
@@ -28,7 +29,7 @@ export class MerchantEventProductsService extends BaseService {
28
29
  .runArrayAdapter(FluxAdapter.parseFluxFormSelectEntry);
29
30
  }
30
31
 
31
- async post(merchantId: string, eventId: string, name: string, description: string, price: number, maxQuantity: number, stock: number | null, stockPoolId: string | null, ticketsReleasedOn: DateTime | null = null, timeSlotIds: string[] | null = null): Promise<BaseResponse<ProductDto>> {
32
+ async post(merchantId: string, eventId: string, name: string, description: string, price: number, maxQuantity: number, stock: number | null, stockPoolId: string | null, ticketsReleasedOn: DateTime | null = null, timeSlotIds: string[] | null = null, type: ProductType = 'ticket', isScannable: boolean | null = null): Promise<BaseResponse<ProductDto>> {
32
33
  return await this
33
34
  .request(`/merchants/${merchantId}/events/${eventId}/products`)
34
35
  .method('post')
@@ -43,7 +44,9 @@ export class MerchantEventProductsService extends BaseService {
43
44
  max_quantity: maxQuantity,
44
45
  stock_pool_id: stockPoolId,
45
46
  tickets_released_on: ticketsReleasedOn?.toISO() ?? null,
46
- time_slot_ids: timeSlotIds
47
+ time_slot_ids: timeSlotIds,
48
+ type,
49
+ is_scannable: isScannable
47
50
  })
48
51
  .runAdapter(ProductAdapter.parseProduct);
49
52
  }