@lumiastream/ui 0.2.6 → 0.2.8-alpha.1

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 (3) hide show
  1. package/dist/index.d.ts +377 -2
  2. package/dist/index.js +3439 -0
  3. package/package.json +60 -59
package/dist/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
  import { ButtonProps } from '@mui/material/Button';
3
3
  import * as React from 'react';
4
- import { ReactNode, CSSProperties, JSX, HTMLAttributes } from 'react';
4
+ import { ReactNode, CSSProperties, JSX, HTMLAttributes, ComponentType } from 'react';
5
5
  import { TextFieldProps } from '@mui/material/TextField';
6
6
  import { SelectProps } from '@mui/material/Select';
7
7
  import { CheckboxProps } from '@mui/material/Checkbox';
@@ -485,4 +485,379 @@ declare const resolvePlatformChatterProfileUrl: ({ platform, username, displayna
485
485
  declare const normalizeHttpUrl: (value: unknown) => string | null;
486
486
  declare const resolveChatterProfileUrlWithResolvers: ({ platform, username, displayname, userId, extraSettings, resolvers, }: ResolveChatterProfileUrlWithResolversInput) => Promise<string | null>;
487
487
 
488
- export { type BuildChatMessageContentOptions, type ChatMessageContentItem, type ChatMessageEmoteStore, type ChatMessageToken, type ChatMessageTokenizationOptions, type ChatboxMediaPreview, type ChatboxMediaPreviewKind, type ChatterProfileResolver, type ChatterProfileResolverPayload, type ChatterProfileUrlInput, type IVariables, LSButton, type LSButtonProps, LSCheckbox, LSCheckboxField, LSColorPicker, type LSColorPickerProps, LSFontPicker, LSInput, type LSInputProps$1 as LSInputProps, LSMultiSelect, LSRadio, LSRadioGroup, LSSelect, LSSliderInput, type LSInputProps as LSSliderInputProps, LSTextField, type LSTextFieldProps, type LSVariableInputContextValue, LSVariableInputField, type LSVariableInputFieldProps, LSVariableInputProvider, MEDIA_PREVIEW_USER_LEVEL_VALUES, type MediaPreviewRoleSettings, type MediaPreviewRoleSettingsInput, type MediaPreviewUserLevel, type MessageLinkPart, type ResolveChatterProfileUrlWithResolversInput, buildChatMessageContent, codeMirrorlinterOptions, getMediaPreviewFromUrl, getNormalizedUserLevels, isMediaPreviewAllowedForUser, normalizeHttpUrl, normalizeMediaPreviewUserLevels, parseMessageLinks, resolveChatterProfileUrlWithResolvers, resolveMediaPreviewRoleSettings, resolveMediaPreviewSetting, resolvePlatformChatterProfileUrl, tokenizeChatMessage, variableCompletionOptions };
488
+ type ModuleType = 'alert' | 'emotebox' | 'emotealert' | 'text' | 'image' | 'audio' | 'video' | 'camera' | 'slideshow' | 'shape' | 'svg' | 'colorbox' | 'goal' | 'timer' | 'gradientlight' | 'browsersource' | 'chatbox' | 'credits' | 'eventlist' | 'eventrotate' | 'hfx' | 'hfxalert' | 'clip' | 'youtube' | 'spinwheel' | 'raffle' | 'viewerqueue' | 'loyaltyleaderboard' | 'viewerprofiles' | 'achievements' | 'poll' | 'tournaments' | 'spotify' | 'nowplaying' | 'youtubemusic' | 'brbscreen' | 'vlc' | 'tts' | 'livecaption' | 'custom' | 'group';
489
+ type OverlayLayerType = 'layer' | 'group';
490
+ type OverlayLayerBounds = {
491
+ height: number;
492
+ width: number;
493
+ x: number;
494
+ y: number;
495
+ scale: [number, number];
496
+ opacity?: number;
497
+ rotate?: number;
498
+ zIndex?: number;
499
+ matrix?: string;
500
+ clipPath?: string;
501
+ };
502
+ type OverlayLayerState = {
503
+ id: string;
504
+ group?: string | null;
505
+ type?: OverlayLayerType;
506
+ state: {
507
+ visible?: boolean;
508
+ locked?: boolean;
509
+ expanded?: boolean;
510
+ };
511
+ bounds: OverlayLayerBounds;
512
+ };
513
+ type OverlayModuleAlertState = {
514
+ events?: Record<string, unknown>;
515
+ [key: string]: unknown;
516
+ };
517
+ type OverlayModuleState = {
518
+ id?: string;
519
+ loaded?: boolean;
520
+ version?: number;
521
+ settings?: {
522
+ title?: string | null;
523
+ type?: ModuleType;
524
+ locked?: boolean;
525
+ };
526
+ lights?: unknown[];
527
+ css?: Record<string, string | number>;
528
+ content?: Record<string, unknown>;
529
+ variables?: Record<string, unknown>;
530
+ events?: Record<string, unknown>;
531
+ alert?: OverlayModuleAlertState;
532
+ };
533
+ type OverlaySettings = {
534
+ layers: OverlayLayerState[];
535
+ metadata: {
536
+ width: number;
537
+ height: number;
538
+ };
539
+ modules: Record<string, OverlayModuleState>;
540
+ };
541
+ type OverlayState = {
542
+ uuid: string;
543
+ listen_id: string;
544
+ name: string;
545
+ description?: string;
546
+ settings: OverlaySettings;
547
+ metadata?: {
548
+ width: number | null;
549
+ height: number | null;
550
+ } | null;
551
+ layers_count?: number | null;
552
+ hasFullSettings?: boolean;
553
+ };
554
+
555
+ interface SEBootstrapResponse {
556
+ overlay: SEOverlay;
557
+ session?: unknown;
558
+ tipping?: unknown;
559
+ channel?: unknown;
560
+ passport?: unknown;
561
+ }
562
+ interface SEOverlay {
563
+ _id: string;
564
+ channel?: string;
565
+ type?: string;
566
+ name?: string;
567
+ settings: {
568
+ width: number;
569
+ height: number;
570
+ name?: string;
571
+ };
572
+ widgets: SEWidget[];
573
+ createdAt?: string;
574
+ updatedAt?: string;
575
+ }
576
+ interface SEWidget {
577
+ id: number | string;
578
+ group?: string | null;
579
+ version?: number | string | null;
580
+ type: string;
581
+ name?: string | null;
582
+ visible?: boolean;
583
+ locked?: boolean;
584
+ listener?: string | null;
585
+ listeners?: Record<string, boolean> | string[] | null;
586
+ provider?: string;
587
+ css: SECss;
588
+ text?: SEText;
589
+ image?: SEImage;
590
+ video?: SEVideo;
591
+ audio?: SEAudio;
592
+ variables?: Record<string, unknown>;
593
+ }
594
+ interface SECss {
595
+ 'z-index'?: number;
596
+ width: string | number;
597
+ height: string | number;
598
+ opacity?: number;
599
+ top?: string | number;
600
+ left?: string | number;
601
+ }
602
+ interface SEText {
603
+ type?: string;
604
+ value?: string | null;
605
+ enableShadow?: boolean;
606
+ scrolling?: {
607
+ direction?: string;
608
+ speed?: number;
609
+ };
610
+ css?: Record<string, unknown>;
611
+ }
612
+ interface SEImage {
613
+ type?: string;
614
+ src?: string;
615
+ css?: Record<string, unknown>;
616
+ }
617
+ interface SEVideo {
618
+ type?: string;
619
+ src?: string;
620
+ volume?: number;
621
+ css?: Record<string, unknown>;
622
+ }
623
+ interface SEAudio {
624
+ src?: string;
625
+ volume?: number;
626
+ }
627
+ interface ImportCoverage {
628
+ totalWidgets: number;
629
+ mappings: Array<{
630
+ seType: string;
631
+ lumiaType: string;
632
+ status: 'direct' | 'partial' | 'template' | 'placeholder';
633
+ count: number;
634
+ }>;
635
+ notes: string[];
636
+ }
637
+ interface ReviewItem {
638
+ moduleId: string;
639
+ seWidget: SEWidget;
640
+ status: 'placeholder' | 'template';
641
+ reason: string;
642
+ flaggedOff?: boolean;
643
+ }
644
+
645
+ /** Distinct SE CDN URLs referenced anywhere inside the overlay's settings. */
646
+ declare function findSEAssetURLs(overlay: OverlayState): string[];
647
+ /** Return a new overlay with every `oldUrl → newUrl` replacement applied. */
648
+ declare function rewriteAssetURLs(overlay: OverlayState, mapping: Record<string, string>): OverlayState;
649
+ interface AssetMirrorProgress {
650
+ url: string;
651
+ state: 'pending' | 'fetching' | 'uploading' | 'done' | 'failed';
652
+ newUrl?: string;
653
+ error?: string;
654
+ }
655
+ /**
656
+ * Mirror a single SE asset to Lumia storage via the existing `/overlays/assets`
657
+ * upload endpoint. Returns the new Lumia URL on success.
658
+ *
659
+ * The host call site is responsible for retries and progress reporting; this
660
+ * function is intentionally single-shot. Pass `signal` (AbortSignal) to abort
661
+ * the source-side `fetch` when the modal closes mid-mirror — the upload itself
662
+ * is consumer-defined and the caller decides whether/how to short-circuit it.
663
+ */
664
+ declare function mirrorOneAsset(url: string, upload: (file: File) => Promise<{
665
+ asset: {
666
+ url: string;
667
+ };
668
+ } | {
669
+ url: string;
670
+ } | unknown>, signal?: AbortSignal): Promise<string>;
671
+ declare function filenameFromURL(url: string): string;
672
+
673
+ interface TransplantedUnit {
674
+ layer: OverlayLayerState;
675
+ module: OverlayModuleState;
676
+ extras?: Array<{
677
+ layer: OverlayLayerState;
678
+ module: OverlayModuleState;
679
+ }>;
680
+ }
681
+ declare function transplantLayer(source: OverlayState, sourceLayerId: string): TransplantedUnit | null;
682
+ declare function listTransplantableLayers(source: OverlayState): Array<{
683
+ id: string;
684
+ label: string;
685
+ type: string;
686
+ }>;
687
+
688
+ declare const SE_WIDGET_TO_MARKETPLACE_CANDIDATES: Record<string, number[]>;
689
+ declare function getMarketplaceCandidates(seWidgetType: string): number[];
690
+ declare function hasMarketplaceCandidates(seWidgetType: string): boolean;
691
+
692
+ declare const SE_IMPORT_FLAGS: {
693
+ readonly IMPORT_MERCH_PRODUCTS: false;
694
+ readonly IMPORT_SEASONAL: false;
695
+ };
696
+ declare function isWidgetFlaggedOff(seType: string): boolean;
697
+ declare const FLAG_OFF_REASONS: Record<string, string>;
698
+
699
+ interface SEAccountClaims {
700
+ channel: string;
701
+ user: string;
702
+ authToken: string;
703
+ provider: string;
704
+ provider_id: string;
705
+ role: string;
706
+ exp: number;
707
+ jti: string;
708
+ channel_id?: string;
709
+ user_id?: string;
710
+ }
711
+ type SEAuthErrorCode = 'invalid-jwt' | 'expired' | 'unauthorized' | 'forbidden';
712
+ declare class SEAuthError extends Error {
713
+ code: SEAuthErrorCode;
714
+ constructor(code: SEAuthErrorCode, message: string);
715
+ }
716
+ declare function decodeJwtPayload(jwt: string): SEAccountClaims;
717
+ declare class SEClient {
718
+ private readonly claims;
719
+ constructor(claims: SEAccountClaims);
720
+ static fromJwt(jwt: string): SEClient;
721
+ get channelId(): string;
722
+ get provider(): string;
723
+ get providerId(): string;
724
+ get userId(): string;
725
+ get jti(): string;
726
+ get expiresAt(): Date;
727
+ provenance(): {
728
+ jti: string;
729
+ channelId: string;
730
+ provider: string;
731
+ importedAt: string;
732
+ };
733
+ get<T>(path: string): Promise<T>;
734
+ }
735
+ interface SEChannelSummary {
736
+ _id: string;
737
+ provider: string;
738
+ providerId: string;
739
+ username: string;
740
+ alias?: string;
741
+ displayName?: string;
742
+ avatar?: string;
743
+ role?: string;
744
+ authorized?: boolean;
745
+ inactive?: boolean;
746
+ isPartner?: boolean;
747
+ broadcasterType?: string;
748
+ }
749
+ interface SEUsersCurrentResponse {
750
+ _id: string;
751
+ suspended?: boolean;
752
+ channels: SEChannelSummary[];
753
+ }
754
+ declare function fetchUsableChannels(client: SEClient): Promise<SEChannelSummary[]>;
755
+
756
+ interface SEExistingAsset {
757
+ file_name?: string;
758
+ name?: string;
759
+ url: string;
760
+ }
761
+ interface SECustomEmbedProps {
762
+ codeId: string;
763
+ html: string;
764
+ css: string;
765
+ js: string;
766
+ data: unknown;
767
+ }
768
+ interface SEUploadAssetResult {
769
+ url: string;
770
+ file_name?: string;
771
+ name?: string;
772
+ }
773
+ interface SESaveOverlayBody {
774
+ name: string;
775
+ description?: string;
776
+ settings: OverlayState['settings'];
777
+ }
778
+ interface SEImportBindings {
779
+ fetchMarketplaceOverlay: (id: number) => Promise<OverlayState>;
780
+ generateAICustomCode: (prompt: string) => Promise<AIGeneratedCustomOverlay>;
781
+ uploadAsset: (file: File) => Promise<SEUploadAssetResult>;
782
+ existingAssets: SEExistingAsset[];
783
+ saveOverlay: (body: SESaveOverlayBody) => Promise<{
784
+ uuid: string;
785
+ }>;
786
+ onComplete: (result: {
787
+ overlayId: string;
788
+ }) => void;
789
+ onClose: () => void;
790
+ notify: {
791
+ success: (msg: string) => void;
792
+ error: (msg: string) => void;
793
+ warning: (msg: string) => void;
794
+ };
795
+ CustomEmbed?: ComponentType<SECustomEmbedProps>;
796
+ t?: (key: string) => string | undefined;
797
+ onAuthError?: (err: SEAuthError) => void;
798
+ }
799
+
800
+ interface SEImportWizardProps {
801
+ bindings: SEImportBindings;
802
+ initialUrl?: string;
803
+ }
804
+ declare function SEImportWizard({ bindings, initialUrl, }: SEImportWizardProps): react_jsx_runtime.JSX.Element;
805
+
806
+ interface MarketplacePickerProps {
807
+ seWidgetType: string;
808
+ fetchMarketplaceOverlay: SEImportBindings['fetchMarketplaceOverlay'];
809
+ CustomEmbed?: SEImportBindings['CustomEmbed'];
810
+ onPick: (transplant: {
811
+ layer: OverlayLayerState;
812
+ module: OverlayModuleState;
813
+ }) => void;
814
+ onCancel: () => void;
815
+ }
816
+ declare function MarketplacePicker({ seWidgetType, fetchMarketplaceOverlay, CustomEmbed, onPick, onCancel }: MarketplacePickerProps): react_jsx_runtime.JSX.Element;
817
+
818
+ interface ImportResult {
819
+ overlay: OverlayState;
820
+ coverage: ImportCoverage;
821
+ reviewItems: ReviewItem[];
822
+ }
823
+ declare function extractSEOverlayId(input: string): string | null;
824
+ declare function extractSEPreviewParts(input: string): {
825
+ overlayId: string;
826
+ apikey: string;
827
+ } | null;
828
+ declare function buildBootstrapUrl(overlayId: string): string;
829
+ declare function fetchSEBootstrap({ overlayId, apikey }: {
830
+ overlayId: string;
831
+ apikey: string;
832
+ }): Promise<SEBootstrapResponse>;
833
+ declare function isSEBootstrap(value: unknown): value is SEBootstrapResponse;
834
+ declare function importSEBootstrap(bootstrap: SEBootstrapResponse): ImportResult;
835
+ interface AIGeneratedCustomOverlay {
836
+ codeId?: string;
837
+ html?: string;
838
+ css?: string;
839
+ js?: string;
840
+ data?: unknown;
841
+ configs?: unknown;
842
+ }
843
+ declare function applyReviewAction(result: ImportResult, moduleId: string, action: 'keep' | 'skip' | 'ai' | 'marketplace', payload?: AIGeneratedCustomOverlay | {
844
+ layer: OverlayLayerState;
845
+ module: OverlayModuleState;
846
+ extras?: Array<{
847
+ layer: OverlayLayerState;
848
+ module: OverlayModuleState;
849
+ }>;
850
+ }): ImportResult;
851
+ declare function getAILandingBounds(widget: SEWidget, canvas?: {
852
+ width: number;
853
+ height: number;
854
+ }): {
855
+ width: number;
856
+ height: number;
857
+ };
858
+ declare function buildAIPromptForSEWidget(widget: SEWidget, canvas?: {
859
+ width: number;
860
+ height: number;
861
+ }): string;
862
+
863
+ export { type AIGeneratedCustomOverlay, type AssetMirrorProgress, type BuildChatMessageContentOptions, type ChatMessageContentItem, type ChatMessageEmoteStore, type ChatMessageToken, type ChatMessageTokenizationOptions, type ChatboxMediaPreview, type ChatboxMediaPreviewKind, type ChatterProfileResolver, type ChatterProfileResolverPayload, type ChatterProfileUrlInput, FLAG_OFF_REASONS, type IVariables, type ImportCoverage, type ImportResult, LSButton, type LSButtonProps, LSCheckbox, LSCheckboxField, LSColorPicker, type LSColorPickerProps, LSFontPicker, LSInput, type LSInputProps$1 as LSInputProps, LSMultiSelect, LSRadio, LSRadioGroup, LSSelect, LSSliderInput, type LSInputProps as LSSliderInputProps, LSTextField, type LSTextFieldProps, type LSVariableInputContextValue, LSVariableInputField, type LSVariableInputFieldProps, LSVariableInputProvider, MEDIA_PREVIEW_USER_LEVEL_VALUES, MarketplacePicker, type MarketplacePickerProps, type MediaPreviewRoleSettings, type MediaPreviewRoleSettingsInput, type MediaPreviewUserLevel, type MessageLinkPart, type ModuleType, type OverlayLayerBounds, type OverlayLayerState, type OverlayLayerType, type OverlayModuleAlertState, type OverlayModuleState, type OverlaySettings, type OverlayState, type ResolveChatterProfileUrlWithResolversInput, type ReviewItem, type SEAccountClaims, SEAuthError, type SEAuthErrorCode, type SEBootstrapResponse, type SEChannelSummary, SEClient, type SECustomEmbedProps, type SEExistingAsset, type SEImportBindings, SEImportWizard, type SEImportWizardProps, type SESaveOverlayBody, type SEUploadAssetResult, type SEUsersCurrentResponse, type SEWidget, SE_IMPORT_FLAGS, SE_WIDGET_TO_MARKETPLACE_CANDIDATES, type TransplantedUnit, applyReviewAction, buildAIPromptForSEWidget, buildBootstrapUrl, buildChatMessageContent, codeMirrorlinterOptions, decodeJwtPayload, extractSEOverlayId, extractSEPreviewParts, fetchSEBootstrap, fetchUsableChannels, filenameFromURL, findSEAssetURLs, getAILandingBounds, getMarketplaceCandidates, getMediaPreviewFromUrl, getNormalizedUserLevels, hasMarketplaceCandidates, importSEBootstrap, isMediaPreviewAllowedForUser, isSEBootstrap, isWidgetFlaggedOff, listTransplantableLayers, mirrorOneAsset, normalizeHttpUrl, normalizeMediaPreviewUserLevels, parseMessageLinks, resolveChatterProfileUrlWithResolvers, resolveMediaPreviewRoleSettings, resolveMediaPreviewSetting, resolvePlatformChatterProfileUrl, rewriteAssetURLs, tokenizeChatMessage, transplantLayer, variableCompletionOptions };