@01.software/sdk 0.5.1 → 0.5.3

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 (37) hide show
  1. package/dist/auth.d.cts +1 -1
  2. package/dist/auth.d.ts +1 -1
  3. package/dist/{const-CDpRB7XK.d.cts → const-C9I6r5Wa.d.cts} +1 -1
  4. package/dist/{const-DQIDvvB-.d.ts → const-JbuUTzeh.d.ts} +1 -1
  5. package/dist/index.d.cts +6 -6
  6. package/dist/index.d.ts +6 -6
  7. package/dist/{payload-types-C-keX5go.d.cts → payload-types-D8fN_vZR.d.cts} +17 -1
  8. package/dist/{payload-types-C-keX5go.d.ts → payload-types-D8fN_vZR.d.ts} +17 -1
  9. package/dist/realtime.d.cts +2 -2
  10. package/dist/realtime.d.ts +2 -2
  11. package/dist/{server-B80o7igg.d.cts → server-StNHlSjW.d.cts} +5 -1
  12. package/dist/{server-B80o7igg.d.ts → server-StNHlSjW.d.ts} +5 -1
  13. package/dist/ui/code-block.cjs +5 -1
  14. package/dist/ui/code-block.cjs.map +1 -1
  15. package/dist/ui/code-block.js +5 -1
  16. package/dist/ui/code-block.js.map +1 -1
  17. package/dist/ui/flow/server.cjs +101 -34
  18. package/dist/ui/flow/server.cjs.map +1 -1
  19. package/dist/ui/flow/server.d.cts +1 -1
  20. package/dist/ui/flow/server.d.ts +1 -1
  21. package/dist/ui/flow/server.js +101 -34
  22. package/dist/ui/flow/server.js.map +1 -1
  23. package/dist/ui/flow.cjs +718 -180
  24. package/dist/ui/flow.cjs.map +1 -1
  25. package/dist/ui/flow.d.cts +77 -11
  26. package/dist/ui/flow.d.ts +77 -11
  27. package/dist/ui/flow.js +705 -167
  28. package/dist/ui/flow.js.map +1 -1
  29. package/dist/ui/form.d.cts +1 -1
  30. package/dist/ui/form.d.ts +1 -1
  31. package/dist/ui/video.d.cts +1 -1
  32. package/dist/ui/video.d.ts +1 -1
  33. package/dist/{webhook-DseJdRFT.d.ts → webhook-BkwMrrL1.d.ts} +2 -2
  34. package/dist/{webhook-Dqe2_xMx.d.cts → webhook-Dbx-pRib.d.cts} +2 -2
  35. package/dist/webhook.d.cts +3 -3
  36. package/dist/webhook.d.ts +3 -3
  37. package/package.json +5 -3
package/dist/auth.d.cts CHANGED
@@ -1,4 +1,4 @@
1
- import './payload-types-C-keX5go.cjs';
1
+ import './payload-types-D8fN_vZR.cjs';
2
2
 
3
3
  interface JwtPayload {
4
4
  clientKey: string;
package/dist/auth.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import './payload-types-C-keX5go.js';
1
+ import './payload-types-D8fN_vZR.js';
2
2
 
3
3
  interface JwtPayload {
4
4
  clientKey: string;
@@ -1,4 +1,4 @@
1
- import { C as Config } from './payload-types-C-keX5go.cjs';
1
+ import { C as Config } from './payload-types-D8fN_vZR.cjs';
2
2
 
3
3
  /**
4
4
  * Collection type derived from Payload Config.
@@ -1,4 +1,4 @@
1
- import { C as Config } from './payload-types-C-keX5go.js';
1
+ import { C as Config } from './payload-types-D8fN_vZR.js';
2
2
 
3
3
  /**
4
4
  * Collection type derived from Payload Config.
package/dist/index.d.cts CHANGED
@@ -1,13 +1,13 @@
1
- import { O as Order, a as OrderProduct, T as Transaction, b as Fulfillment, R as Return, E as Exchange, c as Cart, d as CartItem, P as Product } from './payload-types-C-keX5go.cjs';
2
- export { o as ApiUsage, au as ApiUsageSelect, A as Audience, aq as AudiencesSelect, bs as Auth, q as BillingHistory, aw as BillingHistorySelect, y as Brand, B as BrandLogo, aF as BrandLogosSelect, aE as BrandsSelect, aV as CartItemsSelect, aU as CartsSelect, g as CodeBlock, br as CollectionsWidget, C as Config, G as Customer, J as CustomerAddress, aS as CustomerAddressesSelect, e as CustomerAuthOperations, H as CustomerGroup, aT as CustomerGroupsSelect, aR as CustomersSelect, W as Discount, aW as DiscountsSelect, $ as Document, b0 as DocumentCategoriesSelect, a1 as DocumentCategory, a0 as DocumentType, b1 as DocumentTypesSelect, a$ as DocumentsSelect, m as EmailLog, ar as EmailLogsSelect, N as ExchangeProduct, aP as ExchangeProductsSelect, aO as ExchangesSelect, j as FieldConfig, an as FieldConfigsSelect, ac as Flow, bf as FlowCategoriesSelect, ad as FlowCategory, ag as FlowEdgeType, be as FlowEdgeTypesSelect, af as FlowNodeType, bd as FlowNodeTypesSelect, ae as FlowTag, bg as FlowTagsSelect, bc as FlowsSelect, F as Form, ah as FormSubmission, bm as FormSubmissionsSelect, bl as FormsSelect, K as FulfillmentItem, aL as FulfillmentItemsSelect, aK as FulfillmentsSelect, b8 as GalleriesSelect, a8 as Gallery, b9 as GalleryCategoriesSelect, a9 as GalleryCategory, ab as GalleryItem, bb as GalleryItemsSelect, aa as GalleryTag, ba as GalleryTagsSelect, I as IframeBlock, k as Image, ao as ImagesSelect, L as LiveStream, bk as LiveStreamsSelect, a5 as Music, b6 as MusicCategoriesSelect, a6 as MusicCategory, a7 as MusicTag, b7 as MusicTagsSelect, b5 as MusicsSelect, aH as OrderProductsSelect, Q as OrderStatusLog, aJ as OrderStatusLogsSelect, aG as OrdersSelect, ai as PayloadKv, bn as PayloadKvSelect, aj as PayloadLockedDocument, bo as PayloadLockedDocumentsSelect, al as PayloadMigration, bq as PayloadMigrationsSelect, ak as PayloadPreference, bp as PayloadPreferencesSelect, f as PlayerBlock, a2 as Playlist, b3 as PlaylistCategoriesSelect, a3 as PlaylistCategory, a4 as PlaylistTag, b4 as PlaylistTagsSelect, b2 as PlaylistsSelect, X as Post, Y as PostAuthor, aY as PostAuthorsSelect, aZ as PostCategoriesSelect, Z as PostCategory, _ as PostTag, a_ as PostTagsSelect, aX as PostsSelect, aB as ProductCategoriesSelect, w as ProductCategory, D as ProductCollection, aD as ProductCollectionsSelect, v as ProductOption, aA as ProductOptionsSelect, x as ProductTag, aC as ProductTagsSelect, u as ProductVariant, az as ProductVariantsSelect, ay as ProductsSelect, M as ReturnProduct, aN as ReturnProductsSelect, aM as ReturnsSelect, aQ as ShippingPoliciesSelect, z as ShippingPolicy, p as Subscription, av as SubscriptionsSelect, S as SupportedTimezones, l as SystemMedia, ap as SystemMediaSelect, i as Tenant, r as TenantLogo, ax as TenantLogosSelect, at as TenantMetadataSelect, n as TenantMetadatum, as as TenantsSelect, aI as TransactionsSelect, h as User, U as UserAuthOperations, am as UsersSelect, V as Video, bi as VideoCategoriesSelect, s as VideoCategory, t as VideoTag, bj as VideoTagsSelect, bh as VideosSelect } from './payload-types-C-keX5go.cjs';
1
+ import { O as Order, a as OrderProduct, T as Transaction, b as Fulfillment, R as Return, E as Exchange, c as Cart, d as CartItem, P as Product } from './payload-types-D8fN_vZR.cjs';
2
+ export { o as ApiUsage, au as ApiUsageSelect, A as Audience, aq as AudiencesSelect, bs as Auth, q as BillingHistory, aw as BillingHistorySelect, y as Brand, B as BrandLogo, aF as BrandLogosSelect, aE as BrandsSelect, aV as CartItemsSelect, aU as CartsSelect, g as CodeBlock, br as CollectionsWidget, C as Config, G as Customer, J as CustomerAddress, aS as CustomerAddressesSelect, e as CustomerAuthOperations, H as CustomerGroup, aT as CustomerGroupsSelect, aR as CustomersSelect, W as Discount, aW as DiscountsSelect, $ as Document, b0 as DocumentCategoriesSelect, a1 as DocumentCategory, a0 as DocumentType, b1 as DocumentTypesSelect, a$ as DocumentsSelect, m as EmailLog, ar as EmailLogsSelect, N as ExchangeProduct, aP as ExchangeProductsSelect, aO as ExchangesSelect, j as FieldConfig, an as FieldConfigsSelect, ac as Flow, bf as FlowCategoriesSelect, ad as FlowCategory, ag as FlowEdgeType, be as FlowEdgeTypesSelect, af as FlowNodeType, bd as FlowNodeTypesSelect, ae as FlowTag, bg as FlowTagsSelect, bc as FlowsSelect, F as Form, ah as FormSubmission, bm as FormSubmissionsSelect, bl as FormsSelect, K as FulfillmentItem, aL as FulfillmentItemsSelect, aK as FulfillmentsSelect, b8 as GalleriesSelect, a8 as Gallery, b9 as GalleryCategoriesSelect, a9 as GalleryCategory, ab as GalleryItem, bb as GalleryItemsSelect, aa as GalleryTag, ba as GalleryTagsSelect, I as IframeBlock, k as Image, ao as ImagesSelect, L as LiveStream, bk as LiveStreamsSelect, a5 as Music, b6 as MusicCategoriesSelect, a6 as MusicCategory, a7 as MusicTag, b7 as MusicTagsSelect, b5 as MusicsSelect, aH as OrderProductsSelect, Q as OrderStatusLog, aJ as OrderStatusLogsSelect, aG as OrdersSelect, ai as PayloadKv, bn as PayloadKvSelect, aj as PayloadLockedDocument, bo as PayloadLockedDocumentsSelect, al as PayloadMigration, bq as PayloadMigrationsSelect, ak as PayloadPreference, bp as PayloadPreferencesSelect, f as PlayerBlock, a2 as Playlist, b3 as PlaylistCategoriesSelect, a3 as PlaylistCategory, a4 as PlaylistTag, b4 as PlaylistTagsSelect, b2 as PlaylistsSelect, X as Post, Y as PostAuthor, aY as PostAuthorsSelect, aZ as PostCategoriesSelect, Z as PostCategory, _ as PostTag, a_ as PostTagsSelect, aX as PostsSelect, aB as ProductCategoriesSelect, w as ProductCategory, D as ProductCollection, aD as ProductCollectionsSelect, v as ProductOption, aA as ProductOptionsSelect, x as ProductTag, aC as ProductTagsSelect, u as ProductVariant, az as ProductVariantsSelect, ay as ProductsSelect, M as ReturnProduct, aN as ReturnProductsSelect, aM as ReturnsSelect, aQ as ShippingPoliciesSelect, z as ShippingPolicy, p as Subscription, av as SubscriptionsSelect, S as SupportedTimezones, l as SystemMedia, ap as SystemMediaSelect, i as Tenant, r as TenantLogo, ax as TenantLogosSelect, at as TenantMetadataSelect, n as TenantMetadatum, as as TenantsSelect, aI as TransactionsSelect, h as User, U as UserAuthOperations, am as UsersSelect, V as Video, bi as VideoCategoriesSelect, s as VideoCategory, t as VideoTag, bj as VideoTagsSelect, bh as VideosSelect } from './payload-types-D8fN_vZR.cjs';
3
3
  import { Sort, Where } from 'payload';
4
4
  import * as _tanstack_react_query from '@tanstack/react-query';
5
5
  import { QueryClient, InfiniteData } from '@tanstack/react-query';
6
6
  import { Metadata } from 'next';
7
- import { P as PublicCollection } from './const-CDpRB7XK.cjs';
8
- export { a as COLLECTIONS, C as Collection } from './const-CDpRB7XK.cjs';
9
- import { C as CollectionType } from './webhook-Dqe2_xMx.cjs';
10
- export { a as WebhookEvent, b as WebhookHandler, W as WebhookOperation, c as WebhookOptions, d as createTypedWebhookHandler, h as handleWebhook, i as isValidWebhookEvent } from './webhook-Dqe2_xMx.cjs';
7
+ import { P as PublicCollection } from './const-C9I6r5Wa.cjs';
8
+ export { a as COLLECTIONS, C as Collection } from './const-C9I6r5Wa.cjs';
9
+ import { C as CollectionType } from './webhook-Dbx-pRib.cjs';
10
+ export { a as WebhookEvent, b as WebhookHandler, W as WebhookOperation, c as WebhookOptions, d as createTypedWebhookHandler, h as handleWebhook, i as isValidWebhookEvent } from './webhook-Dbx-pRib.cjs';
11
11
  export { a as RealtimeConnection, R as RealtimeEvent, b as RealtimeListener } from './realtime-DupPIYx-.cjs';
12
12
  export { b as IMAGE_SIZES, I as ImageData, a as ImagePalette, f as ImagePlaceholderOptions, d as getImageLqip, e as getImagePalette, h as getImagePlaceholderStyle, c as getImageSrcSet, g as getImageUrl } from './image-TT8lTsk5.cjs';
13
13
  export { e as VideoGifOptions, V as VideoThumbnailOptions, a as getVideoGif, c as getVideoMp4Url, d as getVideoStoryboard, b as getVideoStreamUrl, g as getVideoThumbnail } from './video-DbLL8yuc.cjs';
package/dist/index.d.ts CHANGED
@@ -1,13 +1,13 @@
1
- import { O as Order, a as OrderProduct, T as Transaction, b as Fulfillment, R as Return, E as Exchange, c as Cart, d as CartItem, P as Product } from './payload-types-C-keX5go.js';
2
- export { o as ApiUsage, au as ApiUsageSelect, A as Audience, aq as AudiencesSelect, bs as Auth, q as BillingHistory, aw as BillingHistorySelect, y as Brand, B as BrandLogo, aF as BrandLogosSelect, aE as BrandsSelect, aV as CartItemsSelect, aU as CartsSelect, g as CodeBlock, br as CollectionsWidget, C as Config, G as Customer, J as CustomerAddress, aS as CustomerAddressesSelect, e as CustomerAuthOperations, H as CustomerGroup, aT as CustomerGroupsSelect, aR as CustomersSelect, W as Discount, aW as DiscountsSelect, $ as Document, b0 as DocumentCategoriesSelect, a1 as DocumentCategory, a0 as DocumentType, b1 as DocumentTypesSelect, a$ as DocumentsSelect, m as EmailLog, ar as EmailLogsSelect, N as ExchangeProduct, aP as ExchangeProductsSelect, aO as ExchangesSelect, j as FieldConfig, an as FieldConfigsSelect, ac as Flow, bf as FlowCategoriesSelect, ad as FlowCategory, ag as FlowEdgeType, be as FlowEdgeTypesSelect, af as FlowNodeType, bd as FlowNodeTypesSelect, ae as FlowTag, bg as FlowTagsSelect, bc as FlowsSelect, F as Form, ah as FormSubmission, bm as FormSubmissionsSelect, bl as FormsSelect, K as FulfillmentItem, aL as FulfillmentItemsSelect, aK as FulfillmentsSelect, b8 as GalleriesSelect, a8 as Gallery, b9 as GalleryCategoriesSelect, a9 as GalleryCategory, ab as GalleryItem, bb as GalleryItemsSelect, aa as GalleryTag, ba as GalleryTagsSelect, I as IframeBlock, k as Image, ao as ImagesSelect, L as LiveStream, bk as LiveStreamsSelect, a5 as Music, b6 as MusicCategoriesSelect, a6 as MusicCategory, a7 as MusicTag, b7 as MusicTagsSelect, b5 as MusicsSelect, aH as OrderProductsSelect, Q as OrderStatusLog, aJ as OrderStatusLogsSelect, aG as OrdersSelect, ai as PayloadKv, bn as PayloadKvSelect, aj as PayloadLockedDocument, bo as PayloadLockedDocumentsSelect, al as PayloadMigration, bq as PayloadMigrationsSelect, ak as PayloadPreference, bp as PayloadPreferencesSelect, f as PlayerBlock, a2 as Playlist, b3 as PlaylistCategoriesSelect, a3 as PlaylistCategory, a4 as PlaylistTag, b4 as PlaylistTagsSelect, b2 as PlaylistsSelect, X as Post, Y as PostAuthor, aY as PostAuthorsSelect, aZ as PostCategoriesSelect, Z as PostCategory, _ as PostTag, a_ as PostTagsSelect, aX as PostsSelect, aB as ProductCategoriesSelect, w as ProductCategory, D as ProductCollection, aD as ProductCollectionsSelect, v as ProductOption, aA as ProductOptionsSelect, x as ProductTag, aC as ProductTagsSelect, u as ProductVariant, az as ProductVariantsSelect, ay as ProductsSelect, M as ReturnProduct, aN as ReturnProductsSelect, aM as ReturnsSelect, aQ as ShippingPoliciesSelect, z as ShippingPolicy, p as Subscription, av as SubscriptionsSelect, S as SupportedTimezones, l as SystemMedia, ap as SystemMediaSelect, i as Tenant, r as TenantLogo, ax as TenantLogosSelect, at as TenantMetadataSelect, n as TenantMetadatum, as as TenantsSelect, aI as TransactionsSelect, h as User, U as UserAuthOperations, am as UsersSelect, V as Video, bi as VideoCategoriesSelect, s as VideoCategory, t as VideoTag, bj as VideoTagsSelect, bh as VideosSelect } from './payload-types-C-keX5go.js';
1
+ import { O as Order, a as OrderProduct, T as Transaction, b as Fulfillment, R as Return, E as Exchange, c as Cart, d as CartItem, P as Product } from './payload-types-D8fN_vZR.js';
2
+ export { o as ApiUsage, au as ApiUsageSelect, A as Audience, aq as AudiencesSelect, bs as Auth, q as BillingHistory, aw as BillingHistorySelect, y as Brand, B as BrandLogo, aF as BrandLogosSelect, aE as BrandsSelect, aV as CartItemsSelect, aU as CartsSelect, g as CodeBlock, br as CollectionsWidget, C as Config, G as Customer, J as CustomerAddress, aS as CustomerAddressesSelect, e as CustomerAuthOperations, H as CustomerGroup, aT as CustomerGroupsSelect, aR as CustomersSelect, W as Discount, aW as DiscountsSelect, $ as Document, b0 as DocumentCategoriesSelect, a1 as DocumentCategory, a0 as DocumentType, b1 as DocumentTypesSelect, a$ as DocumentsSelect, m as EmailLog, ar as EmailLogsSelect, N as ExchangeProduct, aP as ExchangeProductsSelect, aO as ExchangesSelect, j as FieldConfig, an as FieldConfigsSelect, ac as Flow, bf as FlowCategoriesSelect, ad as FlowCategory, ag as FlowEdgeType, be as FlowEdgeTypesSelect, af as FlowNodeType, bd as FlowNodeTypesSelect, ae as FlowTag, bg as FlowTagsSelect, bc as FlowsSelect, F as Form, ah as FormSubmission, bm as FormSubmissionsSelect, bl as FormsSelect, K as FulfillmentItem, aL as FulfillmentItemsSelect, aK as FulfillmentsSelect, b8 as GalleriesSelect, a8 as Gallery, b9 as GalleryCategoriesSelect, a9 as GalleryCategory, ab as GalleryItem, bb as GalleryItemsSelect, aa as GalleryTag, ba as GalleryTagsSelect, I as IframeBlock, k as Image, ao as ImagesSelect, L as LiveStream, bk as LiveStreamsSelect, a5 as Music, b6 as MusicCategoriesSelect, a6 as MusicCategory, a7 as MusicTag, b7 as MusicTagsSelect, b5 as MusicsSelect, aH as OrderProductsSelect, Q as OrderStatusLog, aJ as OrderStatusLogsSelect, aG as OrdersSelect, ai as PayloadKv, bn as PayloadKvSelect, aj as PayloadLockedDocument, bo as PayloadLockedDocumentsSelect, al as PayloadMigration, bq as PayloadMigrationsSelect, ak as PayloadPreference, bp as PayloadPreferencesSelect, f as PlayerBlock, a2 as Playlist, b3 as PlaylistCategoriesSelect, a3 as PlaylistCategory, a4 as PlaylistTag, b4 as PlaylistTagsSelect, b2 as PlaylistsSelect, X as Post, Y as PostAuthor, aY as PostAuthorsSelect, aZ as PostCategoriesSelect, Z as PostCategory, _ as PostTag, a_ as PostTagsSelect, aX as PostsSelect, aB as ProductCategoriesSelect, w as ProductCategory, D as ProductCollection, aD as ProductCollectionsSelect, v as ProductOption, aA as ProductOptionsSelect, x as ProductTag, aC as ProductTagsSelect, u as ProductVariant, az as ProductVariantsSelect, ay as ProductsSelect, M as ReturnProduct, aN as ReturnProductsSelect, aM as ReturnsSelect, aQ as ShippingPoliciesSelect, z as ShippingPolicy, p as Subscription, av as SubscriptionsSelect, S as SupportedTimezones, l as SystemMedia, ap as SystemMediaSelect, i as Tenant, r as TenantLogo, ax as TenantLogosSelect, at as TenantMetadataSelect, n as TenantMetadatum, as as TenantsSelect, aI as TransactionsSelect, h as User, U as UserAuthOperations, am as UsersSelect, V as Video, bi as VideoCategoriesSelect, s as VideoCategory, t as VideoTag, bj as VideoTagsSelect, bh as VideosSelect } from './payload-types-D8fN_vZR.js';
3
3
  import { Sort, Where } from 'payload';
4
4
  import * as _tanstack_react_query from '@tanstack/react-query';
5
5
  import { QueryClient, InfiniteData } from '@tanstack/react-query';
6
6
  import { Metadata } from 'next';
7
- import { P as PublicCollection } from './const-DQIDvvB-.js';
8
- export { a as COLLECTIONS, C as Collection } from './const-DQIDvvB-.js';
9
- import { C as CollectionType } from './webhook-DseJdRFT.js';
10
- export { a as WebhookEvent, b as WebhookHandler, W as WebhookOperation, c as WebhookOptions, d as createTypedWebhookHandler, h as handleWebhook, i as isValidWebhookEvent } from './webhook-DseJdRFT.js';
7
+ import { P as PublicCollection } from './const-JbuUTzeh.js';
8
+ export { a as COLLECTIONS, C as Collection } from './const-JbuUTzeh.js';
9
+ import { C as CollectionType } from './webhook-BkwMrrL1.js';
10
+ export { a as WebhookEvent, b as WebhookHandler, W as WebhookOperation, c as WebhookOptions, d as createTypedWebhookHandler, h as handleWebhook, i as isValidWebhookEvent } from './webhook-BkwMrrL1.js';
11
11
  export { a as RealtimeConnection, R as RealtimeEvent, b as RealtimeListener } from './realtime-DupPIYx-.js';
12
12
  export { b as IMAGE_SIZES, I as ImageData, a as ImagePalette, f as ImagePlaceholderOptions, d as getImageLqip, e as getImagePalette, h as getImagePlaceholderStyle, c as getImageSrcSet, g as getImageUrl } from './image-TT8lTsk5.js';
13
13
  export { e as VideoGifOptions, V as VideoThumbnailOptions, a as getVideoGif, c as getVideoMp4Url, d as getVideoStoryboard, b as getVideoStreamUrl, g as getVideoThumbnail } from './video-DbLL8yuc.js';
@@ -92,6 +92,9 @@ interface Config {
92
92
  'payload-migrations': PayloadMigration;
93
93
  };
94
94
  collectionsJoins: {
95
+ tenants: {
96
+ members: 'users';
97
+ };
95
98
  products: {
96
99
  variants: 'product-variants';
97
100
  options: 'product-options';
@@ -309,6 +312,8 @@ interface User {
309
312
  emailPreferences?: {
310
313
  usageAlerts?: boolean | null;
311
314
  };
315
+ authProvider?: ('local' | 'google') | null;
316
+ googleSub?: string | null;
312
317
  updatedAt: string;
313
318
  createdAt: string;
314
319
  email: string;
@@ -381,6 +386,14 @@ interface Tenant {
381
386
  enabled?: boolean | null;
382
387
  id?: string | null;
383
388
  }[] | null;
389
+ /**
390
+ * Users connected to this tenant
391
+ */
392
+ members?: {
393
+ docs?: (string | User)[];
394
+ hasNextPage?: boolean;
395
+ totalDocs?: number;
396
+ };
384
397
  updatedAt: string;
385
398
  createdAt: string;
386
399
  }
@@ -529,7 +542,7 @@ interface EmailLog {
529
542
  to: string;
530
543
  from?: string | null;
531
544
  subject: string;
532
- type: 'usage-alert' | 'verification' | 'password-reset' | 'newsletter' | 'other';
545
+ type: 'usage-alert' | 'verification' | 'password-reset' | 'newsletter' | 'other' | 'oauth-login' | 'account-link';
533
546
  status: 'sent' | 'failed';
534
547
  sentAt: string;
535
548
  error?: string | null;
@@ -3580,6 +3593,8 @@ interface UsersSelect<T extends boolean = true> {
3580
3593
  emailPreferences?: T | {
3581
3594
  usageAlerts?: T;
3582
3595
  };
3596
+ authProvider?: T;
3597
+ googleSub?: T;
3583
3598
  updatedAt?: T;
3584
3599
  createdAt?: T;
3585
3600
  email?: T;
@@ -3761,6 +3776,7 @@ interface TenantsSelect<T extends boolean = true> {
3761
3776
  enabled?: T;
3762
3777
  id?: T;
3763
3778
  };
3779
+ members?: T;
3764
3780
  updatedAt?: T;
3765
3781
  createdAt?: T;
3766
3782
  }
@@ -92,6 +92,9 @@ interface Config {
92
92
  'payload-migrations': PayloadMigration;
93
93
  };
94
94
  collectionsJoins: {
95
+ tenants: {
96
+ members: 'users';
97
+ };
95
98
  products: {
96
99
  variants: 'product-variants';
97
100
  options: 'product-options';
@@ -309,6 +312,8 @@ interface User {
309
312
  emailPreferences?: {
310
313
  usageAlerts?: boolean | null;
311
314
  };
315
+ authProvider?: ('local' | 'google') | null;
316
+ googleSub?: string | null;
312
317
  updatedAt: string;
313
318
  createdAt: string;
314
319
  email: string;
@@ -381,6 +386,14 @@ interface Tenant {
381
386
  enabled?: boolean | null;
382
387
  id?: string | null;
383
388
  }[] | null;
389
+ /**
390
+ * Users connected to this tenant
391
+ */
392
+ members?: {
393
+ docs?: (string | User)[];
394
+ hasNextPage?: boolean;
395
+ totalDocs?: number;
396
+ };
384
397
  updatedAt: string;
385
398
  createdAt: string;
386
399
  }
@@ -529,7 +542,7 @@ interface EmailLog {
529
542
  to: string;
530
543
  from?: string | null;
531
544
  subject: string;
532
- type: 'usage-alert' | 'verification' | 'password-reset' | 'newsletter' | 'other';
545
+ type: 'usage-alert' | 'verification' | 'password-reset' | 'newsletter' | 'other' | 'oauth-login' | 'account-link';
533
546
  status: 'sent' | 'failed';
534
547
  sentAt: string;
535
548
  error?: string | null;
@@ -3580,6 +3593,8 @@ interface UsersSelect<T extends boolean = true> {
3580
3593
  emailPreferences?: T | {
3581
3594
  usageAlerts?: T;
3582
3595
  };
3596
+ authProvider?: T;
3597
+ googleSub?: T;
3583
3598
  updatedAt?: T;
3584
3599
  createdAt?: T;
3585
3600
  email?: T;
@@ -3761,6 +3776,7 @@ interface TenantsSelect<T extends boolean = true> {
3761
3776
  enabled?: T;
3762
3777
  id?: T;
3763
3778
  };
3779
+ members?: T;
3764
3780
  updatedAt?: T;
3765
3781
  createdAt?: T;
3766
3782
  }
@@ -1,7 +1,7 @@
1
1
  import { R as RealtimeEvent } from './realtime-DupPIYx-.cjs';
2
2
  export { a as RealtimeConnection, b as RealtimeListener } from './realtime-DupPIYx-.cjs';
3
- import { P as PublicCollection } from './const-CDpRB7XK.cjs';
4
- import './payload-types-C-keX5go.cjs';
3
+ import { P as PublicCollection } from './const-C9I6r5Wa.cjs';
4
+ import './payload-types-D8fN_vZR.cjs';
5
5
 
6
6
  interface UseRealtimeQueryOptions {
7
7
  /** Filter events to specific collections. Empty/undefined = all collections. */
@@ -1,7 +1,7 @@
1
1
  import { R as RealtimeEvent } from './realtime-DupPIYx-.js';
2
2
  export { a as RealtimeConnection, b as RealtimeListener } from './realtime-DupPIYx-.js';
3
- import { P as PublicCollection } from './const-DQIDvvB-.js';
4
- import './payload-types-C-keX5go.js';
3
+ import { P as PublicCollection } from './const-JbuUTzeh.js';
4
+ import './payload-types-D8fN_vZR.js';
5
5
 
6
6
  interface UseRealtimeQueryOptions {
7
7
  /** Filter events to specific collections. Empty/undefined = all collections. */
@@ -152,6 +152,10 @@ interface FlowBounds {
152
152
  height: number;
153
153
  }
154
154
 
155
+ declare const BUILT_IN_NODE_TYPES: NodeTypeDef[];
156
+
157
+ declare const BUILT_IN_EDGE_TYPES: EdgeTypeDef[];
158
+
155
159
  type FlowCollection = 'flows' | 'flow-node-types' | 'flow-edge-types';
156
160
  type AnyFn = (...args: any[]) => any;
157
161
  interface SDKClient {
@@ -239,4 +243,4 @@ interface FrameData {
239
243
  */
240
244
  declare function getFrameData(data: CanvasData, frameId: string): FrameData | undefined;
241
245
 
242
- export { type CanvasData as C, type DynamicNodeSlotProps as D, type EdgeTypeDef as E, type FlowNode as F, type NodeTypeDef as N, type PrefetchFlowOptions as P, type SDKClient as S, type UseFlowOptions as U, type FlowEdge as a, type FrameNodeSlotProps as b, type EdgeSlotProps as c, type NodeWrapperSlotProps as d, type FlowViewport as e, type FlowBounds as f, type FlowNodePosition as g, type FlowNodeData as h, type DynamicNodeData as i, type FrameNodeData as j, type NodeTypeFieldDef as k, isDynamicNode as l, isFrameNode as m, type UseFlowResult as n, getNodeBounds as o, prefetchFlow as p, getFrames as q, getFrameData as r, type FrameData as s, useFlow as u };
246
+ export { BUILT_IN_NODE_TYPES as B, type CanvasData as C, type DynamicNodeSlotProps as D, type EdgeTypeDef as E, type FlowNode as F, type NodeTypeDef as N, type PrefetchFlowOptions as P, type SDKClient as S, type UseFlowOptions as U, type NodeTypeFieldDef as a, type FlowEdge as b, type FrameNodeSlotProps as c, type EdgeSlotProps as d, type NodeWrapperSlotProps as e, type FlowViewport as f, type FlowBounds as g, type FrameData as h, type FlowNodePosition as i, type FlowNodeData as j, type DynamicNodeData as k, type FrameNodeData as l, isDynamicNode as m, isFrameNode as n, BUILT_IN_EDGE_TYPES as o, type UseFlowResult as p, prefetchFlow as q, getNodeBounds as r, getFrames as s, getFrameData as t, useFlow as u };
@@ -152,6 +152,10 @@ interface FlowBounds {
152
152
  height: number;
153
153
  }
154
154
 
155
+ declare const BUILT_IN_NODE_TYPES: NodeTypeDef[];
156
+
157
+ declare const BUILT_IN_EDGE_TYPES: EdgeTypeDef[];
158
+
155
159
  type FlowCollection = 'flows' | 'flow-node-types' | 'flow-edge-types';
156
160
  type AnyFn = (...args: any[]) => any;
157
161
  interface SDKClient {
@@ -239,4 +243,4 @@ interface FrameData {
239
243
  */
240
244
  declare function getFrameData(data: CanvasData, frameId: string): FrameData | undefined;
241
245
 
242
- export { type CanvasData as C, type DynamicNodeSlotProps as D, type EdgeTypeDef as E, type FlowNode as F, type NodeTypeDef as N, type PrefetchFlowOptions as P, type SDKClient as S, type UseFlowOptions as U, type FlowEdge as a, type FrameNodeSlotProps as b, type EdgeSlotProps as c, type NodeWrapperSlotProps as d, type FlowViewport as e, type FlowBounds as f, type FlowNodePosition as g, type FlowNodeData as h, type DynamicNodeData as i, type FrameNodeData as j, type NodeTypeFieldDef as k, isDynamicNode as l, isFrameNode as m, type UseFlowResult as n, getNodeBounds as o, prefetchFlow as p, getFrames as q, getFrameData as r, type FrameData as s, useFlow as u };
246
+ export { BUILT_IN_NODE_TYPES as B, type CanvasData as C, type DynamicNodeSlotProps as D, type EdgeTypeDef as E, type FlowNode as F, type NodeTypeDef as N, type PrefetchFlowOptions as P, type SDKClient as S, type UseFlowOptions as U, type NodeTypeFieldDef as a, type FlowEdge as b, type FrameNodeSlotProps as c, type EdgeSlotProps as d, type NodeWrapperSlotProps as e, type FlowViewport as f, type FlowBounds as g, type FrameData as h, type FlowNodePosition as i, type FlowNodeData as j, type DynamicNodeData as k, type FrameNodeData as l, isDynamicNode as m, isFrameNode as n, BUILT_IN_EDGE_TYPES as o, type UseFlowResult as p, prefetchFlow as q, getNodeBounds as r, getFrames as s, getFrameData as t, useFlow as u };
@@ -104,8 +104,12 @@ function CodeBlock({
104
104
  const [nodes, setNodes] = (0, import_react2.useState)(initial);
105
105
  const [copied, setCopied] = (0, import_react2.useState)(false);
106
106
  const initialCodeRef = (0, import_react2.useRef)(code);
107
+ const initialNodesRef = (0, import_react2.useRef)(initial);
107
108
  (0, import_react2.useEffect)(() => {
108
- if (initial && code === initialCodeRef.current && nodes === initial) return;
109
+ if (initial && code === initialCodeRef.current && initialNodesRef.current === initial) {
110
+ initialNodesRef.current = void 0;
111
+ return;
112
+ }
109
113
  let cancelled = false;
110
114
  void highlight(code, language, theme).then((el) => {
111
115
  if (!cancelled) setNodes(el);
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/ui/CodeBlock/index.tsx","../../src/ui/CodeBlock/highlight.ts"],"sourcesContent":["'use client'\n\nimport React, { useEffect, useRef, useState, type JSX } from 'react'\nimport { highlight, type BundledTheme } from './highlight'\n\nexport type { BundledTheme }\nexport { highlight }\n\nexport interface CodeBlockProps {\n /** Code string to highlight */\n code: string\n /** Language identifier (e.g. 'typescript', 'js', 'python') */\n language?: string\n /** Shiki theme name. Default: 'github-dark' */\n theme?: BundledTheme\n /** CSS class for the wrapper */\n className?: string\n /** Pre-rendered JSX from server component via `highlight()` */\n initial?: JSX.Element\n /** Show line numbers. Default: false */\n showLineNumbers?: boolean\n /** Show copy button. Default: true */\n showCopyButton?: boolean\n}\n\n/**\n * Syntax-highlighted code block using shiki.\n *\n * @example Basic usage\n * ```tsx\n * <CodeBlock code=\"const x = 1\" language=\"typescript\" />\n * ```\n *\n * @example With server pre-rendering (Next.js)\n * ```tsx\n * // Server Component\n * const initial = await highlight(code, 'typescript')\n * return <CodeBlock code={code} language=\"typescript\" initial={initial} />\n * ```\n *\n * @example As RichTextContent block renderer\n * ```tsx\n * <RichTextContent\n * data={data}\n * blocks={{\n * Code: ({ node }) => (\n * <CodeBlock code={node.fields.code} language={node.fields.language} />\n * ),\n * }}\n * />\n * ```\n */\nexport function CodeBlock({\n code,\n language = 'typescript',\n theme = 'github-dark',\n className,\n initial,\n showLineNumbers = false,\n showCopyButton = true,\n}: CodeBlockProps) {\n const [nodes, setNodes] = useState<JSX.Element | undefined>(initial)\n const [copied, setCopied] = useState(false)\n const initialCodeRef = useRef(code)\n\n useEffect(() => {\n // Skip re-highlighting if server pre-rendered and code hasn't changed\n if (initial && code === initialCodeRef.current && nodes === initial) return\n\n let cancelled = false\n void highlight(code, language, theme).then((el) => {\n if (!cancelled) setNodes(el)\n })\n return () => {\n cancelled = true\n }\n }, [code, language, theme, initial])\n\n const handleCopy = () => {\n void navigator.clipboard.writeText(code).then(\n () => {\n setCopied(true)\n setTimeout(() => setCopied(false), 2000)\n },\n () => {},\n )\n }\n\n return (\n <div className={className} style={{ position: 'relative' }}>\n {showCopyButton && (\n <button\n type=\"button\"\n onClick={handleCopy}\n aria-label=\"Copy code\"\n style={{\n position: 'absolute',\n top: 8,\n right: 8,\n zIndex: 1,\n padding: '4px 8px',\n fontSize: 12,\n lineHeight: 1,\n border: '1px solid rgba(255,255,255,0.2)',\n borderRadius: 4,\n background: 'rgba(0,0,0,0.3)',\n color: '#ccc',\n cursor: 'pointer',\n opacity: 0.7,\n transition: 'opacity 0.15s',\n }}\n onMouseEnter={(e) => {\n e.currentTarget.style.opacity = '1'\n }}\n onMouseLeave={(e) => {\n e.currentTarget.style.opacity = '0.7'\n }}\n >\n {copied ? 'Copied!' : 'Copy'}\n </button>\n )}\n {showLineNumbers && nodes ? (\n <div style={{ display: 'flex' }}>\n <div\n aria-hidden\n style={{\n padding: '1em 0.5em 1em 1em',\n textAlign: 'right',\n userSelect: 'none',\n color: 'rgba(255,255,255,0.3)',\n fontFamily: 'monospace',\n fontSize: 13,\n lineHeight: 1.5,\n }}\n >\n {code.split('\\n').map((_, i) => (\n <div key={i}>{i + 1}</div>\n ))}\n </div>\n <div style={{ flex: 1, overflow: 'auto' }}>{nodes}</div>\n </div>\n ) : (\n (nodes ?? (\n <pre\n style={{\n margin: 0,\n padding: '1em',\n overflow: 'auto',\n fontFamily: 'monospace',\n fontSize: 13,\n lineHeight: 1.5,\n }}\n >\n <code>{code}</code>\n </pre>\n ))\n )}\n </div>\n )\n}\n","import type { JSX } from 'react'\nimport { Fragment } from 'react'\nimport { jsx, jsxs } from 'react/jsx-runtime'\nimport { toJsxRuntime } from 'hast-util-to-jsx-runtime'\nimport { codeToHast, type BundledLanguage, type BundledTheme } from 'shiki'\n\nexport type { BundledLanguage, BundledTheme }\n\n/** Normalize language aliases to shiki-compatible language IDs */\nconst LANGUAGE_ALIASES: Record<string, string> = {\n js: 'javascript',\n ts: 'typescript',\n sh: 'bash',\n shell: 'bash',\n yml: 'yaml',\n py: 'python',\n rb: 'ruby',\n plaintext: 'text',\n}\n\nfunction normalizeLanguage(lang: string): string {\n return LANGUAGE_ALIASES[lang] || lang\n}\n\n/**\n * Highlight code to JSX using shiki.\n * Works in both Server and Client components.\n *\n * @example Server Component\n * ```tsx\n * const highlighted = await highlight('const x = 1', 'typescript')\n * return <div>{highlighted}</div>\n * ```\n */\nexport async function highlight(\n code: string,\n lang: string,\n theme: BundledTheme = 'github-dark',\n): Promise<JSX.Element> {\n const normalized = normalizeLanguage(lang)\n try {\n const hast = await codeToHast(code, {\n lang: normalized as BundledLanguage,\n theme,\n })\n return toJsxRuntime(hast, { Fragment, jsx, jsxs }) as JSX.Element\n } catch {\n // Fallback to plain text if language is not supported\n const hast = await codeToHast(code, { lang: 'text', theme })\n return toJsxRuntime(hast, { Fragment, jsx, jsxs }) as JSX.Element\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,IAAAA,gBAA6D;;;ACD7D,mBAAyB;AACzB,yBAA0B;AAC1B,sCAA6B;AAC7B,mBAAoE;AAKpE,IAAM,mBAA2C;AAAA,EAC/C,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,OAAO;AAAA,EACP,KAAK;AAAA,EACL,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,WAAW;AACb;A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;AAAA,QACT,UAAU;AAAA,QACV,YAAY;AAAA,QACZ,UAAU;AAAA,QACV,YAAY;AAAA,MACd;AAAA;AAAA,IAEA,8BAAAA,QAAA,cAAC,cAAM,IAAK;AAAA,EACd,CAGN;AAEJ;","names":["import_react","React"]}
1
+ {"version":3,"sources":["../../src/ui/CodeBlock/index.tsx","../../src/ui/CodeBlock/highlight.ts"],"sourcesContent":["'use client'\n\nimport React, { useEffect, useRef, useState, type JSX } from 'react'\nimport { highlight, type BundledTheme } from './highlight'\n\nexport type { BundledTheme }\nexport { highlight }\n\nexport interface CodeBlockProps {\n /** Code string to highlight */\n code: string\n /** Language identifier (e.g. 'typescript', 'js', 'python') */\n language?: string\n /** Shiki theme name. Default: 'github-dark' */\n theme?: BundledTheme\n /** CSS class for the wrapper */\n className?: string\n /** Pre-rendered JSX from server component via `highlight()` */\n initial?: JSX.Element\n /** Show line numbers. Default: false */\n showLineNumbers?: boolean\n /** Show copy button. Default: true */\n showCopyButton?: boolean\n}\n\n/**\n * Syntax-highlighted code block using shiki.\n *\n * @example Basic usage\n * ```tsx\n * <CodeBlock code=\"const x = 1\" language=\"typescript\" />\n * ```\n *\n * @example With server pre-rendering (Next.js)\n * ```tsx\n * // Server Component\n * const initial = await highlight(code, 'typescript')\n * return <CodeBlock code={code} language=\"typescript\" initial={initial} />\n * ```\n *\n * @example As RichTextContent block renderer\n * ```tsx\n * <RichTextContent\n * data={data}\n * blocks={{\n * Code: ({ node }) => (\n * <CodeBlock code={node.fields.code} language={node.fields.language} />\n * ),\n * }}\n * />\n * ```\n */\nexport function CodeBlock({\n code,\n language = 'typescript',\n theme = 'github-dark',\n className,\n initial,\n showLineNumbers = false,\n showCopyButton = true,\n}: CodeBlockProps) {\n const [nodes, setNodes] = useState<JSX.Element | undefined>(initial)\n const [copied, setCopied] = useState(false)\n const initialCodeRef = useRef(code)\n const initialNodesRef = useRef(initial)\n\n useEffect(() => {\n // Skip re-highlighting if server pre-rendered and code hasn't changed\n if (initial && code === initialCodeRef.current && initialNodesRef.current === initial) {\n initialNodesRef.current = undefined\n return\n }\n\n let cancelled = false\n void highlight(code, language, theme).then((el) => {\n if (!cancelled) setNodes(el)\n })\n return () => {\n cancelled = true\n }\n }, [code, language, theme, initial])\n\n const handleCopy = () => {\n void navigator.clipboard.writeText(code).then(\n () => {\n setCopied(true)\n setTimeout(() => setCopied(false), 2000)\n },\n () => {},\n )\n }\n\n return (\n <div className={className} style={{ position: 'relative' }}>\n {showCopyButton && (\n <button\n type=\"button\"\n onClick={handleCopy}\n aria-label=\"Copy code\"\n style={{\n position: 'absolute',\n top: 8,\n right: 8,\n zIndex: 1,\n padding: '4px 8px',\n fontSize: 12,\n lineHeight: 1,\n border: '1px solid rgba(255,255,255,0.2)',\n borderRadius: 4,\n background: 'rgba(0,0,0,0.3)',\n color: '#ccc',\n cursor: 'pointer',\n opacity: 0.7,\n transition: 'opacity 0.15s',\n }}\n onMouseEnter={(e) => {\n e.currentTarget.style.opacity = '1'\n }}\n onMouseLeave={(e) => {\n e.currentTarget.style.opacity = '0.7'\n }}\n >\n {copied ? 'Copied!' : 'Copy'}\n </button>\n )}\n {showLineNumbers && nodes ? (\n <div style={{ display: 'flex' }}>\n <div\n aria-hidden\n style={{\n padding: '1em 0.5em 1em 1em',\n textAlign: 'right',\n userSelect: 'none',\n color: 'rgba(255,255,255,0.3)',\n fontFamily: 'monospace',\n fontSize: 13,\n lineHeight: 1.5,\n }}\n >\n {code.split('\\n').map((_, i) => (\n <div key={i}>{i + 1}</div>\n ))}\n </div>\n <div style={{ flex: 1, overflow: 'auto' }}>{nodes}</div>\n </div>\n ) : (\n (nodes ?? (\n <pre\n style={{\n margin: 0,\n padding: '1em',\n overflow: 'auto',\n fontFamily: 'monospace',\n fontSize: 13,\n lineHeight: 1.5,\n }}\n >\n <code>{code}</code>\n </pre>\n ))\n )}\n </div>\n )\n}\n","import type { JSX } from 'react'\nimport { Fragment } from 'react'\nimport { jsx, jsxs } from 'react/jsx-runtime'\nimport { toJsxRuntime } from 'hast-util-to-jsx-runtime'\nimport { codeToHast, type BundledLanguage, type BundledTheme } from 'shiki'\n\nexport type { BundledLanguage, BundledTheme }\n\n/** Normalize language aliases to shiki-compatible language IDs */\nconst LANGUAGE_ALIASES: Record<string, string> = {\n js: 'javascript',\n ts: 'typescript',\n sh: 'bash',\n shell: 'bash',\n yml: 'yaml',\n py: 'python',\n rb: 'ruby',\n plaintext: 'text',\n}\n\nfunction normalizeLanguage(lang: string): string {\n return LANGUAGE_ALIASES[lang] || lang\n}\n\n/**\n * Highlight code to JSX using shiki.\n * Works in both Server and Client components.\n *\n * @example Server Component\n * ```tsx\n * const highlighted = await highlight('const x = 1', 'typescript')\n * return <div>{highlighted}</div>\n * ```\n */\nexport async function highlight(\n code: string,\n lang: string,\n theme: BundledTheme = 'github-dark',\n): Promise<JSX.Element> {\n const normalized = normalizeLanguage(lang)\n try {\n const hast = await codeToHast(code, {\n lang: normalized as BundledLanguage,\n theme,\n })\n return toJsxRuntime(hast, { Fragment, jsx, jsxs }) as JSX.Element\n } catch {\n // Fallback to plain text if language is not supported\n const hast = await codeToHast(code, { lang: 'text', theme })\n return toJsxRuntime(hast, { Fragment, jsx, jsxs }) as JSX.Element\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,IAAAA,gBAA6D;;;ACD7D,mBAAyB;AACzB,yBAA0B;AAC1B,sCAA6B;AAC7B,mBAAoE;AAKpE,IAAM,mBAA2C;AAAA,EAC/C,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,OAAO;AAAA,EACP,KAAK;AAAA,EACL,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,WAAW;AACb;AAEA,SAAS,kBAAkB,MAAsB;AAC/C,SAAO,iBAAiB,IAAI,KAAK;AACnC;AAYA,SAAsB,UACpB,MACA,MACA,QAAsB,eACA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QACV,YAAY;AAAA,QACZ,UAAU;AAAA,QACV,YAAY;AAAA,MACd;AAAA;AAAA,IAEA,8BAAAA,QAAA,cAAC,cAAM,IAAK;AAAA,EACd,CAGN;AAEJ;","names":["import_react","React"]}
@@ -70,8 +70,12 @@ function CodeBlock({
70
70
  const [nodes, setNodes] = useState(initial);
71
71
  const [copied, setCopied] = useState(false);
72
72
  const initialCodeRef = useRef(code);
73
+ const initialNodesRef = useRef(initial);
73
74
  useEffect(() => {
74
- if (initial && code === initialCodeRef.current && nodes === initial) return;
75
+ if (initial && code === initialCodeRef.current && initialNodesRef.current === initial) {
76
+ initialNodesRef.current = void 0;
77
+ return;
78
+ }
75
79
  let cancelled = false;
76
80
  void highlight(code, language, theme).then((el) => {
77
81
  if (!cancelled) setNodes(el);
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/ui/CodeBlock/index.tsx","../../src/ui/CodeBlock/highlight.ts"],"sourcesContent":["'use client'\n\nimport React, { useEffect, useRef, useState, type JSX } from 'react'\nimport { highlight, type BundledTheme } from './highlight'\n\nexport type { BundledTheme }\nexport { highlight }\n\nexport interface CodeBlockProps {\n /** Code string to highlight */\n code: string\n /** Language identifier (e.g. 'typescript', 'js', 'python') */\n language?: string\n /** Shiki theme name. Default: 'github-dark' */\n theme?: BundledTheme\n /** CSS class for the wrapper */\n className?: string\n /** Pre-rendered JSX from server component via `highlight()` */\n initial?: JSX.Element\n /** Show line numbers. Default: false */\n showLineNumbers?: boolean\n /** Show copy button. Default: true */\n showCopyButton?: boolean\n}\n\n/**\n * Syntax-highlighted code block using shiki.\n *\n * @example Basic usage\n * ```tsx\n * <CodeBlock code=\"const x = 1\" language=\"typescript\" />\n * ```\n *\n * @example With server pre-rendering (Next.js)\n * ```tsx\n * // Server Component\n * const initial = await highlight(code, 'typescript')\n * return <CodeBlock code={code} language=\"typescript\" initial={initial} />\n * ```\n *\n * @example As RichTextContent block renderer\n * ```tsx\n * <RichTextContent\n * data={data}\n * blocks={{\n * Code: ({ node }) => (\n * <CodeBlock code={node.fields.code} language={node.fields.language} />\n * ),\n * }}\n * />\n * ```\n */\nexport function CodeBlock({\n code,\n language = 'typescript',\n theme = 'github-dark',\n className,\n initial,\n showLineNumbers = false,\n showCopyButton = true,\n}: CodeBlockProps) {\n const [nodes, setNodes] = useState<JSX.Element | undefined>(initial)\n const [copied, setCopied] = useState(false)\n const initialCodeRef = useRef(code)\n\n useEffect(() => {\n // Skip re-highlighting if server pre-rendered and code hasn't changed\n if (initial && code === initialCodeRef.current && nodes === initial) return\n\n let cancelled = false\n void highlight(code, language, theme).then((el) => {\n if (!cancelled) setNodes(el)\n })\n return () => {\n cancelled = true\n }\n }, [code, language, theme, initial])\n\n const handleCopy = () => {\n void navigator.clipboard.writeText(code).then(\n () => {\n setCopied(true)\n setTimeout(() => setCopied(false), 2000)\n },\n () => {},\n )\n }\n\n return (\n <div className={className} style={{ position: 'relative' }}>\n {showCopyButton && (\n <button\n type=\"button\"\n onClick={handleCopy}\n aria-label=\"Copy code\"\n style={{\n position: 'absolute',\n top: 8,\n right: 8,\n zIndex: 1,\n padding: '4px 8px',\n fontSize: 12,\n lineHeight: 1,\n border: '1px solid rgba(255,255,255,0.2)',\n borderRadius: 4,\n background: 'rgba(0,0,0,0.3)',\n color: '#ccc',\n cursor: 'pointer',\n opacity: 0.7,\n transition: 'opacity 0.15s',\n }}\n onMouseEnter={(e) => {\n e.currentTarget.style.opacity = '1'\n }}\n onMouseLeave={(e) => {\n e.currentTarget.style.opacity = '0.7'\n }}\n >\n {copied ? 'Copied!' : 'Copy'}\n </button>\n )}\n {showLineNumbers && nodes ? (\n <div style={{ display: 'flex' }}>\n <div\n aria-hidden\n style={{\n padding: '1em 0.5em 1em 1em',\n textAlign: 'right',\n userSelect: 'none',\n color: 'rgba(255,255,255,0.3)',\n fontFamily: 'monospace',\n fontSize: 13,\n lineHeight: 1.5,\n }}\n >\n {code.split('\\n').map((_, i) => (\n <div key={i}>{i + 1}</div>\n ))}\n </div>\n <div style={{ flex: 1, overflow: 'auto' }}>{nodes}</div>\n </div>\n ) : (\n (nodes ?? (\n <pre\n style={{\n margin: 0,\n padding: '1em',\n overflow: 'auto',\n fontFamily: 'monospace',\n fontSize: 13,\n lineHeight: 1.5,\n }}\n >\n <code>{code}</code>\n </pre>\n ))\n )}\n </div>\n )\n}\n","import type { JSX } from 'react'\nimport { Fragment } from 'react'\nimport { jsx, jsxs } from 'react/jsx-runtime'\nimport { toJsxRuntime } from 'hast-util-to-jsx-runtime'\nimport { codeToHast, type BundledLanguage, type BundledTheme } from 'shiki'\n\nexport type { BundledLanguage, BundledTheme }\n\n/** Normalize language aliases to shiki-compatible language IDs */\nconst LANGUAGE_ALIASES: Record<string, string> = {\n js: 'javascript',\n ts: 'typescript',\n sh: 'bash',\n shell: 'bash',\n yml: 'yaml',\n py: 'python',\n rb: 'ruby',\n plaintext: 'text',\n}\n\nfunction normalizeLanguage(lang: string): string {\n return LANGUAGE_ALIASES[lang] || lang\n}\n\n/**\n * Highlight code to JSX using shiki.\n * Works in both Server and Client components.\n *\n * @example Server Component\n * ```tsx\n * const highlighted = await highlight('const x = 1', 'typescript')\n * return <div>{highlighted}</div>\n * ```\n */\nexport async function highlight(\n code: string,\n lang: string,\n theme: BundledTheme = 'github-dark',\n): Promise<JSX.Element> {\n const normalized = normalizeLanguage(lang)\n try {\n const hast = await codeToHast(code, {\n lang: normalized as BundledLanguage,\n theme,\n })\n return toJsxRuntime(hast, { Fragment, jsx, jsxs }) as JSX.Element\n } catch {\n // Fallback to plain text if language is not supported\n const hast = await codeToHast(code, { lang: 'text', theme })\n return toJsxRuntime(hast, { Fragment, jsx, jsxs }) as JSX.Element\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAEA,OAAO,SAAS,WAAW,QAAQ,gBAA0B;;;ACD7D,SAAS,gBAAgB;AACzB,SAAS,KAAK,YAAY;AAC1B,SAAS,oBAAoB;AAC7B,SAAS,kBAA2D;AAKpE,IAAM,mBAA2C;AA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AA,QACL,QAAQ;AAAA,QACR,SAAS;AAAA,QACT,UAAU;AAAA,QACV,YAAY;AAAA,QACZ,UAAU;AAAA,QACV,YAAY;AAAA,MACd;AAAA;AAAA,IAEA,oCAAC,cAAM,IAAK;AAAA,EACd,CAGN;AAEJ;","names":[]}
1
+ {"version":3,"sources":["../../src/ui/CodeBlock/index.tsx","../../src/ui/CodeBlock/highlight.ts"],"sourcesContent":["'use client'\n\nimport React, { useEffect, useRef, useState, type JSX } from 'react'\nimport { highlight, type BundledTheme } from './highlight'\n\nexport type { BundledTheme }\nexport { highlight }\n\nexport interface CodeBlockProps {\n /** Code string to highlight */\n code: string\n /** Language identifier (e.g. 'typescript', 'js', 'python') */\n language?: string\n /** Shiki theme name. Default: 'github-dark' */\n theme?: BundledTheme\n /** CSS class for the wrapper */\n className?: string\n /** Pre-rendered JSX from server component via `highlight()` */\n initial?: JSX.Element\n /** Show line numbers. Default: false */\n showLineNumbers?: boolean\n /** Show copy button. Default: true */\n showCopyButton?: boolean\n}\n\n/**\n * Syntax-highlighted code block using shiki.\n *\n * @example Basic usage\n * ```tsx\n * <CodeBlock code=\"const x = 1\" language=\"typescript\" />\n * ```\n *\n * @example With server pre-rendering (Next.js)\n * ```tsx\n * // Server Component\n * const initial = await highlight(code, 'typescript')\n * return <CodeBlock code={code} language=\"typescript\" initial={initial} />\n * ```\n *\n * @example As RichTextContent block renderer\n * ```tsx\n * <RichTextContent\n * data={data}\n * blocks={{\n * Code: ({ node }) => (\n * <CodeBlock code={node.fields.code} language={node.fields.language} />\n * ),\n * }}\n * />\n * ```\n */\nexport function CodeBlock({\n code,\n language = 'typescript',\n theme = 'github-dark',\n className,\n initial,\n showLineNumbers = false,\n showCopyButton = true,\n}: CodeBlockProps) {\n const [nodes, setNodes] = useState<JSX.Element | undefined>(initial)\n const [copied, setCopied] = useState(false)\n const initialCodeRef = useRef(code)\n const initialNodesRef = useRef(initial)\n\n useEffect(() => {\n // Skip re-highlighting if server pre-rendered and code hasn't changed\n if (initial && code === initialCodeRef.current && initialNodesRef.current === initial) {\n initialNodesRef.current = undefined\n return\n }\n\n let cancelled = false\n void highlight(code, language, theme).then((el) => {\n if (!cancelled) setNodes(el)\n })\n return () => {\n cancelled = true\n }\n }, [code, language, theme, initial])\n\n const handleCopy = () => {\n void navigator.clipboard.writeText(code).then(\n () => {\n setCopied(true)\n setTimeout(() => setCopied(false), 2000)\n },\n () => {},\n )\n }\n\n return (\n <div className={className} style={{ position: 'relative' }}>\n {showCopyButton && (\n <button\n type=\"button\"\n onClick={handleCopy}\n aria-label=\"Copy code\"\n style={{\n position: 'absolute',\n top: 8,\n right: 8,\n zIndex: 1,\n padding: '4px 8px',\n fontSize: 12,\n lineHeight: 1,\n border: '1px solid rgba(255,255,255,0.2)',\n borderRadius: 4,\n background: 'rgba(0,0,0,0.3)',\n color: '#ccc',\n cursor: 'pointer',\n opacity: 0.7,\n transition: 'opacity 0.15s',\n }}\n onMouseEnter={(e) => {\n e.currentTarget.style.opacity = '1'\n }}\n onMouseLeave={(e) => {\n e.currentTarget.style.opacity = '0.7'\n }}\n >\n {copied ? 'Copied!' : 'Copy'}\n </button>\n )}\n {showLineNumbers && nodes ? (\n <div style={{ display: 'flex' }}>\n <div\n aria-hidden\n style={{\n padding: '1em 0.5em 1em 1em',\n textAlign: 'right',\n userSelect: 'none',\n color: 'rgba(255,255,255,0.3)',\n fontFamily: 'monospace',\n fontSize: 13,\n lineHeight: 1.5,\n }}\n >\n {code.split('\\n').map((_, i) => (\n <div key={i}>{i + 1}</div>\n ))}\n </div>\n <div style={{ flex: 1, overflow: 'auto' }}>{nodes}</div>\n </div>\n ) : (\n (nodes ?? (\n <pre\n style={{\n margin: 0,\n padding: '1em',\n overflow: 'auto',\n fontFamily: 'monospace',\n fontSize: 13,\n lineHeight: 1.5,\n }}\n >\n <code>{code}</code>\n </pre>\n ))\n )}\n </div>\n )\n}\n","import type { JSX } from 'react'\nimport { Fragment } from 'react'\nimport { jsx, jsxs } from 'react/jsx-runtime'\nimport { toJsxRuntime } from 'hast-util-to-jsx-runtime'\nimport { codeToHast, type BundledLanguage, type BundledTheme } from 'shiki'\n\nexport type { BundledLanguage, BundledTheme }\n\n/** Normalize language aliases to shiki-compatible language IDs */\nconst LANGUAGE_ALIASES: Record<string, string> = {\n js: 'javascript',\n ts: 'typescript',\n sh: 'bash',\n shell: 'bash',\n yml: 'yaml',\n py: 'python',\n rb: 'ruby',\n plaintext: 'text',\n}\n\nfunction normalizeLanguage(lang: string): string {\n return LANGUAGE_ALIASES[lang] || lang\n}\n\n/**\n * Highlight code to JSX using shiki.\n * Works in both Server and Client components.\n *\n * @example Server Component\n * ```tsx\n * const highlighted = await highlight('const x = 1', 'typescript')\n * return <div>{highlighted}</div>\n * ```\n */\nexport async function highlight(\n code: string,\n lang: string,\n theme: BundledTheme = 'github-dark',\n): Promise<JSX.Element> {\n const normalized = normalizeLanguage(lang)\n try {\n const hast = await codeToHast(code, {\n lang: normalized as BundledLanguage,\n theme,\n })\n return toJsxRuntime(hast, { Fragment, jsx, jsxs }) as JSX.Element\n } catch {\n // Fallback to plain text if language is not supported\n const hast = await codeToHast(code, { lang: 'text', theme })\n return toJsxRuntime(hast, { Fragment, jsx, jsxs }) as JSX.Element\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAEA,OAAO,SAAS,WAAW,QAAQ,gBAA0B;;;ACD7D,SAAS,gBAAgB;AACzB,SAAS,KAAK,YAAY;AAC1B,SAAS,oBAAoB;AAC7B,SAAS,kBAA2D;AAKpE,IAAM,mBAA2C;AAAA,EAC/C,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,OAAO;AAAA,EACP,KAAK;AAAA,EACL,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,WAAW;AACb;AAEA,SAAS,kBAAkB,MAAsB;AAC/C,SAAO,iBAAiB,IAAI,KAAK;AACnC;AAYA,SAAsB,UACpB,MACA,MACA,QAAsB,eACA;AAAA;AACtB,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-57,6 +57,8 @@ var __async = (__this, __arguments, generator) => {
57
57
  // src/ui/Flow/server.ts
58
58
  var server_exports = {};
59
59
  __export(server_exports, {
60
+ BUILT_IN_EDGE_TYPES: () => BUILT_IN_EDGE_TYPES,
61
+ BUILT_IN_NODE_TYPES: () => BUILT_IN_NODE_TYPES,
60
62
  getFrameData: () => getFrameData,
61
63
  getFrames: () => getFrames,
62
64
  getNodeBounds: () => getNodeBounds,
@@ -79,40 +81,54 @@ function collectionKeys(collection) {
79
81
  };
80
82
  }
81
83
 
84
+ // src/ui/Flow/query-options.ts
85
+ function flowQueryOptions(client, slug, id) {
86
+ var _a;
87
+ const identifier = (_a = id != null ? id : slug) != null ? _a : "";
88
+ return {
89
+ queryKey: collectionKeys("flows").detail(identifier),
90
+ queryFn: () => __async(null, null, function* () {
91
+ if (id) return client.from("flows").findById(id);
92
+ const result = yield client.from("flows").find({
93
+ where: { slug: { equals: slug } },
94
+ limit: 1
95
+ });
96
+ const doc = result.docs[0];
97
+ if (!doc) throw new Error(`Flow not found: ${slug}`);
98
+ return doc;
99
+ })
100
+ };
101
+ }
102
+ function nodeTypesQueryOptions(client) {
103
+ return {
104
+ queryKey: collectionKeys("flow-node-types").lists(),
105
+ queryFn: () => __async(null, null, function* () {
106
+ const result = yield client.from("flow-node-types").find({ limit: 0 });
107
+ return result.docs;
108
+ })
109
+ };
110
+ }
111
+ function edgeTypesQueryOptions(client) {
112
+ return {
113
+ queryKey: collectionKeys("flow-edge-types").lists(),
114
+ queryFn: () => __async(null, null, function* () {
115
+ const result = yield client.from("flow-edge-types").find({ limit: 0 });
116
+ return result.docs;
117
+ })
118
+ };
119
+ }
120
+
82
121
  // src/ui/Flow/prefetchFlow.ts
83
122
  function prefetchFlow(options) {
84
123
  return __async(this, null, function* () {
85
- var _a;
86
124
  const { client, slug, id } = options;
87
- const identifier = (_a = id != null ? id : slug) != null ? _a : "";
125
+ if (!slug && !id) {
126
+ throw new Error("prefetchFlow requires either slug or id");
127
+ }
88
128
  yield Promise.all([
89
- client.queryClient.prefetchQuery({
90
- queryKey: collectionKeys("flows").detail(identifier),
91
- queryFn: () => __async(null, null, function* () {
92
- if (id) return client.from("flows").findById(id);
93
- const result = yield client.from("flows").find({
94
- where: { slug: { equals: slug } },
95
- limit: 1
96
- });
97
- const doc = result.docs[0];
98
- if (!doc) throw new Error(`Flow not found: ${slug}`);
99
- return doc;
100
- })
101
- }),
102
- client.queryClient.prefetchQuery({
103
- queryKey: collectionKeys("flow-node-types").lists(),
104
- queryFn: () => __async(null, null, function* () {
105
- const result = yield client.from("flow-node-types").find({ limit: 100 });
106
- return result.docs;
107
- })
108
- }),
109
- client.queryClient.prefetchQuery({
110
- queryKey: collectionKeys("flow-edge-types").lists(),
111
- queryFn: () => __async(null, null, function* () {
112
- const result = yield client.from("flow-edge-types").find({ limit: 100 });
113
- return result.docs;
114
- })
115
- })
129
+ client.queryClient.prefetchQuery(flowQueryOptions(client, slug, id)),
130
+ client.queryClient.prefetchQuery(nodeTypesQueryOptions(client)),
131
+ client.queryClient.prefetchQuery(edgeTypesQueryOptions(client))
116
132
  ]);
117
133
  });
118
134
  }
@@ -143,15 +159,28 @@ function getAbsolutePosition(node, nodeMap) {
143
159
  return { x, y };
144
160
  }
145
161
  function collectDescendants(nodes, rootId) {
162
+ const childrenMap = /* @__PURE__ */ new Map();
163
+ for (const n of nodes) {
164
+ if (n.parentId) {
165
+ let siblings = childrenMap.get(n.parentId);
166
+ if (!siblings) {
167
+ siblings = [];
168
+ childrenMap.set(n.parentId, siblings);
169
+ }
170
+ siblings.push(n.id);
171
+ }
172
+ }
146
173
  const result = /* @__PURE__ */ new Set([rootId]);
147
174
  const queue = [rootId];
148
175
  let i = 0;
149
176
  while (i < queue.length) {
150
- const current = queue[i++];
151
- for (const n of nodes) {
152
- if (n.parentId === current && !result.has(n.id)) {
153
- result.add(n.id);
154
- queue.push(n.id);
177
+ const children = childrenMap.get(queue[i++]);
178
+ if (children) {
179
+ for (const childId of children) {
180
+ if (!result.has(childId)) {
181
+ result.add(childId);
182
+ queue.push(childId);
183
+ }
155
184
  }
156
185
  }
157
186
  }
@@ -230,4 +259,42 @@ function isDynamicNode(node) {
230
259
  function isFrameNode(node) {
231
260
  return node.type === "frame";
232
261
  }
262
+
263
+ // src/ui/Flow/built-in-node-types.ts
264
+ var BUILT_IN_NODE_TYPES = [
265
+ {
266
+ slug: "text",
267
+ name: "Text",
268
+ color: "#e5e7eb",
269
+ defaultSize: { width: 200, height: 200 },
270
+ fields: [{ name: "body", label: "Body", fieldType: "textarea" }]
271
+ },
272
+ {
273
+ slug: "image",
274
+ name: "Image",
275
+ color: "#e5e7eb",
276
+ transparentBackground: true,
277
+ defaultSize: { width: 200, height: 200 },
278
+ fields: [
279
+ { name: "image", label: "Image", fieldType: "image" },
280
+ { name: "alt", label: "Alt Text", fieldType: "text" },
281
+ { name: "caption", label: "Caption", fieldType: "text" }
282
+ ]
283
+ }
284
+ ];
285
+
286
+ // src/ui/Flow/built-in-edge-types.ts
287
+ var BUILT_IN_EDGE_TYPES = [
288
+ {
289
+ slug: "default",
290
+ name: "Default",
291
+ color: "",
292
+ strokeWidth: 2,
293
+ animated: false,
294
+ lineStyle: "default",
295
+ markerStart: "none",
296
+ markerEnd: "arrow",
297
+ fields: []
298
+ }
299
+ ];
233
300
  //# sourceMappingURL=server.cjs.map