@passly-nl/data 1.0.5 → 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
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.5",
4
+ "version": "1.1.0",
5
5
  "type": "module",
6
6
  "license": "MIT",
7
7
  "funding": "https://github.com/sponsors/basmilius",
@@ -49,17 +49,22 @@
49
49
  },
50
50
  "./*": "./*"
51
51
  },
52
- "dependencies": {
53
- "@basmilius/http-client": "^3.18.0",
54
- "@flux-ui/types": "^3.0.0-next.35",
55
- "@fortawesome/fontawesome-common-types": "^7.2.0",
56
- "apexcharts": "^5.10.6",
57
- "luxon": "^3.7.2"
58
- },
59
52
  "devDependencies": {
53
+ "@basmilius/http-client": "^3.30.0",
54
+ "@flux-ui/types": "^3.0.0-next.67",
55
+ "@fortawesome/fontawesome-common-types": "^7.2.0",
60
56
  "@types/luxon": "^3.7.1",
61
- "@typescript/native-preview": "^7.0.0-dev.20260423.1",
62
- "tsdown": "^0.21.10"
57
+ "@typescript/native-preview": "^7.0.0-dev.20260508.1",
58
+ "apexcharts": "^5.11.0",
59
+ "luxon": "^3.7.2",
60
+ "tsdown": "^0.22.0"
61
+ },
62
+ "peerDependencies": {
63
+ "@basmilius/http-client": "^3.30.0",
64
+ "@flux-ui/types": "^3.0.0-next.67",
65
+ "@fortawesome/fontawesome-common-types": "^7.2.0",
66
+ "apexcharts": "^5.11.0",
67
+ "luxon": "^3.7.2"
63
68
  },
64
69
  "overrides": {
65
70
  "@disabled-basmilius/http-client": "link:@basmilius/http-client",
@@ -0,0 +1,37 @@
1
+ import { adapter, ForeignData } from '@basmilius/http-client';
2
+ import { AuthAdapter, DateTimeAdapter } from '#data/adapter';
3
+ import { AiChatConversationDto, AiChatMessageDto, AiChatToolCallDto } from '#data/dto';
4
+ import { optional, optionalArray } from '#data/util';
5
+
6
+ @adapter
7
+ export class AiChatAdapter {
8
+ static parseConversation(data: ForeignData): AiChatConversationDto {
9
+ return new AiChatConversationDto(
10
+ data.id,
11
+ data.title ?? null,
12
+ DateTimeAdapter.parseDateTime(data.created_on),
13
+ DateTimeAdapter.parseDateTime(data.updated_on)
14
+ );
15
+ }
16
+
17
+ static parseMessage(data: ForeignData): AiChatMessageDto {
18
+ return new AiChatMessageDto(
19
+ data.id,
20
+ data.role,
21
+ data.content ?? null,
22
+ optionalArray(data.tool_calls, AiChatAdapter.parseToolCall),
23
+ optional(data.creator, AuthAdapter.parseUser),
24
+ DateTimeAdapter.parseDateTime(data.generated_on)
25
+ );
26
+ }
27
+
28
+ static parseToolCall(data: ForeignData): AiChatToolCallDto {
29
+ return new AiChatToolCallDto(
30
+ data.id ?? '',
31
+ data.name,
32
+ data.input ?? {},
33
+ data.output ?? null,
34
+ !!data.is_error
35
+ );
36
+ }
37
+ }
@@ -0,0 +1,42 @@
1
+ import { adapter, ForeignData } from '@basmilius/http-client';
2
+ import { DateTimeAdapter } from '#data/adapter';
3
+ import { AiUsageDto, AiUsageFeatureStatusDto, AiUsagePeriodDto } from '#data/dto';
4
+ import { optional, optionalArray } from '#data/util';
5
+
6
+ @adapter
7
+ export class AiUsageAdapter {
8
+ static parseAiUsage(data: ForeignData): AiUsageDto {
9
+ return new AiUsageDto(
10
+ data.id,
11
+ data.feature,
12
+ data.operation,
13
+ data.model,
14
+ data.prompt_tokens ?? 0,
15
+ data.cached_tokens ?? 0,
16
+ data.output_tokens ?? 0,
17
+ data.reference_class ?? null,
18
+ data.reference_id ?? null,
19
+ DateTimeAdapter.parseDateTime(data.created_on)
20
+ );
21
+ }
22
+
23
+ static parseAiUsagePeriod(data: ForeignData): AiUsagePeriodDto {
24
+ return new AiUsagePeriodDto(
25
+ optional(data.period_start, DateTimeAdapter.parseDateTime),
26
+ optional(data.period_end, DateTimeAdapter.parseDateTime),
27
+ data.tokens_used ?? 0,
28
+ data.limit_tokens ?? null,
29
+ data.percentage ?? 0,
30
+ optional(data.last_event_on, DateTimeAdapter.parseDateTime),
31
+ optionalArray(data.features, AiUsageAdapter.parseAiUsageFeatureStatus)
32
+ );
33
+ }
34
+
35
+ static parseAiUsageFeatureStatus(data: ForeignData): AiUsageFeatureStatusDto {
36
+ return new AiUsageFeatureStatusDto(
37
+ data.feature,
38
+ !!data.enabled,
39
+ data.tokens_used ?? 0
40
+ );
41
+ }
42
+ }
@@ -0,0 +1,70 @@
1
+ import { adapter, ForeignData } from '@basmilius/http-client';
2
+ import { DateTimeAdapter, PaymentAdapter, RefundAdapter } from '#data/adapter';
3
+ import { CashFlowDiscountDto, CashFlowDto, CashFlowPaymentDto, CashFlowPlatformCostDto, CashFlowRefundDto, CashFlowTimelineEventDto } from '#data/dto';
4
+ import { optional, optionalArray } from '#data/util';
5
+
6
+ @adapter
7
+ export class CashFlowAdapter {
8
+ static parseCashFlow(data: ForeignData): CashFlowDto {
9
+ return new CashFlowDto(
10
+ PaymentAdapter.parseCost(data.subtotal),
11
+ optional(data.discount, CashFlowAdapter.parseCashFlowDiscount),
12
+ PaymentAdapter.parseCost(data.total),
13
+ CashFlowAdapter.parseCashFlowPlatformCost(data.platform_cost),
14
+ optionalArray(data.refunds, CashFlowAdapter.parseCashFlowRefund) ?? [],
15
+ PaymentAdapter.parseCost(data.refunded_total),
16
+ PaymentAdapter.parseCost(data.net_revenue),
17
+ CashFlowAdapter.parseCashFlowPayment(data.payment),
18
+ optionalArray(data.timeline, CashFlowAdapter.parseCashFlowTimelineEvent) ?? []
19
+ );
20
+ }
21
+
22
+ static parseCashFlowDiscount(data: ForeignData): CashFlowDiscountDto {
23
+ return new CashFlowDiscountDto(
24
+ data.code,
25
+ PaymentAdapter.parseCost(data.amount),
26
+ data.type
27
+ );
28
+ }
29
+
30
+ static parseCashFlowPayment(data: ForeignData): CashFlowPaymentDto {
31
+ return new CashFlowPaymentDto(
32
+ data.status ?? null,
33
+ data.provider ?? null,
34
+ data.method ?? null,
35
+ optional(data.paid_on, DateTimeAdapter.parseDateTime)
36
+ );
37
+ }
38
+
39
+ static parseCashFlowPlatformCost(data: ForeignData): CashFlowPlatformCostDto {
40
+ return new CashFlowPlatformCostDto(
41
+ PaymentAdapter.parseCost(data.amount),
42
+ data.is_billable
43
+ );
44
+ }
45
+
46
+ static parseCashFlowRefund(data: ForeignData): CashFlowRefundDto {
47
+ return new CashFlowRefundDto(
48
+ data.id,
49
+ PaymentAdapter.parseCost(data.amount),
50
+ data.status,
51
+ data.reason,
52
+ data.reason_label,
53
+ data.note,
54
+ optional(data.initiator, RefundAdapter.parseRefundInitiator),
55
+ optionalArray(data.tickets, RefundAdapter.parseRefundTicketRef) ?? [],
56
+ optional(data.completed_on, DateTimeAdapter.parseDateTime)
57
+ );
58
+ }
59
+
60
+ static parseCashFlowTimelineEvent(data: ForeignData): CashFlowTimelineEventDto {
61
+ return new CashFlowTimelineEventDto(
62
+ DateTimeAdapter.parseDateTime(data.at),
63
+ data.type,
64
+ optional(data.amount, PaymentAdapter.parseCost),
65
+ PaymentAdapter.parseCost(data.balance),
66
+ data.description,
67
+ data.details ?? null
68
+ );
69
+ }
70
+ }
@@ -0,0 +1,34 @@
1
+ import { adapter, ForeignData } from '@basmilius/http-client';
2
+ import { DateTimeAdapter, FileSystemAdapter } from '#data/adapter';
3
+ import { ContentCalendarItemCreatorDto, ContentCalendarItemDto } from '#data/dto';
4
+ import { optional } from '#data/util';
5
+
6
+ @adapter
7
+ export class ContentCalendarAdapter {
8
+ static parseItem(data: ForeignData): ContentCalendarItemDto {
9
+ return new ContentCalendarItemDto(
10
+ data.id,
11
+ data.event_id ?? null,
12
+ data.scheduled_on ? DateTimeAdapter.parseDateTime(data.scheduled_on) : null,
13
+ data.status,
14
+ data.source,
15
+ data.channel ?? null,
16
+ data.content ?? null,
17
+ data.image_suggestion ?? null,
18
+ data.creator ? ContentCalendarAdapter.parseCreator(data.creator) : null,
19
+ DateTimeAdapter.parseDateTime(data.created_on),
20
+ DateTimeAdapter.parseDateTime(data.updated_on)
21
+ );
22
+ }
23
+
24
+ static parseCreator(data: ForeignData): ContentCalendarItemCreatorDto {
25
+ return new ContentCalendarItemCreatorDto(
26
+ data.id,
27
+ data.first_name,
28
+ data.last_name,
29
+ data.full_name,
30
+ data.initials,
31
+ optional(data.picture, FileSystemAdapter.parsePicture)
32
+ );
33
+ }
34
+ }
@@ -0,0 +1,33 @@
1
+ import { adapter, ForeignData } from '@basmilius/http-client';
2
+ import { DateTimeAdapter, PaymentAdapter } from '#data/adapter';
3
+ import { DiscountCodeDto } from '#data/dto';
4
+ import type { DiscountCodeEvent } from '#data/types';
5
+ import { optional } from '#data/util';
6
+
7
+ @adapter
8
+ export class DiscountCodeAdapter {
9
+ static parseDiscountCode(data: ForeignData): DiscountCodeDto {
10
+ return new DiscountCodeDto(
11
+ data.id,
12
+ data.code,
13
+ data.type,
14
+ data.percentage,
15
+ optional(data.amount, PaymentAdapter.parseCost),
16
+ data.max_uses,
17
+ DateTimeAdapter.parseDateTime(data.valid_from),
18
+ DateTimeAdapter.parseDateTime(data.valid_until),
19
+ DateTimeAdapter.parseDateTime(data.created_on),
20
+ data.uses_count,
21
+ data.remaining_uses,
22
+ data.is_currently_valid,
23
+ optional(data.event, DiscountCodeAdapter.parseDiscountCodeEvent)
24
+ );
25
+ }
26
+
27
+ static parseDiscountCodeEvent(data: ForeignData): DiscountCodeEvent {
28
+ return {
29
+ id: data.id,
30
+ name: data.name
31
+ };
32
+ }
33
+ }
@@ -1,6 +1,6 @@
1
1
  import { adapter, ForeignData } from '@basmilius/http-client';
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, ShopElementInformationDto, ShopElementNoticeDto, ShopElementProductDto, ShopElementTextDto, StockOverviewDto, StockOverviewItemDto, StockPoolDto, TicketTemplateDto } from '#data/dto';
2
+ import { AddressAdapter, AuthAdapter, DateTimeAdapter, FileSystemAdapter, MerchantAdapter, ProductAdapter } from '#data/adapter';
3
+ import { AppTeamDto, EventAvailabilityDto, EventCountersDto, EventDto, ShopDesignDto, ShopDto, ShopElementButtonDto, ShopElementDividerDto, ShopElementDto, ShopElementHeadingDto, ShopElementInformationDto, ShopElementNoticeDto, ShopElementProductDto, ShopElementTextDto, StockOverviewDto, StockOverviewItemDto, StockPoolDto, TicketTemplateDto, TimeSlotDto } from '#data/dto';
4
4
  import { optional } from '#data/util';
5
5
 
6
6
  @adapter
@@ -181,76 +181,13 @@ export class EventAdapter {
181
181
  );
182
182
  }
183
183
 
184
- static parseEventStatisticsAttendance(data: ForeignData): EventStatisticsAttendanceDto {
185
- return new EventStatisticsAttendanceDto(
186
- data.attended,
187
- data.expected,
188
- data.rate
189
- );
190
- }
191
-
192
- static parseEventStatisticsBuyerTotals(data: ForeignData): EventStatisticsBuyerTotalsDto {
193
- return new EventStatisticsBuyerTotalsDto(
194
- data.acquired,
195
- data.average_tickets,
196
- data.doubting,
197
- data.returning,
198
- data.total
199
- );
200
- }
201
-
202
- static parseEventStatisticsFinancial(data: ForeignData): EventStatisticsFinancialDto {
203
- return new EventStatisticsFinancialDto(
204
- PaymentAdapter.parseCost(data.platform_cost),
205
- PaymentAdapter.parseCost(data.revenue)
206
- );
207
- }
208
-
209
- static parseEventStatisticsOrders(data: ForeignData): EventStatisticsOrdersDto {
210
- return new EventStatisticsOrdersDto(
211
- data.chart,
212
- EventAdapter.parseEventStatisticsOrderTotals(data.totals)
213
- );
214
- }
215
-
216
- static parseEventStatisticsOrderTotals(data: ForeignData): EventStatisticsOrderTotalsDto {
217
- return new EventStatisticsOrderTotalsDto(
218
- data.fulfilled,
219
- data.interrupted,
220
- data.pending,
221
- data.total
222
- );
223
- }
224
-
225
- static parseEventStatisticsScans(data: ForeignData): EventStatisticsScansDto {
226
- return new EventStatisticsScansDto(
227
- data.app_teams.map(EventAdapter.parseEventStatisticsScansPerAppTeam),
228
- data.chart,
229
- EventAdapter.parseEventStatisticsScanTotals(data.totals)
230
- );
231
- }
232
-
233
- static parseEventStatisticsScansPerAppTeam(data: ForeignData): EventStatisticsScansPerAppTeamDto {
234
- return new EventStatisticsScansPerAppTeamDto(
184
+ static parseTimeSlot(data: ForeignData): TimeSlotDto {
185
+ return new TimeSlotDto(
235
186
  data.id,
236
- data.name,
237
- data.scans
238
- );
239
- }
240
-
241
- static parseEventStatisticsScanTotals(data: ForeignData): EventStatisticsScanTotalsDto {
242
- return new EventStatisticsScanTotalsDto(
243
- data.total,
244
- data.checkins,
245
- data.checkouts
246
- );
247
- }
248
-
249
- static parseEventStatisticsSwapTotals(data: ForeignData): EventStatisticsSwapTotalsDto {
250
- return new EventStatisticsSwapTotalsDto(
251
- data.swaps,
252
- data.tickets,
253
- data.rate
187
+ data.label,
188
+ DateTimeAdapter.parseDateTime(data.from_time),
189
+ DateTimeAdapter.parseDateTime(data.to_time),
190
+ data.product_count
254
191
  );
255
192
  }
256
193
  }
@@ -0,0 +1,27 @@
1
+ import { adapter, ForeignData } from '@basmilius/http-client';
2
+ import { BuyerAdapter, PaymentAdapter } from '#data/adapter';
3
+ import { EventStatisticsBuyersOverviewDto, StatisticsBuyersRankedDto } from '#data/dto';
4
+
5
+ @adapter
6
+ export class EventStatisticsBuyersAdapter {
7
+ static parseOverview(data: ForeignData): EventStatisticsBuyersOverviewDto {
8
+ return new EventStatisticsBuyersOverviewDto(
9
+ data.total,
10
+ data.acquired,
11
+ data.doubting,
12
+ data.returning,
13
+ data.average_tickets
14
+ );
15
+ }
16
+
17
+ static parseRanked(data: ForeignData): StatisticsBuyersRankedDto {
18
+ return new StatisticsBuyersRankedDto(
19
+ data.ranking,
20
+ BuyerAdapter.parseBuyer(data.buyer),
21
+ data.order_count,
22
+ PaymentAdapter.parseCost(data.total_spend),
23
+ data.events_attended ?? 0,
24
+ PaymentAdapter.parseCost(data.average_order_value)
25
+ );
26
+ }
27
+ }
@@ -0,0 +1,41 @@
1
+ import { adapter, ForeignData } from '@basmilius/http-client';
2
+ import { EventStatisticsAppTeamDto, EventStatisticsAttendanceDto, EventStatisticsOperationsOverviewDto, EventStatisticsSwapsDto } from '#data/dto';
3
+
4
+ @adapter
5
+ export class EventStatisticsOperationsAdapter {
6
+ static parseAppTeam(data: ForeignData): EventStatisticsAppTeamDto {
7
+ return new EventStatisticsAppTeamDto(
8
+ data.id,
9
+ data.name,
10
+ data.scans,
11
+ data.checkins,
12
+ data.checkouts
13
+ );
14
+ }
15
+
16
+ static parseAttendance(data: ForeignData): EventStatisticsAttendanceDto {
17
+ return new EventStatisticsAttendanceDto(
18
+ data.attended,
19
+ data.expected,
20
+ data.rate
21
+ );
22
+ }
23
+
24
+ static parseOverview(data: ForeignData): EventStatisticsOperationsOverviewDto {
25
+ return new EventStatisticsOperationsOverviewDto(
26
+ data.total_scans,
27
+ data.checkins,
28
+ data.checkouts,
29
+ data.attendance_rate,
30
+ data.app_teams
31
+ );
32
+ }
33
+
34
+ static parseSwaps(data: ForeignData): EventStatisticsSwapsDto {
35
+ return new EventStatisticsSwapsDto(
36
+ data.swaps,
37
+ data.tickets,
38
+ data.rate
39
+ );
40
+ }
41
+ }
@@ -0,0 +1,39 @@
1
+ import { adapter, ForeignData } from '@basmilius/http-client';
2
+ import { PaymentAdapter } from '#data/adapter';
3
+ import { EventStatisticsFinancialDto, EventStatisticsKpisDto, EventStatisticsStatusDto } from '#data/dto';
4
+
5
+ @adapter
6
+ export class EventStatisticsOverviewAdapter {
7
+ static parseFinancial(data: ForeignData): EventStatisticsFinancialDto {
8
+ return new EventStatisticsFinancialDto(
9
+ PaymentAdapter.parseCost(data.platform_cost),
10
+ PaymentAdapter.parseCost(data.revenue),
11
+ PaymentAdapter.parseCost(data.net_revenue)
12
+ );
13
+ }
14
+
15
+ static parseKpis(data: ForeignData): EventStatisticsKpisDto {
16
+ return new EventStatisticsKpisDto(
17
+ PaymentAdapter.parseCost(data.revenue),
18
+ PaymentAdapter.parseCost(data.platform_cost),
19
+ PaymentAdapter.parseCost(data.net_revenue),
20
+ data.total_orders,
21
+ data.total_tickets_sold,
22
+ data.tickets_capacity,
23
+ data.sell_through_rate,
24
+ data.attendance_rate,
25
+ PaymentAdapter.parseCost(data.average_order_value),
26
+ PaymentAdapter.parseCost(data.average_ticket_price),
27
+ data.unique_buyers
28
+ );
29
+ }
30
+
31
+ static parseStatus(data: ForeignData): EventStatisticsStatusDto {
32
+ return new EventStatisticsStatusDto(
33
+ data.fulfilled ?? 0,
34
+ data.interrupted ?? 0,
35
+ data.pending ?? 0,
36
+ data.total ?? 0
37
+ );
38
+ }
39
+ }
@@ -0,0 +1,21 @@
1
+ import { adapter, ForeignData } from '@basmilius/http-client';
2
+ import { DateTimeAdapter } from '#data/adapter';
3
+ import { EventStatisticsSalesFlowChartDto, EventStatisticsSalesFlowChartSeriesDto } from '#data/dto';
4
+
5
+ @adapter
6
+ export class EventStatisticsSalesAdapter {
7
+ static parseSalesFlowChart(data: ForeignData): EventStatisticsSalesFlowChartDto {
8
+ return new EventStatisticsSalesFlowChartDto(
9
+ data.series.map(EventStatisticsSalesAdapter.parseSalesFlowChartSeries),
10
+ data.xaxis.categories.map(DateTimeAdapter.parseDateTime)
11
+ );
12
+ }
13
+
14
+ static parseSalesFlowChartSeries(data: ForeignData): EventStatisticsSalesFlowChartSeriesDto {
15
+ return new EventStatisticsSalesFlowChartSeriesDto(
16
+ data.name,
17
+ data.data,
18
+ data.zIndex
19
+ );
20
+ }
21
+ }
@@ -0,0 +1,18 @@
1
+ import { adapter, ForeignData } from '@basmilius/http-client';
2
+ import { MarketingAttributionDto } from '#data/dto';
3
+
4
+ @adapter
5
+ export class MarketingAttributionAdapter {
6
+ static parseMarketingAttribution(data: ForeignData): MarketingAttributionDto {
7
+ return new MarketingAttributionDto(
8
+ data.utm_source ?? null,
9
+ data.utm_medium ?? null,
10
+ data.utm_campaign ?? null,
11
+ data.utm_term ?? null,
12
+ data.utm_content ?? null,
13
+ data.gclid ?? null,
14
+ data.fbclid ?? null,
15
+ data.referrer ?? null
16
+ );
17
+ }
18
+ }
@@ -41,9 +41,11 @@ export class MerchantAdapter {
41
41
  data.currency,
42
42
  optional(data.address, AddressAdapter.parseAddress),
43
43
  optional(data.current_contract, MerchantAdapter.parseContract),
44
+ data.enabled_features ?? [],
44
45
  optional(data.logo, FileSystemAdapter.parsePicture),
45
46
  optional(data.created_on, DateTimeAdapter.parseDateTime),
46
- optional(data.updated_on, DateTimeAdapter.parseDateTime)
47
+ optional(data.updated_on, DateTimeAdapter.parseDateTime),
48
+ data.ai_brand_voice ?? null
47
49
  );
48
50
  }
49
51
 
@@ -1,5 +1,5 @@
1
1
  import { adapter, ForeignData } from '@basmilius/http-client';
2
- import { BuyerAdapter, DateTimeAdapter, EventAdapter, PaymentAdapter, PublicShopAdapter } from '#data/adapter';
2
+ import { BuyerAdapter, DateTimeAdapter, EventAdapter, MarketingAttributionAdapter, PaymentAdapter, PublicShopAdapter } from '#data/adapter';
3
3
  import { OrderDto, OrderLineDto, OrderPaymentProviderDto, OrderProductDto } from '#data/dto';
4
4
  import { optional, optionalArray } from '#data/util';
5
5
 
@@ -12,8 +12,11 @@ export class OrderAdapter {
12
12
  data.origin,
13
13
  data.type,
14
14
  DateTimeAdapter.parseDateTime(data.created_on),
15
+ optional(data.discount_amount, PaymentAdapter.parseCost),
16
+ data.discount_code_applied ?? null,
15
17
  optional(data.payment_provider, OrderAdapter.parseOrderPaymentProvider),
16
18
  optional(data.platform_cost, PaymentAdapter.parseCost)!,
19
+ optional(data.refunded_total, PaymentAdapter.parseCost)!,
17
20
  optional(data.sub_total, PaymentAdapter.parseCost)!,
18
21
  optional(data.total, PaymentAdapter.parseCost)!,
19
22
  data.url,
@@ -21,7 +24,8 @@ export class OrderAdapter {
21
24
  optional(data.event, EventAdapter.parseEvent),
22
25
  optionalArray(data.lines, OrderAdapter.parseOrderLine),
23
26
  optional(data.shop, PublicShopAdapter.parsePublicShop),
24
- optional(data.transaction, PaymentAdapter.parseTransaction)
27
+ optional(data.transaction, PaymentAdapter.parseTransaction),
28
+ optional(data.attribution, MarketingAttributionAdapter.parseMarketingAttribution)
25
29
  );
26
30
  }
27
31
 
@@ -15,6 +15,9 @@ export class ProductAdapter {
15
15
  data.max_quantity,
16
16
  data.is_active,
17
17
  data.is_swappable,
18
+ data.has_sales,
19
+ data.is_timeslotted,
20
+ optionalArray(data.time_slots, EventAdapter.parseTimeSlot) ?? [],
18
21
  data.remaining_stock,
19
22
  optional(data.stock_pool, EventAdapter.parseStockPool),
20
23
  optional(data.image, FileSystemAdapter.parsePicture),
@@ -152,8 +152,7 @@ export class PublicShopAdapter {
152
152
  data.id,
153
153
  data.label,
154
154
  DateTimeAdapter.parseDateTime(data.from_time),
155
- DateTimeAdapter.parseDateTime(data.to_time),
156
- data.max_quantity
155
+ DateTimeAdapter.parseDateTime(data.to_time)
157
156
  );
158
157
  }
159
158
  }
@@ -0,0 +1,34 @@
1
+ import { adapter, ForeignData } from '@basmilius/http-client';
2
+ import { DateTimeAdapter, PaymentAdapter } from '#data/adapter';
3
+ import { RefundDto, RefundInitiatorDto, RefundTicketRefDto } from '#data/dto';
4
+ import { optional } from '#data/util';
5
+
6
+ @adapter
7
+ export class RefundAdapter {
8
+ static parseRefund(data: ForeignData): RefundDto {
9
+ return new RefundDto(
10
+ data.id,
11
+ data.status,
12
+ PaymentAdapter.parseCost(data.amount),
13
+ data.reason,
14
+ data.reason_label,
15
+ data.note,
16
+ DateTimeAdapter.parseDateTime(data.created_on),
17
+ optional(data.completed_on, DateTimeAdapter.parseDateTime)
18
+ );
19
+ }
20
+
21
+ static parseRefundInitiator(data: ForeignData): RefundInitiatorDto {
22
+ return new RefundInitiatorDto(
23
+ data.id,
24
+ data.name
25
+ );
26
+ }
27
+
28
+ static parseRefundTicketRef(data: ForeignData): RefundTicketRefDto {
29
+ return new RefundTicketRefDto(
30
+ data.id,
31
+ data.code
32
+ );
33
+ }
34
+ }
@@ -1,5 +1,5 @@
1
1
  import { adapter, ForeignData } from '@basmilius/http-client';
2
- import { DateTimeAdapter, FileSystemAdapter } from '#data/adapter';
2
+ import { DateTimeAdapter, FileSystemAdapter, MarketingAttributionAdapter } from '#data/adapter';
3
3
  import { ReservationDto, ReservationItemDto, ReservationProductDto } from '#data/dto';
4
4
  import { optional, optionalArray } from '#data/util';
5
5
 
@@ -11,7 +11,8 @@ export class ReservationAdapter {
11
11
  DateTimeAdapter.parseDateTime(data.created_on),
12
12
  DateTimeAdapter.parseDateTime(data.expires_on),
13
13
  data.is_expired,
14
- optionalArray(data.products, ReservationAdapter.parseReservationItem)!
14
+ optionalArray(data.products, ReservationAdapter.parseReservationItem)!,
15
+ optional(data.attribution, MarketingAttributionAdapter.parseMarketingAttribution)
15
16
  );
16
17
  }
17
18
 
@@ -1,6 +1,6 @@
1
1
  import { adapter, type ForeignData } from '@basmilius/http-client';
2
- import { PaymentAdapter } from '#data/adapter';
3
- import { StatisticsEventsOverviewDto } from '#data/dto';
2
+ import { PaymentAdapter, StatisticsOverviewAdapter } from '#data/adapter';
3
+ import { StatisticsEventsOverviewDto, type StatisticsOverviewEventPerformanceDto } from '#data/dto';
4
4
 
5
5
  @adapter
6
6
  export class StatisticsEventsAdapter {
@@ -13,4 +13,8 @@ export class StatisticsEventsAdapter {
13
13
  data.average_sell_through_rate
14
14
  );
15
15
  }
16
+
17
+ static parsePerformance(data: ForeignData): StatisticsOverviewEventPerformanceDto {
18
+ return StatisticsOverviewAdapter.parseEventPerformance(data);
19
+ }
16
20
  }