react-native-seel-widget 0.1.9 → 0.1.12
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/LICENSE +1 -1
- package/README.md +11 -2
- package/lib/module/assets/images/accredited.png +0 -0
- package/lib/module/assets/images/background_image.jpg +0 -0
- package/lib/module/assets/images/button_close.png +0 -0
- package/lib/module/assets/images/button_close_background.png +0 -0
- package/lib/module/assets/images/checkbox_normal.png +0 -0
- package/lib/module/assets/images/checkbox_selected.png +0 -0
- package/lib/module/assets/images/close_white.png +0 -0
- package/lib/module/assets/images/ic_launcher.png +0 -0
- package/lib/module/assets/images/icon_arrow_left.png +0 -0
- package/lib/module/assets/images/icon_bg_select.png +0 -0
- package/lib/module/assets/images/icon_check_selected_black.png +0 -0
- package/lib/module/assets/images/icon_select.png +0 -0
- package/lib/module/assets/images/info_black.png +0 -0
- package/lib/module/assets/images/seel_icon.png +0 -0
- package/lib/module/assets/images/seel_logo.png +0 -0
- package/lib/module/assets/images/seel_word.png +0 -0
- package/lib/module/assets/images/tick_small_minor.png +0 -0
- package/lib/module/constants/key_value.js +50 -0
- package/lib/module/constants/key_value.js.map +1 -0
- package/lib/module/constants/network_request_statue_enum.js +17 -0
- package/lib/module/constants/network_request_statue_enum.js.map +1 -0
- package/lib/module/core/SeelWidgetSDK.js +95 -0
- package/lib/module/core/SeelWidgetSDK.js.map +1 -0
- package/lib/module/core/index.js +4 -0
- package/lib/module/core/index.js.map +1 -0
- package/lib/module/dto/EventsRequest.js +71 -0
- package/lib/module/dto/EventsRequest.js.map +1 -0
- package/lib/module/dto/EventsResponse.js +15 -0
- package/lib/module/dto/EventsResponse.js.map +1 -0
- package/lib/module/dto/IEvents.js +31 -0
- package/lib/module/dto/IEvents.js.map +1 -0
- package/lib/module/dto/IQuotes.js +2 -0
- package/lib/module/dto/IQuotes.js.map +1 -0
- package/lib/module/dto/IQuotesRequest.js +4 -0
- package/lib/module/dto/IQuotesRequest.js.map +1 -0
- package/lib/module/dto/IQuotesResponse.js +2 -0
- package/lib/module/dto/IQuotesResponse.js.map +1 -0
- package/lib/module/dto/index.js +9 -0
- package/lib/module/dto/index.js.map +1 -0
- package/lib/module/index.js +6 -0
- package/lib/module/index.js.map +1 -0
- package/lib/module/network/request.js +176 -0
- package/lib/module/network/request.js.map +1 -0
- package/lib/module/package.json +1 -0
- package/lib/module/ui/coverage-info-footer.js +170 -0
- package/lib/module/ui/coverage-info-footer.js.map +1 -0
- package/lib/module/ui/gradient-animation-text.js +116 -0
- package/lib/module/ui/gradient-animation-text.js.map +1 -0
- package/lib/module/ui/gradient-animation-view.js +110 -0
- package/lib/module/ui/gradient-animation-view.js.map +1 -0
- package/lib/module/ui/index.js +7 -0
- package/lib/module/ui/index.js.map +1 -0
- package/lib/module/ui/seel-wfp-info-view.js +312 -0
- package/lib/module/ui/seel-wfp-info-view.js.map +1 -0
- package/lib/module/ui/seel-wfp-title-view.js +289 -0
- package/lib/module/ui/seel-wfp-title-view.js.map +1 -0
- package/lib/module/ui/seel-wfp-widget.js +227 -0
- package/lib/module/ui/seel-wfp-widget.js.map +1 -0
- package/lib/module/utils/format_util.js +107 -0
- package/lib/module/utils/format_util.js.map +1 -0
- package/lib/module/utils/http_util.js +26 -0
- package/lib/module/utils/http_util.js.map +1 -0
- package/lib/module/utils/storage_util.js +36 -0
- package/lib/module/utils/storage_util.js.map +1 -0
- package/lib/module/utils/uuid.js +21 -0
- package/lib/module/utils/uuid.js.map +1 -0
- package/lib/typescript/package.json +1 -0
- package/lib/typescript/src/constants/key_value.d.ts +48 -0
- package/lib/typescript/src/constants/key_value.d.ts.map +1 -0
- package/lib/typescript/src/constants/network_request_statue_enum.d.ts +13 -0
- package/lib/typescript/src/constants/network_request_statue_enum.d.ts.map +1 -0
- package/lib/typescript/src/core/SeelWidgetSDK.d.ts +58 -0
- package/lib/typescript/src/core/SeelWidgetSDK.d.ts.map +1 -0
- package/lib/typescript/src/core/index.d.ts +2 -0
- package/lib/typescript/src/core/index.d.ts.map +1 -0
- package/lib/typescript/src/dto/EventsRequest.d.ts +60 -0
- package/lib/typescript/src/dto/EventsRequest.d.ts.map +1 -0
- package/lib/typescript/src/dto/EventsResponse.d.ts +11 -0
- package/lib/typescript/src/dto/EventsResponse.d.ts.map +1 -0
- package/lib/typescript/src/dto/IEvents.d.ts +48 -0
- package/lib/typescript/src/dto/IEvents.d.ts.map +1 -0
- package/lib/typescript/src/dto/IQuotes.d.ts +36 -0
- package/lib/typescript/src/dto/IQuotes.d.ts.map +1 -0
- package/lib/typescript/src/dto/IQuotesRequest.d.ts +213 -0
- package/lib/typescript/src/dto/IQuotesRequest.d.ts.map +1 -0
- package/lib/typescript/src/dto/IQuotesResponse.d.ts +96 -0
- package/lib/typescript/src/dto/IQuotesResponse.d.ts.map +1 -0
- package/lib/typescript/src/dto/index.d.ts +7 -0
- package/lib/typescript/src/dto/index.d.ts.map +1 -0
- package/lib/typescript/src/index.d.ts +4 -0
- package/lib/typescript/src/index.d.ts.map +1 -0
- package/lib/typescript/src/network/request.d.ts +49 -0
- package/lib/typescript/src/network/request.d.ts.map +1 -0
- package/lib/typescript/src/ui/coverage-info-footer.d.ts +9 -0
- package/lib/typescript/src/ui/coverage-info-footer.d.ts.map +1 -0
- package/lib/typescript/src/ui/gradient-animation-text.d.ts +40 -0
- package/lib/typescript/src/ui/gradient-animation-text.d.ts.map +1 -0
- package/lib/typescript/src/ui/gradient-animation-view.d.ts +32 -0
- package/lib/typescript/src/ui/gradient-animation-view.d.ts.map +1 -0
- package/lib/typescript/src/ui/index.d.ts +5 -0
- package/lib/typescript/src/ui/index.d.ts.map +1 -0
- package/lib/typescript/src/ui/seel-wfp-info-view.d.ts +13 -0
- package/lib/typescript/src/ui/seel-wfp-info-view.d.ts.map +1 -0
- package/lib/typescript/src/ui/seel-wfp-title-view.d.ts +68 -0
- package/lib/typescript/src/ui/seel-wfp-title-view.d.ts.map +1 -0
- package/lib/typescript/src/ui/seel-wfp-widget.d.ts +16 -0
- package/lib/typescript/src/ui/seel-wfp-widget.d.ts.map +1 -0
- package/lib/typescript/src/utils/format_util.d.ts +2 -0
- package/lib/typescript/src/utils/format_util.d.ts.map +1 -0
- package/lib/typescript/src/utils/http_util.d.ts +18 -0
- package/lib/typescript/src/utils/http_util.d.ts.map +1 -0
- package/lib/typescript/src/utils/storage_util.d.ts +6 -0
- package/lib/typescript/src/utils/storage_util.d.ts.map +1 -0
- package/lib/typescript/src/utils/uuid.d.ts +6 -0
- package/lib/typescript/src/utils/uuid.d.ts.map +1 -0
- package/package.json +9 -7
- package/src/dto/IQuotesRequest.ts +1 -1
- package/src/dto/index.ts +6 -0
- package/src/{index.tsx → index.ts} +1 -0
- package/src/network/request.ts +0 -4
- package/src/ui/seel-wfp-title-view.tsx +4 -1
- package/src/ui/seel-wfp-widget.tsx +2 -1
package/LICENSE
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
MIT License
|
|
2
2
|
|
|
3
|
-
Copyright (c) 2025
|
|
3
|
+
Copyright (c) 2025 qingmingzhang
|
|
4
4
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
5
5
|
of this software and associated documentation files (the "Software"), to deal
|
|
6
6
|
in the Software without restriction, including without limitation the rights
|
package/README.md
CHANGED
|
@@ -41,11 +41,20 @@ SeelWidgetSDK.shared.configure({
|
|
|
41
41
|
import type { IQuotesRequest, IQuotesResponse } from 'react-native-seel-widget';
|
|
42
42
|
import { SeelWFPWidget } from 'react-native-seel-widget';
|
|
43
43
|
|
|
44
|
+
const quoteEU: IQuotesRequest = {};
|
|
45
|
+
const quoteUS: IQuotesRequest = {};
|
|
44
46
|
export default function YourPage() {
|
|
47
|
+
const [domain, setDomain] = useState<Domain>('');
|
|
48
|
+
const initialRef: any = null;
|
|
49
|
+
const seelWidgetRef = useRef<any>(initialRef);
|
|
45
50
|
useEffect(() => {
|
|
46
|
-
const
|
|
47
|
-
|
|
51
|
+
const setup = () => {
|
|
52
|
+
if (seelWidgetRef.current) {
|
|
53
|
+
const quote = domain === 'EU' ? quoteEU : quoteUS;
|
|
54
|
+
seelWidgetRef.current.setup(quote);
|
|
55
|
+
}
|
|
48
56
|
};
|
|
57
|
+
setup();
|
|
49
58
|
});
|
|
50
59
|
|
|
51
60
|
return (
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
const KeyValue = {
|
|
4
|
+
wfp_title: `{{title}} for {{price}}`,
|
|
5
|
+
wfp_subtitle: `Extend your return window to 35 days`,
|
|
6
|
+
wfp_description: `Get a full refund if the order doesn't arrive as described, including loss & damage in transit`,
|
|
7
|
+
powered_by: `Powered by {{seel}}`,
|
|
8
|
+
ineligible_main_message: `We're unable to offer Worry-Free Purchase® for this order. This could be due to one or more of the following reasons`,
|
|
9
|
+
ineligible_reason_shipping: `Shipping destination not supported`,
|
|
10
|
+
ineligible_reason_currency: `Checkout currency not accepted`,
|
|
11
|
+
ineligible_reason_value: `Order value exceeds our coverage limit`,
|
|
12
|
+
ineligible_reason_items: `Item(s) not eligible for this service`,
|
|
13
|
+
ineligible_reason_system: `Our system has flagged this order as ineligible`,
|
|
14
|
+
ineligible_support_message: `If you have any questions, please contact our customer support team for assistance`,
|
|
15
|
+
ineligible_title: `Worry-Free Purchase® isn't eligible for this order`,
|
|
16
|
+
coverage_title: `We've Got You Covered`,
|
|
17
|
+
pricing_message: `Only {{price}} for Complete Peace of Mind`,
|
|
18
|
+
product_name: `Worry-Free Purchase®`,
|
|
19
|
+
whats_covered_title: `What's Covered`,
|
|
20
|
+
standard_coverage_intro: `In addition to your standard coverage under consumer protection laws for`,
|
|
21
|
+
standard_coverage_not_as_described: `Items not as described`,
|
|
22
|
+
standard_coverage_lost_damaged: `Items lost, stolen or damaged in transit (i.e. before they are in your physical possession (or in the possession of someone you have authorised to take delivery)`,
|
|
23
|
+
standard_coverage_not_matching: `Items not matching their description`,
|
|
24
|
+
standard_coverage_quality: `Items not of satisfactory quality or not fit for purpose`,
|
|
25
|
+
standard_coverage_not_delivered: `Items not delivered within 30 days of purchase, unless agreed otherwise`,
|
|
26
|
+
additional_coverage_intro: `Worry-Free Purchase® provides the following protection`,
|
|
27
|
+
additional_coverage_extended_return: `Extended return windows – Seven (7) additional days to decide`,
|
|
28
|
+
additional_coverage_post_delivery: `Post-delivery theft coverage – Protection for packages stolen or missing after delivery`,
|
|
29
|
+
additional_coverage_delay: `Delay compensation if the items are not delivered within 10 days`,
|
|
30
|
+
concierge_intro: `Shoppers also get white glove concierge help with post purchase issues and mishaps`,
|
|
31
|
+
concierge_app_access: `Access to desktop and mobile app`,
|
|
32
|
+
concierge_support: `Live, instant support`,
|
|
33
|
+
privacy_policy: `Privacy Policy`,
|
|
34
|
+
terms_of_service: `Terms of Service`,
|
|
35
|
+
cta_secure_purchase: `Secure Your Purchase Now`,
|
|
36
|
+
cta_continue_without: `Continue Without Protection`,
|
|
37
|
+
get_full_refund: `Get a Full Refund, No Questions Asked`,
|
|
38
|
+
lost_in_transit: `Lost in-transit`,
|
|
39
|
+
item_not_as_described: `Item arrived not as described`,
|
|
40
|
+
item_damaged: `Item damaged/non-functional on arrival`,
|
|
41
|
+
package_stolen: `Package stolen or missing after delivery`,
|
|
42
|
+
easy_resolution: `Easy Resolution`,
|
|
43
|
+
resolve_with_clicks: `Resolve your issues with just a few clicks`,
|
|
44
|
+
complete_peace_of_mind: `Complete Peace of Mind`,
|
|
45
|
+
zero_risk: `Zero-risk on your order with our protection`,
|
|
46
|
+
get_refund_promptly: `Get your refund promptly`,
|
|
47
|
+
worry_free_delivery: `Worry-Free Delivery®`
|
|
48
|
+
};
|
|
49
|
+
export default KeyValue;
|
|
50
|
+
//# sourceMappingURL=key_value.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["KeyValue","wfp_title","wfp_subtitle","wfp_description","powered_by","ineligible_main_message","ineligible_reason_shipping","ineligible_reason_currency","ineligible_reason_value","ineligible_reason_items","ineligible_reason_system","ineligible_support_message","ineligible_title","coverage_title","pricing_message","product_name","whats_covered_title","standard_coverage_intro","standard_coverage_not_as_described","standard_coverage_lost_damaged","standard_coverage_not_matching","standard_coverage_quality","standard_coverage_not_delivered","additional_coverage_intro","additional_coverage_extended_return","additional_coverage_post_delivery","additional_coverage_delay","concierge_intro","concierge_app_access","concierge_support","privacy_policy","terms_of_service","cta_secure_purchase","cta_continue_without","get_full_refund","lost_in_transit","item_not_as_described","item_damaged","package_stolen","easy_resolution","resolve_with_clicks","complete_peace_of_mind","zero_risk","get_refund_promptly","worry_free_delivery"],"sourceRoot":"../../../src","sources":["constants/key_value.ts"],"mappings":";;AAAA,MAAMA,QAAQ,GAAG;EACfC,SAAS,EAAE,yBAAyB;EACpCC,YAAY,EAAE,sCAAsC;EACpDC,eAAe,EAAE,gGAAgG;EACjHC,UAAU,EAAE,qBAAqB;EACjCC,uBAAuB,EAAE,sHAAsH;EAC/IC,0BAA0B,EAAE,oCAAoC;EAChEC,0BAA0B,EAAE,gCAAgC;EAC5DC,uBAAuB,EAAE,wCAAwC;EACjEC,uBAAuB,EAAE,uCAAuC;EAChEC,wBAAwB,EAAE,iDAAiD;EAC3EC,0BAA0B,EAAE,oFAAoF;EAChHC,gBAAgB,EAAE,oDAAoD;EACtEC,cAAc,EAAE,uBAAuB;EACvCC,eAAe,EAAE,2CAA2C;EAC5DC,YAAY,EAAE,sBAAsB;EACpCC,mBAAmB,EAAE,gBAAgB;EACrCC,uBAAuB,EAAE,0EAA0E;EACnGC,kCAAkC,EAAE,wBAAwB;EAC5DC,8BAA8B,EAAE,mKAAmK;EACnMC,8BAA8B,EAAE,sCAAsC;EACtEC,yBAAyB,EAAE,0DAA0D;EACrFC,+BAA+B,EAAE,yEAAyE;EAC1GC,yBAAyB,EAAE,wDAAwD;EACnFC,mCAAmC,EAAE,+DAA+D;EACpGC,iCAAiC,EAAE,yFAAyF;EAC5HC,yBAAyB,EAAE,kEAAkE;EAC7FC,eAAe,EAAE,oFAAoF;EACrGC,oBAAoB,EAAE,kCAAkC;EACxDC,iBAAiB,EAAE,uBAAuB;EAC1CC,cAAc,EAAE,gBAAgB;EAChCC,gBAAgB,EAAE,kBAAkB;EACpCC,mBAAmB,EAAE,0BAA0B;EAC/CC,oBAAoB,EAAE,6BAA6B;EACnDC,eAAe,EAAE,uCAAuC;EACxDC,eAAe,EAAE,iBAAiB;EAClCC,qBAAqB,EAAE,+BAA+B;EACtDC,YAAY,EAAE,wCAAwC;EACtDC,cAAc,EAAE,0CAA0C;EAC1DC,eAAe,EAAE,iBAAiB;EAClCC,mBAAmB,EAAE,4CAA4C;EACjEC,sBAAsB,EAAE,wBAAwB;EAChDC,SAAS,EAAE,6CAA6C;EACxDC,mBAAmB,EAAE,0BAA0B;EAC/CC,mBAAmB,EAAE;AACvB,CAAC;AAED,eAAe5C,QAAQ","ignoreList":[]}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
export let NetworkRequestStatueEnum = /*#__PURE__*/function (NetworkRequestStatueEnum) {
|
|
4
|
+
/* eslint-disable no-bitwise */
|
|
5
|
+
NetworkRequestStatueEnum[NetworkRequestStatueEnum["Idle"] = 1] = "Idle";
|
|
6
|
+
NetworkRequestStatueEnum[NetworkRequestStatueEnum["Refreshing"] = 2] = "Refreshing";
|
|
7
|
+
NetworkRequestStatueEnum[NetworkRequestStatueEnum["LoadingMore"] = 4] = "LoadingMore";
|
|
8
|
+
NetworkRequestStatueEnum[NetworkRequestStatueEnum["Loading"] = 6] = "Loading";
|
|
9
|
+
NetworkRequestStatueEnum[NetworkRequestStatueEnum["RefreshSuccess"] = 8] = "RefreshSuccess";
|
|
10
|
+
NetworkRequestStatueEnum[NetworkRequestStatueEnum["LoadMoreSuccess"] = 16] = "LoadMoreSuccess";
|
|
11
|
+
NetworkRequestStatueEnum[NetworkRequestStatueEnum["Success"] = 24] = "Success";
|
|
12
|
+
NetworkRequestStatueEnum[NetworkRequestStatueEnum["RefreshFailed"] = 32] = "RefreshFailed";
|
|
13
|
+
NetworkRequestStatueEnum[NetworkRequestStatueEnum["LoadMoreFailed"] = 64] = "LoadMoreFailed";
|
|
14
|
+
NetworkRequestStatueEnum[NetworkRequestStatueEnum["Failed"] = 96] = "Failed";
|
|
15
|
+
return NetworkRequestStatueEnum;
|
|
16
|
+
}({});
|
|
17
|
+
//# sourceMappingURL=network_request_statue_enum.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["NetworkRequestStatueEnum"],"sourceRoot":"../../../src","sources":["constants/network_request_statue_enum.ts"],"mappings":";;AAAA,WAAYA,wBAAwB,0BAAxBA,wBAAwB;EAClC;EADUA,wBAAwB,CAAxBA,wBAAwB;EAAxBA,wBAAwB,CAAxBA,wBAAwB;EAAxBA,wBAAwB,CAAxBA,wBAAwB;EAAxBA,wBAAwB,CAAxBA,wBAAwB;EAAxBA,wBAAwB,CAAxBA,wBAAwB;EAAxBA,wBAAwB,CAAxBA,wBAAwB;EAAxBA,wBAAwB,CAAxBA,wBAAwB;EAAxBA,wBAAwB,CAAxBA,wBAAwB;EAAxBA,wBAAwB,CAAxBA,wBAAwB;EAAxBA,wBAAwB,CAAxBA,wBAAwB;EAAA,OAAxBA,wBAAwB;AAAA","ignoreList":[]}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Environment Enum
|
|
5
|
+
*/
|
|
6
|
+
export let SeelEnvironment = /*#__PURE__*/function (SeelEnvironment) {
|
|
7
|
+
SeelEnvironment["Development"] = "development";
|
|
8
|
+
SeelEnvironment["Production"] = "production";
|
|
9
|
+
return SeelEnvironment;
|
|
10
|
+
}({});
|
|
11
|
+
const defaultApiVersion = '2.6.0';
|
|
12
|
+
const defaultSeelEnvironment = SeelEnvironment.Production;
|
|
13
|
+
const defaultRequestTimeout = 5000;
|
|
14
|
+
/**
|
|
15
|
+
* SeelWidgetSDK
|
|
16
|
+
* Main SDK class for Seel Widget functionality
|
|
17
|
+
*/
|
|
18
|
+
export class SeelWidgetSDK {
|
|
19
|
+
// MARK: - Singleton Instance
|
|
20
|
+
static _shared = null;
|
|
21
|
+
static get shared() {
|
|
22
|
+
if (!SeelWidgetSDK._shared) {
|
|
23
|
+
SeelWidgetSDK._shared = new SeelWidgetSDK();
|
|
24
|
+
}
|
|
25
|
+
return SeelWidgetSDK._shared;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
// MARK: - Properties
|
|
29
|
+
_apiKey = '';
|
|
30
|
+
_apiVersion = defaultApiVersion;
|
|
31
|
+
_environment = defaultSeelEnvironment;
|
|
32
|
+
_requestTimeout = defaultRequestTimeout;
|
|
33
|
+
|
|
34
|
+
// MARK: - Private Constructor
|
|
35
|
+
constructor() {
|
|
36
|
+
// Private constructor for singleton pattern
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
// MARK: - Public Methods
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Configure SeelWidgetSDK
|
|
43
|
+
* @param apiKey API key
|
|
44
|
+
* @param environment Environment (optional, defaults to production)
|
|
45
|
+
*/
|
|
46
|
+
configure(props) {
|
|
47
|
+
this._apiKey = props.apiKey;
|
|
48
|
+
this._apiVersion = props.apiVersion ?? defaultApiVersion;
|
|
49
|
+
this._environment = props.environment ?? defaultSeelEnvironment;
|
|
50
|
+
this._requestTimeout = props.requestTimeout ?? defaultRequestTimeout;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Get current API Key
|
|
55
|
+
*/
|
|
56
|
+
get apiKey() {
|
|
57
|
+
return this._apiKey;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* Get current API Version
|
|
62
|
+
*/
|
|
63
|
+
get apiVersion() {
|
|
64
|
+
return this._apiVersion;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* Get current environment
|
|
69
|
+
*/
|
|
70
|
+
get environment() {
|
|
71
|
+
return this._environment;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* Get current Request Timeout
|
|
76
|
+
*/
|
|
77
|
+
get requestTimeout() {
|
|
78
|
+
return this._requestTimeout;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* Get current BaseURL
|
|
83
|
+
*/
|
|
84
|
+
get baseURL() {
|
|
85
|
+
return this._environment === SeelEnvironment.Production ? 'https://api.seel.com' : 'https://api-test.seel.com';
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* Check if configured
|
|
90
|
+
*/
|
|
91
|
+
get isConfigured() {
|
|
92
|
+
return this._apiKey !== '';
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
//# sourceMappingURL=SeelWidgetSDK.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["SeelEnvironment","defaultApiVersion","defaultSeelEnvironment","Production","defaultRequestTimeout","SeelWidgetSDK","_shared","shared","_apiKey","_apiVersion","_environment","_requestTimeout","constructor","configure","props","apiKey","apiVersion","environment","requestTimeout","baseURL","isConfigured"],"sourceRoot":"../../../src","sources":["core/SeelWidgetSDK.ts"],"mappings":";;AAAA;AACA;AACA;AACA,WAAYA,eAAe,0BAAfA,eAAe;EAAfA,eAAe;EAAfA,eAAe;EAAA,OAAfA,eAAe;AAAA;AAK3B,MAAMC,iBAAyB,GAAG,OAAO;AACzC,MAAMC,sBAAuC,GAAGF,eAAe,CAACG,UAAU;AAC1E,MAAMC,qBAA6B,GAAG,IAAI;AAS1C;AACA;AACA;AACA;AACA,OAAO,MAAMC,aAAa,CAAC;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AAY;IACjC,OAAO,IAAI,CAACZ,OAAO,KAAK,EAAE;EAC5B;AACF","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sourceRoot":"../../../src","sources":["core/index.ts"],"mappings":";;AAAA,cAAc,oBAAiB","ignoreList":[]}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Events Request/Response class
|
|
5
|
+
* Converts snake_case API format to camelCase for internal use
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* ```ts
|
|
9
|
+
* const iRequest: IEvents = {
|
|
10
|
+
* client_ip: '',
|
|
11
|
+
* customer_id: '',
|
|
12
|
+
* session_id: '',
|
|
13
|
+
* event_source: '',
|
|
14
|
+
* event_ts: '',
|
|
15
|
+
* event_type: EventTypeEnum.product_page_exit,
|
|
16
|
+
* };
|
|
17
|
+
*
|
|
18
|
+
* const request: EventsRequest = new EventsRequest(iRequest);
|
|
19
|
+
* ```
|
|
20
|
+
*/
|
|
21
|
+
export default class EventsRequest {
|
|
22
|
+
/**
|
|
23
|
+
* Browser IP address
|
|
24
|
+
*/
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Customer Id
|
|
28
|
+
*/
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Device Id
|
|
32
|
+
*/
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Event Id
|
|
36
|
+
*/
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Event information object
|
|
40
|
+
* Each event_type has its own unique schema. For specific details, please refer to the custom pixel guide.
|
|
41
|
+
*/
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Event source
|
|
45
|
+
*/
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Event created timestamp in milliseconds
|
|
49
|
+
*/
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Event type
|
|
53
|
+
*/
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* Session Id
|
|
57
|
+
*/
|
|
58
|
+
|
|
59
|
+
constructor(props) {
|
|
60
|
+
this.clientIP = props.client_ip;
|
|
61
|
+
this.customerId = props.customer_id;
|
|
62
|
+
this.deviceId = props.device_id;
|
|
63
|
+
this.eventId = props.event_id;
|
|
64
|
+
this.eventInfo = props.event_info;
|
|
65
|
+
this.eventSource = props.event_source || '';
|
|
66
|
+
this.eventTs = props.event_ts;
|
|
67
|
+
this.eventType = props.event_type;
|
|
68
|
+
this.sessionId = props.session_id;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
//# sourceMappingURL=EventsRequest.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["EventsRequest","constructor","props","clientIP","client_ip","customerId","customer_id","deviceId","device_id","eventId","event_id","eventInfo","event_info","eventSource","event_source","eventTs","event_ts","eventType","event_type","sessionId","session_id"],"sourceRoot":"../../../src","sources":["dto/EventsRequest.ts"],"mappings":";;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,MAAMA,aAAa,CAAC;EACjC;AACF;AACA;;EAEE;AACF;AACA;;EAEE;AACF;AACA;;EAEE;AACF;AACA;;EAEE;AACF;AACA;AACA;;EAEE;AACF;AACA;;EAEE;AACF;AACA;;EAEE;AACF;AACA;;EAEE;AACF;AACA;;EAGEC,WAAWA,CAACC,KAAc,EAAE;IAC1B,IAAI,CAACC,QAAQ,GAAGD,KAAK,CAACE,SAAS;IAC/B,IAAI,CAACC,UAAU,GAAGH,KAAK,CAACI,WAAW;IACnC,IAAI,CAACC,QAAQ,GAAGL,KAAK,CAACM,SAAS;IAC/B,IAAI,CAACC,OAAO,GAAGP,KAAK,CAACQ,QAAQ;IAC7B,IAAI,CAACC,SAAS,GAAGT,KAAK,CAACU,UAAU;IACjC,IAAI,CAACC,WAAW,GAAGX,KAAK,CAACY,YAAY,IAAI,EAAE;IAC3C,IAAI,CAACC,OAAO,GAAGb,KAAK,CAACc,QAAQ;IAC7B,IAAI,CAACC,SAAS,GAAGf,KAAK,CAACgB,UAAU;IACjC,IAAI,CAACC,SAAS,GAAGjB,KAAK,CAACkB,UAAU;EACnC;AACF","ignoreList":[]}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import EventsRequest from "./EventsRequest.js";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Events Response class
|
|
7
|
+
* Reuses EventsRequest since they have the same structure
|
|
8
|
+
* This avoids code duplication while maintaining semantic clarity
|
|
9
|
+
*/
|
|
10
|
+
export default class EventsResponse extends EventsRequest {
|
|
11
|
+
constructor(props) {
|
|
12
|
+
super(props);
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=EventsResponse.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["EventsRequest","EventsResponse","constructor","props"],"sourceRoot":"../../../src","sources":["dto/EventsResponse.ts"],"mappings":";;AACA,OAAOA,aAAa,MAAM,oBAAiB;;AAE3C;AACA;AACA;AACA;AACA;AACA,eAAe,MAAMC,cAAc,SAASD,aAAa,CAAC;EACxDE,WAAWA,CAACC,KAAc,EAAE;IAC1B,KAAK,CAACA,KAAK,CAAC;EACd;AACF","ignoreList":[]}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
export let EventTypeEnum = /*#__PURE__*/function (EventTypeEnum) {
|
|
4
|
+
EventTypeEnum["product_page_enter"] = "product_page_enter";
|
|
5
|
+
EventTypeEnum["product_page_exit"] = "product_page_exit";
|
|
6
|
+
EventTypeEnum["product_share"] = "product_share";
|
|
7
|
+
EventTypeEnum["favorite_add"] = "favorite_add";
|
|
8
|
+
EventTypeEnum["favorite_remove"] = "favorite_remove";
|
|
9
|
+
EventTypeEnum["cart_add"] = "cart_add";
|
|
10
|
+
EventTypeEnum["cart_remove"] = "cart_remove";
|
|
11
|
+
EventTypeEnum["ra_checked"] = "ra_checked";
|
|
12
|
+
EventTypeEnum["ra_unchecked"] = "ra_unchecked";
|
|
13
|
+
EventTypeEnum["checkout_begin"] = "checkout_begin";
|
|
14
|
+
EventTypeEnum["checkout_complete"] = "checkout_complete";
|
|
15
|
+
return EventTypeEnum;
|
|
16
|
+
}({});
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Event type union type
|
|
20
|
+
* Can be simplified to: export type EventType = EventTypeEnum;
|
|
21
|
+
*/
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Shipping address information for events
|
|
25
|
+
*/
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Event information object
|
|
29
|
+
* Each event_type has its own unique schema. For specific details, please refer to the custom pixel guide.
|
|
30
|
+
*/
|
|
31
|
+
//# sourceMappingURL=IEvents.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["EventTypeEnum"],"sourceRoot":"../../../src","sources":["dto/IEvents.ts"],"mappings":";;AAAA,WAAYA,aAAa,0BAAbA,aAAa;EAAbA,aAAa;EAAbA,aAAa;EAAbA,aAAa;EAAbA,aAAa;EAAbA,aAAa;EAAbA,aAAa;EAAbA,aAAa;EAAbA,aAAa;EAAbA,aAAa;EAAbA,aAAa;EAAbA,aAAa;EAAA,OAAbA,aAAa;AAAA;;AAczB;AACA;AACA;AACA;;AAGA;AACA;AACA;;AAQA;AACA;AACA;AACA","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sourceRoot":"../../../src","sources":["dto/IQuotes.ts"],"mappings":"","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sourceRoot":"../../../src","sources":["dto/IQuotesRequest.ts"],"mappings":"","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sourceRoot":"../../../src","sources":["dto/IQuotesResponse.ts"],"mappings":"","ignoreList":[]}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
export * from "./EventsRequest.js";
|
|
4
|
+
export * from "./EventsResponse.js";
|
|
5
|
+
export * from "./IEvents.js";
|
|
6
|
+
export * from "./IQuotes.js";
|
|
7
|
+
export * from "./IQuotesRequest.js";
|
|
8
|
+
export * from "./IQuotesResponse.js";
|
|
9
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sourceRoot":"../../../src","sources":["dto/index.ts"],"mappings":";;AAAA,cAAc,oBAAiB;AAC/B,cAAc,qBAAkB;AAChC,cAAc,cAAW;AACzB,cAAc,cAAW;AACzB,cAAc,qBAAkB;AAChC,cAAc,sBAAmB","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sourceRoot":"../../src","sources":["index.ts"],"mappings":";;AAAA,cAAc,iBAAQ;AACtB,cAAc,gBAAO;AACrB,cAAc,eAAM","ignoreList":[]}
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { SeelWidgetSDK } from "../core/SeelWidgetSDK.js";
|
|
4
|
+
class Request {
|
|
5
|
+
defaultHeaders() {
|
|
6
|
+
return {
|
|
7
|
+
'Accept': 'application/json',
|
|
8
|
+
'Content-Type': 'application/json',
|
|
9
|
+
'X-Seel-API-Key': SeelWidgetSDK.shared.apiKey,
|
|
10
|
+
'X-Seel-API-Version': SeelWidgetSDK.shared.apiVersion
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
defaultTimeout = SeelWidgetSDK.shared.requestTimeout;
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Set default timeout
|
|
17
|
+
*/
|
|
18
|
+
setDefaultTimeout(timeout) {
|
|
19
|
+
this.defaultTimeout = timeout;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Build query string
|
|
24
|
+
*/
|
|
25
|
+
buildQueryString(params) {
|
|
26
|
+
const queryParams = new URLSearchParams();
|
|
27
|
+
Object.keys(params).forEach(key => {
|
|
28
|
+
const value = params[key];
|
|
29
|
+
if (value !== undefined && value !== null && value !== '') {
|
|
30
|
+
queryParams.append(key, String(value));
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
return queryParams.toString();
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Handle request timeout
|
|
38
|
+
*/
|
|
39
|
+
createTimeoutPromise(timeout) {
|
|
40
|
+
return new Promise((_, reject) => {
|
|
41
|
+
setTimeout(() => {
|
|
42
|
+
reject(new Error(`Request timeout after ${timeout}ms`));
|
|
43
|
+
}, timeout);
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* GET request
|
|
49
|
+
* @param url Request URL
|
|
50
|
+
* @param params Request parameters
|
|
51
|
+
* @param options Request options (headers, timeout, etc.)
|
|
52
|
+
* @returns Promise<any>
|
|
53
|
+
*/
|
|
54
|
+
async get(url, params, options) {
|
|
55
|
+
try {
|
|
56
|
+
// Build full URL (including query parameters)
|
|
57
|
+
let fullUrl = url;
|
|
58
|
+
if (params && Object.keys(params).length > 0) {
|
|
59
|
+
const queryString = this.buildQueryString(params);
|
|
60
|
+
fullUrl = `${url}${url.includes('?') ? '&' : '?'}${queryString}`;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
// Merge request headers
|
|
64
|
+
const headers = {
|
|
65
|
+
...this.defaultHeaders(),
|
|
66
|
+
...options?.headers
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
// Create request configuration
|
|
70
|
+
const requestOptions = {
|
|
71
|
+
method: 'GET',
|
|
72
|
+
headers
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
// Handle timeout
|
|
76
|
+
const timeout = options?.timeout || this.defaultTimeout;
|
|
77
|
+
const timeoutPromise = this.createTimeoutPromise(timeout);
|
|
78
|
+
|
|
79
|
+
// Send request
|
|
80
|
+
const fetchPromise = fetch(fullUrl, requestOptions);
|
|
81
|
+
|
|
82
|
+
// Use Promise.race to handle timeout
|
|
83
|
+
const response = await Promise.race([fetchPromise, timeoutPromise]);
|
|
84
|
+
|
|
85
|
+
// Check response status
|
|
86
|
+
if (!response.ok) {
|
|
87
|
+
throw new Error(`HTTP error! status: ${response.status}`);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
// Parse response data
|
|
91
|
+
const data = await response.json();
|
|
92
|
+
return data;
|
|
93
|
+
} catch (error) {
|
|
94
|
+
// Unified error handling
|
|
95
|
+
if (error instanceof Error) {
|
|
96
|
+
throw new Error(`GET request failed: ${error.message}`);
|
|
97
|
+
}
|
|
98
|
+
throw new Error('GET request failed: Unknown error');
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* POST request
|
|
104
|
+
* @param url Request URL
|
|
105
|
+
* @param data Request body data
|
|
106
|
+
* @param options Request options (headers, timeout, etc.)
|
|
107
|
+
* @returns Promise<any>
|
|
108
|
+
*/
|
|
109
|
+
async post(url, data, options) {
|
|
110
|
+
try {
|
|
111
|
+
// Merge request headers
|
|
112
|
+
const headers = {
|
|
113
|
+
...this.defaultHeaders(),
|
|
114
|
+
...options?.headers
|
|
115
|
+
};
|
|
116
|
+
console.log('headers:', headers);
|
|
117
|
+
|
|
118
|
+
// Build request body
|
|
119
|
+
let body;
|
|
120
|
+
if (data !== undefined && data !== null) {
|
|
121
|
+
// If data is already a string, use it directly
|
|
122
|
+
if (typeof data === 'string') {
|
|
123
|
+
body = data;
|
|
124
|
+
} else {
|
|
125
|
+
// Otherwise, serialize to JSON
|
|
126
|
+
body = JSON.stringify(data);
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
// Create request configuration
|
|
131
|
+
const requestOptions = {
|
|
132
|
+
method: 'POST',
|
|
133
|
+
headers,
|
|
134
|
+
...(body && {
|
|
135
|
+
body
|
|
136
|
+
})
|
|
137
|
+
};
|
|
138
|
+
|
|
139
|
+
// Handle timeout
|
|
140
|
+
const timeout = options?.timeout || this.defaultTimeout;
|
|
141
|
+
const timeoutPromise = this.createTimeoutPromise(timeout);
|
|
142
|
+
|
|
143
|
+
// Send request
|
|
144
|
+
const fetchPromise = fetch(url, requestOptions);
|
|
145
|
+
|
|
146
|
+
// Use Promise.race to handle timeout
|
|
147
|
+
const response = await Promise.race([fetchPromise, timeoutPromise]);
|
|
148
|
+
// Check response status
|
|
149
|
+
if (!response.ok) {
|
|
150
|
+
throw new Error(`HTTP error! status: ${response.status}`);
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
// Parse response data
|
|
154
|
+
const responseData = await response.json();
|
|
155
|
+
return responseData;
|
|
156
|
+
} catch (error) {
|
|
157
|
+
// Unified error handling
|
|
158
|
+
if (error instanceof Error) {
|
|
159
|
+
throw new Error(`POST request failed: ${error.message}`);
|
|
160
|
+
}
|
|
161
|
+
throw new Error('POST request failed: Unknown error');
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
// Export singleton instance
|
|
167
|
+
export const instance = new Request();
|
|
168
|
+
|
|
169
|
+
// Export convenience methods
|
|
170
|
+
export const get = (url, params, options) => {
|
|
171
|
+
return instance.get(url, params, options);
|
|
172
|
+
};
|
|
173
|
+
export const post = (url, data, options) => {
|
|
174
|
+
return instance.post(url, data, options);
|
|
175
|
+
};
|
|
176
|
+
//# sourceMappingURL=request.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["SeelWidgetSDK","Request","defaultHeaders","shared","apiKey","apiVersion","defaultTimeout","requestTimeout","setDefaultTimeout","timeout","buildQueryString","params","queryParams","URLSearchParams","Object","keys","forEach","key","value","undefined","append","String","toString","createTimeoutPromise","Promise","_","reject","setTimeout","Error","get","url","options","fullUrl","length","queryString","includes","headers","requestOptions","method","timeoutPromise","fetchPromise","fetch","response","race","ok","status","data","json","error","message","post","console","log","body","JSON","stringify","responseData","instance"],"sourceRoot":"../../../src","sources":["network/request.ts"],"mappings":";;AAAA,SAASA,aAAa,QAAQ,0BAAuB;AAiBrD,MAAMC,OAAO,CAAC;EACZC,cAAcA,CAAA,EAAmB;IAC/B,OAAO;MACL,QAAQ,EAAE,kBAAkB;MAC5B,cAAc,EAAE,kBAAkB;MAClC,gBAAgB,EAAEF,aAAa,CAACG,MAAM,CAACC,MAAM;MAC7C,oBAAoB,EAAEJ,aAAa,CAACG,MAAM,CAACE;IAC7C,CAAC;EACH;EAEQC,cAAc,GAAWN,aAAa,CAACG,MAAM,CAACI,cAAc;;EAEpE;AACF;AACA;EACEC,iBAAiBA,CAACC,OAAe,EAAQ;IACvC,IAAI,CAACH,cAAc,GAAGG,OAAO;EAC/B;;EAEA;AACF;AACA;EACUC,gBAAgBA,CAACC,MAAwB,EAAU;IACzD,MAAMC,WAAW,GAAG,IAAIC,eAAe,CAAC,CAAC;IACzCC,MAAM,CAACC,IAAI,CAACJ,MAAM,CAAC,CAACK,OAAO,CAAEC,GAAG,IAAK;MACnC,MAAMC,KAAK,GAAGP,MAAM,CAACM,GAAG,CAAC;MACzB,IAAIC,KAAK,KAAKC,SAAS,IAAID,KAAK,KAAK,IAAI,IAAIA,KAAK,KAAK,EAAE,EAAE;QACzDN,WAAW,CAACQ,MAAM,CAACH,GAAG,EAAEI,MAAM,CAACH,KAAK,CAAC,CAAC;MACxC;IACF,CAAC,CAAC;IAEF,OAAON,WAAW,CAACU,QAAQ,CAAC,CAAC;EAC/B;;EAEA;AACF;AACA;EACUC,oBAAoBA,CAACd,OAAe,EAAkB;IAC5D,OAAO,IAAIe,OAAO,CAAC,CAACC,CAAC,EAAEC,MAAM,KAAK;MAChCC,UAAU,CAAC,MAAM;Q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