@passly-nl/data 1.0.4 → 1.1.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 (131) hide show
  1. package/dist/index.d.mts +1116 -171
  2. package/dist/index.d.mts.map +1 -1
  3. package/dist/index.mjs +5 -5
  4. package/dist/index.mjs.map +1 -1
  5. package/package.json +15 -10
  6. package/src/adapter/AiChatAdapter.ts +37 -0
  7. package/src/adapter/AiUsageAdapter.ts +42 -0
  8. package/src/adapter/CashFlowAdapter.ts +70 -0
  9. package/src/adapter/ContentCalendarAdapter.ts +34 -0
  10. package/src/adapter/DiscountCodeAdapter.ts +33 -0
  11. package/src/adapter/EventAdapter.ts +8 -71
  12. package/src/adapter/EventStatisticsBuyersAdapter.ts +27 -0
  13. package/src/adapter/EventStatisticsOperationsAdapter.ts +41 -0
  14. package/src/adapter/EventStatisticsOverviewAdapter.ts +39 -0
  15. package/src/adapter/EventStatisticsSalesAdapter.ts +21 -0
  16. package/src/adapter/MarketingAttributionAdapter.ts +18 -0
  17. package/src/adapter/MerchantAdapter.ts +3 -1
  18. package/src/adapter/OrderAdapter.ts +6 -2
  19. package/src/adapter/ProductAdapter.ts +3 -0
  20. package/src/adapter/PublicShopAdapter.ts +1 -2
  21. package/src/adapter/RefundAdapter.ts +34 -0
  22. package/src/adapter/ReservationAdapter.ts +3 -2
  23. package/src/adapter/StatisticsEventsAdapter.ts +6 -2
  24. package/src/adapter/StatisticsGrowthAdapter.ts +38 -0
  25. package/src/adapter/StatisticsInsightsAdapter.ts +39 -0
  26. package/src/adapter/StatisticsOperationsAdapter.ts +47 -0
  27. package/src/adapter/SubscriptionAdapter.ts +32 -0
  28. package/src/adapter/TicketAdapter.ts +1 -0
  29. package/src/adapter/index.ts +16 -1
  30. package/src/dto/aiChat/AiChatConversationDto.ts +49 -0
  31. package/src/dto/aiChat/AiChatMessageDto.ts +73 -0
  32. package/src/dto/aiChat/AiChatToolCallDto.ts +58 -0
  33. package/src/dto/aiChat/index.ts +3 -0
  34. package/src/dto/aiUsage/AiUsageDto.ts +110 -0
  35. package/src/dto/aiUsage/AiUsageFeatureStatusDto.ts +39 -0
  36. package/src/dto/aiUsage/AiUsagePeriodDto.ts +80 -0
  37. package/src/dto/aiUsage/index.ts +3 -0
  38. package/src/dto/cashFlow/CashFlowDiscountDto.ts +40 -0
  39. package/src/dto/cashFlow/CashFlowDto.ts +99 -0
  40. package/src/dto/cashFlow/CashFlowPaymentDto.ts +50 -0
  41. package/src/dto/cashFlow/CashFlowPlatformCostDto.ts +29 -0
  42. package/src/dto/cashFlow/CashFlowRefundDto.ts +101 -0
  43. package/src/dto/cashFlow/CashFlowTimelineEventDto.ts +71 -0
  44. package/src/dto/cashFlow/index.ts +6 -0
  45. package/src/dto/contentCalendar/ContentCalendarItemCreatorDto.ts +69 -0
  46. package/src/dto/contentCalendar/ContentCalendarItemDto.ts +133 -0
  47. package/src/dto/contentCalendar/index.ts +2 -0
  48. package/src/dto/discountCode/DiscountCodeDto.ts +141 -0
  49. package/src/dto/discountCode/index.ts +1 -0
  50. package/src/dto/event/TimeSlotDto.ts +59 -0
  51. package/src/dto/event/index.ts +1 -9
  52. package/src/dto/eventStatistics/EventStatisticsAppTeamDto.ts +58 -0
  53. package/src/dto/{event/EventStatisticsBuyerTotalsDto.ts → eventStatistics/EventStatisticsBuyersOverviewDto.ts} +18 -18
  54. package/src/dto/{event → eventStatistics}/EventStatisticsFinancialDto.ts +11 -1
  55. package/src/dto/eventStatistics/EventStatisticsKpisDto.ts +119 -0
  56. package/src/dto/eventStatistics/EventStatisticsOperationsOverviewDto.ts +58 -0
  57. package/src/dto/eventStatistics/EventStatisticsSalesFlowChartDto.ts +66 -0
  58. package/src/dto/{event/EventStatisticsOrderTotalsDto.ts → eventStatistics/EventStatisticsStatusDto.ts} +1 -1
  59. package/src/dto/{event/EventStatisticsSwapTotalsDto.ts → eventStatistics/EventStatisticsSwapsDto.ts} +1 -1
  60. package/src/dto/eventStatistics/index.ts +9 -0
  61. package/src/dto/index.ts +10 -0
  62. package/src/dto/marketingAttribution/MarketingAttributionDto.ts +88 -0
  63. package/src/dto/marketingAttribution/index.ts +1 -0
  64. package/src/dto/merchant/MerchantDto.ts +39 -2
  65. package/src/dto/order/OrderDto.ts +42 -2
  66. package/src/dto/product/ProductDto.ts +32 -2
  67. package/src/dto/publicShop/PublicShopCartProductDto.ts +1 -11
  68. package/src/dto/publicShop/PublicShopTimeSlotDto.ts +1 -11
  69. package/src/dto/realtime/AiChatMessageCompletedMessageDto.ts +9 -0
  70. package/src/dto/realtime/ContentCalendarGenerationCompletedMessageDto.ts +8 -0
  71. package/src/dto/realtime/InsightCardCompletedMessageDto.ts +9 -0
  72. package/src/dto/realtime/index.ts +3 -0
  73. package/src/dto/refund/RefundDto.ts +91 -0
  74. package/src/dto/{event/EventStatisticsScansPerAppTeamDto.ts → refund/RefundInitiatorDto.ts} +2 -12
  75. package/src/dto/refund/RefundTicketRefDto.ts +28 -0
  76. package/src/dto/refund/index.ts +3 -0
  77. package/src/dto/reservation/ReservationDto.ts +12 -2
  78. package/src/dto/statistics/InsightDto.ts +130 -0
  79. package/src/dto/statistics/InsightSignalDto.ts +29 -0
  80. package/src/dto/statistics/InsightsResponseDto.ts +50 -0
  81. package/src/dto/statistics/MilestoneDto.ts +80 -0
  82. package/src/dto/statistics/StatisticsGrowthOverviewDto.ts +59 -0
  83. package/src/dto/statistics/StatisticsOperationsAppTeamDto.ts +78 -0
  84. package/src/dto/statistics/StatisticsOperationsOverviewDto.ts +58 -0
  85. package/src/dto/statistics/StatisticsOperationsTaskAssigneeDto.ts +48 -0
  86. package/src/dto/statistics/StatisticsOperationsTasksOverviewDto.ts +69 -0
  87. package/src/dto/statistics/index.ts +9 -0
  88. package/src/dto/subscription/MerchantSubscriptionDto.ts +91 -0
  89. package/src/dto/subscription/SubscriptionPlanDto.ts +80 -0
  90. package/src/dto/subscription/index.ts +2 -0
  91. package/src/dto/ticket/TicketDto.ts +11 -1
  92. package/src/service/AdminMerchantSubscriptionService.ts +34 -0
  93. package/src/service/MerchantAiChatService.ts +51 -0
  94. package/src/service/MerchantAiSettingsService.ts +14 -0
  95. package/src/service/MerchantAiUsageService.ts +32 -0
  96. package/src/service/MerchantDiscountCodeService.ts +42 -0
  97. package/src/service/MerchantDiscountCodesService.ts +45 -0
  98. package/src/service/MerchantEventContentCalendarService.ts +122 -0
  99. package/src/service/MerchantEventProductService.ts +34 -8
  100. package/src/service/MerchantEventProductsService.ts +3 -2
  101. package/src/service/MerchantEventStatisticsBuyersService.ts +86 -0
  102. package/src/service/MerchantEventStatisticsOperationsService.ts +56 -0
  103. package/src/service/MerchantEventStatisticsOverviewService.ts +35 -0
  104. package/src/service/MerchantEventStatisticsSalesService.ts +76 -0
  105. package/src/service/MerchantEventTimeSlotService.ts +51 -0
  106. package/src/service/MerchantEventTimeSlotsService.ts +33 -0
  107. package/src/service/MerchantOrderService.ts +28 -2
  108. package/src/service/MerchantStatisticsEventsService.ts +43 -1
  109. package/src/service/MerchantStatisticsGrowthService.ts +37 -0
  110. package/src/service/MerchantStatisticsInsightsService.ts +15 -0
  111. package/src/service/MerchantStatisticsOperationsService.ts +57 -0
  112. package/src/service/PublicOrderService.ts +30 -0
  113. package/src/service/PublicShopService.ts +25 -7
  114. package/src/service/index.ts +17 -2
  115. package/src/types/aiUsage.ts +5 -0
  116. package/src/types/auth.ts +2 -0
  117. package/src/types/cashFlow.ts +10 -0
  118. package/src/types/contentCalendar.ts +3 -0
  119. package/src/types/discountCode.ts +8 -0
  120. package/src/types/feature.ts +14 -0
  121. package/src/types/general.ts +11 -0
  122. package/src/types/index.ts +9 -0
  123. package/src/types/insights.ts +24 -0
  124. package/src/types/milestone.ts +7 -0
  125. package/src/types/refund.ts +12 -0
  126. package/src/types/subscription.ts +1 -0
  127. package/src/dto/event/EventStatisticsOrdersDto.ts +0 -30
  128. package/src/dto/event/EventStatisticsScanTotalsDto.ts +0 -38
  129. package/src/dto/event/EventStatisticsScansDto.ts +0 -40
  130. package/src/service/MerchantEventStatisticsService.ts +0 -65
  131. /package/src/dto/{event → eventStatistics}/EventStatisticsAttendanceDto.ts +0 -0
@@ -0,0 +1,34 @@
1
+ import { BaseResponse, BaseService } from '@basmilius/http-client';
2
+ import { SubscriptionAdapter } from '#data/adapter';
3
+ import type { MerchantSubscriptionDto, SubscriptionPlanDto } from '#data/dto';
4
+ import type { SubscriptionType } from '#data/types';
5
+
6
+ export class AdminMerchantSubscriptionService extends BaseService {
7
+ async list(merchantId: string): Promise<BaseResponse<{ available: SubscriptionPlanDto[]; active: MerchantSubscriptionDto[]; }>> {
8
+ return await this
9
+ .request(`/admin/merchants/${merchantId}/subscriptions`)
10
+ .method('get')
11
+ .bearerToken()
12
+ .runAdapter((data: any) => ({
13
+ available: (data.available ?? []).map(SubscriptionAdapter.parseSubscriptionPlan),
14
+ active: (data.active ?? []).map(SubscriptionAdapter.parseMerchantSubscription)
15
+ }));
16
+ }
17
+
18
+ async activate(merchantId: string, planKey: string): Promise<BaseResponse<MerchantSubscriptionDto>> {
19
+ return await this
20
+ .request(`/admin/merchants/${merchantId}/subscriptions/activate`)
21
+ .method('post')
22
+ .bearerToken()
23
+ .body({plan_key: planKey})
24
+ .runAdapter(SubscriptionAdapter.parseMerchantSubscription);
25
+ }
26
+
27
+ async cancel(merchantId: string, type: SubscriptionType): Promise<BaseResponse<unknown>> {
28
+ return await this
29
+ .request(`/admin/merchants/${merchantId}/subscriptions/type/${type}`)
30
+ .method('delete')
31
+ .bearerToken()
32
+ .run();
33
+ }
34
+ }
@@ -0,0 +1,51 @@
1
+ import { BaseResponse, BaseService, type ForeignData } from '@basmilius/http-client';
2
+ import { AiChatAdapter } from '#data/adapter';
3
+ import type { AiChatConversationDto, AiChatMessageDto } from '#data/dto';
4
+
5
+ export class MerchantAiChatService extends BaseService {
6
+ async listConversations(merchantId: string): Promise<BaseResponse<AiChatConversationDto[]>> {
7
+ return await this
8
+ .request(`/merchants/${merchantId}/ai-chat`)
9
+ .method('get')
10
+ .bearerToken()
11
+ .runArrayAdapter(AiChatAdapter.parseConversation);
12
+ }
13
+
14
+ async createConversation(merchantId: string, title?: string | null): Promise<BaseResponse<AiChatConversationDto>> {
15
+ return await this
16
+ .request(`/merchants/${merchantId}/ai-chat`)
17
+ .method('post')
18
+ .bearerToken()
19
+ .body({
20
+ title: title ?? null
21
+ })
22
+ .runAdapter(AiChatAdapter.parseConversation);
23
+ }
24
+
25
+ async getMessages(merchantId: string, conversationId: string): Promise<BaseResponse<AiChatMessageDto[]>> {
26
+ return await this
27
+ .request(`/merchants/${merchantId}/ai-chat/${conversationId}/messages`)
28
+ .method('get')
29
+ .bearerToken()
30
+ .runArrayAdapter(AiChatAdapter.parseMessage);
31
+ }
32
+
33
+ async postMessage(merchantId: string, conversationId: string, content: string): Promise<BaseResponse<{ userMessage: AiChatMessageDto }>> {
34
+ return await this
35
+ .request(`/merchants/${merchantId}/ai-chat/${conversationId}/messages`)
36
+ .method('post')
37
+ .bearerToken()
38
+ .body({content})
39
+ .runAdapter((data: ForeignData) => ({
40
+ userMessage: AiChatAdapter.parseMessage(data.user_message)
41
+ }));
42
+ }
43
+
44
+ async deleteConversation(merchantId: string, conversationId: string): Promise<BaseResponse<unknown>> {
45
+ return await this
46
+ .request(`/merchants/${merchantId}/ai-chat/${conversationId}`)
47
+ .method('delete')
48
+ .bearerToken()
49
+ .run();
50
+ }
51
+ }
@@ -0,0 +1,14 @@
1
+ import { BaseResponse, BaseService } from '@basmilius/http-client';
2
+
3
+ export class MerchantAiSettingsService extends BaseService {
4
+ async put(merchantId: string, settings: { aiBrandVoice: string | null; }): Promise<BaseResponse<{ ai_brand_voice: string | null }>> {
5
+ return await this
6
+ .request(`/merchants/${merchantId}/ai/settings`)
7
+ .method('put')
8
+ .bearerToken()
9
+ .body({
10
+ ai_brand_voice: settings.aiBrandVoice
11
+ })
12
+ .run();
13
+ }
14
+ }
@@ -0,0 +1,32 @@
1
+ import { BaseResponse, BaseService, QueryString } from '@basmilius/http-client';
2
+ import { AiUsageAdapter } from '#data/adapter';
3
+ import type { AiUsageDto, AiUsagePeriodDto } from '#data/dto';
4
+
5
+ export class MerchantAiUsageService extends BaseService {
6
+ async getCurrent(merchantId: string): Promise<BaseResponse<AiUsagePeriodDto>> {
7
+ return await this
8
+ .request(`/merchants/${merchantId}/ai-usage`)
9
+ .method('get')
10
+ .bearerToken()
11
+ .runAdapter(AiUsageAdapter.parseAiUsagePeriod);
12
+ }
13
+
14
+ async getHistory(merchantId: string, params?: { feature?: string; limit?: number; }): Promise<BaseResponse<AiUsageDto[]>> {
15
+ const qs = QueryString.builder();
16
+
17
+ if (params?.feature) {
18
+ qs.append('feature', params.feature);
19
+ }
20
+
21
+ if (params?.limit) {
22
+ qs.append('limit', params.limit);
23
+ }
24
+
25
+ return await this
26
+ .request(`/merchants/${merchantId}/ai-usage/history`)
27
+ .method('get')
28
+ .queryString(qs)
29
+ .bearerToken()
30
+ .runArrayAdapter(AiUsageAdapter.parseAiUsage);
31
+ }
32
+ }
@@ -0,0 +1,42 @@
1
+ import { BaseResponse, BaseService, QueryString } from '@basmilius/http-client';
2
+ import type { DateTime } from 'luxon';
3
+ import { CommonAdapter, DiscountCodeAdapter } from '#data/adapter';
4
+ import type { DiscountCodeDto, StatusResponseDto } from '#data/dto';
5
+
6
+ export class MerchantDiscountCodeService extends BaseService {
7
+ async get(merchantId: string, discountCodeId: string): Promise<BaseResponse<DiscountCodeDto>> {
8
+ return await this
9
+ .request(`/merchants/${merchantId}/discount-codes/${discountCodeId}`)
10
+ .method('get')
11
+ .bearerToken()
12
+ .queryString(QueryString.builder()
13
+ .append('language', 'nl'))
14
+ .runAdapter(DiscountCodeAdapter.parseDiscountCode);
15
+ }
16
+
17
+ async put(merchantId: string, discountCodeId: string, validFrom: DateTime, validUntil: DateTime, unlimitedUses: boolean, maxUses: number | null): Promise<BaseResponse<DiscountCodeDto>> {
18
+ return await this
19
+ .request(`/merchants/${merchantId}/discount-codes/${discountCodeId}`)
20
+ .method('put')
21
+ .bearerToken()
22
+ .queryString(QueryString.builder()
23
+ .append('language', 'nl'))
24
+ .body({
25
+ valid_from: validFrom.toISO(),
26
+ valid_until: validUntil.toISO(),
27
+ unlimited_uses: unlimitedUses,
28
+ max_uses: maxUses
29
+ })
30
+ .runAdapter(DiscountCodeAdapter.parseDiscountCode);
31
+ }
32
+
33
+ async delete(merchantId: string, discountCodeId: string): Promise<BaseResponse<StatusResponseDto>> {
34
+ return await this
35
+ .request(`/merchants/${merchantId}/discount-codes/${discountCodeId}`)
36
+ .method('delete')
37
+ .bearerToken()
38
+ .queryString(QueryString.builder()
39
+ .append('language', 'nl'))
40
+ .runAdapter(CommonAdapter.parseStatusResponse);
41
+ }
42
+ }
@@ -0,0 +1,45 @@
1
+ import { BaseResponse, BaseService, Paginated, QueryString } from '@basmilius/http-client';
2
+ import type { DateTime } from 'luxon';
3
+ import { DiscountCodeAdapter } from '#data/adapter';
4
+ import type { DiscountCodeDto } from '#data/dto';
5
+ import type { DiscountCodeType } from '#data/types';
6
+
7
+ export class MerchantDiscountCodesService extends BaseService {
8
+ async get(merchantId: string, offset: number, limit: number, eventId: string | null = null): Promise<BaseResponse<Paginated<DiscountCodeDto>>> {
9
+ const qs = QueryString.builder()
10
+ .append('language', 'nl')
11
+ .append('offset', offset)
12
+ .append('limit', limit);
13
+
14
+ if (eventId !== null) {
15
+ qs.append('event_id', eventId);
16
+ }
17
+
18
+ return await this
19
+ .request(`/merchants/${merchantId}/discount-codes`)
20
+ .method('get')
21
+ .bearerToken()
22
+ .queryString(qs)
23
+ .runPaginatedAdapter(DiscountCodeAdapter.parseDiscountCode);
24
+ }
25
+
26
+ async post(merchantId: string, code: string, type: DiscountCodeType, validFrom: DateTime, validUntil: DateTime, percentage: number | null, amountCents: number | null, maxUses: number | null, eventId: string | null): Promise<BaseResponse<DiscountCodeDto>> {
27
+ return await this
28
+ .request(`/merchants/${merchantId}/discount-codes`)
29
+ .method('post')
30
+ .bearerToken()
31
+ .queryString(QueryString.builder()
32
+ .append('language', 'nl'))
33
+ .body({
34
+ code,
35
+ type,
36
+ valid_from: validFrom.toISO(),
37
+ valid_until: validUntil.toISO(),
38
+ percentage,
39
+ amount_cents: amountCents,
40
+ max_uses: maxUses,
41
+ event_id: eventId
42
+ })
43
+ .runAdapter(DiscountCodeAdapter.parseDiscountCode);
44
+ }
45
+ }
@@ -0,0 +1,122 @@
1
+ import { BaseResponse, BaseService, type ForeignData, QueryString } from '@basmilius/http-client';
2
+ import { ContentCalendarAdapter } from '#data/adapter';
3
+ import type { ContentCalendarItemDto } from '#data/dto';
4
+ import type { ContentCalendarItemChannel, ContentCalendarItemStatus } from '#data/types';
5
+
6
+ export class MerchantEventContentCalendarService extends BaseService {
7
+ async list(merchantId: string, eventId: string, params?: { from?: string; to?: string }): Promise<BaseResponse<ContentCalendarItemDto[]>> {
8
+ const qs = QueryString.builder();
9
+
10
+ if (params?.from) {
11
+ qs.append('from', params.from);
12
+ }
13
+
14
+ if (params?.to) {
15
+ qs.append('to', params.to);
16
+ }
17
+
18
+ return await this
19
+ .request(`/merchants/${merchantId}/events/${eventId}/content-calendar`)
20
+ .method('get')
21
+ .queryString(qs)
22
+ .bearerToken()
23
+ .runArrayAdapter(ContentCalendarAdapter.parseItem);
24
+ }
25
+
26
+ async create(merchantId: string, eventId: string, payload: ContentCalendarItemPayload): Promise<BaseResponse<ContentCalendarItemDto>> {
27
+ return await this
28
+ .request(`/merchants/${merchantId}/events/${eventId}/content-calendar`)
29
+ .method('post')
30
+ .bearerToken()
31
+ .body({
32
+ scheduled_on: payload.scheduledOn,
33
+ status: payload.status,
34
+ channel: payload.channel,
35
+ content: payload.content,
36
+ image_suggestion: payload.imageSuggestion
37
+ })
38
+ .runAdapter(ContentCalendarAdapter.parseItem);
39
+ }
40
+
41
+ async update(merchantId: string, eventId: string, itemId: string, payload: Partial<ContentCalendarItemPayload>): Promise<BaseResponse<ContentCalendarItemDto>> {
42
+ return await this
43
+ .request(`/merchants/${merchantId}/events/${eventId}/content-calendar/${itemId}`)
44
+ .method('patch')
45
+ .bearerToken()
46
+ .body({
47
+ scheduled_on: payload.scheduledOn,
48
+ status: payload.status,
49
+ channel: payload.channel,
50
+ content: payload.content,
51
+ image_suggestion: payload.imageSuggestion
52
+ })
53
+ .runAdapter(ContentCalendarAdapter.parseItem);
54
+ }
55
+
56
+ async delete(merchantId: string, eventId: string, itemId: string): Promise<BaseResponse<unknown>> {
57
+ return await this
58
+ .request(`/merchants/${merchantId}/events/${eventId}/content-calendar/${itemId}`)
59
+ .method('delete')
60
+ .bearerToken()
61
+ .run();
62
+ }
63
+
64
+ async generate(merchantId: string, eventId: string, options?: { additionalInstructions?: string | null; }): Promise<BaseResponse<unknown>> {
65
+ return await this
66
+ .request(`/merchants/${merchantId}/events/${eventId}/content-calendar/generate`)
67
+ .method('post')
68
+ .bearerToken()
69
+ .body({
70
+ additional_instructions: options?.additionalInstructions ?? null
71
+ })
72
+ .run();
73
+ }
74
+
75
+ async generateText(merchantId: string, eventId: string, options: { channel?: ContentCalendarItemChannel | null; scheduledOn?: string | null; content?: string | null; additionalInstructions?: string | null; }): Promise<BaseResponse<{ content: string; imageSuggestion: string | null }>> {
76
+ return await this
77
+ .request(`/merchants/${merchantId}/events/${eventId}/content-calendar/generate-text`)
78
+ .method('post')
79
+ .bearerToken()
80
+ .body({
81
+ channel: options.channel ?? null,
82
+ scheduled_on: options.scheduledOn ?? null,
83
+ content: options.content ?? null,
84
+ additional_instructions: options.additionalInstructions ?? null
85
+ })
86
+ .runAdapter((data: ForeignData) => ({
87
+ content: String(data.content ?? ''),
88
+ imageSuggestion: data.image_suggestion ?? null
89
+ }));
90
+ }
91
+
92
+ async brainstorm(merchantId: string, eventId: string, payload: { ideas: string[]; }): Promise<BaseResponse<ContentCalendarItemDto[]>> {
93
+ return await this
94
+ .request(`/merchants/${merchantId}/events/${eventId}/content-calendar/brainstorm`)
95
+ .method('post')
96
+ .bearerToken()
97
+ .body({
98
+ ideas: payload.ideas
99
+ })
100
+ .runArrayAdapter(ContentCalendarAdapter.parseItem);
101
+ }
102
+
103
+ async getGenerationStatus(merchantId: string, eventId: string): Promise<BaseResponse<{ eventId: string; generating: boolean; since: string | null }>> {
104
+ return await this
105
+ .request(`/merchants/${merchantId}/events/${eventId}/content-calendar/generation-status`)
106
+ .method('get')
107
+ .bearerToken()
108
+ .runAdapter((data: ForeignData) => ({
109
+ eventId: String(data.event_id),
110
+ generating: Boolean(data.generating),
111
+ since: data.since ?? null
112
+ }));
113
+ }
114
+ }
115
+
116
+ export type ContentCalendarItemPayload = {
117
+ readonly scheduledOn?: string | null;
118
+ readonly status?: ContentCalendarItemStatus;
119
+ readonly channel?: ContentCalendarItemChannel | null;
120
+ readonly content?: string | null;
121
+ readonly imageSuggestion?: string | null;
122
+ };
@@ -1,4 +1,5 @@
1
1
  import { BaseResponse, BaseService, QueryString } from '@basmilius/http-client';
2
+ import type { DateTime } from 'luxon';
2
3
  import { ProductAdapter } from '#data/adapter';
3
4
  import type { ProductDto } from '#data/dto';
4
5
 
@@ -27,20 +28,45 @@ export class MerchantEventProductService extends BaseService {
27
28
  .run();
28
29
  }
29
30
 
30
- async patch(merchantId: string, eventId: string, productId: string, product: ProductDto): Promise<BaseResponse<ProductDto>> {
31
+ async patchGeneral(merchantId: string, eventId: string, productId: string, name: string, description: string | null): Promise<BaseResponse<ProductDto>> {
31
32
  return await this
32
- .request(`/merchants/${merchantId}/events/${eventId}/products/${productId}`)
33
+ .request(`/merchants/${merchantId}/events/${eventId}/products/${productId}/general`)
34
+ .method('patch')
35
+ .bearerToken()
36
+ .queryString(QueryString.builder()
37
+ .append('language', 'nl'))
38
+ .body({
39
+ name,
40
+ description
41
+ })
42
+ .runAdapter(ProductAdapter.parseProduct);
43
+ }
44
+
45
+ async patchSales(merchantId: string, eventId: string, productId: string, price: number, maxQuantity: number, isSwappable: boolean, ticketsReleasedOn: DateTime | null): Promise<BaseResponse<ProductDto>> {
46
+ return await this
47
+ .request(`/merchants/${merchantId}/events/${eventId}/products/${productId}/sales`)
48
+ .method('patch')
49
+ .bearerToken()
50
+ .queryString(QueryString.builder()
51
+ .append('language', 'nl'))
52
+ .body({
53
+ price,
54
+ max_quantity: maxQuantity,
55
+ is_swappable: isSwappable,
56
+ tickets_released_on: ticketsReleasedOn?.toISO() ?? null
57
+ })
58
+ .runAdapter(ProductAdapter.parseProduct);
59
+ }
60
+
61
+ async patchValidity(merchantId: string, eventId: string, productId: string, timeSlotIds: string[]): Promise<BaseResponse<ProductDto>> {
62
+ return await this
63
+ .request(`/merchants/${merchantId}/events/${eventId}/products/${productId}/validity`)
33
64
  .method('patch')
34
65
  .bearerToken()
35
66
  .queryString(QueryString.builder()
36
67
  .append('language', 'nl'))
37
68
  .body({
38
- name: product.name,
39
- description: product.description,
40
- price: product.price.cents,
41
- max_quantity: product.maxQuantity,
42
- is_swappable: product.isSwappable,
43
- tickets_released_on: product.ticketsReleasedOn?.toISO() ?? null
69
+ time_slot_ids: timeSlotIds
44
70
  })
45
71
  .runAdapter(ProductAdapter.parseProduct);
46
72
  }
@@ -29,7 +29,7 @@ export class MerchantEventProductsService extends BaseService {
29
29
  .runArrayAdapter(FluxAdapter.parseFluxFormSelectEntry);
30
30
  }
31
31
 
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): 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): Promise<BaseResponse<ProductDto>> {
33
33
  return await this
34
34
  .request(`/merchants/${merchantId}/events/${eventId}/products`)
35
35
  .method('post')
@@ -43,7 +43,8 @@ export class MerchantEventProductsService extends BaseService {
43
43
  stock,
44
44
  max_quantity: maxQuantity,
45
45
  stock_pool_id: stockPoolId,
46
- tickets_released_on: ticketsReleasedOn?.toISO() ?? null
46
+ tickets_released_on: ticketsReleasedOn?.toISO() ?? null,
47
+ time_slot_ids: timeSlotIds
47
48
  })
48
49
  .runAdapter(ProductAdapter.parseProduct);
49
50
  }
@@ -0,0 +1,86 @@
1
+ import { BaseResponse, BaseService, QueryString } from '@basmilius/http-client';
2
+ import type { ApexOptions } from 'apexcharts';
3
+ import { EventStatisticsBuyersAdapter } from '#data/adapter';
4
+ import type { EventStatisticsBuyersOverviewDto, StatisticsBuyersRankedDto } from '#data/dto';
5
+
6
+ export class MerchantEventStatisticsBuyersService extends BaseService {
7
+ async getOverview(merchantId: string, eventId: string): Promise<BaseResponse<EventStatisticsBuyersOverviewDto>> {
8
+ return await this
9
+ .request(`/merchants/${merchantId}/events/${eventId}/statistics/buyers/overview`)
10
+ .method('get')
11
+ .queryString(QueryString.builder()
12
+ .append('language', 'nl'))
13
+ .bearerToken()
14
+ .runAdapter(EventStatisticsBuyersAdapter.parseOverview);
15
+ }
16
+
17
+ async getAcquisitionChart(merchantId: string, eventId: string): Promise<BaseResponse<ApexOptions>> {
18
+ return await this
19
+ .request(`/merchants/${merchantId}/events/${eventId}/statistics/buyers/acquisition-chart`)
20
+ .method('get')
21
+ .queryString(QueryString.builder()
22
+ .append('language', 'nl'))
23
+ .bearerToken()
24
+ .run();
25
+ }
26
+
27
+ async getAgeDistribution(merchantId: string, eventId: string): Promise<BaseResponse<Record<string, number>>> {
28
+ return await this
29
+ .request(`/merchants/${merchantId}/events/${eventId}/statistics/buyers/age-distribution`)
30
+ .method('get')
31
+ .queryString(QueryString.builder()
32
+ .append('language', 'nl'))
33
+ .bearerToken()
34
+ .run();
35
+ }
36
+
37
+ async getGenderDistribution(merchantId: string, eventId: string): Promise<BaseResponse<Record<string, number>>> {
38
+ return await this
39
+ .request(`/merchants/${merchantId}/events/${eventId}/statistics/buyers/gender-distribution`)
40
+ .method('get')
41
+ .queryString(QueryString.builder()
42
+ .append('language', 'nl'))
43
+ .bearerToken()
44
+ .run();
45
+ }
46
+
47
+ async getLanguageDistribution(merchantId: string, eventId: string): Promise<BaseResponse<Record<string, number>>> {
48
+ return await this
49
+ .request(`/merchants/${merchantId}/events/${eventId}/statistics/buyers/language-distribution`)
50
+ .method('get')
51
+ .queryString(QueryString.builder()
52
+ .append('language', 'nl'))
53
+ .bearerToken()
54
+ .run();
55
+ }
56
+
57
+ async getBrowserDistribution(merchantId: string, eventId: string): Promise<BaseResponse<Record<string, number>>> {
58
+ return await this
59
+ .request(`/merchants/${merchantId}/events/${eventId}/statistics/buyers/browser-distribution`)
60
+ .method('get')
61
+ .queryString(QueryString.builder()
62
+ .append('language', 'nl'))
63
+ .bearerToken()
64
+ .run();
65
+ }
66
+
67
+ async getOsDistribution(merchantId: string, eventId: string): Promise<BaseResponse<Record<string, number>>> {
68
+ return await this
69
+ .request(`/merchants/${merchantId}/events/${eventId}/statistics/buyers/os-distribution`)
70
+ .method('get')
71
+ .queryString(QueryString.builder()
72
+ .append('language', 'nl'))
73
+ .bearerToken()
74
+ .run();
75
+ }
76
+
77
+ async getTopBuyers(merchantId: string, eventId: string): Promise<BaseResponse<StatisticsBuyersRankedDto[]>> {
78
+ return await this
79
+ .request(`/merchants/${merchantId}/events/${eventId}/statistics/buyers/top-buyers`)
80
+ .method('get')
81
+ .queryString(QueryString.builder()
82
+ .append('language', 'nl'))
83
+ .bearerToken()
84
+ .runArrayAdapter(EventStatisticsBuyersAdapter.parseRanked);
85
+ }
86
+ }
@@ -0,0 +1,56 @@
1
+ import { BaseResponse, BaseService, QueryString } from '@basmilius/http-client';
2
+ import type { ApexOptions } from 'apexcharts';
3
+ import { EventStatisticsOperationsAdapter } from '#data/adapter';
4
+ import type { EventStatisticsAppTeamDto, EventStatisticsAttendanceDto, EventStatisticsOperationsOverviewDto, EventStatisticsSwapsDto } from '#data/dto';
5
+
6
+ export class MerchantEventStatisticsOperationsService extends BaseService {
7
+ async getOverview(merchantId: string, eventId: string): Promise<BaseResponse<EventStatisticsOperationsOverviewDto>> {
8
+ return await this
9
+ .request(`/merchants/${merchantId}/events/${eventId}/statistics/operations/overview`)
10
+ .method('get')
11
+ .queryString(QueryString.builder()
12
+ .append('language', 'nl'))
13
+ .bearerToken()
14
+ .runAdapter(EventStatisticsOperationsAdapter.parseOverview);
15
+ }
16
+
17
+ async getAppTeams(merchantId: string, eventId: string): Promise<BaseResponse<EventStatisticsAppTeamDto[]>> {
18
+ return await this
19
+ .request(`/merchants/${merchantId}/events/${eventId}/statistics/operations/app-teams`)
20
+ .method('get')
21
+ .queryString(QueryString.builder()
22
+ .append('language', 'nl'))
23
+ .bearerToken()
24
+ .runArrayAdapter(EventStatisticsOperationsAdapter.parseAppTeam);
25
+ }
26
+
27
+ async getAttendance(merchantId: string, eventId: string): Promise<BaseResponse<EventStatisticsAttendanceDto>> {
28
+ return await this
29
+ .request(`/merchants/${merchantId}/events/${eventId}/statistics/operations/attendance`)
30
+ .method('get')
31
+ .queryString(QueryString.builder()
32
+ .append('language', 'nl'))
33
+ .bearerToken()
34
+ .runAdapter(EventStatisticsOperationsAdapter.parseAttendance);
35
+ }
36
+
37
+ async getScansTrend(merchantId: string, eventId: string): Promise<BaseResponse<ApexOptions>> {
38
+ return await this
39
+ .request(`/merchants/${merchantId}/events/${eventId}/statistics/operations/scans-trend`)
40
+ .method('get')
41
+ .queryString(QueryString.builder()
42
+ .append('language', 'nl'))
43
+ .bearerToken()
44
+ .run();
45
+ }
46
+
47
+ async getSwaps(merchantId: string, eventId: string): Promise<BaseResponse<EventStatisticsSwapsDto>> {
48
+ return await this
49
+ .request(`/merchants/${merchantId}/events/${eventId}/statistics/operations/swaps`)
50
+ .method('get')
51
+ .queryString(QueryString.builder()
52
+ .append('language', 'nl'))
53
+ .bearerToken()
54
+ .runAdapter(EventStatisticsOperationsAdapter.parseSwaps);
55
+ }
56
+ }
@@ -0,0 +1,35 @@
1
+ import { BaseResponse, BaseService, QueryString } from '@basmilius/http-client';
2
+ import { EventStatisticsOverviewAdapter } from '#data/adapter';
3
+ import type { EventStatisticsFinancialDto, EventStatisticsKpisDto, EventStatisticsStatusDto } from '#data/dto';
4
+
5
+ export class MerchantEventStatisticsOverviewService extends BaseService {
6
+ async getFinancial(merchantId: string, eventId: string): Promise<BaseResponse<EventStatisticsFinancialDto>> {
7
+ return await this
8
+ .request(`/merchants/${merchantId}/events/${eventId}/statistics/overview/financial`)
9
+ .method('get')
10
+ .queryString(QueryString.builder()
11
+ .append('language', 'nl'))
12
+ .bearerToken()
13
+ .runAdapter(EventStatisticsOverviewAdapter.parseFinancial);
14
+ }
15
+
16
+ async getKeyPerformanceIndicators(merchantId: string, eventId: string): Promise<BaseResponse<EventStatisticsKpisDto>> {
17
+ return await this
18
+ .request(`/merchants/${merchantId}/events/${eventId}/statistics/overview/key-performance-indicators`)
19
+ .method('get')
20
+ .queryString(QueryString.builder()
21
+ .append('language', 'nl'))
22
+ .bearerToken()
23
+ .runAdapter(EventStatisticsOverviewAdapter.parseKpis);
24
+ }
25
+
26
+ async getStatus(merchantId: string, eventId: string): Promise<BaseResponse<EventStatisticsStatusDto>> {
27
+ return await this
28
+ .request(`/merchants/${merchantId}/events/${eventId}/statistics/overview/status`)
29
+ .method('get')
30
+ .queryString(QueryString.builder()
31
+ .append('language', 'nl'))
32
+ .bearerToken()
33
+ .runAdapter(EventStatisticsOverviewAdapter.parseStatus);
34
+ }
35
+ }