Skip to content

Commit

Permalink
Merge pull request #212 from openlawteam/remove-drafts
Browse files Browse the repository at this point in the history
Remove drafts
  • Loading branch information
adridadou authored May 26, 2020
2 parents aa48c22 + 26750f6 commit 303ed89
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 97 deletions.
2 changes: 1 addition & 1 deletion build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
88 changes: 1 addition & 87 deletions js/src/APIClient.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {
Expand Down Expand Up @@ -174,16 +174,6 @@ export class APIClient {
).then(response => response.data);
}

async uploadDraft(params: AnyObjectType): Promise<string> {
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<string> {
const headers = {
'Content-Type': 'text/plain;charset=UTF-8',
Expand All @@ -202,17 +192,6 @@ export class APIClient {
return this.getCall('/driveAuthPage/' + id, headers);
}

async sendDraft(
readonlyEmails: Array<string>,
editEmails: Array<string>,
id: string,
) {
return this.postCall('/send/draft', {
readonlyEmails,
editEmails,
id,
});
}
async prepareSignature(
contractId: string,
fullName: string,
Expand Down Expand Up @@ -309,20 +288,6 @@ export class APIClient {
}).then(response => response.data);
}

async getDraftVersions(
draftId: string,
pageSize: number,
page: number,
accessToken: ?string,
): Promise<Array<Template>> {
return this.getCall('/drafts/version', {
draftId,
pageSize,
page,
accessToken,
}).then(response => response.data);
}

async getTemplate(title: string): Promise<AnyObjectType> {
return this.getCall('/template/raw/' + title).then(
response => response.data,
Expand All @@ -341,16 +306,6 @@ export class APIClient {
).then(response => response.data);
}

async getDraftVersion(
draftId: string,
version: number,
accessToken: ?string,
): Promise<AnyObjectType> {
return this.getCall('/draft/raw/' + draftId + '/' + version, {
accessToken,
}).then(response => response.data);
}

async getContract(
contractId: string,
accessToken: ?string,
Expand Down Expand Up @@ -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,
Expand All @@ -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,
Expand Down Expand Up @@ -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});
Expand Down
9 changes: 0 additions & 9 deletions src/main/scala/org/adridadou/openlaw/client/Openlaw.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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],
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 303ed89

Please sign in to comment.