@hailer/app-sdk 2.0.0-beta-10 → 2.0.0-beta-11
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.map +1 -1
- package/lib/types.d.ts +1 -0
- package/package.json +1 -1
package/lib/app-sdk.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../node_modules/@wishcore/wish-rpc/src/rpc-client.ts", "../node_modules/@wishcore/wish-rpc/src/rpc-server.ts", "../node_modules/@wishcore/wish-rpc/src/index.ts", "../src/hailer-api.ts", "../src/types.ts", "../src/modules/user.ts", "../src/modules/activity/kanban.ts", "../src/modules/activity.ts", "../src/modules/workspace.ts", "../src/modules/ui/activity.ts", "../src/modules/ui/snackbar.ts", "../src/modules/ui/files.ts", "../src/modules/ui/workflow.ts", "../src/modules/ui.ts", "../src/constants.ts", "../src/modules/public/app.ts", "../src/modules/public/form.ts", "../src/modules/public/insight.ts", "../src/modules/public/product.ts", "../src/modules/public.ts", "../src/modules/workflow.ts", "../src/modules/app.ts", "../src/modules/insight.ts", "../src/modules/permission.ts", "../src/modules/product.ts", "../src/modules/payment.ts", "../src/modules/admin.ts", "../src/modules/metrics.ts"],
|
|
4
|
-
"sourcesContent": [null, null, null, "import { Client } from '@wishcore/wish-rpc';\nimport { UserApi } from './modules/user';\nimport { ActivityApi } from './modules/activity';\nimport { WorkspaceApi } from './modules/workspace';\nimport { ApiInfo, Config, Settings, Signal } from './types';\nimport { Ui } from './modules/ui';\nimport { DEFAULT_ALLOWED_URLS, DEFAULT_BACKEND_URL, publicBackendMap } from './constants';\nimport { HailerPublicApi } from './modules/public';\nimport { WorkflowApi } from './modules/workflow';\nimport { AppApi } from './modules/app';\nimport { InsightApi } from './modules/insight';\nimport { PermissionApi } from './modules/permission';\nimport { ProductApi } from './modules/product';\nimport { Payment } from './modules/payment';\nimport { Admin } from './modules/admin';\nimport { MetricsApi } from './modules/metrics';\n\nexport interface Options {\n /** When connected is called the host is ready to receive calls */\n connected?: () => void;\n /** Callback when app is determined to be outside of Hailer, as a standalone app */\n outside?: (config?: any) => void;\n /** Callback on errors, defaults to printing errors in console */\n error?: (error: Error) => void;\n /** Callback called on app init and when permissions have changed */\n permissions?: () => void;\n /** Callback called on app init and when settings have changed */\n settings?: (data: Settings) => void;\n /** Callback called on app init and when config has changed */\n config?: (config: any) => void;\n /** Will be called each time a subscribed signal is emitted from Hailer frontend. To subscribe to signals, add them to options.subscribedSignals[] */\n signals?: (signal: Signal) => void;\n /** Urls the sdk is allowed to connect to. Defaults to all Hailer instances*/\n allowedUrls?: string[];\n /** Public backend Api url. Defaults to https://api.hailer.com */\n publicBackendUrl?: string;\n}\n\nexport class HailerApi {\n public user: UserApi;\n public app: AppApi;\n public activity: ActivityApi;\n public insight: InsightApi;\n public workspace: WorkspaceApi;\n public workflow: WorkflowApi;\n public permission: PermissionApi;\n public product: ProductApi;\n public payment: Payment;\n public admin: Admin;\n public metrics: MetricsApi;\n /** All public endpoints, which can be accessed while not logged in to Hailer. */\n public public: HailerPublicApi;\n /** User interface commands */\n public ui: Ui;\n /** Url of the Hailer instance hosting the API */\n private hostUrl?: string;\n\n private appId?: string;\n /** If set it indicates that app is locked to a specific workspaceId */\n private workspaceId?: string;\n private client: Client;\n private config?: Config;\n private timer?: NodeJS.Timeout;\n /**\n * Hailer API state\n * \n * ```\n * true // outside hailer\n * false // logged into hailer\n * null // state not yet detected\n * ``` \n */\n private outside: boolean | null = null;\n\n /**\n * Create a Hailer API client for inteacting with Hailer. **NOTE** This only works when inside Hailer.\n *\n * This should be run after window is initialized for example in ***onMount*** in Svelte or in ***useEffect*** in React\n */\n constructor(\n public options: Options = {}\n ) {\n const allowedUrls = options.allowedUrls ?? DEFAULT_ALLOWED_URLS;\n \n this.client = new Client(msg => {\n if (this.hostUrl){\n parent.postMessage(JSON.stringify(msg), this.hostUrl)\n }\n })\n\n this.user = new UserApi(this.client);\n this.app = new AppApi(this.client);\n this.activity = new ActivityApi(this.client);\n this.insight = new InsightApi(this.client);\n this.workspace = new WorkspaceApi(this.client);\n this.workflow = new WorkflowApi(this.client);\n this.permission = new PermissionApi(this.client);\n this.public = new HailerPublicApi(this.options);\n this.ui = new Ui(this.client);\n this.product = new ProductApi(this.client);\n this.payment = new Payment(this.client);\n this.admin = new Admin(this.client);\n this.metrics = new MetricsApi(this.client);\n\n const registerMessage = JSON.stringify({ op: 'register', args: [{ appApiVersion: '2' }] });\n\n // If we are not in Iframe set location to outside, else wait 100ms for response to register to check if we are in Hailer\n if (window.location === window.parent.location) {\n // Pick a backend to use for public requests, unless it is set\n if (!this.options.publicBackendUrl) {\n this.options.publicBackendUrl = DEFAULT_BACKEND_URL;\n }\n\n this.public.app.config().then(config => {\n // CSM app assumes we are inside hailer when config is called... breaks the thing...\n // this.options.config?.(config);\n\n this.outside = true;\n this.options.outside?.(config);\n }).catch(error => {\n this.options.error?.(error);\n console.error('Failed to get app configuration in Public App.', error);\n });\n } else {\n // if in a frame, try register to Hailer by sending register to all allowed urls\n allowedUrls.forEach(url => parent.postMessage(registerMessage, url));\n this.timer = setTimeout(() => {\n this.outside = true;\n this.options.outside?.()\n }, 100);\n }\n\n this.createEventListener();\n }\n\n private createEventListener() {\n window.addEventListener('message', async event => {\n const data = event.data;\n\n try {\n const msg = JSON.parse(data);\n if (msg.op === 'register') {\n if (this.appId) {\n console.error('App Id is already set...! Are you using hot-reload?');\n return;\n }\n\n clearTimeout(this.timer);\n\n this.appId = msg.data.appId;\n this.workspaceId = msg.data.workspaceId;\n\n // Set host url now that we have a response\n this.hostUrl = event.origin;\n\n // Pick a backend to use for public requests, unless it is set\n if (!this.options.publicBackendUrl) {\n this.options.publicBackendUrl = publicBackendMap[this.hostUrl] || DEFAULT_BACKEND_URL;\n }\n\n // Register listeners for config and settings\n this.client.request('ui.settings', [], (error: any, data: Settings, end: boolean) => {\n if (error) {\n console.log('ui.settings error:', error, data);\n return;\n }\n\n this.options.settings?.(data);\n });\n\n this.client.request('config', [], (error: any, data: any, end: boolean) => {\n if (error) {\n console.log('config error:', error, data);\n return;\n }\n this.options.config?.(data)\n })\n\n // Register subscribed signals\n this.client.request('signal', [], (error: any, data: any, end: boolean) => {\n if (error) {\n console.log('signal error:', error, data);\n return;\n }\n\n if (data) {\n this.options.signals?.(data);\n }\n });\n\n this.outside = false;\n // Call connected callback\n this.options.connected?.();\n return;\n }\n\n // bail out unless appId is set, as the app is not properly registered\n if (!this.appId) {\n return;\n }\n\n this.client.messageReceived(msg);\n } catch (error) {\n console.log('Dropped invalid JSON message');\n }\n });\n }\n\n info(): ApiInfo {\n return {\n hostUrl: this.hostUrl,\n config: this.config,\n outside: this.outside,\n workspaceId: this.workspaceId,\n }\n }\n}\n", "export interface User {\n _id: string;\n firstname: string;\n lastname: string;\n // email: string;\n // lastSeen: number;\n // status?: string;\n // managedUser?: boolean;\n // removed?: number;\n // defaultProfilepic: string;\n}\n\n/* export interface Workspace {\n _id: string;\n name: string;\n members: string[];\n settings: {\n isolatedTeams?: boolean;\n defaultView: string;\n functionFieldVersion?: 1 | 2;\n color?: string;\n allowPublicCopy?: boolean;\n };\n license: object;\n invoicing?: any;\n propertyFields?: {\n [section: string]: {\n [field: string]: any;\n };\n };\n} */\nexport interface Workspace {\n _id: string;\n name: string;\n}\n\n\nexport interface ActivityFieldRange {\n start: number;\n end: number;\n }\n\n export interface ActivityFieldLink {\n _id: string;\n name: string;\n }\n \nexport interface ActivityFieldError {\n error?: string\n}\n\nexport type ActivityFieldValue = boolean | number | string | (ActivityFieldCountry & ActivityFieldError & ActivityFieldRange & ActivityFieldLink);\n\nexport type ActivityFieldUpdateValue = ActivityFieldValue | null;\n/*\nexport interface UserMap {\n [userId: string]: User;\n}\n\n*/\n\nexport interface ActivityFieldCountry {\n /** ISO 3166-1 alpha-2 (cca2) */\n code: string;\n}\nexport interface Activity {\n _id: string;\n process: string;\n teamAccount: TeamAccount // TODO: Convert in frontend\n created: number;\n uid: string;\n workspaceId: string;\n discussion: string;\n currentPhase: string;\n active?: boolean;\n history?: any[];\n name: string;\n followers?: string[];\n completePhases?: string[];\n location?: {\n type: 'point' | 'area' | 'polyline',\n label: string | null\n data: {\n lat: number\n lng: number\n }[]\n };\n fields?: {\n [fieldId: string]: ActivityFieldValue\n };\n // fields?: { [fieldId: string]: string | number };\n files?: any[];\n updated?: number;\n updatedBy?: string;\n priority?: number;\n sequence?: number\n}\n\nexport interface TeamAccount {\n account: string;\n team: string;\n}\n\nexport interface FormsData {\n files: string[];\n history: {\n // eslint-disable-next-line @typescript-eslint/naming-convention\n 0: {\n [fieldId: string]: {\n value: any;\n };\n };\n };\n name: string;\n location?: boolean;\n uid?: string;\n}\nexport interface FormsResponse {\n name: string;\n description?: string;\n enableUnlinkedMode: boolean;\n enableAttachments: boolean;\n enableMapLocation: boolean;\n locationRequired: 1;\n phases: {\n _id: string;\n followers: [];\n name: string;\n description: string;\n uid: string;\n created: number;\n fields: string[];\n announcementFields: [];\n announcementRecipients: [];\n announcementFieldsOrder: [];\n isEndpoint: boolean;\n }[];\n phasesOrder: string[];\n fields: {\n [id: string]: {\n data: [];\n label: string;\n required: boolean;\n type: string;\n inviteToDiscussionOnChange: boolean;\n _id: string;\n created: number;\n updated: number;\n uid: string;\n functionEnabled: boolean;\n };\n };\n enableMessenger: boolean;\n publicForm: {\n enableMessaging: boolean;\n };\n fieldsOrder: [];\n}\n\nexport interface FormCreateResponse {\n key: string,\n creator: string,\n followers: string,\n active: boolean,\n enableMessaging: boolean,\n allowRead: boolean\n}\n\nexport interface InsightResponse {\n insight: {\n name: string\n },\n data: InsightResponseData\n}\n\nexport interface InsightResponseData {\n headers: string[],\n rows: [],\n time: number\n}\n\nexport interface Config {\n [fieldName: string]: string;\n}\n\nexport type WorkflowFieldType = (\n 'activitylink' |\n 'country' |\n 'date' |\n 'daterange' |\n 'datetime' |\n 'numeric' |\n 'numericunit' |\n 'teams' |\n 'text' |\n 'textarea' |\n 'textunit' |\n 'textpredefinedoptions' |\n 'time' |\n 'timerange' |\n 'datetimerange' |\n 'users' |\n 'linkedfrom' |\n 'subheader'\n);\n\nexport interface WorkflowField {\n _id: string;\n type: WorkflowFieldType;\n label: string;\n required: boolean;\n unit: string;\n placeholder: string;\n description: string;\n data: string[];\n functionEnabled: boolean;\n editable: boolean;\n functionVariables?: { [key: string]: any };\n}\n\nexport interface Workflow {\n _id: string;\n name: string;\n description?: string;\n fields: { [fieldId: string]: any };\n fieldsOrder: string[];\n phases: { [phase_id: string]: WorkflowPhase };\n phasesOrder: string[];\n enablePredefinedName?: boolean;\n nameFunctionEnabled?: boolean;\n nameEditable?: boolean;\n productInstalledId: string;\n workspaceId: string;\n /*\n defaultView: 'table' | 'kanban' | 'map' | 'calendar';\n fields: { [fieldId: string]: any };\n phasesRemoved: string[];\n members: any;\n updated: number;\n coverImage?: string;\n createNewLabel?: string;\n enableAddedField: boolean;\n enableLinkedAnnouncements?: boolean;\n enableMapLocation?: boolean;\n enableUnlinkedMode?: boolean;\n enableMessenger?: boolean;\n allowGuests?: boolean;\n enableGuestEditing?: boolean;\n enableModifiedField?: boolean;\n enableOwnerField?: boolean;\n enableOwnerTeamField?: boolean;\n ownerTeamFieldTitle?: string;\n enableUniqueName?: boolean;\n enablePreselectedTeam?: boolean;\n initPhaseDescription?: string;\n locationRequired?: boolean;\n nameColumnText?: string;\n nameFunction?: string;\n nameFunctionVariables?: any;\n personInCharge?: string;\n personInChargeLabel?: string;\n publicForm?: {\n key: string;\n active: boolean;\n creator: string;\n team_account: TeamAccount;\n followers: string;\n allowRead: boolean;\n enableMessaging?: boolean;\n }\n predefinedNamePrefix?: string;\n preselectedTeam?: TeamAccount;\n enableAttachments: boolean;\n nameFieldPlaceHolderText: string;\n order?: number;\n allowMultipleTags?: boolean;\n allowCustomTags?: boolean;\n requireFileTag?: boolean;\n documentTemplates?: any;\n color?: string;\n starred?: string[];\n isStarred?: boolean;\n createdActivities?: number;\n */\n}\n\nexport interface WorkflowPhase {\n _id: string;\n name: string;\n description?: string;\n fields?: string[];\n primaryDateField?: string;\n primaryNumericField?: string\n /*\n followers: string[];\n created: number;\n uid?: string;\n members?: any[]\n enableAnnouncement?: boolean,\n announcementFields?: string[];\n announcementRecipients?: string[];\n announcementFieldsOrder?: string[];\n announcementToOwner?: boolean;\n announcementToOwnerTeam?: boolean;\n isEndPoint?: boolean;\n possibleNextPhase?: string[];\n possibleNextPhaseSettings?: any;\n fieldOptions?: any;\n primaryNumericField?: string;\n webhooksEnabled?: boolean;\n webhookAdded?: boolean;\n webhookUpdated?: boolean;\n primaryDateField?: string | null | any;\n removed?: number;\n removedBy?: string;\n color?: string | null;\n */\n}\n/**\n * ```ts\n * { [templateId: string]: string }\n * ```\n */\nexport interface IdsMap {\n [templateId: string]: string;\n}\n\nexport type PermissionType = 'admin' | 'own' | 'ownteam' | 'any' | 'edit';\n\nexport interface Member {\n id: string;\n info: { [key: string]: string | number | boolean | null };\n permissions: PermissionType[];\n}\n\nexport type WorkflowPermission = 'admin' | 'any' | 'ownteam' | 'own' | 'guest' | 'none';\nexport type WorkflowPhasePermission = 'edit' | 'view' | 'none';\n\nexport interface PermissionPath {\n type: 'network' | 'user' | 'team' | 'group';\n id: string;\n permission: WorkflowPermission | WorkflowPhasePermission;\n};\n\nexport interface WorkflowPermissionMap {\n [workflowId: string]: {\n // hasAccess: boolean;\n isAdmin: boolean;\n permission: WorkflowPermission;\n permissions: PermissionPath;\n phases: {\n [phaseId: string]: {\n // name: string;\n // hasAccess: boolean;\n permission: WorkflowPhasePermission,\n permissions: PermissionPath[];\n restricted: boolean;\n }\n };\n teams: string[];\n\n }\n};\n\nexport interface WorkspaceRolesPermission {\n isAdmin: boolean;\n isOwner: boolean;\n isGuest: boolean;\n isInviter: boolean;\n isUser: boolean;\n // custom: roleSchema,\n};\n\nexport interface PermissionMap {\n [userId: string]: {\n workflow: WorkflowPermissionMap,\n workspace: WorkspaceRolesPermission,\n // calendar: calendarPermissionMapSchema,\n // insight: insightPermissionMapSchema,\n // app: appPermissionMapSchema,\n // teams: Joi.array().items(validTeamId),\n // permits: Joi.array().items(Joi.string()),\n },\n};\n\nexport interface InsightWorkflowSource {\n name: string;\n workflowId: string;\n fields: {\n name: string;\n fieldId?: string;\n /** Used for phaseLastMove meta */\n phaseId?: string;\n /** Activity information, like _id, created, phaseId etc. */\n meta?: string;\n }[];\n}\nexport interface InsightDoc {\n _id: string;\n name: string;\n /** Key for accessing Insight when set to public */\n publicKey?: string;\n presets: {\n version: 1;\n name: string | 'default';\n options: any;\n }[];\n /** To be used with SQLite if we want to.... */\n query?: string;\n sources: InsightWorkflowSource[];\n public: boolean;\n \n // members: Member[];\n // updated: number;\n /** User id of creator */\n // uid: string;\n // workspaceId: string;\n /** sandboxed javascript with access to all activities in given workflows */\n // function?: string;\n\n \n}\n\nexport type InsightPublic = Omit<InsightDoc, '_id'>;\n\n// These are separate so we can do different configs if necessary without it being a breaking change\nexport interface InsightData {\n headers: string[];\n rows: (string | number | null)[][];\n time: number;\n}\n\nexport interface InsightResponseAsObjectItem {\n [key: string]: any\n}\nexport type InsightResponseAsObjects = InsightResponseAsObjectItem[]\n\nexport interface KanbanListResponse {\n map: {\n [phaseId: string]: {\n activities: {\n _id: string,\n followers: string[],\n name: string,\n fields: { [key: string]: any }\n files: string[],\n primaryDateField: number,\n priority: number,\n }[]\n meta: {\n count: number,\n totalPrimaryNumericValue: number,\n primaryNumericFieldUnit: string | null\n }\n }\n }\n}\n\nexport interface KanbanLoadResponse {\n activity: {\n _id: string,\n followers: string[],\n name: string,\n fields: { [key: string]: any },\n files: string[],\n primaryDateField: number | null,\n priority: number,\n linkedFromCount: number\n },\n process: string,\n phase: string\n}\nexport interface ActivityListOptions {\n sortBy?: 'name' | 'created' | 'updated' | 'following' | 'owner' | 'team' | 'completedOn' | 'priority',\n sortOrder?: 'asc' | 'desc',\n limit?: number,\n skip?: number,\n includeUsers?: boolean,\n includeTeams?: boolean,\n includeHistory?: boolean,\n filters?: any\n}\nexport interface ActivityCreateOptions {\n teamId?: string;\n fileIds?: string[];\n followerIds?: string[];\n location?: {\n label?: string;\n type: 'area' | 'point' | 'polyline';\n data: [{ lat: number, lng: number }];\n };\n discussionId?: string;\n phaseId?: string;\n returnDocument?: boolean;\n}\n\n\n/** Simplistic syntax for add/remove/replace */\nexport interface IdSetUpdate {\n /** Clear all existing */\n '*'?: null,\n /** Add: true, Remove: null */\n [id: string]: true | null | undefined\n}\nexport interface ActivityLocation {\n data: {\n lat: number;\n lng: number;\n }[],\n label?: string;\n type: 'area' | 'point' | 'polyline';\n};\nexport interface ActivityUpdateOptions {\n fields?: ActivityFieldUpdateValue,\n teamId?: string,\n location?: ActivityLocation\n phaseId?: string,\n files?: IdSetUpdate,\n followers?: IdSetUpdate,\n};\n\nexport interface ActivityKanbanListOptions {\n filter: {\n user?: {\n uid: string;\n field: string;\n },\n account?: string;\n team?: string;\n dates?: {\n field: string;\n start: number;\n end: number;\n };\n },\n search?: string;\n limit?: number;\n skip?: number;\n phase?: string;\n includeUsers?: boolean;\n includeTeams?: boolean;\n}\n\nexport interface Settings {\n theme: 'light' | 'dark'\n preferredLanguages: string[];\n}\n\nexport interface ApiInfo {\n /** Url of the Hailer instance hosting the API */\n hostUrl?: string;\n config?: Config;\n outside: boolean | null;\n workspaceId?: string;\n}\n\nexport interface ApiError {\n code: number,\n msg: string, \n debug: object\n}\n\nclass CustomError extends Error {\n public msg: string;\n public code: number;\n \n constructor(message: string, code: number) {\n super(message);\n this.name = this.constructor.name;\n this.msg = message;\n this.code = code;\n Error.captureStackTrace?.(this, this.constructor);\n }\n}\n\nexport class HailerError extends CustomError {\n public debug: object\n public details?: any\n\n constructor(error: {code: number, msg: string, details?: any, debug: any}) {\n super(error.msg, error.code)\n\n this.details = error.details;\n this.debug = error.debug;\n }\n\n toString() {\n console.log('Going to log an error... ;-D');\n return `${super.toString()} \\nField: ${this.details}, ${this.debug}`;\n }\n}\n\nexport interface Signal {\n name: string;\n data: any;\n}\n\nexport interface Product extends ProductType {\n _id: string;\n targetId?: string;\n name: string;\n description?: string;\n icon?: string;\n images?: string[];\n externalUrl?: string;\n publisher?: string;\n ctaLabel: string;\n ctaLink: string;\n /** Available or not in app store */\n public?: boolean;\n cid?: string;\n uid: string;\n}\n\nexport interface ProductListResponse {\n products: Product[];\n totalCount: number;\n}\n\nexport interface ProductSearchOption {\n limit?: number,\n skip?: number,\n search?: string,\n reverse?: boolean,\n sortBy?: 'name' | 'created' | 'updated' | 'type',\n sortOrder?: 'asc' | 'desc'\n}\n\nexport interface ProductSearchFilter extends ProductType {\n public?: boolean,\n cid?: string,\n uid?: string,\n}\n\nexport interface ProductType {\n type?: 'app' | 'template' | 'integration' | 'expert' | 'ai-agent',\n}\n\nexport interface ProductVersion {\n _id: string;\n name: string;\n versions?: Version[];\n cid?: string;\n}\n\nexport interface Version {\n version: string;\n description: string;\n packageHash: string;\n created: number;\n}\n\n// Payment and Pricing Types\nexport interface PricingPlan {\n planId: 'monthly' | 'yearly' | 'one_time';\n label: string;\n price: number;\n currency: string;\n interval: 'month' | 'year' | null;\n}\n\nexport interface PaymentProvider {\n priceId?: {\n monthly?: string;\n yearly?: string;\n one_time?: string;\n };\n trial_days?: number;\n}\n\nexport interface PricingProviders {\n stripe?: PaymentProvider;\n paddle?: PaymentProvider;\n // fuze?: PaymentProvider; // Hidden for now\n}\n\nexport interface PricingData {\n _id?: string;\n productId?: string;\n types: PricingPlan[];\n providers: PricingProviders;\n paymentEnabled?: boolean;\n created?: number;\n updated?: number;\n}\n\nexport interface CreatePricingRequest {\n productId: string;\n types: PricingPlan[];\n providers: PricingProviders;\n paymentEnabled?: boolean;\n}\n\nexport interface UpdatePricingRequest {\n productId: string;\n types: PricingPlan[];\n providers: PricingProviders;\n paymentEnabled?: boolean;\n}\n\nexport interface CreatePurchaseRequest {\n productId: string;\n workspaceId: string;\n planType: 'monthly' | 'yearly' | 'one_time';\n successUrl?: string; // Optional for backward compatibility\n cancelUrl?: string; // Optional for backward compatibility\n useTokens?: boolean; // Optional - use workspace tokens for one-time purchases\n}\n\nexport interface CreatePurchaseResponse {\n status: 'installed_free' | 'subscription_created' | 'checkout_required' | 'payment_processed' | 'payment_failed';\n message?: string;\n productId?: string;\n planType?: string;\n purchaseId?: string;\n subscriptionId?: string;\n provider?: string;\n trialDays?: number;\n checkoutUrl?: string;\n error?: string; // For payment failure details\n}\n\nexport interface Purchase {\n _id: string;\n uid: string;\n cid: string;\n productId?: string;\n productName?: string;\n provider?: 'stripe' | 'paddle' | 'fuze';\n type: 'monthly' | 'yearly' | 'one_time';\n purchaseType: 'workspace' | 'product';\n startedAt: number;\n created: number;\n updated?: number;\n customStatus?: string;\n expiresAt?: number;\n trialDays?: number;\n trialStart?: number;\n trialEnd?: number;\n pricePaid?: {\n amount: number;\n currency: string;\n };\n pricing?: {\n amount: number;\n currency: string;\n interval: string;\n source: string;\n };\n stripe?: {\n customerId?: string;\n checkoutSessionId?: string;\n subscriptionId?: string;\n paymentIntentId?: string;\n status?: string;\n };\n paddle?: {\n customerId?: string;\n subscriptionId?: string;\n status?: string;\n };\n fuze?: {\n customerId?: string;\n subscriptionId?: string;\n status?: string;\n };\n}\n\n// Admin interfaces\nexport interface AdminWorkspaceListItem {\n _id: string;\n name: string;\n memberCount: number;\n created: number;\n updated?: number;\n paymentPlan?: string;\n monthlyPrice?: number;\n paymentMethod?: 'subscription' | 'invoice';\n subscriptionActive?: boolean;\n provider?: string;\n stripeStatus?: string;\n hasPendingSubscription?: boolean;\n tokenBalance?: number;\n autoReloadEnabled?: boolean;\n}\n\nexport interface AdminWorkspaceListRequest {\n filter?: {\n name?: string;\n };\n options?: {\n search?: string;\n sortBy?: string;\n sortOrder?: string;\n limit?: number;\n skip?: number;\n };\n}\n\nexport interface AdminWorkspaceListResponse {\n workspaces: AdminWorkspaceListItem[];\n totalCount: number;\n}\n\n// Purchase data for admin interfaces\nexport interface AdminPurchaseData {\n _id: string;\n uid: string;\n cid: string;\n productId?: string | null;\n productName?: string | null;\n provider?: string;\n type: string;\n purchaseType: 'workspace' | 'product';\n billingType?: 'subscription' | 'invoice';\n planName?: 'flexible' | 'pro' | 'business' | 'enterprise';\n startedAt?: number;\n expiresAt?: number;\n created: number;\n updated?: number;\n customStatus?: string;\n trialStart?: number;\n trialEnd?: number;\n pricePaid?: {\n amount: number;\n currency: string;\n };\n pricing?: {\n amount: number;\n currency: string;\n interval?: string;\n source: 'purchase_record' | 'pricing_collection';\n };\n availablePricing?: Array<{\n planId: 'monthly' | 'yearly' | 'one_time';\n label: string;\n price: number;\n currency: string;\n interval: string | null;\n }>;\n trialDays?: number;\n stripe?: {\n customerId?: string;\n checkoutSessionId?: string;\n subscriptionId?: string;\n paymentIntentId?: string;\n status?: string;\n };\n paddle?: {\n customerId?: string;\n subscriptionId?: string;\n status?: string;\n };\n fuze?: {\n customerId?: string;\n subscriptionId?: string;\n status?: string;\n };\n}\n\n// Single workspace for admin get method (extends list item with purchase data)\nexport interface AdminWorkspaceOverrides {\n // Boolean overrides\n functionFields?: boolean;\n kanban?: boolean;\n customRoles?: boolean;\n restricted?: boolean;\n insight?: boolean;\n dataExport?: boolean;\n documentGenerator?: boolean;\n groups?: boolean;\n print?: boolean;\n isolatedTeams?: boolean;\n managedUsers?: boolean;\n translations?: boolean;\n indexedData?: boolean;\n fastFunctions?: boolean;\n activityRecovery?: boolean;\n // Number overrides\n users?: number | null;\n // String overrides\n tourIdentifier?: string;\n}\n\nexport interface AdminWorkspaceMarketplaceSettings {\n creatorPercent: number;\n}\n\nexport interface AdminWorkspace extends AdminWorkspaceListItem {\n purchaseId?: string;\n purchases?: AdminPurchaseData[];\n overrides?: AdminWorkspaceOverrides;\n marketplace?: AdminWorkspaceMarketplaceSettings;\n}\n\nexport interface AdminUpdateOverridesRequest {\n workspaceId: string;\n overrides: AdminWorkspaceOverrides;\n}\n\nexport interface AdminUpdateMarketplaceSettingsRequest {\n workspaceId: string;\n creatorPercent: number;\n}\n\nexport interface AdminCreateStripeSessionRequest {\n workspaceId: string;\n planName: 'flexible' | 'pro' | 'business' | 'enterprise';\n customPrice: number;\n paymentMethod: 'stripe';\n baseUrl: string;\n}\n\nexport interface AdminCreateStripeSessionResponse {\n success: boolean;\n message: string;\n sessionUrl?: string;\n}\n\nexport interface AdminCreateInvoiceIntegrationRequest {\n workspaceId: string;\n planName: 'enterprise'; // Only enterprise for invoice\n customPrice: number;\n paymentMethod: 'hailer';\n}\n\nexport interface AdminCreateInvoiceIntegrationResponse {\n success: boolean;\n message: string;\n}\n\nexport interface AdminUpdateWorkspaceSubscriptionRequest {\n purchaseId: string;\n billingType: 'subscription' | 'invoice';\n customPrice: number;\n planName: 'flexible' | 'pro' | 'business' | 'enterprise';\n tokenAmount?: number;\n}\n\nexport interface AdminUpdatePurchasePriceRequest {\n purchaseId: string;\n workspaceId: string;\n newPrice: number;\n}\n\nexport interface AdminWorkspaceUser {\n _id: string;\n name: string;\n email: string;\n role: 'owner' | 'admin' | 'user' | 'guest' | 'inviter';\n joined?: number;\n lastActive?: number;\n emailVerified?: boolean;\n}\n\nexport interface AdminWorkspaceUsersListRequest {\n workspaceId?: string;\n filter?: {\n email?: string;\n role?: string;\n };\n options?: {\n search?: string;\n sortBy?: string;\n sortOrder?: string;\n limit?: number;\n skip?: number;\n };\n}\n\nexport interface AdminWorkspaceUsersListResponse {\n users: AdminWorkspaceUser[];\n totalCount: number;\n}\n\nexport interface AdminUpdateUserRequest {\n userId: string;\n updates: {\n emailVerified?: boolean;\n };\n}\n\nexport interface AdminUpdateUserResponse {\n success: boolean;\n}\n\nexport interface AdminUpdateTokenBalanceRequest {\n workspaceId: string;\n tokenAmount: number;\n payoutType?: 'admin_bonus' | 'creator_payout';\n payoutMonth?: number;\n payoutYear?: number;\n creatorPercent?: number;\n}\n\nexport interface AdminTokenTransaction {\n _id: string;\n uid: string;\n cid: string;\n workspaceName: string;\n created: number;\n type: 'purchase' | 'deduction' | 'bonus' | 'admin_adjustment' | 'creator_payout';\n amount: number;\n reason: string;\n meta?: {\n payoutMonth?: number;\n payoutYear?: number;\n creatorProfit?: number;\n creatorPercent?: number;\n [key: string]: any\n };\n createdAt: number;\n}\n\nexport interface AdminTokenTransactionFilter {\n workspaceId?: string;\n type?: 'purchase' | 'deduction' | 'bonus' | 'admin_adjustment' | 'creator_payout';\n operation?: string;\n dateFrom?: number;\n dateTo?: number;\n search?: string;\n}\n\nexport interface AdminTokenTransactionStatistics {\n netChange: number;\n totalPurchases: number;\n totalPurchasesEuro: number;\n purchasesBySource: {\n stripe: {\n count: number;\n tokens: number;\n revenue: number;\n };\n adminPortal: {\n count: number;\n tokens: number;\n revenue: number;\n };\n };\n totalDeductions: number;\n totalDeductionsEuro: number;\n consumptionByOperation: {\n [operation: string]: {\n count: number;\n tokens: number;\n };\n };\n totalBonuses: number;\n totalBonusesEuro: number;\n totalCreatorPayouts: number;\n totalCreatorPayoutsEuro: number;\n totalRefunds: number;\n totalRefundsEuro: number;\n}\n\nexport interface AdminTokenTransactionsListRequest {\n filter?: AdminTokenTransactionFilter;\n options?: {\n sortBy?: string;\n sortOrder?: 'asc' | 'desc';\n limit?: number;\n skip?: number;\n };\n}\n\nexport interface AdminTokenTransactionsListResponse {\n transactions: AdminTokenTransaction[];\n totalCount: number;\n statistics: AdminTokenTransactionStatistics;\n}\n\nexport interface AdminInvoicePurchase {\n _id: string;\n uid: string;\n cid: string;\n workspaceName: string;\n created: number;\n purchaseType: 'workspace' | 'product';\n type: 'monthly' | 'yearly' | 'one_time';\n provider: 'hailer';\n billingType: 'invoice';\n planName?: string;\n productId?: string;\n productName?: string;\n pricePaid?: {\n amount: number;\n currency: string;\n };\n customStatus?: string;\n invoiceHandled?: boolean;\n startedAt: number;\n expiresAt?: number;\n trialStart?: number;\n trialEnd?: number;\n}\n\nexport interface AdminInvoiceListRequest {\n filter?: {\n workspaceId?: string;\n purchaseType?: 'workspace' | 'product';\n status?: 'handled' | 'unhandled' | 'all';\n search?: string;\n };\n options?: {\n sortBy?: string;\n sortOrder?: 'asc' | 'desc';\n limit?: number;\n skip?: number;\n };\n}\n\nexport interface AdminInvoiceWorkspaceGroup {\n cid: string;\n workspaceName: string;\n allHandled: boolean;\n purchases: AdminInvoicePurchase[];\n}\n\nexport interface AdminInvoiceListResponse {\n invoices: AdminInvoicePurchase[];\n totalCount: number;\n workspaceGroups: AdminInvoiceWorkspaceGroup[];\n}\n\nexport interface AdminInvoiceUpdateHandledRequest {\n purchaseIds: string | string[];\n handled: boolean;\n}\n\nexport interface AdminInvoiceUpdateHandledResponse {\n updatedCount: number;\n}\n\n// Monthly Revenue Tracking Types\nexport interface AdminRevenuePurchase {\n _id: string;\n uid: string;\n cid: string;\n workspaceName: string;\n created: number;\n purchaseType: 'workspace' | 'product';\n type: 'monthly' | 'yearly' | 'one_time';\n provider: string;\n productId?: string;\n productName?: string;\n productOwnerCid?: string;\n productOwnerName?: string;\n pricePaid?: { amount: number; currency: string };\n startedAt: number;\n expiresAt?: number;\n // Calculated fields\n normalizedMonthlyRevenue: number; // Yearly \u00F7 12, others as-is\n isMarketplace: boolean;\n profitToHailer: number;\n profitToCreator?: number;\n statusInMonth: 'active' | 'started' | 'ended';\n}\n\nexport interface AdminRevenueWorkspaceGroup {\n cid: string;\n workspaceName: string;\n totalRevenue: number;\n totalMRR: number;\n totalOneTime: number;\n totalCreatorProfit: number;\n totalHailerProfit: number;\n creatorPercent: number;\n productCount: number;\n paidOut?: boolean;\n productBreakdown: Array<{\n productId: string;\n productName: string;\n installationCount: number;\n totalRevenue: number;\n subscriptionTypes: {\n monthly: number;\n yearly: number;\n one_time: number;\n };\n installedBy: Array<{\n cid: string;\n workspaceName: string;\n type: string;\n }>;\n }>;\n purchases: AdminRevenuePurchase[];\n}\n\nexport interface AdminRevenueWorkspaceSubscriptions {\n totalWorkspaces: number;\n totalRevenue: number;\n byPlan: Array<{\n planName: string;\n count: number;\n revenue: number;\n }>;\n}\n\nexport interface AdminRevenueStatistics {\n selectedMonth: { month: number; year: number };\n totalMRR: number;\n totalOneTime: number;\n totalRevenue: number;\n activeCount: number;\n hailerProfit: number;\n creatorProfit: number;\n}\n\nexport interface AdminRevenueListRequest {\n month: number;\n year: number;\n filter?: {\n workspaceId?: string;\n purchaseType?: 'workspace' | 'product';\n subscriptionType?: 'monthly' | 'yearly' | 'one_time';\n search?: string;\n };\n options?: {\n sortBy?: string;\n sortOrder?: 'asc' | 'desc';\n limit?: number;\n skip?: number;\n };\n}\n\nexport interface AdminRevenueListResponse {\n purchases: AdminRevenuePurchase[];\n totalCount: number;\n workspaceGroups: AdminRevenueWorkspaceGroup[];\n statistics: AdminRevenueStatistics;\n}\n\n// Dashboard Statistics Types\nexport interface AdminDashboardEntityStatistics {\n today: number;\n total: number;\n lastWeek: number;\n growth: number;\n}\n\nexport interface AdminDashboardStatisticsResponse {\n users: AdminDashboardEntityStatistics;\n workspaces: AdminDashboardEntityStatistics;\n activities: AdminDashboardEntityStatistics;\n messages: AdminDashboardEntityStatistics;\n userMessages: AdminDashboardEntityStatistics;\n}\n\n// Dashboard Trends Types\nexport interface AdminDashboardTrendDataPoint {\n date: string;\n count: number;\n}\n\nexport interface AdminDashboardTrendsResponse {\n users?: AdminDashboardTrendDataPoint[];\n workspaces?: AdminDashboardTrendDataPoint[];\n}\n\n// Stripe Tax Calculation Types\nexport interface StripeTaxLineItem {\n amount: number;\n reference: string;\n tax_code?: string;\n quantity?: number;\n}\n\nexport interface StripeTaxCalculationRequest {\n workspaceId: string;\n lineItems: StripeTaxLineItem[];\n}\n\nexport interface StripeTaxLineItemResult {\n reference: string;\n amount: number;\n taxAmount: number;\n totalAmount: number;\n}\n\nexport interface StripeTaxCalculationResponse {\n amountSubtotal: number;\n amountTax: number;\n amountTotal: number;\n taxRate?: number;\n country?: string;\n countryName?: string;\n currency: string;\n lineItems: StripeTaxLineItemResult[];\n}\n\n", "import { Client } from '@wishcore/wish-rpc';\nimport { HailerError, User } from '../types';\n\nexport class UserApi {\n constructor(private client: Client) {}\n\n /** \n * Returns the specified user\n * \n * @param userId id of the Hailer user\n *\n * @returns Hailer user information\n *\n * @throws {HailerError} if request is incorrect\n */\n async get(userId: string): Promise<User> {\n try {\n return await this.client.requestAsync('user.get', [userId]);\n }\n catch (error: any) {\n throw new HailerError(error) \n }\n }\n\n /** \n * Returns the current user\n *\n * \n * @returns the current Hailer user information\n *\n * @throws {HailerError} if request is incorrect\n */\n async current(): Promise<User> {\n try {\n return await this.client.requestAsync('user.current', []);\n }\n catch (error: any) {\n throw new HailerError(error) \n }\n }\n\n /** \n * Lists all Hailer users from a workspace\n * \n * \n * @returns list of Hailer users in the workspace the app user is currently in\n *\n * @throws {HailerError} if request is incorrect\n */\n async list(): Promise<User[]> {\n try {\n return await this.client.requestAsync('user.list', []);\n }\n catch (error: any) {\n throw new HailerError(error) \n }\n }\n}\n", "import { Client } from '@wishcore/wish-rpc';\nimport { ActivityKanbanListOptions, HailerError, KanbanListResponse, KanbanLoadResponse } from '../../types';\n\nexport class Kanban {\n constructor(private client: Client) { }\n \n /** \n * Lists all activities in a kanban grouped by phases\n * \n * @param processId the id of the process the kanban relates to\n * @param options ActivityKanbanListOptions\n *\n * @returns activities in kanban list format\n *\n * @throws {HailerError} if request fails\n */\n async list(processId: string, options?: ActivityKanbanListOptions): Promise<KanbanListResponse> {\n try {\n const res = await this.client.requestAsync('activity.kanban.list', [processId, ...options ? [options] : []]);\n return res;\n } catch (error: any) {\n throw new HailerError(error) \n }\n }\n\n /** \n * Loads a single activity in kanban format\n * \n * @param activityId activityId of the wanted activity\n *\n * @returns activity in kanban format\n * \n * @throws {HailerError} if request is incorrect\n */\n async load(activityId: string): Promise<KanbanLoadResponse> {\n try {\n const res = await this.client.requestAsync('activity.kanban.load', [activityId]);\n return res;\n } catch (error: any) {\n throw new HailerError(error) \n }\n }\n\n /** \n * Updates priority of activities in kanban\n * \n * @param activityId activityId of the wanted activity\n * @param priority new priority for the activity\n *\n * @throws {HailerError} if request is incorrect\n */\n async updatePriority(activityId: string, priority: number): Promise<void> {\n try {\n const res = await this.client.requestAsync('activity.kanban.updatePriority', [{activityId, priority}]);\n return res;\n } catch (error: any) {\n throw new HailerError(error) \n }\n }\n\n}\n", "import { Client } from '@wishcore/wish-rpc';\nimport { ActivityCreateOptions, ActivityListOptions, Activity, HailerError, ActivityFieldUpdateValue, ActivityUpdateOptions, ActivityFieldValue } from '../types';\nimport { Kanban } from './activity/kanban';\n\nexport class ActivityApi {\n public kanban: Kanban\n constructor(private client: Client) {\n this.kanban = new Kanban(client)\n }\n\n /** \n * Lists all activities from the specified process and phase\n *\n * @param processId process from current network\n * @param phaseId phase in the process specified in processId\n * @param options ActivityListOptions\n *\n * @returns List of Hailer activities from process and phase filtered with supplied options\n *\n * @throws {HailerError} if request is incorrect\n */\n async list(processId: string, phaseId: string, options?: ActivityListOptions): Promise<Activity[]> {\n try {\n return await this.client.requestAsync('activity.list', [processId, phaseId, options]);\n }\n catch (error: any) {\n throw new HailerError(error) \n }\n }\n\n /** \n * Gets single activity\n *\n * @param activityId activity Id of the process specified in processId\n * @param processId Process where the activityId is\n * @param phaseId Phase where the activityId is in process specified by processId\n * @param options options containing apiVersion\n *\n * @returns Hailer activity information or undefined if no activity is found\n *\n * @throws {HailerError} if request is incorrect\n */\n async get(activityId: string): Promise<Activity | undefined> {\n try {\n // Uses the same endpoint as getAll but only returns the activity in question\n return await this.client.requestAsync('activity.get', [activityId]);\n }\n catch (error: any) {\n throw new HailerError(error) \n }\n }\n\n /** \n * Creates activities\n *\n * @throws {HailerError} if request is incorrect\n */\n async create(workflowId: string | undefined, activities: { name?: string; fields?: { [id: string]: ActivityFieldValue } }[], options?: ActivityCreateOptions ): Promise<Activity[]> {\n try {\n return await this.client.requestAsync('activity.create', [workflowId, activities, ...options ? [options] : []]);\n }\n catch (error: any) {\n throw new HailerError(error) \n }\n }\n\n /** \n * Updates activites\n *\n * @returns The number of updated activities\n *\n * @throws {HailerError} if request is incorrect\n */\n async update(\n activities: { _id: string, name?: string, fields?: { [id: string]: ActivityFieldUpdateValue }, phaseId?: string }[],\n options?: ActivityUpdateOptions\n ): Promise<number> {\n try {\n return await this.client.requestAsync('activity.update', [activities, ...options ? [options] : []]);\n }\n catch (error: any) {\n throw new HailerError(error) \n }\n }\n\n /** \n * Removes activities\n *\n * @param activities Ids of activities to be removed\n * @param options options containing apiVersion\n *\n * @returns The number of removed activities\n *\n * @throws {HailerError} if request is incorrect\n */\n async remove(activities: string[]): Promise<number> {\n try {\n return await this.client.requestAsync('activity.remove', [activities]);\n }\n catch (error: any) {\n throw new HailerError(error) \n }\n }\n}\n", "import { Client } from '@wishcore/wish-rpc';\nimport { HailerError, ProductVersion, Workspace } from '../types';\n\nexport class WorkspaceApi {\n product: {\n /** Publish template in Hailer market */\n publishTemplate: (template: {\n workspaceId?: string,\n versionId?: string,\n version: string,\n versionDescription: string,\n title: string,\n description: string\n }) => Promise<ProductVersion>\n\n /** Check if product is installed */\n isProductInstalled(\n id: string,\n workspaceId: string\n ): Promise<boolean>\n\n /** Get version */\n get(\n id: string\n ): Promise<ProductVersion | undefined>\n\n /** Install template from Hailer market */\n install(productId: string, workspaceId: string): Promise<boolean>\n\n /** Get manifest content from Hailer market */\n getManifest(id: string): Promise<any>\n };\n\n constructor(private client: Client) {\n this.product = {\n publishTemplate: this.publishTemplate.bind(this),\n isProductInstalled: this.isProductInstalled.bind(this),\n get: this.get.bind(this),\n install: this.install.bind(this),\n getManifest: this.getManifest.bind(this),\n };\n }\n\n /** \n * Returns the current network\n *\n * @returns the Hailer Workspace information the user is currently in\n *\n * @throws {HailerError} if request is incorrect\n */\n async current(): Promise<Workspace> {\n try {\n const res = await this.client.requestAsync('workspace.current', []);\n return res;\n }\n catch (error: any) {\n throw new HailerError(error) \n }\n }\n\n /**\n * Returns all workspaces for user if personal app\n * If not personal app it returns only the current workspace\n * @returns the Hailer Workspaces information for the user\n * \n * * @throws {HailerError} if request is incorrect\n */\n async list(): Promise<Workspace[]> {\n try {\n const res = await this.client.requestAsync('workspace.list', []);\n return res;\n }\n catch (error: any) {\n throw new HailerError(error) \n }\n }\n\n\n /** \n * Publish template in Hailer market\n * \n * @param workspaceId Id of workspace\n * @param versionId link to version (empty if first publish)\n * @param version Version number\n * @param versionDescription Version description\n * @param title\n * @param description\n * \n * @returns Created version in Hailer market\n *\n * @throws {HailerError} if request is incorrect\n */\n private async publishTemplate(\n template: {\n workspaceId?: string,\n versionId?: string,\n version: string,\n versionDescription: string,\n title: string,\n description: string\n }\n ): Promise<ProductVersion> {\n try {\n const result = await this.client.requestAsync('workspace.product.publishTemplate', [template]);\n return result;\n }\n catch (error: any) {\n throw new HailerError(error) \n }\n }\n\n /** \n * Check if product is installed\n *\n * @param id Id of product in Hailer market\n *\n * @returns true if ok else false\n *\n * @throws {HailerError} if request is incorrect\n */\n private async isProductInstalled(\n id: string,\n workspaceId: string\n ): Promise<boolean> {\n try {\n return await this.client.requestAsync('workspace.product.isProductInstalled', [id, workspaceId]);\n }\n catch (error: any) {\n throw new HailerError(error) \n }\n }\n\n /** \n * Get version\n *\n * @param id targetId\n *\n * @returns true if ok else false\n *\n * @throws {HailerError} if request is incorrect\n */\n private async get(\n id: string\n ): Promise<ProductVersion | undefined> {\n try {\n return await this.client.requestAsync('workspace.product.get', [id]);\n }\n catch (error: any) {\n throw new HailerError(error) \n }\n }\n\n /** \n * Install template from Hailer market\n *\n * @param productId Id of product in Hailer market\n * \n * @param workspaceId Id of workspace where the product will be installed\n *\n * @returns true, if installed else error\n *\n * @throws {HailerError} if request is incorrect\n */\n private async install(productId: string, workspaceId: string): Promise<boolean> {\n try {\n const result = await this.client.requestAsync('workspace.product.install', [productId, workspaceId]);\n return result;\n }\n catch (error: any) {\n throw new HailerError(error) \n }\n }\n\n /** \n * Get manifest content from Hailer market\n *\n * @param id target Id\n *\n * @returns Manifest content\n *\n * @throws {HailerError} if request is incorrect\n */\n private async getManifest(id: string): Promise<any> {\n try {\n return await this.client.requestAsync('workspace.product.getManifest', [id]);\n }\n catch (error: any) {\n throw new HailerError(error) \n }\n }\n}\n", "import { Client } from '@wishcore/wish-rpc';\n\nexport type ActivityTabTypes =\n 'detail' |\n 'discussion' |\n 'files' |\n 'location' |\n 'linkedFrom' |\n 'options';\n\nexport class Activity {\n constructor(private client: Client) {}\n\n /** Opens an activity in Hailer sidebar */\n async open(\n /** Hailer Activity Id */\n activityId: string,\n options?: {\n /** Which tab to open in activity aside */\n tab?: ActivityTabTypes\n },\n ): Promise<void> {\n await this.client.requestAsync('ui.activity.open', [activityId, ...options ? [options] : []]);\n }\n\n /** Opens activity creation view in Hailer sidebar */\n async create(\n processId: string,\n options?: {\n /** Activity name/title */\n name?: string,\n /** Prepopulate fields */\n fields?: {\n [fieldId: string]: number | string | { start: number, end: number },\n },\n location?: {\n type: 'area' | 'point' | 'polyline',\n data: { lng: number, lat: number }[],\n },\n }\n ): Promise<{ _id: string, name: string } | null> {\n return await this.client.requestAsync('ui.activity.create', [processId, ...options ? [options] : []]);\n }\n\n /** Opens multiple activity edit view in Hailer sidebar */\n async editMultiple(\n activityIds: string[]\n ) {\n return await this.client.requestAsync('ui.activity.editMultiple', [activityIds]);\n }\n}\n", "import { Client } from '@wishcore/wish-rpc';\n\nexport class Snackbar {\n constructor(private client: Client) {}\n\n /** \n * Opens a snackbar in Hailer\n * @param text the text displayed on the snackbar\n * @param buttonLabel the label for the button on the snackbar, for example 'OK'\n * @param duration the time the snackbar is visible in ms\n */\n async open(\n /** The text displayed on the snackbar */\n text: string,\n /** The label for the button on the snackbar, for example 'OK' */\n buttonLabel: string,\n /** The time the snackbar is visible in ms */\n duration?: number,\n ): Promise<void> {\n await this.client.requestAsync('ui.snackbar.open', [text, buttonLabel, duration]);\n }\n}\n", "import { Client } from '@wishcore/wish-rpc';\n\nexport class Files {\n constructor(private client: Client) {}\n\n /**\n * Uploads a file to Hailer\n *\n * @param file file to be uploaded\n * @param publicFile is the file accessible outside of Hailer\n * @param options if file is public\n *\n * @returns File ID in Hailer as string\n */\n public async uploadFile(file: File, filename: string, options: { isPublic?: boolean }): Promise<string> {\n return await this.client.requestAsync('ui.file.upload', [await this.toBase64(file), filename, !!options?.isPublic]);\n }\n\n private toBase64(file: File): Promise<string | ArrayBuffer> {\n return new Promise((resolve, reject) => {\n const reader = new FileReader();\n reader.readAsDataURL(file);\n reader.onload = () => resolve(reader.result ?? '');\n reader.onerror = reject;\n });\n }\n}\n", "import { Client } from '@wishcore/wish-rpc';\n\nexport class Workflow {\n constructor(private client: Client) {}\n\n function = {\n /**\n * Opens the function editor dialog for a specific field\n * @param fieldId The ID of the field to edit\n * @param options Additional options including workflowId and activityId\n */\n edit: async (\n workflowId: string,\n fieldId: string,\n ): Promise<void> => {\n await this.client.requestAsync('ui.workflow.function.edit', [workflowId, fieldId]);\n }\n }\n}", "import { Client } from '@wishcore/wish-rpc';\nimport { Activity } from './ui/activity';\nimport { Snackbar } from './ui/snackbar';\nimport { Files } from './ui/files';\nimport { Workflow } from './ui/workflow';\n\n\nexport class Ui {\n public activity;\n public snackbar;\n public files;\n public insight;\n public workflow;\n\n constructor(private client: Client) {\n this.activity = new Activity(client);\n this.snackbar = new Snackbar(client);\n this.workflow = new Workflow(client);\n\n this.insight = {\n create: async (\n /** Defaults to App workspace */\n workspaceId?: string\n ): Promise<void> => {\n await client.requestAsync('ui.insight.create', [workspaceId]);\n },\n edit: async (\n insightId: string\n ): Promise<void> => {\n await client.requestAsync('ui.insight.edit', [insightId]);\n },\n delete: async (\n insightId: string\n ): Promise<void> => {\n await client.requestAsync('ui.insight.delete', [insightId]);\n },\n permission: async (\n insightId: string\n ): Promise<void> => {\n await client.requestAsync('ui.insight.permission', [insightId]);\n }\n };\n\n this.files = new Files(client);\n }\n}\n", "export const DEFAULT_ALLOWED_URLS = [\n 'https://app.hailer.com',\n 'https://next.hailer.com',\n 'https://testapp.hailer.biz',\n 'https://app.hailer.biz',\n 'https://app.hailer.local.gd',\n 'https://app.k8s.hailer.com',\n 'https://next.k8s.hailer.com',\n 'https://localhost:9443'\n];\n\nexport const DEFAULT_BACKEND_URL = 'https://api.hailer.com';\n\n/** 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 */\nexport const publicBackendMap: { [host: string]: string } = {\n 'https://app.hailer.com': DEFAULT_BACKEND_URL,\n 'https://next.hailer.com': DEFAULT_BACKEND_URL,\n 'https://app.hailer.biz': 'https://api.hailer.biz',\n 'https://testapp.hailer.biz': 'https://testapi.hailer.biz',\n 'https://app.hailer.local.gd': 'https://api.hailer.local.gd',\n 'https://app.k8s.hailer.com': 'https://api.k8s.hailer.com',\n 'https://next.k8s.hailer.com': 'https://api.k8s.hailer.com',\n 'https://localhost:9443': 'http://localhost:1337',\n}\n", "import { Options } from '../../hailer-api';\nimport { Config } from '../../types';\n\nexport class App {\n constructor(private options: Options) {}\n\n /** \n * Read data from app API\n *\n * @param appId key of a specific insight\n *\n * @returns App manifest\n *\n * @throws {HailerError} if there is something wrong with the request or insight cannot be found\n * @throws {TypeError} if Hailer cannot be reached\n */\n async config(): Promise<Config> {\n const manifestFile = 'manifest.json';\n const location = window.location.origin + window.location.pathname;\n let manifestUrl = location + manifestFile;\n\n if (location.endsWith('/index.html')) {\n manifestUrl = location.slice(0, -10) + manifestFile;\n }\n\n const manifestContent = await (await fetch(manifestUrl)).text();\n\n const manifest = JSON.parse(manifestContent);\n\n const appId = manifest.appId;\n\n const res = await fetch(this.options.publicBackendUrl + '/api/v3/app/public', {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json',\n },\n body: JSON.stringify([appId])\n });\n\n return await res.json();\n }\n\n}\n", "import { Options } from '../../hailer-api';\nimport { FormCreateResponse, FormsData, FormsResponse, HailerError } from '../../types';\n\nexport class Form {\n constructor(private options: Options) {}\n\n /** \n * Read data from forms\n *\n * @param formsKey key of a form\n * @param options Overrides default request options, url defaults to https://api.hailer.com/api/v2/forms\n *\n * @returns forms data as object or null if form could not be found\n *\n * @throws {HailerError} if there is something wrong with the request or form cannot be found\n * @throws {TypeError} if Hailer cannot be reached\n */\n async data(formsKey: string): Promise<FormsResponse> {\n const res = await fetch(this.options.publicBackendUrl + '/api/v2/forms/process/get', {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json',\n },\n body: JSON.stringify([formsKey])\n });\n if (!res.ok) {\n throw new HailerError(await res.json())\n }\n return await res.json();\n }\n\n /** \n * Submits form to specified process\n *\n * @param formsKey key of a form\n * @param formsData Data to be sent to form endpoint\n * @param options Overrides default request options, url defaults to https://api.hailer.com/api/v2/forms\n *\n * @returns form creation data or null if form could not be created\n *\n * @throws {HailerError} if there is something wrong with the request or form cannot be found\n * @throws {TypeError} if Hailer cannot be reached\n */\n async submit(formsKey: string, formsData: FormsData): Promise<FormCreateResponse> {\n const res = await fetch(this.options.publicBackendUrl + '/api/v2/forms/activity/create', {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json',\n },\n body: JSON.stringify([formsKey, formsData])\n });\n if (!res.ok) {\n throw new HailerError(await res.json())\n }\n return await res.json();\n }\n}\n", "import { Options } from '../../hailer-api';\nimport { HailerError, InsightResponse, InsightResponseAsObjects, InsightResponseData } from '../../types';\n\nexport class InsightPublicApi {\n constructor(private options: Options) {}\n\n /** \n * Read data from insight API\n *\n * @param insightKey key of a specific insight\n * @param options Overrides default request options, url defaults to https://api.hailer.com/api/v3/insight/public\n *\n * @returns Insight data as object\n *\n * @throws {HailerError} if there is something wrong with the request or insight cannot be found\n * @throws {TypeError} if Hailer cannot be reached\n */\n async data(insightKey: string): Promise<InsightResponse> {\n const res = await fetch(this.options.publicBackendUrl + '/api/v3/insight/public', {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json',\n },\n body: JSON.stringify([insightKey])\n }\n );\n if (!res.ok) {\n throw new HailerError(await res.json())\n }\n return await res.json();\n }\n\n /** \n * Read data from insight API and return in an array of JavaScript objects\n *\n * @param insightKey key of a specific insight\n * @param options Overrides default request options, url defaults to https://api.hailer.com/api/v3/insight/public\n *\n * @returns Insight data as array of JavaScript objects\n *\n * @throws {HailerError} if there is something wrong with the request or insight cannot be found\n * @throws {TypeError} if Hailer cannot be reached\n */\n async dataAsObject(insightKey: string): Promise<InsightResponseAsObjects> {\n const res = await this.data(insightKey);\n\n const input: InsightResponseData = res.data;\n const data: InsightResponseAsObjects = [];\n \n input.rows.forEach((row) => {\n // The object keys are constructed dynamically, so any is necessary\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const object: any = {};\n input.headers.forEach((header, headerIndex) => {\n object[header] = row[headerIndex];\n });\n data.push(object);\n });\n return data;\n }\n}\n", "import { Options } from '../../hailer-api';\nimport { HailerError, Product, ProductListResponse, ProductSearchFilter, ProductSearchOption, ProductType } from '../../types';\n\nexport class ProductPublicApi {\n constructor(private options: Options) {}\n\n /** \n * Lists products from Hailer market\n *\n * @param filter ProductSearchFilter\n * @param options ProductSearchOption\n *\n * @returns List of products in Hailer market filtered with supplied options\n *\n * @throws {HailerError} if request is incorrect\n */\n async list(\n filter?: ProductSearchFilter, \n options?: ProductSearchOption\n ): Promise<ProductListResponse> {\n \n const res = await fetch(this.options.publicBackendUrl + '/api/v3/product/list', {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json',\n },\n body: JSON.stringify([filter, options])\n });\n\n if (!res.ok) {\n throw new HailerError(await res.json())\n }\n return await res.json();\n }\n\n /** \n * Gets single product from Hailer market\n *\n * @param id Product Id\n *\n * @returns Single product from Hailer market or undefined if no product found\n *\n * @throws {HailerError} if request is incorrect\n */\n async get(id: string): Promise<Product | undefined> {\n const res = await fetch(this.options.publicBackendUrl + '/api/v3/product/get', {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json',\n },\n body: JSON.stringify([id])\n });\n\n if (!res.ok) {\n throw new HailerError(await res.json())\n }\n return await res.json();\n }\n}\n", "import { Options } from '../hailer-api';\nimport { Product } from '../types';\nimport { App } from './public/app';\nimport { Form } from './public/form';\nimport { InsightPublicApi } from './public/insight';\nimport { ProductPublicApi } from './public/product';\n\n/**\n * This class is used to access Hailer public API even when the app is outside of Hailer\n */\nexport class HailerPublicApi {\n /** Allows accessing public insight methods. Used for reading data from Hailer even when app is outside of Hailer */\n public insight: InsightPublicApi;\n /** Allows accessing public forms methods. Used for sending data to Hailer even when app is outside of Hailer */\n public form: Form;\n /** Access public App information */\n public app: App;\n /** Access public Product information */\n public product: ProductPublicApi;\n\n constructor(options: Options) {\n this.insight = new InsightPublicApi(options);\n this.form = new Form(options);\n this.app = new App(options);\n this.product = new ProductPublicApi(options);\n }\n}\n", "import { Client } from '@wishcore/wish-rpc';\nimport { HailerError, IdsMap, Workflow } from '../types';\n\nexport class WorkflowApi {\n constructor(private client: Client) {}\n \n /** \n * Lists all processes from a workspace\n *\n * @returns all Hailer processes in the workspace the app user is currently in \n *\n * @throws {HailerError} if request is incorrect\n */\n async list(): Promise<Workflow[]> {\n try {\n return await this.client.requestAsync('workflow.list', []);\n } catch (error: any) {\n console.error(error.msg, error);\n throw new HailerError(error) \n }\n }\n\n /** \n * Gets a single process from a workspace\n * \n * @param workflowId the id of the process in question\n * \n * @returns the specified Hailer process\n *\n * @throws {HailerError} if request is incorrect\n */\n async get(workflowId: string): Promise<Workflow> {\n try {\n return await this.client.requestAsync('workflow.get', [workflowId]);\n }\n catch (error: any) {\n throw new HailerError(error) \n }\n }\n\n /** \n * Gets a single process from a workspace\n * \n * @param processId the id of the process in question\n * \n * @returns the specified Hailer process\n *\n * @throws {HailerError} if request is incorrect\n */\n async install(workflowSpec: any, option?: { workspaceId?: string }): Promise<IdsMap> {\n try {\n return await this.client.requestAsync('workflow.install', [workflowSpec, option]);\n }\n catch (error: any) {\n throw new HailerError(error) \n }\n }\n}\n", "import { Client } from '@wishcore/wish-rpc';\nimport { Config, HailerError, ProductVersion, Version } from '../types';\n\n/**\n * This class is used to access Hailer public API even when the app is outside of Hailer\n */\nexport class AppApi {\n product: {\n /** Check if product is installed */\n isProductInstalled(productId: string, workspaceId: string): Promise<boolean>\n\n /** Get version */\n get(\n id: string\n ): Promise<ProductVersion | undefined>\n\n /** Install app from Hailer market */\n install(productId: string, workspaceId: string): Promise<boolean>\n\n /** Get installed version */\n getInstalledVersion(id: string): Promise<Version>\n\n /** Get manifest content from Hailer market */\n getManifest(id: string): Promise<any>\n };\n\n constructor(private client: Client) {\n this.product = {\n isProductInstalled: this.isProductInstalled.bind(this),\n get: this.get.bind(this),\n install: this.install.bind(this),\n getInstalledVersion: this.getInstalledVersion.bind(this),\n getManifest: this.getManifest.bind(this),\n };\n }\n\n config = {\n update: async (config: Config, option?: { appId?: string }): Promise<void> => {\n try {\n return await this.client.requestAsync('app.config.update', [config, ...option ? [option] : []]);\n } catch (error: any) {\n console.log('Errorasd ', error);\n throw new HailerError(error);\n }\n }\n }\n\n /** \n * Check if product is installed\n *\n * @param productId Id of product in Hailer market\n * \n * @param workspaceId Id of workspace\n *\n * @returns true if ok else false\n *\n * @throws {HailerError} if request is incorrect\n */\n private async isProductInstalled(productId: string, workspaceId: string): Promise<boolean> {\n try {\n return await this.client.requestAsync('app.product.isProductInstalled', [productId, workspaceId]);\n }\n catch (error: any) {\n throw new HailerError(error) \n }\n }\n\n /** \n * Get version\n *\n * @param id targetId\n *\n * @returns true if ok else false\n *\n * @throws {HailerError} if request is incorrect\n */\n private async get(\n id: string\n ): Promise<ProductVersion | undefined> {\n try {\n return await this.client.requestAsync('app.product.get', [id]);\n }\n catch (error: any) {\n throw new HailerError(error) \n }\n }\n\n /** \n * Install app from Hailer market\n *\n * @param productId Id of product in Hailer market\n *\n * @param workspaceId Id of workspace where the product will be installed\n * \n * @returns true, if installed else error\n *\n * @throws {HailerError} if request is incorrect\n */\n private async install(productId: string, workspaceId: string): Promise<boolean> {\n try {\n const result = await this.client.requestAsync('app.product.install', [productId, workspaceId]);\n return result;\n }\n catch (error: any) {\n throw new HailerError(error) \n }\n }\n\n /** \n * Get installed version from Hailer market\n *\n * @param id Id of product in Hailer market\n *\n * @returns true, if installed else error\n *\n * @throws {HailerError} if request is incorrect\n */\n private async getInstalledVersion(id: string): Promise<Version> {\n try {\n const result = await this.client.requestAsync('app.product.getInstalledVersion', [id]);\n return result;\n }\n catch (error: any) {\n throw new HailerError(error) \n }\n }\n\n /** \n * Get manifest content from Hailer market\n *\n * @param id target Id\n *\n * @returns Manifest content\n *\n * @throws {HailerError} if request is incorrect\n */\n private async getManifest(id: string): Promise<any> {\n try {\n return await this.client.requestAsync('app.product.getManifest', [id]);\n }\n catch (error: any) {\n throw new HailerError(error) \n }\n }\n}\n", "import { Client } from '@wishcore/wish-rpc';\nimport { HailerError, InsightData, InsightDoc } from '../types';\n\nexport class InsightApi {\n constructor(private client: Client) {}\n\n /** \n * Get Insight data \n * \n * @param insightId the id of the Insight the data is fetched from\n * \n * @returns data from the Insight\n *\n * @throws {HailerError} if request is incorrect\n */\n async data(insightId: string, options: { update?: true }): Promise<InsightData> {\n\n try {\n /*data = [{ insightId, { headers, rows, time } }] */\n return await this.client.requestAsync('insight.data', [insightId, ...options ? [options] : []]);\n }\n catch (error: any) {\n throw new HailerError(error) \n }\n }\n\n /** \n * Get Insight data \n * \n * \n * @returns data from the Insight\n *\n * @throws {HailerError} if request is incorrect\n */\n async list(): Promise<InsightDoc[]> {\n try {\n return await this.client.requestAsync('insight.list', []);\n }\n catch (error: any) {\n throw new HailerError(error) \n }\n }\n\n /** \n * Get Insight data \n * \n * @returns data from the Insight\n *\n * @throws {HailerError} if request is incorrect\n */\n /* @private */ async update(insightId: string, update: Partial<InsightDoc>): Promise<InsightDoc[]> {\n try {\n return await this.client.requestAsync('insight.update', [insightId, update]);\n }\n catch (error: any) {\n throw new HailerError(error) \n }\n } \n}\n\n", "import { Client } from '@wishcore/wish-rpc';\nimport { HailerError, PermissionMap } from '../types';\n\n/**\n * This class is used to access Hailer public API even when the app is outside of Hailer\n */\nexport class PermissionApi {\n\n constructor(private client: Client) {}\n\n map = async (): Promise<PermissionMap> => {\n try {\n return await this.client.requestAsync('permission.map', []);\n } catch (error: any) {\n console.log('Failed to read permissions from Hailer, error:', error);\n throw new HailerError(error);\n }\n }\n}\n", "import { Client } from '@wishcore/wish-rpc';\nimport { HailerError, Product, ProductSearchOption, ProductSearchFilter, ProductListResponse } from '../types';\n\nexport class ProductApi {\n constructor(private client: Client) {}\n\n /** \n * Lists products from Hailer market\n *\n * @param filter ProductSearchFilter\n * @param options ProductSearchOption\n *\n * @returns List of products in Hailer market filtered with supplied options\n *\n * @throws {HailerError} if request is incorrect\n */\n async list(\n filter?: ProductSearchFilter, \n options?: ProductSearchOption): Promise<ProductListResponse> {\n try {\n const res = await this.client.requestAsync('product.list', [filter, options]);\n return res;\n }\n catch (error: any) {\n throw new HailerError(error) \n }\n }\n\n /** \n * Gets single product from Hailer market\n *\n * @param id Product Id\n *\n * @returns Single product from Hailer market or undefined if no product found\n *\n * @throws {HailerError} if request is incorrect\n */\n async get(id: string): Promise<Product | undefined> {\n try {\n return await this.client.requestAsync('product.get', [id]);\n }\n catch (error: any) {\n throw new HailerError(error) \n }\n }\n\n /** \n * Creates product in Hailer market\n * \n * @param targetId link to targetId (version)\n * @param name Name of the product\n * @param description Description what this product is doing\n * @param icon Icon id for the product\n * @param images List of fileIds for showing pictures of the product\n * @param externalUrl Public URL for creator to show more information about the product\n * @param publisher Publisher (author)\n * @param type App, template, music etc.\n * \n * @returns Created product in Hailer market\n *\n * @throws {HailerError} if request is incorrect\n */\n async create(\n product: {\n targetId?: string,\n name: string,\n description?: string,\n icon?: string,\n images?: string[],\n externalUrl?: string,\n publisher?: string,\n type?: string\n }\n ): Promise<Product> {\n try {\n const result = await this.client.requestAsync('product.create', [product]);\n return result;\n }\n catch (error: any) {\n throw new HailerError(error) \n }\n }\n\n /** \n * Updates product in Hailer market\n *\n * @param id Id of product in Hailer market\n * @param name Name of the product\n * @param description Description what this product is doing\n * @param icon Icon id for the product\n * @param images List of fileIds for showing pictures of the product\n * @param externalUrl Public URL for creator to show more information about the product\n * @param publisher Publisher (Author)\n * @param public: Visible or not in Hailer market\n * @param type App, template, music etc.\n *\n * @returns Updated product in Hailer market\n *\n * @throws {HailerError} if request is incorrect\n */\n async update(\n id: string,\n product: {\n name?: string,\n description?: string,\n icon?: string,\n images?: string[],\n externalUrl?: string,\n publisher?: string,\n public?: boolean,\n type?: string\n }\n ): Promise<Product> {\n try {\n const result = await this.client.requestAsync('product.update', [id, product]);\n return result;\n }\n catch (error: any) {\n throw new HailerError(error) \n }\n }\n\n /** \n * Remove product from Hailer market\n *\n * @param id Id of product in Hailer market\n *\n * @returns true, if removed\n *\n * @throws {HailerError} if request is incorrect\n */\n async remove(id: string): Promise<boolean> {\n try {\n const result = await this.client.requestAsync('product.remove', [id]);\n return result;\n }\n catch (error: any) {\n throw new HailerError(error) \n }\n }\n\n /** \n * Set product as public or not (visible) in Hailer market\n *\n * @param id Id of product in Hailer market\n * @param isPublic Visible or not in Hailer market\n *\n * @returns true if ok else false\n *\n * @throws {HailerError} if request is incorrect\n */\n async setPublic(\n id: string,\n isPublic: boolean\n ): Promise<boolean> {\n try {\n return await this.client.requestAsync('product.setPublic', [id, isPublic]);\n }\n catch (error: any) {\n throw new HailerError(error) \n }\n }\n}\n", "import { Client } from '@wishcore/wish-rpc';\nimport {\n HailerError,\n PricingData,\n CreatePricingRequest,\n UpdatePricingRequest,\n CreatePurchaseRequest,\n CreatePurchaseResponse,\n Purchase,\n StripeTaxCalculationRequest,\n StripeTaxCalculationResponse\n} from '../types';\n\nexport class Payment {\n constructor(private client: Client) {}\n\n /** \n * Creates pricing configuration for a product\n *\n * @param request CreatePricingRequest containing productId, types, and providers\n *\n * @returns Created pricing configuration\n *\n * @throws {HailerError} if request is incorrect or product not found\n */\n async createPricing(request: CreatePricingRequest): Promise<PricingData> {\n try {\n const res = await this.client.requestAsync('payment.createPricing', [request]);\n return res;\n }\n catch (error: any) {\n throw new HailerError(error) \n }\n }\n\n /** \n * Updates pricing configuration for a product\n *\n * @param request UpdatePricingRequest containing productId, types, and providers\n *\n * @returns Updated pricing configuration\n *\n * @throws {HailerError} if request is incorrect, product not found, or pricing doesn't exist\n */\n async updatePricing(request: UpdatePricingRequest): Promise<PricingData> {\n try {\n const res = await this.client.requestAsync('payment.updatePricing', [request]);\n return res;\n }\n catch (error: any) {\n throw new HailerError(error) \n }\n }\n\n /** \n * Gets pricing configuration for a product\n *\n * @param productId Product ID to get pricing for\n *\n * @returns Pricing configuration or null if not found\n *\n * @throws {HailerError} if request is incorrect or product not found\n */\n async getPricing(productId: string): Promise<PricingData | null> {\n try {\n const res = await this.client.requestAsync('payment.getPricing', [{ productId }]);\n return res;\n }\n catch (error: any) {\n throw new HailerError(error) \n }\n }\n\n /** \n * Creates a product purchase/subscription\n *\n * @param request CreatePurchaseRequest containing productId, workspaceId, and planType\n *\n * @returns Purchase creation result with status and details\n *\n * @throws {HailerError} if request is incorrect, product not found, or payment fails\n */\n async createPurchase(request: CreatePurchaseRequest): Promise<CreatePurchaseResponse> {\n try {\n const res = await this.client.requestAsync('payment.createPurchase', [request]);\n return res;\n }\n catch (error: any) {\n throw new HailerError(error) \n }\n }\n\n /**\n * Gets purchases for a workspace\n *\n * @param workspaceId Workspace ID to get purchases for\n *\n * @returns Array of purchases for the workspace\n *\n * @throws {HailerError} if request is incorrect or workspace not found\n */\n async getPurchases(workspaceId: string): Promise<Purchase[]> {\n try {\n const res = await this.client.requestAsync('payment.getPurchases', [{ workspaceId }]);\n return res || [];\n }\n catch (error: any) {\n throw new HailerError(error)\n }\n }\n\n /**\n * Calculates Stripe tax for line items\n *\n * @param request StripeTaxCalculationRequest containing workspaceId and lineItems\n *\n * @returns Tax calculation result with amounts, rates, and country information\n *\n * @throws {HailerError} if request is incorrect, workspace not found, or Stripe customer not found\n */\n async calculateStripeTax(request: StripeTaxCalculationRequest): Promise<StripeTaxCalculationResponse> {\n try {\n const res = await this.client.requestAsync('payment.calculateStripeTax', [request]);\n return res;\n }\n catch (error: any) {\n throw new HailerError(error)\n }\n }\n}", "import { Client } from '@wishcore/wish-rpc';\nimport {\n HailerError,\n AdminWorkspaceListRequest,\n AdminWorkspaceListResponse,\n AdminWorkspace,\n AdminCreateStripeSessionRequest,\n AdminCreateStripeSessionResponse,\n AdminCreateInvoiceIntegrationRequest,\n AdminCreateInvoiceIntegrationResponse,\n AdminUpdateWorkspaceSubscriptionRequest,\n AdminUpdatePurchasePriceRequest,\n AdminWorkspaceUsersListRequest,\n AdminWorkspaceUsersListResponse,\n AdminUpdateUserRequest,\n AdminUpdateUserResponse,\n AdminTokenTransactionsListRequest,\n AdminTokenTransactionsListResponse,\n AdminUpdateOverridesRequest,\n AdminUpdateMarketplaceSettingsRequest,\n AdminInvoiceListRequest,\n AdminInvoiceListResponse,\n AdminInvoiceUpdateHandledRequest,\n AdminInvoiceUpdateHandledResponse,\n AdminRevenueListRequest,\n AdminRevenueListResponse,\n AdminDashboardStatisticsResponse,\n AdminDashboardTrendsResponse\n} from '../types';\n\nexport class Admin {\n constructor(private client: Client) {}\n\n /**\n * Lists workspaces with search, pagination, and sorting\n *\n * @param request AdminWorkspaceListRequest containing filter and options\n *\n * @returns List of workspaces with total count\n *\n * @throws {HailerError} if request fails or user not authorized\n */\n async listWorkspaces(request?: AdminWorkspaceListRequest): Promise<AdminWorkspaceListResponse> {\n try {\n const res = await this.client.requestAsync('admin.workspace.list', [request?.filter, request?.options]);\n return res;\n }\n catch (error: any) {\n throw new HailerError(error)\n }\n }\n\n /**\n * Gets detailed information about a specific workspace\n *\n * @param workspaceId The ID of the workspace to retrieve\n *\n * @returns Workspace details including payment information\n *\n * @throws {HailerError} if request fails, workspace not found, or user not authorized\n */\n async getWorkspace(workspaceId: string): Promise<AdminWorkspace> {\n try {\n const res = await this.client.requestAsync('admin.workspace.get', [workspaceId]);\n return res;\n }\n catch (error: any) {\n throw new HailerError(error)\n }\n }\n\n /**\n * Creates a Stripe checkout session for workspace subscription\n *\n * @param request AdminCreateStripeSessionRequest containing workspace details and payment info\n *\n * @returns AdminCreateStripeSessionResponse with success status and session URL\n *\n * @throws {HailerError} if request fails, user not authorized, or workspace already has subscription\n */\n async createStripeSession(request: AdminCreateStripeSessionRequest): Promise<AdminCreateStripeSessionResponse> {\n try {\n const res = await this.client.requestAsync('admin.workspace.createStripeSession', [request]);\n return res;\n }\n catch (error: any) {\n throw new HailerError(error)\n }\n }\n\n /**\n * Creates an invoice integration for workspace subscription\n *\n * @param request AdminCreateInvoiceIntegrationRequest containing workspace details and payment info\n *\n * @returns AdminCreateInvoiceIntegrationResponse with success status\n *\n * @throws {HailerError} if request fails, user not authorized, or workspace already has subscription\n */\n async createInvoiceIntegration(request: AdminCreateInvoiceIntegrationRequest): Promise<AdminCreateInvoiceIntegrationResponse> {\n try {\n const res = await this.client.requestAsync('admin.workspace.createInvoiceIntegration', [request]);\n return res;\n }\n catch (error: any) {\n throw new HailerError(error)\n }\n }\n\n /**\n * Updates workspace subscription billing information\n *\n * @param request AdminUpdateWorkspaceSubscriptionRequest containing purchase ID and new billing details\n *\n * @returns boolean indicating whether the update was successful\n *\n * @throws {HailerError} if request fails, user not authorized, or purchase not found\n */\n async updateWorkspaceSubscription(request: AdminUpdateWorkspaceSubscriptionRequest): Promise<boolean> {\n try {\n const res = await this.client.requestAsync('admin.workspace.updateSubscription', [request]);\n return res;\n }\n catch (error: any) {\n throw new HailerError(error)\n }\n }\n\n /**\n * Updates purchase price for active invoice products\n *\n * @param request AdminUpdatePurchasePriceRequest containing purchase ID, workspace ID, and new price\n *\n * @returns boolean indicating whether the update was successful\n *\n * @throws {HailerError} if request fails, user not authorized, purchase not found, or not an invoice product\n */\n async updatePurchasePrice(request: AdminUpdatePurchasePriceRequest): Promise<boolean> {\n try {\n const res = await this.client.requestAsync('admin.purchase.updatePrice', [request]);\n return res;\n }\n catch (error: any) {\n throw new HailerError(error)\n }\n }\n\n /**\n * Lists users in a workspace with search, filtering, pagination, and sorting\n * If no workspaceId provided, lists all users across all workspaces\n *\n * @param request AdminWorkspaceUsersListRequest containing optional workspace ID, filter and options\n *\n * @returns List of workspace users with total count and role information\n *\n * @throws {HailerError} if request fails, workspace not found, or user not authorized\n */\n async listWorkspaceUsers(request: AdminWorkspaceUsersListRequest): Promise<AdminWorkspaceUsersListResponse> {\n try {\n const res = await this.client.requestAsync('admin.workspace.listUsers', [request.workspaceId, request.filter, request.options]);\n return res;\n }\n catch (error: any) {\n throw new HailerError(error)\n }\n }\n\n /**\n * Updates a user's information (currently supports email verification only)\n *\n * @param request AdminUpdateUserRequest containing user ID and updates\n *\n * @returns boolean indicating success\n *\n * @throws {HailerError} if request fails, user not found, or user not authorized\n */\n async updateUser(request: AdminUpdateUserRequest): Promise<boolean> {\n try {\n const res = await this.client.requestAsync('admin.user.update', [request.userId, request.updates]);\n return res;\n }\n catch (error: any) {\n throw new HailerError(error)\n }\n }\n\n /**\n * Updates workspace token balance\n *\n * @param request Object containing workspaceId, tokenAmount, and optional payout parameters\n *\n * @returns boolean indicating success\n *\n * @throws {HailerError} if request fails, workspace not found, or user not authorized\n */\n async updateTokenBalance(request: {\n workspaceId: string;\n tokenAmount: number;\n payoutMonth?: number;\n payoutYear?: number;\n payoutType?: 'admin_bonus' | 'creator_payout';\n creatorPercent?: number;\n }): Promise<boolean> {\n try {\n const res = await this.client.requestAsync('admin.workspace.updateTokenBalance', [request]);\n return res;\n }\n catch (error: any) {\n throw new HailerError(error)\n }\n }\n\n /**\n * Updates workspace license overrides\n *\n * @param request AdminUpdateOverridesRequest containing workspaceId and overrides object\n *\n * @returns boolean indicating success\n *\n * @throws {HailerError} if request fails, workspace not found, or user not authorized\n */\n async updateWorkspaceOverrides(request: AdminUpdateOverridesRequest): Promise<boolean> {\n try {\n const res = await this.client.requestAsync('admin.workspace.updateOverrides', [request]);\n return res;\n }\n catch (error: any) {\n throw new HailerError(error)\n }\n }\n\n async updateWorkspaceMarketplaceSettings(request: AdminUpdateMarketplaceSettingsRequest): Promise<boolean> {\n try {\n const res = await this.client.requestAsync('admin.workspace.updateMarketplaceSettings', [request]);\n return res;\n }\n catch (error: any) {\n throw new HailerError(error)\n }\n }\n\n /**\n * Lists token transactions with filtering, pagination, and statistics\n *\n * @param request AdminTokenTransactionsListRequest containing optional filter and pagination options\n *\n * @returns AdminTokenTransactionsListResponse with transactions, total count, and statistics\n *\n * @throws {HailerError} if request fails or user not authorized\n */\n async listTokenTransactions(request?: AdminTokenTransactionsListRequest): Promise<AdminTokenTransactionsListResponse> {\n try {\n const res = await this.client.requestAsync('admin.tokenTransaction.list', [request?.filter, request?.options]);\n return res;\n }\n catch (error: any) {\n throw new HailerError(error)\n }\n }\n\n /**\n * Lists Hailer invoice purchases with filtering, pagination, and workspace grouping\n *\n * @param request AdminInvoiceListRequest containing optional filter and pagination options\n *\n * @returns AdminInvoiceListResponse with invoices, total count, and workspace groups\n *\n * @throws {HailerError} if request fails or user not authorized\n */\n async listInvoices(request?: AdminInvoiceListRequest): Promise<AdminInvoiceListResponse> {\n try {\n const res = await this.client.requestAsync('admin.invoice.list', [request?.filter, request?.options]);\n return res;\n }\n catch (error: any) {\n throw new HailerError(error)\n }\n }\n\n /**\n * Updates the handled status for one or more Hailer invoice purchases\n *\n * @param request AdminInvoiceUpdateHandledRequest containing purchase ID(s) and handled status\n *\n * @returns AdminInvoiceUpdateHandledResponse with count of updated records\n *\n * @throws {HailerError} if request fails, purchase not found, or not a Hailer invoice purchase\n */\n async updateInvoiceHandled(request: AdminInvoiceUpdateHandledRequest): Promise<AdminInvoiceUpdateHandledResponse> {\n try {\n const res = await this.client.requestAsync('admin.invoice.updateHandled', [request.purchaseIds, request.handled]);\n return res;\n }\n catch (error: any) {\n throw new HailerError(error)\n }\n }\n\n async listMonthlyRevenue(request: AdminRevenueListRequest): Promise<AdminRevenueListResponse> {\n try {\n const res = await this.client.requestAsync('admin.revenue.list', [\n request.month,\n request.year,\n request.filter,\n request.options\n ]);\n return res;\n }\n catch (error: any) {\n throw new HailerError(error)\n }\n }\n\n /**\n * Gets dashboard statistics including counts for users, workspaces, activities, and messages\n * Includes today's count, total count, last week count, and week-over-week growth percentage\n *\n * @param entities Optional array of entity types to fetch. Defaults to all entities.\n * Valid values: 'users', 'workspaces', 'activities', 'messages', 'userMessages'\n *\n * @returns AdminDashboardStatisticsResponse with statistics for requested entity types\n *\n * @throws {HailerError} if request fails or user not authorized\n */\n async getDashboardStatistics(entities?: string[]): Promise<AdminDashboardStatisticsResponse> {\n try {\n const res = await this.client.requestAsync('admin.dashboard.statistics', [entities]);\n return res;\n }\n catch (error: any) {\n throw new HailerError(error)\n }\n }\n\n /**\n * Gets dashboard trends showing daily creation counts over time\n *\n * @param days Number of days to fetch (30, 90, 180, or 365). Defaults to 30.\n * @param entities Optional array of entity types to fetch. Defaults to ['users', 'workspaces'].\n * Valid values: 'users', 'workspaces'\n *\n * @returns AdminDashboardTrendsResponse with daily counts for requested entity types\n *\n * @throws {HailerError} if request fails or user not authorized\n */\n async getDashboardTrends(days?: 30 | 90 | 180 | 365, entities?: string[]): Promise<AdminDashboardTrendsResponse> {\n try {\n const res = await this.client.requestAsync('admin.dashboard.trends', [days, entities]);\n return res;\n }\n catch (error: any) {\n throw new HailerError(error)\n }\n }\n}", "import { Client } from '@wishcore/wish-rpc';\nimport { HailerError } from '../types';\n\nexport interface MetricDefinition {\n id: string;\n name: string;\n description: string;\n category: string;\n supportsTimeRange: boolean;\n supportsBreakdown: boolean;\n}\n\nexport interface MetricData {\n metricType: string;\n timestamp: number;\n current: {\n value: number;\n labels?: any;\n };\n timeSeries?: Array<{\n timestamp: number;\n value: number;\n }>;\n breakdown?: {\n byWorkspace?: Record<string, number>;\n byUser?: Record<string, number>;\n };\n metadata: {\n scope?: any;\n permissions?: any;\n source: string;\n executionTime?: number;\n };\n}\nexport interface MetricOptions {\n workspaceId?: string;\n userId?: string;\n timeRange?: {\n start: number;\n end: number;\n };\n interval?: '1m' | '5m' | '15m' | '1h';\n}\n\nexport interface MetricListOptions {\n category?: string;\n includeDetails?: boolean;\n}\n\nexport class MetricsApi {\n constructor(private client: Client) {}\n\n /**\n * Get list of available metrics for current user based on permissions\n * @param options Optional filtering options\n * @returns Array of metric IDs or detailed metric definitions\n */\n async list(options?: MetricListOptions): Promise<string[] | MetricDefinition[]> {\n try {\n return await this.client.requestAsync('metrics.list', options ? [options] : []);\n } catch (error: any) {\n throw new HailerError(error);\n }\n }\n\n /**\n * Get current metrics data for single metric\n * @param metricType The metric type to fetch\n * @param options Optional filtering and time range options\n * @returns Single metric data\n */\n async get(metricTypes: string[], options?: MetricOptions): Promise<MetricData> {\n try {\n return await this.client.requestAsync('metrics.get', [metricTypes, options]);\n } catch (error: any) {\n throw new HailerError(error);\n }\n }\n}"],
|
|
4
|
+
"sourcesContent": [null, null, null, "import { Client } from '@wishcore/wish-rpc';\nimport { UserApi } from './modules/user';\nimport { ActivityApi } from './modules/activity';\nimport { WorkspaceApi } from './modules/workspace';\nimport { ApiInfo, Config, Settings, Signal } from './types';\nimport { Ui } from './modules/ui';\nimport { DEFAULT_ALLOWED_URLS, DEFAULT_BACKEND_URL, publicBackendMap } from './constants';\nimport { HailerPublicApi } from './modules/public';\nimport { WorkflowApi } from './modules/workflow';\nimport { AppApi } from './modules/app';\nimport { InsightApi } from './modules/insight';\nimport { PermissionApi } from './modules/permission';\nimport { ProductApi } from './modules/product';\nimport { Payment } from './modules/payment';\nimport { Admin } from './modules/admin';\nimport { MetricsApi } from './modules/metrics';\n\nexport interface Options {\n /** When connected is called the host is ready to receive calls */\n connected?: () => void;\n /** Callback when app is determined to be outside of Hailer, as a standalone app */\n outside?: (config?: any) => void;\n /** Callback on errors, defaults to printing errors in console */\n error?: (error: Error) => void;\n /** Callback called on app init and when permissions have changed */\n permissions?: () => void;\n /** Callback called on app init and when settings have changed */\n settings?: (data: Settings) => void;\n /** Callback called on app init and when config has changed */\n config?: (config: any) => void;\n /** Will be called each time a subscribed signal is emitted from Hailer frontend. To subscribe to signals, add them to options.subscribedSignals[] */\n signals?: (signal: Signal) => void;\n /** Urls the sdk is allowed to connect to. Defaults to all Hailer instances*/\n allowedUrls?: string[];\n /** Public backend Api url. Defaults to https://api.hailer.com */\n publicBackendUrl?: string;\n}\n\nexport class HailerApi {\n public user: UserApi;\n public app: AppApi;\n public activity: ActivityApi;\n public insight: InsightApi;\n public workspace: WorkspaceApi;\n public workflow: WorkflowApi;\n public permission: PermissionApi;\n public product: ProductApi;\n public payment: Payment;\n public admin: Admin;\n public metrics: MetricsApi;\n /** All public endpoints, which can be accessed while not logged in to Hailer. */\n public public: HailerPublicApi;\n /** User interface commands */\n public ui: Ui;\n /** Url of the Hailer instance hosting the API */\n private hostUrl?: string;\n\n private appId?: string;\n /** If set it indicates that app is locked to a specific workspaceId */\n private workspaceId?: string;\n private client: Client;\n private config?: Config;\n private timer?: NodeJS.Timeout;\n /**\n * Hailer API state\n * \n * ```\n * true // outside hailer\n * false // logged into hailer\n * null // state not yet detected\n * ``` \n */\n private outside: boolean | null = null;\n\n /**\n * Create a Hailer API client for inteacting with Hailer. **NOTE** This only works when inside Hailer.\n *\n * This should be run after window is initialized for example in ***onMount*** in Svelte or in ***useEffect*** in React\n */\n constructor(\n public options: Options = {}\n ) {\n const allowedUrls = options.allowedUrls ?? DEFAULT_ALLOWED_URLS;\n \n this.client = new Client(msg => {\n if (this.hostUrl){\n parent.postMessage(JSON.stringify(msg), this.hostUrl)\n }\n })\n\n this.user = new UserApi(this.client);\n this.app = new AppApi(this.client);\n this.activity = new ActivityApi(this.client);\n this.insight = new InsightApi(this.client);\n this.workspace = new WorkspaceApi(this.client);\n this.workflow = new WorkflowApi(this.client);\n this.permission = new PermissionApi(this.client);\n this.public = new HailerPublicApi(this.options);\n this.ui = new Ui(this.client);\n this.product = new ProductApi(this.client);\n this.payment = new Payment(this.client);\n this.admin = new Admin(this.client);\n this.metrics = new MetricsApi(this.client);\n\n const registerMessage = JSON.stringify({ op: 'register', args: [{ appApiVersion: '2' }] });\n\n // If we are not in Iframe set location to outside, else wait 100ms for response to register to check if we are in Hailer\n if (window.location === window.parent.location) {\n // Pick a backend to use for public requests, unless it is set\n if (!this.options.publicBackendUrl) {\n this.options.publicBackendUrl = DEFAULT_BACKEND_URL;\n }\n\n this.public.app.config().then(config => {\n // CSM app assumes we are inside hailer when config is called... breaks the thing...\n // this.options.config?.(config);\n\n this.outside = true;\n this.options.outside?.(config);\n }).catch(error => {\n this.options.error?.(error);\n console.error('Failed to get app configuration in Public App.', error);\n });\n } else {\n // if in a frame, try register to Hailer by sending register to all allowed urls\n allowedUrls.forEach(url => parent.postMessage(registerMessage, url));\n this.timer = setTimeout(() => {\n this.outside = true;\n this.options.outside?.()\n }, 100);\n }\n\n this.createEventListener();\n }\n\n private createEventListener() {\n window.addEventListener('message', async event => {\n const data = event.data;\n\n try {\n const msg = JSON.parse(data);\n if (msg.op === 'register') {\n if (this.appId) {\n console.error('App Id is already set...! Are you using hot-reload?');\n return;\n }\n\n clearTimeout(this.timer);\n\n this.appId = msg.data.appId;\n this.workspaceId = msg.data.workspaceId;\n\n // Set host url now that we have a response\n this.hostUrl = event.origin;\n\n // Pick a backend to use for public requests, unless it is set\n if (!this.options.publicBackendUrl) {\n this.options.publicBackendUrl = publicBackendMap[this.hostUrl] || DEFAULT_BACKEND_URL;\n }\n\n // Register listeners for config and settings\n this.client.request('ui.settings', [], (error: any, data: Settings, end: boolean) => {\n if (error) {\n console.log('ui.settings error:', error, data);\n return;\n }\n\n this.options.settings?.(data);\n });\n\n this.client.request('config', [], (error: any, data: any, end: boolean) => {\n if (error) {\n console.log('config error:', error, data);\n return;\n }\n this.options.config?.(data)\n })\n\n // Register subscribed signals\n this.client.request('signal', [], (error: any, data: any, end: boolean) => {\n if (error) {\n console.log('signal error:', error, data);\n return;\n }\n\n if (data) {\n this.options.signals?.(data);\n }\n });\n\n this.outside = false;\n // Call connected callback\n this.options.connected?.();\n return;\n }\n\n // bail out unless appId is set, as the app is not properly registered\n if (!this.appId) {\n return;\n }\n\n this.client.messageReceived(msg);\n } catch (error) {\n console.log('Dropped invalid JSON message');\n }\n });\n }\n\n info(): ApiInfo {\n return {\n hostUrl: this.hostUrl,\n config: this.config,\n outside: this.outside,\n workspaceId: this.workspaceId,\n }\n }\n}\n", "export interface User {\n _id: string;\n firstname: string;\n lastname: string;\n // email: string;\n // lastSeen: number;\n // status?: string;\n // managedUser?: boolean;\n // removed?: number;\n // defaultProfilepic: string;\n}\n\n/* export interface Workspace {\n _id: string;\n name: string;\n members: string[];\n settings: {\n isolatedTeams?: boolean;\n defaultView: string;\n functionFieldVersion?: 1 | 2;\n color?: string;\n allowPublicCopy?: boolean;\n };\n license: object;\n invoicing?: any;\n propertyFields?: {\n [section: string]: {\n [field: string]: any;\n };\n };\n} */\nexport interface Workspace {\n _id: string;\n name: string;\n}\n\n\nexport interface ActivityFieldRange {\n start: number;\n end: number;\n }\n\n export interface ActivityFieldLink {\n _id: string;\n name: string;\n }\n \nexport interface ActivityFieldError {\n error?: string\n}\n\nexport type ActivityFieldValue = boolean | number | string | (ActivityFieldCountry & ActivityFieldError & ActivityFieldRange & ActivityFieldLink);\n\nexport type ActivityFieldUpdateValue = ActivityFieldValue | null;\n/*\nexport interface UserMap {\n [userId: string]: User;\n}\n\n*/\n\nexport interface ActivityFieldCountry {\n /** ISO 3166-1 alpha-2 (cca2) */\n code: string;\n}\nexport interface Activity {\n _id: string;\n process: string;\n teamAccount: TeamAccount // TODO: Convert in frontend\n created: number;\n uid: string;\n workspaceId: string;\n discussion: string;\n currentPhase: string;\n active?: boolean;\n history?: any[];\n name: string;\n followers?: string[];\n completePhases?: string[];\n location?: {\n type: 'point' | 'area' | 'polyline',\n label: string | null\n data: {\n lat: number\n lng: number\n }[]\n };\n fields?: {\n [fieldId: string]: ActivityFieldValue\n };\n // fields?: { [fieldId: string]: string | number };\n files?: any[];\n updated?: number;\n updatedBy?: string;\n priority?: number;\n sequence?: number\n}\n\nexport interface TeamAccount {\n account: string;\n team: string;\n}\n\nexport interface FormsData {\n files: string[];\n history: {\n // eslint-disable-next-line @typescript-eslint/naming-convention\n 0: {\n [fieldId: string]: {\n value: any;\n };\n };\n };\n name: string;\n location?: boolean;\n uid?: string;\n}\nexport interface FormsResponse {\n name: string;\n description?: string;\n enableUnlinkedMode: boolean;\n enableAttachments: boolean;\n enableMapLocation: boolean;\n locationRequired: 1;\n phases: {\n _id: string;\n followers: [];\n name: string;\n description: string;\n uid: string;\n created: number;\n fields: string[];\n announcementFields: [];\n announcementRecipients: [];\n announcementFieldsOrder: [];\n isEndpoint: boolean;\n }[];\n phasesOrder: string[];\n fields: {\n [id: string]: {\n data: [];\n label: string;\n required: boolean;\n type: string;\n inviteToDiscussionOnChange: boolean;\n _id: string;\n created: number;\n updated: number;\n uid: string;\n functionEnabled: boolean;\n };\n };\n enableMessenger: boolean;\n publicForm: {\n enableMessaging: boolean;\n };\n fieldsOrder: [];\n}\n\nexport interface FormCreateResponse {\n key: string,\n creator: string,\n followers: string,\n active: boolean,\n enableMessaging: boolean,\n allowRead: boolean\n}\n\nexport interface InsightResponse {\n insight: {\n name: string\n },\n data: InsightResponseData\n}\n\nexport interface InsightResponseData {\n headers: string[],\n rows: [],\n time: number\n}\n\nexport interface Config {\n [fieldName: string]: string;\n}\n\nexport type WorkflowFieldType = (\n 'activitylink' |\n 'country' |\n 'date' |\n 'daterange' |\n 'datetime' |\n 'numeric' |\n 'numericunit' |\n 'teams' |\n 'text' |\n 'textarea' |\n 'textunit' |\n 'textpredefinedoptions' |\n 'time' |\n 'timerange' |\n 'datetimerange' |\n 'users' |\n 'linkedfrom' |\n 'subheader'\n);\n\nexport interface WorkflowField {\n _id: string;\n type: WorkflowFieldType;\n label: string;\n required: boolean;\n unit: string;\n placeholder: string;\n description: string;\n data: string[];\n functionEnabled: boolean;\n editable: boolean;\n functionVariables?: { [key: string]: any };\n}\n\nexport interface Workflow {\n _id: string;\n name: string;\n description?: string;\n fields: { [fieldId: string]: any };\n fieldsOrder: string[];\n phases: { [phase_id: string]: WorkflowPhase };\n phasesOrder: string[];\n enablePredefinedName?: boolean;\n nameFunctionEnabled?: boolean;\n nameEditable?: boolean;\n productInstalledId: string;\n workspaceId: string;\n /*\n defaultView: 'table' | 'kanban' | 'map' | 'calendar';\n fields: { [fieldId: string]: any };\n phasesRemoved: string[];\n members: any;\n updated: number;\n coverImage?: string;\n createNewLabel?: string;\n enableAddedField: boolean;\n enableLinkedAnnouncements?: boolean;\n enableMapLocation?: boolean;\n enableUnlinkedMode?: boolean;\n enableMessenger?: boolean;\n allowGuests?: boolean;\n enableGuestEditing?: boolean;\n enableModifiedField?: boolean;\n enableOwnerField?: boolean;\n enableOwnerTeamField?: boolean;\n ownerTeamFieldTitle?: string;\n enableUniqueName?: boolean;\n enablePreselectedTeam?: boolean;\n initPhaseDescription?: string;\n locationRequired?: boolean;\n nameColumnText?: string;\n nameFunction?: string;\n nameFunctionVariables?: any;\n personInCharge?: string;\n personInChargeLabel?: string;\n publicForm?: {\n key: string;\n active: boolean;\n creator: string;\n team_account: TeamAccount;\n followers: string;\n allowRead: boolean;\n enableMessaging?: boolean;\n }\n predefinedNamePrefix?: string;\n preselectedTeam?: TeamAccount;\n enableAttachments: boolean;\n nameFieldPlaceHolderText: string;\n order?: number;\n allowMultipleTags?: boolean;\n allowCustomTags?: boolean;\n requireFileTag?: boolean;\n documentTemplates?: any;\n color?: string;\n starred?: string[];\n isStarred?: boolean;\n createdActivities?: number;\n */\n}\n\nexport interface WorkflowPhase {\n _id: string;\n name: string;\n description?: string;\n fields?: string[];\n primaryDateField?: string;\n primaryNumericField?: string\n /*\n followers: string[];\n created: number;\n uid?: string;\n members?: any[]\n enableAnnouncement?: boolean,\n announcementFields?: string[];\n announcementRecipients?: string[];\n announcementFieldsOrder?: string[];\n announcementToOwner?: boolean;\n announcementToOwnerTeam?: boolean;\n isEndPoint?: boolean;\n possibleNextPhase?: string[];\n possibleNextPhaseSettings?: any;\n fieldOptions?: any;\n primaryNumericField?: string;\n webhooksEnabled?: boolean;\n webhookAdded?: boolean;\n webhookUpdated?: boolean;\n primaryDateField?: string | null | any;\n removed?: number;\n removedBy?: string;\n color?: string | null;\n */\n}\n/**\n * ```ts\n * { [templateId: string]: string }\n * ```\n */\nexport interface IdsMap {\n [templateId: string]: string;\n}\n\nexport type PermissionType = 'admin' | 'own' | 'ownteam' | 'any' | 'edit';\n\nexport interface Member {\n id: string;\n info: { [key: string]: string | number | boolean | null };\n permissions: PermissionType[];\n}\n\nexport type WorkflowPermission = 'admin' | 'any' | 'ownteam' | 'own' | 'guest' | 'none';\nexport type WorkflowPhasePermission = 'edit' | 'view' | 'none';\n\nexport interface PermissionPath {\n type: 'network' | 'user' | 'team' | 'group';\n id: string;\n permission: WorkflowPermission | WorkflowPhasePermission;\n};\n\nexport interface WorkflowPermissionMap {\n [workflowId: string]: {\n // hasAccess: boolean;\n isAdmin: boolean;\n permission: WorkflowPermission;\n permissions: PermissionPath;\n phases: {\n [phaseId: string]: {\n // name: string;\n // hasAccess: boolean;\n permission: WorkflowPhasePermission,\n permissions: PermissionPath[];\n restricted: boolean;\n }\n };\n teams: string[];\n\n }\n};\n\nexport interface WorkspaceRolesPermission {\n isAdmin: boolean;\n isOwner: boolean;\n isGuest: boolean;\n isInviter: boolean;\n isUser: boolean;\n // custom: roleSchema,\n};\n\nexport interface PermissionMap {\n [userId: string]: {\n workflow: WorkflowPermissionMap,\n workspace: WorkspaceRolesPermission,\n // calendar: calendarPermissionMapSchema,\n // insight: insightPermissionMapSchema,\n // app: appPermissionMapSchema,\n // teams: Joi.array().items(validTeamId),\n // permits: Joi.array().items(Joi.string()),\n },\n};\n\nexport interface InsightWorkflowSource {\n name: string;\n workflowId: string;\n fields: {\n name: string;\n fieldId?: string;\n /** Used for phaseLastMove meta */\n phaseId?: string;\n /** Activity information, like _id, created, phaseId etc. */\n meta?: string;\n }[];\n}\nexport interface InsightDoc {\n _id: string;\n name: string;\n /** Key for accessing Insight when set to public */\n publicKey?: string;\n presets: {\n version: 1;\n name: string | 'default';\n options: any;\n }[];\n /** To be used with SQLite if we want to.... */\n query?: string;\n sources: InsightWorkflowSource[];\n public: boolean;\n \n // members: Member[];\n // updated: number;\n /** User id of creator */\n // uid: string;\n // workspaceId: string;\n /** sandboxed javascript with access to all activities in given workflows */\n // function?: string;\n\n \n}\n\nexport type InsightPublic = Omit<InsightDoc, '_id'>;\n\n// These are separate so we can do different configs if necessary without it being a breaking change\nexport interface InsightData {\n headers: string[];\n rows: (string | number | null)[][];\n time: number;\n}\n\nexport interface InsightResponseAsObjectItem {\n [key: string]: any\n}\nexport type InsightResponseAsObjects = InsightResponseAsObjectItem[]\n\nexport interface KanbanListResponse {\n map: {\n [phaseId: string]: {\n activities: {\n _id: string,\n followers: string[],\n name: string,\n fields: { [key: string]: any }\n files: string[],\n primaryDateField: number,\n priority: number,\n }[]\n meta: {\n count: number,\n totalPrimaryNumericValue: number,\n primaryNumericFieldUnit: string | null\n }\n }\n }\n}\n\nexport interface KanbanLoadResponse {\n activity: {\n _id: string,\n followers: string[],\n name: string,\n fields: { [key: string]: any },\n files: string[],\n primaryDateField: number | null,\n priority: number,\n linkedFromCount: number\n },\n process: string,\n phase: string\n}\nexport interface ActivityListOptions {\n sortBy?: 'name' | 'created' | 'updated' | 'following' | 'owner' | 'team' | 'completedOn' | 'priority',\n sortOrder?: 'asc' | 'desc',\n limit?: number,\n skip?: number,\n includeUsers?: boolean,\n includeTeams?: boolean,\n includeHistory?: boolean,\n filters?: any\n}\nexport interface ActivityCreateOptions {\n teamId?: string;\n fileIds?: string[];\n followerIds?: string[];\n location?: {\n label?: string;\n type: 'area' | 'point' | 'polyline';\n data: [{ lat: number, lng: number }];\n };\n discussionId?: string;\n phaseId?: string;\n returnDocument?: boolean;\n}\n\n\n/** Simplistic syntax for add/remove/replace */\nexport interface IdSetUpdate {\n /** Clear all existing */\n '*'?: null,\n /** Add: true, Remove: null */\n [id: string]: true | null | undefined\n}\nexport interface ActivityLocation {\n data: {\n lat: number;\n lng: number;\n }[],\n label?: string;\n type: 'area' | 'point' | 'polyline';\n};\nexport interface ActivityUpdateOptions {\n fields?: ActivityFieldUpdateValue,\n teamId?: string,\n location?: ActivityLocation\n phaseId?: string,\n files?: IdSetUpdate,\n followers?: IdSetUpdate,\n};\n\nexport interface ActivityKanbanListOptions {\n filter: {\n user?: {\n uid: string;\n field: string;\n },\n account?: string;\n team?: string;\n dates?: {\n field: string;\n start: number;\n end: number;\n };\n },\n search?: string;\n limit?: number;\n skip?: number;\n phase?: string;\n includeUsers?: boolean;\n includeTeams?: boolean;\n}\n\nexport interface Settings {\n theme: 'light' | 'dark'\n preferredLanguages: string[];\n}\n\nexport interface ApiInfo {\n /** Url of the Hailer instance hosting the API */\n hostUrl?: string;\n config?: Config;\n outside: boolean | null;\n workspaceId?: string;\n}\n\nexport interface ApiError {\n code: number,\n msg: string, \n debug: object\n}\n\nclass CustomError extends Error {\n public msg: string;\n public code: number;\n \n constructor(message: string, code: number) {\n super(message);\n this.name = this.constructor.name;\n this.msg = message;\n this.code = code;\n Error.captureStackTrace?.(this, this.constructor);\n }\n}\n\nexport class HailerError extends CustomError {\n public debug: object\n public details?: any\n\n constructor(error: {code: number, msg: string, details?: any, debug: any}) {\n super(error.msg, error.code)\n\n this.details = error.details;\n this.debug = error.debug;\n }\n\n toString() {\n console.log('Going to log an error... ;-D');\n return `${super.toString()} \\nField: ${this.details}, ${this.debug}`;\n }\n}\n\nexport interface Signal {\n name: string;\n data: any;\n}\n\nexport interface Product extends ProductType {\n _id: string;\n targetId?: string;\n name: string;\n description?: string;\n icon?: string;\n images?: string[];\n externalUrl?: string;\n publisher?: string;\n ctaLabel: string;\n ctaLink: string;\n /** Available or not in app store */\n public?: boolean;\n cid?: string;\n uid: string;\n}\n\nexport interface ProductListResponse {\n products: Product[];\n totalCount: number;\n}\n\nexport interface ProductSearchOption {\n limit?: number,\n skip?: number,\n search?: string,\n reverse?: boolean,\n sortBy?: 'name' | 'created' | 'updated' | 'type',\n sortOrder?: 'asc' | 'desc'\n}\n\nexport interface ProductSearchFilter extends ProductType {\n public?: boolean,\n cid?: string,\n uid?: string,\n}\n\nexport interface ProductType {\n type?: 'app' | 'template' | 'integration' | 'expert' | 'ai-agent',\n}\n\nexport interface ProductVersion {\n _id: string;\n name: string;\n versions?: Version[];\n cid?: string;\n}\n\nexport interface Version {\n version: string;\n description: string;\n packageHash: string;\n created: number;\n}\n\n// Payment and Pricing Types\nexport interface PricingPlan {\n planId: 'monthly' | 'yearly' | 'one_time';\n label: string;\n price: number;\n currency: string;\n interval: 'month' | 'year' | null;\n}\n\nexport interface PaymentProvider {\n priceId?: {\n monthly?: string;\n yearly?: string;\n one_time?: string;\n };\n trial_days?: number;\n}\n\nexport interface PricingProviders {\n stripe?: PaymentProvider;\n paddle?: PaymentProvider;\n // fuze?: PaymentProvider; // Hidden for now\n}\n\nexport interface PricingData {\n _id?: string;\n productId?: string;\n types: PricingPlan[];\n providers: PricingProviders;\n paymentEnabled?: boolean;\n created?: number;\n updated?: number;\n}\n\nexport interface CreatePricingRequest {\n productId: string;\n types: PricingPlan[];\n providers: PricingProviders;\n paymentEnabled?: boolean;\n}\n\nexport interface UpdatePricingRequest {\n productId: string;\n types: PricingPlan[];\n providers: PricingProviders;\n paymentEnabled?: boolean;\n}\n\nexport interface CreatePurchaseRequest {\n productId: string;\n workspaceId: string;\n planType: 'monthly' | 'yearly' | 'one_time';\n successUrl?: string; // Optional for backward compatibility\n cancelUrl?: string; // Optional for backward compatibility\n useTokens?: boolean; // Optional - use workspace tokens for one-time purchases\n}\n\nexport interface CreatePurchaseResponse {\n status: 'installed_free' | 'subscription_created' | 'checkout_required' | 'payment_processed' | 'payment_failed';\n message?: string;\n productId?: string;\n planType?: string;\n purchaseId?: string;\n subscriptionId?: string;\n provider?: string;\n trialDays?: number;\n checkoutUrl?: string;\n error?: string; // For payment failure details\n}\n\nexport interface Purchase {\n _id: string;\n uid: string;\n cid: string;\n productId?: string;\n productName?: string;\n provider?: 'stripe' | 'paddle' | 'fuze';\n type: 'monthly' | 'yearly' | 'one_time';\n purchaseType: 'workspace' | 'product';\n startedAt: number;\n created: number;\n updated?: number;\n customStatus?: string;\n expiresAt?: number;\n trialDays?: number;\n trialStart?: number;\n trialEnd?: number;\n pricePaid?: {\n amount: number;\n currency: string;\n };\n pricing?: {\n amount: number;\n currency: string;\n interval: string;\n source: string;\n };\n stripe?: {\n customerId?: string;\n checkoutSessionId?: string;\n subscriptionId?: string;\n paymentIntentId?: string;\n status?: string;\n };\n paddle?: {\n customerId?: string;\n subscriptionId?: string;\n status?: string;\n };\n fuze?: {\n customerId?: string;\n subscriptionId?: string;\n status?: string;\n };\n}\n\n// Admin interfaces\nexport interface AdminWorkspaceListItem {\n _id: string;\n name: string;\n memberCount: number;\n created: number;\n updated?: number;\n paymentPlan?: string;\n monthlyPrice?: number;\n paymentMethod?: 'subscription' | 'invoice';\n subscriptionActive?: boolean;\n provider?: string;\n stripeStatus?: string;\n hasPendingSubscription?: boolean;\n tokenBalance?: number;\n autoReloadEnabled?: boolean;\n}\n\nexport interface AdminWorkspaceListRequest {\n filter?: {\n name?: string;\n };\n options?: {\n search?: string;\n sortBy?: string;\n sortOrder?: string;\n limit?: number;\n skip?: number;\n };\n}\n\nexport interface AdminWorkspaceListResponse {\n workspaces: AdminWorkspaceListItem[];\n totalCount: number;\n}\n\n// Purchase data for admin interfaces\nexport interface AdminPurchaseData {\n _id: string;\n uid: string;\n cid: string;\n productId?: string | null;\n productName?: string | null;\n provider?: string;\n type: string;\n purchaseType: 'workspace' | 'product';\n billingType?: 'subscription' | 'invoice';\n planName?: 'flexible' | 'pro' | 'business' | 'enterprise';\n startedAt?: number;\n expiresAt?: number;\n created: number;\n updated?: number;\n customStatus?: string;\n trialStart?: number;\n trialEnd?: number;\n pricePaid?: {\n amount: number;\n currency: string;\n };\n pricing?: {\n amount: number;\n currency: string;\n interval?: string;\n source: 'purchase_record' | 'pricing_collection';\n };\n availablePricing?: Array<{\n planId: 'monthly' | 'yearly' | 'one_time';\n label: string;\n price: number;\n currency: string;\n interval: string | null;\n }>;\n trialDays?: number;\n stripe?: {\n customerId?: string;\n checkoutSessionId?: string;\n subscriptionId?: string;\n paymentIntentId?: string;\n status?: string;\n };\n paddle?: {\n customerId?: string;\n subscriptionId?: string;\n status?: string;\n };\n fuze?: {\n customerId?: string;\n subscriptionId?: string;\n status?: string;\n };\n}\n\n// Single workspace for admin get method (extends list item with purchase data)\nexport interface AdminWorkspaceOverrides {\n // Boolean overrides\n functionFields?: boolean;\n kanban?: boolean;\n customRoles?: boolean;\n restricted?: boolean;\n insight?: boolean;\n dataExport?: boolean;\n documentGenerator?: boolean;\n groups?: boolean;\n print?: boolean;\n isolatedTeams?: boolean;\n managedUsers?: boolean;\n translations?: boolean;\n indexedData?: boolean;\n fastFunctions?: boolean;\n activityRecovery?: boolean;\n // Number overrides\n users?: number | null;\n // String overrides\n tourIdentifier?: string;\n}\n\nexport interface AdminWorkspaceMarketplaceSettings {\n creatorPercent: number;\n}\n\nexport interface AdminWorkspace extends AdminWorkspaceListItem {\n purchaseId?: string;\n purchases?: AdminPurchaseData[];\n overrides?: AdminWorkspaceOverrides;\n marketplace?: AdminWorkspaceMarketplaceSettings;\n}\n\nexport interface AdminUpdateOverridesRequest {\n workspaceId: string;\n overrides: AdminWorkspaceOverrides;\n}\n\nexport interface AdminUpdateMarketplaceSettingsRequest {\n workspaceId: string;\n creatorPercent: number;\n}\n\nexport interface AdminCreateStripeSessionRequest {\n workspaceId: string;\n planName: 'flexible' | 'pro' | 'business' | 'enterprise';\n customPrice: number;\n paymentMethod: 'stripe';\n baseUrl: string;\n}\n\nexport interface AdminCreateStripeSessionResponse {\n success: boolean;\n message: string;\n sessionUrl?: string;\n}\n\nexport interface AdminCreateInvoiceIntegrationRequest {\n workspaceId: string;\n planName: 'enterprise'; // Only enterprise for invoice\n customPrice: number;\n paymentMethod: 'hailer';\n}\n\nexport interface AdminCreateInvoiceIntegrationResponse {\n success: boolean;\n message: string;\n}\n\nexport interface AdminUpdateWorkspaceSubscriptionRequest {\n purchaseId: string;\n billingType: 'subscription' | 'invoice';\n customPrice: number;\n planName: 'flexible' | 'pro' | 'business' | 'enterprise';\n tokenAmount?: number;\n}\n\nexport interface AdminUpdatePurchasePriceRequest {\n purchaseId: string;\n workspaceId: string;\n newPrice: number;\n}\n\nexport interface AdminWorkspaceUser {\n _id: string;\n name: string;\n email: string;\n role: 'owner' | 'admin' | 'user' | 'guest' | 'inviter';\n joined?: number;\n lastActive?: number;\n emailVerified?: boolean;\n managedUser?: boolean | null;\n}\n\nexport interface AdminWorkspaceUsersListRequest {\n workspaceId?: string;\n filter?: {\n email?: string;\n role?: string;\n };\n options?: {\n search?: string;\n sortBy?: string;\n sortOrder?: string;\n limit?: number;\n skip?: number;\n };\n}\n\nexport interface AdminWorkspaceUsersListResponse {\n users: AdminWorkspaceUser[];\n totalCount: number;\n}\n\nexport interface AdminUpdateUserRequest {\n userId: string;\n updates: {\n emailVerified?: boolean;\n };\n}\n\nexport interface AdminUpdateUserResponse {\n success: boolean;\n}\n\nexport interface AdminUpdateTokenBalanceRequest {\n workspaceId: string;\n tokenAmount: number;\n payoutType?: 'admin_bonus' | 'creator_payout';\n payoutMonth?: number;\n payoutYear?: number;\n creatorPercent?: number;\n}\n\nexport interface AdminTokenTransaction {\n _id: string;\n uid: string;\n cid: string;\n workspaceName: string;\n created: number;\n type: 'purchase' | 'deduction' | 'bonus' | 'admin_adjustment' | 'creator_payout';\n amount: number;\n reason: string;\n meta?: {\n payoutMonth?: number;\n payoutYear?: number;\n creatorProfit?: number;\n creatorPercent?: number;\n [key: string]: any\n };\n createdAt: number;\n}\n\nexport interface AdminTokenTransactionFilter {\n workspaceId?: string;\n type?: 'purchase' | 'deduction' | 'bonus' | 'admin_adjustment' | 'creator_payout';\n operation?: string;\n dateFrom?: number;\n dateTo?: number;\n search?: string;\n}\n\nexport interface AdminTokenTransactionStatistics {\n netChange: number;\n totalPurchases: number;\n totalPurchasesEuro: number;\n purchasesBySource: {\n stripe: {\n count: number;\n tokens: number;\n revenue: number;\n };\n adminPortal: {\n count: number;\n tokens: number;\n revenue: number;\n };\n };\n totalDeductions: number;\n totalDeductionsEuro: number;\n consumptionByOperation: {\n [operation: string]: {\n count: number;\n tokens: number;\n };\n };\n totalBonuses: number;\n totalBonusesEuro: number;\n totalCreatorPayouts: number;\n totalCreatorPayoutsEuro: number;\n totalRefunds: number;\n totalRefundsEuro: number;\n}\n\nexport interface AdminTokenTransactionsListRequest {\n filter?: AdminTokenTransactionFilter;\n options?: {\n sortBy?: string;\n sortOrder?: 'asc' | 'desc';\n limit?: number;\n skip?: number;\n };\n}\n\nexport interface AdminTokenTransactionsListResponse {\n transactions: AdminTokenTransaction[];\n totalCount: number;\n statistics: AdminTokenTransactionStatistics;\n}\n\nexport interface AdminInvoicePurchase {\n _id: string;\n uid: string;\n cid: string;\n workspaceName: string;\n created: number;\n purchaseType: 'workspace' | 'product';\n type: 'monthly' | 'yearly' | 'one_time';\n provider: 'hailer';\n billingType: 'invoice';\n planName?: string;\n productId?: string;\n productName?: string;\n pricePaid?: {\n amount: number;\n currency: string;\n };\n customStatus?: string;\n invoiceHandled?: boolean;\n startedAt: number;\n expiresAt?: number;\n trialStart?: number;\n trialEnd?: number;\n}\n\nexport interface AdminInvoiceListRequest {\n filter?: {\n workspaceId?: string;\n purchaseType?: 'workspace' | 'product';\n status?: 'handled' | 'unhandled' | 'all';\n search?: string;\n };\n options?: {\n sortBy?: string;\n sortOrder?: 'asc' | 'desc';\n limit?: number;\n skip?: number;\n };\n}\n\nexport interface AdminInvoiceWorkspaceGroup {\n cid: string;\n workspaceName: string;\n allHandled: boolean;\n purchases: AdminInvoicePurchase[];\n}\n\nexport interface AdminInvoiceListResponse {\n invoices: AdminInvoicePurchase[];\n totalCount: number;\n workspaceGroups: AdminInvoiceWorkspaceGroup[];\n}\n\nexport interface AdminInvoiceUpdateHandledRequest {\n purchaseIds: string | string[];\n handled: boolean;\n}\n\nexport interface AdminInvoiceUpdateHandledResponse {\n updatedCount: number;\n}\n\n// Monthly Revenue Tracking Types\nexport interface AdminRevenuePurchase {\n _id: string;\n uid: string;\n cid: string;\n workspaceName: string;\n created: number;\n purchaseType: 'workspace' | 'product';\n type: 'monthly' | 'yearly' | 'one_time';\n provider: string;\n productId?: string;\n productName?: string;\n productOwnerCid?: string;\n productOwnerName?: string;\n pricePaid?: { amount: number; currency: string };\n startedAt: number;\n expiresAt?: number;\n // Calculated fields\n normalizedMonthlyRevenue: number; // Yearly \u00F7 12, others as-is\n isMarketplace: boolean;\n profitToHailer: number;\n profitToCreator?: number;\n statusInMonth: 'active' | 'started' | 'ended';\n}\n\nexport interface AdminRevenueWorkspaceGroup {\n cid: string;\n workspaceName: string;\n totalRevenue: number;\n totalMRR: number;\n totalOneTime: number;\n totalCreatorProfit: number;\n totalHailerProfit: number;\n creatorPercent: number;\n productCount: number;\n paidOut?: boolean;\n productBreakdown: Array<{\n productId: string;\n productName: string;\n installationCount: number;\n totalRevenue: number;\n subscriptionTypes: {\n monthly: number;\n yearly: number;\n one_time: number;\n };\n installedBy: Array<{\n cid: string;\n workspaceName: string;\n type: string;\n }>;\n }>;\n purchases: AdminRevenuePurchase[];\n}\n\nexport interface AdminRevenueWorkspaceSubscriptions {\n totalWorkspaces: number;\n totalRevenue: number;\n byPlan: Array<{\n planName: string;\n count: number;\n revenue: number;\n }>;\n}\n\nexport interface AdminRevenueStatistics {\n selectedMonth: { month: number; year: number };\n totalMRR: number;\n totalOneTime: number;\n totalRevenue: number;\n activeCount: number;\n hailerProfit: number;\n creatorProfit: number;\n}\n\nexport interface AdminRevenueListRequest {\n month: number;\n year: number;\n filter?: {\n workspaceId?: string;\n purchaseType?: 'workspace' | 'product';\n subscriptionType?: 'monthly' | 'yearly' | 'one_time';\n search?: string;\n };\n options?: {\n sortBy?: string;\n sortOrder?: 'asc' | 'desc';\n limit?: number;\n skip?: number;\n };\n}\n\nexport interface AdminRevenueListResponse {\n purchases: AdminRevenuePurchase[];\n totalCount: number;\n workspaceGroups: AdminRevenueWorkspaceGroup[];\n statistics: AdminRevenueStatistics;\n}\n\n// Dashboard Statistics Types\nexport interface AdminDashboardEntityStatistics {\n today: number;\n total: number;\n lastWeek: number;\n growth: number;\n}\n\nexport interface AdminDashboardStatisticsResponse {\n users: AdminDashboardEntityStatistics;\n workspaces: AdminDashboardEntityStatistics;\n activities: AdminDashboardEntityStatistics;\n messages: AdminDashboardEntityStatistics;\n userMessages: AdminDashboardEntityStatistics;\n}\n\n// Dashboard Trends Types\nexport interface AdminDashboardTrendDataPoint {\n date: string;\n count: number;\n}\n\nexport interface AdminDashboardTrendsResponse {\n users?: AdminDashboardTrendDataPoint[];\n workspaces?: AdminDashboardTrendDataPoint[];\n}\n\n// Stripe Tax Calculation Types\nexport interface StripeTaxLineItem {\n amount: number;\n reference: string;\n tax_code?: string;\n quantity?: number;\n}\n\nexport interface StripeTaxCalculationRequest {\n workspaceId: string;\n lineItems: StripeTaxLineItem[];\n}\n\nexport interface StripeTaxLineItemResult {\n reference: string;\n amount: number;\n taxAmount: number;\n totalAmount: number;\n}\n\nexport interface StripeTaxCalculationResponse {\n amountSubtotal: number;\n amountTax: number;\n amountTotal: number;\n taxRate?: number;\n country?: string;\n countryName?: string;\n currency: string;\n lineItems: StripeTaxLineItemResult[];\n}\n\n", "import { Client } from '@wishcore/wish-rpc';\nimport { HailerError, User } from '../types';\n\nexport class UserApi {\n constructor(private client: Client) {}\n\n /** \n * Returns the specified user\n * \n * @param userId id of the Hailer user\n *\n * @returns Hailer user information\n *\n * @throws {HailerError} if request is incorrect\n */\n async get(userId: string): Promise<User> {\n try {\n return await this.client.requestAsync('user.get', [userId]);\n }\n catch (error: any) {\n throw new HailerError(error) \n }\n }\n\n /** \n * Returns the current user\n *\n * \n * @returns the current Hailer user information\n *\n * @throws {HailerError} if request is incorrect\n */\n async current(): Promise<User> {\n try {\n return await this.client.requestAsync('user.current', []);\n }\n catch (error: any) {\n throw new HailerError(error) \n }\n }\n\n /** \n * Lists all Hailer users from a workspace\n * \n * \n * @returns list of Hailer users in the workspace the app user is currently in\n *\n * @throws {HailerError} if request is incorrect\n */\n async list(): Promise<User[]> {\n try {\n return await this.client.requestAsync('user.list', []);\n }\n catch (error: any) {\n throw new HailerError(error) \n }\n }\n}\n", "import { Client } from '@wishcore/wish-rpc';\nimport { ActivityKanbanListOptions, HailerError, KanbanListResponse, KanbanLoadResponse } from '../../types';\n\nexport class Kanban {\n constructor(private client: Client) { }\n \n /** \n * Lists all activities in a kanban grouped by phases\n * \n * @param processId the id of the process the kanban relates to\n * @param options ActivityKanbanListOptions\n *\n * @returns activities in kanban list format\n *\n * @throws {HailerError} if request fails\n */\n async list(processId: string, options?: ActivityKanbanListOptions): Promise<KanbanListResponse> {\n try {\n const res = await this.client.requestAsync('activity.kanban.list', [processId, ...options ? [options] : []]);\n return res;\n } catch (error: any) {\n throw new HailerError(error) \n }\n }\n\n /** \n * Loads a single activity in kanban format\n * \n * @param activityId activityId of the wanted activity\n *\n * @returns activity in kanban format\n * \n * @throws {HailerError} if request is incorrect\n */\n async load(activityId: string): Promise<KanbanLoadResponse> {\n try {\n const res = await this.client.requestAsync('activity.kanban.load', [activityId]);\n return res;\n } catch (error: any) {\n throw new HailerError(error) \n }\n }\n\n /** \n * Updates priority of activities in kanban\n * \n * @param activityId activityId of the wanted activity\n * @param priority new priority for the activity\n *\n * @throws {HailerError} if request is incorrect\n */\n async updatePriority(activityId: string, priority: number): Promise<void> {\n try {\n const res = await this.client.requestAsync('activity.kanban.updatePriority', [{activityId, priority}]);\n return res;\n } catch (error: any) {\n throw new HailerError(error) \n }\n }\n\n}\n", "import { Client } from '@wishcore/wish-rpc';\nimport { ActivityCreateOptions, ActivityListOptions, Activity, HailerError, ActivityFieldUpdateValue, ActivityUpdateOptions, ActivityFieldValue } from '../types';\nimport { Kanban } from './activity/kanban';\n\nexport class ActivityApi {\n public kanban: Kanban\n constructor(private client: Client) {\n this.kanban = new Kanban(client)\n }\n\n /** \n * Lists all activities from the specified process and phase\n *\n * @param processId process from current network\n * @param phaseId phase in the process specified in processId\n * @param options ActivityListOptions\n *\n * @returns List of Hailer activities from process and phase filtered with supplied options\n *\n * @throws {HailerError} if request is incorrect\n */\n async list(processId: string, phaseId: string, options?: ActivityListOptions): Promise<Activity[]> {\n try {\n return await this.client.requestAsync('activity.list', [processId, phaseId, options]);\n }\n catch (error: any) {\n throw new HailerError(error) \n }\n }\n\n /** \n * Gets single activity\n *\n * @param activityId activity Id of the process specified in processId\n * @param processId Process where the activityId is\n * @param phaseId Phase where the activityId is in process specified by processId\n * @param options options containing apiVersion\n *\n * @returns Hailer activity information or undefined if no activity is found\n *\n * @throws {HailerError} if request is incorrect\n */\n async get(activityId: string): Promise<Activity | undefined> {\n try {\n // Uses the same endpoint as getAll but only returns the activity in question\n return await this.client.requestAsync('activity.get', [activityId]);\n }\n catch (error: any) {\n throw new HailerError(error) \n }\n }\n\n /** \n * Creates activities\n *\n * @throws {HailerError} if request is incorrect\n */\n async create(workflowId: string | undefined, activities: { name?: string; fields?: { [id: string]: ActivityFieldValue } }[], options?: ActivityCreateOptions ): Promise<Activity[]> {\n try {\n return await this.client.requestAsync('activity.create', [workflowId, activities, ...options ? [options] : []]);\n }\n catch (error: any) {\n throw new HailerError(error) \n }\n }\n\n /** \n * Updates activites\n *\n * @returns The number of updated activities\n *\n * @throws {HailerError} if request is incorrect\n */\n async update(\n activities: { _id: string, name?: string, fields?: { [id: string]: ActivityFieldUpdateValue }, phaseId?: string }[],\n options?: ActivityUpdateOptions\n ): Promise<number> {\n try {\n return await this.client.requestAsync('activity.update', [activities, ...options ? [options] : []]);\n }\n catch (error: any) {\n throw new HailerError(error) \n }\n }\n\n /** \n * Removes activities\n *\n * @param activities Ids of activities to be removed\n * @param options options containing apiVersion\n *\n * @returns The number of removed activities\n *\n * @throws {HailerError} if request is incorrect\n */\n async remove(activities: string[]): Promise<number> {\n try {\n return await this.client.requestAsync('activity.remove', [activities]);\n }\n catch (error: any) {\n throw new HailerError(error) \n }\n }\n}\n", "import { Client } from '@wishcore/wish-rpc';\nimport { HailerError, ProductVersion, Workspace } from '../types';\n\nexport class WorkspaceApi {\n product: {\n /** Publish template in Hailer market */\n publishTemplate: (template: {\n workspaceId?: string,\n versionId?: string,\n version: string,\n versionDescription: string,\n title: string,\n description: string\n }) => Promise<ProductVersion>\n\n /** Check if product is installed */\n isProductInstalled(\n id: string,\n workspaceId: string\n ): Promise<boolean>\n\n /** Get version */\n get(\n id: string\n ): Promise<ProductVersion | undefined>\n\n /** Install template from Hailer market */\n install(productId: string, workspaceId: string): Promise<boolean>\n\n /** Get manifest content from Hailer market */\n getManifest(id: string): Promise<any>\n };\n\n constructor(private client: Client) {\n this.product = {\n publishTemplate: this.publishTemplate.bind(this),\n isProductInstalled: this.isProductInstalled.bind(this),\n get: this.get.bind(this),\n install: this.install.bind(this),\n getManifest: this.getManifest.bind(this),\n };\n }\n\n /** \n * Returns the current network\n *\n * @returns the Hailer Workspace information the user is currently in\n *\n * @throws {HailerError} if request is incorrect\n */\n async current(): Promise<Workspace> {\n try {\n const res = await this.client.requestAsync('workspace.current', []);\n return res;\n }\n catch (error: any) {\n throw new HailerError(error) \n }\n }\n\n /**\n * Returns all workspaces for user if personal app\n * If not personal app it returns only the current workspace\n * @returns the Hailer Workspaces information for the user\n * \n * * @throws {HailerError} if request is incorrect\n */\n async list(): Promise<Workspace[]> {\n try {\n const res = await this.client.requestAsync('workspace.list', []);\n return res;\n }\n catch (error: any) {\n throw new HailerError(error) \n }\n }\n\n\n /** \n * Publish template in Hailer market\n * \n * @param workspaceId Id of workspace\n * @param versionId link to version (empty if first publish)\n * @param version Version number\n * @param versionDescription Version description\n * @param title\n * @param description\n * \n * @returns Created version in Hailer market\n *\n * @throws {HailerError} if request is incorrect\n */\n private async publishTemplate(\n template: {\n workspaceId?: string,\n versionId?: string,\n version: string,\n versionDescription: string,\n title: string,\n description: string\n }\n ): Promise<ProductVersion> {\n try {\n const result = await this.client.requestAsync('workspace.product.publishTemplate', [template]);\n return result;\n }\n catch (error: any) {\n throw new HailerError(error) \n }\n }\n\n /** \n * Check if product is installed\n *\n * @param id Id of product in Hailer market\n *\n * @returns true if ok else false\n *\n * @throws {HailerError} if request is incorrect\n */\n private async isProductInstalled(\n id: string,\n workspaceId: string\n ): Promise<boolean> {\n try {\n return await this.client.requestAsync('workspace.product.isProductInstalled', [id, workspaceId]);\n }\n catch (error: any) {\n throw new HailerError(error) \n }\n }\n\n /** \n * Get version\n *\n * @param id targetId\n *\n * @returns true if ok else false\n *\n * @throws {HailerError} if request is incorrect\n */\n private async get(\n id: string\n ): Promise<ProductVersion | undefined> {\n try {\n return await this.client.requestAsync('workspace.product.get', [id]);\n }\n catch (error: any) {\n throw new HailerError(error) \n }\n }\n\n /** \n * Install template from Hailer market\n *\n * @param productId Id of product in Hailer market\n * \n * @param workspaceId Id of workspace where the product will be installed\n *\n * @returns true, if installed else error\n *\n * @throws {HailerError} if request is incorrect\n */\n private async install(productId: string, workspaceId: string): Promise<boolean> {\n try {\n const result = await this.client.requestAsync('workspace.product.install', [productId, workspaceId]);\n return result;\n }\n catch (error: any) {\n throw new HailerError(error) \n }\n }\n\n /** \n * Get manifest content from Hailer market\n *\n * @param id target Id\n *\n * @returns Manifest content\n *\n * @throws {HailerError} if request is incorrect\n */\n private async getManifest(id: string): Promise<any> {\n try {\n return await this.client.requestAsync('workspace.product.getManifest', [id]);\n }\n catch (error: any) {\n throw new HailerError(error) \n }\n }\n}\n", "import { Client } from '@wishcore/wish-rpc';\n\nexport type ActivityTabTypes =\n 'detail' |\n 'discussion' |\n 'files' |\n 'location' |\n 'linkedFrom' |\n 'options';\n\nexport class Activity {\n constructor(private client: Client) {}\n\n /** Opens an activity in Hailer sidebar */\n async open(\n /** Hailer Activity Id */\n activityId: string,\n options?: {\n /** Which tab to open in activity aside */\n tab?: ActivityTabTypes\n },\n ): Promise<void> {\n await this.client.requestAsync('ui.activity.open', [activityId, ...options ? [options] : []]);\n }\n\n /** Opens activity creation view in Hailer sidebar */\n async create(\n processId: string,\n options?: {\n /** Activity name/title */\n name?: string,\n /** Prepopulate fields */\n fields?: {\n [fieldId: string]: number | string | { start: number, end: number },\n },\n location?: {\n type: 'area' | 'point' | 'polyline',\n data: { lng: number, lat: number }[],\n },\n }\n ): Promise<{ _id: string, name: string } | null> {\n return await this.client.requestAsync('ui.activity.create', [processId, ...options ? [options] : []]);\n }\n\n /** Opens multiple activity edit view in Hailer sidebar */\n async editMultiple(\n activityIds: string[]\n ) {\n return await this.client.requestAsync('ui.activity.editMultiple', [activityIds]);\n }\n}\n", "import { Client } from '@wishcore/wish-rpc';\n\nexport class Snackbar {\n constructor(private client: Client) {}\n\n /** \n * Opens a snackbar in Hailer\n * @param text the text displayed on the snackbar\n * @param buttonLabel the label for the button on the snackbar, for example 'OK'\n * @param duration the time the snackbar is visible in ms\n */\n async open(\n /** The text displayed on the snackbar */\n text: string,\n /** The label for the button on the snackbar, for example 'OK' */\n buttonLabel: string,\n /** The time the snackbar is visible in ms */\n duration?: number,\n ): Promise<void> {\n await this.client.requestAsync('ui.snackbar.open', [text, buttonLabel, duration]);\n }\n}\n", "import { Client } from '@wishcore/wish-rpc';\n\nexport class Files {\n constructor(private client: Client) {}\n\n /**\n * Uploads a file to Hailer\n *\n * @param file file to be uploaded\n * @param publicFile is the file accessible outside of Hailer\n * @param options if file is public\n *\n * @returns File ID in Hailer as string\n */\n public async uploadFile(file: File, filename: string, options: { isPublic?: boolean }): Promise<string> {\n return await this.client.requestAsync('ui.file.upload', [await this.toBase64(file), filename, !!options?.isPublic]);\n }\n\n private toBase64(file: File): Promise<string | ArrayBuffer> {\n return new Promise((resolve, reject) => {\n const reader = new FileReader();\n reader.readAsDataURL(file);\n reader.onload = () => resolve(reader.result ?? '');\n reader.onerror = reject;\n });\n }\n}\n", "import { Client } from '@wishcore/wish-rpc';\n\nexport class Workflow {\n constructor(private client: Client) {}\n\n function = {\n /**\n * Opens the function editor dialog for a specific field\n * @param fieldId The ID of the field to edit\n * @param options Additional options including workflowId and activityId\n */\n edit: async (\n workflowId: string,\n fieldId: string,\n ): Promise<void> => {\n await this.client.requestAsync('ui.workflow.function.edit', [workflowId, fieldId]);\n }\n }\n}", "import { Client } from '@wishcore/wish-rpc';\nimport { Activity } from './ui/activity';\nimport { Snackbar } from './ui/snackbar';\nimport { Files } from './ui/files';\nimport { Workflow } from './ui/workflow';\n\n\nexport class Ui {\n public activity;\n public snackbar;\n public files;\n public insight;\n public workflow;\n\n constructor(private client: Client) {\n this.activity = new Activity(client);\n this.snackbar = new Snackbar(client);\n this.workflow = new Workflow(client);\n\n this.insight = {\n create: async (\n /** Defaults to App workspace */\n workspaceId?: string\n ): Promise<void> => {\n await client.requestAsync('ui.insight.create', [workspaceId]);\n },\n edit: async (\n insightId: string\n ): Promise<void> => {\n await client.requestAsync('ui.insight.edit', [insightId]);\n },\n delete: async (\n insightId: string\n ): Promise<void> => {\n await client.requestAsync('ui.insight.delete', [insightId]);\n },\n permission: async (\n insightId: string\n ): Promise<void> => {\n await client.requestAsync('ui.insight.permission', [insightId]);\n }\n };\n\n this.files = new Files(client);\n }\n}\n", "export const DEFAULT_ALLOWED_URLS = [\n 'https://app.hailer.com',\n 'https://next.hailer.com',\n 'https://testapp.hailer.biz',\n 'https://app.hailer.biz',\n 'https://app.hailer.local.gd',\n 'https://app.k8s.hailer.com',\n 'https://next.k8s.hailer.com',\n 'https://localhost:9443'\n];\n\nexport const DEFAULT_BACKEND_URL = 'https://api.hailer.com';\n\n/** 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 */\nexport const publicBackendMap: { [host: string]: string } = {\n 'https://app.hailer.com': DEFAULT_BACKEND_URL,\n 'https://next.hailer.com': DEFAULT_BACKEND_URL,\n 'https://app.hailer.biz': 'https://api.hailer.biz',\n 'https://testapp.hailer.biz': 'https://testapi.hailer.biz',\n 'https://app.hailer.local.gd': 'https://api.hailer.local.gd',\n 'https://app.k8s.hailer.com': 'https://api.k8s.hailer.com',\n 'https://next.k8s.hailer.com': 'https://api.k8s.hailer.com',\n 'https://localhost:9443': 'http://localhost:1337',\n}\n", "import { Options } from '../../hailer-api';\nimport { Config } from '../../types';\n\nexport class App {\n constructor(private options: Options) {}\n\n /** \n * Read data from app API\n *\n * @param appId key of a specific insight\n *\n * @returns App manifest\n *\n * @throws {HailerError} if there is something wrong with the request or insight cannot be found\n * @throws {TypeError} if Hailer cannot be reached\n */\n async config(): Promise<Config> {\n const manifestFile = 'manifest.json';\n const location = window.location.origin + window.location.pathname;\n let manifestUrl = location + manifestFile;\n\n if (location.endsWith('/index.html')) {\n manifestUrl = location.slice(0, -10) + manifestFile;\n }\n\n const manifestContent = await (await fetch(manifestUrl)).text();\n\n const manifest = JSON.parse(manifestContent);\n\n const appId = manifest.appId;\n\n const res = await fetch(this.options.publicBackendUrl + '/api/v3/app/public', {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json',\n },\n body: JSON.stringify([appId])\n });\n\n return await res.json();\n }\n\n}\n", "import { Options } from '../../hailer-api';\nimport { FormCreateResponse, FormsData, FormsResponse, HailerError } from '../../types';\n\nexport class Form {\n constructor(private options: Options) {}\n\n /** \n * Read data from forms\n *\n * @param formsKey key of a form\n * @param options Overrides default request options, url defaults to https://api.hailer.com/api/v2/forms\n *\n * @returns forms data as object or null if form could not be found\n *\n * @throws {HailerError} if there is something wrong with the request or form cannot be found\n * @throws {TypeError} if Hailer cannot be reached\n */\n async data(formsKey: string): Promise<FormsResponse> {\n const res = await fetch(this.options.publicBackendUrl + '/api/v2/forms/process/get', {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json',\n },\n body: JSON.stringify([formsKey])\n });\n if (!res.ok) {\n throw new HailerError(await res.json())\n }\n return await res.json();\n }\n\n /** \n * Submits form to specified process\n *\n * @param formsKey key of a form\n * @param formsData Data to be sent to form endpoint\n * @param options Overrides default request options, url defaults to https://api.hailer.com/api/v2/forms\n *\n * @returns form creation data or null if form could not be created\n *\n * @throws {HailerError} if there is something wrong with the request or form cannot be found\n * @throws {TypeError} if Hailer cannot be reached\n */\n async submit(formsKey: string, formsData: FormsData): Promise<FormCreateResponse> {\n const res = await fetch(this.options.publicBackendUrl + '/api/v2/forms/activity/create', {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json',\n },\n body: JSON.stringify([formsKey, formsData])\n });\n if (!res.ok) {\n throw new HailerError(await res.json())\n }\n return await res.json();\n }\n}\n", "import { Options } from '../../hailer-api';\nimport { HailerError, InsightResponse, InsightResponseAsObjects, InsightResponseData } from '../../types';\n\nexport class InsightPublicApi {\n constructor(private options: Options) {}\n\n /** \n * Read data from insight API\n *\n * @param insightKey key of a specific insight\n * @param options Overrides default request options, url defaults to https://api.hailer.com/api/v3/insight/public\n *\n * @returns Insight data as object\n *\n * @throws {HailerError} if there is something wrong with the request or insight cannot be found\n * @throws {TypeError} if Hailer cannot be reached\n */\n async data(insightKey: string): Promise<InsightResponse> {\n const res = await fetch(this.options.publicBackendUrl + '/api/v3/insight/public', {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json',\n },\n body: JSON.stringify([insightKey])\n }\n );\n if (!res.ok) {\n throw new HailerError(await res.json())\n }\n return await res.json();\n }\n\n /** \n * Read data from insight API and return in an array of JavaScript objects\n *\n * @param insightKey key of a specific insight\n * @param options Overrides default request options, url defaults to https://api.hailer.com/api/v3/insight/public\n *\n * @returns Insight data as array of JavaScript objects\n *\n * @throws {HailerError} if there is something wrong with the request or insight cannot be found\n * @throws {TypeError} if Hailer cannot be reached\n */\n async dataAsObject(insightKey: string): Promise<InsightResponseAsObjects> {\n const res = await this.data(insightKey);\n\n const input: InsightResponseData = res.data;\n const data: InsightResponseAsObjects = [];\n \n input.rows.forEach((row) => {\n // The object keys are constructed dynamically, so any is necessary\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const object: any = {};\n input.headers.forEach((header, headerIndex) => {\n object[header] = row[headerIndex];\n });\n data.push(object);\n });\n return data;\n }\n}\n", "import { Options } from '../../hailer-api';\nimport { HailerError, Product, ProductListResponse, ProductSearchFilter, ProductSearchOption, ProductType } from '../../types';\n\nexport class ProductPublicApi {\n constructor(private options: Options) {}\n\n /** \n * Lists products from Hailer market\n *\n * @param filter ProductSearchFilter\n * @param options ProductSearchOption\n *\n * @returns List of products in Hailer market filtered with supplied options\n *\n * @throws {HailerError} if request is incorrect\n */\n async list(\n filter?: ProductSearchFilter, \n options?: ProductSearchOption\n ): Promise<ProductListResponse> {\n \n const res = await fetch(this.options.publicBackendUrl + '/api/v3/product/list', {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json',\n },\n body: JSON.stringify([filter, options])\n });\n\n if (!res.ok) {\n throw new HailerError(await res.json())\n }\n return await res.json();\n }\n\n /** \n * Gets single product from Hailer market\n *\n * @param id Product Id\n *\n * @returns Single product from Hailer market or undefined if no product found\n *\n * @throws {HailerError} if request is incorrect\n */\n async get(id: string): Promise<Product | undefined> {\n const res = await fetch(this.options.publicBackendUrl + '/api/v3/product/get', {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json',\n },\n body: JSON.stringify([id])\n });\n\n if (!res.ok) {\n throw new HailerError(await res.json())\n }\n return await res.json();\n }\n}\n", "import { Options } from '../hailer-api';\nimport { Product } from '../types';\nimport { App } from './public/app';\nimport { Form } from './public/form';\nimport { InsightPublicApi } from './public/insight';\nimport { ProductPublicApi } from './public/product';\n\n/**\n * This class is used to access Hailer public API even when the app is outside of Hailer\n */\nexport class HailerPublicApi {\n /** Allows accessing public insight methods. Used for reading data from Hailer even when app is outside of Hailer */\n public insight: InsightPublicApi;\n /** Allows accessing public forms methods. Used for sending data to Hailer even when app is outside of Hailer */\n public form: Form;\n /** Access public App information */\n public app: App;\n /** Access public Product information */\n public product: ProductPublicApi;\n\n constructor(options: Options) {\n this.insight = new InsightPublicApi(options);\n this.form = new Form(options);\n this.app = new App(options);\n this.product = new ProductPublicApi(options);\n }\n}\n", "import { Client } from '@wishcore/wish-rpc';\nimport { HailerError, IdsMap, Workflow } from '../types';\n\nexport class WorkflowApi {\n constructor(private client: Client) {}\n \n /** \n * Lists all processes from a workspace\n *\n * @returns all Hailer processes in the workspace the app user is currently in \n *\n * @throws {HailerError} if request is incorrect\n */\n async list(): Promise<Workflow[]> {\n try {\n return await this.client.requestAsync('workflow.list', []);\n } catch (error: any) {\n console.error(error.msg, error);\n throw new HailerError(error) \n }\n }\n\n /** \n * Gets a single process from a workspace\n * \n * @param workflowId the id of the process in question\n * \n * @returns the specified Hailer process\n *\n * @throws {HailerError} if request is incorrect\n */\n async get(workflowId: string): Promise<Workflow> {\n try {\n return await this.client.requestAsync('workflow.get', [workflowId]);\n }\n catch (error: any) {\n throw new HailerError(error) \n }\n }\n\n /** \n * Gets a single process from a workspace\n * \n * @param processId the id of the process in question\n * \n * @returns the specified Hailer process\n *\n * @throws {HailerError} if request is incorrect\n */\n async install(workflowSpec: any, option?: { workspaceId?: string }): Promise<IdsMap> {\n try {\n return await this.client.requestAsync('workflow.install', [workflowSpec, option]);\n }\n catch (error: any) {\n throw new HailerError(error) \n }\n }\n}\n", "import { Client } from '@wishcore/wish-rpc';\nimport { Config, HailerError, ProductVersion, Version } from '../types';\n\n/**\n * This class is used to access Hailer public API even when the app is outside of Hailer\n */\nexport class AppApi {\n product: {\n /** Check if product is installed */\n isProductInstalled(productId: string, workspaceId: string): Promise<boolean>\n\n /** Get version */\n get(\n id: string\n ): Promise<ProductVersion | undefined>\n\n /** Install app from Hailer market */\n install(productId: string, workspaceId: string): Promise<boolean>\n\n /** Get installed version */\n getInstalledVersion(id: string): Promise<Version>\n\n /** Get manifest content from Hailer market */\n getManifest(id: string): Promise<any>\n };\n\n constructor(private client: Client) {\n this.product = {\n isProductInstalled: this.isProductInstalled.bind(this),\n get: this.get.bind(this),\n install: this.install.bind(this),\n getInstalledVersion: this.getInstalledVersion.bind(this),\n getManifest: this.getManifest.bind(this),\n };\n }\n\n config = {\n update: async (config: Config, option?: { appId?: string }): Promise<void> => {\n try {\n return await this.client.requestAsync('app.config.update', [config, ...option ? [option] : []]);\n } catch (error: any) {\n console.log('Errorasd ', error);\n throw new HailerError(error);\n }\n }\n }\n\n /** \n * Check if product is installed\n *\n * @param productId Id of product in Hailer market\n * \n * @param workspaceId Id of workspace\n *\n * @returns true if ok else false\n *\n * @throws {HailerError} if request is incorrect\n */\n private async isProductInstalled(productId: string, workspaceId: string): Promise<boolean> {\n try {\n return await this.client.requestAsync('app.product.isProductInstalled', [productId, workspaceId]);\n }\n catch (error: any) {\n throw new HailerError(error) \n }\n }\n\n /** \n * Get version\n *\n * @param id targetId\n *\n * @returns true if ok else false\n *\n * @throws {HailerError} if request is incorrect\n */\n private async get(\n id: string\n ): Promise<ProductVersion | undefined> {\n try {\n return await this.client.requestAsync('app.product.get', [id]);\n }\n catch (error: any) {\n throw new HailerError(error) \n }\n }\n\n /** \n * Install app from Hailer market\n *\n * @param productId Id of product in Hailer market\n *\n * @param workspaceId Id of workspace where the product will be installed\n * \n * @returns true, if installed else error\n *\n * @throws {HailerError} if request is incorrect\n */\n private async install(productId: string, workspaceId: string): Promise<boolean> {\n try {\n const result = await this.client.requestAsync('app.product.install', [productId, workspaceId]);\n return result;\n }\n catch (error: any) {\n throw new HailerError(error) \n }\n }\n\n /** \n * Get installed version from Hailer market\n *\n * @param id Id of product in Hailer market\n *\n * @returns true, if installed else error\n *\n * @throws {HailerError} if request is incorrect\n */\n private async getInstalledVersion(id: string): Promise<Version> {\n try {\n const result = await this.client.requestAsync('app.product.getInstalledVersion', [id]);\n return result;\n }\n catch (error: any) {\n throw new HailerError(error) \n }\n }\n\n /** \n * Get manifest content from Hailer market\n *\n * @param id target Id\n *\n * @returns Manifest content\n *\n * @throws {HailerError} if request is incorrect\n */\n private async getManifest(id: string): Promise<any> {\n try {\n return await this.client.requestAsync('app.product.getManifest', [id]);\n }\n catch (error: any) {\n throw new HailerError(error) \n }\n }\n}\n", "import { Client } from '@wishcore/wish-rpc';\nimport { HailerError, InsightData, InsightDoc } from '../types';\n\nexport class InsightApi {\n constructor(private client: Client) {}\n\n /** \n * Get Insight data \n * \n * @param insightId the id of the Insight the data is fetched from\n * \n * @returns data from the Insight\n *\n * @throws {HailerError} if request is incorrect\n */\n async data(insightId: string, options: { update?: true }): Promise<InsightData> {\n\n try {\n /*data = [{ insightId, { headers, rows, time } }] */\n return await this.client.requestAsync('insight.data', [insightId, ...options ? [options] : []]);\n }\n catch (error: any) {\n throw new HailerError(error) \n }\n }\n\n /** \n * Get Insight data \n * \n * \n * @returns data from the Insight\n *\n * @throws {HailerError} if request is incorrect\n */\n async list(): Promise<InsightDoc[]> {\n try {\n return await this.client.requestAsync('insight.list', []);\n }\n catch (error: any) {\n throw new HailerError(error) \n }\n }\n\n /** \n * Get Insight data \n * \n * @returns data from the Insight\n *\n * @throws {HailerError} if request is incorrect\n */\n /* @private */ async update(insightId: string, update: Partial<InsightDoc>): Promise<InsightDoc[]> {\n try {\n return await this.client.requestAsync('insight.update', [insightId, update]);\n }\n catch (error: any) {\n throw new HailerError(error) \n }\n } \n}\n\n", "import { Client } from '@wishcore/wish-rpc';\nimport { HailerError, PermissionMap } from '../types';\n\n/**\n * This class is used to access Hailer public API even when the app is outside of Hailer\n */\nexport class PermissionApi {\n\n constructor(private client: Client) {}\n\n map = async (): Promise<PermissionMap> => {\n try {\n return await this.client.requestAsync('permission.map', []);\n } catch (error: any) {\n console.log('Failed to read permissions from Hailer, error:', error);\n throw new HailerError(error);\n }\n }\n}\n", "import { Client } from '@wishcore/wish-rpc';\nimport { HailerError, Product, ProductSearchOption, ProductSearchFilter, ProductListResponse } from '../types';\n\nexport class ProductApi {\n constructor(private client: Client) {}\n\n /** \n * Lists products from Hailer market\n *\n * @param filter ProductSearchFilter\n * @param options ProductSearchOption\n *\n * @returns List of products in Hailer market filtered with supplied options\n *\n * @throws {HailerError} if request is incorrect\n */\n async list(\n filter?: ProductSearchFilter, \n options?: ProductSearchOption): Promise<ProductListResponse> {\n try {\n const res = await this.client.requestAsync('product.list', [filter, options]);\n return res;\n }\n catch (error: any) {\n throw new HailerError(error) \n }\n }\n\n /** \n * Gets single product from Hailer market\n *\n * @param id Product Id\n *\n * @returns Single product from Hailer market or undefined if no product found\n *\n * @throws {HailerError} if request is incorrect\n */\n async get(id: string): Promise<Product | undefined> {\n try {\n return await this.client.requestAsync('product.get', [id]);\n }\n catch (error: any) {\n throw new HailerError(error) \n }\n }\n\n /** \n * Creates product in Hailer market\n * \n * @param targetId link to targetId (version)\n * @param name Name of the product\n * @param description Description what this product is doing\n * @param icon Icon id for the product\n * @param images List of fileIds for showing pictures of the product\n * @param externalUrl Public URL for creator to show more information about the product\n * @param publisher Publisher (author)\n * @param type App, template, music etc.\n * \n * @returns Created product in Hailer market\n *\n * @throws {HailerError} if request is incorrect\n */\n async create(\n product: {\n targetId?: string,\n name: string,\n description?: string,\n icon?: string,\n images?: string[],\n externalUrl?: string,\n publisher?: string,\n type?: string\n }\n ): Promise<Product> {\n try {\n const result = await this.client.requestAsync('product.create', [product]);\n return result;\n }\n catch (error: any) {\n throw new HailerError(error) \n }\n }\n\n /** \n * Updates product in Hailer market\n *\n * @param id Id of product in Hailer market\n * @param name Name of the product\n * @param description Description what this product is doing\n * @param icon Icon id for the product\n * @param images List of fileIds for showing pictures of the product\n * @param externalUrl Public URL for creator to show more information about the product\n * @param publisher Publisher (Author)\n * @param public: Visible or not in Hailer market\n * @param type App, template, music etc.\n *\n * @returns Updated product in Hailer market\n *\n * @throws {HailerError} if request is incorrect\n */\n async update(\n id: string,\n product: {\n name?: string,\n description?: string,\n icon?: string,\n images?: string[],\n externalUrl?: string,\n publisher?: string,\n public?: boolean,\n type?: string\n }\n ): Promise<Product> {\n try {\n const result = await this.client.requestAsync('product.update', [id, product]);\n return result;\n }\n catch (error: any) {\n throw new HailerError(error) \n }\n }\n\n /** \n * Remove product from Hailer market\n *\n * @param id Id of product in Hailer market\n *\n * @returns true, if removed\n *\n * @throws {HailerError} if request is incorrect\n */\n async remove(id: string): Promise<boolean> {\n try {\n const result = await this.client.requestAsync('product.remove', [id]);\n return result;\n }\n catch (error: any) {\n throw new HailerError(error) \n }\n }\n\n /** \n * Set product as public or not (visible) in Hailer market\n *\n * @param id Id of product in Hailer market\n * @param isPublic Visible or not in Hailer market\n *\n * @returns true if ok else false\n *\n * @throws {HailerError} if request is incorrect\n */\n async setPublic(\n id: string,\n isPublic: boolean\n ): Promise<boolean> {\n try {\n return await this.client.requestAsync('product.setPublic', [id, isPublic]);\n }\n catch (error: any) {\n throw new HailerError(error) \n }\n }\n}\n", "import { Client } from '@wishcore/wish-rpc';\nimport {\n HailerError,\n PricingData,\n CreatePricingRequest,\n UpdatePricingRequest,\n CreatePurchaseRequest,\n CreatePurchaseResponse,\n Purchase,\n StripeTaxCalculationRequest,\n StripeTaxCalculationResponse\n} from '../types';\n\nexport class Payment {\n constructor(private client: Client) {}\n\n /** \n * Creates pricing configuration for a product\n *\n * @param request CreatePricingRequest containing productId, types, and providers\n *\n * @returns Created pricing configuration\n *\n * @throws {HailerError} if request is incorrect or product not found\n */\n async createPricing(request: CreatePricingRequest): Promise<PricingData> {\n try {\n const res = await this.client.requestAsync('payment.createPricing', [request]);\n return res;\n }\n catch (error: any) {\n throw new HailerError(error) \n }\n }\n\n /** \n * Updates pricing configuration for a product\n *\n * @param request UpdatePricingRequest containing productId, types, and providers\n *\n * @returns Updated pricing configuration\n *\n * @throws {HailerError} if request is incorrect, product not found, or pricing doesn't exist\n */\n async updatePricing(request: UpdatePricingRequest): Promise<PricingData> {\n try {\n const res = await this.client.requestAsync('payment.updatePricing', [request]);\n return res;\n }\n catch (error: any) {\n throw new HailerError(error) \n }\n }\n\n /** \n * Gets pricing configuration for a product\n *\n * @param productId Product ID to get pricing for\n *\n * @returns Pricing configuration or null if not found\n *\n * @throws {HailerError} if request is incorrect or product not found\n */\n async getPricing(productId: string): Promise<PricingData | null> {\n try {\n const res = await this.client.requestAsync('payment.getPricing', [{ productId }]);\n return res;\n }\n catch (error: any) {\n throw new HailerError(error) \n }\n }\n\n /** \n * Creates a product purchase/subscription\n *\n * @param request CreatePurchaseRequest containing productId, workspaceId, and planType\n *\n * @returns Purchase creation result with status and details\n *\n * @throws {HailerError} if request is incorrect, product not found, or payment fails\n */\n async createPurchase(request: CreatePurchaseRequest): Promise<CreatePurchaseResponse> {\n try {\n const res = await this.client.requestAsync('payment.createPurchase', [request]);\n return res;\n }\n catch (error: any) {\n throw new HailerError(error) \n }\n }\n\n /**\n * Gets purchases for a workspace\n *\n * @param workspaceId Workspace ID to get purchases for\n *\n * @returns Array of purchases for the workspace\n *\n * @throws {HailerError} if request is incorrect or workspace not found\n */\n async getPurchases(workspaceId: string): Promise<Purchase[]> {\n try {\n const res = await this.client.requestAsync('payment.getPurchases', [{ workspaceId }]);\n return res || [];\n }\n catch (error: any) {\n throw new HailerError(error)\n }\n }\n\n /**\n * Calculates Stripe tax for line items\n *\n * @param request StripeTaxCalculationRequest containing workspaceId and lineItems\n *\n * @returns Tax calculation result with amounts, rates, and country information\n *\n * @throws {HailerError} if request is incorrect, workspace not found, or Stripe customer not found\n */\n async calculateStripeTax(request: StripeTaxCalculationRequest): Promise<StripeTaxCalculationResponse> {\n try {\n const res = await this.client.requestAsync('payment.calculateStripeTax', [request]);\n return res;\n }\n catch (error: any) {\n throw new HailerError(error)\n }\n }\n}", "import { Client } from '@wishcore/wish-rpc';\nimport {\n HailerError,\n AdminWorkspaceListRequest,\n AdminWorkspaceListResponse,\n AdminWorkspace,\n AdminCreateStripeSessionRequest,\n AdminCreateStripeSessionResponse,\n AdminCreateInvoiceIntegrationRequest,\n AdminCreateInvoiceIntegrationResponse,\n AdminUpdateWorkspaceSubscriptionRequest,\n AdminUpdatePurchasePriceRequest,\n AdminWorkspaceUsersListRequest,\n AdminWorkspaceUsersListResponse,\n AdminUpdateUserRequest,\n AdminUpdateUserResponse,\n AdminTokenTransactionsListRequest,\n AdminTokenTransactionsListResponse,\n AdminUpdateOverridesRequest,\n AdminUpdateMarketplaceSettingsRequest,\n AdminInvoiceListRequest,\n AdminInvoiceListResponse,\n AdminInvoiceUpdateHandledRequest,\n AdminInvoiceUpdateHandledResponse,\n AdminRevenueListRequest,\n AdminRevenueListResponse,\n AdminDashboardStatisticsResponse,\n AdminDashboardTrendsResponse\n} from '../types';\n\nexport class Admin {\n constructor(private client: Client) {}\n\n /**\n * Lists workspaces with search, pagination, and sorting\n *\n * @param request AdminWorkspaceListRequest containing filter and options\n *\n * @returns List of workspaces with total count\n *\n * @throws {HailerError} if request fails or user not authorized\n */\n async listWorkspaces(request?: AdminWorkspaceListRequest): Promise<AdminWorkspaceListResponse> {\n try {\n const res = await this.client.requestAsync('admin.workspace.list', [request?.filter, request?.options]);\n return res;\n }\n catch (error: any) {\n throw new HailerError(error)\n }\n }\n\n /**\n * Gets detailed information about a specific workspace\n *\n * @param workspaceId The ID of the workspace to retrieve\n *\n * @returns Workspace details including payment information\n *\n * @throws {HailerError} if request fails, workspace not found, or user not authorized\n */\n async getWorkspace(workspaceId: string): Promise<AdminWorkspace> {\n try {\n const res = await this.client.requestAsync('admin.workspace.get', [workspaceId]);\n return res;\n }\n catch (error: any) {\n throw new HailerError(error)\n }\n }\n\n /**\n * Creates a Stripe checkout session for workspace subscription\n *\n * @param request AdminCreateStripeSessionRequest containing workspace details and payment info\n *\n * @returns AdminCreateStripeSessionResponse with success status and session URL\n *\n * @throws {HailerError} if request fails, user not authorized, or workspace already has subscription\n */\n async createStripeSession(request: AdminCreateStripeSessionRequest): Promise<AdminCreateStripeSessionResponse> {\n try {\n const res = await this.client.requestAsync('admin.workspace.createStripeSession', [request]);\n return res;\n }\n catch (error: any) {\n throw new HailerError(error)\n }\n }\n\n /**\n * Creates an invoice integration for workspace subscription\n *\n * @param request AdminCreateInvoiceIntegrationRequest containing workspace details and payment info\n *\n * @returns AdminCreateInvoiceIntegrationResponse with success status\n *\n * @throws {HailerError} if request fails, user not authorized, or workspace already has subscription\n */\n async createInvoiceIntegration(request: AdminCreateInvoiceIntegrationRequest): Promise<AdminCreateInvoiceIntegrationResponse> {\n try {\n const res = await this.client.requestAsync('admin.workspace.createInvoiceIntegration', [request]);\n return res;\n }\n catch (error: any) {\n throw new HailerError(error)\n }\n }\n\n /**\n * Updates workspace subscription billing information\n *\n * @param request AdminUpdateWorkspaceSubscriptionRequest containing purchase ID and new billing details\n *\n * @returns boolean indicating whether the update was successful\n *\n * @throws {HailerError} if request fails, user not authorized, or purchase not found\n */\n async updateWorkspaceSubscription(request: AdminUpdateWorkspaceSubscriptionRequest): Promise<boolean> {\n try {\n const res = await this.client.requestAsync('admin.workspace.updateSubscription', [request]);\n return res;\n }\n catch (error: any) {\n throw new HailerError(error)\n }\n }\n\n /**\n * Updates purchase price for active invoice products\n *\n * @param request AdminUpdatePurchasePriceRequest containing purchase ID, workspace ID, and new price\n *\n * @returns boolean indicating whether the update was successful\n *\n * @throws {HailerError} if request fails, user not authorized, purchase not found, or not an invoice product\n */\n async updatePurchasePrice(request: AdminUpdatePurchasePriceRequest): Promise<boolean> {\n try {\n const res = await this.client.requestAsync('admin.purchase.updatePrice', [request]);\n return res;\n }\n catch (error: any) {\n throw new HailerError(error)\n }\n }\n\n /**\n * Lists users in a workspace with search, filtering, pagination, and sorting\n * If no workspaceId provided, lists all users across all workspaces\n *\n * @param request AdminWorkspaceUsersListRequest containing optional workspace ID, filter and options\n *\n * @returns List of workspace users with total count and role information\n *\n * @throws {HailerError} if request fails, workspace not found, or user not authorized\n */\n async listWorkspaceUsers(request: AdminWorkspaceUsersListRequest): Promise<AdminWorkspaceUsersListResponse> {\n try {\n const res = await this.client.requestAsync('admin.workspace.listUsers', [request.workspaceId, request.filter, request.options]);\n return res;\n }\n catch (error: any) {\n throw new HailerError(error)\n }\n }\n\n /**\n * Updates a user's information (currently supports email verification only)\n *\n * @param request AdminUpdateUserRequest containing user ID and updates\n *\n * @returns boolean indicating success\n *\n * @throws {HailerError} if request fails, user not found, or user not authorized\n */\n async updateUser(request: AdminUpdateUserRequest): Promise<boolean> {\n try {\n const res = await this.client.requestAsync('admin.user.update', [request.userId, request.updates]);\n return res;\n }\n catch (error: any) {\n throw new HailerError(error)\n }\n }\n\n /**\n * Updates workspace token balance\n *\n * @param request Object containing workspaceId, tokenAmount, and optional payout parameters\n *\n * @returns boolean indicating success\n *\n * @throws {HailerError} if request fails, workspace not found, or user not authorized\n */\n async updateTokenBalance(request: {\n workspaceId: string;\n tokenAmount: number;\n payoutMonth?: number;\n payoutYear?: number;\n payoutType?: 'admin_bonus' | 'creator_payout';\n creatorPercent?: number;\n }): Promise<boolean> {\n try {\n const res = await this.client.requestAsync('admin.workspace.updateTokenBalance', [request]);\n return res;\n }\n catch (error: any) {\n throw new HailerError(error)\n }\n }\n\n /**\n * Updates workspace license overrides\n *\n * @param request AdminUpdateOverridesRequest containing workspaceId and overrides object\n *\n * @returns boolean indicating success\n *\n * @throws {HailerError} if request fails, workspace not found, or user not authorized\n */\n async updateWorkspaceOverrides(request: AdminUpdateOverridesRequest): Promise<boolean> {\n try {\n const res = await this.client.requestAsync('admin.workspace.updateOverrides', [request]);\n return res;\n }\n catch (error: any) {\n throw new HailerError(error)\n }\n }\n\n async updateWorkspaceMarketplaceSettings(request: AdminUpdateMarketplaceSettingsRequest): Promise<boolean> {\n try {\n const res = await this.client.requestAsync('admin.workspace.updateMarketplaceSettings', [request]);\n return res;\n }\n catch (error: any) {\n throw new HailerError(error)\n }\n }\n\n /**\n * Lists token transactions with filtering, pagination, and statistics\n *\n * @param request AdminTokenTransactionsListRequest containing optional filter and pagination options\n *\n * @returns AdminTokenTransactionsListResponse with transactions, total count, and statistics\n *\n * @throws {HailerError} if request fails or user not authorized\n */\n async listTokenTransactions(request?: AdminTokenTransactionsListRequest): Promise<AdminTokenTransactionsListResponse> {\n try {\n const res = await this.client.requestAsync('admin.tokenTransaction.list', [request?.filter, request?.options]);\n return res;\n }\n catch (error: any) {\n throw new HailerError(error)\n }\n }\n\n /**\n * Lists Hailer invoice purchases with filtering, pagination, and workspace grouping\n *\n * @param request AdminInvoiceListRequest containing optional filter and pagination options\n *\n * @returns AdminInvoiceListResponse with invoices, total count, and workspace groups\n *\n * @throws {HailerError} if request fails or user not authorized\n */\n async listInvoices(request?: AdminInvoiceListRequest): Promise<AdminInvoiceListResponse> {\n try {\n const res = await this.client.requestAsync('admin.invoice.list', [request?.filter, request?.options]);\n return res;\n }\n catch (error: any) {\n throw new HailerError(error)\n }\n }\n\n /**\n * Updates the handled status for one or more Hailer invoice purchases\n *\n * @param request AdminInvoiceUpdateHandledRequest containing purchase ID(s) and handled status\n *\n * @returns AdminInvoiceUpdateHandledResponse with count of updated records\n *\n * @throws {HailerError} if request fails, purchase not found, or not a Hailer invoice purchase\n */\n async updateInvoiceHandled(request: AdminInvoiceUpdateHandledRequest): Promise<AdminInvoiceUpdateHandledResponse> {\n try {\n const res = await this.client.requestAsync('admin.invoice.updateHandled', [request.purchaseIds, request.handled]);\n return res;\n }\n catch (error: any) {\n throw new HailerError(error)\n }\n }\n\n async listMonthlyRevenue(request: AdminRevenueListRequest): Promise<AdminRevenueListResponse> {\n try {\n const res = await this.client.requestAsync('admin.revenue.list', [\n request.month,\n request.year,\n request.filter,\n request.options\n ]);\n return res;\n }\n catch (error: any) {\n throw new HailerError(error)\n }\n }\n\n /**\n * Gets dashboard statistics including counts for users, workspaces, activities, and messages\n * Includes today's count, total count, last week count, and week-over-week growth percentage\n *\n * @param entities Optional array of entity types to fetch. Defaults to all entities.\n * Valid values: 'users', 'workspaces', 'activities', 'messages', 'userMessages'\n *\n * @returns AdminDashboardStatisticsResponse with statistics for requested entity types\n *\n * @throws {HailerError} if request fails or user not authorized\n */\n async getDashboardStatistics(entities?: string[]): Promise<AdminDashboardStatisticsResponse> {\n try {\n const res = await this.client.requestAsync('admin.dashboard.statistics', [entities]);\n return res;\n }\n catch (error: any) {\n throw new HailerError(error)\n }\n }\n\n /**\n * Gets dashboard trends showing daily creation counts over time\n *\n * @param days Number of days to fetch (30, 90, 180, or 365). Defaults to 30.\n * @param entities Optional array of entity types to fetch. Defaults to ['users', 'workspaces'].\n * Valid values: 'users', 'workspaces'\n *\n * @returns AdminDashboardTrendsResponse with daily counts for requested entity types\n *\n * @throws {HailerError} if request fails or user not authorized\n */\n async getDashboardTrends(days?: 30 | 90 | 180 | 365, entities?: string[]): Promise<AdminDashboardTrendsResponse> {\n try {\n const res = await this.client.requestAsync('admin.dashboard.trends', [days, entities]);\n return res;\n }\n catch (error: any) {\n throw new HailerError(error)\n }\n }\n}", "import { Client } from '@wishcore/wish-rpc';\nimport { HailerError } from '../types';\n\nexport interface MetricDefinition {\n id: string;\n name: string;\n description: string;\n category: string;\n supportsTimeRange: boolean;\n supportsBreakdown: boolean;\n}\n\nexport interface MetricData {\n metricType: string;\n timestamp: number;\n current: {\n value: number;\n labels?: any;\n };\n timeSeries?: Array<{\n timestamp: number;\n value: number;\n }>;\n breakdown?: {\n byWorkspace?: Record<string, number>;\n byUser?: Record<string, number>;\n };\n metadata: {\n scope?: any;\n permissions?: any;\n source: string;\n executionTime?: number;\n };\n}\nexport interface MetricOptions {\n workspaceId?: string;\n userId?: string;\n timeRange?: {\n start: number;\n end: number;\n };\n interval?: '1m' | '5m' | '15m' | '1h';\n}\n\nexport interface MetricListOptions {\n category?: string;\n includeDetails?: boolean;\n}\n\nexport class MetricsApi {\n constructor(private client: Client) {}\n\n /**\n * Get list of available metrics for current user based on permissions\n * @param options Optional filtering options\n * @returns Array of metric IDs or detailed metric definitions\n */\n async list(options?: MetricListOptions): Promise<string[] | MetricDefinition[]> {\n try {\n return await this.client.requestAsync('metrics.list', options ? [options] : []);\n } catch (error: any) {\n throw new HailerError(error);\n }\n }\n\n /**\n * Get current metrics data for single metric\n * @param metricType The metric type to fetch\n * @param options Optional filtering and time range options\n * @returns Single metric data\n */\n async get(metricTypes: string[], options?: MetricOptions): Promise<MetricData> {\n try {\n return await this.client.requestAsync('metrics.get', [metricTypes, options]);\n } catch (error: any) {\n throw new HailerError(error);\n }\n }\n}"],
|
|
5
5
|
"mappings": "m7BAMA,IAAaA,EAAb,KAAmB,CAKf,YAAoBC,EAAuCC,EAAsB,CAA7D,KAAA,MAAAD,EAJZ,KAAA,SAAuB,CAAA,EACvB,KAAA,GAAK,EACL,KAAA,IAAM,MAGPC,GAAQA,EAAK,MACZ,KAAK,IAAMA,EAAK,IAExB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O,QAAQ,SAAU,CAAC,EAAG,CAACH,EAAYG,EAAWE,IAAiB,CACvE,GAAIL,EAAO,CACP,QAAQ,IAAI,gBAAiBA,EAAOG,CAAI,EACxC,MACJ,CAEIA,GACA,KAAK,QAAQ,UAAUA,CAAI,CAEnC,CAAC,EAED,KAAK,QAAU,GAEf,KAAK,QAAQ,YAAY,EACzB,MACJ,CAGA,GAAI,CAAC,KAAK,MACN,OAGJ,KAAK,OAAO,gBAAgBpB,CAAG,CACnC,MAAgB,CACZ,QAAQ,IAAI,8BAA8B,CAC9C,CACJ,CAAC,CACL,CAEA,MAAgB,CACZ,MAAO,CACH,QAAS,KAAK,QACd,OAAQ,KAAK,OACb,QAAS,KAAK,QACd,YAAa,KAAK,WACtB,CACJ,CACJ",
|
|
6
6
|
"names": ["Client", "write", "opts", "msg", "end", "id", "request", "retval", "err", "op", "args", "resolve", "reject", "data", "cb", "exports", "debug", "Server", "methods", "i", "j", "o", "path", "prefix", "ip", "e", "args", "context", "cb", "result", "copy", "s", "filter", "clientId", "msg", "respond", "id", "err", "data", "op", "client", "send", "ctx", "reqCtx", "exports", "__exportStar", "exports", "import_wish_rpc", "CustomError", "message", "code", "HailerError", "error", "UserApi", "client", "userId", "error", "HailerError", "Kanban", "client", "processId", "options", "error", "HailerError", "activityId", "priority", "ActivityApi", "client", "Kanban", "processId", "phaseId", "options", "error", "HailerError", "activityId", "workflowId", "activities", "WorkspaceApi", "client", "error", "HailerError", "template", "id", "workspaceId", "productId", "Activity", "client", "activityId", "options", "processId", "activityIds", "Snackbar", "client", "text", "buttonLabel", "duration", "Files", "client", "file", "filename", "options", "resolve", "reject", "reader", "Workflow", "client", "workflowId", "fieldId", "Ui", "client", "Activity", "Snackbar", "Workflow", "workspaceId", "insightId", "Files", "DEFAULT_ALLOWED_URLS", "DEFAULT_BACKEND_URL", "publicBackendMap", "App", "options", "manifestFile", "location", "manifestUrl", "manifestContent", "appId", "Form", "options", "formsKey", "res", "HailerError", "formsData", "InsightPublicApi", "options", "insightKey", "res", "HailerError", "input", "data", "row", "object", "header", "headerIndex", "ProductPublicApi", "options", "filter", "res", "HailerError", "id", "HailerPublicApi", "options", "InsightPublicApi", "Form", "App", "ProductPublicApi", "WorkflowApi", "client", "error", "HailerError", "workflowId", "workflowSpec", "option", "AppApi", "client", "config", "option", "error", "HailerError", "productId", "workspaceId", "id", "InsightApi", "client", "insightId", "options", "error", "HailerError", "update", "PermissionApi", "client", "error", "HailerError", "ProductApi", "client", "filter", "options", "error", "HailerError", "id", "product", "isPublic", "Payment", "client", "request", "error", "HailerError", "productId", "workspaceId", "Admin", "client", "request", "error", "HailerError", "workspaceId", "entities", "days", "MetricsApi", "client", "options", "error", "HailerError", "metricTypes", "HailerApi", "options", "allowedUrls", "DEFAULT_ALLOWED_URLS", "msg", "UserApi", "AppApi", "ActivityApi", "InsightApi", "WorkspaceApi", "WorkflowApi", "PermissionApi", "HailerPublicApi", "Ui", "ProductApi", "Payment", "Admin", "MetricsApi", "registerMessage", "DEFAULT_BACKEND_URL", "config", "error", "url", "event", "data", "publicBackendMap", "end"]
|
|
7
7
|
}
|
package/lib/types.d.ts
CHANGED