@blux.ai/web-sdk 2.1.1 → 2.1.4-dev1

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.
@@ -1,6 +1,6 @@
1
1
  /* eslint-disable @typescript-eslint/no-namespace */
2
2
  import { z } from "zod";
3
- import { countryCodeWithLowerCaseSchema, customPropertiesRequestSchema, customPropertiesSchema, dateSchema, eventPropertiesSchema, objectIdSchema, recommendationRequestSchema, } from "../utils/zodSchemas";
3
+ import { countryCodeWithLowerCaseSchema, customPropertiesRequestSchema, customPropertiesSchema, dateSchema, eventPropertiesSchema, internalEventPropertiesSchema, objectIdSchema, recommendationRequestSchema, } from "../utils/zodSchemas";
4
4
  var HttpMethod;
5
5
  (function (HttpMethod) {
6
6
  HttpMethod["GET"] = "get";
@@ -80,16 +80,9 @@ export var APIs;
80
80
  events: z.array(z.object({
81
81
  device_id: objectIdSchema.optional(),
82
82
  event_type: z.string(),
83
- event_value: z.string().optional(),
84
- item_id: z.string().optional(),
85
83
  event_properties: eventPropertiesSchema.optional(),
86
84
  custom_event_properties: customPropertiesSchema.optional(),
87
- internal_event_properties: z
88
- .object({
89
- url: z.string().optional(),
90
- ref: z.string().optional(),
91
- })
92
- .optional(),
85
+ internal_event_properties: internalEventPropertiesSchema.optional(),
93
86
  captured_at: dateSchema,
94
87
  })),
95
88
  });
@@ -1 +1 @@
1
- {"version":3,"file":"APIs.js","sourceRoot":"/","sources":["src/apis/APIs.ts"],"names":[],"mappings":"AAAA,oDAAoD;AACpD,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EACL,8BAA8B,EAC9B,6BAA6B,EAC7B,sBAAsB,EACtB,UAAU,EACV,qBAAqB,EACrB,cAAc,EACd,2BAA2B,GAC5B,MAAM,qBAAqB,CAAC;AAK7B,IAAK,UAKJ;AALD,WAAK,UAAU;IACb,yBAAW,CAAA;IACX,2BAAa,CAAA;IACb,yBAAW,CAAA;IACX,+BAAiB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U;YACvB,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;SAC/B,CAAC,CAAC;QAGU,0BAAU,GAAG,CAAC,CAAC,MAAM,CAAC;YACjC,cAAc,EAAE,CAAC,CAAC,MAAM,EAAE;SAC3B,CAAC,CAAC;IAIL,CAAC,EAxBgB,eAAe,GAAf,oBAAe,KAAf,oBAAe,QAwB/B;IACD,IAAiB,gBAAgB,CA+BhC;IA/BD,WAAiB,gBAAgB;QAClB,qBAAI,GAAG,kBAAkB,CAAC;QAC1B,qBAAI,GAAG,GAAG,gBAAgB,kBAAkB,CAAC;QAC7C,uBAAM,GAAG,UAAU,CAAC,IAAI,CAAC;QAEzB,2BAAU,GAAG,CAAC,CAAC,MAAM,CAAC;YACjC,cAAc,EAAE,cAAc;SAC/B,CAAC,CAAC;QAGU,2BAAU,GAAG,CAAC,CAAC,MAAM,CAAC;YACjC,YAAY,EAAE,cAAc;YAC5B,SAAS,EAAE,cAAc;YACzB,QAAQ,EAAE,CAAC,CAAC,KAAK,CAAC;gBAChB,CAAC,CAAC,OAAO,CAAC,cAAc,CAAC,OAAO,CAAC;gBACjC,CAAC,CAAC,OAAO,CAAC,cAAc,CAAC,GAAG,CAAC;gBAC7B,CAAC,CAAC,OAAO,CAAC,cAAc,CAAC,OAAO,CAAC;aAClC,CAAC;SACH,CAAC,CAAC;IAaL,CAAC,EA/BgB,gBAAgB,GAAhB,qBAAgB,KAAhB,qBAAgB,QA+BhC;AACH,CAAC,EA/OgB,IAAI,KAAJ,IAAI,QA+OpB","sourcesContent":["/* eslint-disable @typescript-eslint/no-namespace */\nimport { z } from \"zod\";\n\nimport {\n countryCodeWithLowerCaseSchema,\n customPropertiesRequestSchema,\n customPropertiesSchema,\n dateSchema,\n eventPropertiesSchema,\n objectIdSchema,\n recommendationRequestSchema,\n} from \"../utils/zodSchemas\";\n\nimport type { Serialize } from \"../utils/Base\";\nimport type { RecResponse } from \"../utils/zodSchemas\";\n\nenum HttpMethod {\n GET = \"get\",\n POST = \"post\",\n PUT = \"put\",\n DELETE = \"delete\",\n}\n\nexport enum DevicePlatform {\n ios = \"ios\",\n android = \"android\",\n browser = \"browser\",\n}\n\nconst applicationsRoot = \"/applications/{application_id}\";\nconst applicationsRootV2 = \"/v2/applications/{application_id}\";\n\nexport namespace APIs {\n export namespace bluxUsersInitialize {\n export const name = \"bluxUsersInitialize\";\n export const path = `${applicationsRoot}/blux-users/initialize`;\n export const method = HttpMethod.POST;\n\n export const bodySchema = z.object({\n device_id: objectIdSchema.optional(),\n country_code: countryCodeWithLowerCaseSchema.optional(),\n device_model: z.string(),\n language_code: z.string(),\n os_version: z.string(),\n platform: z.nativeEnum(DevicePlatform),\n sdk_type: z.string(),\n sdk_version: z.string(),\n timezone: z.string(),\n isVisitHandlingInSdk: z.boolean().default(false), // sdk 업데이트 후 삭제\n blux_user_id: z.string().optional(),\n });\n export type Body = Serialize<z.input<typeof bodySchema>>;\n\n export const pathSchema = z.object({\n application_id: z.string().optional(),\n });\n export type PathParam = Serialize<z.input<typeof pathSchema>>;\n\n export type ResponseData = {\n blux_user_id: string;\n device_id?: string;\n };\n }\n\n export namespace bluxUsersSignIn {\n export const name = \"bluxUsersSignIn\";\n export const path = `${applicationsRoot}/blux-users/{blux_user_id}/sign-in`;\n export const method = HttpMethod.PUT;\n\n export const bodySchema = z.object({\n user_id: z.string(),\n device_id: z.string().optional(), // TODO: @all sdk update 후 필수로 변경\n });\n export type Body = Serialize<z.input<typeof bodySchema>>;\n\n export const pathSchema = z.object({\n application_id: z.string().optional(),\n blux_user_id: objectIdSchema,\n });\n export type PathParam = Serialize<z.input<typeof pathSchema>>;\n\n export type ResponseData = {\n blux_user_id: string;\n };\n }\n\n export namespace bluxUsersSignOut {\n export const name = \"bluxUsersSignOut\";\n export const path = `${applicationsRoot}/blux-users/{blux_user_id}/sign-out`;\n export const method = HttpMethod.PUT;\n\n export const bodySchema = z.object({\n device_id: objectIdSchema.optional(),\n });\n export type Body = Serialize<z.input<typeof bodySchema>>;\n\n export const pathSchema = z.object({\n application_id: z.string().optional(), // TODO: @all objectIdSchema 로 변경\n blux_user_id: objectIdSchema,\n });\n export type PathParam = Serialize<z.input<typeof pathSchema>>;\n\n export type ResponseData = {\n blux_user_id: string;\n };\n }\n\n export namespace bluxUsersCollectEvents {\n export const name = \"bluxUsersCollectEvents\";\n export const path = `${applicationsRoot}/blux-users/{blux_user_id}/collect-events`;\n export const method = HttpMethod.POST;\n export const pathSchema = z.object({\n application_id: objectIdSchema,\n blux_user_id: objectIdSchema,\n });\n export type PathParam = Serialize<z.input<typeof pathSchema>>;\n\n export const bodySchema = z.object({\n events: z.array(\n z.object({\n device_id: objectIdSchema.optional(),\n event_type: z.string(),\n event_value: z.string().optional(),\n item_id: z.string().optional(),\n event_properties: eventPropertiesSchema.optional(),\n custom_event_properties: customPropertiesSchema.optional(),\n internal_event_properties: z\n .object({\n url: z.string().optional(),\n ref: z.string().optional(),\n })\n .optional(),\n captured_at: dateSchema,\n }),\n ),\n });\n export type Body = Serialize<z.input<typeof bodySchema>>;\n\n export type ResponseData = boolean;\n }\n\n export namespace bluxUsersUpdateUserProperties {\n export const name = \"bluxUsersUpdateUserProperties\";\n export const path = `${applicationsRoot}/blux-users/{blux_user_id}/update-user-properties`;\n export const method = HttpMethod.PUT;\n\n export const bodySchema = z.object({\n properties: z.object({\n phone_number: z.string().nullable().optional(),\n email_address: z.string().nullable().optional(),\n nighttime_notification_consent: z.boolean().nullable().optional(),\n marketing_notification_consent: z.boolean().nullable().optional(),\n\n // TODO: @luna 김캐디 연동 수정 이후 삭제\n sms_consent: z.boolean().nullable().optional(),\n email_consent: z.boolean().nullable().optional(),\n\n marketing_notification_sms_consent: z.boolean().nullable().optional(),\n marketing_notification_email_consent: z.boolean().nullable().optional(),\n marketing_notification_kakao_consent: z.boolean().nullable().optional(),\n marketing_notification_push_consent: z.boolean().nullable().optional(),\n }),\n });\n export type Body = Serialize<z.input<typeof bodySchema>>;\n\n export const pathSchema = z.object({\n application_id: z.string().optional(),\n blux_user_id: objectIdSchema,\n });\n export type PathParam = Serialize<z.input<typeof pathSchema>>;\n\n export type ResponseData = {\n blux_user_id: string;\n };\n }\n\n export namespace bluxUsersUpdateCustomUserProperties {\n export const name = \"bluxUsersUpdateCustomUserProperties\";\n export const path = `${applicationsRoot}/blux-users/{blux_user_id}/update-custom-user-properties`;\n export const method = HttpMethod.PUT;\n\n export const bodySchema = z.object({\n properties: customPropertiesRequestSchema,\n });\n export type Body = Serialize<z.input<typeof bodySchema>>;\n\n export const pathSchema = z.object({\n application_id: z.string().optional(),\n blux_user_id: objectIdSchema,\n });\n export type PathParam = Serialize<z.input<typeof pathSchema>>;\n\n export type ResponseData = {\n blux_user_id: string;\n };\n }\n\n export namespace bluxUsersGetItemRecommendationsV2 {\n export const name = \"bluxUsersGetItemRecommendationsV2\";\n export const path = `${applicationsRootV2}/blux-users/{blux_user_id}/item-recommendations`;\n export const method = HttpMethod.POST;\n\n export const bodySchema = recommendationRequestSchema;\n export type Body = Serialize<z.input<typeof bodySchema>>;\n\n export const pathSchema = z.object({\n application_id: objectIdSchema,\n blux_user_id: objectIdSchema,\n });\n export type PathParam = Serialize<z.input<typeof pathSchema>>;\n\n export type ResponseData = RecResponse;\n }\n\n export namespace crmEventsCreate {\n export const name = \"crmEventsCreate\";\n export const path = `${applicationsRoot}/crm-events`;\n export const method = HttpMethod.POST;\n\n export const bodySchema = z.object({\n notification_id: objectIdSchema,\n crm_event_type: z.union([\n z.literal(\"push_opened\"),\n z.literal(\"button_clicked\"),\n z.literal(\"landing_clicked\"),\n z.literal(\"inapp_opened\"),\n ]),\n captured_at: dateSchema,\n item_id: z.string().optional(),\n });\n export type Body = Serialize<z.input<typeof bodySchema>>;\n\n export const pathSchema = z.object({\n application_id: z.string(),\n });\n export type PathParam = Serialize<z.input<typeof pathSchema>>;\n\n export type ResponseData = boolean;\n }\n export namespace inappsDispatcher {\n export const name = \"inappsDispatcher\";\n export const path = `${applicationsRoot}/inapps/dispatch`;\n export const method = HttpMethod.POST;\n\n export const pathSchema = z.object({\n application_id: objectIdSchema,\n });\n export type PathParam = Serialize<z.input<typeof pathSchema>>;\n\n export const bodySchema = z.object({\n blux_user_id: objectIdSchema,\n device_id: objectIdSchema,\n platform: z.union([\n z.literal(DevicePlatform.android),\n z.literal(DevicePlatform.ios),\n z.literal(DevicePlatform.browser),\n ]),\n });\n export type Body = Serialize<z.input<typeof bodySchema>>;\n\n export type ResponseData =\n | ({\n notificationId: string;\n inappId: string;\n htmlString: string;\n baseUrl: string;\n } & { shouldDisplay: true })\n | {\n shouldDisplay: false;\n };\n }\n}\n"]}
1
+ {"version":3,"file":"APIs.js","sourceRoot":"/","sources":["src/apis/APIs.ts"],"names":[],"mappings":"AAAA,oDAAoD;AACpD,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EACL,8BAA8B,EAC9B,6BAA6B,EAC7B,sBAAsB,EACtB,UAAU,EACV,qBAAqB,EACrB,6BAA6B,EAC7B,cAAc,EACd,2BAA2B,GAC5B,MAAM,qBAAqB,CAAC;AAK7B,IAAK,UAKJ;AALD,WAAK,UAAU;IACb,yBAAW,CAAA;IACX,2BAAa,CAAA;IACb,yBAAW,CAAA;IACX,+BAAiB,CAAA;AACnB,CAAC,EALI,UAAU,KAAV,UAAU,QAKd;AAED,MAAM,CAAN,IAAY,cAIX;AAJD,WAAY,cAAc;IACxB,6BAAW,CAAA;IACX,qCAAmB,CAAA;IACnB,qCAAmB,CAAA;AACrB,CAAC,EAJW,cAAc,KAAd,cAAc,QAIzB;AAED,MAAM,gBAAgB,GAAG,gCAAgC,CAAC;AAC1D,MAAM,kBAAkB,GAAG,mCAAmC,CAAC;AAE/D,MAAM,KAAW,IAAI,CAyOpB;AAzOD,WAAiB,IAAI;IACnB,IAAiB,mBAAmB,CA6BnC;IA7BD,WAAiB,mBAAmB;QACrB,wBAAI,GAAG,qBAAqB,CAAC;QAC7B,wBAAI,GAAG,GAAG,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AO,CAAC,cAAc,CAAC,GAAG,CAAC;gBAC7B,CAAC,CAAC,OAAO,CAAC,cAAc,CAAC,OAAO,CAAC;aAClC,CAAC;SACH,CAAC,CAAC;IAcL,CAAC,EAhCgB,gBAAgB,GAAhB,qBAAgB,KAAhB,qBAAgB,QAgChC;AACH,CAAC,EAzOgB,IAAI,KAAJ,IAAI,QAyOpB","sourcesContent":["/* eslint-disable @typescript-eslint/no-namespace */\nimport { z } from \"zod\";\n\nimport {\n countryCodeWithLowerCaseSchema,\n customPropertiesRequestSchema,\n customPropertiesSchema,\n dateSchema,\n eventPropertiesSchema,\n internalEventPropertiesSchema,\n objectIdSchema,\n recommendationRequestSchema,\n} from \"../utils/zodSchemas\";\n\nimport type { Serialize } from \"../utils/Base\";\nimport type { RecResponse } from \"../utils/zodSchemas\";\n\nenum HttpMethod {\n GET = \"get\",\n POST = \"post\",\n PUT = \"put\",\n DELETE = \"delete\",\n}\n\nexport enum DevicePlatform {\n ios = \"ios\",\n android = \"android\",\n browser = \"browser\",\n}\n\nconst applicationsRoot = \"/applications/{application_id}\";\nconst applicationsRootV2 = \"/v2/applications/{application_id}\";\n\nexport namespace APIs {\n export namespace bluxUsersInitialize {\n export const name = \"bluxUsersInitialize\";\n export const path = `${applicationsRoot}/blux-users/initialize`;\n export const method = HttpMethod.POST;\n\n export const bodySchema = z.object({\n device_id: objectIdSchema.optional(),\n country_code: countryCodeWithLowerCaseSchema.optional(),\n device_model: z.string(),\n language_code: z.string(),\n os_version: z.string(),\n platform: z.nativeEnum(DevicePlatform),\n sdk_type: z.string(),\n sdk_version: z.string(),\n timezone: z.string(),\n isVisitHandlingInSdk: z.boolean().default(false), // sdk 업데이트 후 삭제\n blux_user_id: z.string().optional(),\n });\n export type Body = Serialize<z.input<typeof bodySchema>>;\n\n export const pathSchema = z.object({\n application_id: z.string().optional(),\n });\n export type PathParam = Serialize<z.input<typeof pathSchema>>;\n\n export type ResponseData = {\n blux_user_id: string;\n device_id?: string;\n };\n }\n\n export namespace bluxUsersSignIn {\n export const name = \"bluxUsersSignIn\";\n export const path = `${applicationsRoot}/blux-users/{blux_user_id}/sign-in`;\n export const method = HttpMethod.PUT;\n\n export const bodySchema = z.object({\n user_id: z.string(),\n device_id: z.string().optional(), // TODO: @all sdk update 후 필수로 변경\n });\n export type Body = Serialize<z.input<typeof bodySchema>>;\n\n export const pathSchema = z.object({\n application_id: z.string().optional(),\n blux_user_id: objectIdSchema,\n });\n export type PathParam = Serialize<z.input<typeof pathSchema>>;\n\n export type ResponseData = {\n blux_user_id: string;\n };\n }\n\n export namespace bluxUsersSignOut {\n export const name = \"bluxUsersSignOut\";\n export const path = `${applicationsRoot}/blux-users/{blux_user_id}/sign-out`;\n export const method = HttpMethod.PUT;\n\n export const bodySchema = z.object({\n device_id: objectIdSchema.optional(),\n });\n export type Body = Serialize<z.input<typeof bodySchema>>;\n\n export const pathSchema = z.object({\n application_id: z.string().optional(), // TODO: @all objectIdSchema 로 변경\n blux_user_id: objectIdSchema,\n });\n export type PathParam = Serialize<z.input<typeof pathSchema>>;\n\n export type ResponseData = {\n blux_user_id: string;\n };\n }\n\n export namespace bluxUsersCollectEvents {\n export const name = \"bluxUsersCollectEvents\";\n export const path = `${applicationsRoot}/blux-users/{blux_user_id}/collect-events`;\n export const method = HttpMethod.POST;\n export const pathSchema = z.object({\n application_id: objectIdSchema,\n blux_user_id: objectIdSchema,\n });\n export type PathParam = Serialize<z.input<typeof pathSchema>>;\n\n export const bodySchema = z.object({\n events: z.array(\n z.object({\n device_id: objectIdSchema.optional(),\n event_type: z.string(),\n event_properties: eventPropertiesSchema.optional(),\n custom_event_properties: customPropertiesSchema.optional(),\n internal_event_properties: internalEventPropertiesSchema.optional(),\n captured_at: dateSchema,\n }),\n ),\n });\n export type Body = Serialize<z.input<typeof bodySchema>>;\n\n export type ResponseData = boolean;\n }\n\n export namespace bluxUsersUpdateUserProperties {\n export const name = \"bluxUsersUpdateUserProperties\";\n export const path = `${applicationsRoot}/blux-users/{blux_user_id}/update-user-properties`;\n export const method = HttpMethod.PUT;\n\n export const bodySchema = z.object({\n properties: z.object({\n phone_number: z.string().nullable().optional(),\n email_address: z.string().nullable().optional(),\n nighttime_notification_consent: z.boolean().nullable().optional(),\n marketing_notification_consent: z.boolean().nullable().optional(),\n\n // TODO: @luna 김캐디 연동 수정 이후 삭제\n sms_consent: z.boolean().nullable().optional(),\n email_consent: z.boolean().nullable().optional(),\n\n marketing_notification_sms_consent: z.boolean().nullable().optional(),\n marketing_notification_email_consent: z.boolean().nullable().optional(),\n marketing_notification_kakao_consent: z.boolean().nullable().optional(),\n marketing_notification_push_consent: z.boolean().nullable().optional(),\n }),\n });\n export type Body = Serialize<z.input<typeof bodySchema>>;\n\n export const pathSchema = z.object({\n application_id: z.string().optional(),\n blux_user_id: objectIdSchema,\n });\n export type PathParam = Serialize<z.input<typeof pathSchema>>;\n\n export type ResponseData = {\n blux_user_id: string;\n };\n }\n\n export namespace bluxUsersUpdateCustomUserProperties {\n export const name = \"bluxUsersUpdateCustomUserProperties\";\n export const path = `${applicationsRoot}/blux-users/{blux_user_id}/update-custom-user-properties`;\n export const method = HttpMethod.PUT;\n\n export const bodySchema = z.object({\n properties: customPropertiesRequestSchema,\n });\n export type Body = Serialize<z.input<typeof bodySchema>>;\n\n export const pathSchema = z.object({\n application_id: z.string().optional(),\n blux_user_id: objectIdSchema,\n });\n export type PathParam = Serialize<z.input<typeof pathSchema>>;\n\n export type ResponseData = {\n blux_user_id: string;\n };\n }\n\n export namespace bluxUsersGetItemRecommendationsV2 {\n export const name = \"bluxUsersGetItemRecommendationsV2\";\n export const path = `${applicationsRootV2}/blux-users/{blux_user_id}/item-recommendations`;\n export const method = HttpMethod.POST;\n\n export const bodySchema = recommendationRequestSchema;\n export type Body = Serialize<z.input<typeof bodySchema>>;\n\n export const pathSchema = z.object({\n application_id: objectIdSchema,\n blux_user_id: objectIdSchema,\n });\n export type PathParam = Serialize<z.input<typeof pathSchema>>;\n\n export type ResponseData = RecResponse;\n }\n\n export namespace crmEventsCreate {\n export const name = \"crmEventsCreate\";\n export const path = `${applicationsRoot}/crm-events`;\n export const method = HttpMethod.POST;\n\n export const bodySchema = z.object({\n notification_id: objectIdSchema,\n crm_event_type: z.union([\n z.literal(\"push_opened\"),\n z.literal(\"button_clicked\"),\n z.literal(\"landing_clicked\"),\n z.literal(\"inapp_opened\"),\n ]),\n captured_at: dateSchema,\n item_id: z.string().optional(),\n });\n export type Body = Serialize<z.input<typeof bodySchema>>;\n\n export const pathSchema = z.object({\n application_id: z.string(),\n });\n export type PathParam = Serialize<z.input<typeof pathSchema>>;\n\n export type ResponseData = boolean;\n }\n export namespace inappsDispatcher {\n export const name = \"inappsDispatcher\";\n export const path = `${applicationsRoot}/inapps/dispatch`;\n export const method = HttpMethod.POST;\n\n export const pathSchema = z.object({\n application_id: objectIdSchema,\n });\n export type PathParam = Serialize<z.input<typeof pathSchema>>;\n\n export const bodySchema = z.object({\n blux_user_id: objectIdSchema,\n device_id: objectIdSchema,\n platform: z.union([\n z.literal(DevicePlatform.android),\n z.literal(DevicePlatform.ios),\n z.literal(DevicePlatform.browser),\n ]),\n });\n export type Body = Serialize<z.input<typeof bodySchema>>;\n\n export type ResponseData =\n | ({\n notificationId: string;\n inappId: string;\n htmlString: string;\n baseUrl: string;\n } & { shouldDisplay: true; nextPollDelay: number })\n | {\n shouldDisplay: false;\n nextPollDelay: number;\n };\n }\n}\n"]}
@@ -1,33 +1,10 @@
1
- type EventProperties = {
2
- item_id?: string;
3
- page?: string;
4
- section?: string;
5
- price?: number;
6
- order_id?: string;
7
- rating?: number;
8
- position?: number;
9
- search_query?: string;
10
- order_amount?: number;
11
- paid_amount?: number;
12
- tracking?: {
13
- id: string;
14
- type: string;
15
- };
16
- items?: {
17
- id: string;
18
- price: number;
19
- quantity?: number;
20
- }[];
21
- };
1
+ import { CustomProperties, EventProperties, InternalEventProperties } from "../utils/zodSchemas";
22
2
  export interface EventRequest {
23
3
  id: string;
24
4
  event_type: string;
25
5
  event_properties?: EventProperties;
26
6
  custom_event_properties?: Record<string, any>;
27
- internal_event_properties?: {
28
- url?: string;
29
- ref?: string;
30
- };
7
+ internal_event_properties?: InternalEventProperties;
31
8
  captured_at: string;
32
9
  }
33
10
  type BaseEvent = {
@@ -55,6 +32,7 @@ export interface IAddOrderEvent extends BaseEvent {
55
32
  id: string;
56
33
  price: number;
57
34
  quantity?: number;
35
+ custom_event_properties?: CustomProperties;
58
36
  }[];
59
37
  }
60
38
  export interface IAddCustomEvent extends BaseEvent {
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"/","sources":["src/events/types.ts"],"names":[],"mappings":"AAAA,uDAAuD","sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\n\ntype EventProperties = {\n item_id?: string;\n page?: string;\n section?: string;\n price?: number;\n order_id?: string;\n rating?: number;\n position?: number;\n search_query?: string;\n order_amount?: number;\n paid_amount?: number;\n tracking?: {\n id: string;\n type: string;\n };\n items?: {\n id: string;\n price: number;\n quantity?: number;\n }[];\n};\n\nexport interface EventRequest {\n id: string;\n event_type: string;\n event_properties?: EventProperties;\n custom_event_properties?: Record<string, any>;\n internal_event_properties?: { url?: string; ref?: string };\n captured_at: string;\n}\n\ntype BaseEvent = {\n customEventProperties?: Record<string, any>;\n tracking?: EventProperties[\"tracking\"];\n};\n\nexport interface IAddProductDetailViewEvent extends BaseEvent {\n itemId: string;\n}\n\nexport interface IAddLikeEvent extends BaseEvent {\n itemId: string;\n}\n\nexport interface IAddCartaddEvent extends BaseEvent {\n itemId: string;\n}\n\nexport interface IAddRateEvent extends BaseEvent {\n itemId: string;\n rating: number;\n}\nexport interface IAddOrderEvent extends BaseEvent {\n orderId: string;\n paidAmount: number;\n orderAmount: number;\n items: {\n id: string;\n price: number;\n quantity?: number;\n }[];\n}\n\nexport interface IAddCustomEvent extends BaseEvent {\n eventType: string;\n eventProperties?: EventProperties;\n}\n\nexport type IVisitEvent = BaseEvent;\n\nexport type IAddPageVisitEvent = BaseEvent;\n\nexport interface IAddPageViewEvent extends BaseEvent {\n page: string;\n}\n\nexport interface IAddSectionViewEvent extends BaseEvent {\n section: string;\n}\n\nexport interface IAddInstantImpressionEvent extends BaseEvent {\n itemId: string;\n page: string;\n section: string;\n position: number;\n}\n\nexport interface IAddPersistentImpressionEvent extends BaseEvent {\n itemId: string;\n page: string;\n section: string;\n position: number;\n}\n\nexport interface IAddSearchEvent extends BaseEvent {\n searchQuery: string;\n}\n\nexport interface IAddClickEvent extends BaseEvent {\n itemId: string;\n}\n"]}
1
+ {"version":3,"file":"types.js","sourceRoot":"/","sources":["src/events/types.ts"],"names":[],"mappings":"AAAA,uDAAuD","sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\n\nimport {\n CustomProperties,\n EventProperties,\n InternalEventProperties,\n} from \"../utils/zodSchemas\";\n\nexport interface EventRequest {\n id: string;\n event_type: string;\n event_properties?: EventProperties;\n custom_event_properties?: Record<string, any>;\n internal_event_properties?: InternalEventProperties;\n captured_at: string;\n}\n\ntype BaseEvent = {\n customEventProperties?: Record<string, any>;\n tracking?: EventProperties[\"tracking\"];\n};\n\nexport interface IAddProductDetailViewEvent extends BaseEvent {\n itemId: string;\n}\n\nexport interface IAddLikeEvent extends BaseEvent {\n itemId: string;\n}\n\nexport interface IAddCartaddEvent extends BaseEvent {\n itemId: string;\n}\n\nexport interface IAddRateEvent extends BaseEvent {\n itemId: string;\n rating: number;\n}\nexport interface IAddOrderEvent extends BaseEvent {\n orderId: string;\n paidAmount: number;\n orderAmount: number;\n items: {\n id: string;\n price: number;\n quantity?: number;\n custom_event_properties?: CustomProperties;\n }[];\n}\n\nexport interface IAddCustomEvent extends BaseEvent {\n eventType: string;\n eventProperties?: EventProperties;\n}\n\nexport type IVisitEvent = BaseEvent;\n\nexport type IAddPageVisitEvent = BaseEvent;\n\nexport interface IAddPageViewEvent extends BaseEvent {\n page: string;\n}\n\nexport interface IAddSectionViewEvent extends BaseEvent {\n section: string;\n}\n\nexport interface IAddInstantImpressionEvent extends BaseEvent {\n itemId: string;\n page: string;\n section: string;\n position: number;\n}\n\nexport interface IAddPersistentImpressionEvent extends BaseEvent {\n itemId: string;\n page: string;\n section: string;\n position: number;\n}\n\nexport interface IAddSearchEvent extends BaseEvent {\n searchQuery: string;\n}\n\nexport interface IAddClickEvent extends BaseEvent {\n itemId: string;\n}\n"]}
@@ -23,12 +23,18 @@ export declare const eventPropertiesSchema: z.ZodObject<{
23
23
  items: z.ZodOptional<z.ZodArray<z.ZodObject<{
24
24
  id: z.ZodString;
25
25
  price: z.ZodNumber;
26
+ quantity: z.ZodOptional<z.ZodNumber>;
27
+ custom_event_properties: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, Date, string>, z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodArray<z.ZodString, "many">, z.ZodArray<z.ZodObject<{}, "strip", z.ZodTypeAny, {}, {}>, "many">, z.ZodObject<{}, "strip", z.ZodTypeAny, {}, {}>, z.ZodUndefined]>>>;
26
28
  }, "strip", z.ZodTypeAny, {
27
29
  price: number;
28
30
  id: string;
31
+ quantity?: number | undefined;
32
+ custom_event_properties?: Record<string, string | number | boolean | string[] | Date | {}[] | {} | undefined> | undefined;
29
33
  }, {
30
34
  price: number;
31
35
  id: string;
36
+ quantity?: number | undefined;
37
+ custom_event_properties?: Record<string, string | number | boolean | string[] | {}[] | {} | undefined> | undefined;
32
38
  }>, "many">>;
33
39
  search_query: z.ZodOptional<z.ZodString>;
34
40
  order_amount: z.ZodOptional<z.ZodNumber>;
@@ -43,6 +49,7 @@ export declare const eventPropertiesSchema: z.ZodObject<{
43
49
  type: string;
44
50
  id: string;
45
51
  }>>;
52
+ click_target: z.ZodOptional<z.ZodString>;
46
53
  }, "strip", z.ZodTypeAny, {
47
54
  section?: string | undefined;
48
55
  prev_section?: string | undefined;
@@ -57,6 +64,8 @@ export declare const eventPropertiesSchema: z.ZodObject<{
57
64
  items?: {
58
65
  price: number;
59
66
  id: string;
67
+ quantity?: number | undefined;
68
+ custom_event_properties?: Record<string, string | number | boolean | string[] | Date | {}[] | {} | undefined> | undefined;
60
69
  }[] | undefined;
61
70
  search_query?: string | undefined;
62
71
  order_amount?: number | undefined;
@@ -65,6 +74,7 @@ export declare const eventPropertiesSchema: z.ZodObject<{
65
74
  type: string;
66
75
  id: string;
67
76
  } | undefined;
77
+ click_target?: string | undefined;
68
78
  }, {
69
79
  section?: string | undefined;
70
80
  prev_section?: string | undefined;
@@ -79,6 +89,8 @@ export declare const eventPropertiesSchema: z.ZodObject<{
79
89
  items?: {
80
90
  price: number;
81
91
  id: string;
92
+ quantity?: number | undefined;
93
+ custom_event_properties?: Record<string, string | number | boolean | string[] | {}[] | {} | undefined> | undefined;
82
94
  }[] | undefined;
83
95
  search_query?: string | undefined;
84
96
  order_amount?: number | undefined;
@@ -87,8 +99,23 @@ export declare const eventPropertiesSchema: z.ZodObject<{
87
99
  type: string;
88
100
  id: string;
89
101
  } | undefined;
102
+ click_target?: string | undefined;
90
103
  }>;
91
104
  export type EventProperties = z.infer<typeof eventPropertiesSchema>;
105
+ export declare const internalEventPropertiesSchema: z.ZodObject<{
106
+ url: z.ZodOptional<z.ZodString>;
107
+ ref: z.ZodOptional<z.ZodString>;
108
+ click_target: z.ZodOptional<z.ZodString>;
109
+ }, "strip", z.ZodTypeAny, {
110
+ click_target?: string | undefined;
111
+ url?: string | undefined;
112
+ ref?: string | undefined;
113
+ }, {
114
+ click_target?: string | undefined;
115
+ url?: string | undefined;
116
+ ref?: string | undefined;
117
+ }>;
118
+ export type InternalEventProperties = z.infer<typeof internalEventPropertiesSchema>;
92
119
  export declare const recommendationRequestSchema: z.ZodObject<z.objectUtil.extendShape<Pick<{
93
120
  application_id: z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, ObjectId, string>;
94
121
  blux_user_id: z.ZodOptional<z.ZodNullable<z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, ObjectId, string>>>;
@@ -109,6 +109,8 @@ export const eventPropertiesSchema = z.object({
109
109
  .array(z.object({
110
110
  id: z.string(),
111
111
  price: z.number(),
112
+ quantity: z.number().optional(),
113
+ custom_event_properties: customPropertiesSchema.optional(),
112
114
  }))
113
115
  .optional(),
114
116
  search_query: z.string().optional(),
@@ -120,6 +122,12 @@ export const eventPropertiesSchema = z.object({
120
122
  type: z.string(),
121
123
  })
122
124
  .optional(),
125
+ click_target: z.string().optional(),
126
+ });
127
+ export const internalEventPropertiesSchema = z.object({
128
+ url: z.string().optional(),
129
+ ref: z.string().optional(),
130
+ click_target: z.string().optional(),
123
131
  });
124
132
  // Schema for Inference API
125
133
  const inferenceRequestSchema = z.object({
@@ -1 +1 @@
1
- {"version":3,"file":"zodSchemas.js","sourceRoot":"/","sources":["src/utils/zodSchemas.ts"],"names":[],"mappings":"AAAA,OAAO,QAAQ,MAAM,eAAe,CAAC;AACrC,OAAO,EAAE,CAAC,EAAE,QAAQ,EAAE,MAAM,KAAK,CAAC;AAElC,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACvD,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAI3D,SAAS,gBAAgB,CAAC,KAAc;IACtC,OAAO,CACL,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,MAAM,KAAK,EAAE,IAAI,QAAQ,CAAC,OAAO,CAAC,KAAK,CAAC,CAC5E,CAAC;AACJ,CAAC;AAED,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC;KAC5B,MAAM,EAAE;KACR,MAAM,CACL,CAAC,CAAC,EAAE,EAAE,CAAC,gBAAgB,CAAC,CAAC,CAAC,EAC1B,CAAC,CAAC,EAAE,EAAE,CACJ,IAAI,QAAQ,CAAC;IACX;QACE,IAAI,EAAE,QAAQ;QACd,OAAO,EAAE,qBAAqB,CAAC,EAAE;QACjC,IAAI,EAAE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C,MAAM,EAAE;KACjB,CAAC;SACD,QAAQ,EAAE;CACd,CAAC,CAAC;AAGH,2BAA2B;AAC3B,MAAM,sBAAsB,GAAG,CAAC,CAAC,MAAM,CAAC;IACtC,cAAc,EAAE,cAAc;IAC9B,YAAY,EAAE,cAAc,CAAC,OAAO,EAAE;IAEtC,QAAQ,EAAE,CAAC,CAAC,KAAK,CACf,CAAC,CAAC,MAAM,CAAC;QACP,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;QAChB,MAAM,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC;KAC1B,CAAC,CACH;IACD,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,OAAO,EAAE;IAC7B,QAAQ,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,OAAO,EAAE;IAEvC,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE;IACjB,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,OAAO,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC;IACvC,OAAO,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC,OAAO,EAAE,EAAE,mFAAmF;CACtI,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,2BAA2B,GAAG,sBAAsB;KAC9D,IAAI,CAAC;IACJ,OAAO,EAAE,IAAI;IACb,QAAQ,EAAE,IAAI;IACd,KAAK,EAAE,IAAI;IACX,MAAM,EAAE,IAAI;CACb,CAAC;KACD,MAAM,CAAC;IACN,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE;IACrB,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,OAAO,EAAE;CAClC,CAAC,CAAC","sourcesContent":["import ObjectId from \"bson-objectid\";\nimport { z, ZodError } from \"zod\";\n\nimport { assertEqualTypes } from \"./assertEqualTypes\";\nimport { COUNTRY_CODES } from \"../constants/COUNTRIES\";\nimport { ISO8601_REGEX } from \"../constants/ISO8601_REGEX\";\n\nimport type { CountryCode } from \"../constants/COUNTRIES\";\n\nfunction isObjectIdString(value: unknown): value is string {\n return (\n typeof value === \"string\" && value.length === 24 && ObjectId.isValid(value)\n );\n}\n\nexport const objectIdSchema = z\n .string()\n .refine(\n (v) => isObjectIdString(v),\n (v) =>\n new ZodError([\n {\n code: \"custom\",\n message: `Invalid ObjectId: ${v}`,\n path: [\"some_path\"],\n },\n ]),\n )\n .transform((v) => new ObjectId(v));\n\nexport const stringToNumberSchema = z\n .union([z.string(), z.number()])\n .refine(\n (v) => {\n if (typeof v === \"number\") return true;\n const parsed = Number(v);\n return !isNaN(parsed);\n },\n {\n message: \"Invalid number or string in stringToNumberSchema\",\n },\n )\n .transform((v): number => (typeof v === \"number\" ? v : Number(v)));\n\nexport const dateSchema = z\n .string()\n .refine(\n (dateString) => {\n return ISO8601_REGEX.test(dateString);\n },\n {\n message: \"Invalid date string\",\n },\n )\n .transform((dateString) => new Date(dateString));\n\nfunction convertAllObjectId(input: unknown): unknown {\n if (Array.isArray(input)) {\n return input.map((item) => convertAllObjectId(item));\n } else if (isObjectIdString(input)) {\n return new ObjectId(input);\n } else if (\n typeof input === \"string\" &&\n /^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(?:\\.\\d{3})?Z$/.test(input)\n ) {\n return new Date(input);\n } else if (input !== null && typeof input === \"object\") {\n return Object.entries(input).reduce<Record<string, unknown>>(\n (acc, [key, value]) => {\n acc[key] = convertAllObjectId(value);\n return acc;\n },\n {},\n );\n }\n return input;\n}\n\nexport const anonymousObjectSchema = <T extends object = object>() =>\n z\n .object({})\n .passthrough()\n .transform((v) => convertAllObjectId(v) as T);\n\nexport const countryCodeWithLowerCaseSchema = z\n .string()\n .transform((v) => v.toUpperCase())\n .pipe(\n z.union([\n z.literal(\"419\"), // https://en.wikipedia.org/wiki/Language_code\n z.enum(COUNTRY_CODES as [CountryCode, ...CountryCode[]]),\n ]),\n )\n .transform((v) => (v === \"419\" ? undefined : v));\n\nexport const customPropertiesRequestSchema = z.record(\n z.union([\n dateSchema,\n z.string(),\n z.number(),\n z.boolean(),\n z.array(z.string()),\n z.array(z.object({})),\n z.object({}),\n z.null(),\n z.undefined(),\n ]),\n);\n\ntype CustomPropertiesRequest = z.infer<typeof customPropertiesRequestSchema>;\n\nexport const customPropertiesSchema = z.record(\n z.union([\n dateSchema,\n z.string(),\n z.number(),\n z.boolean(),\n z.array(z.string()),\n z.array(z.object({})),\n z.object({}),\n z.undefined(),\n ]),\n);\n\nexport type CustomProperties = z.infer<typeof customPropertiesSchema>;\n\nassertEqualTypes<\n {\n [K in keyof CustomPropertiesRequest]: Exclude<\n CustomPropertiesRequest[K],\n null\n >;\n },\n CustomProperties\n>(true);\n\nexport const stringToArraySchema = z\n .string()\n .transform((v) => v.split(\",\").map((item) => item.trim()))\n .refine((arr) => arr.every((item) => item.length > 0), {\n message: \"Each item should not be empty\",\n });\n\nexport const eventPropertiesSchema = z.object({\n section: z.string().optional(),\n prev_section: z.string().optional(),\n recommendation_id: z.string().optional(),\n price: z.number().optional(),\n order_id: z.string().optional(),\n rating: z.number().optional(),\n prev_page: z.string().optional(),\n page: z.string().optional(),\n position: z.number().optional(),\n item_id: z.string().optional(),\n items: z\n .array(\n z.object({\n id: z.string(),\n price: z.number(),\n }),\n )\n .optional(),\n search_query: z.string().optional(),\n order_amount: z.number().optional(),\n paid_amount: z.number().optional(),\n tracking: z\n .object({\n id: z.string(),\n type: z.string(),\n })\n .optional(),\n});\nexport type EventProperties = z.infer<typeof eventPropertiesSchema>;\n\n// Schema for Inference API\nconst inferenceRequestSchema = z.object({\n application_id: objectIdSchema,\n blux_user_id: objectIdSchema.nullish(),\n\n pipeline: z.array(\n z.object({\n name: z.string(),\n kwargs: z.record(z.any()),\n }),\n ),\n item_id: z.string().nullish(),\n item_ids: z.array(z.string()).nullish(),\n\n limit: z.number(),\n offset: z.number().nullish().default(0),\n options: z.record(z.string(), z.any()).nullish(), // TODO: @all legacy 클라이언트 migration만을 위한 필드라는 점을 고려하여 필드명 수정 필요 ex. legacy_options\n});\n\nexport const recommendationRequestSchema = inferenceRequestSchema\n .pick({\n item_id: true,\n item_ids: true,\n limit: true,\n offset: true,\n })\n .extend({\n call_type: z.string(),\n category_id: z.string().nullish(),\n });\n\nexport type RecResponse = {\n item_ids: string[];\n metadata: Record<string, unknown>;\n recommendation_id: string | null;\n};\n"]}
1
+ {"version":3,"file":"zodSchemas.js","sourceRoot":"/","sources":["src/utils/zodSchemas.ts"],"names":[],"mappings":"AAAA,OAAO,QAAQ,MAAM,eAAe,CAAC;AACrC,OAAO,EAAE,CAAC,EAAE,QAAQ,EAAE,MAAM,KAAK,CAAC;AAElC,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACvD,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAI3D,SAAS,gBAAgB,CAAC,KAAc;IACtC,OAAO,CACL,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,MAAM,KAAK,EAAE,IAAI,QAAQ,CAAC,OAAO,CAAC,KAAK,CAAC,CAC5E,CAAC;AACJ,CAAC;AAED,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC;KAC5B,MAAM,EAAE;KACR,MAAM,CACL,CAAC,CAAC,EAAE,EAAE,CAAC,gBAAgB,CAAC,CAAC,CAAC,EAC1B,CAAC,CAAC,EAAE,EAAE,CACJ,IAAI,QAAQ,CAAC;IACX;QACE,IAAI,EAAE,QAAQ;QACd,OAAO,EAAE,qBAAqB,CAAC,EAAE;QACjC,IAAI,EAAE,CAAC,WAAW,CAAC;KACpB;CACF,CAAC,CACL;KACA,SAAS,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC;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IACb,QAAQ,EAAE,IAAI;IACd,KAAK,EAAE,IAAI;IACX,MAAM,EAAE,IAAI;CACb,CAAC;KACD,MAAM,CAAC;IACN,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE;IACrB,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,OAAO,EAAE;CAClC,CAAC,CAAC","sourcesContent":["import ObjectId from \"bson-objectid\";\nimport { z, ZodError } from \"zod\";\n\nimport { assertEqualTypes } from \"./assertEqualTypes\";\nimport { COUNTRY_CODES } from \"../constants/COUNTRIES\";\nimport { ISO8601_REGEX } from \"../constants/ISO8601_REGEX\";\n\nimport type { CountryCode } from \"../constants/COUNTRIES\";\n\nfunction isObjectIdString(value: unknown): value is string {\n return (\n typeof value === \"string\" && value.length === 24 && ObjectId.isValid(value)\n );\n}\n\nexport const objectIdSchema = z\n .string()\n .refine(\n (v) => isObjectIdString(v),\n (v) =>\n new ZodError([\n {\n code: \"custom\",\n message: `Invalid ObjectId: ${v}`,\n path: [\"some_path\"],\n },\n ]),\n )\n .transform((v) => new ObjectId(v));\n\nexport const stringToNumberSchema = z\n .union([z.string(), z.number()])\n .refine(\n (v) => {\n if (typeof v === \"number\") return true;\n const parsed = Number(v);\n return !isNaN(parsed);\n },\n {\n message: \"Invalid number or string in stringToNumberSchema\",\n },\n )\n .transform((v): number => (typeof v === \"number\" ? v : Number(v)));\n\nexport const dateSchema = z\n .string()\n .refine(\n (dateString) => {\n return ISO8601_REGEX.test(dateString);\n },\n {\n message: \"Invalid date string\",\n },\n )\n .transform((dateString) => new Date(dateString));\n\nfunction convertAllObjectId(input: unknown): unknown {\n if (Array.isArray(input)) {\n return input.map((item) => convertAllObjectId(item));\n } else if (isObjectIdString(input)) {\n return new ObjectId(input);\n } else if (\n typeof input === \"string\" &&\n /^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(?:\\.\\d{3})?Z$/.test(input)\n ) {\n return new Date(input);\n } else if (input !== null && typeof input === \"object\") {\n return Object.entries(input).reduce<Record<string, unknown>>(\n (acc, [key, value]) => {\n acc[key] = convertAllObjectId(value);\n return acc;\n },\n {},\n );\n }\n return input;\n}\n\nexport const anonymousObjectSchema = <T extends object = object>() =>\n z\n .object({})\n .passthrough()\n .transform((v) => convertAllObjectId(v) as T);\n\nexport const countryCodeWithLowerCaseSchema = z\n .string()\n .transform((v) => v.toUpperCase())\n .pipe(\n z.union([\n z.literal(\"419\"), // https://en.wikipedia.org/wiki/Language_code\n z.enum(COUNTRY_CODES as [CountryCode, ...CountryCode[]]),\n ]),\n )\n .transform((v) => (v === \"419\" ? undefined : v));\n\nexport const customPropertiesRequestSchema = z.record(\n z.union([\n dateSchema,\n z.string(),\n z.number(),\n z.boolean(),\n z.array(z.string()),\n z.array(z.object({})),\n z.object({}),\n z.null(),\n z.undefined(),\n ]),\n);\n\ntype CustomPropertiesRequest = z.infer<typeof customPropertiesRequestSchema>;\n\nexport const customPropertiesSchema = z.record(\n z.union([\n dateSchema,\n z.string(),\n z.number(),\n z.boolean(),\n z.array(z.string()),\n z.array(z.object({})),\n z.object({}),\n z.undefined(),\n ]),\n);\n\nexport type CustomProperties = z.infer<typeof customPropertiesSchema>;\n\nassertEqualTypes<\n {\n [K in keyof CustomPropertiesRequest]: Exclude<\n CustomPropertiesRequest[K],\n null\n >;\n },\n CustomProperties\n>(true);\n\nexport const stringToArraySchema = z\n .string()\n .transform((v) => v.split(\",\").map((item) => item.trim()))\n .refine((arr) => arr.every((item) => item.length > 0), {\n message: \"Each item should not be empty\",\n });\n\nexport const eventPropertiesSchema = z.object({\n section: z.string().optional(),\n prev_section: z.string().optional(),\n recommendation_id: z.string().optional(),\n price: z.number().optional(),\n order_id: z.string().optional(),\n rating: z.number().optional(),\n prev_page: z.string().optional(),\n page: z.string().optional(),\n position: z.number().optional(),\n item_id: z.string().optional(),\n items: z\n .array(\n z.object({\n id: z.string(),\n price: z.number(),\n quantity: z.number().optional(),\n custom_event_properties: customPropertiesSchema.optional(),\n }),\n )\n .optional(),\n search_query: z.string().optional(),\n order_amount: z.number().optional(),\n paid_amount: z.number().optional(),\n tracking: z\n .object({\n id: z.string(),\n type: z.string(),\n })\n .optional(),\n click_target: z.string().optional(),\n});\n\nexport type EventProperties = z.infer<typeof eventPropertiesSchema>;\n\nexport const internalEventPropertiesSchema = z.object({\n url: z.string().optional(),\n ref: z.string().optional(),\n click_target: z.string().optional(),\n});\n\nexport type InternalEventProperties = z.infer<\n typeof internalEventPropertiesSchema\n>;\n\n// Schema for Inference API\nconst inferenceRequestSchema = z.object({\n application_id: objectIdSchema,\n blux_user_id: objectIdSchema.nullish(),\n\n pipeline: z.array(\n z.object({\n name: z.string(),\n kwargs: z.record(z.any()),\n }),\n ),\n item_id: z.string().nullish(),\n item_ids: z.array(z.string()).nullish(),\n\n limit: z.number(),\n offset: z.number().nullish().default(0),\n options: z.record(z.string(), z.any()).nullish(), // TODO: @all legacy 클라이언트 migration만을 위한 필드라는 점을 고려하여 필드명 수정 필요 ex. legacy_options\n});\n\nexport const recommendationRequestSchema = inferenceRequestSchema\n .pick({\n item_id: true,\n item_ids: true,\n limit: true,\n offset: true,\n })\n .extend({\n call_type: z.string(),\n category_id: z.string().nullish(),\n });\n\nexport type RecResponse = {\n item_ids: string[];\n metadata: Record<string, unknown>;\n recommendation_id: string | null;\n};\n"]}