@phygitallabs/tapquest-core 2.0.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/README.md +210 -0
- package/index.ts +1 -0
- package/package.json +43 -0
- package/src/constants/firebase.ts +36 -0
- package/src/constants/service.ts +30 -0
- package/src/helper/helpers.ts +3 -0
- package/src/helper/index.ts +1 -0
- package/src/index.ts +25 -0
- package/src/modules/achievement/helpers/index.ts +98 -0
- package/src/modules/achievement/hooks/index.ts +171 -0
- package/src/modules/achievement/index.ts +5 -0
- package/src/modules/achievement/types/index.ts +45 -0
- package/src/modules/achivementWithReward/hooks/achivementPlusRewardModel.ts +83 -0
- package/src/modules/achivementWithReward/hooks/index.ts +5 -0
- package/src/modules/achivementWithReward/index.ts +5 -0
- package/src/modules/auth/README.md +527 -0
- package/src/modules/auth/constants/index.ts +9 -0
- package/src/modules/auth/helpers/index.ts +161 -0
- package/src/modules/auth/helpers/refreshToken.ts +63 -0
- package/src/modules/auth/index.ts +20 -0
- package/src/modules/auth/providers/AuthProvider.tsx +207 -0
- package/src/modules/auth/providers/index.ts +1 -0
- package/src/modules/auth/services/FirebaseAuthService.ts +290 -0
- package/src/modules/auth/services/authServiceFactory.ts +22 -0
- package/src/modules/auth/services/index.ts +3 -0
- package/src/modules/auth/store/authSlice.ts +137 -0
- package/src/modules/auth/types/index.ts +109 -0
- package/src/modules/campaign/hooks/index.ts +6 -0
- package/src/modules/campaign/hooks/useCampaignService.ts +7 -0
- package/src/modules/campaign/index.tsx +7 -0
- package/src/modules/campaign/types/campaign.ts +51 -0
- package/src/modules/campaign/types/enums.ts +4 -0
- package/src/modules/campaign/types/index.ts +4 -0
- package/src/modules/campaign/types/requests.ts +46 -0
- package/src/modules/data-tracking/hooks/index.ts +67 -0
- package/src/modules/data-tracking/index.ts +1 -0
- package/src/modules/generate-certificate/hooks/index.ts +8 -0
- package/src/modules/generate-certificate/index.ts +3 -0
- package/src/modules/generate-certificate/types/generateCertificate.ts +7 -0
- package/src/modules/generate-certificate/types/index.ts +7 -0
- package/src/modules/location/hooks/index.ts +8 -0
- package/src/modules/location/hooks/useLocationService.ts +8 -0
- package/src/modules/location/index.tsx +11 -0
- package/src/modules/location/types/index.ts +18 -0
- package/src/modules/location/types/locationModel.ts +21 -0
- package/src/modules/location/utils/index.ts +5 -0
- package/src/modules/location/utils/locationHelpers.ts +13 -0
- package/src/modules/memory/hooks/index.ts +3 -0
- package/src/modules/memory/index.ts +3 -0
- package/src/modules/memory/types/index.ts +3 -0
- package/src/modules/notification/index.ts +2 -0
- package/src/modules/notification/providers/index.tsx +50 -0
- package/src/modules/notification/types/index.ts +3 -0
- package/src/modules/reward/hooks/index.ts +14 -0
- package/src/modules/reward/hooks/useRewardService.ts +14 -0
- package/src/modules/reward/index.tsx +16 -0
- package/src/modules/reward/types/enums.ts +13 -0
- package/src/modules/reward/types/index.ts +4 -0
- package/src/modules/reward/types/requests.ts +281 -0
- package/src/modules/reward/types/reward.ts +90 -0
- package/src/modules/scan-chip/hooks/index.tsx +67 -0
- package/src/modules/scan-chip/index.ts +2 -0
- package/src/modules/scan-chip/types/index.ts +25 -0
- package/src/modules/send-email/hooks/index.ts +2 -0
- package/src/modules/send-email/index.ts +1 -0
- package/src/modules/user-profile/hooks/index.ts +3 -0
- package/src/modules/user-profile/index.ts +3 -0
- package/src/modules/user-profile/types/index.ts +3 -0
- package/src/providers/ServicesProvider.tsx +173 -0
- package/src/providers/TapquestCoreProvider.tsx +64 -0
- package/src/providers/index.ts +1 -0
- package/src/store/hooks.ts +6 -0
- package/src/store/index.ts +45 -0
- package/src/types/common.d.ts +8 -0
- package/src/types/media.ts +26 -0
- package/src/types/service.d.ts +34 -0
- package/tsconfig.json +28 -0
- package/tsup.config.ts +10 -0
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import posthog from "posthog-js";
|
|
2
|
+
|
|
3
|
+
declare global {
|
|
4
|
+
interface Window {
|
|
5
|
+
dataLayer: Record<string, any>[];
|
|
6
|
+
}
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
declare function gtag(
|
|
10
|
+
command: "event",
|
|
11
|
+
eventName: string,
|
|
12
|
+
eventParameters: Record<string, any>
|
|
13
|
+
): void;
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
// GTM
|
|
17
|
+
const pushEventToDataLayer = (event: string, data: Record<string, any>) => {
|
|
18
|
+
try {
|
|
19
|
+
window.dataLayer = window.dataLayer || [];
|
|
20
|
+
|
|
21
|
+
window.dataLayer.push({
|
|
22
|
+
event,
|
|
23
|
+
...data,
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
} catch (error) {
|
|
27
|
+
console.error(error);
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
// GA
|
|
32
|
+
const pushEventToGA = (eventName: string, eventData: Record<string, any>) => {
|
|
33
|
+
if (typeof gtag != "function") {
|
|
34
|
+
console.error("gtag is not a function");
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
gtag("event", eventName, eventData);
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
// Posthog
|
|
41
|
+
const pushEventToPosthog = (eventName: string, eventData: Record<string, any>) => {
|
|
42
|
+
posthog.capture(eventName, eventData);
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
function useDataTracking() {
|
|
46
|
+
const trackEvent = (eventName: string, eventData: Record<string, any>, useTools?: ("gtm" | "ga" | "posthog")[]) => {
|
|
47
|
+
|
|
48
|
+
useTools = useTools || ["gtm"];
|
|
49
|
+
|
|
50
|
+
if (useTools.includes("gtm") && typeof window !== "undefined") {
|
|
51
|
+
pushEventToDataLayer(eventName, eventData);
|
|
52
|
+
}
|
|
53
|
+
if (useTools.includes("ga") && typeof gtag == "function") {
|
|
54
|
+
pushEventToGA(eventName, eventData);
|
|
55
|
+
}
|
|
56
|
+
if (useTools.includes("posthog") && typeof posthog == "function") {
|
|
57
|
+
pushEventToPosthog(eventName, eventData);
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
return {
|
|
62
|
+
trackEvent
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
export { useDataTracking };
|
|
67
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./hooks";
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import {
|
|
2
|
+
useGenerateThaocamvienCertificate,
|
|
3
|
+
useGenerateTemplateCertificate,
|
|
4
|
+
useGenerateFansipanCertificate
|
|
5
|
+
} from "@phygitallabs/generate-certificate";
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
export { useGenerateThaocamvienCertificate, useGenerateTemplateCertificate, useGenerateFansipanCertificate };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export {
|
|
2
|
+
type CommonModel as GenerateCertificateCommonModel,
|
|
3
|
+
type DateTimeNumber as GenerateCertificateDateTimeNumber,
|
|
4
|
+
type EntityStatus as GenerateCertificateEntityStatus,
|
|
5
|
+
type Media as GenerateCertificateMedia,
|
|
6
|
+
type MediaType as GenerateCertificateMediaType,
|
|
7
|
+
} from "@phygitallabs/generate-certificate";
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
// Re-export from @phygitallabs/api-core package
|
|
2
|
+
export {
|
|
3
|
+
useManyLocations as useLocationsList,
|
|
4
|
+
useOneLocation as useLocationDetail,
|
|
5
|
+
useUserCampaignsCompletedLocation as useLocationProgress,
|
|
6
|
+
useManyUserActionLocations,
|
|
7
|
+
locationQueryKeys
|
|
8
|
+
} from "@phygitallabs/api-core";
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export {
|
|
2
|
+
type LocationModel,
|
|
3
|
+
type CoreLocationModel,
|
|
4
|
+
type SocialMedia,
|
|
5
|
+
type Media,
|
|
6
|
+
type MediaType,
|
|
7
|
+
type EntityStatus,
|
|
8
|
+
type CommonModel,
|
|
9
|
+
type DateTimeNumber,
|
|
10
|
+
type LocationAddress,
|
|
11
|
+
type GeoPosition,
|
|
12
|
+
type AdvertisingConfig,
|
|
13
|
+
type DeviceMedia,
|
|
14
|
+
type LocationTranslations,
|
|
15
|
+
type AIBotConfig,
|
|
16
|
+
type GetManyUserActionLocationResponse,
|
|
17
|
+
type UserActionLocation,
|
|
18
|
+
} from "./locationModel";
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
// Re-export from @phygitallabs/api-core package
|
|
2
|
+
export type {
|
|
3
|
+
LocationModel,
|
|
4
|
+
CoreLocationModel,
|
|
5
|
+
SocialMedia,
|
|
6
|
+
Media,
|
|
7
|
+
MediaType,
|
|
8
|
+
EntityStatus,
|
|
9
|
+
CommonModel,
|
|
10
|
+
DateTimeNumber,
|
|
11
|
+
LocationAddress,
|
|
12
|
+
GeoPosition,
|
|
13
|
+
AdvertisingConfig,
|
|
14
|
+
DeviceMedia,
|
|
15
|
+
LocationTranslations,
|
|
16
|
+
AIBotConfig,
|
|
17
|
+
Position,
|
|
18
|
+
AddressRegion,
|
|
19
|
+
GetManyUserActionLocationResponse,
|
|
20
|
+
UserActionLocation,
|
|
21
|
+
} from "@phygitallabs/api-core";
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
|
|
2
|
+
export const sortLocationsByIndex = <T extends { index?: number }>(locations: T[]): T[] => {
|
|
3
|
+
return [...locations].sort((a, b) => (a.index ?? 0) - (b.index ?? 0));
|
|
4
|
+
};
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
export const filterLocationsByProperty = <T extends Record<string, any>>(
|
|
8
|
+
locations: T[],
|
|
9
|
+
propertyName: keyof T,
|
|
10
|
+
value: boolean
|
|
11
|
+
): T[] => {
|
|
12
|
+
return locations.filter(location => location[propertyName] === value);
|
|
13
|
+
};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { useOneMemory, useManyMemory, useInfiniteMemories, useCreateMemory, useUploadMedia, resetMemoriesQuery, memoriesKey } from "@phygitallabs/api-core";
|
|
2
|
+
|
|
3
|
+
export { useOneMemory, useManyMemory, useInfiniteMemories, useCreateMemory, useUploadMedia, resetMemoriesQuery, memoriesKey };
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { NotificationProvider as NotificationProviderApi } from "@phygitallabs/notification-api";
|
|
3
|
+
|
|
4
|
+
import { EnvironmentType } from "../../../types/common";
|
|
5
|
+
|
|
6
|
+
import type { LPResponse } from "@phygitallabs/notification-api";
|
|
7
|
+
|
|
8
|
+
import serviceApiUrl from "../../../constants/service";
|
|
9
|
+
|
|
10
|
+
interface NotificationCallbacks {
|
|
11
|
+
onWebSocketOpen?: (metadata: Record<string, any>) => void;
|
|
12
|
+
onWebSocketClose?: (metadata: Record<string, any>) => void;
|
|
13
|
+
onWebSocketMessage?: (data: LPResponse) => void;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
interface NotificationProviderProps extends NotificationCallbacks {
|
|
17
|
+
children: React.ReactNode;
|
|
18
|
+
autoConnect?: boolean;
|
|
19
|
+
user: { id: string; accessToken: string | null };
|
|
20
|
+
environment?: EnvironmentType;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export const NotificationProvider: React.FC<NotificationProviderProps> = ({
|
|
24
|
+
children,
|
|
25
|
+
autoConnect = true,
|
|
26
|
+
environment = "dev",
|
|
27
|
+
user,
|
|
28
|
+
onWebSocketOpen,
|
|
29
|
+
onWebSocketClose,
|
|
30
|
+
onWebSocketMessage,
|
|
31
|
+
}) => {
|
|
32
|
+
|
|
33
|
+
const webSocketUrl = serviceApiUrl[environment]?.API_NOTIFICATION_SOCKET_URL;
|
|
34
|
+
|
|
35
|
+
return (
|
|
36
|
+
<NotificationProviderApi
|
|
37
|
+
userUid={user.id}
|
|
38
|
+
accessToken={user.accessToken}
|
|
39
|
+
webSocketUrl={webSocketUrl}
|
|
40
|
+
autoConnect={autoConnect}
|
|
41
|
+
onWebSocketOpen={onWebSocketOpen}
|
|
42
|
+
onWebSocketClose={onWebSocketClose}
|
|
43
|
+
onWebSocketMessage={onWebSocketMessage}
|
|
44
|
+
>
|
|
45
|
+
{children}
|
|
46
|
+
</NotificationProviderApi>
|
|
47
|
+
);
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
export default NotificationProvider;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
// Export reward service hooks
|
|
2
|
+
export {
|
|
3
|
+
useManyUserRewards,
|
|
4
|
+
useGetUserRewards,
|
|
5
|
+
useClaimUserReward,
|
|
6
|
+
useListRewardModels,
|
|
7
|
+
useGetRewardModel,
|
|
8
|
+
useCreateRewardModel,
|
|
9
|
+
useUpdateRewardModel,
|
|
10
|
+
useDeleteRewardModel,
|
|
11
|
+
useCreateModelGroupReward,
|
|
12
|
+
useClearUserRewardCache,
|
|
13
|
+
useV1ListRewards,
|
|
14
|
+
} from "./useRewardService";
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
// Re-export from @phygitallabs/reward package
|
|
2
|
+
export {
|
|
3
|
+
useManyUserRewards,
|
|
4
|
+
useGetUserRewards,
|
|
5
|
+
useClaimUserReward,
|
|
6
|
+
useApiListRewardModels as useListRewardModels,
|
|
7
|
+
useApiGetRewardModel as useGetRewardModel,
|
|
8
|
+
useApiCreateRewardModel as useCreateRewardModel,
|
|
9
|
+
useApiUpdateRewardModel as useUpdateRewardModel,
|
|
10
|
+
useApiDeleteRewardModel as useDeleteRewardModel,
|
|
11
|
+
useCreateModelGroupReward,
|
|
12
|
+
useClearUserRewardCache,
|
|
13
|
+
useV1ListRewards
|
|
14
|
+
} from "@phygitallabs/reward/src/hooks";
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
// Export reward functionality
|
|
2
|
+
export {
|
|
3
|
+
useManyUserRewards,
|
|
4
|
+
useGetUserRewards,
|
|
5
|
+
useClaimUserReward,
|
|
6
|
+
useListRewardModels,
|
|
7
|
+
useGetRewardModel,
|
|
8
|
+
useCreateRewardModel,
|
|
9
|
+
useUpdateRewardModel,
|
|
10
|
+
useDeleteRewardModel,
|
|
11
|
+
useCreateModelGroupReward,
|
|
12
|
+
useClearUserRewardCache,
|
|
13
|
+
useV1ListRewards
|
|
14
|
+
} from "./hooks";
|
|
15
|
+
|
|
16
|
+
export * from "./types";
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
// Re-export from @phygitallabs/reward package
|
|
2
|
+
export {
|
|
3
|
+
CmentityRewardType,
|
|
4
|
+
type CmentityStatus
|
|
5
|
+
} from "@phygitallabs/reward";
|
|
6
|
+
|
|
7
|
+
// Define RewardClaimStatus locally since it's not exported from reward package
|
|
8
|
+
export enum RewardClaimStatus {
|
|
9
|
+
NOT_CLAIMED = "not_claimed",
|
|
10
|
+
CLAIMED = "claimed",
|
|
11
|
+
IN_PROGRESS = "in_progress",
|
|
12
|
+
FAILED = "failed",
|
|
13
|
+
}
|
|
@@ -0,0 +1,281 @@
|
|
|
1
|
+
// Define request types locally since they're not exported from reward package
|
|
2
|
+
import { PaginationRequest, GetManyResponse } from "@phygitallabs/api-core/src/types/pagination";
|
|
3
|
+
import { EntityRewardModel, UserReward } from "./reward";
|
|
4
|
+
|
|
5
|
+
// User Rewards API Requests
|
|
6
|
+
export interface GetManyUserRewardsRequest extends PaginationRequest {
|
|
7
|
+
user_id?: string;
|
|
8
|
+
device_uid?: string;
|
|
9
|
+
group_reward_id?: string;
|
|
10
|
+
project_id?: string;
|
|
11
|
+
campaign_id?: string;
|
|
12
|
+
achievement_id?: string;
|
|
13
|
+
status?: string;
|
|
14
|
+
claim_status?: string;
|
|
15
|
+
is_claimable?: boolean;
|
|
16
|
+
is_expired?: boolean;
|
|
17
|
+
type?: string;
|
|
18
|
+
labels?: string; // JSON string
|
|
19
|
+
created_from?: string;
|
|
20
|
+
created_to?: string;
|
|
21
|
+
claimed_from?: string;
|
|
22
|
+
claimed_to?: string;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export interface GetOneUserRewardRequest {
|
|
26
|
+
id: string;
|
|
27
|
+
include_reward_model?: boolean;
|
|
28
|
+
include_certificate?: boolean;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export interface CreateUserRewardRequest {
|
|
32
|
+
user_id: string;
|
|
33
|
+
device_uid?: string;
|
|
34
|
+
reward_model_id: string;
|
|
35
|
+
group_reward_id?: string;
|
|
36
|
+
project_id?: string;
|
|
37
|
+
campaign_id?: string;
|
|
38
|
+
achievement_id?: string;
|
|
39
|
+
custom_info?: Record<string, any>;
|
|
40
|
+
labels?: Record<string, any>;
|
|
41
|
+
metadata?: Record<string, any>;
|
|
42
|
+
claim_data?: Record<string, any>;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export interface UpdateUserRewardRequest {
|
|
46
|
+
status?: string;
|
|
47
|
+
claim_status?: string;
|
|
48
|
+
claimed_at?: string;
|
|
49
|
+
claimed_by?: string;
|
|
50
|
+
claim_data?: Record<string, any>;
|
|
51
|
+
certificate?: {
|
|
52
|
+
thumbnail_url?: string;
|
|
53
|
+
image_url?: string;
|
|
54
|
+
title?: string;
|
|
55
|
+
subtitle?: string;
|
|
56
|
+
user_name?: string;
|
|
57
|
+
user_email?: string;
|
|
58
|
+
user_phone?: string;
|
|
59
|
+
issued_at?: string;
|
|
60
|
+
issued_by?: string;
|
|
61
|
+
};
|
|
62
|
+
custom_info?: Record<string, any>;
|
|
63
|
+
labels?: Record<string, any>;
|
|
64
|
+
metadata?: Record<string, any>;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
export interface ClaimUserRewardRequest {
|
|
68
|
+
id: string;
|
|
69
|
+
data: {
|
|
70
|
+
certificate?: {
|
|
71
|
+
thumbnail_url?: string;
|
|
72
|
+
image_url?: string;
|
|
73
|
+
title?: string;
|
|
74
|
+
subtitle?: string;
|
|
75
|
+
user_name?: string;
|
|
76
|
+
user_email?: string;
|
|
77
|
+
user_phone?: string;
|
|
78
|
+
issued_at?: string;
|
|
79
|
+
issued_by?: string;
|
|
80
|
+
};
|
|
81
|
+
custom_info?: Record<string, any>;
|
|
82
|
+
labels?: Record<string, any>;
|
|
83
|
+
metadata?: Record<string, any>;
|
|
84
|
+
claim_data?: Record<string, any>;
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
// Reward Models API Requests
|
|
89
|
+
export interface GetManyRewardModelsRequest extends PaginationRequest {
|
|
90
|
+
name?: string;
|
|
91
|
+
type?: string;
|
|
92
|
+
is_active?: boolean;
|
|
93
|
+
is_claimable?: boolean;
|
|
94
|
+
project_id?: string;
|
|
95
|
+
campaign_id?: string;
|
|
96
|
+
achievement_id?: string;
|
|
97
|
+
group_reward_id?: string;
|
|
98
|
+
labels?: string; // JSON string
|
|
99
|
+
created_from?: string;
|
|
100
|
+
created_to?: string;
|
|
101
|
+
valid_from?: string;
|
|
102
|
+
valid_until?: string;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
export interface GetOneRewardModelRequest {
|
|
106
|
+
id: string;
|
|
107
|
+
include_rules?: boolean;
|
|
108
|
+
include_media?: boolean;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
export interface CreateRewardModelRequest {
|
|
112
|
+
name: string;
|
|
113
|
+
description?: string;
|
|
114
|
+
type: string;
|
|
115
|
+
image_url?: string;
|
|
116
|
+
thumbnail_url?: string;
|
|
117
|
+
value?: number;
|
|
118
|
+
currency?: string;
|
|
119
|
+
is_active?: boolean;
|
|
120
|
+
is_claimable?: boolean;
|
|
121
|
+
claim_limit?: number;
|
|
122
|
+
valid_from?: string;
|
|
123
|
+
valid_until?: string;
|
|
124
|
+
labels?: Record<string, any>;
|
|
125
|
+
custom_info?: Record<string, any>;
|
|
126
|
+
group_reward_id?: string;
|
|
127
|
+
project_id?: string;
|
|
128
|
+
campaign_id?: string;
|
|
129
|
+
achievement_id?: string;
|
|
130
|
+
media?: {
|
|
131
|
+
type: string;
|
|
132
|
+
url: string;
|
|
133
|
+
thumbnail_url?: string;
|
|
134
|
+
};
|
|
135
|
+
rules?: Array<{
|
|
136
|
+
name: string;
|
|
137
|
+
description?: string;
|
|
138
|
+
type: string;
|
|
139
|
+
conditions: Record<string, any>;
|
|
140
|
+
is_active?: boolean;
|
|
141
|
+
priority?: number;
|
|
142
|
+
}>;
|
|
143
|
+
metadata?: Record<string, any>;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
export interface UpdateRewardModelRequest {
|
|
147
|
+
name?: string;
|
|
148
|
+
description?: string;
|
|
149
|
+
type?: string;
|
|
150
|
+
image_url?: string;
|
|
151
|
+
thumbnail_url?: string;
|
|
152
|
+
value?: number;
|
|
153
|
+
currency?: string;
|
|
154
|
+
is_active?: boolean;
|
|
155
|
+
is_claimable?: boolean;
|
|
156
|
+
claim_limit?: number;
|
|
157
|
+
valid_from?: string;
|
|
158
|
+
valid_until?: string;
|
|
159
|
+
labels?: Record<string, any>;
|
|
160
|
+
custom_info?: Record<string, any>;
|
|
161
|
+
group_reward_id?: string;
|
|
162
|
+
project_id?: string;
|
|
163
|
+
campaign_id?: string;
|
|
164
|
+
achievement_id?: string;
|
|
165
|
+
media?: {
|
|
166
|
+
type: string;
|
|
167
|
+
url: string;
|
|
168
|
+
thumbnail_url?: string;
|
|
169
|
+
};
|
|
170
|
+
rules?: Array<{
|
|
171
|
+
id?: string;
|
|
172
|
+
name: string;
|
|
173
|
+
description?: string;
|
|
174
|
+
type: string;
|
|
175
|
+
conditions: Record<string, any>;
|
|
176
|
+
is_active?: boolean;
|
|
177
|
+
priority?: number;
|
|
178
|
+
}>;
|
|
179
|
+
metadata?: Record<string, any>;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
// Reward Groups API Requests
|
|
183
|
+
export interface GetManyRewardGroupsRequest extends PaginationRequest {
|
|
184
|
+
name?: string;
|
|
185
|
+
is_active?: boolean;
|
|
186
|
+
project_id?: string;
|
|
187
|
+
campaign_id?: string;
|
|
188
|
+
achievement_id?: string;
|
|
189
|
+
labels?: string; // JSON string
|
|
190
|
+
created_from?: string;
|
|
191
|
+
created_to?: string;
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
export interface GetOneRewardGroupRequest {
|
|
195
|
+
id: string;
|
|
196
|
+
include_rewards?: boolean;
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
export interface CreateRewardGroupRequest {
|
|
200
|
+
name: string;
|
|
201
|
+
description?: string;
|
|
202
|
+
is_active?: boolean;
|
|
203
|
+
reward_ids: string[];
|
|
204
|
+
project_id?: string;
|
|
205
|
+
campaign_id?: string;
|
|
206
|
+
achievement_id?: string;
|
|
207
|
+
labels?: Record<string, any>;
|
|
208
|
+
custom_info?: Record<string, any>;
|
|
209
|
+
metadata?: Record<string, any>;
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
export interface UpdateRewardGroupRequest {
|
|
213
|
+
name?: string;
|
|
214
|
+
description?: string;
|
|
215
|
+
is_active?: boolean;
|
|
216
|
+
reward_ids?: string[];
|
|
217
|
+
project_id?: string;
|
|
218
|
+
campaign_id?: string;
|
|
219
|
+
achievement_id?: string;
|
|
220
|
+
labels?: Record<string, any>;
|
|
221
|
+
custom_info?: Record<string, any>;
|
|
222
|
+
metadata?: Record<string, any>;
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
// Group Reward Models API Requests
|
|
226
|
+
export interface CreateModelGroupRewardRequest {
|
|
227
|
+
group_reward_ids: string[];
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
// API Responses
|
|
231
|
+
export interface GetManyUserRewardsResponse extends GetManyResponse<UserReward> { }
|
|
232
|
+
export interface GetOneUserRewardResponse {
|
|
233
|
+
data: UserReward;
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
export interface GetManyRewardModelsResponse extends GetManyResponse<EntityRewardModel> { }
|
|
237
|
+
export interface GetOneRewardModelResponse {
|
|
238
|
+
data: EntityRewardModel;
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
export interface CreateUserRewardResponse {
|
|
242
|
+
data: UserReward;
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
export interface UpdateUserRewardResponse {
|
|
246
|
+
data: UserReward;
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
export interface ClaimUserRewardResponse {
|
|
250
|
+
data: UserReward;
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
export interface CreateRewardModelResponse {
|
|
254
|
+
data: EntityRewardModel;
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
export interface UpdateRewardModelResponse {
|
|
258
|
+
data: EntityRewardModel;
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
export interface CreateRewardGroupResponse {
|
|
262
|
+
data: {
|
|
263
|
+
id: string;
|
|
264
|
+
name: string;
|
|
265
|
+
description?: string;
|
|
266
|
+
is_active: boolean;
|
|
267
|
+
reward_ids: string[];
|
|
268
|
+
project_id?: string;
|
|
269
|
+
campaign_id?: string;
|
|
270
|
+
achievement_id?: string;
|
|
271
|
+
labels?: Record<string, any>;
|
|
272
|
+
custom_info?: Record<string, any>;
|
|
273
|
+
metadata?: Record<string, any>;
|
|
274
|
+
created_at: string;
|
|
275
|
+
updated_at: string;
|
|
276
|
+
};
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
export interface CreateModelGroupRewardResponse {
|
|
280
|
+
data: EntityRewardModel[];
|
|
281
|
+
}
|