@passly-nl/data 1.0.1 → 1.0.3

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 (41) hide show
  1. package/dist/index.d.mts +185 -8
  2. package/dist/index.d.mts.map +1 -1
  3. package/dist/index.mjs +11 -1
  4. package/dist/index.mjs.map +1 -1
  5. package/package.json +6 -6
  6. package/src/adapter/EmailTemplateAdapter.ts +25 -0
  7. package/src/adapter/EventAdapter.ts +6 -1
  8. package/src/adapter/MerchantAdapter.ts +1 -0
  9. package/src/adapter/ProductAdapter.ts +3 -2
  10. package/src/adapter/PublicShopAdapter.ts +11 -2
  11. package/src/adapter/index.ts +1 -0
  12. package/src/dto/emailTemplate/EmailTemplateDto.ts +80 -0
  13. package/src/dto/emailTemplate/RenderedMailDto.ts +28 -0
  14. package/src/dto/emailTemplate/index.ts +2 -0
  15. package/src/dto/event/ShopElementInformationDto.ts +9 -0
  16. package/src/dto/event/index.ts +1 -0
  17. package/src/dto/index.ts +1 -0
  18. package/src/dto/merchant/MerchantUserDto.ts +12 -1
  19. package/src/dto/product/ProductDto.ts +12 -1
  20. package/src/dto/publicShop/PublicShopElementInformationDto.ts +9 -0
  21. package/src/dto/publicShop/PublicShopEventDto.ts +42 -1
  22. package/src/dto/publicShop/index.ts +1 -0
  23. package/src/service/AdminMerchantService.ts +15 -0
  24. package/src/service/AdminMerchantsService.ts +17 -0
  25. package/src/service/AdminService.ts +4 -0
  26. package/src/service/EmailTemplateEditorService.ts +285 -0
  27. package/src/service/MerchantContractService.ts +60 -0
  28. package/src/service/MerchantEmailTemplateService.ts +43 -0
  29. package/src/service/MerchantEmailTemplatesService.ts +31 -0
  30. package/src/service/MerchantEventEmailTemplateService.ts +43 -0
  31. package/src/service/MerchantEventEmailTemplatesService.ts +31 -0
  32. package/src/service/MerchantEventProductService.ts +3 -1
  33. package/src/service/MerchantEventProductsService.ts +4 -2
  34. package/src/service/MerchantUserService.ts +38 -0
  35. package/src/service/index.ts +10 -0
  36. package/src/types/auth.ts +3 -0
  37. package/src/types/emailTemplate.ts +10 -0
  38. package/src/types/emailTemplateEditor.ts +63 -0
  39. package/src/types/event.ts +1 -0
  40. package/src/types/index.ts +2 -0
  41. package/src/types/publicShop.ts +1 -0
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.0.1",
4
+ "version": "1.0.3",
5
5
  "type": "module",
6
6
  "license": "MIT",
7
7
  "funding": "https://github.com/sponsors/basmilius",
@@ -50,16 +50,16 @@
50
50
  "./*": "./*"
51
51
  },
52
52
  "dependencies": {
53
- "@basmilius/http-client": "^3.10.0",
54
- "@flux-ui/types": "^3.0.0-next.28",
53
+ "@basmilius/http-client": "^3.12.1",
54
+ "@flux-ui/types": "^3.0.0-next.34",
55
55
  "@fortawesome/fontawesome-common-types": "^7.2.0",
56
- "apexcharts": "^5.10.1",
56
+ "apexcharts": "^5.10.4",
57
57
  "luxon": "^3.7.2"
58
58
  },
59
59
  "devDependencies": {
60
60
  "@types/luxon": "^3.7.1",
61
- "@typescript/native-preview": "^7.0.0-dev.20260305.1",
62
- "tsdown": "^0.21.0-beta.5"
61
+ "@typescript/native-preview": "^7.0.0-dev.20260315.1",
62
+ "tsdown": "^0.21.3"
63
63
  },
64
64
  "overrides": {
65
65
  "@disabled-basmilius/http-client": "link:@basmilius/http-client",
@@ -0,0 +1,25 @@
1
+ import { adapter, ForeignData } from '@basmilius/http-client';
2
+ import { DateTimeAdapter } from '#data/adapter';
3
+ import { EmailTemplateDto, RenderedMailDto } from '#data/dto';
4
+
5
+ @adapter
6
+ export class EmailTemplateAdapter {
7
+ static parseEmailTemplate(data: ForeignData): EmailTemplateDto {
8
+ return new EmailTemplateDto(
9
+ data.id,
10
+ data.type,
11
+ data.language ?? null,
12
+ data.subject,
13
+ data.content,
14
+ DateTimeAdapter.parseDateTime(data.created_on),
15
+ DateTimeAdapter.parseDateTime(data.updated_on)
16
+ );
17
+ }
18
+
19
+ static parseRenderedMail(data: ForeignData): RenderedMailDto {
20
+ return new RenderedMailDto(
21
+ data.subject,
22
+ data.content
23
+ );
24
+ }
25
+ }
@@ -1,6 +1,6 @@
1
1
  import { adapter, ForeignData } from '@basmilius/http-client';
2
2
  import { AddressAdapter, AuthAdapter, DateTimeAdapter, FileSystemAdapter, MerchantAdapter, PaymentAdapter, ProductAdapter } from '#data/adapter';
3
- import { AppTeamDto, EventAvailabilityDto, EventCountersDto, EventDto, EventStatisticsAttendanceDto, EventStatisticsBuyerTotalsDto, EventStatisticsFinancialDto, EventStatisticsOrdersDto, EventStatisticsOrderTotalsDto, EventStatisticsScansDto, EventStatisticsScansPerAppTeamDto, EventStatisticsScanTotalsDto, EventStatisticsSwapTotalsDto, ShopDesignDto, ShopDto, ShopElementButtonDto, ShopElementDividerDto, ShopElementDto, ShopElementHeadingDto, ShopElementNoticeDto, ShopElementProductDto, ShopElementTextDto, StockOverviewDto, StockOverviewItemDto, StockPoolDto, TicketTemplateDto } from '#data/dto';
3
+ import { AppTeamDto, EventAvailabilityDto, EventCountersDto, EventDto, EventStatisticsAttendanceDto, EventStatisticsBuyerTotalsDto, EventStatisticsFinancialDto, EventStatisticsOrdersDto, EventStatisticsOrderTotalsDto, EventStatisticsScansDto, EventStatisticsScansPerAppTeamDto, EventStatisticsScanTotalsDto, EventStatisticsSwapTotalsDto, ShopDesignDto, ShopDto, ShopElementButtonDto, ShopElementDividerDto, ShopElementDto, ShopElementHeadingDto, ShopElementInformationDto, ShopElementNoticeDto, ShopElementProductDto, ShopElementTextDto, StockOverviewDto, StockOverviewItemDto, StockPoolDto, TicketTemplateDto } from '#data/dto';
4
4
  import { optional } from '#data/util';
5
5
 
6
6
  @adapter
@@ -104,6 +104,11 @@ export class EventAdapter {
104
104
  data.title
105
105
  );
106
106
 
107
+ case 'information':
108
+ return new ShopElementInformationDto(
109
+ data.id
110
+ );
111
+
107
112
  case 'notice':
108
113
  return new ShopElementNoticeDto(
109
114
  data.id,
@@ -50,6 +50,7 @@ export class MerchantAdapter {
50
50
  static parseMerchantUser(data: ForeignData): MerchantUserDto {
51
51
  return new MerchantUserDto(
52
52
  data.is_manager,
53
+ data.claims ?? [],
53
54
  DateTimeAdapter.parseDateTime(data.created_on),
54
55
  DateTimeAdapter.parseDateTime(data.updated_on),
55
56
  AuthAdapter.parseUser(data.user)
@@ -1,5 +1,5 @@
1
1
  import { adapter, ForeignData } from '@basmilius/http-client';
2
- import { EventAdapter, FileSystemAdapter, PaymentAdapter } from '#data/adapter';
2
+ import { DateTimeAdapter, EventAdapter, FileSystemAdapter, PaymentAdapter } from '#data/adapter';
3
3
  import { ProductDto } from '#data/dto';
4
4
  import { optional, optionalArray } from '#data/util';
5
5
 
@@ -18,7 +18,8 @@ export class ProductAdapter {
18
18
  data.remaining_stock,
19
19
  optional(data.stock_pool, EventAdapter.parseStockPool),
20
20
  optional(data.image, FileSystemAdapter.parsePicture),
21
- optionalArray(data.images, FileSystemAdapter.parsePicture)!
21
+ optionalArray(data.images, FileSystemAdapter.parsePicture)!,
22
+ optional(data.tickets_released_on, DateTimeAdapter.parseDateTime)
22
23
  );
23
24
  }
24
25
  }
@@ -1,6 +1,6 @@
1
1
  import { adapter, ForeignData } from '@basmilius/http-client';
2
2
  import { AddressAdapter, DateTimeAdapter, FileSystemAdapter, PaymentAdapter } from '#data/adapter';
3
- import { PublicShopDesignDto, PublicShopDto, PublicShopElementButtonDto, PublicShopElementDividerDto, PublicShopElementDto, PublicShopElementHeadingDto, PublicShopElementNoticeDto, PublicShopElementProductDto, PublicShopElementTextDto, PublicShopEventDto, PublicShopMerchantDto, PublicShopProductDto, PublicShopReservationDto, PublicShopReservationProductDetailsDto, PublicShopReservationProductDto, PublicShopTimeSlotDto } from '#data/dto';
3
+ import { PublicShopDesignDto, PublicShopDto, PublicShopElementButtonDto, PublicShopElementDividerDto, PublicShopElementDto, PublicShopElementHeadingDto, PublicShopElementInformationDto, PublicShopElementNoticeDto, PublicShopElementProductDto, PublicShopElementTextDto, PublicShopEventDto, PublicShopMerchantDto, PublicShopProductDto, PublicShopReservationDto, PublicShopReservationProductDetailsDto, PublicShopReservationProductDto, PublicShopTimeSlotDto } from '#data/dto';
4
4
  import { optional, optionalArray } from '#data/util';
5
5
 
6
6
  @adapter
@@ -55,6 +55,11 @@ export class PublicShopAdapter {
55
55
  data.title
56
56
  );
57
57
 
58
+ case 'information':
59
+ return new PublicShopElementInformationDto(
60
+ data.id
61
+ );
62
+
58
63
  case 'notice':
59
64
  return new PublicShopElementNoticeDto(
60
65
  data.id,
@@ -84,9 +89,13 @@ export class PublicShopAdapter {
84
89
  return new PublicShopEventDto(
85
90
  data.id,
86
91
  data.name,
92
+ data.description,
87
93
  data.status,
88
94
  AddressAdapter.parseAddress(data.address),
89
- optional(data.header_file, FileSystemAdapter.parsePicture)
95
+ optional(data.header_file, FileSystemAdapter.parsePicture),
96
+ data.minimum_age,
97
+ DateTimeAdapter.parseDateTime(data.starts_on),
98
+ DateTimeAdapter.parseDateTime(data.ends_on)
90
99
  );
91
100
  }
92
101
 
@@ -1,5 +1,6 @@
1
1
  export * from './AddressAdapter';
2
2
  export * from './AuthAdapter';
3
+ export * from './EmailTemplateAdapter';
3
4
  export * from './BuyerAdapter';
4
5
  export * from './CommonAdapter';
5
6
  export * from './DateTimeAdapter';
@@ -0,0 +1,80 @@
1
+ import { dto } from '@basmilius/http-client';
2
+ import type { DateTime } from 'luxon';
3
+ import type { EmailTemplateLanguage, EmailTemplateType } from '#data/types';
4
+
5
+ @dto
6
+ export class EmailTemplateDto {
7
+ get id(): string {
8
+ return this.#id;
9
+ }
10
+
11
+ set id(value: string) {
12
+ this.#id = value;
13
+ }
14
+
15
+ get type(): EmailTemplateType {
16
+ return this.#type;
17
+ }
18
+
19
+ set type(value: EmailTemplateType) {
20
+ this.#type = value;
21
+ }
22
+
23
+ get language(): EmailTemplateLanguage | null {
24
+ return this.#language;
25
+ }
26
+
27
+ set language(value: EmailTemplateLanguage | null) {
28
+ this.#language = value;
29
+ }
30
+
31
+ get subject(): string {
32
+ return this.#subject;
33
+ }
34
+
35
+ set subject(value: string) {
36
+ this.#subject = value;
37
+ }
38
+
39
+ get content(): string {
40
+ return this.#content;
41
+ }
42
+
43
+ set content(value: string) {
44
+ this.#content = value;
45
+ }
46
+
47
+ get createdOn(): DateTime {
48
+ return this.#createdOn;
49
+ }
50
+
51
+ set createdOn(value: DateTime) {
52
+ this.#createdOn = value;
53
+ }
54
+
55
+ get updatedOn(): DateTime {
56
+ return this.#updatedOn;
57
+ }
58
+
59
+ set updatedOn(value: DateTime) {
60
+ this.#updatedOn = value;
61
+ }
62
+
63
+ #id: string;
64
+ #type: EmailTemplateType;
65
+ #language: EmailTemplateLanguage | null;
66
+ #subject: string;
67
+ #content: string;
68
+ #createdOn: DateTime;
69
+ #updatedOn: DateTime;
70
+
71
+ constructor(id: string, type: EmailTemplateType, language: EmailTemplateLanguage | null, subject: string, content: string, createdOn: DateTime, updatedOn: DateTime) {
72
+ this.#id = id;
73
+ this.#type = type;
74
+ this.#language = language;
75
+ this.#subject = subject;
76
+ this.#content = content;
77
+ this.#createdOn = createdOn;
78
+ this.#updatedOn = updatedOn;
79
+ }
80
+ }
@@ -0,0 +1,28 @@
1
+ import { dto } from '@basmilius/http-client';
2
+
3
+ @dto
4
+ export class RenderedMailDto {
5
+ get subject(): string {
6
+ return this.#subject;
7
+ }
8
+
9
+ set subject(value: string) {
10
+ this.#subject = value;
11
+ }
12
+
13
+ get content(): string {
14
+ return this.#content;
15
+ }
16
+
17
+ set content(value: string) {
18
+ this.#content = value;
19
+ }
20
+
21
+ #subject: string;
22
+ #content: string;
23
+
24
+ constructor(subject: string, content: string) {
25
+ this.#subject = subject;
26
+ this.#content = content;
27
+ }
28
+ }
@@ -0,0 +1,2 @@
1
+ export * from './EmailTemplateDto';
2
+ export * from './RenderedMailDto';
@@ -0,0 +1,9 @@
1
+ import { dto } from '@basmilius/http-client';
2
+ import { ShopElementDto } from '#data/dto';
3
+
4
+ @dto
5
+ export class ShopElementInformationDto extends ShopElementDto {
6
+ constructor(id: string) {
7
+ super(id, 'information');
8
+ }
9
+ }
@@ -17,6 +17,7 @@ export * from './ShopElementDto';
17
17
  export * from './ShopElementButtonDto';
18
18
  export * from './ShopElementDividerDto';
19
19
  export * from './ShopElementHeadingDto';
20
+ export * from './ShopElementInformationDto';
20
21
  export * from './ShopElementNoticeDto';
21
22
  export * from './ShopElementProductDto';
22
23
  export * from './ShopElementTextDto';
package/src/dto/index.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  export * from './address';
2
2
  export * from './auth';
3
3
  export * from './common';
4
+ export * from './emailTemplate';
4
5
  export * from './event';
5
6
  export * from './fileSystem';
6
7
  export * from './finance';
@@ -1,6 +1,7 @@
1
1
  import { dto } from '@basmilius/http-client';
2
2
  import type { DateTime } from 'luxon';
3
3
  import type { UserDto } from '#data/dto';
4
+ import type { Claim } from '#data/types';
4
5
 
5
6
  @dto
6
7
  export class MerchantUserDto {
@@ -12,6 +13,14 @@ export class MerchantUserDto {
12
13
  this.#isManager = value;
13
14
  }
14
15
 
16
+ get claims(): Claim[] {
17
+ return this.#claims;
18
+ }
19
+
20
+ set claims(value: Claim[]) {
21
+ this.#claims = value;
22
+ }
23
+
15
24
  get createdOn(): DateTime {
16
25
  return this.#createdOn;
17
26
  }
@@ -37,12 +46,14 @@ export class MerchantUserDto {
37
46
  }
38
47
 
39
48
  #isManager: boolean;
49
+ #claims: Claim[];
40
50
  #createdOn: DateTime;
41
51
  #updatedOn: DateTime;
42
52
  #user: UserDto;
43
53
 
44
- constructor(isManager: boolean, createdOn: DateTime, updatedOn: DateTime, user: UserDto) {
54
+ constructor(isManager: boolean, claims: Claim[], createdOn: DateTime, updatedOn: DateTime, user: UserDto) {
45
55
  this.#isManager = isManager;
56
+ this.#claims = claims;
46
57
  this.#createdOn = createdOn;
47
58
  this.#updatedOn = updatedOn;
48
59
  this.#user = user;
@@ -1,4 +1,5 @@
1
1
  import { dto } from '@basmilius/http-client';
2
+ import type { DateTime } from 'luxon';
2
3
  import type { CostDto, PictureDto, StockPoolDto } from '#data/dto';
3
4
  import type { ProductType } from '#data/types';
4
5
 
@@ -100,6 +101,14 @@ export class ProductDto {
100
101
  this.#images = value;
101
102
  }
102
103
 
104
+ get ticketsReleasedOn(): DateTime | null {
105
+ return this.#ticketsReleasedOn;
106
+ }
107
+
108
+ set ticketsReleasedOn(value: DateTime | null) {
109
+ this.#ticketsReleasedOn = value;
110
+ }
111
+
103
112
  #id: string;
104
113
  #type: ProductType;
105
114
  #name: string;
@@ -112,8 +121,9 @@ export class ProductDto {
112
121
  #stock: StockPoolDto;
113
122
  #image: PictureDto;
114
123
  #images: PictureDto[];
124
+ #ticketsReleasedOn: DateTime | null;
115
125
 
116
- constructor(id: string, type: ProductType, name: string, description: string, price: CostDto, maxQuantity: number, isActive: boolean, isSwappable: boolean, remainingStock: number, stock: StockPoolDto, image: PictureDto, images: PictureDto[]) {
126
+ constructor(id: string, type: ProductType, name: string, description: string, price: CostDto, maxQuantity: number, isActive: boolean, isSwappable: boolean, remainingStock: number, stock: StockPoolDto, image: PictureDto, images: PictureDto[], ticketsReleasedOn: DateTime | null) {
117
127
  this.#id = id;
118
128
  this.#type = type;
119
129
  this.#name = name;
@@ -126,5 +136,6 @@ export class ProductDto {
126
136
  this.#stock = stock;
127
137
  this.#image = image;
128
138
  this.#images = images;
139
+ this.#ticketsReleasedOn = ticketsReleasedOn;
129
140
  }
130
141
  }
@@ -0,0 +1,9 @@
1
+ import { dto } from '@basmilius/http-client';
2
+ import { PublicShopElementDto } from '#data/dto';
3
+
4
+ @dto
5
+ export class PublicShopElementInformationDto extends PublicShopElementDto {
6
+ constructor(id: string) {
7
+ super(id, 'information');
8
+ }
9
+ }
@@ -1,4 +1,5 @@
1
1
  import { dto } from '@basmilius/http-client';
2
+ import type { DateTime } from 'luxon';
2
3
  import type { AddressDto, PictureDto } from '#data/dto';
3
4
  import type { EventStatus } from '#data/types';
4
5
 
@@ -20,6 +21,14 @@ export class PublicShopEventDto {
20
21
  this.#name = value;
21
22
  }
22
23
 
24
+ get description(): string {
25
+ return this.#description;
26
+ }
27
+
28
+ set description(value: string) {
29
+ this.#description = value;
30
+ }
31
+
23
32
  get status(): EventStatus {
24
33
  return this.#status;
25
34
  }
@@ -44,17 +53,49 @@ export class PublicShopEventDto {
44
53
  this.#headerFile = value;
45
54
  }
46
55
 
56
+ get minimumAge(): number {
57
+ return this.#minimumAge;
58
+ }
59
+
60
+ set minimumAge(value: number) {
61
+ this.#minimumAge = value;
62
+ }
63
+
64
+ get startsOn(): DateTime {
65
+ return this.#startsOn;
66
+ }
67
+
68
+ set startsOn(value: DateTime) {
69
+ this.#startsOn = value;
70
+ }
71
+
72
+ get endsOn(): DateTime {
73
+ return this.#endsOn;
74
+ }
75
+
76
+ set endsOn(value: DateTime) {
77
+ this.#endsOn = value;
78
+ }
79
+
47
80
  #id: string;
48
81
  #name: string;
82
+ #description: string;
49
83
  #status: EventStatus;
50
84
  #address: AddressDto;
51
85
  #headerFile: PictureDto | null;
86
+ #minimumAge: number;
87
+ #startsOn: DateTime;
88
+ #endsOn: DateTime;
52
89
 
53
- constructor(id: string, name: string, status: EventStatus, address: AddressDto, headerFile: PictureDto | null) {
90
+ constructor(id: string, name: string, description: string, status: EventStatus, address: AddressDto, headerFile: PictureDto | null, minimumAge: number, startsOn: DateTime, endsOn: DateTime) {
54
91
  this.#id = id;
55
92
  this.#name = name;
93
+ this.#description = description;
56
94
  this.#status = status;
57
95
  this.#address = address;
58
96
  this.#headerFile = headerFile;
97
+ this.#minimumAge = minimumAge;
98
+ this.#startsOn = startsOn;
99
+ this.#endsOn = endsOn;
59
100
  }
60
101
  }
@@ -5,6 +5,7 @@ export * from './PublicShopElementDto';
5
5
  export * from './PublicShopElementButtonDto';
6
6
  export * from './PublicShopElementDividerDto';
7
7
  export * from './PublicShopElementHeadingDto';
8
+ export * from './PublicShopElementInformationDto';
8
9
  export * from './PublicShopElementNoticeDto';
9
10
  export * from './PublicShopElementProductDto';
10
11
  export * from './PublicShopElementTextDto';
@@ -0,0 +1,15 @@
1
+ import { type BaseResponse, BaseService, QueryString } from '@basmilius/http-client';
2
+ import { MerchantAdapter } from '#data/adapter';
3
+ import { MerchantDto } from '#data/dto';
4
+
5
+ export class AdminMerchantService extends BaseService {
6
+ async get(merchantId: string): Promise<BaseResponse<MerchantDto>> {
7
+ return await this
8
+ .request(`/admin/merchants/${merchantId}`)
9
+ .method('get')
10
+ .queryString(QueryString.builder()
11
+ .append('language', 'nl'))
12
+ .bearerToken()
13
+ .runAdapter(MerchantAdapter.parseMerchant);
14
+ }
15
+ }
@@ -0,0 +1,17 @@
1
+ import { type BaseResponse, BaseService, type Paginated, QueryString } from '@basmilius/http-client';
2
+ import { MerchantAdapter } from '#data/adapter';
3
+ import { MerchantDto } from '#data/dto';
4
+
5
+ export class AdminMerchantsService extends BaseService {
6
+ async get(offset: number, limit: number): Promise<BaseResponse<Paginated<MerchantDto>>> {
7
+ return await this
8
+ .request('/admin/merchants')
9
+ .method('get')
10
+ .queryString(QueryString.builder()
11
+ .append('language', 'nl')
12
+ .append('offset', offset)
13
+ .append('limit', limit))
14
+ .bearerToken()
15
+ .runPaginatedAdapter(MerchantAdapter.parseMerchant);
16
+ }
17
+ }
@@ -0,0 +1,4 @@
1
+ import { BaseService } from '@basmilius/http-client';
2
+
3
+ export class AdminService extends BaseService {
4
+ }