@albanian-xrm/cif-types 0.1.0 → 0.1.2

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/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # @albanian-xrm/cif-types
2
2
  Microsoft.CIFramework types from the community (us).
3
3
 
4
- Read more about Channel Integration Framework on the Microsoft Docs [here](https://learn.microsoft.com/en-us/dynamics365/customer-service/channel-integration-framework).
4
+ Read more about Channel Integration Framework on the Microsoft Docs [here](https://learn.microsoft.com/en-us/dynamics365/customer-service/channel-integration-framework/channel-integration-framework).
5
5
 
6
6
  These types are based on the api documentation on the Microsoft Docs [here](https://learn.microsoft.com/en-us/dynamics365/customer-service/channel-integration-framework/reference/microsoft-ciframework).
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@albanian-xrm/cif-types",
3
- "version": "0.1.0",
3
+ "version": "0.1.2",
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
- * Deletes an entity record.
118
- * @param entityLogicalName The entity logical name of the record you want to delete. For example: "account".
119
- * @param id GUID of the entity record you want to delete.
120
- * @returns On success, returns a promise containing a string with the attributes and their values.
121
- * @see {@link https://learn.microsoft.com/en-us/dynamics365/customer-service/channel-integration-framework/reference/microsoft-ciframework/deleterecord External Link: deleteRecord}
122
- * @example
123
- * // delete contact record with the id=b44d31ac-5fd1-e811-8158-000d3af97055d
124
- * var id = "b44d31ac-5fd1-e811-8158-000d3af97055";
125
- * var entityLogicalName = "contact";
126
- * Microsoft.CIFramework.deleteRecord(entityLogicalName, id).then(
127
- * function success(result) {
128
- * res=JSON.parse(result);
129
- * console.log("Contact deleted with ID: " + res.contactid);
130
- * // the record is deleted
131
- * },
132
- * function (error) {
133
- * console.log(error.message);
134
- * // handle error conditions
135
- * }
136
- * );
137
- */
138
- export function deleteRecord(
139
- entityLogicalName: string,
140
- id: string
141
- ): Promise<string>;
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
+ }
@@ -0,0 +1,219 @@
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
+ export interface ClickToAct {
164
+ value: any;
165
+ name: "string";
166
+ format: "string";
167
+ entityLogicalName: "string";
168
+ }
169
+
170
+ export interface ModeChanged {
171
+ value: PanelMode;
172
+ }
173
+
174
+ /**
175
+ * The onpagenavigate event is invoked when the main Unified Interface page navigation occurs. The eventData URL is the navigated Unified Interface page URL.
176
+ */
177
+ export interface PageNavigate {
178
+ /**
179
+ * url
180
+ */
181
+ value: string;
182
+ }
183
+
184
+ export interface SendKBArticle {
185
+ /**
186
+ * KB article title
187
+ */
188
+ title: string;
189
+ /**
190
+ * url
191
+ */
192
+ link: string;
193
+ }
194
+
195
+ export interface SizeChanged {
196
+ value: number;
197
+ }
198
+ }
199
+ }
200
+ }
201
+
202
+ interface Window {
203
+ /**
204
+ * The CIFInitDone event is raised by the Dynamics 365 Channel Integration Framework library when Channel Integration Framework is loaded.
205
+ * This event is used to determine whether the Channel Integration Framework APIs are ready to be consumed.
206
+ * @see {@link https://learn.microsoft.com/en-us/dynamics365/customer-service/channel-integration-framework/reference/events/cifinitdone External Link: CIFInitDone event}
207
+ * @example
208
+ * (function () {
209
+ * window.addEventListener("CIFInitDone", function () {
210
+ * //Code that consumes CIF library APIs.
211
+ * });
212
+ * })();
213
+ */
214
+ addEventListener(
215
+ type: "CIFInitDone",
216
+ listener: () => void,
217
+ options?: boolean | AddEventListenerOptions
218
+ ): void;
219
+ }
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,59 @@
1
+ declare namespace Microsoft {
2
+ namespace CIFramework {
3
+ /**
4
+ * Cancels the notification about incoming conversations based on the cancellation token.
5
+ * @param cancellationToken Unique string that was provided in the {@link notifyEvent} method to display notifications about incoming conversations.
6
+ * @param correlationId Used to group all related API calls together for diagnostic telemetry.
7
+ * @returns Returns the cancellation token.
8
+ * @see {@link https://learn.microsoft.com/en-us/dynamics365/customer-service/channel-integration-framework/v2/reference/microsoft-ciframework/cancelevent External Link: cancelEvent}
9
+ * @example
10
+ * // Trying to cancel a notification, use the same cancelToken passed during creation of notification in notifyEvent
11
+ * Microsoft.CIFramework.cancelEvent(CancelToken).then(
12
+ * function success(result) {
13
+ * console.log(result);
14
+ * // Perform operations
15
+ * },
16
+ * function (error) {
17
+ * console.log(error.message);
18
+ * // Handle error conditions
19
+ * }
20
+ * );
21
+ */
22
+ export function cancelEvent(
23
+ cancellationToken: string,
24
+ correlationId?: string
25
+ ): Promise<string>;
26
+
27
+ /**
28
+ * Displays a notification that can be used to inform the agent about incoming conversations.
29
+ * @param input JSON string
30
+ * @param correlationId Used to group all related API calls together for diagnostic telemetry.
31
+ * @param cancellationToken Is the unique string that's used by the {@link cancelEvent} method to cancel notifications about incoming conversations.
32
+ * @returns Returns a Boolean value of success.
33
+ * @see {@link https://learn.microsoft.com/en-us/dynamics365/customer-service/channel-integration-framework/v2/reference/microsoft-ciframework/notifyevent External Link: notifyEvent}
34
+ * @example
35
+ * var canceltoken = "cancellationtoken"+ Math.ceil(Math.random() * 100000 + 100000).toString();
36
+ *
37
+ * var input = {
38
+ * templateName: "msdyn_chat_incoming_unauthenticated", // unique name of the configured template
39
+ * templateParameters: {},
40
+ * cancellationToken: canceltoken // unique random token, to identify the notification during cancelEvent call
41
+ * }
42
+ * Microsoft.CIFramework.notifyEvent(input).then(
43
+ * function success(result) {
44
+ * console.log(result);
45
+ * // Perform operations
46
+ * },
47
+ * function (error) {
48
+ * console.log(error.message);
49
+ * // Handle error conditions
50
+ * }
51
+ * );
52
+ */
53
+ export function notifyEvent(
54
+ input: string,
55
+ correlationId?: string,
56
+ cancellationToken?: string
57
+ ): Promise<string>;
58
+ }
59
+ }
@@ -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" />