@hot-updater/console 1.0.0-rc.4 → 1.0.0-rc.41
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/.output/nitro.json +1 -1
- package/.output/public/assets/ConsoleFeatureUnavailable-DRzeMGRM.js +1 -0
- package/.output/public/assets/EventDetails-SB5ygJzS.js +1 -0
- package/.output/public/assets/HashValueDisplay-BFX_kY3-.js +1 -0
- package/.output/public/assets/InsightsInfo-btYppp0B.js +1 -0
- package/.output/public/assets/InsightsPageHeader-Ba8psD8t.js +1 -0
- package/.output/public/assets/NotFoundPage-CyRG2eca.js +1 -0
- package/.output/public/assets/alert-dialog-Bbk_4-WJ.js +1 -0
- package/.output/public/assets/api-DUgI6yOI.js +1 -0
- package/.output/public/assets/api-keys-CIO9L_wu.js +1 -0
- package/.output/public/assets/api-keys-CmkNKOhS.js +1 -0
- package/.output/public/assets/arrow-left-CnMYpqB7.js +1 -0
- package/.output/public/assets/arrow-up-right-BtffZA6e.js +1 -0
- package/.output/public/assets/chevron-right-BqD5wtFb.js +1 -0
- package/.output/public/assets/clipboard-DS9ucUQL.js +1 -0
- package/.output/public/assets/console-features-api-BMsI3Bj8.js +1 -0
- package/.output/public/assets/dialog-Bqbb7B0N.js +1 -0
- package/.output/public/assets/dist-LxKJB-Vu.js +1 -0
- package/.output/public/assets/empty-CuT2UhFp.js +1 -0
- package/.output/public/assets/field-BBDpjIqu.js +1 -0
- package/.output/public/assets/index-BEfQ2_7f.js +11 -0
- package/.output/public/assets/input-group-ja_30qaF.js +1 -0
- package/.output/public/assets/insights-B0ib9qOE.js +2 -0
- package/.output/public/assets/insights-BIMJx-0p.js +1 -0
- package/.output/public/assets/insights-CndqcWEj.js +42 -0
- package/.output/public/assets/insights-api-B6Ewc-OG.js +1 -0
- package/.output/public/assets/insights-usage-rpc-DYEhsCKT.js +1 -0
- package/.output/public/assets/insights_.distribution-B26PMy4k.js +2 -0
- package/.output/public/assets/insights_.distribution-BBDtqqYS.js +1 -0
- package/.output/public/assets/insights_.distribution-DhHmYS8k.js +1 -0
- package/.output/public/assets/installations-C3cMuwRx.js +1 -0
- package/.output/public/assets/installations-C3yrjwDh.js +2 -0
- package/.output/public/assets/installations-D3edlN75.js +1 -0
- package/.output/public/assets/key-round-wS_SIZ6b.js +1 -0
- package/.output/public/assets/list-CgrYiadM.js +1 -0
- package/.output/public/assets/refresh-cw-BYgoNCco.js +1 -0
- package/.output/public/assets/remote-config-0i-gDkeU.js +1 -0
- package/.output/public/assets/remote-config-An1ROIOQ.js +6 -0
- package/.output/public/assets/remote-config-CoeWgA9i.js +1 -0
- package/.output/public/assets/routes-DNoaJIQV.js +2 -0
- package/.output/public/assets/routes-cWBDtghZ.js +1 -0
- package/.output/public/assets/search-DaTDPW25.js +1 -0
- package/.output/public/assets/select-CZMQKT7F.js +1 -0
- package/.output/public/assets/sidebar-DNVyJPfX.js +3 -0
- package/.output/public/assets/smartphone-DpTFgtKf.js +1 -0
- package/.output/public/assets/styles-D8mxMvCB.css +2 -0
- package/.output/public/assets/switch-CU4-fupc.js +1 -0
- package/.output/public/assets/table-Gm4qRWwE.js +1 -0
- package/.output/public/assets/tabs-R1I8CRjR.js +1 -0
- package/.output/public/assets/undo-2-CmrHjwFc.js +1 -0
- package/.output/public/assets/useCompositeListItem-BaPeC9ZO.js +1 -0
- package/.output/public/assets/valueToPercent-CH8GCHaL.js +1 -0
- package/.output/server/__23tanstack-start-server-fn-resolver-DTAqlLRd.mjs +178 -0
- package/.output/server/_libs/@base-ui/react+[...].mjs +6450 -2741
- package/.output/server/_libs/@tanstack/react-router+[...].mjs +3802 -4022
- package/.output/server/_libs/@tanstack/react-router-ssr-query+[...].mjs +140 -97
- package/.output/server/_libs/lucide-react.mjs +235 -31
- package/.output/server/_libs/next-themes.mjs +1 -1
- package/.output/server/_libs/react-redux+[...].mjs +1 -1
- package/.output/server/_libs/recharts+[...].mjs +483 -901
- package/.output/server/_libs/sonner.mjs +1 -1
- package/.output/server/_libs/tanstack__history.mjs +68 -41
- package/.output/server/_libs/tanstack__query-core.mjs +2010 -309
- package/.output/server/_libs/tanstack__react-query.mjs +448 -21
- package/.output/server/_libs/verkit.mjs +102 -1
- package/.output/server/_ssr/BundleIdDisplay-BNoVW3Dv.mjs +13 -0
- package/.output/server/_ssr/ConsoleFeatureUnavailable-BPFa-cmJ.mjs +58 -0
- package/.output/server/_ssr/EventDetails-9CeshfdR.mjs +344 -0
- package/.output/server/_ssr/HashValueDisplay-DXZlkcps.mjs +55 -0
- package/.output/server/_ssr/InsightsInfo-DLNdJQ0m.mjs +75 -0
- package/.output/server/_ssr/InsightsPageHeader-DZGVDgvv.mjs +145 -0
- package/.output/server/_ssr/NotFoundPage-mYHHg-2s.mjs +37 -0
- package/.output/server/_ssr/{dialog-DUaIgpgd.mjs → alert-dialog-Chkim7vZ.mjs} +6 -83
- package/.output/server/_ssr/api-C-Il5-sa.mjs +203 -0
- package/.output/server/_ssr/api-keys-01FGqj4d.mjs +5 -0
- package/.output/server/_ssr/{api-keys-DJml_XoK.mjs → api-keys-B_f9h7ln.mjs} +48 -10
- package/.output/server/_ssr/api-keys-rpc-Cf4YCyFc.mjs +52 -0
- package/.output/server/_ssr/api-rpc-DRqwxxT_.mjs +296 -0
- package/.output/server/_ssr/{auth-BF8mbAgF.mjs → auth-UP0wXs4i.mjs} +1 -1
- package/.output/server/_ssr/{auth-rpc-D_hv52-J.mjs → auth-rpc-D8nFpU9C.mjs} +6 -6
- package/.output/server/_ssr/auth.server-COZoXu4i.mjs +5425 -0
- package/.output/server/_ssr/bundleActivity-M5gzBFNg.mjs +18 -0
- package/.output/server/_ssr/config-WVX4IxSR.mjs +15 -0
- package/.output/server/_ssr/config.server-Dm2l7w0O.mjs +36 -0
- package/.output/server/_ssr/console-access--o9FXikU.mjs +17 -0
- package/.output/server/_ssr/console-features-BftSkf3f.mjs +60 -0
- package/.output/server/_ssr/console-features-api-CYclUQ4h.mjs +43 -0
- package/.output/server/_ssr/console-features-rpc-1WaAkPM_.mjs +19 -0
- package/.output/server/_ssr/{createServerFn-B2hcXoPM.mjs → createMiddleware-Cm6Tn0_Y.mjs} +67 -56
- package/.output/server/_ssr/{createServerRpc-DB29C_5p.mjs → createServerRpc-RLR4H-Fn.mjs} +2 -2
- package/.output/server/_ssr/databaseConfig-C5SkAyUy.mjs +5 -0
- package/.output/server/_ssr/{databaseJsonValue-d6I3nAS4.mjs → databaseJsonValue-Csbuzc9Q.mjs} +28 -5
- package/.output/server/_ssr/databaseRows-BUuNU-qt.mjs +74 -0
- package/.output/server/_ssr/dialog-mfSANqjC.mjs +84 -0
- package/.output/server/_ssr/{dist-CyzPaI5v.mjs → dist-wmnTk7w6.mjs} +140 -6
- package/.output/server/_ssr/{downloadBundle-B3ert-pY.mjs → downloadBundle-DViuIa9U.mjs} +10 -10
- package/.output/server/_ssr/empty-BPayFad3.mjs +60 -0
- package/.output/server/_ssr/{empty-plugin-adapters-B5QvGpEl.mjs → empty-plugin-adapters-CPtwX8a7.mjs} +1 -1
- package/.output/server/_ssr/failureReports-DKDhVsXA.mjs +33 -0
- package/.output/server/_ssr/field-DjZ5t7rH.mjs +189 -0
- package/.output/server/_ssr/getBundleChildren-CmjDg6Re.mjs +22 -0
- package/.output/server/_ssr/{input-group-Bb8ueylQ.mjs → input-group-Dx-MEkNM.mjs} +3 -52
- package/.output/server/_ssr/insights-BopxyJjk.mjs +14 -0
- package/.output/server/_ssr/insights-Bvm03d61.mjs +5 -0
- package/.output/server/_ssr/insights-CrLAHSDy.mjs +2315 -0
- package/.output/server/_ssr/insights-api-Bg8ZV_h_.mjs +122 -0
- package/.output/server/_ssr/insights-errors-BjnFUyZj.mjs +34 -0
- package/.output/server/_ssr/insights-failures-rpc-tyy5m9Cc.mjs +36 -0
- package/.output/server/_ssr/insights-failures-xaa41Buf.mjs +46 -0
- package/.output/server/_ssr/{insights-recovery-DSFM-YTL.mjs → insights-recovery-BWQhiZaF.mjs} +9 -2
- package/.output/server/_ssr/insights-recovery-rpc-CPJOiJAV.mjs +32 -0
- package/.output/server/_ssr/{insights-rpc-DrIQCjpD.mjs → insights-rpc-DoC3hla9.mjs} +22 -14
- package/.output/server/_ssr/insights-usage-BpBM0U0c.mjs +29 -0
- package/.output/server/_ssr/insights-usage-rpc-CFuTYp3T.mjs +29 -0
- package/.output/server/_ssr/insights-usage-rpc-O2ruP4iE.mjs +41 -0
- package/.output/server/_ssr/insightsUsage-CzhVjsc8.mjs +56 -0
- package/.output/server/_ssr/insights_.distribution-B3BVPD00.mjs +16 -0
- package/.output/server/_ssr/insights_.distribution-BMoisxRG.mjs +347 -0
- package/.output/server/_ssr/insights_.distribution-BiCcFyrG.mjs +7 -0
- package/.output/server/_ssr/{installations-YumqpNpa.mjs → installations-Cx3jIrwl.mjs} +280 -364
- package/.output/server/_ssr/installations-DTGPaKXx.mjs +69 -0
- package/.output/server/_ssr/installations-osiAuNKr.mjs +5 -0
- package/.output/server/_ssr/listReleases-BfUBlCHo.mjs +79 -0
- package/.output/server/_ssr/release-adoption-005tQRpo.mjs +55 -0
- package/.output/server/_ssr/release-adoption-rpc-BVySDR0L.mjs +41 -0
- package/.output/server/_ssr/releaseAdoption-2PJPA09N.mjs +114 -0
- package/.output/server/_ssr/releaseManagement-BTCWEY8-.mjs +11 -0
- package/.output/server/_ssr/remote-config-CUoAxUMy.mjs +430 -0
- package/.output/server/_ssr/remote-config-Cc5P4J-r.mjs +17 -0
- package/.output/server/_ssr/remote-config-CjdxcZ9B.mjs +5 -0
- package/.output/server/_ssr/remote-config-D2GmbGwI.mjs +2594 -0
- package/.output/server/_ssr/remote-config-rpc-kjoZ9PRS.mjs +115 -0
- package/.output/server/_ssr/rolldown-runtime-rSIU-vHC.mjs +13 -0
- package/.output/server/_ssr/{router-iP95Vqi2.mjs → router-DwGVewL-.mjs} +141 -139
- package/.output/server/_ssr/{routes-ivsV2TDu.mjs → routes-C4yxv3JU.mjs} +192 -685
- package/.output/server/_ssr/routes-D3_aegLY.mjs +409 -0
- package/.output/server/_ssr/runtime.server-BoWf4QhU.mjs +1716 -0
- package/.output/server/_ssr/schema-DrOtkRVD.mjs +361 -0
- package/.output/server/_ssr/select-DkzM2miy.mjs +107 -0
- package/.output/server/_ssr/server-BW0gzB0p.mjs +8325 -0
- package/.output/server/_ssr/{createSsrRpc-NHF2PxuK.mjs → sidebar-DPcOijvL.mjs} +107 -47
- package/.output/server/_ssr/ssr.mjs +1 -1
- package/.output/server/_ssr/start-BfFbHKMK.mjs +4 -0
- package/.output/server/_ssr/switch-BqJ2mAwC.mjs +17 -0
- package/.output/server/_ssr/{table-D1mL8fJu.mjs → table-R7RY92q9.mjs} +2 -2
- package/.output/server/_ssr/tabs-trDcbRkT.mjs +45 -0
- package/.output/server/_ssr/updateFailures-H6pnnYK4.mjs +40 -0
- package/.output/server/_ssr/{uuidv7-D0QFkPL_.mjs → uuidv7-ctA_XVZA.mjs} +2 -2
- package/.output/server/_tanstack-start-manifest_v-BwInaUTw.mjs +139 -0
- package/.output/server/index.mjs +315 -154
- package/LICENSE +13 -14
- package/README.md +82 -72
- package/lib/index.d.mts +23 -11
- package/lib/vite-internal.mjs +13 -3
- package/lib/vite.d.mts +2 -0
- package/package.json +14 -14
- package/src/components/AppSidebar.tsx +100 -71
- package/src/components/ConsoleAccessPage.tsx +5 -1
- package/src/components/ConsoleFeatureUnavailable.tsx +80 -0
- package/src/components/NotFoundPage.tsx +7 -7
- package/src/components/features/FeatureSlots.tsx +103 -0
- package/src/components/features/api-keys/apiKeysFeatureUi.tsx +15 -0
- package/src/components/features/bundles/BundleMetadata.tsx +8 -5
- package/src/components/features/bundles/RolloutCohortsDialog.tsx +1 -1
- package/src/components/features/channels/ChannelManagementDialog.tsx +2 -5
- package/src/components/features/insights/AppUsage.tsx +366 -0
- package/src/components/features/insights/BuiltinBundle.tsx +36 -0
- package/src/components/features/insights/ComparedBundlesChart.tsx +310 -0
- package/src/components/features/insights/EstimatedCount.tsx +18 -0
- package/src/components/features/insights/EventDetails.tsx +400 -39
- package/src/components/features/insights/EventHistoryCard.tsx +112 -26
- package/src/components/features/insights/EventHistoryList.tsx +2 -2
- package/src/components/features/insights/FailureReports.tsx +407 -0
- package/src/components/features/insights/InsightsControls.tsx +265 -88
- package/src/components/features/insights/InsightsErrorAlert.tsx +14 -1
- package/src/components/features/insights/InsightsInfo.tsx +48 -0
- package/src/components/features/insights/InsightsOverview.tsx +604 -355
- package/src/components/features/insights/InsightsPageHeader.tsx +35 -20
- package/src/components/features/insights/InsightsPeriodSelector.tsx +89 -0
- package/src/components/features/insights/InstallationHistoryCard.tsx +66 -11
- package/src/components/features/insights/InstallationMatchesCard.tsx +1 -1
- package/src/components/features/insights/ReleaseActivity.tsx +308 -0
- package/src/components/features/insights/ReportingDevicesSummary.tsx +48 -0
- package/src/components/features/insights/RollbackButton.tsx +118 -0
- package/src/components/features/insights/UpdateFailures.tsx +382 -0
- package/src/components/features/insights/insightsFeatureUi.tsx +35 -0
- package/src/components/features/releases/ReleaseEditorSheet.tsx +26 -12
- package/src/components/features/remote-config/ConditionDialog.tsx +581 -0
- package/src/components/features/remote-config/ConditionsCard.tsx +244 -0
- package/src/components/features/remote-config/ParameterDialog.tsx +407 -0
- package/src/components/features/remote-config/ParametersCard.tsx +244 -0
- package/src/components/features/remote-config/PreviewCard.tsx +284 -0
- package/src/components/features/remote-config/PublishDialog.tsx +319 -0
- package/src/components/features/remote-config/RemoteConfigPage.tsx +353 -0
- package/src/components/features/remote-config/RuleSummary.tsx +21 -0
- package/src/components/features/remote-config/ValueInput.tsx +148 -0
- package/src/components/features/remote-config/VersionsCard.tsx +361 -0
- package/src/components/features/remote-config/remoteConfigFeatureUi.tsx +15 -0
- package/src/components/features/remote-config/useDateTimeText.ts +16 -0
- package/src/components/ui/card.tsx +1 -1
- package/src/components/ui/scroll-area.tsx +52 -0
- package/src/components/ui/sidebar.tsx +22 -29
- package/src/components/ui/tabs.tsx +81 -0
- package/src/index.ts +26 -19
- package/src/lib/api-keys-api.ts +0 -28
- package/src/lib/api-keys-rpc.ts +27 -38
- package/src/lib/api-rpc.ts +189 -266
- package/src/lib/api.ts +19 -102
- package/src/lib/bundle-activity.ts +24 -4
- package/src/lib/console-access.ts +20 -0
- package/src/lib/console-features-api.ts +68 -0
- package/src/lib/console-features-rpc.ts +13 -0
- package/src/lib/console-features.ts +97 -0
- package/src/lib/insights-api.ts +56 -2
- package/src/lib/insights-errors.ts +64 -0
- package/src/lib/insights-failures-rpc.ts +36 -0
- package/src/lib/insights-failures.ts +130 -0
- package/src/lib/insights-recovery-rpc.ts +13 -17
- package/src/lib/insights-recovery.ts +10 -27
- package/src/lib/insights-retention.ts +21 -0
- package/src/lib/insights-rpc.ts +30 -12
- package/src/lib/insights-search.ts +93 -0
- package/src/lib/insights-usage-rpc.ts +29 -0
- package/src/lib/insights-usage.ts +76 -0
- package/src/lib/insights-view.ts +34 -5
- package/src/lib/release-adoption-api.ts +214 -0
- package/src/lib/release-adoption-rpc.ts +49 -0
- package/src/lib/release-adoption.ts +164 -0
- package/src/lib/remote-config-api.ts +119 -0
- package/src/lib/remote-config-draft.ts +652 -0
- package/src/lib/remote-config-rpc.ts +196 -0
- package/src/lib/scroll-restoration.ts +21 -0
- package/src/lib/server/adminInsights.ts +124 -0
- package/src/lib/server/auth.server.ts +13 -5
- package/src/lib/server/bundleActivity.ts +27 -28
- package/src/lib/server/config.server.ts +21 -74
- package/src/lib/server/console-feature-apis.ts +70 -0
- package/src/lib/server/console-runtime.server.ts +82 -38
- package/src/lib/server/downloadBundle.ts +16 -15
- package/src/lib/server/failureReports.ts +49 -0
- package/src/lib/server/getBundleChildren.ts +31 -122
- package/src/lib/server/insightsUsage.ts +63 -0
- package/src/lib/server/listReleases.ts +109 -44
- package/src/lib/server/releaseAdoption.ts +154 -0
- package/src/lib/server/releaseReachability.ts +8 -7
- package/src/lib/server/remoteConfig.ts +191 -0
- package/src/lib/server/runtime.server.ts +120 -31
- package/src/lib/server/updateFailures.ts +65 -0
- package/src/routeTree.gen.ts +65 -44
- package/src/router.tsx +3 -2
- package/src/routes/-installations-search.ts +32 -8
- package/src/routes/-releases-search.ts +76 -29
- package/src/routes/__root.tsx +10 -4
- package/src/routes/api/bundles/$bundleId/download.ts +2 -5
- package/src/routes/api-keys.tsx +5 -2
- package/src/routes/index.tsx +210 -152
- package/src/routes/insights.tsx +133 -18
- package/src/routes/insights_.distribution.tsx +422 -0
- package/src/routes/installations.tsx +98 -41
- package/src/routes/remote-config.tsx +42 -0
- package/src/styles.css +9 -0
- package/src/vite-internal.ts +15 -3
- package/src/vite.ts +2 -0
- package/.output/public/assets/InsightsPageHeader-C-Xc2MB9.js +0 -1
- package/.output/public/assets/api-keys-C1sgC6ko.js +0 -1
- package/.output/public/assets/api-keys-api-LchP65vQ.js +0 -1
- package/.output/public/assets/badge-BuMDU0Rf.js +0 -1
- package/.output/public/assets/card-BEvx_QKh.js +0 -1
- package/.output/public/assets/chart-no-axes-combined-C0G0fQ3J.js +0 -1
- package/.output/public/assets/composite-CHTH1Xhh.js +0 -1
- package/.output/public/assets/createServerFn-DHc2erub.js +0 -3
- package/.output/public/assets/dialog-dyZ1SphZ.js +0 -1
- package/.output/public/assets/dist-Bh1gaDfB.js +0 -1
- package/.output/public/assets/field-79SVH26s.js +0 -1
- package/.output/public/assets/index-BNkxg4jz.js +0 -10
- package/.output/public/assets/input-group-BbHfaBzQ.js +0 -1
- package/.output/public/assets/insights-D_7uSKfc.js +0 -1
- package/.output/public/assets/installations-BzoHWuXw.js +0 -1
- package/.output/public/assets/installations-DvjbUqd1.js +0 -2
- package/.output/public/assets/lazyRouteComponent-BN0MS05o.js +0 -1
- package/.output/public/assets/link-BG06whwB.js +0 -1
- package/.output/public/assets/loader-circle-Bbp8LGVC.js +0 -1
- package/.output/public/assets/preload-helper-uTix4PVD.js +0 -1
- package/.output/public/assets/refresh-cw-DZgiAOMk.js +0 -1
- package/.output/public/assets/routes-BFE-oRIT.js +0 -1
- package/.output/public/assets/routes-DaPMY31P.js +0 -2
- package/.output/public/assets/shield-check-DoIiaaXU.js +0 -1
- package/.output/public/assets/signing-BTRhaF5D.js +0 -1
- package/.output/public/assets/styles-C7U0oVke.css +0 -2
- package/.output/public/assets/table-BBEzJ7Xl.js +0 -1
- package/.output/public/assets/useCompositeListItem-BkPDaqyj.js +0 -42
- package/.output/server/__23tanstack-start-server-fn-resolver-Dr2ixDgQ.mjs +0 -146
- package/.output/server/_ssr/InsightsPageHeader-C5Has8Ry.mjs +0 -60
- package/.output/server/_ssr/api-keys-api-CrCZyvnl.mjs +0 -60
- package/.output/server/_ssr/api-keys-rpc-CFaNf-q0.mjs +0 -136
- package/.output/server/_ssr/api-rpc-B61KL3Eo.mjs +0 -1399
- package/.output/server/_ssr/auth.server-DF_shCeq.mjs +0 -47
- package/.output/server/_ssr/badge-BgsCP9Dp.mjs +0 -28
- package/.output/server/_ssr/bundle-signing-rpc-BBipZnFs.mjs +0 -16
- package/.output/server/_ssr/bundle-signing.server-Co_zHdJx.mjs +0 -12
- package/.output/server/_ssr/bundleActivity-D3_fIda2.mjs +0 -27
- package/.output/server/_ssr/card-DrbxCPtG.mjs +0 -86
- package/.output/server/_ssr/chart-qxa-_30a.mjs +0 -162
- package/.output/server/_ssr/config-Dv8qLDZ0.mjs +0 -13
- package/.output/server/_ssr/config.server-CBr6PDj5.mjs +0 -368
- package/.output/server/_ssr/databaseRows-5bCRTxm-.mjs +0 -126
- package/.output/server/_ssr/deleteBundle-BAq3JuGr.mjs +0 -66
- package/.output/server/_ssr/field-CqNUlqUq.mjs +0 -74
- package/.output/server/_ssr/getBundleChildren-COMt16m_.mjs +0 -50
- package/.output/server/_ssr/insights-B-DUbksX.mjs +0 -502
- package/.output/server/_ssr/insights-recovery-rpc-P71FH66n.mjs +0 -37
- package/.output/server/_ssr/insightsContract-fjJDBeEE.mjs +0 -303
- package/.output/server/_ssr/insightsRecovery-CqcosG7B.mjs +0 -149
- package/.output/server/_ssr/installations-BQrppti7.mjs +0 -29
- package/.output/server/_ssr/routes-BDabsmc7.mjs +0 -37
- package/.output/server/_ssr/runtime.server-jmZOKIQM.mjs +0 -438
- package/.output/server/_ssr/server-p7yrVBfD.mjs +0 -7468
- package/.output/server/_ssr/signing-CxCbnFCt.mjs +0 -134
- package/.output/server/_ssr/start-DpViQGnt.mjs +0 -4
- package/.output/server/_tanstack-start-manifest_v-Cwpu0C9Q.mjs +0 -100
- package/src/components/features/bundles/BundleActivityChart.tsx +0 -95
- package/src/components/features/bundles/BundleInsightsSummary.tsx +0 -121
- package/src/components/features/signing/BundleSigningPage.tsx +0 -139
- package/src/lib/bundle-signing-api.ts +0 -14
- package/src/lib/bundle-signing-rpc.ts +0 -16
- package/src/lib/server/bundle-signing.server.ts +0 -23
- package/src/lib/server/deleteBundle.ts +0 -145
- package/src/lib/server/insightsHistory.ts +0 -52
- package/src/lib/server/insightsRecovery.ts +0 -186
- package/src/routes/signing.tsx +0 -37
|
@@ -0,0 +1,581 @@
|
|
|
1
|
+
import { Plus, RefreshCw, Trash2, X } from "lucide-react";
|
|
2
|
+
import { type FormEvent, useId, useState } from "react";
|
|
3
|
+
|
|
4
|
+
import { PlatformIcon } from "@/components/PlatformIcon";
|
|
5
|
+
import { Button } from "@/components/ui/button";
|
|
6
|
+
import {
|
|
7
|
+
Dialog,
|
|
8
|
+
DialogContent,
|
|
9
|
+
DialogDescription,
|
|
10
|
+
DialogFooter,
|
|
11
|
+
DialogHeader,
|
|
12
|
+
DialogTitle,
|
|
13
|
+
} from "@/components/ui/dialog";
|
|
14
|
+
import {
|
|
15
|
+
Field,
|
|
16
|
+
FieldDescription,
|
|
17
|
+
FieldError,
|
|
18
|
+
FieldGroup,
|
|
19
|
+
FieldLabel,
|
|
20
|
+
FieldLegend,
|
|
21
|
+
FieldSet,
|
|
22
|
+
} from "@/components/ui/field";
|
|
23
|
+
import { Input } from "@/components/ui/input";
|
|
24
|
+
import {
|
|
25
|
+
InputGroup,
|
|
26
|
+
InputGroupAddon,
|
|
27
|
+
InputGroupButton,
|
|
28
|
+
InputGroupInput,
|
|
29
|
+
} from "@/components/ui/input-group";
|
|
30
|
+
import {
|
|
31
|
+
Select,
|
|
32
|
+
SelectContent,
|
|
33
|
+
SelectGroup,
|
|
34
|
+
SelectItem,
|
|
35
|
+
SelectTrigger,
|
|
36
|
+
SelectValue,
|
|
37
|
+
} from "@/components/ui/select";
|
|
38
|
+
import { Textarea } from "@/components/ui/textarea";
|
|
39
|
+
import { ToggleGroup, ToggleGroupItem } from "@/components/ui/toggle-group";
|
|
40
|
+
import { useChannelsQuery } from "@/lib/api";
|
|
41
|
+
import {
|
|
42
|
+
conditionNameError,
|
|
43
|
+
createRule,
|
|
44
|
+
createSeed,
|
|
45
|
+
endPresets,
|
|
46
|
+
fromLocalDateTimeInput,
|
|
47
|
+
RULE_TYPE_LABELS,
|
|
48
|
+
type RemoteConfigCondition,
|
|
49
|
+
type RemoteConfigRule,
|
|
50
|
+
type RemoteConfigRuleType,
|
|
51
|
+
ruleError,
|
|
52
|
+
splitList,
|
|
53
|
+
startPresets,
|
|
54
|
+
suggestConditionName,
|
|
55
|
+
toLocalDateTimeInput,
|
|
56
|
+
} from "@/lib/remote-config-draft";
|
|
57
|
+
|
|
58
|
+
import { useDateTimeText } from "./useDateTimeText";
|
|
59
|
+
|
|
60
|
+
const RULE_TYPES = Object.keys(RULE_TYPE_LABELS) as RemoteConfigRuleType[];
|
|
61
|
+
|
|
62
|
+
/** A list typed as text, kept as typed until it is saved. */
|
|
63
|
+
function ListInput({
|
|
64
|
+
id,
|
|
65
|
+
values,
|
|
66
|
+
onChange,
|
|
67
|
+
placeholder,
|
|
68
|
+
multiline = false,
|
|
69
|
+
}: {
|
|
70
|
+
readonly id: string;
|
|
71
|
+
readonly values: readonly string[];
|
|
72
|
+
readonly onChange: (values: string[]) => void;
|
|
73
|
+
readonly placeholder: string;
|
|
74
|
+
readonly multiline?: boolean;
|
|
75
|
+
}) {
|
|
76
|
+
const [text, setText] = useState(values.join(", "));
|
|
77
|
+
// A value added outside the input, such as a known channel, shows in it.
|
|
78
|
+
const [shown, setShown] = useState(values);
|
|
79
|
+
if (shown !== values) {
|
|
80
|
+
setShown(values);
|
|
81
|
+
if (splitList(text).join("\n") !== values.join("\n")) {
|
|
82
|
+
setText(values.join(", "));
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
const update = (next: string) => {
|
|
86
|
+
setText(next);
|
|
87
|
+
onChange(splitList(next));
|
|
88
|
+
};
|
|
89
|
+
return multiline ? (
|
|
90
|
+
<Textarea
|
|
91
|
+
className="min-h-20 font-mono text-xs"
|
|
92
|
+
id={id}
|
|
93
|
+
onChange={(event) => update(event.target.value)}
|
|
94
|
+
placeholder={placeholder}
|
|
95
|
+
spellCheck={false}
|
|
96
|
+
value={text}
|
|
97
|
+
/>
|
|
98
|
+
) : (
|
|
99
|
+
<Input
|
|
100
|
+
autoComplete="off"
|
|
101
|
+
className="min-h-11 sm:min-h-9"
|
|
102
|
+
id={id}
|
|
103
|
+
onChange={(event) => update(event.target.value)}
|
|
104
|
+
placeholder={placeholder}
|
|
105
|
+
value={text}
|
|
106
|
+
/>
|
|
107
|
+
);
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
/** One end of a date and time rule: a picker, a clear button, and quick choices. */
|
|
111
|
+
function DateTimeField({
|
|
112
|
+
id,
|
|
113
|
+
label,
|
|
114
|
+
value,
|
|
115
|
+
presets,
|
|
116
|
+
onChange,
|
|
117
|
+
}: {
|
|
118
|
+
readonly id: string;
|
|
119
|
+
readonly label: string;
|
|
120
|
+
readonly value: string | undefined;
|
|
121
|
+
readonly presets: readonly { readonly label: string; readonly iso: string }[];
|
|
122
|
+
readonly onChange: (value: string | undefined) => void;
|
|
123
|
+
}) {
|
|
124
|
+
return (
|
|
125
|
+
<Field>
|
|
126
|
+
<FieldLabel htmlFor={id}>{label}</FieldLabel>
|
|
127
|
+
<InputGroup className="h-11 sm:h-9">
|
|
128
|
+
<InputGroupInput
|
|
129
|
+
className="h-11 tabular-nums sm:h-9"
|
|
130
|
+
id={id}
|
|
131
|
+
onChange={(event) =>
|
|
132
|
+
onChange(fromLocalDateTimeInput(event.target.value))
|
|
133
|
+
}
|
|
134
|
+
type="datetime-local"
|
|
135
|
+
value={toLocalDateTimeInput(value)}
|
|
136
|
+
/>
|
|
137
|
+
{value === undefined ? null : (
|
|
138
|
+
<InputGroupAddon align="inline-end">
|
|
139
|
+
<InputGroupButton
|
|
140
|
+
aria-label={`Clear ${label.toLowerCase()}`}
|
|
141
|
+
className="size-11 sm:size-5"
|
|
142
|
+
onClick={() => onChange(undefined)}
|
|
143
|
+
size="icon-xs"
|
|
144
|
+
>
|
|
145
|
+
<X />
|
|
146
|
+
</InputGroupButton>
|
|
147
|
+
</InputGroupAddon>
|
|
148
|
+
)}
|
|
149
|
+
</InputGroup>
|
|
150
|
+
<div className="flex flex-wrap gap-1.5">
|
|
151
|
+
{presets.map((preset) => (
|
|
152
|
+
<Button
|
|
153
|
+
aria-pressed={preset.iso === value}
|
|
154
|
+
className="min-h-11 sm:min-h-6"
|
|
155
|
+
key={preset.label}
|
|
156
|
+
onClick={() => onChange(preset.iso)}
|
|
157
|
+
size="xs"
|
|
158
|
+
type="button"
|
|
159
|
+
variant={preset.iso === value ? "secondary" : "outline"}
|
|
160
|
+
>
|
|
161
|
+
{preset.label}
|
|
162
|
+
</Button>
|
|
163
|
+
))}
|
|
164
|
+
</div>
|
|
165
|
+
</Field>
|
|
166
|
+
);
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
function RuleFields({
|
|
170
|
+
rule,
|
|
171
|
+
onChange,
|
|
172
|
+
}: {
|
|
173
|
+
readonly rule: RemoteConfigRule;
|
|
174
|
+
readonly onChange: (rule: RemoteConfigRule) => void;
|
|
175
|
+
}) {
|
|
176
|
+
const id = useId();
|
|
177
|
+
const channels = useChannelsQuery();
|
|
178
|
+
switch (rule.type) {
|
|
179
|
+
case "platform":
|
|
180
|
+
return (
|
|
181
|
+
<ToggleGroup
|
|
182
|
+
aria-label="Platforms"
|
|
183
|
+
multiple
|
|
184
|
+
onValueChange={(values) =>
|
|
185
|
+
onChange({
|
|
186
|
+
...rule,
|
|
187
|
+
platforms: (values as string[]).filter(
|
|
188
|
+
(value): value is "ios" | "android" =>
|
|
189
|
+
value === "ios" || value === "android",
|
|
190
|
+
),
|
|
191
|
+
})
|
|
192
|
+
}
|
|
193
|
+
value={[...rule.platforms]}
|
|
194
|
+
variant="outline"
|
|
195
|
+
>
|
|
196
|
+
{(["ios", "android"] as const).map((platform) => (
|
|
197
|
+
<ToggleGroupItem
|
|
198
|
+
className="min-h-11 px-3 sm:min-h-8"
|
|
199
|
+
key={platform}
|
|
200
|
+
value={platform}
|
|
201
|
+
>
|
|
202
|
+
<PlatformIcon className="size-3.5" platform={platform} />
|
|
203
|
+
{platform === "ios" ? "iOS" : "Android"}
|
|
204
|
+
</ToggleGroupItem>
|
|
205
|
+
))}
|
|
206
|
+
</ToggleGroup>
|
|
207
|
+
);
|
|
208
|
+
case "channel": {
|
|
209
|
+
const known = (channels.data ?? [])
|
|
210
|
+
.map(({ name }) => name)
|
|
211
|
+
.filter((channel) => !rule.channels.includes(channel));
|
|
212
|
+
return (
|
|
213
|
+
<div className="flex flex-col gap-2">
|
|
214
|
+
<ListInput
|
|
215
|
+
id={`${id}-channels`}
|
|
216
|
+
onChange={(next) => onChange({ ...rule, channels: next })}
|
|
217
|
+
placeholder="production, beta"
|
|
218
|
+
values={rule.channels}
|
|
219
|
+
/>
|
|
220
|
+
{known.length > 0 ? (
|
|
221
|
+
<div className="flex flex-wrap items-center gap-1.5">
|
|
222
|
+
<span className="text-xs text-muted-foreground">Add:</span>
|
|
223
|
+
{known.slice(0, 8).map((channel) => (
|
|
224
|
+
<Button
|
|
225
|
+
className="min-h-11 sm:min-h-6"
|
|
226
|
+
key={channel}
|
|
227
|
+
onClick={() =>
|
|
228
|
+
onChange({ ...rule, channels: [...rule.channels, channel] })
|
|
229
|
+
}
|
|
230
|
+
size="xs"
|
|
231
|
+
type="button"
|
|
232
|
+
variant="outline"
|
|
233
|
+
>
|
|
234
|
+
<Plus data-icon="inline-start" />
|
|
235
|
+
{channel}
|
|
236
|
+
</Button>
|
|
237
|
+
))}
|
|
238
|
+
</div>
|
|
239
|
+
) : null}
|
|
240
|
+
</div>
|
|
241
|
+
);
|
|
242
|
+
}
|
|
243
|
+
case "appVersion":
|
|
244
|
+
return (
|
|
245
|
+
<Input
|
|
246
|
+
aria-label="App version range"
|
|
247
|
+
autoComplete="off"
|
|
248
|
+
className="min-h-11 font-mono sm:min-h-9"
|
|
249
|
+
onChange={(event) => onChange({ ...rule, range: event.target.value })}
|
|
250
|
+
placeholder=">=1.4.0"
|
|
251
|
+
value={rule.range}
|
|
252
|
+
/>
|
|
253
|
+
);
|
|
254
|
+
case "cohort":
|
|
255
|
+
return (
|
|
256
|
+
<ListInput
|
|
257
|
+
id={`${id}-cohorts`}
|
|
258
|
+
onChange={(next) => onChange({ ...rule, cohorts: next })}
|
|
259
|
+
placeholder="1, 2, beta-testers"
|
|
260
|
+
values={rule.cohorts}
|
|
261
|
+
/>
|
|
262
|
+
);
|
|
263
|
+
case "percent":
|
|
264
|
+
return (
|
|
265
|
+
<div className="grid gap-2 sm:grid-cols-[repeat(2,minmax(0,8rem))_minmax(0,1fr)]">
|
|
266
|
+
<Field>
|
|
267
|
+
<FieldLabel htmlFor={`${id}-from`}>From %</FieldLabel>
|
|
268
|
+
<Input
|
|
269
|
+
className="min-h-11 tabular-nums sm:min-h-9"
|
|
270
|
+
id={`${id}-from`}
|
|
271
|
+
inputMode="decimal"
|
|
272
|
+
max={100}
|
|
273
|
+
min={0}
|
|
274
|
+
onChange={(event) =>
|
|
275
|
+
onChange({ ...rule, from: Number(event.target.value) })
|
|
276
|
+
}
|
|
277
|
+
step={0.1}
|
|
278
|
+
type="number"
|
|
279
|
+
value={rule.from}
|
|
280
|
+
/>
|
|
281
|
+
</Field>
|
|
282
|
+
<Field>
|
|
283
|
+
<FieldLabel htmlFor={`${id}-to`}>To %</FieldLabel>
|
|
284
|
+
<Input
|
|
285
|
+
className="min-h-11 tabular-nums sm:min-h-9"
|
|
286
|
+
id={`${id}-to`}
|
|
287
|
+
inputMode="decimal"
|
|
288
|
+
max={100}
|
|
289
|
+
min={0}
|
|
290
|
+
onChange={(event) =>
|
|
291
|
+
onChange({ ...rule, to: Number(event.target.value) })
|
|
292
|
+
}
|
|
293
|
+
step={0.1}
|
|
294
|
+
type="number"
|
|
295
|
+
value={rule.to}
|
|
296
|
+
/>
|
|
297
|
+
</Field>
|
|
298
|
+
<Field>
|
|
299
|
+
<FieldLabel htmlFor={`${id}-seed`}>Seed</FieldLabel>
|
|
300
|
+
<div className="flex gap-2">
|
|
301
|
+
<Input
|
|
302
|
+
autoComplete="off"
|
|
303
|
+
className="min-h-11 font-mono sm:min-h-9"
|
|
304
|
+
id={`${id}-seed`}
|
|
305
|
+
onChange={(event) =>
|
|
306
|
+
onChange({ ...rule, seed: event.target.value })
|
|
307
|
+
}
|
|
308
|
+
value={rule.seed}
|
|
309
|
+
/>
|
|
310
|
+
<Button
|
|
311
|
+
aria-label="New seed"
|
|
312
|
+
className="size-11 sm:size-9"
|
|
313
|
+
onClick={() => onChange({ ...rule, seed: createSeed() })}
|
|
314
|
+
size="icon"
|
|
315
|
+
type="button"
|
|
316
|
+
variant="outline"
|
|
317
|
+
>
|
|
318
|
+
<RefreshCw />
|
|
319
|
+
</Button>
|
|
320
|
+
</div>
|
|
321
|
+
</Field>
|
|
322
|
+
</div>
|
|
323
|
+
);
|
|
324
|
+
case "fingerprint":
|
|
325
|
+
return (
|
|
326
|
+
<ListInput
|
|
327
|
+
id={`${id}-hashes`}
|
|
328
|
+
multiline
|
|
329
|
+
onChange={(next) => onChange({ ...rule, hashes: next })}
|
|
330
|
+
placeholder="One fingerprint hash per line"
|
|
331
|
+
values={rule.hashes}
|
|
332
|
+
/>
|
|
333
|
+
);
|
|
334
|
+
case "dateTime": {
|
|
335
|
+
const change = (field: "from" | "to", instant: string | undefined) => {
|
|
336
|
+
const { [field]: _previous, ...rest } = rule;
|
|
337
|
+
onChange(instant === undefined ? rest : { ...rest, [field]: instant });
|
|
338
|
+
};
|
|
339
|
+
return (
|
|
340
|
+
<div className="grid gap-3 sm:grid-cols-2">
|
|
341
|
+
<DateTimeField
|
|
342
|
+
id={`${id}-from`}
|
|
343
|
+
label="From"
|
|
344
|
+
onChange={(instant) => change("from", instant)}
|
|
345
|
+
presets={startPresets()}
|
|
346
|
+
value={rule.from}
|
|
347
|
+
/>
|
|
348
|
+
<DateTimeField
|
|
349
|
+
id={`${id}-until`}
|
|
350
|
+
label="Until"
|
|
351
|
+
onChange={(instant) => change("to", instant)}
|
|
352
|
+
presets={endPresets(rule.from)}
|
|
353
|
+
value={rule.to}
|
|
354
|
+
/>
|
|
355
|
+
</div>
|
|
356
|
+
);
|
|
357
|
+
}
|
|
358
|
+
}
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
const RULE_HINTS: Readonly<Record<RemoteConfigRuleType, string>> = {
|
|
362
|
+
platform: "Devices on any of these platforms.",
|
|
363
|
+
channel: "Devices on any of these channels, separated by commas.",
|
|
364
|
+
appVersion:
|
|
365
|
+
"A semver range of native app versions, as release targets use: 2.x, >=1.4.0 <2.0.0.",
|
|
366
|
+
percent:
|
|
367
|
+
"Installs whose numeric cohort lands in this share. Rules with one seed split the same order, so 0–10 and 10–20 never overlap.",
|
|
368
|
+
cohort: "Numeric cohorts from 1 to 1000, or custom cohort names.",
|
|
369
|
+
fingerprint: "Native builds with any of these fingerprints.",
|
|
370
|
+
dateTime:
|
|
371
|
+
"Leave either end empty to keep it open. Devices get the change at their next fetch.",
|
|
372
|
+
};
|
|
373
|
+
|
|
374
|
+
/** Adds or edits a condition: a name and the rules a device must all match. */
|
|
375
|
+
export function ConditionDialog({
|
|
376
|
+
open,
|
|
377
|
+
onOpenChange,
|
|
378
|
+
condition,
|
|
379
|
+
takenNames,
|
|
380
|
+
onSave,
|
|
381
|
+
}: {
|
|
382
|
+
readonly open: boolean;
|
|
383
|
+
readonly onOpenChange: (open: boolean) => void;
|
|
384
|
+
/** The condition to edit, or null for a new one. */
|
|
385
|
+
readonly condition: RemoteConfigCondition | null;
|
|
386
|
+
readonly takenNames: readonly string[];
|
|
387
|
+
readonly onSave: (condition: RemoteConfigCondition) => void;
|
|
388
|
+
}) {
|
|
389
|
+
return (
|
|
390
|
+
<Dialog onOpenChange={onOpenChange} open={open}>
|
|
391
|
+
<DialogContent className="max-h-[calc(100svh-2rem)] overflow-y-auto sm:max-w-xl">
|
|
392
|
+
{open ? (
|
|
393
|
+
<ConditionForm
|
|
394
|
+
condition={condition}
|
|
395
|
+
onCancel={() => onOpenChange(false)}
|
|
396
|
+
onSave={(next) => {
|
|
397
|
+
onSave(next);
|
|
398
|
+
onOpenChange(false);
|
|
399
|
+
}}
|
|
400
|
+
takenNames={takenNames}
|
|
401
|
+
/>
|
|
402
|
+
) : null}
|
|
403
|
+
</DialogContent>
|
|
404
|
+
</Dialog>
|
|
405
|
+
);
|
|
406
|
+
}
|
|
407
|
+
|
|
408
|
+
function ConditionForm({
|
|
409
|
+
condition,
|
|
410
|
+
takenNames,
|
|
411
|
+
onSave,
|
|
412
|
+
onCancel,
|
|
413
|
+
}: {
|
|
414
|
+
readonly condition: RemoteConfigCondition | null;
|
|
415
|
+
readonly takenNames: readonly string[];
|
|
416
|
+
readonly onSave: (condition: RemoteConfigCondition) => void;
|
|
417
|
+
readonly onCancel: () => void;
|
|
418
|
+
}) {
|
|
419
|
+
const id = useId();
|
|
420
|
+
const { dateTimeText, timeZone } = useDateTimeText();
|
|
421
|
+
const [name, setName] = useState(condition?.name ?? "");
|
|
422
|
+
const [rules, setRules] = useState<RemoteConfigRule[]>(
|
|
423
|
+
condition === null ? [createRule("platform")] : [...condition.rules],
|
|
424
|
+
);
|
|
425
|
+
const [submitted, setSubmitted] = useState(false);
|
|
426
|
+
// An empty name saves as the rules in a few words.
|
|
427
|
+
const suggestedName = suggestConditionName(rules, takenNames, dateTimeText);
|
|
428
|
+
const savedName = name.trim().length === 0 ? suggestedName : name;
|
|
429
|
+
const nameError = conditionNameError(savedName, takenNames);
|
|
430
|
+
const ruleErrors = rules.map(ruleError);
|
|
431
|
+
const unused = RULE_TYPES.filter(
|
|
432
|
+
(type) => !rules.some((rule) => rule.type === type),
|
|
433
|
+
);
|
|
434
|
+
const invalid =
|
|
435
|
+
nameError !== null ||
|
|
436
|
+
rules.length === 0 ||
|
|
437
|
+
ruleErrors.some((error) => error !== null);
|
|
438
|
+
|
|
439
|
+
const submit = (event: FormEvent<HTMLFormElement>) => {
|
|
440
|
+
event.preventDefault();
|
|
441
|
+
// Opened from the parameter dialog, it must not submit that form too.
|
|
442
|
+
event.stopPropagation();
|
|
443
|
+
setSubmitted(true);
|
|
444
|
+
if (invalid) return;
|
|
445
|
+
onSave({
|
|
446
|
+
name: savedName.trim(),
|
|
447
|
+
rules: rules.map((rule) =>
|
|
448
|
+
rule.type === "appVersion"
|
|
449
|
+
? { ...rule, range: rule.range.trim() }
|
|
450
|
+
: rule,
|
|
451
|
+
),
|
|
452
|
+
});
|
|
453
|
+
};
|
|
454
|
+
|
|
455
|
+
return (
|
|
456
|
+
<form className="flex flex-col gap-4" noValidate onSubmit={submit}>
|
|
457
|
+
<DialogHeader>
|
|
458
|
+
<DialogTitle>
|
|
459
|
+
{condition === null ? "Add condition" : "Edit condition"}
|
|
460
|
+
</DialogTitle>
|
|
461
|
+
<DialogDescription>
|
|
462
|
+
A device matches when it matches every rule.
|
|
463
|
+
</DialogDescription>
|
|
464
|
+
</DialogHeader>
|
|
465
|
+
<FieldGroup>
|
|
466
|
+
<Field data-invalid={(submitted && nameError !== null) || undefined}>
|
|
467
|
+
<FieldLabel htmlFor={`${id}-name`}>Name</FieldLabel>
|
|
468
|
+
<Input
|
|
469
|
+
autoComplete="off"
|
|
470
|
+
className="min-h-11 sm:min-h-9"
|
|
471
|
+
id={`${id}-name`}
|
|
472
|
+
maxLength={101}
|
|
473
|
+
onChange={(event) => setName(event.target.value)}
|
|
474
|
+
placeholder={suggestedName || "Beta testers on iOS"}
|
|
475
|
+
value={name}
|
|
476
|
+
/>
|
|
477
|
+
<FieldDescription>
|
|
478
|
+
Optional: without one, it is named after its rules.
|
|
479
|
+
</FieldDescription>
|
|
480
|
+
<FieldError>{submitted ? nameError : null}</FieldError>
|
|
481
|
+
</Field>
|
|
482
|
+
<FieldSet>
|
|
483
|
+
<FieldLegend variant="label">Rules</FieldLegend>
|
|
484
|
+
{rules.length === 0 ? (
|
|
485
|
+
<FieldError>
|
|
486
|
+
{submitted ? "Add at least one rule." : null}
|
|
487
|
+
</FieldError>
|
|
488
|
+
) : null}
|
|
489
|
+
<ol className="flex flex-col gap-3">
|
|
490
|
+
{rules.map((rule, index) => (
|
|
491
|
+
<li className="rounded-lg border p-3" key={rule.type}>
|
|
492
|
+
<Field
|
|
493
|
+
data-invalid={
|
|
494
|
+
(submitted && ruleErrors[index] !== null) || undefined
|
|
495
|
+
}
|
|
496
|
+
>
|
|
497
|
+
<div className="flex items-center justify-between gap-2">
|
|
498
|
+
<span className="text-sm font-medium">
|
|
499
|
+
{RULE_TYPE_LABELS[rule.type]}
|
|
500
|
+
</span>
|
|
501
|
+
<Button
|
|
502
|
+
aria-label={`Remove the ${RULE_TYPE_LABELS[rule.type].toLowerCase()} rule`}
|
|
503
|
+
className="size-11 sm:size-7"
|
|
504
|
+
onClick={() =>
|
|
505
|
+
setRules(rules.filter((_, at) => at !== index))
|
|
506
|
+
}
|
|
507
|
+
size="icon-sm"
|
|
508
|
+
type="button"
|
|
509
|
+
variant="ghost"
|
|
510
|
+
>
|
|
511
|
+
<Trash2 />
|
|
512
|
+
</Button>
|
|
513
|
+
</div>
|
|
514
|
+
<RuleFields
|
|
515
|
+
onChange={(next) =>
|
|
516
|
+
setRules(
|
|
517
|
+
rules.map((existing, at) =>
|
|
518
|
+
at === index ? next : existing,
|
|
519
|
+
),
|
|
520
|
+
)
|
|
521
|
+
}
|
|
522
|
+
rule={rule}
|
|
523
|
+
/>
|
|
524
|
+
<FieldDescription>
|
|
525
|
+
{rule.type === "dateTime"
|
|
526
|
+
? `In your time zone, ${timeZone}. ${RULE_HINTS.dateTime}`
|
|
527
|
+
: RULE_HINTS[rule.type]}
|
|
528
|
+
</FieldDescription>
|
|
529
|
+
<FieldError>
|
|
530
|
+
{submitted ? ruleErrors[index] : null}
|
|
531
|
+
</FieldError>
|
|
532
|
+
</Field>
|
|
533
|
+
</li>
|
|
534
|
+
))}
|
|
535
|
+
</ol>
|
|
536
|
+
{unused.length > 0 ? (
|
|
537
|
+
<Select
|
|
538
|
+
items={Object.fromEntries(
|
|
539
|
+
unused.map((type) => [type, RULE_TYPE_LABELS[type]]),
|
|
540
|
+
)}
|
|
541
|
+
onValueChange={(value) => {
|
|
542
|
+
if (value !== null) {
|
|
543
|
+
setRules([
|
|
544
|
+
...rules,
|
|
545
|
+
createRule(value as RemoteConfigRuleType),
|
|
546
|
+
]);
|
|
547
|
+
}
|
|
548
|
+
}}
|
|
549
|
+
value={null}
|
|
550
|
+
>
|
|
551
|
+
<SelectTrigger
|
|
552
|
+
aria-label="Add a rule"
|
|
553
|
+
className="min-h-11 w-full sm:min-h-9 sm:w-56"
|
|
554
|
+
>
|
|
555
|
+
<Plus aria-hidden="true" className="size-3.5" />
|
|
556
|
+
<SelectValue placeholder="Add a rule" />
|
|
557
|
+
</SelectTrigger>
|
|
558
|
+
<SelectContent>
|
|
559
|
+
<SelectGroup>
|
|
560
|
+
{unused.map((type) => (
|
|
561
|
+
<SelectItem key={type} value={type}>
|
|
562
|
+
{RULE_TYPE_LABELS[type]}
|
|
563
|
+
</SelectItem>
|
|
564
|
+
))}
|
|
565
|
+
</SelectGroup>
|
|
566
|
+
</SelectContent>
|
|
567
|
+
</Select>
|
|
568
|
+
) : null}
|
|
569
|
+
</FieldSet>
|
|
570
|
+
</FieldGroup>
|
|
571
|
+
<DialogFooter>
|
|
572
|
+
<Button onClick={onCancel} type="button" variant="outline">
|
|
573
|
+
Cancel
|
|
574
|
+
</Button>
|
|
575
|
+
<Button type="submit">
|
|
576
|
+
{condition === null ? "Add condition" : "Save condition"}
|
|
577
|
+
</Button>
|
|
578
|
+
</DialogFooter>
|
|
579
|
+
</form>
|
|
580
|
+
);
|
|
581
|
+
}
|