esewa-ui-library 1.10.4 → 1.10.6

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
@@ -1864,6 +1864,23 @@ const onRequestPaymentClick = () => {
1864
1864
  };
1865
1865
  ```
1866
1866
 
1867
+ #### Close App
1868
+
1869
+ Pass the following to close the app.
1870
+
1871
+ ```tsx
1872
+ const onCloseRequestClick = () => {
1873
+ const obj: REQUEST_DATA_TYPE = {
1874
+ requestType: REQUEST_TYPE_ENUM.CLOSE_APP,
1875
+ callbackKey: CALLBACK_TYPE_ENUM.CLOSE_APP_CALLBACK
1876
+ }
1877
+
1878
+ requestFromMiniApp(
1879
+ obj
1880
+ )
1881
+ }
1882
+ ```
1883
+
1867
1884
  ## Error Handling
1868
1885
 
1869
1886
  Errors are returned as JSON responses with an `error_message` field.
@@ -1910,7 +1927,8 @@ enum REQUEST_TYPE_ENUM {
1910
1927
  USER_DETAIL_ACCESS = 'USER_DETAIL_ACCESS',
1911
1928
  MEDIA_ACCESS = 'MEDIA_ACCESS',
1912
1929
  LOCATION_ACCESS = 'LOCATION_ACCESS',
1913
- VALIDATE_TRANSACTION = 'VALIDATE_TRANSACTION'
1930
+ VALIDATE_TRANSACTION = 'VALIDATE_TRANSACTION',
1931
+ CLOSE_APP = 'CLOSE_APP'
1914
1932
  }
1915
1933
  ```
1916
1934
 
@@ -1927,7 +1945,8 @@ enum CALLBACK_TYPE_ENUM{
1927
1945
  USER_DETAIL_ACCESS_CALLBACK = 'USER_DETAIL_ACCESS_CALLBACK',
1928
1946
  MEDIA_ACCESS_CALLBACK = 'MEDIA_ACCESS_CALLBACK',
1929
1947
  LOCATION_ACCESS_CALLBACK = 'LOCATION_ACCESS_CALLBACK',
1930
- VALIDATE_TRANSACTION_CALLBACK = 'VALIDATE_TRANSACTION_CALLBACK'
1948
+ VALIDATE_TRANSACTION_CALLBACK = 'VALIDATE_TRANSACTION_CALLBACK',
1949
+ CLOSE_APP_CALLBACK = 'CLOSE_APP_CALLBACK'
1931
1950
  }
1932
1951
  ```
1933
1952
 
@@ -4,7 +4,8 @@ export declare enum REQUEST_TYPE_ENUM {
4
4
  USER_DETAIL_ACCESS = "USER_DETAIL_ACCESS",
5
5
  MEDIA_ACCESS = "MEDIA_ACCESS",
6
6
  LOCATION_ACCESS = "LOCATION_ACCESS",
7
- VALIDATE_TRANSACTION = "VALIDATE_TRANSACTION"
7
+ VALIDATE_TRANSACTION = "VALIDATE_TRANSACTION",
8
+ CLOSE_APP = "CLOSE_APP"
8
9
  }
9
10
  export declare enum CALLBACK_TYPE_ENUM {
10
11
  INIT_APP_CALLBACK = "INIT_APP_CALLBACK",
@@ -12,7 +13,8 @@ export declare enum CALLBACK_TYPE_ENUM {
12
13
  USER_DETAIL_ACCESS_CALLBACK = "USER_DETAIL_ACCESS_CALLBACK",
13
14
  MEDIA_ACCESS_CALLBACK = "MEDIA_ACCESS_CALLBACK",
14
15
  LOCATION_ACCESS_CALLBACK = "LOCATION_ACCESS_CALLBACK",
15
- VALIDATE_TRANSACTION_CALLBACK = "VALIDATE_TRANSACTION_CALLBACK"
16
+ VALIDATE_TRANSACTION_CALLBACK = "VALIDATE_TRANSACTION_CALLBACK",
17
+ CLOSE_APP_CALLBACK = "CLOSE_APP_CALLBACK"
16
18
  }
17
19
  export interface MINI_APP_RESPONSE_TYPE {
18
20
  requestType: string;
@@ -24,7 +26,7 @@ export interface REQUEST_DATA_TYPE {
24
26
  device_unique_id?: string;
25
27
  merchant_identifier?: string;
26
28
  vendorIdentifier?: any;
27
- requestType: REQUEST_TYPE_ENUM;
29
+ requestType?: REQUEST_TYPE_ENUM;
28
30
  method?: 'GET' | 'POST';
29
31
  data?: any;
30
32
  callbackKey?: string;
@@ -44,6 +46,7 @@ declare global {
44
46
  MEDIA_ACCESS_CALLBACK?: Callback | null;
45
47
  LOCATION_ACCESS_CALLBACK?: Callback | null;
46
48
  VALIDATE_TRANSACTION_CALLBACK?: Callback | null;
49
+ CLOSE_APP_CALLBACK?: Callback | null;
47
50
  };
48
51
  iOSNative: {
49
52
  INIT_APP_CALLBACK?: Callback | null;
@@ -52,6 +55,7 @@ declare global {
52
55
  MEDIA_ACCESS_CALLBACK?: Callback | null;
53
56
  LOCATION_ACCESS_CALLBACK?: Callback | null;
54
57
  VALIDATE_TRANSACTION_CALLBACK?: Callback | null;
58
+ CLOSE_APP_CALLBACK?: Callback | null;
55
59
  };
56
60
  webkit: {
57
61
  messageHandlers: {
package/dist/index.js CHANGED
@@ -190,7 +190,7 @@ var StyledAppBar = styled__default.header.attrs(function (_ref) {
190
190
  return {
191
191
  titleposition: titleposition
192
192
  };
193
- })(_templateObject$3 || (_templateObject$3 = _taggedTemplateLiteralLoose(["\n width: 100%;\n\n .e-app-bar {\n display: flex;\n justify-content: space-between;\n flex-direction: row;\n align-items: center;\n background-color: var(--appbar-bg-top);\n padding: 7px 12px;\n position: relative;\n height: 42px;\n gap: var(--values-value-8);\n\n &--nav-icon,\n &--close-icon {\n padding: 7px;\n color: var(--white);\n display: flex;\n align-items: center;\n justify-content: center;\n }\n\n /* Title section */\n &--title-wrapper {\n display: flex;\n justify-content: ", ";\n align-items: center;\n width: 100%; // Ensures the title section takes full width to apply the alignment\n }\n\n &--title {\n display: flex;\n align-items: center;\n gap: 12px;\n overflow: hidden;\n }\n\n &--title-image img {\n width: 32px;\n object-fit: cover;\n background: var(--white);\n border: 1px solid var(--border);\n border-radius: var(--grid-borderradius-border-radius-xs);\n }\n\n &--title-label {\n color: var(--white);\n letter-spacing: 0.4px;\n font-size: var(--values-value-16);\n font-weight: 500;\n }\n }\n"])), function (props) {
193
+ })(_templateObject$3 || (_templateObject$3 = _taggedTemplateLiteralLoose(["\n width: 100%;\n\n .e-app-bar {\n display: flex;\n justify-content: space-between;\n flex-direction: row;\n align-items: center;\n background-color: var(--appbar-bg-top);\n padding: 7px 12px;\n position: relative;\n height: 56px;\n gap: var(--values-value-8);\n box-sizing: border-box;\n\n &--nav-icon,\n &--close-icon {\n padding: 7px;\n color: var(--white);\n display: flex;\n align-items: center;\n justify-content: center;\n }\n\n /* Title section */\n &--title-wrapper {\n display: flex;\n justify-content: ", ";\n align-items: center;\n width: 100%; // Ensures the title section takes full width to apply the alignment\n }\n\n &--title {\n display: flex;\n align-items: center;\n gap: 12px;\n overflow: hidden;\n }\n\n &--title-image img {\n width: 32px;\n object-fit: cover;\n background: var(--white);\n border: 1px solid var(--border);\n border-radius: var(--grid-borderradius-border-radius-xs);\n }\n\n &--title-label {\n color: var(--white);\n letter-spacing: 0.4px;\n font-size: var(--values-value-16);\n font-weight: 500;\n }\n }\n"])), function (props) {
194
194
  return props.titleposition === 'left' ? 'flex-start' : props.titleposition === 'right' ? 'flex-end' : 'center';
195
195
  });
196
196
  var ESewaAppBar = function ESewaAppBar(_ref2) {
@@ -7749,15 +7749,17 @@ var CONNECT_APP = function CONNECT_APP(data) {
7749
7749
  };
7750
7750
  var requestFromMiniApp = function requestFromMiniApp(data, callbackFn) {
7751
7751
  var callbackKey = data.callbackKey;
7752
- if (!callbackKey) {
7752
+ if (callbackFn && !callbackKey) {
7753
7753
  throw new Error('Callback key is missing in request data');
7754
7754
  }
7755
- if (isAndroid) {
7756
- window.Android = window.Android || {};
7757
- window.Android[callbackKey] = callbackFn;
7758
- } else if (isiOS) {
7759
- window.iOSNative = window.iOSNative || {};
7760
- window.iOSNative[callbackKey] = callbackFn;
7755
+ if (callbackFn) {
7756
+ if (isAndroid) {
7757
+ window.Android = window.Android || {};
7758
+ window.Android[callbackKey] = callbackFn;
7759
+ } else if (isiOS) {
7760
+ window.iOSNative = window.iOSNative || {};
7761
+ window.iOSNative[callbackKey] = callbackFn;
7762
+ }
7761
7763
  }
7762
7764
  CONNECT_APP(JSON.stringify(data));
7763
7765
  };
@@ -7811,6 +7813,7 @@ var reverseSnakeCase = function reverseSnakeCase(str) {
7811
7813
  REQUEST_TYPE_ENUM["MEDIA_ACCESS"] = "MEDIA_ACCESS";
7812
7814
  REQUEST_TYPE_ENUM["LOCATION_ACCESS"] = "LOCATION_ACCESS";
7813
7815
  REQUEST_TYPE_ENUM["VALIDATE_TRANSACTION"] = "VALIDATE_TRANSACTION";
7816
+ REQUEST_TYPE_ENUM["CLOSE_APP"] = "CLOSE_APP";
7814
7817
  })(exports.REQUEST_TYPE_ENUM || (exports.REQUEST_TYPE_ENUM = {}));
7815
7818
  (function (CALLBACK_TYPE_ENUM) {
7816
7819
  CALLBACK_TYPE_ENUM["INIT_APP_CALLBACK"] = "INIT_APP_CALLBACK";
@@ -7819,6 +7822,7 @@ var reverseSnakeCase = function reverseSnakeCase(str) {
7819
7822
  CALLBACK_TYPE_ENUM["MEDIA_ACCESS_CALLBACK"] = "MEDIA_ACCESS_CALLBACK";
7820
7823
  CALLBACK_TYPE_ENUM["LOCATION_ACCESS_CALLBACK"] = "LOCATION_ACCESS_CALLBACK";
7821
7824
  CALLBACK_TYPE_ENUM["VALIDATE_TRANSACTION_CALLBACK"] = "VALIDATE_TRANSACTION_CALLBACK";
7825
+ CALLBACK_TYPE_ENUM["CLOSE_APP_CALLBACK"] = "CLOSE_APP_CALLBACK";
7822
7826
  })(exports.CALLBACK_TYPE_ENUM || (exports.CALLBACK_TYPE_ENUM = {}));
7823
7827
 
7824
7828
  var _templateObject$o;