@albanian-xrm/cif-types 0.1.5 → 0.1.6

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
@@ -11,17 +11,17 @@ To use the types install `@albanian-xrm/cif-types` and add the following to your
11
11
  ```json
12
12
  "compilerOptions": {
13
13
  "types": [
14
- "@albanian-xrm/cif-types/v1.0"
14
+ "@albanian-xrm/cif-types"
15
15
  ]
16
16
  }
17
17
  ```
18
18
 
19
- If you want CIFv2 then use the following configuration:
19
+ If you want CIFv1 then use the following configuration:
20
20
 
21
21
  ```json
22
22
  "compilerOptions": {
23
23
  "types": [
24
- "@albanian-xrm/cif-types"
24
+ "@albanian-xrm/cif-types/v1.0"
25
25
  ]
26
26
  }
27
27
  ```
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@albanian-xrm/cif-types",
3
- "version": "0.1.5",
3
+ "version": "0.1.6",
4
4
  "description": "Microsoft.CIFramework types from the community (us).",
5
5
  "repository": {
6
6
  "type": "git",
@@ -13,6 +13,6 @@ declare namespace Microsoft {
13
13
  * @returns Returns Promise object without value.
14
14
  * @see {@link https://learn.microsoft.com/en-us/dynamics365/channel-integration-framework/v1/develop/reference/microsoft-ciframework/setclicktoact External Link: setClickToAct}
15
15
  */
16
- export function setClickToAct(value: boolean): Promise<boolean>;
16
+ export function setClickToAct(value: boolean): Promise<void>;
17
17
  }
18
18
  }
package/v1.0/Events.d.ts CHANGED
@@ -24,7 +24,7 @@ declare namespace Microsoft {
24
24
  */
25
25
  export function addHandler(
26
26
  eventName: string,
27
- handlerFunction: (...args) => Promise<void>
27
+ handlerFunction: (...args) => (void | Promise<void>)
28
28
  ): Promise<boolean>;
29
29
 
30
30
  /**
@@ -37,7 +37,7 @@ declare namespace Microsoft {
37
37
  */
38
38
  export function addHandler(
39
39
  eventName: "onclicktoact",
40
- handlerFunction: (eventData: EventArgs.ClickToAct) => Promise<void>
40
+ handlerFunction: (eventData: EventArgs.ClickToAct) => (void | Promise<void>)
41
41
  ): Promise<boolean>;
42
42
 
43
43
  /**
@@ -57,7 +57,7 @@ declare namespace Microsoft {
57
57
  */
58
58
  export function addHandler(
59
59
  eventName: "onmodechanged",
60
- handlerFunction: (eventData: EventArgs.ModeChanged) => Promise<void>
60
+ handlerFunction: (eventData: EventArgs.ModeChanged) => (void | Promise<void>)
61
61
  ): Promise<boolean>;
62
62
 
63
63
  /**
@@ -70,7 +70,7 @@ declare namespace Microsoft {
70
70
  */
71
71
  export function addHandler(
72
72
  eventName: "onpagenavigate",
73
- handlerFunction: (eventData: EventArgs.PageNavigate) => Promise<void>
73
+ handlerFunction: (eventData: EventArgs.PageNavigate) => (void | Promise<void>)
74
74
  ): Promise<boolean>;
75
75
 
76
76
  /**
@@ -83,7 +83,7 @@ declare namespace Microsoft {
83
83
  */
84
84
  export function addHandler(
85
85
  eventName: "onsendkbarticle",
86
- handlerFunction: (eventData: EventArgs.SendKBArticle) => Promise<void>
86
+ handlerFunction: (eventData: EventArgs.SendKBArticle) => (void | Promise<void>)
87
87
  ): Promise<boolean>;
88
88
 
89
89
  /**
@@ -96,7 +96,7 @@ declare namespace Microsoft {
96
96
  */
97
97
  export function addHandler(
98
98
  eventName: "onsizechanged",
99
- handlerFunction: (eventData: EventArgs.SizeChanged) => Promise<void>
99
+ handlerFunction: (eventData: EventArgs.SizeChanged) => (void | Promise<void>)
100
100
  ): Promise<boolean>;
101
101
 
102
102
  /**
@@ -156,7 +156,7 @@ declare namespace Microsoft {
156
156
  */
157
157
  export function removeHandler(
158
158
  eventName: string,
159
- handlerFunction: (eventData: EventArgs.SizeChanged) => Promise<void>
159
+ handlerFunction: (eventData: EventArgs.SizeChanged) => (void | Promise<void>)
160
160
  ): void;
161
161
 
162
162
  namespace EventArgs {
@@ -0,0 +1,97 @@
1
+ declare namespace Microsoft {
2
+ namespace CIFramework {
3
+ /**
4
+ * Creates a tab in a focused session and returns the unique identifier of the created tab.
5
+ * @param input JSON input
6
+ * @param correlationId Used to group all related API calls together for diagnostic telemetry
7
+ * @returns None.
8
+ * @remarks Use this API only when the focused session belongs to the provider or if it is the home or default session.
9
+ * @see {@link https://learn.microsoft.com/en-us/dynamics365/channel-integration-framework/v2/develop/reference/microsoft-ciframework/closetab External Link: closeTab}
10
+ */
11
+ export function closeTab(input: TabInput,correlationId?: string): Promise<void>;
12
+
13
+ /**
14
+ * Creates a tab in a focused session and returns the unique identifier of the created tab.
15
+ * @param input JSON input
16
+ * @param correlationId Used to group all related API calls together for diagnostic telemetry
17
+ * @returns Promise with the value of tab ID as String.
18
+ * @remarks Use this API only when the focused session belongs to the provider or if it is the home or default session.
19
+ * @see {@link https://learn.microsoft.com/en-us/dynamics365/channel-integration-framework/v2/develop/reference/microsoft-ciframework/createtab External Link: createTab}
20
+ */
21
+ export function createTab(input: TabInput,correlationId?: string): Promise<string>;
22
+
23
+ /**
24
+ * Sets the focus on a tab, if:
25
+ * - The focused session belongs to the provider or if it is either the home or default session.
26
+ * - The tab belongs to the session in focus.
27
+ * @param tabId Unique identifier of the tab
28
+ * @param correlationId Used to group all related API calls together for diagnostic telemetry
29
+ * @returns Promise with no value.
30
+ * @remarks Use this API only when the focused session belongs to the provider or if it is the home or default session.
31
+ * @see {@link https://learn.microsoft.com/en-us/dynamics365/channel-integration-framework/v2/develop/reference/microsoft-ciframework/focustab External Link: focusTab}
32
+ */
33
+ export function focusTab(tabId: string, correlationId?: string): Promise<void>;
34
+
35
+ /**
36
+ * Returns the focused tab's identifier in a focused session, if the session belongs to the channel provider.
37
+ * @param correlationId Used to group all related API calls together for diagnostic telemetry
38
+ * @returns Promise with the value as String
39
+ * @remarks Use this API only when the focused session belongs to the provider or if it is the home or default session.
40
+ * @see {@link https://learn.microsoft.com/en-us/dynamics365/channel-integration-framework/v2/develop/reference/microsoft-ciframework/getfocusedtab External Link: getFocusedTab}
41
+ */
42
+ export function getFocusedTab(correlationId?: string): Promise<string>;
43
+
44
+ /**
45
+ * Returns an array of tab Ids associated with template name or template tags for tabs in the session in focus, if the session belongs to the channel provider.
46
+ * @param tabtemplatename Unique Name of the application tab template
47
+ * @param tags Tags associated with the application tab
48
+ * @param correlationId Used to group all related API calls together for diagnostic telemetry
49
+ * @returns Promise with the value of tab ID as String.
50
+ * @remarks Use this API only when the focused session belongs to the provider or if it is the home or default session.
51
+ * @see {@link https://learn.microsoft.com/en-us/dynamics365/channel-integration-framework/v2/develop/reference/microsoft-ciframework/gettabs External Link: getTabs}
52
+ */
53
+ export function getTabs(tabtemplatename?: string, tags?:string, correlationId?: string): Promise<string[]>;
54
+
55
+ /**
56
+ * Refreshes the tab.
57
+ * @param tabId Unique identifier of the tab
58
+ * @param correlationId Used to group all related API calls together for diagnostic telemetry
59
+ * @returns Promise with no value.
60
+ * @remarks Use this API only when the focused session belongs to the provider or if it is the home or default session.
61
+ * @see {@link https://learn.microsoft.com/en-us/dynamics365/channel-integration-framework/v2/develop/reference/microsoft-ciframework/refreshtab External Link: refreshTab}
62
+ */
63
+ export function refreshTab(tabId: string, correlationId?: string): Promise<void>;
64
+
65
+ /**
66
+ * Refreshes the tab.
67
+ * @param tabId Unique identifier of the tab
68
+ * @param title JSON containing the title of the tab.
69
+ * @param correlationId Used to group all related API calls together for diagnostic telemetry
70
+ * @returns none.
71
+ * @remarks Use this API only when the focused session belongs to the provider or if it is the home or default session.
72
+ * @see {@link https://learn.microsoft.com/en-us/dynamics365/channel-integration-framework/v2/develop/reference/microsoft-ciframework/settabtitle External Link: setTabTitle}
73
+ */
74
+ export function setTabTitle(tabId: string, title: TabTitle, correlationId?: string): Promise<void>;
75
+
76
+ export type TabInput = {
77
+ /**
78
+ * Unique name of the tab
79
+ */
80
+ templateName: string;
81
+
82
+ /**
83
+ * Additional context for tab creation and tab slugs
84
+ */
85
+ templateParameters?: { [key: string]: string;};
86
+
87
+ /**
88
+ * Should this tab be focused after the creation
89
+ */
90
+ isFocused?: boolean;
91
+ };
92
+
93
+ export type TabTitle = {
94
+ title: string;
95
+ }
96
+ }
97
+ }
@@ -0,0 +1,64 @@
1
+ declare namespace Microsoft {
2
+ namespace CIFramework {
3
+ /**
4
+ * Invoke this method to log analytics for custom events.
5
+ * @param data Key-value pairs representing the analytics data to be logged.
6
+ * @param eventName Name of the event to be logged.
7
+ * @param correlationId Used to group all related API calls together for diagnostic telemetry
8
+ * @returns Promise with value as string
9
+ * @see {@link https://learn.microsoft.com/en-us/dynamics365/channel-integration-framework/v2/develop/reference/microsoft-ciframework/loganalyticsevent External Link: logAnalyticsEvent}
10
+ */
11
+ export function logAnalyticsEvent(data: AnalyticsData, eventName:string, correlationId?: string): Promise<string>;
12
+
13
+ interface AnalyticsData {
14
+ /**
15
+ * Conversation identifier
16
+ */
17
+ conversationId?: string;
18
+ /**
19
+ * Channel Integration Framework Provider Id
20
+ */
21
+ providerSessionId?: string;
22
+ /**
23
+ * Client session identifier
24
+ */
25
+ clientSessionId?: string;
26
+ /**
27
+ * Participant identifier
28
+ */
29
+ participantId?: string;
30
+ events?: AnalyticsEventData[];
31
+ }
32
+
33
+ interface AnalyticsEventData{
34
+ /**
35
+ * Name of the associated KPI event
36
+ */
37
+ kpiEventName?: string;
38
+ /**
39
+ * Reason due to which the KPI event was created
40
+ */
41
+ kpiEventReason?: string;
42
+ /**
43
+ * Timestamp at which the event occurred
44
+ */
45
+ eventTimestamp?: string;
46
+ /**
47
+ * Additional data related to the session
48
+ */
49
+ additionalData?: string;
50
+ /**
51
+ * Agent notification response action value
52
+ */
53
+ notificationResponseAction?: string;
54
+ /**
55
+ * External system correlation Id
56
+ */
57
+ externalCorrelationId?: string;
58
+ /**
59
+ * Custom data
60
+ */
61
+ customData?: {attribute: string; value: string}[];
62
+ }
63
+ }
64
+ }
@@ -18,6 +18,6 @@ declare namespace Microsoft {
18
18
  export function setClickToAct(
19
19
  value: boolean,
20
20
  correlationId?: string
21
- ): Promise<boolean>;
21
+ ): Promise<void>;
22
22
  }
23
23
  }
@@ -1,7 +1,7 @@
1
1
  declare namespace Microsoft {
2
2
  namespace CIFramework {
3
3
  /**
4
- * This method allows you to update a Conversation(msdyn_ocliveworkitem) record.
4
+ * This method allows you to update a Conversation({@link https://learn.microsoft.com/en-us/dynamics365/customer-service/develop/reference/entities/msdyn_ocliveworkitem msdyn_ocliveworkitem}) record.
5
5
  * @param id Unique identifier of the conversation returned by {@link Microsoft.CIFramework.getSession Microsoft.CIFramework.getSession} API.
6
6
  * @param data JSON string
7
7
  * @param correlationId Used to group all related API calls together for diagnostic telemetry
@@ -29,7 +29,7 @@ declare namespace Microsoft {
29
29
  * @param input JSON string
30
30
  * @param correlationId Used to group all related API calls together for diagnostic telemetry.
31
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.
32
+ * @returns Returns a Promise with a string value.
33
33
  * @see {@link https://learn.microsoft.com/en-us/dynamics365/channel-integration-framework/v2/develop/reference/microsoft-ciframework/notifyevent External Link: notifyEvent}
34
34
  * @example
35
35
  * var canceltoken = "cancellationtoken"+ Math.ceil(Math.random() * 100000 + 100000).toString();
@@ -53,7 +53,10 @@ declare namespace Microsoft {
53
53
  export function notifyEvent(
54
54
  input: NotifyEventArgs,
55
55
  correlationId?: string
56
- ): Promise<string>;
56
+ ): Promise<'{actionName: "Timeout", responseReason: "DisplayTimeout"}' |
57
+ '{actionName: "Reject", responseReason: "DeclinedByAgent"}' |
58
+ '{"actionName":"Accept","responseReason":"Accept"}' |
59
+ void>;
57
60
 
58
61
  export interface NotifyEventArgs {
59
62
  eventType?: string;
@@ -2,6 +2,7 @@ declare namespace Microsoft {
2
2
  namespace CIFramework {
3
3
  /**
4
4
  * Returns the presence text of the agent in the client session.
5
+ * @param correlationId Used to group all related API calls together for diagnostic telemetry
5
6
  * @returns Promise with the presence text of the current agent, as String.
6
7
  * @see {@link https://learn.microsoft.com/en-us/dynamics365/channel-integration-framework/v2/develop/reference/microsoft-ciframework/getpresence External Link: getPresence}
7
8
  * @example
@@ -21,11 +22,12 @@ declare namespace Microsoft {
21
22
  * });
22
23
  * });
23
24
  */
24
- export function getPresence(): Promise<string>;
25
+ export function getPresence(correlationId?: string): Promise<string>;
25
26
 
26
27
  /**
27
28
  * Sets the presence text of the agent in the client session.
28
29
  * @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} .
30
+ * @param correlationId Used to group all related API calls together for diagnostic telemetry
29
31
  * @returns Returns a Boolean value of success.
30
32
  * @see {@link https://learn.microsoft.com/en-us/dynamics365/channel-integration-framework/v2/develop/reference/microsoft-ciframework/setpresence External Link: setPresence}
31
33
  * @example
@@ -41,6 +43,6 @@ declare namespace Microsoft {
41
43
  * });
42
44
  *
43
45
  */
44
- export function setPresence(presenceText: string): Promise<boolean>;
46
+ export function setPresence(presenceText: string, correlationId?: string): Promise<boolean>;
45
47
  }
46
48
  }
package/v2.0/Session.d.ts CHANGED
@@ -36,22 +36,6 @@ declare namespace Microsoft {
36
36
  correlationId?: string
37
37
  ): Promise<boolean>;
38
38
 
39
- /**
40
- * Input for {@link Microsoft.CIFramework.createSession createSession}
41
- */
42
- interface CreateSessionInput {
43
- /**
44
- * Unique name of session template
45
- */
46
- templateName: string;
47
- /**
48
- * Global and application tab template parameters, these values will override configured values
49
- */
50
- templateParameters: {
51
- [key: string]: number | boolean | string;
52
- };
53
- }
54
-
55
39
  /**
56
40
  * Returns an array of session identifiers for a provider.
57
41
  * @param correlationId Used to group all related API calls together for diagnostic telemetry
@@ -66,7 +50,7 @@ declare namespace Microsoft {
66
50
  * @returns Promise with the value as a string.
67
51
  * @see {@link https://learn.microsoft.com/en-us/dynamics365/channel-integration-framework/v2/develop/reference/microsoft-ciframework/getfocusedsession External Link: getAllSessions}
68
52
  */
69
- export function getFocusedSession(): Promise<string>;
53
+ export function getFocusedSession(correlationId?: string): Promise<string>;
70
54
 
71
55
  /**
72
56
  * Returns an object containing the unique identifier of the session, unique identifier of the conversation, context and the value of isFocused parameter, in case the session belongs to the channel provider.
@@ -90,5 +74,56 @@ declare namespace Microsoft {
90
74
  sessionId: string,
91
75
  correlationId?: string
92
76
  ): Promise<string>;
77
+
78
+ /**
79
+ * Shows a notification indicator on the session whose Session Id is passed as a parameter, if the session belongs to the channel provider. The notification indicator draws the user's attention to switch between sessions.
80
+ * @param sessionId Id of the session to be focused.
81
+ * @param correlationId Used to group all related API calls together for diagnostic telemetry
82
+ * @returns None.
83
+ * @see {@link https://learn.microsoft.com/en-us/dynamics365/channel-integration-framework/v2/develop/reference/microsoft-ciframework/requestfocussession External Link: requestFocusSession}
84
+ */
85
+ export function requestFocusSession(sessionId: string, correlationId?: string): Promise<void>;
86
+
87
+ /**
88
+ * Returns an object containing the unique identifier of the session, unique identifier of the conversation, context and the value of isFocused parameter, in case the session belongs to the channel provider.
89
+ * @param sessionId Id of the current session.
90
+ * @param correlationId Used to group all related API calls together for diagnostic telemetry
91
+ * @returns Object containing session Id, conversation Id, context and isFocused parameter
92
+ * @see {@link https://learn.microsoft.com/en-us/dynamics365/channel-integration-framework/v2/develop/reference/microsoft-ciframework/getsession External Link: getSession}
93
+ * @example
94
+ * var input = {
95
+ * sessionId: "session-id-16",
96
+ * customer: "John"
97
+ * };
98
+ * // setSessionTitle needs two params in input bag.
99
+ * // 1. sessionId
100
+ * // 2. slug name which we use in title field of session template record.. In sample, we have given value as "Call from {customer}"
101
+ * // hence we pass "customer" in the input bag parameter.
102
+ * Microsoft.CIFramework.setSessionTitle(input);
103
+ */
104
+ export function setSessionTitle(
105
+ input: SessionInfo,
106
+ correlationId?: string
107
+ ): Promise<string>;
108
+
109
+ interface SessionInfo {
110
+ [prop:string]: 'sessionId' extends typeof prop? string : number | boolean | string;
111
+ }
112
+
113
+ /**
114
+ * Input for {@link Microsoft.CIFramework.createSession createSession}
115
+ */
116
+ interface CreateSessionInput {
117
+ /**
118
+ * Unique name of session template
119
+ */
120
+ templateName: string;
121
+ /**
122
+ * Global and application tab template parameters, these values will override configured values
123
+ */
124
+ templateParameters: {
125
+ [key: string]: number | boolean | string;
126
+ };
127
+ }
93
128
  }
94
129
  }
package/v2.0/index.d.ts CHANGED
@@ -1,3 +1,5 @@
1
+ /// <reference path="./ApplicationTabManagement.d.ts" />
2
+ /// <reference path="./ChannelAnalytics.d.ts" />
1
3
  /// <reference path="./ClickToAct.d.ts" />
2
4
  /// <reference path="./Context.d.ts" />
3
5
  /// <reference path="./Conversation.d.ts" />