@drawbridge/components 0.1.46 → 0.1.48

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.
Files changed (162) hide show
  1. package/dist/bridge/cart-drawer.js +152 -0
  2. package/dist/bridge/cart-drawer.mjs +123 -0
  3. package/dist/bridge/fields.js +278 -0
  4. package/dist/bridge/fields.mjs +276 -1
  5. package/dist/bridge/form-subdomain-checkout.js +687 -0
  6. package/dist/bridge/form-subdomain-checkout.mjs +665 -0
  7. package/dist/bridge/form-subdomain-shop-modal.js +234 -274
  8. package/dist/bridge/form-subdomain-shop-modal.mjs +233 -275
  9. package/dist/bridge/form-subdomain-shop.js +4 -1
  10. package/dist/bridge/form-subdomain-shop.mjs +4 -1
  11. package/dist/bridge/form-subdomain.js +24 -5
  12. package/dist/bridge/form-subdomain.mjs +25 -6
  13. package/dist/bridge/lib/age-gate.js +12 -0
  14. package/dist/bridge/lib/age-gate.mjs +11 -0
  15. package/dist/bridge/lib/cart.js +79 -0
  16. package/dist/bridge/lib/cart.mjs +48 -0
  17. package/dist/bridge/lib/checkout-kit.js +2 -32
  18. package/dist/bridge/lib/checkout-kit.mjs +2 -32
  19. package/dist/bridge/lib/entry.js +41 -0
  20. package/dist/bridge/lib/entry.mjs +40 -0
  21. package/dist/bridge/product-tile.js +13 -6
  22. package/dist/bridge/product-tile.mjs +13 -6
  23. package/dist/bridge/template-layout.js +263 -129
  24. package/dist/bridge/template-layout.mjs +264 -130
  25. package/dist/bridge/template-modal.js +39 -74
  26. package/dist/bridge/template-modal.mjs +40 -75
  27. package/dist/dashboard/avatar.js +2 -3
  28. package/dist/dashboard/avatar.mjs +2 -3
  29. package/dist/dashboard/buttons-subscription.js +1 -1
  30. package/dist/dashboard/buttons-subscription.mjs +1 -1
  31. package/dist/dashboard/campaign-form.js +179 -155
  32. package/dist/dashboard/campaign-form.mjs +179 -155
  33. package/dist/dashboard/campaign-share.js +347 -0
  34. package/dist/dashboard/campaign-share.mjs +314 -0
  35. package/dist/dashboard/card-affiliate.js +1 -1
  36. package/dist/dashboard/card-affiliate.mjs +1 -1
  37. package/dist/dashboard/card-campaign-switch.js +4 -1
  38. package/dist/dashboard/card-campaign-switch.mjs +4 -1
  39. package/dist/dashboard/card-order.js +22 -4
  40. package/dist/dashboard/card-order.mjs +22 -4
  41. package/dist/dashboard/embed-stripe.js +145 -0
  42. package/dist/dashboard/embed-stripe.mjs +116 -0
  43. package/dist/dashboard/form-admin-provider.js +71 -17
  44. package/dist/dashboard/form-admin-provider.mjs +71 -17
  45. package/dist/dashboard/form-file-upload.js +3 -2
  46. package/dist/dashboard/form-file-upload.mjs +4 -3
  47. package/dist/dashboard/form-organization-campaign-advertisements.js +47 -6
  48. package/dist/dashboard/form-organization-campaign-advertisements.mjs +47 -6
  49. package/dist/dashboard/form-organization-campaign-field-birthday.js +193 -0
  50. package/dist/dashboard/form-organization-campaign-field-birthday.mjs +164 -0
  51. package/dist/dashboard/form-organization-campaign-field-rating.js +246 -0
  52. package/dist/dashboard/form-organization-campaign-field-rating.mjs +217 -0
  53. package/dist/dashboard/form-organization-campaign-page.js +73 -39
  54. package/dist/dashboard/form-organization-campaign-page.mjs +73 -39
  55. package/dist/dashboard/form-organization-campaign.js +82 -0
  56. package/dist/dashboard/form-organization-campaign.mjs +81 -0
  57. package/dist/dashboard/form-organization-connection.js +48 -6
  58. package/dist/dashboard/form-organization-connection.mjs +48 -7
  59. package/dist/dashboard/form-organization-product.js +1461 -0
  60. package/dist/dashboard/form-organization-product.mjs +1425 -0
  61. package/dist/dashboard/form-organization-workflow.js +72 -1
  62. package/dist/dashboard/form-organization-workflow.mjs +69 -1
  63. package/dist/dashboard/form-otc.js +4 -5
  64. package/dist/dashboard/form-otc.mjs +4 -5
  65. package/dist/dashboard/form-stripe.js +12 -5
  66. package/dist/dashboard/form-stripe.mjs +12 -5
  67. package/dist/dashboard/input-combobox.js +6 -0
  68. package/dist/dashboard/input-combobox.mjs +6 -0
  69. package/dist/dashboard/input-fields.js +37 -161
  70. package/dist/dashboard/input-fields.mjs +37 -161
  71. package/dist/dashboard/input-file.js +21 -4
  72. package/dist/dashboard/input-file.mjs +21 -4
  73. package/dist/dashboard/input-font.js +2 -0
  74. package/dist/dashboard/input-font.mjs +2 -0
  75. package/dist/dashboard/input-gallery.js +201 -0
  76. package/dist/dashboard/input-gallery.mjs +172 -0
  77. package/dist/dashboard/input-group-ai.js +15 -3
  78. package/dist/dashboard/input-group-ai.mjs +15 -3
  79. package/dist/dashboard/lib/ab-tests.js +2 -2
  80. package/dist/dashboard/lib/ab-tests.mjs +2 -2
  81. package/dist/dashboard/lib/connection-controls.js +5 -2
  82. package/dist/dashboard/lib/connection-controls.mjs +3 -1
  83. package/dist/dashboard/lib/form-page.js +1 -1
  84. package/dist/dashboard/lib/form-page.mjs +1 -1
  85. package/dist/dashboard/lib/menu.js +19 -0
  86. package/dist/dashboard/lib/menu.mjs +18 -0
  87. package/dist/dashboard/lib/products.js +169 -0
  88. package/dist/dashboard/lib/products.mjs +135 -0
  89. package/dist/dashboard/lib/settings-paths.js +35 -0
  90. package/dist/dashboard/lib/settings-paths.mjs +11 -0
  91. package/dist/dashboard/lib/uppy.js +10 -1
  92. package/dist/dashboard/lib/uppy.mjs +11 -2
  93. package/dist/dashboard/menu.js +13 -2
  94. package/dist/dashboard/menu.mjs +13 -2
  95. package/dist/dashboard/order-sections.js +456 -6
  96. package/dist/dashboard/order-sections.mjs +453 -7
  97. package/dist/dashboard/preview.js +119 -52
  98. package/dist/dashboard/preview.mjs +119 -52
  99. package/dist/dashboard/provider-ui.js +9 -7
  100. package/dist/dashboard/provider-ui.mjs +9 -7
  101. package/dist/dashboard/recharts.js +10 -4
  102. package/dist/dashboard/recharts.mjs +10 -4
  103. package/dist/dashboard/shipping-rates.js +404 -0
  104. package/dist/dashboard/shipping-rates.mjs +371 -0
  105. package/dist/dashboard/template-buyer.js +301 -0
  106. package/dist/dashboard/template-buyer.mjs +267 -0
  107. package/dist/dashboard/template-dashboard.js +11 -1
  108. package/dist/dashboard/template-dashboard.mjs +11 -1
  109. package/dist/dashboard/template-design.js +209 -130
  110. package/dist/dashboard/template-design.mjs +210 -131
  111. package/dist/dashboard/template-ui.js +157 -55
  112. package/dist/dashboard/template-ui.mjs +158 -56
  113. package/dist/icons/flags.js +134 -0
  114. package/dist/icons/flags.mjs +115 -0
  115. package/dist/input-checkbox.js +28 -10
  116. package/dist/input-checkbox.mjs +28 -10
  117. package/dist/product.js +96 -24
  118. package/dist/product.mjs +97 -25
  119. package/dist/shared/carousel.js +14 -5
  120. package/dist/shared/carousel.mjs +14 -5
  121. package/dist/shared/lib/helpers.js +54 -6
  122. package/dist/shared/lib/helpers.mjs +53 -8
  123. package/dist/shared/order-summary.js +139 -0
  124. package/dist/shared/order-summary.mjs +110 -0
  125. package/package.json +84 -4
  126. package/types/bridge/cart-drawer.d.ts +31 -0
  127. package/types/bridge/fields.d.ts +14 -2
  128. package/types/bridge/form-subdomain-checkout.d.ts +20 -0
  129. package/types/bridge/form-subdomain-shop-modal.d.ts +27 -3
  130. package/types/bridge/form-subdomain.d.ts +13 -0
  131. package/types/bridge/lib/age-gate.d.ts +5 -0
  132. package/types/bridge/lib/cart.d.ts +44 -0
  133. package/types/bridge/lib/checkout-kit.d.ts +2 -10
  134. package/types/bridge/lib/entry.d.ts +5 -0
  135. package/types/bridge/product-tile.d.ts +2 -0
  136. package/types/dashboard/campaign-share.d.ts +16 -0
  137. package/types/dashboard/card-order.d.ts +6 -0
  138. package/types/dashboard/embed-stripe.d.ts +25 -0
  139. package/types/dashboard/form-admin-provider.d.ts +9 -2
  140. package/types/dashboard/form-file-upload.d.ts +2 -1
  141. package/types/dashboard/form-organization-campaign-advertisements.d.ts +3 -0
  142. package/types/dashboard/form-organization-campaign-field-birthday.d.ts +31 -0
  143. package/types/dashboard/form-organization-campaign-field-rating.d.ts +33 -0
  144. package/types/dashboard/form-organization-campaign-page.d.ts +8 -1
  145. package/types/dashboard/form-organization-campaign.d.ts +3 -0
  146. package/types/dashboard/form-organization-connection.d.ts +11 -0
  147. package/types/dashboard/form-organization-product.d.ts +24 -0
  148. package/types/dashboard/form-otc.d.ts +5 -1
  149. package/types/dashboard/form-stripe.d.ts +3 -2
  150. package/types/dashboard/input-combobox.d.ts +2 -0
  151. package/types/dashboard/input-file.d.ts +2 -0
  152. package/types/dashboard/input-gallery.d.ts +14 -0
  153. package/types/dashboard/lib/products.d.ts +14 -0
  154. package/types/dashboard/lib/settings-paths.d.ts +5 -0
  155. package/types/dashboard/order-sections.d.ts +24 -1
  156. package/types/dashboard/preview.d.ts +11 -3
  157. package/types/dashboard/shipping-rates.d.ts +26 -0
  158. package/types/dashboard/template-buyer.d.ts +50 -0
  159. package/types/icons/flags.d.ts +5 -0
  160. package/types/input-checkbox.d.ts +2 -0
  161. package/types/shared/lib/helpers.d.ts +4 -0
  162. package/types/shared/order-summary.d.ts +19 -0
@@ -0,0 +1,44 @@
1
+ // The page's cart as the browser keeps it: its id per campaign, for 30 days.
2
+
3
+ export interface CartLine {
4
+ availableForSale?: boolean;
5
+ currency?: string | null;
6
+ id: string;
7
+ image?: string | null;
8
+ left?: number | null;
9
+ price?: number | string | null;
10
+ productTitle?: string | null;
11
+ quantity: number;
12
+ variantId?: string;
13
+ variantTitle?: string | null;
14
+ }
15
+
16
+ export interface Cart {
17
+ checkout?: 'shopify' | 'stripe';
18
+ checkoutUrl?: string | null;
19
+ id: string;
20
+ lines: CartLine[];
21
+ // Up to 3 products the cart's items recommend, as the product panel opens them.
22
+ recommended?: any[];
23
+ }
24
+
25
+ // A recommended product as its row draws it.
26
+ export interface RecommendedRow {
27
+ currency: string | null;
28
+ id?: string;
29
+ image: string | null;
30
+ price: number | null;
31
+ title: string;
32
+ }
33
+
34
+ export declare const cartKey: ( args: { campaign: string; subdomain: string } ) => string;
35
+ export declare const cartAlive: ( made: number | string | null, now?: number ) => boolean;
36
+ export declare const cartCount: ( cart?: Cart | null ) => number;
37
+ export declare const withQuantity: ( cart: Cart | null, id: string, quantity: number ) => Cart | null;
38
+ export declare const lineNote: ( line: CartLine, cut?: string[] ) => string | null;
39
+ export declare const canCheckout: ( cart?: Cart | null ) => boolean;
40
+
41
+ // What Continue sends to keep the buyer's email on the cart; null in a preview.
42
+ export declare const continueRequest: ( options: { cartId?: string | null; email: string; params?: { slug?: string; subdomain?: string } | null; preview?: boolean } ) => { body: { cartId: string; email: string }; endpoint: string; method: 'PUT' } | null;
43
+ export declare const productImage: ( product: any, size: string ) => string | null;
44
+ export declare const recommendedRow: ( product: any ) => RecommendedRow;
@@ -2,26 +2,18 @@
2
2
  // the server, where both calls refuse or do nothing.
3
3
 
4
4
  export interface CheckoutArgs {
5
- advertisement?: string;
6
- affiliate?: string | null;
7
- campaign?: string;
8
5
  checkoutUrl?: string;
9
- lines?: { merchandiseId: string; quantity: number }[];
10
6
  onClose?: () => void;
11
7
  onComplete?: ( detail?: unknown ) => void;
12
8
  onOpen?: () => void;
13
9
  // Same-window fallback when no popup can open; defaults to window.location.assign.
14
10
  onRedirect?: ( url: string ) => void;
15
- organization?: string;
16
- page?: string;
17
- slug?: string;
18
- subdomain?: string;
19
11
  [ key: string ]: unknown;
20
12
  }
21
13
 
22
14
  // Preloads and registers the element; rejects on the server or if the package fails to load.
23
15
  export declare const ensureCheckoutKit: () => Promise<void>;
24
16
 
25
- // Creates the cart from `lines` (or takes `checkoutUrl`) and opens checkout in a
26
- // popup, else redirects. Resolves to the checkout url, or null when there is none.
17
+ // Opens the store's `checkoutUrl` in a popup, else redirects. Resolves to the
18
+ // checkout url, or null when there is none.
27
19
  export declare const checkout: ( args: CheckoutArgs ) => Promise<string | null>;
@@ -37,6 +37,11 @@ export declare const AFTER: Array<'message' | 'missions' | 'advertisements'>;
37
37
  export declare const afterOrder: ( data?: { after?: string[]; form?: { after?: string[] } | boolean } | null ) => string[];
38
38
 
39
39
  // The missions a panel lists; `repeat` (the entry limit was reached) drops the Lead form row.
40
+ // The Form page's preview: the step and state it picked, as the page shows them.
41
+ export declare const previewStep: (
42
+ data: Record<string, any> | null | undefined,
43
+ open?: { panel?: Record<string, unknown>; state?: string; step?: string }
44
+ ) => { face: string | null; modal: boolean; panel?: { name: string; data?: Record<string, unknown>; read?: string; step?: number } };
40
45
  export declare const panelMissions: <T extends { type?: string }>( missions?: T[] | null, repeat?: boolean ) => T[] | null;
41
46
 
42
47
  // The consent checkboxes' wording when an agreement has no label of its own.
@@ -12,6 +12,8 @@ export interface ProductTileVariant {
12
12
  }
13
13
 
14
14
  export interface ProductTileProps {
15
+ // The first tile: its picture loads at once.
16
+ eager?: boolean;
15
17
  image?: string;
16
18
  onClick?: () => void;
17
19
  stacked?: boolean;
@@ -0,0 +1,16 @@
1
+ import { ComponentType, SVGProps } from 'react';
2
+
3
+ export interface CampaignShareButton {
4
+ 'data-guide': string;
5
+ disabled: boolean;
6
+ onClick: () => void;
7
+ svg: ComponentType<SVGProps<SVGSVGElement>>;
8
+ title: string;
9
+ }
10
+
11
+ // Share for a campaign's Overview: the header's Share button
12
+ // and the opener of Share your campaign.
13
+ export declare const useCampaignShare: ( options: { params: { campaign: string; organization: string } } ) => {
14
+ button: CampaignShareButton;
15
+ share: ( values?: object ) => void;
16
+ };
@@ -3,6 +3,10 @@ import { Answer, AnswerField } from './answer-rows';
3
3
  import { CardShortcutFile } from './card-shortcut';
4
4
 
5
5
  export interface CardOrderLine {
6
+ // A digital line: how many times the buyer downloaded it.
7
+ downloads?: number;
8
+ // A digital line's file id; the line then reads its downloads.
9
+ file?: string | null;
6
10
  // A form line's item file, or a store line's product image url.
7
11
  image?: CardShortcutFile | string | null;
8
12
  price?: number;
@@ -35,6 +39,8 @@ export interface CardOrderProps {
35
39
  gross?: number;
36
40
  lines?: CardOrderLine[];
37
41
  net?: number;
42
+ // Resend download on each digital line; emails the buyer their links again.
43
+ onResend?: () => void;
38
44
  provider?: CardOrderProvider;
39
45
  purchasedAt?: string | number | Date;
40
46
  // Fee rate in percent; not shown for a redemption.
@@ -0,0 +1,25 @@
1
+ import { ComponentType } from 'react';
2
+
3
+ // One of Stripe's Connect embedded components, drawn by Stripe. Loads Stripe's
4
+ // Connect.js with the [ 'app' ] query's credentials.stripePublishableKey on first use and POSTs `endpoint`
5
+ // for each Account Session secret ( the answer's result.clientSecret ).
6
+ export interface EmbedStripeProps {
7
+ // The section, by the name its Account Session takes: 'account_onboarding',
8
+ // 'account_management', 'notification_banner', 'tax_settings',
9
+ // 'tax_registrations', 'payment_details'.
10
+ component: string;
11
+ // The connection's session route: /organization/:organization/connection/:id/session.
12
+ endpoint: string;
13
+ // payment_details only: the person closed Stripe's overlay.
14
+ onClose?: () => void;
15
+ // account_onboarding only: the person left Stripe's setup.
16
+ onExit?: () => void;
17
+ // notification_banner only: how many notices Stripe shows, and how many need an answer.
18
+ onNotificationsChange?: ( response: { actionRequired: number; total: number } ) => void;
19
+ // payment_details only: the PaymentIntent the overlay opens on.
20
+ payment?: string;
21
+ }
22
+
23
+ declare const EmbedStripe: ComponentType<EmbedStripeProps>;
24
+
25
+ export default EmbedStripe;
@@ -1,14 +1,21 @@
1
1
  import { ComponentType } from 'react';
2
2
 
3
3
  export interface FormAdminProviderField {
4
- input: 'text' | 'password' | 'email' | 'switch' | string;
4
+ // A select with `hook` is a picker over GET /admin/provider/:slug/hook/:hook
5
+ // that stores the picked item's bare id; a select with `options` is a list.
6
+ hook?: string;
7
+ input: 'text' | 'password' | 'email' | 'select' | 'switch' | string;
8
+ // A dotted path into the nested settings, e.g. 'plans.default.prices.starter'.
5
9
  key: string;
6
10
  label: string;
7
11
  // A stored secret's recognisable mask, e.g. 'kls••••••••9f3a'.
8
12
  mask?: string | null;
9
13
  message?: string | null;
14
+ options?: { label: string; value: string }[];
10
15
  redact?: boolean;
11
16
  required?: boolean;
17
+ // false when the vendor cannot search.
18
+ search?: boolean;
12
19
  // Whether a value is stored.
13
20
  set?: boolean;
14
21
  }
@@ -20,7 +27,7 @@ export interface FormAdminProviderProps {
20
27
  enabled?: boolean;
21
28
  fields?: FormAdminProviderField[];
22
29
  live?: boolean;
23
- // Plain fields only: a secret never comes back.
30
+ // Nested like the stored object; plain fields only, a secret never comes back.
24
31
  settings?: Record<string, unknown>;
25
32
  slug?: string;
26
33
  title?: string;
@@ -7,7 +7,8 @@ export interface FormFileUploadProps {
7
7
  // Video ceiling in bytes; defaults to the shared cap the api enforces.
8
8
  maximumUploadBytes?: number;
9
9
  onSuccess: ( response: unknown ) => void;
10
- // Which formats are accepted: 'all' | 'media' | 'image' | 'video' | 'application'.
10
+ // Which formats are accepted: 'all' | 'media' | 'image' | 'video' | 'application',
11
+ // or 'digital': a product variant's private file, always through multipart.
11
12
  type?: string;
12
13
  }
13
14
 
@@ -1,6 +1,9 @@
1
1
  import { ComponentType } from 'react';
2
2
 
3
3
  export interface FormOrganizationCampaignAdvertisementsProps {
4
+ // The campaign's Products and checkout: 'stripe' names the tab Products and
5
+ // lists the products made in Drawbridge.
6
+ checkout?: 'shopify' | 'stripe' | null;
4
7
  // The organization's commerce connection, for the Store tab.
5
8
  commerce?: { slug?: string; title?: string } | null;
6
9
  disabled?: boolean;
@@ -0,0 +1,31 @@
1
+ import { ComponentType } from 'react';
2
+
3
+ // @story fields/birthday
4
+ // What the Form page passes: the api's catalog entry (inputs, slug, type) plus
5
+ // the route ids, and the saved field when editing. An input left out of
6
+ // `inputs` renders disabled. A custom section's question only, never a prize's.
7
+ export interface FormOrganizationCampaignFieldBirthdayValues {
8
+ campaign: string;
9
+ id?: string;
10
+ inputs?: Array<'attributes' | 'label'>;
11
+ organization: string;
12
+ slug?: string;
13
+ type?: 'additional';
14
+ // The Required switch, on to start.
15
+ attributes?: { required?: boolean };
16
+ label?: string;
17
+ // The custom section the question sits in.
18
+ section?: string;
19
+ [ key: string ]: unknown;
20
+ }
21
+
22
+ export interface FormOrganizationCampaignFieldBirthdayProps {
23
+ disabled?: boolean;
24
+ onError: ( error: Error ) => void;
25
+ onSuccess: ( response: unknown ) => void;
26
+ values: FormOrganizationCampaignFieldBirthdayValues;
27
+ }
28
+
29
+ declare const FormOrganizationCampaignFieldBirthday: ComponentType<FormOrganizationCampaignFieldBirthdayProps>;
30
+
31
+ export default FormOrganizationCampaignFieldBirthday;
@@ -0,0 +1,33 @@
1
+ import { ComponentType } from 'react';
2
+
3
+ // @story fields/rating
4
+ // What the Form page passes: the api's catalog entry (inputs, slug, type) plus
5
+ // the route ids, and the saved field when editing. An input left out of
6
+ // `inputs` renders disabled. A custom section's question only, never a prize's.
7
+ export interface FormOrganizationCampaignFieldRatingValues {
8
+ campaign: string;
9
+ id?: string;
10
+ inputs?: Array<'attributes' | 'label' | 'settings'>;
11
+ organization: string;
12
+ slug?: string;
13
+ type?: 'additional';
14
+ // Scale is attributes.max, 3 to 10, 5 to start; the Required switch, on to start.
15
+ attributes?: { max?: number; required?: boolean };
16
+ label?: string;
17
+ // The words under 1 and under the highest number, up to 50 each.
18
+ settings?: { high?: string | null; low?: string | null };
19
+ // The custom section the question sits in.
20
+ section?: string;
21
+ [ key: string ]: unknown;
22
+ }
23
+
24
+ export interface FormOrganizationCampaignFieldRatingProps {
25
+ disabled?: boolean;
26
+ onError: ( error: Error ) => void;
27
+ onSuccess: ( response: unknown ) => void;
28
+ values: FormOrganizationCampaignFieldRatingValues;
29
+ }
30
+
31
+ declare const FormOrganizationCampaignFieldRating: ComponentType<FormOrganizationCampaignFieldRatingProps>;
32
+
33
+ export default FormOrganizationCampaignFieldRating;
@@ -29,8 +29,15 @@ export interface FormOrganizationCampaignPageEditProps {
29
29
  // Called with the form values as they change, for the live preview.
30
30
  onUpdate: ( values: unknown ) => void;
31
31
  organization?: Organization;
32
- // A page of a test: Content and Design tabs inside the form, one Save for both.
32
+ // A page of a test: Content and Style tabs inside the form, one Save for both.
33
+ // With `images`, the Design page's main page: Style saves to the campaign's design.
33
34
  tabs?: boolean;
35
+ // The Design page's linked brand: it sets the logo, preview image and style.
36
+ brand?: { id: string; title?: string } | null;
37
+ // The main page's Logo and Preview image, saved to the campaign's design.
38
+ images?: boolean;
39
+ // Drawn in the Style tab while `brand` is linked.
40
+ linked?: import( 'react' ).ReactNode;
34
41
  values?: FormOrganizationCampaignPageEditValues;
35
42
  }
36
43
 
@@ -60,3 +60,6 @@ export declare const FormOrganizationCampaignTitle: ComponentType<FormOrganizati
60
60
  // The Giveaway page's Winner claim window: days, 1 to 365, 7 to start.
61
61
  export declare const FormOrganizationCampaignClaimWindow: ComponentType<FormOrganizationCampaignFormProps>;
62
62
  export declare const FormOrganizationCampaignSettingsShop: ComponentType<FormOrganizationCampaignFormProps>;
63
+
64
+ // The campaign's Checkout dialog: Stripe or Shopify, handed to `onSubmit`.
65
+ export declare const FormOrganizationCampaignCheckout: ComponentType<{ disabled?: boolean; onSubmit: ( checkout: 'shopify' | 'stripe' ) => void; values?: { checkout?: 'shopify' | 'stripe' } }>;
@@ -45,3 +45,14 @@ export interface FormOrganizationConnectionProps {
45
45
  }
46
46
 
47
47
  export declare const FormOrganizationConnection: ComponentType<FormOrganizationConnectionProps>;
48
+
49
+ // One editable field, drawn by its declared kind. A field with a `hook` is a
50
+ // paged, searchable picker over `endpoint` that stores the bare id; `titleFor`
51
+ // names a stored id.
52
+ export declare const Editable: ComponentType<{
53
+ endpoint?: string;
54
+ field: FormOrganizationConnectionField;
55
+ onChange: ( value: unknown ) => void;
56
+ titleFor?: ( id: string ) => string;
57
+ value?: unknown;
58
+ }>;
@@ -0,0 +1,24 @@
1
+ import { ComponentType } from 'react';
2
+
3
+ type Callback = ( response: unknown ) => void;
4
+
5
+ interface Option { name: string; values: string[] }
6
+
7
+ export declare const FormOrganizationProductCreate: ComponentType<{ campaign: string; onError: Callback; onSuccess: Callback; organization: string }>;
8
+
9
+ export declare const FormProductOption: ComponentType<{ disabled?: boolean; onDone: ( option: Option ) => void; others?: Option[]; values?: Option }>;
10
+
11
+ export declare const FormProductVariant: ComponentType<{ disabled?: boolean; onDone: ( values: Record<string, unknown> ) => void; values: Record<string, unknown> }>;
12
+
13
+ // The product page's body. A product whose `editable` is false opens read only.
14
+ export declare const FormOrganizationProduct: ComponentType<{
15
+ campaign?: string;
16
+ disabled?: boolean;
17
+ onDelete?: () => void;
18
+ onError: Callback;
19
+ onSuccess: Callback;
20
+ organization: { id: string; [ key: string ]: unknown };
21
+ product: Record<string, unknown>;
22
+ }>;
23
+
24
+ export default FormOrganizationProduct;
@@ -1,10 +1,14 @@
1
- import { ComponentType } from 'react';
1
+ import { ComponentType, ReactNode } from 'react';
2
2
 
3
3
  export interface FormOtcCodeProps {
4
+ // The copy under the title; defaults to 'A code will be sent to <identifier>'.
5
+ message?: ReactNode;
4
6
  // Receives the request's error; the page shows it.
5
7
  onError: ( error: unknown ) => void;
6
8
  // Receives the PUT /otc/:id/code response.
7
9
  onSuccess: ( response: unknown ) => void;
10
+ // Defaults to 'Authorization'.
11
+ title?: ReactNode;
8
12
  values?: {
9
13
  // The one-time-code record the code is sent for.
10
14
  id?: string;
@@ -1,8 +1,9 @@
1
1
  import { ComponentType, ReactNode } from 'react';
2
2
 
3
3
  // Stripe's Address and Payment Elements for saving a card. Loads Stripe.js
4
- // with NEXT_PUBLIC_STRIPE_API_KEY when the module is imported, confirms the
5
- // setup intent, then POSTs the payment method to /account/method.
4
+ // with the [ 'app' ] query's credentials.stripePublishableKey ( once per key ),
5
+ // confirms the setup intent, then POSTs the payment method to /account/method.
6
+ // Without a key or a client secret it says payment was not initialized.
6
7
  export interface FormStripeProps {
7
8
  // The submit button's text (default 'Submit').
8
9
  button?: { text?: ReactNode };
@@ -18,6 +18,8 @@ export interface InputComboboxOption {
18
18
  }
19
19
 
20
20
  export interface InputComboboxProps {
21
+ // The name a reader hears when no visible label names it.
22
+ 'aria-label'?: string;
21
23
  disabled?: boolean;
22
24
  onChange: ( value: unknown ) => void;
23
25
  options: InputComboboxOption[];
@@ -15,6 +15,8 @@ export interface InputFileProps {
15
15
  button?: { icon?: ComponentType<SVGProps<SVGSVGElement>>; text?: ReactNode };
16
16
  // This placement's description of the image (its alt text), up to 150 characters.
17
17
  description?: string;
18
+ // A product variant's digital file: the uploader alone, private, no thumbnail.
19
+ digital?: boolean;
18
20
  disabled?: boolean;
19
21
  // With onEdit: a green ring on the thumbnail, the file has been edited ( a gallery crop ).
20
22
  edited?: boolean;
@@ -0,0 +1,14 @@
1
+ import { ComponentType } from 'react';
2
+
3
+ // The gallery editor the page form and the product page share. It reads the
4
+ // surrounding form through useFormContext.
5
+ declare const InputGallery: ComponentType<{
6
+ endpoint: string;
7
+ label?: string | null;
8
+ name?: string;
9
+ onUpdate?: ( values: Record<string, unknown> ) => void;
10
+ organization?: { id: string; [ key: string ]: unknown };
11
+ reposition?: boolean;
12
+ }>;
13
+
14
+ export default InputGallery;
@@ -0,0 +1,14 @@
1
+ // Where a campaign's shop sells, as the Checkout section names it.
2
+ export declare const CHECKOUT_LABELS: Readonly<{ shopify: string; stripe: string }>;
3
+ // The product editor's rules ( drawbridge-utils products underneath ).
4
+ export declare const VARIANT_DEFAULTS: Readonly<Record<string, unknown>>;
5
+ export declare const variantsFor: ( options: unknown[], variants: unknown[] ) => Record<string, unknown>[];
6
+ export declare const moneyOf: ( value: number, currency?: string ) => string;
7
+ export declare const priceText: ( variants?: unknown[] ) => string;
8
+ export declare const variantRows: ( args: { expanded?: string[]; group?: string; options?: unknown[]; variants?: unknown[] } ) => Record<string, unknown>[];
9
+ export declare const totalQuantity: ( variants?: unknown[] ) => number;
10
+ export declare const variantCount: ( options?: unknown[] ) => number;
11
+ export declare const productBody: ( values: Record<string, unknown> ) => Record<string, unknown>;
12
+
13
+ // How many times a digital line was downloaded: '2 downloads', 'Not downloaded yet'.
14
+ export declare const downloadsText: ( count: number ) => string;
@@ -0,0 +1,5 @@
1
+ // The value at a dotted path ('plans.default.product'), or undefined.
2
+ export declare const readPath: ( object: unknown, key: string ) => unknown;
3
+
4
+ // [ [ 'a.b', 1 ], [ 'c', 2 ] ] becomes { a : { b : 1 }, c : 2 }.
5
+ export declare const nestPaths: ( pairs: Array<[ string, unknown ]> ) => Record<string, unknown>;
@@ -11,13 +11,23 @@ export interface ConfirmOptions {
11
11
  onSuccess?: ( response: unknown ) => void;
12
12
  // Why the action is blocked: shown as a warning, the button disabled.
13
13
  task?: string;
14
+ // The dialog's title when it is not the action's own word.
15
+ title?: string;
14
16
  }
15
17
 
16
18
  export declare const useConfirm: () => ( options: ConfirmOptions ) => void;
17
19
 
18
20
  export interface FulfillmentOrder {
19
- fulfillment?: { status?: 'fulfilled' | 'unfulfilled' | string } | null;
21
+ amounts?: { refunded?: number; shipping?: number; subtotal?: number; tax?: number; total?: number } | null;
22
+ currency?: string;
23
+ customer?: { email?: string | null; firstName?: string | null; lastName?: string | null } | null;
24
+ dispute?: { id?: string; status?: string } | null;
25
+ fulfillment?: { status?: 'fulfilled' | 'partially_fulfilled' | 'unfulfilled' | string } | null;
20
26
  id?: string;
27
+ payment?: string | null;
28
+ provider?: { id?: string; name?: string | null; slug?: string } | null;
29
+ shipping?: { address?: Record<string, string | null>; name?: string | null; rate?: { amount?: number; name?: string } | null } | null;
30
+ source?: { domain?: string; id?: string } | null;
21
31
  status?: 'canceled' | 'completed' | 'open' | string;
22
32
  }
23
33
 
@@ -34,3 +44,16 @@ export interface OrderFulfillmentProps {
34
44
  }
35
45
 
36
46
  export declare const OrderFulfillment: ComponentType<OrderFulfillmentProps>;
47
+
48
+ // A paid order's Mark as fulfilled: Carrier, Tracking number, Email the customer.
49
+ export declare const FormFulfill: ComponentType<{ endpoint: string; onError?: ( error: unknown ) => void; onSuccess?: ( response: unknown ) => void }>;
50
+
51
+ // A paid order's Summary: Subtotal, Shipping, Tax and Total.
52
+ export declare const OrderSummarySection: ComponentType<{ order: FulfillmentOrder }>;
53
+
54
+ // A paid order's Customer: Name, Email and Ships to.
55
+ export declare const OrderCustomer: ComponentType<{ order: FulfillmentOrder }>;
56
+
57
+ // A paid order's Payment: Amount, Status and Refund ( Stripe's payment details
58
+ // overlay through `endpoint`, the orders session route ). `onClose` follows the overlay closing.
59
+ export declare const OrderPayment: ComponentType<{ endpoint: string; onClose?: () => void; order: FulfillmentOrder }>;
@@ -23,6 +23,8 @@ export interface PreviewProps {
23
23
  children?: ReactNode;
24
24
  // Inside a SliderLayout, the slide it draws into.
25
25
  id?: string;
26
+ // What the real page needs to draw the step beyond its state.
27
+ page?: Record<string, unknown>;
26
28
  // The step's own states, nested under it in the panel's one picker.
27
29
  states?: PreviewStates;
28
30
  }
@@ -31,14 +33,18 @@ export interface PreviewPageProps {
31
33
  // True by default: beside a form it runs to the page's foot. False: a fixed
32
34
  // 520 px from 1280 px, inside a section with more under it ( the Overview ).
33
35
  fill?: boolean;
34
- // An email: a whole document, at 600 px wide, with no size buttons. Without `url`.
36
+ // An email: a whole document, at a phone's width or 600 px. Without `url`.
35
37
  html?: string;
36
38
  // A picker of the caller's own, in the chip at the top left.
37
39
  left?: ReactNode;
38
- // Posted to the page as { update } whenever it changes.
40
+ // The Form page's step and its state: the page opens them ( `panel`, the After entry's missions and advertisements ).
41
+ open?: { panel?: Record<string, unknown>; state?: string; step?: string };
42
+ // Posted to the page as { open, update } whenever it changes.
39
43
  update?: Record<string, unknown>;
40
44
  // A page: the share page's absolute address, in preview mode.
41
45
  url?: string;
46
+ // A new value loads the page again ( a save ).
47
+ version?: string;
42
48
  // The list the zoom offers; ZOOMS by default.
43
49
  zooms?: PreviewZoom[];
44
50
  }
@@ -54,6 +60,8 @@ export interface SliderLayoutProps {
54
60
  children?: ReactNode;
55
61
  // The slide a press on the Form page's Footer shows.
56
62
  last?: string | null;
63
+ // Every step shown in the campaign's real page, loaded again when `version` changes.
64
+ page?: { url: string; version?: string };
57
65
  // The preview's gray behind the panel, in place of the brand's background.
58
66
  plain?: boolean;
59
67
  slides: Slide[];
@@ -72,7 +80,7 @@ export declare const fitZoom: ( room: number, natural: number ) => number;
72
80
  // A preview beside a form: from its top down to the scroller's foot, less the scroller's bottom padding.
73
81
  export declare const fillHeight: ( args: { foot: number; gap: number; top: number } ) => number;
74
82
  // Sizes `box` that way from 1280 px, as the page scrolls; nothing while `open` over the page.
75
- export declare const useFill: ( box: RefObject<HTMLElement | null>, open?: boolean ) => void;
83
+ export declare const useFill: ( box: RefObject<HTMLElement | null>, open?: boolean, inset?: number, property?: 'height' | 'minHeight' ) => void;
76
84
  export declare const pressScrolls: ( target: unknown, card: unknown ) => boolean;
77
85
  export declare const scrollTarget: ( positions: { node: number; page: number; scrollTop: number } ) => number;
78
86
  export declare const States: ComponentType<PreviewStates & { align?: 'start' | 'end' }>;
@@ -0,0 +1,26 @@
1
+ import { ComponentType } from 'react';
2
+
3
+ export interface ShippingRate {
4
+ country: 'CA' | 'US' | string;
5
+ delivery?: { maximum: number; minimum: number } | null;
6
+ free?: number | null;
7
+ id?: string;
8
+ name: string;
9
+ price: number;
10
+ }
11
+
12
+ // New rate and Edit rate. POSTs ( no `values.id` ) or PUTs `endpoint`.
13
+ export declare const FormRate: ComponentType<{ currency?: string; endpoint: string; onError?: ( error: unknown ) => void; onSuccess?: ( response: unknown ) => void; values?: ShippingRate }>;
14
+
15
+ // The Stripe page's Shipping section: /organization/:organization/rates.
16
+ export interface ShippingRatesProps {
17
+ // The Stripe account's currency.
18
+ currency?: string;
19
+ // Manage access to Connections.
20
+ manage?: boolean;
21
+ organization: string;
22
+ }
23
+
24
+ declare const ShippingRates: ComponentType<ShippingRatesProps>;
25
+
26
+ export default ShippingRates;
@@ -0,0 +1,50 @@
1
+ import { ComponentType, ReactNode } from 'react';
2
+
3
+ // @story orders/buyer-order
4
+ export interface BuyerOrderLine {
5
+ digital: boolean;
6
+ index: number;
7
+ price?: number | null;
8
+ quantity?: number;
9
+ title?: string | null;
10
+ variantTitle?: string | null;
11
+ }
12
+
13
+ export interface BuyerOrderView {
14
+ amounts?: { total?: number } | null;
15
+ currency?: string;
16
+ id: string;
17
+ lines: BuyerOrderLine[];
18
+ number?: string | null;
19
+ organization?: string | null;
20
+ payment?: string | null;
21
+ purchasedAt?: string | Date | null;
22
+ }
23
+
24
+ export interface TemplateBuyerProps {
25
+ children?: ReactNode;
26
+ // Where the Drawbridge mark links.
27
+ home?: string;
28
+ isLoading?: boolean;
29
+ }
30
+
31
+ export interface BuyerOrderProps {
32
+ // The line being downloaded, or null.
33
+ downloading?: number | null;
34
+ onDownload: ( index: number ) => void;
35
+ order: BuyerOrderView;
36
+ }
37
+
38
+ export interface BuyerDownloadProps {
39
+ // The buyer's order page, for View my order.
40
+ href?: string;
41
+ onRetry?: () => void;
42
+ status?: 'starting' | 'expired' | 'failed' | 'refunded' | 'unavailable';
43
+ }
44
+
45
+ export declare const BuyerOrder: ComponentType<BuyerOrderProps>;
46
+ export declare const BuyerDownload: ComponentType<BuyerDownloadProps>;
47
+
48
+ declare const TemplateBuyer: ComponentType<TemplateBuyerProps>;
49
+
50
+ export default TemplateBuyer;
@@ -0,0 +1,5 @@
1
+ import { ComponentType, SVGProps } from 'react';
2
+
3
+ declare const Icon: ComponentType<SVGProps<SVGSVGElement>>;
4
+
5
+ export default Icon;
@@ -5,6 +5,8 @@ export interface InputCheckboxProps extends Omit<ButtonHTMLAttributes<HTMLButton
5
5
  label?: ReactNode;
6
6
  labelId?: string;
7
7
  onChange: ( value: boolean ) => void;
8
+ // A round button with role radio and a dot, for one choice among several.
9
+ round?: boolean;
8
10
  style?: BrandStyle;
9
11
  value?: boolean;
10
12
  }
@@ -140,6 +140,10 @@ export interface Alert {
140
140
  // Why a record needs attention (Warning, or Lock when locked), or null when nothing is wrong.
141
141
  export declare const alertFor: ( record: { capped?: boolean; error?: string | null; errors?: { message?: string }[]; status?: string | null; tasks?: { message?: string }[]; totals?: { connectionAlerts?: number; workflowAlerts?: number } } | null | undefined ) => Alert | null;
142
142
 
143
+ // Drawbridge's publishable key ( GET /app credentials.stripePublishableKey ),
144
+ // handed over by ProviderUi; a test key makes stripeUrl link to /test.
145
+ export declare const setStripeKey: ( key?: string | null ) => void;
146
+
143
147
  export declare const stripeUrl: ( label: string, id: string, ...more: string[] ) => string;
144
148
 
145
149
  export declare const years: ( props: { current: number | string; length?: number } ) => Array<{ key: number; value: number }>;