@open-tender/store 1.1.89 → 1.1.91
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/AccountLoyalty.d.ts +9 -0
- package/dist/cjs/components/AccountLoyalty.js +15 -0
- package/dist/cjs/components/index.d.ts +2 -1
- package/dist/cjs/components/index.js +4 -2
- package/dist/cjs/slices/customer.d.ts +5 -29
- package/dist/cjs/slices/customer.js +14 -4
- package/dist/esm/components/AccountLoyalty.d.ts +9 -0
- package/dist/esm/components/AccountLoyalty.js +13 -0
- package/dist/esm/components/index.d.ts +2 -1
- package/dist/esm/components/index.js +2 -1
- package/dist/esm/slices/customer.d.ts +5 -29
- package/dist/esm/slices/customer.js +14 -4
- package/package.json +3 -3
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { LoyaltyProgramSummary } from '@open-tender/types';
|
|
2
|
+
import { AccountLoyaltyProps } from '@open-tender/ui';
|
|
3
|
+
import { ReactNode } from 'react';
|
|
4
|
+
declare const AccountLoyalty: ({ loyaltySummary, navigate, children }: {
|
|
5
|
+
loyaltySummary: LoyaltyProgramSummary;
|
|
6
|
+
navigate: (route: string) => void;
|
|
7
|
+
children: (props: AccountLoyaltyProps) => ReactNode;
|
|
8
|
+
}) => ReactNode;
|
|
9
|
+
export default AccountLoyalty;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
var hooks_1 = require("../app/hooks");
|
|
4
|
+
var slices_1 = require("../slices");
|
|
5
|
+
var AccountLoyalty = function (_a) {
|
|
6
|
+
var loyaltySummary = _a.loyaltySummary, navigate = _a.navigate, children = _a.children;
|
|
7
|
+
var config = (0, hooks_1.useAppSelector)(slices_1.selectKioskConfig).accountLoyalty;
|
|
8
|
+
var account = (0, hooks_1.useAppSelector)(slices_1.selectCustomer).account;
|
|
9
|
+
var startOrder = function () { return navigate('/menu'); };
|
|
10
|
+
var handlers = { startOrder: startOrder };
|
|
11
|
+
if (!config || !account || !loyaltySummary)
|
|
12
|
+
return null;
|
|
13
|
+
return children({ config: config, handlers: handlers, account: account, loyaltySummary: loyaltySummary });
|
|
14
|
+
};
|
|
15
|
+
exports.default = AccountLoyalty;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import AccountLoyalty from './AccountLoyalty';
|
|
1
2
|
import AccountSection from './AccountSection';
|
|
2
3
|
import Allergen from './Allergen';
|
|
3
4
|
import Applied from './Applied';
|
|
@@ -62,4 +63,4 @@ import Tag from './Tag';
|
|
|
62
63
|
import TextArea from './TextArea';
|
|
63
64
|
import UpsellItem from './UpsellItem';
|
|
64
65
|
import Upsells from './Upsells';
|
|
65
|
-
export { AccountSection, Allergen, Applied, ButtonLink, Card, Cart, 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, SuccessMessage, Tag, TextArea, UpsellItem, Upsells };
|
|
66
|
+
export { AccountLoyalty, AccountSection, Allergen, Applied, ButtonLink, Card, Cart, 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, SuccessMessage, Tag, TextArea, UpsellItem, Upsells };
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
exports.Upsells = exports.UpsellItem = exports.TextArea = exports.Tag = exports.SuccessMessage = exports.SignInQr = exports.SignInPhone = exports.SignInOptionsModal = exports.SignInCheckout = exports.SignInButton = exports.SignIn = exports.Rewards = exports.Reward = exports.Quantity = void 0;
|
|
3
|
+
exports.PointsRewards = exports.PointsReward = 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.Cart = exports.Card = exports.ButtonLink = exports.Applied = exports.Allergen = exports.AccountSection = exports.AccountLoyalty = void 0;
|
|
4
|
+
exports.Upsells = exports.UpsellItem = exports.TextArea = exports.Tag = exports.SuccessMessage = exports.SignInQr = exports.SignInPhone = exports.SignInOptionsModal = exports.SignInCheckout = exports.SignInButton = exports.SignIn = exports.Rewards = exports.Reward = exports.Quantity = exports.PromoCode = void 0;
|
|
5
5
|
var tslib_1 = require("tslib");
|
|
6
|
+
var AccountLoyalty_1 = tslib_1.__importDefault(require("./AccountLoyalty"));
|
|
7
|
+
exports.AccountLoyalty = AccountLoyalty_1.default;
|
|
6
8
|
var AccountSection_1 = tslib_1.__importDefault(require("./AccountSection"));
|
|
7
9
|
exports.AccountSection = AccountSection_1.default;
|
|
8
10
|
var Allergen_1 = tslib_1.__importDefault(require("./Allergen"));
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Customer, CustomerEndpoints, CustomerEntities, Discounts, Favorites, GiftCards, LoyaltyPrograms, Orders, RequestError, RequestStatus } from '@open-tender/types';
|
|
1
|
+
import { Customer, CustomerEndpoints, CustomerEntities, Discounts, Favorites, GiftCards, LoyaltyProgramSummary, LoyaltyPrograms, Orders, RequestError, RequestStatus } from '@open-tender/types';
|
|
2
2
|
import { AppState } from '../app';
|
|
3
3
|
export interface CustomerState {
|
|
4
4
|
account: Customer | null;
|
|
@@ -62,42 +62,18 @@ export declare const selectCustomerLoyalty: ((state: {
|
|
|
62
62
|
sidebar: import("./sidebar").SidebarState;
|
|
63
63
|
surcharges: import("./surcharges").SurchargesState;
|
|
64
64
|
taxes: import("./taxes").TaxesState;
|
|
65
|
-
}) => {
|
|
66
|
-
name: string;
|
|
67
|
-
credit: `${number}.${number}` | null;
|
|
68
|
-
thresholds: import("@open-tender/types").LoyaltyThresholds;
|
|
69
|
-
progress: `${number}.${number}` | null;
|
|
70
|
-
tier: import("@open-tender/types").LoyaltyTier | undefined;
|
|
71
|
-
} | null) & {
|
|
65
|
+
}) => LoyaltyProgramSummary | null) & {
|
|
72
66
|
clearCache: () => void;
|
|
73
67
|
resultsCount: () => number;
|
|
74
68
|
resetResultsCount: () => void;
|
|
75
69
|
} & {
|
|
76
|
-
resultFunc: (resultFuncArgs_0: import("@open-tender/types").LoyaltyProgram) =>
|
|
77
|
-
|
|
78
|
-
credit: `${number}.${number}` | null;
|
|
79
|
-
thresholds: import("@open-tender/types").LoyaltyThresholds;
|
|
80
|
-
progress: `${number}.${number}` | null;
|
|
81
|
-
tier: import("@open-tender/types").LoyaltyTier | undefined;
|
|
82
|
-
} | null;
|
|
83
|
-
memoizedResultFunc: ((resultFuncArgs_0: import("@open-tender/types").LoyaltyProgram) => {
|
|
84
|
-
name: string;
|
|
85
|
-
credit: `${number}.${number}` | null;
|
|
86
|
-
thresholds: import("@open-tender/types").LoyaltyThresholds;
|
|
87
|
-
progress: `${number}.${number}` | null;
|
|
88
|
-
tier: import("@open-tender/types").LoyaltyTier | undefined;
|
|
89
|
-
} | null) & {
|
|
70
|
+
resultFunc: (resultFuncArgs_0: import("@open-tender/types").LoyaltyProgram) => LoyaltyProgramSummary | null;
|
|
71
|
+
memoizedResultFunc: ((resultFuncArgs_0: import("@open-tender/types").LoyaltyProgram) => LoyaltyProgramSummary | null) & {
|
|
90
72
|
clearCache: () => void;
|
|
91
73
|
resultsCount: () => number;
|
|
92
74
|
resetResultsCount: () => void;
|
|
93
75
|
};
|
|
94
|
-
lastResult: () =>
|
|
95
|
-
name: string;
|
|
96
|
-
credit: `${number}.${number}` | null;
|
|
97
|
-
thresholds: import("@open-tender/types").LoyaltyThresholds;
|
|
98
|
-
progress: `${number}.${number}` | null;
|
|
99
|
-
tier: import("@open-tender/types").LoyaltyTier | undefined;
|
|
100
|
-
} | null;
|
|
76
|
+
lastResult: () => LoyaltyProgramSummary | null;
|
|
101
77
|
dependencies: [(state: AppState) => import("@open-tender/types").LoyaltyProgram];
|
|
102
78
|
recomputations: () => number;
|
|
103
79
|
resetRecomputations: () => void;
|
|
@@ -92,9 +92,19 @@ exports.selectCustomerLoyalty = (0, toolkit_1.createSelector)(function (state) {
|
|
|
92
92
|
if (!loyaltyProgram)
|
|
93
93
|
return null;
|
|
94
94
|
var name = loyaltyProgram.name, perk = loyaltyProgram.perk, status = loyaltyProgram.status;
|
|
95
|
-
var _a = perk || {}, _b = _a.
|
|
96
|
-
var
|
|
97
|
-
var
|
|
98
|
-
|
|
95
|
+
var _a = perk || {}, _b = _a.loyalty_perk, loyalty_perk = _b === void 0 ? null : _b, _c = _a.credit, credit = _c === void 0 ? null : _c, _d = _a.thresholds, thresholds = _d === void 0 ? [] : _d;
|
|
96
|
+
var isPoints = loyalty_perk === 'BANKABLE_POINTS';
|
|
97
|
+
var points = isPoints && credit ? parseInt(credit) : null;
|
|
98
|
+
var _e = status || {}, _f = _e.progress, progress = _f === void 0 ? null : _f, _g = _e.tiers, tiers = _g === void 0 ? [] : _g;
|
|
99
|
+
var tier = tiers.find(function (i) { return i.is_current_tier; }) || null;
|
|
100
|
+
return {
|
|
101
|
+
name: name,
|
|
102
|
+
perkType: loyalty_perk,
|
|
103
|
+
points: points,
|
|
104
|
+
credit: isPoints ? null : credit,
|
|
105
|
+
thresholds: thresholds,
|
|
106
|
+
progress: isPoints && progress ? parseInt(progress) : progress,
|
|
107
|
+
tier: tier
|
|
108
|
+
};
|
|
99
109
|
});
|
|
100
110
|
exports.customerReducer = CustomerSlice.reducer;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { LoyaltyProgramSummary } from '@open-tender/types';
|
|
2
|
+
import { AccountLoyaltyProps } from '@open-tender/ui';
|
|
3
|
+
import { ReactNode } from 'react';
|
|
4
|
+
declare const AccountLoyalty: ({ loyaltySummary, navigate, children }: {
|
|
5
|
+
loyaltySummary: LoyaltyProgramSummary;
|
|
6
|
+
navigate: (route: string) => void;
|
|
7
|
+
children: (props: AccountLoyaltyProps) => ReactNode;
|
|
8
|
+
}) => ReactNode;
|
|
9
|
+
export default AccountLoyalty;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { useAppSelector } from '../app/hooks';
|
|
2
|
+
import { selectCustomer, selectKioskConfig } from '../slices';
|
|
3
|
+
var AccountLoyalty = function (_a) {
|
|
4
|
+
var loyaltySummary = _a.loyaltySummary, navigate = _a.navigate, children = _a.children;
|
|
5
|
+
var config = useAppSelector(selectKioskConfig).accountLoyalty;
|
|
6
|
+
var account = useAppSelector(selectCustomer).account;
|
|
7
|
+
var startOrder = function () { return navigate('/menu'); };
|
|
8
|
+
var handlers = { startOrder: startOrder };
|
|
9
|
+
if (!config || !account || !loyaltySummary)
|
|
10
|
+
return null;
|
|
11
|
+
return children({ config: config, handlers: handlers, account: account, loyaltySummary: loyaltySummary });
|
|
12
|
+
};
|
|
13
|
+
export default AccountLoyalty;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import AccountLoyalty from './AccountLoyalty';
|
|
1
2
|
import AccountSection from './AccountSection';
|
|
2
3
|
import Allergen from './Allergen';
|
|
3
4
|
import Applied from './Applied';
|
|
@@ -62,4 +63,4 @@ import Tag from './Tag';
|
|
|
62
63
|
import TextArea from './TextArea';
|
|
63
64
|
import UpsellItem from './UpsellItem';
|
|
64
65
|
import Upsells from './Upsells';
|
|
65
|
-
export { AccountSection, Allergen, Applied, ButtonLink, Card, Cart, 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, SuccessMessage, Tag, TextArea, UpsellItem, Upsells };
|
|
66
|
+
export { AccountLoyalty, AccountSection, Allergen, Applied, ButtonLink, Card, Cart, 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, SuccessMessage, Tag, TextArea, UpsellItem, Upsells };
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import AccountLoyalty from './AccountLoyalty';
|
|
1
2
|
import AccountSection from './AccountSection';
|
|
2
3
|
import Allergen from './Allergen';
|
|
3
4
|
import Applied from './Applied';
|
|
@@ -62,4 +63,4 @@ import Tag from './Tag';
|
|
|
62
63
|
import TextArea from './TextArea';
|
|
63
64
|
import UpsellItem from './UpsellItem';
|
|
64
65
|
import Upsells from './Upsells';
|
|
65
|
-
export { AccountSection, Allergen, Applied, ButtonLink, Card, Cart, 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, SuccessMessage, Tag, TextArea, UpsellItem, Upsells };
|
|
66
|
+
export { AccountLoyalty, AccountSection, Allergen, Applied, ButtonLink, Card, Cart, 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, SuccessMessage, Tag, TextArea, UpsellItem, Upsells };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Customer, CustomerEndpoints, CustomerEntities, Discounts, Favorites, GiftCards, LoyaltyPrograms, Orders, RequestError, RequestStatus } from '@open-tender/types';
|
|
1
|
+
import { Customer, CustomerEndpoints, CustomerEntities, Discounts, Favorites, GiftCards, LoyaltyProgramSummary, LoyaltyPrograms, Orders, RequestError, RequestStatus } from '@open-tender/types';
|
|
2
2
|
import { AppState } from '../app';
|
|
3
3
|
export interface CustomerState {
|
|
4
4
|
account: Customer | null;
|
|
@@ -62,42 +62,18 @@ export declare const selectCustomerLoyalty: ((state: {
|
|
|
62
62
|
sidebar: import("./sidebar").SidebarState;
|
|
63
63
|
surcharges: import("./surcharges").SurchargesState;
|
|
64
64
|
taxes: import("./taxes").TaxesState;
|
|
65
|
-
}) => {
|
|
66
|
-
name: string;
|
|
67
|
-
credit: `${number}.${number}` | null;
|
|
68
|
-
thresholds: import("@open-tender/types").LoyaltyThresholds;
|
|
69
|
-
progress: `${number}.${number}` | null;
|
|
70
|
-
tier: import("@open-tender/types").LoyaltyTier | undefined;
|
|
71
|
-
} | null) & {
|
|
65
|
+
}) => LoyaltyProgramSummary | null) & {
|
|
72
66
|
clearCache: () => void;
|
|
73
67
|
resultsCount: () => number;
|
|
74
68
|
resetResultsCount: () => void;
|
|
75
69
|
} & {
|
|
76
|
-
resultFunc: (resultFuncArgs_0: import("@open-tender/types").LoyaltyProgram) =>
|
|
77
|
-
|
|
78
|
-
credit: `${number}.${number}` | null;
|
|
79
|
-
thresholds: import("@open-tender/types").LoyaltyThresholds;
|
|
80
|
-
progress: `${number}.${number}` | null;
|
|
81
|
-
tier: import("@open-tender/types").LoyaltyTier | undefined;
|
|
82
|
-
} | null;
|
|
83
|
-
memoizedResultFunc: ((resultFuncArgs_0: import("@open-tender/types").LoyaltyProgram) => {
|
|
84
|
-
name: string;
|
|
85
|
-
credit: `${number}.${number}` | null;
|
|
86
|
-
thresholds: import("@open-tender/types").LoyaltyThresholds;
|
|
87
|
-
progress: `${number}.${number}` | null;
|
|
88
|
-
tier: import("@open-tender/types").LoyaltyTier | undefined;
|
|
89
|
-
} | null) & {
|
|
70
|
+
resultFunc: (resultFuncArgs_0: import("@open-tender/types").LoyaltyProgram) => LoyaltyProgramSummary | null;
|
|
71
|
+
memoizedResultFunc: ((resultFuncArgs_0: import("@open-tender/types").LoyaltyProgram) => LoyaltyProgramSummary | null) & {
|
|
90
72
|
clearCache: () => void;
|
|
91
73
|
resultsCount: () => number;
|
|
92
74
|
resetResultsCount: () => void;
|
|
93
75
|
};
|
|
94
|
-
lastResult: () =>
|
|
95
|
-
name: string;
|
|
96
|
-
credit: `${number}.${number}` | null;
|
|
97
|
-
thresholds: import("@open-tender/types").LoyaltyThresholds;
|
|
98
|
-
progress: `${number}.${number}` | null;
|
|
99
|
-
tier: import("@open-tender/types").LoyaltyTier | undefined;
|
|
100
|
-
} | null;
|
|
76
|
+
lastResult: () => LoyaltyProgramSummary | null;
|
|
101
77
|
dependencies: [(state: AppState) => import("@open-tender/types").LoyaltyProgram];
|
|
102
78
|
recomputations: () => number;
|
|
103
79
|
resetRecomputations: () => void;
|
|
@@ -82,9 +82,19 @@ export var selectCustomerLoyalty = createSelector(function (state) {
|
|
|
82
82
|
if (!loyaltyProgram)
|
|
83
83
|
return null;
|
|
84
84
|
var name = loyaltyProgram.name, perk = loyaltyProgram.perk, status = loyaltyProgram.status;
|
|
85
|
-
var _a = perk || {}, _b = _a.
|
|
86
|
-
var
|
|
87
|
-
var
|
|
88
|
-
|
|
85
|
+
var _a = perk || {}, _b = _a.loyalty_perk, loyalty_perk = _b === void 0 ? null : _b, _c = _a.credit, credit = _c === void 0 ? null : _c, _d = _a.thresholds, thresholds = _d === void 0 ? [] : _d;
|
|
86
|
+
var isPoints = loyalty_perk === 'BANKABLE_POINTS';
|
|
87
|
+
var points = isPoints && credit ? parseInt(credit) : null;
|
|
88
|
+
var _e = status || {}, _f = _e.progress, progress = _f === void 0 ? null : _f, _g = _e.tiers, tiers = _g === void 0 ? [] : _g;
|
|
89
|
+
var tier = tiers.find(function (i) { return i.is_current_tier; }) || null;
|
|
90
|
+
return {
|
|
91
|
+
name: name,
|
|
92
|
+
perkType: loyalty_perk,
|
|
93
|
+
points: points,
|
|
94
|
+
credit: isPoints ? null : credit,
|
|
95
|
+
thresholds: thresholds,
|
|
96
|
+
progress: isPoints && progress ? parseInt(progress) : progress,
|
|
97
|
+
tier: tier
|
|
98
|
+
};
|
|
89
99
|
});
|
|
90
100
|
export var customerReducer = CustomerSlice.reducer;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@open-tender/store",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.91",
|
|
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,8 +61,8 @@
|
|
|
61
61
|
},
|
|
62
62
|
"peerDependencies": {
|
|
63
63
|
"@emotion/react": "^11.11.1",
|
|
64
|
-
"@open-tender/types": "^0.4.
|
|
65
|
-
"@open-tender/ui": "^0.3.
|
|
64
|
+
"@open-tender/types": "^0.4.60",
|
|
65
|
+
"@open-tender/ui": "^0.3.76",
|
|
66
66
|
"@open-tender/utils": "^0.4.39",
|
|
67
67
|
"@reduxjs/toolkit": "^2.0.1",
|
|
68
68
|
"date-fns": "2.30.0",
|