@amityco/ulta-ui-kit 1.1.3 → 4.0.0-alpha.2

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,8 +1,9 @@
1
1
  {
2
2
  "name": "@amityco/ulta-ui-kit",
3
- "version": "1.1.3",
3
+ "version": "4.0.0-alpha.2",
4
4
  "engines": {
5
- "node": ">=18"
5
+ "node": ">=20",
6
+ "pnpm": "9"
6
7
  },
7
8
  "module": "dist/esm/index.js",
8
9
  "main": "dist/index.js",
@@ -24,12 +25,10 @@
24
25
  "types": "dist/index.d.ts",
25
26
  "description": "React Ui-Kit for Amity Social Cloud",
26
27
  "peerDependencies": {
27
- "@amityco/ts-sdk": "^6.30.0",
28
28
  "react": ">=17.0.2",
29
29
  "react-dom": ">=17.0.2"
30
30
  },
31
31
  "devDependencies": {
32
- "@amityco/ts-sdk": "^6.30.4",
33
32
  "@eslint/js": "^9.4.0",
34
33
  "@storybook/addon-a11y": "^7.6.7",
35
34
  "@storybook/addon-actions": "^7.6.7",
@@ -90,15 +89,11 @@
90
89
  "vite-tsconfig-paths": "^4.2.3"
91
90
  },
92
91
  "dependencies": {
93
- "@floating-ui/react-dom": "^2.1.1",
94
- "@fortawesome/fontawesome-svg-core": "^1.2.36",
95
- "@fortawesome/free-solid-svg-icons": "^5.15.4",
96
- "@fortawesome/react-fontawesome": "^0.2.0",
92
+ "@amityco/ts-sdk": "^6.32.2",
97
93
  "@hookform/error-message": "^2.0.1",
98
94
  "@hookform/resolvers": "^3.3.4",
99
- "@lexical/link": "^0.17.1",
100
- "@lexical/react": "^0.17.1",
101
- "@radix-ui/react-tabs": "^1.0.4",
95
+ "@lexical/link": "^0.18.0",
96
+ "@lexical/react": "^0.18.0",
102
97
  "@tanstack/react-query": "^5.28.14",
103
98
  "clsx": "^2.1.0",
104
99
  "colorthief": "^2.4.0",
@@ -106,7 +101,7 @@
106
101
  "filesize": "^9.0.11",
107
102
  "framer-motion": "^11.1.7",
108
103
  "hls.js": "^1.4.14",
109
- "lexical": "^0.17.1",
104
+ "lexical": "^0.18.0",
110
105
  "linkify-react": "^4.1.3",
111
106
  "linkifyjs": "^4.1.3",
112
107
  "lodash": "^4.17.21",
@@ -118,7 +113,7 @@
118
113
  "react-hook-form": "^7.49.2",
119
114
  "react-infinite-scroll-component": "^6.1.0",
120
115
  "react-insta-stories": "^2.6.2",
121
- "react-intl": "^6.5.5",
116
+ "react-intl": "^6.8.7",
122
117
  "react-loading-skeleton": "^3.3.1",
123
118
  "react-mentions": "^4.4.10",
124
119
  "react-modal-sheet": "^2.2.0",
package/readme.md CHANGED
@@ -1,164 +1,21 @@
1
- # Ulta-Social-Cloud-Ui-Kit for Web
1
+ # Amity Ui-Kit for Web
2
2
 
3
3
  ## Getting started
4
4
 
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.
5
+ Before starting to work, please read the following instructions.
6
+ https://ekoapp.atlassian.net/wiki/spaces/UP/pages/2443706407/ASC+Web+UIKit+V4+Governance
6
7
 
7
- ### Prerequisites
8
-
9
- Before you begin, ensure you have the following installed:
10
-
11
- • Node.js (>= 20.x)
12
- • React.js (>= 18.x)
8
+ If you have any questions, please ask / discuss with the team.
13
9
 
14
10
  ### Installation
15
11
 
16
- With npm: `npm install --save @amityco/ulta-ui-kit`
17
-
18
- With yarn: `yarn add @amityco/ulta-ui-kit`
19
-
20
- ### Basic Usage
21
-
22
- ```sh
23
- import { AmityUiKitProvider, AmityUiKitSocial } from "@amityco/ulta-ui-kit";
24
-
25
- import "@amityco/ulta-ui-kit/dist/index.css";
26
-
27
- export default function App() {
28
- // Retrieve userId from query parameters
29
- const urlParams = new URLSearchParams(window.location.search);
30
- const userId = urlParams.get("userId");
31
- const apiKey = "<your API key here>";
32
- const apiRegion = "<your API region here>";
33
-
34
- return (
35
- <div style={{ width: '100dvw', height: '100dvh' }}>
36
- <AmityUiKitProvider
37
- key={userId}
38
- apiKey={apiKey}
39
- userId={userId}
40
- apiRegion={apiRegion}
41
- ultaConfig={{
42
- newsCommunityId: 'newsCommunityId', // To configure the news communityId used to navigate from `Ulta Beuty News` banner
43
- faqCommunityId: 'faqCommunityId', // To configure the FAQs communityId used to navigate from `FAQs & Best Practices` banner
44
- defaultTab: 'explore', // To configure the default tab. The available default tabs are 'newfeeds', and 'explore'
45
- termsAndConditionsUrl: 'https://www.ulta.com/foo', // To configure the terms and conditions link on the nickname dialog
46
- privacyAndPolicyUrl: 'https://www.ulta.com/bar', // To configure the privacy and policy link on the nickname dialog
47
- }}
48
- >
49
- <AmityUiKitSocial />
50
- </AmityUiKitProvider>
51
- </div>
52
- );
53
- }
54
- ```
55
-
56
- ### Iframe Post Message Integration
57
-
58
- 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.
59
-
60
- 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:
61
-
62
- ```sh
63
- import React, { useState, useEffect } from 'react';
64
-
65
- export default function App() {
66
- // `userId` is managed as a state variable and will be updated post-login
67
- const [userId, setUserId] = useState('public-xxxx');
68
-
69
- // Handle the postMessage event from the iframe
70
- useEffect(() => {
71
- const handleIframeMessage = event => {
72
- if (event.data === 'anonymousNeedsLogin') {
73
- // Prompt user to log in
74
- // Logic to display login dialog should be implemented here
75
- }
76
-
77
- if (event.data ==== 'uikitRendered') {
78
- // Logic to handle after uikit has been rendered
79
- }
80
-
81
- if (event.data ==== 'explorePageLoaded') {
82
- // Logic to handle after Explore page has been loaded
83
- }
84
-
85
-
86
- if (event.data ==== 'parentNeedsScrollToTop') {
87
- // `parentNeedsScrollToTop` will be posted from iFrame when the Nickname dialog is opened
88
- window.scrollTo(0,0);
89
- }
90
-
91
- };
92
-
93
- // Listen for messages from the iframe
94
- window.addEventListener('message', handleIframeMessage);
95
-
96
- // Cleanup the event listener on component unmount
97
- return () => {
98
- window.removeEventListener('message', handleIframeMessage);
99
- };
100
- }, []);
101
-
102
- // Function to handle setting a new `userId` after the user logs in
103
- const handleSetUserId = newValue => {
104
- setUserId(newValue);
105
- };
106
-
107
- return (
108
- <div>
109
- // Assume that this is Ulta login prompt
110
- <input
111
- type="text"
112
- id="name"
113
- placeholder="Enter new User ID"
114
- onChange={(e) => handleSetUserId(e.target.value)}
115
- />
116
- <button onClick={() => handleSetUserId(document.getElementById('name').value)}>
117
- Set User ID
118
- </button>
119
- <iframe
120
- style={{ width: '100%', height: '80vh' }}
121
- title="Communities"
122
- src={`https://urlToUikit.com?userId=${userId}`}
123
- />
124
- </div>
125
- );
126
- }
127
- ```
128
-
129
- ### Anonymous User Flow
130
-
131
- **Authenticated Users**
132
-
133
- 1. Access and Authentication:
134
-
135
- - Users enter Ulta Web and navigate to the community tab.
136
- - Ulta Web contacts Ulta Authentication Service to verify if the user is logged in.
137
-
138
- 2. Token Handling:
139
-
140
- - If authenticated, Ulta Web requests an Amity authentication token from Ulta Server.
141
- - Ulta Server forwards this request to Amity Server, which returns the token.
142
-
143
- 3. UIKit Initialization:
144
-
145
- - Ulta Web instructs Ulta Iframe to initialize Amity UIKit using the authenticated Ulta User ID and token.
146
- - Amity UIKit is then presented to the user, allowing continued interaction under their Ulta ID.
147
-
148
- **Anonymous Users**
149
-
150
- 1. Access as Anonymous:
151
-
152
- - If not logged in, the same token request is made to handle session management.
153
- - Amity UIKit is initialized as ‘public’, allowing limited interaction.
154
-
155
- 2. Exceeded Interaction Limit:
12
+ 1. `npm install --save @amityco/ui-kit`
13
+ 2. `yarn add @amityco/ui-kit`
156
14
 
157
- - If anonymous interactions exceed limits, Amity UIKit informs Ulta Iframe, triggering a notification to Ulta Web.
158
- - A login dialogue is presented to the user.
15
+ ### Documentation
159
16
 
160
- 3. Login Decision:
17
+ Please refer to our online documentation at https://docs.amity.co or contact a Ui-Kit representative at \* \*developers@amity.co** for support.
161
18
 
162
- - 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.
19
+ ## Contributing
163
20
 
164
- ![Diagram Sept 4 from Mermaid Chart (1)](https://github.com/user-attachments/assets/e62d0e3e-4b00-445d-b8ea-cda1b72ab5f0)
21
+ See [our contributing guide](https://github.com/EkoCommunications/AmityUiKitWeb/blob/develop/CONTRIBUTING.md)