@dawntech/blip-tools 0.6.2 → 0.7.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +57 -2
- package/dist/index.mjs +57 -2
- package/dist/modules/blip-analytics.d.ts +8 -1
- package/dist/modules/blip-dispatch.d.ts +5 -5
- package/dist/modules/blip-main.d.ts +2 -0
- package/dist/modules/blip-threads.d.ts +18 -0
- package/dist/types/analytics.d.ts +5 -0
- package/dist/types/threads.d.ts +13 -0
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -418,7 +418,7 @@ class BlipDispatch {
|
|
|
418
418
|
/**
|
|
419
419
|
* Sends a simple text message to an active user. For sending messages to clients who have never interacted or are inactive, use `sendTemplate` instead.
|
|
420
420
|
*/
|
|
421
|
-
async sendSimpleMessage({ identity, content, metadata }) {
|
|
421
|
+
async sendSimpleMessage({ identity, content, metadata, }) {
|
|
422
422
|
try {
|
|
423
423
|
const response = await this.api.post('/messages', {
|
|
424
424
|
id: crypto.randomUUID(),
|
|
@@ -793,7 +793,7 @@ class BlipAnalytics {
|
|
|
793
793
|
id: crypto.randomUUID(),
|
|
794
794
|
to: 'postmaster@desk.msging.net',
|
|
795
795
|
method: 'get',
|
|
796
|
-
uri:
|
|
796
|
+
uri: createUri('/analytics/reports/timings', params),
|
|
797
797
|
};
|
|
798
798
|
const response = await this.api.post('/commands', body);
|
|
799
799
|
validateResponse(response);
|
|
@@ -803,6 +803,59 @@ class BlipAnalytics {
|
|
|
803
803
|
throw handleError(error);
|
|
804
804
|
}
|
|
805
805
|
}
|
|
806
|
+
/**
|
|
807
|
+
* Returns a summary of tickets grouped by tag. Dates are expected to be in yyyy-mm-dd format.
|
|
808
|
+
*/
|
|
809
|
+
async getTagReports({ beginDate, endDate } = {}) {
|
|
810
|
+
try {
|
|
811
|
+
const params = {
|
|
812
|
+
beginDate,
|
|
813
|
+
endDate,
|
|
814
|
+
};
|
|
815
|
+
const body = {
|
|
816
|
+
id: crypto.randomUUID(),
|
|
817
|
+
to: 'postmaster@desk.msging.net',
|
|
818
|
+
method: 'get',
|
|
819
|
+
uri: createUri('/analytics/reports/tags', params),
|
|
820
|
+
};
|
|
821
|
+
const response = await this.api.post('/commands', body);
|
|
822
|
+
validateResponse(response);
|
|
823
|
+
return response.data.resource.items;
|
|
824
|
+
}
|
|
825
|
+
catch (error) {
|
|
826
|
+
throw handleError(error);
|
|
827
|
+
}
|
|
828
|
+
}
|
|
829
|
+
}
|
|
830
|
+
|
|
831
|
+
class BlipThreads {
|
|
832
|
+
api;
|
|
833
|
+
constructor(context) {
|
|
834
|
+
this.api = context.api;
|
|
835
|
+
}
|
|
836
|
+
async getThread({ identity, refreshExpiredMedia, skip, take, messageId, storageDate, direction, getFromOriginator, }) {
|
|
837
|
+
const params = {
|
|
838
|
+
refreshExpiredMedia: refreshExpiredMedia ? 'true' : 'false',
|
|
839
|
+
$skip: skip,
|
|
840
|
+
$take: take,
|
|
841
|
+
messageId,
|
|
842
|
+
storageDate,
|
|
843
|
+
direction,
|
|
844
|
+
getFromOriginator,
|
|
845
|
+
};
|
|
846
|
+
try {
|
|
847
|
+
const response = await this.api.post('/commands', {
|
|
848
|
+
id: crypto.randomUUID(),
|
|
849
|
+
method: 'get',
|
|
850
|
+
uri: createUri(`/threads/${identity}`, params),
|
|
851
|
+
});
|
|
852
|
+
validateResponse(response);
|
|
853
|
+
return response.data.resource.items;
|
|
854
|
+
}
|
|
855
|
+
catch (error) {
|
|
856
|
+
throw handleError(error);
|
|
857
|
+
}
|
|
858
|
+
}
|
|
806
859
|
}
|
|
807
860
|
|
|
808
861
|
class Blip {
|
|
@@ -820,6 +873,7 @@ class Blip {
|
|
|
820
873
|
monitoring;
|
|
821
874
|
analytics;
|
|
822
875
|
campaign;
|
|
876
|
+
threads;
|
|
823
877
|
constructor(params) {
|
|
824
878
|
validateInstance(params);
|
|
825
879
|
this.api = axios.create({
|
|
@@ -842,6 +896,7 @@ class Blip {
|
|
|
842
896
|
this.monitoring = new BlipMonitoring({ api: this.api });
|
|
843
897
|
this.analytics = new BlipAnalytics({ api: this.api });
|
|
844
898
|
this.campaign = new BlipCampaign({ api: this.api });
|
|
899
|
+
this.threads = new BlipThreads({ api: this.api });
|
|
845
900
|
}
|
|
846
901
|
}
|
|
847
902
|
|
package/dist/index.mjs
CHANGED
|
@@ -416,7 +416,7 @@ class BlipDispatch {
|
|
|
416
416
|
/**
|
|
417
417
|
* Sends a simple text message to an active user. For sending messages to clients who have never interacted or are inactive, use `sendTemplate` instead.
|
|
418
418
|
*/
|
|
419
|
-
async sendSimpleMessage({ identity, content, metadata }) {
|
|
419
|
+
async sendSimpleMessage({ identity, content, metadata, }) {
|
|
420
420
|
try {
|
|
421
421
|
const response = await this.api.post('/messages', {
|
|
422
422
|
id: randomUUID(),
|
|
@@ -791,7 +791,7 @@ class BlipAnalytics {
|
|
|
791
791
|
id: randomUUID(),
|
|
792
792
|
to: 'postmaster@desk.msging.net',
|
|
793
793
|
method: 'get',
|
|
794
|
-
uri:
|
|
794
|
+
uri: createUri('/analytics/reports/timings', params),
|
|
795
795
|
};
|
|
796
796
|
const response = await this.api.post('/commands', body);
|
|
797
797
|
validateResponse(response);
|
|
@@ -801,6 +801,59 @@ class BlipAnalytics {
|
|
|
801
801
|
throw handleError(error);
|
|
802
802
|
}
|
|
803
803
|
}
|
|
804
|
+
/**
|
|
805
|
+
* Returns a summary of tickets grouped by tag. Dates are expected to be in yyyy-mm-dd format.
|
|
806
|
+
*/
|
|
807
|
+
async getTagReports({ beginDate, endDate } = {}) {
|
|
808
|
+
try {
|
|
809
|
+
const params = {
|
|
810
|
+
beginDate,
|
|
811
|
+
endDate,
|
|
812
|
+
};
|
|
813
|
+
const body = {
|
|
814
|
+
id: randomUUID(),
|
|
815
|
+
to: 'postmaster@desk.msging.net',
|
|
816
|
+
method: 'get',
|
|
817
|
+
uri: createUri('/analytics/reports/tags', params),
|
|
818
|
+
};
|
|
819
|
+
const response = await this.api.post('/commands', body);
|
|
820
|
+
validateResponse(response);
|
|
821
|
+
return response.data.resource.items;
|
|
822
|
+
}
|
|
823
|
+
catch (error) {
|
|
824
|
+
throw handleError(error);
|
|
825
|
+
}
|
|
826
|
+
}
|
|
827
|
+
}
|
|
828
|
+
|
|
829
|
+
class BlipThreads {
|
|
830
|
+
api;
|
|
831
|
+
constructor(context) {
|
|
832
|
+
this.api = context.api;
|
|
833
|
+
}
|
|
834
|
+
async getThread({ identity, refreshExpiredMedia, skip, take, messageId, storageDate, direction, getFromOriginator, }) {
|
|
835
|
+
const params = {
|
|
836
|
+
refreshExpiredMedia: refreshExpiredMedia ? 'true' : 'false',
|
|
837
|
+
$skip: skip,
|
|
838
|
+
$take: take,
|
|
839
|
+
messageId,
|
|
840
|
+
storageDate,
|
|
841
|
+
direction,
|
|
842
|
+
getFromOriginator,
|
|
843
|
+
};
|
|
844
|
+
try {
|
|
845
|
+
const response = await this.api.post('/commands', {
|
|
846
|
+
id: randomUUID(),
|
|
847
|
+
method: 'get',
|
|
848
|
+
uri: createUri(`/threads/${identity}`, params),
|
|
849
|
+
});
|
|
850
|
+
validateResponse(response);
|
|
851
|
+
return response.data.resource.items;
|
|
852
|
+
}
|
|
853
|
+
catch (error) {
|
|
854
|
+
throw handleError(error);
|
|
855
|
+
}
|
|
856
|
+
}
|
|
804
857
|
}
|
|
805
858
|
|
|
806
859
|
class Blip {
|
|
@@ -818,6 +871,7 @@ class Blip {
|
|
|
818
871
|
monitoring;
|
|
819
872
|
analytics;
|
|
820
873
|
campaign;
|
|
874
|
+
threads;
|
|
821
875
|
constructor(params) {
|
|
822
876
|
validateInstance(params);
|
|
823
877
|
this.api = axios.create({
|
|
@@ -840,6 +894,7 @@ class Blip {
|
|
|
840
894
|
this.monitoring = new BlipMonitoring({ api: this.api });
|
|
841
895
|
this.analytics = new BlipAnalytics({ api: this.api });
|
|
842
896
|
this.campaign = new BlipCampaign({ api: this.api });
|
|
897
|
+
this.threads = new BlipThreads({ api: this.api });
|
|
843
898
|
}
|
|
844
899
|
}
|
|
845
900
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { AxiosInstance } from 'axios';
|
|
2
|
-
import { TicketAnalyticsReport, TicketAnalyticsTimings } from '../types/analytics';
|
|
2
|
+
import { TagTicketsSummary, TicketAnalyticsReport, TicketAnalyticsTimings } from '../types/analytics';
|
|
3
3
|
export default class BlipAnalytics {
|
|
4
4
|
private api;
|
|
5
5
|
constructor(context: {
|
|
@@ -19,4 +19,11 @@ export default class BlipAnalytics {
|
|
|
19
19
|
beginDate?: string;
|
|
20
20
|
endDate?: string;
|
|
21
21
|
}): Promise<TicketAnalyticsTimings>;
|
|
22
|
+
/**
|
|
23
|
+
* Returns a summary of tickets grouped by tag. Dates are expected to be in yyyy-mm-dd format.
|
|
24
|
+
*/
|
|
25
|
+
getTagReports({ beginDate, endDate }?: {
|
|
26
|
+
beginDate?: string;
|
|
27
|
+
endDate?: string;
|
|
28
|
+
}): Promise<TagTicketsSummary[]>;
|
|
22
29
|
}
|
|
@@ -30,15 +30,15 @@ export default class BlipDispatch {
|
|
|
30
30
|
sendTemplateMessage({ identity, template, metadata, }: {
|
|
31
31
|
identity: string;
|
|
32
32
|
template: Template;
|
|
33
|
-
metadata?: string
|
|
33
|
+
metadata?: Record<string, string>;
|
|
34
34
|
}): Promise<void>;
|
|
35
35
|
/**
|
|
36
36
|
* Sends a simple text message to an active user. For sending messages to clients who have never interacted or are inactive, use `sendTemplate` instead.
|
|
37
37
|
*/
|
|
38
|
-
sendSimpleMessage({ identity, content, metadata }: {
|
|
38
|
+
sendSimpleMessage({ identity, content, metadata, }: {
|
|
39
39
|
identity: string;
|
|
40
40
|
content: string;
|
|
41
|
-
metadata?: string
|
|
41
|
+
metadata?: Record<string, string>;
|
|
42
42
|
}): Promise<void>;
|
|
43
43
|
/**
|
|
44
44
|
* Sends a text message to an active user with a midia. For sending messages to clients who have never interacted or are inactive, use `sendTemplate` instead.
|
|
@@ -48,7 +48,7 @@ export default class BlipDispatch {
|
|
|
48
48
|
uri: string;
|
|
49
49
|
identity: string;
|
|
50
50
|
text: string;
|
|
51
|
-
metadata?: string
|
|
51
|
+
metadata?: Record<string, string>;
|
|
52
52
|
title: string;
|
|
53
53
|
aspectRatio?: string;
|
|
54
54
|
size?: number;
|
|
@@ -59,6 +59,6 @@ export default class BlipDispatch {
|
|
|
59
59
|
identity: string;
|
|
60
60
|
message: string;
|
|
61
61
|
buttons: string[];
|
|
62
|
-
metadata?: string
|
|
62
|
+
metadata?: Record<string, string>;
|
|
63
63
|
}): Promise<void>;
|
|
64
64
|
}
|
|
@@ -12,6 +12,7 @@ import BlipContact from './blip-contact';
|
|
|
12
12
|
import BlipMonitoring from './blip-monitoring';
|
|
13
13
|
import BlipAnalytics from './blip-analytics';
|
|
14
14
|
import BlipCampaign from './blip-campaign';
|
|
15
|
+
import BlipThreads from './blip-threads';
|
|
15
16
|
export declare class Blip {
|
|
16
17
|
private api;
|
|
17
18
|
bucket: BlipBucket;
|
|
@@ -27,5 +28,6 @@ export declare class Blip {
|
|
|
27
28
|
monitoring: BlipMonitoring;
|
|
28
29
|
analytics: BlipAnalytics;
|
|
29
30
|
campaign: BlipCampaign;
|
|
31
|
+
threads: BlipThreads;
|
|
30
32
|
constructor(params: BlipConstructor);
|
|
31
33
|
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { AxiosInstance } from 'axios';
|
|
2
|
+
import { ThreadItem } from '../types/threads';
|
|
3
|
+
export default class BlipThreads {
|
|
4
|
+
private api;
|
|
5
|
+
constructor(context: {
|
|
6
|
+
api: AxiosInstance;
|
|
7
|
+
});
|
|
8
|
+
getThread({ identity, refreshExpiredMedia, skip, take, messageId, storageDate, direction, getFromOriginator, }: {
|
|
9
|
+
identity: string;
|
|
10
|
+
refreshExpiredMedia?: boolean;
|
|
11
|
+
skip?: number;
|
|
12
|
+
take?: number;
|
|
13
|
+
messageId?: string;
|
|
14
|
+
storageDate?: string;
|
|
15
|
+
direction?: 'asc' | 'desc';
|
|
16
|
+
getFromOriginator?: string;
|
|
17
|
+
}): Promise<ThreadItem[]>;
|
|
18
|
+
}
|