diff --git a/build.sbt b/build.sbt index 58b9cf5..c021b7f 100644 --- a/build.sbt +++ b/build.sbt @@ -41,7 +41,7 @@ lazy val root = (project in file(".")) name := "openlaw-core-client", scalaVersion := scalaV, libraryDependencies ++= Seq( - "org.openlaw" %%% "openlaw-core" % "0.1.75" + "org.openlaw" %%% "openlaw-core" % "0.1.77" ), relativeSourceMaps := true, artifactPath in (Compile, fullOptJS) := crossTarget.value / "client.js", diff --git a/js/src/APIClient.js b/js/src/APIClient.js index f59e86f..649eae6 100644 --- a/js/src/APIClient.js +++ b/js/src/APIClient.js @@ -134,7 +134,7 @@ export class APIClient { } const urlRegex = new RegExp( - /templates\/json|draft\/json|contract\/docx|contract\/pdf|contract\/json/, + /templates\/json|contract\/docx|contract\/pdf|contract\/json/, ); if (urlRegex.test(url)) { @@ -174,16 +174,6 @@ export class APIClient { ).then(response => response.data); } - async uploadDraft(params: AnyObjectType): Promise { - const headers = { - 'Content-Type': 'text/plain;charset=UTF-8', - }; - - return this.postCall('/upload/draft', JSON.stringify(params), headers).then( - response => response.data, - ); - } - async uploadFlow(params: AnyObjectType): Promise { const headers = { 'Content-Type': 'text/plain;charset=UTF-8', @@ -202,17 +192,6 @@ export class APIClient { return this.getCall('/driveAuthPage/' + id, headers); } - async sendDraft( - readonlyEmails: Array, - editEmails: Array, - id: string, - ) { - return this.postCall('/send/draft', { - readonlyEmails, - editEmails, - id, - }); - } async prepareSignature( contractId: string, fullName: string, @@ -309,20 +288,6 @@ export class APIClient { }).then(response => response.data); } - async getDraftVersions( - draftId: string, - pageSize: number, - page: number, - accessToken: ?string, - ): Promise> { - return this.getCall('/drafts/version', { - draftId, - pageSize, - page, - accessToken, - }).then(response => response.data); - } - async getTemplate(title: string): Promise { return this.getCall('/template/raw/' + title).then( response => response.data, @@ -341,16 +306,6 @@ export class APIClient { ).then(response => response.data); } - async getDraftVersion( - draftId: string, - version: number, - accessToken: ?string, - ): Promise { - return this.getCall('/draft/raw/' + draftId + '/' + version, { - accessToken, - }).then(response => response.data); - } - async getContract( contractId: string, accessToken: ?string, @@ -480,13 +435,6 @@ export class APIClient { }); } - async changeDraftAlias(draftId: string, newName: string) { - return this.getCall('/draft/alias/' + draftId, { - draftId, - newName, - }); - } - async searchContracts( keyword: string, page: number, @@ -501,20 +449,6 @@ export class APIClient { }).then(response => response.data); } - async searchDrafts( - keyword: string, - page: number, - pageSize: number, - sortBy: string, - ) { - return this.getCall('/drafts/search', { - keyword, - page, - pageSize, - sortBy, - }).then(response => response.data); - } - async searchAddress(term: string) { return this.getCall('/address/search', {term}).then( response => response.data, @@ -603,26 +537,6 @@ export class APIClient { }); } - async downloadDraftAsJson(draftId: string) { - return this.getCall('/draft/json/' + draftId).then(response => { - const blob = new Blob([response.data], {type: response.data.type}); - const url = window.URL.createObjectURL(blob); - const link = document.createElement('a'); - link.href = url; - const contentDisposition = response.headers['content-disposition']; - let fileName = 'unknown'; - if (contentDisposition) { - const fileNameMatch = contentDisposition.match(/filename=(.+)/); - if (fileNameMatch.length === 2) fileName = fileNameMatch[1]; - } - link.setAttribute('download', fileName); - document.body && document.body.appendChild(link); - link.click(); - link.remove(); - window.URL.revokeObjectURL(url); - }); - } - async downloadContractAsDocx(contractId: string) { return this.getCall('/contract/docx/' + contractId).then(response => { const blob = new Blob([response.data], {type: response.data.type}); diff --git a/src/main/scala/org/adridadou/openlaw/client/Openlaw.scala b/src/main/scala/org/adridadou/openlaw/client/Openlaw.scala index 6730895..fad71e1 100644 --- a/src/main/scala/org/adridadou/openlaw/client/Openlaw.scala +++ b/src/main/scala/org/adridadou/openlaw/client/Openlaw.scala @@ -461,9 +461,6 @@ object Openlaw extends LazyLogging { markdown.forPreview(agreement) @JSExport - def parseMarkdown(str: String): String = - markdown.forReviewParagraph(str).getOrThrow() - @JSExport def checkValidity( variable: VariableDefinition, optValue: js.UndefOr[String], @@ -636,12 +633,6 @@ object Openlaw extends LazyLogging { .map({ case (key, variables) => key -> variables.map(_.name).toJSArray }) .toJSDictionary - @JSExport - def isDeal(template: CompiledTemplate): Boolean = template match { - case _: CompiledDeal => true - case _ => false - } - @JSExport def isHidden(variableDefinition: VariableDefinition): Boolean = variableDefinition.isHidden