@open-tender/store 1.1.247 → 1.1.249

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.
@@ -0,0 +1,11 @@
1
+ import { Discount } from '@open-tender/types';
2
+ import { LoyaltyDiscountProps, AppliedProps } from '@open-tender/ui';
3
+ import React, { ReactNode } from 'react';
4
+ declare const LoyaltyDiscount: ({ discount, callback, isLast, children, AppliedView }: {
5
+ discount: Discount;
6
+ callback?: () => void;
7
+ isLast?: boolean;
8
+ children: (props: LoyaltyDiscountProps) => ReactNode;
9
+ AppliedView: (props: AppliedProps) => ReactNode;
10
+ }) => React.ReactNode;
11
+ export default LoyaltyDiscount;
@@ -0,0 +1,42 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ var tslib_1 = require("tslib");
4
+ var react_1 = tslib_1.__importStar(require("react"));
5
+ var hooks_1 = require("../app/hooks");
6
+ var slices_1 = require("../slices");
7
+ var Applied_1 = tslib_1.__importDefault(require("./Applied"));
8
+ var LoyaltyDiscount = function (_a) {
9
+ var discount = _a.discount, callback = _a.callback, isLast = _a.isLast, children = _a.children, AppliedView = _a.AppliedView;
10
+ var dispatch = (0, hooks_1.useAppDispatch)();
11
+ var apiUrl = (0, hooks_1.useAppSelector)(slices_1.selectKioskApi);
12
+ var _b = (0, hooks_1.useAppSelector)(slices_1.selectKioskConfig), config = _b.reward, cardConfig = _b.card;
13
+ var check = (0, hooks_1.useAppSelector)(slices_1.selectPosCheckout).check;
14
+ var discountIds = check === null || check === void 0 ? void 0 : check.discounts.map(function (i) { return i.id; });
15
+ var id = discount.discount_id;
16
+ var isApplied = !!(discountIds === null || discountIds === void 0 ? void 0 : discountIds.includes(id));
17
+ var apply = function () {
18
+ dispatch((0, slices_1.addDiscount)({ id: id }));
19
+ if (callback)
20
+ callback();
21
+ };
22
+ var remove = function () {
23
+ dispatch((0, slices_1.removeDiscount)({ id: id }));
24
+ if (callback)
25
+ callback();
26
+ };
27
+ var handlers = { apply: apply, remove: remove };
28
+ var renderApplied = (0, react_1.useCallback)(function () { return react_1.default.createElement(Applied_1.default, { children: AppliedView }); }, [AppliedView]);
29
+ if (!config)
30
+ return null;
31
+ return children({
32
+ config: config,
33
+ handlers: handlers,
34
+ discount: discount,
35
+ isApplied: isApplied,
36
+ isLast: isLast,
37
+ cardConfig: cardConfig,
38
+ renderApplied: renderApplied,
39
+ apiUrl: apiUrl
40
+ });
41
+ };
42
+ exports.default = LoyaltyDiscount;
@@ -40,6 +40,7 @@ import ItemSelections from './ItemSelections';
40
40
  import ItemSize from './ItemSize';
41
41
  import Keypad from './Keypad';
42
42
  import Loader from './Loader';
43
+ import LoyaltyDiscount from './LoyaltyDiscount';
43
44
  import MadeForName from './MadeForName';
44
45
  import MadeForNotes from './MadeForNotes';
45
46
  import MenuCategory from './MenuCategory';
@@ -73,4 +74,4 @@ import TagsFilter from './TagsFilter';
73
74
  import TextArea from './TextArea';
74
75
  import UpsellItem from './UpsellItem';
75
76
  import Upsells from './Upsells';
76
- export { AccountLoyalty, AccountSection, Allergen, Applied, ButtonLink, CancelButton, Card, Cart, CartButton, CartItem, CartUpsellItem, CartUpsells, CategoryItem, CategoryNav, CategoryNavItem, CategoryNavOther, Checkout, CheckoutCart, CheckoutContent, CheckoutFooter, CheckoutHeader, CheckoutPromoCode, CheckoutTotals, CheckTotals, Discount, ErrorMessage, FavsButton, Header, Ingredients, Input, InputButton, ItemGroup, ItemGroups, ItemOption, ItemOptionSelected, ItemSize, ItemSelections, Keypad, Loader, MadeForName, MadeForNotes, MenuCategory, MenuOther, ModalContent, ModalHeader, NutritionalInfo, Option, OrderCard, OrderDetails, OrderDetailsItem, PointsReward, PointsRewards, PromoCode, Quantity, Reward, Rewards, SignIn, SignInButton, SignInCheckout, SignInOptionsModal, SignInPhone, SignInQr, SignUp, SuccessMessage, Tag, TextArea, UpsellItem, Upsells, IdleModal, TagsFilter, Switch, TagsButton, CheckoutTable, DisabledModal, Notifications };
77
+ export { AccountLoyalty, AccountSection, Allergen, Applied, ButtonLink, CancelButton, Card, Cart, CartButton, CartItem, CartUpsellItem, CartUpsells, CategoryItem, CategoryNav, CategoryNavItem, CategoryNavOther, Checkout, CheckoutCart, CheckoutContent, CheckoutFooter, CheckoutHeader, CheckoutPromoCode, CheckoutTotals, CheckTotals, Discount, ErrorMessage, FavsButton, Header, Ingredients, Input, InputButton, ItemGroup, ItemGroups, ItemOption, ItemOptionSelected, ItemSize, ItemSelections, Keypad, Loader, MadeForName, MadeForNotes, MenuCategory, MenuOther, ModalContent, ModalHeader, NutritionalInfo, Option, OrderCard, OrderDetails, OrderDetailsItem, PointsReward, PointsRewards, PromoCode, Quantity, Reward, Rewards, SignIn, SignInButton, SignInCheckout, SignInOptionsModal, SignInPhone, SignInQr, SignUp, SuccessMessage, Tag, TextArea, UpsellItem, Upsells, IdleModal, TagsFilter, Switch, TagsButton, CheckoutTable, DisabledModal, Notifications, LoyaltyDiscount };
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.OrderDetailsItem = exports.OrderDetails = exports.OrderCard = exports.Option = exports.NutritionalInfo = exports.ModalHeader = exports.ModalContent = exports.MenuOther = exports.MenuCategory = exports.MadeForNotes = exports.MadeForName = exports.Loader = exports.Keypad = exports.ItemSelections = exports.ItemSize = exports.ItemOptionSelected = exports.ItemOption = exports.ItemGroups = exports.ItemGroup = exports.InputButton = exports.Input = exports.Ingredients = exports.Header = exports.FavsButton = exports.ErrorMessage = exports.Discount = exports.CheckTotals = exports.CheckoutTotals = exports.CheckoutPromoCode = exports.CheckoutHeader = exports.CheckoutFooter = exports.CheckoutContent = exports.CheckoutCart = exports.Checkout = exports.CategoryNavOther = exports.CategoryNavItem = exports.CategoryNav = exports.CategoryItem = exports.CartUpsells = exports.CartUpsellItem = exports.CartItem = exports.CartButton = exports.Cart = exports.Card = exports.CancelButton = exports.ButtonLink = exports.Applied = exports.Allergen = exports.AccountSection = exports.AccountLoyalty = void 0;
4
- exports.Notifications = exports.DisabledModal = exports.CheckoutTable = exports.TagsButton = exports.Switch = exports.TagsFilter = exports.IdleModal = exports.Upsells = exports.UpsellItem = exports.TextArea = exports.Tag = exports.SuccessMessage = exports.SignUp = exports.SignInQr = exports.SignInPhone = exports.SignInOptionsModal = exports.SignInCheckout = exports.SignInButton = exports.SignIn = exports.Rewards = exports.Reward = exports.Quantity = exports.PromoCode = exports.PointsRewards = exports.PointsReward = void 0;
4
+ exports.LoyaltyDiscount = exports.Notifications = exports.DisabledModal = exports.CheckoutTable = exports.TagsButton = exports.Switch = exports.TagsFilter = exports.IdleModal = exports.Upsells = exports.UpsellItem = exports.TextArea = exports.Tag = exports.SuccessMessage = exports.SignUp = exports.SignInQr = exports.SignInPhone = exports.SignInOptionsModal = exports.SignInCheckout = exports.SignInButton = exports.SignIn = exports.Rewards = exports.Reward = exports.Quantity = exports.PromoCode = exports.PointsRewards = exports.PointsReward = void 0;
5
5
  var tslib_1 = require("tslib");
6
6
  var AccountLoyalty_1 = tslib_1.__importDefault(require("./AccountLoyalty"));
7
7
  exports.AccountLoyalty = AccountLoyalty_1.default;
@@ -87,6 +87,8 @@ var Keypad_1 = tslib_1.__importDefault(require("./Keypad"));
87
87
  exports.Keypad = Keypad_1.default;
88
88
  var Loader_1 = tslib_1.__importDefault(require("./Loader"));
89
89
  exports.Loader = Loader_1.default;
90
+ var LoyaltyDiscount_1 = tslib_1.__importDefault(require("./LoyaltyDiscount"));
91
+ exports.LoyaltyDiscount = LoyaltyDiscount_1.default;
90
92
  var MadeForName_1 = tslib_1.__importDefault(require("./MadeForName"));
91
93
  exports.MadeForName = MadeForName_1.default;
92
94
  var MadeForNotes_1 = tslib_1.__importDefault(require("./MadeForNotes"));
@@ -62,11 +62,7 @@ var prepareOrder = function (order, checkout) {
62
62
  made_for: made_for,
63
63
  phone: phone,
64
64
  prep_type: prep_type,
65
- details: deviceType
66
- ? {
67
- device_type: deviceType
68
- }
69
- : undefined,
65
+ device_type: deviceType,
70
66
  notes_internal: table !== null && table.length > 0 ? "DINE IN -- TABLE ".concat(table) : null
71
67
  };
72
68
  };
@@ -0,0 +1,11 @@
1
+ import { Discount } from '@open-tender/types';
2
+ import { LoyaltyDiscountProps, AppliedProps } from '@open-tender/ui';
3
+ import React, { ReactNode } from 'react';
4
+ declare const LoyaltyDiscount: ({ discount, callback, isLast, children, AppliedView }: {
5
+ discount: Discount;
6
+ callback?: () => void;
7
+ isLast?: boolean;
8
+ children: (props: LoyaltyDiscountProps) => ReactNode;
9
+ AppliedView: (props: AppliedProps) => ReactNode;
10
+ }) => React.ReactNode;
11
+ export default LoyaltyDiscount;
@@ -0,0 +1,39 @@
1
+ import React, { useCallback } from 'react';
2
+ import { useAppDispatch, useAppSelector } from '../app/hooks';
3
+ import { addDiscount, removeDiscount, selectKioskApi, selectKioskConfig, selectPosCheckout } from '../slices';
4
+ import { default as AppliedContainer } from './Applied';
5
+ var LoyaltyDiscount = function (_a) {
6
+ var discount = _a.discount, callback = _a.callback, isLast = _a.isLast, children = _a.children, AppliedView = _a.AppliedView;
7
+ var dispatch = useAppDispatch();
8
+ var apiUrl = useAppSelector(selectKioskApi);
9
+ var _b = useAppSelector(selectKioskConfig), config = _b.reward, cardConfig = _b.card;
10
+ var check = useAppSelector(selectPosCheckout).check;
11
+ var discountIds = check === null || check === void 0 ? void 0 : check.discounts.map(function (i) { return i.id; });
12
+ var id = discount.discount_id;
13
+ var isApplied = !!(discountIds === null || discountIds === void 0 ? void 0 : discountIds.includes(id));
14
+ var apply = function () {
15
+ dispatch(addDiscount({ id: id }));
16
+ if (callback)
17
+ callback();
18
+ };
19
+ var remove = function () {
20
+ dispatch(removeDiscount({ id: id }));
21
+ if (callback)
22
+ callback();
23
+ };
24
+ var handlers = { apply: apply, remove: remove };
25
+ var renderApplied = useCallback(function () { return React.createElement(AppliedContainer, { children: AppliedView }); }, [AppliedView]);
26
+ if (!config)
27
+ return null;
28
+ return children({
29
+ config: config,
30
+ handlers: handlers,
31
+ discount: discount,
32
+ isApplied: isApplied,
33
+ isLast: isLast,
34
+ cardConfig: cardConfig,
35
+ renderApplied: renderApplied,
36
+ apiUrl: apiUrl
37
+ });
38
+ };
39
+ export default LoyaltyDiscount;
@@ -40,6 +40,7 @@ import ItemSelections from './ItemSelections';
40
40
  import ItemSize from './ItemSize';
41
41
  import Keypad from './Keypad';
42
42
  import Loader from './Loader';
43
+ import LoyaltyDiscount from './LoyaltyDiscount';
43
44
  import MadeForName from './MadeForName';
44
45
  import MadeForNotes from './MadeForNotes';
45
46
  import MenuCategory from './MenuCategory';
@@ -73,4 +74,4 @@ import TagsFilter from './TagsFilter';
73
74
  import TextArea from './TextArea';
74
75
  import UpsellItem from './UpsellItem';
75
76
  import Upsells from './Upsells';
76
- export { AccountLoyalty, AccountSection, Allergen, Applied, ButtonLink, CancelButton, Card, Cart, CartButton, CartItem, CartUpsellItem, CartUpsells, CategoryItem, CategoryNav, CategoryNavItem, CategoryNavOther, Checkout, CheckoutCart, CheckoutContent, CheckoutFooter, CheckoutHeader, CheckoutPromoCode, CheckoutTotals, CheckTotals, Discount, ErrorMessage, FavsButton, Header, Ingredients, Input, InputButton, ItemGroup, ItemGroups, ItemOption, ItemOptionSelected, ItemSize, ItemSelections, Keypad, Loader, MadeForName, MadeForNotes, MenuCategory, MenuOther, ModalContent, ModalHeader, NutritionalInfo, Option, OrderCard, OrderDetails, OrderDetailsItem, PointsReward, PointsRewards, PromoCode, Quantity, Reward, Rewards, SignIn, SignInButton, SignInCheckout, SignInOptionsModal, SignInPhone, SignInQr, SignUp, SuccessMessage, Tag, TextArea, UpsellItem, Upsells, IdleModal, TagsFilter, Switch, TagsButton, CheckoutTable, DisabledModal, Notifications };
77
+ export { AccountLoyalty, AccountSection, Allergen, Applied, ButtonLink, CancelButton, Card, Cart, CartButton, CartItem, CartUpsellItem, CartUpsells, CategoryItem, CategoryNav, CategoryNavItem, CategoryNavOther, Checkout, CheckoutCart, CheckoutContent, CheckoutFooter, CheckoutHeader, CheckoutPromoCode, CheckoutTotals, CheckTotals, Discount, ErrorMessage, FavsButton, Header, Ingredients, Input, InputButton, ItemGroup, ItemGroups, ItemOption, ItemOptionSelected, ItemSize, ItemSelections, Keypad, Loader, MadeForName, MadeForNotes, MenuCategory, MenuOther, ModalContent, ModalHeader, NutritionalInfo, Option, OrderCard, OrderDetails, OrderDetailsItem, PointsReward, PointsRewards, PromoCode, Quantity, Reward, Rewards, SignIn, SignInButton, SignInCheckout, SignInOptionsModal, SignInPhone, SignInQr, SignUp, SuccessMessage, Tag, TextArea, UpsellItem, Upsells, IdleModal, TagsFilter, Switch, TagsButton, CheckoutTable, DisabledModal, Notifications, LoyaltyDiscount };
@@ -40,6 +40,7 @@ import ItemSelections from './ItemSelections';
40
40
  import ItemSize from './ItemSize';
41
41
  import Keypad from './Keypad';
42
42
  import Loader from './Loader';
43
+ import LoyaltyDiscount from './LoyaltyDiscount';
43
44
  import MadeForName from './MadeForName';
44
45
  import MadeForNotes from './MadeForNotes';
45
46
  import MenuCategory from './MenuCategory';
@@ -73,4 +74,4 @@ import TagsFilter from './TagsFilter';
73
74
  import TextArea from './TextArea';
74
75
  import UpsellItem from './UpsellItem';
75
76
  import Upsells from './Upsells';
76
- export { AccountLoyalty, AccountSection, Allergen, Applied, ButtonLink, CancelButton, Card, Cart, CartButton, CartItem, CartUpsellItem, CartUpsells, CategoryItem, CategoryNav, CategoryNavItem, CategoryNavOther, Checkout, CheckoutCart, CheckoutContent, CheckoutFooter, CheckoutHeader, CheckoutPromoCode, CheckoutTotals, CheckTotals, Discount, ErrorMessage, FavsButton, Header, Ingredients, Input, InputButton, ItemGroup, ItemGroups, ItemOption, ItemOptionSelected, ItemSize, ItemSelections, Keypad, Loader, MadeForName, MadeForNotes, MenuCategory, MenuOther, ModalContent, ModalHeader, NutritionalInfo, Option, OrderCard, OrderDetails, OrderDetailsItem, PointsReward, PointsRewards, PromoCode, Quantity, Reward, Rewards, SignIn, SignInButton, SignInCheckout, SignInOptionsModal, SignInPhone, SignInQr, SignUp, SuccessMessage, Tag, TextArea, UpsellItem, Upsells, IdleModal, TagsFilter, Switch, TagsButton, CheckoutTable, DisabledModal, Notifications };
77
+ export { AccountLoyalty, AccountSection, Allergen, Applied, ButtonLink, CancelButton, Card, Cart, CartButton, CartItem, CartUpsellItem, CartUpsells, CategoryItem, CategoryNav, CategoryNavItem, CategoryNavOther, Checkout, CheckoutCart, CheckoutContent, CheckoutFooter, CheckoutHeader, CheckoutPromoCode, CheckoutTotals, CheckTotals, Discount, ErrorMessage, FavsButton, Header, Ingredients, Input, InputButton, ItemGroup, ItemGroups, ItemOption, ItemOptionSelected, ItemSize, ItemSelections, Keypad, Loader, MadeForName, MadeForNotes, MenuCategory, MenuOther, ModalContent, ModalHeader, NutritionalInfo, Option, OrderCard, OrderDetails, OrderDetailsItem, PointsReward, PointsRewards, PromoCode, Quantity, Reward, Rewards, SignIn, SignInButton, SignInCheckout, SignInOptionsModal, SignInPhone, SignInQr, SignUp, SuccessMessage, Tag, TextArea, UpsellItem, Upsells, IdleModal, TagsFilter, Switch, TagsButton, CheckoutTable, DisabledModal, Notifications, LoyaltyDiscount };
@@ -59,11 +59,7 @@ export var prepareOrder = function (order, checkout) {
59
59
  made_for: made_for,
60
60
  phone: phone,
61
61
  prep_type: prep_type,
62
- details: deviceType
63
- ? {
64
- device_type: deviceType
65
- }
66
- : undefined,
62
+ device_type: deviceType,
67
63
  notes_internal: table !== null && table.length > 0 ? "DINE IN -- TABLE ".concat(table) : null
68
64
  };
69
65
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@open-tender/store",
3
- "version": "1.1.247",
3
+ "version": "1.1.249",
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.98",
65
- "@open-tender/ui": "^0.4.34",
66
- "@open-tender/utils": "^0.4.72",
64
+ "@open-tender/types": "^0.4.99",
65
+ "@open-tender/ui": "^0.4.35",
66
+ "@open-tender/utils": "^0.4.73",
67
67
  "@reduxjs/toolkit": "^2.0.1",
68
68
  "date-fns": "2.30.0",
69
69
  "date-fns-tz": "^2.0.0",