@tap-payments/os-micro-frontend-shared 0.0.275-test.1 → 0.0.276
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/build/components/index.d.ts +0 -2
- package/build/components/index.js +0 -2
- package/build/types/analytics.d.ts +2 -1
- package/build/types/analytics.js +1 -0
- package/package.json +3 -3
- package/build/components/ScrollLoader/ScrollLoader.d.ts +0 -10
- package/build/components/ScrollLoader/ScrollLoader.js +0 -43
- package/build/components/ScrollLoader/index.d.ts +0 -3
- package/build/components/ScrollLoader/index.js +0 -3
|
@@ -95,5 +95,3 @@ export * from './TableHeader';
|
|
|
95
95
|
export { default as RangeCalender } from './RangeCalender';
|
|
96
96
|
export { default as AppServices } from './AppServices';
|
|
97
97
|
export * from './SourceChips';
|
|
98
|
-
export { default as ScrollLoader } from './ScrollLoader';
|
|
99
|
-
export * from './ScrollLoader';
|
|
@@ -95,5 +95,3 @@ export * from './TableHeader';
|
|
|
95
95
|
export { default as RangeCalender } from './RangeCalender';
|
|
96
96
|
export { default as AppServices } from './AppServices';
|
|
97
97
|
export * from './SourceChips';
|
|
98
|
-
export { default as ScrollLoader } from './ScrollLoader';
|
|
99
|
-
export * from './ScrollLoader';
|
|
@@ -28,5 +28,6 @@ export declare enum ChargeBreakDownType {
|
|
|
28
28
|
PaymentMethod = "PAYMENT_METHOD",
|
|
29
29
|
PaymentCurrency = "PAYMENT_CURRENCY",
|
|
30
30
|
PaymentScheme = "PAYMENT_SCHEME",
|
|
31
|
-
PaymentType = "PAYMENT_TYPE"
|
|
31
|
+
PaymentType = "PAYMENT_TYPE",
|
|
32
|
+
PaymentLocation = "PAYMENT_LOCATION"
|
|
32
33
|
}
|
package/build/types/analytics.js
CHANGED
|
@@ -4,4 +4,5 @@ export var ChargeBreakDownType;
|
|
|
4
4
|
ChargeBreakDownType["PaymentCurrency"] = "PAYMENT_CURRENCY";
|
|
5
5
|
ChargeBreakDownType["PaymentScheme"] = "PAYMENT_SCHEME";
|
|
6
6
|
ChargeBreakDownType["PaymentType"] = "PAYMENT_TYPE";
|
|
7
|
+
ChargeBreakDownType["PaymentLocation"] = "PAYMENT_LOCATION";
|
|
7
8
|
})(ChargeBreakDownType || (ChargeBreakDownType = {}));
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tap-payments/os-micro-frontend-shared",
|
|
3
3
|
"description": "Shared components and utilities for Tap Payments micro frontends",
|
|
4
|
-
"version": "0.0.
|
|
5
|
-
"testVersion":
|
|
4
|
+
"version": "0.0.276",
|
|
5
|
+
"testVersion": 0,
|
|
6
6
|
"type": "module",
|
|
7
7
|
"main": "build/index.js",
|
|
8
8
|
"module": "build/index.js",
|
|
@@ -131,4 +131,4 @@
|
|
|
131
131
|
"publishConfig": {
|
|
132
132
|
"registry": "https://registry.npmjs.org/"
|
|
133
133
|
}
|
|
134
|
-
}
|
|
134
|
+
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import React, { PropsWithChildren } from 'react';
|
|
2
|
-
import { StackProps } from '@mui/material/Stack';
|
|
3
|
-
export type ScrollLoaderProps<IRootProps extends object = StackProps> = PropsWithChildren<IRootProps & {
|
|
4
|
-
component?: React.FC<IRootProps> | React.ElementType;
|
|
5
|
-
loadMoreItems: () => Promise<unknown>;
|
|
6
|
-
loading?: boolean;
|
|
7
|
-
hasMore?: boolean;
|
|
8
|
-
}>;
|
|
9
|
-
declare const ScrollLoader: <IRootProps extends object = StackProps>(props: ScrollLoaderProps<IRootProps>) => import("react/jsx-runtime").JSX.Element;
|
|
10
|
-
export default ScrollLoader;
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
2
|
-
var t = {};
|
|
3
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
4
|
-
t[p] = s[p];
|
|
5
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
6
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
7
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
8
|
-
t[p[i]] = s[p[i]];
|
|
9
|
-
}
|
|
10
|
-
return t;
|
|
11
|
-
};
|
|
12
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
|
-
import { useCallback, useEffect, useRef } from 'react';
|
|
14
|
-
import Stack from '@mui/material/Stack';
|
|
15
|
-
const OFFSET = 50;
|
|
16
|
-
const ScrollLoader = (props) => {
|
|
17
|
-
const { component = Stack, loadMoreItems, hasMore, loading, children } = props, rootProps = __rest(props, ["component", "loadMoreItems", "hasMore", "loading", "children"]);
|
|
18
|
-
const loadMoreItemsRef = useRef(loadMoreItems);
|
|
19
|
-
loadMoreItemsRef.current = loadMoreItems;
|
|
20
|
-
const Component = component;
|
|
21
|
-
const containerRef = useRef(null);
|
|
22
|
-
const handleScroll = useCallback(() => {
|
|
23
|
-
const el = containerRef.current;
|
|
24
|
-
if (!el || loading || !hasMore)
|
|
25
|
-
return;
|
|
26
|
-
const isBottom = el.scrollHeight - el.scrollTop <= el.clientHeight + OFFSET;
|
|
27
|
-
if (isBottom)
|
|
28
|
-
loadMoreItemsRef.current();
|
|
29
|
-
}, [loading, hasMore]);
|
|
30
|
-
useEffect(() => {
|
|
31
|
-
loadMoreItemsRef.current().then(() => {
|
|
32
|
-
setTimeout(() => {
|
|
33
|
-
handleScroll();
|
|
34
|
-
}, 100);
|
|
35
|
-
});
|
|
36
|
-
}, []);
|
|
37
|
-
return (_jsx(Component, Object.assign({ overflow: "auto", height: "100%", maxHeight: "calc(100vh - 321px)", ref: containerRef, onScroll: handleScroll, style: {
|
|
38
|
-
overflow: 'auto',
|
|
39
|
-
height: '100%',
|
|
40
|
-
maxHeight: 'calc(100vh - 321px)',
|
|
41
|
-
} }, rootProps, { children: children })));
|
|
42
|
-
};
|
|
43
|
-
export default ScrollLoader;
|