@shophost/client 2.0.35 → 2.0.36

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shophost/client",
3
- "version": "2.0.35",
3
+ "version": "2.0.36",
4
4
  "type": "module",
5
5
  "main": "./index.js",
6
6
  "types": "./src/index.d.ts",
@@ -13,7 +13,8 @@
13
13
  "files": [
14
14
  "index.js",
15
15
  "src",
16
- "README.md"
16
+ "README.md",
17
+ "LICENSE"
17
18
  ],
18
19
  "keywords": [
19
20
  "client",
@@ -22,7 +23,7 @@
22
23
  "typescript"
23
24
  ],
24
25
  "author": "Abhishek Shaji (kontakt@abhishek.pl)",
25
- "license": "UNLICENSED",
26
+ "license": "MIT",
26
27
  "repository": {
27
28
  "type": "git",
28
29
  "url": "https://github.com/abhishek-shaji/shophost",
package/src/index.d.ts CHANGED
@@ -5,10 +5,54 @@ export type PaymentMethodDetails = import("./__generated__/sdk").GetAvailablePay
5
5
  export type CreateShippingAddressInput = import("./__generated__/sdk").CreateShippingAddressData["body"];
6
6
  export type UpdateShippingAddressInput = import("./__generated__/sdk").UpdateShippingAddressData["body"];
7
7
  export type ShippingAddress = import("./__generated__/sdk").GetShippingAddressResponses[200];
8
+ export type Currency = import("./__generated__/sdk").OrganizationConfiguration["defaultCurrency"];
8
9
  export type PaginatedResponse<T> = {
9
10
  list: T[];
10
11
  meta: import("./__generated__/sdk").PaginationMeta;
11
12
  };
13
+ export type AnalyticsRange = {
14
+ from: string;
15
+ to: string;
16
+ };
17
+ export type AnalyticsSummary = {
18
+ currency: Currency;
19
+ totalSales: number;
20
+ paidOrders: number;
21
+ averageOrderValue: number;
22
+ reservations: number;
23
+ guests: number;
24
+ };
25
+ export type AnalyticsSalesPoint = {
26
+ date: string;
27
+ label: string;
28
+ totalSales: number;
29
+ paidOrders: number;
30
+ };
31
+ export type AnalyticsReservationPoint = {
32
+ date: string;
33
+ label: string;
34
+ reservations: number;
35
+ guests: number;
36
+ };
37
+ export type AnalyticsPaymentMethod = "card" | "blik" | "paypal" | "bank_transfer" | "cash_on_delivery";
38
+ export type AnalyticsPaymentMethodBreakdown = {
39
+ method: AnalyticsPaymentMethod;
40
+ count: number;
41
+ totalSales: number;
42
+ };
43
+ export type AnalyticsFulfilmentMethodBreakdown = {
44
+ method: "delivery" | "pickup";
45
+ count: number;
46
+ totalSales: number;
47
+ };
48
+ export type AnalyticsOverview = {
49
+ range: AnalyticsRange;
50
+ summary: AnalyticsSummary;
51
+ salesByDay: AnalyticsSalesPoint[];
52
+ reservationsByDay: AnalyticsReservationPoint[];
53
+ paymentMethods: AnalyticsPaymentMethodBreakdown[];
54
+ fulfilmentMethods: AnalyticsFulfilmentMethodBreakdown[];
55
+ };
12
56
  interface RequestInput {
13
57
  body?: unknown;
14
58
  headers?: Record<string, unknown>;
@@ -29,6 +73,17 @@ export interface ClientResponse<TBody = any> {
29
73
  status: number;
30
74
  }
31
75
  export declare const initClient: ({ baseHeaders, baseUrl, credentials, fetch, throwOnUnknownStatus, }: InitClientOptions) => {
76
+ analytics: {
77
+ getOverview: (input: {
78
+ params: {
79
+ organizationId: string;
80
+ };
81
+ query: {
82
+ from: string;
83
+ to: string;
84
+ };
85
+ }) => Promise<ClientResponse<AnalyticsOverview>>;
86
+ };
32
87
  access: {
33
88
  acceptInvitation: (input?: RequestInput) => Promise<ClientResponse<any>>;
34
89
  createInvitation: (input?: RequestInput) => Promise<ClientResponse<any>>;