@beabee/beabee-common 0.20.1 → 0.20.2-alpha.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.
Files changed (78) hide show
  1. package/dist/cjs/data/payment-method.cjs +1 -0
  2. package/dist/cjs/index.cjs +0 -1
  3. package/dist/cjs/search/callouts.cjs +5 -2
  4. package/dist/cjs/types/{callout-navigation-schema.cjs → callout-response-answers.cjs} +2 -2
  5. package/dist/cjs/types/{callout-form-schema.cjs → get-callout-form-schema.cjs} +2 -2
  6. package/dist/cjs/types/{callout-response-answers-nestable.cjs → get-callout-navigation-schema.cjs} +2 -2
  7. package/dist/cjs/types/get-callout-slide-schema.cjs +16 -0
  8. package/dist/cjs/types/index.cjs +14 -8
  9. package/dist/cjs/types/{callout-slide-schema.cjs → set-callout-form-schema.cjs} +2 -2
  10. package/dist/cjs/types/set-callout-navigation-schema.cjs +16 -0
  11. package/dist/cjs/types/set-callout-slide-schema.cjs +16 -0
  12. package/dist/cjs/utils/payments.cjs +7 -3
  13. package/dist/cjs/validators/callout-component-input-address.validator.cjs +1 -5
  14. package/dist/cjs/validators/callout-component-input-checkbox.validator.cjs +1 -5
  15. package/dist/cjs/validators/callout-component-input-currency.validator.cjs +1 -5
  16. package/dist/cjs/validators/callout-component-input-date-time.validator.cjs +0 -4
  17. package/dist/cjs/validators/callout-component-input-email.validator.cjs +1 -9
  18. package/dist/cjs/validators/callout-component-input-file.validator.cjs +5 -5
  19. package/dist/cjs/validators/callout-component-input-number.validator.cjs +0 -4
  20. package/dist/cjs/validators/callout-component-input-phone-number.validator.cjs +1 -5
  21. package/dist/cjs/validators/callout-component-input-select.validator.cjs +0 -9
  22. package/dist/cjs/validators/callout-component-input-selectable.validator.cjs +0 -12
  23. package/dist/cjs/validators/callout-component-input-text.validator.cjs +4 -5
  24. package/dist/cjs/validators/callout-component-input-time.validator.cjs +1 -5
  25. package/dist/cjs/validators/callout-component-input-url.validator.cjs +1 -9
  26. package/dist/cjs/validators/callout-component.validator.cjs +46 -32
  27. package/dist/esm/data/payment-method.js +1 -0
  28. package/dist/esm/search/callouts.js +5 -2
  29. package/dist/esm/types/index.js +7 -4
  30. package/dist/esm/types/set-callout-form-schema.js +0 -0
  31. package/dist/esm/types/set-callout-navigation-schema.js +0 -0
  32. package/dist/esm/types/set-callout-slide-schema.js +0 -0
  33. package/dist/esm/utils/payments.js +7 -3
  34. package/dist/esm/validators/callout-component-input-address.validator.js +1 -4
  35. package/dist/esm/validators/callout-component-input-checkbox.validator.js +1 -4
  36. package/dist/esm/validators/callout-component-input-currency.validator.js +1 -4
  37. package/dist/esm/validators/callout-component-input-date-time.validator.js +0 -3
  38. package/dist/esm/validators/callout-component-input-email.validator.js +2 -9
  39. package/dist/esm/validators/callout-component-input-file.validator.js +5 -4
  40. package/dist/esm/validators/callout-component-input-number.validator.js +0 -3
  41. package/dist/esm/validators/callout-component-input-phone-number.validator.js +1 -4
  42. package/dist/esm/validators/callout-component-input-select.validator.js +0 -8
  43. package/dist/esm/validators/callout-component-input-selectable.validator.js +0 -11
  44. package/dist/esm/validators/callout-component-input-text.validator.js +4 -4
  45. package/dist/esm/validators/callout-component-input-time.validator.js +1 -4
  46. package/dist/esm/validators/callout-component-input-url.validator.js +2 -9
  47. package/dist/esm/validators/callout-component.validator.js +48 -33
  48. package/dist/types/data/payment-method.d.ts +1 -0
  49. package/dist/types/search/callouts.d.ts +5 -2
  50. package/dist/types/types/callout-component-base-input-schema.d.ts +2 -0
  51. package/dist/types/types/callout-component-base-schema.d.ts +1 -1
  52. package/dist/types/types/callout-component-content-schema.d.ts +7 -0
  53. package/dist/types/types/callout-component-input-address-schema.d.ts +2 -0
  54. package/dist/types/types/callout-component-input-phone-number-schema.d.ts +2 -0
  55. package/dist/types/types/callout-component-input-select-schema.d.ts +2 -0
  56. package/dist/types/types/callout-response-answer.d.ts +1 -1
  57. package/dist/types/types/callout-response-answers-slide.d.ts +2 -2
  58. package/dist/types/types/callout-response-answers.d.ts +5 -0
  59. package/dist/types/types/get-callout-form-schema.d.ts +5 -0
  60. package/dist/types/types/get-callout-navigation-schema.d.ts +6 -0
  61. package/dist/types/types/get-callout-slide-schema.d.ts +4 -0
  62. package/dist/types/types/index.d.ts +7 -4
  63. package/dist/types/types/set-callout-form-schema.d.ts +4 -0
  64. package/dist/types/types/set-callout-navigation-schema.d.ts +3 -0
  65. package/dist/types/types/set-callout-slide-schema.d.ts +7 -0
  66. package/dist/types/types/validator-callout-component.d.ts +2 -2
  67. package/dist/types/utils/callouts.d.ts +5 -5
  68. package/dist/types/validators/callout-component-content.validator.d.ts +1 -1
  69. package/dist/types/validators/callout-component.validator.d.ts +5 -3
  70. package/package.json +12 -4
  71. package/dist/types/types/callout-form-schema.d.ts +0 -4
  72. package/dist/types/types/callout-navigation-schema.d.ts +0 -6
  73. package/dist/types/types/callout-response-answers-nestable.d.ts +0 -5
  74. package/dist/types/types/callout-slide-schema.d.ts +0 -7
  75. /package/dist/esm/types/{callout-form-schema.js → callout-response-answers.js} +0 -0
  76. /package/dist/esm/types/{callout-navigation-schema.js → get-callout-form-schema.js} +0 -0
  77. /package/dist/esm/types/{callout-response-answers-nestable.js → get-callout-navigation-schema.js} +0 -0
  78. /package/dist/esm/types/{callout-slide-schema.js → get-callout-slide-schema.js} +0 -0
@@ -25,6 +25,7 @@ var PaymentMethod = /* @__PURE__ */ ((PaymentMethod2) => {
25
25
  PaymentMethod2["StripeCard"] = "s_card";
26
26
  PaymentMethod2["StripeSEPA"] = "s_sepa";
27
27
  PaymentMethod2["StripeBACS"] = "s_bacs";
28
+ PaymentMethod2["StripePayPal"] = "s_paypal";
28
29
  PaymentMethod2["GoCardlessDirectDebit"] = "gc_direct-debit";
29
30
  return PaymentMethod2;
30
31
  })(PaymentMethod || {});
@@ -1,4 +1,3 @@
1
- "use strict";
2
1
  var __defProp = Object.defineProperty;
3
2
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
3
  var __getOwnPropNames = Object.getOwnPropertyNames;
@@ -26,6 +26,9 @@ __export(callouts_exports, {
26
26
  module.exports = __toCommonJS(callouts_exports);
27
27
  var import_data = require("../data/index.cjs");
28
28
  const calloutFilters = {
29
+ id: {
30
+ type: "text"
31
+ },
29
32
  slug: {
30
33
  type: "text"
31
34
  },
@@ -64,7 +67,7 @@ const calloutResponseFilters = {
64
67
  type: "contact",
65
68
  nullable: true
66
69
  },
67
- callout: {
70
+ calloutId: {
68
71
  type: "text"
69
72
  },
70
73
  createdAt: {
@@ -118,7 +121,7 @@ const calloutTagFilters = {
118
121
  description: {
119
122
  type: "text"
120
123
  },
121
- calloutSlug: {
124
+ calloutId: {
122
125
  type: "text"
123
126
  }
124
127
  };
@@ -12,5 +12,5 @@ var __copyProps = (to, from, except, desc) => {
12
12
  return to;
13
13
  };
14
14
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
15
- var callout_navigation_schema_exports = {};
16
- module.exports = __toCommonJS(callout_navigation_schema_exports);
15
+ var callout_response_answers_exports = {};
16
+ module.exports = __toCommonJS(callout_response_answers_exports);
@@ -12,5 +12,5 @@ var __copyProps = (to, from, except, desc) => {
12
12
  return to;
13
13
  };
14
14
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
15
- var callout_form_schema_exports = {};
16
- module.exports = __toCommonJS(callout_form_schema_exports);
15
+ var get_callout_form_schema_exports = {};
16
+ module.exports = __toCommonJS(get_callout_form_schema_exports);
@@ -12,5 +12,5 @@ var __copyProps = (to, from, except, desc) => {
12
12
  return to;
13
13
  };
14
14
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
15
- var callout_response_answers_nestable_exports = {};
16
- module.exports = __toCommonJS(callout_response_answers_nestable_exports);
15
+ var get_callout_navigation_schema_exports = {};
16
+ module.exports = __toCommonJS(get_callout_navigation_schema_exports);
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __copyProps = (to, from, except, desc) => {
7
+ if (from && typeof from === "object" || typeof from === "function") {
8
+ for (let key of __getOwnPropNames(from))
9
+ if (!__hasOwnProp.call(to, key) && key !== except)
10
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
11
+ }
12
+ return to;
13
+ };
14
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
15
+ var get_callout_slide_schema_exports = {};
16
+ module.exports = __toCommonJS(get_callout_slide_schema_exports);
@@ -68,16 +68,13 @@ __reExport(types_exports, require("./callout-component-nestable-tabs-schema.cjs"
68
68
  __reExport(types_exports, require("./callout-component-nestable-well-schema.cjs"), module.exports);
69
69
  __reExport(types_exports, require("./callout-component-schema.cjs"), module.exports);
70
70
  __reExport(types_exports, require("./callout-filter-name.cjs"), module.exports);
71
- __reExport(types_exports, require("./callout-form-schema.cjs"), module.exports);
72
- __reExport(types_exports, require("./callout-navigation-schema.cjs"), module.exports);
73
71
  __reExport(types_exports, require("./callout-response-answer-address.cjs"), module.exports);
74
72
  __reExport(types_exports, require("./callout-response-answer-file-upload.cjs"), module.exports);
75
73
  __reExport(types_exports, require("./callout-response-answer.cjs"), module.exports);
76
- __reExport(types_exports, require("./callout-response-answers-nestable.cjs"), module.exports);
77
74
  __reExport(types_exports, require("./callout-response-answers-slide.cjs"), module.exports);
75
+ __reExport(types_exports, require("./callout-response-answers.cjs"), module.exports);
78
76
  __reExport(types_exports, require("./callout-response-comment-filter-name.cjs"), module.exports);
79
77
  __reExport(types_exports, require("./callout-response-filter-name.cjs"), module.exports);
80
- __reExport(types_exports, require("./callout-slide-schema.cjs"), module.exports);
81
78
  __reExport(types_exports, require("./callout-tag-filter-name.cjs"), module.exports);
82
79
  __reExport(types_exports, require("./date-unit.cjs"), module.exports);
83
80
  __reExport(types_exports, require("./duration.cjs"), module.exports);
@@ -86,6 +83,9 @@ __reExport(types_exports, require("./feeable.cjs"), module.exports);
86
83
  __reExport(types_exports, require("./filter-args.cjs"), module.exports);
87
84
  __reExport(types_exports, require("./filter-type.cjs"), module.exports);
88
85
  __reExport(types_exports, require("./filters.cjs"), module.exports);
86
+ __reExport(types_exports, require("./get-callout-form-schema.cjs"), module.exports);
87
+ __reExport(types_exports, require("./get-callout-navigation-schema.cjs"), module.exports);
88
+ __reExport(types_exports, require("./get-callout-slide-schema.cjs"), module.exports);
89
89
  __reExport(types_exports, require("./notice-filter-name.cjs"), module.exports);
90
90
  __reExport(types_exports, require("./operators-by-type.cjs"), module.exports);
91
91
  __reExport(types_exports, require("./other-filter-args.cjs"), module.exports);
@@ -99,6 +99,9 @@ __reExport(types_exports, require("./rule-opperator-params.cjs"), module.exports
99
99
  __reExport(types_exports, require("./rule-value.cjs"), module.exports);
100
100
  __reExport(types_exports, require("./rule.cjs"), module.exports);
101
101
  __reExport(types_exports, require("./segment-filter-name.cjs"), module.exports);
102
+ __reExport(types_exports, require("./set-callout-form-schema.cjs"), module.exports);
103
+ __reExport(types_exports, require("./set-callout-navigation-schema.cjs"), module.exports);
104
+ __reExport(types_exports, require("./set-callout-slide-schema.cjs"), module.exports);
102
105
  __reExport(types_exports, require("./stripe-fee-country.cjs"), module.exports);
103
106
  __reExport(types_exports, require("./text-case.cjs"), module.exports);
104
107
  __reExport(types_exports, require("./unit-matches.cjs"), module.exports);
@@ -165,16 +168,13 @@ __reExport(types_exports, require("./validator.cjs"), module.exports);
165
168
  ...require("./callout-component-nestable-well-schema.cjs"),
166
169
  ...require("./callout-component-schema.cjs"),
167
170
  ...require("./callout-filter-name.cjs"),
168
- ...require("./callout-form-schema.cjs"),
169
- ...require("./callout-navigation-schema.cjs"),
170
171
  ...require("./callout-response-answer-address.cjs"),
171
172
  ...require("./callout-response-answer-file-upload.cjs"),
172
173
  ...require("./callout-response-answer.cjs"),
173
- ...require("./callout-response-answers-nestable.cjs"),
174
174
  ...require("./callout-response-answers-slide.cjs"),
175
+ ...require("./callout-response-answers.cjs"),
175
176
  ...require("./callout-response-comment-filter-name.cjs"),
176
177
  ...require("./callout-response-filter-name.cjs"),
177
- ...require("./callout-slide-schema.cjs"),
178
178
  ...require("./callout-tag-filter-name.cjs"),
179
179
  ...require("./date-unit.cjs"),
180
180
  ...require("./duration.cjs"),
@@ -183,6 +183,9 @@ __reExport(types_exports, require("./validator.cjs"), module.exports);
183
183
  ...require("./filter-args.cjs"),
184
184
  ...require("./filter-type.cjs"),
185
185
  ...require("./filters.cjs"),
186
+ ...require("./get-callout-form-schema.cjs"),
187
+ ...require("./get-callout-navigation-schema.cjs"),
188
+ ...require("./get-callout-slide-schema.cjs"),
186
189
  ...require("./notice-filter-name.cjs"),
187
190
  ...require("./operators-by-type.cjs"),
188
191
  ...require("./other-filter-args.cjs"),
@@ -196,6 +199,9 @@ __reExport(types_exports, require("./validator.cjs"), module.exports);
196
199
  ...require("./rule-value.cjs"),
197
200
  ...require("./rule.cjs"),
198
201
  ...require("./segment-filter-name.cjs"),
202
+ ...require("./set-callout-form-schema.cjs"),
203
+ ...require("./set-callout-navigation-schema.cjs"),
204
+ ...require("./set-callout-slide-schema.cjs"),
199
205
  ...require("./stripe-fee-country.cjs"),
200
206
  ...require("./text-case.cjs"),
201
207
  ...require("./unit-matches.cjs"),
@@ -12,5 +12,5 @@ var __copyProps = (to, from, except, desc) => {
12
12
  return to;
13
13
  };
14
14
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
15
- var callout_slide_schema_exports = {};
16
- module.exports = __toCommonJS(callout_slide_schema_exports);
15
+ var set_callout_form_schema_exports = {};
16
+ module.exports = __toCommonJS(set_callout_form_schema_exports);
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __copyProps = (to, from, except, desc) => {
7
+ if (from && typeof from === "object" || typeof from === "function") {
8
+ for (let key of __getOwnPropNames(from))
9
+ if (!__hasOwnProp.call(to, key) && key !== except)
10
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
11
+ }
12
+ return to;
13
+ };
14
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
15
+ var set_callout_navigation_schema_exports = {};
16
+ module.exports = __toCommonJS(set_callout_navigation_schema_exports);
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __copyProps = (to, from, except, desc) => {
7
+ if (from && typeof from === "object" || typeof from === "function") {
8
+ for (let key of __getOwnPropNames(from))
9
+ if (!__hasOwnProp.call(to, key) && key !== except)
10
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
11
+ }
12
+ return to;
13
+ };
14
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
15
+ var set_callout_slide_schema_exports = {};
16
+ module.exports = __toCommonJS(set_callout_slide_schema_exports);
@@ -26,19 +26,23 @@ const stripeFees = {
26
26
  gb: {
27
27
  [import_data.PaymentMethod.StripeCard]: (amount) => 0.2 + 0.015 * amount,
28
28
  [import_data.PaymentMethod.StripeSEPA]: () => 0.3,
29
- [import_data.PaymentMethod.StripeBACS]: (amount) => Math.min(2, Math.max(0.2, 0.01 * amount))
29
+ [import_data.PaymentMethod.StripeBACS]: (amount) => Math.min(2, Math.max(0.2, 0.01 * amount)),
30
+ [import_data.PaymentMethod.StripePayPal]: (amount) => 0.1 + 0.02 * amount
30
31
  },
31
32
  eu: {
32
33
  [import_data.PaymentMethod.StripeCard]: (amount) => 0.25 + 0.015 * amount,
33
34
  [import_data.PaymentMethod.StripeSEPA]: () => 0.35,
34
- [import_data.PaymentMethod.StripeBACS]: () => 0
35
+ [import_data.PaymentMethod.StripeBACS]: () => 0,
35
36
  // Not available
37
+ [import_data.PaymentMethod.StripePayPal]: (amount) => 0.1 + 0.02 * amount
36
38
  },
37
39
  ca: {
38
40
  [import_data.PaymentMethod.StripeCard]: (amount) => 0.3 + 0.029 * amount,
39
41
  [import_data.PaymentMethod.StripeSEPA]: () => 0,
40
42
  // Not available
41
- [import_data.PaymentMethod.StripeBACS]: () => 0
43
+ [import_data.PaymentMethod.StripeBACS]: () => 0,
44
+ // Not available
45
+ [import_data.PaymentMethod.StripePayPal]: () => 0
42
46
  // Not available
43
47
  }
44
48
  };
@@ -21,11 +21,7 @@ __export(callout_component_input_address_validator_exports, {
21
21
  calloutComponentInputAddressValidator: () => calloutComponentInputAddressValidator
22
22
  });
23
23
  module.exports = __toCommonJS(callout_component_input_address_validator_exports);
24
- const calloutComponentInputAddressValidator = (schema, answer) => {
25
- var _a;
26
- if (!((_a = schema.validate) == null ? void 0 : _a.required) && answer === void 0) {
27
- return true;
28
- }
24
+ const calloutComponentInputAddressValidator = (_schema, _answer) => {
29
25
  throw new Error(
30
26
  `[calloutComponentInputAddressValidator] Not implemented yet`
31
27
  );
@@ -21,11 +21,7 @@ __export(callout_component_input_checkbox_validator_exports, {
21
21
  calloutComponentInputCheckboxValidator: () => calloutComponentInputCheckboxValidator
22
22
  });
23
23
  module.exports = __toCommonJS(callout_component_input_checkbox_validator_exports);
24
- const calloutComponentInputCheckboxValidator = (schema, answer) => {
25
- var _a;
26
- if (((_a = schema.validate) == null ? void 0 : _a.required) && !answer) {
27
- return true;
28
- }
24
+ const calloutComponentInputCheckboxValidator = (_schema, answer) => {
29
25
  return typeof answer === "boolean";
30
26
  };
31
27
  // Annotate the CommonJS export names for ESM import in node:
@@ -22,11 +22,7 @@ __export(callout_component_input_currency_validator_exports, {
22
22
  });
23
23
  module.exports = __toCommonJS(callout_component_input_currency_validator_exports);
24
24
  var import_utils = require("../utils/index.cjs");
25
- const calloutComponentInputCurrencyValidator = (schema, answer) => {
26
- var _a;
27
- if (((_a = schema.validate) == null ? void 0 : _a.required) && answer === void 0) {
28
- return true;
29
- }
25
+ const calloutComponentInputCurrencyValidator = (_schema, answer) => {
30
26
  return (0, import_utils.isAmountOfMoney)(answer);
31
27
  };
32
28
  // Annotate the CommonJS export names for ESM import in node:
@@ -23,10 +23,6 @@ __export(callout_component_input_date_time_validator_exports, {
23
23
  module.exports = __toCommonJS(callout_component_input_date_time_validator_exports);
24
24
  var import_utils = require("../utils/index.cjs");
25
25
  const calloutComponentInputDateTimeValidator = (schema, answer) => {
26
- var _a;
27
- if (!((_a = schema.validate) == null ? void 0 : _a.required) && !answer) {
28
- return true;
29
- }
30
26
  if (typeof answer !== "string") {
31
27
  return false;
32
28
  }
@@ -22,15 +22,7 @@ __export(callout_component_input_email_validator_exports, {
22
22
  });
23
23
  module.exports = __toCommonJS(callout_component_input_email_validator_exports);
24
24
  var import_utils = require("../utils/index.cjs");
25
- var import_data = require("../data/index.cjs");
26
- const calloutComponentInputEmailValidator = (schema, answer) => {
27
- var _a;
28
- if (!(0, import_utils.isCalloutComponentOfType)(schema, import_data.CalloutComponentType.INPUT_EMAIL)) {
29
- throw new Error("Schema is not a email component");
30
- }
31
- if (!((_a = schema.validate) == null ? void 0 : _a.required) && answer === void 0) {
32
- return true;
33
- }
25
+ const calloutComponentInputEmailValidator = (_schema, answer) => {
34
26
  return (0, import_utils.isEmail)(answer);
35
27
  };
36
28
  // Annotate the CommonJS export names for ESM import in node:
@@ -22,12 +22,12 @@ __export(callout_component_input_file_validator_exports, {
22
22
  });
23
23
  module.exports = __toCommonJS(callout_component_input_file_validator_exports);
24
24
  var import_utils = require("../utils/index.cjs");
25
- const calloutComponentInputFileValidator = (schema, answer) => {
26
- var _a;
27
- if (!((_a = schema.validate) == null ? void 0 : _a.required) && answer === void 0) {
28
- return true;
25
+ var import_callouts = require("../utils/callouts.cjs");
26
+ const calloutComponentInputFileValidator = (_schema, answer) => {
27
+ if ((0, import_callouts.isFileUploadAnswer)(answer)) {
28
+ return (0, import_utils.isURL)(answer.url);
29
29
  }
30
- return (0, import_utils.isURL)(answer);
30
+ return false;
31
31
  };
32
32
  // Annotate the CommonJS export names for ESM import in node:
33
33
  0 && (module.exports = {
@@ -23,10 +23,6 @@ __export(callout_component_input_number_validator_exports, {
23
23
  module.exports = __toCommonJS(callout_component_input_number_validator_exports);
24
24
  var import_utils = require("../utils/index.cjs");
25
25
  const calloutComponentInputNumberValidator = (schema, answer) => {
26
- var _a;
27
- if (!((_a = schema.validate) == null ? void 0 : _a.required) && answer === void 0) {
28
- return true;
29
- }
30
26
  if (schema.validate && !(0, import_utils.isNumberInRange)(answer, schema.validate.min, schema.validate.max)) {
31
27
  return false;
32
28
  }
@@ -22,11 +22,7 @@ __export(callout_component_input_phone_number_validator_exports, {
22
22
  });
23
23
  module.exports = __toCommonJS(callout_component_input_phone_number_validator_exports);
24
24
  var import_utils = require("../utils/index.cjs");
25
- const calloutComponentInputPhoneNumberValidator = (schema, answer) => {
26
- var _a;
27
- if (!((_a = schema.validate) == null ? void 0 : _a.required) && answer === void 0) {
28
- return true;
29
- }
25
+ const calloutComponentInputPhoneNumberValidator = (_schema, answer) => {
30
26
  return (0, import_utils.isPhoneNumber)(answer);
31
27
  };
32
28
  // Annotate the CommonJS export names for ESM import in node:
@@ -21,16 +21,7 @@ __export(callout_component_input_select_validator_exports, {
21
21
  calloutComponentInputSelectValidator: () => calloutComponentInputSelectValidator
22
22
  });
23
23
  module.exports = __toCommonJS(callout_component_input_select_validator_exports);
24
- var import_utils = require("../utils/index.cjs");
25
- var import_data = require("../data/index.cjs");
26
24
  const calloutComponentInputSelectValidator = (schema, answer) => {
27
- var _a;
28
- if (!(0, import_utils.isCalloutComponentOfType)(schema, import_data.CalloutComponentType.INPUT_SELECT)) {
29
- throw new Error("Schema is not a select component");
30
- }
31
- if (!((_a = schema.validate) == null ? void 0 : _a.required) && !answer) {
32
- return true;
33
- }
34
25
  const optionValue = schema.data.values.find((v) => v.value === answer);
35
26
  return !!optionValue;
36
27
  };
@@ -21,19 +21,7 @@ __export(callout_component_input_selectable_validator_exports, {
21
21
  calloutComponentInputSelectableValidator: () => calloutComponentInputSelectableValidator
22
22
  });
23
23
  module.exports = __toCommonJS(callout_component_input_selectable_validator_exports);
24
- var import_utils = require("../utils/index.cjs");
25
- var import_data = require("../data/index.cjs");
26
24
  const calloutComponentInputSelectableValidator = (schema, answer) => {
27
- var _a;
28
- if (!(0, import_utils.isCalloutComponentOfBaseType)(
29
- schema,
30
- import_data.CalloutComponentBaseType.INPUT_SELECTABLE
31
- )) {
32
- throw new Error("Schema is not a selectable component");
33
- }
34
- if (!((_a = schema.validate) == null ? void 0 : _a.required) && !answer) {
35
- return true;
36
- }
37
25
  const optionValue = schema.values.find((v) => v.value === answer);
38
26
  return !!optionValue;
39
27
  };
@@ -26,7 +26,10 @@ const validateRules = (rules, answer) => {
26
26
  if (!rules) {
27
27
  return true;
28
28
  }
29
- if (typeof rules.pattern === "string" && rules.pattern.length && !new RegExp(rules.pattern).test(answer)) {
29
+ if (!answer && rules.required) {
30
+ return false;
31
+ }
32
+ if (typeof rules.pattern === "string" && rules.pattern.length && !new RegExp(rules.pattern).test(answer || "")) {
30
33
  return false;
31
34
  }
32
35
  if (!(0, import_utils.isTextInWordRange)(answer, rules.minWords, rules.maxWords)) {
@@ -38,10 +41,6 @@ const validateRules = (rules, answer) => {
38
41
  return true;
39
42
  };
40
43
  const calloutComponentInputTextValidator = (schema, answer) => {
41
- var _a;
42
- if (!((_a = schema.validate) == null ? void 0 : _a.required) && !answer) {
43
- return true;
44
- }
45
44
  if (typeof answer !== "string") {
46
45
  return false;
47
46
  }
@@ -21,11 +21,7 @@ __export(callout_component_input_time_validator_exports, {
21
21
  calloutComponentInputTimeValidator: () => calloutComponentInputTimeValidator
22
22
  });
23
23
  module.exports = __toCommonJS(callout_component_input_time_validator_exports);
24
- const calloutComponentInputTimeValidator = (schema, answer) => {
25
- var _a;
26
- if (!((_a = schema.validate) == null ? void 0 : _a.required) && answer === void 0) {
27
- return true;
28
- }
24
+ const calloutComponentInputTimeValidator = (_schema, _answer) => {
29
25
  throw new Error(
30
26
  `[calloutComponentInputTimeValidator] Not implemented yet`
31
27
  );
@@ -22,15 +22,7 @@ __export(callout_component_input_url_validator_exports, {
22
22
  });
23
23
  module.exports = __toCommonJS(callout_component_input_url_validator_exports);
24
24
  var import_utils = require("../utils/index.cjs");
25
- var import_data = require("../data/index.cjs");
26
- const calloutComponentInputUrlValidator = (schema, answer) => {
27
- var _a;
28
- if (!(0, import_utils.isCalloutComponentOfType)(schema, import_data.CalloutComponentType.INPUT_URL)) {
29
- throw new Error("Schema is not a url component");
30
- }
31
- if (!((_a = schema.validate) == null ? void 0 : _a.required) && answer === void 0) {
32
- return true;
33
- }
25
+ const calloutComponentInputUrlValidator = (_schema, answer) => {
34
26
  return (0, import_utils.isURL)(answer);
35
27
  };
36
28
  // Annotate the CommonJS export names for ESM import in node:
@@ -18,6 +18,7 @@ var __copyProps = (to, from, except, desc) => {
18
18
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
19
  var callout_component_validator_exports = {};
20
20
  __export(callout_component_validator_exports, {
21
+ calloutComponentInputValidator: () => calloutComponentInputValidator,
21
22
  calloutComponentNestableValidator: () => calloutComponentNestableValidator,
22
23
  calloutComponentValidator: () => calloutComponentValidator
23
24
  });
@@ -38,30 +39,20 @@ var import_callout_component_input_text_validator = require("./callout-component
38
39
  var import_callout_component_input_time_validator = require("./callout-component-input-time.validator.cjs");
39
40
  var import_callout_component_input_url_validator = require("./callout-component-input-url.validator.cjs");
40
41
  var import_data = require("../data/index.cjs");
41
- const calloutComponentNestableValidator = (schema, answerMap) => {
42
- let valid = true;
42
+ var import_callouts = require("../utils/callouts.cjs");
43
+ const calloutComponentNestableValidator = (schema, answers) => {
43
44
  for (const component of schema.components) {
44
- const answer = answerMap[component.key];
45
- const answers = Array.isArray(answer) ? answer : [answer];
46
- if (!answer) {
47
- throw new Error(
48
- `[calloutComponentNestableValidator] no answer`
49
- );
50
- }
51
- for (const _answersLevel2 of answers) {
52
- const answersLevel2 = Array.isArray(_answersLevel2) ? _answersLevel2 : [_answersLevel2];
53
- for (const answer2 of answersLevel2) {
54
- valid = calloutComponentValidator(component, answer2) && valid;
55
- if (!valid) {
56
- return false;
57
- }
58
- }
45
+ const valid = calloutComponentValidator(
46
+ component,
47
+ answers[component.key]
48
+ );
49
+ if (!valid) {
50
+ return false;
59
51
  }
60
52
  }
61
- return valid;
53
+ return true;
62
54
  };
63
- const calloutValidatorsMap = {
64
- [import_data.CalloutComponentType.CONTENT]: import_callout_component_content_validator.calloutComponentContentValidator,
55
+ const calloutInputValidatorsMap = {
65
56
  // Input
66
57
  [import_data.CalloutComponentType.INPUT_EMAIL]: import_callout_component_input_email_validator.calloutComponentInputEmailValidator,
67
58
  [import_data.CalloutComponentType.INPUT_ADDRESS]: import_callout_component_input_address_validator.calloutComponentInputAddressValidator,
@@ -80,25 +71,48 @@ const calloutValidatorsMap = {
80
71
  [import_data.CalloutComponentType.INPUT_TEXT_AREA]: import_callout_component_input_text_validator.calloutComponentInputTextValidator,
81
72
  // Selectable
82
73
  [import_data.CalloutComponentType.INPUT_SELECTABLE_RADIO]: import_callout_component_input_selectable_validator.calloutComponentInputSelectableValidator,
83
- [import_data.CalloutComponentType.INPUT_SELECTABLE_SELECTBOXES]: import_callout_component_input_selectable_validator.calloutComponentInputSelectableValidator,
84
- // NESTABLE
85
- [import_data.CalloutComponentType.NESTABLE_PANEL]: calloutComponentNestableValidator,
86
- [import_data.CalloutComponentType.NESTABLE_WELL]: calloutComponentNestableValidator,
87
- [import_data.CalloutComponentType.NESTABLE_TABS]: calloutComponentNestableValidator
74
+ [import_data.CalloutComponentType.INPUT_SELECTABLE_SELECTBOXES]: import_callout_component_input_selectable_validator.calloutComponentInputSelectableValidator
88
75
  };
89
- const calloutComponentValidator = (schema, answer) => {
90
- const validator = calloutValidatorsMap[schema.type];
76
+ function calloutComponentInputValidator(schema, answer) {
77
+ var _a;
78
+ const validator = calloutInputValidatorsMap[schema.type];
91
79
  if (!validator) {
92
80
  console.error(`No validator found for ${schema.type}`);
93
81
  return false;
94
82
  }
95
- return validator(
96
- schema,
97
- answer
98
- );
99
- };
83
+ if (answer === void 0) {
84
+ return ((_a = schema.validate) == null ? void 0 : _a.required) ? false : true;
85
+ }
86
+ const values = Array.isArray(answer) ? answer : [answer];
87
+ for (const value of values) {
88
+ const valid = validator(schema, value);
89
+ if (!valid) {
90
+ return false;
91
+ }
92
+ }
93
+ return true;
94
+ }
95
+ function calloutComponentValidator(schema, answer) {
96
+ if ((0, import_callouts.isCalloutComponentOfBaseType)(schema, import_data.CalloutComponentBaseType.NESTABLE)) {
97
+ return calloutComponentNestableValidator(
98
+ schema,
99
+ answer
100
+ );
101
+ }
102
+ if ((0, import_callouts.isCalloutComponentOfBaseType)(schema, import_data.CalloutComponentBaseType.INPUT)) {
103
+ return calloutComponentInputValidator(
104
+ schema,
105
+ answer
106
+ );
107
+ }
108
+ if ((0, import_callouts.isCalloutComponentOfBaseType)(schema, import_data.CalloutComponentBaseType.CONTENT)) {
109
+ return (0, import_callout_component_content_validator.calloutComponentContentValidator)(schema, answer);
110
+ }
111
+ throw new Error("Invalid schema type");
112
+ }
100
113
  // Annotate the CommonJS export names for ESM import in node:
101
114
  0 && (module.exports = {
115
+ calloutComponentInputValidator,
102
116
  calloutComponentNestableValidator,
103
117
  calloutComponentValidator
104
118
  });
@@ -2,6 +2,7 @@ var PaymentMethod = /* @__PURE__ */ ((PaymentMethod2) => {
2
2
  PaymentMethod2["StripeCard"] = "s_card";
3
3
  PaymentMethod2["StripeSEPA"] = "s_sepa";
4
4
  PaymentMethod2["StripeBACS"] = "s_bacs";
5
+ PaymentMethod2["StripePayPal"] = "s_paypal";
5
6
  PaymentMethod2["GoCardlessDirectDebit"] = "gc_direct-debit";
6
7
  return PaymentMethod2;
7
8
  })(PaymentMethod || {});
@@ -1,5 +1,8 @@
1
1
  import { ItemStatus } from "../data/index.js";
2
2
  const calloutFilters = {
3
+ id: {
4
+ type: "text"
5
+ },
3
6
  slug: {
4
7
  type: "text"
5
8
  },
@@ -38,7 +41,7 @@ const calloutResponseFilters = {
38
41
  type: "contact",
39
42
  nullable: true
40
43
  },
41
- callout: {
44
+ calloutId: {
42
45
  type: "text"
43
46
  },
44
47
  createdAt: {
@@ -92,7 +95,7 @@ const calloutTagFilters = {
92
95
  description: {
93
96
  type: "text"
94
97
  },
95
- calloutSlug: {
98
+ calloutId: {
96
99
  type: "text"
97
100
  }
98
101
  };
@@ -51,16 +51,13 @@ export * from "./callout-component-nestable-tabs-schema.js";
51
51
  export * from "./callout-component-nestable-well-schema.js";
52
52
  export * from "./callout-component-schema.js";
53
53
  export * from "./callout-filter-name.js";
54
- export * from "./callout-form-schema.js";
55
- export * from "./callout-navigation-schema.js";
56
54
  export * from "./callout-response-answer-address.js";
57
55
  export * from "./callout-response-answer-file-upload.js";
58
56
  export * from "./callout-response-answer.js";
59
- export * from "./callout-response-answers-nestable.js";
60
57
  export * from "./callout-response-answers-slide.js";
58
+ export * from "./callout-response-answers.js";
61
59
  export * from "./callout-response-comment-filter-name.js";
62
60
  export * from "./callout-response-filter-name.js";
63
- export * from "./callout-slide-schema.js";
64
61
  export * from "./callout-tag-filter-name.js";
65
62
  export * from "./date-unit.js";
66
63
  export * from "./duration.js";
@@ -69,6 +66,9 @@ export * from "./feeable.js";
69
66
  export * from "./filter-args.js";
70
67
  export * from "./filter-type.js";
71
68
  export * from "./filters.js";
69
+ export * from "./get-callout-form-schema.js";
70
+ export * from "./get-callout-navigation-schema.js";
71
+ export * from "./get-callout-slide-schema.js";
72
72
  export * from "./notice-filter-name.js";
73
73
  export * from "./operators-by-type.js";
74
74
  export * from "./other-filter-args.js";
@@ -82,6 +82,9 @@ export * from "./rule-opperator-params.js";
82
82
  export * from "./rule-value.js";
83
83
  export * from "./rule.js";
84
84
  export * from "./segment-filter-name.js";
85
+ export * from "./set-callout-form-schema.js";
86
+ export * from "./set-callout-navigation-schema.js";
87
+ export * from "./set-callout-slide-schema.js";
85
88
  export * from "./stripe-fee-country.js";
86
89
  export * from "./text-case.js";
87
90
  export * from "./unit-matches.js";
File without changes
File without changes