@drawbridge/components 0.1.15 → 0.1.16
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/lib/url.js +3 -3
- package/dist/bridge/lib/url.mjs +3 -3
- package/dist/bridge/share-button.js +12 -2
- package/dist/bridge/share-button.mjs +12 -2
- package/dist/bridge/template-layout.js +1 -1
- package/dist/bridge/template-layout.mjs +1 -1
- package/dist/dashboard/answer-rows.js +77 -0
- package/dist/dashboard/answer-rows.mjs +41 -0
- package/dist/dashboard/card-order.js +186 -243
- package/dist/dashboard/card-order.mjs +186 -243
- package/dist/dashboard/form-organization-campaign-field-list.js +8 -49
- package/dist/dashboard/form-organization-campaign-field-list.mjs +8 -49
- package/dist/dashboard/form-organization-workflow.js +70 -120
- package/dist/dashboard/form-organization-workflow.mjs +68 -120
- package/dist/dashboard/item-row.js +92 -0
- package/dist/dashboard/item-row.mjs +63 -0
- package/dist/dashboard/lib/sms.js +3 -0
- package/dist/dashboard/lib/sms.mjs +2 -0
- package/dist/dashboard/order-sections.js +220 -0
- package/dist/dashboard/order-sections.mjs +185 -0
- package/dist/dashboard/preview.js +29 -2
- package/dist/dashboard/preview.mjs +28 -2
- package/dist/shared/lib/helpers.js +7 -0
- package/dist/shared/lib/helpers.mjs +7 -0
- package/package.json +19 -4
- package/types/bridge/lib/url.d.ts +5 -4
- package/types/dashboard/answer-rows.d.ts +30 -0
- package/types/dashboard/card-order.d.ts +16 -14
- package/types/dashboard/form-organization-workflow.d.ts +2 -0
- package/types/dashboard/item-row.d.ts +25 -0
- package/types/dashboard/order-sections.d.ts +36 -0
- package/types/shared/lib/helpers.d.ts +1 -1
|
@@ -1,6 +1,10 @@
|
|
|
1
|
-
import { ComponentType } from 'react';
|
|
1
|
+
import { ComponentType, ReactNode } from 'react';
|
|
2
|
+
import { Answer, AnswerField } from './answer-rows';
|
|
3
|
+
import { ItemRowFile } from './item-row';
|
|
2
4
|
|
|
3
5
|
export interface CardOrderLine {
|
|
6
|
+
// A form line's item file, or a store line's product image url.
|
|
7
|
+
image?: ItemRowFile | string | null;
|
|
4
8
|
price?: number;
|
|
5
9
|
quantity?: number;
|
|
6
10
|
title?: string;
|
|
@@ -16,31 +20,29 @@ export interface CardOrderProvider {
|
|
|
16
20
|
slug?: string;
|
|
17
21
|
}
|
|
18
22
|
|
|
19
|
-
export interface CardOrderCustomer {
|
|
20
|
-
email?: string | null;
|
|
21
|
-
firstName?: string | null;
|
|
22
|
-
lastName?: string | null;
|
|
23
|
-
phone?: string | null;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
23
|
export interface CardOrderProps {
|
|
24
|
+
// A form order's submission answers.
|
|
25
|
+
answers?: Answer[];
|
|
26
|
+
// A form order: drawn under its Status row ( the page's Fulfillment section ).
|
|
27
|
+
children?: ReactNode;
|
|
28
|
+
// A form order: drawn at the Status row's right ( the page's three dots ).
|
|
29
|
+
cta?: ReactNode;
|
|
27
30
|
// ISO code, lower or upper case; defaults to usd.
|
|
28
31
|
currency?: string;
|
|
29
|
-
// A form order's customer, shown in its drawer.
|
|
30
|
-
customer?: CardOrderCustomer | null;
|
|
31
32
|
fee?: number;
|
|
33
|
+
// A form order: the campaign's fields, removed ones included.
|
|
34
|
+
fields?: AnswerField[];
|
|
32
35
|
gross?: number;
|
|
33
36
|
lines?: CardOrderLine[];
|
|
34
37
|
net?: number;
|
|
35
|
-
// A form order's note and pickup.
|
|
36
|
-
note?: string | null;
|
|
37
|
-
pickup?: string | null;
|
|
38
38
|
provider?: CardOrderProvider;
|
|
39
39
|
purchasedAt?: string | number | Date;
|
|
40
40
|
// Fee rate in percent; not shown for a redemption.
|
|
41
41
|
rate?: number | null;
|
|
42
|
+
// A form order's status.
|
|
43
|
+
status?: 'canceled' | 'completed' | 'open' | string;
|
|
42
44
|
// Picks the attribution sentence; anything but 'redemption' reads as a campaign
|
|
43
|
-
// order. 'form' shows a form order:
|
|
45
|
+
// order. 'form' shows a form order: its status, items and answers.
|
|
44
46
|
type?: 'conversion' | 'form' | 'redemption' | string;
|
|
45
47
|
}
|
|
46
48
|
|
|
@@ -113,5 +113,7 @@ export declare const stepReason: ( options: { entry?: WorkflowCatalogEntry | nul
|
|
|
113
113
|
export declare const SAMPLE: { email: string; name: string; order: string; phone: string };
|
|
114
114
|
// The JSON a Send webhook posts, for the sample lead.
|
|
115
115
|
export declare const webhookSample: ( args: { campaign?: { id?: string; title?: string } | null } ) => string;
|
|
116
|
+
// A text as a phone shows it: who it is from, then the bubble holding `children`.
|
|
117
|
+
export declare const TextPreview: ComponentType<{ children?: import( 'react' ).ReactNode; from?: string | null }>;
|
|
116
118
|
// The team email's title and lines, for a new entry or an order.
|
|
117
119
|
export declare const teamSample: ( args: { campaign?: { title?: string } | null; event?: string; organization?: { title?: string } | null } ) => { lines: string[]; title: string };
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { ComponentType, ReactNode } from 'react';
|
|
2
|
+
|
|
3
|
+
export interface ItemRowFile {
|
|
4
|
+
filename?: string;
|
|
5
|
+
id?: string;
|
|
6
|
+
mimetype?: string;
|
|
7
|
+
sizes?: Record<string, string>;
|
|
8
|
+
updatedAt?: string | number | Date;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export interface ItemRowProps {
|
|
12
|
+
// The image's alt text; falls back to the file's name, then the item's name.
|
|
13
|
+
description?: string | null;
|
|
14
|
+
// A sortable list's drag handle, drawn first.
|
|
15
|
+
handle?: ReactNode;
|
|
16
|
+
// An uploaded file, or a store's image url; a grey square without one.
|
|
17
|
+
image?: ItemRowFile | string | null;
|
|
18
|
+
name?: ReactNode;
|
|
19
|
+
// The grey line under the name.
|
|
20
|
+
summary?: ReactNode;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
declare const ItemRow: ComponentType<ItemRowProps>;
|
|
24
|
+
|
|
25
|
+
export default ItemRow;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { ComponentType } from 'react';
|
|
2
|
+
|
|
3
|
+
export interface ConfirmOptions {
|
|
4
|
+
// The dialog's title and its button.
|
|
5
|
+
action: string;
|
|
6
|
+
body?: Record<string, unknown>;
|
|
7
|
+
endpoint: string;
|
|
8
|
+
// The one sentence saying what happens.
|
|
9
|
+
message?: string;
|
|
10
|
+
method?: 'DELETE' | 'POST' | 'PUT';
|
|
11
|
+
onSuccess?: ( response: unknown ) => void;
|
|
12
|
+
// Why the action is blocked: shown as a warning, the button disabled.
|
|
13
|
+
task?: string;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export declare const useConfirm: () => ( options: ConfirmOptions ) => void;
|
|
17
|
+
|
|
18
|
+
export interface FulfillmentOrder {
|
|
19
|
+
fulfillment?: { status?: 'fulfilled' | 'unfulfilled' | string } | null;
|
|
20
|
+
id?: string;
|
|
21
|
+
status?: 'canceled' | 'completed' | 'open' | string;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export declare const fulfillmentControls: ( options: { manage?: boolean; order?: FulfillmentOrder | null } ) => { add: boolean; cancel: boolean };
|
|
25
|
+
|
|
26
|
+
export interface OrderFulfillmentProps {
|
|
27
|
+
// The organization's order: /organization/:organization/order/:order.
|
|
28
|
+
endpoint: string;
|
|
29
|
+
// Manage access to Leads.
|
|
30
|
+
manage?: boolean;
|
|
31
|
+
// Gets the saved order after a confirmed change.
|
|
32
|
+
onSuccess?: ( response: unknown ) => void;
|
|
33
|
+
order: FulfillmentOrder;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export declare const OrderFulfillment: ComponentType<OrderFulfillmentProps>;
|
|
@@ -127,7 +127,7 @@ export declare const usageBadge: ( allowance: Allowance | null | undefined ) =>
|
|
|
127
127
|
// @story admin/organizations-list
|
|
128
128
|
export declare const acceptingBadge: ( accepting: Accepting | null | undefined ) => Badge | null;
|
|
129
129
|
|
|
130
|
-
export type StatusKind = 'advertisement' | 'campaign' | 'connection' | 'draw' | 'invoice' | 'member' | 'organization' | 'page' | 'prize' | 'range' | 'subscription' | 'workflow';
|
|
130
|
+
export type StatusKind = 'advertisement' | 'campaign' | 'connection' | 'draw' | 'invoice' | 'member' | 'order' | 'organization' | 'page' | 'prize' | 'range' | 'subscription' | 'workflow';
|
|
131
131
|
|
|
132
132
|
// The badge beside a table title: each kind says which of its statuses get one; null for the rest.
|
|
133
133
|
export declare const statusBadge: ( kind: StatusKind, status: string | null | undefined ) => Badge | null;
|