@oneblink/sdk-core
Advanced tools
Comparing version 3.0.0-beta.1 to 3.0.0-beta.2
@@ -31,2 +31,3 @@ "use strict"; | ||
const getBusinessNameFromABNRecord = (abnRecord) => { | ||
var _a, _b; | ||
if (abnRecord.entityType.entityTypeCode === 'IND' && abnRecord.legalName) { | ||
@@ -37,6 +38,6 @@ const legalName = createLegalName(abnRecord.legalName); | ||
} | ||
if (abnRecord.mainName?.organisationName) { | ||
if ((_a = abnRecord.mainName) === null || _a === void 0 ? void 0 : _a.organisationName) { | ||
return abnRecord.mainName.organisationName; | ||
} | ||
if (abnRecord.mainTradingName?.organisationName) { | ||
if ((_b = abnRecord.mainTradingName) === null || _b === void 0 ? void 0 : _b.organisationName) { | ||
return abnRecord.mainTradingName.organisationName; | ||
@@ -88,3 +89,3 @@ } | ||
const relevantABN = abnRecord.ABN.find((abn) => abn.isCurrentIndicator === 'Y'); | ||
return relevantABN?.identifierValue; | ||
return relevantABN === null || relevantABN === void 0 ? void 0 : relevantABN.identifierValue; | ||
} | ||
@@ -91,0 +92,0 @@ return abnRecord.ABN.identifierValue; |
@@ -70,3 +70,4 @@ "use strict"; | ||
const everyOptionIsShowing = predicate.optionIds.every((id) => { | ||
const predicateOption = optionsPredicateElement.options?.find((o) => o.id === id); | ||
var _a; | ||
const predicateOption = (_a = optionsPredicateElement.options) === null || _a === void 0 ? void 0 : _a.find((o) => o.id === id); | ||
if (!predicateOption) | ||
@@ -73,0 +74,0 @@ return 'HIDE'; |
@@ -5,3 +5,4 @@ "use strict"; | ||
return predicate.optionIds.some((optionId) => { | ||
const option = predicateElement.options?.find((o) => o.id === optionId); | ||
var _a; | ||
const option = (_a = predicateElement.options) === null || _a === void 0 ? void 0 : _a.find((o) => o.id === optionId); | ||
if (option) { | ||
@@ -8,0 +9,0 @@ if (Array.isArray(value)) { |
@@ -206,3 +206,3 @@ "use strict"; | ||
while ((matches = ElementWYSIWYGRegex.exec(data)) !== null) { | ||
if (matches?.length < 3) | ||
if ((matches === null || matches === void 0 ? void 0 : matches.length) < 3) | ||
continue; | ||
@@ -209,0 +209,0 @@ const elementName = matches[2]; |
@@ -86,2 +86,3 @@ "use strict"; | ||
function getElementSubmissionValue({ propertyName, submission, formElements, formatDate, formatDateTime, formatTime, formatNumber, formatCurrency, }) { | ||
var _a, _b, _c; | ||
const formElement = (0, formElementsService_1.findFormElement)(formElements, (element) => element.type !== 'page' && | ||
@@ -94,3 +95,3 @@ element.type !== 'section' && | ||
} | ||
switch (formElement?.type) { | ||
switch (formElement === null || formElement === void 0 ? void 0 : formElement.type) { | ||
case 'datetime': { | ||
@@ -111,4 +112,4 @@ const value = unknown; | ||
const value = unknown; | ||
const option = formElement.options?.find((opt) => opt.value === value); | ||
return option?.label || value; | ||
const option = (_a = formElement.options) === null || _a === void 0 ? void 0 : _a.find((opt) => opt.value === value); | ||
return (option === null || option === void 0 ? void 0 : option.label) || value; | ||
} | ||
@@ -118,3 +119,4 @@ case 'checkboxes': { | ||
const selectedOptionLabels = value.reduce((labels, selectedOption) => { | ||
const foundOption = formElement.options?.find((o) => o.value === selectedOption); | ||
var _a; | ||
const foundOption = (_a = formElement.options) === null || _a === void 0 ? void 0 : _a.find((o) => o.value === selectedOption); | ||
if (foundOption) | ||
@@ -131,3 +133,3 @@ labels.push(foundOption.label); | ||
...value, | ||
value: option?.label || value.value, | ||
value: (option === null || option === void 0 ? void 0 : option.label) || value.value, | ||
}; | ||
@@ -139,3 +141,4 @@ } | ||
const selectedOptionLabels = value.reduce((labels, selectedOption) => { | ||
const foundOption = formElement.options?.find((o) => o.value === selectedOption); | ||
var _a; | ||
const foundOption = (_a = formElement.options) === null || _a === void 0 ? void 0 : _a.find((o) => o.value === selectedOption); | ||
if (foundOption) | ||
@@ -149,4 +152,4 @@ labels.push(foundOption.label); | ||
const value = unknown; | ||
const option = formElement.options?.find((opt) => opt.value === value); | ||
return option?.label || ''; | ||
const option = (_b = formElement.options) === null || _b === void 0 ? void 0 : _b.find((opt) => opt.value === value); | ||
return (option === null || option === void 0 ? void 0 : option.label) || ''; | ||
} | ||
@@ -175,13 +178,13 @@ } | ||
const value = unknown; | ||
return value?.addressDetails?.formattedAddress || value?.addressId; | ||
return ((_c = value === null || value === void 0 ? void 0 : value.addressDetails) === null || _c === void 0 ? void 0 : _c.formattedAddress) || (value === null || value === void 0 ? void 0 : value.addressId); | ||
} | ||
case 'civicaStreetName': { | ||
const value = unknown; | ||
return value?.formattedStreet; | ||
return value === null || value === void 0 ? void 0 : value.formattedStreet; | ||
} | ||
case 'civicaNameRecord': { | ||
const value = unknown; | ||
return ([value?.title, value?.givenName1, value?.familyName] | ||
return ([value === null || value === void 0 ? void 0 : value.title, value === null || value === void 0 ? void 0 : value.givenName1, value === null || value === void 0 ? void 0 : value.familyName] | ||
.filter((t) => t) | ||
.join(' ') || value?.emailAddress); | ||
.join(' ') || (value === null || value === void 0 ? void 0 : value.emailAddress)); | ||
} | ||
@@ -250,3 +253,4 @@ case 'abn': { | ||
keys.forEach((key) => { | ||
text = text.replaceAll(`{USER:${key}}`, options.userProfile?.[key]?.toString() || ''); | ||
var _a, _b; | ||
text = text.replaceAll(`{USER:${key}}`, ((_b = (_a = options.userProfile) === null || _a === void 0 ? void 0 : _a[key]) === null || _b === void 0 ? void 0 : _b.toString()) || ''); | ||
}); | ||
@@ -253,0 +257,0 @@ const matchesElement = text.match(formElementsService_1.ElementWYSIWYGRegex); |
@@ -23,2 +23,3 @@ "use strict"; | ||
function parseUserProfile(data) { | ||
var _a, _b, _c; | ||
if (typeof data !== 'object' || !data) { | ||
@@ -70,5 +71,5 @@ return; | ||
}; | ||
if (!userProfile.supervisor?.fullName && | ||
!userProfile.supervisor?.email && | ||
!userProfile.supervisor?.providerUserId) { | ||
if (!((_a = userProfile.supervisor) === null || _a === void 0 ? void 0 : _a.fullName) && | ||
!((_b = userProfile.supervisor) === null || _b === void 0 ? void 0 : _b.email) && | ||
!((_c = userProfile.supervisor) === null || _c === void 0 ? void 0 : _c.providerUserId)) { | ||
userProfile.supervisor = undefined; | ||
@@ -75,0 +76,0 @@ } |
{ | ||
"name": "@oneblink/sdk-core", | ||
"description": "OneBlink SDK for JavaScript (works in Browsers and NodeJS)", | ||
"version": "3.0.0-beta.1", | ||
"version": "3.0.0-beta.2", | ||
"author": "OneBlink <developers@oneblink.io> (https://oneblink.io)", | ||
@@ -6,0 +6,0 @@ "bugs": { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
242523
2784