@oneblink/sdk-core 7.4.0 → 8.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.js.map +1 -1
- package/dist/conditionalLogicService/conditionallyShowElement.js +2 -3
- package/dist/conditionalLogicService/conditionallyShowElement.js.map +1 -1
- package/dist/conditionalLogicService/conditionallyShowOption.js +1 -1
- package/dist/conditionalLogicService/conditionallyShowOption.js.map +1 -1
- package/dist/conditionalLogicService/evaluateConditionalOptionsPredicate.js +1 -1
- package/dist/conditionalLogicService/evaluateConditionalOptionsPredicate.js.map +1 -1
- package/dist/conditionalLogicService/evaluateConditionalPredicate.js +1 -1
- package/dist/conditionalLogicService/evaluateConditionalPredicate.js.map +1 -1
- package/dist/conditionalLogicService/generateFormElementsConditionallyShown.js +3 -4
- package/dist/conditionalLogicService/generateFormElementsConditionallyShown.js.map +1 -1
- package/dist/conditionalLogicService.js +1 -2
- package/dist/conditionalLogicService.js.map +1 -1
- package/dist/fileUploadService.js +1 -2
- package/dist/fileUploadService.js.map +1 -1
- package/dist/form-elements-regex.js +2 -2
- package/dist/form-elements-regex.js.map +1 -1
- package/dist/formElementsService.js +8 -8
- package/dist/formElementsService.js.map +1 -1
- package/dist/freshdeskService.js +3 -3
- package/dist/freshdeskService.js.map +1 -1
- package/dist/index.js +17 -7
- package/dist/index.js.map +1 -1
- package/dist/paymentService.d.ts +3 -1
- package/dist/paymentService.js +2 -2
- package/dist/paymentService.js.map +1 -1
- package/dist/replaceCustomValues.js +4 -5
- package/dist/replaceCustomValues.js.map +1 -1
- package/dist/schedulingService.js +1 -2
- package/dist/schedulingService.js.map +1 -1
- package/dist/sharepointService.js +10 -4
- package/dist/sharepointService.js.map +1 -1
- package/dist/submissionService.js +1 -2
- package/dist/submissionService.js.map +1 -1
- package/dist/typeCastService.js.map +1 -1
- package/dist/types/resource-definitions.d.ts +4 -1
- package/dist/types/resource-definitions.js.map +1 -1
- package/dist/userService.js +2 -3
- package/dist/userService.js.map +1 -1
- package/dist/webhookSubscriptionService.js +1 -2
- package/dist/webhookSubscriptionService.js.map +1 -1
- package/package.json +21 -18
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.checkForSchedulingEvent =
|
|
3
|
+
exports.checkForSchedulingEvent = checkForSchedulingEvent;
|
|
4
4
|
const _1 = require(".");
|
|
5
5
|
/**
|
|
6
6
|
* Examine a submission and its form definition to validate whether a scheduling
|
|
@@ -29,5 +29,4 @@ function checkForSchedulingEvent(definition, submission) {
|
|
|
29
29
|
formElements: definition.elements,
|
|
30
30
|
}));
|
|
31
31
|
}
|
|
32
|
-
exports.checkForSchedulingEvent = checkForSchedulingEvent;
|
|
33
32
|
//# sourceMappingURL=schedulingService.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schedulingService.js","sourceRoot":"","sources":["../src/schedulingService.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"schedulingService.js","sourceRoot":"","sources":["../src/schedulingService.ts"],"names":[],"mappings":";;AAwBA,0DAgBC;AAnCD,wBAA2C;AAE3C;;;;;;;;;;;;;;;;GAgBG;AACH,SAAgB,uBAAuB,CACrC,UAA0B,EAC1B,UAA0D;IAE1D,MAAM,0BAA0B,GAAG,UAAU,CAAC,gBAAgB,IAAI,EAAE,CAAA;IACpE,OAAO,0BAA0B,CAAC,IAAI,CAAC,CAAC,yBAAyB,EAAE,EAAE,CACnE,0BAAuB,CAAC,6BAA6B,CAAC;QACpD,aAAa,EAAE,CAAC,CAAC,yBAAyB,CAAC,oBAAoB;QAC/D,gCAAgC,EAC9B,CAAC,CAAC,yBAAyB,CAAC,yCAAyC;QACvE,qBAAqB,EACnB,yBAAyB,CAAC,8BAA8B,IAAI,EAAE;QAChE,UAAU,EAAE,UAAU;QACtB,YAAY,EAAE,UAAU,CAAC,QAAQ;KAClC,CAAC,CACH,CAAA;AACH,CAAC","sourcesContent":["import {\n FormTypes,\n SubmissionEventTypes,\n SubmissionTypes,\n} from '@oneblink/types'\nimport { conditionalLogicService } from '.'\n\n/**\n * Examine a submission and its form definition to validate whether a scheduling\n * workflow event needs to run.\n *\n * #### Example\n *\n * ```js\n * const result = schedulingService.checkFormSchedulingEvent(\n * form,\n * submission,\n * )\n * ```\n *\n * @param definition\n * @param submission\n * @returns\n */\nexport function checkForSchedulingEvent(\n definition: FormTypes.Form,\n submission: SubmissionTypes.S3SubmissionData['submission'],\n): SubmissionEventTypes.FormSchedulingEvent | undefined {\n const schedulingSubmissionEvents = definition.schedulingEvents || []\n return schedulingSubmissionEvents.find((schedulingSubmissionEvent) =>\n conditionalLogicService.evaluateConditionalPredicates({\n isConditional: !!schedulingSubmissionEvent.conditionallyExecute,\n requiresAllConditionalPredicates:\n !!schedulingSubmissionEvent.requiresAllConditionallyExecutePredicates,\n conditionalPredicates:\n schedulingSubmissionEvent.conditionallyExecutePredicates || [],\n submission: submission,\n formElements: definition.elements,\n }),\n )\n}\n"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.generateSharepointColumnResourceDefinitions =
|
|
3
|
+
exports.generateSharepointColumnResourceDefinitions = generateSharepointColumnResourceDefinitions;
|
|
4
4
|
function generateSharepointColumnResourceDefinitions(columnDefinitions) {
|
|
5
5
|
return columnDefinitions.reduce((memo, columnDefinition) => {
|
|
6
6
|
var _a, _b, _c, _d;
|
|
@@ -38,8 +38,15 @@ function generateSharepointColumnResourceDefinitions(columnDefinitions) {
|
|
|
38
38
|
label: choice,
|
|
39
39
|
value: choice,
|
|
40
40
|
})),
|
|
41
|
-
checkIsFormElementSupported() {
|
|
42
|
-
|
|
41
|
+
checkIsFormElementSupported(formElementWithOptions, { formsAppEnvironmentId, formElementOptionsSets }) {
|
|
42
|
+
const formElementOptionsSetId = formElementWithOptions.dynamicOptionSetId;
|
|
43
|
+
return (!!formElementOptionsSetId &&
|
|
44
|
+
formElementWithOptions.optionsType === 'DYNAMIC' &&
|
|
45
|
+
formElementOptionsSets.some((formElementOptionsSet) => {
|
|
46
|
+
return (formElementOptionsSet.type === 'SHAREPOINT_LIST_COLUMN' &&
|
|
47
|
+
formElementOptionsSet.environments.some((env) => env.formsAppEnvironmentId === formsAppEnvironmentId &&
|
|
48
|
+
env.sharepointColumn.id === columnDefinition.id));
|
|
49
|
+
}));
|
|
43
50
|
},
|
|
44
51
|
});
|
|
45
52
|
}
|
|
@@ -83,5 +90,4 @@ function generateSharepointColumnResourceDefinitions(columnDefinitions) {
|
|
|
83
90
|
return memo;
|
|
84
91
|
}, []);
|
|
85
92
|
}
|
|
86
|
-
exports.generateSharepointColumnResourceDefinitions = generateSharepointColumnResourceDefinitions;
|
|
87
93
|
//# sourceMappingURL=sharepointService.js.map
|
|
@@ -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,kGAoGC;AApGD,SAAgB,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,MAAA,gBAAgB,CAAC,IAAI,0CAAE,kBAAkB,EAAE,CAAC;gBAC9C,IAAI,CAAC,IAAI,CAAC;oBACR,EAAE,EAAE,gBAAgB,CAAC,EAAE;oBACvB,UAAU,EAAE,KAAK;oBACjB,8BAA8B,E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AK;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'\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 checkIsFormElementSupported(\n formElementWithOptions,\n { formsAppEnvironmentId, formElementOptionsSets },\n ) {\n const formElementOptionsSetId =\n formElementWithOptions.dynamicOptionSetId\n return (\n !!formElementOptionsSetId &&\n formElementWithOptions.optionsType === 'DYNAMIC' &&\n formElementOptionsSets.some((formElementOptionsSet) => {\n return (\n formElementOptionsSet.type === 'SHAREPOINT_LIST_COLUMN' &&\n formElementOptionsSet.environments.some(\n (env) =>\n env.formsAppEnvironmentId === formsAppEnvironmentId &&\n env.sharepointColumn.id === columnDefinition.id,\n )\n )\n })\n )\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"]}
|
|
@@ -14,7 +14,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.getRootElementValueById =
|
|
17
|
+
exports.getRootElementValueById = getRootElementValueById;
|
|
18
18
|
__exportStar(require("./replaceCustomValues"), exports);
|
|
19
19
|
/**
|
|
20
20
|
* Takes a form element's id, the form elements and the submission data to
|
|
@@ -61,5 +61,4 @@ function getRootElementValueById(formElementId, formElements, submission) {
|
|
|
61
61
|
}
|
|
62
62
|
}
|
|
63
63
|
}
|
|
64
|
-
exports.getRootElementValueById = getRootElementValueById;
|
|
65
64
|
//# sourceMappingURL=submissionService.js.map
|
|
@@ -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":";;;;;;;;;;;;;;;;AAuBA,0DAuCC;AA5DD,wDAAqC;AAErC;;;;;;;;;;;;;;;;;;GAkBG;AACH,SAAgB,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,aAAV,UAAU,uBAAV,UAAU,CACR,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,aAAV,UAAU,uBAAV,UAAU,CAAG,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'\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"]}
|
|
@@ -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;
|
|
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,OA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A;QACV,CAAC;QACD,OAAO,CAAC,CAAC,CAAC;YACR,OAAM;QACR,CAAC;IACH,CAAC;AACH,CAAC,CAAA;AAED,MAAM,YAAY,GAAG;IACnB,gBAAgB;IAChB,qBAAqB;IACrB,wBAAwB;IACxB,eAAe;IACf,uBAAuB;IACvB,iBAAiB;IACjB,cAAc;IACd,0BAA0B;IAC1B,aAAa;IACb,sBAAsB;IACtB,gBAAgB;IAChB,mBAAmB;CACpB,CAAA;AAsBQ,oCAAY;AApBrB,MAAM,wBAAwB,GAAG,CAC/B,CAAiC,EACkB,EAAE;IACrD,QAAQ,CAAC,CAAC,IAAI,EAAE,CAAC;QACf,KAAK,QAAQ,CAAC;QACd,KAAK,QAAQ,CAAC;QACd,KAAK,sBAAsB,CAAC;QAC5B,KAAK,aAAa,CAAC,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;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 '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 'pointAddress':\n case 'geoscapeAddress':\n case 'civicaStreetName':\n case 'bsb':\n case 'autocomplete':\n case 'abn':\n case 'apiNSWLiquorLicence':\n case 'googleAddress': {\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 'geoscapeAddress':\n case 'pointAddress':\n case 'compliance':\n case 'civicaStreetName':\n case 'autocomplete':\n case 'apiNSWLiquorLicence': {\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"]}
|
|
@@ -12,5 +12,8 @@ export type ResourceDefinition<T> = T & {
|
|
|
12
12
|
} | {
|
|
13
13
|
type: 'CHOICE_SINGLE' | 'CHOICE_MULTIPLE';
|
|
14
14
|
choices: ResourceDefinitionChoice[];
|
|
15
|
-
checkIsFormElementSupported: (formElementWithOptions: FormTypes.FormElementWithOptions
|
|
15
|
+
checkIsFormElementSupported: (formElementWithOptions: FormTypes.FormElementWithOptions, options: {
|
|
16
|
+
formElementOptionsSets: FormTypes.FormElementOptionSet[];
|
|
17
|
+
formsAppEnvironmentId: number;
|
|
18
|
+
}) => boolean;
|
|
16
19
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resource-definitions.js","sourceRoot":"","sources":["../../src/types/resource-definitions.ts"],"names":[],"mappings":"","sourcesContent":["import { FormTypes } from '@oneblink/types'\n\nexport type ResourceDefinitionChoice = {\n value: string | number\n label: string\n}\n\nexport type ResourceDefinition<T> = T & {\n id: string\n isRequired: boolean\n displayName: string\n} & (\n | {\n type:\n | 'TEXT_SINGLE_LINE'\n | 'TEXT_MULTI_LINE'\n | 'EMAIL'\n | 'DATE'\n | 'DATETIME'\n | 'NUMBER'\n | 'BOOLEAN'\n }\n | {\n type: 'CHOICE_SINGLE' | 'CHOICE_MULTIPLE'\n choices: ResourceDefinitionChoice[]\n checkIsFormElementSupported: (\n formElementWithOptions: FormTypes.FormElementWithOptions,\n ) => boolean\n }\n )\n"]}
|
|
1
|
+
{"version":3,"file":"resource-definitions.js","sourceRoot":"","sources":["../../src/types/resource-definitions.ts"],"names":[],"mappings":"","sourcesContent":["import { FormTypes } from '@oneblink/types'\n\nexport type ResourceDefinitionChoice = {\n value: string | number\n label: string\n}\n\nexport type ResourceDefinition<T> = T & {\n id: string\n isRequired: boolean\n displayName: string\n} & (\n | {\n type:\n | 'TEXT_SINGLE_LINE'\n | 'TEXT_MULTI_LINE'\n | 'EMAIL'\n | 'DATE'\n | 'DATETIME'\n | 'NUMBER'\n | 'BOOLEAN'\n }\n | {\n type: 'CHOICE_SINGLE' | 'CHOICE_MULTIPLE'\n choices: ResourceDefinitionChoice[]\n checkIsFormElementSupported: (\n formElementWithOptions: FormTypes.FormElementWithOptions,\n options: {\n formElementOptionsSets: FormTypes.FormElementOptionSet[]\n formsAppEnvironmentId: number\n },\n ) => boolean\n }\n )\n"]}
|
package/dist/userService.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.parseUserProfile = parseUserProfile;
|
|
4
|
+
exports.getUserFriendlyName = getUserFriendlyName;
|
|
4
5
|
/**
|
|
5
6
|
* Parse a User Profile based on a JWT payload. Will return `undefined` if not a
|
|
6
7
|
* valid JWT payload
|
|
@@ -88,7 +89,6 @@ function parseUserProfile(data) {
|
|
|
88
89
|
}
|
|
89
90
|
return userProfile;
|
|
90
91
|
}
|
|
91
|
-
exports.parseUserProfile = parseUserProfile;
|
|
92
92
|
/**
|
|
93
93
|
* A friendly `string` that represents the a [User Profile](#user-profile). Uses
|
|
94
94
|
* first name, last name, full name, email address or username.
|
|
@@ -121,5 +121,4 @@ function getUserFriendlyName(userProfile) {
|
|
|
121
121
|
}
|
|
122
122
|
return userProfile.userId;
|
|
123
123
|
}
|
|
124
|
-
exports.getUserFriendlyName = getUserFriendlyName;
|
|
125
124
|
//# sourceMappingURL=userService.js.map
|
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":";;AAoBA,4CAwFC;AAmBD,kDAoBC;AAjJD;;;;;;;;;;;;;;;;;GAiBG;AACH,SAAgB,gBAAgB,CAC9B,IAAa;;IAEb,IAAI,OAAO,IAAI,KAAK,QAAQ,IAAI,CAAC,IAAI,EAAE,CAAC;QACtC,OAAM;IACR,CAAC;IACD,MAAM,UAAU,GAAG,IAA+B,CAAA;IAClD,IAAI,OAAO,UAAU,CAAC,GAAG,KAAK,QAAQ,EAAE,CAAC;QACvC,OAAM;IACR,CAAC;IACD,MAAM,WAAW,GAA0B;QACzC,UAAU,EAAE,KAAK;QACjB,YAAY,EAAE,SAAS;QACvB,cAAc,EAAE,UAAU,CAAC,GAAG;QAC9B,MAAM,EAAE,UAAU,CAAC,GAAG;QACtB,KAAK,EAAE,OAAO,UAAU,CAAC,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS;QAC1E,aAAa,EACX,OAAO,UAAU,CAAC,cAAc,KAAK,SAAS;YAC5C,CAAC,CAAC,U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;AACpB,CAAC;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,SAAgB,mBAAmB,CACjC,WAAkC;IAElC,IAAI,WAAW,CAAC,QAAQ,EAAE,CAAC;QACzB,OAAO,WAAW,CAAC,QAAQ,CAAA;IAC7B,CAAC;IAED,IAAI,WAAW,CAAC,SAAS,IAAI,WAAW,CAAC,QAAQ,EAAE,CAAC;QAClD,OAAO,CAAC,WAAW,CAAC,SAAS,EAAE,WAAW,CAAC,QAAQ,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,CAAA;IACvE,CAAC;IAED,IAAI,WAAW,CAAC,KAAK,EAAE,CAAC;QACtB,OAAO,WAAW,CAAC,KAAK,CAAA;IAC1B,CAAC;IAED,IAAI,WAAW,CAAC,QAAQ,EAAE,CAAC;QACzB,OAAO,WAAW,CAAC,QAAQ,CAAA;IAC7B,CAAC;IAED,OAAO,WAAW,CAAC,MAAM,CAAA;AAC3B,CAAC","sourcesContent":["import { MiscTypes } from '@oneblink/types'\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: typeof jwtPayload.email === 'string' ? jwtPayload.email : undefined,\n emailVerified:\n typeof jwtPayload.email_verified === 'boolean'\n ? jwtPayload.email_verified\n : undefined,\n firstName:\n typeof jwtPayload.given_name === 'string'\n ? jwtPayload.given_name\n : undefined,\n lastName:\n typeof jwtPayload.family_name === 'string'\n ? jwtPayload.family_name\n : undefined,\n fullName: typeof jwtPayload.name === 'string' ? jwtPayload.name : undefined,\n picture:\n typeof jwtPayload.picture === 'string' ? jwtPayload.picture : undefined,\n role:\n typeof jwtPayload['custom:role'] === 'string'\n ? jwtPayload['custom:role']\n : undefined,\n username:\n typeof jwtPayload.email === 'string' ? jwtPayload.email : jwtPayload.sub,\n supervisor: {\n fullName:\n typeof jwtPayload['custom:supervisor_name'] === 'string'\n ? jwtPayload['custom:supervisor_name']\n : undefined,\n email:\n typeof jwtPayload['custom:supervisor_email'] === 'string'\n ? jwtPayload['custom:supervisor_email']\n : undefined,\n providerUserId:\n typeof jwtPayload['custom:supervisor_user_id'] === 'string'\n ? jwtPayload['custom:supervisor_user_id']\n : undefined,\n },\n phoneNumber:\n typeof jwtPayload['custom:phone_number'] === 'string'\n ? jwtPayload['custom:phone_number']\n : undefined,\n phoneNumberVerified:\n typeof jwtPayload['custom:phone_number_verified'] === 'boolean'\n ? jwtPayload['custom:phone_number_verified']\n : undefined,\n groups:\n typeof jwtPayload['custom:groups'] === 'string'\n ? jwtPayload['custom:groups'].split(',').map((group) => group.trim())\n : undefined,\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,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.convertToFormWorkflowEvent =
|
|
3
|
+
exports.convertToFormWorkflowEvent = convertToFormWorkflowEvent;
|
|
4
4
|
/**
|
|
5
5
|
* Converts a Webhook sbuscription into its corresponding Form workflow event
|
|
6
6
|
*
|
|
@@ -38,5 +38,4 @@ function convertToFormWorkflowEvent(webhookSubscription) {
|
|
|
38
38
|
},
|
|
39
39
|
};
|
|
40
40
|
}
|
|
41
|
-
exports.convertToFormWorkflowEvent = convertToFormWorkflowEvent;
|
|
42
41
|
//# 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":";;AA8CS,gEAA0B;AA5CnC;;;;;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,EACvC,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","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 ) {\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,33 +1,36 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@oneblink/sdk-core",
|
|
3
3
|
"description": "OneBlink SDK for JavaScript (works in Browsers and NodeJS)",
|
|
4
|
-
"version": "
|
|
4
|
+
"version": "8.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
|
-
"@
|
|
10
|
+
"@eslint/eslintrc": "^3.3.0",
|
|
11
|
+
"@eslint/js": "^9.21.0",
|
|
12
|
+
"@microsoft/eslint-plugin-sdl": "^1.1.0",
|
|
11
13
|
"@microsoft/microsoft-graph-types": "^2.40.0",
|
|
12
|
-
"@oneblink/release-cli": "^3.
|
|
14
|
+
"@oneblink/release-cli": "^3.3.1-beta.1",
|
|
13
15
|
"@oneblink/types": "github:oneblink/types",
|
|
14
|
-
"@types/jest": "^29.5.
|
|
15
|
-
"@types/lodash": "^4.
|
|
16
|
-
"@typescript-eslint/eslint-plugin": "^
|
|
17
|
-
"@typescript-eslint/parser": "^
|
|
18
|
-
"eslint": "^
|
|
19
|
-
"eslint-config-prettier": "^
|
|
20
|
-
"eslint-plugin-prettier": "^
|
|
21
|
-
"eslint-plugin-react": "^7.
|
|
16
|
+
"@types/jest": "^29.5.14",
|
|
17
|
+
"@types/lodash": "^4.17.16",
|
|
18
|
+
"@typescript-eslint/eslint-plugin": "^8.28.0",
|
|
19
|
+
"@typescript-eslint/parser": "^8.28.0",
|
|
20
|
+
"eslint": "^9.23.0",
|
|
21
|
+
"eslint-config-prettier": "^10.1.1",
|
|
22
|
+
"eslint-plugin-prettier": "^5.2.5",
|
|
23
|
+
"eslint-plugin-react": "^7.37.4",
|
|
22
24
|
"fixpack": "^4.0.0",
|
|
23
|
-
"
|
|
25
|
+
"globals": "^16.0.0",
|
|
26
|
+
"jest": "^29.7.0",
|
|
24
27
|
"lodash": "^4.17.21",
|
|
25
|
-
"prettier": "^
|
|
26
|
-
"prettier-plugin-jsdoc": "^
|
|
27
|
-
"ts-jest": "^29.
|
|
28
|
-
"tsc-watch": "^6.
|
|
29
|
-
"typedoc": "^0.
|
|
30
|
-
"typescript": "^5.
|
|
28
|
+
"prettier": "^3.5.3",
|
|
29
|
+
"prettier-plugin-jsdoc": "^1.3.2",
|
|
30
|
+
"ts-jest": "^29.3.0",
|
|
31
|
+
"tsc-watch": "^6.2.1",
|
|
32
|
+
"typedoc": "^0.28.1",
|
|
33
|
+
"typescript": "^5.8.2"
|
|
31
34
|
},
|
|
32
35
|
"directories": {
|
|
33
36
|
"doc": "docs"
|