@drawbridge/components 0.1.7 → 0.1.9
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/bridge/form-subdomain-shop-modal.js +8 -0
- package/dist/bridge/form-subdomain-shop-modal.mjs +8 -0
- package/dist/bridge/template-modal.js +4 -3
- package/dist/bridge/template-modal.mjs +4 -3
- package/dist/bridge/template-subdomain.js +1 -1
- package/dist/bridge/template-subdomain.mjs +1 -1
- package/dist/dashboard/form-admin-organization.js +32 -0
- package/dist/dashboard/form-admin-organization.mjs +32 -0
- package/dist/dashboard/form-organization-workflow.js +128 -108
- package/dist/dashboard/form-organization-workflow.mjs +123 -108
- package/dist/dashboard/lib/navigation.js +22 -2
- package/dist/dashboard/lib/navigation.mjs +18 -1
- package/dist/dashboard/lib/sms.js +27 -0
- package/dist/dashboard/lib/sms.mjs +4 -0
- package/dist/dashboard/provider-ui.js +31 -6
- package/dist/dashboard/provider-ui.mjs +31 -6
- package/dist/dashboard/template-dashboard.js +9 -7
- package/dist/dashboard/template-dashboard.mjs +7 -6
- package/dist/dashboard/template-socket.js +3 -0
- package/dist/dashboard/template-socket.mjs +3 -0
- package/package.json +7 -2
- package/types/dashboard/form-organization-workflow.d.ts +31 -1
- package/types/dashboard/lib/navigation.d.ts +21 -0
- package/types/dashboard/lib/sms.d.ts +6 -0
- package/types/dashboard/template-dashboard.d.ts +2 -0
|
@@ -31,14 +31,14 @@ __export(template_dashboard_exports, {
|
|
|
31
31
|
TemplateDashboardError: () => TemplateDashboardError,
|
|
32
32
|
TemplateDashboardResource: () => TemplateDashboardResource,
|
|
33
33
|
TemplateDashboardTasks: () => TemplateDashboardTasks,
|
|
34
|
-
default: () => template_dashboard_default
|
|
34
|
+
default: () => template_dashboard_default,
|
|
35
|
+
isNotFound: () => isNotFound
|
|
35
36
|
});
|
|
36
37
|
module.exports = __toCommonJS(template_dashboard_exports);
|
|
37
38
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
38
39
|
var import_react = require("react");
|
|
39
40
|
var import_react_query = require("@tanstack/react-query");
|
|
40
41
|
var import_navigation = require("next/navigation");
|
|
41
|
-
var import_fetch = require("@drawbridge/drawbridge-utils/fetch");
|
|
42
42
|
var import_hooks = require("./lib/hooks");
|
|
43
43
|
var import_icon_labels = require("../shared/lib/icon-labels");
|
|
44
44
|
var import_provider_resource = __toESM(require("./provider-resource"));
|
|
@@ -624,6 +624,7 @@ const TemplateDashboard = ({
|
|
|
624
624
|
}
|
|
625
625
|
);
|
|
626
626
|
};
|
|
627
|
+
const isNotFound = (error) => (error == null ? void 0 : error.status) === 404;
|
|
627
628
|
const TemplateDashboardResource = ({
|
|
628
629
|
cache,
|
|
629
630
|
children,
|
|
@@ -642,15 +643,15 @@ const TemplateDashboardResource = ({
|
|
|
642
643
|
}) => {
|
|
643
644
|
const dynamic = Object.values(chrome).some((value) => value instanceof Function);
|
|
644
645
|
const errorHandler = error || ((query) => {
|
|
645
|
-
var _a, _b
|
|
646
|
-
if ((
|
|
646
|
+
var _a, _b;
|
|
647
|
+
if (!isNotFound(query == null ? void 0 : query.error)) {
|
|
647
648
|
const panel = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
648
649
|
TemplateDashboardError,
|
|
649
650
|
{
|
|
650
651
|
...{
|
|
651
652
|
error: {
|
|
652
|
-
...(
|
|
653
|
-
message: (
|
|
653
|
+
...(_a = query == null ? void 0 : query.error) == null ? void 0 : _a.data,
|
|
654
|
+
message: (_b = query == null ? void 0 : query.error) == null ? void 0 : _b.message
|
|
654
655
|
}
|
|
655
656
|
}
|
|
656
657
|
}
|
|
@@ -754,5 +755,6 @@ var template_dashboard_default = TemplateDashboard;
|
|
|
754
755
|
Refetch,
|
|
755
756
|
TemplateDashboardError,
|
|
756
757
|
TemplateDashboardResource,
|
|
757
|
-
TemplateDashboardTasks
|
|
758
|
+
TemplateDashboardTasks,
|
|
759
|
+
isNotFound
|
|
758
760
|
});
|
|
@@ -2,7 +2,6 @@ import { jsx, jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import { isValidElement, useEffect, useRef, useState } from "react";
|
|
3
3
|
import { keepPreviousData, useIsFetching, useQueryClient } from "@tanstack/react-query";
|
|
4
4
|
import { notFound } from "next/navigation";
|
|
5
|
-
import { isTransientError } from "@drawbridge/drawbridge-utils/fetch";
|
|
6
5
|
import { useDrawer } from "./lib/hooks.mjs";
|
|
7
6
|
import { iconLabel } from "../shared/lib/icon-labels.mjs";
|
|
8
7
|
import ProviderResource from "./provider-resource.mjs";
|
|
@@ -588,6 +587,7 @@ const TemplateDashboard = ({
|
|
|
588
587
|
}
|
|
589
588
|
);
|
|
590
589
|
};
|
|
590
|
+
const isNotFound = (error) => (error == null ? void 0 : error.status) === 404;
|
|
591
591
|
const TemplateDashboardResource = ({
|
|
592
592
|
cache,
|
|
593
593
|
children,
|
|
@@ -606,15 +606,15 @@ const TemplateDashboardResource = ({
|
|
|
606
606
|
}) => {
|
|
607
607
|
const dynamic = Object.values(chrome).some((value) => value instanceof Function);
|
|
608
608
|
const errorHandler = error || ((query) => {
|
|
609
|
-
var _a, _b
|
|
610
|
-
if ((
|
|
609
|
+
var _a, _b;
|
|
610
|
+
if (!isNotFound(query == null ? void 0 : query.error)) {
|
|
611
611
|
const panel = /* @__PURE__ */ jsx(
|
|
612
612
|
TemplateDashboardError,
|
|
613
613
|
{
|
|
614
614
|
...{
|
|
615
615
|
error: {
|
|
616
|
-
...(
|
|
617
|
-
message: (
|
|
616
|
+
...(_a = query == null ? void 0 : query.error) == null ? void 0 : _a.data,
|
|
617
|
+
message: (_b = query == null ? void 0 : query.error) == null ? void 0 : _b.message
|
|
618
618
|
}
|
|
619
619
|
}
|
|
620
620
|
}
|
|
@@ -718,5 +718,6 @@ export {
|
|
|
718
718
|
TemplateDashboardError,
|
|
719
719
|
TemplateDashboardResource,
|
|
720
720
|
TemplateDashboardTasks,
|
|
721
|
-
template_dashboard_default as default
|
|
721
|
+
template_dashboard_default as default,
|
|
722
|
+
isNotFound
|
|
722
723
|
};
|
|
@@ -458,6 +458,9 @@ const TemplateSocketOrganization = ({
|
|
|
458
458
|
queryClient.invalidateQueries({
|
|
459
459
|
queryKey: ["menu", "organization", params.organization]
|
|
460
460
|
});
|
|
461
|
+
queryClient.invalidateQueries({
|
|
462
|
+
queryKey: ["organization-workflow-catalog", params.organization]
|
|
463
|
+
});
|
|
461
464
|
queryClient.invalidateQueries({
|
|
462
465
|
queryKey: ["organizations"]
|
|
463
466
|
});
|
|
@@ -423,6 +423,9 @@ const TemplateSocketOrganization = ({
|
|
|
423
423
|
queryClient.invalidateQueries({
|
|
424
424
|
queryKey: ["menu", "organization", params.organization]
|
|
425
425
|
});
|
|
426
|
+
queryClient.invalidateQueries({
|
|
427
|
+
queryKey: ["organization-workflow-catalog", params.organization]
|
|
428
|
+
});
|
|
426
429
|
queryClient.invalidateQueries({
|
|
427
430
|
queryKey: ["organizations"]
|
|
428
431
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@drawbridge/components",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.9",
|
|
4
4
|
"exports": {
|
|
5
5
|
"./advertisement": {
|
|
6
6
|
"types": "./types/advertisement.d.ts",
|
|
@@ -737,6 +737,11 @@
|
|
|
737
737
|
"import": "./dist/dashboard/lib/overage.mjs",
|
|
738
738
|
"default": "./dist/dashboard/lib/overage.js"
|
|
739
739
|
},
|
|
740
|
+
"./dashboard/lib/sms": {
|
|
741
|
+
"types": "./types/dashboard/lib/sms.d.ts",
|
|
742
|
+
"import": "./dist/dashboard/lib/sms.mjs",
|
|
743
|
+
"default": "./dist/dashboard/lib/sms.js"
|
|
744
|
+
},
|
|
740
745
|
"./dashboard/lib/table-actions": {
|
|
741
746
|
"types": "./types/dashboard/lib/table-actions.d.ts",
|
|
742
747
|
"import": "./dist/dashboard/lib/table-actions.mjs",
|
|
@@ -1641,7 +1646,7 @@
|
|
|
1641
1646
|
},
|
|
1642
1647
|
"devDependencies": {
|
|
1643
1648
|
"@analytics/google-tag-manager": "0.5.5",
|
|
1644
|
-
"@drawbridge/drawbridge-agents": "0.1.
|
|
1649
|
+
"@drawbridge/drawbridge-agents": "0.1.96",
|
|
1645
1650
|
"@drawbridge/drawbridge-telemetry": "0.0.19",
|
|
1646
1651
|
"@drawbridge/drawbridge-utils": "0.0.222",
|
|
1647
1652
|
"@headlessui/react": "2.2.9",
|
|
@@ -63,7 +63,14 @@ export interface FormOrganizationWorkflowEditProps extends Callbacks {
|
|
|
63
63
|
title?: string;
|
|
64
64
|
trigger?: {
|
|
65
65
|
event?: string;
|
|
66
|
-
|
|
66
|
+
// The picked campaigns: the read hydrates them into documents in pick
|
|
67
|
+
// order; empty means every campaign. A pre-Cherry workflow may still
|
|
68
|
+
// carry one `campaign` string, which loads as a one-item list.
|
|
69
|
+
filters?: {
|
|
70
|
+
campaign?: string | { id: string } | null;
|
|
71
|
+
campaigns?: ( string | { id: string; [ key: string ]: unknown } )[];
|
|
72
|
+
segment?: string | { id: string } | null;
|
|
73
|
+
};
|
|
67
74
|
};
|
|
68
75
|
[ key: string ]: unknown;
|
|
69
76
|
};
|
|
@@ -75,4 +82,27 @@ export declare const FormOrganizationWorkflowEdit: ComponentType<FormOrganizatio
|
|
|
75
82
|
// Reduces a campaign (hydrated document or id) to its id.
|
|
76
83
|
export declare const campaignFilterId: ( campaign?: string | { id?: string } | null ) => string | null;
|
|
77
84
|
|
|
85
|
+
// The picked campaigns as ids, from `filters.campaigns` (ids or documents) or
|
|
86
|
+
// a pre-Cherry `filters.campaign`.
|
|
87
|
+
export declare const campaignFilterIds: ( filters?: {
|
|
88
|
+
campaign?: string | { id?: string } | null;
|
|
89
|
+
campaigns?: ( string | { id?: string } | null )[];
|
|
90
|
+
} | null ) => string[];
|
|
91
|
+
|
|
92
|
+
// One picker row per id, in the ids' order: its document, or a bare { id }
|
|
93
|
+
// while it loads or once it is deleted.
|
|
94
|
+
export declare const filterRows: <T extends { id?: string }>( ids: string[], docs: ( T | null | undefined )[] ) => ( T | { id: string } )[];
|
|
95
|
+
|
|
96
|
+
// The document among `seeds` (the read's hydrated campaigns) for one id.
|
|
97
|
+
export declare const filterSeed: <T extends { id?: string }>( seeds: ( T | string | null )[] | null | undefined, id: string ) => T | undefined;
|
|
98
|
+
|
|
99
|
+
// A label read's catch: a 404 resolves { result : null }; anything else throws.
|
|
100
|
+
export declare const filterMissing: ( error: unknown ) => { result: null };
|
|
101
|
+
|
|
102
|
+
// The editor's validation schema (yup).
|
|
103
|
+
export declare const workflowSchema: {
|
|
104
|
+
validate: ( value: unknown, options?: Record<string, unknown> ) => Promise<unknown>;
|
|
105
|
+
[ key: string ]: unknown;
|
|
106
|
+
};
|
|
107
|
+
|
|
78
108
|
export declare const stepRow: ( step?: FormOrganizationWorkflowStep, members?: { id?: string; [ key: string ]: unknown }[] ) => FormOrganizationWorkflowRow;
|
|
@@ -22,3 +22,24 @@ export declare const interceptHref: ( props: {
|
|
|
22
22
|
search: string;
|
|
23
23
|
};
|
|
24
24
|
} ) => string | null;
|
|
25
|
+
|
|
26
|
+
// Where a page whose session the api refuses (401) sends the browser: the
|
|
27
|
+
// dashboard's sign-out route, which clears the cookies and opens /auth with
|
|
28
|
+
// this page as redirectTo. Null on /auth itself, so it can never loop.
|
|
29
|
+
export declare const expiredSessionHref: ( props: {
|
|
30
|
+
csrf?: string | null;
|
|
31
|
+
pathname?: string;
|
|
32
|
+
search?: string;
|
|
33
|
+
} ) => string | null;
|
|
34
|
+
|
|
35
|
+
// The sessionStorage key holding when this tab last tried /api/auth/refresh
|
|
36
|
+
// after a 401.
|
|
37
|
+
export declare const sessionRetryKey: string;
|
|
38
|
+
|
|
39
|
+
// Whether a 401 may try /api/auth/refresh: false when this tab already tried
|
|
40
|
+
// within the last minute (`stamp`, ms), so a refresh that answers ok but still
|
|
41
|
+
// 401s signs out instead of looping.
|
|
42
|
+
export declare const retrySession: ( props: {
|
|
43
|
+
now: number;
|
|
44
|
+
stamp?: string | number | null;
|
|
45
|
+
} ) => boolean;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
// Whether the organization's SMS number reads Active: an `sms` identity row on
|
|
2
|
+
// `identityItems` with `status : 'verified'`. Pending and Rejected cannot send.
|
|
3
|
+
export declare const smsNumberActive: ( organization?: {
|
|
4
|
+
identityItems?: { status?: string; type?: string; [ key: string ]: unknown }[];
|
|
5
|
+
[ key: string ]: unknown;
|
|
6
|
+
} | null ) => boolean;
|
|
@@ -104,6 +104,8 @@ export interface TemplateDashboardResourceProps<TData = any> extends TemplateDas
|
|
|
104
104
|
refetchOnMount?: boolean | 'always';
|
|
105
105
|
}
|
|
106
106
|
|
|
107
|
+
// Only a 404 is "Nothing found"; any other refusal shows the api's sentence.
|
|
108
|
+
export declare const isNotFound: ( error: unknown ) => boolean;
|
|
107
109
|
export declare const Refetch: ComponentType<RefetchProps>;
|
|
108
110
|
export declare const TemplateDashboardError: ComponentType<TemplateDashboardErrorProps>;
|
|
109
111
|
export declare function TemplateDashboardResource<TData = any>( props: TemplateDashboardResourceProps<TData> ): ReactNode;
|