@oneblink/sdk-core 0.3.2-beta.5 → 0.3.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.
@@ -3,14 +3,15 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.displayABNNumberFromABNRecord = exports.getABNNumberFromABNRecord = exports.displayBusinessNameFromABNRecord = exports.getBusinessNameFromABNRecord = void 0;
4
4
  const createLegalName = ({ familyName, givenName, otherGivenName, }) => {
5
5
  let legalName = '';
6
+ // Concat last name
7
+ if (familyName)
8
+ legalName += `${familyName}, `;
9
+ // Concat first name
6
10
  if (givenName)
7
11
  legalName += `${givenName} `;
8
12
  // Concat middle name
9
13
  if (otherGivenName)
10
- legalName += `${otherGivenName} `;
11
- // Concat last name
12
- if (familyName)
13
- legalName += `${familyName}`;
14
+ legalName += `${otherGivenName}`;
14
15
  return legalName;
15
16
  };
16
17
  const getBusinessNameFromABNRecord = (abnRecord) => {
@@ -1 +1 @@
1
- {"version":3,"file":"abnService.js","sourceRoot":"","sources":["../src/abnService.ts"],"names":[],"mappings":";;;AAEA,MAAM,eAAe,GAAG,CAAC,EACvB,UAAU,EACV,SAAS,EACT,cAAc,GACsB,EAAE,EAAE;IACxC,IAAI,SAAS,GAAG,EAAE,CAAA;IAClB,IAAI,SAAS;QAAE,SAAS,IAAI,GAAG,SAAS,GAAG,CAAA;IAC3C,qBAAqB;IACrB,IAAI,cAAc;QAAE,SAAS,IAAI,GAAG,cAAc,GAAG,CAAA;IACrD,mBAAmB;IACnB,IAAI,UAAU;QAAE,SAAS,IAAI,GAAG,UAAU,EAAE,CAAA;IAE5C,OAAO,SAAS,CAAA;AAClB,CAAC,CAAA;AAEM,MAAM,4BAA4B,GAAG,CAC1C,SAAoB,EACA,EAAE;;IACtB,IAAI,SAAS,CAAC,UAAU,CAAC,cAAc,KAAK,KAAK,IAAI,SAAS,CAAC,SAAS,EAAE;QACxE,MAAM,SAAS,GAAG,eAAe,CAAC,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U,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\nconst createLegalName = ({\n familyName,\n givenName,\n otherGivenName,\n}: NonNullable<ABNRecord['legalName']>) => {\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 return legalName\n}\n\nexport const getBusinessNameFromABNRecord = (\n abnRecord: ABNRecord,\n): string | undefined => {\n if (abnRecord.entityType.entityTypeCode === 'IND' && abnRecord.legalName) {\n const legalName = createLegalName(abnRecord.legalName)\n if (legalName) return legalName.trim()\n }\n\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 legalName = createLegalName(abnRecord.legalName)\n if (legalName) return legalName.trim()\n }\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"]}
1
+ {"version":3,"file":"abnService.js","sourceRoot":"","sources":["../src/abnService.ts"],"names":[],"mappings":";;;AAEA,MAAM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uBAAuB,CAAA;AAChD,CAAC,CAAA;AALY,QAAA,gCAAgC,oCAK5C;AAEM,MAAM,yBAAyB,GAAG,CACvC,SAAoB,EACA,EAAE;IACtB,IAAI,CAAC,SAAS,CAAC,GAAG;QAAE,OAAM;IAC1B,IAAI,KAAK,CAAC,OAAO,CAAC,SAAS,CAAC,GAAG,CAAC,EAAE;QAChC,MAAM,WAAW,GAAG,SAAS,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,kBAAkB,CAAC,CAAA;QACvE,OAAO,WAAW,aAAX,WAAW,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\nconst createLegalName = ({\n familyName,\n givenName,\n otherGivenName,\n}: NonNullable<ABNRecord['legalName']>) => {\n let legalName = ''\n // Concat last name\n if (familyName) legalName += `${familyName}, `\n // Concat first name\n if (givenName) legalName += `${givenName} `\n // Concat middle name\n if (otherGivenName) legalName += `${otherGivenName}`\n\n return legalName\n}\n\nexport const getBusinessNameFromABNRecord = (\n abnRecord: ABNRecord,\n): string | undefined => {\n if (abnRecord.entityType.entityTypeCode === 'IND' && abnRecord.legalName) {\n const legalName = createLegalName(abnRecord.legalName)\n if (legalName) return legalName.trim()\n }\n\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 legalName = createLegalName(abnRecord.legalName)\n if (legalName) return legalName.trim()\n }\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"]}
@@ -0,0 +1 @@
1
+ export declare function getContentDisposition(filename: string): string;
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getContentDisposition = void 0;
4
+ function getContentDisposition(filename) {
5
+ return `attachment; filename*=UTF-8''${encodeURIComponent(filename)}`;
6
+ }
7
+ exports.getContentDisposition = getContentDisposition;
8
+ //# sourceMappingURL=fileUploadService.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fileUploadService.js","sourceRoot":"","sources":["../src/fileUploadService.ts"],"names":[],"mappings":";;;AAAA,SAAgB,qBAAqB,CAAC,QAAgB;IACpD,OAAO,gCAAgC,kBAAkB,CAAC,QAAQ,CAAC,EAAE,CAAA;AACvE,CAAC;AAFD,sDAEC","sourcesContent":["export function getContentDisposition(filename: string): string {\n return `attachment; filename*=UTF-8''${encodeURIComponent(filename)}`\n}\n"]}
package/dist/index.d.ts CHANGED
@@ -4,4 +4,5 @@ import replaceCustomValues, { getElementSubmissionValue } from './replaceCustomV
4
4
  export * as typeCastService from './typeCastService';
5
5
  export * as userService from './userService';
6
6
  export * as abnService from './abnService';
7
+ export { getContentDisposition } from './fileUploadService';
7
8
  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.abnService = exports.userService = exports.typeCastService = exports.conditionalLogicService = exports.formElementsService = void 0;
22
+ exports.getElementSubmissionValue = exports.replaceCustomValues = exports.getContentDisposition = 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"));
@@ -28,4 +28,6 @@ Object.defineProperty(exports, "getElementSubmissionValue", { enumerable: true,
28
28
  exports.typeCastService = __importStar(require("./typeCastService"));
29
29
  exports.userService = __importStar(require("./userService"));
30
30
  exports.abnService = __importStar(require("./abnService"));
31
+ var fileUploadService_1 = require("./fileUploadService");
32
+ Object.defineProperty(exports, "getContentDisposition", { enumerable: true, get: function () { return fileUploadService_1.getContentDisposition; } });
31
33
  //# 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;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"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA,6EAA4D;AAC5D,qFAAoE;AACpE,6EAE8B;AAMrB,8BARF,6BAAmB,CAQE;AAAE,0GAP5B,+CAAyB,OAO4B;AALvD,qEAAoD;AACpD,6DAA4C;AAC5C,2DAA0C;AAC1C,yDAA2D;AAAlD,0HAAA,qBAAqB,OAAA","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'\nexport { getContentDisposition } from './fileUploadService'\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.5",
4
+ "version": "0.3.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"