@albanian-xrm/cif-types 0.1.0 → 0.1.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/package.json +2 -2
- package/v1.0/CRUD.d.ts +27 -27
- package/v1.0/Context.d.ts +31 -0
- package/v1.0/Events.d.ts +213 -0
- package/v1.0/index.d.ts +1 -0
- package/v2.0/Presence.d.ts +46 -0
- package/v2.0/index.d.ts +2 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@albanian-xrm/cif-types",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"description": "Microsoft.CIFramework types from the community (us).",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -18,4 +18,4 @@
|
|
|
18
18
|
"url": "https://github.com/albanian-xrm/cif-types/issues"
|
|
19
19
|
},
|
|
20
20
|
"homepage": "https://github.com/albanian-xrm/cif-types#readme"
|
|
21
|
-
}
|
|
21
|
+
}
|
package/v1.0/CRUD.d.ts
CHANGED
|
@@ -111,32 +111,32 @@ declare namespace Microsoft {
|
|
|
111
111
|
id: string,
|
|
112
112
|
data: string
|
|
113
113
|
): Promise<string>;
|
|
114
|
-
}
|
|
115
114
|
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
115
|
+
/**
|
|
116
|
+
* Deletes an entity record.
|
|
117
|
+
* @param entityLogicalName The entity logical name of the record you want to delete. For example: "account".
|
|
118
|
+
* @param id GUID of the entity record you want to delete.
|
|
119
|
+
* @returns On success, returns a promise containing a string with the attributes and their values.
|
|
120
|
+
* @see {@link https://learn.microsoft.com/en-us/dynamics365/customer-service/channel-integration-framework/reference/microsoft-ciframework/deleterecord External Link: deleteRecord}
|
|
121
|
+
* @example
|
|
122
|
+
* // delete contact record with the id=b44d31ac-5fd1-e811-8158-000d3af97055d
|
|
123
|
+
* var id = "b44d31ac-5fd1-e811-8158-000d3af97055";
|
|
124
|
+
* var entityLogicalName = "contact";
|
|
125
|
+
* Microsoft.CIFramework.deleteRecord(entityLogicalName, id).then(
|
|
126
|
+
* function success(result) {
|
|
127
|
+
* res=JSON.parse(result);
|
|
128
|
+
* console.log("Contact deleted with ID: " + res.contactid);
|
|
129
|
+
* // the record is deleted
|
|
130
|
+
* },
|
|
131
|
+
* function (error) {
|
|
132
|
+
* console.log(error.message);
|
|
133
|
+
* // handle error conditions
|
|
134
|
+
* }
|
|
135
|
+
* );
|
|
136
|
+
*/
|
|
137
|
+
export function deleteRecord(
|
|
138
|
+
entityLogicalName: string,
|
|
139
|
+
id: string
|
|
140
|
+
): Promise<string>;
|
|
141
|
+
}
|
|
142
142
|
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
declare namespace Microsoft {
|
|
2
|
+
namespace CIFramework {
|
|
3
|
+
/**
|
|
4
|
+
* This method allows you to set automation dictionary. It enables providers to add, modify and remove values of slugs and the updated values are subsequently available for future macro invocations.
|
|
5
|
+
* @param input JSON string
|
|
6
|
+
* @param sessionId Unique identifier of the current session.
|
|
7
|
+
* @param isDelete Set isDelete to `true` if the list of parameters in input JSON are to be deleted. If isDelete is set to `true`, the slug values will be deleted and will no longer be available for subsequent macro invocations.
|
|
8
|
+
* @param correlationId Used to group all related API calls together for diagnostic telemetry
|
|
9
|
+
* @returns Returns a promise with string value.
|
|
10
|
+
* @see {@link https://learn.microsoft.com/en-us/dynamics365/customer-service/channel-integration-framework/reference/microsoft-ciframework/updatecontext External Link: updateContext}
|
|
11
|
+
* @example
|
|
12
|
+
* var input = { "customerName" : "Contosso" };
|
|
13
|
+
* Microsoft.CIFramework.updateContext(input).then(
|
|
14
|
+
* function success(result) {
|
|
15
|
+
* console.log(result);
|
|
16
|
+
* // Perform operations upon record retrieval and opening
|
|
17
|
+
* },
|
|
18
|
+
* function (error) {
|
|
19
|
+
* console.log(error.message);
|
|
20
|
+
* // Handle error conditions
|
|
21
|
+
* }
|
|
22
|
+
* );
|
|
23
|
+
*/
|
|
24
|
+
export function updateContext(
|
|
25
|
+
input: string,
|
|
26
|
+
sessionId?: string,
|
|
27
|
+
isDelete?: boolean,
|
|
28
|
+
correlationId?: string
|
|
29
|
+
): Promise<string>;
|
|
30
|
+
}
|
|
31
|
+
}
|
package/v1.0/Events.d.ts
ADDED
|
@@ -0,0 +1,213 @@
|
|
|
1
|
+
declare namespace Microsoft {
|
|
2
|
+
namespace CIFramework {
|
|
3
|
+
/**
|
|
4
|
+
* Adds the subscriber to the events.
|
|
5
|
+
* @remark This API can be used on both the widget and Unified Interface page.
|
|
6
|
+
* @param eventName Name of the event for which the handler is set. The supported events are as follows:
|
|
7
|
+
* * onClickToAct - The event is invoked when the outbound communication (ClickToAct) field is enabled.
|
|
8
|
+
* * onModeChanged - The event is invoked when the panel mode is manually toggled between Minimized (0) and Docked (1).
|
|
9
|
+
* * onSizeChanged - The event is invoked when the panel size is manually changed by dragging.
|
|
10
|
+
* * onPageNavigate - The event is triggered before a navigation event occurs on the main page.
|
|
11
|
+
* * onSendKBArticle - The event is invoked when the user selects the Send button on the KB control.
|
|
12
|
+
*
|
|
13
|
+
* You can also pass custom events in the `eventName` parameter.
|
|
14
|
+
* @param handlerFunction The handler function is invoked when any of the supported events are triggered.
|
|
15
|
+
* @returns Promise with a value as Boolean.
|
|
16
|
+
* @see {@link https://learn.microsoft.com/en-us/dynamics365/customer-service/channel-integration-framework/reference/microsoft-ciframework/raiseevent External Link: raiseEvent}
|
|
17
|
+
* @example
|
|
18
|
+
* handlerFunction = function(eventData) {
|
|
19
|
+
* console.log(eventData)
|
|
20
|
+
* return Promise.resolve();
|
|
21
|
+
* }
|
|
22
|
+
*
|
|
23
|
+
* Microsoft.CIFramework.addHandler("onmodechanged", handlerFunction);
|
|
24
|
+
*/
|
|
25
|
+
export function addHandler(
|
|
26
|
+
eventName: string,
|
|
27
|
+
handlerFunction: (...args) => Promise<void>
|
|
28
|
+
): Promise<boolean>;
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Adds the subscriber to the events. The event is invoked when the panel mode is manually toggled between Minimized (0) and Docked (1).
|
|
32
|
+
* @remark This API can be used on both the widget and Unified Interface page.
|
|
33
|
+
* @param eventName Name of the event for which the handler is set. The event is invoked when the outbound communication (ClickToAct) field is enabled.
|
|
34
|
+
* @param handlerFunction The handler function is invoked when any of the supported events are triggered.
|
|
35
|
+
* @returns Promise with a value as Boolean.
|
|
36
|
+
* @see {@link https://learn.microsoft.com/en-us/dynamics365/customer-service/channel-integration-framework/reference/microsoft-ciframework/raiseevent External Link: raiseEvent}
|
|
37
|
+
*/
|
|
38
|
+
export function addHandler(
|
|
39
|
+
eventName: "onclicktoact",
|
|
40
|
+
handlerFunction: (eventData: EventArgs.ClickToAct) => Promise<void>
|
|
41
|
+
): Promise<boolean>;
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Adds the subscriber to the events. The event is invoked when the panel mode is manually toggled between Minimized (0) and Docked (1).
|
|
45
|
+
* @remark This API can be used on both the widget and Unified Interface page.
|
|
46
|
+
* @param eventName Name of the event for which the handler is set. The 'OnModeChanged' event is invoked when the panel mode is manually toggled between Minimized (0) and Docked (1).
|
|
47
|
+
* @param handlerFunction The handler function is invoked when any of the supported events are triggered.
|
|
48
|
+
* @returns Promise with a value as Boolean.
|
|
49
|
+
* @see {@link https://learn.microsoft.com/en-us/dynamics365/customer-service/channel-integration-framework/reference/microsoft-ciframework/raiseevent External Link: raiseEvent}
|
|
50
|
+
* @example
|
|
51
|
+
* handlerFunction = function(eventData) {
|
|
52
|
+
* console.log(eventData)
|
|
53
|
+
* return Promise.resolve();
|
|
54
|
+
* }
|
|
55
|
+
*
|
|
56
|
+
* Microsoft.CIFramework.addHandler("onmodechanged", handlerFunction);
|
|
57
|
+
*/
|
|
58
|
+
export function addHandler(
|
|
59
|
+
eventName: "onmodechanged",
|
|
60
|
+
handlerFunction: (eventData: EventArgs.ModeChanged) => Promise<void>
|
|
61
|
+
): Promise<boolean>;
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* Adds the subscriber to the events. The event is triggered before a navigation event occurs on the main page.
|
|
65
|
+
* @remark This API can be used on both the widget and Unified Interface page.
|
|
66
|
+
* @param eventName Name of the event for which the handler is set.
|
|
67
|
+
* @param handlerFunction The handler function is invoked when any of the supported events are triggered.
|
|
68
|
+
* @returns Promise with a value as Boolean.
|
|
69
|
+
* @see {@link https://learn.microsoft.com/en-us/dynamics365/customer-service/channel-integration-framework/reference/microsoft-ciframework/raiseevent External Link: raiseEvent}
|
|
70
|
+
*/
|
|
71
|
+
export function addHandler(
|
|
72
|
+
eventName: "onpagenavigate",
|
|
73
|
+
handlerFunction: (eventData: EventArgs.PageNavigate) => Promise<void>
|
|
74
|
+
): Promise<boolean>;
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* Adds the subscriber to the events. The event is invoked when the user selects the Send button on the KB control.
|
|
78
|
+
* @remark This API can be used on both the widget and Unified Interface page.
|
|
79
|
+
* @param eventName Name of the event for which the handler is set.
|
|
80
|
+
* @param handlerFunction The handler function is invoked when any of the supported events are triggered.
|
|
81
|
+
* @returns Promise with a value as Boolean.
|
|
82
|
+
* @see {@link https://learn.microsoft.com/en-us/dynamics365/customer-service/channel-integration-framework/reference/microsoft-ciframework/raiseevent External Link: raiseEvent}
|
|
83
|
+
*/
|
|
84
|
+
export function addHandler(
|
|
85
|
+
eventName: "onsendkbarticle",
|
|
86
|
+
handlerFunction: (eventData: EventArgs.SendKBArticle) => Promise<void>
|
|
87
|
+
): Promise<boolean>;
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* Adds the subscriber to the events. The event is invoked when the panel size is manually changed by dragging.
|
|
91
|
+
* @remark This API can be used on both the widget and Unified Interface page.
|
|
92
|
+
* @param eventName Name of the event for which the handler is set.
|
|
93
|
+
* @param handlerFunction The handler function is invoked when any of the supported events are triggered.
|
|
94
|
+
* @returns Promise with a value as Boolean.
|
|
95
|
+
* @see {@link https://learn.microsoft.com/en-us/dynamics365/customer-service/channel-integration-framework/reference/microsoft-ciframework/raiseevent External Link: raiseEvent}
|
|
96
|
+
*/
|
|
97
|
+
export function addHandler(
|
|
98
|
+
eventName: "onsizechanged",
|
|
99
|
+
handlerFunction: (eventData: EventArgs.SizeChanged) => Promise<void>
|
|
100
|
+
): Promise<boolean>;
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* Invokes the associated subscriber for the event.
|
|
104
|
+
* @param eventName Name of the event whose handler needs to be invoked.
|
|
105
|
+
* @param eventInputParameters The input parameters that need to be passed to the handler function.
|
|
106
|
+
* @param correlationId Is used to group all related API calls together for diagnostic telemetry.
|
|
107
|
+
* @remark If you've created custom events using the {@link addHandler} method, then you can raise those events by passing the event name as parameter in this method.
|
|
108
|
+
* @returns Promise with a value as Boolean.
|
|
109
|
+
* @see {@link https://learn.microsoft.com/en-us/dynamics365/customer-service/channel-integration-framework/reference/microsoft-ciframework/raiseevent External Link: raiseEvent}
|
|
110
|
+
* @example
|
|
111
|
+
* // Let there be an event registered to a subscriber.
|
|
112
|
+
* handlerFunction = function(eventInput)
|
|
113
|
+
* {
|
|
114
|
+
* console.log(eventInput);
|
|
115
|
+
* if(eventInput != null && eventInput != undefined && eventInput.size > 0)
|
|
116
|
+
* {
|
|
117
|
+
* inputData = eventInput.get("value");
|
|
118
|
+
* correlationId = eventInput.get("correlationId");
|
|
119
|
+
* console.log(inputData + " " + correlationId);
|
|
120
|
+
* }
|
|
121
|
+
* return Promise.resolve();
|
|
122
|
+
* }
|
|
123
|
+
* Microsoft.CIFramework.addHandler("oncustomevent", handlerFunction);
|
|
124
|
+
* //Use raiseEvent API to invoke the subscribed handler of the event.
|
|
125
|
+
* Microsoft.CIFramework.raiseEvent("oncustomevent", "test input value");
|
|
126
|
+
*
|
|
127
|
+
* //In the main UCI page
|
|
128
|
+
* Microsoft.CIFramework.addHandler("widgetEvent", handlerFunction);
|
|
129
|
+
* ///In the widget code
|
|
130
|
+
* Microsoft.CIFramework.raiseEvent("widgetEvent", eventInput);
|
|
131
|
+
*
|
|
132
|
+
* //In the widget code
|
|
133
|
+
* Microsoft.CIFramework.addHandler("mainPageEvent", handlerFunction);
|
|
134
|
+
* //In the main UCI page
|
|
135
|
+
* Microsoft.CIFramework.raiseEvent("mainPageEvent", eventInput);
|
|
136
|
+
*/
|
|
137
|
+
export function raiseEvent(
|
|
138
|
+
eventName: string,
|
|
139
|
+
eventInputParameters: string,
|
|
140
|
+
correlationId?: string
|
|
141
|
+
): Promise<boolean>;
|
|
142
|
+
|
|
143
|
+
/**
|
|
144
|
+
* Removes the subscriber from the events.
|
|
145
|
+
* @remark This API can be used on both the widget and Unified Interface page.
|
|
146
|
+
* @param eventName Name of the event for which the handler is set. The supported events are as follows:
|
|
147
|
+
* * onClickToAct - The event is invoked when the outbound communication (ClickToAct) field is enabled.
|
|
148
|
+
* * onModeChanged - The event is invoked when the panel mode is manually toggled between Minimized (0) and Docked (1).
|
|
149
|
+
* * onSizeChanged - The event is invoked when the panel size is manually changed by dragging.
|
|
150
|
+
* * onPageNavigate - The event is triggered before a navigation event occurs on the main page.
|
|
151
|
+
* * onSendKBArticle - The event is invoked when the user selects the Send button on the KB control.
|
|
152
|
+
*
|
|
153
|
+
* You can also pass custom events in the `eventName` parameter.
|
|
154
|
+
* @param handlerFunction The handler function that is to removed.
|
|
155
|
+
* @see {@link https://learn.microsoft.com/en-us/dynamics365/customer-service/channel-integration-framework/reference/microsoft-ciframework/raiseevent External Link: raiseEvent}
|
|
156
|
+
*/
|
|
157
|
+
export function removeHandler(
|
|
158
|
+
eventName: string,
|
|
159
|
+
handlerFunction: (eventData: EventArgs.SizeChanged) => Promise<void>
|
|
160
|
+
): void;
|
|
161
|
+
|
|
162
|
+
namespace EventArgs {
|
|
163
|
+
/**
|
|
164
|
+
* The CIFInitDone event is raised by the Dynamics 365 Channel Integration Framework library when Channel Integration Framework is loaded.
|
|
165
|
+
* This event is used to determine whether the Channel Integration Framework APIs are ready to be consumed.
|
|
166
|
+
* @see {@link https://learn.microsoft.com/en-us/dynamics365/customer-service/channel-integration-framework/reference/events/cifinitdone External Link: CIFInitDone event}
|
|
167
|
+
* @example
|
|
168
|
+
* (function () {
|
|
169
|
+
* window.addEventListener("CIFInitDone", function () {
|
|
170
|
+
* //Code that consumes CIF library APIs.
|
|
171
|
+
* });
|
|
172
|
+
* })();
|
|
173
|
+
*/
|
|
174
|
+
export interface CIFInitDone {}
|
|
175
|
+
|
|
176
|
+
export interface ClickToAct {
|
|
177
|
+
value: any;
|
|
178
|
+
name: "string";
|
|
179
|
+
format: "string";
|
|
180
|
+
entityLogicalName: "string";
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
export interface ModeChanged {
|
|
184
|
+
value: PanelMode;
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
/**
|
|
188
|
+
* The onpagenavigate event is invoked when the main Unified Interface page navigation occurs. The eventData URL is the navigated Unified Interface page URL.
|
|
189
|
+
*/
|
|
190
|
+
export interface PageNavigate {
|
|
191
|
+
/**
|
|
192
|
+
* url
|
|
193
|
+
*/
|
|
194
|
+
value: string;
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
export interface SendKBArticle {
|
|
198
|
+
/**
|
|
199
|
+
* KB article title
|
|
200
|
+
*/
|
|
201
|
+
title: string;
|
|
202
|
+
/**
|
|
203
|
+
* url
|
|
204
|
+
*/
|
|
205
|
+
link: string;
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
export interface SizeChanged {
|
|
209
|
+
value: number;
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
}
|
package/v1.0/index.d.ts
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
/// <reference path="./CRUD.d.ts" />
|
|
3
3
|
/// <reference path="./EntityMetadata.d.ts" />
|
|
4
4
|
/// <reference path="./Environment.d.ts" />
|
|
5
|
+
/// <reference path="./Events.d.ts" />
|
|
5
6
|
/// <reference path="./PanelMode.d.ts" />
|
|
6
7
|
/// <reference path="./PanelWidth.d.ts" />
|
|
7
8
|
/// <reference path="./Search.d.ts" />
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
declare namespace Microsoft {
|
|
2
|
+
namespace CIFramework {
|
|
3
|
+
/**
|
|
4
|
+
* Returns the presence text of the agent in the client session.
|
|
5
|
+
* @returns Promise with the presence text of the current agent, as String.
|
|
6
|
+
* @see {@link https://learn.microsoft.com/en-us/dynamics365/customer-service/channel-integration-framework/v2/reference/microsoft-ciframework/getpresence External Link: getPresence}
|
|
7
|
+
* @example
|
|
8
|
+
* function getPresence() {
|
|
9
|
+
* return new Promise((resolve, reject) => {
|
|
10
|
+
* Microsoft.CIFramework.getPresence().then(
|
|
11
|
+
* function (result) {
|
|
12
|
+
* if (result == "FAILED")
|
|
13
|
+
* //your code handling for failure
|
|
14
|
+
* else {
|
|
15
|
+
* //your code for success
|
|
16
|
+
* }
|
|
17
|
+
* return result;
|
|
18
|
+
* },
|
|
19
|
+
* function (error) {
|
|
20
|
+
* // code handling for promise failure
|
|
21
|
+
* });
|
|
22
|
+
* });
|
|
23
|
+
*/
|
|
24
|
+
export function getPresence(): Promise<string>;
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Sets the presence text of the agent in the client session.
|
|
28
|
+
* @param presenceText Presence text for current agent in Omnichannel for Customer Service. For the presence to be set correctly, the string should exactly match the text used in the admin app. To create custom presence, see {@link https://learn.microsoft.com/en-us/dynamics365/customer-service/presence-custom-presence External Link: Configure and manage custom presence} .
|
|
29
|
+
* @returns Returns a Boolean value of success.
|
|
30
|
+
* @see {@link https://learn.microsoft.com/en-us/dynamics365/customer-service/channel-integration-framework/v2/reference/microsoft-ciframework/setpresence External Link: setPresence}
|
|
31
|
+
* @example
|
|
32
|
+
* Microsoft.CIFramework.setPresence(custompresence).then(
|
|
33
|
+
* function (result) {
|
|
34
|
+
* if(!result)
|
|
35
|
+
* //code handling when OC Presence is in error
|
|
36
|
+
* else
|
|
37
|
+
* //code handling for success
|
|
38
|
+
* },
|
|
39
|
+
* function (error) {
|
|
40
|
+
* reject(error);
|
|
41
|
+
* });
|
|
42
|
+
*
|
|
43
|
+
*/
|
|
44
|
+
export function setPresence(presenceText: string): Promise<boolean>;
|
|
45
|
+
}
|
|
46
|
+
}
|
package/v2.0/index.d.ts
CHANGED
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
/// <reference path="../v1.0/CRUD.d.ts" />
|
|
3
3
|
/// <reference path="../v1.0/EntityMetadata.d.ts" />
|
|
4
4
|
/// <reference path="../v1.0/Environment.d.ts" />
|
|
5
|
+
/// <reference path="../v1.0/Events.d.ts" />
|
|
5
6
|
/// <reference path="./PanelMode.d.ts" />
|
|
6
7
|
/// <reference path="../v1.0/PanelWidth.d.ts" />
|
|
8
|
+
/// <reference path="./Presence.d.ts" />
|
|
7
9
|
/// <reference path="../v1.0/Search.d.ts" />
|