@passly-nl/data 1.4.2 → 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 (37) hide show
  1. package/dist/index.d.mts +49 -25
  2. package/dist/index.d.mts.map +1 -1
  3. package/dist/index.mjs +155 -60
  4. package/dist/index.mjs.map +1 -1
  5. package/package.json +1 -1
  6. package/src/adapter/EventAdapter.ts +12 -2
  7. package/src/adapter/OrderAdapter.ts +3 -2
  8. package/src/adapter/ProductAdapter.ts +2 -1
  9. package/src/adapter/PublicShopAdapter.ts +11 -2
  10. package/src/adapter/ReservationAdapter.ts +4 -2
  11. package/src/dto/event/ShopDesignDto.ts +22 -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 +11 -1
  22. package/src/dto/publicShop/PublicShopDesignDto.ts +22 -1
  23. package/src/dto/publicShop/PublicShopElementButtonDto.ts +3 -2
  24. package/src/dto/publicShop/PublicShopElementDividerDto.ts +3 -2
  25. package/src/dto/publicShop/PublicShopElementDto.ts +12 -2
  26. package/src/dto/publicShop/PublicShopElementHeadingDto.ts +3 -3
  27. package/src/dto/publicShop/PublicShopElementInformationDto.ts +3 -2
  28. package/src/dto/publicShop/PublicShopElementNoticeDto.ts +3 -3
  29. package/src/dto/publicShop/PublicShopElementProductDto.ts +3 -2
  30. package/src/dto/publicShop/PublicShopElementTextDto.ts +3 -2
  31. package/src/dto/reservation/ReservationProductDto.ts +23 -2
  32. package/src/service/MerchantEventProductService.ts +3 -2
  33. package/src/service/MerchantEventProductsService.ts +5 -2
  34. package/src/service/MerchantEventShopService.ts +28 -3
  35. package/src/service/PublicShopService.ts +17 -2
  36. package/src/types/event.ts +4 -0
  37. package/src/types/product.ts +2 -1
@@ -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
  }
@@ -1,6 +1,6 @@
1
1
  import { BaseResponse, BaseService, QueryString } from '@basmilius/http-client';
2
- import { EventAdapter, ShortlinkAdapter } from '#data/adapter';
3
- import type { ShopDesignDto, ShopDto, ShopElementDto, ShortlinkDto } from '#data/dto';
2
+ import { CommonAdapter, EventAdapter, ShortlinkAdapter } from '#data/adapter';
3
+ import type { ShopDesignDto, ShopDto, ShopElementDto, ShortlinkDto, StatusResponseDto } from '#data/dto';
4
4
 
5
5
  export class MerchantEventShopService extends BaseService {
6
6
  async get(merchantId: string, eventId: string, shopId: string): Promise<BaseResponse<ShopDto>> {
@@ -60,7 +60,8 @@ export class MerchantEventShopService extends BaseService {
60
60
  .body({
61
61
  background_color: design.backgroundColor,
62
62
  foreground_color: design.foregroundColor,
63
- primary_color: design.primaryColor
63
+ primary_color: design.primaryColor,
64
+ background_scrim: design.backgroundScrim
64
65
  })
65
66
  .runAdapter(EventAdapter.parseShopDesign);
66
67
  }
@@ -95,6 +96,20 @@ export class MerchantEventShopService extends BaseService {
95
96
  .runAdapter(EventAdapter.parseShop);
96
97
  }
97
98
 
99
+ async postBackground(merchantId: string, eventId: string, shopId: string, picture: File): Promise<BaseResponse<StatusResponseDto>> {
100
+ const data = new FormData();
101
+ data.append('file', picture);
102
+
103
+ return await this
104
+ .request(`/merchants/${merchantId}/events/${eventId}/shops/${shopId}/design/background`)
105
+ .method('post')
106
+ .queryString(QueryString.builder()
107
+ .append('language', 'nl'))
108
+ .bearerToken()
109
+ .body(data)
110
+ .runAdapter(CommonAdapter.parseStatusResponse);
111
+ }
112
+
98
113
  async postShortlink(merchantId: string, eventId: string, shopId: string): Promise<BaseResponse<ShortlinkDto>> {
99
114
  return await this
100
115
  .request(`/merchants/${merchantId}/events/${eventId}/shops/${shopId}/shortlink`)
@@ -104,4 +119,14 @@ export class MerchantEventShopService extends BaseService {
104
119
  .bearerToken()
105
120
  .runAdapter(ShortlinkAdapter.parse);
106
121
  }
122
+
123
+ async deleteBackground(merchantId: string, eventId: string, shopId: string): Promise<BaseResponse<StatusResponseDto>> {
124
+ return await this
125
+ .request(`/merchants/${merchantId}/events/${eventId}/shops/${shopId}/design/background`)
126
+ .method('delete')
127
+ .queryString(QueryString.builder()
128
+ .append('language', 'nl'))
129
+ .bearerToken()
130
+ .runAdapter(CommonAdapter.parseStatusResponse);
131
+ }
107
132
  }
@@ -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'