@arbidocs/blocks 0.5.139 → 0.5.141
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/{ConnectedCallDock-L27WYW4Y.cjs → ConnectedCallDock-ZNS5BS2R.cjs} +20 -20
- package/dist/{ConnectedCallDock-L27WYW4Y.cjs.map → ConnectedCallDock-ZNS5BS2R.cjs.map} +1 -1
- package/dist/{ConnectedCallRoom-ZXSS6CVG.cjs → ConnectedCallRoom-ACNVSFH7.cjs} +13 -13
- package/dist/{ConnectedCallRoom-ZXSS6CVG.cjs.map → ConnectedCallRoom-ACNVSFH7.cjs.map} +1 -1
- package/dist/{ConnectedNativeDocxComparison-X2O5OIYZ.cjs → ConnectedNativeDocxComparison-QKY66ZJ7.cjs} +18 -18
- package/dist/{ConnectedNativeDocxComparison-X2O5OIYZ.cjs.map → ConnectedNativeDocxComparison-QKY66ZJ7.cjs.map} +1 -1
- package/dist/{ConnectedPresentation-XVCFF25X.cjs → ConnectedPresentation-3JXN6SRT.cjs} +17 -17
- package/dist/{ConnectedPresentation-XVCFF25X.cjs.map → ConnectedPresentation-3JXN6SRT.cjs.map} +1 -1
- package/dist/{ConnectedSlidesTab-UG2NUFPS.cjs → ConnectedSlidesTab-IECS2MJI.cjs} +15 -15
- package/dist/{ConnectedSlidesTab-UG2NUFPS.cjs.map → ConnectedSlidesTab-IECS2MJI.cjs.map} +1 -1
- package/dist/{ConnectedStreamedWordArtifact-BI6WFIAW.cjs → ConnectedStreamedWordArtifact-PHEOVHKH.cjs} +18 -18
- package/dist/{ConnectedStreamedWordArtifact-BI6WFIAW.cjs.map → ConnectedStreamedWordArtifact-PHEOVHKH.cjs.map} +1 -1
- package/dist/{DocumentReviewCard-NZCGQ7SH.cjs → DocumentReviewCard-ENCPTGJE.cjs} +16 -16
- package/dist/{DocumentReviewCard-NZCGQ7SH.cjs.map → DocumentReviewCard-ENCPTGJE.cjs.map} +1 -1
- package/dist/{FilesViewerDialog-NKDVTI6H.cjs → FilesViewerDialog-OFUBS5VA.cjs} +42 -42
- package/dist/{FilesViewerDialog-NKDVTI6H.cjs.map → FilesViewerDialog-OFUBS5VA.cjs.map} +1 -1
- package/dist/{NativeDocxEditor-KM6U4ZLA.cjs → NativeDocxEditor-7A3SYDAJ.cjs} +6 -6
- package/dist/{NativeDocxEditor-KM6U4ZLA.cjs.map → NativeDocxEditor-7A3SYDAJ.cjs.map} +1 -1
- package/dist/{WorkspaceTableView-B5FAVVVA.cjs → WorkspaceTableView-A2YTG4OQ.cjs} +9 -9
- package/dist/{WorkspaceTableView-B5FAVVVA.cjs.map → WorkspaceTableView-A2YTG4OQ.cjs.map} +1 -1
- package/dist/agents/index.cjs +296 -296
- package/dist/{ai-XVDR2XYV.cjs → ai-QEXZ4SYR.cjs} +25 -25
- package/dist/ai-QEXZ4SYR.cjs.map +1 -0
- package/dist/calls/index.cjs +120 -120
- package/dist/{chunk-SHGUTM42.cjs → chunk-2EY52GDM.cjs} +11 -11
- package/dist/{chunk-SHGUTM42.cjs.map → chunk-2EY52GDM.cjs.map} +1 -1
- package/dist/{chunk-FYNNNQ6H.cjs → chunk-33GOYI3O.cjs} +4 -4
- package/dist/{chunk-FYNNNQ6H.cjs.map → chunk-33GOYI3O.cjs.map} +1 -1
- package/dist/{chunk-RJE6KXJQ.cjs → chunk-6CGMSJLB.cjs} +3 -3
- package/dist/{chunk-RJE6KXJQ.cjs.map → chunk-6CGMSJLB.cjs.map} +1 -1
- package/dist/{chunk-C6DF6WB2.cjs → chunk-6JLRF7N6.cjs} +4 -3
- package/dist/chunk-6JLRF7N6.cjs.map +1 -0
- package/dist/{chunk-L62EU3TQ.cjs → chunk-A53YMUOX.cjs} +3 -3
- package/dist/{chunk-L62EU3TQ.cjs.map → chunk-A53YMUOX.cjs.map} +1 -1
- package/dist/{chunk-N5UI363Q.cjs → chunk-ECSOXKJQ.cjs} +3 -3
- package/dist/{chunk-N5UI363Q.cjs.map → chunk-ECSOXKJQ.cjs.map} +1 -1
- package/dist/{chunk-Q77OKXYM.cjs → chunk-EYXU32D7.cjs} +6 -6
- package/dist/{chunk-Q77OKXYM.cjs.map → chunk-EYXU32D7.cjs.map} +1 -1
- package/dist/{chunk-REP5GA2Z.cjs → chunk-FRRF2OQ7.cjs} +11 -11
- package/dist/{chunk-REP5GA2Z.cjs.map → chunk-FRRF2OQ7.cjs.map} +1 -1
- package/dist/{chunk-3Y75LUCT.cjs → chunk-HZG4GRDA.cjs} +3 -3
- package/dist/{chunk-3Y75LUCT.cjs.map → chunk-HZG4GRDA.cjs.map} +1 -1
- package/dist/{chunk-EY23TOPI.cjs → chunk-IFJBE7M5.cjs} +11 -11
- package/dist/{chunk-EY23TOPI.cjs.map → chunk-IFJBE7M5.cjs.map} +1 -1
- package/dist/{chunk-DBGBAD4J.cjs → chunk-INNHU46B.cjs} +4 -4
- package/dist/{chunk-DBGBAD4J.cjs.map → chunk-INNHU46B.cjs.map} +1 -1
- package/dist/{chunk-SS7IYHLK.cjs → chunk-IZNSTFAT.cjs} +69 -69
- package/dist/{chunk-SS7IYHLK.cjs.map → chunk-IZNSTFAT.cjs.map} +1 -1
- package/dist/{chunk-RYVZDFVO.cjs → chunk-JJZOL5MG.cjs} +3 -3
- package/dist/{chunk-RYVZDFVO.cjs.map → chunk-JJZOL5MG.cjs.map} +1 -1
- package/dist/{chunk-BT2QTDZ4.cjs → chunk-KP7BQIZL.cjs} +35 -35
- package/dist/{chunk-BT2QTDZ4.cjs.map → chunk-KP7BQIZL.cjs.map} +1 -1
- package/dist/{chunk-LWWPIYFD.cjs → chunk-LFMOQALU.cjs} +48 -48
- package/dist/{chunk-LWWPIYFD.cjs.map → chunk-LFMOQALU.cjs.map} +1 -1
- package/dist/{chunk-JXZM5ODS.cjs → chunk-MBXXWTKT.cjs} +28 -28
- package/dist/{chunk-JXZM5ODS.cjs.map → chunk-MBXXWTKT.cjs.map} +1 -1
- package/dist/{chunk-EHFSR633.cjs → chunk-MEYQLQWS.cjs} +13 -13
- package/dist/{chunk-EHFSR633.cjs.map → chunk-MEYQLQWS.cjs.map} +1 -1
- package/dist/{chunk-2WHI2PAJ.cjs → chunk-N2YDYEUL.cjs} +6 -6
- package/dist/{chunk-2WHI2PAJ.cjs.map → chunk-N2YDYEUL.cjs.map} +1 -1
- package/dist/{chunk-PA7YEXL3.cjs → chunk-N3H3YAKY.cjs} +4 -4
- package/dist/{chunk-PA7YEXL3.cjs.map → chunk-N3H3YAKY.cjs.map} +1 -1
- package/dist/{chunk-TKWYFNWW.cjs → chunk-NGPYPW7M.cjs} +62 -60
- package/dist/chunk-NGPYPW7M.cjs.map +1 -0
- package/dist/{chunk-FDRZJFNV.cjs → chunk-O6OLY43S.cjs} +5 -5
- package/dist/{chunk-FDRZJFNV.cjs.map → chunk-O6OLY43S.cjs.map} +1 -1
- package/dist/{chunk-KZWPBL2P.cjs → chunk-OOW7H2YD.cjs} +6 -6
- package/dist/{chunk-KZWPBL2P.cjs.map → chunk-OOW7H2YD.cjs.map} +1 -1
- package/dist/{chunk-YEGOCUBR.cjs → chunk-ORQXGMCC.cjs} +15 -15
- package/dist/{chunk-YEGOCUBR.cjs.map → chunk-ORQXGMCC.cjs.map} +1 -1
- package/dist/chunk-QCC57APO.cjs +18 -0
- package/dist/{chunk-SUPCMKLP.cjs.map → chunk-QCC57APO.cjs.map} +1 -1
- package/dist/{chunk-DT4ORVVI.cjs → chunk-QFXOTJ6G.cjs} +3 -3
- package/dist/{chunk-DT4ORVVI.cjs.map → chunk-QFXOTJ6G.cjs.map} +1 -1
- package/dist/{chunk-G7E5IJST.cjs → chunk-QW6NCUR7.cjs} +5 -5
- package/dist/{chunk-G7E5IJST.cjs.map → chunk-QW6NCUR7.cjs.map} +1 -1
- package/dist/{chunk-CKKODA5B.cjs → chunk-R5NTEW4L.cjs} +26 -26
- package/dist/{chunk-CKKODA5B.cjs.map → chunk-R5NTEW4L.cjs.map} +1 -1
- package/dist/{chunk-F5HT73TR.cjs → chunk-RGSFPWG2.cjs} +50 -50
- package/dist/{chunk-F5HT73TR.cjs.map → chunk-RGSFPWG2.cjs.map} +1 -1
- package/dist/{chunk-K3WSXEEI.cjs → chunk-RSQGDXAF.cjs} +3 -3
- package/dist/{chunk-K3WSXEEI.cjs.map → chunk-RSQGDXAF.cjs.map} +1 -1
- package/dist/{chunk-6JI4AXAY.cjs → chunk-TOYKBRAU.cjs} +12 -12
- package/dist/{chunk-6JI4AXAY.cjs.map → chunk-TOYKBRAU.cjs.map} +1 -1
- package/dist/{chunk-CYA7MDHZ.cjs → chunk-TXBXIUTX.cjs} +6 -6
- package/dist/{chunk-CYA7MDHZ.cjs.map → chunk-TXBXIUTX.cjs.map} +1 -1
- package/dist/{chunk-RDBUQCAS.cjs → chunk-U6XMZG6G.cjs} +3 -3
- package/dist/{chunk-RDBUQCAS.cjs.map → chunk-U6XMZG6G.cjs.map} +1 -1
- package/dist/{chunk-LYDPVFNS.cjs → chunk-UD56Y6UA.cjs} +4 -4
- package/dist/{chunk-LYDPVFNS.cjs.map → chunk-UD56Y6UA.cjs.map} +1 -1
- package/dist/{chunk-DNWJUTK6.cjs → chunk-UWTCK5IN.cjs} +6 -6
- package/dist/{chunk-DNWJUTK6.cjs.map → chunk-UWTCK5IN.cjs.map} +1 -1
- package/dist/{chunk-7HU2NQVO.cjs → chunk-VCDD763Y.cjs} +3 -3
- package/dist/{chunk-7HU2NQVO.cjs.map → chunk-VCDD763Y.cjs.map} +1 -1
- package/dist/{chunk-HG72AVXX.cjs → chunk-VF26CUE3.cjs} +3 -3
- package/dist/{chunk-HG72AVXX.cjs.map → chunk-VF26CUE3.cjs.map} +1 -1
- package/dist/{chunk-7YIN4Q63.cjs → chunk-X46QYO4S.cjs} +4 -4
- package/dist/{chunk-7YIN4Q63.cjs.map → chunk-X46QYO4S.cjs.map} +1 -1
- package/dist/{chunk-N7B5OAI5.cjs → chunk-ZPIZINH2.cjs} +4 -4
- package/dist/{chunk-N7B5OAI5.cjs.map → chunk-ZPIZINH2.cjs.map} +1 -1
- package/dist/{chunk-RFPZKHZ6.cjs → chunk-ZTHYJP4G.cjs} +7 -7
- package/dist/{chunk-RFPZKHZ6.cjs.map → chunk-ZTHYJP4G.cjs.map} +1 -1
- package/dist/connect/docx.cjs +22 -22
- package/dist/connect/index.cjs +1088 -1029
- package/dist/connect/index.cjs.map +1 -1
- package/dist/connect/viewer.cjs +30 -30
- package/dist/connection/billing/ChangeProPlan.d.ts +1 -1
- package/dist/connection/billing/ChangeProPlan.js +9 -3
- package/dist/connection/billing/ChangeProPlan.js.map +2 -2
- package/dist/connection/billing/ConnectedPricesPrefetch.d.ts +1 -0
- package/dist/connection/billing/ConnectedPricesPrefetch.js +12 -0
- package/dist/connection/billing/ConnectedPricesPrefetch.js.map +7 -0
- package/dist/connection/billing/ConnectedWelcomeDialog.js +21 -3
- package/dist/connection/billing/ConnectedWelcomeDialog.js.map +2 -2
- package/dist/connection/billing/NewProjectFlow.js +3 -14
- package/dist/connection/billing/NewProjectFlow.js.map +2 -2
- package/dist/connection/billing/PlanPricesSkeleton.d.ts +3 -0
- package/dist/connection/billing/PlanPricesSkeleton.js +40 -0
- package/dist/connection/billing/PlanPricesSkeleton.js.map +7 -0
- package/dist/connection/billing/SubscriptionPlans.d.ts +1 -1
- package/dist/connection/billing/SubscriptionPlans.js +19 -6
- package/dist/connection/billing/SubscriptionPlans.js.map +2 -2
- package/dist/connection/billing/index.d.ts +1 -0
- package/dist/connection/billing/index.js +2 -0
- package/dist/connection/billing/index.js.map +2 -2
- package/dist/connection/notification-center/NotificationEvent.js +1 -1
- package/dist/connection/notification-center/NotificationEvent.js.map +1 -1
- package/dist/connection/viewer/useViewerBlobs.d.ts +3 -3
- package/dist/connection/viewer/useViewerBlobs.js +3 -1
- package/dist/connection/viewer/useViewerBlobs.js.map +2 -2
- package/dist/dashboards/index.cjs +1 -1
- package/dist/docx/index.cjs +38 -38
- package/dist/docx/review/DocxEditorReview.js +2 -1
- package/dist/docx/review/DocxEditorReview.js.map +2 -2
- package/dist/embed/index.cjs +37 -37
- package/dist/facts/index.cjs +43 -43
- package/dist/files/index.cjs +224 -224
- package/dist/index.cjs +1698 -1698
- package/dist/settings/WelcomeDialog.d.ts +1 -1
- package/dist/settings/WelcomeDialog.js.map +1 -1
- package/dist/settings/index.cjs +147 -147
- package/dist/shell/index.cjs +87 -87
- package/dist/studio/index.cjs +29 -29
- package/dist/styles.css +1 -1
- package/dist/vite/index.cjs +11 -10
- package/dist/vite/index.cjs.map +1 -1
- package/dist/vite/index.d.ts +4 -13
- package/dist/vite/index.js +11 -10
- package/dist/vite/index.js.map +1 -1
- package/dist/workflow-canvas/index.cjs +54 -54
- package/node_modules/@arbidocs/coedit/package.json +1 -1
- package/package.json +5 -5
- package/dist/ai-XVDR2XYV.cjs.map +0 -1
- package/dist/chunk-C6DF6WB2.cjs.map +0 -1
- package/dist/chunk-SUPCMKLP.cjs +0 -18
- package/dist/chunk-TKWYFNWW.cjs.map +0 -1
package/dist/connect/viewer.cjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
'use strict';
|
|
3
3
|
|
|
4
|
-
var
|
|
4
|
+
var chunkNGPYPW7M_cjs = require('../chunk-NGPYPW7M.cjs');
|
|
5
5
|
require('../chunk-JITYC4OS.cjs');
|
|
6
6
|
require('../chunk-WVZLAAIZ.cjs');
|
|
7
7
|
require('../chunk-X7ALF4MP.cjs');
|
|
@@ -9,19 +9,19 @@ require('../chunk-4CIVQWAX.cjs');
|
|
|
9
9
|
var chunk57LUHZLV_cjs = require('../chunk-57LUHZLV.cjs');
|
|
10
10
|
require('../chunk-QWVUBTW3.cjs');
|
|
11
11
|
require('../chunk-JVEDKKNO.cjs');
|
|
12
|
-
require('../chunk-
|
|
12
|
+
require('../chunk-UD56Y6UA.cjs');
|
|
13
13
|
require('../chunk-TIBTTITZ.cjs');
|
|
14
|
-
require('../chunk-
|
|
15
|
-
require('../chunk-
|
|
14
|
+
require('../chunk-KP7BQIZL.cjs');
|
|
15
|
+
require('../chunk-N3H3YAKY.cjs');
|
|
16
16
|
require('../chunk-HYUKPHCT.cjs');
|
|
17
|
-
require('../chunk-
|
|
17
|
+
require('../chunk-ZPIZINH2.cjs');
|
|
18
18
|
require('../chunk-223D4727.cjs');
|
|
19
19
|
require('../chunk-SNUBQMIS.cjs');
|
|
20
|
-
require('../chunk-
|
|
20
|
+
require('../chunk-FRRF2OQ7.cjs');
|
|
21
21
|
require('../chunk-4ONPEVTP.cjs');
|
|
22
22
|
require('../chunk-V3KLUWQQ.cjs');
|
|
23
23
|
require('../chunk-OA3AN6WW.cjs');
|
|
24
|
-
require('../chunk-
|
|
24
|
+
require('../chunk-OOW7H2YD.cjs');
|
|
25
25
|
require('../chunk-3RAW2ZH5.cjs');
|
|
26
26
|
require('../chunk-ETMSINQS.cjs');
|
|
27
27
|
require('../chunk-OUYBYZ7Y.cjs');
|
|
@@ -30,58 +30,58 @@ require('../chunk-DTMBAFIL.cjs');
|
|
|
30
30
|
require('../chunk-7NJKDJVO.cjs');
|
|
31
31
|
require('../chunk-LIDXIX36.cjs');
|
|
32
32
|
require('../chunk-34HQO4ZQ.cjs');
|
|
33
|
-
require('../chunk-
|
|
34
|
-
require('../chunk-EY23TOPI.cjs');
|
|
33
|
+
require('../chunk-IFJBE7M5.cjs');
|
|
35
34
|
require('../chunk-K4763GD5.cjs');
|
|
36
35
|
require('../chunk-2RLA6QO2.cjs');
|
|
37
36
|
require('../chunk-MZZ3SBQL.cjs');
|
|
38
|
-
require('../chunk-
|
|
39
|
-
require('../chunk-
|
|
37
|
+
require('../chunk-VCDD763Y.cjs');
|
|
38
|
+
require('../chunk-ECSOXKJQ.cjs');
|
|
40
39
|
require('../chunk-WQMR3O2D.cjs');
|
|
41
40
|
require('../chunk-NZNBJF3M.cjs');
|
|
42
41
|
require('../chunk-NWNVWO6L.cjs');
|
|
43
42
|
require('../chunk-SK6HQ46Q.cjs');
|
|
44
|
-
require('../chunk-DEXUL3T6.cjs');
|
|
45
|
-
require('../chunk-AFQTQC7A.cjs');
|
|
46
|
-
require('../chunk-XJEXFEWG.cjs');
|
|
47
|
-
require('../chunk-Z2XZ2D4N.cjs');
|
|
48
|
-
require('../chunk-YZSQ7F5K.cjs');
|
|
49
|
-
require('../chunk-MCXS6X37.cjs');
|
|
50
|
-
require('../chunk-KQF7POTG.cjs');
|
|
51
43
|
require('../chunk-TG2GM7WJ.cjs');
|
|
52
|
-
require('../chunk-
|
|
53
|
-
require('../chunk-75BNMCUX.cjs');
|
|
44
|
+
require('../chunk-A53YMUOX.cjs');
|
|
54
45
|
require('../chunk-OEJQFPWO.cjs');
|
|
55
46
|
require('../chunk-OYXWQTHF.cjs');
|
|
56
47
|
require('../chunk-S237ORM3.cjs');
|
|
57
48
|
require('../chunk-II2OEXHW.cjs');
|
|
58
|
-
require('../chunk-
|
|
59
|
-
require('../chunk-RYVZDFVO.cjs');
|
|
49
|
+
require('../chunk-JJZOL5MG.cjs');
|
|
60
50
|
require('../chunk-3YEXZX4H.cjs');
|
|
61
51
|
require('../chunk-4PA6VCCR.cjs');
|
|
62
|
-
require('../chunk-
|
|
52
|
+
require('../chunk-RSQGDXAF.cjs');
|
|
63
53
|
require('../chunk-AHDJXIUB.cjs');
|
|
64
54
|
require('../chunk-RL2HI6NP.cjs');
|
|
65
55
|
require('../chunk-6UZC4XVV.cjs');
|
|
66
56
|
require('../chunk-S5OGPQSB.cjs');
|
|
67
|
-
require('../chunk-
|
|
68
|
-
require('../chunk-JN5YMHGI.cjs');
|
|
69
|
-
require('../chunk-UDSHVNU3.cjs');
|
|
57
|
+
require('../chunk-VZOOGA47.cjs');
|
|
70
58
|
require('../chunk-OUGRCQM7.cjs');
|
|
71
|
-
require('../chunk-IPSHAMO2.cjs');
|
|
72
59
|
require('../chunk-ZVEW3JBT.cjs');
|
|
73
60
|
require('../chunk-MHIG6GGS.cjs');
|
|
74
61
|
require('../chunk-VG24E4JJ.cjs');
|
|
75
62
|
require('../chunk-U2FFG2B3.cjs');
|
|
76
63
|
require('../chunk-KKYNTWDU.cjs');
|
|
77
64
|
require('../chunk-M74FWYNL.cjs');
|
|
78
|
-
require('../chunk-VZOOGA47.cjs');
|
|
79
65
|
require('../chunk-CENMN32L.cjs');
|
|
80
66
|
require('../chunk-YKOPKLYP.cjs');
|
|
81
67
|
require('../chunk-3YZKDCWY.cjs');
|
|
82
68
|
require('../chunk-SJSGSHIT.cjs');
|
|
83
|
-
require('../chunk-PPCATBOY.cjs');
|
|
84
69
|
require('../chunk-ZW6FPIFC.cjs');
|
|
70
|
+
require('../chunk-CT3SLXB7.cjs');
|
|
71
|
+
require('../chunk-DEXUL3T6.cjs');
|
|
72
|
+
require('../chunk-AFQTQC7A.cjs');
|
|
73
|
+
require('../chunk-XJEXFEWG.cjs');
|
|
74
|
+
require('../chunk-Z2XZ2D4N.cjs');
|
|
75
|
+
require('../chunk-YZSQ7F5K.cjs');
|
|
76
|
+
require('../chunk-MCXS6X37.cjs');
|
|
77
|
+
require('../chunk-KQF7POTG.cjs');
|
|
78
|
+
require('../chunk-75BNMCUX.cjs');
|
|
79
|
+
require('../chunk-FX3K6LNZ.cjs');
|
|
80
|
+
require('../chunk-EQTZQD66.cjs');
|
|
81
|
+
require('../chunk-JN5YMHGI.cjs');
|
|
82
|
+
require('../chunk-UDSHVNU3.cjs');
|
|
83
|
+
require('../chunk-IPSHAMO2.cjs');
|
|
84
|
+
require('../chunk-PPCATBOY.cjs');
|
|
85
85
|
require('../chunk-LJJJ6CYH.cjs');
|
|
86
86
|
require('../chunk-MNIQDXM6.cjs');
|
|
87
87
|
require('../chunk-T6WA6S5T.cjs');
|
|
@@ -94,7 +94,7 @@ require('../chunk-PLIF5CUV.cjs');
|
|
|
94
94
|
|
|
95
95
|
Object.defineProperty(exports, "ConnectedDocumentViewer", {
|
|
96
96
|
enumerable: true,
|
|
97
|
-
get: function () { return
|
|
97
|
+
get: function () { return chunkNGPYPW7M_cjs.ConnectedDocumentViewer; }
|
|
98
98
|
});
|
|
99
99
|
Object.defineProperty(exports, "ConnectedDocumentToolsProvider", {
|
|
100
100
|
enumerable: true,
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
*/
|
|
14
14
|
import type { components } from '@arbidocs/client';
|
|
15
15
|
type ProjectResponse = components['schemas']['ProjectResponse'];
|
|
16
|
-
export declare function ChangeProPlan(
|
|
16
|
+
export declare function ChangeProPlan(props: {
|
|
17
17
|
project: ProjectResponse;
|
|
18
18
|
onDone?: () => void;
|
|
19
19
|
}): import("react").JSX.Element;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { PlanPricesSkeleton } from "./PlanPricesSkeleton.js";
|
|
3
4
|
import { useState } from "react";
|
|
4
5
|
import {
|
|
5
6
|
MoreInfo,
|
|
@@ -39,11 +40,16 @@ function formatDate(unix) {
|
|
|
39
40
|
});
|
|
40
41
|
}
|
|
41
42
|
const intervalWord = (i) => i === "year" ? "annual" : "monthly";
|
|
42
|
-
function ChangeProPlan({
|
|
43
|
+
function ChangeProPlan(props) {
|
|
44
|
+
const { data: products, isPending } = useProducts();
|
|
45
|
+
if (isPending) return /* @__PURE__ */ jsx(PlanPricesSkeleton, { cards: 1 });
|
|
46
|
+
return /* @__PURE__ */ jsx(ChangeProPlanForm, { ...props, products });
|
|
47
|
+
}
|
|
48
|
+
function ChangeProPlanForm({
|
|
43
49
|
project,
|
|
44
|
-
onDone
|
|
50
|
+
onDone,
|
|
51
|
+
products
|
|
45
52
|
}) {
|
|
46
|
-
const { data: products } = useProducts();
|
|
47
53
|
const changePlan = useChangeProjectPlan();
|
|
48
54
|
const cancel = useCancelProjectSubscription();
|
|
49
55
|
const prices = findProPrices(products);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/connection/billing/ChangeProPlan.tsx"],
|
|
4
|
-
"sourcesContent": ["/**\n * ChangeProPlan \u2014 change the plan of a project already on Pro.\n *\n * Pro is one licence. Choices: Pro, Free, and the billing interval; a legacy multi-pack plan (no longer\n * sold) also shows its own count (\"Pro \u00D73\", priced from the project) and may only go down to one\n * licence. One POST /change-plan { interval, packs }:\n * - packs is 1, or the subscription's current count (which undoes a scheduled reduction).\n * - One licence instead of several applies at period end (`addons.packs_next`), no refund.\n * - Monthly \u2194 annual switches at period end (`addons.pending_interval`); a plan that renews with\n * several packs can't switch interval, so the toggle shows only once one licence is chosen.\n * - Sending the current value clears a pending change; on a project set to cancel, it resumes.\n * - Free: POST /cancel \u2014 Pro and its add-ons stay until the period ends.\n */\n\nimport { useState } from 'react'\nimport {\n MoreInfo,\n PlanActionButton,\n PlanNotice,\n PlanStack,\n PlanTierOption,\n PricingToggle,\n} from '../../settings'\nimport {\n useCancelProjectSubscription,\n useChangeProjectPlan,\n useProducts,\n usePreviewProjectPlanChange,\n} from '@arbidocs/react'\nimport { notify } from '@arbidocs/react/shell'\nimport { formatGbp } from '@arbidocs/react'\nimport { addonErrorMessage } from './useAddonPurchase'\nimport type { components } from '@arbidocs/client'\nimport { ConnectedReferralRewardNote } from './ConnectedReferralReward'\nimport { PlanChangeLines } from './PlanChangeLines'\nimport { notifyPlanChange } from './plan-change-outcome'\nimport { proTierName } from './plan-badge'\nimport {\n calcSavingsPercent,\n findProPrices,\n packPrice,\n planNameForPacks,\n type PlanInterval,\n plusVat,\n PRO_PACKS,\n} from './plan-pricing'\n\ntype ProjectResponse = components['schemas']['ProjectResponse']\n\nfunction formatDate(unix: number | null | undefined): string | null {\n if (!unix) return null\n return new Date(unix * 1000).toLocaleDateString('en-GB', {\n day: 'numeric',\n month: 'short',\n year: 'numeric',\n })\n}\n\nconst intervalWord = (i: PlanInterval) => (i === 'year' ? 'annual' : 'monthly')\n\nexport function ChangeProPlan({\n project,\n onDone,\n}: {\n project: ProjectResponse\n onDone?: () => void\n}) {\n const { data: products } = useProducts()\n const changePlan = useChangeProjectPlan()\n const cancel = useCancelProjectSubscription()\n const prices = findProPrices(products)\n const product = products?.[0]\n const addons = project.addons\n\n const isCanceling = project.cancel_at_period_end === true || project.subscription === 'canceled'\n const currentPacks = Math.max(addons?.packs ?? project.packs ?? PRO_PACKS, PRO_PACKS)\n const isLegacyMultiPack = currentPacks > PRO_PACKS\n const currentInterval: PlanInterval = project.plan_interval === 'year' ? 'year' : 'month'\n // What the project becomes at the end of this period, if nothing else changes.\n const scheduledPacks = isCanceling ? 0 : (addons?.packs_next ?? currentPacks)\n const scheduledInterval: PlanInterval = addons?.pending_interval ?? currentInterval\n\n const [targetPacks, setTargetPacks] = useState(scheduledPacks)\n const [chosenInterval, setChosenInterval] = useState<PlanInterval>(scheduledInterval)\n // Several packs only renew on their own (retired) price and interval.\n const targetInterval: PlanInterval = targetPacks > PRO_PACKS ? currentInterval : chosenInterval\n const periodEnd = formatDate(addons?.period_end ?? project.current_period_end)\n const when = periodEnd ?? 'the end of the period'\n const shortWhen = periodEnd ? periodEnd.replace(/ \\d{4}$/, '') : 'period end'\n const isPending = changePlan.isPending || cancel.isPending\n\n const sameAsScheduled =\n targetPacks === scheduledPacks && (targetPacks === 0 || targetInterval === scheduledInterval)\n\n // Pro (one licence) and Free; a legacy plan also lists its own pack count, first.\n const packOptions = isLegacyMultiPack ? [currentPacks, PRO_PACKS, 0] : [PRO_PACKS, 0]\n\n const intervalPrice = targetInterval === 'year' ? prices.annual : prices.monthly\n const currency = intervalPrice?.currency ?? project.currency ?? 'gbp'\n const preview = usePreviewProjectPlanChange(\n project.external_id,\n sameAsScheduled || targetPacks === 0 ? null : { packs: targetPacks, interval: targetInterval }\n )\n // The backend also says when a selection changes nothing.\n const noChange = sameAsScheduled || preview.data?.unchanged === true\n\n const isPersonal = project.is_personal === true\n const nameFor = (packs: number) =>\n packs === 0 && !isPersonal\n ? 'Cancel subscription'\n : packs === currentPacks && packs > 0\n ? proTierName(project)\n : planNameForPacks(packs)\n\n /** What applying the selection does: one short line per effect. */\n const effects: string[] = []\n const target = nameFor(targetPacks)\n if (targetPacks === 0) {\n effects.push(\n isPersonal\n ? `Moves to Free on ${when}. No refund.`\n : `Access ends on ${when}. Your data is retained for 30 days to export or resubscribe, then scheduled for deletion.`\n )\n } else {\n if (isCanceling) effects.push(`Stays on ${target}.`)\n if (targetPacks < currentPacks) {\n effects.push(`Changes to one Pro licence on ${when}. No refund.`)\n } else if (!isCanceling && addons?.packs_next != null) {\n effects.push(`Cancels the change to ${planNameForPacks(addons.packs_next)}.`)\n }\n if (targetInterval !== currentInterval) {\n effects.push(`${targetInterval === 'year' ? 'Annual' : 'Monthly'} billing from ${when}.`)\n } else if (addons?.pending_interval && addons.pending_interval !== currentInterval) {\n effects.push(`Cancels the switch to ${intervalWord(addons.pending_interval)} billing.`)\n }\n }\n // The real charge, from Stripe's preview, before the user confirms.\n const showLines = !noChange && targetPacks > 0 && !preview.isError\n\n const apply = () => {\n const onError = (error: unknown) => notify.error(addonErrorMessage(error))\n if (targetPacks === 0) {\n cancel.mutate(project.external_id, {\n onSuccess: () => {\n notify.success(isPersonal ? `Moves to Free on ${when}` : `Subscription ends on ${when}`)\n onDone?.()\n },\n onError,\n })\n return\n }\n changePlan.mutate(\n {\n projectExtId: project.external_id,\n body: { interval: targetInterval, packs: targetPacks },\n },\n {\n onSuccess: (data) => {\n notifyPlanChange(data, 'Subscription change saved')\n onDone?.()\n },\n onError,\n }\n )\n }\n\n const optionFor = (packs: number) => {\n if (packs === 0) {\n return {\n total: isPersonal ? 'Free' : undefined,\n summary: isPersonal\n ? product\n ? `${formatGbp(product.free_ai_gbp)} of AI credits \u00B7 ${product.free_storage_gb * 1000} MB \u00B7 just you`\n : 'No subscription'\n : 'Suspended after the paid period. 30 days to export or resubscribe.',\n }\n }\n const allowance = product\n ? `${formatGbp(product.included_ai_gbp * packs)} of AI credits \u00B7 ${product.included_storage_gb * packs} GB`\n : 'AI credits and storage'\n // A legacy plan keeps its own price (from the subscription); one licence is the price list's.\n const legacy = packs > PRO_PACKS\n const exVat = legacy ? project.amount_ex_vat : packPrice(intervalPrice)?.amount_ex_vat\n return {\n total: exVat != null ? plusVat(exVat, currency) : undefined,\n summary: allowance,\n }\n }\n\n return (\n <PlanStack gap={4} testId=\"change-pro-plan\">\n <div className=\"flex flex-wrap items-center justify-between gap-2\">\n <span className=\"text-sm font-medium text-foreground\">Billing</span>\n {targetPacks > PRO_PACKS ? (\n <span className=\"text-sm text-muted-foreground\" data-testid=\"change-plan-interval-fixed\">\n {currentInterval === 'year' ? 'Annual' : 'Monthly'}\n </span>\n ) : (\n <PricingToggle\n isAnnual={targetInterval === 'year'}\n onToggle={() => setChosenInterval(targetInterval === 'year' ? 'month' : 'year')}\n savingsPercent={calcSavingsPercent(prices.monthly, prices.annual)}\n />\n )}\n </div>\n\n <PlanStack gap={2}>\n {packOptions.map((packs) => {\n const { total, summary } = optionFor(packs)\n return (\n <PlanTierOption\n key={packs}\n onSelect={setTargetPacks}\n option={{\n id: packs,\n name: nameFor(packs),\n isCurrent: packs === currentPacks,\n isSelected: packs === targetPacks,\n total,\n intervalLabel: packs === 0 ? '/mo' : targetInterval === 'year' ? '/yr' : '/mo',\n summary,\n }}\n />\n )\n })}\n </PlanStack>\n\n {isLegacyMultiPack && (\n <div className=\"flex flex-wrap items-center gap-x-3 gap-y-1\">\n <PlanNotice className=\"text-xs\" testId=\"change-plan-legacy-note\">\n {proTierName(project)} is no longer sold\n </PlanNotice>\n <MoreInfo title=\"Legacy subscription\" testId=\"change-plan-legacy-more-info\">\n <p>\n {proTierName(project)} keeps renewing at its own price, with its allowance and\n add-ons, until you change it.\n </p>\n <p>\n You can move to one Pro licence from {when}. The change applies at the end of the\n period; no refund.\n </p>\n </MoreInfo>\n </div>\n )}\n {!noChange && effects.length > 0 && (\n <p className=\"text-sm font-medium text-foreground\" data-testid=\"change-plan-note\">\n {effects.join(' ')}\n </p>\n )}\n {showLines && (\n <PlanChangeLines\n preview={preview.data}\n isError={preview.isError}\n className=\"space-y-0.5 text-sm text-foreground\"\n />\n )}\n\n {targetPacks > 0 && <ConnectedReferralRewardNote />}\n\n <PlanActionButton\n onClick={apply}\n disabled={noChange || isPending}\n data-testid=\"change-plan-apply\"\n >\n {noChange\n ? 'No change'\n : isPending\n ? 'Updating\u2026'\n : targetPacks === 0\n ? isPersonal\n ? `Move to Free on ${shortWhen}`\n : `Cancel subscription on ${shortWhen}`\n : targetPacks < currentPacks\n ? `Move to one licence on ${shortWhen}`\n : 'Save change'}\n </PlanActionButton>\n </PlanStack>\n )\n}\n"],
|
|
5
|
-
"mappings": ";
|
|
4
|
+
"sourcesContent": ["/**\n * ChangeProPlan \u2014 change the plan of a project already on Pro.\n *\n * Pro is one licence. Choices: Pro, Free, and the billing interval; a legacy multi-pack plan (no longer\n * sold) also shows its own count (\"Pro \u00D73\", priced from the project) and may only go down to one\n * licence. One POST /change-plan { interval, packs }:\n * - packs is 1, or the subscription's current count (which undoes a scheduled reduction).\n * - One licence instead of several applies at period end (`addons.packs_next`), no refund.\n * - Monthly \u2194 annual switches at period end (`addons.pending_interval`); a plan that renews with\n * several packs can't switch interval, so the toggle shows only once one licence is chosen.\n * - Sending the current value clears a pending change; on a project set to cancel, it resumes.\n * - Free: POST /cancel \u2014 Pro and its add-ons stay until the period ends.\n */\n\nimport { PlanPricesSkeleton } from './PlanPricesSkeleton'\nimport { useState } from 'react'\nimport {\n MoreInfo,\n PlanActionButton,\n PlanNotice,\n PlanStack,\n PlanTierOption,\n PricingToggle,\n} from '../../settings'\nimport {\n useCancelProjectSubscription,\n useChangeProjectPlan,\n useProducts,\n usePreviewProjectPlanChange,\n} from '@arbidocs/react'\nimport { notify } from '@arbidocs/react/shell'\nimport { formatGbp } from '@arbidocs/react'\nimport { addonErrorMessage } from './useAddonPurchase'\nimport type { components } from '@arbidocs/client'\nimport { ConnectedReferralRewardNote } from './ConnectedReferralReward'\nimport { PlanChangeLines } from './PlanChangeLines'\nimport { notifyPlanChange } from './plan-change-outcome'\nimport { proTierName } from './plan-badge'\nimport {\n calcSavingsPercent,\n findProPrices,\n packPrice,\n planNameForPacks,\n type PlanInterval,\n plusVat,\n PRO_PACKS,\n} from './plan-pricing'\n\ntype ProjectResponse = components['schemas']['ProjectResponse']\n\nfunction formatDate(unix: number | null | undefined): string | null {\n if (!unix) return null\n return new Date(unix * 1000).toLocaleDateString('en-GB', {\n day: 'numeric',\n month: 'short',\n year: 'numeric',\n })\n}\n\nconst intervalWord = (i: PlanInterval) => (i === 'year' ? 'annual' : 'monthly')\n\nexport function ChangeProPlan(props: { project: ProjectResponse; onDone?: () => void }) {\n const { data: products, isPending } = useProducts()\n // Pending is loading: the form never renders with its prices missing and then jump.\n if (isPending) return <PlanPricesSkeleton cards={1} />\n return <ChangeProPlanForm {...props} products={products} />\n}\n\nfunction ChangeProPlanForm({\n project,\n onDone,\n products,\n}: {\n project: ProjectResponse\n onDone?: () => void\n products: ReturnType<typeof useProducts>['data']\n}) {\n const changePlan = useChangeProjectPlan()\n const cancel = useCancelProjectSubscription()\n const prices = findProPrices(products)\n const product = products?.[0]\n const addons = project.addons\n\n const isCanceling = project.cancel_at_period_end === true || project.subscription === 'canceled'\n const currentPacks = Math.max(addons?.packs ?? project.packs ?? PRO_PACKS, PRO_PACKS)\n const isLegacyMultiPack = currentPacks > PRO_PACKS\n const currentInterval: PlanInterval = project.plan_interval === 'year' ? 'year' : 'month'\n // What the project becomes at the end of this period, if nothing else changes.\n const scheduledPacks = isCanceling ? 0 : (addons?.packs_next ?? currentPacks)\n const scheduledInterval: PlanInterval = addons?.pending_interval ?? currentInterval\n\n const [targetPacks, setTargetPacks] = useState(scheduledPacks)\n const [chosenInterval, setChosenInterval] = useState<PlanInterval>(scheduledInterval)\n // Several packs only renew on their own (retired) price and interval.\n const targetInterval: PlanInterval = targetPacks > PRO_PACKS ? currentInterval : chosenInterval\n const periodEnd = formatDate(addons?.period_end ?? project.current_period_end)\n const when = periodEnd ?? 'the end of the period'\n const shortWhen = periodEnd ? periodEnd.replace(/ \\d{4}$/, '') : 'period end'\n const isPending = changePlan.isPending || cancel.isPending\n\n const sameAsScheduled =\n targetPacks === scheduledPacks && (targetPacks === 0 || targetInterval === scheduledInterval)\n\n // Pro (one licence) and Free; a legacy plan also lists its own pack count, first.\n const packOptions = isLegacyMultiPack ? [currentPacks, PRO_PACKS, 0] : [PRO_PACKS, 0]\n\n const intervalPrice = targetInterval === 'year' ? prices.annual : prices.monthly\n const currency = intervalPrice?.currency ?? project.currency ?? 'gbp'\n const preview = usePreviewProjectPlanChange(\n project.external_id,\n sameAsScheduled || targetPacks === 0 ? null : { packs: targetPacks, interval: targetInterval }\n )\n // The backend also says when a selection changes nothing.\n const noChange = sameAsScheduled || preview.data?.unchanged === true\n\n const isPersonal = project.is_personal === true\n const nameFor = (packs: number) =>\n packs === 0 && !isPersonal\n ? 'Cancel subscription'\n : packs === currentPacks && packs > 0\n ? proTierName(project)\n : planNameForPacks(packs)\n\n /** What applying the selection does: one short line per effect. */\n const effects: string[] = []\n const target = nameFor(targetPacks)\n if (targetPacks === 0) {\n effects.push(\n isPersonal\n ? `Moves to Free on ${when}. No refund.`\n : `Access ends on ${when}. Your data is retained for 30 days to export or resubscribe, then scheduled for deletion.`\n )\n } else {\n if (isCanceling) effects.push(`Stays on ${target}.`)\n if (targetPacks < currentPacks) {\n effects.push(`Changes to one Pro licence on ${when}. No refund.`)\n } else if (!isCanceling && addons?.packs_next != null) {\n effects.push(`Cancels the change to ${planNameForPacks(addons.packs_next)}.`)\n }\n if (targetInterval !== currentInterval) {\n effects.push(`${targetInterval === 'year' ? 'Annual' : 'Monthly'} billing from ${when}.`)\n } else if (addons?.pending_interval && addons.pending_interval !== currentInterval) {\n effects.push(`Cancels the switch to ${intervalWord(addons.pending_interval)} billing.`)\n }\n }\n // The real charge, from Stripe's preview, before the user confirms.\n const showLines = !noChange && targetPacks > 0 && !preview.isError\n\n const apply = () => {\n const onError = (error: unknown) => notify.error(addonErrorMessage(error))\n if (targetPacks === 0) {\n cancel.mutate(project.external_id, {\n onSuccess: () => {\n notify.success(isPersonal ? `Moves to Free on ${when}` : `Subscription ends on ${when}`)\n onDone?.()\n },\n onError,\n })\n return\n }\n changePlan.mutate(\n {\n projectExtId: project.external_id,\n body: { interval: targetInterval, packs: targetPacks },\n },\n {\n onSuccess: (data) => {\n notifyPlanChange(data, 'Subscription change saved')\n onDone?.()\n },\n onError,\n }\n )\n }\n\n const optionFor = (packs: number) => {\n if (packs === 0) {\n return {\n total: isPersonal ? 'Free' : undefined,\n summary: isPersonal\n ? product\n ? `${formatGbp(product.free_ai_gbp)} of AI credits \u00B7 ${product.free_storage_gb * 1000} MB \u00B7 just you`\n : 'No subscription'\n : 'Suspended after the paid period. 30 days to export or resubscribe.',\n }\n }\n const allowance = product\n ? `${formatGbp(product.included_ai_gbp * packs)} of AI credits \u00B7 ${product.included_storage_gb * packs} GB`\n : 'AI credits and storage'\n // A legacy plan keeps its own price (from the subscription); one licence is the price list's.\n const legacy = packs > PRO_PACKS\n const exVat = legacy ? project.amount_ex_vat : packPrice(intervalPrice)?.amount_ex_vat\n return {\n total: exVat != null ? plusVat(exVat, currency) : undefined,\n summary: allowance,\n }\n }\n\n return (\n <PlanStack gap={4} testId=\"change-pro-plan\">\n <div className=\"flex flex-wrap items-center justify-between gap-2\">\n <span className=\"text-sm font-medium text-foreground\">Billing</span>\n {targetPacks > PRO_PACKS ? (\n <span className=\"text-sm text-muted-foreground\" data-testid=\"change-plan-interval-fixed\">\n {currentInterval === 'year' ? 'Annual' : 'Monthly'}\n </span>\n ) : (\n <PricingToggle\n isAnnual={targetInterval === 'year'}\n onToggle={() => setChosenInterval(targetInterval === 'year' ? 'month' : 'year')}\n savingsPercent={calcSavingsPercent(prices.monthly, prices.annual)}\n />\n )}\n </div>\n\n <PlanStack gap={2}>\n {packOptions.map((packs) => {\n const { total, summary } = optionFor(packs)\n return (\n <PlanTierOption\n key={packs}\n onSelect={setTargetPacks}\n option={{\n id: packs,\n name: nameFor(packs),\n isCurrent: packs === currentPacks,\n isSelected: packs === targetPacks,\n total,\n intervalLabel: packs === 0 ? '/mo' : targetInterval === 'year' ? '/yr' : '/mo',\n summary,\n }}\n />\n )\n })}\n </PlanStack>\n\n {isLegacyMultiPack && (\n <div className=\"flex flex-wrap items-center gap-x-3 gap-y-1\">\n <PlanNotice className=\"text-xs\" testId=\"change-plan-legacy-note\">\n {proTierName(project)} is no longer sold\n </PlanNotice>\n <MoreInfo title=\"Legacy subscription\" testId=\"change-plan-legacy-more-info\">\n <p>\n {proTierName(project)} keeps renewing at its own price, with its allowance and\n add-ons, until you change it.\n </p>\n <p>\n You can move to one Pro licence from {when}. The change applies at the end of the\n period; no refund.\n </p>\n </MoreInfo>\n </div>\n )}\n {!noChange && effects.length > 0 && (\n <p className=\"text-sm font-medium text-foreground\" data-testid=\"change-plan-note\">\n {effects.join(' ')}\n </p>\n )}\n {showLines && (\n <PlanChangeLines\n preview={preview.data}\n isError={preview.isError}\n className=\"space-y-0.5 text-sm text-foreground\"\n />\n )}\n\n {targetPacks > 0 && <ConnectedReferralRewardNote />}\n\n <PlanActionButton\n onClick={apply}\n disabled={noChange || isPending}\n data-testid=\"change-plan-apply\"\n >\n {noChange\n ? 'No change'\n : isPending\n ? 'Updating\u2026'\n : targetPacks === 0\n ? isPersonal\n ? `Move to Free on ${shortWhen}`\n : `Cancel subscription on ${shortWhen}`\n : targetPacks < currentPacks\n ? `Move to one licence on ${shortWhen}`\n : 'Save change'}\n </PlanActionButton>\n </PlanStack>\n )\n}\n"],
|
|
5
|
+
"mappings": ";AAgEwB,cAwIlB,YAxIkB;AAlDxB,SAAS,0BAA0B;AACnC,SAAS,gBAAgB;AACzB;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,cAAc;AACvB,SAAS,iBAAiB;AAC1B,SAAS,yBAAyB;AAElC,SAAS,mCA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uCAAsC,eAAY,oBAC5D,kBAAQ,KAAK,GAAG,GACnB;AAAA,IAED,aACC;AAAA,MAAC;AAAA;AAAA,QACC,SAAS,QAAQ;AAAA,QACjB,SAAS,QAAQ;AAAA,QACjB,WAAU;AAAA;AAAA,IACZ;AAAA,IAGD,cAAc,KAAK,oBAAC,+BAA4B;AAAA,IAEjD;AAAA,MAAC;AAAA;AAAA,QACC,SAAS;AAAA,QACT,UAAU,YAAY;AAAA,QACtB,eAAY;AAAA,QAEX,qBACG,cACA,YACE,mBACA,gBAAgB,IACd,aACE,mBAAmB,SAAS,KAC5B,0BAA0B,SAAS,KACrC,cAAc,eACZ,0BAA0B,SAAS,KACnC;AAAA;AAAA,IACZ;AAAA,KACF;AAEJ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function ConnectedPricesPrefetch(): null;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useProducts } from "@arbidocs/react";
|
|
3
|
+
import { useBillingSupport } from "./support.js";
|
|
4
|
+
function ConnectedPricesPrefetch() {
|
|
5
|
+
const { stripeEnabled } = useBillingSupport();
|
|
6
|
+
useProducts({ enabled: stripeEnabled });
|
|
7
|
+
return null;
|
|
8
|
+
}
|
|
9
|
+
export {
|
|
10
|
+
ConnectedPricesPrefetch
|
|
11
|
+
};
|
|
12
|
+
//# sourceMappingURL=ConnectedPricesPrefetch.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/connection/billing/ConnectedPricesPrefetch.tsx"],
|
|
4
|
+
"sourcesContent": ["/**\n * Reads the plan prices as soon as the session is signed in, where the site sells plans, so every\n * billing screen (welcome dialog, plan picker, new project) opens with them cached instead of\n * starting the request when it opens. Mount it once, inside the host, as early as the host can\n * (the app: its `<ArbiHost>` children, above the lazy dashboard). Renders nothing.\n */\nimport { useProducts } from '@arbidocs/react'\nimport { useBillingSupport } from './support'\n\nexport function ConnectedPricesPrefetch(): null {\n const { stripeEnabled } = useBillingSupport()\n useProducts({ enabled: stripeEnabled })\n return null\n}\n"],
|
|
5
|
+
"mappings": ";AAMA,SAAS,mBAAmB;AAC5B,SAAS,yBAAyB;AAE3B,SAAS,0BAAgC;AAC9C,QAAM,EAAE,cAAc,IAAI,kBAAkB;AAC5C,cAAY,EAAE,SAAS,cAAc,CAAC;AACtC,SAAO;AACT;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -8,6 +8,8 @@ import { PlanBadge } from "../../settings/PlanBadge.js";
|
|
|
8
8
|
import { WelcomeDialog } from "../../settings/WelcomeDialog.js";
|
|
9
9
|
import { ConnectedWelcomeInvitations } from "../contacts/ConnectedWelcomeInvitations.js";
|
|
10
10
|
import { SubscriptionPlans } from "./SubscriptionPlans.js";
|
|
11
|
+
import { useBillingSupport } from "./support.js";
|
|
12
|
+
import { Button } from "@arbidocs/react/ui";
|
|
11
13
|
import { planBadgeView } from "./plan-badge.js";
|
|
12
14
|
import { findProPrices, packPrice } from "./plan-pricing.js";
|
|
13
15
|
import { aiUsageResetTimestamp, formatResetDate, getQuotaItems } from "./quota-items.js";
|
|
@@ -20,7 +22,8 @@ function ConnectedWelcomeDialog({
|
|
|
20
22
|
const currentUser = useArbiSession().user;
|
|
21
23
|
const { data: projects } = useProjects();
|
|
22
24
|
const balance = useRewardBalance();
|
|
23
|
-
const {
|
|
25
|
+
const { stripeEnabled } = useBillingSupport();
|
|
26
|
+
const { data: products, isPending: pricesPending } = useProducts({ enabled: stripeEnabled });
|
|
24
27
|
const [showInvite, setShowInvite] = useState(false);
|
|
25
28
|
const ownedProjects = useMemo(
|
|
26
29
|
() => (projects ?? []).filter((p) => p.created_by === currentUser?.external_id),
|
|
@@ -67,7 +70,16 @@ function ConnectedWelcomeDialog({
|
|
|
67
70
|
pct: q.pct,
|
|
68
71
|
hint: q.key === "ai-usage" ? aiUsageHint : void 0
|
|
69
72
|
})),
|
|
70
|
-
subscriptionChoices: /* @__PURE__ */ jsx(
|
|
73
|
+
subscriptionChoices: !stripeEnabled ? /* @__PURE__ */ jsx(
|
|
74
|
+
Button,
|
|
75
|
+
{
|
|
76
|
+
type: "button",
|
|
77
|
+
variant: "outline",
|
|
78
|
+
onClick: dismiss,
|
|
79
|
+
"data-testid": "welcome-modal-dismiss",
|
|
80
|
+
children: "Continue"
|
|
81
|
+
}
|
|
82
|
+
) : /* @__PURE__ */ jsx(
|
|
71
83
|
SubscriptionPlans,
|
|
72
84
|
{
|
|
73
85
|
projectExtId: selectedProject.external_id,
|
|
@@ -79,7 +91,13 @@ function ConnectedWelcomeDialog({
|
|
|
79
91
|
selectedProject.external_id
|
|
80
92
|
),
|
|
81
93
|
proMonthlyPriceLabel: monthlyExVat != null ? formatMoney(monthlyExVat, monthly?.currency ?? "gbp") : void 0,
|
|
82
|
-
referralOfferLabel: products?.[0]?.inviter_reward_amount != null ? formatMoney(products[0].inviter_reward_amount, products[0].reward_currency) :
|
|
94
|
+
referralOfferLabel: products?.[0]?.inviter_reward_amount != null ? formatMoney(products[0].inviter_reward_amount, products[0].reward_currency) : stripeEnabled && pricesPending ? /* @__PURE__ */ jsx(
|
|
95
|
+
"span",
|
|
96
|
+
{
|
|
97
|
+
"aria-hidden": "true",
|
|
98
|
+
className: "inline-block h-4 w-12 animate-pulse rounded bg-muted align-middle"
|
|
99
|
+
}
|
|
100
|
+
) : "\u2014",
|
|
83
101
|
onInvite: () => setShowInvite(true),
|
|
84
102
|
inviteStep: {
|
|
85
103
|
active: showInvite,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/connection/billing/ConnectedWelcomeDialog.tsx"],
|
|
4
|
-
"sourcesContent": ["/**\n * Free users choose Free or Pro directly in the greeting, with a Monthly/Annual\n * toggle for their Free project. Payment is followed by persisted spending-limit\n * setup; referrals stay inside the greeting dialog.\n */\n\nimport { useMemo, useState } from 'react'\nimport type { LucideIcon } from 'lucide-react'\nimport { useArbiSession, useProducts, useProjects } from '@arbidocs/react'\nimport { useNotify } from '@arbidocs/react/shell'\nimport { useBlocksEnvironment } from '../../provider/environment'\nimport { PlanBadge } from '../../settings/PlanBadge'\nimport { WelcomeDialog } from '../../settings/WelcomeDialog'\nimport { ConnectedWelcomeInvitations } from '../contacts/ConnectedWelcomeInvitations'\nimport { SubscriptionPlans } from './SubscriptionPlans'\nimport { planBadgeView } from './plan-badge'\nimport { findProPrices, packPrice } from './plan-pricing'\nimport { aiUsageResetTimestamp, formatResetDate, getQuotaItems } from './quota-items'\nimport { formatMoney, useRewardBalance } from './reward-balance'\n\nexport interface ConnectedWelcomeDialogProps {\n open: boolean\n onOpenChange: (open: boolean) => void\n}\n\nexport function ConnectedWelcomeDialog({\n open,\n onOpenChange: setOpen,\n}: ConnectedWelcomeDialogProps) {\n const environment = useBlocksEnvironment()\n const currentUser = useArbiSession().user\n const { data: projects } = useProjects()\n const balance = useRewardBalance()\n const { data: products } = useProducts({ enabled:
|
|
5
|
-
"mappings": ";
|
|
4
|
+
"sourcesContent": ["/**\n * Free users choose Free or Pro directly in the greeting, with a Monthly/Annual\n * toggle for their Free project. Payment is followed by persisted spending-limit\n * setup; referrals stay inside the greeting dialog.\n */\n\nimport { useMemo, useState } from 'react'\nimport type { LucideIcon } from 'lucide-react'\nimport { useArbiSession, useProducts, useProjects } from '@arbidocs/react'\nimport { useNotify } from '@arbidocs/react/shell'\nimport { useBlocksEnvironment } from '../../provider/environment'\nimport { PlanBadge } from '../../settings/PlanBadge'\nimport { WelcomeDialog } from '../../settings/WelcomeDialog'\nimport { ConnectedWelcomeInvitations } from '../contacts/ConnectedWelcomeInvitations'\nimport { SubscriptionPlans } from './SubscriptionPlans'\nimport { useBillingSupport } from './support'\nimport { Button } from '@arbidocs/react/ui'\nimport { planBadgeView } from './plan-badge'\nimport { findProPrices, packPrice } from './plan-pricing'\nimport { aiUsageResetTimestamp, formatResetDate, getQuotaItems } from './quota-items'\nimport { formatMoney, useRewardBalance } from './reward-balance'\n\nexport interface ConnectedWelcomeDialogProps {\n open: boolean\n onOpenChange: (open: boolean) => void\n}\n\nexport function ConnectedWelcomeDialog({\n open,\n onOpenChange: setOpen,\n}: ConnectedWelcomeDialogProps) {\n const environment = useBlocksEnvironment()\n const currentUser = useArbiSession().user\n const { data: projects } = useProjects()\n const balance = useRewardBalance()\n const { stripeEnabled } = useBillingSupport()\n // Prefetched with the session (ConnectedAppRuntime), so this is normally a cache read.\n const { data: products, isPending: pricesPending } = useProducts({ enabled: stripeEnabled })\n // Invites return to the same subscription chooser without discarding its selection.\n const [showInvite, setShowInvite] = useState(false)\n\n // The initial Free-plan screen targets the owned personal project without a selector.\n const ownedProjects = useMemo(\n () => (projects ?? []).filter((p) => p.created_by === currentUser?.external_id),\n [projects, currentUser?.external_id]\n )\n const selectedProject = ownedProjects.find((p) => p.is_personal) ?? ownedProjects[0]\n\n if (!selectedProject) return null\n\n const handleOpenChange = (next: boolean) => {\n if (!next) {\n setShowInvite(false)\n }\n setOpen(next)\n }\n\n const dismiss = () => {\n handleOpenChange(false)\n const title = 'Upgrade anytime under Subscriptions and Usage'\n // Keep one reminder rather than adding another every time plans are closed.\n if (useNotify.getState().notifications.some((n) => n.title === title)) return\n environment.notify(title, 'info', {\n ambient: false,\n href: environment.hrefFor({ kind: 'settings', section: 'usage' }),\n action: { label: 'View subscriptions', onClick: () => environment.openDialog('welcome') },\n })\n }\n\n const { monthly } = findProPrices(products)\n const monthlyExVat = packPrice(monthly)?.amount_ex_vat ?? monthly?.amount_ex_vat\n const firstName = currentUser?.given_name\n const hasBalance = balance !== null\n const quotaItems = getQuotaItems(selectedProject.quotas)\n // When the AI budget refills: the billing period for subscribed projects,\n // the signup-anniversary stamp for free ones (future dates only). Rendered\n // inline after the label \u2014 \"AI credits (resets Aug 31, 2026)\".\n const resetTs = aiUsageResetTimestamp(selectedProject)\n const aiUsageHint = resetTs ? `resets ${formatResetDate(resetTs)}` : undefined\n\n return (\n <WelcomeDialog\n open={open}\n onClose={dismiss}\n firstName={firstName}\n hasReward={hasBalance}\n planBadge={<PlanBadge {...planBadgeView(selectedProject)} size=\"md\" />}\n quotas={quotaItems.map((q) => ({\n key: q.key,\n icon: q.icon as LucideIcon,\n label: q.label,\n value: q.usedOfLimit,\n pct: q.pct,\n hint: q.key === 'ai-usage' ? aiUsageHint : undefined,\n }))}\n subscriptionChoices={\n !stripeEnabled ? (\n <Button\n type=\"button\"\n variant=\"outline\"\n onClick={dismiss}\n data-testid=\"welcome-modal-dismiss\"\n >\n Continue\n </Button>\n ) : (\n <SubscriptionPlans\n key={selectedProject.external_id}\n projectExtId={selectedProject.external_id}\n currentQuotas={selectedProject.quotas}\n enabled={open}\n onDismiss={dismiss}\n onCompleted={() => handleOpenChange(false)}\n />\n )\n }\n proMonthlyPriceLabel={\n monthlyExVat != null ? formatMoney(monthlyExVat, monthly?.currency ?? 'gbp') : undefined\n }\n referralOfferLabel={\n products?.[0]?.inviter_reward_amount != null ? (\n formatMoney(products[0].inviter_reward_amount, products[0].reward_currency)\n ) : stripeEnabled && pricesPending ? (\n <span\n aria-hidden=\"true\"\n className=\"inline-block h-4 w-12 animate-pulse rounded bg-muted align-middle\"\n />\n ) : (\n '\u2014'\n )\n }\n onInvite={() => setShowInvite(true)}\n inviteStep={{\n active: showInvite,\n onBack: () => setShowInvite(false),\n content: (\n <ConnectedWelcomeInvitations\n currentUserExtId={currentUser?.external_id ?? ''}\n onBack={() => setShowInvite(false)}\n onNavigate={() => handleOpenChange(false)}\n />\n ),\n }}\n rewardBalanceLabel={hasBalance ? formatMoney(balance.amount, balance.currency) : undefined}\n labels={{ emptyBalance: formatMoney(0, products?.[0]?.reward_currency ?? monthly?.currency) }}\n />\n )\n}\n"],
|
|
5
|
+
"mappings": ";AAsFiB;AAhFjB,SAAS,SAAS,gBAAgB;AAElC,SAAS,gBAAgB,aAAa,mBAAmB;AACzD,SAA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OACtC,YAAY,SAAS,CAAC,EAAE,uBAAuB,SAAS,CAAC,EAAE,eAAe,IACxE,iBAAiB,gBACnB;AAAA,QAAC;AAAA;AAAA,UACC,eAAY;AAAA,UACZ,WAAU;AAAA;AAAA,MACZ,IAEA;AAAA,MAGJ,UAAU,MAAM,cAAc,IAAI;AAAA,MAClC,YAAY;AAAA,QACV,QAAQ;AAAA,QACR,QAAQ,MAAM,cAAc,KAAK;AAAA,QACjC,SACE;AAAA,UAAC;AAAA;AAAA,YACC,kBAAkB,aAAa,eAAe;AAAA,YAC9C,QAAQ,MAAM,cAAc,KAAK;AAAA,YACjC,YAAY,MAAM,iBAAiB,KAAK;AAAA;AAAA,QAC1C;AAAA,MAEJ;AAAA,MACA,oBAAoB,aAAa,YAAY,QAAQ,QAAQ,QAAQ,QAAQ,IAAI;AAAA,MACjF,QAAQ,EAAE,cAAc,YAAY,GAAG,WAAW,CAAC,GAAG,mBAAmB,SAAS,QAAQ,EAAE;AAAA;AAAA,EAC9F;AAEJ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -11,6 +11,7 @@ import {
|
|
|
11
11
|
useIsSlow
|
|
12
12
|
} from "@arbidocs/react";
|
|
13
13
|
import { StripeCheckoutModal } from "./StripeCheckoutModal.js";
|
|
14
|
+
import { PlanPricesSkeleton } from "./PlanPricesSkeleton.js";
|
|
14
15
|
import { ProjectPurchaseOptions } from "./ProjectPurchaseOptions.js";
|
|
15
16
|
import { notify } from "@arbidocs/react/shell";
|
|
16
17
|
import { useBillingSupport } from "./support.js";
|
|
@@ -41,7 +42,7 @@ function NewProjectFlow({
|
|
|
41
42
|
const paymentCompleted = useRef(false);
|
|
42
43
|
const attempt = useRef(0);
|
|
43
44
|
const { stripeEnabled } = useBillingSupport();
|
|
44
|
-
const { data: products,
|
|
45
|
+
const { data: products, isPending: productsLoading } = useProducts({ enabled: stripeEnabled });
|
|
45
46
|
const createProject = useCreateProject();
|
|
46
47
|
const deleteProject = useDeleteProject();
|
|
47
48
|
const refreshProject = useRefreshProject();
|
|
@@ -146,19 +147,7 @@ function NewProjectFlow({
|
|
|
146
147
|
}
|
|
147
148
|
)
|
|
148
149
|
] }),
|
|
149
|
-
stripeEnabled && (productsLoading ? /* @__PURE__ */
|
|
150
|
-
/* @__PURE__ */ jsx(PlanNotice, { children: "Loading prices\u2026" }),
|
|
151
|
-
/* @__PURE__ */ jsx(
|
|
152
|
-
Button,
|
|
153
|
-
{
|
|
154
|
-
type: "button",
|
|
155
|
-
variant: "outline",
|
|
156
|
-
disabled: !canSubmit,
|
|
157
|
-
onClick: () => create(void 0, void 0, void 0, "free"),
|
|
158
|
-
children: "Stay on Free"
|
|
159
|
-
}
|
|
160
|
-
)
|
|
161
|
-
] }) : /* @__PURE__ */ jsx(
|
|
150
|
+
stripeEnabled && (productsLoading ? /* @__PURE__ */ jsx(PlanPricesSkeleton, {}) : /* @__PURE__ */ jsx(
|
|
162
151
|
ProjectPurchaseOptions,
|
|
163
152
|
{
|
|
164
153
|
products,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/connection/billing/NewProjectFlow.tsx"],
|
|
4
|
-
"sourcesContent": ["/** Name the project, then choose monthly or annual payment. Stripe confirms payment. */\nimport { useEffect, useRef, useState } from 'react'\nimport { Button, Input, Label, entityNoun, getEntityLabel } from '@arbidocs/react/ui'\nimport { ModalScaffold, PlanActionButton, PlanNotice, PlanStack } from '../../settings'\nimport {\n useProducts,\n useCreateProject,\n useDeleteProject,\n useRefreshProject,\n useIsSlow,\n} from '@arbidocs/react'\nimport { StripeCheckoutModal } from './StripeCheckoutModal'\nimport { ProjectPurchaseOptions } from './ProjectPurchaseOptions'\nimport { notify } from '@arbidocs/react/shell'\nimport { useBillingSupport } from './support'\nimport { apiErrorDetail } from './api-error'\nimport { refusal } from './refusal-copy'\nimport { findProPrices, type PlanInterval } from './plan-pricing'\nimport type { TaxQuote } from './tax-quote'\n\nfunction createProjectErrorMessage(\n error: unknown,\n fallback = `Failed to create ${entityNoun('PROJECT')}`\n): string {\n const detail = apiErrorDetail(error)\n if (typeof detail === 'string' && detail) return detail\n const message = (detail as { message?: unknown } | null)?.message\n return typeof message === 'string' && message ? message : fallback\n}\n\ninterface NewProjectFlowProps {\n open: boolean\n onOpenChange: (open: boolean) => void\n defaultName: string\n onProjectCreated?: (project: { external_id: string }) => void\n}\n\nexport function NewProjectFlow({\n open,\n onOpenChange,\n defaultName,\n onProjectCreated,\n}: NewProjectFlowProps) {\n const [projectName, setProjectName] = useState(defaultName)\n const [promoCode, setPromoCode] = useState('')\n const [checkoutPromoCode, setCheckoutPromoCode] = useState<string>()\n const [isCreating, setIsCreating] = useState(false)\n const isSlow = useIsSlow(isCreating)\n const [checkoutOpen, setCheckoutOpen] = useState(false)\n const [checkoutProject, setCheckoutProject] = useState<{ id: string; name: string } | null>(null)\n const [checkoutInterval, setCheckoutInterval] = useState<PlanInterval>('month')\n const [checkoutQuote, setCheckoutQuote] = useState<TaxQuote>()\n const paymentCompleted = useRef(false)\n const attempt = useRef(0)\n const { stripeEnabled } = useBillingSupport()\n const { data: products,
|
|
5
|
-
"mappings": ";
|
|
4
|
+
"sourcesContent": ["/** Name the project, then choose monthly or annual payment. Stripe confirms payment. */\nimport { useEffect, useRef, useState } from 'react'\nimport { Button, Input, Label, entityNoun, getEntityLabel } from '@arbidocs/react/ui'\nimport { ModalScaffold, PlanActionButton, PlanNotice, PlanStack } from '../../settings'\nimport {\n useProducts,\n useCreateProject,\n useDeleteProject,\n useRefreshProject,\n useIsSlow,\n} from '@arbidocs/react'\nimport { StripeCheckoutModal } from './StripeCheckoutModal'\nimport { PlanPricesSkeleton } from './PlanPricesSkeleton'\nimport { ProjectPurchaseOptions } from './ProjectPurchaseOptions'\nimport { notify } from '@arbidocs/react/shell'\nimport { useBillingSupport } from './support'\nimport { apiErrorDetail } from './api-error'\nimport { refusal } from './refusal-copy'\nimport { findProPrices, type PlanInterval } from './plan-pricing'\nimport type { TaxQuote } from './tax-quote'\n\nfunction createProjectErrorMessage(\n error: unknown,\n fallback = `Failed to create ${entityNoun('PROJECT')}`\n): string {\n const detail = apiErrorDetail(error)\n if (typeof detail === 'string' && detail) return detail\n const message = (detail as { message?: unknown } | null)?.message\n return typeof message === 'string' && message ? message : fallback\n}\n\ninterface NewProjectFlowProps {\n open: boolean\n onOpenChange: (open: boolean) => void\n defaultName: string\n onProjectCreated?: (project: { external_id: string }) => void\n}\n\nexport function NewProjectFlow({\n open,\n onOpenChange,\n defaultName,\n onProjectCreated,\n}: NewProjectFlowProps) {\n const [projectName, setProjectName] = useState(defaultName)\n const [promoCode, setPromoCode] = useState('')\n const [checkoutPromoCode, setCheckoutPromoCode] = useState<string>()\n const [isCreating, setIsCreating] = useState(false)\n const isSlow = useIsSlow(isCreating)\n const [checkoutOpen, setCheckoutOpen] = useState(false)\n const [checkoutProject, setCheckoutProject] = useState<{ id: string; name: string } | null>(null)\n const [checkoutInterval, setCheckoutInterval] = useState<PlanInterval>('month')\n const [checkoutQuote, setCheckoutQuote] = useState<TaxQuote>()\n const paymentCompleted = useRef(false)\n const attempt = useRef(0)\n const { stripeEnabled } = useBillingSupport()\n const { data: products, isPending: productsLoading } = useProducts({ enabled: stripeEnabled })\n const createProject = useCreateProject()\n const deleteProject = useDeleteProject()\n const refreshProject = useRefreshProject()\n\n useEffect(() => {\n if (!open) return\n setProjectName(defaultName)\n setPromoCode('')\n setIsCreating(false)\n }, [open, defaultName])\n\n const close = () => {\n attempt.current += 1\n setIsCreating(false)\n onOpenChange(false)\n }\n const handleCheckoutOpenChange = (nextOpen: boolean) => {\n setCheckoutOpen(nextOpen)\n if (nextOpen) return\n if (checkoutProject && !paymentCompleted.current) {\n deleteProject.mutate(checkoutProject.id, {\n onSuccess: () =>\n notify.info(\n `Payment not completed. Nothing was charged and \"${checkoutProject.name}\" wasn't created.`\n ),\n onError: () => {\n // A paid or uncertain checkout must never be discarded. Sync it and let persisted setup resume.\n refreshProject.mutate(checkoutProject.id)\n notify.info('Your project was kept while payment status is checked.')\n },\n })\n }\n setCheckoutProject(null)\n paymentCompleted.current = false\n }\n const chosenName = stripeEnabled\n ? defaultName.trim() || getEntityLabel('PROJECT')\n : projectName.trim()\n const canSubmit = !!chosenName && !isCreating && !createProject.isPending\n const create = (\n interval?: PlanInterval,\n _capPence?: number,\n quote?: TaxQuote,\n plan: 'free' | 'pro' = stripeEnabled ? 'pro' : 'free'\n ) => {\n if (!canSubmit) return\n const currentAttempt = ++attempt.current\n setIsCreating(true)\n createProject.mutate(\n {\n name: chosenName,\n plan,\n daily_cap_per_user: plan === 'pro' ? 0 : null,\n },\n {\n onSuccess: (project) => {\n if (currentAttempt !== attempt.current) {\n // The user cancelled while creation was in flight; no checkout or charge was started.\n deleteProject.mutate(project.external_id)\n return\n }\n setIsCreating(false)\n onProjectCreated?.(project)\n if (plan === 'free') {\n notify.success(`${getEntityLabel('PROJECT')} created`)\n onOpenChange(false)\n return\n }\n paymentCompleted.current = false\n setCheckoutProject({ id: project.external_id, name: project.name })\n setCheckoutInterval(interval ?? 'month')\n setCheckoutQuote(quote)\n setCheckoutPromoCode(promoCode.trim() || undefined)\n setCheckoutOpen(true)\n onOpenChange(false)\n },\n onError: (error) => {\n setIsCreating(false)\n if (currentAttempt !== attempt.current) return\n notify.error(\n stripeEnabled\n ? refusal(\n `\"${chosenName}\" wasn't created`,\n createProjectErrorMessage(error, 'Try again')\n )\n : createProjectErrorMessage(error)\n )\n },\n }\n )\n }\n\n return (\n <>\n <ModalScaffold\n open={open}\n onOpenChange={(next) => (next ? onOpenChange(true) : close())}\n title={`New ${entityNoun('PROJECT')}`}\n description={\n stripeEnabled\n ? 'Choose Free or Pro. Set your project name and spending limits after payment.'\n : 'Name your project.'\n }\n size=\"md\"\n className={stripeEnabled ? 'project-purchase-modal sm:max-w-[640px]' : undefined}\n >\n <PlanStack gap={4}>\n {!stripeEnabled && (\n <div className=\"space-y-2\">\n <Label htmlFor=\"new-project-name\">Name</Label>\n <Input\n id=\"new-project-name\"\n value={projectName}\n onChange={(event) => setProjectName(event.target.value)}\n placeholder={`My ${getEntityLabel('PROJECT')}`}\n autoFocus\n onKeyDown={(event) => {\n if (event.key === 'Enter' && !stripeEnabled) create()\n }}\n />\n </div>\n )}\n {stripeEnabled &&\n (productsLoading ? (\n <PlanPricesSkeleton />\n ) : (\n <ProjectPurchaseOptions\n products={products}\n promoCode={promoCode}\n onPromoCodeChange={setPromoCode}\n disabled={!canSubmit}\n busy={isCreating}\n enabled={open}\n onChoose={create}\n onChooseFree={() => create(undefined, undefined, undefined, 'free')}\n />\n ))}\n <div className=\"flex items-center justify-end gap-2\">\n <Button variant=\"ghost\" onClick={close}>\n Cancel\n </Button>\n {!stripeEnabled && (\n <PlanActionButton onClick={() => create()} disabled={!canSubmit}>\n {isCreating ? 'Creating\u2026' : `Create ${entityNoun('PROJECT')}`}\n </PlanActionButton>\n )}\n </div>\n {isSlow && (\n <PlanNotice className=\"text-xs\" testId=\"new-project-still-working\">\n Still working. We'll update here.\n </PlanNotice>\n )}\n </PlanStack>\n </ModalScaffold>\n {checkoutProject && (\n <StripeCheckoutModal\n promoCode={checkoutPromoCode}\n price={findProPrices(products)[checkoutInterval === 'year' ? 'annual' : 'monthly']}\n projectExtId={checkoutProject.id}\n interval={checkoutInterval}\n addonBudgetPence={0}\n requireSpendLimitConfirmation\n quote={checkoutQuote}\n open={checkoutOpen}\n onOpenChange={handleCheckoutOpenChange}\n onCompleted={() => {\n paymentCompleted.current = true\n }}\n />\n )}\n </>\n )\n}\n"],
|
|
5
|
+
"mappings": ";AAsJI,mBAgBU,KADF,YAfR;AArJJ,SAAS,WAAW,QAAQ,gBAAgB;AAC5C,SAAS,QAAQ,OAAO,OAAO,YAAY,sBAAsB;AACjE,SAAS,eAAe,kBAAkB,YAAY,iBAAiB;AACvE;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,2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cACX,MAAM;AAAA,cACN,SAAS;AAAA,cACT,UAAU;AAAA,cACV,cAAc,MAAM,OAAO,QAAW,QAAW,QAAW,MAAM;AAAA;AAAA,UACpE;AAAA,UAEJ,qBAAC,SAAI,WAAU,uCACb;AAAA,gCAAC,UAAO,SAAQ,SAAQ,SAAS,OAAO,oBAExC;AAAA,YACC,CAAC,iBACA,oBAAC,oBAAiB,SAAS,MAAM,OAAO,GAAG,UAAU,CAAC,WACnD,uBAAa,mBAAc,UAAU,WAAW,SAAS,CAAC,IAC7D;AAAA,aAEJ;AAAA,UACC,UACC,oBAAC,cAAW,WAAU,WAAU,QAAO,6BAA4B,+CAEnE;AAAA,WAEJ;AAAA;AAAA,IACF;AAAA,IACC,mBACC;AAAA,MAAC;AAAA;AAAA,QACC,WAAW;AAAA,QACX,OAAO,cAAc,QAAQ,EAAE,qBAAqB,SAAS,WAAW,SAAS;AAAA,QACjF,cAAc,gBAAgB;AAAA,QAC9B,UAAU;AAAA,QACV,kBAAkB;AAAA,QAClB,+BAA6B;AAAA,QAC7B,OAAO;AAAA,QACP,MAAM;AAAA,QACN,cAAc;AAAA,QACd,aAAa,MAAM;AACjB,2BAAiB,UAAU;AAAA,QAC7B;AAAA;AAAA,IACF;AAAA,KAEJ;AAEJ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { cn } from "@arbidocs/react/ui";
|
|
4
|
+
function Bar({ className }) {
|
|
5
|
+
return /* @__PURE__ */ jsx("div", { "aria-hidden": "true", className: cn("animate-pulse rounded bg-muted", className) });
|
|
6
|
+
}
|
|
7
|
+
function Card() {
|
|
8
|
+
return /* @__PURE__ */ jsxs(
|
|
9
|
+
"div",
|
|
10
|
+
{
|
|
11
|
+
"aria-hidden": "true",
|
|
12
|
+
className: "flex min-w-0 flex-col gap-3 rounded-[10px] border border-secondary/30 bg-secondary/5 px-3.5 py-2.5",
|
|
13
|
+
style: { minHeight: 330 },
|
|
14
|
+
children: [
|
|
15
|
+
/* @__PURE__ */ jsx(Bar, { className: "h-8 w-full" }),
|
|
16
|
+
/* @__PURE__ */ jsx(Bar, { className: "h-4 w-4/5" }),
|
|
17
|
+
/* @__PURE__ */ jsx(Bar, { className: "h-4 w-3/5" }),
|
|
18
|
+
/* @__PURE__ */ jsx(Bar, { className: "h-4 w-2/3" }),
|
|
19
|
+
/* @__PURE__ */ jsx(Bar, { className: "mt-auto h-6 w-1/3" })
|
|
20
|
+
]
|
|
21
|
+
}
|
|
22
|
+
);
|
|
23
|
+
}
|
|
24
|
+
function PlanPricesSkeleton({ cards = 2 }) {
|
|
25
|
+
return /* @__PURE__ */ jsx(
|
|
26
|
+
"div",
|
|
27
|
+
{
|
|
28
|
+
role: "status",
|
|
29
|
+
"aria-busy": "true",
|
|
30
|
+
"aria-label": "Loading prices",
|
|
31
|
+
"data-testid": "plan-prices-skeleton",
|
|
32
|
+
className: cn("grid gap-2.5", cards === 2 ? "grid-cols-2" : "grid-cols-1"),
|
|
33
|
+
children: Array.from({ length: cards }, (_, i) => /* @__PURE__ */ jsx(Card, {}, i))
|
|
34
|
+
}
|
|
35
|
+
);
|
|
36
|
+
}
|
|
37
|
+
export {
|
|
38
|
+
PlanPricesSkeleton
|
|
39
|
+
};
|
|
40
|
+
//# sourceMappingURL=PlanPricesSkeleton.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/connection/billing/PlanPricesSkeleton.tsx"],
|
|
4
|
+
"sourcesContent": ["/**\n * What the plan chooser shows until its prices arrive: the same two cards (Free, Pro) the chooser\n * renders, as quiet placeholders of the same size, so the prices fill in without the dialog\n * resizing or any empty or error text appearing first. One implementation for every host.\n */\nimport { cn } from '@arbidocs/react/ui'\n\nfunction Bar({ className }: { className: string }) {\n return <div aria-hidden=\"true\" className={cn('animate-pulse rounded bg-muted', className)} />\n}\n\nfunction Card() {\n return (\n <div\n aria-hidden=\"true\"\n className=\"flex min-w-0 flex-col gap-3 rounded-[10px] border border-secondary/30 bg-secondary/5 px-3.5 py-2.5\"\n style={{ minHeight: 330 }}\n >\n <Bar className=\"h-8 w-full\" />\n <Bar className=\"h-4 w-4/5\" />\n <Bar className=\"h-4 w-3/5\" />\n <Bar className=\"h-4 w-2/3\" />\n <Bar className=\"mt-auto h-6 w-1/3\" />\n </div>\n )\n}\n\nexport function PlanPricesSkeleton({ cards = 2 }: { cards?: 1 | 2 }) {\n return (\n <div\n role=\"status\"\n aria-busy=\"true\"\n aria-label=\"Loading prices\"\n data-testid=\"plan-prices-skeleton\"\n className={cn('grid gap-2.5', cards === 2 ? 'grid-cols-2' : 'grid-cols-1')}\n >\n {Array.from({ length: cards }, (_, i) => (\n <Card key={i} />\n ))}\n </div>\n )\n}\n"],
|
|
5
|
+
"mappings": ";AAQS,cAKL,YALK;AAHT,SAAS,UAAU;AAEnB,SAAS,IAAI,EAAE,UAAU,GAA0B;AACjD,SAAO,oBAAC,SAAI,eAAY,QAAO,WAAW,GAAG,kCAAkC,SAAS,GAAG;AAC7F;AAEA,SAAS,OAAO;AACd,SACE;AAAA,IAAC;AAAA;AAAA,MACC,eAAY;AAAA,MACZ,WAAU;AAAA,MACV,OAAO,EAAE,WAAW,IAAI;AAAA,MAExB;AAAA,4BAAC,OAAI,WAAU,cAAa;AAAA,QAC5B,oBAAC,OAAI,WAAU,aAAY;AAAA,QAC3B,oBAAC,OAAI,WAAU,aAAY;AAAA,QAC3B,oBAAC,OAAI,WAAU,aAAY;AAAA,QAC3B,oBAAC,OAAI,WAAU,qBAAoB;AAAA;AAAA;AAAA,EACrC;AAEJ;AAEO,SAAS,mBAAmB,EAAE,QAAQ,EAAE,GAAsB;AACnE,SACE;AAAA,IAAC;AAAA;AAAA,MACC,MAAK;AAAA,MACL,aAAU;AAAA,MACV,cAAW;AAAA,MACX,eAAY;AAAA,MACZ,WAAW,GAAG,gBAAgB,UAAU,IAAI,gBAAgB,aAAa;AAAA,MAExE,gBAAM,KAAK,EAAE,QAAQ,MAAM,GAAG,CAAC,GAAG,MACjC,oBAAC,UAAU,CAAG,CACf;AAAA;AAAA,EACH;AAEJ;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -6,5 +6,5 @@ interface SubscriptionPlansProps {
|
|
|
6
6
|
onCompleted?: () => void;
|
|
7
7
|
enabled?: boolean;
|
|
8
8
|
}
|
|
9
|
-
export declare function SubscriptionPlans({ projectExtId, currentQuotas, onDismiss, onCompleted, enabled, }: SubscriptionPlansProps): import("react").JSX.Element;
|
|
9
|
+
export declare function SubscriptionPlans({ projectExtId, currentQuotas, onDismiss, onCompleted, enabled, }: SubscriptionPlansProps): import("react").JSX.Element | null;
|
|
10
10
|
export {};
|
|
@@ -5,6 +5,8 @@ import { Button } from "@arbidocs/react/ui";
|
|
|
5
5
|
import { ArrowRight } from "lucide-react";
|
|
6
6
|
import { PlanNotice } from "../../settings/index.js";
|
|
7
7
|
import { useProducts } from "@arbidocs/react";
|
|
8
|
+
import { PlanPricesSkeleton } from "./PlanPricesSkeleton.js";
|
|
9
|
+
import { useBillingSupport } from "./support.js";
|
|
8
10
|
import { StripeCheckoutModal } from "./StripeCheckoutModal.js";
|
|
9
11
|
import { ProjectPurchaseOptions } from "./ProjectPurchaseOptions.js";
|
|
10
12
|
import { findProPrices } from "./plan-pricing.js";
|
|
@@ -15,16 +17,27 @@ function SubscriptionPlans({
|
|
|
15
17
|
onCompleted,
|
|
16
18
|
enabled = true
|
|
17
19
|
}) {
|
|
18
|
-
const {
|
|
20
|
+
const { stripeEnabled } = useBillingSupport();
|
|
21
|
+
const {
|
|
22
|
+
data: products,
|
|
23
|
+
isPending,
|
|
24
|
+
error,
|
|
25
|
+
refetch
|
|
26
|
+
} = useProducts({ enabled: enabled && stripeEnabled });
|
|
19
27
|
const [promoCode, setPromoCode] = useState("");
|
|
20
28
|
const [checkout, setCheckout] = useState(null);
|
|
21
29
|
const [checkoutOpen, setCheckoutOpen] = useState(false);
|
|
22
|
-
if (
|
|
30
|
+
if (!stripeEnabled) return null;
|
|
31
|
+
if (isPending) return /* @__PURE__ */ jsx(PlanPricesSkeleton, {});
|
|
32
|
+
if (error || !products?.length)
|
|
23
33
|
return /* @__PURE__ */ jsxs("div", { className: "space-y-3", children: [
|
|
24
|
-
/* @__PURE__ */ jsx(PlanNotice, { tone: error ? "error" : void 0, children:
|
|
25
|
-
|
|
26
|
-
"
|
|
27
|
-
/* @__PURE__ */
|
|
34
|
+
/* @__PURE__ */ jsx(PlanNotice, { tone: error ? "error" : void 0, children: error ? "Prices didn't load. Try again." : "No subscriptions available." }),
|
|
35
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-wrap gap-2", children: [
|
|
36
|
+
error && /* @__PURE__ */ jsx(Button, { type: "button", variant: "outline", onClick: () => void refetch(), children: "Try again" }),
|
|
37
|
+
onDismiss && /* @__PURE__ */ jsxs(Button, { type: "button", variant: "outline", onClick: onDismiss, children: [
|
|
38
|
+
"Stay on Free ",
|
|
39
|
+
/* @__PURE__ */ jsx(ArrowRight, { "aria-hidden": "true", size: 16 })
|
|
40
|
+
] })
|
|
28
41
|
] })
|
|
29
42
|
] });
|
|
30
43
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|