@passly-nl/data 1.4.3 → 1.6.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 (37) hide show
  1. package/dist/index.d.mts +48 -26
  2. package/dist/index.d.mts.map +1 -1
  3. package/dist/index.mjs +147 -61
  4. package/dist/index.mjs.map +1 -1
  5. package/package.json +1 -1
  6. package/src/adapter/EventAdapter.ts +10 -1
  7. package/src/adapter/OrderAdapter.ts +3 -2
  8. package/src/adapter/ProductAdapter.ts +3 -1
  9. package/src/adapter/PublicShopAdapter.ts +10 -1
  10. package/src/adapter/ReservationAdapter.ts +4 -2
  11. package/src/dto/event/EventDto.ts +11 -1
  12. package/src/dto/event/ShopElementButtonDto.ts +3 -2
  13. package/src/dto/event/ShopElementDividerDto.ts +3 -2
  14. package/src/dto/event/ShopElementDto.ts +12 -2
  15. package/src/dto/event/ShopElementHeadingDto.ts +3 -3
  16. package/src/dto/event/ShopElementInformationDto.ts +3 -2
  17. package/src/dto/event/ShopElementNoticeDto.ts +3 -3
  18. package/src/dto/event/ShopElementProductDto.ts +3 -2
  19. package/src/dto/event/ShopElementTextDto.ts +3 -2
  20. package/src/dto/order/OrderProductDto.ts +12 -1
  21. package/src/dto/product/ProductDto.ts +21 -1
  22. package/src/dto/publicShop/PublicShopElementButtonDto.ts +3 -2
  23. package/src/dto/publicShop/PublicShopElementDividerDto.ts +3 -2
  24. package/src/dto/publicShop/PublicShopElementDto.ts +12 -2
  25. package/src/dto/publicShop/PublicShopElementHeadingDto.ts +3 -3
  26. package/src/dto/publicShop/PublicShopElementInformationDto.ts +3 -2
  27. package/src/dto/publicShop/PublicShopElementNoticeDto.ts +3 -3
  28. package/src/dto/publicShop/PublicShopElementProductDto.ts +3 -2
  29. package/src/dto/publicShop/PublicShopElementTextDto.ts +3 -2
  30. package/src/dto/publicShop/PublicShopEventDto.ts +11 -1
  31. package/src/dto/publicShop/PublicShopProductDto.ts +11 -1
  32. package/src/dto/reservation/ReservationProductDto.ts +23 -2
  33. package/src/service/MerchantEventProductService.ts +3 -2
  34. package/src/service/MerchantEventProductsService.ts +5 -2
  35. package/src/service/PublicShopService.ts +17 -2
  36. package/src/types/event.ts +4 -0
  37. package/src/types/product.ts +2 -1
@@ -29,6 +29,14 @@ export class PublicShopEventDto {
29
29
  this.#description = value;
30
30
  }
31
31
 
32
+ get descriptionPlaintext(): string {
33
+ return this.#descriptionPlaintext;
34
+ }
35
+
36
+ set descriptionPlaintext(value: string) {
37
+ this.#descriptionPlaintext = value;
38
+ }
39
+
32
40
  get status(): EventStatus {
33
41
  return this.#status;
34
42
  }
@@ -80,6 +88,7 @@ export class PublicShopEventDto {
80
88
  #id: string;
81
89
  #name: string;
82
90
  #description: string;
91
+ #descriptionPlaintext: string;
83
92
  #status: EventStatus;
84
93
  #address: AddressDto;
85
94
  #headerFile: PictureDto | null;
@@ -87,10 +96,11 @@ export class PublicShopEventDto {
87
96
  #startsOn: DateTime;
88
97
  #endsOn: DateTime;
89
98
 
90
- constructor(id: string, name: string, description: string, status: EventStatus, address: AddressDto, headerFile: PictureDto | null, minimumAge: number, startsOn: DateTime, endsOn: DateTime) {
99
+ constructor(id: string, name: string, description: string, descriptionPlaintext: string, status: EventStatus, address: AddressDto, headerFile: PictureDto | null, minimumAge: number, startsOn: DateTime, endsOn: DateTime) {
91
100
  this.#id = id;
92
101
  this.#name = name;
93
102
  this.#description = description;
103
+ this.#descriptionPlaintext = descriptionPlaintext;
94
104
  this.#status = status;
95
105
  this.#address = address;
96
106
  this.#headerFile = headerFile;
@@ -37,6 +37,14 @@ export class PublicShopProductDto {
37
37
  this.#description = value;
38
38
  }
39
39
 
40
+ get descriptionPlaintext(): string {
41
+ return this.#descriptionPlaintext;
42
+ }
43
+
44
+ set descriptionPlaintext(value: string) {
45
+ this.#descriptionPlaintext = value;
46
+ }
47
+
40
48
  get price(): CostDto {
41
49
  return this.#price;
42
50
  }
@@ -121,6 +129,7 @@ export class PublicShopProductDto {
121
129
  #type: ProductType;
122
130
  #name: string;
123
131
  #description: string;
132
+ #descriptionPlaintext: string;
124
133
  #price: CostDto;
125
134
  #maxQuantity: number;
126
135
  #isActive: boolean;
@@ -132,11 +141,12 @@ export class PublicShopProductDto {
132
141
  #saleStartsOn: DateTime | null;
133
142
  #saleEndsOn: DateTime | null;
134
143
 
135
- constructor(id: string, type: ProductType, name: string, description: string, price: CostDto, maxQuantity: number, isActive: boolean, isTimeslotted: boolean, timeSlots: PublicShopTimeSlotDto[], image: PictureDto | null, images: PictureDto[], availability: ProductAvailability, saleStartsOn: DateTime | null, saleEndsOn: DateTime | null) {
144
+ constructor(id: string, type: ProductType, name: string, description: string, descriptionPlaintext: string, price: CostDto, maxQuantity: number, isActive: boolean, isTimeslotted: boolean, timeSlots: PublicShopTimeSlotDto[], image: PictureDto | null, images: PictureDto[], availability: ProductAvailability, saleStartsOn: DateTime | null, saleEndsOn: DateTime | null) {
136
145
  this.#id = id;
137
146
  this.#type = type;
138
147
  this.#name = name;
139
148
  this.#description = description;
149
+ this.#descriptionPlaintext = descriptionPlaintext;
140
150
  this.#price = price;
141
151
  this.#maxQuantity = maxQuantity;
142
152
  this.#isActive = isActive;
@@ -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
  }
@@ -1,7 +1,7 @@
1
1
  import { BaseResponse, BaseService, QueryString } from '@basmilius/http-client';
2
2
  import type { DateTime } from 'luxon';
3
- import { OrderAdapter, PublicShopAdapter } from '#data/adapter';
4
- import type { MarketingAttributionDto, OrderDto, PublicShopCartProductDto, PublicShopDto, PublicShopReservationDto } from '#data/dto';
3
+ import { OrderAdapter, PublicShopAdapter, ReservationAdapter } from '#data/adapter';
4
+ import type { MarketingAttributionDto, OrderDto, PublicShopCartProductDto, PublicShopDto, PublicShopReservationDto, ReservationDto } from '#data/dto';
5
5
  import type { Gender } from '#data/types';
6
6
  import { emptyNull } from '#data/util';
7
7
 
@@ -69,6 +69,21 @@ export class PublicShopService extends BaseService {
69
69
  .runAdapter(OrderAdapter.parseOrder);
70
70
  }
71
71
 
72
+ async putReservationProducts(shopId: string, reservationId: string, products: PublicShopCartProductDto[]): Promise<BaseResponse<ReservationDto>> {
73
+ return await this
74
+ .request(`/shops/${shopId}/reservations/${reservationId}/products`)
75
+ .method('put')
76
+ .queryString(QueryString.builder()
77
+ .append('language', 'nl'))
78
+ .body({
79
+ products: products.map(product => [
80
+ product.productId,
81
+ product.quantity
82
+ ])
83
+ })
84
+ .runAdapter(ReservationAdapter.parseReservation);
85
+ }
86
+
72
87
  async reserve(shopId: string, products: PublicShopCartProductDto[], attribution: MarketingAttributionDto | null = null): Promise<BaseResponse<PublicShopReservationDto>> {
73
88
  return await this
74
89
  .request(`/shops/${shopId}/reserve`)
@@ -10,6 +10,10 @@ export type EventStatisticsStatus =
10
10
  | 'concluded'
11
11
  | 'upcoming';
12
12
 
13
+ export type ShopElementPage =
14
+ | 'main'
15
+ | 'add_ons';
16
+
13
17
  export type ShopElementType =
14
18
  | 'button'
15
19
  | 'divider'
@@ -1,5 +1,6 @@
1
1
  export type ProductType =
2
- | 'ticket'
2
+ | 'add_on'
3
+ | 'ticket';
3
4
 
4
5
  export type ProductAvailability =
5
6
  | 'available'