esewa-ui-library 1.10.10 → 1.10.11

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 CHANGED
@@ -1624,6 +1624,10 @@ This library provides a set of services that allow interaction between the merch
1624
1624
  - [Validate Payment](#validate-payment)
1625
1625
  - [Request Payment](#request-payment)
1626
1626
  - [Close App](#close-app)
1627
+ - [Get Product](#get-product)
1628
+ - [Validate User](#validate-user)
1629
+ - [Merchant Detail](#merchant-detail)
1630
+ - [QR Scanner Request](#qr-scanner-request)
1627
1631
  - [Request File Download](#request-file-download)
1628
1632
  - [Error Handling](#error-handling)
1629
1633
 
@@ -1883,6 +1887,106 @@ const onCloseRequestClick = () => {
1883
1887
  }
1884
1888
  ```
1885
1889
 
1890
+ #### Get Product Request
1891
+
1892
+ ```tsx
1893
+ const onGetProductClick = () => {
1894
+ const obj = {
1895
+ requestType: REQUEST_TYPE_ENUM.GET_PRODUCT,
1896
+ token: sessionStorage.getItem('miniAppAuthToken'),
1897
+ callbackKey: CALLBACK_TYPE_ENUM.GET_PRODUCT_CALLBACK
1898
+ };
1899
+
1900
+ const getProductCallBack = (data: any) => {
1901
+ try {
1902
+ if (!data) throw new Error('Received null or undefined response');
1903
+ const res = JSON.parse(data);
1904
+ if (res?.error_message) throw new Error(res.error_message);
1905
+ setProduct(res);
1906
+ } catch (error) {
1907
+ console.error('Error parsing response:', error);
1908
+ }
1909
+ };
1910
+
1911
+ requestFromMiniApp(obj, getProductCallBack);
1912
+ };
1913
+ ```
1914
+
1915
+ #### Validate User Request
1916
+
1917
+ ```tsx
1918
+ const onValidateUserClick = () => {
1919
+ const obj = {
1920
+ requestType: REQUEST_TYPE_ENUM.VALIDATE_USER,
1921
+ token: sessionStorage.getItem('miniAppAuthToken'),
1922
+ callbackKey: CALLBACK_TYPE_ENUM.VALIDATE_USER_CALLBACK
1923
+ };
1924
+
1925
+ const validateUserCallBack = (data: any) => {
1926
+ try {
1927
+ if (!data) throw new Error('Received null or undefined response');
1928
+ const res = JSON.parse(data);
1929
+ if (res?.error_message) throw new Error(res.error_message);
1930
+ setProduct(res);
1931
+ } catch (error) {
1932
+ console.error('Error parsing response:', error);
1933
+ }
1934
+ };
1935
+
1936
+ requestFromMiniApp(obj, validateUserCallBack);
1937
+ };
1938
+ ```
1939
+
1940
+ #### Merchant Detail Request
1941
+
1942
+ ```tsx
1943
+ const onMerchantDetailClick = () => {
1944
+ const obj = {
1945
+ requestType: REQUEST_TYPE_ENUM.MERCHANT_DETAIL,
1946
+ token: sessionStorage.getItem('miniAppAuthToken'),
1947
+ callbackKey: CALLBACK_TYPE_ENUM.MERCHANT_DETAIL_CALLBACK
1948
+ };
1949
+
1950
+ const merchantDetailCallBack = (data: any) => {
1951
+ try {
1952
+ if (!data) throw new Error('Received null or undefined response');
1953
+ const res = JSON.parse(data);
1954
+ if (res?.error_message) throw new Error(res.error_message);
1955
+ setProduct(res);
1956
+ } catch (error) {
1957
+ console.error('Error parsing response:', error);
1958
+ }
1959
+ };
1960
+
1961
+ requestFromMiniApp(obj, merchantDetailCallBack);
1962
+ };
1963
+ ```
1964
+
1965
+ #### QR Scanner Request
1966
+
1967
+ ```tsx
1968
+ const onQrScannerClick = () => {
1969
+ const obj = {
1970
+ requestType: REQUEST_TYPE_ENUM.QR_SCANNER_ACCESS,
1971
+ token: sessionStorage.getItem('miniAppAuthToken'),
1972
+ callbackKey: CALLBACK_TYPE_ENUM.QR_SCANNER_ACCESS_CALLBACK
1973
+ };
1974
+
1975
+ const qrScannerCallBack = (data: any) => {
1976
+ try {
1977
+ if (!data) throw new Error('Received null or undefined response');
1978
+ const res = JSON.parse(data);
1979
+ if (res?.error_message) throw new Error(res.error_message);
1980
+ setProduct(res);
1981
+ } catch (error) {
1982
+ console.error('Error parsing response:', error);
1983
+ }
1984
+ };
1985
+
1986
+ requestFromMiniApp(obj, qrScannerCallBack);
1987
+ };
1988
+ ```
1989
+
1886
1990
  #### Request File Download
1887
1991
 
1888
1992
  Pass the following to request file download.
@@ -2015,6 +2119,10 @@ enum REQUEST_TYPE_ENUM {
2015
2119
  VALIDATE_TRANSACTION = 'VALIDATE_TRANSACTION',
2016
2120
  CLOSE_APP = 'CLOSE_APP',
2017
2121
  FILE_DOWNLOAD_ACCESS = 'FILE_DOWNLOAD_ACCESS'
2122
+ GET_PRODUCT = 'GET_PRODUCT',
2123
+ VALIDATE_USER = 'VALIDATE_USER',
2124
+ MERCHANT_DETAIL = 'MERCHANT_DETAIL',
2125
+ QR_SCANNER_ACCESS = 'QR_SCANNER_ACCESS'
2018
2126
  }
2019
2127
  ```
2020
2128
 
@@ -2033,7 +2141,11 @@ enum CALLBACK_TYPE_ENUM{
2033
2141
  LOCATION_ACCESS_CALLBACK = 'LOCATION_ACCESS_CALLBACK',
2034
2142
  VALIDATE_TRANSACTION_CALLBACK = 'VALIDATE_TRANSACTION_CALLBACK',
2035
2143
  CLOSE_APP_CALLBACK = 'CLOSE_APP_CALLBACK',
2036
- FILE_DOWNLOAD_ACCESS_CALLBACK = 'FILE_DOWNLOAD_ACCESS_CALLBACK'
2144
+ FILE_DOWNLOAD_ACCESS_CALLBACK = 'FILE_DOWNLOAD_ACCESS_CALLBACK',
2145
+ GET_PRODUCT_CALLBACK = 'GET_PRODUCT_CALLBACK',
2146
+ VALIDATE_USER_CALLBACK = 'VALIDATE_USER_CALLBACK',
2147
+ MERCHANT_DETAIL_CALLBACK = 'MERCHANT_DETAIL_CALLBACK',
2148
+ QR_SCANNER_ACCESS_CALLBACK = 'QR_SCANNER_ACCESS_CALLBACK'
2037
2149
  }
2038
2150
  ```
2039
2151
 
@@ -8,7 +8,9 @@ export declare enum REQUEST_TYPE_ENUM {
8
8
  CLOSE_APP = "CLOSE_APP",
9
9
  FILE_DOWNLOAD_ACCESS = "FILE_DOWNLOAD_ACCESS",
10
10
  GET_PRODUCT = "GET_PRODUCT",
11
- VALIDATE_USER = "VALIDATE_USER"
11
+ VALIDATE_USER = "VALIDATE_USER",
12
+ MERCHANT_DETAIL = "MERCHANT_DETAIL",
13
+ QR_SCANNER_ACCESS = "QR_SCANNER_ACCESS"
12
14
  }
13
15
  export declare enum CALLBACK_TYPE_ENUM {
14
16
  INIT_APP_CALLBACK = "INIT_APP_CALLBACK",
@@ -20,7 +22,9 @@ export declare enum CALLBACK_TYPE_ENUM {
20
22
  CLOSE_APP_CALLBACK = "CLOSE_APP_CALLBACK",
21
23
  FILE_DOWNLOAD_ACCESS_CALLBACK = "FILE_DOWNLOAD_ACCESS_CALLBACK",
22
24
  GET_PRODUCT_CALLBACK = "GET_PRODUCT_CALLBACK",
23
- VALIDATE_USER_CALLBACK = "VALIDATE_USER_CALLBACK"
25
+ VALIDATE_USER_CALLBACK = "VALIDATE_USER_CALLBACK",
26
+ MERCHANT_DETAIL_CALLBACK = "MERCHANT_DETAIL_CALLBACK",
27
+ QR_SCANNER_ACCESS_CALLBACK = "QR_SCANNER_ACCESS_CALLBACK"
24
28
  }
25
29
  export interface MINI_APP_RESPONSE_TYPE {
26
30
  requestType: string;
@@ -56,6 +60,8 @@ declare global {
56
60
  FILE_DOWNLOAD_CALLBACK?: Callback | null;
57
61
  GET_PRODUCT_CALLBACK?: Callback | null;
58
62
  VALIDATE_USER_CALLBACK?: Callback | null;
63
+ MERCHANT_DETAIL_CALLBACK?: Callback | null;
64
+ QR_SCANNER_ACCESS_CALLBACK?: Callback | null;
59
65
  };
60
66
  iOSNative: {
61
67
  INIT_APP_CALLBACK?: Callback | null;
@@ -68,6 +74,8 @@ declare global {
68
74
  FILE_DOWNLOAD_CALLBACK?: Callback | null;
69
75
  GET_PRODUCT_CALLBACK?: Callback | null;
70
76
  VALIDATE_USER_CALLBACK?: Callback | null;
77
+ MERCHANT_DETAIL_CALLBACK?: Callback | null;
78
+ QR_SCANNER_ACCESS_CALLBACK?: Callback | null;
71
79
  };
72
80
  flutter_inappwebview: {
73
81
  callHandler?: (handlerName: string, data: any) => void;
@@ -81,6 +89,8 @@ declare global {
81
89
  FILE_DOWNLOAD_CALLBACK?: Callback | null;
82
90
  GET_PRODUCT_CALLBACK?: Callback | null;
83
91
  VALIDATE_USER_CALLBACK?: Callback | null;
92
+ MERCHANT_DETAIL_CALLBACK?: Callback | null;
93
+ QR_SCANNER_ACCESS_CALLBACK?: Callback | null;
84
94
  };
85
95
  webkit: {
86
96
  messageHandlers: {
package/dist/index.js CHANGED
@@ -7829,6 +7829,8 @@ var reverseSnakeCase = function reverseSnakeCase(str) {
7829
7829
  REQUEST_TYPE_ENUM["FILE_DOWNLOAD_ACCESS"] = "FILE_DOWNLOAD_ACCESS";
7830
7830
  REQUEST_TYPE_ENUM["GET_PRODUCT"] = "GET_PRODUCT";
7831
7831
  REQUEST_TYPE_ENUM["VALIDATE_USER"] = "VALIDATE_USER";
7832
+ REQUEST_TYPE_ENUM["MERCHANT_DETAIL"] = "MERCHANT_DETAIL";
7833
+ REQUEST_TYPE_ENUM["QR_SCANNER_ACCESS"] = "QR_SCANNER_ACCESS";
7832
7834
  })(exports.REQUEST_TYPE_ENUM || (exports.REQUEST_TYPE_ENUM = {}));
7833
7835
  (function (CALLBACK_TYPE_ENUM) {
7834
7836
  CALLBACK_TYPE_ENUM["INIT_APP_CALLBACK"] = "INIT_APP_CALLBACK";
@@ -7841,6 +7843,8 @@ var reverseSnakeCase = function reverseSnakeCase(str) {
7841
7843
  CALLBACK_TYPE_ENUM["FILE_DOWNLOAD_ACCESS_CALLBACK"] = "FILE_DOWNLOAD_ACCESS_CALLBACK";
7842
7844
  CALLBACK_TYPE_ENUM["GET_PRODUCT_CALLBACK"] = "GET_PRODUCT_CALLBACK";
7843
7845
  CALLBACK_TYPE_ENUM["VALIDATE_USER_CALLBACK"] = "VALIDATE_USER_CALLBACK";
7846
+ CALLBACK_TYPE_ENUM["MERCHANT_DETAIL_CALLBACK"] = "MERCHANT_DETAIL_CALLBACK";
7847
+ CALLBACK_TYPE_ENUM["QR_SCANNER_ACCESS_CALLBACK"] = "QR_SCANNER_ACCESS_CALLBACK";
7844
7848
  })(exports.CALLBACK_TYPE_ENUM || (exports.CALLBACK_TYPE_ENUM = {}));
7845
7849
 
7846
7850
  var _templateObject$o;