@blux.ai/web-sdk 0.0.7 → 1.0.0-rc1

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 (130) hide show
  1. package/README.md +19 -19
  2. package/dist/package.json +35 -0
  3. package/package.json +2 -2
  4. package/demo/craco.config.js +0 -29
  5. package/demo/package.json +0 -50
  6. package/demo/public/favicon.ico +0 -0
  7. package/demo/public/index.html +0 -43
  8. package/demo/public/logo192.png +0 -0
  9. package/demo/public/logo512.png +0 -0
  10. package/demo/public/manifest.json +0 -25
  11. package/demo/public/robots.txt +0 -3
  12. package/demo/src/App.test.tsx +0 -9
  13. package/demo/src/App.tsx +0 -252
  14. package/demo/src/index.css +0 -16
  15. package/demo/src/index.tsx +0 -19
  16. package/demo/src/react-app-env.d.ts +0 -1
  17. package/demo/src/reportWebVitals.ts +0 -15
  18. package/demo/src/setupTests.ts +0 -5
  19. package/demo/tailwind.config.js +0 -10
  20. package/dist/BluxClient.d.ts +0 -43
  21. package/dist/BluxClient.js +0 -190
  22. package/dist/BluxClient.js.map +0 -1
  23. package/dist/apis/APIs.d.ts +0 -317
  24. package/dist/apis/APIs.js +0 -138
  25. package/dist/apis/APIs.js.map +0 -1
  26. package/dist/apis/createEvent.d.ts +0 -4
  27. package/dist/apis/createEvent.js +0 -7
  28. package/dist/apis/createEvent.js.map +0 -1
  29. package/dist/apis/getItemRecommendation.d.ts +0 -4
  30. package/dist/apis/getItemRecommendation.js +0 -7
  31. package/dist/apis/getItemRecommendation.js.map +0 -1
  32. package/dist/apis/initialize.d.ts +0 -4
  33. package/dist/apis/initialize.js +0 -7
  34. package/dist/apis/initialize.js.map +0 -1
  35. package/dist/apis/signIn.d.ts +0 -4
  36. package/dist/apis/signIn.js +0 -7
  37. package/dist/apis/signIn.js.map +0 -1
  38. package/dist/apis/signOut.d.ts +0 -4
  39. package/dist/apis/signOut.js +0 -7
  40. package/dist/apis/signOut.js.map +0 -1
  41. package/dist/apis/updateCustomUserProperties.d.ts +0 -4
  42. package/dist/apis/updateCustomUserProperties.js +0 -7
  43. package/dist/apis/updateCustomUserProperties.js.map +0 -1
  44. package/dist/apis/updateUserProperties.d.ts +0 -4
  45. package/dist/apis/updateUserProperties.js +0 -7
  46. package/dist/apis/updateUserProperties.js.map +0 -1
  47. package/dist/constants/COUNTRIES.d.ts +0 -928
  48. package/dist/constants/COUNTRIES.js +0 -1159
  49. package/dist/constants/COUNTRIES.js.map +0 -1
  50. package/dist/constants/ISO8601_REGEX.d.ts +0 -1
  51. package/dist/constants/ISO8601_REGEX.js +0 -4
  52. package/dist/constants/ISO8601_REGEX.js.map +0 -1
  53. package/dist/constants/URLS.d.ts +0 -6
  54. package/dist/constants/URLS.js +0 -7
  55. package/dist/constants/URLS.js.map +0 -1
  56. package/dist/events/AddCartaddEvent.d.ts +0 -5
  57. package/dist/events/AddCartaddEvent.js +0 -11
  58. package/dist/events/AddCartaddEvent.js.map +0 -1
  59. package/dist/events/AddCustomEvent.d.ts +0 -5
  60. package/dist/events/AddCustomEvent.js +0 -12
  61. package/dist/events/AddCustomEvent.js.map +0 -1
  62. package/dist/events/AddLikeEvent.d.ts +0 -5
  63. package/dist/events/AddLikeEvent.js +0 -11
  64. package/dist/events/AddLikeEvent.js.map +0 -1
  65. package/dist/events/AddPageViewEvent.d.ts +0 -5
  66. package/dist/events/AddPageViewEvent.js +0 -11
  67. package/dist/events/AddPageViewEvent.js.map +0 -1
  68. package/dist/events/AddProductDetailViewEvent.d.ts +0 -5
  69. package/dist/events/AddProductDetailViewEvent.js +0 -11
  70. package/dist/events/AddProductDetailViewEvent.js.map +0 -1
  71. package/dist/events/AddPurchaseEvent.d.ts +0 -5
  72. package/dist/events/AddPurchaseEvent.js +0 -12
  73. package/dist/events/AddPurchaseEvent.js.map +0 -1
  74. package/dist/events/AddRateEvent.d.ts +0 -5
  75. package/dist/events/AddRateEvent.js +0 -12
  76. package/dist/events/AddRateEvent.js.map +0 -1
  77. package/dist/events/AddRecommendationViewEvent.d.ts +0 -5
  78. package/dist/events/AddRecommendationViewEvent.js +0 -10
  79. package/dist/events/AddRecommendationViewEvent.js.map +0 -1
  80. package/dist/events/Event.d.ts +0 -16
  81. package/dist/events/Event.js +0 -24
  82. package/dist/events/Event.js.map +0 -1
  83. package/dist/events/VisitEvent.d.ts +0 -5
  84. package/dist/events/VisitEvent.js +0 -10
  85. package/dist/events/VisitEvent.js.map +0 -1
  86. package/dist/events/index.d.ts +0 -8
  87. package/dist/events/index.js +0 -9
  88. package/dist/events/index.js.map +0 -1
  89. package/dist/events/types.d.ts +0 -38
  90. package/dist/events/types.js +0 -2
  91. package/dist/events/types.js.map +0 -1
  92. package/dist/index.d.ts +0 -5
  93. package/dist/index.js +0 -6
  94. package/dist/index.js.map +0 -1
  95. package/dist/recommendations/ItemRecommendation.d.ts +0 -5
  96. package/dist/recommendations/ItemRecommendation.js +0 -12
  97. package/dist/recommendations/ItemRecommendation.js.map +0 -1
  98. package/dist/recommendations/Recommendation.d.ts +0 -5
  99. package/dist/recommendations/Recommendation.js +0 -9
  100. package/dist/recommendations/Recommendation.js.map +0 -1
  101. package/dist/recommendations/index.d.ts +0 -1
  102. package/dist/recommendations/index.js +0 -2
  103. package/dist/recommendations/index.js.map +0 -1
  104. package/dist/recommendations/types.d.ts +0 -11
  105. package/dist/recommendations/types.js +0 -2
  106. package/dist/recommendations/types.js.map +0 -1
  107. package/dist/utils/Base.d.ts +0 -13
  108. package/dist/utils/Base.js +0 -2
  109. package/dist/utils/Base.js.map +0 -1
  110. package/dist/utils/LocalStorage.d.ts +0 -4
  111. package/dist/utils/LocalStorage.js +0 -14
  112. package/dist/utils/LocalStorage.js.map +0 -1
  113. package/dist/utils/Logger.d.ts +0 -13
  114. package/dist/utils/Logger.js +0 -49
  115. package/dist/utils/Logger.js.map +0 -1
  116. package/dist/utils/assertEqualTypes.d.ts +0 -3
  117. package/dist/utils/assertEqualTypes.js +0 -5
  118. package/dist/utils/assertEqualTypes.js.map +0 -1
  119. package/dist/utils/getPath.d.ts +0 -1
  120. package/dist/utils/getPath.js +0 -9
  121. package/dist/utils/getPath.js.map +0 -1
  122. package/dist/utils/helper.d.ts +0 -1
  123. package/dist/utils/helper.js +0 -4
  124. package/dist/utils/helper.js.map +0 -1
  125. package/dist/utils/operators.d.ts +0 -2
  126. package/dist/utils/operators.js +0 -6
  127. package/dist/utils/operators.js.map +0 -1
  128. package/dist/utils/zodSchemas.d.ts +0 -19
  129. package/dist/utils/zodSchemas.js +0 -105
  130. package/dist/utils/zodSchemas.js.map +0 -1
package/README.md CHANGED
@@ -20,11 +20,11 @@ yarn add @blux.ai/web-sdk
20
20
  - 필요 변수 : `클라이언트 ID`, `API 키`
21
21
 
22
22
  ```typescript
23
- BluxClient.setLogLevel("debug");
24
- BluxClient.init({
25
- bluxClientId: "{blux_client_id}",
23
+ const bluxClient = await BluxClient.init({
24
+ applicationId: "{blux_client_id}",
26
25
  bluxApiKey: "{blux_api_key}",
27
26
  });
27
+ bluxClient.setLogLevel("debug");
28
28
  ```
29
29
 
30
30
  - **setLogLevel** : 연동 관련하여 디버깅을 하기 위해서 로깅을 활성화할 수 있습니다. 해당 설정은 정적이므로 BluxClient를 초기화하기 전에 호출하실 수 있습니다.
@@ -42,7 +42,7 @@ BluxClient.init({
42
42
  - 회원 유저가 앱을 실행하는 시점에도 `initialize` 메소드 호출 이후에 실행되어야 합니다.
43
43
 
44
44
  ```typescript
45
- BluxClient.signIn("USER ID");
45
+ bluxClient.signIn("USER ID");
46
46
  ```
47
47
 
48
48
  ### setUserProperties
@@ -50,8 +50,8 @@ BluxClient.signIn("USER ID");
50
50
  - 유저에게 지정된 속성들을 부여합니다. 전화번호, 이메일 번호를 등록할 수 있습니다.
51
51
 
52
52
  ```typescript
53
- BluxClient.setUserProperties({
54
- phone_number: "+821011112222",
53
+ bluxClient.setUserProperties({
54
+ phone_number: "01011112222",
55
55
  email_address: "test@example.com",
56
56
  });
57
57
  ```
@@ -61,7 +61,7 @@ BluxClient.setUserProperties({
61
61
  - `setUserProperties`에서 설정할 수 있는 지정된 속성 외 임의의 속성을 부여할 수 있습니다.
62
62
 
63
63
  ```typescript
64
- BluxClient.setCustomUserProperties({
64
+ bluxClient.setCustomUserProperties({
65
65
  custom_key1: "any_value",
66
66
  custom_key2: true,
67
67
  custom_key3: null,
@@ -75,7 +75,7 @@ BluxClient.setCustomUserProperties({
75
75
  - 유저들을 더 잘 식별하기위해 사용됩니다.
76
76
 
77
77
  ```typescript
78
- BluxClient.signOut();
78
+ bluxClient.signOut();
79
79
  ```
80
80
 
81
81
  ### sendEvent
@@ -87,9 +87,9 @@ BluxClient.signOut();
87
87
  ---
88
88
 
89
89
  ```typescript
90
- BluxClient.sendEvent(
90
+ bluxClient.sendEvent(
91
91
  new AddProductDetailViewEvent({
92
- itemId: "ITEM_ID",
92
+ item_id: "ITEM_ID",
93
93
  }),
94
94
  );
95
95
  ```
@@ -101,9 +101,9 @@ BluxClient.sendEvent(
101
101
  ---
102
102
 
103
103
  ```typescript
104
- BluxClient.sendEvent(
104
+ bluxClient.sendEvent(
105
105
  new AddLikeEvent({
106
- itemId: "ITEM_ID",
106
+ item_id: "ITEM_ID",
107
107
  }),
108
108
  );
109
109
  ```
@@ -115,9 +115,9 @@ BluxClient.sendEvent(
115
115
  ---
116
116
 
117
117
  ```typescript
118
- BluxClient.sendEvent(
118
+ bluxClient.sendEvent(
119
119
  new AddCartaddEvent({
120
- itemId: "ITEM_ID",
120
+ item_id: "ITEM_ID",
121
121
  }),
122
122
  );
123
123
  ```
@@ -134,9 +134,9 @@ BluxClient.sendEvent(
134
134
  - `AddPurchaseEvent` 객체를 각 상품 구매건에 맞춰서 생성한 후 list 형태로 넘겨주시면 됩니다.
135
135
 
136
136
  ```typescript
137
- BluxClient.sendEvent(
137
+ bluxClient.sendEvent(
138
138
  new AddPurchaseEvent({
139
- itemId: "ITEM_ID",
139
+ item_id: "ITEM_ID",
140
140
  price: 1000,
141
141
  }),
142
142
  );
@@ -144,13 +144,13 @@ BluxClient.sendEvent(
144
144
 
145
145
  ```typescript
146
146
  // 복수 상품을 구매한 경우
147
- BluxClient.sendEvent([
147
+ bluxClient.sendEvent([
148
148
  new AddPurchaseEvent({
149
- itemId: "ITEM_ID_1",
149
+ item_id: "ITEM_ID_1",
150
150
  price: 1000,
151
151
  }),
152
152
  new AddPurchaseEvent({
153
- itemId: "ITEM_ID_2",
153
+ item_id: "ITEM_ID_2",
154
154
  price: 2000,
155
155
  }),
156
156
  ]);
@@ -0,0 +1,35 @@
1
+ {
2
+ "name": "@blux.ai/web-sdk",
3
+ "version": "1.0.0-rc1",
4
+ "description": "The official Blux JavaScript browser client library",
5
+ "main": "dist/index.js",
6
+ "module": "dist/index.js",
7
+ "types": "dist/index.d.ts",
8
+ "license": "UNLICENSED",
9
+ "scripts": {
10
+ "test": "jest",
11
+ "build": "tsc",
12
+ "dev": "yarn build -w",
13
+ "prepack": "rm -rf dist && yarn build",
14
+ "deploy": "npm publish --access public"
15
+ },
16
+ "author": "Z.Ai Inc.",
17
+ "homepage": "https://www.blux.ai/",
18
+ "devDependencies": {
19
+ "@sentry/types": "^8.35.0",
20
+ "@types/uuid": "^10.0.0",
21
+ "typescript": "^4.6.3"
22
+ },
23
+ "dependencies": {
24
+ "axios": "1.7.7",
25
+ "bson-objectid": "^2.0.4",
26
+ "dayjs": "1.11.13",
27
+ "lodash": "4.17.21",
28
+ "rxjs": "^7.8.1",
29
+ "uuid": "^10.0.0",
30
+ "zod": "3.23.8"
31
+ },
32
+ "installConfig": {
33
+ "hoistingLimits": "workspaces"
34
+ }
35
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blux.ai/web-sdk",
3
- "version": "0.0.7",
3
+ "version": "1.0.0-rc1",
4
4
  "description": "The official Blux JavaScript browser client library",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.js",
@@ -21,7 +21,7 @@
21
21
  "typescript": "^4.6.3"
22
22
  },
23
23
  "dependencies": {
24
- "axios": "^1.7.2",
24
+ "axios": "1.7.7",
25
25
  "bson-objectid": "^2.0.4",
26
26
  "dayjs": "1.11.13",
27
27
  "lodash": "4.17.21",
@@ -1,29 +0,0 @@
1
- /* eslint-disable no-undef */
2
-
3
- module.exports = {
4
- webpack: {
5
- configure: (config) => {
6
- // ...
7
- const fileLoaderRule = getFileLoaderRule(config.module.rules);
8
- if (!fileLoaderRule) {
9
- throw new Error("File loader not found");
10
- }
11
- fileLoaderRule.exclude.push(/\.cjs$/);
12
- // ...
13
- return config;
14
- },
15
- },
16
- };
17
-
18
- function getFileLoaderRule(rules) {
19
- for (const rule of rules) {
20
- if ("oneOf" in rule) {
21
- const found = getFileLoaderRule(rule.oneOf);
22
- if (found) {
23
- return found;
24
- }
25
- } else if (rule.test === undefined && rule.type === "asset/resource") {
26
- return rule;
27
- }
28
- }
29
- }
package/demo/package.json DELETED
@@ -1,50 +0,0 @@
1
- {
2
- "name": "demo",
3
- "version": "0.1.0",
4
- "private": true,
5
- "dependencies": {
6
- "@blux.ai/web-sdk": "workspace:*",
7
- "@testing-library/jest-dom": "^5.14.1",
8
- "@testing-library/react": "^13.0.0",
9
- "@types/jest": "^27.0.1",
10
- "@types/node": "^16.7.13",
11
- "@types/react": "^18.0.0",
12
- "@types/react-dom": "^18.0.0",
13
- "react": "^18.3.1",
14
- "react-dom": "^18.3.1",
15
- "react-scripts": "5.0.1",
16
- "typescript": "^4.4.2",
17
- "web-vitals": "^2.1.0"
18
- },
19
- "scripts": {
20
- "start": "craco start",
21
- "build": "craco build",
22
- "test": "craco test",
23
- "eject": "react-scripts eject"
24
- },
25
- "eslintConfig": {
26
- "extends": [
27
- "react-app",
28
- "react-app/jest"
29
- ]
30
- },
31
- "browserslist": {
32
- "production": [
33
- ">0.2%",
34
- "not dead",
35
- "not op_mini all"
36
- ],
37
- "development": [
38
- "last 1 chrome version",
39
- "last 1 firefox version",
40
- "last 1 safari version"
41
- ]
42
- },
43
- "devDependencies": {
44
- "@craco/craco": "^7.1.0",
45
- "tailwindcss": "^3.4.4"
46
- },
47
- "installConfig": {
48
- "hoistingLimits": "workspaces"
49
- }
50
- }
Binary file
@@ -1,43 +0,0 @@
1
- <!doctype html>
2
- <html lang="en">
3
- <head>
4
- <meta charset="utf-8" />
5
- <link rel="icon" href="%PUBLIC_URL%/favicon.ico" />
6
- <meta name="viewport" content="width=device-width, initial-scale=1" />
7
- <meta name="theme-color" content="#000000" />
8
- <meta
9
- name="description"
10
- content="Web site created using create-react-app"
11
- />
12
- <link rel="apple-touch-icon" href="%PUBLIC_URL%/logo192.png" />
13
- <!--
14
- manifest.json provides metadata used when your web app is installed on a
15
- user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/
16
- -->
17
- <link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
18
- <!--
19
- Notice the use of %PUBLIC_URL% in the tags above.
20
- It will be replaced with the URL of the `public` folder during the build.
21
- Only files inside the `public` folder can be referenced from the HTML.
22
-
23
- Unlike "/favicon.ico" or "favicon.ico", "%PUBLIC_URL%/favicon.ico" will
24
- work correctly both with client-side routing and a non-root public URL.
25
- Learn how to configure a non-root public URL by running `npm run build`.
26
- -->
27
- <title>React App</title>
28
- </head>
29
- <body>
30
- <noscript>You need to enable JavaScript to run this app.</noscript>
31
- <div id="root"></div>
32
- <!--
33
- This HTML file is a template.
34
- If you open it directly in the browser, you will see an empty page.
35
-
36
- You can add webfonts, meta tags, or analytics to this file.
37
- The build step will place the bundled scripts into the <body> tag.
38
-
39
- To begin the development, run `npm start` or `yarn start`.
40
- To create a production bundle, use `npm run build` or `yarn build`.
41
- -->
42
- </body>
43
- </html>
Binary file
Binary file
@@ -1,25 +0,0 @@
1
- {
2
- "short_name": "React App",
3
- "name": "Create React App Sample",
4
- "icons": [
5
- {
6
- "src": "favicon.ico",
7
- "sizes": "64x64 32x32 24x24 16x16",
8
- "type": "image/x-icon"
9
- },
10
- {
11
- "src": "logo192.png",
12
- "type": "image/png",
13
- "sizes": "192x192"
14
- },
15
- {
16
- "src": "logo512.png",
17
- "type": "image/png",
18
- "sizes": "512x512"
19
- }
20
- ],
21
- "start_url": ".",
22
- "display": "standalone",
23
- "theme_color": "#000000",
24
- "background_color": "#ffffff"
25
- }
@@ -1,3 +0,0 @@
1
- # https://www.robotstxt.org/robotstxt.html
2
- User-agent: *
3
- Disallow:
@@ -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,252 +0,0 @@
1
- import { useState } from "react";
2
- import { AddCustomEvent, ItemRecommendation, BluxClient } from "@blux.ai/web-sdk";
3
-
4
- const bluxClient = new BluxClient("stg");
5
- bluxClient.setLogLevel("debug");
6
-
7
- const searchParams = new URL(window.location.href).searchParams;
8
- const APPLICATION_ID_FROM_QUERY_PARAMS = searchParams.get("application_id");
9
- const API_KEY_FROM_QUERY_PARAMS = searchParams.get("api_key");
10
- const PHONE_NUMBER_FROM_QUERY_PARAMS = searchParams.get("phone_number");
11
- const EMAIL_FROM_QUERY_PARAMS = searchParams.get("email");
12
-
13
- function App() {
14
- const [applicationId, setApplicationId] = useState<string>(
15
- APPLICATION_ID_FROM_QUERY_PARAMS ?? "",
16
- );
17
- const [bluxApiKey, setBluxApiKey] = useState<string>(
18
- API_KEY_FROM_QUERY_PARAMS ?? "",
19
- );
20
-
21
- const [userId, signIn] = useState<string>(
22
- `test_user_id_${Math.floor(Math.random() * 100)}`,
23
- );
24
-
25
- const [telNumber, setTelNumber] = useState<string>(
26
- PHONE_NUMBER_FROM_QUERY_PARAMS ?? "",
27
- );
28
- const [email, setEmail] = useState<string>(EMAIL_FROM_QUERY_PARAMS ?? "");
29
- const [customKey, setCustomKey] = useState<string>("custom_key");
30
- const [customValue, setCustomValue] = useState<string>("custom_value");
31
- const [eventType, setEventType] = useState<string>("custom_event_type");
32
- const [itemId, setItemId] = useState<string>("item_id_3");
33
-
34
- // Recommendation Related States
35
- const [callType, setCallType] = useState<string>("");
36
- const [limit, setLimit] = useState<number>(10);
37
- const [offset, setOffset] = useState<number>(0);
38
- const [recommendationItemIds, setRecommendationItemIds] = useState<string>("ITEM_ID_1, ITEM_ID_2, ITEM_ID_3");
39
-
40
- const [isInitialized, setIsInitialized] = useState<boolean>(false);
41
-
42
- return (
43
- <div className="p-10">
44
- <div className="input-container flex flex-col">
45
- <div>BluxUser</div>
46
- <div>
47
- {bluxClient.bluxUser$.value
48
- ? JSON.stringify(bluxClient.bluxUser$.value, null, 2)
49
- : "not initialized"}
50
- </div>
51
- <div className="flex">
52
- <div>
53
- <div>ApplicationId</div>
54
- <input
55
- className="w-[500px] rounded-md border-black border-2"
56
- type="text"
57
- placeholder="Enter Application Id"
58
- value={applicationId}
59
- onChange={(e) => setApplicationId(e.target.value)}
60
- />
61
- <div className="mt-3">BluxApiKey</div>
62
- <input
63
- className="w-[500px] rounded-md border-black border-2"
64
- type="text"
65
- placeholder="Enter Blux API Key"
66
- value={bluxApiKey}
67
- onChange={(e) => setBluxApiKey(e.target.value)}
68
- />
69
- <div className="mt-3">User Id</div>
70
- <input
71
- className="w-[500px] rounded-md border-black border-2"
72
- type="text"
73
- placeholder="Enter User Id"
74
- value={userId}
75
- onChange={(e) => signIn(e.target.value)}
76
- />
77
- <div className="mt-3">Phone Number</div>
78
- <input
79
- className="w-[500px] rounded-md border-black border-2"
80
- type="text"
81
- placeholder="Enter phone number"
82
- value={telNumber}
83
- onChange={(e) => setTelNumber(e.target.value)}
84
- />
85
- <div className="mt-3">Email</div>
86
- <input
87
- className="w-[500px] rounded-md border-black border-2"
88
- type="text"
89
- placeholder="Enter email"
90
- value={email}
91
- onChange={(e) => setEmail(e.target.value)}
92
- />
93
- <div className="mt-3">CustomKey</div>
94
- <input
95
- className="w-[500px] rounded-md border-black border-2"
96
- type="text"
97
- placeholder="Enter custom key"
98
- value={customKey}
99
- onChange={(e) => setCustomKey(e.target.value)}
100
- />
101
- <div className="mt-3">CustomValue</div>
102
- <input
103
- className="w-[500px] rounded-md border-black border-2"
104
- type="text"
105
- placeholder="Enter custom value"
106
- value={customValue}
107
- onChange={(e) => setCustomValue(e.target.value)}
108
- />
109
- <div className="mt-3">CustomEventType</div>
110
- <input
111
- className="w-[500px] rounded-md border-black border-2"
112
- type="text"
113
- placeholder="Enter custom event type"
114
- value={eventType}
115
- onChange={(e) => setEventType(e.target.value)}
116
- />
117
- <div className="mt-3">CustomEvent ItemId</div>
118
- <input
119
- className="w-[500px] rounded-md border-black border-2"
120
- type="text"
121
- placeholder="Enter custom event item id"
122
- value={itemId}
123
- onChange={(e) => setItemId(e.target.value)}
124
- />
125
- </div>
126
- <div>
127
- <div className="mt-3 ml-10">RecommendationCallType</div>
128
- <input
129
- className="w-[500px] rounded-md border-black border-2 ml-10"
130
- type="text"
131
- placeholder="Enter call type for item recommendation"
132
- value={callType}
133
- onChange={(e) => setCallType(e.target.value)}
134
- />
135
- <div className="ml-10">RecommendationLimit</div>
136
- <input
137
- className="w-[500px] rounded-md border-black border-2 ml-10"
138
- type="text"
139
- placeholder="Enter recommendation limit"
140
- value={limit}
141
- onChange={(e) => setLimit(Number(e.target.value))}
142
- />
143
- <div className="mt-3 ml-10">RecommendationOffset</div>
144
- <input
145
- className="w-[500px] rounded-md border-black border-2 ml-10"
146
- type="text"
147
- placeholder="Enter recommendation offset"
148
- value={offset}
149
- onChange={(e) => setOffset(Number(e.target.value))}
150
- />
151
- <div className="mt-3 ml-10">RecommendationItemIds</div>
152
- <input
153
- className="w-[500px] rounded-md border-black border-2 ml-10"
154
- type="text"
155
- placeholder="Enter recommendation item ids (comma separated)"
156
- value={recommendationItemIds}
157
- onChange={(e) => setRecommendationItemIds(e.target.value)}
158
- />
159
- </div>
160
- </div>
161
- </div>
162
- <div className="mt-10 flex gap-4 w-[1000px] flex-wrap">
163
- <button
164
- className="bg-blue-500 rounded-md p-4 disabled:bg-gray-300"
165
- onClick={() =>
166
- bluxClient
167
- .init({ applicationId, bluxApiKey })
168
- .then((isSuccess) => setIsInitialized(isSuccess))
169
- }
170
- disabled={applicationId === "" || bluxApiKey === ""}
171
- >
172
- init
173
- </button>
174
- <button
175
- className="bg-blue-500 rounded-md p-4 disabled:bg-gray-300"
176
- onClick={() => bluxClient.signIn(userId)}
177
- disabled={!isInitialized}
178
- >
179
- signIn
180
- </button>
181
- <button
182
- className="bg-blue-500 rounded-md p-4 disabled:bg-gray-300"
183
- onClick={() => bluxClient.signOut()}
184
- disabled={!isInitialized}
185
- >
186
- signOut
187
- </button>
188
- <button
189
- className="bg-blue-500 rounded-md p-4 disabled:bg-gray-300"
190
- onClick={() =>
191
- bluxClient.setUserProperties({ phone_number: telNumber })
192
- }
193
- disabled={!isInitialized}
194
- >
195
- setUserProperties (phone number)
196
- </button>
197
- <button
198
- className="bg-blue-500 rounded-md p-4 disabled:bg-gray-300"
199
- onClick={() => bluxClient.setUserProperties({ email_address: email })}
200
- disabled={!isInitialized}
201
- >
202
- setUserProperties (email)
203
- </button>
204
- <button
205
- className="bg-blue-500 rounded-md p-4 disabled:bg-gray-300"
206
- onClick={() =>
207
- bluxClient.setCustomUserProperties({ [customKey]: customValue })
208
- }
209
- disabled={!isInitialized}
210
- >
211
- setCustomProperties
212
- </button>
213
- <button
214
- className="bg-blue-500 rounded-md p-4 disabled:bg-gray-300"
215
- onClick={() =>
216
- bluxClient.sendEvent(
217
- new AddCustomEvent({
218
- item_id: itemId,
219
- event_properties: { [customKey]: customValue },
220
- event_type: eventType,
221
- }),
222
- )
223
- }
224
- disabled={!isInitialized}
225
- >
226
- sendCustomEvent
227
- </button>
228
- <button
229
- className="bg-blue-500 rounded-md p-4 disabled:bg-gray-300"
230
- onClick={async () =>
231
- {
232
- const recommendationResponse = await bluxClient.getItemRecommendation(
233
- new ItemRecommendation({
234
- call_type: callType,
235
- limit,
236
- offset,
237
- item_ids: recommendationItemIds ? recommendationItemIds.split(","): undefined,
238
- }),
239
- )
240
- console.log(recommendationResponse);
241
- }
242
- }
243
- disabled={!isInitialized || callType === ""}
244
- >
245
- getItemRecommendation
246
- </button>
247
- </div>
248
- </div>
249
- );
250
- }
251
-
252
- export default App;
@@ -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
- }
@@ -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;
@@ -1,5 +0,0 @@
1
- // jest-dom adds custom jest matchers for asserting on DOM nodes.
2
- // allows you to do things like:
3
- // expect(element).toHaveTextContent(/react/i)
4
- // learn more: https://github.com/testing-library/jest-dom
5
- import "@testing-library/jest-dom";
@@ -1,10 +0,0 @@
1
- /* eslint-disable no-undef */
2
-
3
- /** @type {import('tailwindcss').Config} */
4
- module.exports = {
5
- content: ["./src/**/*.{js,jsx,ts,tsx}"],
6
- theme: {
7
- extend: {},
8
- },
9
- plugins: [],
10
- };