@amityco/ulta-ui-kit 1.0.0-alpha.26 → 1.0.0-alpha.28

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 (76) hide show
  1. package/dist/CircularStd-Black-EL754VZN.eot +0 -0
  2. package/dist/CircularStd-Black-M6FYDJME.woff2 +0 -0
  3. package/dist/CircularStd-Black-PNLLRW5C.woff +0 -0
  4. package/dist/CircularStd-Black-YMQQKCA3.ttf +0 -0
  5. package/dist/CircularStd-BlackItalic-BWOJUVN3.ttf +0 -0
  6. package/dist/CircularStd-BlackItalic-G62XUQUP.woff2 +0 -0
  7. package/dist/CircularStd-BlackItalic-MBNBDZUU.eot +0 -0
  8. package/dist/CircularStd-BlackItalic-NVQVXG5L.woff +0 -0
  9. package/dist/CircularStd-Bold-3YZD2D54.woff +0 -0
  10. package/dist/CircularStd-Bold-OBIX2X7G.woff2 +0 -0
  11. package/dist/CircularStd-Bold-QHAMEMSL.eot +0 -0
  12. package/dist/CircularStd-Bold-UGQNNLCJ.ttf +0 -0
  13. package/dist/CircularStd-BoldItalic-53VUNMNP.ttf +0 -0
  14. package/dist/CircularStd-BoldItalic-7MYBAB7V.woff2 +0 -0
  15. package/dist/CircularStd-BoldItalic-A6ZIS4PA.eot +0 -0
  16. package/dist/CircularStd-BoldItalic-S4EXYNAA.woff +0 -0
  17. package/dist/CircularStd-Book-JPHT3EYH.eot +0 -0
  18. package/dist/CircularStd-Book-QH24MWNT.woff2 +0 -0
  19. package/dist/CircularStd-Book-WO57ECZG.woff +0 -0
  20. package/dist/CircularStd-Book-X7C7G6T7.ttf +0 -0
  21. package/dist/CircularStd-BookItalic-FKVXO6VC.woff +0 -0
  22. package/dist/CircularStd-BookItalic-JMRK2M3F.ttf +0 -0
  23. package/dist/CircularStd-BookItalic-LYDC7HJ5.eot +0 -0
  24. package/dist/CircularStd-BookItalic-N7R5KSUJ.woff2 +0 -0
  25. package/dist/CircularStd-Medium-27RJ4G7E.woff +0 -0
  26. package/dist/CircularStd-Medium-CYDQT5MI.eot +0 -0
  27. package/dist/CircularStd-Medium-MVVUHW3Z.woff2 +0 -0
  28. package/dist/CircularStd-Medium-TPGRKUIA.ttf +0 -0
  29. package/dist/CircularStd-MediumItalic-6VIHMKHS.woff +0 -0
  30. package/dist/CircularStd-MediumItalic-MGFTUSP5.woff2 +0 -0
  31. package/dist/CircularStd-MediumItalic-PWSPA5NY.ttf +0 -0
  32. package/dist/CircularStd-MediumItalic-QZO45QYZ.eot +0 -0
  33. package/dist/esm/CircularStd-Black-EL754VZN.eot +0 -0
  34. package/dist/esm/CircularStd-Black-M6FYDJME.woff2 +0 -0
  35. package/dist/esm/CircularStd-Black-PNLLRW5C.woff +0 -0
  36. package/dist/esm/CircularStd-Black-YMQQKCA3.ttf +0 -0
  37. package/dist/esm/CircularStd-BlackItalic-BWOJUVN3.ttf +0 -0
  38. package/dist/esm/CircularStd-BlackItalic-G62XUQUP.woff2 +0 -0
  39. package/dist/esm/CircularStd-BlackItalic-MBNBDZUU.eot +0 -0
  40. package/dist/esm/CircularStd-BlackItalic-NVQVXG5L.woff +0 -0
  41. package/dist/esm/CircularStd-Bold-3YZD2D54.woff +0 -0
  42. package/dist/esm/CircularStd-Bold-OBIX2X7G.woff2 +0 -0
  43. package/dist/esm/CircularStd-Bold-QHAMEMSL.eot +0 -0
  44. package/dist/esm/CircularStd-Bold-UGQNNLCJ.ttf +0 -0
  45. package/dist/esm/CircularStd-BoldItalic-53VUNMNP.ttf +0 -0
  46. package/dist/esm/CircularStd-BoldItalic-7MYBAB7V.woff2 +0 -0
  47. package/dist/esm/CircularStd-BoldItalic-A6ZIS4PA.eot +0 -0
  48. package/dist/esm/CircularStd-BoldItalic-S4EXYNAA.woff +0 -0
  49. package/dist/esm/CircularStd-Book-JPHT3EYH.eot +0 -0
  50. package/dist/esm/CircularStd-Book-QH24MWNT.woff2 +0 -0
  51. package/dist/esm/CircularStd-Book-WO57ECZG.woff +0 -0
  52. package/dist/esm/CircularStd-Book-X7C7G6T7.ttf +0 -0
  53. package/dist/esm/CircularStd-BookItalic-FKVXO6VC.woff +0 -0
  54. package/dist/esm/CircularStd-BookItalic-JMRK2M3F.ttf +0 -0
  55. package/dist/esm/CircularStd-BookItalic-LYDC7HJ5.eot +0 -0
  56. package/dist/esm/CircularStd-BookItalic-N7R5KSUJ.woff2 +0 -0
  57. package/dist/esm/CircularStd-Medium-27RJ4G7E.woff +0 -0
  58. package/dist/esm/CircularStd-Medium-CYDQT5MI.eot +0 -0
  59. package/dist/esm/CircularStd-Medium-MVVUHW3Z.woff2 +0 -0
  60. package/dist/esm/CircularStd-Medium-TPGRKUIA.ttf +0 -0
  61. package/dist/esm/CircularStd-MediumItalic-6VIHMKHS.woff +0 -0
  62. package/dist/esm/CircularStd-MediumItalic-MGFTUSP5.woff2 +0 -0
  63. package/dist/esm/CircularStd-MediumItalic-PWSPA5NY.ttf +0 -0
  64. package/dist/esm/CircularStd-MediumItalic-QZO45QYZ.eot +0 -0
  65. package/dist/esm/index.css +1 -1
  66. package/dist/esm/index.js +1055 -897
  67. package/dist/index.css +1 -1
  68. package/dist/index.js +1119 -961
  69. package/dist/metafile-cjs.json +1 -1
  70. package/dist/metafile-esm.json +1 -1
  71. package/package.json +1 -1
  72. package/readme.md +84 -23
  73. package/dist/CommunityProfile-CQ6HQGPN.png +0 -0
  74. package/dist/MobileBanner-PN3GVEO7.png +0 -0
  75. package/dist/esm/CommunityProfile-CQ6HQGPN.png +0 -0
  76. package/dist/esm/MobileBanner-PN3GVEO7.png +0 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@amityco/ulta-ui-kit",
3
- "version": "1.0.0-alpha.26",
3
+ "version": "1.0.0-alpha.28",
4
4
  "engines": {
5
5
  "node": ">=18"
6
6
  },
package/readme.md CHANGED
@@ -2,12 +2,12 @@
2
2
 
3
3
  ## Getting started
4
4
 
5
- Our AmityUIKit include user interfaces to enable fast integration of Amity Social features into new or existing website.
5
+ The AmityUIKit provides a comprehensive user interface toolkit to quickly integrate Amity Social features into new or existing websites. This toolkit simplifies the incorporation of social interactions within your projects through an iframe-based integration.
6
6
 
7
7
  ### Prerequisites
8
+ Before you begin, ensure you have the following installed:
8
9
 
9
- • Node.js (>= 20.x)
10
-
10
+ • Node.js (>= 20.x)
11
11
  • React.js (>= 18.x)
12
12
 
13
13
  ### Installation
@@ -20,48 +20,109 @@ With yarn: `yarn add @amityco/ulta-ui-kit`
20
20
  ```sh
21
21
  import { AmityUiKitProvider, AmityUiKitSocial } from "@amityco/ulta-ui-kit";
22
22
 
23
- const userId = "<your USER ID here>";
24
- const apiKey = "<your API key here>";
25
-
26
23
  export default function App() {
27
-
28
- return (
29
- <div className="App">
30
- <AmityUiKitProvider
31
- key={userId}
32
- apiKey={apiKey}
33
- userId={userId}
34
- apiRegion={apiRegion}
35
- >
36
- <AmityUiKitSocial />
37
- </AmityUiKitProvider>
38
- </div>
24
+ // Retrieve userId from query parameters
25
+ const urlParams = new URLSearchParams(window.location.search);
26
+ const userId = urlParams.get("userId");
27
+ const apiKey = "<your API key here>";
28
+ const apiRegion = "<your API region here>";
29
+
30
+ return (
31
+ <div className="App">
32
+ <AmityUiKitProvider
33
+ apiKey={apiKey}
34
+ userId={userId}
35
+ apiRegion={apiRegion}
36
+ >
37
+ <AmityUiKitSocial />
38
+ </AmityUiKitProvider>
39
+ </div>
39
40
  );
40
41
  }
41
42
  ```
42
43
 
43
44
  ### Iframe Post Message Integration
45
+ 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.
46
+
44
47
  When an anonymous user exceeds three clicks, the UIKit will emit a ‘anonymousClicksExceedLimit’ postMessage event. Below is a code example demonstrating how to receive this postMessage event from the UIKit Iframe:
45
48
 
46
49
  ```sh
50
+ import React, { useState, useEffect } from 'react';
51
+
47
52
  export default function App() {
53
+ // `userId` is managed as a state variable and will be updated post-login
54
+ const [userId, setUserId] = useState('anonymous-xxxx');
55
+
56
+ // Handle the postMessage event from the iframe
48
57
  useEffect(() => {
49
- const handleIframeMessage = (event) => {
50
- if (event.data === 'anonymousCicksExceedLimit') {
51
- // handle the event here
52
- // show login dialog
58
+ const handleIframeMessage = event => {
59
+ if (event.data === 'anonymousClicksExceedLimit') {
60
+ // Prompt user to log in
61
+ // Logic to display login dialog should be implemented here
53
62
  }
54
63
  };
55
64
 
65
+ // Listen for messages from the iframe
56
66
  window.addEventListener('message', handleIframeMessage);
57
67
 
68
+ // Cleanup the event listener on component unmount
58
69
  return () => {
59
70
  window.removeEventListener('message', handleIframeMessage);
60
71
  };
61
72
  }, []);
62
73
 
63
- return <iframe src="https://urlToUikit.com />;
74
+ // Function to handle setting a new `userId` after the user logs in
75
+ const handleSetUserId = newValue => {
76
+ setUserId(newValue);
77
+ };
78
+
79
+ return (
80
+ <div>
81
+ // Assume that this is Ulta login prompt
82
+ <input
83
+ type="text"
84
+ id="name"
85
+ placeholder="Enter new User ID"
86
+ onChange={(e) => handleSetUserId(e.target.value)}
87
+ />
88
+ <button onClick={() => handleSetUserId(document.getElementById('name').value)}>
89
+ Set User ID
90
+ </button>
91
+ <iframe
92
+ style={{ width: '100%', height: '80vh' }}
93
+ title="Communities"
94
+ src={`https://urlToUikit.com?userId=${userId}`}
95
+ />
96
+ </div>
97
+ );
64
98
  }
65
99
  ```
66
100
 
101
+ ### Anonymous User Flow
102
+ **Authenticated Users**
103
+ 1. Access and Authentication:
104
+ - Users enter Ulta Web and navigate to the community tab.
105
+ - Ulta Web contacts Ulta Authentication Service to verify if the user is logged in.
106
+ 2. Token Handling:
107
+ - If authenticated, Ulta Web requests an Amity authentication token from Ulta Server.
108
+ - Ulta Server forwards this request to Amity Server, which returns the token.
109
+
110
+ 3. UIKit Initialization:
111
+ - Ulta Web instructs Ulta Iframe to initialize Amity UIKit using the authenticated Ulta User ID and token.
112
+ - Amity UIKit is then presented to the user, allowing continued interaction under their Ulta ID.
113
+
114
+ **Anonymous Users**
115
+ 1. Access as Anonymous:
116
+ - If not logged in, the same token request is made to handle session management.
117
+ - Amity UIKit is initialized as ‘anonymous’, allowing limited interaction.
118
+ 2. Exceeded Interaction Limit:
119
+ - If anonymous interactions exceed limits, Amity UIKit informs Ulta Iframe, triggering a notification to Ulta Web.
120
+ - A login dialogue is presented to the user.
121
+ 3. Login Decision:
122
+ - If the user logs in, Ulta Authentication Service authenticates the user, and the token process repeats to reinitialize Amity UIKit with the Ulta User ID.
123
+
124
+
125
+
126
+ ![Diagram Sept 4 from Mermaid Chart (1)](https://github.com/user-attachments/assets/e62d0e3e-4b00-445d-b8ea-cda1b72ab5f0)
127
+
67
128
 
Binary file
Binary file
Binary file