@oneblink/sdk-core 0.3.1-beta.1 → 0.3.2-beta.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/abnService.d.ts +5 -0
- package/dist/abnService.js +48 -0
- package/dist/abnService.js.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +2 -1
- package/dist/index.js.map +1 -1
- package/dist/typeCastService.d.ts +1 -1
- package/dist/typeCastService.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { ABNRecord } from '@oneblink/types/typescript/misc';
|
|
2
|
+
export declare const getBusinessNameFromABNRecord: (abnRecord: ABNRecord) => string | undefined;
|
|
3
|
+
export declare const displayBusinessNameFromABNRecord: (abnRecord: ABNRecord) => string;
|
|
4
|
+
export declare const getABNNumberFromABNRecord: (abnRecord: ABNRecord) => string | undefined;
|
|
5
|
+
export declare const displayABNNumberFromABNRecord: (abnRecord: ABNRecord) => string;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.displayABNNumberFromABNRecord = exports.getABNNumberFromABNRecord = exports.displayBusinessNameFromABNRecord = exports.getBusinessNameFromABNRecord = void 0;
|
|
4
|
+
const getBusinessNameFromABNRecord = (abnRecord) => {
|
|
5
|
+
var _a, _b;
|
|
6
|
+
if ((_a = abnRecord.mainName) === null || _a === void 0 ? void 0 : _a.organisationName) {
|
|
7
|
+
return abnRecord.mainName.organisationName;
|
|
8
|
+
}
|
|
9
|
+
if ((_b = abnRecord.mainTradingName) === null || _b === void 0 ? void 0 : _b.organisationName) {
|
|
10
|
+
return abnRecord.mainTradingName.organisationName;
|
|
11
|
+
}
|
|
12
|
+
if (abnRecord.legalName) {
|
|
13
|
+
const { givenName, otherGivenName, familyName } = abnRecord.legalName;
|
|
14
|
+
let legalName = '';
|
|
15
|
+
if (givenName)
|
|
16
|
+
legalName += `${givenName} `;
|
|
17
|
+
// Concat middle name
|
|
18
|
+
if (otherGivenName)
|
|
19
|
+
legalName += `${otherGivenName} `;
|
|
20
|
+
// Concat last name
|
|
21
|
+
if (familyName)
|
|
22
|
+
legalName += `${familyName}`;
|
|
23
|
+
if (legalName)
|
|
24
|
+
return legalName.trim();
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
exports.getBusinessNameFromABNRecord = getBusinessNameFromABNRecord;
|
|
28
|
+
const displayBusinessNameFromABNRecord = (abnRecord) => {
|
|
29
|
+
const businessName = (0, exports.getBusinessNameFromABNRecord)(abnRecord);
|
|
30
|
+
return businessName || 'Unknown Business Name';
|
|
31
|
+
};
|
|
32
|
+
exports.displayBusinessNameFromABNRecord = displayBusinessNameFromABNRecord;
|
|
33
|
+
const getABNNumberFromABNRecord = (abnRecord) => {
|
|
34
|
+
if (!abnRecord.ABN)
|
|
35
|
+
return;
|
|
36
|
+
if (Array.isArray(abnRecord.ABN)) {
|
|
37
|
+
const relevantABN = abnRecord.ABN.find((abn) => abn.isCurrentIndicator);
|
|
38
|
+
return relevantABN === null || relevantABN === void 0 ? void 0 : relevantABN.identifierValue;
|
|
39
|
+
}
|
|
40
|
+
return abnRecord.ABN.identifierValue;
|
|
41
|
+
};
|
|
42
|
+
exports.getABNNumberFromABNRecord = getABNNumberFromABNRecord;
|
|
43
|
+
const displayABNNumberFromABNRecord = (abnRecord) => {
|
|
44
|
+
const abnNumber = (0, exports.getABNNumberFromABNRecord)(abnRecord);
|
|
45
|
+
return abnNumber || 'Unknown ABN Number';
|
|
46
|
+
};
|
|
47
|
+
exports.displayABNNumberFromABNRecord = displayABNNumberFromABNRecord;
|
|
48
|
+
//# sourceMappingURL=abnService.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"abnService.js","sourceRoot":"","sources":["../src/abnService.ts"],"names":[],"mappings":";;;AAEO,MAAM,4BAA4B,GAAG,CAC1C,SAAoB,EACA,EAA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,uBAAX,WAAW,CAAE,eAAe,CAAA;KACpC;IACD,OAAO,SAAS,CAAC,GAAG,CAAC,eAAe,CAAA;AACtC,CAAC,CAAA;AATY,QAAA,yBAAyB,6BASrC;AACM,MAAM,6BAA6B,GAAG,CAAC,SAAoB,EAAU,EAAE;IAC5E,MAAM,SAAS,GAAG,IAAA,iCAAyB,EAAC,SAAS,CAAC,CAAA;IACtD,OAAO,SAAS,IAAI,oBAAoB,CAAA;AAC1C,CAAC,CAAA;AAHY,QAAA,6BAA6B,iCAGzC","sourcesContent":["import { ABNRecord } from '@oneblink/types/typescript/misc'\n\nexport const getBusinessNameFromABNRecord = (\n abnRecord: ABNRecord,\n): string | undefined => {\n if (abnRecord.mainName?.organisationName) {\n return abnRecord.mainName.organisationName\n }\n if (abnRecord.mainTradingName?.organisationName) {\n return abnRecord.mainTradingName.organisationName\n }\n if (abnRecord.legalName) {\n const { givenName, otherGivenName, familyName } = abnRecord.legalName\n\n let legalName = ''\n if (givenName) legalName += `${givenName} `\n // Concat middle name\n if (otherGivenName) legalName += `${otherGivenName} `\n // Concat last name\n if (familyName) legalName += `${familyName}`\n\n if (legalName) return legalName.trim()\n }\n}\nexport const displayBusinessNameFromABNRecord = (\n abnRecord: ABNRecord,\n): string => {\n const businessName = getBusinessNameFromABNRecord(abnRecord)\n return businessName || 'Unknown Business Name'\n}\n\nexport const getABNNumberFromABNRecord = (\n abnRecord: ABNRecord,\n): string | undefined => {\n if (!abnRecord.ABN) return\n if (Array.isArray(abnRecord.ABN)) {\n const relevantABN = abnRecord.ABN.find((abn) => abn.isCurrentIndicator)\n return relevantABN?.identifierValue\n }\n return abnRecord.ABN.identifierValue\n}\nexport const displayABNNumberFromABNRecord = (abnRecord: ABNRecord): string => {\n const abnNumber = getABNNumberFromABNRecord(abnRecord)\n return abnNumber || 'Unknown ABN Number'\n}\n"]}
|
package/dist/index.d.ts
CHANGED
|
@@ -3,4 +3,5 @@ export * as conditionalLogicService from './conditionalLogicService';
|
|
|
3
3
|
import replaceCustomValues, { getElementSubmissionValue } from './replaceCustomValues';
|
|
4
4
|
export * as typeCastService from './typeCastService';
|
|
5
5
|
export * as userService from './userService';
|
|
6
|
+
export * as abnService from './abnService';
|
|
6
7
|
export { replaceCustomValues, getElementSubmissionValue };
|
package/dist/index.js
CHANGED
|
@@ -19,7 +19,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
19
19
|
return result;
|
|
20
20
|
};
|
|
21
21
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
22
|
-
exports.getElementSubmissionValue = exports.replaceCustomValues = exports.userService = exports.typeCastService = exports.conditionalLogicService = exports.formElementsService = void 0;
|
|
22
|
+
exports.getElementSubmissionValue = exports.replaceCustomValues = exports.abnService = exports.userService = exports.typeCastService = exports.conditionalLogicService = exports.formElementsService = void 0;
|
|
23
23
|
exports.formElementsService = __importStar(require("./formElementsService"));
|
|
24
24
|
exports.conditionalLogicService = __importStar(require("./conditionalLogicService"));
|
|
25
25
|
const replaceCustomValues_1 = __importStar(require("./replaceCustomValues"));
|
|
@@ -27,4 +27,5 @@ exports.replaceCustomValues = replaceCustomValues_1.default;
|
|
|
27
27
|
Object.defineProperty(exports, "getElementSubmissionValue", { enumerable: true, get: function () { return replaceCustomValues_1.getElementSubmissionValue; } });
|
|
28
28
|
exports.typeCastService = __importStar(require("./typeCastService"));
|
|
29
29
|
exports.userService = __importStar(require("./userService"));
|
|
30
|
+
exports.abnService = __importStar(require("./abnService"));
|
|
30
31
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA,6EAA4D;AAC5D,qFAAoE;AACpE,6EAE8B;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA,6EAA4D;AAC5D,qFAAoE;AACpE,6EAE8B;AAKrB,8BAPF,6BAAmB,CAOE;AAAE,0GAN5B,+CAAyB,OAM4B;AAJvD,qEAAoD;AACpD,6DAA4C;AAC5C,2DAA0C","sourcesContent":["export * as formElementsService from './formElementsService'\nexport * as conditionalLogicService from './conditionalLogicService'\nimport replaceCustomValues, {\n getElementSubmissionValue,\n} from './replaceCustomValues'\nexport * as typeCastService from './typeCastService'\nexport * as userService from './userService'\nexport * as abnService from './abnService'\n\nexport { replaceCustomValues, getElementSubmissionValue }\n"]}
|
|
@@ -13,6 +13,6 @@ declare const formElements: {
|
|
|
13
13
|
toRepeatableSetElement: (e: FormTypes.FormElement) => FormTypes.RepeatableSetElement | undefined;
|
|
14
14
|
};
|
|
15
15
|
declare const submissionEvents: {
|
|
16
|
-
toPaymentSubmissionEvent: (e: SubmissionEventTypes.
|
|
16
|
+
toPaymentSubmissionEvent: (e: SubmissionEventTypes.FormEvent) => SubmissionEventTypes.PaymentSubmissionEvent | undefined;
|
|
17
17
|
};
|
|
18
18
|
export { formElements, submissionEvents };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"typeCastService.js","sourceRoot":"","sources":["../src/typeCastService.ts"],"names":[],"mappings":";;;AAEA,MAAM,gBAAgB,GAAG,CACvB,CAAwB,EACsB,EAAE;IAChD,QAAQ,CAAC,CAAC,IAAI,EAAE;QACd,KAAK,QAAQ,CAAC;QACd,KAAK,YAAY,CAAC;QAClB,KAAK,OAAO,CAAC;QACb,KAAK,cAAc,CAAC;QACpB,KAAK,YAAY,CAAC,CAAC;YACjB,OAAO,CAAC,CAAA;SACT;QACD,OAAO,CAAC,CAAC;YACP,OAAM;SACP;KACF;AACH,CAAC,CAAA;AAED,MAAM,qBAAqB,GAAG,CAC5B,CAAwB,EACmB,EAAE;IAC7C,QAAQ,CAAC,CAAC,IAAI,EAAE;QACd,KAAK,MAAM,CAAC;QACZ,KAAK,UAAU,CAAC,CAAC;YACf,OAAO,CAAC,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OAAM;SACP;KACF;AACH,CAAC,CAAA;AAGD,MAAM,iBAAiB,GAAG,CACxB,CAAwB,EACK,EAAE;IAC/B,QAAQ,CAAC,CAAC,IAAI,EAAE;QACd,KAAK,SAAS,CAAC;QACf,KAAK,MAAM,CAAC,CAAC;YACX,OAAO,CAAC,CAAA;SACT;QACD,OAAO,CAAC,CAAC;YACP,OAAM;SACP;KACF;AACH,CAAC,CAAA;AAKD,MAAM,0BAA0B,GAAG,CACjC,CAAwB,EACkB,EAAE;IAC5C,QAAQ,CAAC,CAAC,IAAI,EAAE;QACd,KAAK,eAAe,CAAC;QACrB,KAAK,SAAS,CAAC;QACf,KAAK,MAAM,CAAC,CAAC;YACX,OAAM;SACP;QACD,OAAO,CAAC,CAAC;YACP,OAAO,CAAC,CAAA;SACT;KACF;AACH,CAAC,CAAA;AAED,MAAM,aAAa,GAAG,CACpB,CAAwB,EACW,EAAE;IACrC,QAAQ,CAAC,CAAC,IAAI,EAAE;QACd,KAAK,MAAM,CAAC,CAAC;YACX,OAAO,CAAC,CAAA;SACT;QACD,OAAO,CAAC,CAAC;YACP,OAAM;SACP;KACF;AACH,CAAC,CAAA;AAED,MAAM,sBAAsB,GAAG,CAC7B,CAAwB,EACoB,EAAE;IAC9C,QAAQ,CAAC,CAAC,IAAI,EAAE;QACd,KAAK,eAAe,CAAC,CAAC;YACpB,OAAO,CAAC,CAAA;SACT;QACD,OAAO,CAAC,CAAC;YACP,OAAM;SACP;KACF;AACH,CAAC,CAAA;AAED,MAAM,YAAY,GAAG;IACnB,gBAAgB;IAChB,qBAAqB;IACrB,wBAAwB;IACxB,eAAe;IACf,uBAAuB;IACvB,iBAAiB;IACjB,0BAA0B;IAC1B,aAAa;IACb,sBAAsB;CACvB,CAAA;AAqBQ,oCAAY;AAnBrB,MAAM,wBAAwB,GAAG,CAC/B,
|
|
1
|
+
{"version":3,"file":"typeCastService.js","sourceRoot":"","sources":["../src/typeCastService.ts"],"names":[],"mappings":";;;AAEA,MAAM,gBA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C,CAAC,IAAI,EAAE;QACd,KAAK,eAAe,CAAC,CAAC;YACpB,OAAO,CAAC,CAAA;SACT;QACD,OAAO,CAAC,CAAC;YACP,OAAM;SACP;KACF;AACH,CAAC,CAAA;AAED,MAAM,YAAY,GAAG;IACnB,gBAAgB;IAChB,qBAAqB;IACrB,wBAAwB;IACxB,eAAe;IACf,uBAAuB;IACvB,iBAAiB;IACjB,0BAA0B;IAC1B,aAAa;IACb,sBAAsB;CACvB,CAAA;AAqBQ,oCAAY;AAnBrB,MAAM,wBAAwB,GAAG,CAC/B,CAAiC,EACwB,EAAE;IAC3D,QAAQ,CAAC,CAAC,IAAI,EAAE;QACd,KAAK,QAAQ,CAAC;QACd,KAAK,QAAQ,CAAC;QACd,KAAK,mBAAmB,CAAC,CAAC;YACxB,OAAO,CAAC,CAAA;SACT;QACD,OAAO,CAAC,CAAC;YACP,OAAM;SACP;KACF;AACH,CAAC,CAAA;AAED,MAAM,gBAAgB,GAAG;IACvB,wBAAwB;CACzB,CAAA;AAEsB,4CAAgB","sourcesContent":["import { FormTypes, SubmissionEventTypes } from '@oneblink/types'\n\nconst toOptionsElement = (\n e: FormTypes.FormElement,\n): FormTypes.FormElementWithOptions | undefined => {\n switch (e.type) {\n case 'select':\n case 'compliance':\n case 'radio':\n case 'autocomplete':\n case 'checkboxes': {\n return e\n }\n default: {\n return\n }\n }\n}\n\nconst toFormElementWithForm = (\n e: FormTypes.FormElement,\n): FormTypes.FormElementWithForm | undefined => {\n switch (e.type) {\n case 'form':\n case 'infoPage': {\n return e\n }\n default: {\n return\n }\n }\n}\n\nconst toFormElementWithoutForm = (\n e: FormTypes.FormElement,\n): FormTypes.FormElementWithoutForm | undefined => {\n switch (e.type) {\n case 'form':\n case 'infoPage': {\n return\n }\n default: {\n return e\n }\n }\n}\n\nconst toLookupElement = (\n e: FormTypes.FormElement,\n): FormTypes.LookupFormElement | undefined => {\n switch (e.type) {\n case 'boolean':\n case 'checkboxes':\n case 'date':\n case 'datetime':\n case 'files':\n case 'location':\n case 'number':\n case 'compliance':\n case 'radio':\n case 'select':\n case 'text':\n case 'textarea':\n case 'time':\n case 'barcodeScanner':\n case 'email':\n case 'telephone':\n case 'pointAddress':\n case 'geoscapeAddress':\n case 'civicaStreetName':\n case 'bsb':\n case 'autocomplete':\n case 'abn': {\n return e\n }\n default: {\n return\n }\n }\n}\n\nconst toNestedElementsElement = (\n e: FormTypes.FormElement,\n): FormTypes.NestedElementsElement | undefined => {\n switch (e.type) {\n case 'repeatableSet':\n case 'section':\n case 'page': {\n return e\n }\n default: {\n return\n }\n }\n}\n\ntype NamelessElement = FormTypes.PageElement | FormTypes.SectionElement\nconst toNamelessElement = (\n e: FormTypes.FormElement,\n): NamelessElement | undefined => {\n switch (e.type) {\n case 'section':\n case 'page': {\n return e\n }\n default: {\n return\n }\n }\n}\n\ntype NonNestedElementsFormElement =\n | FormTypes.NonNestedElementsElement\n | FormTypes.FormElementWithForm\nconst toNonNestedElementsElement = (\n e: FormTypes.FormElement,\n): NonNestedElementsFormElement | undefined => {\n switch (e.type) {\n case 'repeatableSet':\n case 'section':\n case 'page': {\n return\n }\n default: {\n return e\n }\n }\n}\n\nconst toPageElement = (\n e: FormTypes.FormElement,\n): FormTypes.PageElement | undefined => {\n switch (e.type) {\n case 'page': {\n return e\n }\n default: {\n return\n }\n }\n}\n\nconst toRepeatableSetElement = (\n e: FormTypes.FormElement,\n): FormTypes.RepeatableSetElement | undefined => {\n switch (e.type) {\n case 'repeatableSet': {\n return e\n }\n default: {\n return\n }\n }\n}\n\nconst formElements = {\n toOptionsElement,\n toFormElementWithForm,\n toFormElementWithoutForm,\n toLookupElement,\n toNestedElementsElement,\n toNamelessElement,\n toNonNestedElementsElement,\n toPageElement,\n toRepeatableSetElement,\n}\n\nconst toPaymentSubmissionEvent = (\n e: SubmissionEventTypes.FormEvent,\n): SubmissionEventTypes.PaymentSubmissionEvent | undefined => {\n switch (e.type) {\n case 'BPOINT':\n case 'CP_PAY':\n case 'WESTPAC_QUICK_WEB': {\n return e\n }\n default: {\n return\n }\n }\n}\n\nconst submissionEvents = {\n toPaymentSubmissionEvent,\n}\n\nexport { formElements, submissionEvents }\n"]}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@oneblink/sdk-core",
|
|
3
3
|
"description": "OneBlink SDK for JavaScript (works in Browsers and NodeJS)",
|
|
4
|
-
"version": "0.3.
|
|
4
|
+
"version": "0.3.2-beta.3",
|
|
5
5
|
"author": "OneBlink <developers@oneblink.io> (https://oneblink.io)",
|
|
6
6
|
"bugs": {
|
|
7
7
|
"url": "https://github.com/oneblink/sdk-core-js/issues"
|