@bikdotai/bik-shared-backend 20.4.1-beta.0 → 20.5.0
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/lib/alertsV2/alertInstances.repo.js +2 -26
- package/lib/alertsV2/alertsV2.helper.d.ts +4 -3
- package/lib/alertsV2/alertsV2.helper.js +3 -49
- package/lib/alertsV2/alertsV2.service.js +5 -14
- package/lib/auth/authMiddlewares.js +3 -68
- package/lib/auth/firebase-auth.service.js +3 -3
- package/lib/auth/implementations/bik-admin-auth-service.d.ts +1 -1
- package/lib/auth/implementations/bik-admin-auth-service.js +1 -2
- package/lib/auth/index.d.ts +0 -3
- package/lib/auth/index.js +0 -3
- package/lib/auth/secret-manager/env-variables/variables.list.d.ts +0 -3
- package/lib/auth/secret-manager/env-variables/variables.list.js +0 -3
- package/lib/chat-handover-protocol/chat-handover-protocol.js +41 -26
- package/lib/core/setup.d.ts +0 -3
- package/lib/core/setup.js +2 -24
- package/lib/elastic/counter/ingestion.js +0 -1
- package/lib/elastic/queries/campaign/getBroadcastDetailedStats.d.ts +0 -117
- package/lib/elastic/queries/campaign/getBroadcastDetailedStats.js +1 -94
- package/lib/elastic/queries/campaign/getUniqueCustomerCnt.d.ts +0 -1
- package/lib/elastic/queries/campaign/getUniqueCustomerCnt.js +0 -1
- package/lib/elastic/queries/chatbot/getAiOperations.d.ts +5 -5
- package/lib/elastic/queries/chatbot/getAiOperations.js +3 -3
- package/lib/elastic/queries/chatbot/index.d.ts +0 -1
- package/lib/elastic/queries/chatbot/index.js +0 -1
- package/lib/elastic/queries/crm/getActivityTimelineByAgent.js +1 -1
- package/lib/elastic/queries/crm/getBreachedSLACount.d.ts +0 -1
- package/lib/elastic/queries/crm/getBreachedSLACount.js +5 -8
- package/lib/elastic/queries/crm/getFirstResponseTime.d.ts +0 -1
- package/lib/elastic/queries/crm/getFirstResponseTime.js +5 -8
- package/lib/elastic/queries/integrations/index.d.ts +0 -1
- package/lib/elastic/queries/integrations/index.js +0 -1
- package/lib/elastic/queries/openAi/addToCartSession.d.ts +0 -1
- package/lib/elastic/queries/openAi/addToCartSession.js +3 -11
- package/lib/elastic/queries/openAi/checkoutCompletedSession.d.ts +0 -1
- package/lib/elastic/queries/openAi/checkoutCompletedSession.js +3 -11
- package/lib/elastic/reports/crm/index.d.ts +0 -1
- package/lib/elastic/reports/crm/index.js +0 -1
- package/lib/elastic/reports/reports.service.js +8 -17
- package/lib/events/events.d.ts +0 -8
- package/lib/events/events.js +1 -25
- package/lib/events/schema/events.helper.d.ts +0 -1
- package/lib/events/schema/events.helper.js +6 -12
- package/lib/index.d.ts +0 -1
- package/lib/index.js +0 -1
- package/lib/merchant-events/elastic.search.d.ts +0 -5
- package/lib/merchant-events/elastic.search.js +2 -23
- package/lib/merchant-events/merchant.service.d.ts +1 -1
- package/lib/merchant-events/merchant.service.js +11 -12
- package/lib/recordAnalytics/recordAnalytics.service.js +4 -5
- package/lib/redis/redisPubSubService.d.ts +6 -4
- package/lib/redis/redisPubSubService.js +123 -211
- package/lib/redis/redisService.js +8 -14
- package/lib/swagger/SwaggerSchemaHelper.js +17 -21
- package/lib/user-properties/userProperties.service.js +0 -1
- package/package.json +2 -2
- package/lib/alerts/templates/campaign/campaignMovedToDraftSegmentSyncDelay.d.ts +0 -1
- package/lib/alerts/templates/campaign/campaignMovedToDraftSegmentSyncDelay.js +0 -4
- package/lib/alerts/templates/campaign/campaignMovedToDraftSegmentSyncFailed.d.ts +0 -1
- package/lib/alerts/templates/campaign/campaignMovedToDraftSegmentSyncFailed.js +0 -4
- package/lib/alerts/templates/campaign/campaignScheduledTimeExceededDueToSyncDelay.d.ts +0 -1
- package/lib/alerts/templates/campaign/campaignScheduledTimeExceededDueToSyncDelay.js +0 -4
- package/lib/auth/secret-manager/configManager.firestore.d.ts +0 -22
- package/lib/auth/secret-manager/configManager.firestore.js +0 -166
- package/lib/auth/secret-manager/configManager.helper.d.ts +0 -13
- package/lib/auth/secret-manager/configManager.helper.js +0 -32
- package/lib/auth/secret-manager/configManager.model.d.ts +0 -38
- package/lib/auth/secret-manager/configManager.model.js +0 -2
- package/lib/auth/secret-manager/configManager.service.d.ts +0 -17
- package/lib/auth/secret-manager/configManager.service.js +0 -138
- package/lib/core/local_runner.d.ts +0 -1
- package/lib/core/local_runner.js +0 -60
- package/lib/database/database.model.d.ts +0 -95
- package/lib/database/database.model.js +0 -5
- package/lib/database/database.service.d.ts +0 -90
- package/lib/database/database.service.js +0 -382
- package/lib/database/index.d.ts +0 -7
- package/lib/database/index.js +0 -23
- package/lib/elastic/queries/chatbot/getAgentCostForBroadcast.d.ts +0 -117
- package/lib/elastic/queries/chatbot/getAgentCostForBroadcast.js +0 -98
- package/lib/elastic/queries/integrations/getOrdersShadowServices.d.ts +0 -76
- package/lib/elastic/queries/integrations/getOrdersShadowServices.js +0 -61
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
import { QueryHelper } from '../query.helper';
|
|
2
|
-
export interface GetOrdersShadowServicesParams {
|
|
3
|
-
indexName: string;
|
|
4
|
-
storeId: string;
|
|
5
|
-
startDate: string;
|
|
6
|
-
endDate: string;
|
|
7
|
-
pageSize?: number;
|
|
8
|
-
afterKey?: string;
|
|
9
|
-
}
|
|
10
|
-
export interface OrderShadowServicesItem {
|
|
11
|
-
id: string;
|
|
12
|
-
orderId?: string;
|
|
13
|
-
orderValue?: number;
|
|
14
|
-
shadowServices?: string[];
|
|
15
|
-
shadowServiceIds?: string[];
|
|
16
|
-
shadowServicePods?: string[];
|
|
17
|
-
}
|
|
18
|
-
export interface GetOrdersShadowServicesResponse {
|
|
19
|
-
orders: OrderShadowServicesItem[];
|
|
20
|
-
afterKey: string | null;
|
|
21
|
-
hasMore: boolean;
|
|
22
|
-
}
|
|
23
|
-
interface ElasticHitSource {
|
|
24
|
-
eventProperties?: {
|
|
25
|
-
orderId?: string;
|
|
26
|
-
orderValue?: number;
|
|
27
|
-
shadowServices?: string[];
|
|
28
|
-
shadowServiceIds?: string[];
|
|
29
|
-
shadowServicePods?: string[];
|
|
30
|
-
};
|
|
31
|
-
}
|
|
32
|
-
interface ElasticHit {
|
|
33
|
-
_id: string;
|
|
34
|
-
_source: ElasticHitSource;
|
|
35
|
-
sort?: [string];
|
|
36
|
-
}
|
|
37
|
-
interface ElasticSearchResponse {
|
|
38
|
-
hits: {
|
|
39
|
-
hits: ElasticHit[];
|
|
40
|
-
};
|
|
41
|
-
}
|
|
42
|
-
export declare class GetOrdersShadowServicesQuery implements QueryHelper<GetOrdersShadowServicesParams, GetOrdersShadowServicesResponse> {
|
|
43
|
-
getQuery(params: GetOrdersShadowServicesParams): {
|
|
44
|
-
index: string;
|
|
45
|
-
size: number;
|
|
46
|
-
_source: string[];
|
|
47
|
-
query: {
|
|
48
|
-
bool: {
|
|
49
|
-
filter: ({
|
|
50
|
-
term: {
|
|
51
|
-
[field: string]: {
|
|
52
|
-
value: string;
|
|
53
|
-
};
|
|
54
|
-
};
|
|
55
|
-
} | {
|
|
56
|
-
range: {
|
|
57
|
-
[field: string]: {
|
|
58
|
-
gte: string;
|
|
59
|
-
lte: string;
|
|
60
|
-
};
|
|
61
|
-
};
|
|
62
|
-
})[];
|
|
63
|
-
};
|
|
64
|
-
};
|
|
65
|
-
sort: {
|
|
66
|
-
[field: string]: "desc" | "asc";
|
|
67
|
-
}[];
|
|
68
|
-
search_after?: [string] | undefined;
|
|
69
|
-
};
|
|
70
|
-
transform(elasticOutput: ElasticSearchResponse, params: GetOrdersShadowServicesParams): {
|
|
71
|
-
orders: OrderShadowServicesItem[];
|
|
72
|
-
afterKey: string | null;
|
|
73
|
-
hasMore: boolean;
|
|
74
|
-
};
|
|
75
|
-
}
|
|
76
|
-
export {};
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.GetOrdersShadowServicesQuery = void 0;
|
|
4
|
-
const events_1 = require("@bikdotai/bik-models/events");
|
|
5
|
-
const DEFAULT_PAGE_SIZE = 1000;
|
|
6
|
-
class GetOrdersShadowServicesQuery {
|
|
7
|
-
getQuery(params) {
|
|
8
|
-
var _a;
|
|
9
|
-
const size = (_a = params.pageSize) !== null && _a !== void 0 ? _a : DEFAULT_PAGE_SIZE;
|
|
10
|
-
const query = {
|
|
11
|
-
index: params.indexName,
|
|
12
|
-
size,
|
|
13
|
-
_source: [
|
|
14
|
-
'eventProperties.orderId',
|
|
15
|
-
'eventProperties.orderValue',
|
|
16
|
-
'eventProperties.shadowServices',
|
|
17
|
-
'eventProperties.shadowServiceIds',
|
|
18
|
-
'eventProperties.shadowServicePods',
|
|
19
|
-
],
|
|
20
|
-
query: {
|
|
21
|
-
bool: {
|
|
22
|
-
filter: [
|
|
23
|
-
{ term: { 'storeId.keyword': { value: params.storeId } } },
|
|
24
|
-
{ term: { 'eventName.keyword': { value: events_1.Events.ORDERED } } },
|
|
25
|
-
{ range: { createdAt: { gte: params.startDate, lte: params.endDate } } },
|
|
26
|
-
],
|
|
27
|
-
},
|
|
28
|
-
},
|
|
29
|
-
sort: [{ _id: 'asc' }],
|
|
30
|
-
};
|
|
31
|
-
if (params.afterKey) {
|
|
32
|
-
query.search_after = [params.afterKey];
|
|
33
|
-
}
|
|
34
|
-
return query;
|
|
35
|
-
}
|
|
36
|
-
transform(elasticOutput, params) {
|
|
37
|
-
var _a, _b, _c;
|
|
38
|
-
const hits = (_b = (_a = elasticOutput.hits) === null || _a === void 0 ? void 0 : _a.hits) !== null && _b !== void 0 ? _b : [];
|
|
39
|
-
const orders = hits.map((hit) => {
|
|
40
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
41
|
-
return ({
|
|
42
|
-
id: hit._id,
|
|
43
|
-
orderId: (_b = (_a = hit._source) === null || _a === void 0 ? void 0 : _a.eventProperties) === null || _b === void 0 ? void 0 : _b.orderId,
|
|
44
|
-
orderValue: (_d = (_c = hit._source) === null || _c === void 0 ? void 0 : _c.eventProperties) === null || _d === void 0 ? void 0 : _d.orderValue,
|
|
45
|
-
shadowServices: (_f = (_e = hit._source) === null || _e === void 0 ? void 0 : _e.eventProperties) === null || _f === void 0 ? void 0 : _f.shadowServices,
|
|
46
|
-
shadowServiceIds: (_h = (_g = hit._source) === null || _g === void 0 ? void 0 : _g.eventProperties) === null || _h === void 0 ? void 0 : _h.shadowServiceIds,
|
|
47
|
-
shadowServicePods: (_k = (_j = hit._source) === null || _j === void 0 ? void 0 : _j.eventProperties) === null || _k === void 0 ? void 0 : _k.shadowServicePods,
|
|
48
|
-
});
|
|
49
|
-
});
|
|
50
|
-
const size = (_c = params.pageSize) !== null && _c !== void 0 ? _c : DEFAULT_PAGE_SIZE;
|
|
51
|
-
const hasMore = hits.length === size && hits.length > 0;
|
|
52
|
-
const lastHit = hits[hits.length - 1];
|
|
53
|
-
const afterKey = hasMore && (lastHit === null || lastHit === void 0 ? void 0 : lastHit._id) ? lastHit._id : null;
|
|
54
|
-
return {
|
|
55
|
-
orders,
|
|
56
|
-
afterKey,
|
|
57
|
-
hasMore,
|
|
58
|
-
};
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
exports.GetOrdersShadowServicesQuery = GetOrdersShadowServicesQuery;
|