@blux.ai/web-sdk 0.0.6 → 1.0.0-rc0
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 +19 -19
- package/dist/package.json +35 -0
- package/package.json +5 -3
- package/dist/BluxClient.d.ts +0 -43
- package/dist/BluxClient.js +0 -190
- package/dist/BluxClient.js.map +0 -1
- package/dist/apis/createEvent.d.ts +0 -4
- package/dist/apis/createEvent.js +0 -7
- package/dist/apis/createEvent.js.map +0 -1
- package/dist/apis/getItemRecommendation.d.ts +0 -4
- package/dist/apis/getItemRecommendation.js +0 -7
- package/dist/apis/getItemRecommendation.js.map +0 -1
- package/dist/apis/initialize.d.ts +0 -4
- package/dist/apis/initialize.js +0 -7
- package/dist/apis/initialize.js.map +0 -1
- package/dist/apis/signIn.d.ts +0 -4
- package/dist/apis/signIn.js +0 -7
- package/dist/apis/signIn.js.map +0 -1
- package/dist/apis/signOut.d.ts +0 -4
- package/dist/apis/signOut.js +0 -7
- package/dist/apis/signOut.js.map +0 -1
- package/dist/apis/updateCustomUserProperties.d.ts +0 -4
- package/dist/apis/updateCustomUserProperties.js +0 -7
- package/dist/apis/updateCustomUserProperties.js.map +0 -1
- package/dist/apis/updateUserProperties.d.ts +0 -4
- package/dist/apis/updateUserProperties.js +0 -7
- package/dist/apis/updateUserProperties.js.map +0 -1
- package/dist/constants/URLS.d.ts +0 -6
- package/dist/constants/URLS.js +0 -7
- package/dist/constants/URLS.js.map +0 -1
- package/dist/events/AddCartaddEvent.d.ts +0 -5
- package/dist/events/AddCartaddEvent.js +0 -11
- package/dist/events/AddCartaddEvent.js.map +0 -1
- package/dist/events/AddCustomEvent.d.ts +0 -5
- package/dist/events/AddCustomEvent.js +0 -12
- package/dist/events/AddCustomEvent.js.map +0 -1
- package/dist/events/AddLikeEvent.d.ts +0 -5
- package/dist/events/AddLikeEvent.js +0 -11
- package/dist/events/AddLikeEvent.js.map +0 -1
- package/dist/events/AddPageViewEvent.d.ts +0 -5
- package/dist/events/AddPageViewEvent.js +0 -11
- package/dist/events/AddPageViewEvent.js.map +0 -1
- package/dist/events/AddProductDetailViewEvent.d.ts +0 -5
- package/dist/events/AddProductDetailViewEvent.js +0 -12
- package/dist/events/AddProductDetailViewEvent.js.map +0 -1
- package/dist/events/AddPurchaseEvent.d.ts +0 -5
- package/dist/events/AddPurchaseEvent.js +0 -13
- package/dist/events/AddPurchaseEvent.js.map +0 -1
- package/dist/events/AddRateEvent.d.ts +0 -5
- package/dist/events/AddRateEvent.js +0 -12
- package/dist/events/AddRateEvent.js.map +0 -1
- package/dist/events/AddRecommendationViewEvent.d.ts +0 -5
- package/dist/events/AddRecommendationViewEvent.js +0 -10
- package/dist/events/AddRecommendationViewEvent.js.map +0 -1
- package/dist/events/Event.d.ts +0 -5
- package/dist/events/Event.js +0 -12
- package/dist/events/Event.js.map +0 -1
- package/dist/events/VisitEvent.d.ts +0 -5
- package/dist/events/VisitEvent.js +0 -11
- package/dist/events/VisitEvent.js.map +0 -1
- package/dist/events/index.d.ts +0 -8
- package/dist/events/index.js +0 -9
- package/dist/events/index.js.map +0 -1
- package/dist/events/types.d.ts +0 -38
- package/dist/events/types.js +0 -2
- package/dist/events/types.js.map +0 -1
- package/dist/index.d.ts +0 -5
- package/dist/index.js +0 -6
- package/dist/index.js.map +0 -1
- package/dist/recommendations/ItemRecommendation.d.ts +0 -5
- package/dist/recommendations/ItemRecommendation.js +0 -12
- package/dist/recommendations/ItemRecommendation.js.map +0 -1
- package/dist/recommendations/Recommendation.d.ts +0 -5
- package/dist/recommendations/Recommendation.js +0 -9
- package/dist/recommendations/Recommendation.js.map +0 -1
- package/dist/recommendations/index.d.ts +0 -1
- package/dist/recommendations/index.js +0 -2
- package/dist/recommendations/index.js.map +0 -1
- package/dist/recommendations/types.d.ts +0 -11
- package/dist/recommendations/types.js +0 -2
- package/dist/recommendations/types.js.map +0 -1
- package/dist/utils/LocalStorage.d.ts +0 -4
- package/dist/utils/LocalStorage.js +0 -14
- package/dist/utils/LocalStorage.js.map +0 -1
- package/dist/utils/Logger.d.ts +0 -13
- package/dist/utils/Logger.js +0 -49
- package/dist/utils/Logger.js.map +0 -1
- package/dist/utils/getPath.d.ts +0 -1
- package/dist/utils/getPath.js +0 -4
- package/dist/utils/getPath.js.map +0 -1
- package/dist/utils/helper.d.ts +0 -1
- package/dist/utils/helper.js +0 -4
- package/dist/utils/helper.js.map +0 -1
- package/dist/utils/operators.d.ts +0 -2
- package/dist/utils/operators.js +0 -6
- package/dist/utils/operators.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.
|
|
24
|
-
|
|
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
|
-
|
|
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
|
-
|
|
54
|
-
phone_number: "
|
|
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
|
-
|
|
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
|
-
|
|
78
|
+
bluxClient.signOut();
|
|
79
79
|
```
|
|
80
80
|
|
|
81
81
|
### sendEvent
|
|
@@ -87,9 +87,9 @@ BluxClient.signOut();
|
|
|
87
87
|
---
|
|
88
88
|
|
|
89
89
|
```typescript
|
|
90
|
-
|
|
90
|
+
bluxClient.sendEvent(
|
|
91
91
|
new AddProductDetailViewEvent({
|
|
92
|
-
|
|
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
|
-
|
|
104
|
+
bluxClient.sendEvent(
|
|
105
105
|
new AddLikeEvent({
|
|
106
|
-
|
|
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
|
-
|
|
118
|
+
bluxClient.sendEvent(
|
|
119
119
|
new AddCartaddEvent({
|
|
120
|
-
|
|
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
|
-
|
|
137
|
+
bluxClient.sendEvent(
|
|
138
138
|
new AddPurchaseEvent({
|
|
139
|
-
|
|
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
|
-
|
|
147
|
+
bluxClient.sendEvent([
|
|
148
148
|
new AddPurchaseEvent({
|
|
149
|
-
|
|
149
|
+
item_id: "ITEM_ID_1",
|
|
150
150
|
price: 1000,
|
|
151
151
|
}),
|
|
152
152
|
new AddPurchaseEvent({
|
|
153
|
-
|
|
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-rc0",
|
|
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
|
|
3
|
+
"version": "1.0.0-rc0",
|
|
4
4
|
"description": "The official Blux JavaScript browser client library",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.js",
|
|
@@ -16,12 +16,14 @@
|
|
|
16
16
|
"author": "Z.Ai Inc.",
|
|
17
17
|
"homepage": "https://www.blux.ai/",
|
|
18
18
|
"devDependencies": {
|
|
19
|
+
"@sentry/types": "^8.35.0",
|
|
19
20
|
"@types/uuid": "^10.0.0",
|
|
20
21
|
"typescript": "^4.6.3"
|
|
21
22
|
},
|
|
22
23
|
"dependencies": {
|
|
23
|
-
"
|
|
24
|
-
"
|
|
24
|
+
"axios": "1.7.7",
|
|
25
|
+
"bson-objectid": "^2.0.4",
|
|
26
|
+
"dayjs": "1.11.13",
|
|
25
27
|
"lodash": "4.17.21",
|
|
26
28
|
"rxjs": "^7.8.1",
|
|
27
29
|
"uuid": "^10.0.0",
|
package/dist/BluxClient.d.ts
DELETED
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import { BehaviorSubject } from "rxjs";
|
|
2
|
-
import type { LogLevel } from "./utils/Logger";
|
|
3
|
-
import type { EventRequest } from "./events/types";
|
|
4
|
-
import type { Event } from "./events/Event";
|
|
5
|
-
import type { ItemRecommendationResponse } from "@blux.ai/common";
|
|
6
|
-
import type { Recommendation } from "./recommendations/Recommendation";
|
|
7
|
-
export type SdkInfo = {
|
|
8
|
-
type: string;
|
|
9
|
-
version: string;
|
|
10
|
-
};
|
|
11
|
-
type BluxUser = {
|
|
12
|
-
id: string;
|
|
13
|
-
bluxApiKey: string;
|
|
14
|
-
applicationId: string;
|
|
15
|
-
deviceId: string;
|
|
16
|
-
userId?: string;
|
|
17
|
-
};
|
|
18
|
-
export declare class BluxClient {
|
|
19
|
-
private readonly STAGE;
|
|
20
|
-
private readonly api;
|
|
21
|
-
private readonly sdkInfo;
|
|
22
|
-
readonly bluxUser$: BehaviorSubject<BluxUser | undefined>;
|
|
23
|
-
readonly requestQueue$: BehaviorSubject<EventRequest[]>;
|
|
24
|
-
constructor(STAGE?: "local" | "dev" | "stg" | "prod");
|
|
25
|
-
private generateApiHeader;
|
|
26
|
-
init({ applicationId, bluxApiKey, }: {
|
|
27
|
-
applicationId: string;
|
|
28
|
-
bluxApiKey: string;
|
|
29
|
-
}): Promise<boolean>;
|
|
30
|
-
setLogLevel(logLevel: LogLevel): void;
|
|
31
|
-
private getBluxUserWithTimeout;
|
|
32
|
-
signIn(userId: string): Promise<void>;
|
|
33
|
-
signOut(): Promise<void>;
|
|
34
|
-
setUserProperties(userProperties: {
|
|
35
|
-
phone_number?: string;
|
|
36
|
-
email_address?: string;
|
|
37
|
-
}): Promise<void>;
|
|
38
|
-
setCustomUserProperties(customUserProperties: Record<string, string | boolean | number | null>): Promise<void>;
|
|
39
|
-
sendEvent(event: Event | Event[]): void;
|
|
40
|
-
getItemRecommendation(recommendation: Recommendation): Promise<ItemRecommendationResponse>;
|
|
41
|
-
}
|
|
42
|
-
export declare const bluxClient: BluxClient;
|
|
43
|
-
export {};
|
package/dist/BluxClient.js
DELETED
|
@@ -1,190 +0,0 @@
|
|
|
1
|
-
import { asyncScheduler, BehaviorSubject, catchError, exhaustMap, filter, firstValueFrom, map, observeOn, throwError, timeout, withLatestFrom, } from "rxjs";
|
|
2
|
-
import { LocalStorage } from "./utils/LocalStorage";
|
|
3
|
-
import { Logger } from "./utils/Logger";
|
|
4
|
-
import axios from "axios";
|
|
5
|
-
import { filterNullable } from "./utils/operators";
|
|
6
|
-
import { API_URL_BY_STAGE } from "./constants/URLS";
|
|
7
|
-
import { DevicePlatform } from "@blux.ai/common";
|
|
8
|
-
import { initialize } from "./apis/initialize";
|
|
9
|
-
import { signIn } from "./apis/signIn";
|
|
10
|
-
import { signOut } from "./apis/signOut";
|
|
11
|
-
import { updateUserProperties } from "./apis/updateUserProperties";
|
|
12
|
-
import { updateCustomUserProperties } from "./apis/updateCustomUserProperties";
|
|
13
|
-
import { collectEvent } from "./apis/createEvent";
|
|
14
|
-
import { VisitEvent } from "./events/VisitEvent";
|
|
15
|
-
import { getItemRecommendation } from "./apis/getItemRecommendation";
|
|
16
|
-
export class BluxClient {
|
|
17
|
-
STAGE;
|
|
18
|
-
api;
|
|
19
|
-
sdkInfo = {
|
|
20
|
-
type: "browser",
|
|
21
|
-
version: "0.0.3",
|
|
22
|
-
};
|
|
23
|
-
bluxUser$ = new BehaviorSubject(undefined);
|
|
24
|
-
requestQueue$ = new BehaviorSubject([]);
|
|
25
|
-
constructor(STAGE = "prod") {
|
|
26
|
-
this.STAGE = STAGE;
|
|
27
|
-
this.api = axios.create({
|
|
28
|
-
baseURL: API_URL_BY_STAGE[this.STAGE],
|
|
29
|
-
});
|
|
30
|
-
this.requestQueue$
|
|
31
|
-
.pipe(filter((queue) => queue.length > 0), withLatestFrom(this.bluxUser$.pipe(filterNullable())), exhaustMap(async ([requests, bluxUser]) => {
|
|
32
|
-
try {
|
|
33
|
-
await collectEvent(this.api, {
|
|
34
|
-
blux_user_id: bluxUser.id,
|
|
35
|
-
application_id: bluxUser.applicationId,
|
|
36
|
-
}, {
|
|
37
|
-
events: requests.map((request) => ({
|
|
38
|
-
...request,
|
|
39
|
-
user_id: bluxUser.userId,
|
|
40
|
-
blux_id: bluxUser.id,
|
|
41
|
-
device_id: bluxUser.deviceId,
|
|
42
|
-
})),
|
|
43
|
-
}, this.generateApiHeader(bluxUser));
|
|
44
|
-
}
|
|
45
|
-
catch (error) {
|
|
46
|
-
// todo : retry
|
|
47
|
-
Logger.error(error, { tags: { from: "request-events-api" } });
|
|
48
|
-
}
|
|
49
|
-
return requests.map((r) => r.id); // todo: return successed requests only
|
|
50
|
-
}), map((requestIdsSucceeded) => this.requestQueue$.value.filter((request) => !requestIdsSucceeded.includes(request.id))), observeOn(asyncScheduler))
|
|
51
|
-
.subscribe(this.requestQueue$);
|
|
52
|
-
}
|
|
53
|
-
generateApiHeader({ bluxApiKey }) {
|
|
54
|
-
return {
|
|
55
|
-
Authorization: bluxApiKey,
|
|
56
|
-
};
|
|
57
|
-
}
|
|
58
|
-
async init({ applicationId, bluxApiKey, }) {
|
|
59
|
-
this.sendEvent(new VisitEvent({}));
|
|
60
|
-
try {
|
|
61
|
-
Logger.debug(`Init with application id: ${applicationId}`);
|
|
62
|
-
const deviceId = LocalStorage.getDeviceId();
|
|
63
|
-
if (!deviceId) {
|
|
64
|
-
Logger.debug("Saved Device ID is not exists, newly registered.");
|
|
65
|
-
}
|
|
66
|
-
const { data: { blux_user_id, device_id }, } = await initialize(this.api, { application_id: applicationId }, {
|
|
67
|
-
isVisitHandlingInSdk: true,
|
|
68
|
-
device_id: deviceId ?? undefined,
|
|
69
|
-
country_code: navigator.language.split("-")[1],
|
|
70
|
-
device_model: navigator.userAgent,
|
|
71
|
-
language_code: navigator.language.split("-")[0],
|
|
72
|
-
platform: DevicePlatform.browser,
|
|
73
|
-
os_version: navigator.userAgent,
|
|
74
|
-
sdk_version: this.sdkInfo.version,
|
|
75
|
-
sdk_type: this.sdkInfo.type,
|
|
76
|
-
timezone: Intl.DateTimeFormat().resolvedOptions().timeZone,
|
|
77
|
-
}, this.generateApiHeader({
|
|
78
|
-
bluxApiKey,
|
|
79
|
-
}));
|
|
80
|
-
LocalStorage.setDeviceId(device_id);
|
|
81
|
-
this.bluxUser$.next({
|
|
82
|
-
id: blux_user_id,
|
|
83
|
-
bluxApiKey,
|
|
84
|
-
applicationId,
|
|
85
|
-
deviceId: device_id,
|
|
86
|
-
});
|
|
87
|
-
return true;
|
|
88
|
-
}
|
|
89
|
-
catch (error) {
|
|
90
|
-
Logger.error(error, { tags: { from: "init" } });
|
|
91
|
-
return false;
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
setLogLevel(logLevel) {
|
|
95
|
-
Logger.setLevel(logLevel);
|
|
96
|
-
}
|
|
97
|
-
async getBluxUserWithTimeout() {
|
|
98
|
-
const bluxUser = await firstValueFrom(this.bluxUser$.pipe(filterNullable(), timeout(5000), catchError((error) => {
|
|
99
|
-
return throwError(() => error.name === "TimeoutError"
|
|
100
|
-
? new Error("Application ID is not intialized. Please initialize BluxClient.")
|
|
101
|
-
: error);
|
|
102
|
-
})));
|
|
103
|
-
return bluxUser;
|
|
104
|
-
}
|
|
105
|
-
async signIn(userId) {
|
|
106
|
-
try {
|
|
107
|
-
const bluxUser = await this.getBluxUserWithTimeout();
|
|
108
|
-
const { data: { blux_user_id: bluxIdInResponse }, } = await signIn(this.api, { application_id: bluxUser.applicationId, blux_user_id: bluxUser.id }, { user_id: userId, device_id: bluxUser.deviceId }, this.generateApiHeader(bluxUser));
|
|
109
|
-
if (bluxIdInResponse !== bluxUser.id) {
|
|
110
|
-
Logger.debug("Blux id is changed in signIn.");
|
|
111
|
-
this.bluxUser$.next({
|
|
112
|
-
...bluxUser,
|
|
113
|
-
id: bluxIdInResponse,
|
|
114
|
-
});
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
catch (error) {
|
|
118
|
-
Logger.error(error, { tags: { from: "signIn" } });
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
async signOut() {
|
|
122
|
-
try {
|
|
123
|
-
const bluxUser = await this.getBluxUserWithTimeout();
|
|
124
|
-
const { data: { blux_user_id: bluxIdInResponse }, } = await signOut(this.api, { application_id: bluxUser.applicationId, blux_user_id: bluxUser.id }, { device_id: bluxUser.deviceId }, this.generateApiHeader(bluxUser));
|
|
125
|
-
Logger.debug("Blux id is changed in signOut.");
|
|
126
|
-
this.bluxUser$.next({
|
|
127
|
-
...bluxUser,
|
|
128
|
-
id: bluxIdInResponse,
|
|
129
|
-
});
|
|
130
|
-
}
|
|
131
|
-
catch (error) {
|
|
132
|
-
Logger.error(error, { tags: { from: "signOut" } });
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
async setUserProperties(userProperties) {
|
|
136
|
-
try {
|
|
137
|
-
const bluxUser = await this.getBluxUserWithTimeout();
|
|
138
|
-
await updateUserProperties(this.api, { application_id: bluxUser.applicationId, blux_user_id: bluxUser.id }, { properties: userProperties }, this.generateApiHeader(bluxUser));
|
|
139
|
-
}
|
|
140
|
-
catch (error) {
|
|
141
|
-
Logger.error(error, { tags: { from: "setUserProperties" } });
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
async setCustomUserProperties(customUserProperties) {
|
|
145
|
-
try {
|
|
146
|
-
const bluxUser = await this.getBluxUserWithTimeout();
|
|
147
|
-
await updateCustomUserProperties(this.api, { application_id: bluxUser.applicationId, blux_user_id: bluxUser.id }, { properties: customUserProperties }, this.generateApiHeader(bluxUser));
|
|
148
|
-
}
|
|
149
|
-
catch (error) {
|
|
150
|
-
Logger.error(error, { tags: { from: "setCustomUserProperties" } });
|
|
151
|
-
}
|
|
152
|
-
}
|
|
153
|
-
sendEvent(event) {
|
|
154
|
-
const requests = (Array.isArray(event) ? event : [event]).map((event) => event.request);
|
|
155
|
-
this.requestQueue$.next([
|
|
156
|
-
...this.requestQueue$.value,
|
|
157
|
-
...requests.filter((request) => !this.requestQueue$.value.map((r) => r.id).includes(request.id)),
|
|
158
|
-
]);
|
|
159
|
-
}
|
|
160
|
-
async getItemRecommendation(recommendation) {
|
|
161
|
-
try {
|
|
162
|
-
const bluxUser = await this.getBluxUserWithTimeout();
|
|
163
|
-
const recommendationRequest = recommendation.request;
|
|
164
|
-
const recommendationResponse = await getItemRecommendation(this.api, {
|
|
165
|
-
application_id: bluxUser.applicationId,
|
|
166
|
-
blux_user_id: bluxUser.id,
|
|
167
|
-
}, {
|
|
168
|
-
call_type: recommendationRequest.call_type,
|
|
169
|
-
limit: recommendationRequest.limit,
|
|
170
|
-
offset: recommendationRequest.offset,
|
|
171
|
-
item_ids: recommendationRequest.item_ids,
|
|
172
|
-
}, this.generateApiHeader(bluxUser));
|
|
173
|
-
return recommendationResponse.data;
|
|
174
|
-
}
|
|
175
|
-
catch (error) {
|
|
176
|
-
Logger.error(error, { tags: { from: "getItemRecommendation" } });
|
|
177
|
-
return {
|
|
178
|
-
items: [],
|
|
179
|
-
metadata: {},
|
|
180
|
-
status: {
|
|
181
|
-
is_success: false,
|
|
182
|
-
code: 400,
|
|
183
|
-
message: error.message,
|
|
184
|
-
},
|
|
185
|
-
};
|
|
186
|
-
}
|
|
187
|
-
}
|
|
188
|
-
}
|
|
189
|
-
export const bluxClient = new BluxClient("prod");
|
|
190
|
-
//# sourceMappingURL=BluxClient.js.map
|
package/dist/BluxClient.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"BluxClient.js","sourceRoot":"/","sources":["BluxClient.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,cAAc,EACd,eAAe,EACf,UAAU,EACV,UAAU,EACV,MAAM,EACN,cAAc,EACd,GAAG,EACH,SAAS,EACT,UAAU,EACV,OAAO,EACP,cAAc,GACf,MAAM,MAAM,CAAC;AACd,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAEpD,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAExC,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B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AE,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC,EAAE,CAAC,CAClE;SACF,CAAC,CAAC;IACL,CAAC;IAEM,KAAK,CAAC,qBAAqB,CAChC,cAA8B;QAE9B,IAAI;YACF,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,sBAAsB,EAAE,CAAC;YACrD,MAAM,qBAAqB,GAAG,cAAc,CAAC,OAAO,CAAC;YAErD,MAAM,sBAAsB,GAAG,MAAM,qBAAqB,CACxD,IAAI,CAAC,GAAG,EACR;gBACE,cAAc,EAAE,QAAQ,CAAC,aAAa;gBACtC,YAAY,EAAE,QAAQ,CAAC,EAAE;aAC1B,EACD;gBACE,SAAS,EAAE,qBAAqB,CAAC,SAAS;gBAC1C,KAAK,EAAE,qBAAqB,CAAC,KAAK;gBAClC,MAAM,EAAE,qBAAqB,CAAC,MAAM;gBACpC,QAAQ,EAAE,qBAAqB,CAAC,QAAQ;aACzC,EACD,IAAI,CAAC,iBAAiB,CAAC,QAAQ,CAAC,CACjC,CAAC;YAEF,OAAO,sBAAsB,CAAC,IAAI,CAAC;SACpC;QAAC,OAAO,KAAK,EAAE;YACd,MAAM,CAAC,KAAK,CAAC,KAAK,EAAE,EAAE,IAAI,EAAE,EAAE,IAAI,EAAE,uBAAuB,EAAE,EAAE,CAAC,CAAC;YACjE,OAAO;gBACL,KAAK,EAAE,EAAE;gBACT,QAAQ,EAAE,EAAE;gBACZ,MAAM,EAAE;oBACN,UAAU,EAAE,KAAK;oBACjB,IAAI,EAAE,GAAG;oBACT,OAAO,EAAE,KAAK,CAAC,OAAO;iBACvB;aACF,CAAC;SACH;IACH,CAAC;CACF;AAED,MAAM,CAAC,MAAM,UAAU,GAAG,IAAI,UAAU,CAAC,MAAM,CAAC,CAAC","sourcesContent":["import {\n asyncScheduler,\n BehaviorSubject,\n catchError,\n exhaustMap,\n filter,\n firstValueFrom,\n map,\n observeOn,\n throwError,\n timeout,\n withLatestFrom,\n} from \"rxjs\";\nimport { LocalStorage } from \"./utils/LocalStorage\";\nimport type { LogLevel } from \"./utils/Logger\";\nimport { Logger } from \"./utils/Logger\";\nimport type { AxiosInstance } from \"axios\";\nimport axios from \"axios\";\nimport { filterNullable } from \"./utils/operators\";\nimport type { EventRequest } from \"./events/types\";\nimport { API_URL_BY_STAGE } from \"./constants/URLS\";\nimport type { Event } from \"./events/Event\";\nimport type { ItemRecommendationResponse } from \"@blux.ai/common\";\nimport { DevicePlatform } from \"@blux.ai/common\";\nimport { initialize } from \"./apis/initialize\";\nimport { signIn } from \"./apis/signIn\";\nimport { signOut } from \"./apis/signOut\";\nimport { updateUserProperties } from \"./apis/updateUserProperties\";\nimport { updateCustomUserProperties } from \"./apis/updateCustomUserProperties\";\nimport { collectEvent } from \"./apis/createEvent\";\nimport { VisitEvent } from \"./events/VisitEvent\";\nimport type { Recommendation } from \"./recommendations/Recommendation\";\nimport { getItemRecommendation } from \"./apis/getItemRecommendation\";\n\nexport type SdkInfo = {\n type: string;\n version: string;\n};\n\ntype BluxUser = {\n id: string;\n bluxApiKey: string;\n applicationId: string;\n deviceId: string;\n userId?: string;\n};\n\nexport class BluxClient {\n private readonly api: AxiosInstance;\n\n private readonly sdkInfo: SdkInfo = {\n type: \"browser\",\n version: \"0.0.3\",\n };\n\n public readonly bluxUser$ = new BehaviorSubject<BluxUser | undefined>(\n undefined,\n );\n\n public readonly requestQueue$ = new BehaviorSubject<EventRequest[]>([]);\n\n constructor(\n private readonly STAGE: \"local\" | \"dev\" | \"stg\" | \"prod\" = \"prod\",\n ) {\n this.api = axios.create({\n baseURL: API_URL_BY_STAGE[this.STAGE],\n });\n this.requestQueue$\n .pipe(\n filter((queue) => queue.length > 0),\n withLatestFrom(this.bluxUser$.pipe(filterNullable())),\n exhaustMap(async ([requests, bluxUser]) => {\n try {\n await collectEvent(\n this.api,\n {\n blux_user_id: bluxUser.id,\n application_id: bluxUser.applicationId,\n },\n {\n events: requests.map((request) => ({\n ...request,\n user_id: bluxUser.userId,\n blux_id: bluxUser.id,\n device_id: bluxUser.deviceId,\n })),\n },\n this.generateApiHeader(bluxUser),\n );\n } catch (error) {\n // todo : retry\n Logger.error(error, { tags: { from: \"request-events-api\" } });\n }\n\n return requests.map((r) => r.id); // todo: return successed requests only\n }),\n map((requestIdsSucceeded) =>\n this.requestQueue$.value.filter(\n (request) => !requestIdsSucceeded.includes(request.id),\n ),\n ),\n observeOn(asyncScheduler),\n )\n .subscribe(this.requestQueue$);\n }\n\n private generateApiHeader({ bluxApiKey }: { bluxApiKey: string }) {\n return {\n Authorization: bluxApiKey,\n };\n }\n\n public async init({\n applicationId,\n bluxApiKey,\n }: {\n applicationId: string;\n bluxApiKey: string;\n }): Promise<boolean> {\n this.sendEvent(new VisitEvent({}));\n try {\n Logger.debug(`Init with application id: ${applicationId}`);\n\n const deviceId = LocalStorage.getDeviceId();\n\n if (!deviceId) {\n Logger.debug(\"Saved Device ID is not exists, newly registered.\");\n }\n\n const {\n data: { blux_user_id, device_id },\n } = await initialize(\n this.api,\n { application_id: applicationId },\n {\n isVisitHandlingInSdk: true,\n device_id: deviceId ?? undefined,\n country_code: navigator.language.split(\"-\")[1],\n device_model: navigator.userAgent,\n language_code: navigator.language.split(\"-\")[0],\n platform: DevicePlatform.browser,\n os_version: navigator.userAgent,\n sdk_version: this.sdkInfo.version,\n sdk_type: this.sdkInfo.type,\n timezone: Intl.DateTimeFormat().resolvedOptions().timeZone,\n },\n this.generateApiHeader({\n bluxApiKey,\n }),\n );\n\n LocalStorage.setDeviceId(device_id);\n\n this.bluxUser$.next({\n id: blux_user_id,\n bluxApiKey,\n applicationId,\n deviceId: device_id,\n });\n\n return true;\n } catch (error) {\n Logger.error(error, { tags: { from: \"init\" } });\n return false;\n }\n }\n\n public setLogLevel(logLevel: LogLevel) {\n Logger.setLevel(logLevel);\n }\n\n private async getBluxUserWithTimeout() {\n const bluxUser = await firstValueFrom(\n this.bluxUser$.pipe(\n filterNullable(),\n timeout(5000),\n catchError((error) => {\n return throwError(() =>\n error.name === \"TimeoutError\"\n ? new Error(\n \"Application ID is not intialized. Please initialize BluxClient.\",\n )\n : error,\n );\n }),\n ),\n );\n\n return bluxUser;\n }\n\n public async signIn(userId: string) {\n try {\n const bluxUser = await this.getBluxUserWithTimeout();\n\n const {\n data: { blux_user_id: bluxIdInResponse },\n } = await signIn(\n this.api,\n { application_id: bluxUser.applicationId, blux_user_id: bluxUser.id },\n { user_id: userId, device_id: bluxUser.deviceId },\n this.generateApiHeader(bluxUser),\n );\n\n if (bluxIdInResponse !== bluxUser.id) {\n Logger.debug(\"Blux id is changed in signIn.\");\n this.bluxUser$.next({\n ...bluxUser,\n id: bluxIdInResponse,\n });\n }\n } catch (error) {\n Logger.error(error, { tags: { from: \"signIn\" } });\n }\n }\n\n public async signOut() {\n try {\n const bluxUser = await this.getBluxUserWithTimeout();\n\n const {\n data: { blux_user_id: bluxIdInResponse },\n } = await signOut(\n this.api,\n { application_id: bluxUser.applicationId, blux_user_id: bluxUser.id },\n { device_id: bluxUser.deviceId },\n this.generateApiHeader(bluxUser),\n );\n\n Logger.debug(\"Blux id is changed in signOut.\");\n this.bluxUser$.next({\n ...bluxUser,\n id: bluxIdInResponse,\n });\n } catch (error) {\n Logger.error(error, { tags: { from: \"signOut\" } });\n }\n }\n\n public async setUserProperties(userProperties: {\n phone_number?: string;\n email_address?: string;\n }) {\n try {\n const bluxUser = await this.getBluxUserWithTimeout();\n\n await updateUserProperties(\n this.api,\n { application_id: bluxUser.applicationId, blux_user_id: bluxUser.id },\n { properties: userProperties },\n this.generateApiHeader(bluxUser),\n );\n } catch (error) {\n Logger.error(error, { tags: { from: \"setUserProperties\" } });\n }\n }\n\n public async setCustomUserProperties(\n customUserProperties: Record<string, string | boolean | number | null>,\n ) {\n try {\n const bluxUser = await this.getBluxUserWithTimeout();\n\n await updateCustomUserProperties(\n this.api,\n { application_id: bluxUser.applicationId, blux_user_id: bluxUser.id },\n { properties: customUserProperties },\n this.generateApiHeader(bluxUser),\n );\n } catch (error) {\n Logger.error(error, { tags: { from: \"setCustomUserProperties\" } });\n }\n }\n\n public sendEvent(event: Event | Event[]) {\n const requests = (Array.isArray(event) ? event : [event]).map(\n (event) => event.request,\n );\n\n this.requestQueue$.next([\n ...this.requestQueue$.value,\n ...requests.filter(\n (request) =>\n !this.requestQueue$.value.map((r) => r.id).includes(request.id),\n ),\n ]);\n }\n\n public async getItemRecommendation(\n recommendation: Recommendation,\n ): Promise<ItemRecommendationResponse> {\n try {\n const bluxUser = await this.getBluxUserWithTimeout();\n const recommendationRequest = recommendation.request;\n\n const recommendationResponse = await getItemRecommendation(\n this.api,\n {\n application_id: bluxUser.applicationId,\n blux_user_id: bluxUser.id,\n },\n {\n call_type: recommendationRequest.call_type,\n limit: recommendationRequest.limit,\n offset: recommendationRequest.offset,\n item_ids: recommendationRequest.item_ids,\n },\n this.generateApiHeader(bluxUser),\n );\n\n return recommendationResponse.data;\n } catch (error) {\n Logger.error(error, { tags: { from: \"getItemRecommendation\" } });\n return {\n items: [],\n metadata: {},\n status: {\n is_success: false,\n code: 400,\n message: error.message,\n },\n };\n }\n }\n}\n\nexport const bluxClient = new BluxClient(\"prod\");\n"]}
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import { APIs } from "@blux.ai/common";
|
|
2
|
-
import type { AxiosInstance } from "axios";
|
|
3
|
-
import API = APIs.bluxUsersCollectEvents;
|
|
4
|
-
export declare const collectEvent: (instance: AxiosInstance, pathParams: API.PathParam, body: API.Body, headers: Record<string, string>) => Promise<import("axios").AxiosResponse<boolean, any>>;
|
package/dist/apis/createEvent.js
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { APIs } from "@blux.ai/common";
|
|
2
|
-
import { getPath } from "../utils/getPath";
|
|
3
|
-
var API = APIs.bluxUsersCollectEvents;
|
|
4
|
-
export const collectEvent = (instance, pathParams, body, headers) => {
|
|
5
|
-
return instance[API.method](getPath(API.path, pathParams), body, { headers });
|
|
6
|
-
};
|
|
7
|
-
//# sourceMappingURL=createEvent.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"createEvent.js","sourceRoot":"/","sources":["apis/createEvent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AAEvC,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAE3C,IAAO,GAAG,GAAG,IAAI,CAAC,sBAAsB,CAAC;AAEzC,MAAM,CAAC,MAAM,YAAY,GAAG,CAC1B,QAAuB,EACvB,UAAyB,EACzB,IAAc,EACd,OAA+B,EAC/B,EAAE;IACF,OAAO,QAAQ,CAAC,GAAG,CAAC,MAAM,CAAC,CACzB,OAAO,CAAC,GAAG,CAAC,IAAI,EAAE,UAAU,CAAC,EAC7B,IAAI,EACJ,EAAE,OAAO,EAAE,CACZ,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import { APIs } from \"@blux.ai/common\";\nimport type { AxiosInstance } from \"axios\";\nimport { getPath } from \"../utils/getPath\";\n\nimport API = APIs.bluxUsersCollectEvents;\n\nexport const collectEvent = (\n instance: AxiosInstance,\n pathParams: API.PathParam,\n body: API.Body,\n headers: Record<string, string>,\n) => {\n return instance[API.method]<API.ResponseData>(\n getPath(API.path, pathParams),\n body,\n { headers },\n );\n};\n"]}
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import { APIs } from "@blux.ai/common";
|
|
2
|
-
import type { AxiosInstance } from "axios";
|
|
3
|
-
import API = APIs.bluxUsersGetItemRecommendations;
|
|
4
|
-
export declare const getItemRecommendation: (instance: AxiosInstance, pathParams: API.PathParam, body: API.Body, headers: Record<string, string>) => Promise<import("axios").AxiosResponse<import("@blux.ai/common").ItemRecommendationResponse, any>>;
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { APIs } from "@blux.ai/common";
|
|
2
|
-
var API = APIs.bluxUsersGetItemRecommendations;
|
|
3
|
-
import { getPath } from "../utils/getPath";
|
|
4
|
-
export const getItemRecommendation = (instance, pathParams, body, headers) => {
|
|
5
|
-
return instance[API.method](getPath(API.path, pathParams), body, { headers });
|
|
6
|
-
};
|
|
7
|
-
//# sourceMappingURL=getItemRecommendation.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"getItemRecommendation.js","sourceRoot":"/","sources":["apis/getItemRecommendation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AAGvC,IAAO,GAAG,GAAG,IAAI,CAAC,+BAA+B,CAAC;AAClD,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAE3C,MAAM,CAAC,MAAM,qBAAqB,GAAG,CACnC,QAAuB,EACvB,UAAyB,EACzB,IAAc,EACd,OAA+B,EAC/B,EAAE;IACF,OAAO,QAAQ,CAAC,GAAG,CAAC,MAAM,CAAC,CACzB,OAAO,CAAC,GAAG,CAAC,IAAI,EAAE,UAAU,CAAC,EAC7B,IAAI,EACJ,EAAE,OAAO,EAAE,CACZ,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import { APIs } from \"@blux.ai/common\";\nimport type { AxiosInstance } from \"axios\";\n\nimport API = APIs.bluxUsersGetItemRecommendations;\nimport { getPath } from \"../utils/getPath\";\n\nexport const getItemRecommendation = (\n instance: AxiosInstance,\n pathParams: API.PathParam,\n body: API.Body,\n headers: Record<string, string>,\n) => {\n return instance[API.method]<API.ResponseData>(\n getPath(API.path, pathParams),\n body,\n { headers },\n );\n};\n"]}
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import { APIs } from "@blux.ai/common";
|
|
2
|
-
import type { AxiosInstance } from "axios";
|
|
3
|
-
import API = APIs.bluxUsersInitialize;
|
|
4
|
-
export declare const initialize: (instance: AxiosInstance, pathParams: API.PathParam, body: API.Body, headers: Record<string, string>) => Promise<import("axios").AxiosResponse<API.ResponseData, any>>;
|
package/dist/apis/initialize.js
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { APIs } from "@blux.ai/common";
|
|
2
|
-
import { getPath } from "../utils/getPath";
|
|
3
|
-
var API = APIs.bluxUsersInitialize;
|
|
4
|
-
export const initialize = (instance, pathParams, body, headers) => {
|
|
5
|
-
return instance[API.method](getPath(API.path, pathParams), body, { headers });
|
|
6
|
-
};
|
|
7
|
-
//# sourceMappingURL=initialize.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"initialize.js","sourceRoot":"/","sources":["apis/initialize.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AAEvC,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAE3C,IAAO,GAAG,GAAG,IAAI,CAAC,mBAAmB,CAAC;AAEtC,MAAM,CAAC,MAAM,UAAU,GAAG,CACxB,QAAuB,EACvB,UAAyB,EACzB,IAAc,EACd,OAA+B,EAC/B,EAAE;IACF,OAAO,QAAQ,CAAC,GAAG,CAAC,MAAM,CAAC,CACzB,OAAO,CAAC,GAAG,CAAC,IAAI,EAAE,UAAU,CAAC,EAC7B,IAAI,EACJ,EAAE,OAAO,EAAE,CACZ,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import { APIs } from \"@blux.ai/common\";\nimport type { AxiosInstance } from \"axios\";\nimport { getPath } from \"../utils/getPath\";\n\nimport API = APIs.bluxUsersInitialize;\n\nexport const initialize = (\n instance: AxiosInstance,\n pathParams: API.PathParam,\n body: API.Body,\n headers: Record<string, string>,\n) => {\n return instance[API.method]<API.ResponseData>(\n getPath(API.path, pathParams),\n body,\n { headers },\n );\n};\n"]}
|
package/dist/apis/signIn.d.ts
DELETED
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import { APIs } from "@blux.ai/common";
|
|
2
|
-
import type { AxiosInstance } from "axios";
|
|
3
|
-
import API = APIs.bluxUsersSignIn;
|
|
4
|
-
export declare const signIn: (instance: AxiosInstance, pathParams: API.PathParam, body: API.Body, headers: Record<string, string>) => Promise<import("axios").AxiosResponse<API.ResponseData, any>>;
|
package/dist/apis/signIn.js
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { APIs } from "@blux.ai/common";
|
|
2
|
-
import { getPath } from "../utils/getPath";
|
|
3
|
-
var API = APIs.bluxUsersSignIn;
|
|
4
|
-
export const signIn = (instance, pathParams, body, headers) => {
|
|
5
|
-
return instance[API.method](getPath(API.path, pathParams), body, { headers });
|
|
6
|
-
};
|
|
7
|
-
//# sourceMappingURL=signIn.js.map
|
package/dist/apis/signIn.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"signIn.js","sourceRoot":"/","sources":["apis/signIn.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AAEvC,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAE3C,IAAO,GAAG,GAAG,IAAI,CAAC,eAAe,CAAC;AAElC,MAAM,CAAC,MAAM,MAAM,GAAG,CACpB,QAAuB,EACvB,UAAyB,EACzB,IAAc,EACd,OAA+B,EAC/B,EAAE;IACF,OAAO,QAAQ,CAAC,GAAG,CAAC,MAAM,CAAC,CACzB,OAAO,CAAC,GAAG,CAAC,IAAI,EAAE,UAAU,CAAC,EAC7B,IAAI,EACJ,EAAE,OAAO,EAAE,CACZ,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import { APIs } from \"@blux.ai/common\";\nimport type { AxiosInstance } from \"axios\";\nimport { getPath } from \"../utils/getPath\";\n\nimport API = APIs.bluxUsersSignIn;\n\nexport const signIn = (\n instance: AxiosInstance,\n pathParams: API.PathParam,\n body: API.Body,\n headers: Record<string, string>,\n) => {\n return instance[API.method]<API.ResponseData>(\n getPath(API.path, pathParams),\n body,\n { headers },\n );\n};\n"]}
|
package/dist/apis/signOut.d.ts
DELETED
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import { APIs } from "@blux.ai/common";
|
|
2
|
-
import type { AxiosInstance } from "axios";
|
|
3
|
-
import API = APIs.bluxUsersSignOut;
|
|
4
|
-
export declare const signOut: (instance: AxiosInstance, pathParams: API.PathParam, body: API.Body, headers: Record<string, string>) => Promise<import("axios").AxiosResponse<API.ResponseData, any>>;
|
package/dist/apis/signOut.js
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { APIs } from "@blux.ai/common";
|
|
2
|
-
import { getPath } from "../utils/getPath";
|
|
3
|
-
var API = APIs.bluxUsersSignOut;
|
|
4
|
-
export const signOut = (instance, pathParams, body, headers) => {
|
|
5
|
-
return instance[API.method](getPath(API.path, pathParams), body, { headers });
|
|
6
|
-
};
|
|
7
|
-
//# sourceMappingURL=signOut.js.map
|
package/dist/apis/signOut.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"signOut.js","sourceRoot":"/","sources":["apis/signOut.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AAEvC,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAE3C,IAAO,GAAG,GAAG,IAAI,CAAC,gBAAgB,CAAC;AAEnC,MAAM,CAAC,MAAM,OAAO,GAAG,CACrB,QAAuB,EACvB,UAAyB,EACzB,IAAc,EACd,OAA+B,EAC/B,EAAE;IACF,OAAO,QAAQ,CAAC,GAAG,CAAC,MAAM,CAAC,CACzB,OAAO,CAAC,GAAG,CAAC,IAAI,EAAE,UAAU,CAAC,EAC7B,IAAI,EACJ,EAAE,OAAO,EAAE,CACZ,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import { APIs } from \"@blux.ai/common\";\nimport type { AxiosInstance } from \"axios\";\nimport { getPath } from \"../utils/getPath\";\n\nimport API = APIs.bluxUsersSignOut;\n\nexport const signOut = (\n instance: AxiosInstance,\n pathParams: API.PathParam,\n body: API.Body,\n headers: Record<string, string>,\n) => {\n return instance[API.method]<API.ResponseData>(\n getPath(API.path, pathParams),\n body,\n { headers },\n );\n};\n"]}
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import { APIs } from "@blux.ai/common";
|
|
2
|
-
import type { AxiosInstance } from "axios";
|
|
3
|
-
import API = APIs.bluxUsersUpdateCustomUserProperties;
|
|
4
|
-
export declare const updateCustomUserProperties: (instance: AxiosInstance, pathParams: API.PathParam, body: API.Body, headers: Record<string, string>) => Promise<import("axios").AxiosResponse<API.ResponseData, any>>;
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { APIs } from "@blux.ai/common";
|
|
2
|
-
import { getPath } from "../utils/getPath";
|
|
3
|
-
var API = APIs.bluxUsersUpdateCustomUserProperties;
|
|
4
|
-
export const updateCustomUserProperties = (instance, pathParams, body, headers) => {
|
|
5
|
-
return instance[API.method](getPath(API.path, pathParams), body, { headers });
|
|
6
|
-
};
|
|
7
|
-
//# sourceMappingURL=updateCustomUserProperties.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"updateCustomUserProperties.js","sourceRoot":"/","sources":["apis/updateCustomUserProperties.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AAEvC,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAE3C,IAAO,GAAG,GAAG,IAAI,CAAC,mCAAmC,CAAC;AAEtD,MAAM,CAAC,MAAM,0BAA0B,GAAG,CACxC,QAAuB,EACvB,UAAyB,EACzB,IAAc,EACd,OAA+B,EAC/B,EAAE;IACF,OAAO,QAAQ,CAAC,GAAG,CAAC,MAAM,CAAC,CACzB,OAAO,CAAC,GAAG,CAAC,IAAI,EAAE,UAAU,CAAC,EAC7B,IAAI,EACJ,EAAE,OAAO,EAAE,CACZ,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import { APIs } from \"@blux.ai/common\";\nimport type { AxiosInstance } from \"axios\";\nimport { getPath } from \"../utils/getPath\";\n\nimport API = APIs.bluxUsersUpdateCustomUserProperties;\n\nexport const updateCustomUserProperties = (\n instance: AxiosInstance,\n pathParams: API.PathParam,\n body: API.Body,\n headers: Record<string, string>,\n) => {\n return instance[API.method]<API.ResponseData>(\n getPath(API.path, pathParams),\n body,\n { headers },\n );\n};\n"]}
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import { APIs } from "@blux.ai/common";
|
|
2
|
-
import type { AxiosInstance } from "axios";
|
|
3
|
-
import API = APIs.bluxUsersUpdateUserProperties;
|
|
4
|
-
export declare const updateUserProperties: (instance: AxiosInstance, pathParams: API.PathParam, body: API.Body, headers: Record<string, string>) => Promise<import("axios").AxiosResponse<API.ResponseData, any>>;
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { APIs } from "@blux.ai/common";
|
|
2
|
-
import { getPath } from "../utils/getPath";
|
|
3
|
-
var API = APIs.bluxUsersUpdateUserProperties;
|
|
4
|
-
export const updateUserProperties = (instance, pathParams, body, headers) => {
|
|
5
|
-
return instance[API.method](getPath(API.path, pathParams), body, { headers });
|
|
6
|
-
};
|
|
7
|
-
//# sourceMappingURL=updateUserProperties.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"updateUserProperties.js","sourceRoot":"/","sources":["apis/updateUserProperties.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AAEvC,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAE3C,IAAO,GAAG,GAAG,IAAI,CAAC,6BAA6B,CAAC;AAEhD,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAClC,QAAuB,EACvB,UAAyB,EACzB,IAAc,EACd,OAA+B,EAC/B,EAAE;IACF,OAAO,QAAQ,CAAC,GAAG,CAAC,MAAM,CAAC,CACzB,OAAO,CAAC,GAAG,CAAC,IAAI,EAAE,UAAU,CAAC,EAC7B,IAAI,EACJ,EAAE,OAAO,EAAE,CACZ,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import { APIs } from \"@blux.ai/common\";\nimport type { AxiosInstance } from \"axios\";\nimport { getPath } from \"../utils/getPath\";\n\nimport API = APIs.bluxUsersUpdateUserProperties;\n\nexport const updateUserProperties = (\n instance: AxiosInstance,\n pathParams: API.PathParam,\n body: API.Body,\n headers: Record<string, string>,\n) => {\n return instance[API.method]<API.ResponseData>(\n getPath(API.path, pathParams),\n body,\n { headers },\n );\n};\n"]}
|
package/dist/constants/URLS.d.ts
DELETED
package/dist/constants/URLS.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"URLS.js","sourceRoot":"/","sources":["constants/URLS.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,gBAAgB,GAAG;IAC9B,KAAK,EAAE,6BAA6B;IACpC,GAAG,EAAE,yBAAyB;IAC9B,GAAG,EAAE,yBAAyB;IAC9B,IAAI,EAAE,0BAA0B;CACxB,CAAC","sourcesContent":["export const API_URL_BY_STAGE = {\n local: \"http://localhost:9000/local\",\n dev: \"https://api.blux.ai/dev\",\n stg: \"https://api.blux.ai/stg\",\n prod: \"https://api.blux.ai/prod\",\n} as const;\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"AddCartaddEvent.js","sourceRoot":"/","sources":["events/AddCartaddEvent.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAEhC,MAAM,OAAO,eAAgB,SAAQ,KAAK;IACxC,YAAY,EAAE,OAAO,EAAE,gBAAgB,EAAoB;QACzD,KAAK,CAAC;YACJ,UAAU,EAAE,SAAS;YACrB,OAAO;YACP,gBAAgB;SACjB,CAAC,CAAC;IACL,CAAC;CACF","sourcesContent":["import type { IAddCartaddEvent } from \"./types\";\nimport { Event } from \"./Event\";\n\nexport class AddCartaddEvent extends Event {\n constructor({ item_id, event_properties }: IAddCartaddEvent) {\n super({\n event_type: \"cartadd\",\n item_id,\n event_properties,\n });\n }\n}\n"]}
|