@amityco/ulta-ui-kit 1.0.0-beta.1 → 1.0.0-beta.11

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@amityco/ulta-ui-kit",
3
- "version": "1.0.0-beta.1",
3
+ "version": "1.0.0-beta.11",
4
4
  "engines": {
5
5
  "node": ">=18"
6
6
  },
package/readme.md CHANGED
@@ -32,14 +32,16 @@ export default function App() {
32
32
  const apiRegion = "<your API region here>";
33
33
 
34
34
  return (
35
- <div className="App">
36
- <AmityUiKitProvider
37
- apiKey={apiKey}
38
- userId={userId}
39
- apiRegion={apiRegion}
40
- >
41
- <AmityUiKitSocial />
42
- </AmityUiKitProvider>
35
+ <div style={{ width: '100dvw', height: '100dvh' }}>
36
+ <AmityUiKitProvider
37
+ key={userId}
38
+ apiKey={apiKey}
39
+ userId={userId}
40
+ apiRegion={apiRegion}
41
+
42
+ >
43
+ <AmityUiKitSocial />
44
+ </AmityUiKitProvider>
43
45
  </div>
44
46
  );
45
47
  }
@@ -49,7 +51,7 @@ export default function App() {
49
51
 
50
52
  In React, the component’s state dictates the behavior and rendering of the component. When the state changes, React automatically triggers a re-render of the component, updating the DOM where necessary. In your application, the userId is stored in the component’s state using the useState hook. This state determines the URL of the iframe where the Amity UIKit is loaded. When the userId state changes, React recognizes this change and re-renders the component, including the iframe, with the updated URL.
51
53
 
52
- When an anonymous user exceeds three clicks, the UIKit will emit a ‘anonymousNeedsLogin’ postMessage event. Below is a code example demonstrating how to receive this postMessage event from the UIKit Iframe:
54
+ When an anonymous user click on any buttons to interact within community, the UIKit will emit a ‘anonymousNeedsLogin’ postMessage event. Below is a code example demonstrating how to receive this postMessage event from the UIKit Iframe:
53
55
 
54
56
  ```sh
55
57
  import React, { useState, useEffect } from 'react';
@@ -65,6 +67,21 @@ export default function App() {
65
67
  // Prompt user to log in
66
68
  // Logic to display login dialog should be implemented here
67
69
  }
70
+
71
+ if (event.data ==== 'uikitRendered') {
72
+ // Logic to handle after uikit has been rendered
73
+ }
74
+
75
+ if (event.data ==== 'explorePageLoaded') {
76
+ // Logic to handle after Explore page has been loaded
77
+ }
78
+
79
+
80
+ if (event.data ==== 'parentNeedsScrollToTop') {
81
+ // `parentNeedsScrollToTop` will be posted from iFrame when the Nickname dialog is opened
82
+ window.scrollTo(0,0);
83
+ }
84
+
68
85
  };
69
86
 
70
87
  // Listen for messages from the iframe