@frontapp/ui-bridge
Advanced tools
Comparing version 2.0.0-beta1 to 2.0.0-beta10
@@ -26,3 +26,5 @@ import { Observable } from 'rxjs'; | ||
export * from './internal/asyncTypesV2'; | ||
export * from './internal/attachmentTypesV2'; | ||
export * from './internal/channelTypesV2'; | ||
export * from './internal/commentTypesV2'; | ||
export * from './internal/contactTypesV2'; | ||
@@ -37,2 +39,3 @@ export * from './internal/contextTypesV2'; | ||
export * from './internal/inboxTypesV2'; | ||
export * from './internal/linkTypesV2'; | ||
export * from './internal/messageTypesV2'; | ||
@@ -39,0 +42,0 @@ export * from './internal/paginationTypesV2'; |
"use strict"; | ||
function __export(m) { | ||
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; | ||
} | ||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); | ||
}) : (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
o[k2] = m[k]; | ||
})); | ||
var __exportStar = (this && this.__exportStar) || function(m, exports) { | ||
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.getBridge = void 0; | ||
function getBridge() { | ||
@@ -14,6 +22,22 @@ // eslint-disable-next-line no-undef | ||
*/ | ||
__export(require("./internal/asyncTypesV2")); | ||
__export(require("./internal/entryPointTypesV2")); | ||
__export(require("./internal/errorTypesV2")); | ||
__export(require("./internal/httpTypesV2")); | ||
__export(require("./internal/widgetTypesV2")); | ||
__exportStar(require("./internal/asyncTypesV2"), exports); | ||
__exportStar(require("./internal/attachmentTypesV2"), exports); | ||
__exportStar(require("./internal/channelTypesV2"), exports); | ||
__exportStar(require("./internal/commentTypesV2"), exports); | ||
__exportStar(require("./internal/contactTypesV2"), exports); | ||
__exportStar(require("./internal/contextTypesV2"), exports); | ||
__exportStar(require("./internal/conversationTypesV2"), exports); | ||
__exportStar(require("./internal/draftTypesV2"), exports); | ||
__exportStar(require("./internal/entryPointTypesV2"), exports); | ||
__exportStar(require("./internal/errorTypesV2"), exports); | ||
__exportStar(require("./internal/httpTypesV2"), exports); | ||
__exportStar(require("./internal/idTypesV2"), exports); | ||
__exportStar(require("./internal/inboxTypesV2"), exports); | ||
__exportStar(require("./internal/linkTypesV2"), exports); | ||
__exportStar(require("./internal/messageTypesV2"), exports); | ||
__exportStar(require("./internal/paginationTypesV2"), exports); | ||
__exportStar(require("./internal/recipientTypesV2"), exports); | ||
__exportStar(require("./internal/tagTypesV2"), exports); | ||
__exportStar(require("./internal/teammateTypesV2"), exports); | ||
__exportStar(require("./internal/topicTypesV2"), exports); | ||
__exportStar(require("./internal/widgetTypesV2"), exports); |
@@ -6,6 +6,8 @@ "use strict"; | ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || | ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; | ||
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; | ||
return extendStatics(d, b); | ||
}; | ||
return function (d, b) { | ||
if (typeof b !== "function" && b !== null) | ||
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); | ||
extendStatics(d, b); | ||
@@ -17,2 +19,3 @@ function __() { this.constructor = d; } | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.buildApplicationCancelTokenSource = exports.ApplicationCancelError = void 0; | ||
var errorTypesV2_1 = require("./errorTypesV2"); | ||
@@ -34,4 +37,5 @@ var ApplicationCancelError = /** @class */ (function (_super) { | ||
var cancel = function (message) { | ||
if (!resolve) | ||
if (!resolve) { | ||
throw new Error('Promise initialization failed'); | ||
} | ||
wasResolveCalled = true; | ||
@@ -41,14 +45,15 @@ resolve({ message: message || 'The process was cancelled.' }); | ||
var throwIfRequested = function () { | ||
if (wasResolveCalled) | ||
if (wasResolveCalled) { | ||
throw new ApplicationCancelError(); | ||
} | ||
}; | ||
var token = { | ||
promise: promise, | ||
throwIfRequested: throwIfRequested | ||
throwIfRequested: throwIfRequested, | ||
}; | ||
return { | ||
cancel: cancel, | ||
token: token | ||
token: token, | ||
}; | ||
} | ||
exports.buildApplicationCancelTokenSource = buildApplicationCancelTokenSource; |
@@ -1,2 +0,2 @@ | ||
import { ApplicationContactGroupId, ApplicationContactId, ApplicationCustomFieldId, ApplicationTeammateId } from './idTypesV2'; | ||
import { ApplicationContactGroupId, ApplicationContactId, ApplicationCustomFieldId, ApplicationInboxId, ApplicationTeammateId } from './idTypesV2'; | ||
export interface ApplicationContact { | ||
@@ -25,2 +25,3 @@ /** Unique ID of the Contact. */ | ||
string: string; | ||
enum: string; | ||
datetime: Date; | ||
@@ -30,2 +31,3 @@ boolean: boolean; | ||
teammateId: ApplicationTeammateId; | ||
inboxId: ApplicationInboxId; | ||
unknown: string; | ||
@@ -39,3 +41,3 @@ } | ||
} | ||
export declare type ApplicationCustomAttribute = ApplicationCustomAttributeBase<'string'> | ApplicationCustomAttributeBase<'datetime'> | ApplicationCustomAttributeBase<'boolean'> | ApplicationCustomAttributeBase<'number'> | ApplicationCustomAttributeBase<'teammateId'> | ApplicationCustomAttributeBase<'unknown'>; | ||
export declare type ApplicationCustomAttribute = ApplicationCustomAttributeBase<'string'> | ApplicationCustomAttributeBase<'enum'> | ApplicationCustomAttributeBase<'datetime'> | ApplicationCustomAttributeBase<'boolean'> | ApplicationCustomAttributeBase<'number'> | ApplicationCustomAttributeBase<'teammateId'> | ApplicationCustomAttributeBase<'inboxId'> | ApplicationCustomAttributeBase<'unknown'>; | ||
export {}; |
import { ApplicationCancelToken } from './asyncTypesV2'; | ||
import { ApplicationChannelList } from './channelTypesV2'; | ||
import { ApplicationCommentList } from './commentTypesV2'; | ||
import { ApplicationConversation, ApplicationConversationStatus, ApplicationSingleConversation } from './conversationTypesV2'; | ||
@@ -7,6 +8,9 @@ import { ApplicationDraft, ApplicationDraftTemplate, ApplicationDraftUpdate } from './draftTypesV2'; | ||
import { HttpRequest, HttpResponse } from './httpTypesV2'; | ||
import { ApplicationDraftId, ApplicationInboxId, ApplicationTagId, ApplicationTeammateId } from './idTypesV2'; | ||
import { ApplicationAttachmentId, ApplicationCommentId, ApplicationConversationId, ApplicationDraftId, ApplicationInboxId, ApplicationMessageId, ApplicationTagId, ApplicationTeammateId, ApplicationTopicId } from './idTypesV2'; | ||
import { ApplicationInboxList } from './inboxTypesV2'; | ||
import { ApplicationLink } from './linkTypesV2'; | ||
import { ApplicationMessageList } from './messageTypesV2'; | ||
import { ApplicationPaginationToken } from './paginationTypesV2'; | ||
import { ApplicationRecipientList } from './recipientTypesV2'; | ||
import { HttpRelayRequest } from './relayTypesV2'; | ||
import { ApplicationTagList } from './tagTypesV2'; | ||
@@ -16,2 +20,5 @@ import { ApplicationTeammate, ApplicationTeammateList } from './teammateTypesV2'; | ||
import { Widget, WidgetTemplate } from './widgetTypesV2'; | ||
export declare enum ApplicationAuthenticationStatusesEnum { | ||
AUTHORIZED = "authorized" | ||
} | ||
export interface ApplicationContextBase { | ||
@@ -30,2 +37,6 @@ /** Unique ID for this context. */ | ||
preferences: object; | ||
/** Current teammate's authentication. */ | ||
authentication: { | ||
status?: ApplicationAuthenticationStatusesEnum; | ||
}; | ||
/** Current teammate. */ | ||
@@ -54,2 +65,17 @@ teammate: ApplicationTeammate; | ||
/** | ||
* Relay an HTTP request. | ||
* @param request Definition of the HTTP request to run. | ||
* @param cancelToken Cancel the HTTP request. | ||
* @returns HTTP response. | ||
*/ | ||
relayHttp(request: HttpRelayRequest, cancelToken?: ApplicationCancelToken): Promise<HttpResponse>; | ||
/** | ||
* Start the authentication flow according to the configured security scheme. | ||
*/ | ||
authenticate(cancelToken?: ApplicationCancelToken): Promise<void>; | ||
/** | ||
* Delete the credentials stored for the current teammate. | ||
*/ | ||
deauthenticate(cancelToken?: ApplicationCancelToken): Promise<void>; | ||
/** | ||
* Open a browser window. | ||
@@ -69,2 +95,8 @@ * @param url URL to navigate to. | ||
/** | ||
* Open a conversation in a popup. | ||
* @param conversationId Conversation to open. | ||
* @param cancelToken Cancel the request. | ||
*/ | ||
openConversationInPopup(conversationId: ApplicationConversationId, cancelToken?: ApplicationCancelToken): Promise<void>; | ||
/** | ||
* Perform a search in Front for the current teammate. | ||
@@ -117,2 +149,10 @@ * @param query Search query. | ||
updateDraft(draftId: ApplicationDraftId, update: ApplicationDraftUpdate, cancelToken?: ApplicationCancelToken): Promise<void>; | ||
/** | ||
* Fetch the current path the user is in within the app. | ||
* If the user is composing a new message in a popped out composer, | ||
* noConversationPopoverContext, | ||
* we will return a constant string of 'composing-new'. | ||
* @param cancelToken Cancel the request. | ||
*/ | ||
fetchPath(cancelToken?: ApplicationCancelToken): Promise<string>; | ||
} | ||
@@ -129,5 +169,14 @@ export interface NoConversationContext extends ApplicationContextBase { | ||
* @returns The added topic. | ||
* @deprecated | ||
*/ | ||
addTopic(externalUrl: string, name: string | undefined, cancelToken?: ApplicationCancelToken): Promise<ApplicationTopic>; | ||
/** | ||
* Add a link to the selected conversations. | ||
* @param externalUrl URL of the topic. | ||
* @param name Human readable name. | ||
* @param cancelToken Cancel the creation of the link. | ||
* @returns The added link. | ||
*/ | ||
addLink(externalUrl: string, name: string | undefined, cancelToken?: ApplicationCancelToken): Promise<ApplicationLink>; | ||
/** | ||
* Assign or unassign the selected conversations. | ||
@@ -162,2 +211,8 @@ * @param teammateId ID of the teammate to assign the conversations to. If null, the conversations will be unassigned. | ||
untag(tagIds: ReadonlyArray<ApplicationTagId>, cancelToken?: ApplicationCancelToken): Promise<void>; | ||
/** | ||
* Remove the specified link from the conversation. | ||
* @param linkId Link ID to remove. | ||
* @param cancelToken Cancel the request. | ||
*/ | ||
removeLink(linkId: ApplicationTopicId, cancelToken?: ApplicationCancelToken): Promise<void>; | ||
} | ||
@@ -182,3 +237,43 @@ export interface SingleConversationContext extends ExistingConversationBaseContext { | ||
listMessages(paginationToken?: ApplicationPaginationToken, cancelToken?: ApplicationCancelToken): Promise<ApplicationMessageList>; | ||
/** | ||
* List the comments in the current conversation. | ||
* @param paginationToken Token of the requested page. If omitted, will return the first page of results. | ||
* @param cancelToken Cancel the request. | ||
* @returns List of comments. | ||
*/ | ||
listComments(paginationToken?: ApplicationPaginationToken, cancelToken?: ApplicationCancelToken): Promise<ApplicationCommentList>; | ||
/** | ||
* Download the specified attachment that is attached to a message. To get attachments you will need to use | ||
* {@link listMessages} which returns messages with any attachments. | ||
* @param messageOrCommentId Message or comment id for the attachment. | ||
* @param attachmentId Attachment id to be fetched. | ||
* @param cancelToken Cancel the request. | ||
* @returns File holding the data of the attachment | ||
*/ | ||
downloadAttachment(messageOrCommentId: ApplicationMessageId | ApplicationCommentId, attachmentId: ApplicationAttachmentId, cancelToken?: ApplicationCancelToken): Promise<File | undefined>; | ||
/** | ||
* List the recipients in the current conversation in the order in which the messages are sent. | ||
* @param paginationToken Token of the requested page. If omitted, will return the first page of results. | ||
* @param cancelToken Cancel the request. | ||
* @returns List of recipients. | ||
*/ | ||
listRecipients(paginationToken?: ApplicationPaginationToken, cancelToken?: ApplicationCancelToken): Promise<ApplicationRecipientList>; | ||
} | ||
export interface NoConversationPopoverContext extends ApplicationContextBase, Pick<SingleConversationContext, 'fetchDraft'> { | ||
type: 'noConversationPopover'; | ||
draftId?: ApplicationDraftId; | ||
/** | ||
* Closes the popover. | ||
* * @param cancelToken Cancel the request. | ||
*/ | ||
requestClose(cancelToken?: ApplicationCancelToken): Promise<void>; | ||
} | ||
export interface SingleConversationPopoverContext extends Omit<SingleConversationContext, 'type'> { | ||
type: 'singleConversationPopover'; | ||
/** | ||
* Closes the popover. | ||
* * @param cancelToken Cancel the request. | ||
*/ | ||
requestClose(cancelToken?: ApplicationCancelToken): Promise<void>; | ||
} | ||
export interface MultiConversationsContext extends ExistingConversationBaseContext { | ||
@@ -190,3 +285,3 @@ type: 'multiConversations'; | ||
export declare type ExistingConversationContext = SingleConversationContext | MultiConversationsContext; | ||
export declare type ConversationContext = NoConversationContext | SingleConversationContext | MultiConversationsContext; | ||
export declare type ConversationContext = NoConversationContext | NoConversationPopoverContext | SingleConversationContext | SingleConversationPopoverContext | MultiConversationsContext; | ||
export interface MessageContext extends ApplicationContextBase { | ||
@@ -193,0 +288,0 @@ type: 'message'; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.ApplicationAuthenticationStatusesEnum = void 0; | ||
var entryPointTypesV2_1 = require("./entryPointTypesV2"); | ||
var ApplicationAuthenticationStatusesEnum; | ||
(function (ApplicationAuthenticationStatusesEnum) { | ||
ApplicationAuthenticationStatusesEnum["AUTHORIZED"] = "authorized"; | ||
})(ApplicationAuthenticationStatusesEnum = exports.ApplicationAuthenticationStatusesEnum || (exports.ApplicationAuthenticationStatusesEnum = {})); |
import { ApplicationConversationId, ApplicationDraftId } from './idTypesV2'; | ||
import { ApplicationInbox } from './inboxTypesV2'; | ||
import { ApplicationLink } from './linkTypesV2'; | ||
import { ApplicationRecipient } from './recipientTypesV2'; | ||
@@ -28,4 +29,6 @@ import { ApplicationTag } from './tagTypesV2'; | ||
tags: ReadonlyArray<ApplicationTag>; | ||
/** Topics attached to the conversation. */ | ||
/** @deprecated Topics attached to the conversation. */ | ||
topics: ReadonlyArray<ApplicationTopic>; | ||
/** Links attached to the conversation. */ | ||
links: ReadonlyArray<ApplicationLink>; | ||
} | ||
@@ -32,0 +35,0 @@ export interface ApplicationSingleConversation extends ApplicationConversation { |
@@ -49,2 +49,4 @@ import { ApplicationChannel } from './channelTypesV2'; | ||
content?: ApplicationDraftContent; | ||
/** Attachments to be added to draft */ | ||
attachments?: ReadonlyArray<File>; | ||
} | ||
@@ -56,3 +58,5 @@ export interface ApplicationDraftUpdate extends ApplicationDraftTemplateBase { | ||
content?: ApplicationDraftContent; | ||
/** Attachments for the draft */ | ||
attachments?: ReadonlyArray<File>; | ||
} | ||
export {}; |
@@ -6,2 +6,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.EntryPointTypesEnum = void 0; | ||
var EntryPointTypesEnum; | ||
@@ -8,0 +9,0 @@ (function (EntryPointTypesEnum) { |
@@ -6,6 +6,8 @@ "use strict"; | ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || | ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; | ||
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; | ||
return extendStatics(d, b); | ||
}; | ||
return function (d, b) { | ||
if (typeof b !== "function" && b !== null) | ||
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); | ||
extendStatics(d, b); | ||
@@ -17,2 +19,3 @@ function __() { this.constructor = d; } | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.ApplicationDefaultError = exports.ApplicationError = void 0; | ||
var ApplicationError = /** @class */ (function (_super) { | ||
@@ -19,0 +22,0 @@ __extends(ApplicationError, _super); |
@@ -19,4 +19,6 @@ export declare enum HttpVerbsEnum { | ||
status: number; | ||
/** Headers of the response */ | ||
headers: Record<string, string | undefined>; | ||
/** Body of the response. */ | ||
body: unknown; | ||
} |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.HttpVerbsEnum = void 0; | ||
var HttpVerbsEnum; | ||
@@ -4,0 +5,0 @@ (function (HttpVerbsEnum) { |
@@ -56,3 +56,6 @@ import { Branded } from 'io-ts'; | ||
} | ||
export declare type ApplicationResourceIdBrand = ApplicationActivityIdBrand & ApplicationAttachmentIdBrand & ApplicationCalendarEventIdBrand & ApplicationCalendarEventVersionIdBrand & ApplicationCardIdBrand & ApplicationCardGroupIdBrand & ApplicationChannelIdBrand & ApplicationCommentIdBrand & ApplicationConversationIdBrand & ApplicationCustomFieldIdBrand & ApplicationDraftIdBrand & ApplicationInboxIdBrand & ApplicationMessageIdBrand & ApplicationRuleIdBrand & ApplicationTagIdBrand & ApplicationTeamIdBrand & ApplicationTeammateIdBrand & ApplicationTopicIdBrand; | ||
interface ApplicationCircleIdBrand { | ||
readonly publicIdCircle: unique symbol; | ||
} | ||
export declare type ApplicationResourceIdBrand = ApplicationActivityIdBrand & ApplicationAttachmentIdBrand & ApplicationCalendarEventIdBrand & ApplicationCalendarEventVersionIdBrand & ApplicationCardIdBrand & ApplicationCardGroupIdBrand & ApplicationChannelIdBrand & ApplicationCircleIdBrand & ApplicationCommentIdBrand & ApplicationConversationIdBrand & ApplicationCustomFieldIdBrand & ApplicationDraftIdBrand & ApplicationInboxIdBrand & ApplicationMessageIdBrand & ApplicationRuleIdBrand & ApplicationTagIdBrand & ApplicationTeamIdBrand & ApplicationTeammateIdBrand & ApplicationTopicIdBrand; | ||
export declare type ApplicationAttachmentId = Branded<string, ApplicationAttachmentIdBrand>; | ||
@@ -62,2 +65,3 @@ export declare type ApplicationChannelId = Branded<string, ApplicationChannelIdBrand>; | ||
export declare type ApplicationContactGroupId = Branded<string, ApplicationCardGroupIdBrand>; | ||
export declare type ApplicationCommentId = Branded<string, ApplicationCommentIdBrand>; | ||
export declare type ApplicationConversationId = Branded<string, ApplicationConversationIdBrand>; | ||
@@ -64,0 +68,0 @@ export declare type ApplicationCustomFieldId = Branded<string, ApplicationCustomFieldIdBrand>; |
@@ -1,2 +0,3 @@ | ||
import { ApplicationAttachmentId, ApplicationMessageId } from './idTypesV2'; | ||
import { ApplicationAttachment } from './attachmentTypesV2'; | ||
import { ApplicationMessageId } from './idTypesV2'; | ||
import { ApplicationPaginatedResults } from './paginationTypesV2'; | ||
@@ -24,3 +25,3 @@ import { ApplicationRecipient } from './recipientTypesV2'; | ||
to: ReadonlyArray<ApplicationRecipient>; | ||
/** List of recipients in copy of the emssage. */ | ||
/** List of recipients in copy of the message. */ | ||
cc: ReadonlyArray<ApplicationRecipient> | undefined; | ||
@@ -39,13 +40,1 @@ /** List of recipients in blind copy of the message. */ | ||
export declare type ApplicationMessageList = ApplicationPaginatedResults<ApplicationMessage>; | ||
export interface ApplicationAttachment { | ||
/** Unique ID of the attachment. */ | ||
id: ApplicationAttachmentId; | ||
/** Name of the file. */ | ||
name: string; | ||
/** MIME type of the file. */ | ||
contentType: string; | ||
/** Size of the file (in bytes). */ | ||
size: number; | ||
/** Identifier of the file in the body, if inline. */ | ||
inlineCid: string | undefined; | ||
} |
import { ApplicationContact } from './contactTypesV2'; | ||
import { ApplicationPaginatedResults } from './paginationTypesV2'; | ||
export interface ApplicationRecipient { | ||
@@ -9,2 +10,5 @@ /** Handle of the recipient. */ | ||
contact: ApplicationContact | undefined; | ||
/** The type of the handle */ | ||
type: string; | ||
} | ||
export declare type ApplicationRecipientList = ApplicationPaginatedResults<ApplicationRecipient>; |
@@ -6,2 +6,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.WidgetTypesEnum = void 0; | ||
var WidgetTypesEnum; | ||
@@ -8,0 +9,0 @@ (function (WidgetTypesEnum) { |
{ | ||
"name": "@frontapp/ui-bridge", | ||
"version": "2.0.0-beta1", | ||
"version": "2.0.0-beta10", | ||
"description": "Helpers and TypeScript definitions for the Front SDK bridge", | ||
@@ -19,8 +19,13 @@ "author": { | ||
"clean": "rm -rf ./dist", | ||
"deploy:dry-run": "npm publish --access public --dry-run", | ||
"deploy": "npm publish --access public", | ||
"prepare": "npm run clean && npm run build" | ||
}, | ||
"dependencies": { | ||
"rxjs": "^6.5.3", | ||
"io-ts": "^2.1.0" | ||
"io-ts": "^2.1.0", | ||
"rxjs": "^6.5.3" | ||
}, | ||
"devDependencies": { | ||
"typescript": "^4.5.4" | ||
} | ||
} | ||
} |
46692
48
1030
1