@oneblink/sdk-core 0.3.2-beta.1 → 0.3.2-beta.2

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.
@@ -0,0 +1,2 @@
1
+ import { ABNRecord } from '@oneblink/types/typescript/misc';
2
+ export declare const getBusinessNameFromABNRecord: (abnRecord: ABNRecord) => string;
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ 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
+ return 'Unknown Business Name';
27
+ };
28
+ exports.getBusinessNameFromABNRecord = getBusinessNameFromABNRecord;
29
+ //# sourceMappingURL=abnService.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"abnService.js","sourceRoot":"","sources":["../src/abnService.ts"],"names":[],"mappings":";;;AAEO,MAAM,4BAA4B,GAAG,CAAC,SAAoB,EAAU,EAAE;;IAC3E,IAAI,MAAA,SAAS,CAAC,QAAQ,0CAAE,gBAAgB,EAAE;QACxC,OAAO,SAAS,CAAC,QAAQ,CAAC,gBAAgB,CAAA;KAC3C;IACD,IAAI,MAAA,SAAS,CAAC,eAAe,0CAAE,gBAAgB,EAAE;QAC/C,OAAO,SAAS,CAAC,eAAe,CAAC,gBAAgB,CAAA;KAClD;IACD,IAAI,SAAS,CAAC,SAAS,EAAE;QACvB,MAAM,EAAE,SAAS,EAAE,cAAc,EAAE,UAAU,EAAE,GAAG,SAAS,CAAC,SAAS,CAAA;QAErE,IAAI,SAAS,GAAG,EAAE,CAAA;QAClB,IAAI,SAAS;YAAE,SAAS,IAAI,GAAG,SAAS,GAAG,CAAA;QAC3C,qBAAqB;QACrB,IAAI,cAAc;YAAE,SAAS,IAAI,GAAG,cAAc,GAAG,CAAA;QACrD,mBAAmB;QACnB,IAAI,UAAU;YAAE,SAAS,IAAI,GAAG,UAAU,EAAE,CAAA;QAE5C,IAAI,SAAS;YAAE,OAAO,SAAS,CAAC,IAAI,EAAE,CAAA;KACvC;IAED,OAAO,uBAAuB,CAAA;AAChC,CAAC,CAAA;AArBY,QAAA,4BAA4B,gCAqBxC","sourcesContent":["import { ABNRecord } from '@oneblink/types/typescript/misc'\n\nexport const getBusinessNameFromABNRecord = (abnRecord: ABNRecord): string => {\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\n return 'Unknown Business Name'\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;AAIrB,8BANF,6BAAmB,CAME;AAAE,0GAL5B,+CAAyB,OAK4B;AAHvD,qEAAoD;AACpD,6DAA4C","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'\n\nexport { replaceCustomValues, getElementSubmissionValue }\n"]}
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"]}
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.2-beta.1",
4
+ "version": "0.3.2-beta.2",
5
5
  "author": "OneBlink <developers@oneblink.io> (https://oneblink.io)",
6
6
  "bugs": {
7
7
  "url": "https://github.com/oneblink/sdk-core-js/issues"