@open-tender/store 0.1.301 → 0.1.303
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/dist/cjs/components/Keypad.js +12 -4
- package/dist/cjs/services/api.d.ts +16 -0
- package/dist/cjs/services/api.js +3 -0
- package/dist/cjs/slices/config.d.ts +16 -0
- package/dist/cjs/slices/config.js +10 -6
- package/dist/esm/components/Keypad.js +12 -4
- package/dist/esm/services/api.d.ts +16 -0
- package/dist/esm/services/api.js +3 -0
- package/dist/esm/slices/config.d.ts +16 -0
- package/dist/esm/slices/config.js +10 -6
- package/package.json +1 -1
|
@@ -9,11 +9,19 @@ var Keypad = function (_a) {
|
|
|
9
9
|
var _c = (0, hooks_1.useAppSelector)(slices_1.selectKioskConfig), keypad = _c.keypad, numpad = _c.numpad;
|
|
10
10
|
var isDollar = type === 'dollar';
|
|
11
11
|
var config = type === 'numeric' || isDollar ? numpad : keypad;
|
|
12
|
-
var _d = (0, react_1.useState)(
|
|
12
|
+
var _d = (0, react_1.useState)(autoCapitalize), isShiftOn = _d[0], setIsShiftOn = _d[1];
|
|
13
13
|
var handleOnKeyPress = (0, react_1.useCallback)(function (key) {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
14
|
+
var isShiftKey = key === '\u21E7';
|
|
15
|
+
if (isShiftKey) {
|
|
16
|
+
setIsShiftOn(function (prev) { return !prev; });
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
var newValue = (0, utils_1.getKeyboardValue)(key, value, maxLength, isShiftOn);
|
|
20
|
+
handlers.change(newValue);
|
|
21
|
+
if (autoCapitalize) {
|
|
22
|
+
setIsShiftOn(newValue.length === 0);
|
|
23
|
+
}
|
|
24
|
+
}, [handlers, value, maxLength, isShiftOn, autoCapitalize]);
|
|
17
25
|
var viewHandlers = (0, react_1.useMemo)(function () { return ({ keyPress: handleOnKeyPress }); }, [handleOnKeyPress]);
|
|
18
26
|
if (!config)
|
|
19
27
|
return null;
|
|
@@ -83,5 +83,21 @@ declare class PosAPI {
|
|
|
83
83
|
getAllergens(): Promise<Allergens>;
|
|
84
84
|
testPrint(): Promise<boolean>;
|
|
85
85
|
rateOrder(orderId: string, data: any): Promise<unknown>;
|
|
86
|
+
fetchPaymentConfigs(): Promise<{
|
|
87
|
+
integration: string;
|
|
88
|
+
is_testing: false;
|
|
89
|
+
merchant_api_key: string;
|
|
90
|
+
merchant_id: string;
|
|
91
|
+
merchant_password: string;
|
|
92
|
+
merchant_username: string;
|
|
93
|
+
offline_limit: string;
|
|
94
|
+
saved_cards: boolean;
|
|
95
|
+
signature_threshold: string | null;
|
|
96
|
+
freedompay_store_id: string;
|
|
97
|
+
card_stor_service_url: string;
|
|
98
|
+
client_selling_system: string;
|
|
99
|
+
client_selling_system_version: string;
|
|
100
|
+
freedompay_terminal_id: string;
|
|
101
|
+
}>;
|
|
86
102
|
}
|
|
87
103
|
export default PosAPI;
|
package/dist/cjs/services/api.js
CHANGED
|
@@ -384,6 +384,9 @@ var PosAPI = /** @class */ (function () {
|
|
|
384
384
|
PosAPI.prototype.rateOrder = function (orderId, data) {
|
|
385
385
|
return this.request("/orders/".concat(orderId, "/rating"), 'POST', data);
|
|
386
386
|
};
|
|
387
|
+
PosAPI.prototype.fetchPaymentConfigs = function () {
|
|
388
|
+
return this.request("/kiosk/payment-config");
|
|
389
|
+
};
|
|
387
390
|
return PosAPI;
|
|
388
391
|
}());
|
|
389
392
|
exports.default = PosAPI;
|
|
@@ -21,6 +21,22 @@ export interface ConfigState {
|
|
|
21
21
|
error: RequestError | null;
|
|
22
22
|
retries: number;
|
|
23
23
|
accessibilityOn?: boolean;
|
|
24
|
+
paymentConfigs: {
|
|
25
|
+
integration: string;
|
|
26
|
+
is_testing: boolean;
|
|
27
|
+
merchant_api_key: string;
|
|
28
|
+
merchant_id: string;
|
|
29
|
+
merchant_password: string;
|
|
30
|
+
merchant_username: string;
|
|
31
|
+
offline_limit: string;
|
|
32
|
+
saved_cards: boolean;
|
|
33
|
+
signature_threshold: string | null;
|
|
34
|
+
freedompay_store_id: string;
|
|
35
|
+
card_stor_service_url: string;
|
|
36
|
+
client_selling_system: string;
|
|
37
|
+
client_selling_system_version: string;
|
|
38
|
+
freedompay_terminal_id: string;
|
|
39
|
+
} | null;
|
|
24
40
|
}
|
|
25
41
|
export declare enum ConfigActionType {
|
|
26
42
|
FetchConfig = "config/getConfig"
|
|
@@ -28,14 +28,15 @@ var initialState = {
|
|
|
28
28
|
loading: 'idle',
|
|
29
29
|
error: null,
|
|
30
30
|
retries: 0,
|
|
31
|
-
accessibilityOn: false
|
|
31
|
+
accessibilityOn: false,
|
|
32
|
+
paymentConfigs: null
|
|
32
33
|
};
|
|
33
34
|
var ConfigActionType;
|
|
34
35
|
(function (ConfigActionType) {
|
|
35
36
|
ConfigActionType["FetchConfig"] = "config/getConfig";
|
|
36
37
|
})(ConfigActionType || (exports.ConfigActionType = ConfigActionType = {}));
|
|
37
38
|
exports.fetchConfig = (0, toolkit_1.createAsyncThunk)(ConfigActionType.FetchConfig, function (_a, _b) { return tslib_1.__awaiter(void 0, [_a, _b], void 0, function (_c, _d) {
|
|
38
|
-
var posTerminalId, kdsTerminalId, app, api, _e, _f, devicesList, _g, stores, _h, selectOptions, _j, itemTypes, _k, menuColors, store, devices, err, cashier, employee, tz, businessDate, err_1, err_2;
|
|
39
|
+
var posTerminalId, kdsTerminalId, app, api, _e, _f, devicesList, _g, stores, _h, selectOptions, _j, itemTypes, _k, menuColors, paymentConfigs, store, devices, err, cashier, employee, tz, businessDate, err_1, err_2;
|
|
39
40
|
var apiUrl = _c.apiUrl;
|
|
40
41
|
var dispatch = _d.dispatch, getState = _d.getState, rejectWithValue = _d.rejectWithValue;
|
|
41
42
|
return tslib_1.__generator(this, function (_l) {
|
|
@@ -57,10 +58,11 @@ exports.fetchConfig = (0, toolkit_1.createAsyncThunk)(ConfigActionType.FetchConf
|
|
|
57
58
|
// api.getSettings<SelectOptions>('SELECT_OPTION'),
|
|
58
59
|
api.getSelectOptions(),
|
|
59
60
|
api.getSettings('ITEM_TYPE'),
|
|
60
|
-
api.getSettings('ITEM_COLORS')
|
|
61
|
+
api.getSettings('ITEM_COLORS'),
|
|
62
|
+
api.fetchPaymentConfigs()
|
|
61
63
|
])];
|
|
62
64
|
case 1:
|
|
63
|
-
_e = _l.sent(), _f = _e[0], devicesList = _f === void 0 ? [] : _f, _g = _e[1], stores = _g === void 0 ? [] : _g, _h = _e[2], selectOptions = _h === void 0 ? [] : _h, _j = _e[3], itemTypes = _j === void 0 ? [] : _j, _k = _e[4], menuColors = _k === void 0 ? [] : _k;
|
|
65
|
+
_e = _l.sent(), _f = _e[0], devicesList = _f === void 0 ? [] : _f, _g = _e[1], stores = _g === void 0 ? [] : _g, _h = _e[2], selectOptions = _h === void 0 ? [] : _h, _j = _e[3], itemTypes = _j === void 0 ? [] : _j, _k = _e[4], menuColors = _k === void 0 ? [] : _k, paymentConfigs = _e[5];
|
|
64
66
|
store = stores[0] || null;
|
|
65
67
|
devices = devicesList[0] || null;
|
|
66
68
|
if (!store || !devices) {
|
|
@@ -102,7 +104,8 @@ exports.fetchConfig = (0, toolkit_1.createAsyncThunk)(ConfigActionType.FetchConf
|
|
|
102
104
|
hasCashDrawer: true,
|
|
103
105
|
error: null,
|
|
104
106
|
loading: 'idle',
|
|
105
|
-
retries: 0
|
|
107
|
+
retries: 0,
|
|
108
|
+
paymentConfigs: paymentConfigs
|
|
106
109
|
}];
|
|
107
110
|
case 6:
|
|
108
111
|
err_2 = _l.sent();
|
|
@@ -141,7 +144,7 @@ var configSlice = (0, toolkit_1.createSlice)({
|
|
|
141
144
|
state.loading = 'pending';
|
|
142
145
|
})
|
|
143
146
|
.addCase(exports.fetchConfig.fulfilled, function (state, action) {
|
|
144
|
-
var _a = action.payload, api = _a.api, app = _a.app, devices = _a.devices, store = _a.store, selectOptions = _a.selectOptions, menuColors = _a.menuColors, hasPinpad = _a.hasPinpad, hasCashDrawer = _a.hasCashDrawer;
|
|
147
|
+
var _a = action.payload, api = _a.api, app = _a.app, devices = _a.devices, store = _a.store, selectOptions = _a.selectOptions, menuColors = _a.menuColors, hasPinpad = _a.hasPinpad, hasCashDrawer = _a.hasCashDrawer, paymentConfigs = _a.paymentConfigs;
|
|
145
148
|
state.api = api;
|
|
146
149
|
state.app = app;
|
|
147
150
|
state.store = store;
|
|
@@ -153,6 +156,7 @@ var configSlice = (0, toolkit_1.createSlice)({
|
|
|
153
156
|
state.loading = 'idle';
|
|
154
157
|
state.retries = 0;
|
|
155
158
|
state.error = null;
|
|
159
|
+
state.paymentConfigs = paymentConfigs;
|
|
156
160
|
})
|
|
157
161
|
.addCase(exports.fetchConfig.rejected, function (state, action) {
|
|
158
162
|
state.error = action.payload;
|
|
@@ -7,11 +7,19 @@ var Keypad = function (_a) {
|
|
|
7
7
|
var _c = useAppSelector(selectKioskConfig), keypad = _c.keypad, numpad = _c.numpad;
|
|
8
8
|
var isDollar = type === 'dollar';
|
|
9
9
|
var config = type === 'numeric' || isDollar ? numpad : keypad;
|
|
10
|
-
var _d = useState(
|
|
10
|
+
var _d = useState(autoCapitalize), isShiftOn = _d[0], setIsShiftOn = _d[1];
|
|
11
11
|
var handleOnKeyPress = useCallback(function (key) {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
12
|
+
var isShiftKey = key === '\u21E7';
|
|
13
|
+
if (isShiftKey) {
|
|
14
|
+
setIsShiftOn(function (prev) { return !prev; });
|
|
15
|
+
return;
|
|
16
|
+
}
|
|
17
|
+
var newValue = getKeyboardValue(key, value, maxLength, isShiftOn);
|
|
18
|
+
handlers.change(newValue);
|
|
19
|
+
if (autoCapitalize) {
|
|
20
|
+
setIsShiftOn(newValue.length === 0);
|
|
21
|
+
}
|
|
22
|
+
}, [handlers, value, maxLength, isShiftOn, autoCapitalize]);
|
|
15
23
|
var viewHandlers = useMemo(function () { return ({ keyPress: handleOnKeyPress }); }, [handleOnKeyPress]);
|
|
16
24
|
if (!config)
|
|
17
25
|
return null;
|
|
@@ -83,5 +83,21 @@ declare class PosAPI {
|
|
|
83
83
|
getAllergens(): Promise<Allergens>;
|
|
84
84
|
testPrint(): Promise<boolean>;
|
|
85
85
|
rateOrder(orderId: string, data: any): Promise<unknown>;
|
|
86
|
+
fetchPaymentConfigs(): Promise<{
|
|
87
|
+
integration: string;
|
|
88
|
+
is_testing: false;
|
|
89
|
+
merchant_api_key: string;
|
|
90
|
+
merchant_id: string;
|
|
91
|
+
merchant_password: string;
|
|
92
|
+
merchant_username: string;
|
|
93
|
+
offline_limit: string;
|
|
94
|
+
saved_cards: boolean;
|
|
95
|
+
signature_threshold: string | null;
|
|
96
|
+
freedompay_store_id: string;
|
|
97
|
+
card_stor_service_url: string;
|
|
98
|
+
client_selling_system: string;
|
|
99
|
+
client_selling_system_version: string;
|
|
100
|
+
freedompay_terminal_id: string;
|
|
101
|
+
}>;
|
|
86
102
|
}
|
|
87
103
|
export default PosAPI;
|
package/dist/esm/services/api.js
CHANGED
|
@@ -382,6 +382,9 @@ var PosAPI = /** @class */ (function () {
|
|
|
382
382
|
PosAPI.prototype.rateOrder = function (orderId, data) {
|
|
383
383
|
return this.request("/orders/".concat(orderId, "/rating"), 'POST', data);
|
|
384
384
|
};
|
|
385
|
+
PosAPI.prototype.fetchPaymentConfigs = function () {
|
|
386
|
+
return this.request("/kiosk/payment-config");
|
|
387
|
+
};
|
|
385
388
|
return PosAPI;
|
|
386
389
|
}());
|
|
387
390
|
export default PosAPI;
|
|
@@ -21,6 +21,22 @@ export interface ConfigState {
|
|
|
21
21
|
error: RequestError | null;
|
|
22
22
|
retries: number;
|
|
23
23
|
accessibilityOn?: boolean;
|
|
24
|
+
paymentConfigs: {
|
|
25
|
+
integration: string;
|
|
26
|
+
is_testing: boolean;
|
|
27
|
+
merchant_api_key: string;
|
|
28
|
+
merchant_id: string;
|
|
29
|
+
merchant_password: string;
|
|
30
|
+
merchant_username: string;
|
|
31
|
+
offline_limit: string;
|
|
32
|
+
saved_cards: boolean;
|
|
33
|
+
signature_threshold: string | null;
|
|
34
|
+
freedompay_store_id: string;
|
|
35
|
+
card_stor_service_url: string;
|
|
36
|
+
client_selling_system: string;
|
|
37
|
+
client_selling_system_version: string;
|
|
38
|
+
freedompay_terminal_id: string;
|
|
39
|
+
} | null;
|
|
24
40
|
}
|
|
25
41
|
export declare enum ConfigActionType {
|
|
26
42
|
FetchConfig = "config/getConfig"
|
|
@@ -25,14 +25,15 @@ var initialState = {
|
|
|
25
25
|
loading: 'idle',
|
|
26
26
|
error: null,
|
|
27
27
|
retries: 0,
|
|
28
|
-
accessibilityOn: false
|
|
28
|
+
accessibilityOn: false,
|
|
29
|
+
paymentConfigs: null
|
|
29
30
|
};
|
|
30
31
|
export var ConfigActionType;
|
|
31
32
|
(function (ConfigActionType) {
|
|
32
33
|
ConfigActionType["FetchConfig"] = "config/getConfig";
|
|
33
34
|
})(ConfigActionType || (ConfigActionType = {}));
|
|
34
35
|
export var fetchConfig = createAsyncThunk(ConfigActionType.FetchConfig, function (_a, _b) { return __awaiter(void 0, [_a, _b], void 0, function (_c, _d) {
|
|
35
|
-
var posTerminalId, kdsTerminalId, app, api, _e, _f, devicesList, _g, stores, _h, selectOptions, _j, itemTypes, _k, menuColors, store, devices, err, cashier, employee, tz, businessDate, err_1, err_2;
|
|
36
|
+
var posTerminalId, kdsTerminalId, app, api, _e, _f, devicesList, _g, stores, _h, selectOptions, _j, itemTypes, _k, menuColors, paymentConfigs, store, devices, err, cashier, employee, tz, businessDate, err_1, err_2;
|
|
36
37
|
var apiUrl = _c.apiUrl;
|
|
37
38
|
var dispatch = _d.dispatch, getState = _d.getState, rejectWithValue = _d.rejectWithValue;
|
|
38
39
|
return __generator(this, function (_l) {
|
|
@@ -54,10 +55,11 @@ export var fetchConfig = createAsyncThunk(ConfigActionType.FetchConfig, function
|
|
|
54
55
|
// api.getSettings<SelectOptions>('SELECT_OPTION'),
|
|
55
56
|
api.getSelectOptions(),
|
|
56
57
|
api.getSettings('ITEM_TYPE'),
|
|
57
|
-
api.getSettings('ITEM_COLORS')
|
|
58
|
+
api.getSettings('ITEM_COLORS'),
|
|
59
|
+
api.fetchPaymentConfigs()
|
|
58
60
|
])];
|
|
59
61
|
case 1:
|
|
60
|
-
_e = _l.sent(), _f = _e[0], devicesList = _f === void 0 ? [] : _f, _g = _e[1], stores = _g === void 0 ? [] : _g, _h = _e[2], selectOptions = _h === void 0 ? [] : _h, _j = _e[3], itemTypes = _j === void 0 ? [] : _j, _k = _e[4], menuColors = _k === void 0 ? [] : _k;
|
|
62
|
+
_e = _l.sent(), _f = _e[0], devicesList = _f === void 0 ? [] : _f, _g = _e[1], stores = _g === void 0 ? [] : _g, _h = _e[2], selectOptions = _h === void 0 ? [] : _h, _j = _e[3], itemTypes = _j === void 0 ? [] : _j, _k = _e[4], menuColors = _k === void 0 ? [] : _k, paymentConfigs = _e[5];
|
|
61
63
|
store = stores[0] || null;
|
|
62
64
|
devices = devicesList[0] || null;
|
|
63
65
|
if (!store || !devices) {
|
|
@@ -99,7 +101,8 @@ export var fetchConfig = createAsyncThunk(ConfigActionType.FetchConfig, function
|
|
|
99
101
|
hasCashDrawer: true,
|
|
100
102
|
error: null,
|
|
101
103
|
loading: 'idle',
|
|
102
|
-
retries: 0
|
|
104
|
+
retries: 0,
|
|
105
|
+
paymentConfigs: paymentConfigs
|
|
103
106
|
}];
|
|
104
107
|
case 6:
|
|
105
108
|
err_2 = _l.sent();
|
|
@@ -138,7 +141,7 @@ var configSlice = createSlice({
|
|
|
138
141
|
state.loading = 'pending';
|
|
139
142
|
})
|
|
140
143
|
.addCase(fetchConfig.fulfilled, function (state, action) {
|
|
141
|
-
var _a = action.payload, api = _a.api, app = _a.app, devices = _a.devices, store = _a.store, selectOptions = _a.selectOptions, menuColors = _a.menuColors, hasPinpad = _a.hasPinpad, hasCashDrawer = _a.hasCashDrawer;
|
|
144
|
+
var _a = action.payload, api = _a.api, app = _a.app, devices = _a.devices, store = _a.store, selectOptions = _a.selectOptions, menuColors = _a.menuColors, hasPinpad = _a.hasPinpad, hasCashDrawer = _a.hasCashDrawer, paymentConfigs = _a.paymentConfigs;
|
|
142
145
|
state.api = api;
|
|
143
146
|
state.app = app;
|
|
144
147
|
state.store = store;
|
|
@@ -150,6 +153,7 @@ var configSlice = createSlice({
|
|
|
150
153
|
state.loading = 'idle';
|
|
151
154
|
state.retries = 0;
|
|
152
155
|
state.error = null;
|
|
156
|
+
state.paymentConfigs = paymentConfigs;
|
|
153
157
|
})
|
|
154
158
|
.addCase(fetchConfig.rejected, function (state, action) {
|
|
155
159
|
state.error = action.payload;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@open-tender/store",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.303",
|
|
4
4
|
"description": "A library of hooks, reducers, utility functions, and types for use with Open Tender applications that utilize our in-store POS API",
|
|
5
5
|
"main": "./dist/cjs/index.js",
|
|
6
6
|
"module": "./dist/esm/index.js",
|