@blux.ai/web-sdk 0.0.5 → 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.
Files changed (115) hide show
  1. package/README.md +4 -4
  2. package/demo/craco.config.js +2 -0
  3. package/demo/package.json +4 -2
  4. package/demo/public/index.html +1 -1
  5. package/demo/tailwind.config.js +2 -0
  6. package/dist/BluxClient.d.ts +14 -13
  7. package/dist/BluxClient.js +180 -324
  8. package/dist/BluxClient.js.map +1 -1
  9. package/dist/apis/createEvent.d.ts +4 -0
  10. package/dist/apis/createEvent.js +7 -0
  11. package/dist/apis/createEvent.js.map +1 -0
  12. package/dist/apis/getItemRecommendation.d.ts +4 -0
  13. package/dist/apis/getItemRecommendation.js +7 -0
  14. package/dist/apis/getItemRecommendation.js.map +1 -0
  15. package/dist/apis/initialize.d.ts +4 -0
  16. package/dist/apis/initialize.js +7 -0
  17. package/dist/apis/initialize.js.map +1 -0
  18. package/dist/apis/signIn.d.ts +4 -0
  19. package/dist/apis/signIn.js +7 -0
  20. package/dist/apis/signIn.js.map +1 -0
  21. package/dist/apis/signOut.d.ts +4 -0
  22. package/dist/apis/signOut.js +7 -0
  23. package/dist/apis/signOut.js.map +1 -0
  24. package/dist/apis/updateCustomUserProperties.d.ts +4 -0
  25. package/dist/apis/updateCustomUserProperties.js +7 -0
  26. package/dist/apis/updateCustomUserProperties.js.map +1 -0
  27. package/dist/apis/updateUserProperties.d.ts +4 -0
  28. package/dist/apis/updateUserProperties.js +7 -0
  29. package/dist/apis/updateUserProperties.js.map +1 -0
  30. package/dist/constants/URLS.d.ts +1 -7
  31. package/dist/constants/URLS.js +3 -15
  32. package/dist/constants/URLS.js.map +1 -1
  33. package/dist/events/AddCartaddEvent.d.ts +2 -2
  34. package/dist/events/AddCartaddEvent.js +9 -40
  35. package/dist/events/AddCartaddEvent.js.map +1 -1
  36. package/dist/events/AddCustomEvent.d.ts +2 -2
  37. package/dist/events/AddCustomEvent.js +11 -42
  38. package/dist/events/AddCustomEvent.js.map +1 -1
  39. package/dist/events/AddLikeEvent.d.ts +2 -2
  40. package/dist/events/AddLikeEvent.js +9 -40
  41. package/dist/events/AddLikeEvent.js.map +1 -1
  42. package/dist/events/AddPageViewEvent.d.ts +2 -2
  43. package/dist/events/AddPageViewEvent.js +9 -38
  44. package/dist/events/AddPageViewEvent.js.map +1 -1
  45. package/dist/events/AddProductDetailViewEvent.d.ts +2 -2
  46. package/dist/events/AddProductDetailViewEvent.js +11 -41
  47. package/dist/events/AddProductDetailViewEvent.js.map +1 -1
  48. package/dist/events/AddPurchaseEvent.d.ts +2 -2
  49. package/dist/events/AddPurchaseEvent.js +11 -39
  50. package/dist/events/AddPurchaseEvent.js.map +1 -1
  51. package/dist/events/AddRateEvent.d.ts +2 -2
  52. package/dist/events/AddRateEvent.js +9 -40
  53. package/dist/events/AddRateEvent.js.map +1 -1
  54. package/dist/events/AddRecommendationViewEvent.d.ts +2 -2
  55. package/dist/events/AddRecommendationViewEvent.js +8 -39
  56. package/dist/events/AddRecommendationViewEvent.js.map +1 -1
  57. package/dist/events/Event.d.ts +2 -2
  58. package/dist/events/Event.js +11 -25
  59. package/dist/events/Event.js.map +1 -1
  60. package/dist/events/VisitEvent.d.ts +5 -0
  61. package/dist/events/VisitEvent.js +11 -0
  62. package/dist/events/VisitEvent.js.map +1 -0
  63. package/dist/events/index.js +9 -28
  64. package/dist/events/index.js.map +1 -1
  65. package/dist/events/types.d.ts +6 -10
  66. package/dist/events/types.js +2 -6
  67. package/dist/events/types.js.map +1 -1
  68. package/dist/index.d.ts +3 -1
  69. package/dist/index.js +6 -23
  70. package/dist/index.js.map +1 -1
  71. package/dist/recommendations/ItemRecommendation.d.ts +5 -0
  72. package/dist/recommendations/ItemRecommendation.js +12 -0
  73. package/dist/recommendations/ItemRecommendation.js.map +1 -0
  74. package/dist/recommendations/Recommendation.d.ts +5 -0
  75. package/dist/recommendations/Recommendation.js +9 -0
  76. package/dist/recommendations/Recommendation.js.map +1 -0
  77. package/dist/recommendations/index.d.ts +1 -0
  78. package/dist/recommendations/index.js +2 -0
  79. package/dist/recommendations/index.js.map +1 -0
  80. package/dist/recommendations/types.d.ts +11 -0
  81. package/dist/recommendations/types.js +2 -0
  82. package/dist/recommendations/types.js.map +1 -0
  83. package/dist/utils/LocalStorage.js +14 -0
  84. package/dist/utils/LocalStorage.js.map +1 -0
  85. package/dist/{core → utils}/Logger.d.ts +1 -1
  86. package/dist/utils/Logger.js +49 -0
  87. package/dist/utils/Logger.js.map +1 -0
  88. package/dist/utils/getPath.d.ts +1 -0
  89. package/dist/utils/getPath.js +4 -0
  90. package/dist/utils/getPath.js.map +1 -0
  91. package/dist/utils/helper.js +2 -9
  92. package/dist/utils/helper.js.map +1 -1
  93. package/dist/utils/operators.d.ts +1 -1
  94. package/dist/utils/operators.js +5 -11
  95. package/dist/utils/operators.js.map +1 -1
  96. package/package.json +7 -6
  97. package/.prettierrc +0 -4
  98. package/.sentryclirc +0 -3
  99. package/demo/README.md +0 -46
  100. package/demo/src/App.test.tsx +0 -9
  101. package/demo/src/App.tsx +0 -158
  102. package/demo/src/index.css +0 -16
  103. package/demo/src/index.tsx +0 -19
  104. package/demo/src/react-app-env.d.ts +0 -1
  105. package/demo/src/reportWebVitals.ts +0 -15
  106. package/demo/src/setupTests.ts +0 -5
  107. package/demo/yarn.lock +0 -10120
  108. package/dist/core/LocalStorage.js +0 -21
  109. package/dist/core/LocalStorage.js.map +0 -1
  110. package/dist/core/Logger.js +0 -88
  111. package/dist/core/Logger.js.map +0 -1
  112. package/dist/utils/sentry.d.ts +0 -2
  113. package/dist/utils/sentry.js +0 -50
  114. package/dist/utils/sentry.js.map +0 -1
  115. /package/dist/{core → utils}/LocalStorage.d.ts +0 -0
@@ -0,0 +1,49 @@
1
+ const consoleMethodByLevel = {
2
+ debug: console.debug.bind(console),
3
+ log: console.log.bind(console),
4
+ warning: console.warn.bind(console),
5
+ error: console.error.bind(console),
6
+ fatal: console.error.bind(console),
7
+ };
8
+ const LOG_LEVEL_ORDERS = {
9
+ debug: 0,
10
+ log: 1,
11
+ warning: 2,
12
+ error: 3,
13
+ fatal: 4,
14
+ };
15
+ // eslint-disable-next-line @typescript-eslint/no-extraneous-class
16
+ export class Logger {
17
+ static logLevel = "error";
18
+ static base(message, level, context) {
19
+ if (LOG_LEVEL_ORDERS[level] >= LOG_LEVEL_ORDERS[this.logLevel]) {
20
+ const logForConsole = ["[BluxClient]", message];
21
+ if (context?.extra) {
22
+ logForConsole.push(context.extra);
23
+ }
24
+ if (context?.tags) {
25
+ logForConsole.push(context.tags);
26
+ }
27
+ consoleMethodByLevel[level]?.(...logForConsole);
28
+ }
29
+ }
30
+ static debug(message, context) {
31
+ this.base(message, "debug", context);
32
+ }
33
+ static log(message, context) {
34
+ this.base(message, "log", context);
35
+ }
36
+ static warning(message, context) {
37
+ this.base(message, "warning", context);
38
+ }
39
+ static error(message, context) {
40
+ this.base(message, "error", context);
41
+ }
42
+ static fatal(message, context) {
43
+ this.base(message, "fatal", context);
44
+ }
45
+ static setLevel(level) {
46
+ this.logLevel = level;
47
+ }
48
+ }
49
+ //# sourceMappingURL=Logger.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Logger.js","sourceRoot":"/","sources":["utils/Logger.ts"],"names":[],"mappings":"AAGA,MAAM,oBAAoB,GAAG;IAC3B,KAAK,EAAE,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC;IAClC,GAAG,EAAE,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC;IAC9B,OAAO,EAAE,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC;IACnC,KAAK,EAAE,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC;IAClC,KAAK,EAAE,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC;CAC1B,CAAC;AAIX,MAAM,gBAAgB,GAAG;IACvB,KAAK,EAAE,CAAC;IACR,GAAG,EAAE,CAAC;IACN,OAAO,EAAE,CAAC;IACV,KAAK,EAAE,CAAC;IACR,KAAK,EAAE,CAAC;CACT,CAAC;AAIF,kEAAkE;AAClE,MAAM,OAAO,MAAM;IACV,MAAM,CAAC,QAAQ,GAAa,OAAO,CAAC;IAEnC,MAAM,CAAC,IAAI,CACjB,OAAuB,EACvB,KAAe,EACf,OAAiB;QAEjB,IAAI,gBAAgB,CAAC,KAAK,CAAC,IAAI,gBAAgB,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE;YAC9D,MAAM,aAAa,GAAc,CAAC,cAAc,EAAE,OAAO,CAAC,CAAC;YAE3D,IAAI,OAAO,EAAE,KAAK,EAAE;gBAClB,aAAa,CAAC,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;aACnC;YACD,IAAI,OAAO,EAAE,IAAI,EAAE;gBACjB,aAAa,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;aAClC;YAED,oBAAoB,CAAC,KAAK,CAAC,EAAE,CAAC,GAAG,aAAa,CAAC,CAAC;SACjD;IACH,CAAC;IACM,MAAM,CAAC,KAAK,CAAC,OAAuB,EAAE,OAAiB;QAC5D,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;IACvC,CAAC;IACM,MAAM,CAAC,GAAG,CAAC,OAAuB,EAAE,OAAiB;QAC1D,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC;IACrC,CAAC;IACM,MAAM,CAAC,OAAO,CAAC,OAAuB,EAAE,OAAiB;QAC9D,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,SAAS,EAAE,OAAO,CAAC,CAAC;IACzC,CAAC;IACM,MAAM,CAAC,KAAK,CAAC,OAAuB,EAAE,OAAiB;QAC5D,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;IACvC,CAAC;IACM,MAAM,CAAC,KAAK,CAAC,OAAuB,EAAE,OAAiB;QAC5D,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;IACvC,CAAC;IAEM,MAAM,CAAC,QAAQ,CAAC,KAAe;QACpC,IAAI,CAAC,QAAQ,GAAG,KAAK,CAAC;IACxB,CAAC","sourcesContent":["/* eslint-disable no-console */\nimport type { ScopeContext } from \"@sentry/types\";\n\nconst consoleMethodByLevel = {\n debug: console.debug.bind(console),\n log: console.log.bind(console),\n warning: console.warn.bind(console),\n error: console.error.bind(console),\n fatal: console.error.bind(console),\n} as const;\n\nexport type LogLevel = \"debug\" | \"log\" | \"warning\" | \"error\" | \"fatal\";\n\nconst LOG_LEVEL_ORDERS = {\n debug: 0,\n log: 1,\n warning: 2,\n error: 3,\n fatal: 4,\n};\n\nexport type Context = Partial<Pick<ScopeContext, \"tags\" | \"extra\">>;\n\n// eslint-disable-next-line @typescript-eslint/no-extraneous-class\nexport class Logger {\n public static logLevel: LogLevel = \"error\";\n\n private static base(\n message: string | Error,\n level: LogLevel,\n context?: Context,\n ) {\n if (LOG_LEVEL_ORDERS[level] >= LOG_LEVEL_ORDERS[this.logLevel]) {\n const logForConsole: unknown[] = [\"[BluxClient]\", message];\n\n if (context?.extra) {\n logForConsole.push(context.extra);\n }\n if (context?.tags) {\n logForConsole.push(context.tags);\n }\n\n consoleMethodByLevel[level]?.(...logForConsole);\n }\n }\n public static debug(message: string | Error, context?: Context) {\n this.base(message, \"debug\", context);\n }\n public static log(message: string | Error, context?: Context) {\n this.base(message, \"log\", context);\n }\n public static warning(message: string | Error, context?: Context) {\n this.base(message, \"warning\", context);\n }\n public static error(message: string | Error, context?: Context) {\n this.base(message, \"error\", context);\n }\n public static fatal(message: string | Error, context?: Context) {\n this.base(message, \"fatal\", context);\n }\n\n public static setLevel(level: LogLevel) {\n this.logLevel = level;\n }\n}\n"]}
@@ -0,0 +1 @@
1
+ export declare function getPath(path: string, pathParams: Record<string, string>): string;
@@ -0,0 +1,4 @@
1
+ export function getPath(path, pathParams) {
2
+ return Object.keys(pathParams).reduce((acc, key) => acc.replace(`{${key}}`, pathParams[key]), path);
3
+ }
4
+ //# sourceMappingURL=getPath.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getPath.js","sourceRoot":"/","sources":["utils/getPath.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,OAAO,CAAC,IAAY,EAAE,UAAkC;IACtE,OAAO,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,OAAO,CAAC,IAAI,GAAG,GAAG,EAAE,UAAU,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC;AACtG,CAAC","sourcesContent":["export function getPath(path: string, pathParams: Record<string, string>) {\n return Object.keys(pathParams).reduce((acc, key) => acc.replace(`{${key}}`, pathParams[key]), path);\n}\n"]}
@@ -1,11 +1,4 @@
1
- "use strict";
2
- !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},n=(new Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="985a57e3-68a3-52dc-9464-c6ab04aab3b5")}catch(e){}}();
3
-
4
- exports.__esModule = true;
5
- exports.getCurrentUnixTimestamp = void 0;
6
- var getCurrentUnixTimestamp = function () {
1
+ export const getCurrentUnixTimestamp = () => {
7
2
  return new Date().getTime() / 1e3;
8
3
  };
9
- exports.getCurrentUnixTimestamp = getCurrentUnixTimestamp;
10
- //# sourceMappingURL=helper.js.map
11
- //# debugId=985a57e3-68a3-52dc-9464-c6ab04aab3b5
4
+ //# sourceMappingURL=helper.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"helper.js","sources":["utils/helper.ts"],"sourceRoot":"/","sourcesContent":["export const getCurrentUnixTimestamp = () => {\n return new Date().getTime() / 1e3;\n};\n"],"names":[],"mappings":";;;;;AAAO,IAAM,uBAAuB,GAAG;IACrC,OAAO,IAAI,IAAI,EAAE,CAAC,OAAO,EAAE,GAAG,GAAG,CAAC;AACpC,CAAC,CAAC;AAFW,QAAA,uBAAuB,2BAElC","debug_id":"985a57e3-68a3-52dc-9464-c6ab04aab3b5"}
1
+ {"version":3,"file":"helper.js","sourceRoot":"/","sources":["utils/helper.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,uBAAuB,GAAG,GAAG,EAAE;IAC1C,OAAO,IAAI,IAAI,EAAE,CAAC,OAAO,EAAE,GAAG,GAAG,CAAC;AACpC,CAAC,CAAC","sourcesContent":["export const getCurrentUnixTimestamp = () => {\n return new Date().getTime() / 1e3;\n};\n"]}
@@ -1,2 +1,2 @@
1
- import { OperatorFunction } from "rxjs";
1
+ import type { OperatorFunction } from "rxjs";
2
2
  export declare function filterNullable<T>(): OperatorFunction<T | null | undefined, T>;
@@ -1,12 +1,6 @@
1
- "use strict";
2
- !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},n=(new Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="95b6898a-b9b8-5e37-9ad4-08b9bcf66acc")}catch(e){}}();
3
-
4
- exports.__esModule = true;
5
- exports.filterNullable = void 0;
6
- var rxjs_1 = require("rxjs");
7
- function filterNullable() {
8
- return (0, rxjs_1.filter)(function (v) { return v != null; });
1
+ import { filter } from "rxjs";
2
+ export function filterNullable() {
3
+ // eslint-disable-next-line no-eq-null,eqeqeq
4
+ return filter((v) => v != null);
9
5
  }
10
- exports.filterNullable = filterNullable;
11
- //# sourceMappingURL=operators.js.map
12
- //# debugId=95b6898a-b9b8-5e37-9ad4-08b9bcf66acc
6
+ //# sourceMappingURL=operators.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"operators.js","sources":["utils/operators.ts"],"sourceRoot":"/","sourcesContent":["import { filter, OperatorFunction } from \"rxjs\";\n\nexport function filterNullable<T>(): OperatorFunction<T | null | undefined, T> {\n return filter((v): v is T => v != null);\n}\n"],"names":[],"mappings":";;;;;AAAA,6BAAgD;AAEhD,SAAgB,cAAc;IAC5B,OAAO,IAAA,aAAM,EAAC,UAAC,CAAC,IAAa,OAAA,CAAC,IAAI,IAAI,EAAT,CAAS,CAAC,CAAC;AAC1C,CAAC;AAFD,wCAEC","debug_id":"95b6898a-b9b8-5e37-9ad4-08b9bcf66acc"}
1
+ {"version":3,"file":"operators.js","sourceRoot":"/","sources":["utils/operators.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AAE9B,MAAM,UAAU,cAAc;IAC5B,6CAA6C;IAC7C,OAAO,MAAM,CAAC,CAAC,CAAC,EAAU,EAAE,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC;AAC1C,CAAC","sourcesContent":["import type { OperatorFunction } from \"rxjs\";\nimport { filter } from \"rxjs\";\n\nexport function filterNullable<T>(): OperatorFunction<T | null | undefined, T> {\n // eslint-disable-next-line no-eq-null,eqeqeq\n return filter((v): v is T => v != null);\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blux.ai/web-sdk",
3
- "version": "0.0.5",
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 && yarn sentry:sourcemaps",
14
- "sentry:sourcemaps": "sentry-cli sourcemaps inject --org blux-engr --project blux-web-sdk ./dist && sentry-cli sourcemaps upload --org blux-engr --project blux-web-sdk ./dist",
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
- "@sentry/browser": "^8.15.0",
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
@@ -1,4 +0,0 @@
1
- {
2
- "tabWidth": 2,
3
- "singleQuote": false
4
- }
package/.sentryclirc DELETED
@@ -1,3 +0,0 @@
1
-
2
- [auth]
3
- token=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
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/).
@@ -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, signIn] = 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) => signIn(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.signIn(userId)}
103
- disabled={!isInitialized}
104
- >
105
- signIn
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;
@@ -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";