@carlonicora/nextjs-jsonapi 6.2.0 → 6.3.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.
- package/dist/{AssistantMessageInterface-S7oyERTT.d.mts → AssistantMessageInterface-0ZQ1EJKO.d.mts} +1 -1
- package/dist/{AssistantMessageInterface-DHJJO_Z_.d.ts → AssistantMessageInterface-CA-hZ5Wj.d.ts} +1 -1
- package/dist/{BlockNoteEditor-Q757ZLCO.js → BlockNoteEditor-CT4XUXPC.js} +19 -19
- package/dist/{BlockNoteEditor-Q757ZLCO.js.map → BlockNoteEditor-CT4XUXPC.js.map} +1 -1
- package/dist/{BlockNoteEditor-D6VMXRZH.mjs → BlockNoteEditor-M6UQRVRK.mjs} +4 -4
- package/dist/{BlockNoteViewer-KG4CIJC5.js → BlockNoteViewer-MFLWF3Y2.js} +3 -3
- package/dist/{BlockNoteViewer-KG4CIJC5.js.map → BlockNoteViewer-MFLWF3Y2.js.map} +1 -1
- package/dist/{BlockNoteViewer-GI5LVQHZ.mjs → BlockNoteViewer-XZJ5Y7WN.mjs} +2 -2
- package/dist/{BlogPostInterface-BB_4wcDR.d.mts → BlogPostInterface-BN2mXc46.d.mts} +1 -1
- package/dist/{BlogPostInterface-bWAT1rfR.d.ts → BlogPostInterface-CTGfsR1I.d.ts} +1 -1
- package/dist/{auth.interface-CSzJ1oP1.d.ts → auth.interface-D5606g19.d.ts} +1 -1
- package/dist/{auth.interface-DD4uQv2K.d.mts → auth.interface-tsOuc0Fi.d.mts} +1 -1
- package/dist/billing/index.d.mts +3 -3
- package/dist/billing/index.d.ts +3 -3
- package/dist/billing/index.js +501 -493
- package/dist/billing/index.js.map +1 -1
- package/dist/billing/index.mjs +13 -5
- package/dist/billing/index.mjs.map +1 -1
- package/dist/{chunk-QKDPCZ3G.mjs → chunk-3FD6Y734.mjs} +73 -15
- package/dist/chunk-3FD6Y734.mjs.map +1 -0
- package/dist/{chunk-3P3IYUWQ.js → chunk-DSGP6GC3.js} +8 -8
- package/dist/{chunk-3P3IYUWQ.js.map → chunk-DSGP6GC3.js.map} +1 -1
- package/dist/{chunk-HLW3SUMD.mjs → chunk-O2TEUH5S.mjs} +2 -2
- package/dist/{chunk-UEWDYVLW.js → chunk-QJIDORHM.js} +4 -4
- package/dist/{chunk-UEWDYVLW.js.map → chunk-QJIDORHM.js.map} +1 -1
- package/dist/{chunk-CUNSPLOD.mjs → chunk-RUJCWOJE.mjs} +2 -2
- package/dist/{chunk-6PW3562E.mjs → chunk-TIT4CJYQ.mjs} +1233 -1181
- package/dist/chunk-TIT4CJYQ.mjs.map +1 -0
- package/dist/{chunk-S332ZCIE.js → chunk-V4I3XKOM.js} +3 -3
- package/dist/{chunk-S332ZCIE.js.map → chunk-V4I3XKOM.js.map} +1 -1
- package/dist/{chunk-GSHMGL6N.js → chunk-XZCCIKX3.js} +151 -93
- package/dist/chunk-XZCCIKX3.js.map +1 -0
- package/dist/{chunk-XQEYBESH.js → chunk-Y7JIQNM6.js} +922 -870
- package/dist/chunk-Y7JIQNM6.js.map +1 -0
- package/dist/{chunk-MHBE4KQR.mjs → chunk-ZDUT5JPT.mjs} +2 -2
- package/dist/client/index.d.mts +4 -4
- package/dist/client/index.d.ts +4 -4
- package/dist/client/index.js +4 -4
- package/dist/client/index.mjs +3 -3
- package/dist/components/index.d.mts +22 -6
- package/dist/components/index.d.ts +22 -6
- package/dist/components/index.js +10 -4
- package/dist/components/index.js.map +1 -1
- package/dist/components/index.mjs +10 -4
- package/dist/contexts/index.d.mts +5 -5
- package/dist/contexts/index.d.ts +5 -5
- package/dist/contexts/index.js +4 -4
- package/dist/contexts/index.mjs +3 -3
- package/dist/core/index.d.mts +23 -13
- package/dist/core/index.d.ts +23 -13
- package/dist/core/index.js +8 -2
- package/dist/core/index.js.map +1 -1
- package/dist/core/index.mjs +7 -1
- package/dist/{currency-DrEVd_Xs.d.mts → currency-BhuEoBOn.d.mts} +2 -115
- package/dist/{currency-8ErEC39n.d.ts → currency-CBgZkS0u.d.ts} +2 -115
- package/dist/email-automations/index.js +92 -92
- package/dist/email-automations/index.mjs +3 -3
- package/dist/features/analytics/index.d.mts +2 -2
- package/dist/features/analytics/index.d.ts +2 -2
- package/dist/features/analytics/index.js +121 -121
- package/dist/features/analytics/index.mjs +4 -4
- package/dist/features/analytics/server.js +4 -4
- package/dist/features/analytics/server.mjs +2 -2
- package/dist/features/blog/index.d.mts +4 -4
- package/dist/features/blog/index.d.ts +4 -4
- package/dist/features/blog/index.js +150 -150
- package/dist/features/blog/index.mjs +3 -3
- package/dist/features/blog/server.d.mts +4 -4
- package/dist/features/blog/server.d.ts +4 -4
- package/dist/features/blog/server.js +16 -16
- package/dist/features/blog/server.mjs +1 -1
- package/dist/features/help/index.js +37 -37
- package/dist/features/help/index.mjs +3 -3
- package/dist/features/tokenusage/index.js +127 -127
- package/dist/features/tokenusage/index.mjs +4 -4
- package/dist/index.d.mts +8 -8
- package/dist/index.d.ts +8 -8
- package/dist/index.js +9 -3
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +8 -2
- package/dist/{notification.interface-BB6GPpZY.d.mts → notification.interface-CF5h90U2.d.mts} +1 -1
- package/dist/{notification.interface-CmAGrijJ.d.ts → notification.interface-DQReXAD7.d.ts} +1 -1
- package/dist/{s3.service-Bz_K-tjz.d.ts → s3.service-BTCpmp5g.d.ts} +11 -4
- package/dist/{s3.service-D5zNCEW3.d.mts → s3.service-CzFBDEuQ.d.mts} +11 -4
- package/dist/server/index.d.mts +5 -5
- package/dist/server/index.d.ts +5 -5
- package/dist/server/index.js +3 -3
- package/dist/server/index.mjs +2 -2
- package/dist/stripe-price.interface-D6mKjAdr.d.mts +132 -0
- package/dist/stripe-price.interface-DGqcklFJ.d.ts +132 -0
- package/dist/{useSocket-B0H9pmmH.d.ts → useSocket-BM3q9A0C.d.ts} +1 -1
- package/dist/{useSocket-B5RQb6v2.d.mts → useSocket-CwSoq6VS.d.mts} +1 -1
- package/dist/{user.interface-CIWGlbqM.d.mts → user.interface-BYnGJ7ss.d.mts} +37 -2
- package/dist/{user.interface-C0ZdsBZj.d.ts → user.interface-BqPjVyJI.d.ts} +37 -2
- package/messages/en.json +8 -0
- package/messages/it.json +8 -0
- package/package.json +1 -1
- package/src/components/containers/RoundPageContainer.tsx +7 -2
- package/src/components/index.ts +5 -0
- package/src/features/billing/components/containers/BillingDashboardContainer.tsx +20 -3
- package/src/features/billing/components/widgets/CreditWarningBanner.tsx +93 -0
- package/src/features/billing/data/credit-warning.spec.ts +96 -0
- package/src/features/billing/data/credit-warning.ts +57 -0
- package/src/features/billing/data/index.ts +3 -0
- package/src/features/billing/i18n-keys.ts +6 -0
- package/src/features/company/data/company.interface.ts +11 -0
- package/src/features/company/data/company.service.ts +17 -0
- package/src/features/company/data/company.spec.ts +29 -0
- package/src/features/company/data/company.ts +31 -0
- package/dist/chunk-6PW3562E.mjs.map +0 -1
- package/dist/chunk-GSHMGL6N.js.map +0 -1
- package/dist/chunk-QKDPCZ3G.mjs.map +0 -1
- package/dist/chunk-XQEYBESH.js.map +0 -1
- package/dist/feature.interface-BO25VLlx.d.ts +0 -19
- package/dist/feature.interface-CXb1-vNq.d.mts +0 -19
- /package/dist/{BlockNoteEditor-D6VMXRZH.mjs.map → BlockNoteEditor-M6UQRVRK.mjs.map} +0 -0
- /package/dist/{BlockNoteViewer-GI5LVQHZ.mjs.map → BlockNoteViewer-XZJ5Y7WN.mjs.map} +0 -0
- /package/dist/{chunk-HLW3SUMD.mjs.map → chunk-O2TEUH5S.mjs.map} +0 -0
- /package/dist/{chunk-CUNSPLOD.mjs.map → chunk-RUJCWOJE.mjs.map} +0 -0
- /package/dist/{chunk-MHBE4KQR.mjs.map → chunk-ZDUT5JPT.mjs.map} +0 -0
|
@@ -3631,6 +3631,39 @@ var Billing = class extends AbstractApiData {
|
|
|
3631
3631
|
}
|
|
3632
3632
|
};
|
|
3633
3633
|
|
|
3634
|
+
// src/features/billing/stripe-subscription/data/stripe-subscription.interface.ts
|
|
3635
|
+
var SubscriptionStatus = /* @__PURE__ */ ((SubscriptionStatus2) => {
|
|
3636
|
+
SubscriptionStatus2["ACTIVE"] = "active";
|
|
3637
|
+
SubscriptionStatus2["PAST_DUE"] = "past_due";
|
|
3638
|
+
SubscriptionStatus2["UNPAID"] = "unpaid";
|
|
3639
|
+
SubscriptionStatus2["CANCELED"] = "canceled";
|
|
3640
|
+
SubscriptionStatus2["INCOMPLETE"] = "incomplete";
|
|
3641
|
+
SubscriptionStatus2["INCOMPLETE_EXPIRED"] = "incomplete_expired";
|
|
3642
|
+
SubscriptionStatus2["TRIALING"] = "trialing";
|
|
3643
|
+
SubscriptionStatus2["PAUSED"] = "paused";
|
|
3644
|
+
return SubscriptionStatus2;
|
|
3645
|
+
})(SubscriptionStatus || {});
|
|
3646
|
+
|
|
3647
|
+
// src/features/billing/data/credit-warning.ts
|
|
3648
|
+
var CREDIT_WARNING_DISMISS_SEGMENT = "credit-warning/dismiss";
|
|
3649
|
+
function isCreditWarningActive(company, thresholdPercent) {
|
|
3650
|
+
if (!company.aiEnabled || !company.isActiveSubscription) return false;
|
|
3651
|
+
if (!company.creditWarningSentAt || company.creditWarningDismissedAt) return false;
|
|
3652
|
+
const granted = company.creditsGrantedThisPeriod;
|
|
3653
|
+
if (granted === void 0 || granted <= 0) return false;
|
|
3654
|
+
const monthly = company.availableMonthlyCredits;
|
|
3655
|
+
const extra = company.availableExtraCredits;
|
|
3656
|
+
if (!(monthly > 0 || extra > 0)) return false;
|
|
3657
|
+
return monthly + extra <= granted * (100 - thresholdPercent) / 100;
|
|
3658
|
+
}
|
|
3659
|
+
__name(isCreditWarningActive, "isCreditWarningActive");
|
|
3660
|
+
function resolveChangePlanTarget(subscriptions) {
|
|
3661
|
+
return subscriptions.find(
|
|
3662
|
+
(sub) => (sub.status === "active" /* ACTIVE */ || sub.status === "trialing" /* TRIALING */) && sub.price?.priceType === "recurring"
|
|
3663
|
+
);
|
|
3664
|
+
}
|
|
3665
|
+
__name(resolveChangePlanTarget, "resolveChangePlanTarget");
|
|
3666
|
+
|
|
3634
3667
|
// src/features/billing/modules/billing.module.ts
|
|
3635
3668
|
var BillingModule = /* @__PURE__ */ __name((factory) => factory({
|
|
3636
3669
|
name: "billing",
|
|
@@ -4673,19 +4706,6 @@ var StripeSubscription = class extends AbstractApiData {
|
|
|
4673
4706
|
}
|
|
4674
4707
|
};
|
|
4675
4708
|
|
|
4676
|
-
// src/features/billing/stripe-subscription/data/stripe-subscription.interface.ts
|
|
4677
|
-
var SubscriptionStatus = /* @__PURE__ */ ((SubscriptionStatus2) => {
|
|
4678
|
-
SubscriptionStatus2["ACTIVE"] = "active";
|
|
4679
|
-
SubscriptionStatus2["PAST_DUE"] = "past_due";
|
|
4680
|
-
SubscriptionStatus2["UNPAID"] = "unpaid";
|
|
4681
|
-
SubscriptionStatus2["CANCELED"] = "canceled";
|
|
4682
|
-
SubscriptionStatus2["INCOMPLETE"] = "incomplete";
|
|
4683
|
-
SubscriptionStatus2["INCOMPLETE_EXPIRED"] = "incomplete_expired";
|
|
4684
|
-
SubscriptionStatus2["TRIALING"] = "trialing";
|
|
4685
|
-
SubscriptionStatus2["PAUSED"] = "paused";
|
|
4686
|
-
return SubscriptionStatus2;
|
|
4687
|
-
})(SubscriptionStatus || {});
|
|
4688
|
-
|
|
4689
4709
|
// src/features/billing/stripe-subscription/data/stripe-subscription.service.ts
|
|
4690
4710
|
var StripeSubscriptionService = class extends AbstractService {
|
|
4691
4711
|
static {
|
|
@@ -6140,6 +6160,10 @@ var Company = class extends AbstractApiData {
|
|
|
6140
6160
|
_availableMonthlyCredits = 0;
|
|
6141
6161
|
_availableExtraCredits = 0;
|
|
6142
6162
|
_aiEnabled;
|
|
6163
|
+
_creditsGrantedThisPeriod;
|
|
6164
|
+
_creditWarningSentAt;
|
|
6165
|
+
_creditWarningDismissedAt;
|
|
6166
|
+
_creditWarningOffer;
|
|
6143
6167
|
_features;
|
|
6144
6168
|
_modules;
|
|
6145
6169
|
_legal_address;
|
|
@@ -6177,6 +6201,18 @@ var Company = class extends AbstractApiData {
|
|
|
6177
6201
|
get aiEnabled() {
|
|
6178
6202
|
return this._aiEnabled ?? true;
|
|
6179
6203
|
}
|
|
6204
|
+
get creditsGrantedThisPeriod() {
|
|
6205
|
+
return this._creditsGrantedThisPeriod;
|
|
6206
|
+
}
|
|
6207
|
+
get creditWarningSentAt() {
|
|
6208
|
+
return this._creditWarningSentAt;
|
|
6209
|
+
}
|
|
6210
|
+
get creditWarningDismissedAt() {
|
|
6211
|
+
return this._creditWarningDismissedAt;
|
|
6212
|
+
}
|
|
6213
|
+
get creditWarningOffer() {
|
|
6214
|
+
return this._creditWarningOffer;
|
|
6215
|
+
}
|
|
6180
6216
|
get features() {
|
|
6181
6217
|
return this._features ?? [];
|
|
6182
6218
|
}
|
|
@@ -6227,6 +6263,10 @@ var Company = class extends AbstractApiData {
|
|
|
6227
6263
|
this._availableMonthlyCredits = data.jsonApi.attributes.availableMonthlyCredits ?? 0;
|
|
6228
6264
|
this._availableExtraCredits = data.jsonApi.attributes.availableExtraCredits ?? 0;
|
|
6229
6265
|
this._aiEnabled = data.jsonApi.attributes.aiEnabled ?? true;
|
|
6266
|
+
this._creditsGrantedThisPeriod = data.jsonApi.attributes.creditsGrantedThisPeriod ?? void 0;
|
|
6267
|
+
this._creditWarningSentAt = data.jsonApi.attributes.creditWarningSentAt ? new Date(data.jsonApi.attributes.creditWarningSentAt) : void 0;
|
|
6268
|
+
this._creditWarningDismissedAt = data.jsonApi.attributes.creditWarningDismissedAt ? new Date(data.jsonApi.attributes.creditWarningDismissedAt) : void 0;
|
|
6269
|
+
this._creditWarningOffer = data.jsonApi.attributes.creditWarningOffer ?? void 0;
|
|
6230
6270
|
this._legal_address = data.jsonApi.attributes.legal_address;
|
|
6231
6271
|
this._street_number = data.jsonApi.attributes.street_number;
|
|
6232
6272
|
this._street = data.jsonApi.attributes.street;
|
|
@@ -6376,6 +6416,21 @@ var CompanyService = class extends AbstractService {
|
|
|
6376
6416
|
input: params
|
|
6377
6417
|
});
|
|
6378
6418
|
}
|
|
6419
|
+
/**
|
|
6420
|
+
* Dismisses this period's credit warning for the company. The request has no
|
|
6421
|
+
* body: the server stamps the dismissal itself and answers 204.
|
|
6422
|
+
*/
|
|
6423
|
+
static async dismissCreditWarning(params) {
|
|
6424
|
+
await this.callApi({
|
|
6425
|
+
type: Modules.Company,
|
|
6426
|
+
method: "POST" /* POST */,
|
|
6427
|
+
endpoint: new EndpointCreator({
|
|
6428
|
+
endpoint: Modules.Company,
|
|
6429
|
+
id: params.companyId,
|
|
6430
|
+
childEndpoint: CREDIT_WARNING_DISMISS_SEGMENT
|
|
6431
|
+
}).generate()
|
|
6432
|
+
});
|
|
6433
|
+
}
|
|
6379
6434
|
};
|
|
6380
6435
|
|
|
6381
6436
|
// src/features/company/data/entity-ai-status.ts
|
|
@@ -12129,6 +12184,10 @@ export {
|
|
|
12129
12184
|
TwoFactorStatusModule,
|
|
12130
12185
|
BillingService,
|
|
12131
12186
|
Billing,
|
|
12187
|
+
SubscriptionStatus,
|
|
12188
|
+
CREDIT_WARNING_DISMISS_SEGMENT,
|
|
12189
|
+
isCreditWarningActive,
|
|
12190
|
+
resolveChangePlanTarget,
|
|
12132
12191
|
BillingModule,
|
|
12133
12192
|
PaymentMethod,
|
|
12134
12193
|
StripeCustomer,
|
|
@@ -12148,7 +12207,6 @@ export {
|
|
|
12148
12207
|
StripeProductService,
|
|
12149
12208
|
StripeProductModule,
|
|
12150
12209
|
StripeSubscription,
|
|
12151
|
-
SubscriptionStatus,
|
|
12152
12210
|
StripeSubscriptionService,
|
|
12153
12211
|
StripeSubscriptionModule,
|
|
12154
12212
|
StripeUsage,
|
|
@@ -12334,4 +12392,4 @@ export {
|
|
|
12334
12392
|
AuditLogService,
|
|
12335
12393
|
AuditLogModule
|
|
12336
12394
|
};
|
|
12337
|
-
//# sourceMappingURL=chunk-
|
|
12395
|
+
//# sourceMappingURL=chunk-3FD6Y734.mjs.map
|