@hailer/app-sdk 2.0.0-beta-7 → 2.0.0-beta-9
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/lib/app-sdk.js +2 -2
- package/lib/app-sdk.js.map +4 -4
- package/lib/hailer-api.d.ts +6 -0
- package/lib/index.d.ts +1 -0
- package/lib/modules/admin.d.ts +146 -0
- package/lib/modules/metrics.d.ts +61 -0
- package/lib/modules/network.d.ts +14 -0
- package/lib/modules/payment.d.ts +66 -0
- package/lib/modules/public/version.d.ts +16 -0
- package/lib/modules/version.d.ts +16 -0
- package/lib/modules/workspace.d.ts +1 -1
- package/lib/src/constants.d.ts +7 -0
- package/lib/src/hailer-api.d.ts +92 -0
- package/lib/src/index.d.ts +2 -0
- package/lib/src/modules/activity/kanban.d.ts +36 -0
- package/lib/src/modules/activity.d.ts +83 -0
- package/lib/src/modules/app.d.ts +12 -0
- package/lib/src/modules/insight.d.ts +36 -0
- package/lib/src/modules/network.d.ts +14 -0
- package/lib/src/modules/permission.d.ts +9 -0
- package/lib/src/modules/process.d.ts +38 -0
- package/lib/src/modules/product-installed.d.ts +40 -0
- package/lib/src/modules/product-version.d.ts +16 -0
- package/lib/src/modules/product.d.ts +104 -0
- package/lib/src/modules/public/app.d.ts +17 -0
- package/lib/src/modules/public/form.d.ts +31 -0
- package/lib/src/modules/public/insight.d.ts +30 -0
- package/lib/src/modules/public/product-version.d.ts +16 -0
- package/lib/src/modules/public/product.d.ts +27 -0
- package/lib/src/modules/public.d.ts +22 -0
- package/lib/src/modules/ui/activity.d.ts +30 -0
- package/lib/src/modules/ui/files.d.ts +18 -0
- package/lib/src/modules/ui/snackbar.d.ts +18 -0
- package/lib/src/modules/ui.d.ts +17 -0
- package/lib/src/modules/user.d.ts +36 -0
- package/lib/src/modules/workflow.d.ts +24 -0
- package/lib/src/types.d.ts +381 -0
- package/lib/tools/publish.d.ts +1 -0
- package/lib/tools/replace-private.d.ts +1 -0
- package/lib/tools/replace-private.js +33 -0
- package/lib/types.d.ts +547 -0
- package/lib/version.d.ts +0 -0
- package/package.json +1 -1
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
import { Client } from '@wishcore/wish-rpc';
|
|
2
|
+
import { AdminWorkspaceListRequest, AdminWorkspaceListResponse, AdminWorkspace, AdminCreateStripeSessionRequest, AdminCreateStripeSessionResponse, AdminCreateInvoiceIntegrationRequest, AdminCreateInvoiceIntegrationResponse, AdminUpdateWorkspaceSubscriptionRequest, AdminUpdatePurchasePriceRequest, AdminWorkspaceUsersListRequest, AdminWorkspaceUsersListResponse, AdminUpdateUserRequest, AdminTokenTransactionsListRequest, AdminTokenTransactionsListResponse, AdminUpdateOverridesRequest, AdminUpdateMarketplaceSettingsRequest, AdminInvoiceListRequest, AdminInvoiceListResponse, AdminInvoiceUpdateHandledRequest, AdminInvoiceUpdateHandledResponse, AdminRevenueListRequest, AdminRevenueListResponse } from '../types';
|
|
3
|
+
export declare class Admin {
|
|
4
|
+
private client;
|
|
5
|
+
constructor(client: Client);
|
|
6
|
+
/**
|
|
7
|
+
* Lists workspaces with search, pagination, and sorting
|
|
8
|
+
*
|
|
9
|
+
* @param request AdminWorkspaceListRequest containing filter and options
|
|
10
|
+
*
|
|
11
|
+
* @returns List of workspaces with total count
|
|
12
|
+
*
|
|
13
|
+
* @throws {HailerError} if request fails or user not authorized
|
|
14
|
+
*/
|
|
15
|
+
listWorkspaces(request?: AdminWorkspaceListRequest): Promise<AdminWorkspaceListResponse>;
|
|
16
|
+
/**
|
|
17
|
+
* Gets detailed information about a specific workspace
|
|
18
|
+
*
|
|
19
|
+
* @param workspaceId The ID of the workspace to retrieve
|
|
20
|
+
*
|
|
21
|
+
* @returns Workspace details including payment information
|
|
22
|
+
*
|
|
23
|
+
* @throws {HailerError} if request fails, workspace not found, or user not authorized
|
|
24
|
+
*/
|
|
25
|
+
getWorkspace(workspaceId: string): Promise<AdminWorkspace>;
|
|
26
|
+
/**
|
|
27
|
+
* Creates a Stripe checkout session for workspace subscription
|
|
28
|
+
*
|
|
29
|
+
* @param request AdminCreateStripeSessionRequest containing workspace details and payment info
|
|
30
|
+
*
|
|
31
|
+
* @returns AdminCreateStripeSessionResponse with success status and session URL
|
|
32
|
+
*
|
|
33
|
+
* @throws {HailerError} if request fails, user not authorized, or workspace already has subscription
|
|
34
|
+
*/
|
|
35
|
+
createStripeSession(request: AdminCreateStripeSessionRequest): Promise<AdminCreateStripeSessionResponse>;
|
|
36
|
+
/**
|
|
37
|
+
* Creates an invoice integration for workspace subscription
|
|
38
|
+
*
|
|
39
|
+
* @param request AdminCreateInvoiceIntegrationRequest containing workspace details and payment info
|
|
40
|
+
*
|
|
41
|
+
* @returns AdminCreateInvoiceIntegrationResponse with success status
|
|
42
|
+
*
|
|
43
|
+
* @throws {HailerError} if request fails, user not authorized, or workspace already has subscription
|
|
44
|
+
*/
|
|
45
|
+
createInvoiceIntegration(request: AdminCreateInvoiceIntegrationRequest): Promise<AdminCreateInvoiceIntegrationResponse>;
|
|
46
|
+
/**
|
|
47
|
+
* Updates workspace subscription billing information
|
|
48
|
+
*
|
|
49
|
+
* @param request AdminUpdateWorkspaceSubscriptionRequest containing purchase ID and new billing details
|
|
50
|
+
*
|
|
51
|
+
* @returns boolean indicating whether the update was successful
|
|
52
|
+
*
|
|
53
|
+
* @throws {HailerError} if request fails, user not authorized, or purchase not found
|
|
54
|
+
*/
|
|
55
|
+
updateWorkspaceSubscription(request: AdminUpdateWorkspaceSubscriptionRequest): Promise<boolean>;
|
|
56
|
+
/**
|
|
57
|
+
* Updates purchase price for active invoice products
|
|
58
|
+
*
|
|
59
|
+
* @param request AdminUpdatePurchasePriceRequest containing purchase ID, workspace ID, and new price
|
|
60
|
+
*
|
|
61
|
+
* @returns boolean indicating whether the update was successful
|
|
62
|
+
*
|
|
63
|
+
* @throws {HailerError} if request fails, user not authorized, purchase not found, or not an invoice product
|
|
64
|
+
*/
|
|
65
|
+
updatePurchasePrice(request: AdminUpdatePurchasePriceRequest): Promise<boolean>;
|
|
66
|
+
/**
|
|
67
|
+
* Lists users in a workspace with search, filtering, pagination, and sorting
|
|
68
|
+
* If no workspaceId provided, lists all users across all workspaces
|
|
69
|
+
*
|
|
70
|
+
* @param request AdminWorkspaceUsersListRequest containing optional workspace ID, filter and options
|
|
71
|
+
*
|
|
72
|
+
* @returns List of workspace users with total count and role information
|
|
73
|
+
*
|
|
74
|
+
* @throws {HailerError} if request fails, workspace not found, or user not authorized
|
|
75
|
+
*/
|
|
76
|
+
listWorkspaceUsers(request: AdminWorkspaceUsersListRequest): Promise<AdminWorkspaceUsersListResponse>;
|
|
77
|
+
/**
|
|
78
|
+
* Updates a user's information (currently supports email verification only)
|
|
79
|
+
*
|
|
80
|
+
* @param request AdminUpdateUserRequest containing user ID and updates
|
|
81
|
+
*
|
|
82
|
+
* @returns boolean indicating success
|
|
83
|
+
*
|
|
84
|
+
* @throws {HailerError} if request fails, user not found, or user not authorized
|
|
85
|
+
*/
|
|
86
|
+
updateUser(request: AdminUpdateUserRequest): Promise<boolean>;
|
|
87
|
+
/**
|
|
88
|
+
* Updates workspace token balance
|
|
89
|
+
*
|
|
90
|
+
* @param request Object containing workspaceId, tokenAmount, and optional payout parameters
|
|
91
|
+
*
|
|
92
|
+
* @returns boolean indicating success
|
|
93
|
+
*
|
|
94
|
+
* @throws {HailerError} if request fails, workspace not found, or user not authorized
|
|
95
|
+
*/
|
|
96
|
+
updateTokenBalance(request: {
|
|
97
|
+
workspaceId: string;
|
|
98
|
+
tokenAmount: number;
|
|
99
|
+
payoutMonth?: number;
|
|
100
|
+
payoutYear?: number;
|
|
101
|
+
payoutType?: 'admin_bonus' | 'creator_payout';
|
|
102
|
+
creatorPercent?: number;
|
|
103
|
+
}): Promise<boolean>;
|
|
104
|
+
/**
|
|
105
|
+
* Updates workspace license overrides
|
|
106
|
+
*
|
|
107
|
+
* @param request AdminUpdateOverridesRequest containing workspaceId and overrides object
|
|
108
|
+
*
|
|
109
|
+
* @returns boolean indicating success
|
|
110
|
+
*
|
|
111
|
+
* @throws {HailerError} if request fails, workspace not found, or user not authorized
|
|
112
|
+
*/
|
|
113
|
+
updateWorkspaceOverrides(request: AdminUpdateOverridesRequest): Promise<boolean>;
|
|
114
|
+
updateWorkspaceMarketplaceSettings(request: AdminUpdateMarketplaceSettingsRequest): Promise<boolean>;
|
|
115
|
+
/**
|
|
116
|
+
* Lists token transactions with filtering, pagination, and statistics
|
|
117
|
+
*
|
|
118
|
+
* @param request AdminTokenTransactionsListRequest containing optional filter and pagination options
|
|
119
|
+
*
|
|
120
|
+
* @returns AdminTokenTransactionsListResponse with transactions, total count, and statistics
|
|
121
|
+
*
|
|
122
|
+
* @throws {HailerError} if request fails or user not authorized
|
|
123
|
+
*/
|
|
124
|
+
listTokenTransactions(request?: AdminTokenTransactionsListRequest): Promise<AdminTokenTransactionsListResponse>;
|
|
125
|
+
/**
|
|
126
|
+
* Lists Hailer invoice purchases with filtering, pagination, and workspace grouping
|
|
127
|
+
*
|
|
128
|
+
* @param request AdminInvoiceListRequest containing optional filter and pagination options
|
|
129
|
+
*
|
|
130
|
+
* @returns AdminInvoiceListResponse with invoices, total count, and workspace groups
|
|
131
|
+
*
|
|
132
|
+
* @throws {HailerError} if request fails or user not authorized
|
|
133
|
+
*/
|
|
134
|
+
listInvoices(request?: AdminInvoiceListRequest): Promise<AdminInvoiceListResponse>;
|
|
135
|
+
/**
|
|
136
|
+
* Updates the handled status for one or more Hailer invoice purchases
|
|
137
|
+
*
|
|
138
|
+
* @param request AdminInvoiceUpdateHandledRequest containing purchase ID(s) and handled status
|
|
139
|
+
*
|
|
140
|
+
* @returns AdminInvoiceUpdateHandledResponse with count of updated records
|
|
141
|
+
*
|
|
142
|
+
* @throws {HailerError} if request fails, purchase not found, or not a Hailer invoice purchase
|
|
143
|
+
*/
|
|
144
|
+
updateInvoiceHandled(request: AdminInvoiceUpdateHandledRequest): Promise<AdminInvoiceUpdateHandledResponse>;
|
|
145
|
+
listMonthlyRevenue(request: AdminRevenueListRequest): Promise<AdminRevenueListResponse>;
|
|
146
|
+
}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { Client } from '@wishcore/wish-rpc';
|
|
2
|
+
export interface MetricDefinition {
|
|
3
|
+
id: string;
|
|
4
|
+
name: string;
|
|
5
|
+
description: string;
|
|
6
|
+
category: string;
|
|
7
|
+
supportsTimeRange: boolean;
|
|
8
|
+
supportsBreakdown: boolean;
|
|
9
|
+
}
|
|
10
|
+
export interface MetricData {
|
|
11
|
+
metricType: string;
|
|
12
|
+
timestamp: number;
|
|
13
|
+
current: {
|
|
14
|
+
value: number;
|
|
15
|
+
labels?: any;
|
|
16
|
+
};
|
|
17
|
+
timeSeries?: Array<{
|
|
18
|
+
timestamp: number;
|
|
19
|
+
value: number;
|
|
20
|
+
}>;
|
|
21
|
+
breakdown?: {
|
|
22
|
+
byWorkspace?: Record<string, number>;
|
|
23
|
+
byUser?: Record<string, number>;
|
|
24
|
+
};
|
|
25
|
+
metadata: {
|
|
26
|
+
scope?: any;
|
|
27
|
+
permissions?: any;
|
|
28
|
+
source: string;
|
|
29
|
+
executionTime?: number;
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
export interface MetricOptions {
|
|
33
|
+
workspaceId?: string;
|
|
34
|
+
userId?: string;
|
|
35
|
+
timeRange?: {
|
|
36
|
+
start: number;
|
|
37
|
+
end: number;
|
|
38
|
+
};
|
|
39
|
+
interval?: '1m' | '5m' | '15m' | '1h';
|
|
40
|
+
}
|
|
41
|
+
export interface MetricListOptions {
|
|
42
|
+
category?: string;
|
|
43
|
+
includeDetails?: boolean;
|
|
44
|
+
}
|
|
45
|
+
export declare class MetricsApi {
|
|
46
|
+
private client;
|
|
47
|
+
constructor(client: Client);
|
|
48
|
+
/**
|
|
49
|
+
* Get list of available metrics for current user based on permissions
|
|
50
|
+
* @param options Optional filtering options
|
|
51
|
+
* @returns Array of metric IDs or detailed metric definitions
|
|
52
|
+
*/
|
|
53
|
+
list(options?: MetricListOptions): Promise<string[] | MetricDefinition[]>;
|
|
54
|
+
/**
|
|
55
|
+
* Get current metrics data for single metric
|
|
56
|
+
* @param metricType The metric type to fetch
|
|
57
|
+
* @param options Optional filtering and time range options
|
|
58
|
+
* @returns Single metric data
|
|
59
|
+
*/
|
|
60
|
+
get(metricTypes: string[], options?: MetricOptions): Promise<MetricData>;
|
|
61
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Client } from '@wishcore/wish-rpc';
|
|
2
|
+
import { Workspace } from '../types';
|
|
3
|
+
export declare class WorkspaceApi {
|
|
4
|
+
private client;
|
|
5
|
+
constructor(client: Client);
|
|
6
|
+
/**
|
|
7
|
+
* Returns the current network
|
|
8
|
+
*
|
|
9
|
+
* @returns the Hailer Workspace information the user is currently in
|
|
10
|
+
*
|
|
11
|
+
* @throws {HailerError} if request is incorrect
|
|
12
|
+
*/
|
|
13
|
+
current(): Promise<Workspace>;
|
|
14
|
+
}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { Client } from '@wishcore/wish-rpc';
|
|
2
|
+
import { PricingData, CreatePricingRequest, UpdatePricingRequest, CreatePurchaseRequest, CreatePurchaseResponse, Purchase, StripeTaxCalculationRequest, StripeTaxCalculationResponse } from '../types';
|
|
3
|
+
export declare class Payment {
|
|
4
|
+
private client;
|
|
5
|
+
constructor(client: Client);
|
|
6
|
+
/**
|
|
7
|
+
* Creates pricing configuration for a product
|
|
8
|
+
*
|
|
9
|
+
* @param request CreatePricingRequest containing productId, types, and providers
|
|
10
|
+
*
|
|
11
|
+
* @returns Created pricing configuration
|
|
12
|
+
*
|
|
13
|
+
* @throws {HailerError} if request is incorrect or product not found
|
|
14
|
+
*/
|
|
15
|
+
createPricing(request: CreatePricingRequest): Promise<PricingData>;
|
|
16
|
+
/**
|
|
17
|
+
* Updates pricing configuration for a product
|
|
18
|
+
*
|
|
19
|
+
* @param request UpdatePricingRequest containing productId, types, and providers
|
|
20
|
+
*
|
|
21
|
+
* @returns Updated pricing configuration
|
|
22
|
+
*
|
|
23
|
+
* @throws {HailerError} if request is incorrect, product not found, or pricing doesn't exist
|
|
24
|
+
*/
|
|
25
|
+
updatePricing(request: UpdatePricingRequest): Promise<PricingData>;
|
|
26
|
+
/**
|
|
27
|
+
* Gets pricing configuration for a product
|
|
28
|
+
*
|
|
29
|
+
* @param productId Product ID to get pricing for
|
|
30
|
+
*
|
|
31
|
+
* @returns Pricing configuration or null if not found
|
|
32
|
+
*
|
|
33
|
+
* @throws {HailerError} if request is incorrect or product not found
|
|
34
|
+
*/
|
|
35
|
+
getPricing(productId: string): Promise<PricingData | null>;
|
|
36
|
+
/**
|
|
37
|
+
* Creates a product purchase/subscription
|
|
38
|
+
*
|
|
39
|
+
* @param request CreatePurchaseRequest containing productId, workspaceId, and planType
|
|
40
|
+
*
|
|
41
|
+
* @returns Purchase creation result with status and details
|
|
42
|
+
*
|
|
43
|
+
* @throws {HailerError} if request is incorrect, product not found, or payment fails
|
|
44
|
+
*/
|
|
45
|
+
createPurchase(request: CreatePurchaseRequest): Promise<CreatePurchaseResponse>;
|
|
46
|
+
/**
|
|
47
|
+
* Gets purchases for a workspace
|
|
48
|
+
*
|
|
49
|
+
* @param workspaceId Workspace ID to get purchases for
|
|
50
|
+
*
|
|
51
|
+
* @returns Array of purchases for the workspace
|
|
52
|
+
*
|
|
53
|
+
* @throws {HailerError} if request is incorrect or workspace not found
|
|
54
|
+
*/
|
|
55
|
+
getPurchases(workspaceId: string): Promise<Purchase[]>;
|
|
56
|
+
/**
|
|
57
|
+
* Calculates Stripe tax for line items
|
|
58
|
+
*
|
|
59
|
+
* @param request StripeTaxCalculationRequest containing workspaceId and lineItems
|
|
60
|
+
*
|
|
61
|
+
* @returns Tax calculation result with amounts, rates, and country information
|
|
62
|
+
*
|
|
63
|
+
* @throws {HailerError} if request is incorrect, workspace not found, or Stripe customer not found
|
|
64
|
+
*/
|
|
65
|
+
calculateStripeTax(request: StripeTaxCalculationRequest): Promise<StripeTaxCalculationResponse>;
|
|
66
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Options } from '../../hailer-api';
|
|
2
|
+
import { Version } from '../../types';
|
|
3
|
+
export declare class VersionPublicApi {
|
|
4
|
+
private options;
|
|
5
|
+
constructor(options: Options);
|
|
6
|
+
/**
|
|
7
|
+
* Gets single version from Hailer market
|
|
8
|
+
*
|
|
9
|
+
* @param id Version Id
|
|
10
|
+
*
|
|
11
|
+
* @returns Single version from Hailer market or undefined if no version found
|
|
12
|
+
*
|
|
13
|
+
* @throws {HailerError} if request is incorrect
|
|
14
|
+
*/
|
|
15
|
+
get(id: string): Promise<Version | undefined>;
|
|
16
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Client } from '@wishcore/wish-rpc';
|
|
2
|
+
import { Version } from '../types';
|
|
3
|
+
export declare class VersionApi {
|
|
4
|
+
private client;
|
|
5
|
+
constructor(client: Client);
|
|
6
|
+
/**
|
|
7
|
+
* Gets single version from Hailer market
|
|
8
|
+
*
|
|
9
|
+
* @param id Version Id
|
|
10
|
+
*
|
|
11
|
+
* @returns Single version from Hailer market or undefined if no version found
|
|
12
|
+
*
|
|
13
|
+
* @throws {HailerError} if request is incorrect
|
|
14
|
+
*/
|
|
15
|
+
get(id: string): Promise<Version | undefined>;
|
|
16
|
+
}
|
|
@@ -13,7 +13,7 @@ export declare class WorkspaceApi {
|
|
|
13
13
|
description: string;
|
|
14
14
|
}) => Promise<ProductVersion>;
|
|
15
15
|
/** Check if product is installed */
|
|
16
|
-
isProductInstalled(id: string): Promise<boolean>;
|
|
16
|
+
isProductInstalled(id: string, workspaceId: string): Promise<boolean>;
|
|
17
17
|
/** Get version */
|
|
18
18
|
get(id: string): Promise<ProductVersion | undefined>;
|
|
19
19
|
/** Install template from Hailer market */
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export declare const DEFAULT_API_VERSION = 1;
|
|
2
|
+
export declare const DEFAULT_ALLOWED_URLS: string[];
|
|
3
|
+
export declare const DEFAULT_BACKEND_URL = "https://api.hailer.com";
|
|
4
|
+
/** Map of which backend to use depending on which frontend is hosting the app frame, be sure to fall back to production backend if no match */
|
|
5
|
+
export declare const publicBackendMap: {
|
|
6
|
+
[host: string]: string;
|
|
7
|
+
};
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import { UserApi } from './modules/user';
|
|
2
|
+
import { ActivityApi } from './modules/activity';
|
|
3
|
+
import { WorkspaceApi } from './modules/network';
|
|
4
|
+
import { HailerApiInfo, HailerSettings, HailerSignal } from './types';
|
|
5
|
+
import { Ui } from './modules/ui';
|
|
6
|
+
import { Process } from './modules/process';
|
|
7
|
+
import { HailerPublicApi } from './modules/public';
|
|
8
|
+
import { WorkflowApi } from './modules/workflow';
|
|
9
|
+
import { AppApi } from './modules/app';
|
|
10
|
+
import { InsightApi } from './modules/insight';
|
|
11
|
+
import { PermissionApi } from './modules/permission';
|
|
12
|
+
import { ProductApi } from './modules/product';
|
|
13
|
+
import { ProductVersionApi } from './modules/product-version';
|
|
14
|
+
import { ProductInstalledApi } from './modules/product-installed';
|
|
15
|
+
export interface Options {
|
|
16
|
+
/** When connected is called the host is ready to receive calls */
|
|
17
|
+
connected?: () => void;
|
|
18
|
+
/** Callback when app is determined to be outside of Hailer, as a standalone app */
|
|
19
|
+
outside?: (config?: any) => void;
|
|
20
|
+
/** Callback on errors, defaults to printing errors in console */
|
|
21
|
+
error?: (error: Error) => void;
|
|
22
|
+
/** Callback called on app init and when permissions have changed */
|
|
23
|
+
permissions?: () => void;
|
|
24
|
+
/** Callback called on app init and when settings have changed */
|
|
25
|
+
settings?: (data: HailerSettings) => void;
|
|
26
|
+
/** Callback called on app init and when config has changed */
|
|
27
|
+
config?: (config: any) => void;
|
|
28
|
+
/** Will be called each time a subscribed signal is emitted from Hailer frontend. To subscribe to signals, add them to options.subscribedSignals[] */
|
|
29
|
+
signals?: (signal: HailerSignal) => void;
|
|
30
|
+
/** Urls the sdk is allowed to connect to. Defaults to all Hailer instances*/
|
|
31
|
+
allowedUrls?: string[];
|
|
32
|
+
/**
|
|
33
|
+
* Optional signal filter, passes all signals by default
|
|
34
|
+
*
|
|
35
|
+
* Example:
|
|
36
|
+
*
|
|
37
|
+
* subscribedSignals: ['activity.create', 'activity.update']
|
|
38
|
+
*/
|
|
39
|
+
subscribedSignals?: string[];
|
|
40
|
+
/** Api version to be used in the app by default */
|
|
41
|
+
apiVersion?: 1;
|
|
42
|
+
/** Public backend Api url. Defaults to https://api.hailer.com */
|
|
43
|
+
publicBackendUrl?: string;
|
|
44
|
+
}
|
|
45
|
+
export declare class HailerApi {
|
|
46
|
+
options: Options;
|
|
47
|
+
user: UserApi;
|
|
48
|
+
app: AppApi;
|
|
49
|
+
activity: ActivityApi;
|
|
50
|
+
insight: InsightApi;
|
|
51
|
+
network: WorkspaceApi;
|
|
52
|
+
process: Process;
|
|
53
|
+
workflow: WorkflowApi;
|
|
54
|
+
permission: PermissionApi;
|
|
55
|
+
product: ProductApi;
|
|
56
|
+
productVersion: ProductVersionApi;
|
|
57
|
+
productInstalled: ProductInstalledApi;
|
|
58
|
+
/** All public endpoints, which can be accessed while not logged in to Hailer. */
|
|
59
|
+
public: HailerPublicApi;
|
|
60
|
+
/** User interface commands */
|
|
61
|
+
ui: Ui;
|
|
62
|
+
/** Url of the Hailer instance hosting the API */
|
|
63
|
+
private hostUrl?;
|
|
64
|
+
private appId?;
|
|
65
|
+
/** If set it indicates that app is locked to a specific workspaceId */
|
|
66
|
+
private workspaceId?;
|
|
67
|
+
private client;
|
|
68
|
+
private apiVersion;
|
|
69
|
+
private settings?;
|
|
70
|
+
private config?;
|
|
71
|
+
private subscribedSignals?;
|
|
72
|
+
private timer?;
|
|
73
|
+
/**
|
|
74
|
+
* Hailer API state
|
|
75
|
+
*
|
|
76
|
+
* ```
|
|
77
|
+
* true // outside hailer
|
|
78
|
+
* false // logged into hailer
|
|
79
|
+
* null // state not yet detected
|
|
80
|
+
* ```
|
|
81
|
+
*/
|
|
82
|
+
private outside;
|
|
83
|
+
/**
|
|
84
|
+
* Create a Hailer API client for inteacting with Hailer. **NOTE** This only works when inside Hailer.
|
|
85
|
+
*
|
|
86
|
+
* This should be run after window is initialized for example in ***onMount*** in Svelte or in ***useEffect*** in React
|
|
87
|
+
*/
|
|
88
|
+
constructor(options?: Options);
|
|
89
|
+
private createEventListener;
|
|
90
|
+
info(): HailerApiInfo;
|
|
91
|
+
request(op: string, args: any[]): Promise<any>;
|
|
92
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { Client } from '@wishcore/wish-rpc';
|
|
2
|
+
import { ActivityKanbanListOptions, KanbanListResponse, KanbanLoadResponse } from '../../types';
|
|
3
|
+
export declare class Kanban {
|
|
4
|
+
private client;
|
|
5
|
+
constructor(client: Client);
|
|
6
|
+
/**
|
|
7
|
+
* Lists all activities in a kanban grouped by phases
|
|
8
|
+
*
|
|
9
|
+
* @param processId the id of the process the kanban relates to
|
|
10
|
+
* @param options ActivityKanbanListOptions
|
|
11
|
+
*
|
|
12
|
+
* @returns activities in kanban list format
|
|
13
|
+
*
|
|
14
|
+
* @throws {HailerError} if request fails
|
|
15
|
+
*/
|
|
16
|
+
list(processId: string, options?: ActivityKanbanListOptions): Promise<KanbanListResponse>;
|
|
17
|
+
/**
|
|
18
|
+
* Loads a single activity in kanban format
|
|
19
|
+
*
|
|
20
|
+
* @param activityId activityId of the wanted activity
|
|
21
|
+
*
|
|
22
|
+
* @returns activity in kanban format
|
|
23
|
+
*
|
|
24
|
+
* @throws {HailerError} if request is incorrect
|
|
25
|
+
*/
|
|
26
|
+
load(activityId: string): Promise<KanbanLoadResponse>;
|
|
27
|
+
/**
|
|
28
|
+
* Updates priority of activities in kanban
|
|
29
|
+
*
|
|
30
|
+
* @param activityId activityId of the wanted activity
|
|
31
|
+
* @param priority new priority for the activity
|
|
32
|
+
*
|
|
33
|
+
* @throws {HailerError} if request is incorrect
|
|
34
|
+
*/
|
|
35
|
+
updatePriority(activityId: string, priority: number): Promise<void>;
|
|
36
|
+
}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { Client } from '@wishcore/wish-rpc';
|
|
2
|
+
import { ActivityCreateOptions, ActivityListOptions, Activity } from '../types';
|
|
3
|
+
import { Kanban } from './activity/kanban';
|
|
4
|
+
export declare class ActivityApi {
|
|
5
|
+
private client;
|
|
6
|
+
kanban: Kanban;
|
|
7
|
+
constructor(client: Client);
|
|
8
|
+
/**
|
|
9
|
+
* Lists all activities from the specified process and phase
|
|
10
|
+
*
|
|
11
|
+
* @param processId process from current network
|
|
12
|
+
* @param phaseId phase in the process specified in processId
|
|
13
|
+
* @param options ActivityListOptions
|
|
14
|
+
*
|
|
15
|
+
* @returns List of Hailer activities from process and phase filtered with supplied options
|
|
16
|
+
*
|
|
17
|
+
* @throws {HailerError} if request is incorrect
|
|
18
|
+
*/
|
|
19
|
+
list(processId: string, phaseId: string, options?: ActivityListOptions): Promise<Activity[]>;
|
|
20
|
+
/**
|
|
21
|
+
* Gets single activity
|
|
22
|
+
*
|
|
23
|
+
* @param activityId activity Id of the process specified in processId
|
|
24
|
+
* @param processId Process where the activityId is
|
|
25
|
+
* @param phaseId Phase where the activityId is in process specified by processId
|
|
26
|
+
* @param options options containing apiVersion
|
|
27
|
+
*
|
|
28
|
+
* @returns Hailer activity information or undefined if no activity is found
|
|
29
|
+
*
|
|
30
|
+
* @throws {HailerError} if request is incorrect
|
|
31
|
+
*/
|
|
32
|
+
get(activityId: string): Promise<Activity | undefined>;
|
|
33
|
+
/**
|
|
34
|
+
* Creates activities
|
|
35
|
+
*
|
|
36
|
+
* @param processId The process where the activity is created
|
|
37
|
+
* @param activities new activities as objects
|
|
38
|
+
* @param activities.name name of the activity
|
|
39
|
+
* @param activities.fields fields of the activity
|
|
40
|
+
* @param options ActivityCreateOptions
|
|
41
|
+
*
|
|
42
|
+
* @throws {HailerError} if request is incorrect
|
|
43
|
+
*/
|
|
44
|
+
create(processId: string, activities: {
|
|
45
|
+
name: string;
|
|
46
|
+
fields?: {
|
|
47
|
+
[id: string]: string | number;
|
|
48
|
+
};
|
|
49
|
+
}[], options?: ActivityCreateOptions): Promise<Activity[]>;
|
|
50
|
+
/**
|
|
51
|
+
* Updates activites
|
|
52
|
+
*
|
|
53
|
+
* Each activity has the following parameters
|
|
54
|
+
* @param activities updated activity objects of an activity to edit
|
|
55
|
+
* @param activities.name New name of the activity
|
|
56
|
+
* @param activities.fields change values of fields, null removes current value
|
|
57
|
+
* @param activities.phaseId New phase of the activity
|
|
58
|
+
* @param options
|
|
59
|
+
*
|
|
60
|
+
* @returns The number of updated activities
|
|
61
|
+
*
|
|
62
|
+
* @throws {HailerError} if request is incorrect
|
|
63
|
+
*/
|
|
64
|
+
update(activities: {
|
|
65
|
+
_id: string;
|
|
66
|
+
name?: string;
|
|
67
|
+
fields?: {
|
|
68
|
+
[id: string]: string | number | null;
|
|
69
|
+
};
|
|
70
|
+
phaseId?: string;
|
|
71
|
+
}[], options: any): Promise<number>;
|
|
72
|
+
/**
|
|
73
|
+
* Removes activities
|
|
74
|
+
*
|
|
75
|
+
* @param activities Ids of activities to be removed
|
|
76
|
+
* @param options options containing apiVersion
|
|
77
|
+
*
|
|
78
|
+
* @returns The number of removed activities
|
|
79
|
+
*
|
|
80
|
+
* @throws {HailerError} if request is incorrect
|
|
81
|
+
*/
|
|
82
|
+
remove(activities: string[]): Promise<number>;
|
|
83
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Client } from '@wishcore/wish-rpc';
|
|
2
|
+
import { HailerAppConfig } from '../types';
|
|
3
|
+
/**
|
|
4
|
+
* This class is used to access Hailer public API even when the app is outside of Hailer
|
|
5
|
+
*/
|
|
6
|
+
export declare class AppApi {
|
|
7
|
+
private client;
|
|
8
|
+
constructor(client: Client);
|
|
9
|
+
config: {
|
|
10
|
+
update: (appId: string | undefined, config: HailerAppConfig) => Promise<void>;
|
|
11
|
+
};
|
|
12
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { Client } from '@wishcore/wish-rpc';
|
|
2
|
+
import { InsightData, InsightDoc } from '../types';
|
|
3
|
+
export declare class InsightApi {
|
|
4
|
+
private client;
|
|
5
|
+
constructor(client: Client);
|
|
6
|
+
/**
|
|
7
|
+
* Get Insight data
|
|
8
|
+
*
|
|
9
|
+
* @param insightId the id of the Insight the data is fetched from
|
|
10
|
+
*
|
|
11
|
+
* @returns data from the Insight
|
|
12
|
+
*
|
|
13
|
+
* @throws {HailerError} if request is incorrect
|
|
14
|
+
*/
|
|
15
|
+
data(insightId: string, options: {
|
|
16
|
+
update?: true;
|
|
17
|
+
}): Promise<InsightData>;
|
|
18
|
+
/**
|
|
19
|
+
* Get Insight data
|
|
20
|
+
*
|
|
21
|
+
*
|
|
22
|
+
* @returns data from the Insight
|
|
23
|
+
*
|
|
24
|
+
* @throws {HailerError} if request is incorrect
|
|
25
|
+
*/
|
|
26
|
+
list(): Promise<InsightDoc[]>;
|
|
27
|
+
/**
|
|
28
|
+
* Get Insight data
|
|
29
|
+
*
|
|
30
|
+
*
|
|
31
|
+
* @returns data from the Insight
|
|
32
|
+
*
|
|
33
|
+
* @throws {HailerError} if request is incorrect
|
|
34
|
+
*/
|
|
35
|
+
update(insightId: string, update: Partial<InsightDoc>): Promise<InsightDoc[]>;
|
|
36
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Client } from '@wishcore/wish-rpc';
|
|
2
|
+
import { Workspace } from '../types';
|
|
3
|
+
export declare class WorkspaceApi {
|
|
4
|
+
private client;
|
|
5
|
+
constructor(client: Client);
|
|
6
|
+
/**
|
|
7
|
+
* Returns the current network
|
|
8
|
+
*
|
|
9
|
+
* @returns the Hailer Workspace information the user is currently in
|
|
10
|
+
*
|
|
11
|
+
* @throws {HailerError} if request is incorrect
|
|
12
|
+
*/
|
|
13
|
+
current(): Promise<Workspace>;
|
|
14
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Client } from '@wishcore/wish-rpc';
|
|
2
|
+
/**
|
|
3
|
+
* This class is used to access Hailer public API even when the app is outside of Hailer
|
|
4
|
+
*/
|
|
5
|
+
export declare class PermissionApi {
|
|
6
|
+
private client;
|
|
7
|
+
constructor(client: Client);
|
|
8
|
+
map: () => Promise<void>;
|
|
9
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { Client } from '@wishcore/wish-rpc';
|
|
2
|
+
import { HailerProcess } from '../types';
|
|
3
|
+
/** @deprecated Use Workflow instead */
|
|
4
|
+
export declare class Process {
|
|
5
|
+
private client;
|
|
6
|
+
constructor(client: Client);
|
|
7
|
+
/**
|
|
8
|
+
* Lists all processes from a workspace
|
|
9
|
+
*
|
|
10
|
+
* @returns all Hailer processes in the workspace the app user is currently in
|
|
11
|
+
*
|
|
12
|
+
* @throws {HailerError} if request is incorrect
|
|
13
|
+
*/
|
|
14
|
+
list(): Promise<{
|
|
15
|
+
[key: string]: HailerProcess;
|
|
16
|
+
}>;
|
|
17
|
+
/**
|
|
18
|
+
* Gets a single process from a workspace
|
|
19
|
+
*
|
|
20
|
+
* @param processId the id of the process in question
|
|
21
|
+
*
|
|
22
|
+
* @returns the specified Hailer process
|
|
23
|
+
*
|
|
24
|
+
* @throws {HailerError} if request is incorrect
|
|
25
|
+
*/
|
|
26
|
+
get(processId: string): Promise<HailerProcess>;
|
|
27
|
+
/**
|
|
28
|
+
* Gets an id of a field in a process by its name
|
|
29
|
+
*
|
|
30
|
+
* @param processId the id of the process in question
|
|
31
|
+
* @param fieldName name of the field
|
|
32
|
+
*
|
|
33
|
+
* @returns the field id as string
|
|
34
|
+
*
|
|
35
|
+
* @throws {HailerError} if request is incorrect
|
|
36
|
+
*/
|
|
37
|
+
getFieldIdByName(processId: string, fieldName: string): Promise<string>;
|
|
38
|
+
}
|