@beabee/beabee-common 1.19.5 → 1.19.7

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 (220) hide show
  1. package/README.md +41 -0
  2. package/dist/cjs/data/index.cjs +87 -0
  3. package/dist/cjs/error/InvalidRule.cjs +35 -0
  4. package/dist/cjs/error/index.cjs +22 -0
  5. package/dist/cjs/index.cjs +28 -0
  6. package/dist/cjs/search/api-keys.cjs +35 -0
  7. package/dist/cjs/search/callouts.cjs +131 -0
  8. package/dist/cjs/search/contacts.cjs +105 -0
  9. package/dist/cjs/search/index.cjs +32 -0
  10. package/dist/cjs/search/notices.cjs +61 -0
  11. package/dist/cjs/search/operators.cjs +89 -0
  12. package/dist/cjs/search/payments.cjs +51 -0
  13. package/dist/cjs/types/api-key-filter-name.cjs +16 -0
  14. package/dist/cjs/types/array-filter-args.cjs +16 -0
  15. package/dist/cjs/types/base-callout-component-schema.cjs +16 -0
  16. package/dist/cjs/types/base-filter-args.cjs +16 -0
  17. package/dist/cjs/types/base-validated-rule.cjs +16 -0
  18. package/dist/cjs/types/callout-component-schema.cjs +16 -0
  19. package/dist/cjs/types/callout-filter-name.cjs +16 -0
  20. package/dist/cjs/types/callout-form-schema.cjs +16 -0
  21. package/dist/cjs/types/callout-navigation-schema.cjs +16 -0
  22. package/dist/cjs/types/callout-response-answer-address.cjs +16 -0
  23. package/dist/cjs/types/callout-response-answer-file-upload.cjs +16 -0
  24. package/dist/cjs/types/callout-response-answer.cjs +16 -0
  25. package/dist/cjs/types/callout-response-answers.cjs +16 -0
  26. package/dist/cjs/types/callout-response-comment-filter-name.cjs +16 -0
  27. package/dist/cjs/types/callout-response-filter-name.cjs +16 -0
  28. package/dist/cjs/types/callout-slide-schema.cjs +16 -0
  29. package/dist/cjs/types/callout-tag-filter-name.cjs +16 -0
  30. package/dist/cjs/types/content-callout-component-schema.cjs +16 -0
  31. package/dist/cjs/types/date-unit.cjs +16 -0
  32. package/dist/cjs/types/duration.cjs +16 -0
  33. package/dist/cjs/types/enum-filter-args.cjs +16 -0
  34. package/dist/cjs/types/feeable.cjs +16 -0
  35. package/dist/cjs/types/filter-args.cjs +16 -0
  36. package/dist/cjs/types/filter-type.cjs +16 -0
  37. package/dist/cjs/types/filters.cjs +16 -0
  38. package/dist/cjs/types/index.cjs +120 -0
  39. package/dist/cjs/types/input-callout-component-schema.cjs +16 -0
  40. package/dist/cjs/types/input-file-callout-component-schema.cjs +16 -0
  41. package/dist/cjs/types/nestable-callout-component-schema.cjs +16 -0
  42. package/dist/cjs/types/notice-filter-name.cjs +16 -0
  43. package/dist/cjs/types/operators-by-type.cjs +16 -0
  44. package/dist/cjs/types/other-filter-args.cjs +16 -0
  45. package/dist/cjs/types/paginated-query.cjs +16 -0
  46. package/dist/cjs/types/paginated.cjs +16 -0
  47. package/dist/cjs/types/payment-filter-name.cjs +16 -0
  48. package/dist/cjs/types/radio-callout-component-schema.cjs +16 -0
  49. package/dist/cjs/types/role-type.cjs +16 -0
  50. package/dist/cjs/types/rule-group.cjs +16 -0
  51. package/dist/cjs/types/rule-operator.cjs +16 -0
  52. package/dist/cjs/types/rule-opperator-params.cjs +16 -0
  53. package/dist/cjs/types/rule-value.cjs +16 -0
  54. package/dist/cjs/types/rule.cjs +16 -0
  55. package/dist/cjs/types/select-callout-component-schema.cjs +16 -0
  56. package/dist/cjs/types/stripe-fee-country.cjs +16 -0
  57. package/dist/cjs/types/unit-matches.cjs +16 -0
  58. package/dist/cjs/types/validated-boolean-rule.cjs +16 -0
  59. package/dist/cjs/types/validated-number-rule.cjs +16 -0
  60. package/dist/cjs/types/validated-rule-group.cjs +16 -0
  61. package/dist/cjs/types/validated-rule-value.cjs +16 -0
  62. package/dist/cjs/types/validated-rule.cjs +16 -0
  63. package/dist/cjs/types/validated-string-rule.cjs +16 -0
  64. package/dist/cjs/utils/callouts.cjs +137 -0
  65. package/dist/cjs/utils/date.cjs +87 -0
  66. package/dist/cjs/utils/index.cjs +28 -0
  67. package/dist/cjs/utils/payments.cjs +53 -0
  68. package/dist/cjs/utils/rules.cjs +109 -0
  69. package/dist/esm/data/index.js +57 -50
  70. package/dist/esm/error/InvalidRule.js +10 -7
  71. package/dist/esm/error/index.js +1 -2
  72. package/dist/esm/index.js +4 -7
  73. package/dist/esm/search/api-keys.js +10 -7
  74. package/dist/esm/search/callouts.js +100 -94
  75. package/dist/esm/search/contacts.js +83 -74
  76. package/dist/esm/search/index.js +6 -64
  77. package/dist/esm/search/notices.js +36 -33
  78. package/dist/esm/search/operators.js +62 -0
  79. package/dist/esm/search/payments.js +26 -23
  80. package/dist/esm/types/api-key-filter-name.js +0 -0
  81. package/dist/esm/types/array-filter-args.js +0 -0
  82. package/dist/esm/types/base-callout-component-schema.js +0 -0
  83. package/dist/esm/types/base-filter-args.js +0 -0
  84. package/dist/esm/types/base-validated-rule.js +0 -0
  85. package/dist/esm/types/callout-component-schema.js +0 -0
  86. package/dist/esm/types/callout-filter-name.js +0 -0
  87. package/dist/esm/types/callout-form-schema.js +0 -0
  88. package/dist/esm/types/callout-navigation-schema.js +0 -0
  89. package/dist/esm/types/callout-response-answer-address.js +0 -0
  90. package/dist/esm/types/callout-response-answer-file-upload.js +0 -0
  91. package/dist/esm/types/callout-response-answer.js +0 -0
  92. package/dist/esm/types/callout-response-answers.js +0 -0
  93. package/dist/esm/types/callout-response-comment-filter-name.js +0 -0
  94. package/dist/esm/types/callout-response-filter-name.js +0 -0
  95. package/dist/esm/types/callout-slide-schema.js +0 -0
  96. package/dist/esm/types/callout-tag-filter-name.js +0 -0
  97. package/dist/esm/types/content-callout-component-schema.js +0 -0
  98. package/dist/esm/types/date-unit.js +0 -0
  99. package/dist/esm/types/duration.js +0 -0
  100. package/dist/esm/types/enum-filter-args.js +0 -0
  101. package/dist/esm/types/feeable.js +0 -0
  102. package/dist/esm/types/filter-args.js +0 -0
  103. package/dist/esm/types/filter-type.js +0 -0
  104. package/dist/esm/types/filters.js +0 -0
  105. package/dist/esm/types/index.js +50 -0
  106. package/dist/esm/types/input-callout-component-schema.js +0 -0
  107. package/dist/esm/types/input-file-callout-component-schema.js +0 -0
  108. package/dist/esm/types/nestable-callout-component-schema.js +0 -0
  109. package/dist/esm/types/notice-filter-name.js +0 -0
  110. package/dist/esm/types/operators-by-type.js +0 -0
  111. package/dist/esm/types/other-filter-args.js +0 -0
  112. package/dist/esm/types/paginated-query.js +0 -0
  113. package/dist/esm/types/paginated.js +0 -0
  114. package/dist/esm/types/payment-filter-name.js +0 -0
  115. package/dist/esm/types/radio-callout-component-schema.js +0 -0
  116. package/dist/esm/types/role-type.js +0 -0
  117. package/dist/esm/types/rule-group.js +0 -0
  118. package/dist/esm/types/rule-operator.js +0 -0
  119. package/dist/esm/types/rule-opperator-params.js +0 -0
  120. package/dist/esm/types/rule-value.js +0 -0
  121. package/dist/esm/types/rule.js +0 -0
  122. package/dist/esm/types/select-callout-component-schema.js +0 -0
  123. package/dist/esm/types/stripe-fee-country.js +0 -0
  124. package/dist/esm/types/unit-matches.js +0 -0
  125. package/dist/esm/types/validated-boolean-rule.js +0 -0
  126. package/dist/esm/types/validated-number-rule.js +0 -0
  127. package/dist/esm/types/validated-rule-group.js +0 -0
  128. package/dist/esm/types/validated-rule-value.js +0 -0
  129. package/dist/esm/types/validated-rule.js +0 -0
  130. package/dist/esm/types/validated-string-rule.js +0 -0
  131. package/dist/esm/utils/callouts.js +91 -93
  132. package/dist/esm/utils/date.js +56 -56
  133. package/dist/esm/utils/index.js +4 -0
  134. package/dist/esm/utils/payments.js +25 -23
  135. package/dist/esm/utils/rules.js +75 -58
  136. package/dist/types/data/index.d.ts +0 -4
  137. package/dist/types/error/InvalidRule.d.ts +2 -2
  138. package/dist/types/error/index.d.ts +1 -2
  139. package/dist/types/index.d.ts +5 -7
  140. package/dist/types/search/api-keys.d.ts +0 -1
  141. package/dist/types/search/callouts.d.ts +1 -5
  142. package/dist/types/search/contacts.d.ts +3 -2
  143. package/dist/types/search/index.d.ts +6 -194
  144. package/dist/types/search/notices.d.ts +1 -2
  145. package/dist/types/search/operators.d.ts +128 -0
  146. package/dist/types/search/payments.d.ts +1 -2
  147. package/dist/types/types/api-key-filter-name.d.ts +2 -0
  148. package/dist/types/types/array-filter-args.d.ts +5 -0
  149. package/dist/types/types/base-callout-component-schema.d.ts +9 -0
  150. package/dist/types/types/base-filter-args.d.ts +5 -0
  151. package/dist/types/types/base-validated-rule.d.ts +9 -0
  152. package/dist/types/types/callout-component-schema.d.ts +2 -0
  153. package/dist/types/types/callout-filter-name.d.ts +2 -0
  154. package/dist/types/types/callout-form-schema.d.ts +4 -0
  155. package/dist/types/types/callout-navigation-schema.d.ts +6 -0
  156. package/dist/types/types/callout-response-answer-address.d.ts +9 -0
  157. package/dist/types/types/callout-response-answer-file-upload.d.ts +3 -0
  158. package/dist/types/types/callout-response-answer.d.ts +2 -0
  159. package/dist/types/types/callout-response-answers.d.ts +5 -0
  160. package/dist/types/types/callout-response-comment-filter-name.d.ts +2 -0
  161. package/dist/types/types/callout-response-filter-name.d.ts +2 -0
  162. package/dist/types/types/callout-slide-schema.d.ts +7 -0
  163. package/dist/types/types/callout-tag-filter-name.d.ts +2 -0
  164. package/dist/types/types/content-callout-component-schema.d.ts +5 -0
  165. package/dist/types/types/date-unit.d.ts +2 -0
  166. package/dist/types/types/duration.d.ts +1 -0
  167. package/dist/types/types/enum-filter-args.d.ts +5 -0
  168. package/dist/types/types/feeable.d.ts +6 -0
  169. package/dist/types/types/filter-args.d.ts +2 -0
  170. package/dist/types/types/filter-type.d.ts +1 -0
  171. package/dist/types/types/filters.d.ts +2 -0
  172. package/dist/types/types/index.d.ts +50 -0
  173. package/dist/types/types/input-callout-component-schema.d.ts +6 -0
  174. package/dist/types/types/input-file-callout-component-schema.d.ts +5 -0
  175. package/dist/types/types/nestable-callout-component-schema.d.ts +6 -0
  176. package/dist/types/types/notice-filter-name.d.ts +2 -0
  177. package/dist/types/types/operators-by-type.d.ts +2 -0
  178. package/dist/types/types/other-filter-args.d.ts +4 -0
  179. package/dist/types/types/paginated-query.d.ts +8 -0
  180. package/dist/types/types/paginated.d.ts +6 -0
  181. package/dist/types/types/payment-filter-name.d.ts +2 -0
  182. package/dist/types/types/radio-callout-component-schema.d.ts +10 -0
  183. package/dist/types/types/role-type.d.ts +2 -0
  184. package/dist/types/types/rule-group.d.ts +5 -0
  185. package/dist/types/types/rule-operator.d.ts +2 -0
  186. package/dist/types/types/rule-opperator-params.d.ts +3 -0
  187. package/dist/types/types/rule-value.d.ts +1 -0
  188. package/dist/types/types/rule.d.ts +6 -0
  189. package/dist/types/types/select-callout-component-schema.d.ts +11 -0
  190. package/dist/types/types/stripe-fee-country.d.ts +1 -0
  191. package/dist/types/types/unit-matches.d.ts +2 -0
  192. package/dist/types/types/validated-boolean-rule.d.ts +2 -0
  193. package/dist/types/types/validated-number-rule.d.ts +2 -0
  194. package/dist/types/types/validated-rule-group.d.ts +5 -0
  195. package/dist/types/types/validated-rule-value.d.ts +2 -0
  196. package/dist/types/types/validated-rule.d.ts +2 -0
  197. package/dist/types/types/validated-string-rule.d.ts +2 -0
  198. package/dist/types/utils/callouts.d.ts +1 -3
  199. package/dist/types/utils/date.d.ts +3 -3
  200. package/dist/types/utils/index.d.ts +4 -0
  201. package/dist/types/utils/payments.d.ts +1 -7
  202. package/dist/types/utils/rules.d.ts +1 -1
  203. package/package.json +31 -12
  204. package/dist/cjs/data/callouts.js +0 -2
  205. package/dist/cjs/data/index.js +0 -67
  206. package/dist/cjs/error/InvalidRule.js +0 -11
  207. package/dist/cjs/error/index.js +0 -8
  208. package/dist/cjs/index.js +0 -23
  209. package/dist/cjs/search/api-keys.js +0 -11
  210. package/dist/cjs/search/callouts.js +0 -101
  211. package/dist/cjs/search/contacts.js +0 -78
  212. package/dist/cjs/search/index.js +0 -81
  213. package/dist/cjs/search/notices.js +0 -37
  214. package/dist/cjs/search/payments.js +0 -27
  215. package/dist/cjs/utils/callouts.js +0 -118
  216. package/dist/cjs/utils/date.js +0 -77
  217. package/dist/cjs/utils/payments.js +0 -31
  218. package/dist/cjs/utils/rules.js +0 -69
  219. package/dist/esm/data/callouts.js +0 -1
  220. package/dist/types/data/callouts.d.ts +0 -70
@@ -0,0 +1,28 @@
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 __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
15
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
16
+ var utils_exports = {};
17
+ module.exports = __toCommonJS(utils_exports);
18
+ __reExport(utils_exports, require("./callouts.cjs"), module.exports);
19
+ __reExport(utils_exports, require("./date.cjs"), module.exports);
20
+ __reExport(utils_exports, require("./payments.cjs"), module.exports);
21
+ __reExport(utils_exports, require("./rules.cjs"), module.exports);
22
+ // Annotate the CommonJS export names for ESM import in node:
23
+ 0 && (module.exports = {
24
+ ...require("./callouts.cjs"),
25
+ ...require("./date.cjs"),
26
+ ...require("./payments.cjs"),
27
+ ...require("./rules.cjs")
28
+ });
@@ -0,0 +1,53 @@
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 __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var payments_exports = {};
20
+ __export(payments_exports, {
21
+ calcPaymentFee: () => calcPaymentFee
22
+ });
23
+ module.exports = __toCommonJS(payments_exports);
24
+ var import_data = require("../data/index.cjs");
25
+ const stripeFees = {
26
+ gb: {
27
+ [import_data.PaymentMethod.StripeCard]: (amount) => 0.2 + 0.015 * amount,
28
+ [import_data.PaymentMethod.StripeSEPA]: () => 0.3,
29
+ [import_data.PaymentMethod.StripeBACS]: (amount) => Math.min(2, Math.max(0.2, 0.01 * amount))
30
+ },
31
+ eu: {
32
+ [import_data.PaymentMethod.StripeCard]: (amount) => 0.25 + 0.015 * amount,
33
+ [import_data.PaymentMethod.StripeSEPA]: () => 0.35,
34
+ [import_data.PaymentMethod.StripeBACS]: () => 0
35
+ // Not available
36
+ },
37
+ ca: {
38
+ [import_data.PaymentMethod.StripeCard]: (amount) => 0.3 + 0.029 * amount,
39
+ [import_data.PaymentMethod.StripeSEPA]: () => 0,
40
+ // Not available
41
+ [import_data.PaymentMethod.StripeBACS]: () => 0
42
+ // Not available
43
+ }
44
+ };
45
+ const gcFee = (amount) => 0.2 + amount * 0.01;
46
+ function calcPaymentFee(feeable, country) {
47
+ const feeFn = feeable.paymentMethod === import_data.PaymentMethod.GoCardlessDirectDebit ? gcFee : stripeFees[country][feeable.paymentMethod];
48
+ return feeable.period === import_data.ContributionPeriod.Annually ? 0 : feeFn(feeable.amount);
49
+ }
50
+ // Annotate the CommonJS export names for ESM import in node:
51
+ 0 && (module.exports = {
52
+ calcPaymentFee
53
+ });
@@ -0,0 +1,109 @@
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 __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var rules_exports = {};
20
+ __export(rules_exports, {
21
+ isRuleGroup: () => isRuleGroup,
22
+ validateRule: () => validateRule,
23
+ validateRuleGroup: () => validateRuleGroup
24
+ });
25
+ module.exports = __toCommonJS(rules_exports);
26
+ var import_error = require("../error/index.cjs");
27
+ var import_search = require("../search/index.cjs");
28
+ var import_date = require("./date.cjs");
29
+ function isRuleGroup(ruleOrGroup) {
30
+ return "condition" in ruleOrGroup;
31
+ }
32
+ function validateRule(filters, rule) {
33
+ const filter = filters[rule.field];
34
+ if (!filter) {
35
+ throw new import_error.InvalidRule(rule, `Invalid field: ${rule.field}`);
36
+ }
37
+ let expectedArgs = 0;
38
+ if (rule.operator in import_search.nullableOperators) {
39
+ if (!filter.nullable && filter.type !== "text") {
40
+ throw new import_error.InvalidRule(
41
+ rule,
42
+ `Invalid nullable operator: field is not nullable`
43
+ );
44
+ }
45
+ } else {
46
+ const operator = import_search.operatorsByTypeMap[filter.type][rule.operator];
47
+ if (!operator) {
48
+ throw new import_error.InvalidRule(
49
+ rule,
50
+ `Invalid operator for type: ${filter.type} type doesn't define ${rule.operator}`
51
+ );
52
+ }
53
+ expectedArgs = operator.args;
54
+ }
55
+ if (expectedArgs !== rule.value.length) {
56
+ throw new import_error.InvalidRule(
57
+ rule,
58
+ `Invalid operator argument count: ${rule.operator} needs ${expectedArgs}, ${rule.value.length} given`
59
+ );
60
+ }
61
+ const expectedType = filter.type === "boolean" || filter.type === "number" ? filter.type : "string";
62
+ if (rule.value.some((v) => typeof v !== expectedType)) {
63
+ throw new import_error.InvalidRule(
64
+ rule,
65
+ `Invalid operator argument type: ${rule.operator} needs ${expectedType}, ${rule.value.map(
66
+ (v) => typeof v
67
+ )} given`
68
+ );
69
+ }
70
+ if (filter.type === "date" && rule.value.some((v) => !(0, import_date.isValidDate)(v))) {
71
+ throw new import_error.InvalidRule(
72
+ rule,
73
+ `Invalid operator argument: date type needs valid absolute or relative date, ${rule.value} given`
74
+ );
75
+ }
76
+ if ((filter.type === "enum" || filter.type === "array") && rule.value.some((v) => {
77
+ var _a;
78
+ return ((_a = filter.options) == null ? void 0 : _a.indexOf(v)) === -1;
79
+ })) {
80
+ throw new import_error.InvalidRule(
81
+ rule,
82
+ `Invalid operator argument: ${filter.type} type expected ${filter.options}, ${rule.value} given`
83
+ );
84
+ }
85
+ return {
86
+ field: rule.field,
87
+ type: filter.type,
88
+ nullable: !!filter.nullable,
89
+ operator: rule.operator,
90
+ value: rule.value
91
+ };
92
+ }
93
+ function validateRuleGroup(filters, ruleGroup) {
94
+ const validatedRuleGroup = {
95
+ condition: ruleGroup.condition,
96
+ rules: []
97
+ };
98
+ for (const rule of ruleGroup.rules) {
99
+ const valid = isRuleGroup(rule) ? validateRuleGroup(filters, rule) : validateRule(filters, rule);
100
+ validatedRuleGroup.rules.push(valid);
101
+ }
102
+ return validatedRuleGroup;
103
+ }
104
+ // Annotate the CommonJS export names for ESM import in node:
105
+ 0 && (module.exports = {
106
+ isRuleGroup,
107
+ validateRule,
108
+ validateRuleGroup
109
+ });
@@ -1,50 +1,57 @@
1
- export var ContributionPeriod;
2
- (function (ContributionPeriod) {
3
- ContributionPeriod["Monthly"] = "monthly";
4
- ContributionPeriod["Annually"] = "annually";
5
- })(ContributionPeriod || (ContributionPeriod = {}));
6
- export var ContributionType;
7
- (function (ContributionType) {
8
- ContributionType["Automatic"] = "Automatic";
9
- ContributionType["Manual"] = "Manual";
10
- ContributionType["Gift"] = "Gift";
11
- ContributionType["None"] = "None";
12
- })(ContributionType || (ContributionType = {}));
13
- export var ItemStatus;
14
- (function (ItemStatus) {
15
- ItemStatus["Draft"] = "draft";
16
- ItemStatus["Scheduled"] = "scheduled";
17
- ItemStatus["Open"] = "open";
18
- ItemStatus["Ended"] = "ended";
19
- })(ItemStatus || (ItemStatus = {}));
20
- export var MembershipStatus;
21
- (function (MembershipStatus) {
22
- MembershipStatus["Active"] = "active";
23
- MembershipStatus["Expiring"] = "expiring";
24
- MembershipStatus["Expired"] = "expired";
25
- MembershipStatus["None"] = "none";
26
- })(MembershipStatus || (MembershipStatus = {}));
27
- export var NewsletterStatus;
28
- (function (NewsletterStatus) {
29
- NewsletterStatus["Subscribed"] = "subscribed";
30
- NewsletterStatus["Unsubscribed"] = "unsubscribed";
31
- NewsletterStatus["Cleaned"] = "cleaned";
32
- NewsletterStatus["Pending"] = "pending";
33
- NewsletterStatus["None"] = "none";
34
- })(NewsletterStatus || (NewsletterStatus = {}));
35
- export var PaymentMethod;
36
- (function (PaymentMethod) {
37
- PaymentMethod["StripeCard"] = "s_card";
38
- PaymentMethod["StripeSEPA"] = "s_sepa";
39
- PaymentMethod["StripeBACS"] = "s_bacs";
40
- PaymentMethod["GoCardlessDirectDebit"] = "gc_direct-debit";
41
- })(PaymentMethod || (PaymentMethod = {}));
42
- export var PaymentStatus;
43
- (function (PaymentStatus) {
44
- PaymentStatus["Pending"] = "pending";
45
- PaymentStatus["Successful"] = "successful";
46
- PaymentStatus["Failed"] = "failed";
47
- PaymentStatus["Cancelled"] = "cancelled";
48
- })(PaymentStatus || (PaymentStatus = {}));
49
- export const RoleTypes = ["member", "admin", "superadmin"];
50
- export * from "./callouts";
1
+ var ContributionPeriod = /* @__PURE__ */ ((ContributionPeriod2) => {
2
+ ContributionPeriod2["Monthly"] = "monthly";
3
+ ContributionPeriod2["Annually"] = "annually";
4
+ return ContributionPeriod2;
5
+ })(ContributionPeriod || {});
6
+ var ContributionType = /* @__PURE__ */ ((ContributionType2) => {
7
+ ContributionType2["Automatic"] = "Automatic";
8
+ ContributionType2["Manual"] = "Manual";
9
+ ContributionType2["Gift"] = "Gift";
10
+ ContributionType2["None"] = "None";
11
+ return ContributionType2;
12
+ })(ContributionType || {});
13
+ var ItemStatus = /* @__PURE__ */ ((ItemStatus2) => {
14
+ ItemStatus2["Draft"] = "draft";
15
+ ItemStatus2["Scheduled"] = "scheduled";
16
+ ItemStatus2["Open"] = "open";
17
+ ItemStatus2["Ended"] = "ended";
18
+ return ItemStatus2;
19
+ })(ItemStatus || {});
20
+ var MembershipStatus = /* @__PURE__ */ ((MembershipStatus2) => {
21
+ MembershipStatus2["Active"] = "active";
22
+ MembershipStatus2["Expiring"] = "expiring";
23
+ MembershipStatus2["Expired"] = "expired";
24
+ MembershipStatus2["None"] = "none";
25
+ return MembershipStatus2;
26
+ })(MembershipStatus || {});
27
+ var NewsletterStatus = /* @__PURE__ */ ((NewsletterStatus2) => {
28
+ NewsletterStatus2["Subscribed"] = "subscribed";
29
+ NewsletterStatus2["Unsubscribed"] = "unsubscribed";
30
+ NewsletterStatus2["Cleaned"] = "cleaned";
31
+ NewsletterStatus2["Pending"] = "pending";
32
+ NewsletterStatus2["None"] = "none";
33
+ return NewsletterStatus2;
34
+ })(NewsletterStatus || {});
35
+ var PaymentMethod = /* @__PURE__ */ ((PaymentMethod2) => {
36
+ PaymentMethod2["StripeCard"] = "s_card";
37
+ PaymentMethod2["StripeSEPA"] = "s_sepa";
38
+ PaymentMethod2["StripeBACS"] = "s_bacs";
39
+ PaymentMethod2["GoCardlessDirectDebit"] = "gc_direct-debit";
40
+ return PaymentMethod2;
41
+ })(PaymentMethod || {});
42
+ var PaymentStatus = /* @__PURE__ */ ((PaymentStatus2) => {
43
+ PaymentStatus2["Pending"] = "pending";
44
+ PaymentStatus2["Successful"] = "successful";
45
+ PaymentStatus2["Failed"] = "failed";
46
+ PaymentStatus2["Cancelled"] = "cancelled";
47
+ return PaymentStatus2;
48
+ })(PaymentStatus || {});
49
+ export {
50
+ ContributionPeriod,
51
+ ContributionType,
52
+ ItemStatus,
53
+ MembershipStatus,
54
+ NewsletterStatus,
55
+ PaymentMethod,
56
+ PaymentStatus
57
+ };
@@ -1,8 +1,11 @@
1
- export default class InvalidRule extends Error {
2
- constructor(rule, message) {
3
- super();
4
- this.rule = rule;
5
- this.message = message;
6
- Object.setPrototypeOf(this, InvalidRule.prototype);
7
- }
1
+ class InvalidRule extends Error {
2
+ constructor(rule, message) {
3
+ super();
4
+ this.rule = rule;
5
+ this.message = message;
6
+ Object.setPrototypeOf(this, InvalidRule.prototype);
7
+ }
8
8
  }
9
+ export {
10
+ InvalidRule
11
+ };
@@ -1,2 +1 @@
1
- import InvalidRule from "./InvalidRule";
2
- export { InvalidRule };
1
+ export * from "./InvalidRule.js";
package/dist/esm/index.js CHANGED
@@ -1,7 +1,4 @@
1
- export * from "./search";
2
- export * from "./data";
3
- export * from "./error";
4
- export * from "./utils/callouts";
5
- export * from "./utils/date";
6
- export * from "./utils/payments";
7
- export * from "./utils/rules";
1
+ export * from "./data/index.js";
2
+ export * from "./error/index.js";
3
+ export * from "./search/index.js";
4
+ export * from "./utils/index.js";
@@ -1,8 +1,11 @@
1
- export const apiKeyFilters = {
2
- id: {
3
- type: "text",
4
- },
5
- createdAt: {
6
- type: "date",
7
- },
1
+ const apiKeyFilters = {
2
+ id: {
3
+ type: "text"
4
+ },
5
+ createdAt: {
6
+ type: "date"
7
+ }
8
+ };
9
+ export {
10
+ apiKeyFilters
8
11
  };
@@ -1,98 +1,104 @@
1
- import { ItemStatus } from "../data";
2
- export const calloutFilters = {
3
- slug: {
4
- type: "text",
5
- },
6
- title: {
7
- type: "text",
8
- },
9
- status: {
10
- type: "enum",
11
- options: [
12
- ItemStatus.Draft,
13
- ItemStatus.Scheduled,
14
- ItemStatus.Open,
15
- ItemStatus.Ended,
16
- ],
17
- },
18
- answeredBy: {
19
- type: "contact",
20
- },
21
- starts: {
22
- type: "date",
23
- nullable: true,
24
- },
25
- expires: {
26
- type: "date",
27
- nullable: true,
28
- },
29
- hidden: {
30
- type: "boolean",
31
- },
1
+ import { ItemStatus } from "../data/index.js";
2
+ const calloutFilters = {
3
+ slug: {
4
+ type: "text"
5
+ },
6
+ title: {
7
+ type: "text"
8
+ },
9
+ status: {
10
+ type: "enum",
11
+ options: [
12
+ ItemStatus.Draft,
13
+ ItemStatus.Scheduled,
14
+ ItemStatus.Open,
15
+ ItemStatus.Ended
16
+ ]
17
+ },
18
+ answeredBy: {
19
+ type: "contact"
20
+ },
21
+ starts: {
22
+ type: "date",
23
+ nullable: true
24
+ },
25
+ expires: {
26
+ type: "date",
27
+ nullable: true
28
+ },
29
+ hidden: {
30
+ type: "boolean"
31
+ }
32
32
  };
33
- export const calloutResponseFilters = {
34
- id: {
35
- type: "text",
36
- },
37
- contact: {
38
- type: "contact",
39
- nullable: true,
40
- },
41
- callout: {
42
- type: "text",
43
- },
44
- createdAt: {
45
- type: "date",
46
- },
47
- updatedAt: {
48
- type: "date",
49
- },
50
- bucket: {
51
- type: "text",
52
- nullable: true,
53
- },
54
- tags: {
55
- type: "array",
56
- },
57
- assignee: {
58
- type: "contact",
59
- nullable: true,
60
- },
61
- answers: {
62
- type: "blob",
63
- },
33
+ const calloutResponseFilters = {
34
+ id: {
35
+ type: "text"
36
+ },
37
+ contact: {
38
+ type: "contact",
39
+ nullable: true
40
+ },
41
+ callout: {
42
+ type: "text"
43
+ },
44
+ createdAt: {
45
+ type: "date"
46
+ },
47
+ updatedAt: {
48
+ type: "date"
49
+ },
50
+ bucket: {
51
+ type: "text",
52
+ nullable: true
53
+ },
54
+ tags: {
55
+ type: "array"
56
+ },
57
+ assignee: {
58
+ type: "contact",
59
+ nullable: true
60
+ },
61
+ answers: {
62
+ type: "blob"
63
+ }
64
64
  };
65
- export const calloutResponseCommentFilters = {
66
- id: {
67
- type: "text",
68
- },
69
- responseId: {
70
- type: "text",
71
- },
72
- contact: {
73
- type: "contact",
74
- },
75
- createdAt: {
76
- type: "date",
77
- },
78
- updatedAt: {
79
- type: "date",
80
- },
81
- text: {
82
- type: "text",
83
- },
65
+ const calloutResponseCommentFilters = {
66
+ id: {
67
+ type: "text"
68
+ },
69
+ responseId: {
70
+ type: "text"
71
+ },
72
+ contact: {
73
+ type: "contact"
74
+ },
75
+ createdAt: {
76
+ type: "date"
77
+ },
78
+ updatedAt: {
79
+ type: "date"
80
+ },
81
+ text: {
82
+ type: "text"
83
+ }
84
84
  };
85
- export const calloutTagFilters = {
86
- id: {
87
- type: "text",
88
- },
89
- name: {
90
- type: "text",
91
- },
92
- description: {
93
- type: "text",
94
- },
95
- calloutSlug: {
96
- type: "text",
97
- },
85
+ const calloutTagFilters = {
86
+ id: {
87
+ type: "text"
88
+ },
89
+ name: {
90
+ type: "text"
91
+ },
92
+ description: {
93
+ type: "text"
94
+ },
95
+ calloutSlug: {
96
+ type: "text"
97
+ }
98
+ };
99
+ export {
100
+ calloutFilters,
101
+ calloutResponseCommentFilters,
102
+ calloutResponseFilters,
103
+ calloutTagFilters
98
104
  };