@carlonicora/nextjs-jsonapi 6.14.1 → 6.16.0

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 (127) hide show
  1. package/dist/{BlockNoteEditor-UIAX72XW.js → BlockNoteEditor-GWDYMS6R.js} +20 -20
  2. package/dist/{BlockNoteEditor-UIAX72XW.js.map → BlockNoteEditor-GWDYMS6R.js.map} +1 -1
  3. package/dist/{BlockNoteEditor-I3J6YYXK.mjs → BlockNoteEditor-HNP5UAJT.mjs} +5 -5
  4. package/dist/{BlockNoteViewer-HIUAJQRI.mjs → BlockNoteViewer-X4UEVI2A.mjs} +3 -3
  5. package/dist/{BlockNoteViewer-APBOPT4B.js → BlockNoteViewer-XYKFY77F.js} +4 -4
  6. package/dist/{BlockNoteViewer-APBOPT4B.js.map → BlockNoteViewer-XYKFY77F.js.map} +1 -1
  7. package/dist/EmailPurpose-DOsSqM5K.d.mts +3 -0
  8. package/dist/EmailPurpose-DOsSqM5K.d.ts +3 -0
  9. package/dist/billing/index.js +492 -492
  10. package/dist/billing/index.mjs +4 -4
  11. package/dist/{chunk-4XLDBOSE.js → chunk-A7Y5YW7Q.js} +1 -1
  12. package/dist/{chunk-4XLDBOSE.js.map → chunk-A7Y5YW7Q.js.map} +1 -1
  13. package/dist/{chunk-ZYSNJKOP.js → chunk-DFA566KY.js} +4 -4
  14. package/dist/{chunk-ZYSNJKOP.js.map → chunk-DFA566KY.js.map} +1 -1
  15. package/dist/{chunk-DJXSCARG.js → chunk-I5BQLY7V.js} +9 -9
  16. package/dist/{chunk-DJXSCARG.js.map → chunk-I5BQLY7V.js.map} +1 -1
  17. package/dist/{chunk-RFKSJIQB.mjs → chunk-KMPBSOFB.mjs} +138 -5
  18. package/dist/chunk-KMPBSOFB.mjs.map +1 -0
  19. package/dist/{chunk-UOTHRJD2.mjs → chunk-OKBJEIOP.mjs} +1 -1
  20. package/dist/chunk-OKBJEIOP.mjs.map +1 -0
  21. package/dist/{chunk-PMESKNKL.js → chunk-OO2DBP6L.js} +1106 -973
  22. package/dist/chunk-OO2DBP6L.js.map +1 -0
  23. package/dist/{chunk-HAW5PNJG.mjs → chunk-TY5YWBLL.mjs} +3 -3
  24. package/dist/{chunk-RT7XFGIN.js → chunk-UGDYZW4K.js} +1035 -997
  25. package/dist/chunk-UGDYZW4K.js.map +1 -0
  26. package/dist/{chunk-RYY7USSW.mjs → chunk-YEZGASBX.mjs} +50 -12
  27. package/dist/{chunk-RYY7USSW.mjs.map → chunk-YEZGASBX.mjs.map} +1 -1
  28. package/dist/{chunk-OUEYZOLB.mjs → chunk-YVKWACDP.mjs} +2 -2
  29. package/dist/client/index.js +5 -5
  30. package/dist/client/index.mjs +4 -4
  31. package/dist/components/editors/server.d.mts +7 -1
  32. package/dist/components/editors/server.d.ts +7 -1
  33. package/dist/components/editors/server.js +17 -4
  34. package/dist/components/editors/server.js.map +1 -1
  35. package/dist/components/editors/server.mjs +17 -4
  36. package/dist/components/editors/server.mjs.map +1 -1
  37. package/dist/components/index.d.mts +3 -2
  38. package/dist/components/index.d.ts +3 -2
  39. package/dist/components/index.js +5 -5
  40. package/dist/components/index.mjs +4 -4
  41. package/dist/contexts/index.js +5 -5
  42. package/dist/contexts/index.mjs +4 -4
  43. package/dist/core/index.d.mts +92 -7
  44. package/dist/core/index.d.ts +92 -7
  45. package/dist/core/index.js +7 -3
  46. package/dist/core/index.js.map +1 -1
  47. package/dist/core/index.mjs +6 -2
  48. package/dist/{email-automation-enrollment.fields-BZvF14qx.d.mts → email-automation-enrollment.fields-CPsgxLif.d.mts} +11 -1
  49. package/dist/{email-automation-enrollment.fields-Cp3VMzFq.d.ts → email-automation-enrollment.fields-CVicSamF.d.ts} +11 -1
  50. package/dist/email-automations/index.d.mts +19 -5
  51. package/dist/email-automations/index.d.ts +19 -5
  52. package/dist/email-automations/index.js +356 -129
  53. package/dist/email-automations/index.js.map +1 -1
  54. package/dist/email-automations/index.mjs +306 -79
  55. package/dist/email-automations/index.mjs.map +1 -1
  56. package/dist/features/analytics/index.js +121 -121
  57. package/dist/features/analytics/index.mjs +4 -4
  58. package/dist/features/analytics/server.js +5 -5
  59. package/dist/features/analytics/server.mjs +3 -3
  60. package/dist/features/blog/index.js +151 -151
  61. package/dist/features/blog/index.mjs +4 -4
  62. package/dist/features/blog/server.js +17 -17
  63. package/dist/features/blog/server.mjs +2 -2
  64. package/dist/features/help/index.js +38 -38
  65. package/dist/features/help/index.mjs +4 -4
  66. package/dist/features/tokenusage/index.js +127 -127
  67. package/dist/features/tokenusage/index.mjs +4 -4
  68. package/dist/index.d.mts +4 -3
  69. package/dist/index.d.ts +4 -3
  70. package/dist/index.js +8 -4
  71. package/dist/index.js.map +1 -1
  72. package/dist/index.mjs +7 -3
  73. package/dist/offline/index.js +14 -14
  74. package/dist/offline/index.mjs +1 -1
  75. package/dist/{referral-admin.interface-RVO-ZTJz.d.mts → referral-admin.interface-DTj4LzXx.d.mts} +3 -0
  76. package/dist/{referral-admin.interface-CnytdDaQ.d.ts → referral-admin.interface-DeSCw3Pp.d.ts} +3 -0
  77. package/dist/server/index.js +4 -4
  78. package/dist/server/index.mjs +3 -3
  79. package/messages/en.json +35 -3
  80. package/messages/it.json +35 -3
  81. package/package.json +1 -1
  82. package/src/components/editors/server/__tests__/renderBlockNoteMarkdown.spec.ts +45 -0
  83. package/src/components/editors/server/renderBlockNoteHTML.ts +2 -18
  84. package/src/components/editors/server/renderBlockNoteMarkdown.ts +10 -0
  85. package/src/components/editors/server/serverEditor.ts +25 -0
  86. package/src/components/editors/server-entry.ts +1 -0
  87. package/src/core/index.ts +1 -0
  88. package/src/core/registry/ModuleRegistry.ts +1 -0
  89. package/src/features/email-automation/EmailAutomationCandidateModule.ts +12 -0
  90. package/src/features/email-automation/EmailAutomationModule.ts +1 -0
  91. package/src/features/email-automation/components/__tests__/EmailAutomationEditor.spec.tsx +74 -9
  92. package/src/features/email-automation/components/forms/EmailAutomationAddPersonDialog.tsx +226 -0
  93. package/src/features/email-automation/components/forms/EmailAutomationEditor.tsx +23 -0
  94. package/src/features/email-automation/components/forms/EmailStepEditor.tsx +7 -3
  95. package/src/features/email-automation/components/index.ts +1 -0
  96. package/src/features/email-automation/components/lists/EmailAutomationRecipientsList.tsx +38 -20
  97. package/src/features/email-automation/components/lists/EmailAutomationsList.tsx +1 -0
  98. package/src/features/email-automation/components/unsubscribe/EmailUnsubscribe.tsx +9 -4
  99. package/src/features/email-automation/data/EmailAutomation.ts +9 -0
  100. package/src/features/email-automation/data/EmailAutomationCandidate.ts +66 -0
  101. package/src/features/email-automation/data/EmailAutomationCandidateInterface.ts +19 -0
  102. package/src/features/email-automation/data/EmailAutomationEnrollment.ts +16 -2
  103. package/src/features/email-automation/data/EmailAutomationEnrollmentInterface.ts +7 -0
  104. package/src/features/email-automation/data/EmailAutomationInterface.ts +3 -0
  105. package/src/features/email-automation/data/EmailAutomationService.ts +53 -1
  106. package/src/features/email-automation/data/EmailPurpose.ts +1 -0
  107. package/src/features/email-automation/data/__tests__/email-automation-models.spec.ts +70 -0
  108. package/src/features/email-automation/data/email-automation.fields.ts +1 -0
  109. package/src/features/email-automation/data/index.ts +2 -0
  110. package/src/features/email-automation/hooks/useEmailAutomationTableStructure.tsx +19 -0
  111. package/src/features/email-automation/index.ts +2 -0
  112. package/src/features/email-blast/EmailBlastModule.ts +1 -0
  113. package/src/features/email-blast/components/forms/EmailBlastEditor.tsx +33 -4
  114. package/src/features/email-blast/components/lists/EmailBlastsList.tsx +1 -0
  115. package/src/features/email-blast/data/EmailBlast.ts +10 -1
  116. package/src/features/email-blast/data/EmailBlastInterface.ts +3 -0
  117. package/src/features/email-blast/data/__tests__/EmailBlast.spec.ts +18 -0
  118. package/src/features/email-blast/data/email-blast.fields.ts +1 -0
  119. package/src/features/email-blast/hooks/useEmailBlastTableStructure.tsx +15 -0
  120. package/dist/chunk-PMESKNKL.js.map +0 -1
  121. package/dist/chunk-RFKSJIQB.mjs.map +0 -1
  122. package/dist/chunk-RT7XFGIN.js.map +0 -1
  123. package/dist/chunk-UOTHRJD2.mjs.map +0 -1
  124. /package/dist/{BlockNoteEditor-I3J6YYXK.mjs.map → BlockNoteEditor-HNP5UAJT.mjs.map} +0 -0
  125. /package/dist/{BlockNoteViewer-HIUAJQRI.mjs.map → BlockNoteViewer-X4UEVI2A.mjs.map} +0 -0
  126. /package/dist/{chunk-HAW5PNJG.mjs.map → chunk-TY5YWBLL.mjs.map} +0 -0
  127. /package/dist/{chunk-OUEYZOLB.mjs.map → chunk-YVKWACDP.mjs.map} +0 -0
@@ -8,7 +8,7 @@ import {
8
8
  getI18nDefaultLocale,
9
9
  getI18nServerLocale,
10
10
  getI18nSupportedLocales
11
- } from "./chunk-UOTHRJD2.mjs";
11
+ } from "./chunk-OKBJEIOP.mjs";
12
12
  import {
13
13
  ClientJsonApiDelete,
14
14
  ClientJsonApiGet,
@@ -6511,6 +6511,7 @@ var EmailAutomation = class extends AbstractApiData {
6511
6511
  _exitTrigger;
6512
6512
  _replyTo;
6513
6513
  _isActive = false;
6514
+ _purpose = "marketing";
6514
6515
  _stepCount;
6515
6516
  _activeCount;
6516
6517
  _completedCount;
@@ -6530,6 +6531,9 @@ var EmailAutomation = class extends AbstractApiData {
6530
6531
  get isActive() {
6531
6532
  return this._isActive;
6532
6533
  }
6534
+ get purpose() {
6535
+ return this._purpose;
6536
+ }
6533
6537
  get stepCount() {
6534
6538
  return this._stepCount ?? 0;
6535
6539
  }
@@ -6549,6 +6553,7 @@ var EmailAutomation = class extends AbstractApiData {
6549
6553
  this._exitTrigger = data.jsonApi.attributes.exitTrigger ?? void 0;
6550
6554
  this._replyTo = data.jsonApi.attributes.replyTo ?? void 0;
6551
6555
  this._isActive = data.jsonApi.attributes.isActive === true;
6556
+ this._purpose = data.jsonApi.attributes.purpose === "service" ? "service" : "marketing";
6552
6557
  this._stepCount = data.jsonApi.attributes.stepCount;
6553
6558
  this._activeCount = data.jsonApi.attributes.activeCount;
6554
6559
  this._completedCount = data.jsonApi.attributes.completedCount;
@@ -6571,6 +6576,7 @@ var EmailAutomation = class extends AbstractApiData {
6571
6576
  if (data.exitTrigger !== void 0) response.data.attributes.exitTrigger = data.exitTrigger;
6572
6577
  if (data.replyTo !== void 0) response.data.attributes.replyTo = data.replyTo;
6573
6578
  if (data.isActive !== void 0) response.data.attributes.isActive = data.isActive;
6579
+ if (data.purpose !== void 0) response.data.attributes.purpose = data.purpose;
6574
6580
  return response;
6575
6581
  }
6576
6582
  };
@@ -6587,6 +6593,7 @@ var EmailAutomationModule = /* @__PURE__ */ __name((factory) => factory({
6587
6593
  fields: [
6588
6594
  createJsonApiInclusion("email-automations", [
6589
6595
  "name",
6596
+ "purpose",
6590
6597
  "trigger",
6591
6598
  "exitTrigger",
6592
6599
  "replyTo",
@@ -6769,8 +6776,21 @@ var EmailAutomationEnrollment = class extends AbstractApiData {
6769
6776
  this._automation = this._readIncluded(data, "automation", Modules.EmailAutomation);
6770
6777
  return this;
6771
6778
  }
6772
- createJsonApi(_data) {
6773
- throw new Error("EmailAutomationEnrollment is created by the API and cannot be created from the client");
6779
+ /**
6780
+ * Body of POST email-automations/:id/email-automation-enrollments: an
6781
+ * administrator adds a person by hand. The API enrols them at the first step.
6782
+ */
6783
+ createJsonApi(data) {
6784
+ return {
6785
+ data: {
6786
+ type: Modules.EmailAutomationEnrollment.name,
6787
+ id: data.id,
6788
+ attributes: {
6789
+ recipientType: data.recipientType,
6790
+ recipientId: data.recipientId
6791
+ }
6792
+ }
6793
+ };
6774
6794
  }
6775
6795
  /**
6776
6796
  * Body of POST email-automations/unsubscribe/:token.
@@ -6830,6 +6850,72 @@ var EmailAutomationTriggerModule = /* @__PURE__ */ __name((factory) => factory({
6830
6850
  icon: ZapIcon
6831
6851
  }), "EmailAutomationTriggerModule");
6832
6852
 
6853
+ // src/features/email-automation/EmailAutomationCandidateModule.ts
6854
+ import { UserPlusIcon } from "lucide-react";
6855
+
6856
+ // src/features/email-automation/data/EmailAutomationCandidate.ts
6857
+ var EmailAutomationCandidate = class extends AbstractApiData {
6858
+ static {
6859
+ __name(this, "EmailAutomationCandidate");
6860
+ }
6861
+ _recipientType = "user";
6862
+ _recipientId;
6863
+ _email;
6864
+ _name;
6865
+ _addable;
6866
+ _reason;
6867
+ get recipientType() {
6868
+ return this._recipientType;
6869
+ }
6870
+ get recipientId() {
6871
+ return this._recipientId ?? "";
6872
+ }
6873
+ get email() {
6874
+ return this._email ?? "";
6875
+ }
6876
+ get name() {
6877
+ return this._name;
6878
+ }
6879
+ get addable() {
6880
+ return this._addable ?? false;
6881
+ }
6882
+ get reason() {
6883
+ return this._reason;
6884
+ }
6885
+ rehydrate(data) {
6886
+ super.rehydrate(data);
6887
+ const attributes = data.jsonApi.attributes;
6888
+ this._recipientType = attributes.recipientType === "waitlist" ? "waitlist" : "user";
6889
+ this._recipientId = attributes.recipientId;
6890
+ this._email = attributes.email;
6891
+ this._name = attributes.name ?? void 0;
6892
+ this._addable = attributes.addable === true;
6893
+ this._reason = attributes.reason ?? void 0;
6894
+ return this;
6895
+ }
6896
+ /**
6897
+ * The API computes candidates and never accepts one as a request body; this
6898
+ * only identifies the resource.
6899
+ */
6900
+ createJsonApi(data) {
6901
+ return {
6902
+ data: {
6903
+ type: Modules.EmailAutomationCandidate.name,
6904
+ id: data.id
6905
+ }
6906
+ };
6907
+ }
6908
+ };
6909
+
6910
+ // src/features/email-automation/EmailAutomationCandidateModule.ts
6911
+ var EmailAutomationCandidateModule = /* @__PURE__ */ __name((factory) => factory({
6912
+ moduleId: "5c3e9a71-2b84-4f06-9d1e-7a4b6c8e0f25",
6913
+ pageUrl: void 0,
6914
+ name: "email-automation-candidates",
6915
+ model: EmailAutomationCandidate,
6916
+ icon: UserPlusIcon
6917
+ }), "EmailAutomationCandidateModule");
6918
+
6833
6919
  // src/features/email-automation/data/EmailAutomationService.ts
6834
6920
  var EmailAutomationService = class extends AbstractService {
6835
6921
  static {
@@ -6918,6 +7004,42 @@ var EmailAutomationService = class extends AbstractService {
6918
7004
  previous: params.previous
6919
7005
  });
6920
7006
  }
7007
+ /**
7008
+ * GET email-automations/:id/email-automation-candidates: users and waitlist
7009
+ * entries matching the search, each flagged addable or not by the API. Paged:
7010
+ * read through useDataListRetriever, which passes the next/previous refs.
7011
+ */
7012
+ static async findCandidates(params) {
7013
+ const endpoint = new EndpointCreator({
7014
+ endpoint: Modules.EmailAutomation,
7015
+ id: params.automationId,
7016
+ childEndpoint: Modules.EmailAutomationCandidate
7017
+ });
7018
+ if (params.search) endpoint.addAdditionalParam("search", params.search);
7019
+ return this.callApi({
7020
+ type: Modules.EmailAutomationCandidate,
7021
+ method: "GET" /* GET */,
7022
+ endpoint: endpoint.generate(),
7023
+ next: params.next,
7024
+ previous: params.previous
7025
+ });
7026
+ }
7027
+ /**
7028
+ * POST email-automations/:id/email-automation-enrollments: adds one person by
7029
+ * hand. The API re-checks every rule and answers 400 with the reason.
7030
+ */
7031
+ static async addEnrollment(params) {
7032
+ return this.callApi({
7033
+ type: Modules.EmailAutomationEnrollment,
7034
+ method: "POST" /* POST */,
7035
+ endpoint: new EndpointCreator({
7036
+ endpoint: Modules.EmailAutomation,
7037
+ id: params.automationId,
7038
+ childEndpoint: Modules.EmailAutomationEnrollment
7039
+ }).generate(),
7040
+ input: params.input
7041
+ });
7042
+ }
6921
7043
  };
6922
7044
 
6923
7045
  // src/features/email-automation/data/EmailAutomationStepService.ts
@@ -7024,6 +7146,7 @@ var EmailAutomationEnrollmentService = class extends AbstractService {
7024
7146
  // src/features/email-automation/data/email-automation.fields.ts
7025
7147
  var EmailAutomationFields = /* @__PURE__ */ ((EmailAutomationFields2) => {
7026
7148
  EmailAutomationFields2["name"] = "name";
7149
+ EmailAutomationFields2["purpose"] = "purpose";
7027
7150
  EmailAutomationFields2["trigger"] = "trigger";
7028
7151
  EmailAutomationFields2["status"] = "status";
7029
7152
  EmailAutomationFields2["steps"] = "steps";
@@ -7055,6 +7178,7 @@ var EmailBlast = class extends AbstractApiData {
7055
7178
  _subject;
7056
7179
  _body;
7057
7180
  _replyTo;
7181
+ _purpose = "marketing";
7058
7182
  _status = "draft";
7059
7183
  _sentAt;
7060
7184
  _recipientCount;
@@ -7070,6 +7194,9 @@ var EmailBlast = class extends AbstractApiData {
7070
7194
  get replyTo() {
7071
7195
  return this._replyTo;
7072
7196
  }
7197
+ get purpose() {
7198
+ return this._purpose;
7199
+ }
7073
7200
  get status() {
7074
7201
  return this._status;
7075
7202
  }
@@ -7094,6 +7221,7 @@ var EmailBlast = class extends AbstractApiData {
7094
7221
  this._subject = attributes.subject;
7095
7222
  this._body = attributes.body;
7096
7223
  this._replyTo = attributes.replyTo ?? void 0;
7224
+ this._purpose = attributes.purpose === "service" ? "service" : "marketing";
7097
7225
  this._status = attributes.status ?? "draft";
7098
7226
  this._sentAt = attributes.sentAt ? new Date(attributes.sentAt) : void 0;
7099
7227
  this._recipientCount = attributes.recipientCount ?? void 0;
@@ -7103,7 +7231,7 @@ var EmailBlast = class extends AbstractApiData {
7103
7231
  return this;
7104
7232
  }
7105
7233
  /**
7106
- * Only the editable text travels: status, counters and sentAt are set by the API.
7234
+ * Only the editable text and the purpose travel: status, counters and sentAt are set by the API.
7107
7235
  */
7108
7236
  createJsonApi(data) {
7109
7237
  const response = {
@@ -7119,6 +7247,7 @@ var EmailBlast = class extends AbstractApiData {
7119
7247
  if (data.subject !== void 0) response.data.attributes.subject = data.subject;
7120
7248
  if (data.body !== void 0) response.data.attributes.body = data.body;
7121
7249
  if (data.replyTo !== void 0) response.data.attributes.replyTo = data.replyTo;
7250
+ if (data.purpose !== void 0) response.data.attributes.purpose = data.purpose;
7122
7251
  return response;
7123
7252
  }
7124
7253
  };
@@ -7135,6 +7264,7 @@ var EmailBlastModule = /* @__PURE__ */ __name((factory) => factory({
7135
7264
  fields: [
7136
7265
  createJsonApiInclusion("email-blasts", [
7137
7266
  "subject",
7267
+ "purpose",
7138
7268
  "status",
7139
7269
  "sentAt",
7140
7270
  "recipientCount",
@@ -7348,6 +7478,7 @@ var EmailBlastDeliveryService = class extends AbstractService {
7348
7478
  // src/features/email-blast/data/email-blast.fields.ts
7349
7479
  var EmailBlastFields = /* @__PURE__ */ ((EmailBlastFields2) => {
7350
7480
  EmailBlastFields2["subject"] = "subject";
7481
+ EmailBlastFields2["purpose"] = "purpose";
7351
7482
  EmailBlastFields2["status"] = "status";
7352
7483
  EmailBlastFields2["sentAt"] = "sentAt";
7353
7484
  EmailBlastFields2["sent"] = "sent";
@@ -12487,6 +12618,8 @@ export {
12487
12618
  EmailAutomationEnrollmentModule,
12488
12619
  EmailAutomationTrigger,
12489
12620
  EmailAutomationTriggerModule,
12621
+ EmailAutomationCandidate,
12622
+ EmailAutomationCandidateModule,
12490
12623
  EmailAutomationService,
12491
12624
  EmailAutomationStepService,
12492
12625
  EmailAutomationEnrollmentService,
@@ -12636,4 +12769,4 @@ export {
12636
12769
  AuditLogService,
12637
12770
  AuditLogModule
12638
12771
  };
12639
- //# sourceMappingURL=chunk-RFKSJIQB.mjs.map
12772
+ //# sourceMappingURL=chunk-KMPBSOFB.mjs.map