@oneblink/sdk-core 7.1.0 → 7.2.0-beta.1

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/index.d.ts CHANGED
@@ -88,3 +88,13 @@ export * as schedulingService from './schedulingService';
88
88
  * ```
89
89
  */
90
90
  export * as fileUploadService from './fileUploadService';
91
+ /**
92
+ * ## Webhook Subscription Service
93
+ *
94
+ * Helper functions for handling Webhook subscriptions
95
+ *
96
+ * ```js
97
+ * import { webhookSubscriptionService } from '@oneblink/sdk-core'
98
+ * ```
99
+ */
100
+ export * as webhookSubscriptionService from './webhookSubscriptionService';
package/dist/index.js CHANGED
@@ -23,7 +23,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
23
23
  return result;
24
24
  };
25
25
  Object.defineProperty(exports, "__esModule", { value: true });
26
- exports.fileUploadService = exports.schedulingService = exports.paymentService = exports.abnService = exports.userService = exports.typeCastService = exports.submissionService = exports.conditionalLogicService = exports.formElementsService = void 0;
26
+ exports.webhookSubscriptionService = exports.fileUploadService = exports.schedulingService = exports.paymentService = exports.abnService = exports.userService = exports.typeCastService = exports.submissionService = exports.conditionalLogicService = exports.formElementsService = void 0;
27
27
  /**
28
28
  * ## Form Elements Service
29
29
  *
@@ -114,4 +114,14 @@ exports.schedulingService = __importStar(require("./schedulingService"));
114
114
  * ```
115
115
  */
116
116
  exports.fileUploadService = __importStar(require("./fileUploadService"));
117
+ /**
118
+ * ## Webhook Subscription Service
119
+ *
120
+ * Helper functions for handling Webhook subscriptions
121
+ *
122
+ * ```js
123
+ * import { webhookSubscriptionService } from '@oneblink/sdk-core'
124
+ * ```
125
+ */
126
+ exports.webhookSubscriptionService = __importStar(require("./webhookSubscriptionService"));
117
127
  //# 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;;;;;;;;GAQG;AACH,6EAA4D;AAC5D;;;;;;;;GAQG;AACH,qFAAoE;AACpE;;;;;;;;GAQG;AACH,yEAAwD;AACxD;;;;;;;;GAQG;AACH,qEAAoD;AACpD;;;;;;;;GAQG;AACH,6DAA4C;AAC5C;;;;;;;;GAQG;AACH,2DAA0C;AAC1C;;;;;;;;GAQG;AACH,mEAAkD;AAClD;;;;;;;;GAQG;AACH,yEAAwD;AACxD;;;;;;;;GAQG;AACH,yEAAwD","sourcesContent":["/**\n * ## Form Elements Service\n *\n * Helper functions for handling form elements\n *\n * ```js\n * import { formElementsService } from '@oneblink/sdk-core'\n * ```\n */\nexport * as formElementsService from './formElementsService'\n/**\n * ## Conditional Logic Service\n *\n * Helper functions for handling conditional logic\n *\n * ```js\n * import { conditionalLogicService } from '@oneblink/sdk-core'\n * ```\n */\nexport * as conditionalLogicService from './conditionalLogicService'\n/**\n * ## Submission Service\n *\n * Helper functions for handling form submission data\n *\n * ```js\n * import { submissionService } from '@oneblink/sdk-core'\n * ```\n */\nexport * as submissionService from './submissionService'\n/**\n * ## Submission Service\n *\n * Helper functions for casting types\n *\n * ```js\n * import { typeCastService } from '@oneblink/sdk-core'\n * ```\n */\nexport * as typeCastService from './typeCastService'\n/**\n * ## User Service\n *\n * Helper functions for handling users\n *\n * ```js\n * import { userService } from '@oneblink/sdk-core'\n * ```\n */\nexport * as userService from './userService'\n/**\n * ## ABN Service\n *\n * Helper functions for handling ABN Records\n *\n * ```js\n * import { abnService } from '@oneblink/sdk-core'\n * ```\n */\nexport * as abnService from './abnService'\n/**\n * ## Payment Service\n *\n * Helper functions for payments\n *\n * ```js\n * import { paymentService } from '@oneblink/sdk-core'\n * ```\n */\nexport * as paymentService from './paymentService'\n/**\n * ## Scheduling Service\n *\n * Helper functions for scheduling\n *\n * ```js\n * import { schedulingService } from '@oneblink/sdk-core'\n * ```\n */\nexport * as schedulingService from './schedulingService'\n/**\n * ## File Upload Service\n *\n * Helper functions for handling file uploads\n *\n * ```js\n * import { fileUploadService } from '@oneblink/sdk-core'\n * ```\n */\nexport * as fileUploadService from './fileUploadService'\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;GAQG;AACH,6EAA4D;AAC5D;;;;;;;;GAQG;AACH,qFAAoE;AACpE;;;;;;;;GAQG;AACH,yEAAwD;AACxD;;;;;;;;GAQG;AACH,qEAAoD;AACpD;;;;;;;;GAQG;AACH,6DAA4C;AAC5C;;;;;;;;GAQG;AACH,2DAA0C;AAC1C;;;;;;;;GAQG;AACH,mEAAkD;AAClD;;;;;;;;GAQG;AACH,yEAAwD;AACxD;;;;;;;;GAQG;AACH,yEAAwD;AACxD;;;;;;;;GAQG;AACH,2FAA0E","sourcesContent":["/**\n * ## Form Elements Service\n *\n * Helper functions for handling form elements\n *\n * ```js\n * import { formElementsService } from '@oneblink/sdk-core'\n * ```\n */\nexport * as formElementsService from './formElementsService'\n/**\n * ## Conditional Logic Service\n *\n * Helper functions for handling conditional logic\n *\n * ```js\n * import { conditionalLogicService } from '@oneblink/sdk-core'\n * ```\n */\nexport * as conditionalLogicService from './conditionalLogicService'\n/**\n * ## Submission Service\n *\n * Helper functions for handling form submission data\n *\n * ```js\n * import { submissionService } from '@oneblink/sdk-core'\n * ```\n */\nexport * as submissionService from './submissionService'\n/**\n * ## Submission Service\n *\n * Helper functions for casting types\n *\n * ```js\n * import { typeCastService } from '@oneblink/sdk-core'\n * ```\n */\nexport * as typeCastService from './typeCastService'\n/**\n * ## User Service\n *\n * Helper functions for handling users\n *\n * ```js\n * import { userService } from '@oneblink/sdk-core'\n * ```\n */\nexport * as userService from './userService'\n/**\n * ## ABN Service\n *\n * Helper functions for handling ABN Records\n *\n * ```js\n * import { abnService } from '@oneblink/sdk-core'\n * ```\n */\nexport * as abnService from './abnService'\n/**\n * ## Payment Service\n *\n * Helper functions for payments\n *\n * ```js\n * import { paymentService } from '@oneblink/sdk-core'\n * ```\n */\nexport * as paymentService from './paymentService'\n/**\n * ## Scheduling Service\n *\n * Helper functions for scheduling\n *\n * ```js\n * import { schedulingService } from '@oneblink/sdk-core'\n * ```\n */\nexport * as schedulingService from './schedulingService'\n/**\n * ## File Upload Service\n *\n * Helper functions for handling file uploads\n *\n * ```js\n * import { fileUploadService } from '@oneblink/sdk-core'\n * ```\n */\nexport * as fileUploadService from './fileUploadService'\n/**\n * ## Webhook Subscription Service\n *\n * Helper functions for handling Webhook subscriptions\n *\n * ```js\n * import { webhookSubscriptionService } from '@oneblink/sdk-core'\n * ```\n */\nexport * as webhookSubscriptionService from './webhookSubscriptionService'\n"]}
@@ -0,0 +1,9 @@
1
+ import { SubmissionEventTypes } from '@oneblink/types';
2
+ /**
3
+ * Converts a Webhook sbuscription into its corresponding Form workflow event
4
+ *
5
+ * @param webhookSubscription The subscription to be converted
6
+ * @returns
7
+ */
8
+ declare function convertToFormWorkflowEvent(webhookSubscription: SubmissionEventTypes.WebhookSubscription): SubmissionEventTypes.FormWorkflowEvent;
9
+ export { convertToFormWorkflowEvent };
@@ -0,0 +1,42 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.convertToFormWorkflowEvent = void 0;
4
+ /**
5
+ * Converts a Webhook sbuscription into its corresponding Form workflow event
6
+ *
7
+ * @param webhookSubscription The subscription to be converted
8
+ * @returns
9
+ */
10
+ function convertToFormWorkflowEvent(webhookSubscription) {
11
+ const url = new URL(webhookSubscription.callbackUrl);
12
+ if (url.hostname.endsWith('logic.azure.com') ||
13
+ url.hostname.endsWith('logic.azure.us')) {
14
+ return {
15
+ type: 'POWER_AUTOMATE_FLOW',
16
+ label: webhookSubscription.label,
17
+ configuration: {
18
+ url: webhookSubscription.callbackUrl,
19
+ formId: webhookSubscription.formId,
20
+ },
21
+ };
22
+ }
23
+ if (url.hostname.endsWith('civicplus.com')) {
24
+ return {
25
+ type: 'CP_INTEGRATION_HUB_WEBHOOK',
26
+ label: webhookSubscription.label,
27
+ configuration: {
28
+ url: webhookSubscription.callbackUrl,
29
+ formId: webhookSubscription.formId,
30
+ },
31
+ };
32
+ }
33
+ return {
34
+ type: 'CALLBACK',
35
+ label: webhookSubscription.label,
36
+ configuration: {
37
+ url: webhookSubscription.callbackUrl,
38
+ },
39
+ };
40
+ }
41
+ exports.convertToFormWorkflowEvent = convertToFormWorkflowEvent;
42
+ //# sourceMappingURL=webhookSubscriptionService.js.map
@@ -0,0 +1 @@
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,EACvC;QACA,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;KACF;IAED,IAAI,GAAG,CAAC,QAAQ,CAAC,QAAQ,CAAC,eAAe,CAAC,EAAE;QAC1C,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;KACF;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;AAEQ,gEAA0B","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,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": "7.1.0",
4
+ "version": "7.2.0-beta.1",
5
5
  "author": "OneBlink <developers@oneblink.io> (https://oneblink.io)",
6
6
  "bugs": {
7
7
  "url": "https://github.com/oneblink/sdk-core-js/issues"