@blux.ai/web-sdk 2.0.0 → 2.1.1
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/dist/package.json +1 -1
- package/dist/src/BluxClient.d.ts +10 -1
- package/dist/src/BluxClient.js +59 -13
- package/dist/src/BluxClient.js.map +1 -1
- package/dist/src/apis/APIs.d.ts +20 -225
- package/dist/src/apis/APIs.js +7 -15
- package/dist/src/apis/APIs.js.map +1 -1
- package/dist/src/utils/observables.d.ts +1 -0
- package/dist/src/utils/observables.js +5 -0
- package/dist/src/utils/observables.js.map +1 -0
- package/dist/src/utils/operators.js.map +1 -1
- package/dist/src/utils/zodSchemas.js +1 -1
- package/dist/src/utils/zodSchemas.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
package/dist/src/apis/APIs.d.ts
CHANGED
|
@@ -394,6 +394,10 @@ export declare namespace APIs {
|
|
|
394
394
|
marketing_notification_consent: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
|
|
395
395
|
sms_consent: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
|
|
396
396
|
email_consent: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
|
|
397
|
+
marketing_notification_sms_consent: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
|
|
398
|
+
marketing_notification_email_consent: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
|
|
399
|
+
marketing_notification_kakao_consent: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
|
|
400
|
+
marketing_notification_push_consent: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
|
|
397
401
|
}, "strip", z.ZodTypeAny, {
|
|
398
402
|
phone_number?: string | null | undefined;
|
|
399
403
|
email_address?: string | null | undefined;
|
|
@@ -401,6 +405,10 @@ export declare namespace APIs {
|
|
|
401
405
|
marketing_notification_consent?: boolean | null | undefined;
|
|
402
406
|
sms_consent?: boolean | null | undefined;
|
|
403
407
|
email_consent?: boolean | null | undefined;
|
|
408
|
+
marketing_notification_sms_consent?: boolean | null | undefined;
|
|
409
|
+
marketing_notification_email_consent?: boolean | null | undefined;
|
|
410
|
+
marketing_notification_kakao_consent?: boolean | null | undefined;
|
|
411
|
+
marketing_notification_push_consent?: boolean | null | undefined;
|
|
404
412
|
}, {
|
|
405
413
|
phone_number?: string | null | undefined;
|
|
406
414
|
email_address?: string | null | undefined;
|
|
@@ -408,6 +416,10 @@ export declare namespace APIs {
|
|
|
408
416
|
marketing_notification_consent?: boolean | null | undefined;
|
|
409
417
|
sms_consent?: boolean | null | undefined;
|
|
410
418
|
email_consent?: boolean | null | undefined;
|
|
419
|
+
marketing_notification_sms_consent?: boolean | null | undefined;
|
|
420
|
+
marketing_notification_email_consent?: boolean | null | undefined;
|
|
421
|
+
marketing_notification_kakao_consent?: boolean | null | undefined;
|
|
422
|
+
marketing_notification_push_consent?: boolean | null | undefined;
|
|
411
423
|
}>;
|
|
412
424
|
}, "strip", z.ZodTypeAny, {
|
|
413
425
|
properties: {
|
|
@@ -417,6 +429,10 @@ export declare namespace APIs {
|
|
|
417
429
|
marketing_notification_consent?: boolean | null | undefined;
|
|
418
430
|
sms_consent?: boolean | null | undefined;
|
|
419
431
|
email_consent?: boolean | null | undefined;
|
|
432
|
+
marketing_notification_sms_consent?: boolean | null | undefined;
|
|
433
|
+
marketing_notification_email_consent?: boolean | null | undefined;
|
|
434
|
+
marketing_notification_kakao_consent?: boolean | null | undefined;
|
|
435
|
+
marketing_notification_push_consent?: boolean | null | undefined;
|
|
420
436
|
};
|
|
421
437
|
}, {
|
|
422
438
|
properties: {
|
|
@@ -426,6 +442,10 @@ export declare namespace APIs {
|
|
|
426
442
|
marketing_notification_consent?: boolean | null | undefined;
|
|
427
443
|
sms_consent?: boolean | null | undefined;
|
|
428
444
|
email_consent?: boolean | null | undefined;
|
|
445
|
+
marketing_notification_sms_consent?: boolean | null | undefined;
|
|
446
|
+
marketing_notification_email_consent?: boolean | null | undefined;
|
|
447
|
+
marketing_notification_kakao_consent?: boolean | null | undefined;
|
|
448
|
+
marketing_notification_push_consent?: boolean | null | undefined;
|
|
429
449
|
};
|
|
430
450
|
}>;
|
|
431
451
|
type Body = Serialize<z.input<typeof bodySchema>>;
|
|
@@ -572,239 +592,14 @@ export declare namespace APIs {
|
|
|
572
592
|
blux_user_id: z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, import("bson-objectid").default, string>;
|
|
573
593
|
device_id: z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, import("bson-objectid").default, string>;
|
|
574
594
|
platform: z.ZodUnion<[z.ZodLiteral<DevicePlatform.android>, z.ZodLiteral<DevicePlatform.ios>, z.ZodLiteral<DevicePlatform.browser>]>;
|
|
575
|
-
events: z.ZodArray<z.ZodObject<{
|
|
576
|
-
device_id: z.ZodOptional<z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, import("bson-objectid").default, string>>;
|
|
577
|
-
event_type: z.ZodString;
|
|
578
|
-
event_properties: z.ZodOptional<z.ZodObject<{
|
|
579
|
-
section: z.ZodOptional<z.ZodString>;
|
|
580
|
-
prev_section: z.ZodOptional<z.ZodString>;
|
|
581
|
-
recommendation_id: z.ZodOptional<z.ZodString>;
|
|
582
|
-
price: z.ZodOptional<z.ZodNumber>;
|
|
583
|
-
order_id: z.ZodOptional<z.ZodString>;
|
|
584
|
-
rating: z.ZodOptional<z.ZodNumber>;
|
|
585
|
-
prev_page: z.ZodOptional<z.ZodString>;
|
|
586
|
-
page: z.ZodOptional<z.ZodString>;
|
|
587
|
-
position: z.ZodOptional<z.ZodNumber>;
|
|
588
|
-
item_id: z.ZodOptional<z.ZodString>;
|
|
589
|
-
items: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
590
|
-
id: z.ZodString;
|
|
591
|
-
price: z.ZodNumber;
|
|
592
|
-
}, "strip", z.ZodTypeAny, {
|
|
593
|
-
price: number;
|
|
594
|
-
id: string;
|
|
595
|
-
}, {
|
|
596
|
-
price: number;
|
|
597
|
-
id: string;
|
|
598
|
-
}>, "many">>;
|
|
599
|
-
search_query: z.ZodOptional<z.ZodString>;
|
|
600
|
-
order_amount: z.ZodOptional<z.ZodNumber>;
|
|
601
|
-
paid_amount: z.ZodOptional<z.ZodNumber>;
|
|
602
|
-
tracking: z.ZodOptional<z.ZodObject<{
|
|
603
|
-
id: z.ZodString;
|
|
604
|
-
type: z.ZodString;
|
|
605
|
-
}, "strip", z.ZodTypeAny, {
|
|
606
|
-
type: string;
|
|
607
|
-
id: string;
|
|
608
|
-
}, {
|
|
609
|
-
type: string;
|
|
610
|
-
id: string;
|
|
611
|
-
}>>;
|
|
612
|
-
}, "strip", z.ZodTypeAny, {
|
|
613
|
-
section?: string | undefined;
|
|
614
|
-
prev_section?: string | undefined;
|
|
615
|
-
recommendation_id?: string | undefined;
|
|
616
|
-
price?: number | undefined;
|
|
617
|
-
order_id?: string | undefined;
|
|
618
|
-
rating?: number | undefined;
|
|
619
|
-
prev_page?: string | undefined;
|
|
620
|
-
page?: string | undefined;
|
|
621
|
-
position?: number | undefined;
|
|
622
|
-
item_id?: string | undefined;
|
|
623
|
-
items?: {
|
|
624
|
-
price: number;
|
|
625
|
-
id: string;
|
|
626
|
-
}[] | undefined;
|
|
627
|
-
search_query?: string | undefined;
|
|
628
|
-
order_amount?: number | undefined;
|
|
629
|
-
paid_amount?: number | undefined;
|
|
630
|
-
tracking?: {
|
|
631
|
-
type: string;
|
|
632
|
-
id: string;
|
|
633
|
-
} | undefined;
|
|
634
|
-
}, {
|
|
635
|
-
section?: string | undefined;
|
|
636
|
-
prev_section?: string | undefined;
|
|
637
|
-
recommendation_id?: string | undefined;
|
|
638
|
-
price?: number | undefined;
|
|
639
|
-
order_id?: string | undefined;
|
|
640
|
-
rating?: number | undefined;
|
|
641
|
-
prev_page?: string | undefined;
|
|
642
|
-
page?: string | undefined;
|
|
643
|
-
position?: number | undefined;
|
|
644
|
-
item_id?: string | undefined;
|
|
645
|
-
items?: {
|
|
646
|
-
price: number;
|
|
647
|
-
id: string;
|
|
648
|
-
}[] | undefined;
|
|
649
|
-
search_query?: string | undefined;
|
|
650
|
-
order_amount?: number | undefined;
|
|
651
|
-
paid_amount?: number | undefined;
|
|
652
|
-
tracking?: {
|
|
653
|
-
type: string;
|
|
654
|
-
id: string;
|
|
655
|
-
} | undefined;
|
|
656
|
-
}>>;
|
|
657
|
-
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]>>>;
|
|
658
|
-
internal_event_properties: z.ZodOptional<z.ZodObject<{
|
|
659
|
-
url: z.ZodOptional<z.ZodString>;
|
|
660
|
-
ref: z.ZodOptional<z.ZodString>;
|
|
661
|
-
}, "strip", z.ZodTypeAny, {
|
|
662
|
-
url?: string | undefined;
|
|
663
|
-
ref?: string | undefined;
|
|
664
|
-
}, {
|
|
665
|
-
url?: string | undefined;
|
|
666
|
-
ref?: string | undefined;
|
|
667
|
-
}>>;
|
|
668
|
-
captured_at: z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, Date, string>;
|
|
669
|
-
}, "strip", z.ZodTypeAny, {
|
|
670
|
-
event_type: string;
|
|
671
|
-
captured_at: Date;
|
|
672
|
-
device_id?: import("bson-objectid").default | undefined;
|
|
673
|
-
event_properties?: {
|
|
674
|
-
section?: string | undefined;
|
|
675
|
-
prev_section?: string | undefined;
|
|
676
|
-
recommendation_id?: string | undefined;
|
|
677
|
-
price?: number | undefined;
|
|
678
|
-
order_id?: string | undefined;
|
|
679
|
-
rating?: number | undefined;
|
|
680
|
-
prev_page?: string | undefined;
|
|
681
|
-
page?: string | undefined;
|
|
682
|
-
position?: number | undefined;
|
|
683
|
-
item_id?: string | undefined;
|
|
684
|
-
items?: {
|
|
685
|
-
price: number;
|
|
686
|
-
id: string;
|
|
687
|
-
}[] | undefined;
|
|
688
|
-
search_query?: string | undefined;
|
|
689
|
-
order_amount?: number | undefined;
|
|
690
|
-
paid_amount?: number | undefined;
|
|
691
|
-
tracking?: {
|
|
692
|
-
type: string;
|
|
693
|
-
id: string;
|
|
694
|
-
} | undefined;
|
|
695
|
-
} | undefined;
|
|
696
|
-
custom_event_properties?: Record<string, string | number | boolean | string[] | Date | {}[] | {} | undefined> | undefined;
|
|
697
|
-
internal_event_properties?: {
|
|
698
|
-
url?: string | undefined;
|
|
699
|
-
ref?: string | undefined;
|
|
700
|
-
} | undefined;
|
|
701
|
-
}, {
|
|
702
|
-
event_type: string;
|
|
703
|
-
captured_at: string;
|
|
704
|
-
device_id?: string | undefined;
|
|
705
|
-
event_properties?: {
|
|
706
|
-
section?: string | undefined;
|
|
707
|
-
prev_section?: string | undefined;
|
|
708
|
-
recommendation_id?: string | undefined;
|
|
709
|
-
price?: number | undefined;
|
|
710
|
-
order_id?: string | undefined;
|
|
711
|
-
rating?: number | undefined;
|
|
712
|
-
prev_page?: string | undefined;
|
|
713
|
-
page?: string | undefined;
|
|
714
|
-
position?: number | undefined;
|
|
715
|
-
item_id?: string | undefined;
|
|
716
|
-
items?: {
|
|
717
|
-
price: number;
|
|
718
|
-
id: string;
|
|
719
|
-
}[] | undefined;
|
|
720
|
-
search_query?: string | undefined;
|
|
721
|
-
order_amount?: number | undefined;
|
|
722
|
-
paid_amount?: number | undefined;
|
|
723
|
-
tracking?: {
|
|
724
|
-
type: string;
|
|
725
|
-
id: string;
|
|
726
|
-
} | undefined;
|
|
727
|
-
} | undefined;
|
|
728
|
-
custom_event_properties?: Record<string, string | number | boolean | string[] | {}[] | {} | undefined> | undefined;
|
|
729
|
-
internal_event_properties?: {
|
|
730
|
-
url?: string | undefined;
|
|
731
|
-
ref?: string | undefined;
|
|
732
|
-
} | undefined;
|
|
733
|
-
}>, "many">;
|
|
734
595
|
}, "strip", z.ZodTypeAny, {
|
|
735
596
|
blux_user_id: import("bson-objectid").default;
|
|
736
597
|
device_id: import("bson-objectid").default;
|
|
737
598
|
platform: DevicePlatform;
|
|
738
|
-
events: {
|
|
739
|
-
event_type: string;
|
|
740
|
-
captured_at: Date;
|
|
741
|
-
device_id?: import("bson-objectid").default | undefined;
|
|
742
|
-
event_properties?: {
|
|
743
|
-
section?: string | undefined;
|
|
744
|
-
prev_section?: string | undefined;
|
|
745
|
-
recommendation_id?: string | undefined;
|
|
746
|
-
price?: number | undefined;
|
|
747
|
-
order_id?: string | undefined;
|
|
748
|
-
rating?: number | undefined;
|
|
749
|
-
prev_page?: string | undefined;
|
|
750
|
-
page?: string | undefined;
|
|
751
|
-
position?: number | undefined;
|
|
752
|
-
item_id?: string | undefined;
|
|
753
|
-
items?: {
|
|
754
|
-
price: number;
|
|
755
|
-
id: string;
|
|
756
|
-
}[] | undefined;
|
|
757
|
-
search_query?: string | undefined;
|
|
758
|
-
order_amount?: number | undefined;
|
|
759
|
-
paid_amount?: number | undefined;
|
|
760
|
-
tracking?: {
|
|
761
|
-
type: string;
|
|
762
|
-
id: string;
|
|
763
|
-
} | undefined;
|
|
764
|
-
} | undefined;
|
|
765
|
-
custom_event_properties?: Record<string, string | number | boolean | string[] | Date | {}[] | {} | undefined> | undefined;
|
|
766
|
-
internal_event_properties?: {
|
|
767
|
-
url?: string | undefined;
|
|
768
|
-
ref?: string | undefined;
|
|
769
|
-
} | undefined;
|
|
770
|
-
}[];
|
|
771
599
|
}, {
|
|
772
600
|
blux_user_id: string;
|
|
773
601
|
device_id: string;
|
|
774
602
|
platform: DevicePlatform;
|
|
775
|
-
events: {
|
|
776
|
-
event_type: string;
|
|
777
|
-
captured_at: string;
|
|
778
|
-
device_id?: string | undefined;
|
|
779
|
-
event_properties?: {
|
|
780
|
-
section?: string | undefined;
|
|
781
|
-
prev_section?: string | undefined;
|
|
782
|
-
recommendation_id?: string | undefined;
|
|
783
|
-
price?: number | undefined;
|
|
784
|
-
order_id?: string | undefined;
|
|
785
|
-
rating?: number | undefined;
|
|
786
|
-
prev_page?: string | undefined;
|
|
787
|
-
page?: string | undefined;
|
|
788
|
-
position?: number | undefined;
|
|
789
|
-
item_id?: string | undefined;
|
|
790
|
-
items?: {
|
|
791
|
-
price: number;
|
|
792
|
-
id: string;
|
|
793
|
-
}[] | undefined;
|
|
794
|
-
search_query?: string | undefined;
|
|
795
|
-
order_amount?: number | undefined;
|
|
796
|
-
paid_amount?: number | undefined;
|
|
797
|
-
tracking?: {
|
|
798
|
-
type: string;
|
|
799
|
-
id: string;
|
|
800
|
-
} | undefined;
|
|
801
|
-
} | undefined;
|
|
802
|
-
custom_event_properties?: Record<string, string | number | boolean | string[] | {}[] | {} | undefined> | undefined;
|
|
803
|
-
internal_event_properties?: {
|
|
804
|
-
url?: string | undefined;
|
|
805
|
-
ref?: string | undefined;
|
|
806
|
-
} | undefined;
|
|
807
|
-
}[];
|
|
808
603
|
}>;
|
|
809
604
|
type Body = Serialize<z.input<typeof bodySchema>>;
|
|
810
605
|
type ResponseData = ({
|
package/dist/src/apis/APIs.js
CHANGED
|
@@ -47,7 +47,7 @@ export var APIs;
|
|
|
47
47
|
bluxUsersSignIn.method = HttpMethod.PUT;
|
|
48
48
|
bluxUsersSignIn.bodySchema = z.object({
|
|
49
49
|
user_id: z.string(),
|
|
50
|
-
device_id: z.string().optional(), //
|
|
50
|
+
device_id: z.string().optional(), // TODO: @all sdk update 후 필수로 변경
|
|
51
51
|
});
|
|
52
52
|
bluxUsersSignIn.pathSchema = z.object({
|
|
53
53
|
application_id: z.string().optional(),
|
|
@@ -63,7 +63,7 @@ export var APIs;
|
|
|
63
63
|
device_id: objectIdSchema.optional(),
|
|
64
64
|
});
|
|
65
65
|
bluxUsersSignOut.pathSchema = z.object({
|
|
66
|
-
application_id: z.string().optional(), //
|
|
66
|
+
application_id: z.string().optional(), // TODO: @all objectIdSchema 로 변경
|
|
67
67
|
blux_user_id: objectIdSchema,
|
|
68
68
|
});
|
|
69
69
|
})(bluxUsersSignOut = APIs.bluxUsersSignOut || (APIs.bluxUsersSignOut = {}));
|
|
@@ -105,8 +105,13 @@ export var APIs;
|
|
|
105
105
|
email_address: z.string().nullable().optional(),
|
|
106
106
|
nighttime_notification_consent: z.boolean().nullable().optional(),
|
|
107
107
|
marketing_notification_consent: z.boolean().nullable().optional(),
|
|
108
|
+
// TODO: @luna 김캐디 연동 수정 이후 삭제
|
|
108
109
|
sms_consent: z.boolean().nullable().optional(),
|
|
109
110
|
email_consent: z.boolean().nullable().optional(),
|
|
111
|
+
marketing_notification_sms_consent: z.boolean().nullable().optional(),
|
|
112
|
+
marketing_notification_email_consent: z.boolean().nullable().optional(),
|
|
113
|
+
marketing_notification_kakao_consent: z.boolean().nullable().optional(),
|
|
114
|
+
marketing_notification_push_consent: z.boolean().nullable().optional(),
|
|
110
115
|
}),
|
|
111
116
|
});
|
|
112
117
|
bluxUsersUpdateUserProperties.pathSchema = z.object({
|
|
@@ -174,19 +179,6 @@ export var APIs;
|
|
|
174
179
|
z.literal(DevicePlatform.ios),
|
|
175
180
|
z.literal(DevicePlatform.browser),
|
|
176
181
|
]),
|
|
177
|
-
events: z.array(z.object({
|
|
178
|
-
device_id: objectIdSchema.optional(),
|
|
179
|
-
event_type: z.string(),
|
|
180
|
-
event_properties: eventPropertiesSchema.optional(),
|
|
181
|
-
custom_event_properties: customPropertiesSchema.optional(),
|
|
182
|
-
internal_event_properties: z
|
|
183
|
-
.object({
|
|
184
|
-
url: z.string().optional(),
|
|
185
|
-
ref: z.string().optional(),
|
|
186
|
-
})
|
|
187
|
-
.optional(),
|
|
188
|
-
captured_at: dateSchema,
|
|
189
|
-
})),
|
|
190
182
|
});
|
|
191
183
|
})(inappsDispatcher = APIs.inappsDispatcher || (APIs.inappsDispatcher = {}));
|
|
192
184
|
})(APIs || (APIs = {}));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"APIs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AC,QAAQ,EAAE;iBAC3B,CAAC;qBACD,QAAQ,EAAE;gBACb,WAAW,EAAE,UAAU;aACxB,CAAC,CACH;SACF,CAAC,CAAC;IAaL,CAAC,EA9CgB,gBAAgB,GAAhB,qBAAgB,KAAhB,qBAAgB,QA8ChC;AACH,CAAC,EAvPgB,IAAI,KAAJ,IAAI,QAuPpB","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: 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: 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 sms_consent: z.boolean().nullable().optional(),\n email_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 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: 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 =\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,cAAc,EACd,2BAA2B,GAC5B,MAAM,qBAAqB,CAAC;AAK7B,IAAK,UAKJ;AALD,WAAK,UAAU;IACb,yBAAW,CAAA;I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,cAAc,CAAC;aAC1B,CAAC;YACF,WAAW,EAAE,UAAU;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"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const onlineAndVisible$: import("rxjs").Observable<boolean>;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { fromEvent, startWith, map, distinctUntilChanged, shareReplay, merge, of, combineLatest, } from "rxjs";
|
|
2
|
+
const visible$ = fromEvent(document, "visibilitychange").pipe(startWith(0), map(() => document.visibilityState === "visible"), distinctUntilChanged(), shareReplay({ bufferSize: 1, refCount: true }));
|
|
3
|
+
const online$ = merge(fromEvent(window, "online").pipe(map(() => true)), fromEvent(window, "offline").pipe(map(() => false)), of(navigator.onLine)).pipe(distinctUntilChanged(), shareReplay({ bufferSize: 1, refCount: true }));
|
|
4
|
+
export const onlineAndVisible$ = combineLatest([visible$, online$]).pipe(map(([v, o]) => v && o), distinctUntilChanged(), shareReplay({ bufferSize: 1, refCount: true }));
|
|
5
|
+
//# sourceMappingURL=observables.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"observables.js","sourceRoot":"/","sources":["src/utils/observables.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EACT,SAAS,EACT,GAAG,EACH,oBAAoB,EACpB,WAAW,EACX,KAAK,EACL,EAAE,EACF,aAAa,GACd,MAAM,MAAM,CAAC;AAEd,MAAM,QAAQ,GAAG,SAAS,CAAC,QAAQ,EAAE,kBAAkB,CAAC,CAAC,IAAI,CAC3D,SAAS,CAAC,CAAC,CAAC,EACZ,GAAG,CAAC,GAAG,EAAE,CAAC,QAAQ,CAAC,eAAe,KAAK,SAAS,CAAC,EACjD,oBAAoB,EAAE,EACtB,WAAW,CAAC,EAAE,UAAU,EAAE,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,CAC/C,CAAC;AAEF,MAAM,OAAO,GAAG,KAAK,CACnB,SAAS,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,CAAC,EACjD,SAAS,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC,KAAK,CAAC,CAAC,EACnD,EAAE,CAAC,SAAS,CAAC,MAAM,CAAC,CACrB,CAAC,IAAI,CAAC,oBAAoB,EAAE,EAAE,WAAW,CAAC,EAAE,UAAU,EAAE,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;AAE/E,MAAM,CAAC,MAAM,iBAAiB,GAAG,aAAa,CAAC,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC,CAAC,IAAI,CACtE,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,EACvB,oBAAoB,EAAE,EACtB,WAAW,CAAC,EAAE,UAAU,EAAE,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,CAC/C,CAAC","sourcesContent":["import {\n fromEvent,\n startWith,\n map,\n distinctUntilChanged,\n shareReplay,\n merge,\n of,\n combineLatest,\n} from \"rxjs\";\n\nconst visible$ = fromEvent(document, \"visibilitychange\").pipe(\n startWith(0),\n map(() => document.visibilityState === \"visible\"),\n distinctUntilChanged(),\n shareReplay({ bufferSize: 1, refCount: true }),\n);\n\nconst online$ = merge(\n fromEvent(window, \"online\").pipe(map(() => true)),\n fromEvent(window, \"offline\").pipe(map(() => false)),\n of(navigator.onLine),\n).pipe(distinctUntilChanged(), shareReplay({ bufferSize: 1, refCount: true }));\n\nexport const onlineAndVisible$ = combineLatest([visible$, online$]).pipe(\n map(([v, o]) => v && o),\n distinctUntilChanged(),\n shareReplay({ bufferSize: 1, refCount: true }),\n);\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"operators.js","sourceRoot":"/","sources":["src/utils/operators.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AAI9B,MAAM,UAAU,cAAc;
|
|
1
|
+
{"version":3,"file":"operators.js","sourceRoot":"/","sources":["src/utils/operators.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AAI9B,MAAM,UAAU,cAAc;IAC5B,OAAO,MAAM,CAAC,CAAC,CAAC,EAAU,EAAE,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC;AAC1C,CAAC","sourcesContent":["import { filter } from \"rxjs\";\n\nimport type { OperatorFunction } from \"rxjs\";\n\nexport function filterNullable<T>(): OperatorFunction<T | null | undefined, T> {\n return filter((v): v is T => v != null);\n}\n"]}
|
|
@@ -133,7 +133,7 @@ const inferenceRequestSchema = z.object({
|
|
|
133
133
|
item_ids: z.array(z.string()).nullish(),
|
|
134
134
|
limit: z.number(),
|
|
135
135
|
offset: z.number().nullish().default(0),
|
|
136
|
-
options: z.record(z.string(), z.any()).nullish(), //
|
|
136
|
+
options: z.record(z.string(), z.any()).nullish(), // TODO: @all legacy 클라이언트 migration만을 위한 필드라는 점을 고려하여 필드명 수정 필요 ex. legacy_options
|
|
137
137
|
});
|
|
138
138
|
export const recommendationRequestSchema = inferenceRequestSchema
|
|
139
139
|
.pick({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"zodSchemas.js","s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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,8EAA8E;CACjI,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: 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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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"]}
|