@oneblink/sdk-core 8.11.1 → 9.0.0-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.
- package/dist/abnService.d.ts +5 -5
- package/dist/abnService.js +9 -17
- package/dist/abnService.js.map +1 -1
- package/dist/conditionalLogicService/conditionallyShowElement.d.ts +1 -1
- package/dist/conditionalLogicService/conditionallyShowElement.js +4 -11
- package/dist/conditionalLogicService/conditionallyShowElement.js.map +1 -1
- package/dist/conditionalLogicService/conditionallyShowOption.d.ts +1 -1
- package/dist/conditionalLogicService/conditionallyShowOption.js +10 -18
- package/dist/conditionalLogicService/conditionallyShowOption.js.map +1 -1
- package/dist/conditionalLogicService/evaluateConditionalOptionsPredicate.js +2 -6
- package/dist/conditionalLogicService/evaluateConditionalOptionsPredicate.js.map +1 -1
- package/dist/conditionalLogicService/evaluateConditionalPredicate.d.ts +1 -1
- package/dist/conditionalLogicService/evaluateConditionalPredicate.js +14 -22
- package/dist/conditionalLogicService/evaluateConditionalPredicate.js.map +1 -1
- package/dist/conditionalLogicService/generateFormElementsConditionallyShown.js +12 -19
- package/dist/conditionalLogicService/generateFormElementsConditionallyShown.js.map +1 -1
- package/dist/conditionalLogicService/types.js +1 -2
- package/dist/conditionalLogicService.d.ts +1 -1
- package/dist/conditionalLogicService.js +6 -26
- package/dist/conditionalLogicService.js.map +1 -1
- package/dist/fileUploadService.js +2 -6
- package/dist/fileUploadService.js.map +1 -1
- package/dist/form-elements-regex.js +10 -14
- package/dist/form-elements-regex.js.map +1 -1
- package/dist/formElementsService.d.ts +2 -3
- package/dist/formElementsService.js +4 -15
- package/dist/formElementsService.js.map +1 -1
- package/dist/freshdeskService.d.ts +1 -1
- package/dist/freshdeskService.js +23 -31
- package/dist/freshdeskService.js.map +1 -1
- package/dist/goodToGoService.d.ts +1 -1
- package/dist/goodToGoService.js +2 -6
- package/dist/goodToGoService.js.map +1 -1
- package/dist/index.d.ts +14 -14
- package/dist/index.js +14 -50
- package/dist/index.js.map +1 -1
- package/dist/paymentService.d.ts +1 -1
- package/dist/paymentService.js +11 -18
- package/dist/paymentService.js.map +1 -1
- package/dist/replaceCustomValues.js +42 -50
- package/dist/replaceCustomValues.js.map +1 -1
- package/dist/schedulingService.js +3 -6
- package/dist/schedulingService.js.map +1 -1
- package/dist/sharepointService.d.ts +1 -1
- package/dist/sharepointService.js +4 -8
- package/dist/sharepointService.js.map +1 -1
- package/dist/submissionService.d.ts +1 -1
- package/dist/submissionService.js +4 -21
- package/dist/submissionService.js.map +1 -1
- package/dist/typeCastService.js +1 -5
- package/dist/typeCastService.js.map +1 -1
- package/dist/typedoc.d.ts +1 -1
- package/dist/typedoc.js +2 -18
- package/dist/typedoc.js.map +1 -1
- package/dist/types/resource-definitions.js +1 -2
- package/dist/userService.js +8 -11
- package/dist/userService.js.map +1 -1
- package/dist/webhookSubscriptionService.js +1 -3
- package/dist/webhookSubscriptionService.js.map +1 -1
- package/package.json +25 -27
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sharepointService.js","sourceRoot":"","sources":["../src/sharepointService.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"sharepointService.js","sourceRoot":"","sources":["../src/sharepointService.ts"],"names":[],"mappings":"AAOA,MAAM,UAAU,2CAA2C,CACzD,iBAAqC;IAErC,OAAO,iBAAiB,CAAC,MAAM,CAC7B,CAAC,IAAI,EAAE,gBAAgB,EAAE,EAAE;QACzB,IACE,CAAC,gBAAgB,CAAC,QAAQ;YAC1B,gBAAgB,CAAC,WAAW,KAAK,SAAS;YAC1C,gBAAgB,CAAC,IAAI;YACrB,gBAAgB,CAAC,EAAE;YACnB,gBAAgB,CAAC,WAAW,EAC5B,CAAC;YACD,IAAI,gBAAgB,CAAC,IAAI,EAAE,kBAAkB,EAAE,CAAC;gBAC9C,IAAI,CAAC,IAAI,CAAC;oBACR,EAAE,EAAE,gBAAgB,CAAC,EAAE;oBACvB,UAAU,EAAE,KAAK;o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AQ,EAAE,CAAC;gBACrC,IAAI,CAAC,IAAI,CAAC;oBACR,EAAE,EAAE,gBAAgB,CAAC,EAAE;oBACvB,UAAU,EAAE,KAAK;oBACjB,8BAA8B,EAAE,gBAAgB,CAAC,IAAI;oBACrD,WAAW,EAAE,gBAAgB,CAAC,WAAW;oBACzC,IAAI,EAAE,UAAU;iBACjB,CAAC,CAAA;YACJ,CAAC;iBAAM,IAAI,gBAAgB,CAAC,MAAM,EAAE,CAAC;gBACnC,IAAI,CAAC,IAAI,CAAC;oBACR,EAAE,EAAE,gBAAgB,CAAC,EAAE;oBACvB,UAAU,EAAE,KAAK;oBACjB,8BAA8B,EAAE,gBAAgB,CAAC,IAAI;oBACrD,WAAW,EAAE,gBAAgB,CAAC,WAAW;oBACzC,IAAI,EAAE,QAAQ;iBACf,CAAC,CAAA;YACJ,CAAC;iBAAM,IAAI,gBAAgB,CAAC,OAAO,EAAE,CAAC;gBACpC,IAAI,CAAC,IAAI,CAAC;oBACR,EAAE,EAAE,gBAAgB,CAAC,EAAE;oBACvB,UAAU,EAAE,KAAK;oBACjB,8BAA8B,EAAE,gBAAgB,CAAC,IAAI;oBACrD,WAAW,EAAE,gBAAgB,CAAC,WAAW;oBACzC,IAAI,EAAE,SAAS;iBAChB,CAAC,CAAA;YACJ,CAAC;QACH,CAAC;QAED,OAAO,IAAI,CAAA;IACb,CAAC,EACD,EAAE,CACH,CAAA;AACH,CAAC","sourcesContent":["import { ColumnDefinition } from '@microsoft/microsoft-graph-types'\nimport { SubmissionEventTypes } from '@oneblink/types'\nimport { ResourceDefinition } from './types/resource-definitions.js'\n\nexport type SharepointColumnResourceDefinition =\n ResourceDefinition<SubmissionEventTypes.SharepointColumnResourceDefinitionBase>\n\nexport function generateSharepointColumnResourceDefinitions(\n columnDefinitions: ColumnDefinition[],\n) {\n return columnDefinitions.reduce<SharepointColumnResourceDefinition[]>(\n (memo, columnDefinition) => {\n if (\n !columnDefinition.readOnly &&\n columnDefinition.columnGroup !== '_Hidden' &&\n columnDefinition.name &&\n columnDefinition.id &&\n columnDefinition.displayName\n ) {\n if (columnDefinition.text?.allowMultipleLines) {\n memo.push({\n id: columnDefinition.id,\n isRequired: false,\n sharepointColumnDefinitionName: columnDefinition.name,\n displayName: columnDefinition.displayName,\n type: 'TEXT_MULTI_LINE',\n })\n } else if (columnDefinition.text) {\n memo.push({\n id: columnDefinition.id,\n isRequired: false,\n sharepointColumnDefinitionName: columnDefinition.name,\n displayName: columnDefinition.displayName,\n type: 'TEXT_SINGLE_LINE',\n })\n } else if (columnDefinition.choice?.choices?.length) {\n memo.push({\n id: columnDefinition.id,\n isRequired: false,\n sharepointColumnDefinitionName: columnDefinition.name,\n displayName: columnDefinition.displayName,\n type: 'CHOICE_SINGLE',\n choices: columnDefinition.choice.choices.map((choice) => ({\n label: choice,\n value: choice,\n })),\n })\n } else if (columnDefinition.dateTime?.format === 'dateOnly') {\n memo.push({\n id: columnDefinition.id,\n isRequired: false,\n sharepointColumnDefinitionName: columnDefinition.name,\n displayName: columnDefinition.displayName,\n type: 'DATE',\n })\n } else if (columnDefinition.dateTime) {\n memo.push({\n id: columnDefinition.id,\n isRequired: false,\n sharepointColumnDefinitionName: columnDefinition.name,\n displayName: columnDefinition.displayName,\n type: 'DATETIME',\n })\n } else if (columnDefinition.number) {\n memo.push({\n id: columnDefinition.id,\n isRequired: false,\n sharepointColumnDefinitionName: columnDefinition.name,\n displayName: columnDefinition.displayName,\n type: 'NUMBER',\n })\n } else if (columnDefinition.boolean) {\n memo.push({\n id: columnDefinition.id,\n isRequired: false,\n sharepointColumnDefinitionName: columnDefinition.name,\n displayName: columnDefinition.displayName,\n type: 'BOOLEAN',\n })\n }\n }\n\n return memo\n },\n [],\n )\n}\n"]}
|
|
@@ -1,21 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.getRootElementValueById = getRootElementValueById;
|
|
18
|
-
__exportStar(require("./replaceCustomValues"), exports);
|
|
1
|
+
export * from './replaceCustomValues.js';
|
|
19
2
|
/**
|
|
20
3
|
* Takes a form element's id, the form elements and the submission data to
|
|
21
4
|
* return a value from the submission.
|
|
@@ -35,7 +18,7 @@ __exportStar(require("./replaceCustomValues"), exports);
|
|
|
35
18
|
* @param submission
|
|
36
19
|
* @returns
|
|
37
20
|
*/
|
|
38
|
-
function getRootElementValueById(formElementId, formElements, submission) {
|
|
21
|
+
export function getRootElementValueById(formElementId, formElements, submission) {
|
|
39
22
|
for (const formElement of formElements) {
|
|
40
23
|
switch (formElement.type) {
|
|
41
24
|
case 'section':
|
|
@@ -47,7 +30,7 @@ function getRootElementValueById(formElementId, formElements, submission) {
|
|
|
47
30
|
break;
|
|
48
31
|
}
|
|
49
32
|
case 'form': {
|
|
50
|
-
const value = getRootElementValueById(formElementId, formElement.elements || [], submission
|
|
33
|
+
const value = getRootElementValueById(formElementId, formElement.elements || [], submission?.[formElement.name]);
|
|
51
34
|
if (value !== undefined) {
|
|
52
35
|
return value;
|
|
53
36
|
}
|
|
@@ -55,7 +38,7 @@ function getRootElementValueById(formElementId, formElements, submission) {
|
|
|
55
38
|
}
|
|
56
39
|
default: {
|
|
57
40
|
if (formElement.id === formElementId) {
|
|
58
|
-
return submission
|
|
41
|
+
return submission?.[formElement.name];
|
|
59
42
|
}
|
|
60
43
|
}
|
|
61
44
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"submissionService.js","sourceRoot":"","sources":["../src/submissionService.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"submissionService.js","sourceRoot":"","sources":["../src/submissionService.ts"],"names":[],"mappings":"AAEA,cAAc,0BAA0B,CAAA;AAExC;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,UAAU,uBAAuB,CACrC,aAAqB,EACrB,YAAqC,EACrC,UAAsE;IAEtE,KAAK,MAAM,WAAW,IAAI,YAAY,EAAE,CAAC;QACvC,QAAQ,WAAW,CAAC,IAAI,EAAE,CAAC;YACzB,KAAK,SAAS,CAAC;YACf,KAAK,MAAM,CAAC,CAAC,CAAC;gBACZ,MAAM,KAAK,GAAG,uBAAuB,CACnC,aAAa,EACb,WAAW,CAAC,QAAQ,EACpB,UAAU,CACX,CAAA;gBACD,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;oBACxB,OAAO,KAAK,CAAA;gBACd,CAAC;gBACD,MAAK;YACP,CAAC;YACD,KAAK,MAAM,CAAC,CAAC,CAAC;gBACZ,MAAM,KAAK,GAAG,uBAAuB,CACnC,aAAa,EACb,WAAW,CAAC,QAAQ,IAAI,EAAE,EAC1B,UAAU,EAAE,CACV,WAAW,CAAC,IAAI,CACiC,CACpD,CAAA;gBACD,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;oBACxB,OAAO,KAAK,CAAA;gBACd,CAAC;gBACD,MAAK;YACP,CAAC;YACD,OAAO,CAAC,CAAC,CAAC;gBACR,IAAI,WAAW,CAAC,EAAE,KAAK,aAAa,EAAE,CAAC;oBACrC,OAAO,UAAU,EAAE,CAAC,WAAW,CAAC,IAAI,CAAC,CAAA;gBACvC,CAAC;YACH,CAAC;QACH,CAAC;IACH,CAAC;AACH,CAAC","sourcesContent":["import { FormTypes, SubmissionTypes } from '@oneblink/types'\n\nexport * from './replaceCustomValues.js'\n\n/**\n * Takes a form element's id, the form elements and the submission data to\n * return a value from the submission.\n *\n * #### Example\n *\n * ```js\n * const value = submissionService.getRootElementById(\n * formElementId,\n * form.elements,\n * submission,\n * )\n * ```\n *\n * @param formElementId\n * @param formElements\n * @param submission\n * @returns\n */\nexport function getRootElementValueById(\n formElementId: string,\n formElements: FormTypes.FormElement[],\n submission: SubmissionTypes.S3SubmissionData['submission'] | undefined,\n): unknown {\n for (const formElement of formElements) {\n switch (formElement.type) {\n case 'section':\n case 'page': {\n const value = getRootElementValueById(\n formElementId,\n formElement.elements,\n submission,\n )\n if (value !== undefined) {\n return value\n }\n break\n }\n case 'form': {\n const value = getRootElementValueById(\n formElementId,\n formElement.elements || [],\n submission?.[\n formElement.name\n ] as SubmissionTypes.S3SubmissionData['submission'],\n )\n if (value !== undefined) {\n return value\n }\n break\n }\n default: {\n if (formElement.id === formElementId) {\n return submission?.[formElement.name]\n }\n }\n }\n }\n}\n"]}
|
package/dist/typeCastService.js
CHANGED
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.submissionEvents = exports.formElements = void 0;
|
|
4
1
|
const toOptionsElement = (e) => {
|
|
5
2
|
switch (e.type) {
|
|
6
3
|
case 'freshdeskDependentField':
|
|
@@ -191,7 +188,6 @@ const formElements = {
|
|
|
191
188
|
toStorageElement,
|
|
192
189
|
toAutoLookupElement,
|
|
193
190
|
};
|
|
194
|
-
exports.formElements = formElements;
|
|
195
191
|
const toPaymentSubmissionEvent = (e) => {
|
|
196
192
|
switch (e.type) {
|
|
197
193
|
case 'BPOINT':
|
|
@@ -208,5 +204,5 @@ const toPaymentSubmissionEvent = (e) => {
|
|
|
208
204
|
const submissionEvents = {
|
|
209
205
|
toPaymentSubmissionEvent,
|
|
210
206
|
};
|
|
211
|
-
|
|
207
|
+
export { formElements, submissionEvents };
|
|
212
208
|
//# sourceMappingURL=typeCastService.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"typeCastService.js","sourceRoot":"","sources":["../src/typeCastService.ts"],"names":[],"mappings":"
|
|
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,CAAC;QACf,KAAK,yBAAyB,CAAC;QAC/B,KAAK,QAAQ,CAAC;QACd,KAAK,YAAY,CAAC;QAClB,KAAK,OAAO,CAAC;QACb,KAAK,cAAc,CAAC;QACpB,KAAK,YAAY,CAAC,CAAC,CAAC;YAClB,OAAO,CAAC,CAAA;QACV,CAAC;QACD,OAAO,CAAC,CAAC,CAAC;YACR,OAAM;QACR,CAAC;IACH,CAAC;AACH,CAAC,CAAA;AAED,MAAM,qBAAqB,GAAG,CAC5B,CAAwB,EACmB,EAAE;IAC7C,QAAQ,CAAC,CAAC,IAAI,EAAE,CAAC;QACf,KAAK,MAAM,CAAC;QACZ,KAAK,UAAU,CAAC,CAAC,CAAC;YAChB,OAAO,CAAC,CAAA;QACV,CAAC;QACD,OAAO,CAAC,CAAC,CAAC;YACR,OAAM;QACR,CAAC;IACH,CAAC;AACH,CAAC,CAAA;AAED,MAAM,wBAAwB,GAAG,CAC/B,CAAwB,EACsB,EAAE;IAChD,QAAQ,CAAC,CAAC,IAAI,EAAE,CAAC;QACf,KAAK,MAAM,CAAC;QACZ,KAAK,UAAU,CAAC,CAAC,CAAC;YAChB,OAAM;QACR,CAAC;QACD,OAAO,CAAC,CAAC,CAAC;YACR,OAAO,CAAC,CAAA;QACV,CAAC;IACH,CAAC;AACH,CAAC,CAAA;AAED,MAAM,eAAe,GAAG,CACtB,CAAwB,EACiB,EAAE;IAC3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AAC,CAAC,CAAC;YACnB,OAAO,CAAC,CAAA;QACV,CAAC;QACD,OAAO,CAAC,CAAC,CAAC;YACR,OAAM;QACR,CAAC;IACH,CAAC;AACH,CAAC,CAAA;AAED,MAAM,gBAAgB,GAAG;IACvB,wBAAwB;CACzB,CAAA;AAED,OAAO,EAAE,YAAY,EAAE,gBAAgB,EAAE,CAAA","sourcesContent":["import { FormTypes, SubmissionEventTypes } from '@oneblink/types'\n\nconst toOptionsElement = (\n e: FormTypes.FormElement,\n): FormTypes.FormElementWithOptions | undefined => {\n switch (e.type) {\n case 'freshdeskDependentField':\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 'freshdeskDependentField':\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 'pointCadastralParcel':\n case 'pointAddress':\n case 'pointAddressV3':\n case 'geoscapeAddress':\n case 'civicaStreetName':\n case 'bsb':\n case 'autocomplete':\n case 'abn':\n case 'apiNSWLiquorLicence':\n case 'googleAddress':\n case 'arcGISWebMap':\n case 'lookupButton': {\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\nconst toNamelessElement = (\n e: FormTypes.FormElement,\n): FormTypes.FormElementWithoutName | undefined => {\n switch (e.type) {\n case 'section':\n case 'page': {\n return e\n }\n default: {\n return\n }\n }\n}\n\nfunction toNamedElement(\n e: FormTypes.FormElement,\n): FormTypes.FormElementWithName | undefined {\n switch (e.type) {\n case 'page':\n case 'section': {\n return undefined\n }\n default: {\n return e\n }\n }\n}\n\nexport type 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 toStorageElement = (\n e: FormTypes.FormElement,\n): FormTypes.StorageElement | undefined => {\n switch (e.type) {\n case 'files':\n case 'draw':\n case 'compliance':\n case 'camera': {\n return e\n }\n default: {\n return\n }\n }\n}\n\nconst toAutoLookupElement = (e: FormTypes.FormElement) => {\n switch (e.type) {\n case 'radio':\n case 'boolean':\n case 'files':\n case 'location':\n case 'pointCadastralParcel':\n case 'geoscapeAddress':\n case 'pointAddress':\n case 'pointAddressV3':\n case 'compliance':\n case 'civicaStreetName':\n case 'autocomplete':\n case 'apiNSWLiquorLicence':\n case 'arcGISWebMap': {\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 toNamedElement,\n toNonNestedElementsElement,\n toPageElement,\n toRepeatableSetElement,\n toStorageElement,\n toAutoLookupElement,\n}\n\nconst toPaymentSubmissionEvent = (\n e: SubmissionEventTypes.FormEvent,\n): SubmissionEventTypes.FormPaymentEvent | undefined => {\n switch (e.type) {\n case 'BPOINT':\n case 'CP_PAY':\n case 'WESTPAC_QUICK_STREAM':\n case 'NSW_GOV_PAY': {\n return e\n }\n default: {\n return\n }\n }\n}\n\nconst submissionEvents = {\n toPaymentSubmissionEvent,\n}\n\nexport { formElements, submissionEvents }\n"]}
|
package/dist/typedoc.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from './index';
|
|
1
|
+
export * from './index.js';
|
|
2
2
|
export * from '@oneblink/types';
|
package/dist/typedoc.js
CHANGED
|
@@ -1,19 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./index"), exports);
|
|
18
|
-
__exportStar(require("@oneblink/types"), exports);
|
|
1
|
+
export * from './index.js';
|
|
2
|
+
export * from '@oneblink/types';
|
|
19
3
|
//# sourceMappingURL=typedoc.js.map
|
package/dist/typedoc.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"typedoc.js","sourceRoot":"","sources":["../src/typedoc.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"typedoc.js","sourceRoot":"","sources":["../src/typedoc.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAA;AAC1B,cAAc,iBAAiB,CAAA","sourcesContent":["export * from './index.js'\nexport * from '@oneblink/types'\n"]}
|
package/dist/userService.js
CHANGED
|
@@ -1,7 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.parseUserProfile = parseUserProfile;
|
|
4
|
-
exports.getUserFriendlyName = getUserFriendlyName;
|
|
5
1
|
function parseBoolean(value) {
|
|
6
2
|
return typeof value === 'boolean' ? value : undefined;
|
|
7
3
|
}
|
|
@@ -32,8 +28,7 @@ function parseAddress(address) {
|
|
|
32
28
|
*
|
|
33
29
|
* @param data An object containing all parameters to be passed to the function
|
|
34
30
|
*/
|
|
35
|
-
function parseUserProfile(data) {
|
|
36
|
-
var _a, _b, _c, _d;
|
|
31
|
+
export function parseUserProfile(data) {
|
|
37
32
|
if (typeof data !== 'object' || !data) {
|
|
38
33
|
return;
|
|
39
34
|
}
|
|
@@ -63,7 +58,9 @@ function parseUserProfile(data) {
|
|
|
63
58
|
},
|
|
64
59
|
phoneNumber: parseString(jwtPayload['custom:phone_number']),
|
|
65
60
|
phoneNumberVerified: parseBoolean(jwtPayload['custom:phone_number_verified']),
|
|
66
|
-
groups:
|
|
61
|
+
groups: parseString(jwtPayload['custom:groups'])
|
|
62
|
+
?.split(',')
|
|
63
|
+
.map((group) => group.trim()),
|
|
67
64
|
areaCode: parseString(jwtPayload['custom:area_code']),
|
|
68
65
|
city: parseString(jwtPayload['custom:city']),
|
|
69
66
|
state: parseString(jwtPayload['custom:state']),
|
|
@@ -78,9 +75,9 @@ function parseUserProfile(data) {
|
|
|
78
75
|
zipCode: parseString(jwtPayload['custom:zip_code']),
|
|
79
76
|
postalCode: parseString(jwtPayload['custom:postal_code']),
|
|
80
77
|
};
|
|
81
|
-
if (!
|
|
82
|
-
!
|
|
83
|
-
!
|
|
78
|
+
if (!userProfile.supervisor?.fullName &&
|
|
79
|
+
!userProfile.supervisor?.email &&
|
|
80
|
+
!userProfile.supervisor?.providerUserId) {
|
|
84
81
|
userProfile.supervisor = undefined;
|
|
85
82
|
}
|
|
86
83
|
if (jwtPayload.identities &&
|
|
@@ -113,7 +110,7 @@ function parseUserProfile(data) {
|
|
|
113
110
|
* @param userProfile
|
|
114
111
|
* @returns
|
|
115
112
|
*/
|
|
116
|
-
function getUserFriendlyName(userProfile) {
|
|
113
|
+
export function getUserFriendlyName(userProfile) {
|
|
117
114
|
if (userProfile.fullName) {
|
|
118
115
|
return userProfile.fullName;
|
|
119
116
|
}
|
package/dist/userService.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"userService.js","sourceRoot":"","sources":["../src/userService.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"userService.js","sourceRoot":"","sources":["../src/userService.ts"],"names":[],"mappings":"AAEA,SAAS,YAAY,CAAC,KAAc;IAClC,OAAO,OAAO,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CAAA;AACvD,CAAC;AAED,SAAS,WAAW,CAAC,KAAc;IACjC,OAAO,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CAAA;AACtD,CAAC;AAED,SAAS,YAAY,CAAC,OAAgB;IACpC,IAAI,OAAO,OAAO,KAAK,QAAQ,IAAI,OAAO,IAAI,WAAW,IAAI,OAAO,EAAE,CAAC;QACrE,OAAO,WAAW,CAAC,OAAO,CAAC,SAAS,CAAC,CAAA;IACvC,CAAC;IAED,OAAO,WAAW,CAAC,OAAO,CAAC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C","sourcesContent":["import { MiscTypes } from '@oneblink/types'\n\nfunction parseBoolean(value: unknown): boolean | undefined {\n return typeof value === 'boolean' ? value : undefined\n}\n\nfunction parseString(value: unknown): string | undefined {\n return typeof value === 'string' ? value : undefined\n}\n\nfunction parseAddress(address: unknown): string | undefined {\n if (typeof address === 'object' && address && 'formatted' in address) {\n return parseString(address.formatted)\n }\n\n return parseString(address)\n}\n\n/**\n * Parse a User Profile based on a JWT payload. Will return `undefined` if not a\n * valid JWT payload\n *\n * #### Example\n *\n * ```js\n * import jwtDecode from 'jwt-decode'\n *\n * const jwtPayload = jwtDecode('a valid token from a user')\n * const userProfile = userService.parseUserProfile(jwtPayload)\n * if (userProfile) {\n * // continue\n * }\n * ```\n *\n * @param data An object containing all parameters to be passed to the function\n */\nexport function parseUserProfile(\n data: unknown,\n): MiscTypes.UserProfile | undefined {\n if (typeof data !== 'object' || !data) {\n return\n }\n const jwtPayload = data as Record<string, unknown>\n if (typeof jwtPayload.sub !== 'string') {\n return\n }\n const userProfile: MiscTypes.UserProfile = {\n isSAMLUser: false,\n providerType: 'Cognito',\n providerUserId: jwtPayload.sub,\n userId: jwtPayload.sub,\n email: parseString(jwtPayload.email),\n emailVerified: parseBoolean(jwtPayload.email_verified),\n firstName: parseString(jwtPayload.given_name),\n middleName: parseString(jwtPayload.middle_name),\n lastName: parseString(jwtPayload.family_name),\n fullName: parseString(jwtPayload.name),\n picture: parseString(jwtPayload.picture),\n address: parseAddress(jwtPayload.address),\n role: parseString(jwtPayload['custom:role']),\n username: parseString(jwtPayload.email) || jwtPayload.sub,\n supervisor: {\n fullName: parseString(jwtPayload['custom:supervisor_name']),\n email: parseString(jwtPayload['custom:supervisor_email']),\n providerUserId: parseString(jwtPayload['custom:supervisor_user_id']),\n },\n phoneNumber: parseString(jwtPayload['custom:phone_number']),\n phoneNumberVerified: parseBoolean(\n jwtPayload['custom:phone_number_verified'],\n ),\n groups: parseString(jwtPayload['custom:groups'])\n ?.split(',')\n .map((group) => group.trim()),\n areaCode: parseString(jwtPayload['custom:area_code']),\n city: parseString(jwtPayload['custom:city']),\n state: parseString(jwtPayload['custom:state']),\n country: parseString(jwtPayload['custom:country']),\n countryCallingCode: parseString(jwtPayload['custom:country_calling_code']),\n department: parseString(jwtPayload['custom:department']),\n division: parseString(jwtPayload['custom:division']),\n bargain: parseString(jwtPayload['custom:bargain']),\n employeeNumber: parseString(jwtPayload['custom:employee_number']),\n departmentHeadFullName: parseString(\n jwtPayload['custom:departmenthead_name'],\n ),\n departmentHeadEmail: parseString(jwtPayload['custom:departmenthead_email']),\n zipCode: parseString(jwtPayload['custom:zip_code']),\n postalCode: parseString(jwtPayload['custom:postal_code']),\n }\n\n if (\n !userProfile.supervisor?.fullName &&\n !userProfile.supervisor?.email &&\n !userProfile.supervisor?.providerUserId\n ) {\n userProfile.supervisor = undefined\n }\n\n if (\n jwtPayload.identities &&\n Array.isArray(jwtPayload.identities) &&\n jwtPayload.identities.length\n ) {\n const { providerType, userId } = jwtPayload.identities[0]\n userProfile.providerType = providerType\n userProfile.providerUserId = userId\n userProfile.isSAMLUser = providerType === 'SAML'\n if (userProfile.isSAMLUser) {\n userProfile.username = jwtPayload.preferred_username || userId\n }\n }\n\n return userProfile\n}\n\n/**\n * A friendly `string` that represents the a [User Profile](#user-profile). Uses\n * first name, last name, full name, email address or username.\n *\n * #### Example\n *\n * ```js\n * const userProfile = userService.parseUserProfile(jwtPayload)\n * const name = userService.getUserFriendlyName(userProfile)\n * if (name) {\n * // Display current user's name\n * }\n * ```\n *\n * @param userProfile\n * @returns\n */\nexport function getUserFriendlyName(\n userProfile: MiscTypes.UserProfile,\n): string {\n if (userProfile.fullName) {\n return userProfile.fullName\n }\n\n if (userProfile.firstName || userProfile.lastName) {\n return [userProfile.firstName, userProfile.lastName].join(' ').trim()\n }\n\n if (userProfile.email) {\n return userProfile.email\n }\n\n if (userProfile.username) {\n return userProfile.username\n }\n\n return userProfile.userId\n}\n"]}
|
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.convertToFormWorkflowEvent = convertToFormWorkflowEvent;
|
|
4
1
|
/**
|
|
5
2
|
* Converts a Webhook sbuscription into its corresponding Form workflow event
|
|
6
3
|
*
|
|
@@ -39,4 +36,5 @@ function convertToFormWorkflowEvent(webhookSubscription) {
|
|
|
39
36
|
},
|
|
40
37
|
};
|
|
41
38
|
}
|
|
39
|
+
export { convertToFormWorkflowEvent };
|
|
42
40
|
//# sourceMappingURL=webhookSubscriptionService.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webhookSubscriptionService.js","sourceRoot":"","sources":["../src/webhookSubscriptionService.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"webhookSubscriptionService.js","sourceRoot":"","sources":["../src/webhookSubscriptionService.ts"],"names":[],"mappings":"AAEA;;;;;GAKG;AACH,SAAS,0BAA0B,CACjC,mBAA6D;IAE7D,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,mBAAmB,CAAC,WAAW,CAAC,CAAA;IACpD,IACE,GAAG,CAAC,QAAQ,CAAC,QAAQ,CAAC,iBAAiB,CAAC;QACxC,GAAG,CAAC,QAAQ,CAAC,QAAQ,CAAC,gBAAgB,CAAC;QACvC,GAAG,CAAC,QAAQ,CAAC,QAAQ,CAAC,uBAAuB,CAAC,EAC9C,CAAC;QACD,OAAO;YACL,IAAI,EAAE,qBAAqB;YAC3B,KAAK,EAAE,mBAAmB,CAAC,KAAK;YAChC,aAAa,EAAE;gBACb,GAAG,EAAE,mBAAmB,CAAC,WAAW;gBACpC,MAAM,EAAE,mBAAmB,CAAC,MAAM;aACnC;SACF,CAAA;IACH,CAAC;IAED,IAAI,GAAG,CAAC,QAAQ,CAAC,QAAQ,CAAC,eAAe,CAAC,EAAE,CAAC;QAC3C,OAAO;YACL,IAAI,EAAE,4BAA4B;YAClC,KAAK,EAAE,mBAAmB,CAAC,KAAK;YAChC,aAAa,EAAE;gBACb,GAAG,EAAE,mBAAmB,CAAC,WAAW;gBACpC,MAAM,EAAE,mBAAmB,CAAC,MAAM;aACnC;SACF,CAAA;IACH,CAAC;IAED,OAAO;QACL,IAAI,EAAE,UAAU;QAChB,KAAK,EAAE,mBAAmB,CAAC,KAAK;QAChC,aAAa,EAAE;YACb,GAAG,EAAE,mBAAmB,CAAC,WAAW;SACrC;KACF,CAAA;AACH,CAAC;AAED,OAAO,EAAE,0BAA0B,EAAE,CAAA","sourcesContent":["import { SubmissionEventTypes } from '@oneblink/types'\n\n/**\n * Converts a Webhook sbuscription into its corresponding Form workflow event\n *\n * @param webhookSubscription The subscription to be converted\n * @returns\n */\nfunction convertToFormWorkflowEvent(\n webhookSubscription: SubmissionEventTypes.WebhookSubscription,\n): SubmissionEventTypes.FormWorkflowEvent {\n const url = new URL(webhookSubscription.callbackUrl)\n if (\n url.hostname.endsWith('logic.azure.com') ||\n url.hostname.endsWith('logic.azure.us') ||\n url.hostname.endsWith('api.powerplatform.com')\n ) {\n return {\n type: 'POWER_AUTOMATE_FLOW',\n label: webhookSubscription.label,\n configuration: {\n url: webhookSubscription.callbackUrl,\n formId: webhookSubscription.formId,\n },\n }\n }\n\n if (url.hostname.endsWith('civicplus.com')) {\n return {\n type: 'CP_INTEGRATION_HUB_WEBHOOK',\n label: webhookSubscription.label,\n configuration: {\n url: webhookSubscription.callbackUrl,\n formId: webhookSubscription.formId,\n },\n }\n }\n\n return {\n type: 'CALLBACK',\n label: webhookSubscription.label,\n configuration: {\n url: webhookSubscription.callbackUrl,\n },\n }\n}\n\nexport { convertToFormWorkflowEvent }\n"]}
|
package/package.json
CHANGED
|
@@ -1,44 +1,41 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@oneblink/sdk-core",
|
|
3
3
|
"description": "OneBlink SDK for JavaScript (works in Browsers and NodeJS)",
|
|
4
|
-
"version": "
|
|
4
|
+
"version": "9.0.0-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"
|
|
8
8
|
},
|
|
9
9
|
"devDependencies": {
|
|
10
|
-
"@eslint/eslintrc": "^3.3.
|
|
11
|
-
"@eslint/js": "^9.
|
|
10
|
+
"@eslint/eslintrc": "^3.3.3",
|
|
11
|
+
"@eslint/js": "^9.39.2",
|
|
12
12
|
"@microsoft/eslint-plugin-sdl": "^1.1.0",
|
|
13
|
-
"@microsoft/microsoft-graph-types": "^2.
|
|
14
|
-
"@oneblink/release-cli": "^
|
|
13
|
+
"@microsoft/microsoft-graph-types": "^2.43.1",
|
|
14
|
+
"@oneblink/release-cli": "^4.0.0-beta.2",
|
|
15
15
|
"@oneblink/types": "github:oneblink/types",
|
|
16
|
-
"@spotto/contract": "^1.0.69-alpha.
|
|
17
|
-
"@types/
|
|
18
|
-
"@
|
|
19
|
-
"@typescript-eslint/
|
|
20
|
-
"
|
|
21
|
-
"eslint": "^
|
|
22
|
-
"eslint-
|
|
23
|
-
"eslint-plugin-prettier": "^5.2.5",
|
|
24
|
-
"eslint-plugin-react": "^7.37.4",
|
|
16
|
+
"@spotto/contract": "^1.0.69-alpha.13",
|
|
17
|
+
"@types/lodash": "^4.17.23",
|
|
18
|
+
"@typescript-eslint/eslint-plugin": "^8.53.0",
|
|
19
|
+
"@typescript-eslint/parser": "^8.53.0",
|
|
20
|
+
"eslint": "^9.39.2",
|
|
21
|
+
"eslint-config-prettier": "^10.1.8",
|
|
22
|
+
"eslint-plugin-prettier": "^5.5.4",
|
|
25
23
|
"fixpack": "^4.0.0",
|
|
26
|
-
"globals": "^
|
|
27
|
-
"
|
|
28
|
-
"
|
|
29
|
-
"prettier": "^
|
|
30
|
-
"
|
|
31
|
-
"
|
|
32
|
-
"
|
|
33
|
-
"
|
|
34
|
-
"typescript": "^5.8.2"
|
|
24
|
+
"globals": "^17.0.0",
|
|
25
|
+
"lodash": "^4.17.23",
|
|
26
|
+
"prettier": "^3.7.4",
|
|
27
|
+
"prettier-plugin-jsdoc": "^1.8.0",
|
|
28
|
+
"tsc-watch": "^7.2.0",
|
|
29
|
+
"typedoc": "^0.28.16",
|
|
30
|
+
"typescript": "^5.9.3",
|
|
31
|
+
"vitest": "^4.0.17"
|
|
35
32
|
},
|
|
36
33
|
"directories": {
|
|
37
34
|
"doc": "docs"
|
|
38
35
|
},
|
|
39
36
|
"engines": {
|
|
40
|
-
"node": ">=
|
|
41
|
-
"npm": ">=
|
|
37
|
+
"node": ">=24",
|
|
38
|
+
"npm": ">=11"
|
|
42
39
|
},
|
|
43
40
|
"files": [
|
|
44
41
|
"dist"
|
|
@@ -65,9 +62,10 @@
|
|
|
65
62
|
"pretest": "npm run fixpack && npm run eslint",
|
|
66
63
|
"release": "oneblink-release repository --no-name",
|
|
67
64
|
"start": "tsc-watch",
|
|
68
|
-
"test": "
|
|
65
|
+
"test": "vitest run",
|
|
69
66
|
"types": "npm install --save-dev github:oneblink/types",
|
|
70
67
|
"typescript": "tsc --noEmit",
|
|
71
68
|
"update-dependents": "oneblink-release update-dependents --force"
|
|
72
|
-
}
|
|
69
|
+
},
|
|
70
|
+
"type": "module"
|
|
73
71
|
}
|