@carlonicora/nextjs-jsonapi 1.28.0 → 1.29.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/{BlockNoteEditor-CAUNVZUF.js → BlockNoteEditor-YBVEOPV4.js} +13 -13
- package/dist/{BlockNoteEditor-CAUNVZUF.js.map → BlockNoteEditor-YBVEOPV4.js.map} +1 -1
- package/dist/{BlockNoteEditor-EOA4OEVX.mjs → BlockNoteEditor-ZM4YPXHO.mjs} +3 -3
- package/dist/billing/index.d.mts +47 -17
- package/dist/billing/index.d.ts +47 -17
- package/dist/billing/index.js +1241 -1073
- package/dist/billing/index.js.map +1 -1
- package/dist/billing/index.mjs +1375 -1207
- package/dist/billing/index.mjs.map +1 -1
- package/dist/{chunk-IXI4GAKB.js → chunk-3X7EEFMN.js} +488 -431
- package/dist/chunk-3X7EEFMN.js.map +1 -0
- package/dist/{chunk-ORFXBO7F.mjs → chunk-DU64WMZD.mjs} +6 -3
- package/dist/chunk-DU64WMZD.mjs.map +1 -0
- package/dist/{chunk-TSEU4KZ2.js → chunk-J22NEVSK.js} +21 -18
- package/dist/chunk-J22NEVSK.js.map +1 -0
- package/dist/{chunk-PYASRX75.mjs → chunk-UCD5CUE4.mjs} +81 -24
- package/dist/chunk-UCD5CUE4.mjs.map +1 -0
- package/dist/client/index.d.mts +14 -5
- package/dist/client/index.d.ts +14 -5
- package/dist/client/index.js +5 -3
- package/dist/client/index.js.map +1 -1
- package/dist/client/index.mjs +4 -2
- package/dist/components/index.d.mts +2 -2
- package/dist/components/index.d.ts +2 -2
- package/dist/components/index.js +3 -3
- package/dist/components/index.mjs +2 -2
- package/dist/{config-B4pZpLT9.d.ts → config-CHwoRDOp.d.ts} +1 -1
- package/dist/{config-DT1K-t6I.d.mts → config-DiWyJzk9.d.mts} +1 -1
- package/dist/{content.interface-B2Ldg0vg.d.mts → content.interface-BSpowEiW.d.mts} +1 -1
- package/dist/{content.interface-D8NHv3DX.d.ts → content.interface-DFQ7mkpL.d.ts} +1 -1
- package/dist/contexts/index.d.mts +2 -2
- package/dist/contexts/index.d.ts +2 -2
- package/dist/contexts/index.js +3 -3
- package/dist/contexts/index.mjs +2 -2
- package/dist/core/index.d.mts +39 -37
- package/dist/core/index.d.ts +39 -37
- package/dist/core/index.js +2 -2
- package/dist/core/index.mjs +1 -1
- package/dist/index.d.mts +4 -4
- package/dist/index.d.ts +4 -4
- package/dist/index.js +2 -2
- package/dist/index.mjs +1 -1
- package/dist/{notification.interface-H0L9WBge.d.ts → notification.interface-CmKmObIU.d.ts} +1 -0
- package/dist/{notification.interface-DEn-Yp_b.d.mts → notification.interface-D5MbtfZK.d.mts} +1 -0
- package/dist/{s3.service-BNytYanU.d.mts → s3.service-BMT7W6KS.d.mts} +19 -19
- package/dist/{s3.service-C7f_Ygz5.d.ts → s3.service-DsXo9nop.d.ts} +19 -19
- package/dist/server/index.d.mts +3 -3
- package/dist/server/index.d.ts +3 -3
- package/dist/server/index.js +3 -3
- package/dist/server/index.mjs +1 -1
- package/dist/{useSocket-BcnThTD0.d.mts → useSocket-DUqGoPya.d.mts} +1 -1
- package/dist/{useSocket-QZTOCzRF.d.ts → useSocket-QuHa0ZmO.d.ts} +1 -1
- package/package.json +1 -1
- package/src/client/index.ts +1 -0
- package/src/components/forms/FormSelect.tsx +2 -1
- package/src/features/auth/data/auth.ts +0 -2
- package/src/features/billing/components/containers/BillingDashboardContainer.tsx +60 -3
- package/src/features/billing/stripe-customer/components/forms/PaymentMethodEditor.tsx +12 -152
- package/src/features/billing/stripe-customer/components/forms/PaymentMethodForm.tsx +168 -0
- package/src/features/billing/stripe-customer/components/forms/index.ts +1 -0
- package/src/features/billing/stripe-price/components/forms/PriceEditor.tsx +19 -1
- package/src/features/billing/stripe-product/components/forms/ProductEditor.tsx +2 -2
- package/src/features/billing/stripe-subscription/components/containers/SubscriptionsContainer.tsx +24 -235
- package/src/features/billing/stripe-subscription/components/details/SubscriptionDetails.tsx +7 -18
- package/src/features/billing/stripe-subscription/components/forms/index.ts +0 -1
- package/src/features/billing/stripe-subscription/components/lists/SubscriptionsList.tsx +10 -1
- package/src/features/billing/stripe-subscription/components/widgets/IntervalToggle.tsx +28 -0
- package/src/features/billing/stripe-subscription/components/widgets/ProductPricingList.tsx +128 -0
- package/src/features/billing/stripe-subscription/components/widgets/ProductPricingRow.tsx +54 -0
- package/src/features/billing/stripe-subscription/components/widgets/SubscriptionConfirmation.tsx +68 -0
- package/src/features/billing/stripe-subscription/components/widgets/index.ts +4 -1
- package/src/features/billing/stripe-subscription/components/wizards/SubscriptionWizard.tsx +114 -0
- package/src/features/billing/stripe-subscription/components/wizards/WizardProgressIndicator.tsx +66 -0
- package/src/features/billing/stripe-subscription/components/wizards/WizardStepPaymentMethod.tsx +32 -0
- package/src/features/billing/stripe-subscription/components/wizards/WizardStepPlanSelection.tsx +103 -0
- package/src/features/billing/stripe-subscription/components/wizards/WizardStepReview.tsx +133 -0
- package/src/features/billing/stripe-subscription/components/wizards/index.ts +6 -0
- package/src/features/billing/stripe-subscription/hooks/useSubscriptionWizard.ts +217 -0
- package/src/features/billing/stripe-subscription/index.ts +3 -2
- package/src/features/company/components/details/TokenStatusIndicator.tsx +19 -9
- package/src/features/company/data/company.interface.ts +2 -0
- package/src/features/company/data/company.ts +7 -0
- package/src/features/company/hooks/index.ts +1 -0
- package/src/features/company/hooks/useSubscriptionStatus.ts +71 -0
- package/src/features/user/components/forms/UserEditor.tsx +1 -1
- package/src/features/user/components/lists/AdminUsersList.tsx +1 -1
- package/src/features/user/contexts/CurrentUserContext.tsx +1 -1
- package/src/features/user/data/user.ts +1 -1
- package/dist/chunk-IXI4GAKB.js.map +0 -1
- package/dist/chunk-ORFXBO7F.mjs.map +0 -1
- package/dist/chunk-PYASRX75.mjs.map +0 -1
- package/dist/chunk-TSEU4KZ2.js.map +0 -1
- package/src/features/billing/stripe-subscription/components/forms/SubscriptionEditor.tsx +0 -331
- package/src/features/billing/stripe-subscription/components/widgets/PricingCardsGrid.tsx +0 -110
- /package/dist/{BlockNoteEditor-EOA4OEVX.mjs.map → BlockNoteEditor-ZM4YPXHO.mjs.map} +0 -0
|
@@ -3,14 +3,14 @@
|
|
|
3
3
|
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
var
|
|
6
|
+
var _chunk3X7EEFMNjs = require('./chunk-3X7EEFMN.js');
|
|
7
7
|
require('./chunk-EW6QPMN3.js');
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
|
|
12
12
|
|
|
13
|
-
var
|
|
13
|
+
var _chunkJ22NEVSKjs = require('./chunk-J22NEVSK.js');
|
|
14
14
|
require('./chunk-LXKSUWAV.js');
|
|
15
15
|
require('./chunk-IBS6NI7D.js');
|
|
16
16
|
require('./chunk-FM6WRAN5.js');
|
|
@@ -80,7 +80,7 @@ var createDiffActionsInlineContentSpec = /* @__PURE__ */ _chunk7QVYU63Ejs.__name
|
|
|
80
80
|
const diffIds = props.inlineContent.props.diffIds;
|
|
81
81
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "diff-actions-container mx-2 inline-flex items-center gap-1 align-middle", children: [
|
|
82
82
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
83
|
-
|
|
83
|
+
_chunk3X7EEFMNjs.Button,
|
|
84
84
|
{
|
|
85
85
|
title: "Accept change",
|
|
86
86
|
onClick: (e) => {
|
|
@@ -92,7 +92,7 @@ var createDiffActionsInlineContentSpec = /* @__PURE__ */ _chunk7QVYU63Ejs.__name
|
|
|
92
92
|
}
|
|
93
93
|
),
|
|
94
94
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
95
|
-
|
|
95
|
+
_chunk3X7EEFMNjs.Button,
|
|
96
96
|
{
|
|
97
97
|
title: "Reject change",
|
|
98
98
|
className: "mx-2 p-0",
|
|
@@ -122,7 +122,7 @@ function BlockNoteEditor({
|
|
|
122
122
|
bordered
|
|
123
123
|
}) {
|
|
124
124
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
125
|
-
const { company } =
|
|
125
|
+
const { company } = _chunk3X7EEFMNjs.useCurrentUserContext.call(void 0, );
|
|
126
126
|
const [acceptedChanges, setAcceptedChanges] = _react3.useState.call(void 0, /* @__PURE__ */ new Set());
|
|
127
127
|
const [rejectedChanges, setRejectedChanges] = _react3.useState.call(void 0, /* @__PURE__ */ new Set());
|
|
128
128
|
const editorRef = _react3.useRef.call(void 0, null);
|
|
@@ -158,7 +158,7 @@ function BlockNoteEditor({
|
|
|
158
158
|
const uploadImage = _react3.useCallback.call(void 0,
|
|
159
159
|
async (file) => {
|
|
160
160
|
if (!company) {
|
|
161
|
-
|
|
161
|
+
_chunk3X7EEFMNjs.errorToast.call(void 0, {
|
|
162
162
|
title: t(`generic.errors.upload`),
|
|
163
163
|
error: t(`generic.errors.upload_description`)
|
|
164
164
|
});
|
|
@@ -166,7 +166,7 @@ function BlockNoteEditor({
|
|
|
166
166
|
}
|
|
167
167
|
const fileType = file.type;
|
|
168
168
|
const key = `companies/${company.id}/${type}/${id}/${file.name}`;
|
|
169
|
-
const s3 = await
|
|
169
|
+
const s3 = await _chunkJ22NEVSKjs.S3Service.getPreSignedUrl({
|
|
170
170
|
key,
|
|
171
171
|
contentType: fileType,
|
|
172
172
|
isPublic: true
|
|
@@ -176,7 +176,7 @@ function BlockNoteEditor({
|
|
|
176
176
|
headers: s3.headers,
|
|
177
177
|
body: file
|
|
178
178
|
});
|
|
179
|
-
const signedImage = await
|
|
179
|
+
const signedImage = await _chunkJ22NEVSKjs.S3Service.getSignedUrl({
|
|
180
180
|
key,
|
|
181
181
|
isPublic: true
|
|
182
182
|
});
|
|
@@ -205,8 +205,8 @@ function BlockNoteEditor({
|
|
|
205
205
|
const processedContent = _react3.useMemo.call(void 0, () => {
|
|
206
206
|
if (diffContent && initialContent) {
|
|
207
207
|
try {
|
|
208
|
-
const diffResult =
|
|
209
|
-
const renderedDiff =
|
|
208
|
+
const diffResult = _chunkJ22NEVSKjs.BlockNoteDiffUtil.diff(initialContent, diffContent);
|
|
209
|
+
const renderedDiff = _chunkJ22NEVSKjs.BlockNoteWordDiffRendererUtil.renderWordDiffs(
|
|
210
210
|
diffResult.blocks,
|
|
211
211
|
handleAcceptChange,
|
|
212
212
|
handleRejectChange,
|
|
@@ -364,7 +364,7 @@ function BlockNoteEditor({
|
|
|
364
364
|
},
|
|
365
365
|
[editor]
|
|
366
366
|
);
|
|
367
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { ref: editorRef, className:
|
|
367
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { ref: editorRef, className: _chunkJ22NEVSKjs.cn.call(void 0, bordered ? "rounded-md border" : "", "w-full"), children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
368
368
|
_shadcn.BlockNoteView,
|
|
369
369
|
{
|
|
370
370
|
editor,
|
|
@@ -372,7 +372,7 @@ function BlockNoteEditor({
|
|
|
372
372
|
editable: onChange !== void 0,
|
|
373
373
|
formattingToolbar: false,
|
|
374
374
|
theme: "light",
|
|
375
|
-
className:
|
|
375
|
+
className: _chunkJ22NEVSKjs.cn.call(void 0, `BlockNoteView ${onChange ? "min-h-96 p-4" : ""}`, className, size === "sm" && "small"),
|
|
376
376
|
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, BlockNoteEditorFormattingToolbar, {})
|
|
377
377
|
}
|
|
378
378
|
) });
|
|
@@ -381,4 +381,4 @@ _chunk7QVYU63Ejs.__name.call(void 0, BlockNoteEditor, "BlockNoteEditor");
|
|
|
381
381
|
|
|
382
382
|
|
|
383
383
|
exports.default = BlockNoteEditor;
|
|
384
|
-
//# sourceMappingURL=BlockNoteEditor-
|
|
384
|
+
//# sourceMappingURL=BlockNoteEditor-YBVEOPV4.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/home/runner/work/nextjs-jsonapi/nextjs-jsonapi/dist/BlockNoteEditor-CAUNVZUF.js","../src/components/editors/BlockNoteEditor.tsx","../src/components/editors/BlockNoteEditorFormattingToolbar.tsx"],"names":["jsxs","jsx"],"mappings":"AAAA,ylBAAY;AACZ;AACE;AACA;AACA;AACF,sDAA4B;AAC5B,+BAA4B;AAC5B;AACE;AACA;AACA;AACA;AACF,sDAA4B;AAC5B,+BAA4B;AAC5B,+BAA4B;AAC5B,+BAA4B;AAC5B,+BAA4B;AAC5B;AACE;AACF,sDAA4B;AAC5B;AACA;ACnBA,uCAAyE;AACzE,yCAAiE;AACjE,2CAA8B;AAC9B,uCAAO;AACP,2CAAiC;AACjC,qCAAgC;AAChC,+BAAyE;ADqBzE;AACA;AE5BA;AACE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAOM,+CAAA;AAJD,SAAS,gCAAA,CAAA,EAAmC;AACjD,EAAA,uBACE,6BAAA;AAAA,IAAC,kCAAA;AAAA,IAAA;AAAA,MACC,iBAAA,EAAmB,CAAA,EAAA,mBACjB,8BAAA,wBAAC,EAAA,EACC,QAAA,EAAA;AAAA,wBAAA,6BAAA,sBAAC,EAAA,CAAA,CAAA,EAAqB,iBAAmB,CAAA;AAAA,wBAEzC,6BAAA,wBAAC,EAAA,CAAA,CAAA,EAAuB,mBAAqB,CAAA;AAAA,wBAC7C,6BAAA,wBAAC,EAAA,CAAA,CAAA,EAAuB,mBAAqB,CAAA;AAAA,wBAE7C,6BAAA,2BAAC,EAAA,EAAqB,cAAA,EAAgB,OAAA,CAAA,EAAa,iBAAmB,CAAA;AAAA,wBACtE,6BAAA,2BAAC,EAAA,EAAqB,cAAA,EAAgB,SAAA,CAAA,EAAe,mBAAqB,CAAA;AAAA,wBAC1E,6BAAA,2BAAC,EAAA,EAAqB,cAAA,EAAgB,YAAA,CAAA,EAAkB,sBAAwB,CAAA;AAAA,wBAChF,6BAAA,2BAAC,EAAA,EAAqB,cAAA,EAAgB,SAAA,CAAA,EAAe,mBAAqB,CAAA;AAAA,wBAE1E,6BAAA,sBAAC,EAA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;AACrD,IAAA;AAEiE,IAAA;AACR,EAAA;AAGH,EAAA;AACT,IAAA;AADxB,EAAA;AAKsC,EAAA;AAC7C,EAAA;AACoC,IAAA;AACa,MAAA;AACf,MAAA;AACA,QAAA;AAC9C,MAAA;AAJoB,IAAA;AAOwC,IAAA;AACvB,MAAA;AACmB,MAAA;AAC1D,IAAA;AAC0B,EAAA;AAI6B,EAAA;AACzC,EAAA;AACoB,IAAA;AACU,IAAA;AACC,IAAA;AACK,IAAA;AACxB,IAAA;AACS,MAAA;AACjC,MAAA;AACF,IAAA;AACwE,IAAA;AACvC,IAAA;AACN,EAAA;AAGD,EAAA;AACL,IAAA;AACf,MAAA;AAEqD,QAAA;AACP,QAAA;AAC1B,UAAA;AACtB,QAAA;AAGkC,QAAA;AACpB,MAAA;AAC0C,QAAA;AAEpD,QAAA;AACoB,UAAA;AACC,UAAA;AACqB,YAAA;AACM,YAAA;AACd,YAAA;AACpC,UAAA;AACsB,QAAA;AAC2B,UAAA;AACnD,QAAA;AACF,MAAA;AACF,IAAA;AACO,IAAA;AACT,EAAA;AAGqC,EAAA;AAChC,IAAA;AAAA,IAAA;AACC,MAAA;AACU,MAAA;AACa,MAAA;AACJ,MAAA;AACb,MAAA;AACuD,MAAA;AAE5D,MAAA;AAAiC,IAAA;AAEtC,EAAA;AAEJ;AAtUwB;AD6S6C;AACA;AACA","file":"/home/runner/work/nextjs-jsonapi/nextjs-jsonapi/dist/BlockNoteEditor-CAUNVZUF.js","sourcesContent":[null,"\"use client\";\n\nimport { BlockNoteSchema, defaultInlineContentSpecs, PartialBlock } from \"@blocknote/core\";\nimport { createReactInlineContentSpec, useCreateBlockNote } from \"@blocknote/react\";\nimport { BlockNoteView } from \"@blocknote/shadcn\";\nimport \"@blocknote/shadcn/style.css\";\nimport { CheckIcon, XIcon } from \"lucide-react\";\nimport { useTranslations } from \"next-intl\";\nimport React, { useCallback, useEffect, useMemo, useRef, useState } from \"react\";\nimport { useCurrentUserContext } from \"../../contexts\";\nimport { S3Interface } from \"../../features/s3/data\";\nimport { UserInterface } from \"../../features/user/data\";\nimport { S3Service } from \"../../features/s3/data/s3.service\";\nimport { Button } from \"../../shadcnui\";\nimport { BlockNoteDiffUtil, BlockNoteWordDiffRendererUtil, cn } from \"../../utils\";\nimport { errorToast } from \"../errors\";\nimport { BlockNoteEditorFormattingToolbar } from \"./BlockNoteEditorFormattingToolbar\";\n\nexport type BlockNoteEditorProps = {\n id: string;\n type: string;\n initialContent?: PartialBlock[];\n onChange?: (content: any, isEmpty: boolean, hasUnresolvedDiff: boolean) => void;\n size?: \"sm\" | \"md\";\n className?: string;\n markdownContent?: string;\n diffContent?: PartialBlock[];\n placeholder?: string;\n bordered?: boolean;\n};\n\nconst createDiffActionsInlineContentSpec = (\n handleAcceptChange: (diffId: string) => void,\n handleRejectChange: (diffId: string) => void,\n) => {\n return createReactInlineContentSpec(\n {\n type: \"diffActions\",\n propSchema: {\n diffIds: {\n default: \"\",\n },\n },\n content: \"none\",\n },\n {\n render: (props) => {\n const diffIds = props.inlineContent.props.diffIds;\n\n return (\n <span className=\"diff-actions-container mx-2 inline-flex items-center gap-1 align-middle\">\n <Button\n title=\"Accept change\"\n onClick={(e) => {\n e.preventDefault();\n e.stopPropagation();\n diffIds.split(\",\").forEach((id: string) => handleAcceptChange(id.trim()));\n }}\n >\n <CheckIcon className=\"h-3 w-3 text-green-600\" />\n </Button>\n <Button\n title=\"Reject change\"\n className=\"mx-2 p-0\"\n onClick={(e) => {\n e.preventDefault();\n e.stopPropagation();\n diffIds.split(\",\").forEach((id: string) => handleRejectChange(id.trim()));\n }}\n >\n <XIcon className=\"h-3 w-3 text-red-600\" />\n </Button>\n </span>\n );\n },\n },\n );\n};\n\nexport default function BlockNoteEditor({\n id,\n type,\n initialContent,\n onChange,\n size,\n className,\n markdownContent,\n diffContent,\n placeholder,\n bordered,\n}: BlockNoteEditorProps): React.JSX.Element {\n const t = useTranslations();\n const { company } = useCurrentUserContext<UserInterface>();\n\n const [acceptedChanges, setAcceptedChanges] = useState<Set<string>>(new Set());\n const [rejectedChanges, setRejectedChanges] = useState<Set<string>>(new Set());\n\n const editorRef = useRef<HTMLDivElement>(null);\n\n const handleAcceptChange = useCallback((diffId: string) => {\n setAcceptedChanges((prev) => new Set([...prev, diffId]));\n setRejectedChanges((prev) => {\n const newSet = new Set(prev);\n newSet.delete(diffId);\n return newSet;\n });\n }, []);\n\n const handleRejectChange = useCallback((diffId: string) => {\n setRejectedChanges((prev) => new Set([...prev, diffId]));\n setAcceptedChanges((prev) => {\n const newSet = new Set(prev);\n newSet.delete(diffId);\n return newSet;\n });\n }, []);\n\n const DiffActionsInlineContent = useMemo(\n () => createDiffActionsInlineContentSpec(handleAcceptChange, handleRejectChange),\n [handleAcceptChange, handleRejectChange],\n );\n\n const schema = useMemo(\n () =>\n BlockNoteSchema.create({\n inlineContentSpecs: {\n ...defaultInlineContentSpecs,\n diffActions: DiffActionsInlineContent,\n },\n } as any),\n [DiffActionsInlineContent],\n );\n\n const uploadImage = useCallback(\n async (file: File): Promise<string> => {\n if (!company) {\n errorToast({\n title: t(`generic.errors.upload`),\n error: t(`generic.errors.upload_description`),\n });\n throw new Error(t(`generic.errors.upload`));\n }\n\n const fileType = file.type;\n const key = `companies/${company.id}/${type}/${id}/${file.name}`;\n\n const s3: S3Interface = await S3Service.getPreSignedUrl({\n key: key,\n contentType: fileType,\n isPublic: true,\n });\n\n await fetch(s3.url, {\n method: \"PUT\",\n headers: s3.headers,\n body: file,\n });\n\n const signedImage: S3Interface = await S3Service.getSignedUrl({\n key: key,\n isPublic: true,\n });\n\n return signedImage.url;\n },\n [company, id, t],\n );\n\n // Utility: Remove trailing empty blocks for read-only display\n const removeTrailingEmptyBlocks = useCallback(\n (blocks: PartialBlock[]): PartialBlock[] => {\n if (!blocks || blocks.length === 0) return blocks;\n\n // Only remove trailing empty blocks in read-only mode\n if (onChange !== undefined) return blocks;\n\n const result = [...blocks];\n\n // Remove trailing empty paragraph blocks, but keep at least one block\n while (result.length > 1) {\n const lastBlock = result[result.length - 1];\n\n // Check if it's an empty paragraph\n const isEmptyParagraph =\n lastBlock.type === \"paragraph\" &&\n (!lastBlock.content ||\n lastBlock.content.length === 0 ||\n (Array.isArray(lastBlock.content) && lastBlock.content.every((c: any) => !c.text || c.text.trim() === \"\")));\n\n if (isEmptyParagraph) {\n result.pop();\n } else {\n break;\n }\n }\n\n return result;\n },\n [onChange],\n );\n\n const processedContent = useMemo(() => {\n if (diffContent && initialContent) {\n try {\n const diffResult = BlockNoteDiffUtil.diff(initialContent, diffContent);\n const renderedDiff = BlockNoteWordDiffRendererUtil.renderWordDiffs(\n diffResult.blocks,\n handleAcceptChange,\n handleRejectChange,\n acceptedChanges,\n rejectedChanges,\n );\n return removeTrailingEmptyBlocks(renderedDiff);\n } catch (error) {\n return initialContent && Array.isArray(initialContent) && initialContent.length > 0\n ? removeTrailingEmptyBlocks(initialContent)\n : [];\n }\n }\n\n if (!initialContent) {\n return [];\n }\n\n if (!Array.isArray(initialContent)) {\n return [];\n }\n\n return initialContent.length > 0 ? removeTrailingEmptyBlocks(initialContent) : [];\n }, [\n initialContent,\n diffContent,\n handleAcceptChange,\n handleRejectChange,\n acceptedChanges,\n rejectedChanges,\n removeTrailingEmptyBlocks,\n ]);\n\n const validatedInitialContent = useMemo(() => {\n if (processedContent && Array.isArray(processedContent) && processedContent.length > 0) {\n const validatedContent = processedContent.filter((block) => {\n if (!block || typeof block !== \"object\") return false;\n if (!(block as any).type) return false;\n return true;\n });\n return validatedContent.length > 0 ? (validatedContent as PartialBlock[]) : undefined;\n }\n return undefined;\n }, [processedContent]);\n\n const editor = useCreateBlockNote(\n useMemo(\n () => ({\n placeholders: {\n emptyDocument: placeholder || t(`generic.blocknote.placeholder`),\n },\n schema,\n initialContent: validatedInitialContent,\n uploadFile: uploadImage,\n }),\n [placeholder, t, schema, validatedInitialContent, uploadImage],\n ),\n );\n\n const handleChange = useCallback(async () => {\n if (!onChange) return;\n const newBlocks = editor.document;\n\n const markdownFromBlocks = (await editor.blocksToMarkdownLossy(editor.document)).trim();\n\n function hasUnresolvedDiffsRecursive(block: any): boolean {\n if (!block || typeof block !== \"object\") return false;\n let diffId = undefined;\n if (block.props && block.props.diffId) diffId = block.props.diffId;\n if (!diffId && block.attrs && block.attrs.diffId) diffId = block.attrs.diffId;\n if (diffId && !acceptedChanges.has(diffId) && !rejectedChanges.has(diffId)) {\n return true;\n }\n\n if (block.content) {\n const contentArr = Array.isArray(block.content) ? block.content : [block.content];\n for (const inline of contentArr) {\n if (inline && typeof inline === \"object\") {\n if (inline.type === \"diffActions\" && inline.props && inline.props.diffIds) {\n const ids =\n typeof inline.props.diffIds === \"string\" ? inline.props.diffIds.split(\",\") : inline.props.diffIds;\n for (const id of ids) {\n const trimmed = (id || \"\").toString().trim();\n if (trimmed && !acceptedChanges.has(trimmed) && !rejectedChanges.has(trimmed)) {\n return true;\n }\n }\n }\n if (inline.props && inline.props.diffId) {\n const diffIdInline = inline.props.diffId;\n if (diffIdInline && !acceptedChanges.has(diffIdInline) && !rejectedChanges.has(diffIdInline)) {\n return true;\n }\n }\n if (inline.children && Array.isArray(inline.children)) {\n for (const child of inline.children) {\n if (hasUnresolvedDiffsRecursive(child)) return true;\n }\n }\n }\n }\n }\n if (Array.isArray(block.children)) {\n for (const child of block.children) {\n if (hasUnresolvedDiffsRecursive(child)) return true;\n }\n }\n return false;\n }\n\n let hasUnresolvedDiff = false;\n if (Array.isArray(newBlocks)) {\n hasUnresolvedDiff = newBlocks.some((block: any) => hasUnresolvedDiffsRecursive(block));\n }\n\n onChange(newBlocks, !markdownFromBlocks.length, hasUnresolvedDiff);\n }, [editor, onChange, id, acceptedChanges, rejectedChanges]);\n\n // Utility: deep equality for arrays of blocks\n const areBlocksEqual = (a: any[], b: any[]): boolean => {\n return JSON.stringify(a) === JSON.stringify(b);\n };\n\n // Only initialize from markdownContent once per value, and only if different\n const hasInitializedFromMarkdown = useRef<string | null>(null);\n useEffect(() => {\n const updateContent = async (markdown: string) => {\n const blocks = await editor.tryParseMarkdownToBlocks(markdown);\n if (!areBlocksEqual(blocks, editor.document)) {\n editor.replaceBlocks(editor.document, blocks);\n }\n };\n\n if (markdownContent && hasInitializedFromMarkdown.current !== markdownContent) {\n hasInitializedFromMarkdown.current = markdownContent;\n updateContent(markdownContent).then(() => handleChange());\n }\n }, [markdownContent, editor]);\n\n // Update editor content when diff content changes, but only if different\n // Prevent unnecessary replaceBlocks calls that reset scroll/cursor.\n const previousContentHashRef = useRef<string | null>(null);\n useEffect(() => {\n if (!processedContent || !editor) return;\n const hash = JSON.stringify(processedContent);\n if (previousContentHashRef.current === hash) return; // no changes\n const currentHash = JSON.stringify(editor.document);\n if (currentHash === hash) {\n previousContentHashRef.current = hash;\n return; // already in sync\n }\n editor.replaceBlocks(editor.document, processedContent as PartialBlock[]);\n previousContentHashRef.current = hash;\n }, [processedContent, editor]);\n\n // Handle audio received from whisper transcription\n const handleAudioReceived = useCallback(\n (message: string) => {\n try {\n // Ensure the editor has focus\n const editorElement = editorRef.current?.querySelector('[contenteditable=\"true\"]') as HTMLElement;\n if (editorElement && document.activeElement !== editorElement) {\n editorElement.focus();\n }\n\n // Insert the transcribed text at the current cursor position\n editor.insertInlineContent(message);\n } catch (error) {\n console.error(\"Error inserting transcribed text:\", error);\n // Fallback: try to insert at the end of the document\n try {\n const blocks = editor.document;\n if (blocks.length > 0) {\n const lastBlock = blocks[blocks.length - 1];\n editor.setTextCursorPosition(lastBlock.id, \"end\");\n editor.insertInlineContent(message);\n }\n } catch (fallbackError) {\n console.error(\"Fallback insertion also failed:\", fallbackError);\n }\n }\n },\n [editor],\n );\n\n return (\n <div ref={editorRef} className={cn(bordered ? \"rounded-md border\" : \"\", \"w-full\")}>\n <BlockNoteView\n editor={editor}\n onChange={handleChange}\n editable={onChange !== undefined}\n formattingToolbar={false}\n theme=\"light\"\n className={cn(`BlockNoteView ${onChange ? \"min-h-96 p-4\" : \"\"}`, className, size === \"sm\" && \"small\")}\n >\n <BlockNoteEditorFormattingToolbar />\n </BlockNoteView>\n </div>\n );\n}\n","\"use client\";\n\nimport {\n BasicTextStyleButton,\n BlockTypeSelect,\n CreateLinkButton,\n FileCaptionButton,\n FileReplaceButton,\n FormattingToolbar,\n FormattingToolbarController,\n TextAlignButton,\n} from \"@blocknote/react\";\n\nexport function BlockNoteEditorFormattingToolbar() {\n return (\n <FormattingToolbarController\n formattingToolbar={() => (\n <FormattingToolbar>\n <BlockTypeSelect key={\"blockTypeSelect\"} />\n\n <FileCaptionButton key={\"fileCaptionButton\"} />\n <FileReplaceButton key={\"replaceFileButton\"} />\n\n <BasicTextStyleButton basicTextStyle={\"bold\"} key={\"boldStyleButton\"} />\n <BasicTextStyleButton basicTextStyle={\"italic\"} key={\"italicStyleButton\"} />\n <BasicTextStyleButton basicTextStyle={\"underline\"} key={\"underlineStyleButton\"} />\n <BasicTextStyleButton basicTextStyle={\"strike\"} key={\"strikeStyleButton\"} />\n\n <TextAlignButton textAlignment={\"left\"} key={\"textAlignLeftButton\"} />\n <TextAlignButton textAlignment={\"center\"} key={\"textAlignCenterButton\"} />\n <TextAlignButton textAlignment={\"right\"} key={\"textAlignRightButton\"} />\n\n <CreateLinkButton key={\"createLinkButton\"} />\n </FormattingToolbar>\n )}\n />\n );\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["/home/runner/work/nextjs-jsonapi/nextjs-jsonapi/dist/BlockNoteEditor-YBVEOPV4.js","../src/components/editors/BlockNoteEditor.tsx","../src/components/editors/BlockNoteEditorFormattingToolbar.tsx"],"names":["jsxs","jsx"],"mappings":"AAAA,ylBAAY;AACZ;AACE;AACA;AACA;AACF,sDAA4B;AAC5B,+BAA4B;AAC5B;AACE;AACA;AACA;AACA;AACF,sDAA4B;AAC5B,+BAA4B;AAC5B,+BAA4B;AAC5B,+BAA4B;AAC5B,+BAA4B;AAC5B;AACE;AACF,sDAA4B;AAC5B;AACA;ACnBA,uCAAyE;AACzE,yCAAiE;AACjE,2CAA8B;AAC9B,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A;AACwE,IAAA;AACvC,IAAA;AACN,EAAA;AAGD,EAAA;AACL,IAAA;AACf,MAAA;AAEqD,QAAA;AACP,QAAA;AAC1B,UAAA;AACtB,QAAA;AAGkC,QAAA;AACpB,MAAA;AAC0C,QAAA;AAEpD,QAAA;AACoB,UAAA;AACC,UAAA;AACqB,YAAA;AACM,YAAA;AACd,YAAA;AACpC,UAAA;AACsB,QAAA;AAC2B,UAAA;AACnD,QAAA;AACF,MAAA;AACF,IAAA;AACO,IAAA;AACT,EAAA;AAGqC,EAAA;AAChC,IAAA;AAAA,IAAA;AACC,MAAA;AACU,MAAA;AACa,MAAA;AACJ,MAAA;AACb,MAAA;AACuD,MAAA;AAE5D,MAAA;AAAiC,IAAA;AAEtC,EAAA;AAEJ;AAtUwB;AD6S6C;AACA;AACA","file":"/home/runner/work/nextjs-jsonapi/nextjs-jsonapi/dist/BlockNoteEditor-YBVEOPV4.js","sourcesContent":[null,"\"use client\";\n\nimport { BlockNoteSchema, defaultInlineContentSpecs, PartialBlock } from \"@blocknote/core\";\nimport { createReactInlineContentSpec, useCreateBlockNote } from \"@blocknote/react\";\nimport { BlockNoteView } from \"@blocknote/shadcn\";\nimport \"@blocknote/shadcn/style.css\";\nimport { CheckIcon, XIcon } from \"lucide-react\";\nimport { useTranslations } from \"next-intl\";\nimport React, { useCallback, useEffect, useMemo, useRef, useState } from \"react\";\nimport { useCurrentUserContext } from \"../../contexts\";\nimport { S3Interface } from \"../../features/s3/data\";\nimport { UserInterface } from \"../../features/user/data\";\nimport { S3Service } from \"../../features/s3/data/s3.service\";\nimport { Button } from \"../../shadcnui\";\nimport { BlockNoteDiffUtil, BlockNoteWordDiffRendererUtil, cn } from \"../../utils\";\nimport { errorToast } from \"../errors\";\nimport { BlockNoteEditorFormattingToolbar } from \"./BlockNoteEditorFormattingToolbar\";\n\nexport type BlockNoteEditorProps = {\n id: string;\n type: string;\n initialContent?: PartialBlock[];\n onChange?: (content: any, isEmpty: boolean, hasUnresolvedDiff: boolean) => void;\n size?: \"sm\" | \"md\";\n className?: string;\n markdownContent?: string;\n diffContent?: PartialBlock[];\n placeholder?: string;\n bordered?: boolean;\n};\n\nconst createDiffActionsInlineContentSpec = (\n handleAcceptChange: (diffId: string) => void,\n handleRejectChange: (diffId: string) => void,\n) => {\n return createReactInlineContentSpec(\n {\n type: \"diffActions\",\n propSchema: {\n diffIds: {\n default: \"\",\n },\n },\n content: \"none\",\n },\n {\n render: (props) => {\n const diffIds = props.inlineContent.props.diffIds;\n\n return (\n <span className=\"diff-actions-container mx-2 inline-flex items-center gap-1 align-middle\">\n <Button\n title=\"Accept change\"\n onClick={(e) => {\n e.preventDefault();\n e.stopPropagation();\n diffIds.split(\",\").forEach((id: string) => handleAcceptChange(id.trim()));\n }}\n >\n <CheckIcon className=\"h-3 w-3 text-green-600\" />\n </Button>\n <Button\n title=\"Reject change\"\n className=\"mx-2 p-0\"\n onClick={(e) => {\n e.preventDefault();\n e.stopPropagation();\n diffIds.split(\",\").forEach((id: string) => handleRejectChange(id.trim()));\n }}\n >\n <XIcon className=\"h-3 w-3 text-red-600\" />\n </Button>\n </span>\n );\n },\n },\n );\n};\n\nexport default function BlockNoteEditor({\n id,\n type,\n initialContent,\n onChange,\n size,\n className,\n markdownContent,\n diffContent,\n placeholder,\n bordered,\n}: BlockNoteEditorProps): React.JSX.Element {\n const t = useTranslations();\n const { company } = useCurrentUserContext<UserInterface>();\n\n const [acceptedChanges, setAcceptedChanges] = useState<Set<string>>(new Set());\n const [rejectedChanges, setRejectedChanges] = useState<Set<string>>(new Set());\n\n const editorRef = useRef<HTMLDivElement>(null);\n\n const handleAcceptChange = useCallback((diffId: string) => {\n setAcceptedChanges((prev) => new Set([...prev, diffId]));\n setRejectedChanges((prev) => {\n const newSet = new Set(prev);\n newSet.delete(diffId);\n return newSet;\n });\n }, []);\n\n const handleRejectChange = useCallback((diffId: string) => {\n setRejectedChanges((prev) => new Set([...prev, diffId]));\n setAcceptedChanges((prev) => {\n const newSet = new Set(prev);\n newSet.delete(diffId);\n return newSet;\n });\n }, []);\n\n const DiffActionsInlineContent = useMemo(\n () => createDiffActionsInlineContentSpec(handleAcceptChange, handleRejectChange),\n [handleAcceptChange, handleRejectChange],\n );\n\n const schema = useMemo(\n () =>\n BlockNoteSchema.create({\n inlineContentSpecs: {\n ...defaultInlineContentSpecs,\n diffActions: DiffActionsInlineContent,\n },\n } as any),\n [DiffActionsInlineContent],\n );\n\n const uploadImage = useCallback(\n async (file: File): Promise<string> => {\n if (!company) {\n errorToast({\n title: t(`generic.errors.upload`),\n error: t(`generic.errors.upload_description`),\n });\n throw new Error(t(`generic.errors.upload`));\n }\n\n const fileType = file.type;\n const key = `companies/${company.id}/${type}/${id}/${file.name}`;\n\n const s3: S3Interface = await S3Service.getPreSignedUrl({\n key: key,\n contentType: fileType,\n isPublic: true,\n });\n\n await fetch(s3.url, {\n method: \"PUT\",\n headers: s3.headers,\n body: file,\n });\n\n const signedImage: S3Interface = await S3Service.getSignedUrl({\n key: key,\n isPublic: true,\n });\n\n return signedImage.url;\n },\n [company, id, t],\n );\n\n // Utility: Remove trailing empty blocks for read-only display\n const removeTrailingEmptyBlocks = useCallback(\n (blocks: PartialBlock[]): PartialBlock[] => {\n if (!blocks || blocks.length === 0) return blocks;\n\n // Only remove trailing empty blocks in read-only mode\n if (onChange !== undefined) return blocks;\n\n const result = [...blocks];\n\n // Remove trailing empty paragraph blocks, but keep at least one block\n while (result.length > 1) {\n const lastBlock = result[result.length - 1];\n\n // Check if it's an empty paragraph\n const isEmptyParagraph =\n lastBlock.type === \"paragraph\" &&\n (!lastBlock.content ||\n lastBlock.content.length === 0 ||\n (Array.isArray(lastBlock.content) && lastBlock.content.every((c: any) => !c.text || c.text.trim() === \"\")));\n\n if (isEmptyParagraph) {\n result.pop();\n } else {\n break;\n }\n }\n\n return result;\n },\n [onChange],\n );\n\n const processedContent = useMemo(() => {\n if (diffContent && initialContent) {\n try {\n const diffResult = BlockNoteDiffUtil.diff(initialContent, diffContent);\n const renderedDiff = BlockNoteWordDiffRendererUtil.renderWordDiffs(\n diffResult.blocks,\n handleAcceptChange,\n handleRejectChange,\n acceptedChanges,\n rejectedChanges,\n );\n return removeTrailingEmptyBlocks(renderedDiff);\n } catch (error) {\n return initialContent && Array.isArray(initialContent) && initialContent.length > 0\n ? removeTrailingEmptyBlocks(initialContent)\n : [];\n }\n }\n\n if (!initialContent) {\n return [];\n }\n\n if (!Array.isArray(initialContent)) {\n return [];\n }\n\n return initialContent.length > 0 ? removeTrailingEmptyBlocks(initialContent) : [];\n }, [\n initialContent,\n diffContent,\n handleAcceptChange,\n handleRejectChange,\n acceptedChanges,\n rejectedChanges,\n removeTrailingEmptyBlocks,\n ]);\n\n const validatedInitialContent = useMemo(() => {\n if (processedContent && Array.isArray(processedContent) && processedContent.length > 0) {\n const validatedContent = processedContent.filter((block) => {\n if (!block || typeof block !== \"object\") return false;\n if (!(block as any).type) return false;\n return true;\n });\n return validatedContent.length > 0 ? (validatedContent as PartialBlock[]) : undefined;\n }\n return undefined;\n }, [processedContent]);\n\n const editor = useCreateBlockNote(\n useMemo(\n () => ({\n placeholders: {\n emptyDocument: placeholder || t(`generic.blocknote.placeholder`),\n },\n schema,\n initialContent: validatedInitialContent,\n uploadFile: uploadImage,\n }),\n [placeholder, t, schema, validatedInitialContent, uploadImage],\n ),\n );\n\n const handleChange = useCallback(async () => {\n if (!onChange) return;\n const newBlocks = editor.document;\n\n const markdownFromBlocks = (await editor.blocksToMarkdownLossy(editor.document)).trim();\n\n function hasUnresolvedDiffsRecursive(block: any): boolean {\n if (!block || typeof block !== \"object\") return false;\n let diffId = undefined;\n if (block.props && block.props.diffId) diffId = block.props.diffId;\n if (!diffId && block.attrs && block.attrs.diffId) diffId = block.attrs.diffId;\n if (diffId && !acceptedChanges.has(diffId) && !rejectedChanges.has(diffId)) {\n return true;\n }\n\n if (block.content) {\n const contentArr = Array.isArray(block.content) ? block.content : [block.content];\n for (const inline of contentArr) {\n if (inline && typeof inline === \"object\") {\n if (inline.type === \"diffActions\" && inline.props && inline.props.diffIds) {\n const ids =\n typeof inline.props.diffIds === \"string\" ? inline.props.diffIds.split(\",\") : inline.props.diffIds;\n for (const id of ids) {\n const trimmed = (id || \"\").toString().trim();\n if (trimmed && !acceptedChanges.has(trimmed) && !rejectedChanges.has(trimmed)) {\n return true;\n }\n }\n }\n if (inline.props && inline.props.diffId) {\n const diffIdInline = inline.props.diffId;\n if (diffIdInline && !acceptedChanges.has(diffIdInline) && !rejectedChanges.has(diffIdInline)) {\n return true;\n }\n }\n if (inline.children && Array.isArray(inline.children)) {\n for (const child of inline.children) {\n if (hasUnresolvedDiffsRecursive(child)) return true;\n }\n }\n }\n }\n }\n if (Array.isArray(block.children)) {\n for (const child of block.children) {\n if (hasUnresolvedDiffsRecursive(child)) return true;\n }\n }\n return false;\n }\n\n let hasUnresolvedDiff = false;\n if (Array.isArray(newBlocks)) {\n hasUnresolvedDiff = newBlocks.some((block: any) => hasUnresolvedDiffsRecursive(block));\n }\n\n onChange(newBlocks, !markdownFromBlocks.length, hasUnresolvedDiff);\n }, [editor, onChange, id, acceptedChanges, rejectedChanges]);\n\n // Utility: deep equality for arrays of blocks\n const areBlocksEqual = (a: any[], b: any[]): boolean => {\n return JSON.stringify(a) === JSON.stringify(b);\n };\n\n // Only initialize from markdownContent once per value, and only if different\n const hasInitializedFromMarkdown = useRef<string | null>(null);\n useEffect(() => {\n const updateContent = async (markdown: string) => {\n const blocks = await editor.tryParseMarkdownToBlocks(markdown);\n if (!areBlocksEqual(blocks, editor.document)) {\n editor.replaceBlocks(editor.document, blocks);\n }\n };\n\n if (markdownContent && hasInitializedFromMarkdown.current !== markdownContent) {\n hasInitializedFromMarkdown.current = markdownContent;\n updateContent(markdownContent).then(() => handleChange());\n }\n }, [markdownContent, editor]);\n\n // Update editor content when diff content changes, but only if different\n // Prevent unnecessary replaceBlocks calls that reset scroll/cursor.\n const previousContentHashRef = useRef<string | null>(null);\n useEffect(() => {\n if (!processedContent || !editor) return;\n const hash = JSON.stringify(processedContent);\n if (previousContentHashRef.current === hash) return; // no changes\n const currentHash = JSON.stringify(editor.document);\n if (currentHash === hash) {\n previousContentHashRef.current = hash;\n return; // already in sync\n }\n editor.replaceBlocks(editor.document, processedContent as PartialBlock[]);\n previousContentHashRef.current = hash;\n }, [processedContent, editor]);\n\n // Handle audio received from whisper transcription\n const handleAudioReceived = useCallback(\n (message: string) => {\n try {\n // Ensure the editor has focus\n const editorElement = editorRef.current?.querySelector('[contenteditable=\"true\"]') as HTMLElement;\n if (editorElement && document.activeElement !== editorElement) {\n editorElement.focus();\n }\n\n // Insert the transcribed text at the current cursor position\n editor.insertInlineContent(message);\n } catch (error) {\n console.error(\"Error inserting transcribed text:\", error);\n // Fallback: try to insert at the end of the document\n try {\n const blocks = editor.document;\n if (blocks.length > 0) {\n const lastBlock = blocks[blocks.length - 1];\n editor.setTextCursorPosition(lastBlock.id, \"end\");\n editor.insertInlineContent(message);\n }\n } catch (fallbackError) {\n console.error(\"Fallback insertion also failed:\", fallbackError);\n }\n }\n },\n [editor],\n );\n\n return (\n <div ref={editorRef} className={cn(bordered ? \"rounded-md border\" : \"\", \"w-full\")}>\n <BlockNoteView\n editor={editor}\n onChange={handleChange}\n editable={onChange !== undefined}\n formattingToolbar={false}\n theme=\"light\"\n className={cn(`BlockNoteView ${onChange ? \"min-h-96 p-4\" : \"\"}`, className, size === \"sm\" && \"small\")}\n >\n <BlockNoteEditorFormattingToolbar />\n </BlockNoteView>\n </div>\n );\n}\n","\"use client\";\n\nimport {\n BasicTextStyleButton,\n BlockTypeSelect,\n CreateLinkButton,\n FileCaptionButton,\n FileReplaceButton,\n FormattingToolbar,\n FormattingToolbarController,\n TextAlignButton,\n} from \"@blocknote/react\";\n\nexport function BlockNoteEditorFormattingToolbar() {\n return (\n <FormattingToolbarController\n formattingToolbar={() => (\n <FormattingToolbar>\n <BlockTypeSelect key={\"blockTypeSelect\"} />\n\n <FileCaptionButton key={\"fileCaptionButton\"} />\n <FileReplaceButton key={\"replaceFileButton\"} />\n\n <BasicTextStyleButton basicTextStyle={\"bold\"} key={\"boldStyleButton\"} />\n <BasicTextStyleButton basicTextStyle={\"italic\"} key={\"italicStyleButton\"} />\n <BasicTextStyleButton basicTextStyle={\"underline\"} key={\"underlineStyleButton\"} />\n <BasicTextStyleButton basicTextStyle={\"strike\"} key={\"strikeStyleButton\"} />\n\n <TextAlignButton textAlignment={\"left\"} key={\"textAlignLeftButton\"} />\n <TextAlignButton textAlignment={\"center\"} key={\"textAlignCenterButton\"} />\n <TextAlignButton textAlignment={\"right\"} key={\"textAlignRightButton\"} />\n\n <CreateLinkButton key={\"createLinkButton\"} />\n </FormattingToolbar>\n )}\n />\n );\n}\n"]}
|
|
@@ -3,14 +3,14 @@ import {
|
|
|
3
3
|
Button,
|
|
4
4
|
errorToast,
|
|
5
5
|
useCurrentUserContext
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-UCD5CUE4.mjs";
|
|
7
7
|
import "./chunk-GR4QPP36.mjs";
|
|
8
8
|
import {
|
|
9
9
|
BlockNoteDiffUtil,
|
|
10
10
|
BlockNoteWordDiffRendererUtil,
|
|
11
11
|
S3Service,
|
|
12
12
|
cn
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-DU64WMZD.mjs";
|
|
14
14
|
import "./chunk-AUXK7QSA.mjs";
|
|
15
15
|
import "./chunk-C7C7VY4F.mjs";
|
|
16
16
|
import "./chunk-U4MTVHOC.mjs";
|
|
@@ -381,4 +381,4 @@ __name(BlockNoteEditor, "BlockNoteEditor");
|
|
|
381
381
|
export {
|
|
382
382
|
BlockNoteEditor as default
|
|
383
383
|
};
|
|
384
|
-
//# sourceMappingURL=BlockNoteEditor-
|
|
384
|
+
//# sourceMappingURL=BlockNoteEditor-ZM4YPXHO.mjs.map
|
package/dist/billing/index.d.mts
CHANGED
|
@@ -103,6 +103,13 @@ type PaymentMethodEditorProps = {
|
|
|
103
103
|
};
|
|
104
104
|
declare function PaymentMethodEditor({ open, onOpenChange, onSuccess }: PaymentMethodEditorProps): react_jsx_runtime.JSX.Element;
|
|
105
105
|
|
|
106
|
+
type PaymentMethodFormProps = {
|
|
107
|
+
onSuccess: () => void;
|
|
108
|
+
onCancel: () => void;
|
|
109
|
+
isLoading?: boolean;
|
|
110
|
+
};
|
|
111
|
+
declare function PaymentMethodForm({ onSuccess, onCancel, isLoading }: PaymentMethodFormProps): react_jsx_runtime.JSX.Element;
|
|
112
|
+
|
|
106
113
|
type PaymentMethodsListProps = {
|
|
107
114
|
paymentMethods: PaymentMethodInterface[];
|
|
108
115
|
onUpdate: () => void;
|
|
@@ -161,15 +168,19 @@ type ProductsListProps = {
|
|
|
161
168
|
};
|
|
162
169
|
declare function ProductsList({ products, onProductsChange }: ProductsListProps): react_jsx_runtime.JSX.Element;
|
|
163
170
|
|
|
164
|
-
|
|
171
|
+
type SubscriptionsContainerProps = {
|
|
172
|
+
onOpenWizard?: (subscription?: StripeSubscriptionInterface) => void;
|
|
173
|
+
};
|
|
174
|
+
declare function SubscriptionsContainer({ onOpenWizard }: SubscriptionsContainerProps): react_jsx_runtime.JSX.Element;
|
|
165
175
|
|
|
166
176
|
type SubscriptionDetailsProps = {
|
|
167
177
|
subscription: StripeSubscriptionInterface;
|
|
168
178
|
open: boolean;
|
|
169
179
|
onOpenChange: (open: boolean) => void;
|
|
170
180
|
onSubscriptionChange: () => void;
|
|
181
|
+
onChangePlan?: (subscription: StripeSubscriptionInterface) => void;
|
|
171
182
|
};
|
|
172
|
-
declare function SubscriptionDetails({ subscription, open, onOpenChange, onSubscriptionChange, }: SubscriptionDetailsProps): react_jsx_runtime.JSX.Element;
|
|
183
|
+
declare function SubscriptionDetails({ subscription, open, onOpenChange, onSubscriptionChange, onChangePlan, }: SubscriptionDetailsProps): react_jsx_runtime.JSX.Element;
|
|
173
184
|
|
|
174
185
|
type CancelSubscriptionDialogProps = {
|
|
175
186
|
subscription: StripeSubscriptionInterface;
|
|
@@ -179,20 +190,21 @@ type CancelSubscriptionDialogProps = {
|
|
|
179
190
|
};
|
|
180
191
|
declare function CancelSubscriptionDialog({ subscription, open, onOpenChange, onSuccess, }: CancelSubscriptionDialogProps): react_jsx_runtime.JSX.Element;
|
|
181
192
|
|
|
182
|
-
type SubscriptionEditorProps = {
|
|
183
|
-
subscription?: StripeSubscriptionInterface;
|
|
184
|
-
open: boolean;
|
|
185
|
-
onOpenChange: (open: boolean) => void;
|
|
186
|
-
onSuccess: () => void;
|
|
187
|
-
onAddPaymentMethod?: () => void;
|
|
188
|
-
};
|
|
189
|
-
declare function SubscriptionEditor({ subscription, open, onOpenChange, onSuccess, onAddPaymentMethod, }: SubscriptionEditorProps): react_jsx_runtime.JSX.Element;
|
|
190
|
-
|
|
191
193
|
type SubscriptionsListProps = {
|
|
192
194
|
subscriptions: StripeSubscriptionInterface[];
|
|
193
195
|
onSubscriptionsChange: () => void;
|
|
196
|
+
onChangePlan?: (subscription: StripeSubscriptionInterface) => void;
|
|
194
197
|
};
|
|
195
|
-
declare function SubscriptionsList({ subscriptions, onSubscriptionsChange }: SubscriptionsListProps): react_jsx_runtime.JSX.Element;
|
|
198
|
+
declare function SubscriptionsList({ subscriptions, onSubscriptionsChange, onChangePlan }: SubscriptionsListProps): react_jsx_runtime.JSX.Element;
|
|
199
|
+
|
|
200
|
+
type BillingInterval = "month" | "year";
|
|
201
|
+
type IntervalToggleProps = {
|
|
202
|
+
value: BillingInterval;
|
|
203
|
+
onChange: (interval: BillingInterval) => void;
|
|
204
|
+
hasMonthly: boolean;
|
|
205
|
+
hasYearly: boolean;
|
|
206
|
+
};
|
|
207
|
+
declare function IntervalToggle({ value, onChange, hasMonthly, hasYearly }: IntervalToggleProps): react_jsx_runtime.JSX.Element | null;
|
|
196
208
|
|
|
197
209
|
type PricingCardProps = {
|
|
198
210
|
price: StripePriceInterface;
|
|
@@ -204,17 +216,27 @@ type PricingCardProps = {
|
|
|
204
216
|
};
|
|
205
217
|
declare function PricingCard({ price, isCurrentPlan, isSelected, isDisabled, isLoading, onSelect }: PricingCardProps): react_jsx_runtime.JSX.Element;
|
|
206
218
|
|
|
207
|
-
type
|
|
208
|
-
type PricingCardsGridProps = {
|
|
219
|
+
type ProductPricingListProps = {
|
|
209
220
|
products: StripeProductInterface[];
|
|
210
|
-
|
|
221
|
+
selectedInterval: BillingInterval;
|
|
211
222
|
currentPriceId?: string;
|
|
212
223
|
selectedPriceId?: string;
|
|
213
224
|
loadingPriceId?: string;
|
|
214
225
|
loading?: boolean;
|
|
215
226
|
onSelectPrice: (price: StripePriceInterface) => void;
|
|
227
|
+
hideRecurringPrices?: boolean;
|
|
228
|
+
};
|
|
229
|
+
declare function ProductPricingList({ products, selectedInterval, currentPriceId, selectedPriceId, loadingPriceId, loading, onSelectPrice, hideRecurringPrices, }: ProductPricingListProps): react_jsx_runtime.JSX.Element;
|
|
230
|
+
|
|
231
|
+
type ProductPricingRowProps = {
|
|
232
|
+
product: StripeProductInterface;
|
|
233
|
+
prices: StripePriceInterface[];
|
|
234
|
+
currentPriceId?: string;
|
|
235
|
+
selectedPriceId?: string;
|
|
236
|
+
loadingPriceId?: string;
|
|
237
|
+
onSelectPrice: (price: StripePriceInterface) => void;
|
|
216
238
|
};
|
|
217
|
-
declare function
|
|
239
|
+
declare function ProductPricingRow({ product, prices, currentPriceId, selectedPriceId, loadingPriceId, onSelectPrice, }: ProductPricingRowProps): react_jsx_runtime.JSX.Element | null;
|
|
218
240
|
|
|
219
241
|
type ProrationPreviewProps = {
|
|
220
242
|
preview: ProrationPreviewInterface;
|
|
@@ -227,6 +249,14 @@ type SubscriptionStatusBadgeProps = {
|
|
|
227
249
|
};
|
|
228
250
|
declare function SubscriptionStatusBadge({ status, cancelAtPeriodEnd }: SubscriptionStatusBadgeProps): react_jsx_runtime.JSX.Element;
|
|
229
251
|
|
|
252
|
+
type SubscriptionConfirmationProps = {
|
|
253
|
+
price: StripePriceInterface;
|
|
254
|
+
isLoading: boolean;
|
|
255
|
+
onConfirm: () => void;
|
|
256
|
+
onCancel: () => void;
|
|
257
|
+
};
|
|
258
|
+
declare function SubscriptionConfirmation({ price, isLoading, onConfirm, onCancel }: SubscriptionConfirmationProps): react_jsx_runtime.JSX.Element;
|
|
259
|
+
|
|
230
260
|
declare function UsageContainer(): react_jsx_runtime.JSX.Element | null;
|
|
231
261
|
|
|
232
262
|
type UsageSummaryCardProps = {
|
|
@@ -246,4 +276,4 @@ type UsageSummaryCardsProps = {
|
|
|
246
276
|
};
|
|
247
277
|
declare function UsageSummaryCards({ meters, summaries }: UsageSummaryCardsProps): react_jsx_runtime.JSX.Element;
|
|
248
278
|
|
|
249
|
-
export { BillingAlertBanner, BillingDashboardContainer, BillingDetailModal, BillingUsageSummaryCard, CancelSubscriptionDialog, CustomerInfoCard, InvoiceDetails, InvoiceStatusBadge, InvoicesContainer, InvoicesList, InvoicesSummaryCard, PaymentMethodCard, PaymentMethodEditor, PaymentMethodSummaryCard, PaymentMethodsContainer, PaymentMethodsList, PriceEditor,
|
|
279
|
+
export { BillingAlertBanner, BillingDashboardContainer, BillingDetailModal, type BillingInterval, BillingUsageSummaryCard, CancelSubscriptionDialog, CustomerInfoCard, IntervalToggle, type IntervalToggleProps, InvoiceDetails, InvoiceStatusBadge, InvoicesContainer, InvoicesList, InvoicesSummaryCard, PaymentMethodCard, PaymentMethodEditor, PaymentMethodForm, PaymentMethodSummaryCard, PaymentMethodsContainer, PaymentMethodsList, PriceEditor, PricesList, PricingCard, type PricingCardProps, ProductEditor, ProductPricingList, type ProductPricingListProps, ProductPricingRow, type ProductPricingRowProps, ProductsAdminContainer, ProductsList, ProrationPreview, StripeProvider, SubscriptionConfirmation, SubscriptionDetails, SubscriptionStatusBadge, SubscriptionSummaryCard, SubscriptionsContainer, SubscriptionsList, UsageContainer, UsageHistoryTable, UsageSummaryCard, UsageSummaryCards, formatCurrency, formatDate, formatInterval, isStripeConfigured };
|
package/dist/billing/index.d.ts
CHANGED
|
@@ -103,6 +103,13 @@ type PaymentMethodEditorProps = {
|
|
|
103
103
|
};
|
|
104
104
|
declare function PaymentMethodEditor({ open, onOpenChange, onSuccess }: PaymentMethodEditorProps): react_jsx_runtime.JSX.Element;
|
|
105
105
|
|
|
106
|
+
type PaymentMethodFormProps = {
|
|
107
|
+
onSuccess: () => void;
|
|
108
|
+
onCancel: () => void;
|
|
109
|
+
isLoading?: boolean;
|
|
110
|
+
};
|
|
111
|
+
declare function PaymentMethodForm({ onSuccess, onCancel, isLoading }: PaymentMethodFormProps): react_jsx_runtime.JSX.Element;
|
|
112
|
+
|
|
106
113
|
type PaymentMethodsListProps = {
|
|
107
114
|
paymentMethods: PaymentMethodInterface[];
|
|
108
115
|
onUpdate: () => void;
|
|
@@ -161,15 +168,19 @@ type ProductsListProps = {
|
|
|
161
168
|
};
|
|
162
169
|
declare function ProductsList({ products, onProductsChange }: ProductsListProps): react_jsx_runtime.JSX.Element;
|
|
163
170
|
|
|
164
|
-
|
|
171
|
+
type SubscriptionsContainerProps = {
|
|
172
|
+
onOpenWizard?: (subscription?: StripeSubscriptionInterface) => void;
|
|
173
|
+
};
|
|
174
|
+
declare function SubscriptionsContainer({ onOpenWizard }: SubscriptionsContainerProps): react_jsx_runtime.JSX.Element;
|
|
165
175
|
|
|
166
176
|
type SubscriptionDetailsProps = {
|
|
167
177
|
subscription: StripeSubscriptionInterface;
|
|
168
178
|
open: boolean;
|
|
169
179
|
onOpenChange: (open: boolean) => void;
|
|
170
180
|
onSubscriptionChange: () => void;
|
|
181
|
+
onChangePlan?: (subscription: StripeSubscriptionInterface) => void;
|
|
171
182
|
};
|
|
172
|
-
declare function SubscriptionDetails({ subscription, open, onOpenChange, onSubscriptionChange, }: SubscriptionDetailsProps): react_jsx_runtime.JSX.Element;
|
|
183
|
+
declare function SubscriptionDetails({ subscription, open, onOpenChange, onSubscriptionChange, onChangePlan, }: SubscriptionDetailsProps): react_jsx_runtime.JSX.Element;
|
|
173
184
|
|
|
174
185
|
type CancelSubscriptionDialogProps = {
|
|
175
186
|
subscription: StripeSubscriptionInterface;
|
|
@@ -179,20 +190,21 @@ type CancelSubscriptionDialogProps = {
|
|
|
179
190
|
};
|
|
180
191
|
declare function CancelSubscriptionDialog({ subscription, open, onOpenChange, onSuccess, }: CancelSubscriptionDialogProps): react_jsx_runtime.JSX.Element;
|
|
181
192
|
|
|
182
|
-
type SubscriptionEditorProps = {
|
|
183
|
-
subscription?: StripeSubscriptionInterface;
|
|
184
|
-
open: boolean;
|
|
185
|
-
onOpenChange: (open: boolean) => void;
|
|
186
|
-
onSuccess: () => void;
|
|
187
|
-
onAddPaymentMethod?: () => void;
|
|
188
|
-
};
|
|
189
|
-
declare function SubscriptionEditor({ subscription, open, onOpenChange, onSuccess, onAddPaymentMethod, }: SubscriptionEditorProps): react_jsx_runtime.JSX.Element;
|
|
190
|
-
|
|
191
193
|
type SubscriptionsListProps = {
|
|
192
194
|
subscriptions: StripeSubscriptionInterface[];
|
|
193
195
|
onSubscriptionsChange: () => void;
|
|
196
|
+
onChangePlan?: (subscription: StripeSubscriptionInterface) => void;
|
|
194
197
|
};
|
|
195
|
-
declare function SubscriptionsList({ subscriptions, onSubscriptionsChange }: SubscriptionsListProps): react_jsx_runtime.JSX.Element;
|
|
198
|
+
declare function SubscriptionsList({ subscriptions, onSubscriptionsChange, onChangePlan }: SubscriptionsListProps): react_jsx_runtime.JSX.Element;
|
|
199
|
+
|
|
200
|
+
type BillingInterval = "month" | "year";
|
|
201
|
+
type IntervalToggleProps = {
|
|
202
|
+
value: BillingInterval;
|
|
203
|
+
onChange: (interval: BillingInterval) => void;
|
|
204
|
+
hasMonthly: boolean;
|
|
205
|
+
hasYearly: boolean;
|
|
206
|
+
};
|
|
207
|
+
declare function IntervalToggle({ value, onChange, hasMonthly, hasYearly }: IntervalToggleProps): react_jsx_runtime.JSX.Element | null;
|
|
196
208
|
|
|
197
209
|
type PricingCardProps = {
|
|
198
210
|
price: StripePriceInterface;
|
|
@@ -204,17 +216,27 @@ type PricingCardProps = {
|
|
|
204
216
|
};
|
|
205
217
|
declare function PricingCard({ price, isCurrentPlan, isSelected, isDisabled, isLoading, onSelect }: PricingCardProps): react_jsx_runtime.JSX.Element;
|
|
206
218
|
|
|
207
|
-
type
|
|
208
|
-
type PricingCardsGridProps = {
|
|
219
|
+
type ProductPricingListProps = {
|
|
209
220
|
products: StripeProductInterface[];
|
|
210
|
-
|
|
221
|
+
selectedInterval: BillingInterval;
|
|
211
222
|
currentPriceId?: string;
|
|
212
223
|
selectedPriceId?: string;
|
|
213
224
|
loadingPriceId?: string;
|
|
214
225
|
loading?: boolean;
|
|
215
226
|
onSelectPrice: (price: StripePriceInterface) => void;
|
|
227
|
+
hideRecurringPrices?: boolean;
|
|
228
|
+
};
|
|
229
|
+
declare function ProductPricingList({ products, selectedInterval, currentPriceId, selectedPriceId, loadingPriceId, loading, onSelectPrice, hideRecurringPrices, }: ProductPricingListProps): react_jsx_runtime.JSX.Element;
|
|
230
|
+
|
|
231
|
+
type ProductPricingRowProps = {
|
|
232
|
+
product: StripeProductInterface;
|
|
233
|
+
prices: StripePriceInterface[];
|
|
234
|
+
currentPriceId?: string;
|
|
235
|
+
selectedPriceId?: string;
|
|
236
|
+
loadingPriceId?: string;
|
|
237
|
+
onSelectPrice: (price: StripePriceInterface) => void;
|
|
216
238
|
};
|
|
217
|
-
declare function
|
|
239
|
+
declare function ProductPricingRow({ product, prices, currentPriceId, selectedPriceId, loadingPriceId, onSelectPrice, }: ProductPricingRowProps): react_jsx_runtime.JSX.Element | null;
|
|
218
240
|
|
|
219
241
|
type ProrationPreviewProps = {
|
|
220
242
|
preview: ProrationPreviewInterface;
|
|
@@ -227,6 +249,14 @@ type SubscriptionStatusBadgeProps = {
|
|
|
227
249
|
};
|
|
228
250
|
declare function SubscriptionStatusBadge({ status, cancelAtPeriodEnd }: SubscriptionStatusBadgeProps): react_jsx_runtime.JSX.Element;
|
|
229
251
|
|
|
252
|
+
type SubscriptionConfirmationProps = {
|
|
253
|
+
price: StripePriceInterface;
|
|
254
|
+
isLoading: boolean;
|
|
255
|
+
onConfirm: () => void;
|
|
256
|
+
onCancel: () => void;
|
|
257
|
+
};
|
|
258
|
+
declare function SubscriptionConfirmation({ price, isLoading, onConfirm, onCancel }: SubscriptionConfirmationProps): react_jsx_runtime.JSX.Element;
|
|
259
|
+
|
|
230
260
|
declare function UsageContainer(): react_jsx_runtime.JSX.Element | null;
|
|
231
261
|
|
|
232
262
|
type UsageSummaryCardProps = {
|
|
@@ -246,4 +276,4 @@ type UsageSummaryCardsProps = {
|
|
|
246
276
|
};
|
|
247
277
|
declare function UsageSummaryCards({ meters, summaries }: UsageSummaryCardsProps): react_jsx_runtime.JSX.Element;
|
|
248
278
|
|
|
249
|
-
export { BillingAlertBanner, BillingDashboardContainer, BillingDetailModal, BillingUsageSummaryCard, CancelSubscriptionDialog, CustomerInfoCard, InvoiceDetails, InvoiceStatusBadge, InvoicesContainer, InvoicesList, InvoicesSummaryCard, PaymentMethodCard, PaymentMethodEditor, PaymentMethodSummaryCard, PaymentMethodsContainer, PaymentMethodsList, PriceEditor,
|
|
279
|
+
export { BillingAlertBanner, BillingDashboardContainer, BillingDetailModal, type BillingInterval, BillingUsageSummaryCard, CancelSubscriptionDialog, CustomerInfoCard, IntervalToggle, type IntervalToggleProps, InvoiceDetails, InvoiceStatusBadge, InvoicesContainer, InvoicesList, InvoicesSummaryCard, PaymentMethodCard, PaymentMethodEditor, PaymentMethodForm, PaymentMethodSummaryCard, PaymentMethodsContainer, PaymentMethodsList, PriceEditor, PricesList, PricingCard, type PricingCardProps, ProductEditor, ProductPricingList, type ProductPricingListProps, ProductPricingRow, type ProductPricingRowProps, ProductsAdminContainer, ProductsList, ProrationPreview, StripeProvider, SubscriptionConfirmation, SubscriptionDetails, SubscriptionStatusBadge, SubscriptionSummaryCard, SubscriptionsContainer, SubscriptionsList, UsageContainer, UsageHistoryTable, UsageSummaryCard, UsageSummaryCards, formatCurrency, formatDate, formatInterval, isStripeConfigured };
|