@passly-nl/data 1.4.0 → 1.4.2
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.
- package/dist/index.d.mts +27 -6
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +98 -11
- package/dist/index.mjs.map +1 -1
- package/package.json +6 -6
- package/src/adapter/EventAdapter.ts +2 -1
- package/src/adapter/ProductAdapter.ts +6 -1
- package/src/adapter/PublicShopAdapter.ts +4 -1
- package/src/dto/event/AppTeamDto.ts +11 -1
- package/src/dto/product/ProductDto.ts +52 -2
- package/src/dto/publicShop/PublicShopProductDto.ts +33 -2
- package/src/service/MerchantEventAppTeamService.ts +2 -1
- package/src/service/MerchantEventAppTeamsService.ts +3 -2
- package/src/service/MerchantEventProductService.ts +5 -2
- package/src/service/MerchantEventStockPoolsService.ts +23 -0
- package/src/types/product.ts +7 -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.4.
|
|
4
|
+
"version": "1.4.2",
|
|
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
|
"devDependencies": {
|
|
53
|
-
"@basmilius/http-client": "^3.
|
|
54
|
-
"@flux-ui/types": "^3.
|
|
53
|
+
"@basmilius/http-client": "^3.50.0",
|
|
54
|
+
"@flux-ui/types": "^3.2.0",
|
|
55
55
|
"@types/luxon": "^3.7.2",
|
|
56
|
-
"@typescript/native-preview": "^7.0.0-dev.
|
|
56
|
+
"@typescript/native-preview": "^7.0.0-dev.20260704.1",
|
|
57
57
|
"luxon": "^3.7.2",
|
|
58
58
|
"tsdown": "^0.22.3"
|
|
59
59
|
},
|
|
60
60
|
"peerDependencies": {
|
|
61
|
-
"@basmilius/http-client": "^3.
|
|
62
|
-
"@flux-ui/types": "^3.
|
|
61
|
+
"@basmilius/http-client": "^3.50.0",
|
|
62
|
+
"@flux-ui/types": "^3.2.0",
|
|
63
63
|
"luxon": "^3.7.2"
|
|
64
64
|
}
|
|
65
65
|
}
|
|
@@ -14,7 +14,8 @@ export class EventAdapter {
|
|
|
14
14
|
data.checkout_count,
|
|
15
15
|
optional(data.creator, AuthAdapter.parseUser),
|
|
16
16
|
optional(data.event, EventAdapter.parseEvent),
|
|
17
|
-
optional(data.merchant, MerchantAdapter.parseMerchant)
|
|
17
|
+
optional(data.merchant, MerchantAdapter.parseMerchant),
|
|
18
|
+
(data.products ?? []).map((product: { id: string }) => product.id)
|
|
18
19
|
);
|
|
19
20
|
}
|
|
20
21
|
|
|
@@ -23,7 +23,12 @@ export class ProductAdapter {
|
|
|
23
23
|
data.has_sales,
|
|
24
24
|
optional(data.image, FileSystemAdapter.parsePicture),
|
|
25
25
|
optionalArray(data.images, FileSystemAdapter.parsePicture)!,
|
|
26
|
-
optional(data.tickets_released_on, DateTimeAdapter.parseDateTime)
|
|
26
|
+
optional(data.tickets_released_on, DateTimeAdapter.parseDateTime),
|
|
27
|
+
data.show_when_unavailable,
|
|
28
|
+
optional(data.sale_starts_on, DateTimeAdapter.parseDateTime),
|
|
29
|
+
optional(data.sale_ends_on, DateTimeAdapter.parseDateTime),
|
|
30
|
+
data.availability,
|
|
31
|
+
data.sold
|
|
27
32
|
);
|
|
28
33
|
}
|
|
29
34
|
}
|
|
@@ -118,7 +118,10 @@ export class PublicShopAdapter {
|
|
|
118
118
|
data.is_timeslotted,
|
|
119
119
|
optionalArray(data.time_slots, PublicShopAdapter.parsePublicShopTimeSlot)!,
|
|
120
120
|
optional(data.image, FileSystemAdapter.parsePicture),
|
|
121
|
-
optionalArray(data.images, FileSystemAdapter.parsePicture)
|
|
121
|
+
optionalArray(data.images, FileSystemAdapter.parsePicture)!,
|
|
122
|
+
data.availability,
|
|
123
|
+
optional(data.sale_starts_on, DateTimeAdapter.parseDateTime),
|
|
124
|
+
optional(data.sale_ends_on, DateTimeAdapter.parseDateTime)
|
|
122
125
|
);
|
|
123
126
|
}
|
|
124
127
|
|
|
@@ -67,6 +67,14 @@ export class AppTeamDto {
|
|
|
67
67
|
this.#merchant = value;
|
|
68
68
|
}
|
|
69
69
|
|
|
70
|
+
get productIds(): string[] {
|
|
71
|
+
return this.#productIds;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
set productIds(value: string[]) {
|
|
75
|
+
this.#productIds = value;
|
|
76
|
+
}
|
|
77
|
+
|
|
70
78
|
#id: string;
|
|
71
79
|
#name: string;
|
|
72
80
|
#secret: string;
|
|
@@ -75,8 +83,9 @@ export class AppTeamDto {
|
|
|
75
83
|
#creator: UserDto;
|
|
76
84
|
#event: EventDto;
|
|
77
85
|
#merchant: MerchantDto;
|
|
86
|
+
#productIds: string[];
|
|
78
87
|
|
|
79
|
-
constructor(id: string, name: string, secret: string, checkinCount: number, checkoutCount: number, creator: UserDto, event: EventDto, merchant: MerchantDto) {
|
|
88
|
+
constructor(id: string, name: string, secret: string, checkinCount: number, checkoutCount: number, creator: UserDto, event: EventDto, merchant: MerchantDto, productIds: string[]) {
|
|
80
89
|
this.#id = id;
|
|
81
90
|
this.#name = name;
|
|
82
91
|
this.#secret = secret;
|
|
@@ -85,5 +94,6 @@ export class AppTeamDto {
|
|
|
85
94
|
this.#creator = creator;
|
|
86
95
|
this.#event = event;
|
|
87
96
|
this.#merchant = merchant;
|
|
97
|
+
this.#productIds = productIds;
|
|
88
98
|
}
|
|
89
99
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { dto } from '@basmilius/http-client';
|
|
2
2
|
import type { DateTime } from 'luxon';
|
|
3
3
|
import type { CostDto, PictureDto, StockPoolDto, TimeSlotDto } from '#data/dto';
|
|
4
|
-
import type { ProductType } from '#data/types';
|
|
4
|
+
import type { ProductAvailability, ProductType } from '#data/types';
|
|
5
5
|
|
|
6
6
|
@dto
|
|
7
7
|
export class ProductDto {
|
|
@@ -141,6 +141,46 @@ export class ProductDto {
|
|
|
141
141
|
this.#ticketsReleasedOn = value;
|
|
142
142
|
}
|
|
143
143
|
|
|
144
|
+
get showWhenUnavailable(): boolean {
|
|
145
|
+
return this.#showWhenUnavailable;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
set showWhenUnavailable(value: boolean) {
|
|
149
|
+
this.#showWhenUnavailable = value;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
get saleStartsOn(): DateTime | null {
|
|
153
|
+
return this.#saleStartsOn;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
set saleStartsOn(value: DateTime | null) {
|
|
157
|
+
this.#saleStartsOn = value;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
get saleEndsOn(): DateTime | null {
|
|
161
|
+
return this.#saleEndsOn;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
set saleEndsOn(value: DateTime | null) {
|
|
165
|
+
this.#saleEndsOn = value;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
get availability(): ProductAvailability {
|
|
169
|
+
return this.#availability;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
set availability(value: ProductAvailability) {
|
|
173
|
+
this.#availability = value;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
get sold(): number {
|
|
177
|
+
return this.#sold;
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
set sold(value: number) {
|
|
181
|
+
this.#sold = value;
|
|
182
|
+
}
|
|
183
|
+
|
|
144
184
|
#id: string;
|
|
145
185
|
#type: ProductType;
|
|
146
186
|
#name: string;
|
|
@@ -158,8 +198,13 @@ export class ProductDto {
|
|
|
158
198
|
#image: PictureDto;
|
|
159
199
|
#images: PictureDto[];
|
|
160
200
|
#ticketsReleasedOn: DateTime | null;
|
|
201
|
+
#showWhenUnavailable: boolean;
|
|
202
|
+
#saleStartsOn: DateTime | null;
|
|
203
|
+
#saleEndsOn: DateTime | null;
|
|
204
|
+
#availability: ProductAvailability;
|
|
205
|
+
#sold: number;
|
|
161
206
|
|
|
162
|
-
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) {
|
|
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) {
|
|
163
208
|
this.#id = id;
|
|
164
209
|
this.#type = type;
|
|
165
210
|
this.#name = name;
|
|
@@ -177,5 +222,10 @@ export class ProductDto {
|
|
|
177
222
|
this.#image = image;
|
|
178
223
|
this.#images = images;
|
|
179
224
|
this.#ticketsReleasedOn = ticketsReleasedOn;
|
|
225
|
+
this.#showWhenUnavailable = showWhenUnavailable;
|
|
226
|
+
this.#saleStartsOn = saleStartsOn;
|
|
227
|
+
this.#saleEndsOn = saleEndsOn;
|
|
228
|
+
this.#availability = availability;
|
|
229
|
+
this.#sold = sold;
|
|
180
230
|
}
|
|
181
231
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { dto } from '@basmilius/http-client';
|
|
2
|
+
import type { DateTime } from 'luxon';
|
|
2
3
|
import type { CostDto, PictureDto, PublicShopTimeSlotDto } from '#data/dto';
|
|
3
|
-
import type { ProductType } from '#data/types';
|
|
4
|
+
import type { ProductAvailability, ProductType } from '#data/types';
|
|
4
5
|
|
|
5
6
|
@dto
|
|
6
7
|
export class PublicShopProductDto {
|
|
@@ -92,6 +93,30 @@ export class PublicShopProductDto {
|
|
|
92
93
|
this.#images = value;
|
|
93
94
|
}
|
|
94
95
|
|
|
96
|
+
get availability(): ProductAvailability {
|
|
97
|
+
return this.#availability;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
set availability(value: ProductAvailability) {
|
|
101
|
+
this.#availability = value;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
get saleStartsOn(): DateTime | null {
|
|
105
|
+
return this.#saleStartsOn;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
set saleStartsOn(value: DateTime | null) {
|
|
109
|
+
this.#saleStartsOn = value;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
get saleEndsOn(): DateTime | null {
|
|
113
|
+
return this.#saleEndsOn;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
set saleEndsOn(value: DateTime | null) {
|
|
117
|
+
this.#saleEndsOn = value;
|
|
118
|
+
}
|
|
119
|
+
|
|
95
120
|
#id: string;
|
|
96
121
|
#type: ProductType;
|
|
97
122
|
#name: string;
|
|
@@ -103,8 +128,11 @@ export class PublicShopProductDto {
|
|
|
103
128
|
#timeSlots: PublicShopTimeSlotDto[];
|
|
104
129
|
#image: PictureDto | null;
|
|
105
130
|
#images: PictureDto[];
|
|
131
|
+
#availability: ProductAvailability;
|
|
132
|
+
#saleStartsOn: DateTime | null;
|
|
133
|
+
#saleEndsOn: DateTime | null;
|
|
106
134
|
|
|
107
|
-
constructor(id: string, type: ProductType, name: string, description: string, price: CostDto, maxQuantity: number, isActive: boolean, isTimeslotted: boolean, timeSlots: PublicShopTimeSlotDto[], image: PictureDto | null, images: PictureDto[]) {
|
|
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) {
|
|
108
136
|
this.#id = id;
|
|
109
137
|
this.#type = type;
|
|
110
138
|
this.#name = name;
|
|
@@ -116,5 +144,8 @@ export class PublicShopProductDto {
|
|
|
116
144
|
this.#timeSlots = timeSlots;
|
|
117
145
|
this.#image = image;
|
|
118
146
|
this.#images = images;
|
|
147
|
+
this.#availability = availability;
|
|
148
|
+
this.#saleStartsOn = saleStartsOn;
|
|
149
|
+
this.#saleEndsOn = saleEndsOn;
|
|
119
150
|
}
|
|
120
151
|
}
|
|
@@ -31,7 +31,8 @@ export class MerchantEventAppTeamService extends BaseService {
|
|
|
31
31
|
.queryString(QueryString.builder()
|
|
32
32
|
.append('language', 'nl'))
|
|
33
33
|
.body({
|
|
34
|
-
name: appTeam.name
|
|
34
|
+
name: appTeam.name,
|
|
35
|
+
product_ids: appTeam.productIds
|
|
35
36
|
})
|
|
36
37
|
.runAdapter(EventAdapter.parseAppTeam);
|
|
37
38
|
}
|
|
@@ -14,7 +14,7 @@ export class MerchantEventAppTeamsService extends BaseService {
|
|
|
14
14
|
.runPaginatedAdapter(EventAdapter.parseAppTeam);
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
-
async post(merchantId: string, eventId: string, name: string): Promise<BaseResponse<AppTeamDto>> {
|
|
17
|
+
async post(merchantId: string, eventId: string, name: string, productIds: string[] = []): Promise<BaseResponse<AppTeamDto>> {
|
|
18
18
|
return await this
|
|
19
19
|
.request(`/merchants/${merchantId}/events/${eventId}/app-teams`)
|
|
20
20
|
.method('post')
|
|
@@ -22,7 +22,8 @@ export class MerchantEventAppTeamsService extends BaseService {
|
|
|
22
22
|
.queryString(QueryString.builder()
|
|
23
23
|
.append('language', 'nl'))
|
|
24
24
|
.body({
|
|
25
|
-
name
|
|
25
|
+
name,
|
|
26
|
+
product_ids: productIds
|
|
26
27
|
})
|
|
27
28
|
.runAdapter(EventAdapter.parseAppTeam);
|
|
28
29
|
}
|
|
@@ -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): 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): Promise<BaseResponse<ProductDto>> {
|
|
46
46
|
return await this
|
|
47
47
|
.request(`/merchants/${merchantId}/events/${eventId}/products/${productId}/sales`)
|
|
48
48
|
.method('patch')
|
|
@@ -53,7 +53,10 @@ export class MerchantEventProductService extends BaseService {
|
|
|
53
53
|
price,
|
|
54
54
|
max_quantity: maxQuantity,
|
|
55
55
|
is_swappable: isSwappable,
|
|
56
|
-
tickets_released_on: ticketsReleasedOn?.toISO() ?? null
|
|
56
|
+
tickets_released_on: ticketsReleasedOn?.toISO() ?? null,
|
|
57
|
+
show_when_unavailable: showWhenUnavailable,
|
|
58
|
+
sale_starts_on: saleStartsOn?.toISO() ?? null,
|
|
59
|
+
sale_ends_on: saleEndsOn?.toISO() ?? null
|
|
57
60
|
})
|
|
58
61
|
.runAdapter(ProductAdapter.parseProduct);
|
|
59
62
|
}
|
|
@@ -37,6 +37,29 @@ export class MerchantEventStockPoolsService extends BaseService {
|
|
|
37
37
|
.runArrayAdapter(FluxAdapter.parseFluxFormSelectEntry);
|
|
38
38
|
}
|
|
39
39
|
|
|
40
|
+
async getSingle(merchantId: string, eventId: string, stockPoolId: string): Promise<BaseResponse<StockPoolDto>> {
|
|
41
|
+
return await this
|
|
42
|
+
.request(`/merchants/${merchantId}/events/${eventId}/stock-pools/${stockPoolId}`)
|
|
43
|
+
.method('get')
|
|
44
|
+
.queryString(QueryString.builder()
|
|
45
|
+
.append('language', 'nl'))
|
|
46
|
+
.bearerToken()
|
|
47
|
+
.runAdapter(EventAdapter.parseStockPool);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
async patch(merchantId: string, eventId: string, stockPoolId: string, stock: number): Promise<BaseResponse<StockPoolDto>> {
|
|
51
|
+
return await this
|
|
52
|
+
.request(`/merchants/${merchantId}/events/${eventId}/stock-pools/${stockPoolId}`)
|
|
53
|
+
.method('patch')
|
|
54
|
+
.bearerToken()
|
|
55
|
+
.queryString(QueryString.builder()
|
|
56
|
+
.append('language', 'nl'))
|
|
57
|
+
.body({
|
|
58
|
+
stock
|
|
59
|
+
})
|
|
60
|
+
.runAdapter(EventAdapter.parseStockPool);
|
|
61
|
+
}
|
|
62
|
+
|
|
40
63
|
async post(merchantId: string, eventId: string, name: string, stock: number): Promise<BaseResponse<StockPoolDto>> {
|
|
41
64
|
return await this
|
|
42
65
|
.request(`/merchants/${merchantId}/events/${eventId}/stock-pools`)
|