@carlonicora/nextjs-jsonapi 5.7.0 → 5.7.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-ZHXXFWUJ.js → BlockNoteEditor-ARUXU5AV.js} +9 -9
- package/dist/{BlockNoteEditor-ZHXXFWUJ.js.map → BlockNoteEditor-ARUXU5AV.js.map} +1 -1
- package/dist/{BlockNoteEditor-R3WXUFHX.mjs → BlockNoteEditor-MNNISNVN.mjs} +2 -2
- package/dist/billing/index.js +381 -380
- package/dist/billing/index.js.map +1 -1
- package/dist/billing/index.mjs +3 -2
- package/dist/billing/index.mjs.map +1 -1
- package/dist/{chunk-CFB6FHIY.mjs → chunk-2FNSDBJG.mjs} +9 -6
- package/dist/chunk-2FNSDBJG.mjs.map +1 -0
- package/dist/{chunk-ZCOPOO7T.js → chunk-2WK35GO2.js} +10 -7
- package/dist/chunk-2WK35GO2.js.map +1 -0
- package/dist/client/index.js +2 -2
- package/dist/client/index.mjs +1 -1
- package/dist/components/index.js +2 -2
- package/dist/components/index.mjs +1 -1
- package/dist/contexts/index.js +2 -2
- package/dist/contexts/index.mjs +1 -1
- package/dist/email-automations/index.js +58 -58
- package/dist/email-automations/index.mjs +1 -1
- package/dist/features/analytics/index.js +87 -87
- package/dist/features/analytics/index.mjs +1 -1
- package/dist/features/blog/index.js +93 -93
- package/dist/features/blog/index.mjs +1 -1
- package/dist/features/help/index.js +31 -31
- package/dist/features/help/index.mjs +1 -1
- package/dist/features/tokenusage/index.js +74 -74
- package/dist/features/tokenusage/index.mjs +1 -1
- package/package.json +1 -1
- package/src/features/billing/stripe-coupon/components/containers/CouponContainer.tsx +2 -2
- package/src/features/billing/stripe-coupon/components/forms/CouponEditor.tsx +1 -11
- package/src/features/billing/stripe-coupon/utils/__tests__/coupon-page-module.spec.ts +32 -0
- package/src/features/billing/stripe-coupon/utils/coupon-page-module.ts +13 -0
- package/dist/chunk-CFB6FHIY.mjs.map +0 -1
- package/dist/chunk-ZCOPOO7T.js.map +0 -1
- /package/dist/{BlockNoteEditor-R3WXUFHX.mjs.map → BlockNoteEditor-MNNISNVN.mjs.map} +0 -0
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
import { useTranslations } from "next-intl";
|
|
4
4
|
import { RoundPageContainer } from "../../../../../components";
|
|
5
|
-
import { Modules } from "../../../../../core";
|
|
6
5
|
import { useCouponContext } from "../../../contexts/CouponContext";
|
|
7
6
|
import { CouponDetails } from "../details/CouponDetails";
|
|
8
7
|
import { CouponCodesList } from "../lists/CouponCodesList";
|
|
8
|
+
import { couponPageModule } from "../../utils/coupon-page-module";
|
|
9
9
|
|
|
10
10
|
export function CouponContainer() {
|
|
11
11
|
const t = useTranslations();
|
|
@@ -15,7 +15,7 @@ export function CouponContainer() {
|
|
|
15
15
|
|
|
16
16
|
return (
|
|
17
17
|
<RoundPageContainer
|
|
18
|
-
module={
|
|
18
|
+
module={couponPageModule()}
|
|
19
19
|
id={coupon.id}
|
|
20
20
|
tabs={[
|
|
21
21
|
{
|
|
@@ -27,7 +27,7 @@ import {
|
|
|
27
27
|
StripeCouponInput,
|
|
28
28
|
StripeCouponInterface,
|
|
29
29
|
} from "../../data/stripe-coupon.interface";
|
|
30
|
-
import {
|
|
30
|
+
import { couponPageModule } from "../../utils/coupon-page-module";
|
|
31
31
|
import { formatCouponDiscount } from "../../utils/format-coupon-discount";
|
|
32
32
|
import {
|
|
33
33
|
CouponCodeFields,
|
|
@@ -151,16 +151,6 @@ function toCouponInput(values: CouponCreateValues): StripeCouponInput {
|
|
|
151
151
|
return payload;
|
|
152
152
|
}
|
|
153
153
|
|
|
154
|
-
/**
|
|
155
|
-
* The module with the coupon's own route as pageUrl: the module's pageUrl is the
|
|
156
|
-
* products page (the coupons list is its Codes tab), so EditorSheet's
|
|
157
|
-
* navigate / revalidate after a save would otherwise land on
|
|
158
|
-
* `/administration/products/<couponId>`.
|
|
159
|
-
*/
|
|
160
|
-
function couponPageModule() {
|
|
161
|
-
return { ...Modules.StripeCoupon, pageUrl: STRIPE_COUPON_DETAIL_PAGE_URL };
|
|
162
|
-
}
|
|
163
|
-
|
|
164
154
|
function CouponRenameEditor({
|
|
165
155
|
coupon,
|
|
166
156
|
propagateChanges,
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { beforeAll, describe, expect, it } from "vitest";
|
|
2
|
+
import { ApiRequestDataTypeInterface } from "../../../../../core/interfaces/ApiRequestDataTypeInterface";
|
|
3
|
+
import { ModuleRegistry } from "../../../../../core/registry/ModuleRegistry";
|
|
4
|
+
import { StripeCoupon } from "../../data/stripe-coupon";
|
|
5
|
+
import { STRIPE_COUPON_DETAIL_PAGE_URL } from "../../stripe-coupon.module";
|
|
6
|
+
import { couponPageModule } from "../coupon-page-module";
|
|
7
|
+
|
|
8
|
+
// couponPageModule() resolves Modules.StripeCoupon through the real ModuleRegistry.
|
|
9
|
+
const registerIfAbsent = (key: string, module: ApiRequestDataTypeInterface) => {
|
|
10
|
+
try {
|
|
11
|
+
ModuleRegistry.get(key as any);
|
|
12
|
+
} catch {
|
|
13
|
+
ModuleRegistry.register(key, module);
|
|
14
|
+
}
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
beforeAll(() => {
|
|
18
|
+
registerIfAbsent("StripeCoupon", {
|
|
19
|
+
name: "stripe-coupons",
|
|
20
|
+
pageUrl: "/administration/products",
|
|
21
|
+
model: StripeCoupon,
|
|
22
|
+
} as any);
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
describe("couponPageModule", () => {
|
|
26
|
+
// The coupon page's tabs and the editor build `<pageUrl>/<couponId>` from this module:
|
|
27
|
+
// with the products pageUrl that is a products route, which answers Not Found.
|
|
28
|
+
it("points at the coupon's own route, not the products page", () =>
|
|
29
|
+
expect(couponPageModule().pageUrl).toBe(STRIPE_COUPON_DETAIL_PAGE_URL));
|
|
30
|
+
|
|
31
|
+
it("keeps the rest of the coupon module", () => expect(couponPageModule().name).toBe("stripe-coupons"));
|
|
32
|
+
});
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Modules } from "../../../../core";
|
|
2
|
+
import { STRIPE_COUPON_DETAIL_PAGE_URL } from "../stripe-coupon.module";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* The module with the coupon's own route as pageUrl: the module's pageUrl is the
|
|
6
|
+
* products page (the coupons list is its Codes tab), so anything that builds a
|
|
7
|
+
* URL for one coupon from the module (EditorSheet's navigate / revalidate after a
|
|
8
|
+
* save, RoundPageContainer's tab rewrite) would otherwise land on
|
|
9
|
+
* `/administration/products/<couponId>`.
|
|
10
|
+
*/
|
|
11
|
+
export function couponPageModule() {
|
|
12
|
+
return { ...Modules.StripeCoupon, pageUrl: STRIPE_COUPON_DETAIL_PAGE_URL };
|
|
13
|
+
}
|