@passly-nl/data 1.2.1 → 1.3.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 (73) hide show
  1. package/dist/index.d.mts +667 -72
  2. package/dist/index.d.mts.map +1 -1
  3. package/dist/index.mjs +1982 -343
  4. package/dist/index.mjs.map +1 -1
  5. package/package.json +6 -8
  6. package/src/adapter/StatisticsBuyersAdapter.ts +50 -1
  7. package/src/adapter/StatisticsChartAdapter.ts +56 -0
  8. package/src/adapter/StatisticsEventsAdapter.ts +41 -2
  9. package/src/adapter/StatisticsGrowthAdapter.ts +9 -1
  10. package/src/adapter/StatisticsMarketingAdapter.ts +78 -0
  11. package/src/adapter/StatisticsOperationsAdapter.ts +45 -12
  12. package/src/adapter/StatisticsOverviewAdapter.ts +33 -2
  13. package/src/adapter/StatisticsRefundsAdapter.ts +43 -0
  14. package/src/adapter/StatisticsSalesAdapter.ts +36 -1
  15. package/src/adapter/index.ts +3 -1
  16. package/src/dto/eventStatistics/index.ts +0 -1
  17. package/src/dto/order/OrderProductDto.ts +5 -4
  18. package/src/dto/statistics/StatisticsBuyersAcquisitionSourceDto.ts +28 -0
  19. package/src/dto/statistics/StatisticsBuyersAgeGenderMatrixDto.ts +38 -0
  20. package/src/dto/statistics/StatisticsBuyersCohortRetentionDto.ts +48 -0
  21. package/src/dto/statistics/StatisticsBuyersDeviceConversionDto.ts +48 -0
  22. package/src/dto/statistics/StatisticsBuyersGeographicDistributionDto.ts +49 -0
  23. package/src/dto/statistics/StatisticsBuyersSpendBucketsDto.ts +36 -0
  24. package/src/dto/statistics/StatisticsChartDto.ts +43 -0
  25. package/src/dto/statistics/StatisticsEventsSalesCurveDto.ts +19 -0
  26. package/src/dto/statistics/StatisticsEventsSalesCurveEventDto.ts +59 -0
  27. package/src/dto/statistics/StatisticsEventsSellOutTimingDto.ts +39 -0
  28. package/src/dto/statistics/StatisticsEventsSellOutTimingEventDto.ts +38 -0
  29. package/src/dto/statistics/StatisticsEventsTimeToEventDto.ts +36 -0
  30. package/src/dto/statistics/StatisticsGrowthCmgrDto.ts +38 -0
  31. package/src/dto/statistics/StatisticsMarketingCampaignDto.ts +69 -0
  32. package/src/dto/statistics/StatisticsMarketingOverviewDto.ts +79 -0
  33. package/src/dto/statistics/StatisticsMarketingReferrerDto.ts +39 -0
  34. package/src/dto/statistics/StatisticsMarketingShortlinkRoiDto.ts +109 -0
  35. package/src/dto/statistics/StatisticsMarketingSourceBreakdownDto.ts +49 -0
  36. package/src/dto/statistics/StatisticsMarketingSourceFunnelDto.ts +48 -0
  37. package/src/dto/statistics/StatisticsMarketingSourceMediumMatrixDto.ts +39 -0
  38. package/src/dto/statistics/StatisticsOperationsNoShowRateDto.ts +59 -0
  39. package/src/dto/statistics/StatisticsOperationsNoShowRateEventDto.ts +58 -0
  40. package/src/dto/statistics/StatisticsOperationsScanTimeDistributionDto.ts +36 -0
  41. package/src/dto/statistics/{StatisticsOperationsTaskAssigneeDto.ts → StatisticsOperationsStewardDto.ts} +28 -8
  42. package/src/dto/statistics/StatisticsOperationsStockUtilizationDto.ts +100 -0
  43. package/src/dto/statistics/StatisticsOverviewCancellationFunnelDto.ts +58 -0
  44. package/src/dto/statistics/StatisticsOverviewReservationConversionRateDto.ts +78 -0
  45. package/src/dto/statistics/StatisticsOverviewTopShopDto.ts +49 -0
  46. package/src/dto/statistics/StatisticsPieChartDto.ts +29 -0
  47. package/src/dto/statistics/StatisticsRefundsAmountDistributionDto.ts +38 -0
  48. package/src/dto/statistics/StatisticsRefundsOverviewDto.ts +59 -0
  49. package/src/dto/statistics/StatisticsRefundsTopEventDto.ts +70 -0
  50. package/src/dto/statistics/StatisticsRefundsVelocityDto.ts +45 -0
  51. package/src/dto/statistics/StatisticsSalesDiscountEfficacyDto.ts +99 -0
  52. package/src/dto/statistics/StatisticsSalesFailedTransactionReasonDto.ts +29 -0
  53. package/src/dto/statistics/StatisticsSalesOrderValueDistributionDto.ts +38 -0
  54. package/src/dto/statistics/StatisticsSalesRepeatPurchaseVelocityDto.ts +35 -0
  55. package/src/dto/statistics/index.ts +37 -2
  56. package/src/service/MerchantEventStatisticsBuyersService.ts +4 -5
  57. package/src/service/MerchantEventStatisticsOperationsService.ts +4 -5
  58. package/src/service/MerchantEventStatisticsSalesService.ts +10 -11
  59. package/src/service/MerchantStatisticsBuyersService.ts +64 -5
  60. package/src/service/MerchantStatisticsEventsService.ts +48 -9
  61. package/src/service/MerchantStatisticsGrowthService.ts +25 -5
  62. package/src/service/MerchantStatisticsMarketingService.ts +96 -0
  63. package/src/service/MerchantStatisticsOperationsService.ts +39 -10
  64. package/src/service/MerchantStatisticsOverviewService.ts +34 -5
  65. package/src/service/MerchantStatisticsRefundsService.ts +76 -0
  66. package/src/service/MerchantStatisticsSalesService.ts +78 -9
  67. package/src/service/MerchantStatisticsService.ts +0 -11
  68. package/src/service/index.ts +2 -0
  69. package/src/types/index.ts +1 -0
  70. package/src/types/statistics.ts +32 -0
  71. package/src/adapter/EventStatisticsSalesAdapter.ts +0 -21
  72. package/src/dto/eventStatistics/EventStatisticsSalesFlowChartDto.ts +0 -66
  73. package/src/dto/statistics/StatisticsOperationsTasksOverviewDto.ts +0 -69
@@ -1,7 +1,6 @@
1
1
  import { BaseResponse, BaseService, QueryString } from '@basmilius/http-client';
2
- import type { ApexOptions } from 'apexcharts';
3
- import { EventStatisticsSalesAdapter, StatisticsSalesAdapter } from '#data/adapter';
4
- import type { EventStatisticsSalesFlowChartDto, StatisticsSalesLifetimeTotalsDto, StatisticsSalesPurchaseBehaviorDto, StatisticsSalesTransactionSuccessRateDto } from '#data/dto';
2
+ import { StatisticsChartAdapter, StatisticsSalesAdapter } from '#data/adapter';
3
+ import type { StatisticsChartDto, StatisticsPieChartDto, StatisticsSalesLifetimeTotalsDto, StatisticsSalesPurchaseBehaviorDto, StatisticsSalesTransactionSuccessRateDto } from '#data/dto';
5
4
 
6
5
  export class MerchantEventStatisticsSalesService extends BaseService {
7
6
  async getLifetimeTotals(merchantId: string, eventId: string): Promise<BaseResponse<StatisticsSalesLifetimeTotalsDto>> {
@@ -14,34 +13,34 @@ export class MerchantEventStatisticsSalesService extends BaseService {
14
13
  .runAdapter(StatisticsSalesAdapter.parseLifetimeTotals);
15
14
  }
16
15
 
17
- async getSalesFlowChart(merchantId: string, eventId: string): Promise<BaseResponse<EventStatisticsSalesFlowChartDto>> {
16
+ async getSalesFlowChart(merchantId: string, eventId: string): Promise<BaseResponse<StatisticsChartDto>> {
18
17
  return await this
19
18
  .request(`/merchants/${merchantId}/events/${eventId}/statistics/sales/sales-flow-chart`)
20
19
  .method('get')
21
20
  .queryString(QueryString.builder()
22
21
  .append('language', 'nl'))
23
22
  .bearerToken()
24
- .runAdapter(EventStatisticsSalesAdapter.parseSalesFlowChart);
23
+ .runAdapter(StatisticsChartAdapter.parseChart);
25
24
  }
26
25
 
27
- async getRevenueTrend(merchantId: string, eventId: string): Promise<BaseResponse<ApexOptions>> {
26
+ async getRevenueTrend(merchantId: string, eventId: string): Promise<BaseResponse<StatisticsChartDto>> {
28
27
  return await this
29
28
  .request(`/merchants/${merchantId}/events/${eventId}/statistics/sales/revenue-trend`)
30
29
  .method('get')
31
30
  .queryString(QueryString.builder()
32
31
  .append('language', 'nl'))
33
32
  .bearerToken()
34
- .run();
33
+ .runAdapter(StatisticsChartAdapter.parseChart);
35
34
  }
36
35
 
37
- async getPaymentMethodsChart(merchantId: string, eventId: string): Promise<BaseResponse<ApexOptions>> {
36
+ async getPaymentMethodsChart(merchantId: string, eventId: string): Promise<BaseResponse<StatisticsPieChartDto>> {
38
37
  return await this
39
38
  .request(`/merchants/${merchantId}/events/${eventId}/statistics/sales/payment-methods-chart`)
40
39
  .method('get')
41
40
  .queryString(QueryString.builder()
42
41
  .append('language', 'nl'))
43
42
  .bearerToken()
44
- .run();
43
+ .runAdapter(StatisticsChartAdapter.parsePie);
45
44
  }
46
45
 
47
46
  async getPurchaseBehavior(merchantId: string, eventId: string): Promise<BaseResponse<StatisticsSalesPurchaseBehaviorDto>> {
@@ -64,13 +63,13 @@ export class MerchantEventStatisticsSalesService extends BaseService {
64
63
  .runAdapter(StatisticsSalesAdapter.parseTransactionSuccessRate);
65
64
  }
66
65
 
67
- async getSalesByDayOfWeek(merchantId: string, eventId: string): Promise<BaseResponse<ApexOptions>> {
66
+ async getSalesByDayOfWeek(merchantId: string, eventId: string): Promise<BaseResponse<StatisticsChartDto>> {
68
67
  return await this
69
68
  .request(`/merchants/${merchantId}/events/${eventId}/statistics/sales/sales-by-day-of-week`)
70
69
  .method('get')
71
70
  .queryString(QueryString.builder()
72
71
  .append('language', 'nl'))
73
72
  .bearerToken()
74
- .run();
73
+ .runAdapter(StatisticsChartAdapter.parseChart);
75
74
  }
76
75
  }
@@ -1,18 +1,17 @@
1
1
  import { BaseResponse, BaseService, QueryString } from '@basmilius/http-client';
2
- import type { ApexOptions } from 'apexcharts';
3
2
  import type { DateTime } from 'luxon';
4
- import { StatisticsBuyersAdapter } from '#data/adapter';
5
- import type { StatisticsBuyersOverviewDto, StatisticsBuyersRankedDto } from '#data/dto';
3
+ import { StatisticsBuyersAdapter, StatisticsChartAdapter } from '#data/adapter';
4
+ import type { StatisticsBuyersAcquisitionSourceDto, StatisticsBuyersAgeGenderMatrixDto, StatisticsBuyersCohortRetentionDto, StatisticsBuyersDeviceConversionDto, StatisticsBuyersGeographicDistributionDto, StatisticsBuyersOverviewDto, StatisticsBuyersRankedDto, StatisticsBuyersSpendBucketsDto, StatisticsChartDto } from '#data/dto';
6
5
 
7
6
  export class MerchantStatisticsBuyersService extends BaseService {
8
- async getAcquisition(merchantId: string, from: DateTime, to: DateTime): Promise<BaseResponse<ApexOptions>> {
7
+ async getAcquisition(merchantId: string, from: DateTime, to: DateTime): Promise<BaseResponse<StatisticsChartDto>> {
9
8
  return await this
10
9
  .request(`/merchants/${merchantId}/statistics/buyers/acquisition-chart/${from.toSQLDate()}/${to.toSQLDate()}`)
11
10
  .method('get')
12
11
  .queryString(QueryString.builder()
13
12
  .append('language', 'nl'))
14
13
  .bearerToken()
15
- .run();
14
+ .runAdapter(StatisticsChartAdapter.parseChart);
16
15
  }
17
16
 
18
17
  async getAgeDistribution(merchantId: string, from: DateTime, to: DateTime): Promise<BaseResponse<Record<string, number>>> {
@@ -84,4 +83,64 @@ export class MerchantStatisticsBuyersService extends BaseService {
84
83
  .bearerToken()
85
84
  .runArrayAdapter(StatisticsBuyersAdapter.parseRanked);
86
85
  }
86
+
87
+ async getGeographicDistribution(merchantId: string, from: DateTime, to: DateTime): Promise<BaseResponse<StatisticsBuyersGeographicDistributionDto[]>> {
88
+ return await this
89
+ .request(`/merchants/${merchantId}/statistics/buyers/geographic-distribution/${from.toSQLDate()}/${to.toSQLDate()}`)
90
+ .method('get')
91
+ .queryString(QueryString.builder()
92
+ .append('language', 'nl'))
93
+ .bearerToken()
94
+ .runArrayAdapter(StatisticsBuyersAdapter.parseGeographicDistribution);
95
+ }
96
+
97
+ async getCohortRetention(merchantId: string): Promise<BaseResponse<StatisticsBuyersCohortRetentionDto>> {
98
+ return await this
99
+ .request(`/merchants/${merchantId}/statistics/buyers/cohort-retention`)
100
+ .method('get')
101
+ .queryString(QueryString.builder()
102
+ .append('language', 'nl'))
103
+ .bearerToken()
104
+ .runAdapter(StatisticsBuyersAdapter.parseCohortRetention);
105
+ }
106
+
107
+ async getSpendBuckets(merchantId: string): Promise<BaseResponse<StatisticsBuyersSpendBucketsDto>> {
108
+ return await this
109
+ .request(`/merchants/${merchantId}/statistics/buyers/spend-buckets`)
110
+ .method('get')
111
+ .queryString(QueryString.builder()
112
+ .append('language', 'nl'))
113
+ .bearerToken()
114
+ .runAdapter(StatisticsBuyersAdapter.parseSpendBuckets);
115
+ }
116
+
117
+ async getAcquisitionSourceSplit(merchantId: string, from: DateTime, to: DateTime): Promise<BaseResponse<StatisticsBuyersAcquisitionSourceDto[]>> {
118
+ return await this
119
+ .request(`/merchants/${merchantId}/statistics/buyers/acquisition-source-split/${from.toSQLDate()}/${to.toSQLDate()}`)
120
+ .method('get')
121
+ .queryString(QueryString.builder()
122
+ .append('language', 'nl'))
123
+ .bearerToken()
124
+ .runArrayAdapter(StatisticsBuyersAdapter.parseAcquisitionSource);
125
+ }
126
+
127
+ async getAgeGenderMatrix(merchantId: string, from: DateTime, to: DateTime): Promise<BaseResponse<StatisticsBuyersAgeGenderMatrixDto>> {
128
+ return await this
129
+ .request(`/merchants/${merchantId}/statistics/buyers/age-gender-matrix/${from.toSQLDate()}/${to.toSQLDate()}`)
130
+ .method('get')
131
+ .queryString(QueryString.builder()
132
+ .append('language', 'nl'))
133
+ .bearerToken()
134
+ .runAdapter(StatisticsBuyersAdapter.parseAgeGenderMatrix);
135
+ }
136
+
137
+ async getDeviceConversion(merchantId: string, from: DateTime, to: DateTime): Promise<BaseResponse<StatisticsBuyersDeviceConversionDto[]>> {
138
+ return await this
139
+ .request(`/merchants/${merchantId}/statistics/buyers/device-conversion/${from.toSQLDate()}/${to.toSQLDate()}`)
140
+ .method('get')
141
+ .queryString(QueryString.builder()
142
+ .append('language', 'nl'))
143
+ .bearerToken()
144
+ .runArrayAdapter(StatisticsBuyersAdapter.parseDeviceConversion);
145
+ }
87
146
  }
@@ -1,8 +1,7 @@
1
1
  import { BaseResponse, BaseService, QueryString } from '@basmilius/http-client';
2
- import type { ApexOptions } from 'apexcharts';
3
2
  import type { DateTime } from 'luxon';
4
- import { StatisticsEventsAdapter } from '#data/adapter';
5
- import type { StatisticsEventsOverviewDto, StatisticsOverviewEventPerformanceDto } from '#data/dto';
3
+ import { StatisticsChartAdapter, StatisticsEventsAdapter } from '#data/adapter';
4
+ import type { StatisticsChartDto, StatisticsEventsOverviewDto, StatisticsEventsSalesCurveDto, StatisticsEventsSellOutTimingDto, StatisticsEventsTimeToEventDto, StatisticsOverviewEventPerformanceDto, StatisticsPieChartDto } from '#data/dto';
6
5
 
7
6
  export class MerchantStatisticsEventsService extends BaseService {
8
7
  async getOverview(merchantId: string): Promise<BaseResponse<StatisticsEventsOverviewDto>> {
@@ -25,33 +24,73 @@ export class MerchantStatisticsEventsService extends BaseService {
25
24
  .runAdapter(StatisticsEventsAdapter.parsePerformance);
26
25
  }
27
26
 
28
- async getSellThroughTrend(merchantId: string, from: DateTime, to: DateTime): Promise<BaseResponse<ApexOptions>> {
27
+ async getSellThroughTrend(merchantId: string, from: DateTime, to: DateTime): Promise<BaseResponse<StatisticsChartDto>> {
29
28
  return await this
30
29
  .request(`/merchants/${merchantId}/statistics/events/sell-through-trend/${from.toSQLDate()}/${to.toSQLDate()}`)
31
30
  .method('get')
32
31
  .queryString(QueryString.builder()
33
32
  .append('language', 'nl'))
34
33
  .bearerToken()
35
- .run();
34
+ .runAdapter(StatisticsChartAdapter.parseChart);
36
35
  }
37
36
 
38
- async getSalesVelocity(merchantId: string, from: DateTime, to: DateTime): Promise<BaseResponse<ApexOptions>> {
37
+ async getSalesVelocity(merchantId: string, from: DateTime, to: DateTime): Promise<BaseResponse<StatisticsChartDto>> {
39
38
  return await this
40
39
  .request(`/merchants/${merchantId}/statistics/events/sales-velocity/${from.toSQLDate()}/${to.toSQLDate()}`)
41
40
  .method('get')
42
41
  .queryString(QueryString.builder()
43
42
  .append('language', 'nl'))
44
43
  .bearerToken()
45
- .run();
44
+ .runAdapter(StatisticsChartAdapter.parseChart);
46
45
  }
47
46
 
48
- async getPublicationStatus(merchantId: string, from: DateTime, to: DateTime): Promise<BaseResponse<ApexOptions>> {
47
+ async getPublicationStatus(merchantId: string, from: DateTime, to: DateTime): Promise<BaseResponse<StatisticsPieChartDto>> {
49
48
  return await this
50
49
  .request(`/merchants/${merchantId}/statistics/events/publication-status/${from.toSQLDate()}/${to.toSQLDate()}`)
51
50
  .method('get')
52
51
  .queryString(QueryString.builder()
53
52
  .append('language', 'nl'))
54
53
  .bearerToken()
55
- .run();
54
+ .runAdapter(StatisticsChartAdapter.parsePie);
55
+ }
56
+
57
+ async getTimeToEventDistribution(merchantId: string, from: DateTime, to: DateTime): Promise<BaseResponse<StatisticsEventsTimeToEventDto>> {
58
+ return await this
59
+ .request(`/merchants/${merchantId}/statistics/events/time-to-event/${from.toSQLDate()}/${to.toSQLDate()}`)
60
+ .method('get')
61
+ .queryString(QueryString.builder()
62
+ .append('language', 'nl'))
63
+ .bearerToken()
64
+ .runAdapter(StatisticsEventsAdapter.parseTimeToEvent);
65
+ }
66
+
67
+ async getSalesCurvePerEvent(merchantId: string, from: DateTime, to: DateTime): Promise<BaseResponse<StatisticsEventsSalesCurveDto>> {
68
+ return await this
69
+ .request(`/merchants/${merchantId}/statistics/events/sales-curve/${from.toSQLDate()}/${to.toSQLDate()}`)
70
+ .method('get')
71
+ .queryString(QueryString.builder()
72
+ .append('language', 'nl'))
73
+ .bearerToken()
74
+ .runAdapter(StatisticsEventsAdapter.parseSalesCurve);
75
+ }
76
+
77
+ async getSellOutTiming(merchantId: string, from: DateTime, to: DateTime): Promise<BaseResponse<StatisticsEventsSellOutTimingDto>> {
78
+ return await this
79
+ .request(`/merchants/${merchantId}/statistics/events/sell-out-timing/${from.toSQLDate()}/${to.toSQLDate()}`)
80
+ .method('get')
81
+ .queryString(QueryString.builder()
82
+ .append('language', 'nl'))
83
+ .bearerToken()
84
+ .runAdapter(StatisticsEventsAdapter.parseSellOutTiming);
85
+ }
86
+
87
+ async getDayOfWeekDistribution(merchantId: string, from: DateTime, to: DateTime): Promise<BaseResponse<StatisticsChartDto>> {
88
+ return await this
89
+ .request(`/merchants/${merchantId}/statistics/events/day-of-week-distribution/${from.toSQLDate()}/${to.toSQLDate()}`)
90
+ .method('get')
91
+ .queryString(QueryString.builder()
92
+ .append('language', 'nl'))
93
+ .bearerToken()
94
+ .runAdapter(StatisticsChartAdapter.parseChart);
56
95
  }
57
96
  }
@@ -1,8 +1,7 @@
1
1
  import { BaseResponse, BaseService, QueryString } from '@basmilius/http-client';
2
- import type { ApexOptions } from 'apexcharts';
3
2
  import type { DateTime } from 'luxon';
4
- import { StatisticsGrowthAdapter } from '#data/adapter';
5
- import type { MilestoneDto, StatisticsGrowthOverviewDto } from '#data/dto';
3
+ import { StatisticsChartAdapter, StatisticsGrowthAdapter } from '#data/adapter';
4
+ import type { MilestoneDto, StatisticsChartDto, StatisticsGrowthCmgrDto, StatisticsGrowthOverviewDto } from '#data/dto';
6
5
 
7
6
  export class MerchantStatisticsGrowthService extends BaseService {
8
7
  async getOverview(merchantId: string, from: DateTime, to: DateTime): Promise<BaseResponse<StatisticsGrowthOverviewDto>> {
@@ -15,14 +14,14 @@ export class MerchantStatisticsGrowthService extends BaseService {
15
14
  .runAdapter(StatisticsGrowthAdapter.parseOverview);
16
15
  }
17
16
 
18
- async getYearOverYear(merchantId: string, from: DateTime, to: DateTime): Promise<BaseResponse<ApexOptions>> {
17
+ async getYearOverYear(merchantId: string, from: DateTime, to: DateTime): Promise<BaseResponse<StatisticsChartDto>> {
19
18
  return await this
20
19
  .request(`/merchants/${merchantId}/statistics/growth/year-over-year/${from.toSQLDate()}/${to.toSQLDate()}`)
21
20
  .method('get')
22
21
  .queryString(QueryString.builder()
23
22
  .append('language', 'nl'))
24
23
  .bearerToken()
25
- .run();
24
+ .runAdapter(StatisticsChartAdapter.parseChart);
26
25
  }
27
26
 
28
27
  async getMilestones(merchantId: string): Promise<BaseResponse<MilestoneDto[]>> {
@@ -34,4 +33,25 @@ export class MerchantStatisticsGrowthService extends BaseService {
34
33
  .bearerToken()
35
34
  .runArrayAdapter(StatisticsGrowthAdapter.parseMilestone);
36
35
  }
36
+
37
+ async getForecast(merchantId: string): Promise<BaseResponse<StatisticsChartDto>> {
38
+ return await this
39
+ .request(`/merchants/${merchantId}/statistics/growth/forecast`)
40
+ .method('get')
41
+ .queryString(QueryString.builder()
42
+ .append('language', 'nl'))
43
+ .bearerToken()
44
+ .runAdapter(StatisticsChartAdapter.parseChart);
45
+ }
46
+
47
+ async getCompoundMonthlyGrowthRate(merchantId: string): Promise<BaseResponse<StatisticsGrowthCmgrDto>> {
48
+ return await this
49
+ .request(`/merchants/${merchantId}/statistics/growth/cmgr`)
50
+ .method('get')
51
+ .queryString(QueryString.builder()
52
+ .append('language', 'nl'))
53
+ .bearerToken()
54
+ .runAdapter(StatisticsGrowthAdapter.parseCmgr);
55
+ }
56
+
37
57
  }
@@ -0,0 +1,96 @@
1
+ import { BaseResponse, BaseService, QueryString } from '@basmilius/http-client';
2
+ import type { DateTime } from 'luxon';
3
+ import { StatisticsChartAdapter, StatisticsMarketingAdapter } from '#data/adapter';
4
+ import type { StatisticsChartDto, StatisticsMarketingCampaignDto, StatisticsMarketingOverviewDto, StatisticsMarketingReferrerDto, StatisticsMarketingShortlinkRoiDto, StatisticsMarketingSourceBreakdownDto, StatisticsMarketingSourceFunnelDto, StatisticsMarketingSourceMediumMatrixDto, StatisticsPieChartDto } from '#data/dto';
5
+
6
+ export class MerchantStatisticsMarketingService extends BaseService {
7
+ async getOverview(merchantId: string, from: DateTime, to: DateTime): Promise<BaseResponse<StatisticsMarketingOverviewDto>> {
8
+ return await this
9
+ .request(`/merchants/${merchantId}/statistics/marketing/overview/${from.toSQLDate()}/${to.toSQLDate()}`)
10
+ .method('get')
11
+ .queryString(QueryString.builder()
12
+ .append('language', 'nl'))
13
+ .bearerToken()
14
+ .runAdapter(StatisticsMarketingAdapter.parseOverview);
15
+ }
16
+
17
+ async getSourceBreakdown(merchantId: string, from: DateTime, to: DateTime): Promise<BaseResponse<StatisticsMarketingSourceBreakdownDto[]>> {
18
+ return await this
19
+ .request(`/merchants/${merchantId}/statistics/marketing/source-breakdown/${from.toSQLDate()}/${to.toSQLDate()}`)
20
+ .method('get')
21
+ .queryString(QueryString.builder()
22
+ .append('language', 'nl'))
23
+ .bearerToken()
24
+ .runArrayAdapter(StatisticsMarketingAdapter.parseSourceBreakdown);
25
+ }
26
+
27
+ async getTopCampaigns(merchantId: string, from: DateTime, to: DateTime): Promise<BaseResponse<StatisticsMarketingCampaignDto[]>> {
28
+ return await this
29
+ .request(`/merchants/${merchantId}/statistics/marketing/top-campaigns/${from.toSQLDate()}/${to.toSQLDate()}`)
30
+ .method('get')
31
+ .queryString(QueryString.builder()
32
+ .append('language', 'nl'))
33
+ .bearerToken()
34
+ .runArrayAdapter(StatisticsMarketingAdapter.parseTopCampaigns);
35
+ }
36
+
37
+ async getSourceMediumMatrix(merchantId: string, from: DateTime, to: DateTime): Promise<BaseResponse<StatisticsMarketingSourceMediumMatrixDto>> {
38
+ return await this
39
+ .request(`/merchants/${merchantId}/statistics/marketing/source-medium-matrix/${from.toSQLDate()}/${to.toSQLDate()}`)
40
+ .method('get')
41
+ .queryString(QueryString.builder()
42
+ .append('language', 'nl'))
43
+ .bearerToken()
44
+ .runAdapter(StatisticsMarketingAdapter.parseSourceMediumMatrix);
45
+ }
46
+
47
+ async getPaidAdAttribution(merchantId: string, from: DateTime, to: DateTime): Promise<BaseResponse<StatisticsPieChartDto>> {
48
+ return await this
49
+ .request(`/merchants/${merchantId}/statistics/marketing/paid-ad-attribution/${from.toSQLDate()}/${to.toSQLDate()}`)
50
+ .method('get')
51
+ .queryString(QueryString.builder()
52
+ .append('language', 'nl'))
53
+ .bearerToken()
54
+ .runAdapter(StatisticsChartAdapter.parsePie);
55
+ }
56
+
57
+ async getTopReferrers(merchantId: string, from: DateTime, to: DateTime): Promise<BaseResponse<StatisticsMarketingReferrerDto[]>> {
58
+ return await this
59
+ .request(`/merchants/${merchantId}/statistics/marketing/top-referrers/${from.toSQLDate()}/${to.toSQLDate()}`)
60
+ .method('get')
61
+ .queryString(QueryString.builder()
62
+ .append('language', 'nl'))
63
+ .bearerToken()
64
+ .runArrayAdapter(StatisticsMarketingAdapter.parseTopReferrers);
65
+ }
66
+
67
+ async getSourceFunnel(merchantId: string, from: DateTime, to: DateTime): Promise<BaseResponse<StatisticsMarketingSourceFunnelDto[]>> {
68
+ return await this
69
+ .request(`/merchants/${merchantId}/statistics/marketing/source-funnel/${from.toSQLDate()}/${to.toSQLDate()}`)
70
+ .method('get')
71
+ .queryString(QueryString.builder()
72
+ .append('language', 'nl'))
73
+ .bearerToken()
74
+ .runArrayAdapter(StatisticsMarketingAdapter.parseSourceFunnel);
75
+ }
76
+
77
+ async getShortlinkRoi(merchantId: string, from: DateTime, to: DateTime): Promise<BaseResponse<StatisticsMarketingShortlinkRoiDto[]>> {
78
+ return await this
79
+ .request(`/merchants/${merchantId}/statistics/marketing/shortlink-roi/${from.toSQLDate()}/${to.toSQLDate()}`)
80
+ .method('get')
81
+ .queryString(QueryString.builder()
82
+ .append('language', 'nl'))
83
+ .bearerToken()
84
+ .runArrayAdapter(StatisticsMarketingAdapter.parseShortlinkRoi);
85
+ }
86
+
87
+ async getAttributionCoverageTrend(merchantId: string, from: DateTime, to: DateTime): Promise<BaseResponse<StatisticsChartDto>> {
88
+ return await this
89
+ .request(`/merchants/${merchantId}/statistics/marketing/attribution-coverage-trend/${from.toSQLDate()}/${to.toSQLDate()}`)
90
+ .method('get')
91
+ .queryString(QueryString.builder()
92
+ .append('language', 'nl'))
93
+ .bearerToken()
94
+ .runAdapter(StatisticsChartAdapter.parseChart);
95
+ }
96
+ }
@@ -1,8 +1,7 @@
1
1
  import { BaseResponse, BaseService, QueryString } from '@basmilius/http-client';
2
- import type { ApexOptions } from 'apexcharts';
3
2
  import type { DateTime } from 'luxon';
4
- import { StatisticsOperationsAdapter } from '#data/adapter';
5
- import type { StatisticsOperationsAppTeamDto, StatisticsOperationsOverviewDto, StatisticsOperationsTasksOverviewDto } from '#data/dto';
3
+ import { StatisticsChartAdapter, StatisticsOperationsAdapter } from '#data/adapter';
4
+ import type { StatisticsChartDto, StatisticsOperationsAppTeamDto, StatisticsOperationsNoShowRateDto, StatisticsOperationsOverviewDto, StatisticsOperationsScanTimeDistributionDto, StatisticsOperationsStewardDto, StatisticsOperationsStockUtilizationDto } from '#data/dto';
6
5
 
7
6
  export class MerchantStatisticsOperationsService extends BaseService {
8
7
  async getOverview(merchantId: string, from: DateTime, to: DateTime): Promise<BaseResponse<StatisticsOperationsOverviewDto>> {
@@ -15,24 +14,24 @@ export class MerchantStatisticsOperationsService extends BaseService {
15
14
  .runAdapter(StatisticsOperationsAdapter.parseOverview);
16
15
  }
17
16
 
18
- async getScansTrend(merchantId: string, from: DateTime, to: DateTime): Promise<BaseResponse<ApexOptions>> {
17
+ async getScansTrend(merchantId: string, from: DateTime, to: DateTime): Promise<BaseResponse<StatisticsChartDto>> {
19
18
  return await this
20
19
  .request(`/merchants/${merchantId}/statistics/operations/scans-trend/${from.toSQLDate()}/${to.toSQLDate()}`)
21
20
  .method('get')
22
21
  .queryString(QueryString.builder()
23
22
  .append('language', 'nl'))
24
23
  .bearerToken()
25
- .run();
24
+ .runAdapter(StatisticsChartAdapter.parseChart);
26
25
  }
27
26
 
28
- async getCheckinRatePerEvent(merchantId: string, from: DateTime, to: DateTime): Promise<BaseResponse<ApexOptions>> {
27
+ async getCheckinRatePerEvent(merchantId: string, from: DateTime, to: DateTime): Promise<BaseResponse<StatisticsChartDto>> {
29
28
  return await this
30
29
  .request(`/merchants/${merchantId}/statistics/operations/checkin-rate-per-event/${from.toSQLDate()}/${to.toSQLDate()}`)
31
30
  .method('get')
32
31
  .queryString(QueryString.builder()
33
32
  .append('language', 'nl'))
34
33
  .bearerToken()
35
- .run();
34
+ .runAdapter(StatisticsChartAdapter.parseChart);
36
35
  }
37
36
 
38
37
  async getAppTeams(merchantId: string, from: DateTime, to: DateTime): Promise<BaseResponse<StatisticsOperationsAppTeamDto[]>> {
@@ -45,13 +44,43 @@ export class MerchantStatisticsOperationsService extends BaseService {
45
44
  .runArrayAdapter(StatisticsOperationsAdapter.parseAppTeam);
46
45
  }
47
46
 
48
- async getTasksOverview(merchantId: string, from: DateTime, to: DateTime): Promise<BaseResponse<StatisticsOperationsTasksOverviewDto>> {
47
+ async getNoShowRate(merchantId: string, from: DateTime, to: DateTime): Promise<BaseResponse<StatisticsOperationsNoShowRateDto>> {
49
48
  return await this
50
- .request(`/merchants/${merchantId}/statistics/operations/tasks-overview/${from.toSQLDate()}/${to.toSQLDate()}`)
49
+ .request(`/merchants/${merchantId}/statistics/operations/no-show-rate/${from.toSQLDate()}/${to.toSQLDate()}`)
51
50
  .method('get')
52
51
  .queryString(QueryString.builder()
53
52
  .append('language', 'nl'))
54
53
  .bearerToken()
55
- .runAdapter(StatisticsOperationsAdapter.parseTasksOverview);
54
+ .runAdapter(StatisticsOperationsAdapter.parseNoShowRate);
55
+ }
56
+
57
+ async getScanTimeDistribution(merchantId: string, from: DateTime, to: DateTime): Promise<BaseResponse<StatisticsOperationsScanTimeDistributionDto>> {
58
+ return await this
59
+ .request(`/merchants/${merchantId}/statistics/operations/scan-time-distribution/${from.toSQLDate()}/${to.toSQLDate()}`)
60
+ .method('get')
61
+ .queryString(QueryString.builder()
62
+ .append('language', 'nl'))
63
+ .bearerToken()
64
+ .runAdapter(StatisticsOperationsAdapter.parseScanTimeDistribution);
65
+ }
66
+
67
+ async getStewardLeaderboard(merchantId: string, from: DateTime, to: DateTime): Promise<BaseResponse<StatisticsOperationsStewardDto[]>> {
68
+ return await this
69
+ .request(`/merchants/${merchantId}/statistics/operations/steward-leaderboard/${from.toSQLDate()}/${to.toSQLDate()}`)
70
+ .method('get')
71
+ .queryString(QueryString.builder()
72
+ .append('language', 'nl'))
73
+ .bearerToken()
74
+ .runArrayAdapter(StatisticsOperationsAdapter.parseSteward);
75
+ }
76
+
77
+ async getStockUtilization(merchantId: string, from: DateTime, to: DateTime): Promise<BaseResponse<StatisticsOperationsStockUtilizationDto[]>> {
78
+ return await this
79
+ .request(`/merchants/${merchantId}/statistics/operations/stock-utilization/${from.toSQLDate()}/${to.toSQLDate()}`)
80
+ .method('get')
81
+ .queryString(QueryString.builder()
82
+ .append('language', 'nl'))
83
+ .bearerToken()
84
+ .runArrayAdapter(StatisticsOperationsAdapter.parseStockUtilization);
56
85
  }
57
86
  }
@@ -1,7 +1,6 @@
1
1
  import { BaseResponse, BaseService, QueryString } from '@basmilius/http-client';
2
- import type { ApexOptions } from 'apexcharts';
3
- import { PaymentAdapter, StatisticsAdapter, StatisticsOverviewAdapter } from '#data/adapter';
4
- import type { CostDto, StatisticsOverviewBestRevenueMonthDto, StatisticsOverviewEventPerformanceDto, StatisticsOverviewKPIsDto, StatisticsTrendDto } from '#data/dto';
2
+ import { PaymentAdapter, StatisticsAdapter, StatisticsChartAdapter, StatisticsOverviewAdapter } from '#data/adapter';
3
+ import type { CostDto, StatisticsChartDto, StatisticsOverviewBestRevenueMonthDto, StatisticsOverviewCancellationFunnelDto, StatisticsOverviewEventPerformanceDto, StatisticsOverviewKPIsDto, StatisticsOverviewReservationConversionRateDto, StatisticsOverviewTopShopDto, StatisticsTrendDto } from '#data/dto';
5
4
 
6
5
  export class MerchantStatisticsOverviewService extends BaseService {
7
6
  async getBestRevenueMonth(merchantId: string): Promise<BaseResponse<StatisticsOverviewBestRevenueMonthDto>> {
@@ -34,14 +33,14 @@ export class MerchantStatisticsOverviewService extends BaseService {
34
33
  .runAdapter(StatisticsOverviewAdapter.parseKPIs);
35
34
  }
36
35
 
37
- async getRevenueAnalysis(merchantId: string): Promise<BaseResponse<ApexOptions>> {
36
+ async getRevenueAnalysis(merchantId: string): Promise<BaseResponse<StatisticsChartDto>> {
38
37
  return await this
39
38
  .request(`/merchants/${merchantId}/statistics/overview/revenue-analysis`)
40
39
  .method('get')
41
40
  .queryString(QueryString.builder()
42
41
  .append('language', 'nl'))
43
42
  .bearerToken()
44
- .run();
43
+ .runAdapter(StatisticsChartAdapter.parseChart);
45
44
  }
46
45
 
47
46
  async getRevenueMonthComparison(merchantId: string): Promise<BaseResponse<StatisticsTrendDto<CostDto>>> {
@@ -53,4 +52,34 @@ export class MerchantStatisticsOverviewService extends BaseService {
53
52
  .bearerToken()
54
53
  .runAdapter(r => StatisticsAdapter.parseTrend(r, PaymentAdapter.parseCost));
55
54
  }
55
+
56
+ async getTopShops(merchantId: string): Promise<BaseResponse<StatisticsOverviewTopShopDto[]>> {
57
+ return await this
58
+ .request(`/merchants/${merchantId}/statistics/overview/top-shops`)
59
+ .method('get')
60
+ .queryString(QueryString.builder()
61
+ .append('language', 'nl'))
62
+ .bearerToken()
63
+ .runArrayAdapter(StatisticsOverviewAdapter.parseTopShop);
64
+ }
65
+
66
+ async getCancellationFunnel(merchantId: string): Promise<BaseResponse<StatisticsOverviewCancellationFunnelDto>> {
67
+ return await this
68
+ .request(`/merchants/${merchantId}/statistics/overview/cancellation-funnel`)
69
+ .method('get')
70
+ .queryString(QueryString.builder()
71
+ .append('language', 'nl'))
72
+ .bearerToken()
73
+ .runAdapter(StatisticsOverviewAdapter.parseCancellationFunnel);
74
+ }
75
+
76
+ async getReservationConversionRate(merchantId: string): Promise<BaseResponse<StatisticsOverviewReservationConversionRateDto>> {
77
+ return await this
78
+ .request(`/merchants/${merchantId}/statistics/overview/reservation-conversion-rate`)
79
+ .method('get')
80
+ .queryString(QueryString.builder()
81
+ .append('language', 'nl'))
82
+ .bearerToken()
83
+ .runAdapter(StatisticsOverviewAdapter.parseReservationConversionRate);
84
+ }
56
85
  }
@@ -0,0 +1,76 @@
1
+ import { BaseResponse, BaseService, QueryString } from '@basmilius/http-client';
2
+ import type { DateTime } from 'luxon';
3
+ import { StatisticsChartAdapter, StatisticsRefundsAdapter } from '#data/adapter';
4
+ import type { StatisticsChartDto, StatisticsPieChartDto, StatisticsRefundsAmountDistributionDto, StatisticsRefundsOverviewDto, StatisticsRefundsTopEventDto, StatisticsRefundsVelocityDto } from '#data/dto';
5
+
6
+ export class MerchantStatisticsRefundsService extends BaseService {
7
+ async getOverview(merchantId: string, from: DateTime, to: DateTime): Promise<BaseResponse<StatisticsRefundsOverviewDto>> {
8
+ return await this
9
+ .request(`/merchants/${merchantId}/statistics/refunds/overview/${from.toSQLDate()}/${to.toSQLDate()}`)
10
+ .method('get')
11
+ .queryString(QueryString.builder()
12
+ .append('language', 'nl'))
13
+ .bearerToken()
14
+ .runAdapter(StatisticsRefundsAdapter.parseOverview);
15
+ }
16
+
17
+ async getRefundRateTrend(merchantId: string, from: DateTime, to: DateTime): Promise<BaseResponse<StatisticsChartDto>> {
18
+ return await this
19
+ .request(`/merchants/${merchantId}/statistics/refunds/refund-rate-trend/${from.toSQLDate()}/${to.toSQLDate()}`)
20
+ .method('get')
21
+ .queryString(QueryString.builder()
22
+ .append('language', 'nl'))
23
+ .bearerToken()
24
+ .runAdapter(StatisticsChartAdapter.parseChart);
25
+ }
26
+
27
+ async getReasonsDistribution(merchantId: string, from: DateTime, to: DateTime): Promise<BaseResponse<StatisticsPieChartDto>> {
28
+ return await this
29
+ .request(`/merchants/${merchantId}/statistics/refunds/reasons-distribution/${from.toSQLDate()}/${to.toSQLDate()}`)
30
+ .method('get')
31
+ .queryString(QueryString.builder()
32
+ .append('language', 'nl'))
33
+ .bearerToken()
34
+ .runAdapter(StatisticsChartAdapter.parsePie);
35
+ }
36
+
37
+ async getTopEvents(merchantId: string, from: DateTime, to: DateTime): Promise<BaseResponse<StatisticsRefundsTopEventDto[]>> {
38
+ return await this
39
+ .request(`/merchants/${merchantId}/statistics/refunds/top-events/${from.toSQLDate()}/${to.toSQLDate()}`)
40
+ .method('get')
41
+ .queryString(QueryString.builder()
42
+ .append('language', 'nl'))
43
+ .bearerToken()
44
+ .runArrayAdapter(StatisticsRefundsAdapter.parseTopEvents);
45
+ }
46
+
47
+ async getVelocity(merchantId: string, from: DateTime, to: DateTime): Promise<BaseResponse<StatisticsRefundsVelocityDto>> {
48
+ return await this
49
+ .request(`/merchants/${merchantId}/statistics/refunds/velocity/${from.toSQLDate()}/${to.toSQLDate()}`)
50
+ .method('get')
51
+ .queryString(QueryString.builder()
52
+ .append('language', 'nl'))
53
+ .bearerToken()
54
+ .runAdapter(StatisticsRefundsAdapter.parseVelocity);
55
+ }
56
+
57
+ async getAmountDistribution(merchantId: string, from: DateTime, to: DateTime): Promise<BaseResponse<StatisticsRefundsAmountDistributionDto>> {
58
+ return await this
59
+ .request(`/merchants/${merchantId}/statistics/refunds/amount-distribution/${from.toSQLDate()}/${to.toSQLDate()}`)
60
+ .method('get')
61
+ .queryString(QueryString.builder()
62
+ .append('language', 'nl'))
63
+ .bearerToken()
64
+ .runAdapter(StatisticsRefundsAdapter.parseAmountDistribution);
65
+ }
66
+
67
+ async getNetRevenueTrend(merchantId: string, from: DateTime, to: DateTime): Promise<BaseResponse<StatisticsChartDto>> {
68
+ return await this
69
+ .request(`/merchants/${merchantId}/statistics/refunds/net-revenue-trend/${from.toSQLDate()}/${to.toSQLDate()}`)
70
+ .method('get')
71
+ .queryString(QueryString.builder()
72
+ .append('language', 'nl'))
73
+ .bearerToken()
74
+ .runAdapter(StatisticsChartAdapter.parseChart);
75
+ }
76
+ }