@carlonicora/nextjs-jsonapi 1.37.0 → 1.38.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{BlockNoteEditor-GTWR6CPI.mjs → BlockNoteEditor-5CEV5TZT.mjs} +3 -3
- package/dist/{BlockNoteEditor-74FHJO7E.js → BlockNoteEditor-VB72JQEO.js} +13 -13
- package/dist/{BlockNoteEditor-74FHJO7E.js.map → BlockNoteEditor-VB72JQEO.js.map} +1 -1
- package/dist/billing/index.d.mts +12 -2
- package/dist/billing/index.d.ts +12 -2
- package/dist/billing/index.js +680 -452
- package/dist/billing/index.js.map +1 -1
- package/dist/billing/index.mjs +588 -360
- package/dist/billing/index.mjs.map +1 -1
- package/dist/{chunk-53IPQJVH.js → chunk-3EZX4G2E.js} +147 -23
- package/dist/chunk-3EZX4G2E.js.map +1 -0
- package/dist/{chunk-YVEK3SUS.js → chunk-BYMBRMKS.js} +454 -446
- package/dist/chunk-BYMBRMKS.js.map +1 -0
- package/dist/{chunk-P7R2DPD6.mjs → chunk-TQ5GRRTM.mjs} +125 -1
- package/dist/chunk-TQ5GRRTM.mjs.map +1 -0
- package/dist/{chunk-ZUUH4CQC.mjs → chunk-VMK2N3TQ.mjs} +13 -5
- package/dist/{chunk-ZUUH4CQC.mjs.map → chunk-VMK2N3TQ.mjs.map} +1 -1
- package/dist/client/index.js +3 -3
- package/dist/client/index.mjs +2 -2
- package/dist/components/index.js +3 -3
- package/dist/components/index.mjs +2 -2
- package/dist/contexts/index.js +3 -3
- package/dist/contexts/index.mjs +2 -2
- package/dist/core/index.d.mts +47 -3
- package/dist/core/index.d.ts +47 -3
- package/dist/core/index.js +8 -2
- package/dist/core/index.js.map +1 -1
- package/dist/core/index.mjs +7 -1
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +8 -2
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +7 -1
- package/dist/server/index.js +3 -3
- package/dist/server/index.mjs +1 -1
- package/dist/{stripe-subscription.interface-DK7BJaNd.d.ts → stripe-promotion-code.interface-BcJty0rv.d.ts} +18 -1
- package/dist/{stripe-subscription.interface-C8uhCYIZ.d.mts → stripe-promotion-code.interface-Dnm2DJKQ.d.mts} +18 -1
- package/package.json +1 -1
- package/src/billing/index.ts +1 -0
- package/src/core/index.ts +1 -0
- package/src/core/registry/ModuleRegistry.ts +1 -0
- package/src/features/auth/components/forms/Login.tsx +14 -2
- package/src/features/billing/components/cards/SubscriptionSummaryCard.tsx +5 -16
- package/src/features/billing/stripe-invoice/data/stripe-invoice.interface.ts +1 -0
- package/src/features/billing/stripe-promotion-code/components/PromoCodeInput.tsx +108 -0
- package/src/features/billing/stripe-promotion-code/components/index.ts +1 -0
- package/src/features/billing/stripe-promotion-code/data/index.ts +3 -0
- package/src/features/billing/stripe-promotion-code/data/stripe-promotion-code.interface.ts +14 -0
- package/src/features/billing/stripe-promotion-code/data/stripe-promotion-code.service.ts +64 -0
- package/src/features/billing/stripe-promotion-code/data/stripe-promotion-code.ts +66 -0
- package/src/features/billing/stripe-promotion-code/index.ts +2 -0
- package/src/features/billing/stripe-promotion-code/stripe-promotion-code.module.ts +9 -0
- package/src/features/billing/stripe-subscription/components/lists/SubscriptionsList.tsx +20 -3
- package/src/features/billing/stripe-subscription/components/wizards/SubscriptionWizard.tsx +6 -0
- package/src/features/billing/stripe-subscription/components/wizards/WizardStepReview.tsx +131 -9
- package/src/features/billing/stripe-subscription/data/stripe-subscription.interface.ts +2 -0
- package/src/features/billing/stripe-subscription/data/stripe-subscription.ts +8 -0
- package/src/features/billing/stripe-subscription/hooks/useSubscriptionWizard.ts +93 -7
- package/src/features/index.ts +1 -0
- package/dist/chunk-53IPQJVH.js.map +0 -1
- package/dist/chunk-P7R2DPD6.mjs.map +0 -1
- package/dist/chunk-YVEK3SUS.js.map +0 -1
- /package/dist/{BlockNoteEditor-GTWR6CPI.mjs.map → BlockNoteEditor-5CEV5TZT.mjs.map} +0 -0
|
@@ -3442,6 +3442,8 @@ var StripeSubscription = class extends AbstractApiData {
|
|
|
3442
3442
|
return this;
|
|
3443
3443
|
}
|
|
3444
3444
|
createJsonApi(data) {
|
|
3445
|
+
console.log("[StripeSubscription.createJsonApi] Input data:", JSON.stringify(data, null, 2));
|
|
3446
|
+
console.log("[StripeSubscription.createJsonApi] promotionCode in input:", data.promotionCode);
|
|
3445
3447
|
const response = {
|
|
3446
3448
|
data: {
|
|
3447
3449
|
type: Modules.StripeSubscription.name,
|
|
@@ -3477,6 +3479,10 @@ var StripeSubscription = class extends AbstractApiData {
|
|
|
3477
3479
|
if (data.metadata) {
|
|
3478
3480
|
response.data.attributes.metadata = data.metadata;
|
|
3479
3481
|
}
|
|
3482
|
+
if (data.promotionCode) {
|
|
3483
|
+
response.data.attributes.promotionCode = data.promotionCode;
|
|
3484
|
+
}
|
|
3485
|
+
console.log("[StripeSubscription.createJsonApi] Final response:", JSON.stringify(response, null, 2));
|
|
3480
3486
|
return response;
|
|
3481
3487
|
}
|
|
3482
3488
|
};
|
|
@@ -3823,6 +3829,121 @@ var StripeUsageModule = /* @__PURE__ */ __name((factory) => factory({
|
|
|
3823
3829
|
moduleId: "c2e9f4a6-1d7b-4e3a-8f5c-9b2d6a1e7f3c"
|
|
3824
3830
|
}), "StripeUsageModule");
|
|
3825
3831
|
|
|
3832
|
+
// src/features/billing/stripe-promotion-code/data/stripe-promotion-code.service.ts
|
|
3833
|
+
var STRIPE_PROMOTION_CODE_ENDPOINT = "stripe-promotion-codes";
|
|
3834
|
+
var StripePromotionCodeService = class {
|
|
3835
|
+
static {
|
|
3836
|
+
__name(this, "StripePromotionCodeService");
|
|
3837
|
+
}
|
|
3838
|
+
/**
|
|
3839
|
+
* Validate a promotion code against Stripe
|
|
3840
|
+
*
|
|
3841
|
+
* @param params.code - The promotion code to validate (e.g., "SAVE20")
|
|
3842
|
+
* @param params.stripePriceId - Optional price ID to check product restrictions
|
|
3843
|
+
* @param params.language - Language code for the request
|
|
3844
|
+
* @returns Validation result with discount details if valid
|
|
3845
|
+
*/
|
|
3846
|
+
static async validatePromotionCode(params) {
|
|
3847
|
+
const response = await JsonApiPost({
|
|
3848
|
+
classKey: Modules.StripePromotionCode,
|
|
3849
|
+
endpoint: `${STRIPE_PROMOTION_CODE_ENDPOINT}/validate`,
|
|
3850
|
+
body: {
|
|
3851
|
+
data: {
|
|
3852
|
+
type: STRIPE_PROMOTION_CODE_ENDPOINT,
|
|
3853
|
+
attributes: {
|
|
3854
|
+
code: params.code,
|
|
3855
|
+
stripePriceId: params.stripePriceId
|
|
3856
|
+
}
|
|
3857
|
+
}
|
|
3858
|
+
},
|
|
3859
|
+
overridesJsonApiCreation: true,
|
|
3860
|
+
language: params.language ?? "en"
|
|
3861
|
+
});
|
|
3862
|
+
if (!response.ok) {
|
|
3863
|
+
return {
|
|
3864
|
+
valid: false,
|
|
3865
|
+
code: params.code,
|
|
3866
|
+
errorMessage: response.error || "Failed to validate promotion code"
|
|
3867
|
+
};
|
|
3868
|
+
}
|
|
3869
|
+
const data = response.data;
|
|
3870
|
+
return {
|
|
3871
|
+
valid: data.valid,
|
|
3872
|
+
promotionCodeId: data.promotionCodeId,
|
|
3873
|
+
code: data.code,
|
|
3874
|
+
discountType: data.discountType,
|
|
3875
|
+
discountValue: data.discountValue,
|
|
3876
|
+
currency: data.currency,
|
|
3877
|
+
duration: data.duration,
|
|
3878
|
+
durationInMonths: data.durationInMonths,
|
|
3879
|
+
errorMessage: data.errorMessage
|
|
3880
|
+
};
|
|
3881
|
+
}
|
|
3882
|
+
};
|
|
3883
|
+
|
|
3884
|
+
// src/features/billing/stripe-promotion-code/data/stripe-promotion-code.ts
|
|
3885
|
+
var StripePromotionCode = class extends AbstractApiData {
|
|
3886
|
+
static {
|
|
3887
|
+
__name(this, "StripePromotionCode");
|
|
3888
|
+
}
|
|
3889
|
+
_valid = false;
|
|
3890
|
+
_promotionCodeId;
|
|
3891
|
+
_code = "";
|
|
3892
|
+
_discountType;
|
|
3893
|
+
_discountValue;
|
|
3894
|
+
_currency;
|
|
3895
|
+
_duration;
|
|
3896
|
+
_durationInMonths;
|
|
3897
|
+
_errorMessage;
|
|
3898
|
+
get valid() {
|
|
3899
|
+
return this._valid;
|
|
3900
|
+
}
|
|
3901
|
+
get promotionCodeId() {
|
|
3902
|
+
return this._promotionCodeId;
|
|
3903
|
+
}
|
|
3904
|
+
get code() {
|
|
3905
|
+
return this._code;
|
|
3906
|
+
}
|
|
3907
|
+
get discountType() {
|
|
3908
|
+
return this._discountType;
|
|
3909
|
+
}
|
|
3910
|
+
get discountValue() {
|
|
3911
|
+
return this._discountValue;
|
|
3912
|
+
}
|
|
3913
|
+
get currency() {
|
|
3914
|
+
return this._currency;
|
|
3915
|
+
}
|
|
3916
|
+
get duration() {
|
|
3917
|
+
return this._duration;
|
|
3918
|
+
}
|
|
3919
|
+
get durationInMonths() {
|
|
3920
|
+
return this._durationInMonths;
|
|
3921
|
+
}
|
|
3922
|
+
get errorMessage() {
|
|
3923
|
+
return this._errorMessage;
|
|
3924
|
+
}
|
|
3925
|
+
rehydrate(data) {
|
|
3926
|
+
super.rehydrate(data);
|
|
3927
|
+
this._valid = data.jsonApi.attributes.valid ?? false;
|
|
3928
|
+
this._promotionCodeId = data.jsonApi.attributes.promotionCodeId;
|
|
3929
|
+
this._code = data.jsonApi.attributes.code ?? "";
|
|
3930
|
+
this._discountType = data.jsonApi.attributes.discountType;
|
|
3931
|
+
this._discountValue = data.jsonApi.attributes.discountValue;
|
|
3932
|
+
this._currency = data.jsonApi.attributes.currency;
|
|
3933
|
+
this._duration = data.jsonApi.attributes.duration;
|
|
3934
|
+
this._durationInMonths = data.jsonApi.attributes.durationInMonths;
|
|
3935
|
+
this._errorMessage = data.jsonApi.attributes.errorMessage;
|
|
3936
|
+
return this;
|
|
3937
|
+
}
|
|
3938
|
+
};
|
|
3939
|
+
|
|
3940
|
+
// src/features/billing/stripe-promotion-code/stripe-promotion-code.module.ts
|
|
3941
|
+
var StripePromotionCodeModule = /* @__PURE__ */ __name((factory) => factory({
|
|
3942
|
+
name: "stripe-promotion-codes",
|
|
3943
|
+
model: StripePromotionCode,
|
|
3944
|
+
moduleId: "b8e4f6a2-9d0c-5b3f-c7e8-4g2d9f0a5c6e"
|
|
3945
|
+
}), "StripePromotionCodeModule");
|
|
3946
|
+
|
|
3826
3947
|
// src/features/company/data/company.ts
|
|
3827
3948
|
var Company = class extends AbstractApiData {
|
|
3828
3949
|
static {
|
|
@@ -5356,6 +5477,9 @@ export {
|
|
|
5356
5477
|
StripeUsage,
|
|
5357
5478
|
StripeUsageService,
|
|
5358
5479
|
StripeUsageModule,
|
|
5480
|
+
StripePromotionCodeService,
|
|
5481
|
+
StripePromotionCode,
|
|
5482
|
+
StripePromotionCodeModule,
|
|
5359
5483
|
Company,
|
|
5360
5484
|
CompanyFields,
|
|
5361
5485
|
CompanyService,
|
|
@@ -5395,4 +5519,4 @@ export {
|
|
|
5395
5519
|
AVAILABLE_OAUTH_SCOPES,
|
|
5396
5520
|
DEFAULT_GRANT_TYPES
|
|
5397
5521
|
};
|
|
5398
|
-
//# sourceMappingURL=chunk-
|
|
5522
|
+
//# sourceMappingURL=chunk-TQ5GRRTM.mjs.map
|