react-native-glance-chat 0.0.0-stage → 0.1.4

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 (46) hide show
  1. package/GlanceChat.podspec +20 -0
  2. package/LICENSE +20 -0
  3. package/README.md +50 -2
  4. package/android/build.gradle +104 -0
  5. package/android/src/main/AndroidManifest.xml +2 -0
  6. package/android/src/main/java/com/glancechat/GlanceChatModuleImpl.kt +174 -0
  7. package/android/src/main/java/com/glancechat/GlanceChatOverlayHostView.kt +39 -0
  8. package/android/src/main/java/com/glancechat/GlanceChatOverlayViewManager.kt +74 -0
  9. package/android/src/main/java/com/glancechat/GlanceChatPackage.kt +40 -0
  10. package/android/src/main/java/com/glancechat/GlanceMixAndMatchWidgetViewManager.kt +142 -0
  11. package/android/src/main/java/com/glancechat/GlancePdpSuggestionsViewManager.kt +40 -0
  12. package/android/src/main/java/com/glancechat/GlanceProductTryOnWidgetViewManager.kt +145 -0
  13. package/android/src/main/java/com/glancechat/UrlBrandLogoProvider.kt +24 -0
  14. package/android/src/newarch/java/com/glancechat/GlanceChatModule.kt +44 -0
  15. package/android/src/oldarch/java/com/glancechat/GlanceChatModule.kt +59 -0
  16. package/ios/GlanceChat.h +5 -0
  17. package/ios/GlanceChat.mm +21 -0
  18. package/lib/module/GlanceChatOverlayNativeComponent.ts +22 -0
  19. package/lib/module/GlanceMixAndMatchWidgetNativeComponent.ts +21 -0
  20. package/lib/module/GlancePdpSuggestionsNativeComponent.ts +9 -0
  21. package/lib/module/GlanceProductTryOnWidgetNativeComponent.ts +18 -0
  22. package/lib/module/NativeGlanceChat.js +20 -0
  23. package/lib/module/NativeGlanceChat.js.map +1 -0
  24. package/lib/module/index.js +65 -0
  25. package/lib/module/index.js.map +1 -0
  26. package/lib/module/package.json +1 -0
  27. package/lib/typescript/package.json +1 -0
  28. package/lib/typescript/src/GlanceChatOverlayNativeComponent.d.ts +18 -0
  29. package/lib/typescript/src/GlanceChatOverlayNativeComponent.d.ts.map +1 -0
  30. package/lib/typescript/src/GlanceMixAndMatchWidgetNativeComponent.d.ts +17 -0
  31. package/lib/typescript/src/GlanceMixAndMatchWidgetNativeComponent.d.ts.map +1 -0
  32. package/lib/typescript/src/GlancePdpSuggestionsNativeComponent.d.ts +6 -0
  33. package/lib/typescript/src/GlancePdpSuggestionsNativeComponent.d.ts.map +1 -0
  34. package/lib/typescript/src/GlanceProductTryOnWidgetNativeComponent.d.ts +14 -0
  35. package/lib/typescript/src/GlanceProductTryOnWidgetNativeComponent.d.ts.map +1 -0
  36. package/lib/typescript/src/NativeGlanceChat.d.ts +79 -0
  37. package/lib/typescript/src/NativeGlanceChat.d.ts.map +1 -0
  38. package/lib/typescript/src/index.d.ts +34 -0
  39. package/lib/typescript/src/index.d.ts.map +1 -0
  40. package/package.json +126 -4
  41. package/src/GlanceChatOverlayNativeComponent.ts +22 -0
  42. package/src/GlanceMixAndMatchWidgetNativeComponent.ts +21 -0
  43. package/src/GlancePdpSuggestionsNativeComponent.ts +9 -0
  44. package/src/GlanceProductTryOnWidgetNativeComponent.ts +18 -0
  45. package/src/NativeGlanceChat.ts +96 -0
  46. package/src/index.tsx +78 -0
@@ -0,0 +1,40 @@
1
+ package com.glancechat
2
+
3
+ import androidx.compose.ui.platform.ComposeView
4
+ import androidx.compose.ui.platform.ViewCompositionStrategy
5
+ import com.facebook.react.module.annotations.ReactModule
6
+ import com.facebook.react.uimanager.SimpleViewManager
7
+ import com.facebook.react.uimanager.ThemedReactContext
8
+ import com.facebook.react.uimanager.ViewManagerDelegate
9
+ import com.facebook.react.viewmanagers.GlancePdpSuggestionsViewManagerDelegate
10
+ import com.facebook.react.viewmanagers.GlancePdpSuggestionsViewManagerInterface
11
+ import com.glance.chat.ui.components.PdpSuggestionsWidget
12
+
13
+ /**
14
+ * Fabric/legacy view manager hosting the SDK's [PdpSuggestionsWidget] Composable. No configurable
15
+ * props — the widget is driven by the SDK's page context — but it still implements the
16
+ * codegen-generated interface/delegate so it registers cleanly under Fabric.
17
+ * See docs/REACT_NATIVE_INTEGRATION.md §5.
18
+ */
19
+ @ReactModule(name = GlancePdpSuggestionsViewManager.NAME)
20
+ class GlancePdpSuggestionsViewManager :
21
+ SimpleViewManager<ComposeView>(),
22
+ GlancePdpSuggestionsViewManagerInterface<ComposeView> {
23
+
24
+ private val delegate = GlancePdpSuggestionsViewManagerDelegate(this)
25
+
26
+ override fun getName() = NAME
27
+
28
+ override fun getDelegate(): ViewManagerDelegate<ComposeView> = delegate
29
+
30
+ override fun createViewInstance(context: ThemedReactContext): ComposeView {
31
+ return ComposeView(context).apply {
32
+ setViewCompositionStrategy(ViewCompositionStrategy.DisposeOnViewTreeLifecycleDestroyed)
33
+ setContent { PdpSuggestionsWidget() }
34
+ }
35
+ }
36
+
37
+ companion object {
38
+ const val NAME = "GlancePdpSuggestionsView"
39
+ }
40
+ }
@@ -0,0 +1,145 @@
1
+ package com.glancechat
2
+
3
+ import android.widget.FrameLayout
4
+ import androidx.compose.ui.platform.ComposeView
5
+ import androidx.compose.ui.platform.ViewCompositionStrategy
6
+ import com.facebook.react.bridge.Arguments
7
+ import com.facebook.react.module.annotations.ReactModule
8
+ import com.facebook.react.uimanager.SimpleViewManager
9
+ import com.facebook.react.uimanager.ThemedReactContext
10
+ import com.facebook.react.uimanager.UIManagerHelper
11
+ import com.facebook.react.uimanager.ViewManagerDelegate
12
+ import com.facebook.react.uimanager.events.Event
13
+ import com.facebook.react.viewmanagers.GlanceProductTryOnWidgetViewManagerDelegate
14
+ import com.facebook.react.viewmanagers.GlanceProductTryOnWidgetViewManagerInterface
15
+ import com.glance.chat.ui.components.ProductTryOnWidget
16
+
17
+ /**
18
+ * Fabric/legacy view manager hosting the SDK's [ProductTryOnWidget] Composable. Implements the
19
+ * codegen-generated interface so `variantId` / `enabled` props route through the delegate under
20
+ * Fabric, and forwards the Compose `onClick` lambda to the JS `onPress` bubbling event.
21
+ * See docs/REACT_NATIVE_INTEGRATION.md §5.
22
+ *
23
+ * The Composable is hosted inside a [WidgetHostLayout] (a FrameLayout) rather than a bare
24
+ * ComposeView so composition can be deferred until the view is attached to a window. Under
25
+ * Fabric, React Native measures views before attach (and measures recycled FlatList cells while
26
+ * detached); a ComposeView that composes during that measure throws "Cannot locate
27
+ * windowRecomposer". The host adds the ComposeView child only on attach.
28
+ */
29
+ @ReactModule(name = GlanceProductTryOnWidgetViewManager.NAME)
30
+ class GlanceProductTryOnWidgetViewManager :
31
+ SimpleViewManager<FrameLayout>(),
32
+ GlanceProductTryOnWidgetViewManagerInterface<FrameLayout> {
33
+
34
+ private val delegate = GlanceProductTryOnWidgetViewManagerDelegate(this)
35
+
36
+ override fun getName() = NAME
37
+
38
+ override fun getDelegate(): ViewManagerDelegate<FrameLayout> = delegate
39
+
40
+ override fun createViewInstance(context: ThemedReactContext): FrameLayout =
41
+ WidgetHostLayout(context)
42
+
43
+ override fun setVariantId(view: FrameLayout, value: String?) {
44
+ (view as WidgetHostLayout).variantId = value ?: ""
45
+ }
46
+
47
+ override fun setEnabled(view: FrameLayout, value: Boolean) {
48
+ (view as WidgetHostLayout).widgetEnabled = value
49
+ }
50
+
51
+ override fun getExportedCustomBubblingEventTypeConstants(): Map<String, Any> {
52
+ return mapOf(
53
+ "onPress" to mapOf(
54
+ "phasedRegistrationNames" to mapOf(
55
+ "bubbled" to "onPress",
56
+ "captured" to "onPressCapture"
57
+ )
58
+ )
59
+ )
60
+ }
61
+
62
+ private class PressEvent(surfaceId: Int, viewId: Int) : Event<PressEvent>(surfaceId, viewId) {
63
+ override fun getEventName() = "onPress"
64
+ override fun getEventData() = Arguments.createMap()
65
+ }
66
+
67
+ /**
68
+ * FrameLayout that lazily hosts a [ComposeView]. Composition is created only while the host is
69
+ * attached to a window, so the widget is safe inside virtualized list cells and view pooling.
70
+ */
71
+ private class WidgetHostLayout(context: ThemedReactContext) : FrameLayout(context) {
72
+ private var composeView: ComposeView? = null
73
+
74
+ var variantId: String = ""
75
+ set(value) {
76
+ field = value
77
+ if (isAttachedToWindow) renderContent()
78
+ }
79
+
80
+ var widgetEnabled: Boolean = true
81
+ set(value) {
82
+ field = value
83
+ if (isAttachedToWindow) renderContent()
84
+ }
85
+
86
+ override fun onAttachedToWindow() {
87
+ super.onAttachedToWindow()
88
+ renderContent()
89
+ }
90
+
91
+ // React Native (Fabric) lays out this host but not children we add natively,
92
+ // so the ComposeView would stay 0x0. Measure and lay out the child to fill
93
+ // the host on every layout pass.
94
+ override fun onLayout(changed: Boolean, l: Int, t: Int, r: Int, b: Int) {
95
+ super.onLayout(changed, l, t, r, b)
96
+ layoutChild()
97
+ }
98
+
99
+ private fun renderContent() {
100
+ val view = composeView ?: ComposeView(context).also {
101
+ it.setViewCompositionStrategy(
102
+ ViewCompositionStrategy.DisposeOnDetachedFromWindowOrReleasedFromPool
103
+ )
104
+ addView(
105
+ it,
106
+ LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT)
107
+ )
108
+ composeView = it
109
+ }
110
+ val currentVariantId = variantId
111
+ val currentEnabled = widgetEnabled
112
+ view.setContent {
113
+ ProductTryOnWidget(
114
+ onClick = { emitPress() },
115
+ variantId = currentVariantId,
116
+ enabled = currentEnabled
117
+ )
118
+ }
119
+ // RN (Fabric) won't re-run layout for natively-added children, so measure
120
+ // and lay out the ComposeView to fill the host now.
121
+ layoutChild()
122
+ }
123
+
124
+ private fun layoutChild() {
125
+ val child = composeView ?: return
126
+ if (width == 0 || height == 0) return
127
+ child.measure(
128
+ MeasureSpec.makeMeasureSpec(width, MeasureSpec.EXACTLY),
129
+ MeasureSpec.makeMeasureSpec(height, MeasureSpec.EXACTLY)
130
+ )
131
+ child.layout(0, 0, width, height)
132
+ }
133
+
134
+ private fun emitPress() {
135
+ val reactContext = context as? ThemedReactContext ?: return
136
+ val surfaceId = UIManagerHelper.getSurfaceId(reactContext)
137
+ val dispatcher = UIManagerHelper.getEventDispatcherForReactTag(reactContext, id)
138
+ dispatcher?.dispatchEvent(PressEvent(surfaceId, id))
139
+ }
140
+ }
141
+
142
+ companion object {
143
+ const val NAME = "GlanceProductTryOnWidgetView"
144
+ }
145
+ }
@@ -0,0 +1,24 @@
1
+ package com.glancechat
2
+
3
+ import androidx.compose.foundation.layout.fillMaxSize
4
+ import androidx.compose.runtime.Composable
5
+ import androidx.compose.ui.Modifier
6
+ import androidx.compose.ui.layout.ContentScale
7
+ import coil.compose.AsyncImage
8
+ import com.glance.chat.ui.components.BrandLogoProvider
9
+
10
+ /**
11
+ * [BrandLogoProvider] backed by a URL. Used to bridge the RN `brandLogoUrl` string prop
12
+ * to the SDK's provider interface (which cannot cross the RN bridge directly).
13
+ */
14
+ class UrlBrandLogoProvider(private val logoUrl: String) : BrandLogoProvider {
15
+ @Composable
16
+ override fun BrandLogo(modifier: Modifier) {
17
+ AsyncImage(
18
+ model = logoUrl,
19
+ contentDescription = "Brand logo",
20
+ modifier = modifier.fillMaxSize(),
21
+ contentScale = ContentScale.Fit
22
+ )
23
+ }
24
+ }
@@ -0,0 +1,44 @@
1
+ package com.glancechat
2
+
3
+ import com.facebook.react.bridge.ReactApplicationContext
4
+ import com.facebook.react.bridge.ReadableMap
5
+
6
+ /**
7
+ * New Architecture (TurboModule) wrapper. Extends the codegen-generated
8
+ * [NativeGlanceChatSpec] and forwards every call to the shared
9
+ * [GlanceChatModuleImpl]. See docs/REACT_NATIVE_INTEGRATION.md §10.
10
+ */
11
+ class GlanceChatModule(reactContext: ReactApplicationContext) :
12
+ NativeGlanceChatSpec(reactContext) {
13
+
14
+ private val impl = GlanceChatModuleImpl(reactContext)
15
+
16
+ override fun getName() = GlanceChatModuleImpl.NAME
17
+
18
+ override fun initialize(partnerId: String, config: ReadableMap, userId: String?) =
19
+ impl.initialize(partnerId, config, userId)
20
+
21
+ override fun destroy() = impl.destroy()
22
+
23
+ override fun isInitialized() = impl.isInitialized()
24
+
25
+ override fun isLoggedIn() = impl.isLoggedIn()
26
+
27
+ override fun setPageContext(context: String, metadata: ReadableMap) =
28
+ impl.setPageContext(context, metadata)
29
+
30
+ override fun clearPageContext() = impl.clearPageContext()
31
+
32
+ override fun closeChat() = impl.closeChat()
33
+
34
+ override fun openChatWithSuggestion(suggestion: String) =
35
+ impl.openChatWithSuggestion(suggestion)
36
+
37
+ override fun handleDeepLink(uri: String) = impl.handleDeepLink(uri)
38
+
39
+ override fun startOnboarding(variantId: String?) = impl.startOnboarding(variantId)
40
+
41
+ companion object {
42
+ const val NAME = GlanceChatModuleImpl.NAME
43
+ }
44
+ }
@@ -0,0 +1,59 @@
1
+ package com.glancechat
2
+
3
+ import com.facebook.react.bridge.ReactApplicationContext
4
+ import com.facebook.react.bridge.ReactContextBaseJavaModule
5
+ import com.facebook.react.bridge.ReactMethod
6
+ import com.facebook.react.bridge.ReadableMap
7
+
8
+ /**
9
+ * Legacy bridge wrapper. Extends [ReactContextBaseJavaModule] and forwards every
10
+ * `@ReactMethod` to the shared [GlanceChatModuleImpl]. Compiled only when the
11
+ * consumer app has the New Architecture disabled. See docs/REACT_NATIVE_INTEGRATION.md §10.
12
+ */
13
+ class GlanceChatModule(reactContext: ReactApplicationContext) :
14
+ ReactContextBaseJavaModule(reactContext) {
15
+
16
+ private val impl = GlanceChatModuleImpl(reactContext)
17
+
18
+ override fun getName() = GlanceChatModuleImpl.NAME
19
+
20
+ @ReactMethod
21
+ fun initialize(partnerId: String, config: ReadableMap, userId: String?) =
22
+ impl.initialize(partnerId, config, userId)
23
+
24
+ @ReactMethod
25
+ fun destroy() = impl.destroy()
26
+
27
+ @ReactMethod(isBlockingSynchronousMethod = true)
28
+ fun isInitialized() = impl.isInitialized()
29
+
30
+ @ReactMethod(isBlockingSynchronousMethod = true)
31
+ fun isLoggedIn() = impl.isLoggedIn()
32
+
33
+ @ReactMethod
34
+ fun setPageContext(context: String, metadata: ReadableMap) =
35
+ impl.setPageContext(context, metadata)
36
+
37
+ @ReactMethod
38
+ fun clearPageContext() = impl.clearPageContext()
39
+
40
+ @ReactMethod
41
+ fun closeChat() = impl.closeChat()
42
+
43
+ @ReactMethod
44
+ fun openChatWithSuggestion(suggestion: String) =
45
+ impl.openChatWithSuggestion(suggestion)
46
+
47
+ @ReactMethod(isBlockingSynchronousMethod = true)
48
+ fun handleDeepLink(uri: String) = impl.handleDeepLink(uri)
49
+
50
+ @ReactMethod
51
+ fun startOnboarding(variantId: String?) = impl.startOnboarding(variantId)
52
+
53
+ // Required so JS addListener/removeListeners calls don't warn on the legacy bridge.
54
+ @ReactMethod
55
+ fun addListener(eventName: String) = Unit
56
+
57
+ @ReactMethod
58
+ fun removeListeners(count: Double) = Unit
59
+ }
@@ -0,0 +1,5 @@
1
+ #import <GlanceChatSpec/GlanceChatSpec.h>
2
+
3
+ @interface GlanceChat : NSObject <NativeGlanceChatSpec>
4
+
5
+ @end
@@ -0,0 +1,21 @@
1
+ #import "GlanceChat.h"
2
+
3
+ @implementation GlanceChat
4
+ - (NSNumber *)multiply:(double)a b:(double)b {
5
+ NSNumber *result = @(a * b);
6
+
7
+ return result;
8
+ }
9
+
10
+ - (std::shared_ptr<facebook::react::TurboModule>)getTurboModule:
11
+ (const facebook::react::ObjCTurboModule::InitParams &)params
12
+ {
13
+ return std::make_shared<facebook::react::NativeGlanceChatSpecJSI>(params);
14
+ }
15
+
16
+ + (NSString *)moduleName
17
+ {
18
+ return @"GlanceChat";
19
+ }
20
+
21
+ @end
@@ -0,0 +1,22 @@
1
+ import type { ViewProps, HostComponent } from 'react-native';
2
+ import { codegenNativeComponent } from 'react-native';
3
+
4
+ export interface NativeProps extends ViewProps {
5
+ /**
6
+ * Optional brand logo URL rendered in the chat header. Replaces the native
7
+ * `BrandLogoProvider` interface (which cannot cross the bridge) with a
8
+ * serializable prop; the native side builds a provider that loads the URL.
9
+ */
10
+ brandLogoUrl?: string;
11
+
12
+ /**
13
+ * When false, hides the chat FAB/dialog, AI Store, and All Looks UI entirely —
14
+ * only onboarding and the try-on result screen remain. Defaults to true (chat
15
+ * enabled) so existing consumers are unaffected.
16
+ */
17
+ chatEnabled?: boolean;
18
+ }
19
+
20
+ export default codegenNativeComponent<NativeProps>(
21
+ 'GlanceChatOverlayView'
22
+ ) as HostComponent<NativeProps>;
@@ -0,0 +1,21 @@
1
+ import type { ViewProps, HostComponent } from 'react-native';
2
+ import type { BubblingEventHandler } from 'react-native/Libraries/Types/CodegenTypesNamespace';
3
+ import { codegenNativeComponent } from 'react-native';
4
+
5
+ export type AddToCartEvent = Readonly<{
6
+ productId: string;
7
+ size: string;
8
+ }>;
9
+
10
+ export interface NativeProps extends ViewProps {
11
+ /** Merchant variant id of the anchor product the tray recommends for. */
12
+ variantId: string;
13
+ /** Whether the widget is interactive. Defaults to true on the native side. */
14
+ enabled?: boolean;
15
+ /** Fired when a size is confirmed in the add-to-cart sheet. */
16
+ onAddToCartClick?: BubblingEventHandler<AddToCartEvent> | null;
17
+ }
18
+
19
+ export default codegenNativeComponent<NativeProps>(
20
+ 'GlanceMixAndMatchWidgetView'
21
+ ) as HostComponent<NativeProps>;
@@ -0,0 +1,9 @@
1
+ import type { ViewProps, HostComponent } from 'react-native';
2
+ import { codegenNativeComponent } from 'react-native';
3
+
4
+ // PDP suggestions widget takes no configurable props (pure UI driven by page context).
5
+ export interface NativeProps extends ViewProps {}
6
+
7
+ export default codegenNativeComponent<NativeProps>(
8
+ 'GlancePdpSuggestionsView'
9
+ ) as HostComponent<NativeProps>;
@@ -0,0 +1,18 @@
1
+ import type { ViewProps, HostComponent } from 'react-native';
2
+ import type { BubblingEventHandler } from 'react-native/Libraries/Types/CodegenTypesNamespace';
3
+ import { codegenNativeComponent } from 'react-native';
4
+
5
+ type PressEvent = Readonly<{}>;
6
+
7
+ export interface NativeProps extends ViewProps {
8
+ /** Merchant variant id the widget kicks off a try-on / feed fetch for. */
9
+ variantId: string;
10
+ /** Whether the widget is interactive. Defaults to true on the native side. */
11
+ enabled?: boolean;
12
+ /** Fired when the widget is tapped (maps to the native onClick lambda). */
13
+ onPress?: BubblingEventHandler<PressEvent> | null;
14
+ }
15
+
16
+ export default codegenNativeComponent<NativeProps>(
17
+ 'GlanceProductTryOnWidgetView'
18
+ ) as HostComponent<NativeProps>;
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+
3
+ import { TurboModuleRegistry } from 'react-native';
4
+
5
+ /**
6
+ * Configuration passed to {@link Spec.initialize}. Mirrors the native
7
+ * `GlanceChatConfig.Builder` — only the client-facing fields. The SDK derives
8
+ * Firebase credentials, endpoints, and auth URLs internally per environment.
9
+ */
10
+
11
+ /** Payload for the {@link Spec.onProductClick} event. */
12
+
13
+ /**
14
+ * Payload for {@link Spec.onTryOnStatesChanged}: a map of variantId -> status
15
+ * string (e.g. 'IDLE' | 'GENERATING' | 'READY' | 'FAILED'). Codegen does not
16
+ * support Map, so it is serialized as a plain object.
17
+ */
18
+
19
+ export default TurboModuleRegistry.getEnforcing('GlanceChat');
20
+ //# sourceMappingURL=NativeGlanceChat.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["TurboModuleRegistry","getEnforcing"],"sourceRoot":"../../src","sources":["NativeGlanceChat.ts"],"mappings":";;AAEA,SAASA,mBAAmB,QAAQ,cAAc;;AAElD;AACA;AACA;AACA;AACA;;AASA;;AAMA;AACA;AACA;AACA;AACA;;AAoEA,eAAeA,mBAAmB,CAACC,YAAY,CAAO,YAAY,CAAC","ignoreList":[]}
@@ -0,0 +1,65 @@
1
+ "use strict";
2
+
3
+ import GlanceChat from "./NativeGlanceChat.js";
4
+ // Native UI components (Fabric). Each hosts the corresponding SDK Composable.
5
+ export { default as GlanceChatOverlay } from './GlanceChatOverlayNativeComponent';
6
+ export { default as GlanceProductTryOnWidget } from './GlanceProductTryOnWidgetNativeComponent';
7
+ export { default as GlanceMixAndMatchWidget } from './GlanceMixAndMatchWidgetNativeComponent';
8
+ export { default as GlancePdpSuggestions } from './GlancePdpSuggestionsNativeComponent';
9
+
10
+ /** Environments the SDK supports. */
11
+ export const GlanceEnvironment = {
12
+ DEVELOPMENT: 'DEVELOPMENT',
13
+ UAT: 'UAT',
14
+ PRODUCTION: 'PRODUCTION'
15
+ };
16
+ /**
17
+ * Imperative API for the Glance Chat SDK. Thin wrapper over the native
18
+ * TurboModule; see `docs/REACT_NATIVE_INTEGRATION.md` in the Helios-Android repo.
19
+ */
20
+ export const Glance = {
21
+ initialize(partnerId, config, userId) {
22
+ GlanceChat.initialize(partnerId, config, userId ?? null);
23
+ },
24
+ destroy() {
25
+ GlanceChat.destroy();
26
+ },
27
+ isInitialized() {
28
+ return GlanceChat.isInitialized();
29
+ },
30
+ isLoggedIn() {
31
+ return GlanceChat.isLoggedIn();
32
+ },
33
+ setPageContext(context, metadata = {}) {
34
+ GlanceChat.setPageContext(context, metadata);
35
+ },
36
+ clearPageContext() {
37
+ GlanceChat.clearPageContext();
38
+ },
39
+ closeChat() {
40
+ GlanceChat.closeChat();
41
+ },
42
+ openChatWithSuggestion(suggestion) {
43
+ GlanceChat.openChatWithSuggestion(suggestion);
44
+ },
45
+ handleDeepLink(uri) {
46
+ return GlanceChat.handleDeepLink(uri);
47
+ },
48
+ startOnboarding(variantId) {
49
+ GlanceChat.startOnboarding(variantId);
50
+ },
51
+ // --- Event subscriptions -------------------------------------------------
52
+ onProductClick(listener) {
53
+ return GlanceChat.onProductClick(listener);
54
+ },
55
+ onDeeplinkClick(listener) {
56
+ return GlanceChat.onDeeplinkClick(listener);
57
+ },
58
+ onTryOnStatesChanged(listener) {
59
+ return GlanceChat.onTryOnStatesChanged(listener);
60
+ },
61
+ onSessionExpired(listener) {
62
+ return GlanceChat.onSessionExpired(listener);
63
+ }
64
+ };
65
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["GlanceChat","default","GlanceChatOverlay","GlanceProductTryOnWidget","GlanceMixAndMatchWidget","GlancePdpSuggestions","GlanceEnvironment","DEVELOPMENT","UAT","PRODUCTION","Glance","initialize","partnerId","config","userId","destroy","isInitialized","isLoggedIn","setPageContext","context","metadata","clearPageContext","closeChat","openChatWithSuggestion","suggestion","handleDeepLink","uri","startOnboarding","variantId","onProductClick","listener","onDeeplinkClick","onTryOnStatesChanged","onSessionExpired"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":";;AAAA,OAAOA,UAAU,MAAM,uBAAoB;AAS3C;AACA,SAASC,OAAO,IAAIC,iBAAiB,QAAQ,oCAAoC;AACjF,SAASD,OAAO,IAAIE,wBAAwB,QAAQ,2CAA2C;AAC/F,SAASF,OAAO,IAAIG,uBAAuB,QAAQ,0CAA0C;AAC7F,SAASH,OAAO,IAAII,oBAAoB,QAAQ,uCAAuC;;AAEvF;AACA,OAAO,MAAMC,iBAAiB,GAAG;EAC/BC,WAAW,EAAE,aAAa;EAC1BC,GAAG,EAAE,KAAK;EACVC,UAAU,EAAE;AACd,CAAU;AAIV;AACA;AACA;AACA;AACA,OAAO,MAAMC,MAAM,GAAG;EACpBC,UAAUA,CACRC,SAAiB,EACjBC,MAAwB,EACxBC,MAAsB,EAChB;IACNd,UAAU,CAACW,UAAU,CAACC,SAAS,EAAEC,MAAM,EAAEC,MAAM,IAAI,IAAI,CAAC;EAC1D,CAAC;EACDC,OAAOA,CAAA,EAAS;IACdf,UAAU,CAACe,OAAO,CAAC,CAAC;EACtB,CAAC;EACDC,aAAaA,CAAA,EAAY;IACvB,OAAOhB,UAAU,CAACgB,aAAa,CAAC,CAAC;EACnC,CAAC;EACDC,UAAUA,CAAA,EAAY;IACpB,OAAOjB,UAAU,CAACiB,UAAU,CAAC,CAAC;EAChC,CAAC;EACDC,cAAcA,CAACC,OAAe,EAAEC,QAAgC,GAAG,CAAC,CAAC,EAAQ;IAC3EpB,UAAU,CAACkB,cAAc,CAACC,OAAO,EAAEC,QAAQ,CAAC;EAC9C,CAAC;EACDC,gBAAgBA,CAAA,EAAS;IACvBrB,UAAU,CAACqB,gBAAgB,CAAC,CAAC;EAC/B,CAAC;EACDC,SAASA,CAAA,EAAS;IAChBtB,UAAU,CAACsB,SAAS,CAAC,CAAC;EACxB,CAAC;EACDC,sBAAsBA,CAACC,UAAkB,EAAQ;IAC/CxB,UAAU,CAACuB,sBAAsB,CAACC,UAAU,CAAC;EAC/C,CAAC;EACDC,cAAcA,CAACC,GAAW,EAAW;IACnC,OAAO1B,UAAU,CAACyB,cAAc,CAACC,GAAG,CAAC;EACvC,CAAC;EACDC,eAAeA,CAACC,SAAkB,EAAQ;IACxC5B,UAAU,CAAC2B,eAAe,CAACC,SAAS,CAAC;EACvC,CAAC;EAED;EACAC,cAAcA,CAACC,QAA4C,EAAE;IAC3D,OAAO9B,UAAU,CAAC6B,cAAc,CAACC,QAAQ,CAAC;EAC5C,CAAC;EACDC,eAAeA,CAACD,QAA+B,EAAE;IAC/C,OAAO9B,UAAU,CAAC+B,eAAe,CAACD,QAAQ,CAAC;EAC7C,CAAC;EACDE,oBAAoBA,CAACF,QAA2C,EAAE;IAChE,OAAO9B,UAAU,CAACgC,oBAAoB,CAACF,QAAQ,CAAC;EAClD,CAAC;EACDG,gBAAgBA,CAACH,QAAoB,EAAE;IACrC,OAAO9B,UAAU,CAACiC,gBAAgB,CAACH,QAAQ,CAAC;EAC9C;AACF,CAAC","ignoreList":[]}
@@ -0,0 +1 @@
1
+ {"type":"module"}
@@ -0,0 +1 @@
1
+ {"type":"module"}
@@ -0,0 +1,18 @@
1
+ import type { ViewProps, HostComponent } from 'react-native';
2
+ export interface NativeProps extends ViewProps {
3
+ /**
4
+ * Optional brand logo URL rendered in the chat header. Replaces the native
5
+ * `BrandLogoProvider` interface (which cannot cross the bridge) with a
6
+ * serializable prop; the native side builds a provider that loads the URL.
7
+ */
8
+ brandLogoUrl?: string;
9
+ /**
10
+ * When false, hides the chat FAB/dialog, AI Store, and All Looks UI entirely —
11
+ * only onboarding and the try-on result screen remain. Defaults to true (chat
12
+ * enabled) so existing consumers are unaffected.
13
+ */
14
+ chatEnabled?: boolean;
15
+ }
16
+ declare const _default: HostComponent<NativeProps>;
17
+ export default _default;
18
+ //# sourceMappingURL=GlanceChatOverlayNativeComponent.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GlanceChatOverlayNativeComponent.d.ts","sourceRoot":"","sources":["../../../src/GlanceChatOverlayNativeComponent.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAG7D,MAAM,WAAW,WAAY,SAAQ,SAAS;IAC5C;;;;OAIG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IAEtB;;;;OAIG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB;wBAII,aAAa,CAAC,WAAW,CAAC;AAF/B,wBAEgC"}
@@ -0,0 +1,17 @@
1
+ import type { ViewProps, HostComponent } from 'react-native';
2
+ import type { BubblingEventHandler } from 'react-native/Libraries/Types/CodegenTypesNamespace';
3
+ export type AddToCartEvent = Readonly<{
4
+ productId: string;
5
+ size: string;
6
+ }>;
7
+ export interface NativeProps extends ViewProps {
8
+ /** Merchant variant id of the anchor product the tray recommends for. */
9
+ variantId: string;
10
+ /** Whether the widget is interactive. Defaults to true on the native side. */
11
+ enabled?: boolean;
12
+ /** Fired when a size is confirmed in the add-to-cart sheet. */
13
+ onAddToCartClick?: BubblingEventHandler<AddToCartEvent> | null;
14
+ }
15
+ declare const _default: HostComponent<NativeProps>;
16
+ export default _default;
17
+ //# sourceMappingURL=GlanceMixAndMatchWidgetNativeComponent.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GlanceMixAndMatchWidgetNativeComponent.d.ts","sourceRoot":"","sources":["../../../src/GlanceMixAndMatchWidgetNativeComponent.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAC7D,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,oDAAoD,CAAC;AAG/F,MAAM,MAAM,cAAc,GAAG,QAAQ,CAAC;IACpC,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,MAAM,CAAC;CACd,CAAC,CAAC;AAEH,MAAM,WAAW,WAAY,SAAQ,SAAS;IAC5C,yEAAyE;IACzE,SAAS,EAAE,MAAM,CAAC;IAClB,8EAA8E;IAC9E,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,+DAA+D;IAC/D,gBAAgB,CAAC,EAAE,oBAAoB,CAAC,cAAc,CAAC,GAAG,IAAI,CAAC;CAChE;wBAII,aAAa,CAAC,WAAW,CAAC;AAF/B,wBAEgC"}
@@ -0,0 +1,6 @@
1
+ import type { ViewProps, HostComponent } from 'react-native';
2
+ export interface NativeProps extends ViewProps {
3
+ }
4
+ declare const _default: HostComponent<NativeProps>;
5
+ export default _default;
6
+ //# sourceMappingURL=GlancePdpSuggestionsNativeComponent.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GlancePdpSuggestionsNativeComponent.d.ts","sourceRoot":"","sources":["../../../src/GlancePdpSuggestionsNativeComponent.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAI7D,MAAM,WAAW,WAAY,SAAQ,SAAS;CAAG;wBAI5C,aAAa,CAAC,WAAW,CAAC;AAF/B,wBAEgC"}
@@ -0,0 +1,14 @@
1
+ import type { ViewProps, HostComponent } from 'react-native';
2
+ import type { BubblingEventHandler } from 'react-native/Libraries/Types/CodegenTypesNamespace';
3
+ type PressEvent = Readonly<{}>;
4
+ export interface NativeProps extends ViewProps {
5
+ /** Merchant variant id the widget kicks off a try-on / feed fetch for. */
6
+ variantId: string;
7
+ /** Whether the widget is interactive. Defaults to true on the native side. */
8
+ enabled?: boolean;
9
+ /** Fired when the widget is tapped (maps to the native onClick lambda). */
10
+ onPress?: BubblingEventHandler<PressEvent> | null;
11
+ }
12
+ declare const _default: HostComponent<NativeProps>;
13
+ export default _default;
14
+ //# sourceMappingURL=GlanceProductTryOnWidgetNativeComponent.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GlanceProductTryOnWidgetNativeComponent.d.ts","sourceRoot":"","sources":["../../../src/GlanceProductTryOnWidgetNativeComponent.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAC7D,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,oDAAoD,CAAC;AAG/F,KAAK,UAAU,GAAG,QAAQ,CAAC,EAAE,CAAC,CAAC;AAE/B,MAAM,WAAW,WAAY,SAAQ,SAAS;IAC5C,0EAA0E;IAC1E,SAAS,EAAE,MAAM,CAAC;IAClB,8EAA8E;IAC9E,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,2EAA2E;IAC3E,OAAO,CAAC,EAAE,oBAAoB,CAAC,UAAU,CAAC,GAAG,IAAI,CAAC;CACnD;wBAII,aAAa,CAAC,WAAW,CAAC;AAF/B,wBAEgC"}