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

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-alpha.28",
3
+ "version": "1.0.0-alpha.29",
4
4
  "engines": {
5
5
  "node": ">=18"
6
6
  },
package/readme.md CHANGED
@@ -5,10 +5,11 @@
5
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
+
8
9
  Before you begin, ensure you have the following installed:
9
10
 
10
- Node.js (>= 20.x)
11
- React.js (>= 18.x)
11
+ Node.js (>= 20.x)
12
+ React.js (>= 18.x)
12
13
 
13
14
  ### Installation
14
15
 
@@ -17,9 +18,12 @@ With npm: `npm install --save @amityco/ulta-ui-kit`
17
18
  With yarn: `yarn add @amityco/ulta-ui-kit`
18
19
 
19
20
  ### Basic Usage
21
+
20
22
  ```sh
21
23
  import { AmityUiKitProvider, AmityUiKitSocial } from "@amityco/ulta-ui-kit";
22
24
 
25
+ import "@amityco/ulta-ui-kit/dist/index.css";
26
+
23
27
  export default function App() {
24
28
  // Retrieve userId from query parameters
25
29
  const urlParams = new URLSearchParams(window.location.search);
@@ -42,9 +46,10 @@ export default function App() {
42
46
  ```
43
47
 
44
48
  ### Iframe Post Message Integration
49
+
45
50
  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
51
 
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:
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:
48
53
 
49
54
  ```sh
50
55
  import React, { useState, useEffect } from 'react';
@@ -56,7 +61,7 @@ export default function App() {
56
61
  // Handle the postMessage event from the iframe
57
62
  useEffect(() => {
58
63
  const handleIframeMessage = event => {
59
- if (event.data === 'anonymousClicksExceedLimit') {
64
+ if (event.data === 'anonymousNeedsLogin') {
60
65
  // Prompt user to log in
61
66
  // Logic to display login dialog should be implemented here
62
67
  }
@@ -99,30 +104,38 @@ export default function App() {
99
104
  ```
100
105
 
101
106
  ### Anonymous User Flow
107
+
102
108
  **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:
109
+
110
+ 1. Access and Authentication:
111
+
112
+ - Users enter Ulta Web and navigate to the community tab.
113
+ - Ulta Web contacts Ulta Authentication Service to verify if the user is logged in.
114
+
115
+ 2. Token Handling:
116
+
107
117
  - If authenticated, Ulta Web requests an Amity authentication token from Ulta Server.
108
118
  - Ulta Server forwards this request to Amity Server, which returns the token.
109
-
110
- 3. UIKit Initialization:
119
+
120
+ 3. UIKit Initialization:
121
+
111
122
  - Ulta Web instructs Ulta Iframe to initialize Amity UIKit using the authenticated Ulta User ID and token.
112
123
  - Amity UIKit is then presented to the user, allowing continued interaction under their Ulta ID.
113
124
 
114
125
  **Anonymous Users**
126
+
115
127
  1. Access as Anonymous:
128
+
116
129
  - If not logged in, the same token request is made to handle session management.
117
130
  - 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
131
 
132
+ 2. Exceeded Interaction Limit:
124
133
 
134
+ - If anonymous interactions exceed limits, Amity UIKit informs Ulta Iframe, triggering a notification to Ulta Web.
135
+ - A login dialogue is presented to the user.
125
136
 
126
- ![Diagram Sept 4 from Mermaid Chart (1)](https://github.com/user-attachments/assets/e62d0e3e-4b00-445d-b8ea-cda1b72ab5f0)
137
+ 3. Login Decision:
127
138
 
139
+ - 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.
128
140
 
141
+ ![Diagram Sept 4 from Mermaid Chart (1)](https://github.com/user-attachments/assets/e62d0e3e-4b00-445d-b8ea-cda1b72ab5f0)