@blux.ai/web-sdk 0.0.4-rc0 → 0.0.6-tommy0
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/README.md +6 -6
- package/demo/craco.config.js +2 -0
- package/demo/package.json +4 -2
- package/demo/public/index.html +1 -1
- package/demo/tailwind.config.js +2 -0
- package/dist/BluxClient.d.ts +16 -15
- package/dist/BluxClient.js +180 -320
- package/dist/BluxClient.js.map +1 -1
- package/dist/apis/createEvent.d.ts +4 -0
- package/dist/apis/createEvent.js +7 -0
- package/dist/apis/createEvent.js.map +1 -0
- package/dist/apis/getItemRecommendation.d.ts +4 -0
- package/dist/apis/getItemRecommendation.js +7 -0
- package/dist/apis/getItemRecommendation.js.map +1 -0
- package/dist/apis/initialize.d.ts +4 -0
- package/dist/apis/initialize.js +7 -0
- package/dist/apis/initialize.js.map +1 -0
- package/dist/apis/signIn.d.ts +4 -0
- package/dist/apis/signIn.js +7 -0
- package/dist/apis/signIn.js.map +1 -0
- package/dist/apis/signOut.d.ts +4 -0
- package/dist/apis/signOut.js +7 -0
- package/dist/apis/signOut.js.map +1 -0
- package/dist/apis/updateCustomUserProperties.d.ts +4 -0
- package/dist/apis/updateCustomUserProperties.js +7 -0
- package/dist/apis/updateCustomUserProperties.js.map +1 -0
- package/dist/apis/updateUserProperties.d.ts +4 -0
- package/dist/apis/updateUserProperties.js +7 -0
- package/dist/apis/updateUserProperties.js.map +1 -0
- package/dist/constants/URLS.d.ts +2 -6
- package/dist/constants/URLS.js +4 -14
- package/dist/constants/URLS.js.map +1 -1
- package/dist/events/AddCartaddEvent.d.ts +2 -2
- package/dist/events/AddCartaddEvent.js +9 -40
- package/dist/events/AddCartaddEvent.js.map +1 -1
- package/dist/events/AddCustomEvent.d.ts +2 -2
- package/dist/events/AddCustomEvent.js +11 -42
- package/dist/events/AddCustomEvent.js.map +1 -1
- package/dist/events/AddLikeEvent.d.ts +2 -2
- package/dist/events/AddLikeEvent.js +9 -40
- package/dist/events/AddLikeEvent.js.map +1 -1
- package/dist/events/AddPageViewEvent.d.ts +2 -2
- package/dist/events/AddPageViewEvent.js +9 -38
- package/dist/events/AddPageViewEvent.js.map +1 -1
- package/dist/events/AddProductDetailViewEvent.d.ts +2 -2
- package/dist/events/AddProductDetailViewEvent.js +11 -41
- package/dist/events/AddProductDetailViewEvent.js.map +1 -1
- package/dist/events/AddPurchaseEvent.d.ts +2 -2
- package/dist/events/AddPurchaseEvent.js +11 -39
- package/dist/events/AddPurchaseEvent.js.map +1 -1
- package/dist/events/AddRateEvent.d.ts +2 -2
- package/dist/events/AddRateEvent.js +9 -40
- package/dist/events/AddRateEvent.js.map +1 -1
- package/dist/events/AddRecommendationViewEvent.d.ts +2 -2
- package/dist/events/AddRecommendationViewEvent.js +8 -39
- package/dist/events/AddRecommendationViewEvent.js.map +1 -1
- package/dist/events/Event.d.ts +2 -2
- package/dist/events/Event.js +11 -25
- package/dist/events/Event.js.map +1 -1
- package/dist/events/VisitEvent.d.ts +5 -0
- package/dist/events/VisitEvent.js +11 -0
- package/dist/events/VisitEvent.js.map +1 -0
- package/dist/events/index.js +9 -28
- package/dist/events/index.js.map +1 -1
- package/dist/events/types.d.ts +6 -10
- package/dist/events/types.js +2 -6
- package/dist/events/types.js.map +1 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.js +6 -23
- package/dist/index.js.map +1 -1
- package/dist/recommendations/ItemRecommendation.d.ts +5 -0
- package/dist/recommendations/ItemRecommendation.js +12 -0
- package/dist/recommendations/ItemRecommendation.js.map +1 -0
- package/dist/recommendations/Recommendation.d.ts +5 -0
- package/dist/recommendations/Recommendation.js +9 -0
- package/dist/recommendations/Recommendation.js.map +1 -0
- package/dist/recommendations/index.d.ts +1 -0
- package/dist/recommendations/index.js +2 -0
- package/dist/recommendations/index.js.map +1 -0
- package/dist/recommendations/types.d.ts +11 -0
- package/dist/recommendations/types.js +2 -0
- package/dist/recommendations/types.js.map +1 -0
- package/dist/utils/LocalStorage.js +14 -0
- package/dist/utils/LocalStorage.js.map +1 -0
- package/dist/{core → utils}/Logger.d.ts +1 -1
- package/dist/utils/Logger.js +49 -0
- package/dist/utils/Logger.js.map +1 -0
- package/dist/utils/getPath.d.ts +1 -0
- package/dist/utils/getPath.js +4 -0
- package/dist/utils/getPath.js.map +1 -0
- package/dist/utils/helper.js +2 -9
- package/dist/utils/helper.js.map +1 -1
- package/dist/utils/operators.d.ts +1 -1
- package/dist/utils/operators.js +5 -11
- package/dist/utils/operators.js.map +1 -1
- package/package.json +7 -6
- package/.prettierrc +0 -4
- package/.sentryclirc +0 -3
- package/demo/README.md +0 -46
- package/demo/src/App.test.tsx +0 -9
- package/demo/src/App.tsx +0 -158
- package/demo/src/index.css +0 -16
- package/demo/src/index.tsx +0 -19
- package/demo/src/react-app-env.d.ts +0 -1
- package/demo/src/reportWebVitals.ts +0 -15
- package/demo/src/setupTests.ts +0 -5
- package/demo/yarn.lock +0 -10120
- package/dist/core/LocalStorage.js +0 -21
- package/dist/core/LocalStorage.js.map +0 -1
- package/dist/core/Logger.js +0 -88
- package/dist/core/Logger.js.map +0 -1
- package/dist/utils/sentry.d.ts +0 -2
- package/dist/utils/sentry.js +0 -49
- package/dist/utils/sentry.js.map +0 -1
- /package/dist/{core → utils}/LocalStorage.d.ts +0 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@blux.ai/web-sdk",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.6-tommy0",
|
|
4
4
|
"description": "The official Blux JavaScript browser client library",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.js",
|
|
@@ -10,9 +10,8 @@
|
|
|
10
10
|
"test": "jest",
|
|
11
11
|
"build": "tsc",
|
|
12
12
|
"dev": "yarn build -w",
|
|
13
|
-
"prepack": "rm -rf dist && yarn build
|
|
14
|
-
"
|
|
15
|
-
"deploy": "yarn prepack && npm publish --access public"
|
|
13
|
+
"prepack": "rm -rf dist && yarn build",
|
|
14
|
+
"deploy": "npm publish --access public"
|
|
16
15
|
},
|
|
17
16
|
"author": "Z.Ai Inc.",
|
|
18
17
|
"homepage": "https://www.blux.ai/",
|
|
@@ -21,10 +20,12 @@
|
|
|
21
20
|
"typescript": "^4.6.3"
|
|
22
21
|
},
|
|
23
22
|
"dependencies": {
|
|
24
|
-
"@
|
|
25
|
-
"@sentry/cli": "^2.32.1",
|
|
23
|
+
"@blux.ai/common": "24.9.2-hotfix4",
|
|
26
24
|
"axios": "^1.7.2",
|
|
27
25
|
"rxjs": "^7.8.1",
|
|
28
26
|
"uuid": "^10.0.0"
|
|
27
|
+
},
|
|
28
|
+
"installConfig": {
|
|
29
|
+
"hoistingLimits": "workspaces"
|
|
29
30
|
}
|
|
30
31
|
}
|
package/.prettierrc
DELETED
package/.sentryclirc
DELETED
package/demo/README.md
DELETED
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
# Getting Started with Create React App
|
|
2
|
-
|
|
3
|
-
This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app).
|
|
4
|
-
|
|
5
|
-
## Available Scripts
|
|
6
|
-
|
|
7
|
-
In the project directory, you can run:
|
|
8
|
-
|
|
9
|
-
### `yarn start`
|
|
10
|
-
|
|
11
|
-
Runs the app in the development mode.\
|
|
12
|
-
Open [http://localhost:3000](http://localhost:3000) to view it in the browser.
|
|
13
|
-
|
|
14
|
-
The page will reload if you make edits.\
|
|
15
|
-
You will also see any lint errors in the console.
|
|
16
|
-
|
|
17
|
-
### `yarn test`
|
|
18
|
-
|
|
19
|
-
Launches the test runner in the interactive watch mode.\
|
|
20
|
-
See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information.
|
|
21
|
-
|
|
22
|
-
### `yarn build`
|
|
23
|
-
|
|
24
|
-
Builds the app for production to the `build` folder.\
|
|
25
|
-
It correctly bundles React in production mode and optimizes the build for the best performance.
|
|
26
|
-
|
|
27
|
-
The build is minified and the filenames include the hashes.\
|
|
28
|
-
Your app is ready to be deployed!
|
|
29
|
-
|
|
30
|
-
See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information.
|
|
31
|
-
|
|
32
|
-
### `yarn eject`
|
|
33
|
-
|
|
34
|
-
**Note: this is a one-way operation. Once you `eject`, you can’t go back!**
|
|
35
|
-
|
|
36
|
-
If you aren’t satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project.
|
|
37
|
-
|
|
38
|
-
Instead, it will copy all the configuration files and the transitive dependencies (webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you’re on your own.
|
|
39
|
-
|
|
40
|
-
You don’t have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn’t feel obligated to use this feature. However we understand that this tool wouldn’t be useful if you couldn’t customize it when you are ready for it.
|
|
41
|
-
|
|
42
|
-
## Learn More
|
|
43
|
-
|
|
44
|
-
You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started).
|
|
45
|
-
|
|
46
|
-
To learn React, check out the [React documentation](https://reactjs.org/).
|
package/demo/src/App.test.tsx
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { render, screen } from '@testing-library/react';
|
|
3
|
-
import App from './App';
|
|
4
|
-
|
|
5
|
-
test('renders learn react link', () => {
|
|
6
|
-
render(<App />);
|
|
7
|
-
const linkElement = screen.getByText(/learn react/i);
|
|
8
|
-
expect(linkElement).toBeInTheDocument();
|
|
9
|
-
});
|
package/demo/src/App.tsx
DELETED
|
@@ -1,158 +0,0 @@
|
|
|
1
|
-
import React, { useState } from "react";
|
|
2
|
-
import BluxClient, { AddLikeEvent } from "@blux.ai/web-sdk";
|
|
3
|
-
function App() {
|
|
4
|
-
const [bluxClientId, setBluxClientId] = useState<string>(
|
|
5
|
-
"cc392627-0c7a-40a0-b472-fbd0842eb125"
|
|
6
|
-
);
|
|
7
|
-
const [bluxApiKey, setBluxApiKey] = useState<string>(
|
|
8
|
-
"yvU_CEMtZxqWXKFpkv2FsN2ICoKb6G8BrmiD5urZzYg"
|
|
9
|
-
);
|
|
10
|
-
|
|
11
|
-
const [userId, setUserId] = useState<string>(
|
|
12
|
-
`test_user_id_${Math.floor(Math.random() * 100)}`
|
|
13
|
-
);
|
|
14
|
-
|
|
15
|
-
const [telNumber, setTelNumber] = useState<string>("+821012345678");
|
|
16
|
-
const [email, setEmail] = useState<string>("qa@blux.ai");
|
|
17
|
-
const [customKey, setCustomKey] = useState<string>("custom_key");
|
|
18
|
-
const [customValue, setCustomValue] = useState<string>("custom_value");
|
|
19
|
-
|
|
20
|
-
const [isInitialized, setIsInitialized] = useState<boolean>(false);
|
|
21
|
-
|
|
22
|
-
return (
|
|
23
|
-
<div className="p-10">
|
|
24
|
-
<div className="input-container flex flex-col">
|
|
25
|
-
<div>BluxUser</div>
|
|
26
|
-
<div>
|
|
27
|
-
{BluxClient.bluxUser$.value
|
|
28
|
-
? JSON.stringify(BluxClient.bluxUser$.value)
|
|
29
|
-
: "not initialized"}
|
|
30
|
-
</div>
|
|
31
|
-
<div>BluxClientId</div>
|
|
32
|
-
<input
|
|
33
|
-
className="w-[500px] rounded-md border-black border-2"
|
|
34
|
-
type="text"
|
|
35
|
-
placeholder="Enter Blux Client ID"
|
|
36
|
-
value={bluxClientId}
|
|
37
|
-
onChange={(e) => setBluxClientId(e.target.value)}
|
|
38
|
-
/>
|
|
39
|
-
<div className="mt-3">BluxApiKey</div>
|
|
40
|
-
<input
|
|
41
|
-
className="w-[500px] rounded-md border-black border-2"
|
|
42
|
-
type="text"
|
|
43
|
-
placeholder="Enter Blux API Key"
|
|
44
|
-
value={bluxApiKey}
|
|
45
|
-
onChange={(e) => setBluxApiKey(e.target.value)}
|
|
46
|
-
/>
|
|
47
|
-
<div className="mt-3">User Id</div>
|
|
48
|
-
<input
|
|
49
|
-
className="w-[500px] rounded-md border-black border-2"
|
|
50
|
-
type="text"
|
|
51
|
-
placeholder="Enter User Id"
|
|
52
|
-
value={userId}
|
|
53
|
-
onChange={(e) => setUserId(e.target.value)}
|
|
54
|
-
/>
|
|
55
|
-
<div className="mt-3">Phone Number</div>
|
|
56
|
-
<input
|
|
57
|
-
className="w-[500px] rounded-md border-black border-2"
|
|
58
|
-
type="text"
|
|
59
|
-
placeholder="Enter phone number"
|
|
60
|
-
value={telNumber}
|
|
61
|
-
onChange={(e) => setTelNumber(e.target.value)}
|
|
62
|
-
/>
|
|
63
|
-
<div className="mt-3">Email</div>
|
|
64
|
-
<input
|
|
65
|
-
className="w-[500px] rounded-md border-black border-2"
|
|
66
|
-
type="text"
|
|
67
|
-
placeholder="Enter email"
|
|
68
|
-
value={email}
|
|
69
|
-
onChange={(e) => setEmail(e.target.value)}
|
|
70
|
-
/>
|
|
71
|
-
<div className="mt-3">CustomKey</div>
|
|
72
|
-
<input
|
|
73
|
-
className="w-[500px] rounded-md border-black border-2"
|
|
74
|
-
type="text"
|
|
75
|
-
placeholder="Enter custom key"
|
|
76
|
-
value={customKey}
|
|
77
|
-
onChange={(e) => setCustomKey(e.target.value)}
|
|
78
|
-
/>
|
|
79
|
-
<div className="mt-3">CustomValue</div>
|
|
80
|
-
<input
|
|
81
|
-
className="w-[500px] rounded-md border-black border-2"
|
|
82
|
-
type="text"
|
|
83
|
-
placeholder="Enter custom value"
|
|
84
|
-
value={customValue}
|
|
85
|
-
onChange={(e) => setCustomValue(e.target.value)}
|
|
86
|
-
/>
|
|
87
|
-
</div>
|
|
88
|
-
<div className="mt-10 flex gap-4">
|
|
89
|
-
<button
|
|
90
|
-
className="bg-blue-500 rounded-md p-4 disabled:bg-gray-300"
|
|
91
|
-
onClick={() =>
|
|
92
|
-
BluxClient.init({ bluxClientId, bluxApiKey }).then(() =>
|
|
93
|
-
setIsInitialized(true)
|
|
94
|
-
)
|
|
95
|
-
}
|
|
96
|
-
disabled={bluxClientId === "" || bluxApiKey === ""}
|
|
97
|
-
>
|
|
98
|
-
init
|
|
99
|
-
</button>
|
|
100
|
-
<button
|
|
101
|
-
className="bg-blue-500 rounded-md p-4 disabled:bg-gray-300"
|
|
102
|
-
onClick={() => BluxClient.setUserId(userId)}
|
|
103
|
-
disabled={!isInitialized}
|
|
104
|
-
>
|
|
105
|
-
setUserId
|
|
106
|
-
</button>
|
|
107
|
-
<button
|
|
108
|
-
className="bg-blue-500 rounded-md p-4 disabled:bg-gray-300"
|
|
109
|
-
onClick={() => BluxClient.signOut()}
|
|
110
|
-
disabled={!isInitialized}
|
|
111
|
-
>
|
|
112
|
-
signOut
|
|
113
|
-
</button>
|
|
114
|
-
<button
|
|
115
|
-
className="bg-blue-500 rounded-md p-4 disabled:bg-gray-300"
|
|
116
|
-
onClick={() =>
|
|
117
|
-
BluxClient.setUserProperties({ phone_number: telNumber })
|
|
118
|
-
}
|
|
119
|
-
disabled={!isInitialized}
|
|
120
|
-
>
|
|
121
|
-
setUserProperties (phone number)
|
|
122
|
-
</button>
|
|
123
|
-
<button
|
|
124
|
-
className="bg-blue-500 rounded-md p-4 disabled:bg-gray-300"
|
|
125
|
-
onClick={() => BluxClient.setUserProperties({ email_address: email })}
|
|
126
|
-
disabled={!isInitialized}
|
|
127
|
-
>
|
|
128
|
-
setUserProperties (email)
|
|
129
|
-
</button>
|
|
130
|
-
<button
|
|
131
|
-
className="bg-blue-500 rounded-md p-4 disabled:bg-gray-300"
|
|
132
|
-
onClick={() =>
|
|
133
|
-
BluxClient.setCustomUserProperties({ [customKey]: customValue })
|
|
134
|
-
}
|
|
135
|
-
disabled={!isInitialized}
|
|
136
|
-
>
|
|
137
|
-
setCustomProperties
|
|
138
|
-
</button>
|
|
139
|
-
<button
|
|
140
|
-
className="bg-blue-500 rounded-md p-4 disabled:bg-gray-300"
|
|
141
|
-
onClick={() =>
|
|
142
|
-
BluxClient.sendEvent(
|
|
143
|
-
new AddLikeEvent({
|
|
144
|
-
item_id: "test-neo",
|
|
145
|
-
url: "test-url",
|
|
146
|
-
})
|
|
147
|
-
)
|
|
148
|
-
}
|
|
149
|
-
disabled={!isInitialized}
|
|
150
|
-
>
|
|
151
|
-
sendEvent
|
|
152
|
-
</button>
|
|
153
|
-
</div>
|
|
154
|
-
</div>
|
|
155
|
-
);
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
export default App;
|
package/demo/src/index.css
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
@tailwind base;
|
|
2
|
-
@tailwind components;
|
|
3
|
-
@tailwind utilities;
|
|
4
|
-
body {
|
|
5
|
-
margin: 0;
|
|
6
|
-
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen",
|
|
7
|
-
"Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue",
|
|
8
|
-
sans-serif;
|
|
9
|
-
-webkit-font-smoothing: antialiased;
|
|
10
|
-
-moz-osx-font-smoothing: grayscale;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
code {
|
|
14
|
-
font-family: source-code-pro, Menlo, Monaco, Consolas, "Courier New",
|
|
15
|
-
monospace;
|
|
16
|
-
}
|
package/demo/src/index.tsx
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import ReactDOM from "react-dom/client";
|
|
3
|
-
import "./index.css";
|
|
4
|
-
import App from "./App";
|
|
5
|
-
import reportWebVitals from "./reportWebVitals";
|
|
6
|
-
|
|
7
|
-
const root = ReactDOM.createRoot(
|
|
8
|
-
document.getElementById("root") as HTMLElement
|
|
9
|
-
);
|
|
10
|
-
root.render(
|
|
11
|
-
<React.StrictMode>
|
|
12
|
-
<App />
|
|
13
|
-
</React.StrictMode>
|
|
14
|
-
);
|
|
15
|
-
|
|
16
|
-
// If you want to start measuring performance in your app, pass a function
|
|
17
|
-
// to log results (for example: reportWebVitals(console.log))
|
|
18
|
-
// or send to an analytics endpoint. Learn more: https://bit.ly/CRA-vitals
|
|
19
|
-
reportWebVitals();
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
/// <reference types="react-scripts" />
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { ReportHandler } from "web-vitals";
|
|
2
|
-
|
|
3
|
-
const reportWebVitals = (onPerfEntry?: ReportHandler) => {
|
|
4
|
-
if (onPerfEntry && onPerfEntry instanceof Function) {
|
|
5
|
-
import("web-vitals").then(({ getCLS, getFID, getFCP, getLCP, getTTFB }) => {
|
|
6
|
-
getCLS(onPerfEntry);
|
|
7
|
-
getFID(onPerfEntry);
|
|
8
|
-
getFCP(onPerfEntry);
|
|
9
|
-
getLCP(onPerfEntry);
|
|
10
|
-
getTTFB(onPerfEntry);
|
|
11
|
-
});
|
|
12
|
-
}
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
export default reportWebVitals;
|
package/demo/src/setupTests.ts
DELETED