@passly-nl/data 1.0.5 → 1.2.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.
- package/dist/index.d.mts +1118 -171
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +5 -5
- package/dist/index.mjs.map +1 -1
- package/package.json +16 -11
- package/src/adapter/AiChatAdapter.ts +37 -0
- package/src/adapter/AiUsageAdapter.ts +42 -0
- package/src/adapter/CashFlowAdapter.ts +70 -0
- package/src/adapter/ContentCalendarAdapter.ts +34 -0
- package/src/adapter/DiscountCodeAdapter.ts +33 -0
- package/src/adapter/EventAdapter.ts +8 -71
- package/src/adapter/EventStatisticsBuyersAdapter.ts +27 -0
- package/src/adapter/EventStatisticsOperationsAdapter.ts +41 -0
- package/src/adapter/EventStatisticsOverviewAdapter.ts +39 -0
- package/src/adapter/EventStatisticsSalesAdapter.ts +21 -0
- package/src/adapter/MarketingAttributionAdapter.ts +18 -0
- package/src/adapter/MerchantAdapter.ts +3 -1
- package/src/adapter/OrderAdapter.ts +6 -2
- package/src/adapter/ProductAdapter.ts +4 -0
- package/src/adapter/PublicShopAdapter.ts +1 -2
- package/src/adapter/RefundAdapter.ts +34 -0
- package/src/adapter/ReservationAdapter.ts +3 -2
- package/src/adapter/StatisticsEventsAdapter.ts +6 -2
- package/src/adapter/StatisticsGrowthAdapter.ts +38 -0
- package/src/adapter/StatisticsInsightsAdapter.ts +39 -0
- package/src/adapter/StatisticsOperationsAdapter.ts +47 -0
- package/src/adapter/SubscriptionAdapter.ts +32 -0
- package/src/adapter/TicketAdapter.ts +1 -0
- package/src/adapter/index.ts +16 -1
- package/src/dto/aiChat/AiChatConversationDto.ts +49 -0
- package/src/dto/aiChat/AiChatMessageDto.ts +73 -0
- package/src/dto/aiChat/AiChatToolCallDto.ts +58 -0
- package/src/dto/aiChat/index.ts +3 -0
- package/src/dto/aiUsage/AiUsageDto.ts +110 -0
- package/src/dto/aiUsage/AiUsageFeatureStatusDto.ts +39 -0
- package/src/dto/aiUsage/AiUsagePeriodDto.ts +80 -0
- package/src/dto/aiUsage/index.ts +3 -0
- package/src/dto/cashFlow/CashFlowDiscountDto.ts +40 -0
- package/src/dto/cashFlow/CashFlowDto.ts +99 -0
- package/src/dto/cashFlow/CashFlowPaymentDto.ts +50 -0
- package/src/dto/cashFlow/CashFlowPlatformCostDto.ts +29 -0
- package/src/dto/cashFlow/CashFlowRefundDto.ts +101 -0
- package/src/dto/cashFlow/CashFlowTimelineEventDto.ts +71 -0
- package/src/dto/cashFlow/index.ts +6 -0
- package/src/dto/contentCalendar/ContentCalendarItemCreatorDto.ts +69 -0
- package/src/dto/contentCalendar/ContentCalendarItemDto.ts +133 -0
- package/src/dto/contentCalendar/index.ts +2 -0
- package/src/dto/discountCode/DiscountCodeDto.ts +141 -0
- package/src/dto/discountCode/index.ts +1 -0
- package/src/dto/event/TimeSlotDto.ts +59 -0
- package/src/dto/event/index.ts +1 -9
- package/src/dto/eventStatistics/EventStatisticsAppTeamDto.ts +58 -0
- package/src/dto/{event/EventStatisticsBuyerTotalsDto.ts → eventStatistics/EventStatisticsBuyersOverviewDto.ts} +18 -18
- package/src/dto/{event → eventStatistics}/EventStatisticsFinancialDto.ts +11 -1
- package/src/dto/eventStatistics/EventStatisticsKpisDto.ts +119 -0
- package/src/dto/eventStatistics/EventStatisticsOperationsOverviewDto.ts +58 -0
- package/src/dto/eventStatistics/EventStatisticsSalesFlowChartDto.ts +66 -0
- package/src/dto/{event/EventStatisticsOrderTotalsDto.ts → eventStatistics/EventStatisticsStatusDto.ts} +1 -1
- package/src/dto/{event/EventStatisticsSwapTotalsDto.ts → eventStatistics/EventStatisticsSwapsDto.ts} +1 -1
- package/src/dto/eventStatistics/index.ts +9 -0
- package/src/dto/index.ts +10 -0
- package/src/dto/marketingAttribution/MarketingAttributionDto.ts +88 -0
- package/src/dto/marketingAttribution/index.ts +1 -0
- package/src/dto/merchant/MerchantDto.ts +39 -2
- package/src/dto/order/OrderDto.ts +42 -2
- package/src/dto/product/ProductDto.ts +42 -2
- package/src/dto/publicShop/PublicShopCartProductDto.ts +1 -11
- package/src/dto/publicShop/PublicShopTimeSlotDto.ts +1 -11
- package/src/dto/realtime/AiChatMessageCompletedMessageDto.ts +9 -0
- package/src/dto/realtime/ContentCalendarGenerationCompletedMessageDto.ts +8 -0
- package/src/dto/realtime/InsightCardCompletedMessageDto.ts +9 -0
- package/src/dto/realtime/index.ts +3 -0
- package/src/dto/refund/RefundDto.ts +91 -0
- package/src/dto/{event/EventStatisticsScansPerAppTeamDto.ts → refund/RefundInitiatorDto.ts} +2 -12
- package/src/dto/refund/RefundTicketRefDto.ts +28 -0
- package/src/dto/refund/index.ts +3 -0
- package/src/dto/reservation/ReservationDto.ts +12 -2
- package/src/dto/statistics/InsightDto.ts +130 -0
- package/src/dto/statistics/InsightSignalDto.ts +29 -0
- package/src/dto/statistics/InsightsResponseDto.ts +50 -0
- package/src/dto/statistics/MilestoneDto.ts +80 -0
- package/src/dto/statistics/StatisticsGrowthOverviewDto.ts +59 -0
- package/src/dto/statistics/StatisticsOperationsAppTeamDto.ts +78 -0
- package/src/dto/statistics/StatisticsOperationsOverviewDto.ts +58 -0
- package/src/dto/statistics/StatisticsOperationsTaskAssigneeDto.ts +48 -0
- package/src/dto/statistics/StatisticsOperationsTasksOverviewDto.ts +69 -0
- package/src/dto/statistics/index.ts +9 -0
- package/src/dto/subscription/MerchantSubscriptionDto.ts +91 -0
- package/src/dto/subscription/SubscriptionPlanDto.ts +80 -0
- package/src/dto/subscription/index.ts +2 -0
- package/src/dto/ticket/TicketDto.ts +11 -1
- package/src/service/AdminMerchantSubscriptionService.ts +34 -0
- package/src/service/MerchantAiChatService.ts +51 -0
- package/src/service/MerchantAiSettingsService.ts +14 -0
- package/src/service/MerchantAiUsageService.ts +32 -0
- package/src/service/MerchantDiscountCodeService.ts +42 -0
- package/src/service/MerchantDiscountCodesService.ts +45 -0
- package/src/service/MerchantEventContentCalendarService.ts +122 -0
- package/src/service/MerchantEventProductService.ts +34 -8
- package/src/service/MerchantEventProductsService.ts +3 -2
- package/src/service/MerchantEventStatisticsBuyersService.ts +86 -0
- package/src/service/MerchantEventStatisticsOperationsService.ts +56 -0
- package/src/service/MerchantEventStatisticsOverviewService.ts +35 -0
- package/src/service/MerchantEventStatisticsSalesService.ts +76 -0
- package/src/service/MerchantEventTimeSlotService.ts +51 -0
- package/src/service/MerchantEventTimeSlotsService.ts +33 -0
- package/src/service/MerchantOrderService.ts +28 -2
- package/src/service/MerchantStatisticsEventsService.ts +43 -1
- package/src/service/MerchantStatisticsGrowthService.ts +37 -0
- package/src/service/MerchantStatisticsInsightsService.ts +15 -0
- package/src/service/MerchantStatisticsOperationsService.ts +57 -0
- package/src/service/PublicOrderService.ts +30 -0
- package/src/service/PublicShopService.ts +25 -7
- package/src/service/index.ts +17 -2
- package/src/types/aiUsage.ts +5 -0
- package/src/types/auth.ts +2 -0
- package/src/types/cashFlow.ts +10 -0
- package/src/types/contentCalendar.ts +3 -0
- package/src/types/discountCode.ts +8 -0
- package/src/types/feature.ts +14 -0
- package/src/types/general.ts +11 -0
- package/src/types/index.ts +9 -0
- package/src/types/insights.ts +24 -0
- package/src/types/milestone.ts +7 -0
- package/src/types/refund.ts +12 -0
- package/src/types/subscription.ts +1 -0
- package/src/dto/event/EventStatisticsOrdersDto.ts +0 -30
- package/src/dto/event/EventStatisticsScanTotalsDto.ts +0 -38
- package/src/dto/event/EventStatisticsScansDto.ts +0 -40
- package/src/service/MerchantEventStatisticsService.ts +0 -65
- /package/src/dto/{event → eventStatistics}/EventStatisticsAttendanceDto.ts +0 -0
|
@@ -0,0 +1,76 @@
|
|
|
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';
|
|
5
|
+
|
|
6
|
+
export class MerchantEventStatisticsSalesService extends BaseService {
|
|
7
|
+
async getLifetimeTotals(merchantId: string, eventId: string): Promise<BaseResponse<StatisticsSalesLifetimeTotalsDto>> {
|
|
8
|
+
return await this
|
|
9
|
+
.request(`/merchants/${merchantId}/events/${eventId}/statistics/sales/lifetime-totals`)
|
|
10
|
+
.method('get')
|
|
11
|
+
.queryString(QueryString.builder()
|
|
12
|
+
.append('language', 'nl'))
|
|
13
|
+
.bearerToken()
|
|
14
|
+
.runAdapter(StatisticsSalesAdapter.parseLifetimeTotals);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
async getSalesFlowChart(merchantId: string, eventId: string): Promise<BaseResponse<EventStatisticsSalesFlowChartDto>> {
|
|
18
|
+
return await this
|
|
19
|
+
.request(`/merchants/${merchantId}/events/${eventId}/statistics/sales/sales-flow-chart`)
|
|
20
|
+
.method('get')
|
|
21
|
+
.queryString(QueryString.builder()
|
|
22
|
+
.append('language', 'nl'))
|
|
23
|
+
.bearerToken()
|
|
24
|
+
.runAdapter(EventStatisticsSalesAdapter.parseSalesFlowChart);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
async getRevenueTrend(merchantId: string, eventId: string): Promise<BaseResponse<ApexOptions>> {
|
|
28
|
+
return await this
|
|
29
|
+
.request(`/merchants/${merchantId}/events/${eventId}/statistics/sales/revenue-trend`)
|
|
30
|
+
.method('get')
|
|
31
|
+
.queryString(QueryString.builder()
|
|
32
|
+
.append('language', 'nl'))
|
|
33
|
+
.bearerToken()
|
|
34
|
+
.run();
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
async getPaymentMethodsChart(merchantId: string, eventId: string): Promise<BaseResponse<ApexOptions>> {
|
|
38
|
+
return await this
|
|
39
|
+
.request(`/merchants/${merchantId}/events/${eventId}/statistics/sales/payment-methods-chart`)
|
|
40
|
+
.method('get')
|
|
41
|
+
.queryString(QueryString.builder()
|
|
42
|
+
.append('language', 'nl'))
|
|
43
|
+
.bearerToken()
|
|
44
|
+
.run();
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
async getPurchaseBehavior(merchantId: string, eventId: string): Promise<BaseResponse<StatisticsSalesPurchaseBehaviorDto>> {
|
|
48
|
+
return await this
|
|
49
|
+
.request(`/merchants/${merchantId}/events/${eventId}/statistics/sales/purchase-behavior`)
|
|
50
|
+
.method('get')
|
|
51
|
+
.queryString(QueryString.builder()
|
|
52
|
+
.append('language', 'nl'))
|
|
53
|
+
.bearerToken()
|
|
54
|
+
.runAdapter(StatisticsSalesAdapter.parsePurchaseBehavior);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
async getTransactionSuccessRate(merchantId: string, eventId: string): Promise<BaseResponse<StatisticsSalesTransactionSuccessRateDto>> {
|
|
58
|
+
return await this
|
|
59
|
+
.request(`/merchants/${merchantId}/events/${eventId}/statistics/sales/transaction-success-rate`)
|
|
60
|
+
.method('get')
|
|
61
|
+
.queryString(QueryString.builder()
|
|
62
|
+
.append('language', 'nl'))
|
|
63
|
+
.bearerToken()
|
|
64
|
+
.runAdapter(StatisticsSalesAdapter.parseTransactionSuccessRate);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
async getSalesByDayOfWeek(merchantId: string, eventId: string): Promise<BaseResponse<ApexOptions>> {
|
|
68
|
+
return await this
|
|
69
|
+
.request(`/merchants/${merchantId}/events/${eventId}/statistics/sales/sales-by-day-of-week`)
|
|
70
|
+
.method('get')
|
|
71
|
+
.queryString(QueryString.builder()
|
|
72
|
+
.append('language', 'nl'))
|
|
73
|
+
.bearerToken()
|
|
74
|
+
.run();
|
|
75
|
+
}
|
|
76
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { BaseResponse, BaseService, QueryString } from '@basmilius/http-client';
|
|
2
|
+
import type { DateTime } from 'luxon';
|
|
3
|
+
import { EventAdapter } from '#data/adapter';
|
|
4
|
+
import type { TimeSlotDto } from '#data/dto';
|
|
5
|
+
|
|
6
|
+
export class MerchantEventTimeSlotService extends BaseService {
|
|
7
|
+
async get(merchantId: string, eventId: string, timeSlotId: string): Promise<BaseResponse<TimeSlotDto>> {
|
|
8
|
+
return await this
|
|
9
|
+
.request(`/merchants/${merchantId}/events/${eventId}/time-slots/${timeSlotId}`)
|
|
10
|
+
.method('get')
|
|
11
|
+
.bearerToken()
|
|
12
|
+
.queryString(QueryString.builder()
|
|
13
|
+
.append('language', 'nl'))
|
|
14
|
+
.runAdapter(EventAdapter.parseTimeSlot);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
async update(merchantId: string, eventId: string, timeSlotId: string, fromTime?: DateTime, toTime?: DateTime, label?: string | null): Promise<BaseResponse<TimeSlotDto>> {
|
|
18
|
+
const body: Record<string, unknown> = {};
|
|
19
|
+
|
|
20
|
+
if (fromTime !== undefined) {
|
|
21
|
+
body.from_time = fromTime.toISO();
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
if (toTime !== undefined) {
|
|
25
|
+
body.to_time = toTime.toISO();
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
if (label !== undefined) {
|
|
29
|
+
body.label = label;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
return await this
|
|
33
|
+
.request(`/merchants/${merchantId}/events/${eventId}/time-slots/${timeSlotId}`)
|
|
34
|
+
.method('put')
|
|
35
|
+
.bearerToken()
|
|
36
|
+
.queryString(QueryString.builder()
|
|
37
|
+
.append('language', 'nl'))
|
|
38
|
+
.body(body)
|
|
39
|
+
.runAdapter(EventAdapter.parseTimeSlot);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
async delete(merchantId: string, eventId: string, timeSlotId: string): Promise<BaseResponse<never>> {
|
|
43
|
+
return await this
|
|
44
|
+
.request(`/merchants/${merchantId}/events/${eventId}/time-slots/${timeSlotId}`)
|
|
45
|
+
.method('delete')
|
|
46
|
+
.bearerToken()
|
|
47
|
+
.queryString(QueryString.builder()
|
|
48
|
+
.append('language', 'nl'))
|
|
49
|
+
.runEmpty();
|
|
50
|
+
}
|
|
51
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { BaseResponse, BaseService, Paginated, QueryString } from '@basmilius/http-client';
|
|
2
|
+
import type { DateTime } from 'luxon';
|
|
3
|
+
import { EventAdapter } from '#data/adapter';
|
|
4
|
+
import type { TimeSlotDto } from '#data/dto';
|
|
5
|
+
|
|
6
|
+
export class MerchantEventTimeSlotsService extends BaseService {
|
|
7
|
+
async list(merchantId: string, eventId: string, offset: number, limit: number): Promise<BaseResponse<Paginated<TimeSlotDto>>> {
|
|
8
|
+
return await this
|
|
9
|
+
.request(`/merchants/${merchantId}/events/${eventId}/time-slots`)
|
|
10
|
+
.method('get')
|
|
11
|
+
.queryString(QueryString.builder()
|
|
12
|
+
.append('language', 'nl')
|
|
13
|
+
.append('offset', offset)
|
|
14
|
+
.append('limit', limit))
|
|
15
|
+
.bearerToken()
|
|
16
|
+
.runPaginatedAdapter(EventAdapter.parseTimeSlot);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
async create(merchantId: string, eventId: string, fromTime: DateTime, toTime: DateTime, label: string | null = null): Promise<BaseResponse<TimeSlotDto>> {
|
|
20
|
+
return await this
|
|
21
|
+
.request(`/merchants/${merchantId}/events/${eventId}/time-slots`)
|
|
22
|
+
.method('post')
|
|
23
|
+
.bearerToken()
|
|
24
|
+
.queryString(QueryString.builder()
|
|
25
|
+
.append('language', 'nl'))
|
|
26
|
+
.body({
|
|
27
|
+
from_time: fromTime.toISO(),
|
|
28
|
+
to_time: toTime.toISO(),
|
|
29
|
+
label
|
|
30
|
+
})
|
|
31
|
+
.runAdapter(EventAdapter.parseTimeSlot);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { BaseResponse, BaseService, BlobResponse, QueryString } from '@basmilius/http-client';
|
|
2
|
-
import { OrderAdapter, TicketAdapter } from '#data/adapter';
|
|
3
|
-
import type { OrderDto, TicketDto } from '#data/dto';
|
|
2
|
+
import { CashFlowAdapter, OrderAdapter, RefundAdapter, TicketAdapter } from '#data/adapter';
|
|
3
|
+
import type { CashFlowDto, OrderDto, RefundDto, TicketDto } from '#data/dto';
|
|
4
|
+
import type { RefundReason } from '#data/types';
|
|
4
5
|
|
|
5
6
|
export class MerchantOrderService extends BaseService {
|
|
6
7
|
async get(merchantId: string, orderId: string): Promise<BaseResponse<OrderDto>> {
|
|
@@ -13,6 +14,16 @@ export class MerchantOrderService extends BaseService {
|
|
|
13
14
|
.runAdapter(OrderAdapter.parseOrder);
|
|
14
15
|
}
|
|
15
16
|
|
|
17
|
+
async getCashFlow(merchantId: string, orderId: string): Promise<BaseResponse<CashFlowDto>> {
|
|
18
|
+
return await this
|
|
19
|
+
.request(`/merchants/${merchantId}/orders/${orderId}/cash-flow`)
|
|
20
|
+
.method('get')
|
|
21
|
+
.bearerToken()
|
|
22
|
+
.queryString(QueryString.builder()
|
|
23
|
+
.append('language', 'nl'))
|
|
24
|
+
.runAdapter(CashFlowAdapter.parseCashFlow);
|
|
25
|
+
}
|
|
26
|
+
|
|
16
27
|
async getPasses(merchantId: string, orderId: string): Promise<BlobResponse> {
|
|
17
28
|
return await this
|
|
18
29
|
.request(`/merchants/${merchantId}/orders/${orderId}/passes`)
|
|
@@ -43,6 +54,21 @@ export class MerchantOrderService extends BaseService {
|
|
|
43
54
|
.runArrayAdapter(TicketAdapter.parseTicket);
|
|
44
55
|
}
|
|
45
56
|
|
|
57
|
+
async postRefund(merchantId: string, orderId: string, ticketIds: string[], reason: RefundReason, note: string | null = null): Promise<BaseResponse<RefundDto>> {
|
|
58
|
+
return await this
|
|
59
|
+
.request(`/merchants/${merchantId}/orders/${orderId}/refund`)
|
|
60
|
+
.method('post')
|
|
61
|
+
.bearerToken()
|
|
62
|
+
.queryString(QueryString.builder()
|
|
63
|
+
.append('language', 'nl'))
|
|
64
|
+
.body({
|
|
65
|
+
ticket_ids: ticketIds,
|
|
66
|
+
reason,
|
|
67
|
+
note
|
|
68
|
+
})
|
|
69
|
+
.runAdapter(RefundAdapter.parseRefund);
|
|
70
|
+
}
|
|
71
|
+
|
|
46
72
|
async postResend(merchantId: string, orderId: string): Promise<BaseResponse<never>> {
|
|
47
73
|
return await this
|
|
48
74
|
.request(`/merchants/${merchantId}/orders/${orderId}/resend`)
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { BaseResponse, BaseService, QueryString } from '@basmilius/http-client';
|
|
2
|
+
import type { ApexOptions } from 'apexcharts';
|
|
3
|
+
import type { DateTime } from 'luxon';
|
|
2
4
|
import { StatisticsEventsAdapter } from '#data/adapter';
|
|
3
|
-
import type { StatisticsEventsOverviewDto } from '#data/dto';
|
|
5
|
+
import type { StatisticsEventsOverviewDto, StatisticsOverviewEventPerformanceDto } from '#data/dto';
|
|
4
6
|
|
|
5
7
|
export class MerchantStatisticsEventsService extends BaseService {
|
|
6
8
|
async getOverview(merchantId: string): Promise<BaseResponse<StatisticsEventsOverviewDto>> {
|
|
@@ -12,4 +14,44 @@ export class MerchantStatisticsEventsService extends BaseService {
|
|
|
12
14
|
.bearerToken()
|
|
13
15
|
.runAdapter(StatisticsEventsAdapter.parseOverview);
|
|
14
16
|
}
|
|
17
|
+
|
|
18
|
+
async getPerformance(merchantId: string, from: DateTime, to: DateTime): Promise<BaseResponse<StatisticsOverviewEventPerformanceDto>> {
|
|
19
|
+
return await this
|
|
20
|
+
.request(`/merchants/${merchantId}/statistics/events/performance/${from.toSQLDate()}/${to.toSQLDate()}`)
|
|
21
|
+
.method('get')
|
|
22
|
+
.queryString(QueryString.builder()
|
|
23
|
+
.append('language', 'nl'))
|
|
24
|
+
.bearerToken()
|
|
25
|
+
.runAdapter(StatisticsEventsAdapter.parsePerformance);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
async getSellThroughTrend(merchantId: string, from: DateTime, to: DateTime): Promise<BaseResponse<ApexOptions>> {
|
|
29
|
+
return await this
|
|
30
|
+
.request(`/merchants/${merchantId}/statistics/events/sell-through-trend/${from.toSQLDate()}/${to.toSQLDate()}`)
|
|
31
|
+
.method('get')
|
|
32
|
+
.queryString(QueryString.builder()
|
|
33
|
+
.append('language', 'nl'))
|
|
34
|
+
.bearerToken()
|
|
35
|
+
.run();
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
async getSalesVelocity(merchantId: string, from: DateTime, to: DateTime): Promise<BaseResponse<ApexOptions>> {
|
|
39
|
+
return await this
|
|
40
|
+
.request(`/merchants/${merchantId}/statistics/events/sales-velocity/${from.toSQLDate()}/${to.toSQLDate()}`)
|
|
41
|
+
.method('get')
|
|
42
|
+
.queryString(QueryString.builder()
|
|
43
|
+
.append('language', 'nl'))
|
|
44
|
+
.bearerToken()
|
|
45
|
+
.run();
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
async getPublicationStatus(merchantId: string, from: DateTime, to: DateTime): Promise<BaseResponse<ApexOptions>> {
|
|
49
|
+
return await this
|
|
50
|
+
.request(`/merchants/${merchantId}/statistics/events/publication-status/${from.toSQLDate()}/${to.toSQLDate()}`)
|
|
51
|
+
.method('get')
|
|
52
|
+
.queryString(QueryString.builder()
|
|
53
|
+
.append('language', 'nl'))
|
|
54
|
+
.bearerToken()
|
|
55
|
+
.run();
|
|
56
|
+
}
|
|
15
57
|
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { BaseResponse, BaseService, QueryString } from '@basmilius/http-client';
|
|
2
|
+
import type { ApexOptions } from 'apexcharts';
|
|
3
|
+
import type { DateTime } from 'luxon';
|
|
4
|
+
import { StatisticsGrowthAdapter } from '#data/adapter';
|
|
5
|
+
import type { MilestoneDto, StatisticsGrowthOverviewDto } from '#data/dto';
|
|
6
|
+
|
|
7
|
+
export class MerchantStatisticsGrowthService extends BaseService {
|
|
8
|
+
async getOverview(merchantId: string, from: DateTime, to: DateTime): Promise<BaseResponse<StatisticsGrowthOverviewDto>> {
|
|
9
|
+
return await this
|
|
10
|
+
.request(`/merchants/${merchantId}/statistics/growth/overview/${from.toSQLDate()}/${to.toSQLDate()}`)
|
|
11
|
+
.method('get')
|
|
12
|
+
.queryString(QueryString.builder()
|
|
13
|
+
.append('language', 'nl'))
|
|
14
|
+
.bearerToken()
|
|
15
|
+
.runAdapter(StatisticsGrowthAdapter.parseOverview);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
async getYearOverYear(merchantId: string, from: DateTime, to: DateTime): Promise<BaseResponse<ApexOptions>> {
|
|
19
|
+
return await this
|
|
20
|
+
.request(`/merchants/${merchantId}/statistics/growth/year-over-year/${from.toSQLDate()}/${to.toSQLDate()}`)
|
|
21
|
+
.method('get')
|
|
22
|
+
.queryString(QueryString.builder()
|
|
23
|
+
.append('language', 'nl'))
|
|
24
|
+
.bearerToken()
|
|
25
|
+
.run();
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
async getMilestones(merchantId: string): Promise<BaseResponse<MilestoneDto[]>> {
|
|
29
|
+
return await this
|
|
30
|
+
.request(`/merchants/${merchantId}/statistics/growth/milestones`)
|
|
31
|
+
.method('get')
|
|
32
|
+
.queryString(QueryString.builder()
|
|
33
|
+
.append('language', 'nl'))
|
|
34
|
+
.bearerToken()
|
|
35
|
+
.runArrayAdapter(StatisticsGrowthAdapter.parseMilestone);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { BaseResponse, BaseService, QueryString } from '@basmilius/http-client';
|
|
2
|
+
import { StatisticsInsightsAdapter } from '#data/adapter';
|
|
3
|
+
import type { InsightsResponseDto } from '#data/dto';
|
|
4
|
+
|
|
5
|
+
export class MerchantStatisticsInsightsService extends BaseService {
|
|
6
|
+
async getInsights(merchantId: string): Promise<BaseResponse<InsightsResponseDto>> {
|
|
7
|
+
return await this
|
|
8
|
+
.request(`/merchants/${merchantId}/statistics/insights`)
|
|
9
|
+
.method('get')
|
|
10
|
+
.queryString(QueryString.builder()
|
|
11
|
+
.append('language', 'nl'))
|
|
12
|
+
.bearerToken()
|
|
13
|
+
.runAdapter(StatisticsInsightsAdapter.parseInsightsResponse);
|
|
14
|
+
}
|
|
15
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { BaseResponse, BaseService, QueryString } from '@basmilius/http-client';
|
|
2
|
+
import type { ApexOptions } from 'apexcharts';
|
|
3
|
+
import type { DateTime } from 'luxon';
|
|
4
|
+
import { StatisticsOperationsAdapter } from '#data/adapter';
|
|
5
|
+
import type { StatisticsOperationsAppTeamDto, StatisticsOperationsOverviewDto, StatisticsOperationsTasksOverviewDto } from '#data/dto';
|
|
6
|
+
|
|
7
|
+
export class MerchantStatisticsOperationsService extends BaseService {
|
|
8
|
+
async getOverview(merchantId: string, from: DateTime, to: DateTime): Promise<BaseResponse<StatisticsOperationsOverviewDto>> {
|
|
9
|
+
return await this
|
|
10
|
+
.request(`/merchants/${merchantId}/statistics/operations/overview/${from.toSQLDate()}/${to.toSQLDate()}`)
|
|
11
|
+
.method('get')
|
|
12
|
+
.queryString(QueryString.builder()
|
|
13
|
+
.append('language', 'nl'))
|
|
14
|
+
.bearerToken()
|
|
15
|
+
.runAdapter(StatisticsOperationsAdapter.parseOverview);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
async getScansTrend(merchantId: string, from: DateTime, to: DateTime): Promise<BaseResponse<ApexOptions>> {
|
|
19
|
+
return await this
|
|
20
|
+
.request(`/merchants/${merchantId}/statistics/operations/scans-trend/${from.toSQLDate()}/${to.toSQLDate()}`)
|
|
21
|
+
.method('get')
|
|
22
|
+
.queryString(QueryString.builder()
|
|
23
|
+
.append('language', 'nl'))
|
|
24
|
+
.bearerToken()
|
|
25
|
+
.run();
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
async getCheckinRatePerEvent(merchantId: string, from: DateTime, to: DateTime): Promise<BaseResponse<ApexOptions>> {
|
|
29
|
+
return await this
|
|
30
|
+
.request(`/merchants/${merchantId}/statistics/operations/checkin-rate-per-event/${from.toSQLDate()}/${to.toSQLDate()}`)
|
|
31
|
+
.method('get')
|
|
32
|
+
.queryString(QueryString.builder()
|
|
33
|
+
.append('language', 'nl'))
|
|
34
|
+
.bearerToken()
|
|
35
|
+
.run();
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
async getAppTeams(merchantId: string, from: DateTime, to: DateTime): Promise<BaseResponse<StatisticsOperationsAppTeamDto[]>> {
|
|
39
|
+
return await this
|
|
40
|
+
.request(`/merchants/${merchantId}/statistics/operations/app-teams/${from.toSQLDate()}/${to.toSQLDate()}`)
|
|
41
|
+
.method('get')
|
|
42
|
+
.queryString(QueryString.builder()
|
|
43
|
+
.append('language', 'nl'))
|
|
44
|
+
.bearerToken()
|
|
45
|
+
.runArrayAdapter(StatisticsOperationsAdapter.parseAppTeam);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
async getTasksOverview(merchantId: string, from: DateTime, to: DateTime): Promise<BaseResponse<StatisticsOperationsTasksOverviewDto>> {
|
|
49
|
+
return await this
|
|
50
|
+
.request(`/merchants/${merchantId}/statistics/operations/tasks-overview/${from.toSQLDate()}/${to.toSQLDate()}`)
|
|
51
|
+
.method('get')
|
|
52
|
+
.queryString(QueryString.builder()
|
|
53
|
+
.append('language', 'nl'))
|
|
54
|
+
.bearerToken()
|
|
55
|
+
.runAdapter(StatisticsOperationsAdapter.parseTasksOverview);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
@@ -30,6 +30,36 @@ export class PublicOrderService extends BaseService {
|
|
|
30
30
|
.runAdapter(OrderAdapter.parseOrder);
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
+
async postDiscountCode(orderId: string, code: string): Promise<BaseResponse<OrderDto>> {
|
|
34
|
+
return await this
|
|
35
|
+
.request(`/orders/${orderId}/discount-code`)
|
|
36
|
+
.method('post')
|
|
37
|
+
.queryString(QueryString.builder()
|
|
38
|
+
.append('language', 'nl'))
|
|
39
|
+
.body({
|
|
40
|
+
code
|
|
41
|
+
})
|
|
42
|
+
.runAdapter(OrderAdapter.parseOrder);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
async deleteDiscountCode(orderId: string): Promise<BaseResponse<OrderDto>> {
|
|
46
|
+
return await this
|
|
47
|
+
.request(`/orders/${orderId}/discount-code`)
|
|
48
|
+
.method('delete')
|
|
49
|
+
.queryString(QueryString.builder()
|
|
50
|
+
.append('language', 'nl'))
|
|
51
|
+
.runAdapter(OrderAdapter.parseOrder);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
async postCheckoutFree(orderId: string): Promise<BaseResponse<TransactionDto>> {
|
|
55
|
+
return await this
|
|
56
|
+
.request(`/orders/${orderId}/checkout-free`)
|
|
57
|
+
.method('post')
|
|
58
|
+
.queryString(QueryString.builder()
|
|
59
|
+
.append('language', 'nl'))
|
|
60
|
+
.runAdapter(PaymentAdapter.parseTransaction);
|
|
61
|
+
}
|
|
62
|
+
|
|
33
63
|
async postPay(orderId: string, paymentMethodId: string): Promise<BaseResponse<TransactionDto>> {
|
|
34
64
|
return await this
|
|
35
65
|
.request(`/orders/${orderId}/pay`)
|
|
@@ -1,10 +1,27 @@
|
|
|
1
1
|
import { BaseResponse, BaseService, QueryString } from '@basmilius/http-client';
|
|
2
2
|
import type { DateTime } from 'luxon';
|
|
3
3
|
import { OrderAdapter, PublicShopAdapter } from '#data/adapter';
|
|
4
|
-
import type { OrderDto, PublicShopCartProductDto, PublicShopDto, PublicShopReservationDto } from '#data/dto';
|
|
4
|
+
import type { MarketingAttributionDto, OrderDto, PublicShopCartProductDto, PublicShopDto, PublicShopReservationDto } from '#data/dto';
|
|
5
5
|
import type { Gender } from '#data/types';
|
|
6
6
|
import { emptyNull } from '#data/util';
|
|
7
7
|
|
|
8
|
+
function attributionBody(attribution: MarketingAttributionDto | null): Record<string, string | null> {
|
|
9
|
+
if (attribution === null) {
|
|
10
|
+
return {};
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
return {
|
|
14
|
+
utm_source: attribution.utmSource,
|
|
15
|
+
utm_medium: attribution.utmMedium,
|
|
16
|
+
utm_campaign: attribution.utmCampaign,
|
|
17
|
+
utm_term: attribution.utmTerm,
|
|
18
|
+
utm_content: attribution.utmContent,
|
|
19
|
+
gclid: attribution.gclid,
|
|
20
|
+
fbclid: attribution.fbclid,
|
|
21
|
+
referrer: attribution.referrer
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
|
|
8
25
|
export class PublicShopService extends BaseService {
|
|
9
26
|
async get(shopId: string): Promise<BaseResponse<PublicShopDto>> {
|
|
10
27
|
return await this
|
|
@@ -15,7 +32,7 @@ export class PublicShopService extends BaseService {
|
|
|
15
32
|
.runAdapter(PublicShopAdapter.parsePublicShop);
|
|
16
33
|
}
|
|
17
34
|
|
|
18
|
-
async buy(shopId: string, reservationId: string, firstName: string, lastName: string, email: string, phoneNumber: string, dateOfBirth: DateTime | null, gender: Gender | null, addressCity: string | null, addressCountry: string | null, addressNumber: string | null, addressPostalCode: string | null, addressStreet: string | null): Promise<BaseResponse<OrderDto>> {
|
|
35
|
+
async buy(shopId: string, reservationId: string, firstName: string, lastName: string, email: string, phoneNumber: string, dateOfBirth: DateTime | null, gender: Gender | null, addressCity: string | null, addressCountry: string | null, addressNumber: string | null, addressPostalCode: string | null, addressStreet: string | null, attribution: MarketingAttributionDto | null = null): Promise<BaseResponse<OrderDto>> {
|
|
19
36
|
let address: Record<string, string | null> = null;
|
|
20
37
|
|
|
21
38
|
addressCity = emptyNull(addressCity);
|
|
@@ -46,12 +63,13 @@ export class PublicShopService extends BaseService {
|
|
|
46
63
|
phone_number: phoneNumber.trim() === '' ? null : phoneNumber.trim(),
|
|
47
64
|
date_of_birth: dateOfBirth?.toISODate(),
|
|
48
65
|
gender: gender,
|
|
49
|
-
address
|
|
66
|
+
address,
|
|
67
|
+
...attributionBody(attribution)
|
|
50
68
|
})
|
|
51
69
|
.runAdapter(OrderAdapter.parseOrder);
|
|
52
70
|
}
|
|
53
71
|
|
|
54
|
-
async reserve(shopId: string, products: PublicShopCartProductDto[]): Promise<BaseResponse<PublicShopReservationDto>> {
|
|
72
|
+
async reserve(shopId: string, products: PublicShopCartProductDto[], attribution: MarketingAttributionDto | null = null): Promise<BaseResponse<PublicShopReservationDto>> {
|
|
55
73
|
return await this
|
|
56
74
|
.request(`/shops/${shopId}/reserve`)
|
|
57
75
|
.method('post')
|
|
@@ -60,9 +78,9 @@ export class PublicShopService extends BaseService {
|
|
|
60
78
|
.body({
|
|
61
79
|
products: products.map(p => [
|
|
62
80
|
p.productId,
|
|
63
|
-
p.quantity
|
|
64
|
-
|
|
65
|
-
|
|
81
|
+
p.quantity
|
|
82
|
+
]),
|
|
83
|
+
...attributionBody(attribution)
|
|
66
84
|
})
|
|
67
85
|
.runAdapter(PublicShopAdapter.parsePublicShopReservation);
|
|
68
86
|
}
|
package/src/service/index.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
export * from './AdminService';
|
|
2
1
|
export * from './AdminMerchantService';
|
|
2
|
+
export * from './AdminMerchantSubscriptionService';
|
|
3
3
|
export * from './AdminMerchantsService';
|
|
4
|
+
export * from './AdminService';
|
|
4
5
|
export * from './AuthService';
|
|
5
6
|
export * from './InvitationService';
|
|
6
7
|
export * from './MerchantService';
|
|
@@ -9,12 +10,19 @@ export * from './MerchantContractService';
|
|
|
9
10
|
export * from './MerchantBuyerService';
|
|
10
11
|
export * from './MerchantBuyersService';
|
|
11
12
|
export * from './MerchantDashboardService';
|
|
13
|
+
export * from './MerchantDiscountCodeService';
|
|
14
|
+
export * from './MerchantDiscountCodesService';
|
|
12
15
|
export * from './MerchantEventAppTeamService';
|
|
13
16
|
export * from './MerchantEventAppTeamsService';
|
|
14
17
|
export * from './MerchantEventProductService';
|
|
15
18
|
export * from './MerchantEventProductsService';
|
|
16
19
|
export * from './MerchantEventService';
|
|
17
|
-
export * from './
|
|
20
|
+
export * from './MerchantEventStatisticsBuyersService';
|
|
21
|
+
export * from './MerchantEventStatisticsOperationsService';
|
|
22
|
+
export * from './MerchantEventStatisticsOverviewService';
|
|
23
|
+
export * from './MerchantEventStatisticsSalesService';
|
|
24
|
+
export * from './MerchantEventTimeSlotService';
|
|
25
|
+
export * from './MerchantEventTimeSlotsService';
|
|
18
26
|
export * from './MerchantEventShopService';
|
|
19
27
|
export * from './MerchantEventShopsService';
|
|
20
28
|
export * from './MerchantEventStockPoolsService';
|
|
@@ -35,8 +43,15 @@ export * from './MerchantShopsService';
|
|
|
35
43
|
export * from './MerchantStatisticsService';
|
|
36
44
|
export * from './MerchantStatisticsBuyersService';
|
|
37
45
|
export * from './MerchantStatisticsEventsService';
|
|
46
|
+
export * from './MerchantStatisticsGrowthService';
|
|
47
|
+
export * from './MerchantStatisticsInsightsService';
|
|
48
|
+
export * from './MerchantStatisticsOperationsService';
|
|
38
49
|
export * from './MerchantStatisticsOverviewService';
|
|
39
50
|
export * from './MerchantStatisticsSalesService';
|
|
51
|
+
export * from './MerchantAiChatService';
|
|
52
|
+
export * from './MerchantAiSettingsService';
|
|
53
|
+
export * from './MerchantEventContentCalendarService';
|
|
54
|
+
export * from './MerchantAiUsageService';
|
|
40
55
|
export * from './MerchantTicketService';
|
|
41
56
|
export * from './MerchantTicketsService';
|
|
42
57
|
export * from './MerchantUserService';
|
package/src/types/auth.ts
CHANGED
|
@@ -5,6 +5,7 @@ export type Claim =
|
|
|
5
5
|
| 'admin:statistics'
|
|
6
6
|
| 'auth:login'
|
|
7
7
|
| 'buyers:view'
|
|
8
|
+
| 'discounts:manage'
|
|
8
9
|
| 'events:create'
|
|
9
10
|
| 'events:manage'
|
|
10
11
|
| 'events:publish'
|
|
@@ -17,6 +18,7 @@ export type Claim =
|
|
|
17
18
|
| 'finance:export'
|
|
18
19
|
| 'finance:view'
|
|
19
20
|
| 'finance:invoices:view'
|
|
21
|
+
| 'insights:view'
|
|
20
22
|
| 'merchant:admin'
|
|
21
23
|
| 'merchant:users'
|
|
22
24
|
| 'orders:export'
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export type Feature =
|
|
2
|
+
| 'contentCalendar'
|
|
3
|
+
| 'contentCalendar:ai'
|
|
4
|
+
| 'ai:insights'
|
|
5
|
+
| 'ai:chat'
|
|
6
|
+
| 'wallet:apple'
|
|
7
|
+
| 'events:guestList'
|
|
8
|
+
| 'events:stockPools';
|
|
9
|
+
|
|
10
|
+
export type FeatureGroup =
|
|
11
|
+
| 'contentCalendar'
|
|
12
|
+
| 'ai'
|
|
13
|
+
| 'wallet'
|
|
14
|
+
| 'events';
|
package/src/types/general.ts
CHANGED
|
@@ -1,8 +1,19 @@
|
|
|
1
|
+
export type AiGenerationStatus =
|
|
2
|
+
| 'ready'
|
|
3
|
+
| 'failed';
|
|
4
|
+
|
|
1
5
|
export type Gender =
|
|
2
6
|
| 'female'
|
|
3
7
|
| 'male'
|
|
4
8
|
| 'other';
|
|
5
9
|
|
|
10
|
+
export type Granularity =
|
|
11
|
+
| 'hourly'
|
|
12
|
+
| 'daily'
|
|
13
|
+
| 'weekly'
|
|
14
|
+
| 'monthly'
|
|
15
|
+
| 'yearly';
|
|
16
|
+
|
|
6
17
|
export type HeadingLevel =
|
|
7
18
|
| 1
|
|
8
19
|
| 2
|
package/src/types/index.ts
CHANGED
|
@@ -1,11 +1,20 @@
|
|
|
1
|
+
export type * from './aiUsage';
|
|
1
2
|
export type * from './auth';
|
|
3
|
+
export type * from './cashFlow';
|
|
4
|
+
export type * from './contentCalendar';
|
|
5
|
+
export type * from './discountCode';
|
|
2
6
|
export type * from './emailTemplate';
|
|
3
7
|
export type * from './emailTemplateEditor';
|
|
8
|
+
export type * from './feature';
|
|
4
9
|
export type * from './general';
|
|
5
10
|
export type * from './event';
|
|
6
11
|
export type * from './finance';
|
|
12
|
+
export type * from './insights';
|
|
13
|
+
export type * from './milestone';
|
|
7
14
|
export type * from './order';
|
|
8
15
|
export type * from './payment';
|
|
9
16
|
export type * from './product';
|
|
10
17
|
export type * from './publicShop';
|
|
18
|
+
export type * from './refund';
|
|
19
|
+
export type * from './subscription';
|
|
11
20
|
export type * from './ticket';
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export type InsightCardType =
|
|
2
|
+
| 'executive_summary'
|
|
3
|
+
| 'top_opportunities'
|
|
4
|
+
| 'risk_anomalies'
|
|
5
|
+
| 'buyer_behavior'
|
|
6
|
+
| 'best_timing'
|
|
7
|
+
| 'forecast';
|
|
8
|
+
|
|
9
|
+
export type InsightStatus =
|
|
10
|
+
| 'pending'
|
|
11
|
+
| 'generating'
|
|
12
|
+
| 'ready'
|
|
13
|
+
| 'failed'
|
|
14
|
+
| 'insufficient_data'
|
|
15
|
+
| 'budget_exceeded';
|
|
16
|
+
|
|
17
|
+
export type InsightSignalKind =
|
|
18
|
+
| 'positive'
|
|
19
|
+
| 'negative'
|
|
20
|
+
| 'neutral';
|
|
21
|
+
|
|
22
|
+
export type InsightLanguage =
|
|
23
|
+
| 'en'
|
|
24
|
+
| 'nl';
|