@wix/headless-instagram 0.0.0

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 (64) hide show
  1. package/cjs/dist/react/InstagramFeed.d.ts +7 -0
  2. package/cjs/dist/react/InstagramFeed.js +6 -0
  3. package/cjs/dist/react/InstagramFeedRoot.d.ts +18 -0
  4. package/cjs/dist/react/InstagramFeedRoot.js +19 -0
  5. package/cjs/dist/react/InstagramMedia.d.ts +73 -0
  6. package/cjs/dist/react/InstagramMedia.js +71 -0
  7. package/cjs/dist/react/InstagramMedias.d.ts +10 -0
  8. package/cjs/dist/react/InstagramMedias.js +16 -0
  9. package/cjs/dist/react/UserName.d.ts +11 -0
  10. package/cjs/dist/react/UserName.js +8 -0
  11. package/cjs/dist/react/core/InstagramMedia.d.ts +82 -0
  12. package/cjs/dist/react/core/InstagramMedia.js +65 -0
  13. package/cjs/dist/react/core/InstagramMedias.d.ts +19 -0
  14. package/cjs/dist/react/core/InstagramMedias.js +54 -0
  15. package/cjs/dist/react/core/Root.d.ts +7 -0
  16. package/cjs/dist/react/core/Root.js +8 -0
  17. package/cjs/dist/react/core/UserName.d.ts +21 -0
  18. package/cjs/dist/react/core/UserName.js +17 -0
  19. package/cjs/dist/react/core/index.d.ts +4 -0
  20. package/cjs/dist/react/core/index.js +5 -0
  21. package/cjs/dist/react/index.d.ts +2 -0
  22. package/cjs/dist/react/index.js +2 -0
  23. package/cjs/dist/services/index.d.ts +2 -0
  24. package/cjs/dist/services/index.js +2 -0
  25. package/cjs/dist/services/instagram-feed-service.d.ts +178 -0
  26. package/cjs/dist/services/instagram-feed-service.js +196 -0
  27. package/cjs/dist/services/instagram-media-item-service.d.ts +73 -0
  28. package/cjs/dist/services/instagram-media-item-service.js +55 -0
  29. package/cjs/dist/vitest.setup.d.ts +1 -0
  30. package/cjs/dist/vitest.setup.js +1 -0
  31. package/cjs/package.json +3 -0
  32. package/dist/react/InstagramFeed.d.ts +7 -0
  33. package/dist/react/InstagramFeed.js +6 -0
  34. package/dist/react/InstagramFeedRoot.d.ts +18 -0
  35. package/dist/react/InstagramFeedRoot.js +19 -0
  36. package/dist/react/InstagramMedia.d.ts +73 -0
  37. package/dist/react/InstagramMedia.js +71 -0
  38. package/dist/react/InstagramMedias.d.ts +10 -0
  39. package/dist/react/InstagramMedias.js +16 -0
  40. package/dist/react/UserName.d.ts +11 -0
  41. package/dist/react/UserName.js +8 -0
  42. package/dist/react/core/InstagramMedia.d.ts +82 -0
  43. package/dist/react/core/InstagramMedia.js +65 -0
  44. package/dist/react/core/InstagramMedias.d.ts +19 -0
  45. package/dist/react/core/InstagramMedias.js +54 -0
  46. package/dist/react/core/Root.d.ts +7 -0
  47. package/dist/react/core/Root.js +8 -0
  48. package/dist/react/core/UserName.d.ts +21 -0
  49. package/dist/react/core/UserName.js +17 -0
  50. package/dist/react/core/index.d.ts +4 -0
  51. package/dist/react/core/index.js +5 -0
  52. package/dist/react/index.d.ts +2 -0
  53. package/dist/react/index.js +2 -0
  54. package/dist/services/index.d.ts +2 -0
  55. package/dist/services/index.js +2 -0
  56. package/dist/services/instagram-feed-service.d.ts +178 -0
  57. package/dist/services/instagram-feed-service.js +196 -0
  58. package/dist/services/instagram-media-item-service.d.ts +73 -0
  59. package/dist/services/instagram-media-item-service.js +55 -0
  60. package/dist/vitest.setup.d.ts +1 -0
  61. package/dist/vitest.setup.js +1 -0
  62. package/package.json +72 -0
  63. package/react/package.json +6 -0
  64. package/services/package.json +6 -0
@@ -0,0 +1,178 @@
1
+ import { type Signal } from '@wix/services-definitions/core-services/signals';
2
+ import { accounts } from '@wix/instagram-account';
3
+ import { media } from '@wix/instagram-media';
4
+ /**
5
+ * Instagram media item types
6
+ */
7
+ export type InstagramMediaType = 'image' | 'video' | 'carousel';
8
+ /**
9
+ * Instagram media item structure
10
+ * Extending SDK types with additional fields for UI components
11
+ */
12
+ export interface InstagramMediaItem {
13
+ /** Unique identifier for the media item */
14
+ id: string;
15
+ /** Type of the media */
16
+ type: InstagramMediaType;
17
+ /** URL to the media content */
18
+ mediaUrl: string;
19
+ /** Thumbnail URL for videos */
20
+ thumbnailUrl?: string;
21
+ /** Caption text */
22
+ caption?: string;
23
+ /** Permalink to the Instagram post */
24
+ permalink: string;
25
+ /** ISO timestamp of when the media was created */
26
+ timestamp: string;
27
+ /** Alt text for accessibility */
28
+ altText?: string;
29
+ }
30
+ /**
31
+ * Instagram account information using SDK types
32
+ */
33
+ export type InstagramAccount = accounts.InstagramAccount;
34
+ /**
35
+ * Instagram media using SDK types
36
+ */
37
+ export type InstagramMedia = media.Media;
38
+ /**
39
+ * Instagram feed data combining account and media information
40
+ */
41
+ export interface InstagramFeedData {
42
+ /** Instagram account information */
43
+ account?: InstagramAccount;
44
+ /** Array of media items */
45
+ mediaItems: InstagramMediaItem[];
46
+ /** Whether there are more items to load */
47
+ hasMore: boolean;
48
+ /** Cursor for pagination */
49
+ nextCursor?: string;
50
+ }
51
+ /**
52
+ * Configuration interface for the Instagram Feed service.
53
+ * Contains the initial feed data and connection settings.
54
+ */
55
+ export interface InstagramFeedServiceConfig {
56
+ /** Instagram account ID or username */
57
+ accountId?: string;
58
+ /** Number of media items to fetch */
59
+ limit?: number;
60
+ /** Initial feed data (for SSR or caching) */
61
+ feedData?: InstagramFeedData;
62
+ }
63
+ /**
64
+ * API interface for the Instagram Feed service, providing reactive feed data management.
65
+ * This service handles loading and managing Instagram feed data, loading state, and errors.
66
+ */
67
+ export interface InstagramFeedServiceAPI {
68
+ /** Reactive signal containing the current feed data */
69
+ feedData: Signal<InstagramFeedData>;
70
+ /** Reactive signal indicating if feed data is currently being loaded */
71
+ isLoading: Signal<boolean>;
72
+ /** Reactive signal containing any error message, or null if no error */
73
+ error: Signal<string | null>;
74
+ /** Function to load more media items */
75
+ loadMore: () => Promise<void>;
76
+ /** Function to refresh the entire feed */
77
+ refresh: () => Promise<void>;
78
+ }
79
+ /**
80
+ * Service definition for the Instagram Feed service.
81
+ * This defines the reactive API contract for managing Instagram feed data.
82
+ */
83
+ export declare const InstagramFeedServiceDefinition: string & {
84
+ __api: InstagramFeedServiceAPI;
85
+ __config: InstagramFeedServiceConfig;
86
+ isServiceDefinition?: boolean;
87
+ } & InstagramFeedServiceAPI;
88
+ /**
89
+ * Implementation of the Instagram Feed service that manages reactive Instagram feed data.
90
+ * This service provides signals for feed data, loading state, and error handling,
91
+ * along with methods to dynamically load and refresh Instagram content.
92
+ *
93
+ * @example
94
+ * ```tsx
95
+ * import { InstagramFeedService, InstagramFeedServiceDefinition } from '@wix/instagram/services';
96
+ * import { useService } from '@wix/services-manager-react';
97
+ *
98
+ * function InstagramComponent({ feedConfig }) {
99
+ * return (
100
+ * <ServiceProvider services={createServicesMap([
101
+ * [InstagramFeedServiceDefinition, InstagramFeedService.withConfig(feedConfig)]
102
+ * ])}>
103
+ * <InstagramDisplay />
104
+ * </ServiceProvider>
105
+ * );
106
+ * }
107
+ *
108
+ * function InstagramDisplay() {
109
+ * const feedService = useService(InstagramFeedServiceDefinition);
110
+ * const feedData = feedService.feedData.get();
111
+ * const isLoading = feedService.isLoading.get();
112
+ * const error = feedService.error.get();
113
+ *
114
+ * if (isLoading) return <div>Loading Instagram feed...</div>;
115
+ * if (error) return <div>Error: {error}</div>;
116
+ *
117
+ * return <div>{feedData.mediaItems.length} posts loaded</div>;
118
+ * }
119
+ * ```
120
+ */
121
+ export declare const InstagramFeedService: import("@wix/services-definitions").ServiceFactory<string & {
122
+ __api: InstagramFeedServiceAPI;
123
+ __config: InstagramFeedServiceConfig;
124
+ isServiceDefinition?: boolean;
125
+ } & InstagramFeedServiceAPI, InstagramFeedServiceConfig>;
126
+ /**
127
+ * Success result interface for Instagram feed service configuration loading.
128
+ * Returned when feed data is successfully loaded.
129
+ */
130
+ export interface SuccessInstagramFeedServiceConfigResult {
131
+ /** Type "success" means that the feed was loaded and the config is valid */
132
+ type: 'success';
133
+ /** The feed config containing the loaded feed data */
134
+ config: InstagramFeedServiceConfig;
135
+ }
136
+ /**
137
+ * Not found result interface for Instagram feed service configuration loading.
138
+ * Returned when account or feed data cannot be found.
139
+ */
140
+ export interface NotFoundInstagramFeedServiceConfigResult {
141
+ /** Type "notFound" means that the account was not found */
142
+ type: 'notFound';
143
+ }
144
+ /**
145
+ * Union type for Instagram feed service configuration results.
146
+ */
147
+ export type InstagramFeedServiceConfigResult = SuccessInstagramFeedServiceConfigResult | NotFoundInstagramFeedServiceConfigResult;
148
+ /**
149
+ * Input object for loading Instagram feed service configuration
150
+ */
151
+ /**
152
+ * Loads Instagram feed service configuration from the Wix Instagram API for SSR initialization.
153
+ * This function is designed to be used during Server-Side Rendering (SSR) to preload
154
+ * Instagram feed data that will be used to configure the InstagramFeedService.
155
+ *
156
+ * @param input InstagramFeedServiceConfig object containing accountId and optional limit
157
+ * @returns Promise that resolves to InstagramFeedServiceConfigResult (success with config or notFound)
158
+ *
159
+ * @example
160
+ * ```tsx
161
+ * import { loadInstagramFeedServiceConfig } from '@wix/instagram/services';
162
+ *
163
+ * // In your SSR handler or server action
164
+ * const configResult = await loadInstagramFeedServiceConfig({
165
+ * accountId: 'instagram_account_123',
166
+ * limit: 12
167
+ * });
168
+ *
169
+ * if (configResult.type === 'success') {
170
+ * // Use configResult.config to initialize InstagramFeedService
171
+ * return configResult.config;
172
+ * } else {
173
+ * // Handle not found case
174
+ * return { accountId: 'instagram_account_123' }; // fallback config
175
+ * }
176
+ * ```
177
+ */
178
+ export declare function loadInstagramFeedServiceConfig(input: InstagramFeedServiceConfig): Promise<InstagramFeedServiceConfigResult>;
@@ -0,0 +1,196 @@
1
+ import { defineService, implementService } from '@wix/services-definitions';
2
+ import { SignalsServiceDefinition, } from '@wix/services-definitions/core-services/signals';
3
+ import { accounts } from '@wix/instagram-account';
4
+ import { media } from '@wix/instagram-media';
5
+ /**
6
+ * Default Instagram feed data
7
+ */
8
+ const defaultInstagramFeedData = {
9
+ mediaItems: [],
10
+ hasMore: false,
11
+ };
12
+ /**
13
+ * Service definition for the Instagram Feed service.
14
+ * This defines the reactive API contract for managing Instagram feed data.
15
+ */
16
+ export const InstagramFeedServiceDefinition = defineService('instagram-feed');
17
+ /**
18
+ * Implementation of the Instagram Feed service that manages reactive Instagram feed data.
19
+ * This service provides signals for feed data, loading state, and error handling,
20
+ * along with methods to dynamically load and refresh Instagram content.
21
+ *
22
+ * @example
23
+ * ```tsx
24
+ * import { InstagramFeedService, InstagramFeedServiceDefinition } from '@wix/instagram/services';
25
+ * import { useService } from '@wix/services-manager-react';
26
+ *
27
+ * function InstagramComponent({ feedConfig }) {
28
+ * return (
29
+ * <ServiceProvider services={createServicesMap([
30
+ * [InstagramFeedServiceDefinition, InstagramFeedService.withConfig(feedConfig)]
31
+ * ])}>
32
+ * <InstagramDisplay />
33
+ * </ServiceProvider>
34
+ * );
35
+ * }
36
+ *
37
+ * function InstagramDisplay() {
38
+ * const feedService = useService(InstagramFeedServiceDefinition);
39
+ * const feedData = feedService.feedData.get();
40
+ * const isLoading = feedService.isLoading.get();
41
+ * const error = feedService.error.get();
42
+ *
43
+ * if (isLoading) return <div>Loading Instagram feed...</div>;
44
+ * if (error) return <div>Error: {error}</div>;
45
+ *
46
+ * return <div>{feedData.mediaItems.length} posts loaded</div>;
47
+ * }
48
+ * ```
49
+ */
50
+ export const InstagramFeedService = implementService.withConfig()(InstagramFeedServiceDefinition, ({ getService, config }) => {
51
+ const signalsService = getService(SignalsServiceDefinition);
52
+ const feedData = signalsService.signal(config.feedData || defaultInstagramFeedData);
53
+ const isLoading = signalsService.signal(!!config.accountId);
54
+ const error = signalsService.signal(null);
55
+ const loadFeed = async (accountId, cursor) => {
56
+ try {
57
+ isLoading.set(true);
58
+ error.set(null);
59
+ // Load Instagram account information
60
+ const accountResponse = await accounts.getInstagramAccount(accountId);
61
+ // Load Instagram media for the account
62
+ const mediaResponse = await media.listInstagramAccountMedia(accountId);
63
+ // Transform SDK media to our interface format
64
+ const transformedMedia = mediaResponse.media?.map((mediaItem) => ({
65
+ id: mediaItem._id || mediaItem.mediaId || '',
66
+ type: (mediaItem.mediaType || 'image'),
67
+ mediaUrl: mediaItem.mediaUrl || '',
68
+ thumbnailUrl: mediaItem.thumbnailUrl || undefined,
69
+ caption: mediaItem.caption,
70
+ permalink: mediaItem.permalink || '',
71
+ timestamp: typeof mediaItem.timestamp === 'string'
72
+ ? mediaItem.timestamp
73
+ : new Date().toISOString(),
74
+ altText: mediaItem.caption ||
75
+ `Instagram post ${mediaItem._id || mediaItem.mediaId}`,
76
+ })) || [];
77
+ const newFeedData = {
78
+ account: accountResponse,
79
+ mediaItems: cursor
80
+ ? [...feedData.get().mediaItems, ...transformedMedia]
81
+ : transformedMedia,
82
+ hasMore: false, // Note: Real pagination logic would depend on actual SDK response structure
83
+ nextCursor: undefined,
84
+ };
85
+ feedData.set(newFeedData);
86
+ }
87
+ catch (err) {
88
+ const errorMessage = err instanceof Error
89
+ ? err.message
90
+ : 'Failed to load Instagram feed';
91
+ error.set(errorMessage);
92
+ }
93
+ finally {
94
+ isLoading.set(false);
95
+ }
96
+ };
97
+ const loadMore = async () => {
98
+ const currentData = feedData.get();
99
+ if (!currentData.hasMore || isLoading.get())
100
+ return;
101
+ if (config.accountId) {
102
+ await loadFeed(config.accountId, currentData.nextCursor);
103
+ }
104
+ };
105
+ const refresh = async () => {
106
+ if (config.accountId) {
107
+ await loadFeed(config.accountId);
108
+ }
109
+ };
110
+ // Initial load if accountId is provided
111
+ if (config.accountId && !config.feedData) {
112
+ loadFeed(config.accountId);
113
+ }
114
+ return {
115
+ feedData,
116
+ isLoading,
117
+ error,
118
+ loadMore,
119
+ refresh,
120
+ };
121
+ });
122
+ /**
123
+ * Input object for loading Instagram feed service configuration
124
+ */
125
+ /**
126
+ * Loads Instagram feed service configuration from the Wix Instagram API for SSR initialization.
127
+ * This function is designed to be used during Server-Side Rendering (SSR) to preload
128
+ * Instagram feed data that will be used to configure the InstagramFeedService.
129
+ *
130
+ * @param input InstagramFeedServiceConfig object containing accountId and optional limit
131
+ * @returns Promise that resolves to InstagramFeedServiceConfigResult (success with config or notFound)
132
+ *
133
+ * @example
134
+ * ```tsx
135
+ * import { loadInstagramFeedServiceConfig } from '@wix/instagram/services';
136
+ *
137
+ * // In your SSR handler or server action
138
+ * const configResult = await loadInstagramFeedServiceConfig({
139
+ * accountId: 'instagram_account_123',
140
+ * limit: 12
141
+ * });
142
+ *
143
+ * if (configResult.type === 'success') {
144
+ * // Use configResult.config to initialize InstagramFeedService
145
+ * return configResult.config;
146
+ * } else {
147
+ * // Handle not found case
148
+ * return { accountId: 'instagram_account_123' }; // fallback config
149
+ * }
150
+ * ```
151
+ */
152
+ export async function loadInstagramFeedServiceConfig(input) {
153
+ try {
154
+ const { accountId, limit } = input;
155
+ if (!accountId) {
156
+ return { type: 'notFound' };
157
+ }
158
+ // Load Instagram account information using SDK
159
+ const accountResponse = await accounts.getInstagramAccount(accountId);
160
+ if (!accountResponse) {
161
+ return { type: 'notFound' };
162
+ }
163
+ // Load initial media items using SDK
164
+ const mediaResponse = await media.listInstagramAccountMedia(accountId);
165
+ // Transform SDK media to our interface format
166
+ const transformedMedia = mediaResponse.media?.map((mediaItem) => ({
167
+ id: mediaItem._id || mediaItem.mediaId || '',
168
+ type: (mediaItem.mediaType || 'image'),
169
+ mediaUrl: mediaItem.mediaUrl || '',
170
+ thumbnailUrl: mediaItem.thumbnailUrl || undefined,
171
+ caption: mediaItem.caption,
172
+ permalink: mediaItem.permalink || '',
173
+ timestamp: typeof mediaItem.timestamp === 'string'
174
+ ? mediaItem.timestamp
175
+ : new Date().toISOString(),
176
+ altText: mediaItem.caption ||
177
+ `Instagram post ${mediaItem._id || mediaItem.mediaId}`,
178
+ })) || [];
179
+ const feedData = {
180
+ account: accountResponse,
181
+ mediaItems: transformedMedia,
182
+ hasMore: false, // Note: Real pagination logic would depend on actual SDK response structure
183
+ nextCursor: undefined,
184
+ };
185
+ const config = {
186
+ accountId,
187
+ limit,
188
+ feedData,
189
+ };
190
+ return { type: 'success', config };
191
+ }
192
+ catch (error) {
193
+ console.error('Failed to load Instagram feed config:', error);
194
+ return { type: 'notFound' };
195
+ }
196
+ }
@@ -0,0 +1,73 @@
1
+ import { type Signal } from '@wix/services-definitions/core-services/signals';
2
+ import type { InstagramMediaItem } from './instagram-feed-service.js';
3
+ /**
4
+ * API interface for Instagram Media Item service
5
+ */
6
+ export interface InstagramMediaItemServiceAPI {
7
+ /** Reactive signal containing the media item data */
8
+ mediaItem: Signal<InstagramMediaItem>;
9
+ /** Reactive signal containing the media item index */
10
+ index: Signal<number>;
11
+ }
12
+ /**
13
+ * Configuration for Instagram Media Item service
14
+ */
15
+ export interface InstagramMediaItemServiceConfig {
16
+ /** The Instagram media item data */
17
+ mediaItem: InstagramMediaItem;
18
+ /** The index of this media item in the gallery */
19
+ index: number;
20
+ }
21
+ /**
22
+ * Service definition for Instagram Media Item
23
+ */
24
+ export declare const InstagramMediaItemServiceDefinition: string & {
25
+ __api: InstagramMediaItemServiceAPI;
26
+ __config: {};
27
+ isServiceDefinition?: boolean;
28
+ } & InstagramMediaItemServiceAPI;
29
+ /**
30
+ * Implementation of the Instagram Media Item service that manages reactive media item data.
31
+ * This service provides signals for individual media item data and its index position.
32
+ * Used by gallery components to access media item information in a service-based architecture.
33
+ *
34
+ * @example
35
+ * ```tsx
36
+ * import { InstagramMediaItemService, InstagramMediaItemServiceDefinition } from '@wix/headless-instagram/services';
37
+ * import { useService } from '@wix/services-manager-react';
38
+ * import { WixServices, createServicesMap } from '@wix/services-manager';
39
+ *
40
+ * function MediaItemComponent({ mediaItem, index }) {
41
+ * return (
42
+ * <WixServices
43
+ * servicesMap={createServicesMap().addService(
44
+ * InstagramMediaItemServiceDefinition,
45
+ * InstagramMediaItemService,
46
+ * { mediaItem, index }
47
+ * )}
48
+ * >
49
+ * <MediaItemDisplay />
50
+ * </WixServices>
51
+ * );
52
+ * }
53
+ *
54
+ * function MediaItemDisplay() {
55
+ * const mediaItemService = useService(InstagramMediaItemServiceDefinition);
56
+ * const mediaItem = mediaItemService.mediaItem.get();
57
+ * const index = mediaItemService.index.get();
58
+ *
59
+ * return (
60
+ * <div>
61
+ * <img src={mediaItem.mediaUrl} alt={mediaItem.altText} />
62
+ * <span>Item {index + 1}</span>
63
+ * {mediaItem.type === 'video' && <VideoIndicator />}
64
+ * </div>
65
+ * );
66
+ * }
67
+ * ```
68
+ */
69
+ export declare const InstagramMediaItemService: import("@wix/services-definitions").ServiceFactory<string & {
70
+ __api: InstagramMediaItemServiceAPI;
71
+ __config: {};
72
+ isServiceDefinition?: boolean;
73
+ } & InstagramMediaItemServiceAPI, InstagramMediaItemServiceConfig>;
@@ -0,0 +1,55 @@
1
+ import { defineService, implementService } from '@wix/services-definitions';
2
+ import { SignalsServiceDefinition, } from '@wix/services-definitions/core-services/signals';
3
+ /**
4
+ * Service definition for Instagram Media Item
5
+ */
6
+ export const InstagramMediaItemServiceDefinition = defineService('instagramMediaItem');
7
+ /**
8
+ * Implementation of the Instagram Media Item service that manages reactive media item data.
9
+ * This service provides signals for individual media item data and its index position.
10
+ * Used by gallery components to access media item information in a service-based architecture.
11
+ *
12
+ * @example
13
+ * ```tsx
14
+ * import { InstagramMediaItemService, InstagramMediaItemServiceDefinition } from '@wix/headless-instagram/services';
15
+ * import { useService } from '@wix/services-manager-react';
16
+ * import { WixServices, createServicesMap } from '@wix/services-manager';
17
+ *
18
+ * function MediaItemComponent({ mediaItem, index }) {
19
+ * return (
20
+ * <WixServices
21
+ * servicesMap={createServicesMap().addService(
22
+ * InstagramMediaItemServiceDefinition,
23
+ * InstagramMediaItemService,
24
+ * { mediaItem, index }
25
+ * )}
26
+ * >
27
+ * <MediaItemDisplay />
28
+ * </WixServices>
29
+ * );
30
+ * }
31
+ *
32
+ * function MediaItemDisplay() {
33
+ * const mediaItemService = useService(InstagramMediaItemServiceDefinition);
34
+ * const mediaItem = mediaItemService.mediaItem.get();
35
+ * const index = mediaItemService.index.get();
36
+ *
37
+ * return (
38
+ * <div>
39
+ * <img src={mediaItem.mediaUrl} alt={mediaItem.altText} />
40
+ * <span>Item {index + 1}</span>
41
+ * {mediaItem.type === 'video' && <VideoIndicator />}
42
+ * </div>
43
+ * );
44
+ * }
45
+ * ```
46
+ */
47
+ export const InstagramMediaItemService = implementService.withConfig()(InstagramMediaItemServiceDefinition, ({ getService, config }) => {
48
+ const signalsService = getService(SignalsServiceDefinition);
49
+ const mediaItem = signalsService.signal(config.mediaItem);
50
+ const index = signalsService.signal(config.index);
51
+ return {
52
+ mediaItem,
53
+ index,
54
+ };
55
+ });
@@ -0,0 +1 @@
1
+ import '@testing-library/jest-dom/vitest';
@@ -0,0 +1 @@
1
+ import '@testing-library/jest-dom/vitest';
@@ -0,0 +1,3 @@
1
+ {
2
+ "type": "commonjs"
3
+ }
@@ -0,0 +1,7 @@
1
+ export { Root } from './InstagramFeedRoot.js';
2
+ export { UserName } from './UserName.js';
3
+ export { InstagramMedias } from './InstagramMedias.js';
4
+ export { InstagramMedia } from './InstagramMedia.js';
5
+ export type { RootProps } from './InstagramFeedRoot.js';
6
+ export type { UserNameProps } from './UserName.js';
7
+ export type { InstagramMediasProps } from './InstagramMedias.js';
@@ -0,0 +1,6 @@
1
+ // Instagram Feed compound component exports following stores pattern
2
+ // This file creates the Instagram namespace with all components
3
+ export { Root } from './InstagramFeedRoot.js';
4
+ export { UserName } from './UserName.js';
5
+ export { InstagramMedias } from './InstagramMedias.js';
6
+ export { InstagramMedia } from './InstagramMedia.js';
@@ -0,0 +1,18 @@
1
+ import React from 'react';
2
+ import { type InstagramFeedServiceConfig } from '../services/index.js';
3
+ /**
4
+ * Props for InstagramFeed Root component
5
+ */
6
+ export interface RootProps {
7
+ children: React.ReactNode;
8
+ instagramFeedServiceConfig: InstagramFeedServiceConfig;
9
+ className?: string;
10
+ }
11
+ /**
12
+ * Root component that provides Instagram feed service context using WixServices.
13
+ * This follows the same service-based pattern as the stores package.
14
+ *
15
+ * @order 1
16
+ * @component
17
+ */
18
+ export declare function Root(props: RootProps): React.ReactNode;
@@ -0,0 +1,19 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { WixServices } from '@wix/services-manager-react';
3
+ import { createServicesMap } from '@wix/services-manager';
4
+ import { InstagramFeedService, InstagramFeedServiceDefinition, } from '../services/index.js';
5
+ /**
6
+ * Root component that provides Instagram feed service context using WixServices.
7
+ * This follows the same service-based pattern as the stores package.
8
+ *
9
+ * @order 1
10
+ * @component
11
+ */
12
+ export function Root(props) {
13
+ const { children, instagramFeedServiceConfig, className, ...attrs } = props;
14
+ const attributes = {
15
+ className,
16
+ ...attrs,
17
+ };
18
+ return (_jsx(WixServices, { servicesMap: createServicesMap().addService(InstagramFeedServiceDefinition, InstagramFeedService, instagramFeedServiceConfig), children: _jsx("div", { ...attributes, children: children }) }));
19
+ }
@@ -0,0 +1,73 @@
1
+ import React from 'react';
2
+ import { type AsChildChildren } from '@wix/headless-utils/react';
3
+ export interface MediaGalleryRepeaterProps {
4
+ children: React.ReactNode;
5
+ }
6
+ /**
7
+ * Repeats children for each Instagram media item, providing a per-item service context.
8
+ */
9
+ export declare const MediaGalleryRepeater: React.FC<MediaGalleryRepeaterProps>;
10
+ export declare enum TestIds {
11
+ instagramMediaCaption = "instagram-media-caption",
12
+ instagramMediaType = "instagram-media-type",
13
+ instagramMediaUserName = "instagram-media-username",
14
+ instagramMediaTimestamp = "instagram-media-timestamp",
15
+ instagramMediaGalleries = "instagram-media-galleries"
16
+ }
17
+ export interface CaptionProps {
18
+ asChild?: boolean;
19
+ children?: AsChildChildren<{
20
+ caption?: string;
21
+ }>;
22
+ className?: string;
23
+ }
24
+ export declare const Caption: React.ForwardRefExoticComponent<CaptionProps & React.RefAttributes<HTMLElement>>;
25
+ export interface MediaTypeProps {
26
+ asChild?: boolean;
27
+ children?: AsChildChildren<{
28
+ mediaType: 'image' | 'video' | 'carousel';
29
+ }>;
30
+ className?: string;
31
+ }
32
+ export declare const MediaType: React.ForwardRefExoticComponent<MediaTypeProps & React.RefAttributes<HTMLElement>>;
33
+ export interface UserNameProps {
34
+ asChild?: boolean;
35
+ children?: AsChildChildren<{
36
+ userName?: string;
37
+ }>;
38
+ className?: string;
39
+ }
40
+ export declare const UserName: React.ForwardRefExoticComponent<UserNameProps & React.RefAttributes<HTMLElement>>;
41
+ export interface TimestampProps {
42
+ asChild?: boolean;
43
+ children?: AsChildChildren<{
44
+ timestamp: string;
45
+ }>;
46
+ className?: string;
47
+ }
48
+ export declare const Timestamp: React.ForwardRefExoticComponent<TimestampProps & React.RefAttributes<HTMLElement>>;
49
+ export interface MediaGalleriesProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'children'> {
50
+ children: React.ReactNode;
51
+ }
52
+ export declare const MediaGalleries: React.ForwardRefExoticComponent<MediaGalleriesProps & React.RefAttributes<HTMLDivElement>>;
53
+ export interface MediaGalleryItemsProps {
54
+ children: React.ReactNode;
55
+ className?: string;
56
+ }
57
+ export declare const MediaGalleryItems: React.ForwardRefExoticComponent<MediaGalleryItemsProps & React.RefAttributes<HTMLDivElement>>;
58
+ export declare const InstagramMedia: {
59
+ Root: ({ children }: {
60
+ children: React.ReactNode;
61
+ }) => import("react/jsx-runtime").JSX.Element;
62
+ Caption: React.ForwardRefExoticComponent<CaptionProps & React.RefAttributes<HTMLElement>>;
63
+ MediaType: React.ForwardRefExoticComponent<MediaTypeProps & React.RefAttributes<HTMLElement>>;
64
+ UserName: React.ForwardRefExoticComponent<UserNameProps & React.RefAttributes<HTMLElement>>;
65
+ Timestamp: React.ForwardRefExoticComponent<TimestampProps & React.RefAttributes<HTMLElement>>;
66
+ MediaGalleries: React.ForwardRefExoticComponent<MediaGalleriesProps & React.RefAttributes<HTMLDivElement>>;
67
+ MediaGalleryItems: React.ForwardRefExoticComponent<MediaGalleryItemsProps & React.RefAttributes<HTMLDivElement>>;
68
+ MediaGalleryRepeater: React.FC<MediaGalleryRepeaterProps>;
69
+ caption: React.ForwardRefExoticComponent<CaptionProps & React.RefAttributes<HTMLElement>>;
70
+ mediaType: React.ForwardRefExoticComponent<MediaTypeProps & React.RefAttributes<HTMLElement>>;
71
+ userName: React.ForwardRefExoticComponent<UserNameProps & React.RefAttributes<HTMLElement>>;
72
+ timestamp: React.ForwardRefExoticComponent<TimestampProps & React.RefAttributes<HTMLElement>>;
73
+ };