@whitewall/blip-sdk 0.0.189 → 0.0.190
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/client.js +0 -3
- package/dist/cjs/client.js.map +1 -1
- package/dist/cjs/namespaces/analytics.js +15 -0
- package/dist/cjs/namespaces/analytics.js.map +1 -1
- package/dist/cjs/types/index.js +0 -1
- package/dist/cjs/types/index.js.map +1 -1
- package/dist/esm/client.js +0 -3
- package/dist/esm/client.js.map +1 -1
- package/dist/esm/namespaces/analytics.js +15 -0
- package/dist/esm/namespaces/analytics.js.map +1 -1
- package/dist/esm/types/index.js +0 -1
- package/dist/esm/types/index.js.map +1 -1
- package/dist/types/client.d.ts +0 -2
- package/dist/types/client.d.ts.map +1 -1
- package/dist/types/namespaces/analytics.d.ts +10 -1
- package/dist/types/namespaces/analytics.d.ts.map +1 -1
- package/dist/types/types/index.d.ts +0 -1
- package/dist/types/types/index.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/client.ts +0 -3
- package/src/namespaces/analytics.ts +29 -1
- package/src/types/index.ts +0 -1
- package/dist/cjs/namespaces/plugins.js +0 -266
- package/dist/cjs/namespaces/plugins.js.map +0 -1
- package/dist/cjs/types/plugins.js +0 -3
- package/dist/cjs/types/plugins.js.map +0 -1
- package/dist/esm/namespaces/plugins.js +0 -262
- package/dist/esm/namespaces/plugins.js.map +0 -1
- package/dist/esm/types/plugins.js +0 -2
- package/dist/esm/types/plugins.js.map +0 -1
- package/dist/types/namespaces/plugins.d.ts +0 -105
- package/dist/types/namespaces/plugins.d.ts.map +0 -1
- package/dist/types/types/plugins.d.ts +0 -50
- package/dist/types/types/plugins.d.ts.map +0 -1
- package/src/namespaces/plugins.ts +0 -434
- package/src/types/plugins.ts +0 -52
|
@@ -1,105 +0,0 @@
|
|
|
1
|
-
import type { BlipClient } from '../client.ts';
|
|
2
|
-
import type { BlipLanguage } from '../types/account.ts';
|
|
3
|
-
import type { Identity } from '../types/node.ts';
|
|
4
|
-
import type { DetailedPlugin, Plugin, PluginBilling, PluginSubscription } from '../types/plugins.ts';
|
|
5
|
-
import type { Application } from '../types/portal.ts';
|
|
6
|
-
import { type ConsumeOptions, Namespace, type SendCommandOptions } from './namespace.ts';
|
|
7
|
-
export declare class PluginsNamespace extends Namespace {
|
|
8
|
-
constructor(blipClient: BlipClient, defaultOptions?: SendCommandOptions);
|
|
9
|
-
getTenantApplicationsWithPlugin(tenantId: string, pluginId: string, opts?: ConsumeOptions): Promise<Array<Application>>;
|
|
10
|
-
getInstalledPlugins(tenantId: string, opts?: ConsumeOptions): Promise<Array<Plugin>>;
|
|
11
|
-
/**
|
|
12
|
-
* @param tenantId - The tenant id to use when fetching the plugins, only works as blip.ai user and the user should be a member of the tenant
|
|
13
|
-
*/
|
|
14
|
-
getPlugins(tenantId?: string, opts?: ConsumeOptions): Promise<Array<Plugin>>;
|
|
15
|
-
getPlugin(pluginId: string, query?: {
|
|
16
|
-
returnInstalledBots?: boolean;
|
|
17
|
-
language?: BlipLanguage;
|
|
18
|
-
}, opts?: ConsumeOptions): Promise<DetailedPlugin>;
|
|
19
|
-
getPluginSubscription(tenantId: string, pluginId: string, opts?: ConsumeOptions): Promise<PluginSubscription>;
|
|
20
|
-
/**
|
|
21
|
-
* @param settings.hasPartnerService - Whether the plugin has a partner service (default value: false)
|
|
22
|
-
* @param settings.language - The language to send the communication emails (default value: pt)
|
|
23
|
-
* @param settings.plan - If the plugin has multiple plans, the plan to subscribe to
|
|
24
|
-
*/
|
|
25
|
-
subscribeToPlugin(tenantId: string, pluginId: string, settings: {
|
|
26
|
-
plan: number;
|
|
27
|
-
hasPartnerService?: boolean;
|
|
28
|
-
language?: BlipLanguage;
|
|
29
|
-
}, opts?: ConsumeOptions): Promise<void>;
|
|
30
|
-
upgradePluginSubscription(tenantId: string, pluginId: string, settings: {
|
|
31
|
-
plan: number;
|
|
32
|
-
language?: BlipLanguage;
|
|
33
|
-
}, opts?: ConsumeOptions): Promise<void>;
|
|
34
|
-
cancelPluginSubscription(tenantId: string, pluginId: string, settings?: {
|
|
35
|
-
language?: BlipLanguage;
|
|
36
|
-
}, opts?: ConsumeOptions): Promise<void>;
|
|
37
|
-
/**
|
|
38
|
-
* @param settings.language - The language to send the communication emails (default value: pt)
|
|
39
|
-
* @param settings.applicationIdentity - The application identity to install the plugin
|
|
40
|
-
*/
|
|
41
|
-
installPlugin(tenantId: string, pluginId: string, settings: {
|
|
42
|
-
applicationIdentity: Identity;
|
|
43
|
-
language?: BlipLanguage;
|
|
44
|
-
}, opts?: ConsumeOptions): Promise<void>;
|
|
45
|
-
/**
|
|
46
|
-
* @param settings.language - The language to send the communication emails (default value: pt)
|
|
47
|
-
* @param settings.applicationIdentity - The application identity to uninstall the plugin
|
|
48
|
-
*/
|
|
49
|
-
uninstallPlugin(tenantId: string, pluginId: string, settings: {
|
|
50
|
-
applicationIdentity: Identity;
|
|
51
|
-
language?: BlipLanguage;
|
|
52
|
-
}, opts?: ConsumeOptions): Promise<void>;
|
|
53
|
-
/** This route can only be called by an admin user of blip.ai */
|
|
54
|
-
deletePluginMedia(mediaId: string, opts?: ConsumeOptions): Promise<void>;
|
|
55
|
-
/** This route can only be called by an admin user of blip.ai */
|
|
56
|
-
addPluginMedia(pluginId: string, type: 'image' | 'video', url: string, opts?: ConsumeOptions): Promise<void>;
|
|
57
|
-
/** This route can only be called by an admin user of blip.ai */
|
|
58
|
-
addPlugin(plugin: {
|
|
59
|
-
documentation: DetailedPlugin['documentation'];
|
|
60
|
-
url: string;
|
|
61
|
-
icon: DetailedPlugin['icon'];
|
|
62
|
-
price?: DetailedPlugin['price'];
|
|
63
|
-
authorId: number;
|
|
64
|
-
media: Array<{
|
|
65
|
-
uri: string;
|
|
66
|
-
type: 'image' | 'video';
|
|
67
|
-
}>;
|
|
68
|
-
tags: Array<number>;
|
|
69
|
-
languages: {
|
|
70
|
-
pt: {
|
|
71
|
-
name: string;
|
|
72
|
-
overview: string;
|
|
73
|
-
description: string;
|
|
74
|
-
};
|
|
75
|
-
en: {
|
|
76
|
-
name: string;
|
|
77
|
-
overview: string;
|
|
78
|
-
description: string;
|
|
79
|
-
};
|
|
80
|
-
es: {
|
|
81
|
-
name: string;
|
|
82
|
-
overview: string;
|
|
83
|
-
description: string;
|
|
84
|
-
};
|
|
85
|
-
};
|
|
86
|
-
prices?: Array<Omit<PluginBilling, 'billingId' | 'currency' | 'language' | 'isActive' | 'featuresIncluded'> & {
|
|
87
|
-
featuresIncluded: Array<{
|
|
88
|
-
icon: string;
|
|
89
|
-
description: string;
|
|
90
|
-
}>;
|
|
91
|
-
}>;
|
|
92
|
-
}, opts?: ConsumeOptions): Promise<void>;
|
|
93
|
-
/** This route can only be called by an admin user of blip.ai */
|
|
94
|
-
updatePlugin(pluginId: string, plugin: Partial<Pick<DetailedPlugin, 'name' | 'overview' | 'description' | 'icon' | 'documentation' | 'price'> & {
|
|
95
|
-
url: string;
|
|
96
|
-
isPublished: boolean;
|
|
97
|
-
}>, opts?: ConsumeOptions): Promise<void>;
|
|
98
|
-
setPluginBilling(pluginId: string, billingId: string, billing: Omit<PluginBilling, 'billingId' | 'currency' | 'language' | 'featuresIncluded'> & {
|
|
99
|
-
featuresIncluded: Array<{
|
|
100
|
-
icon: string;
|
|
101
|
-
description: string;
|
|
102
|
-
}>;
|
|
103
|
-
}, opts?: ConsumeOptions): Promise<void>;
|
|
104
|
-
}
|
|
105
|
-
//# sourceMappingURL=plugins.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"plugins.d.ts","sourceRoot":"","sources":["../../../src/namespaces/plugins.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AAC9C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAA;AACvD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAA;AAChD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM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AAC,GAAG;QAC7F,GAAG,EAAE,MAAM,CAAA;QACX,WAAW,EAAE,OAAO,CAAA;KACvB,CACJ,EACD,IAAI,CAAC,EAAE,cAAc,GACtB,OAAO,CAAC,IAAI,CAAC;IAsBT,gBAAgB,CACnB,QAAQ,EAAE,MAAM,EAChB,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE,IAAI,CAAC,aAAa,EAAE,WAAW,GAAG,UAAU,GAAG,UAAU,GAAG,kBAAkB,CAAC,GAAG;QACvF,gBAAgB,EAAE,KAAK,CAAC;YACpB,IAAI,EAAE,MAAM,CAAA;YACZ,WAAW,EAAE,MAAM,CAAA;SACtB,CAAC,CAAA;KACL,EACD,IAAI,CAAC,EAAE,cAAc;CA0B5B"}
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
export type Plugin = {
|
|
2
|
-
id: string;
|
|
3
|
-
name: string;
|
|
4
|
-
overview: string;
|
|
5
|
-
price: number;
|
|
6
|
-
isPaid: boolean;
|
|
7
|
-
icon: string;
|
|
8
|
-
storageDate: string;
|
|
9
|
-
author: {
|
|
10
|
-
id: number;
|
|
11
|
-
name: string;
|
|
12
|
-
email: string;
|
|
13
|
-
logo: string;
|
|
14
|
-
isActive: boolean;
|
|
15
|
-
};
|
|
16
|
-
installedBotsNumber?: number;
|
|
17
|
-
installedBotsNumberAllContracts?: number;
|
|
18
|
-
subscription?: {
|
|
19
|
-
status: string;
|
|
20
|
-
};
|
|
21
|
-
tags: Array<string>;
|
|
22
|
-
chargeType: string;
|
|
23
|
-
imageUrl: string;
|
|
24
|
-
};
|
|
25
|
-
export type DetailedPlugin = Plugin & {
|
|
26
|
-
description?: string;
|
|
27
|
-
documentation?: string;
|
|
28
|
-
};
|
|
29
|
-
export type PluginBilling = {
|
|
30
|
-
billingId: number;
|
|
31
|
-
currency: string;
|
|
32
|
-
description: string;
|
|
33
|
-
featuresIncluded: string;
|
|
34
|
-
isRecommended?: boolean;
|
|
35
|
-
language: string;
|
|
36
|
-
name: string;
|
|
37
|
-
price: number;
|
|
38
|
-
additionalDescription?: string;
|
|
39
|
-
};
|
|
40
|
-
export type PluginSubscription = DetailedPlugin & {
|
|
41
|
-
/** All possible billings for the plugin */
|
|
42
|
-
billings: Array<PluginBilling>;
|
|
43
|
-
subscription: NonNullable<Plugin['subscription']> & {
|
|
44
|
-
/** The active billing plans, usually the length is 0 or 1 */
|
|
45
|
-
billings: Array<PluginBilling>;
|
|
46
|
-
chargeType: string;
|
|
47
|
-
price: number;
|
|
48
|
-
};
|
|
49
|
-
};
|
|
50
|
-
//# sourceMappingURL=plugins.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"plugins.d.ts","sourceRoot":"","sources":["../../../src/types/plugins.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,MAAM,GAAG;IACjB,EAAE,EAAE,MAAM,CAAA;IACV,IAAI,EAAE,MAAM,CAAA;IACZ,QAAQ,EAAE,MAAM,CAAA;IAChB,KAAK,EAAE,MAAM,CAAA;IACb,MAAM,EAAE,OAAO,CAAA;IACf,IAAI,EAAE,MAAM,CAAA;IACZ,WAAW,EAAE,MAAM,CAAA;IACnB,MAAM,EAAE;QACJ,EAAE,EAAE,MAAM,CAAA;QACV,IAAI,EAAE,MAAM,CAAA;QACZ,KAAK,EAAE,MAAM,CAAA;QACb,IAAI,EAAE,MAAM,CAAA;QACZ,QAAQ,EAAE,OAAO,CAAA;KACpB,CAAA;IACD,mBAAmB,CAAC,EAAE,MAAM,CAAA;IAC5B,+BAA+B,CAAC,EAAE,MAAM,CAAA;IACxC,YAAY,CAAC,EAAE;QACX,MAAM,EAAE,MAAM,CAAA;KACjB,CAAA;IACD,IAAI,EAAE,KAAK,CAAC,MAAM,CAAC,CAAA;IACnB,UAAU,EAAE,MAAM,CAAA;IAClB,QAAQ,EAAE,MAAM,CAAA;CACnB,CAAA;AAED,MAAM,MAAM,cAAc,GAAG,MAAM,GAAG;IAClC,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,aAAa,CAAC,EAAE,MAAM,CAAA;CACzB,CAAA;AAED,MAAM,MAAM,aAAa,GAAG;IACxB,SAAS,EAAE,MAAM,CAAA;IACjB,QAAQ,EAAE,MAAM,CAAA;IAChB,WAAW,EAAE,MAAM,CAAA;IACnB,gBAAgB,EAAE,MAAM,CAAA;IACxB,aAAa,CAAC,EAAE,OAAO,CAAA;IACvB,QAAQ,EAAE,MAAM,CAAA;IAChB,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,EAAE,MAAM,CAAA;IACb,qBAAqB,CAAC,EAAE,MAAM,CAAA;CACjC,CAAA;AAED,MAAM,MAAM,kBAAkB,GAAG,cAAc,GAAG;IAC9C,2CAA2C;IAC3C,QAAQ,EAAE,KAAK,CAAC,aAAa,CAAC,CAAA;IAC9B,YAAY,EAAE,WAAW,CAAC,MAAM,CAAC,cAAc,CAAC,CAAC,GAAG;QAChD,6DAA6D;QAC7D,QAAQ,EAAE,KAAK,CAAC,aAAa,CAAC,CAAA;QAC9B,UAAU,EAAE,MAAM,CAAA;QAClB,KAAK,EAAE,MAAM,CAAA;KAChB,CAAA;CACJ,CAAA"}
|
|
@@ -1,434 +0,0 @@
|
|
|
1
|
-
import type { BlipClient } from '../client.ts'
|
|
2
|
-
import type { BlipLanguage } from '../types/account.ts'
|
|
3
|
-
import type { Identity } from '../types/node.ts'
|
|
4
|
-
import type { DetailedPlugin, Plugin, PluginBilling, PluginSubscription } from '../types/plugins.ts'
|
|
5
|
-
import type { Application } from '../types/portal.ts'
|
|
6
|
-
import { uri } from '../utils/uri.ts'
|
|
7
|
-
import { type ConsumeOptions, Namespace, type SendCommandOptions } from './namespace.ts'
|
|
8
|
-
|
|
9
|
-
export class PluginsNamespace extends Namespace {
|
|
10
|
-
constructor(blipClient: BlipClient, defaultOptions?: SendCommandOptions) {
|
|
11
|
-
super(blipClient, 'plugins', { ...defaultOptions, domain: 'blip.ai' })
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
public getTenantApplicationsWithPlugin(
|
|
15
|
-
tenantId: string,
|
|
16
|
-
pluginId: string,
|
|
17
|
-
opts?: ConsumeOptions,
|
|
18
|
-
): Promise<Array<Application>> {
|
|
19
|
-
return this.sendCommand(
|
|
20
|
-
{
|
|
21
|
-
method: 'get',
|
|
22
|
-
uri: uri`/tenants/${tenantId}/plugins/${pluginId}/applications`,
|
|
23
|
-
},
|
|
24
|
-
{
|
|
25
|
-
...opts,
|
|
26
|
-
collection: true,
|
|
27
|
-
// This route doesn't handle pagination correctly, it will always fetch all
|
|
28
|
-
fetchall: false,
|
|
29
|
-
},
|
|
30
|
-
)
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
public getInstalledPlugins(tenantId: string, opts?: ConsumeOptions): Promise<Array<Plugin>> {
|
|
34
|
-
return this.sendCommand(
|
|
35
|
-
{
|
|
36
|
-
method: 'get',
|
|
37
|
-
uri: uri`/tenants/${tenantId}/plugins?${{ charge: 'all', onlySubscribed: 'true' }}`,
|
|
38
|
-
},
|
|
39
|
-
{
|
|
40
|
-
collection: true,
|
|
41
|
-
// This route doesn't handle pagination correctly, it will always fetch all
|
|
42
|
-
fetchall: false,
|
|
43
|
-
...opts,
|
|
44
|
-
},
|
|
45
|
-
)
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
/**
|
|
49
|
-
* @param tenantId - The tenant id to use when fetching the plugins, only works as blip.ai user and the user should be a member of the tenant
|
|
50
|
-
*/
|
|
51
|
-
public getPlugins(tenantId?: string, opts?: ConsumeOptions): Promise<Array<Plugin>> {
|
|
52
|
-
return this.sendCommand(
|
|
53
|
-
{
|
|
54
|
-
method: 'get',
|
|
55
|
-
uri: tenantId
|
|
56
|
-
? uri`/tenants/${tenantId}/plugins?${{ charge: 'all' }}`
|
|
57
|
-
: uri`/plugins?${{ charge: 'all' }}`,
|
|
58
|
-
},
|
|
59
|
-
{
|
|
60
|
-
collection: true,
|
|
61
|
-
// This route doesn't handle pagination correctly, it will always fetch all
|
|
62
|
-
fetchall: false,
|
|
63
|
-
...opts,
|
|
64
|
-
},
|
|
65
|
-
)
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
public getPlugin(
|
|
69
|
-
pluginId: string,
|
|
70
|
-
query?: { returnInstalledBots?: boolean; language?: BlipLanguage },
|
|
71
|
-
opts?: ConsumeOptions,
|
|
72
|
-
): Promise<DetailedPlugin> {
|
|
73
|
-
return this.sendCommand(
|
|
74
|
-
{
|
|
75
|
-
method: 'get',
|
|
76
|
-
uri: uri`/plugins/${pluginId}?${{ language: query?.language, returnInstalledBots: query?.returnInstalledBots }}`,
|
|
77
|
-
},
|
|
78
|
-
opts,
|
|
79
|
-
)
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
public getPluginSubscription(
|
|
83
|
-
tenantId: string,
|
|
84
|
-
pluginId: string,
|
|
85
|
-
opts?: ConsumeOptions,
|
|
86
|
-
): Promise<PluginSubscription> {
|
|
87
|
-
return this.sendCommand(
|
|
88
|
-
{
|
|
89
|
-
method: 'get',
|
|
90
|
-
uri: uri`/tenants/${tenantId}/plugins/${pluginId}/subscription`,
|
|
91
|
-
},
|
|
92
|
-
opts,
|
|
93
|
-
)
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
/**
|
|
97
|
-
* @param settings.hasPartnerService - Whether the plugin has a partner service (default value: false)
|
|
98
|
-
* @param settings.language - The language to send the communication emails (default value: pt)
|
|
99
|
-
* @param settings.plan - If the plugin has multiple plans, the plan to subscribe to
|
|
100
|
-
*/
|
|
101
|
-
public subscribeToPlugin(
|
|
102
|
-
tenantId: string,
|
|
103
|
-
pluginId: string,
|
|
104
|
-
settings: {
|
|
105
|
-
plan: number
|
|
106
|
-
hasPartnerService?: boolean
|
|
107
|
-
language?: BlipLanguage
|
|
108
|
-
},
|
|
109
|
-
opts?: ConsumeOptions,
|
|
110
|
-
): Promise<void> {
|
|
111
|
-
return this.sendCommand(
|
|
112
|
-
{
|
|
113
|
-
method: 'set',
|
|
114
|
-
type: 'application/vnd.iris.plugins.subscribe+json',
|
|
115
|
-
uri: uri`/tenants/${tenantId}/plugins/${pluginId}/subscribe`,
|
|
116
|
-
resource: {
|
|
117
|
-
hasPartnerService: settings.hasPartnerService ?? false,
|
|
118
|
-
language: settings.language ?? 'pt',
|
|
119
|
-
plan: settings.plan,
|
|
120
|
-
pluginId,
|
|
121
|
-
// That means that it will be charged to the tenant, not sure if exists other values
|
|
122
|
-
chargeType: 3,
|
|
123
|
-
},
|
|
124
|
-
},
|
|
125
|
-
opts,
|
|
126
|
-
)
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
public upgradePluginSubscription(
|
|
130
|
-
tenantId: string,
|
|
131
|
-
pluginId: string,
|
|
132
|
-
settings: {
|
|
133
|
-
plan: number
|
|
134
|
-
language?: BlipLanguage
|
|
135
|
-
},
|
|
136
|
-
opts?: ConsumeOptions,
|
|
137
|
-
): Promise<void> {
|
|
138
|
-
return this.sendCommand(
|
|
139
|
-
{
|
|
140
|
-
method: 'set',
|
|
141
|
-
type: 'application/vnd.iris.plugins.subscribe+json',
|
|
142
|
-
uri: uri`/tenants/${tenantId}/plugins/${pluginId}/upgrade`,
|
|
143
|
-
resource: {
|
|
144
|
-
pluginId,
|
|
145
|
-
plan: settings.plan,
|
|
146
|
-
language: settings.language ?? 'pt',
|
|
147
|
-
},
|
|
148
|
-
},
|
|
149
|
-
opts,
|
|
150
|
-
)
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
public cancelPluginSubscription(
|
|
154
|
-
tenantId: string,
|
|
155
|
-
pluginId: string,
|
|
156
|
-
settings?: {
|
|
157
|
-
language?: BlipLanguage
|
|
158
|
-
},
|
|
159
|
-
opts?: ConsumeOptions,
|
|
160
|
-
): Promise<void> {
|
|
161
|
-
return this.sendCommand(
|
|
162
|
-
{
|
|
163
|
-
method: 'delete',
|
|
164
|
-
uri: uri`/tenants/${tenantId}/plugins/${pluginId}/cancel?${{ language: settings?.language ?? 'pt' }}`,
|
|
165
|
-
},
|
|
166
|
-
opts,
|
|
167
|
-
)
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
/**
|
|
171
|
-
* @param settings.language - The language to send the communication emails (default value: pt)
|
|
172
|
-
* @param settings.applicationIdentity - The application identity to install the plugin
|
|
173
|
-
*/
|
|
174
|
-
public installPlugin(
|
|
175
|
-
tenantId: string,
|
|
176
|
-
pluginId: string,
|
|
177
|
-
settings: {
|
|
178
|
-
applicationIdentity: Identity
|
|
179
|
-
language?: BlipLanguage
|
|
180
|
-
},
|
|
181
|
-
opts?: ConsumeOptions,
|
|
182
|
-
): Promise<void> {
|
|
183
|
-
return this.sendCommand(
|
|
184
|
-
{
|
|
185
|
-
method: 'set',
|
|
186
|
-
type: 'application/vnd.iris.plugins.install+json',
|
|
187
|
-
uri: uri`/tenants/${tenantId}/plugins/${pluginId}/install`,
|
|
188
|
-
resource: {
|
|
189
|
-
applicationIdentity: settings.applicationIdentity,
|
|
190
|
-
language: settings.language ?? 'pt',
|
|
191
|
-
},
|
|
192
|
-
},
|
|
193
|
-
opts,
|
|
194
|
-
)
|
|
195
|
-
}
|
|
196
|
-
|
|
197
|
-
/**
|
|
198
|
-
* @param settings.language - The language to send the communication emails (default value: pt)
|
|
199
|
-
* @param settings.applicationIdentity - The application identity to uninstall the plugin
|
|
200
|
-
*/
|
|
201
|
-
public uninstallPlugin(
|
|
202
|
-
tenantId: string,
|
|
203
|
-
pluginId: string,
|
|
204
|
-
settings: {
|
|
205
|
-
applicationIdentity: Identity
|
|
206
|
-
language?: BlipLanguage
|
|
207
|
-
},
|
|
208
|
-
opts?: ConsumeOptions,
|
|
209
|
-
): Promise<void> {
|
|
210
|
-
return this.sendCommand(
|
|
211
|
-
{
|
|
212
|
-
method: 'set',
|
|
213
|
-
type: 'application/vnd.iris.plugins.install+json',
|
|
214
|
-
uri: uri`/tenants/${tenantId}/plugins/${pluginId}/uninstall`,
|
|
215
|
-
resource: {
|
|
216
|
-
applicationIdentity: settings.applicationIdentity,
|
|
217
|
-
language: settings.language ?? 'pt',
|
|
218
|
-
},
|
|
219
|
-
},
|
|
220
|
-
opts,
|
|
221
|
-
)
|
|
222
|
-
}
|
|
223
|
-
|
|
224
|
-
/** This route can only be called by an admin user of blip.ai */
|
|
225
|
-
public deletePluginMedia(mediaId: string, opts?: ConsumeOptions) {
|
|
226
|
-
return this.sendCommand(
|
|
227
|
-
{
|
|
228
|
-
method: 'delete',
|
|
229
|
-
uri: uri`/images/${mediaId}`,
|
|
230
|
-
},
|
|
231
|
-
opts,
|
|
232
|
-
)
|
|
233
|
-
}
|
|
234
|
-
|
|
235
|
-
/** This route can only be called by an admin user of blip.ai */
|
|
236
|
-
public addPluginMedia(pluginId: string, type: 'image' | 'video', url: string, opts?: ConsumeOptions) {
|
|
237
|
-
return this.sendCommand(
|
|
238
|
-
{
|
|
239
|
-
method: 'set',
|
|
240
|
-
type: 'application/vnd.iris.plugins.image-create+json',
|
|
241
|
-
uri: uri`/images`,
|
|
242
|
-
resource: {
|
|
243
|
-
uri: url,
|
|
244
|
-
pluginId,
|
|
245
|
-
imageType: type === 'image' ? 3 : 1,
|
|
246
|
-
},
|
|
247
|
-
},
|
|
248
|
-
opts,
|
|
249
|
-
)
|
|
250
|
-
}
|
|
251
|
-
|
|
252
|
-
/** This route can only be called by an admin user of blip.ai */
|
|
253
|
-
public addPlugin(
|
|
254
|
-
plugin: {
|
|
255
|
-
documentation: DetailedPlugin['documentation']
|
|
256
|
-
url: string
|
|
257
|
-
icon: DetailedPlugin['icon']
|
|
258
|
-
price?: DetailedPlugin['price']
|
|
259
|
-
authorId: number
|
|
260
|
-
media: Array<{ uri: string; type: 'image' | 'video' }>
|
|
261
|
-
tags: Array<number>
|
|
262
|
-
languages: {
|
|
263
|
-
pt: {
|
|
264
|
-
name: string
|
|
265
|
-
overview: string
|
|
266
|
-
description: string
|
|
267
|
-
}
|
|
268
|
-
en: {
|
|
269
|
-
name: string
|
|
270
|
-
overview: string
|
|
271
|
-
description: string
|
|
272
|
-
}
|
|
273
|
-
es: {
|
|
274
|
-
name: string
|
|
275
|
-
overview: string
|
|
276
|
-
description: string
|
|
277
|
-
}
|
|
278
|
-
}
|
|
279
|
-
prices?: Array<
|
|
280
|
-
Omit<PluginBilling, 'billingId' | 'currency' | 'language' | 'isActive' | 'featuresIncluded'> & {
|
|
281
|
-
featuresIncluded: Array<{
|
|
282
|
-
icon: string
|
|
283
|
-
description: string
|
|
284
|
-
}>
|
|
285
|
-
}
|
|
286
|
-
>
|
|
287
|
-
},
|
|
288
|
-
opts?: ConsumeOptions,
|
|
289
|
-
) {
|
|
290
|
-
const price = plugin.prices?.[0]?.price ?? plugin.price
|
|
291
|
-
return this.sendCommand(
|
|
292
|
-
{
|
|
293
|
-
method: 'set',
|
|
294
|
-
type: 'application/vnd.lime.collection+json',
|
|
295
|
-
uri: uri`/plugins`,
|
|
296
|
-
resource: {
|
|
297
|
-
itemType: 'application/vnd.iris.plugin.resource+json',
|
|
298
|
-
items: [
|
|
299
|
-
{
|
|
300
|
-
name: plugin.languages.pt.name,
|
|
301
|
-
website: plugin.documentation,
|
|
302
|
-
url: plugin.url,
|
|
303
|
-
overview: plugin.languages.pt.overview,
|
|
304
|
-
description: plugin.languages.pt.description,
|
|
305
|
-
version: '1.0.0',
|
|
306
|
-
icon: plugin.icon,
|
|
307
|
-
isPaid: price !== undefined && price > 0,
|
|
308
|
-
price,
|
|
309
|
-
authorId: plugin.authorId,
|
|
310
|
-
installationType: 0,
|
|
311
|
-
configurationLink: '/application/detail/{botId}/plugin/{pluginId}',
|
|
312
|
-
pluginType: 'Frontend',
|
|
313
|
-
images: plugin.media.map((m) => ({
|
|
314
|
-
language: 'pt',
|
|
315
|
-
uri: m.uri,
|
|
316
|
-
imageType: m.type === 'image' ? 3 : 1,
|
|
317
|
-
})),
|
|
318
|
-
chargeType: plugin.prices && plugin.prices.length > 1 ? 3 : 1,
|
|
319
|
-
tags: plugin.tags.map((t) => ({ tagValue: t })),
|
|
320
|
-
languages: [
|
|
321
|
-
{
|
|
322
|
-
language: 0,
|
|
323
|
-
},
|
|
324
|
-
{
|
|
325
|
-
language: 1,
|
|
326
|
-
},
|
|
327
|
-
{
|
|
328
|
-
language: 2,
|
|
329
|
-
},
|
|
330
|
-
],
|
|
331
|
-
translations: [
|
|
332
|
-
{
|
|
333
|
-
name: plugin.languages.en.name,
|
|
334
|
-
overview: plugin.languages.en.overview,
|
|
335
|
-
description: plugin.languages.en.description,
|
|
336
|
-
language: 'en',
|
|
337
|
-
},
|
|
338
|
-
{
|
|
339
|
-
name: plugin.languages.es.name,
|
|
340
|
-
overview: plugin.languages.es.overview,
|
|
341
|
-
description: plugin.languages.es.description,
|
|
342
|
-
language: 'es',
|
|
343
|
-
},
|
|
344
|
-
],
|
|
345
|
-
billings: plugin.prices?.map((p) => ({
|
|
346
|
-
name: p.name,
|
|
347
|
-
description: p.description,
|
|
348
|
-
price: p.price,
|
|
349
|
-
// TODO: I don't know exactly what it means yet
|
|
350
|
-
language: 'pt',
|
|
351
|
-
// TODO: This one too
|
|
352
|
-
currency: 1,
|
|
353
|
-
chargeType: 1,
|
|
354
|
-
isRecommended: p.isRecommended,
|
|
355
|
-
featuresIncluded: JSON.stringify(p.featuresIncluded),
|
|
356
|
-
additionalDescription: p.additionalDescription,
|
|
357
|
-
isActive: true,
|
|
358
|
-
})),
|
|
359
|
-
},
|
|
360
|
-
],
|
|
361
|
-
},
|
|
362
|
-
},
|
|
363
|
-
opts,
|
|
364
|
-
)
|
|
365
|
-
}
|
|
366
|
-
|
|
367
|
-
/** This route can only be called by an admin user of blip.ai */
|
|
368
|
-
public updatePlugin(
|
|
369
|
-
pluginId: string,
|
|
370
|
-
plugin: Partial<
|
|
371
|
-
Pick<DetailedPlugin, 'name' | 'overview' | 'description' | 'icon' | 'documentation' | 'price'> & {
|
|
372
|
-
url: string
|
|
373
|
-
isPublished: boolean
|
|
374
|
-
}
|
|
375
|
-
>,
|
|
376
|
-
opts?: ConsumeOptions,
|
|
377
|
-
): Promise<void> {
|
|
378
|
-
return this.sendCommand(
|
|
379
|
-
{
|
|
380
|
-
method: 'set',
|
|
381
|
-
type: 'application/vnd.iris.plugin.resource+json',
|
|
382
|
-
uri: uri`/plugins/${pluginId}`,
|
|
383
|
-
resource: {
|
|
384
|
-
name: plugin.name,
|
|
385
|
-
overview: plugin.overview,
|
|
386
|
-
description: plugin.description,
|
|
387
|
-
icon: plugin.icon,
|
|
388
|
-
website: plugin.documentation,
|
|
389
|
-
url: plugin.url,
|
|
390
|
-
price: plugin.price,
|
|
391
|
-
isPaid: plugin.price !== undefined && plugin.price > 0,
|
|
392
|
-
isPublished: plugin.isPublished,
|
|
393
|
-
},
|
|
394
|
-
},
|
|
395
|
-
opts,
|
|
396
|
-
)
|
|
397
|
-
}
|
|
398
|
-
|
|
399
|
-
public setPluginBilling(
|
|
400
|
-
pluginId: string,
|
|
401
|
-
billingId: string,
|
|
402
|
-
billing: Omit<PluginBilling, 'billingId' | 'currency' | 'language' | 'featuresIncluded'> & {
|
|
403
|
-
featuresIncluded: Array<{
|
|
404
|
-
icon: string
|
|
405
|
-
description: string
|
|
406
|
-
}>
|
|
407
|
-
},
|
|
408
|
-
opts?: ConsumeOptions,
|
|
409
|
-
) {
|
|
410
|
-
return this.sendCommand(
|
|
411
|
-
{
|
|
412
|
-
method: 'set',
|
|
413
|
-
type: 'application/vnd.iris.plugins.billing-update+json',
|
|
414
|
-
uri: uri`/billings/${billingId}`,
|
|
415
|
-
resource: {
|
|
416
|
-
blipPluginId: pluginId,
|
|
417
|
-
name: billing.name,
|
|
418
|
-
description: billing.description,
|
|
419
|
-
featuresIncluded: billing.featuresIncluded ? JSON.stringify(billing.featuresIncluded) : undefined,
|
|
420
|
-
isRecommended: billing.isRecommended,
|
|
421
|
-
price: billing.price,
|
|
422
|
-
additionalDescription: billing.additionalDescription,
|
|
423
|
-
// TODO: add params to this
|
|
424
|
-
language: 'pt',
|
|
425
|
-
// TODO: This one too
|
|
426
|
-
currency: 1,
|
|
427
|
-
chargeType: 3,
|
|
428
|
-
isActive: true,
|
|
429
|
-
},
|
|
430
|
-
},
|
|
431
|
-
opts,
|
|
432
|
-
)
|
|
433
|
-
}
|
|
434
|
-
}
|
package/src/types/plugins.ts
DELETED
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
export type Plugin = {
|
|
2
|
-
id: string
|
|
3
|
-
name: string
|
|
4
|
-
overview: string
|
|
5
|
-
price: number
|
|
6
|
-
isPaid: boolean
|
|
7
|
-
icon: string
|
|
8
|
-
storageDate: string
|
|
9
|
-
author: {
|
|
10
|
-
id: number
|
|
11
|
-
name: string
|
|
12
|
-
email: string
|
|
13
|
-
logo: string
|
|
14
|
-
isActive: boolean
|
|
15
|
-
}
|
|
16
|
-
installedBotsNumber?: number
|
|
17
|
-
installedBotsNumberAllContracts?: number
|
|
18
|
-
subscription?: {
|
|
19
|
-
status: string
|
|
20
|
-
}
|
|
21
|
-
tags: Array<string>
|
|
22
|
-
chargeType: string
|
|
23
|
-
imageUrl: string
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
export type DetailedPlugin = Plugin & {
|
|
27
|
-
description?: string
|
|
28
|
-
documentation?: string
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
export type PluginBilling = {
|
|
32
|
-
billingId: number
|
|
33
|
-
currency: string
|
|
34
|
-
description: string
|
|
35
|
-
featuresIncluded: string
|
|
36
|
-
isRecommended?: boolean
|
|
37
|
-
language: string
|
|
38
|
-
name: string
|
|
39
|
-
price: number
|
|
40
|
-
additionalDescription?: string
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
export type PluginSubscription = DetailedPlugin & {
|
|
44
|
-
/** All possible billings for the plugin */
|
|
45
|
-
billings: Array<PluginBilling>
|
|
46
|
-
subscription: NonNullable<Plugin['subscription']> & {
|
|
47
|
-
/** The active billing plans, usually the length is 0 or 1 */
|
|
48
|
-
billings: Array<PluginBilling>
|
|
49
|
-
chargeType: string
|
|
50
|
-
price: number
|
|
51
|
-
}
|
|
52
|
-
}
|