@proveanything/smartlinks-auth-ui 0.3.1 → 0.3.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.
@@ -1,34 +1,24 @@
1
1
  import React from 'react';
2
2
  import type { SmartlinksFrameProps } from '../../types/iframeMessages';
3
3
  /**
4
- * SmartlinksFrame - Parent-side iframe wrapper for embedding SmartLinks microapps.
4
+ * SmartlinksFrame - React wrapper for embedding SmartLinks microapps.
5
5
  *
6
- * This component handles all bidirectional communication with the embedded iframe:
7
- * - API proxy requests (with optional caching)
8
- * - Authentication state synchronization (when inside AuthProvider)
9
- * - Deep linking / route changes
10
- * - Resize management
11
- * - File upload proxying
12
- *
13
- * Can be used with or without AuthProvider - authentication is optional.
6
+ * This component handles iframe creation and message passing for SmartLinks apps.
7
+ * It requires only collectionId and appId - the SDK handles URL discovery and API proxying.
14
8
  *
15
9
  * @example
16
10
  * ```tsx
17
- * // With authentication
18
- * <AuthProvider collectionId="my-collection">
19
- * <SmartlinksFrame
20
- * collectionId="my-collection"
21
- * appId="warranty-app"
22
- * appUrl="https://warranty.lovable.app"
23
- * collection={collectionData}
24
- * />
25
- * </AuthProvider>
11
+ * // Simple usage - SDK resolves app URL automatically
12
+ * <SmartlinksFrame
13
+ * collectionId="my-collection"
14
+ * appId="warranty-app"
15
+ * />
26
16
  *
27
- * // Without authentication (public/anonymous access)
17
+ * // With optional product context
28
18
  * <SmartlinksFrame
29
19
  * collectionId="my-collection"
30
- * appId="info-app"
31
- * appUrl="https://info-app.lovable.app"
20
+ * appId="warranty-app"
21
+ * productId="product-123"
32
22
  * />
33
23
  * ```
34
24
  */
@@ -1 +1 @@
1
- {"version":3,"file":"SmartlinksFrame.d.ts","sourceRoot":"","sources":["../../../src/components/SmartlinksFrame/SmartlinksFrame.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAsC,MAAM,OAAO,CAAC;AAI3D,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AAKvE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,eAAO,MAAM,eAAe,EAAE,KAAK,CAAC,EAAE,CAAC,oBAAoB,CAsJ1D,CAAC"}
1
+ {"version":3,"file":"SmartlinksFrame.d.ts","sourceRoot":"","sources":["../../../src/components/SmartlinksFrame/SmartlinksFrame.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA+D,MAAM,OAAO,CAAC;AAOpF,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AAGvE;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,eAAO,MAAM,eAAe,EAAE,KAAK,CAAC,EAAE,CAAC,oBAAoB,CAsL1D,CAAC"}
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Helper functions for SmartlinksFrame
3
+ * Separated to avoid circular dependencies
4
+ */
5
+ /**
6
+ * Compute admin status from collection/proof roles.
7
+ */
8
+ export declare function isAdminFromRoles(user: {
9
+ uid: string;
10
+ } | null | undefined, collection?: {
11
+ roles?: Record<string, string>;
12
+ }, proof?: {
13
+ roles?: Record<string, string>;
14
+ }): boolean;
15
+ /**
16
+ * Build iframe src URL with query parameters.
17
+ */
18
+ export declare function buildIframeSrc(baseUrl: string, params: Record<string, string | undefined>): string;
19
+ //# sourceMappingURL=helpers.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../../src/components/SmartlinksFrame/helpers.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;GAEG;AACH,wBAAgB,gBAAgB,CAC9B,IAAI,EAAE;IAAE,GAAG,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,GAAG,SAAS,EACxC,UAAU,CAAC,EAAE;IAAE,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CAAE,EAC/C,KAAK,CAAC,EAAE;IAAE,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CAAE,GACzC,OAAO,CAUT;AAED;;GAEG;AACH,wBAAgB,cAAc,CAC5B,OAAO,EAAE,MAAM,EACf,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,GACzC,MAAM,CAQR"}
@@ -1,7 +1,7 @@
1
1
  export { SmartlinksFrame } from './SmartlinksFrame';
2
+ export type { SmartlinksFrameProps, IframeResizeOptions, IframeResponderOptions, CachedData, CollectionApp, RouteChangeMessage, SmartlinksIframeMessage, } from '../../types/iframeMessages';
3
+ export { isAdminFromRoles, buildIframeSrc } from './helpers';
2
4
  export { useAdminDetection } from './useAdminDetection';
3
5
  export { useIframeResize } from './useIframeResize';
4
6
  export { useIframeMessages } from './useIframeMessages';
5
- export type { SmartlinksFrameProps } from '../../types/iframeMessages';
6
- export type { IframeResizeOptions } from './useIframeResize';
7
7
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/SmartlinksFrame/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,YAAY,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AACvE,YAAY,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/SmartlinksFrame/index.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAGpD,YAAY,EACV,oBAAoB,EACpB,mBAAmB,EACnB,sBAAsB,EACtB,UAAU,EACV,aAAa,EACb,kBAAkB,EAClB,uBAAuB,GACxB,M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BAAoB,GAC5B,IAAI,CAiaN"}
1
+ {"version":3,"file":"useIframeMessages.d.ts","sourceRoot":"","sources":["../../../src/components/SmartlinksFrame/useIframeMessages.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,KAAK,EAQV,UAAU,EACX,MAAM,4BAA4B,CAAC;AAepC,MAAM,WAAW,oBAAoB;IACnC,YAAY,EAAE,MAAM,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,UAAU,CAAC;IAEvB,KAAK,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,SAAS,CAAC,EAAE,OAAO,EAAE,SAAS,CAAC,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IACrI,MAAM,CAAC,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IAC7B,aAAa,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,KAAK,IAAI,CAAC;IACtE,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC;CAClC;AASD;;;;;;;;;;;;GAYG;AACH,wBAAgB,iBAAiB,CAC/B,SAAS,EAAE,KAAK,CAAC,SAAS,CAAC,iBAAiB,CAAC,EAC7C,OAAO,EAAE,oBAAoB,GAC5B,IAAI,CA8aN"}
package/dist/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  export { SmartlinksAuthUI } from './components/SmartlinksAuthUI';
2
2
  export { AccountManagement } from './components/AccountManagement';
3
- export { SmartlinksFrame, useAdminDetection, useIframeResize, useIframeMessages, } from './components/SmartlinksFrame';
4
- export type { SmartlinksFrameProps, IframeResizeOptions, } from './components/SmartlinksFrame';
3
+ export { SmartlinksFrame, isAdminFromRoles, buildIframeSrc, useAdminDetection, useIframeResize, useIframeMessages, } from './components/SmartlinksFrame';
4
+ export type { SmartlinksFrameProps, IframeResizeOptions, IframeResponderOptions, CachedData, CollectionApp, } from './components/SmartlinksFrame';
5
5
  export { AuthProvider, useAuth } from './context/AuthContext';
6
6
  export { ProtectedRoute } from './components/ProtectedRoute';
7
7
  export { tokenStorage } from './utils/tokenStorage';
@@ -10,7 +10,7 @@ export { getDefaultAuthKitId, setDefaultAuthKitId } from './utils/defaultAuthKit
10
10
  export { getFriendlyErrorMessage, isConflictError, isAuthError, isRateLimitError, isServerError, getErrorStatusCode, getErrorCode } from './utils/errorHandling';
11
11
  export { SchemaFieldRenderer, getEditableFields, getRegistrationFields, sortFieldsByPlacement } from './components/SchemaFieldRenderer';
12
12
  export type { SchemaField, ContactSchema, RegistrationFieldConfig } from './components/SchemaFieldRenderer';
13
- export type { RouteChangeMessage, SmartlinksIframeMessage, ProxyRequest, ProxyResponse, CachedData, } from './types/iframeMessages';
13
+ export type { RouteChangeMessage, SmartlinksIframeMessage, ProxyRequest, ProxyResponse, } from './types/iframeMessages';
14
14
  export type * from './types';
15
15
  export type { AuthLogger, SignupProminence, RedirectReason } from './types';
16
16
  export { SmartlinksAuthUI as FirebaseAuthUI } from './components/SmartlinksAuthUI';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAGjE,OAAO,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AAGnE,OAAO,EACL,eAAe,EACf,iBAAiB,EACjB,eAAe,EACf,iBAAiB,GAClB,MAAM,8BAA8B,CAAC;AACtC,YAAY,EACV,oBAAoB,EACpB,mBAAmB,GACpB,MAAM,8BAA8B,CAAC;AAGtC,OAAO,EAAE,YAAY,EA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