@open-tender/store 1.1.165 → 1.1.167

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.
@@ -1,9 +1,11 @@
1
1
  import { MenuCategory } from '@open-tender/types';
2
2
  import { CategoryNavItemProps } from '@open-tender/ui';
3
3
  import { ReactNode } from 'react';
4
- declare const CategoryNavItem: ({ category, children, navigate }: {
4
+ declare const CategoryNavItem: ({ category, children, navigate, scrollTo, index }: {
5
5
  category: MenuCategory;
6
6
  navigate: (route: string) => void;
7
7
  children: (props: CategoryNavItemProps) => ReactNode;
8
+ scrollTo?: (index: number) => void;
9
+ index?: number;
8
10
  }) => ReactNode;
9
11
  export default CategoryNavItem;
@@ -4,7 +4,7 @@ var ui_1 = require("@open-tender/ui");
4
4
  var hooks_1 = require("../app/hooks");
5
5
  var slices_1 = require("../slices");
6
6
  var CategoryNavItem = function (_a) {
7
- var category = _a.category, children = _a.children, navigate = _a.navigate;
7
+ var category = _a.category, children = _a.children, navigate = _a.navigate, scrollTo = _a.scrollTo, index = _a.index;
8
8
  var dispatch = (0, hooks_1.useAppDispatch)();
9
9
  var apiUrl = (0, hooks_1.useAppSelector)(slices_1.selectKioskApi);
10
10
  var current = (0, hooks_1.useAppSelector)(slices_1.selectCurrentCategory);
@@ -15,7 +15,12 @@ var CategoryNavItem = function (_a) {
15
15
  var imageUrl = (0, ui_1.makeImageUrl)(category);
16
16
  var browse = function () {
17
17
  dispatch((0, slices_1.setCurrentCategory)(category));
18
- navigate('/menu/category');
18
+ if (scrollTo && index) {
19
+ scrollTo(index);
20
+ }
21
+ else {
22
+ navigate('/menu/category');
23
+ }
19
24
  };
20
25
  var handlers = { browse: browse };
21
26
  if (!config)
@@ -320,7 +320,7 @@ exports.completeChipDNA = (0, toolkit_1.createAsyncThunk)(CheckoutActionType.Com
320
320
  });
321
321
  }); });
322
322
  exports.addCreditTender = (0, toolkit_1.createAsyncThunk)(CheckoutActionType.AddCreditTender, function (_1, _a) { return tslib_1.__awaiter(void 0, [_1, _a], void 0, function (_, _b) {
323
- var _c, config, order, checkout, orderId, api, amount, tender, response, card_token, hasLoyalty, data, callback, err_7;
323
+ var _c, config, order, checkout, orderId, api, amount, tender, card_token, hasLoyalty, data, callback, err_7;
324
324
  var _d;
325
325
  var dispatch = _b.dispatch, getState = _b.getState, rejectWithValue = _b.rejectWithValue;
326
326
  return tslib_1.__generator(this, function (_e) {
@@ -336,8 +336,7 @@ exports.addCreditTender = (0, toolkit_1.createAsyncThunk)(CheckoutActionType.Add
336
336
  tender = { tender_type: 'CREDIT', amount: amount };
337
337
  return [4 /*yield*/, api.postCreditTender(orderId, tender)];
338
338
  case 1:
339
- response = _e.sent();
340
- console.log(response);
339
+ _e.sent();
341
340
  card_token = null;
342
341
  hasLoyalty = (_d = config.store) === null || _d === void 0 ? void 0 : _d.has_loyalty;
343
342
  if (!(hasLoyalty && card_token && !checkout.customer)) return [3 /*break*/, 2];
@@ -1,9 +1,11 @@
1
1
  import { MenuCategory } from '@open-tender/types';
2
2
  import { CategoryNavItemProps } from '@open-tender/ui';
3
3
  import { ReactNode } from 'react';
4
- declare const CategoryNavItem: ({ category, children, navigate }: {
4
+ declare const CategoryNavItem: ({ category, children, navigate, scrollTo, index }: {
5
5
  category: MenuCategory;
6
6
  navigate: (route: string) => void;
7
7
  children: (props: CategoryNavItemProps) => ReactNode;
8
+ scrollTo?: (index: number) => void;
9
+ index?: number;
8
10
  }) => ReactNode;
9
11
  export default CategoryNavItem;
@@ -2,7 +2,7 @@ import { makeImageUrl } from '@open-tender/ui';
2
2
  import { useAppDispatch, useAppSelector } from '../app/hooks';
3
3
  import { selectCurrentCategory, selectKioskApi, selectKioskConfig, setCurrentCategory } from '../slices';
4
4
  var CategoryNavItem = function (_a) {
5
- var category = _a.category, children = _a.children, navigate = _a.navigate;
5
+ var category = _a.category, children = _a.children, navigate = _a.navigate, scrollTo = _a.scrollTo, index = _a.index;
6
6
  var dispatch = useAppDispatch();
7
7
  var apiUrl = useAppSelector(selectKioskApi);
8
8
  var current = useAppSelector(selectCurrentCategory);
@@ -13,7 +13,12 @@ var CategoryNavItem = function (_a) {
13
13
  var imageUrl = makeImageUrl(category);
14
14
  var browse = function () {
15
15
  dispatch(setCurrentCategory(category));
16
- navigate('/menu/category');
16
+ if (scrollTo && index) {
17
+ scrollTo(index);
18
+ }
19
+ else {
20
+ navigate('/menu/category');
21
+ }
17
22
  };
18
23
  var handlers = { browse: browse };
19
24
  if (!config)
@@ -316,7 +316,7 @@ export var completeChipDNA = createAsyncThunk(CheckoutActionType.CompleteChipDNA
316
316
  });
317
317
  }); });
318
318
  export var addCreditTender = createAsyncThunk(CheckoutActionType.AddCreditTender, function (_1, _a) { return __awaiter(void 0, [_1, _a], void 0, function (_, _b) {
319
- var _c, config, order, checkout, orderId, api, amount, tender, response, card_token, hasLoyalty, data, callback, err_7;
319
+ var _c, config, order, checkout, orderId, api, amount, tender, card_token, hasLoyalty, data, callback, err_7;
320
320
  var _d;
321
321
  var dispatch = _b.dispatch, getState = _b.getState, rejectWithValue = _b.rejectWithValue;
322
322
  return __generator(this, function (_e) {
@@ -332,8 +332,7 @@ export var addCreditTender = createAsyncThunk(CheckoutActionType.AddCreditTender
332
332
  tender = { tender_type: 'CREDIT', amount: amount };
333
333
  return [4 /*yield*/, api.postCreditTender(orderId, tender)];
334
334
  case 1:
335
- response = _e.sent();
336
- console.log(response);
335
+ _e.sent();
337
336
  card_token = null;
338
337
  hasLoyalty = (_d = config.store) === null || _d === void 0 ? void 0 : _d.has_loyalty;
339
338
  if (!(hasLoyalty && card_token && !checkout.customer)) return [3 /*break*/, 2];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@open-tender/store",
3
- "version": "1.1.165",
3
+ "version": "1.1.167",
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",
@@ -61,9 +61,9 @@
61
61
  },
62
62
  "peerDependencies": {
63
63
  "@emotion/react": "^11.11.1",
64
- "@open-tender/types": "^0.4.70",
64
+ "@open-tender/types": "^0.4.75",
65
65
  "@open-tender/ui": "^0.4.2",
66
- "@open-tender/utils": "^0.4.45",
66
+ "@open-tender/utils": "^0.4.49",
67
67
  "@reduxjs/toolkit": "^2.0.1",
68
68
  "date-fns": "2.30.0",
69
69
  "date-fns-tz": "^2.0.0",