@oneblink/sdk-core
Advanced tools
Comparing version 2.0.0-beta.2 to 2.0.0-beta.3
import { FormTypes, SubmissionTypes } from '@oneblink/types'; | ||
export type ReplaceSubmissionFormatters = { | ||
export type ReplaceInjectablesFormatters = { | ||
formatDateTime: (value: string) => string; | ||
@@ -9,3 +9,3 @@ formatDate: (value: string) => string; | ||
}; | ||
export type ReplaceSubmissionResultOptions = ReplaceSubmissionFormatters & { | ||
export type ReplaceInjectablesOptions = ReplaceInjectablesFormatters & { | ||
form: FormTypes.Form; | ||
@@ -58,13 +58,7 @@ submissionId: string; | ||
submission: SubmissionTypes.S3SubmissionData['submission']; | ||
formatDate: (value: string) => string; | ||
formatDateTime: (value: string) => string; | ||
formatTime: (value: string) => string; | ||
formatNumber: (value: number) => string; | ||
formatCurrency: (value: number) => string; | ||
}): unknown; | ||
} & ReplaceInjectablesFormatters): unknown; | ||
/** | ||
* Replace the `{ELEMENT:<elementName>}` values in text while a form is being | ||
* filled out. The replacements are suppose to be user friendly and for display | ||
* purposes, e.g. dates should be displayed in the user's desired format and | ||
* timezone. | ||
* purposes, e.g. dates should be displayed in the user's desired format and timezone. | ||
* | ||
@@ -74,3 +68,3 @@ * #### Example | ||
* ```js | ||
* const result = submissionService.replaceSubmissionValues( | ||
* const result = submissionService.replaceInjectablesWithElementValues( | ||
* 'https://example.com/path?search{ELEMENT:search}', | ||
@@ -108,6 +102,6 @@ * { | ||
*/ | ||
export declare function replaceSubmissionValues(text: string, options: { | ||
export declare function replaceInjectablesWithElementValues(text: string, options: { | ||
formElements: FormTypes.FormElement[]; | ||
submission: SubmissionTypes.S3SubmissionData['submission']; | ||
} & ReplaceSubmissionFormatters): string; | ||
} & ReplaceInjectablesFormatters): string; | ||
/** | ||
@@ -122,3 +116,3 @@ * Replace the `{ELEMENT:<elementName>}` values in text after a successful form | ||
* ```js | ||
* const result = submissionService.replaceSubmissionResultValues( | ||
* const result = submissionService.replaceInjectablesWithSubmissionValues( | ||
* 'https://example.com/path?submissionId={SUBMISSION_ID}&externalId={EXTERNAL_ID}&search{ELEMENT:search}', | ||
@@ -170,2 +164,2 @@ * { | ||
*/ | ||
export declare function replaceSubmissionResultValues(text: string, { form, submission, externalId, submissionId, submissionTimestamp, formatDate, formatDateTime, formatTime, formatNumber, formatCurrency, previousApprovalId, }: ReplaceSubmissionResultOptions): string; | ||
export declare function replaceInjectablesWithSubmissionValues(text: string, { form, submission, externalId, submissionId, submissionTimestamp, formatDate, formatDateTime, formatTime, formatNumber, formatCurrency, previousApprovalId, }: ReplaceInjectablesOptions): string; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.replaceSubmissionResultValues = exports.replaceSubmissionValues = exports.getElementSubmissionValue = void 0; | ||
exports.replaceInjectablesWithSubmissionValues = exports.replaceInjectablesWithElementValues = exports.getElementSubmissionValue = void 0; | ||
const formElementsService_1 = require("./formElementsService"); | ||
@@ -196,4 +196,3 @@ const abnService_1 = require("./abnService"); | ||
* filled out. The replacements are suppose to be user friendly and for display | ||
* purposes, e.g. dates should be displayed in the user's desired format and | ||
* timezone. | ||
* purposes, e.g. dates should be displayed in the user's desired format and timezone. | ||
* | ||
@@ -203,3 +202,3 @@ * #### Example | ||
* ```js | ||
* const result = submissionService.replaceSubmissionValues( | ||
* const result = submissionService.replaceInjectablesWithElementValues( | ||
* 'https://example.com/path?search{ELEMENT:search}', | ||
@@ -237,3 +236,3 @@ * { | ||
*/ | ||
function replaceSubmissionValues(text, options) { | ||
function replaceInjectablesWithElementValues(text, options) { | ||
const matches = text.match(formElementsService_1.WYSIWYGRegex); | ||
@@ -252,3 +251,3 @@ if (!matches) { | ||
} | ||
exports.replaceSubmissionValues = replaceSubmissionValues; | ||
exports.replaceInjectablesWithElementValues = replaceInjectablesWithElementValues; | ||
/** | ||
@@ -263,3 +262,3 @@ * Replace the `{ELEMENT:<elementName>}` values in text after a successful form | ||
* ```js | ||
* const result = submissionService.replaceSubmissionResultValues( | ||
* const result = submissionService.replaceInjectablesWithSubmissionValues( | ||
* 'https://example.com/path?submissionId={SUBMISSION_ID}&externalId={EXTERNAL_ID}&search{ELEMENT:search}', | ||
@@ -311,4 +310,4 @@ * { | ||
*/ | ||
function replaceSubmissionResultValues(text, { form, submission, externalId, submissionId, submissionTimestamp, formatDate, formatDateTime, formatTime, formatNumber, formatCurrency, previousApprovalId, }) { | ||
const string = replaceSubmissionValues(text, { | ||
function replaceInjectablesWithSubmissionValues(text, { form, submission, externalId, submissionId, submissionTimestamp, formatDate, formatDateTime, formatTime, formatNumber, formatCurrency, previousApprovalId, }) { | ||
const string = replaceInjectablesWithElementValues(text, { | ||
formElements: form.elements, | ||
@@ -338,3 +337,3 @@ submission, | ||
} | ||
exports.replaceSubmissionResultValues = replaceSubmissionResultValues; | ||
exports.replaceInjectablesWithSubmissionValues = replaceInjectablesWithSubmissionValues; | ||
//# sourceMappingURL=replaceCustomValues.js.map |
{ | ||
"name": "@oneblink/sdk-core", | ||
"description": "OneBlink SDK for JavaScript (works in Browsers and NodeJS)", | ||
"version": "2.0.0-beta.2", | ||
"version": "2.0.0-beta.3", | ||
"author": "OneBlink <developers@oneblink.io> (https://oneblink.io)", | ||
@@ -6,0 +6,0 @@ "bugs": { |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
240526
2752