@albanian-xrm/cif-types 0.1.3 → 0.1.4

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
@@ -4,3 +4,16 @@ Microsoft.CIFramework types from the community (us).
4
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).
7
+
8
+
9
+ To use the types install `@albanian-xrm/cif-types` and add the following to your `tsconfig.json`:
10
+
11
+ ```json
12
+ "compilerOptions": {
13
+ "types": [
14
+ "@albanian-xrm/cif-types/v1.0/index.d.ts"
15
+ ]
16
+ }
17
+ ```
18
+
19
+ You will get the Intellisense in your IDE with the global `Microsoft.CIFramework` types.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@albanian-xrm/cif-types",
3
- "version": "0.1.3",
3
+ "version": "0.1.4",
4
4
  "description": "Microsoft.CIFramework types from the community (us).",
5
5
  "repository": {
6
6
  "type": "git",
package/v1.0/Form.d.ts ADDED
@@ -0,0 +1,176 @@
1
+ declare namespace Microsoft {
2
+ namespace CIFramework {
3
+ /**
4
+ * Opens an entity form or a quick create form.
5
+ * @returns On success, returns a Promise object containing string.
6
+ * @see {@link https://learn.microsoft.com/en-us/dynamics365/customer-service/channel-integration-framework/reference/microsoft-ciframework/openform External Link: openForm}
7
+ * @example
8
+ * var id = "5af02e2a-d0d1-e811-8158-000d3af97055"
9
+ * var title = "Sample Case Form"
10
+ * var entityFormOptions = {};
11
+ * entityFormOptions["entityName"] = "incident";
12
+ *
13
+ * var formParameters = {};
14
+ * //pre-populate some fields based on the context
15
+ * formParameters["title"] = title;
16
+ * formParameters["customerid"] = id;
17
+ * formParameters["customeridtype"] = "contact";
18
+ * formParameters["caseorigincode"] = 1;
19
+ * formParameters["description"] = "Opened the form with pre-populated details like title, contact id, and description.";
20
+ *
21
+ * //Open the form
22
+ * Microsoft.CIFramework.openForm(JSON.stringify(entityFormOptions), JSON.stringify(formParameters)).then(
23
+ * function (success) {
24
+ * console.log(success);
25
+ * },
26
+ * function (error) {
27
+ * console.log(error);
28
+ * }
29
+ * );
30
+ */
31
+ export function openForm(
32
+ entityFormOptions: string,
33
+ formParameters?: string
34
+ ): Promise<string>;
35
+
36
+ export interface EntityFormOptions {
37
+ /**
38
+ * Indicates whether to display the command bar. If you do not specify this parameter, the command bar is displayed by default.
39
+ */
40
+ cmdBar?: boolean;
41
+
42
+ /**
43
+ * Indicates a record that will provide default values based on mapped attribute values.
44
+ */
45
+ createFromEntity?: LookupValue;
46
+
47
+ /**
48
+ * String Identifier of the entity record to display the form for.
49
+ */
50
+ entityId?: string;
51
+
52
+ /**
53
+ * Logical name of the entity to display the form for.
54
+ */
55
+ entityName: string;
56
+
57
+ /**
58
+ * Identifier of the form instance to be displayed.
59
+ */
60
+ formId?: string;
61
+
62
+ /**
63
+ * Height of the form window to be displayed in pixels.
64
+ */
65
+ height?: number;
66
+
67
+ /**
68
+ * Controls whether the navigation bar is displayed and whether application navigation is available using the areas and subareas defined in the site map.
69
+ */
70
+ navBar?: EntityFormNavBar;
71
+
72
+ /**
73
+ * Indicates whether to display the form in a new window.
74
+ */
75
+ openInNewWindow?: boolean;
76
+
77
+ /**
78
+ * Indicates the position of the form on the window.
79
+ */
80
+ windowPosition?: WindowPosition;
81
+
82
+ /**
83
+ * Identifier of the business process to be displayed on the form.
84
+ */
85
+ processId?: string;
86
+
87
+ /**
88
+ * Identifier of the business process instance to be displayed on the form.
89
+ */
90
+ processInstanceId?: string;
91
+
92
+ /**
93
+ * Indicates a relationship object to display the related records on the form.
94
+ */
95
+ relationship?: Relationship;
96
+
97
+ /**
98
+ * Identifier of the selected stage in business process instance.
99
+ */
100
+ selectStageId?: string;
101
+
102
+ useQuickCreateForm?: boolean;
103
+
104
+ /**
105
+ * Width of the form window to be displayed in pixels.
106
+ */
107
+ width?: number;
108
+ }
109
+
110
+ /**
111
+ * The following interface describes the attributes of the {@link Microsoft.CIFramework.EntityFormOptions.relationship relationship} object attribute of the {@link Microsoft.CIFramework.openForm entityFormOptions} parameter.
112
+ */
113
+ export interface Relationship {
114
+ /**
115
+ * Name of the attribute used for relationship.
116
+ */
117
+ attributeName?: string;
118
+
119
+ /**
120
+ * Name of the relationship.
121
+ */
122
+ name?: string;
123
+
124
+ /**
125
+ * Name of the navigation property for the relationship.
126
+ */
127
+ navigationProperty?: string;
128
+
129
+ /**
130
+ * Relationship type.
131
+ */
132
+ relationshipType?: RelationshipType;
133
+
134
+ /**
135
+ * Role type in the relationship.
136
+ */
137
+ roleType?: RoleType;
138
+ }
139
+
140
+ export const enum EntityFormNavBar {
141
+ /**
142
+ * The navigation bar is displayed. This is the default behavior if the navBar parameter is not used.
143
+ */
144
+ on = "on",
145
+ /**
146
+ * The navigation bar is not displayed. The user can navigate using other user interface elements or the back and forward buttons.
147
+ */
148
+ off = "off",
149
+ /**
150
+ * On an entity form, only the navigation options for related entities are available. After navigating to a related entity, a back button is displayed on the navigation bar to allow returning to the original record.
151
+ */
152
+ entity = "entity",
153
+ }
154
+
155
+ export const enum WindowPosition {
156
+ Center = 1,
157
+ Side = 2,
158
+ }
159
+
160
+ export const enum RelationshipType {
161
+ OneToMany = 0,
162
+ ManyToMany = 1,
163
+ }
164
+
165
+ export const enum RoleType {
166
+ Referencing = 1,
167
+ AssociationEntity = 2,
168
+ }
169
+
170
+ export interface LookupValue {
171
+ entityType: string;
172
+ id: string;
173
+ name?: string;
174
+ }
175
+ }
176
+ }
package/v1.0/index.d.ts CHANGED
@@ -4,6 +4,7 @@
4
4
  /// <reference path="./EntityMetadata.d.ts" />
5
5
  /// <reference path="./Environment.d.ts" />
6
6
  /// <reference path="./Events.d.ts" />
7
+ /// <reference path="./Form.d.ts" />
7
8
  /// <reference path="./PanelMode.d.ts" />
8
9
  /// <reference path="./PanelWidth.d.ts" />
9
10
  /// <reference path="./Search.d.ts" />
@@ -0,0 +1,23 @@
1
+ declare namespace Microsoft {
2
+ namespace CIFramework {
3
+ /**
4
+ * Returns a Boolean value to indicate whether the outbound communication (ClickToAct) is enabled or not.
5
+ * @param correlationId Used to group all related API calls together for diagnostic telemetry
6
+ * @returns Returns Promise object with the value. `true` if ClickToAct is enabled; `false` otherwise.
7
+ * @see {@link https://learn.microsoft.com/en-us/dynamics365/customer-service/channel-integration-framework/v2/reference/microsoft-ciframework/getclicktoact External Link: getClickToAct}
8
+ */
9
+ export function getClickToAct(correlationId?: string): Promise<boolean>;
10
+
11
+ /**
12
+ * Sets a Boolean value to enable or disable the outbound communication (ClickToAct).
13
+ * @param value Sets the value to enable or disable ClickToAct.
14
+ * @param correlationId Used to group all related API calls together for diagnostic telemetry
15
+ * @returns Returns Promise object without value.
16
+ * @see {@link https://learn.microsoft.com/en-us/dynamics365/customer-service/channel-integration-framework/v2/reference/microsoft-ciframework/setclicktoact External Link: setClickToAct}
17
+ */
18
+ export function setClickToAct(
19
+ value: boolean,
20
+ correlationId?: string
21
+ ): Promise<boolean>;
22
+ }
23
+ }
@@ -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/v2/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,35 @@
1
+ declare namespace Microsoft {
2
+ namespace CIFramework {
3
+ /**
4
+ * This method allows you to update a Conversation(msdyn_ocliveworkitem) record.
5
+ * @param id Unique identifier of the conversation returned by {@link Microsoft.CIFramework.getSession Microsoft.CIFramework.getSession} API.
6
+ * @param data JSON string
7
+ * @param correlationId Used to group all related API calls together for diagnostic telemetry
8
+ * @returns Returns a promise with string value.
9
+ * @see {@link https://learn.microsoft.com/en-us/dynamics365/customer-service/channel-integration-framework/v2/reference/microsoft-ciframework/updateconversation External Link: updateConversation}
10
+ * @example
11
+ * var data = {
12
+ * "subject": "Troubleshooting printer malfunction",
13
+ * "prioritycode": 2
14
+ * }
15
+ * var conversationId = "05145e77-ce40-ea11-a812-000d3a579805";
16
+ * var jsonData = JSON.stringify(data);
17
+ * Microsoft.CIFramework.updateConversation(conversationId, jsonData).then(
18
+ * function success (response) {
19
+ * var result = JSON.parse(response);
20
+ * console.log("Conversation updated with ID: " + result.id);
21
+ * //the Conversation is updated
22
+ * },
23
+ * function (error) {
24
+ * console.log(error);
25
+ * //handle errors
26
+ * }
27
+ * );
28
+ */
29
+ export function updateConversation(
30
+ id: string,
31
+ data: string,
32
+ correlationId?: string
33
+ ): Promise<string>;
34
+ }
35
+ }
@@ -51,9 +51,20 @@ declare namespace Microsoft {
51
51
  * );
52
52
  */
53
53
  export function notifyEvent(
54
- input: string,
55
- correlationId?: string,
56
- cancellationToken?: string
54
+ input: NotifyEventArgs,
55
+ correlationId?: string
57
56
  ): Promise<string>;
57
+
58
+ export interface NotifyEventArgs {
59
+ eventType?: string;
60
+ templateName: string;
61
+ templateParameters: object;
62
+ templateNameResolver?: string;
63
+ additionalParametersObject?: string;
64
+ messageNotificationType?: string;
65
+ notificationAction?: string;
66
+ cancellationToken?: string;
67
+ notificationUXObject?: string;
68
+ }
58
69
  }
59
70
  }
@@ -0,0 +1,86 @@
1
+ declare namespace Microsoft {
2
+ namespace CIFramework {
3
+ /**
4
+ * Allows you to check if a new session can be created.
5
+ * @param correlationId Used to group all related API calls together for diagnostic telemetry
6
+ * @returns Promise with the value as Boolean.
7
+ * @see {@link https://learn.microsoft.com/en-us/dynamics365/customer-service/channel-integration-framework/v2/reference/microsoft-ciframework/cancreatesession External Link: canCreateSession}
8
+ */
9
+ export function canCreateSession(correlationId?: string): Promise<boolean>;
10
+
11
+ /**
12
+ * Creates a new session based on the session template name and returns the unique identifier of the session that was created.
13
+ *
14
+ * If your organization uses single or multiple channel providers, then you can use this method to start a default session. More information: {@link https://learn.microsoft.com/en-us/dynamics365/customer-service/channel-integration-framework/v2/support-multiple-providers External Link: Configure support for single and multiple channel providers}
15
+ * @param correlationId Used to group all related API calls together for diagnostic telemetry
16
+ * @returns Promise with the value as Boolean.
17
+ * @see {@link https://learn.microsoft.com/en-us/dynamics365/customer-service/channel-integration-framework/v2/reference/microsoft-ciframework/cancreatesession External Link: canCreateSession}
18
+ * @example
19
+ * var input = {
20
+ * // unique name of the configured template
21
+ * templateName: "msdyn_chat_session",
22
+ * templateParameters: {
23
+ * customer: "Contoso",
24
+ * } // Global and application tab template parameters, these values will override configured values
25
+ * };
26
+ * Microsoft.CIFramework.createSession(input).then(function success(sessionId) {
27
+ * console.log(sessionId);
28
+ * // perform operations on session Id retrieved
29
+ * }, function(error) {
30
+ * console.log(error.message);
31
+ * // handle error conditions
32
+ * });
33
+ */
34
+ export function createSession(
35
+ input: CreateSessionInput,
36
+ correlationId?: string
37
+ ): Promise<boolean>;
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
+ /**
56
+ * Returns an array of session identifiers for a provider.
57
+ * @param correlationId Used to group all related API calls together for diagnostic telemetry
58
+ * @returns Promise with the value as array of strings.
59
+ * @see {@link https://learn.microsoft.com/en-us/dynamics365/customer-service/channel-integration-framework/v2/reference/microsoft-ciframework/getallsessions External Link: getAllSessions}
60
+ */
61
+ export function getAllSessions(correlationId?: string): Promise<string[]>;
62
+
63
+ /**
64
+ * 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.
65
+ * @param sessionId Id of the current session.
66
+ * @param correlationId Used to group all related API calls together for diagnostic telemetry
67
+ * @returns Object containing session Id, conversation Id, context and isFocused parameter
68
+ * @see {@link https://learn.microsoft.com/en-us/dynamics365/customer-service/channel-integration-framework/v2/reference/microsoft-ciframework/getsession External Link: getSession}
69
+ * @example
70
+ * Microsoft.CIFramework.getSession("session-id-1").then(
71
+ * function success(result) {
72
+ * console.log(result);
73
+ * // perform operations on session info
74
+ * },
75
+ * function (error) {
76
+ * console.log(error.message);
77
+ * // handle error conditions
78
+ * }
79
+ * );
80
+ */
81
+ export function getSession(
82
+ sessionId: string,
83
+ correlationId?: string
84
+ ): Promise<string>;
85
+ }
86
+ }
package/v2.0/index.d.ts CHANGED
@@ -1,10 +1,13 @@
1
- /// <reference path="../v1.0/ClickToAct.d.ts" />
1
+ /// <reference path="./ClickToAct.d.ts" />
2
2
  /// <reference path="../v1.0/Context.d.ts" />
3
+ /// <reference path="./Conversation.d.ts" />
3
4
  /// <reference path="../v1.0/CRUD.d.ts" />
4
5
  /// <reference path="../v1.0/EntityMetadata.d.ts" />
5
6
  /// <reference path="../v1.0/Environment.d.ts" />
6
7
  /// <reference path="../v1.0/Events.d.ts" />
8
+ /// <reference path="./Notification.d.ts" />
7
9
  /// <reference path="./PanelMode.d.ts" />
8
10
  /// <reference path="../v1.0/PanelWidth.d.ts" />
9
11
  /// <reference path="./Presence.d.ts" />
10
12
  /// <reference path="../v1.0/Search.d.ts" />
13
+ /// <reference path="./Session.d.ts" />