@scrumble-nl/gatherer-frontend 1.3.1 → 1.4.0-beta.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 +25 -25
- package/lib/module/context/gatherer-context.js +22 -14
- package/lib/module/context/gatherer-context.js.map +1 -1
- package/lib/module/context/scan-context.js +7 -3
- package/lib/module/context/scan-context.js.map +1 -1
- package/lib/module/hooks/use-gatherer.js +3 -1
- package/lib/module/hooks/use-gatherer.js.map +1 -1
- package/lib/module/hooks/use-pick-item-switch.js +4 -2
- package/lib/module/hooks/use-pick-item-switch.js.map +1 -1
- package/lib/module/hooks/use-scanner.js +3 -1
- package/lib/module/hooks/use-scanner.js.map +1 -1
- package/lib/module/index.js +7 -5
- package/lib/module/index.js.map +1 -1
- package/lib/module/lang/en/components/pick-list.js +2 -0
- package/lib/module/lang/en/components/pick-list.js.map +1 -1
- package/lib/module/lang/en/components/picker.js +2 -0
- package/lib/module/lang/en/components/picker.js.map +1 -1
- package/lib/module/lang/en/english.js +4 -2
- package/lib/module/lang/en/english.js.map +1 -1
- package/lib/module/lang/i18n.js +4 -3
- package/lib/module/lang/i18n.js.map +1 -1
- package/lib/module/lang/nl/components/pick-list.js +2 -0
- package/lib/module/lang/nl/components/pick-list.js.map +1 -1
- package/lib/module/lang/nl/components/picker.js +2 -0
- package/lib/module/lang/nl/components/picker.js.map +1 -1
- package/lib/module/lang/nl/dutch.js +4 -2
- package/lib/module/lang/nl/dutch.js.map +1 -1
- package/lib/module/package.json +1 -0
- package/lib/module/pick-list/partials/empty-list.js +11 -6
- package/lib/module/pick-list/partials/empty-list.js.map +1 -1
- package/lib/module/pick-list/partials/pick-group-item.js +24 -13
- package/lib/module/pick-list/partials/pick-group-item.js.map +1 -1
- package/lib/module/pick-list/partials/search.js +34 -28
- package/lib/module/pick-list/partials/search.js.map +1 -1
- package/lib/module/pick-list/pick-list.js +12 -9
- package/lib/module/pick-list/pick-list.js.map +1 -1
- package/lib/module/pick-list/styles/empty-list-styles.js +3 -1
- package/lib/module/pick-list/styles/empty-list-styles.js.map +1 -1
- package/lib/module/pick-list/styles/pick-group-item-styles.js +3 -1
- package/lib/module/pick-list/styles/pick-group-item-styles.js.map +1 -1
- package/lib/module/pick-list/styles/search-styles.js +3 -1
- package/lib/module/pick-list/styles/search-styles.js.map +1 -1
- package/lib/module/picker/partials/modal/pick-modal.js +24 -16
- package/lib/module/picker/partials/modal/pick-modal.js.map +1 -1
- package/lib/module/picker/partials/modal/pick-quantity-select.js +51 -38
- package/lib/module/picker/partials/modal/pick-quantity-select.js.map +1 -1
- package/lib/module/picker/partials/pick-amount.js +17 -11
- package/lib/module/picker/partials/pick-amount.js.map +1 -1
- package/lib/module/picker/partials/product-info.js +21 -15
- package/lib/module/picker/partials/product-info.js.map +1 -1
- package/lib/module/picker/partials/progress-bar.js +21 -15
- package/lib/module/picker/partials/progress-bar.js.map +1 -1
- package/lib/module/picker/picker.js +21 -17
- package/lib/module/picker/picker.js.map +1 -1
- package/lib/module/picker/styles/pick-amount-styles.js +3 -1
- package/lib/module/picker/styles/pick-amount-styles.js.map +1 -1
- package/lib/module/picker/styles/pick-modal-styles.js +3 -1
- package/lib/module/picker/styles/pick-modal-styles.js.map +1 -1
- package/lib/module/picker/styles/picker-styles.js +2 -0
- package/lib/module/picker/styles/picker-styles.js.map +1 -1
- package/lib/module/picker/styles/product-info-styles.js +3 -1
- package/lib/module/picker/styles/product-info-styles.js.map +1 -1
- package/lib/module/picker/styles/progress-bar-styles.js +3 -1
- package/lib/module/picker/styles/progress-bar-styles.js.map +1 -1
- package/lib/module/shared/api/api-urls.js +2 -0
- package/lib/module/shared/api/api-urls.js.map +1 -1
- package/lib/module/shared/badge/badge.js +12 -7
- package/lib/module/shared/badge/badge.js.map +1 -1
- package/lib/module/shared/badge/styles/badge-styles.js +3 -1
- package/lib/module/shared/badge/styles/badge-styles.js.map +1 -1
- package/lib/module/shared/constants.js +2 -0
- package/lib/module/shared/constants.js.map +1 -1
- package/lib/module/shared/default-pick-group-item.js +17 -13
- package/lib/module/shared/default-pick-group-item.js.map +1 -1
- package/lib/module/shared/layout/data-column.js +14 -9
- package/lib/module/shared/layout/data-column.js.map +1 -1
- package/lib/module/shared/layout/data-format.js +8 -4
- package/lib/module/shared/layout/data-format.js.map +1 -1
- package/lib/module/shared/layout/data-row.js +16 -12
- package/lib/module/shared/layout/data-row.js.map +1 -1
- package/lib/module/shared/layout/styles/layout-styles.js +3 -1
- package/lib/module/shared/layout/styles/layout-styles.js.map +1 -1
- package/lib/module/shared/press-button/press-button.js +9 -5
- package/lib/module/shared/press-button/press-button.js.map +1 -1
- package/lib/module/types/badge/badge.d.js +1 -1
- package/lib/module/types/badge/badge.d.js.map +1 -1
- package/lib/module/types/config/config.d.js +1 -1
- package/lib/module/types/config/config.d.js.map +1 -1
- package/lib/module/types/control/control.d.js +1 -1
- package/lib/module/types/control/control.d.js.map +1 -1
- package/lib/module/types/pick-group/pick-group.d.js +1 -1
- package/lib/module/types/pick-group/pick-group.d.js.map +1 -1
- package/lib/module/types/pick-group/search-params.d.js +1 -1
- package/lib/module/types/pick-group/search-params.d.js.map +1 -1
- package/lib/module/types/pick-item/pick-item.d.js +1 -1
- package/lib/module/types/pick-item/pick-item.d.js.map +1 -1
- package/lib/module/types/scanner/scanner.d.js +1 -1
- package/lib/module/types/scanner/scanner.d.js.map +1 -1
- package/lib/typescript/context/gatherer-context.d.ts +3 -1
- package/lib/typescript/context/gatherer-context.d.ts.map +1 -0
- package/lib/typescript/context/scan-context.d.ts +2 -1
- package/lib/typescript/context/scan-context.d.ts.map +1 -0
- package/lib/typescript/hooks/use-gatherer.d.ts +3 -2
- package/lib/typescript/hooks/use-gatherer.d.ts.map +1 -0
- package/lib/typescript/hooks/use-pick-item-switch.d.ts +1 -0
- package/lib/typescript/hooks/use-pick-item-switch.d.ts.map +1 -0
- package/lib/typescript/hooks/use-scanner.d.ts +1 -0
- package/lib/typescript/hooks/use-scanner.d.ts.map +1 -0
- package/lib/typescript/index.d.ts +1 -0
- package/lib/typescript/index.d.ts.map +1 -0
- package/lib/typescript/lang/en/components/pick-list.d.ts +1 -0
- package/lib/typescript/lang/en/components/pick-list.d.ts.map +1 -0
- package/lib/typescript/lang/en/components/picker.d.ts +1 -0
- package/lib/typescript/lang/en/components/picker.d.ts.map +1 -0
- package/lib/typescript/lang/en/english.d.ts +1 -0
- package/lib/typescript/lang/en/english.d.ts.map +1 -0
- package/lib/typescript/lang/i18n.d.ts +1 -0
- package/lib/typescript/lang/i18n.d.ts.map +1 -0
- package/lib/typescript/lang/nl/components/pick-list.d.ts +1 -0
- package/lib/typescript/lang/nl/components/pick-list.d.ts.map +1 -0
- package/lib/typescript/lang/nl/components/picker.d.ts +1 -0
- package/lib/typescript/lang/nl/components/picker.d.ts.map +1 -0
- package/lib/typescript/lang/nl/dutch.d.ts +1 -0
- package/lib/typescript/lang/nl/dutch.d.ts.map +1 -0
- package/lib/typescript/package.json +1 -0
- package/lib/typescript/pick-list/partials/empty-list.d.ts +3 -1
- package/lib/typescript/pick-list/partials/empty-list.d.ts.map +1 -0
- package/lib/typescript/pick-list/partials/pick-group-item.d.ts +3 -1
- package/lib/typescript/pick-list/partials/pick-group-item.d.ts.map +1 -0
- package/lib/typescript/pick-list/partials/search.d.ts +3 -1
- package/lib/typescript/pick-list/partials/search.d.ts.map +1 -0
- package/lib/typescript/pick-list/pick-list.d.ts +3 -1
- package/lib/typescript/pick-list/pick-list.d.ts.map +1 -0
- package/lib/typescript/pick-list/styles/empty-list-styles.d.ts +1 -0
- package/lib/typescript/pick-list/styles/empty-list-styles.d.ts.map +1 -0
- package/lib/typescript/pick-list/styles/pick-group-item-styles.d.ts +1 -0
- package/lib/typescript/pick-list/styles/pick-group-item-styles.d.ts.map +1 -0
- package/lib/typescript/pick-list/styles/search-styles.d.ts +1 -0
- package/lib/typescript/pick-list/styles/search-styles.d.ts.map +1 -0
- package/lib/typescript/picker/partials/modal/pick-modal.d.ts +3 -1
- package/lib/typescript/picker/partials/modal/pick-modal.d.ts.map +1 -0
- package/lib/typescript/picker/partials/modal/pick-quantity-select.d.ts +3 -1
- package/lib/typescript/picker/partials/modal/pick-quantity-select.d.ts.map +1 -0
- package/lib/typescript/picker/partials/pick-amount.d.ts +3 -1
- package/lib/typescript/picker/partials/pick-amount.d.ts.map +1 -0
- package/lib/typescript/picker/partials/product-info.d.ts +3 -2
- package/lib/typescript/picker/partials/product-info.d.ts.map +1 -0
- package/lib/typescript/picker/partials/progress-bar.d.ts +3 -1
- package/lib/typescript/picker/partials/progress-bar.d.ts.map +1 -0
- package/lib/typescript/picker/picker.d.ts +10 -9
- package/lib/typescript/picker/picker.d.ts.map +1 -0
- package/lib/typescript/picker/styles/pick-amount-styles.d.ts +1 -0
- package/lib/typescript/picker/styles/pick-amount-styles.d.ts.map +1 -0
- package/lib/typescript/picker/styles/pick-modal-styles.d.ts +4 -3
- package/lib/typescript/picker/styles/pick-modal-styles.d.ts.map +1 -0
- package/lib/typescript/picker/styles/picker-styles.d.ts +1 -0
- package/lib/typescript/picker/styles/picker-styles.d.ts.map +1 -0
- package/lib/typescript/picker/styles/product-info-styles.d.ts +1 -0
- package/lib/typescript/picker/styles/product-info-styles.d.ts.map +1 -0
- package/lib/typescript/picker/styles/progress-bar-styles.d.ts +1 -0
- package/lib/typescript/picker/styles/progress-bar-styles.d.ts.map +1 -0
- package/lib/typescript/shared/api/api-urls.d.ts +8 -7
- package/lib/typescript/shared/api/api-urls.d.ts.map +1 -0
- package/lib/typescript/shared/badge/badge.d.ts +4 -3
- package/lib/typescript/shared/badge/badge.d.ts.map +1 -0
- package/lib/typescript/shared/badge/styles/badge-styles.d.ts +1 -0
- package/lib/typescript/shared/badge/styles/badge-styles.d.ts.map +1 -0
- package/lib/typescript/shared/constants.d.ts +1 -0
- package/lib/typescript/shared/constants.d.ts.map +1 -0
- package/lib/typescript/shared/default-pick-group-item.d.ts +2 -1
- package/lib/typescript/shared/default-pick-group-item.d.ts.map +1 -0
- package/lib/typescript/shared/layout/data-column.d.ts +4 -2
- package/lib/typescript/shared/layout/data-column.d.ts.map +1 -0
- package/lib/typescript/shared/layout/data-format.d.ts +4 -2
- package/lib/typescript/shared/layout/data-format.d.ts.map +1 -0
- package/lib/typescript/shared/layout/data-row.d.ts +5 -3
- package/lib/typescript/shared/layout/data-row.d.ts.map +1 -0
- package/lib/typescript/shared/layout/styles/layout-styles.d.ts +3 -2
- package/lib/typescript/shared/layout/styles/layout-styles.d.ts.map +1 -0
- package/lib/typescript/shared/press-button/press-button.d.ts +3 -2
- package/lib/typescript/shared/press-button/press-button.d.ts.map +1 -0
- package/package.json +32 -42
- package/src/context/gatherer-context.tsx +7 -5
- package/src/context/scan-context.tsx +1 -1
- package/src/hooks/use-gatherer.tsx +2 -3
- package/src/hooks/use-pick-item-switch.tsx +2 -2
- package/src/lang/i18n.ts +0 -1
- package/src/pick-list/partials/empty-list.tsx +1 -1
- package/src/pick-list/partials/pick-group-item.tsx +1 -1
- package/src/pick-list/partials/search.tsx +1 -1
- package/src/pick-list/pick-list.tsx +2 -2
- package/src/picker/partials/modal/pick-modal.tsx +1 -1
- package/src/picker/partials/modal/pick-quantity-select.tsx +2 -3
- package/src/picker/partials/pick-amount.tsx +1 -1
- package/src/picker/partials/product-info.tsx +1 -1
- package/src/picker/partials/progress-bar.tsx +1 -1
- package/src/picker/picker.tsx +4 -4
- package/src/shared/badge/badge.tsx +2 -4
- package/src/shared/default-pick-group-item.ts +15 -13
- package/src/shared/layout/data-column.tsx +3 -3
- package/src/shared/layout/data-format.tsx +3 -3
- package/src/shared/layout/data-row.tsx +4 -4
- package/src/shared/press-button/press-button.tsx +1 -1
- package/src/types/config/config.d.ts +8 -6
- package/src/types/control/control.d.ts +1 -1
- package/lib/commonjs/context/gatherer-context.js +0 -89
- package/lib/commonjs/context/gatherer-context.js.map +0 -1
- package/lib/commonjs/context/scan-context.js +0 -18
- package/lib/commonjs/context/scan-context.js.map +0 -1
- package/lib/commonjs/hooks/use-gatherer.js +0 -13
- package/lib/commonjs/hooks/use-gatherer.js.map +0 -1
- package/lib/commonjs/hooks/use-pick-item-switch.js +0 -52
- package/lib/commonjs/hooks/use-pick-item-switch.js.map +0 -1
- package/lib/commonjs/hooks/use-scanner.js +0 -33
- package/lib/commonjs/hooks/use-scanner.js.map +0 -1
- package/lib/commonjs/index.js +0 -41
- package/lib/commonjs/index.js.map +0 -1
- package/lib/commonjs/lang/en/components/pick-list.js +0 -14
- package/lib/commonjs/lang/en/components/pick-list.js.map +0 -1
- package/lib/commonjs/lang/en/components/picker.js +0 -16
- package/lib/commonjs/lang/en/components/picker.js.map +0 -1
- package/lib/commonjs/lang/en/english.js +0 -16
- package/lib/commonjs/lang/en/english.js.map +0 -1
- package/lib/commonjs/lang/i18n.js +0 -27
- package/lib/commonjs/lang/i18n.js.map +0 -1
- package/lib/commonjs/lang/nl/components/pick-list.js +0 -14
- package/lib/commonjs/lang/nl/components/pick-list.js.map +0 -1
- package/lib/commonjs/lang/nl/components/picker.js +0 -16
- package/lib/commonjs/lang/nl/components/picker.js.map +0 -1
- package/lib/commonjs/lang/nl/dutch.js +0 -16
- package/lib/commonjs/lang/nl/dutch.js.map +0 -1
- package/lib/commonjs/pick-list/partials/empty-list.js +0 -23
- package/lib/commonjs/pick-list/partials/empty-list.js.map +0 -1
- package/lib/commonjs/pick-list/partials/pick-group-item.js +0 -50
- package/lib/commonjs/pick-list/partials/pick-group-item.js.map +0 -1
- package/lib/commonjs/pick-list/partials/search.js +0 -64
- package/lib/commonjs/pick-list/partials/search.js.map +0 -1
- package/lib/commonjs/pick-list/pick-list.js +0 -86
- package/lib/commonjs/pick-list/pick-list.js.map +0 -1
- package/lib/commonjs/pick-list/styles/empty-list-styles.js +0 -19
- package/lib/commonjs/pick-list/styles/empty-list-styles.js.map +0 -1
- package/lib/commonjs/pick-list/styles/pick-group-item-styles.js +0 -28
- package/lib/commonjs/pick-list/styles/pick-group-item-styles.js.map +0 -1
- package/lib/commonjs/pick-list/styles/search-styles.js +0 -34
- package/lib/commonjs/pick-list/styles/search-styles.js.map +0 -1
- package/lib/commonjs/picker/partials/modal/pick-modal.js +0 -47
- package/lib/commonjs/picker/partials/modal/pick-modal.js.map +0 -1
- package/lib/commonjs/picker/partials/modal/pick-quantity-select.js +0 -136
- package/lib/commonjs/picker/partials/modal/pick-quantity-select.js.map +0 -1
- package/lib/commonjs/picker/partials/pick-amount.js +0 -40
- package/lib/commonjs/picker/partials/pick-amount.js.map +0 -1
- package/lib/commonjs/picker/partials/product-info.js +0 -46
- package/lib/commonjs/picker/partials/product-info.js.map +0 -1
- package/lib/commonjs/picker/partials/progress-bar.js +0 -42
- package/lib/commonjs/picker/partials/progress-bar.js.map +0 -1
- package/lib/commonjs/picker/picker.js +0 -95
- package/lib/commonjs/picker/picker.js.map +0 -1
- package/lib/commonjs/picker/styles/pick-amount-styles.js +0 -30
- package/lib/commonjs/picker/styles/pick-amount-styles.js.map +0 -1
- package/lib/commonjs/picker/styles/pick-modal-styles.js +0 -86
- package/lib/commonjs/picker/styles/pick-modal-styles.js.map +0 -1
- package/lib/commonjs/picker/styles/picker-styles.js +0 -14
- package/lib/commonjs/picker/styles/picker-styles.js.map +0 -1
- package/lib/commonjs/picker/styles/product-info-styles.js +0 -30
- package/lib/commonjs/picker/styles/product-info-styles.js.map +0 -1
- package/lib/commonjs/picker/styles/progress-bar-styles.js +0 -18
- package/lib/commonjs/picker/styles/progress-bar-styles.js.map +0 -1
- package/lib/commonjs/shared/api/api-urls.js +0 -22
- package/lib/commonjs/shared/api/api-urls.js.map +0 -1
- package/lib/commonjs/shared/badge/badge.js +0 -44
- package/lib/commonjs/shared/badge/badge.js.map +0 -1
- package/lib/commonjs/shared/badge/styles/badge-styles.js +0 -24
- package/lib/commonjs/shared/badge/styles/badge-styles.js.map +0 -1
- package/lib/commonjs/shared/constants.js +0 -37
- package/lib/commonjs/shared/constants.js.map +0 -1
- package/lib/commonjs/shared/default-pick-group-item.js +0 -22
- package/lib/commonjs/shared/default-pick-group-item.js.map +0 -1
- package/lib/commonjs/shared/layout/data-column.js +0 -26
- package/lib/commonjs/shared/layout/data-column.js.map +0 -1
- package/lib/commonjs/shared/layout/data-format.js +0 -27
- package/lib/commonjs/shared/layout/data-format.js.map +0 -1
- package/lib/commonjs/shared/layout/data-row.js +0 -36
- package/lib/commonjs/shared/layout/data-row.js.map +0 -1
- package/lib/commonjs/shared/layout/styles/layout-styles.js +0 -29
- package/lib/commonjs/shared/layout/styles/layout-styles.js.map +0 -1
- package/lib/commonjs/shared/press-button/press-button.js +0 -34
- package/lib/commonjs/shared/press-button/press-button.js.map +0 -1
- package/lib/commonjs/types/badge/badge.d.js +0 -2
- package/lib/commonjs/types/badge/badge.d.js.map +0 -1
- package/lib/commonjs/types/config/config.d.js +0 -2
- package/lib/commonjs/types/config/config.d.js.map +0 -1
- package/lib/commonjs/types/control/control.d.js +0 -2
- package/lib/commonjs/types/control/control.d.js.map +0 -1
- package/lib/commonjs/types/pick-group/pick-group.d.js +0 -2
- package/lib/commonjs/types/pick-group/pick-group.d.js.map +0 -1
- package/lib/commonjs/types/pick-group/search-params.d.js +0 -2
- package/lib/commonjs/types/pick-group/search-params.d.js.map +0 -1
- package/lib/commonjs/types/pick-item/pick-item.d.js +0 -2
- package/lib/commonjs/types/pick-item/pick-item.d.js.map +0 -1
- package/lib/commonjs/types/scanner/scanner.d.js +0 -2
- package/lib/commonjs/types/scanner/scanner.d.js.map +0 -1
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { ReactNode } from 'react';
|
|
1
|
+
import React, { ReactNode } from 'react';
|
|
2
2
|
import { PressableProps, ViewStyle } from 'react-native';
|
|
3
3
|
interface props extends PressableProps {
|
|
4
4
|
children: ReactNode;
|
|
5
5
|
style: ViewStyle;
|
|
6
6
|
}
|
|
7
|
-
export declare const PressButton: (props: props) => JSX.Element;
|
|
7
|
+
export declare const PressButton: (props: props) => React.JSX.Element;
|
|
8
8
|
export {};
|
|
9
|
+
//# sourceMappingURL=press-button.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"press-button.d.ts","sourceRoot":"","sources":["../../../../src/shared/press-button/press-button.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAC,SAAS,EAAW,MAAM,OAAO,CAAC;AACjD,OAAO,EAAY,cAAc,EAAE,SAAS,EAAC,MAAM,cAAc,CAAC;AAIlE,UAAU,KAAM,SAAQ,cAAc;IAClC,QAAQ,EAAE,SAAS,CAAC;IACpB,KAAK,EAAE,SAAS,CAAC;CACpB;AAED,eAAO,MAAM,WAAW,GAAI,OAAO,KAAK,sBAmBvC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@scrumble-nl/gatherer-frontend",
|
|
3
|
-
"version": "1.
|
|
4
|
-
"main": "lib/
|
|
5
|
-
"
|
|
6
|
-
"types": "lib/typescript/index.d.ts",
|
|
3
|
+
"version": "1.4.0-beta.1",
|
|
4
|
+
"main": "./lib/module/index.js",
|
|
5
|
+
"types": "./lib/typescript/index.d.ts",
|
|
7
6
|
"react-native": "src/index",
|
|
8
7
|
"source": "src/index",
|
|
9
8
|
"files": [
|
|
@@ -46,49 +45,41 @@
|
|
|
46
45
|
"registry": "https://registry.npmjs.org/"
|
|
47
46
|
},
|
|
48
47
|
"dependencies": {
|
|
49
|
-
"axios": "^
|
|
50
|
-
"i18next": "^
|
|
51
|
-
"react-i18next": "^
|
|
52
|
-
"react-native-progress": "^5.0.
|
|
48
|
+
"axios": "^1.10.0",
|
|
49
|
+
"i18next": "^25.3.0",
|
|
50
|
+
"react-i18next": "^15.5.3",
|
|
51
|
+
"react-native-progress": "^5.0.1"
|
|
53
52
|
},
|
|
54
53
|
"devDependencies": {
|
|
55
|
-
"@
|
|
56
|
-
"@
|
|
57
|
-
"@
|
|
58
|
-
"@
|
|
59
|
-
"@
|
|
60
|
-
"@
|
|
61
|
-
"@
|
|
62
|
-
"@
|
|
63
|
-
"@types/react
|
|
64
|
-
"@types/react-native-vector-icons": "^6.4.
|
|
65
|
-
"commitlint": "^
|
|
66
|
-
"eslint": "^
|
|
67
|
-
"eslint-config-prettier": "^
|
|
68
|
-
"eslint-plugin-prettier": "^
|
|
69
|
-
"
|
|
70
|
-
"
|
|
71
|
-
"
|
|
72
|
-
"
|
|
73
|
-
"react
|
|
74
|
-
"react-native
|
|
75
|
-
"
|
|
76
|
-
"
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
"@types/react": "17.0.21"
|
|
54
|
+
"@babel/eslint-parser": "^7.28.0",
|
|
55
|
+
"@commitlint/config-conventional": "^19.8.1",
|
|
56
|
+
"@eslint/compat": "^1.2.9",
|
|
57
|
+
"@eslint/js": "^9.26.0",
|
|
58
|
+
"@typescript-eslint/eslint-plugin": "^8.32.1",
|
|
59
|
+
"@typescript-eslint/parser": "^8.32.1",
|
|
60
|
+
"@release-it/conventional-changelog": "^10.0.1",
|
|
61
|
+
"@scrumble-nl/eslint-plugin-scrumble-rules": "^2.1.3",
|
|
62
|
+
"@types/react": "19.1.8",
|
|
63
|
+
"@types/react-native-vector-icons": "^6.4.18",
|
|
64
|
+
"commitlint": "^19.8.1",
|
|
65
|
+
"eslint": "^9.30.1",
|
|
66
|
+
"eslint-config-prettier": "^10.1.5",
|
|
67
|
+
"eslint-plugin-prettier": "^5.5.1",
|
|
68
|
+
"eslint-plugin-react": "^7.37.5",
|
|
69
|
+
"eslint-plugin-react-hooks": "^5.2.0",
|
|
70
|
+
"pod-install": "^0.3.9",
|
|
71
|
+
"prettier": "^3.6.2",
|
|
72
|
+
"react": "19.1.0",
|
|
73
|
+
"react-native": "^0.80.1",
|
|
74
|
+
"react-native-builder-bob": "^0.40.12",
|
|
75
|
+
"release-it": "^19.0.3",
|
|
76
|
+
"typescript": "^5.8.3",
|
|
77
|
+
"typescript-eslint": "^8.32.1"
|
|
80
78
|
},
|
|
81
79
|
"peerDependencies": {
|
|
82
80
|
"react": "*",
|
|
83
81
|
"react-native": "*"
|
|
84
82
|
},
|
|
85
|
-
"jest": {
|
|
86
|
-
"preset": "react-native",
|
|
87
|
-
"modulePathIgnorePatterns": [
|
|
88
|
-
"<rootDir>/example/node_modules",
|
|
89
|
-
"<rootDir>/lib/"
|
|
90
|
-
]
|
|
91
|
-
},
|
|
92
83
|
"commitlint": {
|
|
93
84
|
"extends": [
|
|
94
85
|
"@commitlint/config-conventional"
|
|
@@ -119,8 +110,7 @@
|
|
|
119
110
|
"source": "src",
|
|
120
111
|
"output": "lib",
|
|
121
112
|
"targets": [
|
|
122
|
-
"
|
|
123
|
-
"module",
|
|
113
|
+
["module", {"esm": true}],
|
|
124
114
|
[
|
|
125
115
|
"typescript",
|
|
126
116
|
{
|
|
@@ -16,6 +16,7 @@ export interface IGathererContext<T extends DefaultPickItem> {
|
|
|
16
16
|
startPicking: (pickGroupId: number) => Promise<PickItem<T>>;
|
|
17
17
|
switchPickItem: (dir: ControlDir) => Promise<PickItem<T>>;
|
|
18
18
|
parseEan?: (ean: string) => Record<string, string> & {barcode: string};
|
|
19
|
+
scanImplementation: ScanImplementation;
|
|
19
20
|
}
|
|
20
21
|
|
|
21
22
|
interface props {
|
|
@@ -23,11 +24,12 @@ interface props {
|
|
|
23
24
|
config: GathererConfig;
|
|
24
25
|
}
|
|
25
26
|
|
|
27
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
26
28
|
export const GathererContext = createContext<IGathererContext<any>>({} as IGathererContext<any>);
|
|
27
29
|
|
|
28
|
-
export const GathererContextProvider = <T extends DefaultPickItem>(
|
|
29
|
-
const {scanImplementation, instance, onLastPick, language, parseEan} =
|
|
30
|
-
const [pickItem, setPickItem] = useState<PickItem<T>>(defaultPickGroupItem);
|
|
30
|
+
export const GathererContextProvider = <T extends DefaultPickItem>({children, config}: props) => {
|
|
31
|
+
const {scanImplementation, instance, onLastPick, language, parseEan} = config;
|
|
32
|
+
const [pickItem, setPickItem] = useState<PickItem<T>>(() => defaultPickGroupItem<T>());
|
|
31
33
|
const currentPickGroupId = useRef<number>(0);
|
|
32
34
|
|
|
33
35
|
useEffect(() => {
|
|
@@ -93,7 +95,7 @@ export const GathererContextProvider = <T extends DefaultPickItem>(props: props)
|
|
|
93
95
|
}, [language]);
|
|
94
96
|
|
|
95
97
|
const context = useMemo(
|
|
96
|
-
() => ({
|
|
98
|
+
(): IGathererContext<T> => ({
|
|
97
99
|
pickItem,
|
|
98
100
|
instance,
|
|
99
101
|
onLastPick,
|
|
@@ -109,7 +111,7 @@ export const GathererContextProvider = <T extends DefaultPickItem>(props: props)
|
|
|
109
111
|
|
|
110
112
|
return (
|
|
111
113
|
<GathererContext.Provider value={context}>
|
|
112
|
-
<ScanContextProvider scanner={
|
|
114
|
+
<ScanContextProvider scanner={config.scanImplementation}>{children}</ScanContextProvider>
|
|
113
115
|
</GathererContext.Provider>
|
|
114
116
|
);
|
|
115
117
|
};
|
|
@@ -19,6 +19,6 @@ interface props {
|
|
|
19
19
|
|
|
20
20
|
export const ScanContext = createContext<IScanContext>({} as IScanContext);
|
|
21
21
|
|
|
22
|
-
export const ScanContextProvider = (props: props)
|
|
22
|
+
export const ScanContextProvider = (props: props) => {
|
|
23
23
|
return <ScanContext.Provider value={props.scanner}>{props.children}</ScanContext.Provider>;
|
|
24
24
|
};
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import {useContext} from 'react';
|
|
2
2
|
|
|
3
|
-
import {GathererContext} from '../context/gatherer-context';
|
|
4
|
-
import type {IGathererContext} from '../context/gatherer-context';
|
|
3
|
+
import {GathererContext, IGathererContext} from '../context/gatherer-context';
|
|
5
4
|
|
|
6
|
-
export const useGatherer = <T extends DefaultPickItem
|
|
5
|
+
export const useGatherer = <T extends DefaultPickItem>() => {
|
|
7
6
|
return useContext<IGathererContext<T>>(GathererContext);
|
|
8
7
|
};
|
|
@@ -11,7 +11,7 @@ export const usePickItemSwitch = (): ProductSwitch => {
|
|
|
11
11
|
}, [switchPickItem]);
|
|
12
12
|
|
|
13
13
|
const setItemToPicked = useCallback(
|
|
14
|
-
(quantityPicked?: number, metaData?:
|
|
14
|
+
(quantityPicked?: number, metaData?: object): void => {
|
|
15
15
|
instance
|
|
16
16
|
.patch(SET_ITEM_PICKED_URL, {
|
|
17
17
|
quantity_picked: quantityPicked,
|
|
@@ -31,7 +31,7 @@ export const usePickItemSwitch = (): ProductSwitch => {
|
|
|
31
31
|
);
|
|
32
32
|
|
|
33
33
|
const nextPickItem = useCallback(
|
|
34
|
-
(isSkip: boolean, quantityPicked?: number, metaData?:
|
|
34
|
+
(isSkip: boolean, quantityPicked?: number, metaData?: object): void => {
|
|
35
35
|
if (isSkip) {
|
|
36
36
|
retrieveNextPickItem();
|
|
37
37
|
return;
|
package/src/lang/i18n.ts
CHANGED
|
@@ -15,7 +15,7 @@ export interface props<T> {
|
|
|
15
15
|
|
|
16
16
|
const {listItem, label, text} = styles;
|
|
17
17
|
|
|
18
|
-
export const PickGroupItem = <T extends PickGroup>(props: props<T>)
|
|
18
|
+
export const PickGroupItem = <T extends PickGroup>(props: props<T>) => {
|
|
19
19
|
const {t} = useTranslation();
|
|
20
20
|
const {startPicking} = useGatherer();
|
|
21
21
|
const {id, is_picked} = props.renderProps.item;
|
|
@@ -12,7 +12,7 @@ interface props {
|
|
|
12
12
|
|
|
13
13
|
const {container, searchColumn, search, iconColumn} = styles;
|
|
14
14
|
|
|
15
|
-
export const Search = (props: props)
|
|
15
|
+
export const Search = (props: props) => {
|
|
16
16
|
const textInputRef = useRef<TextInput>(null);
|
|
17
17
|
const [searchTerm, setSearchTerm] = useState<string>('');
|
|
18
18
|
const {onSearch} = props;
|
|
@@ -16,7 +16,7 @@ interface props<T> {
|
|
|
16
16
|
onItemPress?: (pickGroup: T) => void;
|
|
17
17
|
}
|
|
18
18
|
|
|
19
|
-
export const PickList = <T extends PickGroup>(props: props<T>)
|
|
19
|
+
export const PickList = <T extends PickGroup>(props: props<T>) => {
|
|
20
20
|
const {renderItem, onItemPress, isAfterPickList, shouldRefresh} = props;
|
|
21
21
|
const [loading, setLoading] = useState<boolean>(true);
|
|
22
22
|
const [pickList, setPickList] = useState<T[]>([]);
|
|
@@ -73,7 +73,7 @@ export const PickList = <T extends PickGroup>(props: props<T>): JSX.Element => {
|
|
|
73
73
|
};
|
|
74
74
|
}, [getPickList, instance, shouldRefresh]);
|
|
75
75
|
|
|
76
|
-
const renderPickGroupItem = (renderProps: ListRenderItemInfo<T>)
|
|
76
|
+
const renderPickGroupItem = (renderProps: ListRenderItemInfo<T>) => {
|
|
77
77
|
return <PickGroupItem onPress={onItemPress} renderProps={renderProps} />;
|
|
78
78
|
};
|
|
79
79
|
|
|
@@ -14,7 +14,7 @@ interface props {
|
|
|
14
14
|
|
|
15
15
|
const {background, container, innerContainer, title} = styles;
|
|
16
16
|
|
|
17
|
-
export const PickModal = (props: props)
|
|
17
|
+
export const PickModal = (props: props) => {
|
|
18
18
|
const {t} = useTranslation();
|
|
19
19
|
const {visible, closeModal, onPickItems} = props;
|
|
20
20
|
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import React, {useCallback, useEffect, useState} from 'react';
|
|
2
2
|
import {TouchableHighlight, View, Text, Pressable} from 'react-native';
|
|
3
3
|
|
|
4
|
-
import type {TFuncReturn} from 'i18next';
|
|
5
4
|
import {useTranslation} from 'react-i18next';
|
|
6
5
|
import Icon from 'react-native-vector-icons/Ionicons';
|
|
7
6
|
|
|
@@ -27,10 +26,10 @@ const {
|
|
|
27
26
|
pickButtonText,
|
|
28
27
|
} = styles;
|
|
29
28
|
|
|
30
|
-
export const PickQuantitySelect = (props: props)
|
|
29
|
+
export const PickQuantitySelect = (props: props) => {
|
|
31
30
|
const {onPickItems, visible} = props;
|
|
32
31
|
const [selectedQuantity, setSelectedQuantity] = useState<number>(1);
|
|
33
|
-
const [error, setError] = useState
|
|
32
|
+
const [error, setError] = useState('');
|
|
34
33
|
const {pickItem, parseEan} = useGatherer();
|
|
35
34
|
const {t} = useTranslation();
|
|
36
35
|
const quantityToPick = pickItem.quantity;
|
|
@@ -11,7 +11,7 @@ export interface pickAmountProps {
|
|
|
11
11
|
backgroundColor?: string;
|
|
12
12
|
}
|
|
13
13
|
|
|
14
|
-
export const PickAmount = (props: pickAmountProps)
|
|
14
|
+
export const PickAmount = (props: pickAmountProps) => {
|
|
15
15
|
const {pickItem} = useGatherer();
|
|
16
16
|
const {backgroundColor} = props;
|
|
17
17
|
const backgroundStyle = {backgroundColor: backgroundColor ?? PRIMARY_COLOR};
|
|
@@ -16,7 +16,7 @@ export interface productInfoProps {
|
|
|
16
16
|
children?: ReactNode;
|
|
17
17
|
}
|
|
18
18
|
|
|
19
|
-
export const ProductInfo = (props: productInfoProps)
|
|
19
|
+
export const ProductInfo = (props: productInfoProps) => {
|
|
20
20
|
const {pickItem} = useGatherer();
|
|
21
21
|
const {t} = useTranslation();
|
|
22
22
|
const {name, quantity, barcode, children} = props;
|
|
@@ -17,7 +17,7 @@ export interface progressProps {
|
|
|
17
17
|
|
|
18
18
|
const {progressText} = styles;
|
|
19
19
|
|
|
20
|
-
export const ProgressBar = (props: progressProps)
|
|
20
|
+
export const ProgressBar = (props: progressProps) => {
|
|
21
21
|
const {pickItem} = useGatherer();
|
|
22
22
|
const totalProducts = (props.total || pickItem.totalPickItems) ?? 1;
|
|
23
23
|
const current = ((props.current || pickItem.pickItemIndex) ?? 0) + 1;
|
package/src/picker/picker.tsx
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, {ReactNode, useCallback, useEffect, useRef, useState} from 'react';
|
|
1
|
+
import React, {ReactNode, useCallback, useEffect, useRef, useState, ReactElement} from 'react';
|
|
2
2
|
import {View, ViewStyle} from 'react-native';
|
|
3
3
|
|
|
4
4
|
import {styles} from './styles/picker-styles';
|
|
@@ -15,15 +15,15 @@ import {DataColumn as Column} from '../shared/layout/data-column';
|
|
|
15
15
|
interface props {
|
|
16
16
|
children: ReactNode;
|
|
17
17
|
style?: ViewStyle;
|
|
18
|
-
pickModal?:
|
|
18
|
+
pickModal?: ReactElement;
|
|
19
19
|
onMultiQuantityPick?: () => void;
|
|
20
20
|
shouldLesserPick?: boolean;
|
|
21
|
-
onScan?: (scan: string) => Promise<
|
|
21
|
+
onScan?: (scan: string) => Promise<object>;
|
|
22
22
|
}
|
|
23
23
|
|
|
24
24
|
const {container} = styles;
|
|
25
25
|
|
|
26
|
-
const Picker = (props: props)
|
|
26
|
+
const Picker = (props: props) => {
|
|
27
27
|
const {children, style, onMultiQuantityPick, onScan} = props;
|
|
28
28
|
const {pickItem, parseEan} = useGatherer();
|
|
29
29
|
const [pickModalVisible, setPickModalVisible] = useState<boolean>(false);
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import {Text, View} from 'react-native';
|
|
3
3
|
|
|
4
|
-
import type {DefaultTFuncReturn} from 'i18next';
|
|
5
|
-
|
|
6
4
|
import {styles} from './styles/badge-styles';
|
|
7
5
|
import {
|
|
8
6
|
DANGER_COLOR,
|
|
@@ -16,7 +14,7 @@ import {
|
|
|
16
14
|
|
|
17
15
|
interface props {
|
|
18
16
|
variant: BadgeVariant;
|
|
19
|
-
children:
|
|
17
|
+
children: string;
|
|
20
18
|
}
|
|
21
19
|
|
|
22
20
|
const backgroundMap: Record<BadgeVariant, string> = {
|
|
@@ -35,7 +33,7 @@ const colorMap: Record<BadgeVariant, string> = {
|
|
|
35
33
|
};
|
|
36
34
|
const {badge, text} = styles;
|
|
37
35
|
|
|
38
|
-
export const Badge = (props: props)
|
|
36
|
+
export const Badge = (props: props) => {
|
|
39
37
|
const background = {backgroundColor: backgroundMap[props.variant ?? 'primary']};
|
|
40
38
|
const color = {color: colorMap[props.variant ?? 'primary']};
|
|
41
39
|
|
|
@@ -1,14 +1,16 @@
|
|
|
1
|
-
export const defaultPickGroupItem: PickItem<
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
1
|
+
export const defaultPickGroupItem = <T extends DefaultPickItem>(): PickItem<T> => {
|
|
2
|
+
return {
|
|
3
|
+
pickItem: {
|
|
4
|
+
id: 0,
|
|
5
|
+
ean: '',
|
|
6
|
+
name: '',
|
|
7
|
+
} as T,
|
|
8
|
+
quantity: 0,
|
|
9
|
+
quantityPicked: 0,
|
|
10
|
+
barcode: '',
|
|
11
|
+
pickItemIndex: 0,
|
|
12
|
+
totalPickItems: 0,
|
|
13
|
+
previous: null,
|
|
14
|
+
next: null,
|
|
15
|
+
};
|
|
14
16
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import React, {ReactElement} from 'react';
|
|
2
2
|
import {View, ViewStyle, Text} from 'react-native';
|
|
3
3
|
|
|
4
4
|
import {DataFormat} from './data-format';
|
|
@@ -6,13 +6,13 @@ import {styles} from './styles/layout-styles';
|
|
|
6
6
|
|
|
7
7
|
export interface columnProps {
|
|
8
8
|
title: string;
|
|
9
|
-
data:
|
|
9
|
+
data: ReactElement | string | number;
|
|
10
10
|
columnStyles?: ViewStyle;
|
|
11
11
|
}
|
|
12
12
|
|
|
13
13
|
const {dataColumn, dataTitle} = styles;
|
|
14
14
|
|
|
15
|
-
export const DataColumn = (props: columnProps)
|
|
15
|
+
export const DataColumn = (props: columnProps) => {
|
|
16
16
|
return (
|
|
17
17
|
<View style={[dataColumn, props.columnStyles ?? {}]}>
|
|
18
18
|
<Text style={dataTitle}>{props.title}</Text>
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import React, {ReactElement} from 'react';
|
|
2
2
|
import {Text} from 'react-native';
|
|
3
3
|
|
|
4
4
|
import {styles} from './styles/layout-styles';
|
|
5
5
|
|
|
6
6
|
interface props {
|
|
7
|
-
data:
|
|
7
|
+
data: ReactElement | string | number;
|
|
8
8
|
}
|
|
9
9
|
|
|
10
10
|
const {dataText} = styles;
|
|
11
11
|
|
|
12
|
-
export const DataFormat = (props: props)
|
|
12
|
+
export const DataFormat = (props: props) => {
|
|
13
13
|
const {data} = props;
|
|
14
14
|
|
|
15
15
|
if (typeof data === 'string' || typeof data === 'number') {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import React, {ReactElement} from 'react';
|
|
2
2
|
import {View, ViewStyle} from 'react-native';
|
|
3
3
|
|
|
4
4
|
import {DataColumn} from './data-column';
|
|
@@ -6,16 +6,16 @@ import {styles} from './styles/layout-styles';
|
|
|
6
6
|
|
|
7
7
|
export interface rowProps {
|
|
8
8
|
leftTitle: string;
|
|
9
|
-
leftContent:
|
|
9
|
+
leftContent: ReactElement | string | number;
|
|
10
10
|
rightTitle?: string | null;
|
|
11
|
-
rightContent?:
|
|
11
|
+
rightContent?: ReactElement | string | number;
|
|
12
12
|
rowStyles?: ViewStyle;
|
|
13
13
|
columnStyles?: ViewStyle;
|
|
14
14
|
}
|
|
15
15
|
|
|
16
16
|
const {dataRow} = styles;
|
|
17
17
|
|
|
18
|
-
export const DataRow = (props: rowProps)
|
|
18
|
+
export const DataRow = (props: rowProps) => {
|
|
19
19
|
const {leftTitle, leftContent, rightTitle, rightContent, rowStyles, columnStyles} = props;
|
|
20
20
|
|
|
21
21
|
return (
|
|
@@ -8,7 +8,7 @@ interface props extends PressableProps {
|
|
|
8
8
|
style: ViewStyle;
|
|
9
9
|
}
|
|
10
10
|
|
|
11
|
-
export const PressButton = (props: props)
|
|
11
|
+
export const PressButton = (props: props) => {
|
|
12
12
|
const [buttonPressed, setButtonPressed] = useState<boolean>(false);
|
|
13
13
|
const buttonBackground: ViewStyle = {backgroundColor: buttonPressed ? NEAR_WHITE : WHITE};
|
|
14
14
|
|
|
@@ -1,11 +1,6 @@
|
|
|
1
1
|
type GathererConfig = {
|
|
2
2
|
instance: import('../../../node_modules/axios').AxiosInstance;
|
|
3
|
-
scanImplementation:
|
|
4
|
-
registerListener: (event: ScanEvent) => void;
|
|
5
|
-
clearEventListeners: () => void;
|
|
6
|
-
registerEventListener?: () => void;
|
|
7
|
-
onBarcodeReadFail?: (event: ScanEvent) => void;
|
|
8
|
-
};
|
|
3
|
+
scanImplementation: ScanImplementation;
|
|
9
4
|
onLastPick: () => void;
|
|
10
5
|
language?: LanguageConfig;
|
|
11
6
|
parseEan?: (ean: string) => Record<string, string> & {barcode: string};
|
|
@@ -14,3 +9,10 @@ type GathererConfig = {
|
|
|
14
9
|
type LanguageConfig = 'nl' | 'en';
|
|
15
10
|
|
|
16
11
|
type ScanEvent = (event: {data: string}) => void;
|
|
12
|
+
|
|
13
|
+
type ScanImplementation = {
|
|
14
|
+
registerListener: (event: ScanEvent) => void;
|
|
15
|
+
clearEventListeners: () => void;
|
|
16
|
+
registerEventListener?: () => void;
|
|
17
|
+
onBarcodeReadFail?: (event: ScanEvent) => void;
|
|
18
|
+
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
type ControlDir = 'prev' | 'next';
|
|
2
2
|
|
|
3
3
|
type ProductSwitch = {
|
|
4
|
-
nextPickItem: (isSkip: boolean, quantityPicked?: number, metaData?:
|
|
4
|
+
nextPickItem: (isSkip: boolean, quantityPicked?: number, metaData?: object) => void;
|
|
5
5
|
previousPickItem: () => void;
|
|
6
6
|
};
|
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.GathererContextProvider = exports.GathererContext = void 0;
|
|
7
|
-
var _react = _interopRequireWildcard(require("react"));
|
|
8
|
-
var _i18n = _interopRequireDefault(require("../lang/i18n"));
|
|
9
|
-
var _scanContext = require("./scan-context");
|
|
10
|
-
var _defaultPickGroupItem = require("../shared/default-pick-group-item");
|
|
11
|
-
var _apiUrls = require("../shared/api/api-urls");
|
|
12
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
13
|
-
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
14
|
-
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
15
|
-
const GathererContext = /*#__PURE__*/(0, _react.createContext)({});
|
|
16
|
-
exports.GathererContext = GathererContext;
|
|
17
|
-
const GathererContextProvider = props => {
|
|
18
|
-
const {
|
|
19
|
-
scanImplementation,
|
|
20
|
-
instance,
|
|
21
|
-
onLastPick,
|
|
22
|
-
language,
|
|
23
|
-
parseEan
|
|
24
|
-
} = props.config;
|
|
25
|
-
const [pickItem, setPickItem] = (0, _react.useState)(_defaultPickGroupItem.defaultPickGroupItem);
|
|
26
|
-
const currentPickGroupId = (0, _react.useRef)(0);
|
|
27
|
-
(0, _react.useEffect)(() => {
|
|
28
|
-
var _scanImplementation$r;
|
|
29
|
-
(_scanImplementation$r = scanImplementation.registerEventListener) === null || _scanImplementation$r === void 0 ? void 0 : _scanImplementation$r.call(scanImplementation);
|
|
30
|
-
}, [scanImplementation]);
|
|
31
|
-
const savePickGroupData = (0, _react.useCallback)(data => {
|
|
32
|
-
setPickItem(data);
|
|
33
|
-
}, []);
|
|
34
|
-
const startPicking = (0, _react.useCallback)(async pickGroupId => {
|
|
35
|
-
return new Promise((resolve, reject) => {
|
|
36
|
-
instance.post(_apiUrls.START_PICKING_URL, {
|
|
37
|
-
pick_group_id: pickGroupId
|
|
38
|
-
}).then(response => {
|
|
39
|
-
currentPickGroupId.current = pickGroupId;
|
|
40
|
-
savePickGroupData(response.data);
|
|
41
|
-
resolve(response.data);
|
|
42
|
-
}).catch(reject);
|
|
43
|
-
});
|
|
44
|
-
}, [instance, savePickGroupData]);
|
|
45
|
-
const switchPickItem = (0, _react.useCallback)(async dir => {
|
|
46
|
-
const url = dir === 'prev' ? _apiUrls.PREV_PICK_ITEM_URL : _apiUrls.NEXT_PICK_ITEM_URL;
|
|
47
|
-
setPickItem(prevState => {
|
|
48
|
-
if (dir === 'prev' && prevState.previous) {
|
|
49
|
-
return prevState.previous;
|
|
50
|
-
}
|
|
51
|
-
if (dir === 'next' && prevState.next) {
|
|
52
|
-
return prevState.next;
|
|
53
|
-
}
|
|
54
|
-
return prevState;
|
|
55
|
-
});
|
|
56
|
-
return new Promise((resolve, reject) => {
|
|
57
|
-
instance.post(url, {
|
|
58
|
-
pick_group_id: currentPickGroupId.current,
|
|
59
|
-
pick_item_id: pickItem.pickItem.id
|
|
60
|
-
}).then(response => {
|
|
61
|
-
setPickItem(response.data);
|
|
62
|
-
resolve(response.data);
|
|
63
|
-
}).catch(reject);
|
|
64
|
-
});
|
|
65
|
-
}, [instance, pickItem.pickItem.id]);
|
|
66
|
-
(0, _react.useEffect)(() => {
|
|
67
|
-
if (language) {
|
|
68
|
-
_i18n.default.changeLanguage(language);
|
|
69
|
-
}
|
|
70
|
-
}, [language]);
|
|
71
|
-
const context = (0, _react.useMemo)(() => ({
|
|
72
|
-
pickItem,
|
|
73
|
-
instance,
|
|
74
|
-
onLastPick,
|
|
75
|
-
startPicking,
|
|
76
|
-
switchPickItem,
|
|
77
|
-
parseEan,
|
|
78
|
-
savePickGroupData,
|
|
79
|
-
scanImplementation,
|
|
80
|
-
currentPickGroupId: currentPickGroupId.current
|
|
81
|
-
}), [parseEan, instance, onLastPick, pickItem, savePickGroupData, scanImplementation, startPicking, switchPickItem]);
|
|
82
|
-
return /*#__PURE__*/_react.default.createElement(GathererContext.Provider, {
|
|
83
|
-
value: context
|
|
84
|
-
}, /*#__PURE__*/_react.default.createElement(_scanContext.ScanContextProvider, {
|
|
85
|
-
scanner: props.config.scanImplementation
|
|
86
|
-
}, props.children));
|
|
87
|
-
};
|
|
88
|
-
exports.GathererContextProvider = GathererContextProvider;
|
|
89
|
-
//# sourceMappingURL=gatherer-context.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["GathererContext","createContext","GathererContextProvider","props","scanImplementation","instance","onLastPick","language","parseEan","config","pickItem","setPickItem","useState","defaultPickGroupItem","currentPickGroupId","useRef","useEffect","registerEventListener","savePickGroupData","useCallback","data","startPicking","pickGroupId","Promise","resolve","reject","post","START_PICKING_URL","pick_group_id","then","response","current","catch","switchPickItem","dir","url","PREV_PICK_ITEM_URL","NEXT_PICK_ITEM_URL","prevState","previous","next","pick_item_id","id","i18n","changeLanguage","context","useMemo","children"],"sources":["gatherer-context.tsx"],"sourcesContent":["import React, {createContext, ReactNode, useCallback, useEffect, useMemo, useRef, useState} from 'react';\n\nimport type {AxiosInstance} from 'axios';\n\nimport i18n from '../lang/i18n';\nimport {ScanContextProvider} from './scan-context';\nimport {defaultPickGroupItem} from '../shared/default-pick-group-item';\nimport {NEXT_PICK_ITEM_URL, PREV_PICK_ITEM_URL, START_PICKING_URL} from '../shared/api/api-urls';\n\nexport interface IGathererContext<T extends DefaultPickItem> {\n pickItem: PickItem<T>;\n currentPickGroupId: number;\n onLastPick: () => void;\n instance: AxiosInstance;\n savePickGroupData: (data: PickItem<T>) => void;\n startPicking: (pickGroupId: number) => Promise<PickItem<T>>;\n switchPickItem: (dir: ControlDir) => Promise<PickItem<T>>;\n parseEan?: (ean: string) => Record<string, string> & {barcode: string};\n}\n\ninterface props {\n children: ReactNode;\n config: GathererConfig;\n}\n\nexport const GathererContext = createContext<IGathererContext<any>>({} as IGathererContext<any>);\n\nexport const GathererContextProvider = <T extends DefaultPickItem>(props: props): JSX.Element => {\n const {scanImplementation, instance, onLastPick, language, parseEan} = props.config;\n const [pickItem, setPickItem] = useState<PickItem<T>>(defaultPickGroupItem);\n const currentPickGroupId = useRef<number>(0);\n\n useEffect(() => {\n scanImplementation.registerEventListener?.();\n }, [scanImplementation]);\n\n const savePickGroupData = useCallback((data: PickItem<T>): void => {\n setPickItem(data);\n }, []);\n\n const startPicking = useCallback(\n async (pickGroupId: number): Promise<PickItem<T>> => {\n return new Promise((resolve, reject) => {\n instance\n .post(START_PICKING_URL, {pick_group_id: pickGroupId})\n .then(response => {\n currentPickGroupId.current = pickGroupId;\n savePickGroupData(response.data);\n resolve(response.data);\n })\n .catch(reject);\n });\n },\n [instance, savePickGroupData],\n );\n\n const switchPickItem = useCallback(\n async (dir: ControlDir): Promise<PickItem<T>> => {\n const url = dir === 'prev' ? PREV_PICK_ITEM_URL : NEXT_PICK_ITEM_URL;\n\n setPickItem(prevState => {\n if (dir === 'prev' && prevState.previous) {\n return prevState.previous;\n }\n\n if (dir === 'next' && prevState.next) {\n return prevState.next;\n }\n\n return prevState;\n });\n\n return new Promise((resolve, reject) => {\n instance\n .post(url, {\n pick_group_id: currentPickGroupId.current,\n pick_item_id: pickItem.pickItem.id,\n })\n .then(response => {\n setPickItem(response.data);\n resolve(response.data);\n })\n .catch(reject);\n });\n },\n [instance, pickItem.pickItem.id],\n );\n\n useEffect(() => {\n if (language) {\n i18n.changeLanguage(language);\n }\n }, [language]);\n\n const context = useMemo(\n () => ({\n pickItem,\n instance,\n onLastPick,\n startPicking,\n switchPickItem,\n parseEan,\n savePickGroupData,\n scanImplementation,\n currentPickGroupId: currentPickGroupId.current,\n }),\n [parseEan, instance, onLastPick, pickItem, savePickGroupData, scanImplementation, startPicking, switchPickItem],\n );\n\n return (\n <GathererContext.Provider value={context}>\n <ScanContextProvider scanner={props.config.scanImplementation}>{props.children}</ScanContextProvider>\n </GathererContext.Provider>\n );\n};\n"],"mappings":"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"}
|