react-native-seel-widget 0.1.23 → 0.2.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/README.md +117 -97
- package/lib/module/network/request.js +15 -2
- package/lib/module/network/request.js.map +1 -1
- package/lib/module/ui/gradient-animation-text.js +7 -4
- package/lib/module/ui/gradient-animation-text.js.map +1 -1
- package/lib/module/ui/seel-wfp-title-view.js +6 -5
- package/lib/module/ui/seel-wfp-title-view.js.map +1 -1
- package/lib/module/ui/seel-wfp-widget.js +128 -44
- package/lib/module/ui/seel-wfp-widget.js.map +1 -1
- package/lib/module/utils/format_util.js +2 -1
- package/lib/module/utils/format_util.js.map +1 -1
- package/lib/module/utils/http_util.js +22 -2
- package/lib/module/utils/http_util.js.map +1 -1
- package/lib/module/utils/index.js +1 -0
- package/lib/module/utils/index.js.map +1 -1
- package/lib/module/utils/logger.js +138 -0
- package/lib/module/utils/logger.js.map +1 -0
- package/lib/module/utils/storage_util.js +4 -3
- package/lib/module/utils/storage_util.js.map +1 -1
- package/lib/typescript/src/dto/IQuotesRequest.d.ts +7 -1
- package/lib/typescript/src/dto/IQuotesRequest.d.ts.map +1 -1
- package/lib/typescript/src/network/request.d.ts.map +1 -1
- package/lib/typescript/src/ui/gradient-animation-text.d.ts.map +1 -1
- package/lib/typescript/src/ui/seel-wfp-title-view.d.ts +2 -2
- package/lib/typescript/src/ui/seel-wfp-title-view.d.ts.map +1 -1
- package/lib/typescript/src/ui/seel-wfp-widget.d.ts +14 -0
- package/lib/typescript/src/ui/seel-wfp-widget.d.ts.map +1 -1
- package/lib/typescript/src/utils/format_util.d.ts.map +1 -1
- package/lib/typescript/src/utils/http_util.d.ts.map +1 -1
- package/lib/typescript/src/utils/index.d.ts +1 -0
- package/lib/typescript/src/utils/index.d.ts.map +1 -1
- package/lib/typescript/src/utils/logger.d.ts +104 -0
- package/lib/typescript/src/utils/logger.d.ts.map +1 -0
- package/lib/typescript/src/utils/storage_util.d.ts.map +1 -1
- package/package.json +3 -3
- package/src/dto/IQuotesRequest.ts +10 -1
- package/src/network/request.ts +17 -2
- package/src/ui/gradient-animation-text.tsx +21 -8
- package/src/ui/seel-wfp-title-view.tsx +7 -6
- package/src/ui/seel-wfp-widget.tsx +189 -61
- package/src/utils/format_util.ts +3 -1
- package/src/utils/http_util.ts +31 -2
- package/src/utils/index.ts +1 -0
- package/src/utils/logger.ts +158 -0
- package/src/utils/storage_util.ts +5 -4
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IQuotesRequest.d.ts","sourceRoot":"","sources":["../../../../src/dto/IQuotesRequest.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAEnE;;GAEG;AACH,MAAM,WAAW,sBAAsB;IACrC;;OAEG;IACH,WAAW,EAAE,MAAM,CAAC;IACpB;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED;;GAEG;AACH,MAAM,WAAW,uBAAuB;IACtC,YAAY,CAAC,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"IQuotesRequest.d.ts","sourceRoot":"","sources":["../../../../src/dto/IQuotesRequest.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAEnE;;GAEG;AACH,MAAM,WAAW,sBAAsB;IACrC;;OAEG;IACH,WAAW,EAAE,MAAM,CAAC;IACpB;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;OAEG;IACH,KAAK,C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,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"request.d.ts","sourceRoot":"","sources":["../../../../src/network/request.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"request.d.ts","sourceRoot":"","sources":["../../../../src/network/request.ts"],"names":[],"mappings":"AAGA,MAAM,WAAW,cAAc;IAC7B,gBAAgB,EAAE,MAAM,CAAC;IACzB,oBAAoB,EAAE,MAAM,CAAC;IAC7B,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAC;CACvB;AAED,MAAM,WAAW,cAAc;IAC7B,OAAO,CAAC,EAAE,cAAc,CAAC;IACzB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,gBAAgB;IAC/B,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;CACpB;AAED,cAAM,OAAO;IACX,cAAc,IAAI,cAAc;IAShC,OAAO,CAAC,cAAc,CAA+C;IAErE;;OAEG;IACH,iBAAiB,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;IAIxC;;OAEG;IACH,OAAO,CAAC,gBAAgB;IAYxB;;OAEG;IACH,OAAO,CAAC,oBAAoB;IAQ5B;;;;;;OAMG;IACG,GAAG,CAAC,CAAC,GAAG,GAAG,EACf,GAAG,EAAE,MAAM,EACX,MAAM,CAAC,EAAE,gBAAgB,EACzB,OAAO,CAAC,EAAE,cAAc,GACvB,OAAO,CAAC,CAAC,CAAC;IAgDb;;;;;;OAMG;IACG,IAAI,CAAC,CAAC,GAAG,GAAG,EAChB,GAAG,EAAE,MAAM,EACX,IAAI,CAAC,EAAE,GAAG,EACV,OAAO,CAAC,EAAE,cAAc,GACvB,OAAO,CAAC,CAAC,CAAC;CAoEd;AAGD,eAAO,MAAM,QAAQ,SAAgB,CAAC;AAGtC,eAAO,MAAM,GAAG,GAAI,CAAC,GAAG,GAAG,EACzB,KAAK,MAAM,EACX,SAAS,gBAAgB,EACzB,UAAU,cAAc,KACvB,OAAO,CAAC,CAAC,CAEX,CAAC;AAEF,eAAO,MAAM,IAAI,GAAI,CAAC,GAAG,GAAG,EAC1B,KAAK,MAAM,EACX,OAAO,GAAG,EACV,UAAU,cAAc,KACvB,OAAO,CAAC,CAAC,CAEX,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gradient-animation-text.d.ts","sourceRoot":"","sources":["../../../../src/ui/gradient-animation-text.tsx"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"gradient-animation-text.d.ts","sourceRoot":"","sources":["../../../../src/ui/gradient-animation-text.tsx"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AASzD,MAAM,WAAW,0BAA0B;IACzC;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB;;OAEG;IACH,cAAc,CAAC,EAAE,SAAS,CAAC;IAC3B;;OAEG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB;;OAEG;IACH,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B;;OAEG;IACH,cAAc,CAAC,EAAE,MAAM,EAAE,CAAC;CAC3B;AAED,MAAM,WAAW,wBAAwB;IACvC;;OAEG;IACH,KAAK,EAAE,MAAM,IAAI,CAAC;IAClB;;OAEG;IACH,IAAI,EAAE,MAAM,IAAI,CAAC;CAClB;AAED,QAAA,MAAM,qBAAqB,iIA0G1B,CAAC;AAoCF,eAAe,qBAAqB,CAAC"}
|
|
@@ -61,8 +61,8 @@ export interface SeelWFPTitleViewProps {
|
|
|
61
61
|
pressable?: boolean;
|
|
62
62
|
optedIn: boolean;
|
|
63
63
|
dictionary: any;
|
|
64
|
-
|
|
64
|
+
loadingStatus: NetworkRequestStatusEnum;
|
|
65
65
|
onChangeOptedInValue: (optedIn: boolean) => void;
|
|
66
66
|
}
|
|
67
|
-
export declare function SeelWFPTitleView({ status, title, price, containerStyle, lightContainerStyle, darkContainerStyle, titleStyle, lightTitleStyle, darkTitleStyle, priceStyle, lightPriceStyle, darkPriceStyle, optedIn, dictionary,
|
|
67
|
+
export declare function SeelWFPTitleView({ status, title, price, containerStyle, lightContainerStyle, darkContainerStyle, titleStyle, lightTitleStyle, darkTitleStyle, priceStyle, lightPriceStyle, darkPriceStyle, optedIn, dictionary, loadingStatus, onClickInfoIcon, onChangeOptedInValue, }: SeelWFPTitleViewProps): import("react/jsx-runtime").JSX.Element;
|
|
68
68
|
//# sourceMappingURL=seel-wfp-title-view.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"seel-wfp-title-view.d.ts","sourceRoot":"","sources":["../../../../src/ui/seel-wfp-title-view.tsx"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAMzD,OAAO,EAAE,wBAAwB,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"seel-wfp-title-view.d.ts","sourceRoot":"","sources":["../../../../src/ui/seel-wfp-title-view.tsx"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAMzD,OAAO,EAAE,wBAAwB,EAAE,MAAM,cAAc,CAAC;AAIxD,MAAM,WAAW,qBAAqB;IACpC,MAAM,EAAE,MAAM,CAAC;IACf;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;OAEG;IACH,cAAc,CAAC,EAAE,SAAS,CAAC;IAC3B;;OAEG;IACH,kBAAkB,CAAC,EAAE,SAAS,CAAC;IAC/B;;OAEG;IACH,mBAAmB,CAAC,EAAE,SAAS,CAAC;IAChC;;OAEG;IACH,UAAU,CAAC,EAAE,SAAS,CAAC;IACvB;;OAEG;IACH,cAAc,CAAC,EAAE,SAAS,CAAC;IAC3B;;OAEG;IACH,eAAe,CAAC,EAAE,SAAS,CAAC;IAC5B;;OAEG;IACH,UAAU,CAAC,EAAE,SAAS,CAAC;IACvB;;OAEG;IACH,cAAc,CAAC,EAAE,SAAS,CAAC;IAC3B;;OAEG;IACH,eAAe,CAAC,EAAE,SAAS,CAAC;IAC5B;;;OAGG;IACH,eAAe,CAAC,EAAE,CAAC,KAAK,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;IAC3C;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;OAEG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,OAAO,EAAE,OAAO,CAAC;IACjB,UAAU,EAAE,GAAG,CAAC;IAChB,aAAa,EAAE,wBAAwB,CAAC;IACxC,oBAAoB,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,CAAC;CAClD;AAED,wBAAgB,gBAAgB,CAAC,EAC/B,MAAM,EACN,KAAK,EACL,KAAK,EACL,cAAc,EACd,mBAAmB,EACnB,kBAAkB,EAClB,UAAU,EACV,eAAe,EACf,cAAc,EACd,UAAU,EACV,eAAe,EACf,cAAc,EACd,OAAe,EACf,UAAe,EACf,aAA6C,EAC7C,eAAe,EACf,oBAAyC,GAC1C,EAAE,qBAAqB,2CA8KvB"}
|
|
@@ -2,15 +2,29 @@ import { DomainEnum } from './seel-wfp-info-view';
|
|
|
2
2
|
import type { IQuotesRequest } from '../dto/IQuotesRequest';
|
|
3
3
|
import type { IQuotesResponse } from '../dto/IQuotesResponse';
|
|
4
4
|
export interface SeelWFPWidgetRef {
|
|
5
|
+
/** Manually trigger a quote request */
|
|
5
6
|
setup(quote: IQuotesRequest): void;
|
|
7
|
+
/** Refresh using the last request data (only works in auto mode) */
|
|
8
|
+
refresh(): void;
|
|
9
|
+
/** Cancel any pending request */
|
|
10
|
+
cancel(): void;
|
|
6
11
|
}
|
|
7
12
|
interface SeelWFPWidgetProps {
|
|
13
|
+
/** Domain/region for the widget */
|
|
8
14
|
domain: DomainEnum;
|
|
15
|
+
/** Default opt-in state */
|
|
9
16
|
defaultOptedIn: boolean;
|
|
17
|
+
/** Callback when opt-in status or quote response changes */
|
|
10
18
|
onChangeValue: ({ optedIn, quotesResponse, }: {
|
|
11
19
|
optedIn: boolean;
|
|
12
20
|
quotesResponse?: IQuotesResponse;
|
|
13
21
|
}) => void;
|
|
22
|
+
/** Request data for auto-fetch mode */
|
|
23
|
+
request?: IQuotesRequest;
|
|
24
|
+
/** Enable auto-fetch when request prop changes (default: false) */
|
|
25
|
+
autoFetch?: boolean;
|
|
26
|
+
/** Debounce delay in milliseconds for auto-fetch (default: 300) */
|
|
27
|
+
debounceMs?: number;
|
|
14
28
|
}
|
|
15
29
|
declare const _default: import("react").ForwardRefExoticComponent<SeelWFPWidgetProps & import("react").RefAttributes<SeelWFPWidgetRef>>;
|
|
16
30
|
export default _default;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"seel-wfp-widget.d.ts","sourceRoot":"","sources":["../../../../src/ui/seel-wfp-widget.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"seel-wfp-widget.d.ts","sourceRoot":"","sources":["../../../../src/ui/seel-wfp-widget.tsx"],"names":[],"mappings":"AAkBA,OAAO,EAAmB,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAOnE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAU9D,MAAM,WAAW,gBAAgB;IAC/B,uCAAuC;IACvC,KAAK,CAAC,KAAK,EAAE,cAAc,GAAG,IAAI,CAAC;IACnC,oEAAoE;IACpE,OAAO,IAAI,IAAI,CAAC;IAChB,iCAAiC;IACjC,MAAM,IAAI,IAAI,CAAC;CAChB;AAED,UAAU,kBAAkB;IAC1B,mCAAmC;IACnC,MAAM,EAAE,UAAU,CAAC;IACnB,2BAA2B;IAC3B,cAAc,EAAE,OAAO,CAAC;IACxB,4DAA4D;IAC5D,aAAa,EAAE,CAAC,EACd,OAAO,EACP,cAAc,GACf,EAAE;QACD,OAAO,EAAE,OAAO,CAAC;QACjB,cAAc,CAAC,EAAE,eAAe,CAAC;KAClC,KAAK,IAAI,CAAC;IACX,uCAAuC;IACvC,OAAO,CAAC,EAAE,cAAc,CAAC;IACzB,mEAAmE;IACnE,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,mEAAmE;IACnE,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;;AA2WD,wBAA+E"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"format_util.d.ts","sourceRoot":"","sources":["../../../../src/utils/format_util.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"format_util.d.ts","sourceRoot":"","sources":["../../../../src/utils/format_util.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,WAAW,GAAI,OAAO,GAAG,EAAE,UAAU,MAAM,EAAE,SAAS,GAAG,QAoHrE,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"http_util.d.ts","sourceRoot":"","sources":["../../../../src/utils/http_util.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"http_util.d.ts","sourceRoot":"","sources":["../../../../src/utils/http_util.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAI9D,oBAAY,gBAAgB;IAC1B,UAAU,IAAA;IACV,MAAM,IAAA;IACN,aAAa,IAAA;IACb,YAAY,IAAA;IACZ,WAAW,IAAA;IACX;;OAEG;IACH,WAAW,IAAA;IACX,OAAO,IAAA;CACR;AAED,eAAO,MAAM,WAAW,GAAI,MAAM,cAAc,6BAuB/C,CAAC;AAEF,eAAO,MAAM,WAAW,GAAI,MAAM,OAAO,6BAWxC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,aAAa,CAAC;AAC5B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,QAAQ,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC;AACzB,cAAc,gBAAgB,CAAC;AAC/B,cAAc,QAAQ,CAAC"}
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Log levels enum for type-safe logging
|
|
3
|
+
*/
|
|
4
|
+
export declare enum LogLevel {
|
|
5
|
+
Debug = 0,
|
|
6
|
+
Info = 1,
|
|
7
|
+
Warn = 2,
|
|
8
|
+
Error = 3
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Logger configuration options
|
|
12
|
+
*/
|
|
13
|
+
export interface LoggerOptions {
|
|
14
|
+
/**
|
|
15
|
+
* Minimum log level to output (default: Debug in development, Warn in production)
|
|
16
|
+
*/
|
|
17
|
+
minLevel?: LogLevel;
|
|
18
|
+
/**
|
|
19
|
+
* Whether to include timestamps in log messages (default: true)
|
|
20
|
+
*/
|
|
21
|
+
includeTimestamp?: boolean;
|
|
22
|
+
/**
|
|
23
|
+
* Custom prefix for all log messages
|
|
24
|
+
*/
|
|
25
|
+
prefix?: string;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Unified logger class for consistent logging across the application
|
|
29
|
+
*
|
|
30
|
+
* Features:
|
|
31
|
+
* - Type-safe log levels
|
|
32
|
+
* - Development/production mode detection
|
|
33
|
+
* - Configurable log level filtering
|
|
34
|
+
* - Optional timestamps
|
|
35
|
+
* - Context/tag support
|
|
36
|
+
*/
|
|
37
|
+
declare class Logger {
|
|
38
|
+
private readonly isDevelopment;
|
|
39
|
+
private readonly minLevel;
|
|
40
|
+
private readonly includeTimestamp;
|
|
41
|
+
private readonly prefix;
|
|
42
|
+
constructor(options?: LoggerOptions);
|
|
43
|
+
/**
|
|
44
|
+
* Format log message with timestamp and prefix
|
|
45
|
+
*/
|
|
46
|
+
private formatMessage;
|
|
47
|
+
/**
|
|
48
|
+
* Check if log level should be output
|
|
49
|
+
*/
|
|
50
|
+
private shouldLog;
|
|
51
|
+
/**
|
|
52
|
+
* Log debug messages (only in development mode)
|
|
53
|
+
* @param args - Arguments to log
|
|
54
|
+
*/
|
|
55
|
+
debug(...args: unknown[]): void;
|
|
56
|
+
/**
|
|
57
|
+
* Log info messages
|
|
58
|
+
* @param args - Arguments to log
|
|
59
|
+
*/
|
|
60
|
+
info(...args: unknown[]): void;
|
|
61
|
+
/**
|
|
62
|
+
* Log warning messages
|
|
63
|
+
* @param args - Arguments to log
|
|
64
|
+
*/
|
|
65
|
+
warn(...args: unknown[]): void;
|
|
66
|
+
/**
|
|
67
|
+
* Log error messages
|
|
68
|
+
* @param args - Arguments to log
|
|
69
|
+
*/
|
|
70
|
+
error(...args: unknown[]): void;
|
|
71
|
+
/**
|
|
72
|
+
* Create a logger instance with a custom context/tag
|
|
73
|
+
* @param context - Context string to prefix all log messages
|
|
74
|
+
* @returns A new Logger instance with the context prefix
|
|
75
|
+
*
|
|
76
|
+
* @example
|
|
77
|
+
* ```typescript
|
|
78
|
+
* const storageLogger = logger.withContext('Storage');
|
|
79
|
+
* storageLogger.info('Reading data'); // [SeelWidget] [Storage] [INFO] Reading data
|
|
80
|
+
* ```
|
|
81
|
+
*/
|
|
82
|
+
withContext(context: string): Logger;
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Default logger instance
|
|
86
|
+
* Use this instance for general logging throughout the application
|
|
87
|
+
*
|
|
88
|
+
* @example
|
|
89
|
+
* ```typescript
|
|
90
|
+
* import { logger } from '../utils';
|
|
91
|
+
*
|
|
92
|
+
* logger.debug('Debug message');
|
|
93
|
+
* logger.info('Info message');
|
|
94
|
+
* logger.warn('Warning message');
|
|
95
|
+
* logger.error('Error message');
|
|
96
|
+
*
|
|
97
|
+
* // With context
|
|
98
|
+
* const storageLogger = logger.withContext('Storage');
|
|
99
|
+
* storageLogger.info('Reading from storage');
|
|
100
|
+
* ```
|
|
101
|
+
*/
|
|
102
|
+
export declare const logger: Logger;
|
|
103
|
+
export {};
|
|
104
|
+
//# sourceMappingURL=logger.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../../../src/utils/logger.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,oBAAY,QAAQ;IAClB,KAAK,IAAI;IACT,IAAI,IAAI;IACR,IAAI,IAAI;IACR,KAAK,IAAI;CACV;AAED;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B;;OAEG;IACH,QAAQ,CAAC,EAAE,QAAQ,CAAC;IACpB;;OAEG;IACH,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED;;;;;;;;;GASG;AACH,cAAM,MAAM;IACV,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAU;IACxC,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAW;IACpC,OAAO,CAAC,QAAQ,CAAC,gBAAgB,CAAU;IAC3C,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAS;gBAEpB,OAAO,GAAE,aAAkB;IAcvC;;OAEG;IACH,OAAO,CAAC,aAAa;IAWrB;;OAEG;IACH,OAAO,CAAC,SAAS;IAIjB;;;OAGG;IACH,KAAK,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI;IAM/B;;;OAGG;IACH,IAAI,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI;IAM9B;;;OAGG;IACH,IAAI,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI;IAM9B;;;OAGG;IACH,KAAK,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI;IAM/B;;;;;;;;;;OAUG;IACH,WAAW,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM;CAOrC;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,MAAM,QAAyC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"storage_util.d.ts","sourceRoot":"","sources":["../../../../src/utils/storage_util.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"storage_util.d.ts","sourceRoot":"","sources":["../../../../src/utils/storage_util.ts"],"names":[],"mappings":"AASA,eAAO,MAAM,eAAe;;;CAG3B,CAAC;AAUF,eAAO,MAAM,YAAY,GAAU,OAAO,OAAO,KAAG,OAAO,CAAC,IAAI,CAc/D,CAAC;AAEF,eAAO,MAAM,WAAW,QAAa,OAAO,CAAC,OAAO,GAAG,IAAI,CAU1D,CAAC;AAEF,eAAO,MAAM,sBAAsB,GAAU,OAAO,MAAM,KAAG,OAAO,CAAC,IAAI,CAQxE,CAAC;AAEF,eAAO,MAAM,qBAAqB,QAAa,OAAO,CAAC,MAAM,CAW5D,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native-seel-widget",
|
|
3
|
-
"version": "0.1
|
|
3
|
+
"version": "0.2.1",
|
|
4
4
|
"description": "React Native Seel Widget",
|
|
5
5
|
"main": "./lib/module/index.js",
|
|
6
6
|
"types": "./lib/typescript/src/index.d.ts",
|
|
@@ -83,8 +83,8 @@
|
|
|
83
83
|
"typescript": "^5.9.2"
|
|
84
84
|
},
|
|
85
85
|
"peerDependencies": {
|
|
86
|
-
"react": "
|
|
87
|
-
"react-native": "
|
|
86
|
+
"react": ">=18.0.0",
|
|
87
|
+
"react-native": ">=0.70.0"
|
|
88
88
|
},
|
|
89
89
|
"workspaces": [
|
|
90
90
|
"example"
|
|
@@ -31,6 +31,8 @@ export interface IQuotesRequestCustomer {
|
|
|
31
31
|
*/
|
|
32
32
|
export interface IQuotesRequestExtraInfo {
|
|
33
33
|
shipping_fee?: number;
|
|
34
|
+
total_discounts: number;
|
|
35
|
+
total_sales_tax: number;
|
|
34
36
|
}
|
|
35
37
|
|
|
36
38
|
/**
|
|
@@ -216,5 +218,12 @@ export interface IQuotesRequest {
|
|
|
216
218
|
/**
|
|
217
219
|
* Additional information for the quote
|
|
218
220
|
*/
|
|
219
|
-
extra_info
|
|
221
|
+
extra_info: IQuotesRequestExtraInfo;
|
|
220
222
|
}
|
|
223
|
+
|
|
224
|
+
export type IQuotesRequestWithoutExtraInfo = Omit<IQuotesRequest, 'extra_info'>;
|
|
225
|
+
|
|
226
|
+
export type IQuotesRequestWithOptionalExtraInfo =
|
|
227
|
+
IQuotesRequestWithoutExtraInfo & {
|
|
228
|
+
extra_info?: IQuotesRequestExtraInfo;
|
|
229
|
+
};
|
package/src/network/request.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { SeelWidgetSDK } from '../core/SeelWidgetSDK';
|
|
2
|
+
import { logger } from '../utils';
|
|
2
3
|
|
|
3
4
|
export interface RequestHeaders {
|
|
4
5
|
'X-Seel-API-Key': string;
|
|
@@ -138,7 +139,7 @@ class Request {
|
|
|
138
139
|
...options?.headers,
|
|
139
140
|
};
|
|
140
141
|
|
|
141
|
-
|
|
142
|
+
logger.info('headers:', headers);
|
|
142
143
|
|
|
143
144
|
// Build request body
|
|
144
145
|
let body: string | undefined;
|
|
@@ -168,9 +169,22 @@ class Request {
|
|
|
168
169
|
|
|
169
170
|
// Use Promise.race to handle timeout
|
|
170
171
|
const response = await Promise.race([fetchPromise, timeoutPromise]);
|
|
172
|
+
|
|
171
173
|
// Check response status
|
|
172
174
|
if (!response.ok) {
|
|
173
|
-
|
|
175
|
+
// Try to get error details from response body
|
|
176
|
+
let errorDetails = '';
|
|
177
|
+
try {
|
|
178
|
+
const errorBody = await response.text();
|
|
179
|
+
if (errorBody) {
|
|
180
|
+
errorDetails = ` - ${errorBody}`;
|
|
181
|
+
}
|
|
182
|
+
} catch {
|
|
183
|
+
// Ignore error parsing failure
|
|
184
|
+
}
|
|
185
|
+
throw new Error(
|
|
186
|
+
`HTTP error! status: ${response.status}${errorDetails}`
|
|
187
|
+
);
|
|
174
188
|
}
|
|
175
189
|
|
|
176
190
|
// Parse response data
|
|
@@ -179,6 +193,7 @@ class Request {
|
|
|
179
193
|
} catch (error) {
|
|
180
194
|
// Unified error handling
|
|
181
195
|
if (error instanceof Error) {
|
|
196
|
+
logger.error('POST request failed:', error.message);
|
|
182
197
|
throw new Error(`POST request failed: ${error.message}`);
|
|
183
198
|
}
|
|
184
199
|
throw new Error('POST request failed: Unknown error');
|
|
@@ -8,6 +8,13 @@ import {
|
|
|
8
8
|
import { Animated, StyleSheet, Text, View } from 'react-native';
|
|
9
9
|
import type { TextStyle, ViewStyle } from 'react-native';
|
|
10
10
|
|
|
11
|
+
/** Animation object interface for Animated.loop/timing result */
|
|
12
|
+
interface AnimationHandle {
|
|
13
|
+
start: (callback?: (result: { finished: boolean }) => void) => void;
|
|
14
|
+
stop: () => void;
|
|
15
|
+
reset?: () => void;
|
|
16
|
+
}
|
|
17
|
+
|
|
11
18
|
export interface GradientAnimationTextProps {
|
|
12
19
|
/**
|
|
13
20
|
* Text content to display
|
|
@@ -67,7 +74,7 @@ const GradientAnimationText = forwardRef<
|
|
|
67
74
|
) => {
|
|
68
75
|
// Use a larger range for smoother animation across the container
|
|
69
76
|
const translateX = useRef(new Animated.Value(-300)).current;
|
|
70
|
-
const animationRef = useRef<
|
|
77
|
+
const animationRef = useRef<AnimationHandle | null>(null);
|
|
71
78
|
|
|
72
79
|
const startAnimation = useCallback(() => {
|
|
73
80
|
// Stop existing animation if any
|
|
@@ -94,10 +101,14 @@ const GradientAnimationText = forwardRef<
|
|
|
94
101
|
}
|
|
95
102
|
}, []);
|
|
96
103
|
|
|
97
|
-
useImperativeHandle(
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
104
|
+
useImperativeHandle(
|
|
105
|
+
ref,
|
|
106
|
+
() => ({
|
|
107
|
+
start: startAnimation,
|
|
108
|
+
stop: stopAnimation,
|
|
109
|
+
}),
|
|
110
|
+
[startAnimation, stopAnimation]
|
|
111
|
+
);
|
|
101
112
|
|
|
102
113
|
useEffect(() => {
|
|
103
114
|
if (autoStart) {
|
|
@@ -127,19 +138,19 @@ const GradientAnimationText = forwardRef<
|
|
|
127
138
|
<View
|
|
128
139
|
style={[
|
|
129
140
|
styles.gradientSection,
|
|
130
|
-
{ backgroundColor: gradientColors[0] },
|
|
141
|
+
{ backgroundColor: gradientColors[0] ?? 'transparent' },
|
|
131
142
|
]}
|
|
132
143
|
/>
|
|
133
144
|
<View
|
|
134
145
|
style={[
|
|
135
146
|
styles.gradientSection,
|
|
136
|
-
{ backgroundColor: gradientColors[1] },
|
|
147
|
+
{ backgroundColor: gradientColors[1] ?? 'transparent' },
|
|
137
148
|
]}
|
|
138
149
|
/>
|
|
139
150
|
<View
|
|
140
151
|
style={[
|
|
141
152
|
styles.gradientSection,
|
|
142
|
-
{ backgroundColor: gradientColors[2] },
|
|
153
|
+
{ backgroundColor: gradientColors[2] ?? 'transparent' },
|
|
143
154
|
]}
|
|
144
155
|
/>
|
|
145
156
|
</View>
|
|
@@ -182,4 +193,6 @@ const styles = StyleSheet.create({
|
|
|
182
193
|
},
|
|
183
194
|
});
|
|
184
195
|
|
|
196
|
+
GradientAnimationText.displayName = 'GradientAnimationText';
|
|
197
|
+
|
|
185
198
|
export default GradientAnimationText;
|
|
@@ -15,6 +15,7 @@ import GradientAnimationText, {
|
|
|
15
15
|
import { useRef } from 'react';
|
|
16
16
|
import { NetworkRequestStatusEnum } from '../constants';
|
|
17
17
|
import { ResponseStatusEnum } from '../constants';
|
|
18
|
+
import { logger } from '../utils';
|
|
18
19
|
|
|
19
20
|
export interface SeelWFPTitleViewProps {
|
|
20
21
|
status: string;
|
|
@@ -77,7 +78,7 @@ export interface SeelWFPTitleViewProps {
|
|
|
77
78
|
pressable?: boolean;
|
|
78
79
|
optedIn: boolean;
|
|
79
80
|
dictionary: any;
|
|
80
|
-
|
|
81
|
+
loadingStatus: NetworkRequestStatusEnum;
|
|
81
82
|
onChangeOptedInValue: (optedIn: boolean) => void;
|
|
82
83
|
}
|
|
83
84
|
|
|
@@ -96,7 +97,7 @@ export function SeelWFPTitleView({
|
|
|
96
97
|
darkPriceStyle,
|
|
97
98
|
optedIn = false,
|
|
98
99
|
dictionary = {},
|
|
99
|
-
|
|
100
|
+
loadingStatus = NetworkRequestStatusEnum.Idle,
|
|
100
101
|
onClickInfoIcon,
|
|
101
102
|
onChangeOptedInValue = (_: boolean) => {},
|
|
102
103
|
}: SeelWFPTitleViewProps) {
|
|
@@ -139,7 +140,7 @@ export function SeelWFPTitleView({
|
|
|
139
140
|
style={defaultStyles.infoIconButton}
|
|
140
141
|
hitSlop={{ top: 12, right: 12, bottom: 12, left: 12 }}
|
|
141
142
|
onPress={() => {
|
|
142
|
-
|
|
143
|
+
logger.info('Push To Info Page');
|
|
143
144
|
if (!!onClickInfoIcon && typeof onClickInfoIcon === 'function') {
|
|
144
145
|
onClickInfoIcon();
|
|
145
146
|
}
|
|
@@ -189,7 +190,7 @@ export function SeelWFPTitleView({
|
|
|
189
190
|
hitSlop={{ top: 8, right: 8, bottom: 8, left: 8 }}
|
|
190
191
|
onPress={() => {
|
|
191
192
|
// eslint-disable-next-line no-bitwise
|
|
192
|
-
if ((
|
|
193
|
+
if ((loadingStatus & NetworkRequestStatusEnum.Success) !== 0) {
|
|
193
194
|
onChangeOptedInValue(!optedIn);
|
|
194
195
|
}
|
|
195
196
|
}}
|
|
@@ -215,7 +216,7 @@ export function SeelWFPTitleView({
|
|
|
215
216
|
) : null}
|
|
216
217
|
|
|
217
218
|
{/* eslint-disable-next-line no-bitwise */}
|
|
218
|
-
{(
|
|
219
|
+
{(loadingStatus & NetworkRequestStatusEnum.Loading) === 0 ? (
|
|
219
220
|
status === ResponseStatusEnum.Accepted ? (
|
|
220
221
|
<Text style={_priceStyle} adjustsFontSizeToFit>
|
|
221
222
|
{price}
|
|
@@ -230,7 +231,7 @@ export function SeelWFPTitleView({
|
|
|
230
231
|
/>
|
|
231
232
|
</View>
|
|
232
233
|
)}
|
|
233
|
-
{
|
|
234
|
+
{loadingStatus === NetworkRequestStatusEnum.Success &&
|
|
234
235
|
status === ResponseStatusEnum.Accepted
|
|
235
236
|
? renderInfoButton()
|
|
236
237
|
: null}
|