@rpg-engine/long-bow 0.8.72 → 0.8.73

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,7 @@
1
+ import { ICharacterProps } from '../components/Character/CharacterSelection';
2
+ export declare const useCharacterSkinNavigation: (availableCharacters: ICharacterProps[], itemKey: string) => {
3
+ currentIndex: number;
4
+ currentCharacter: ICharacterProps;
5
+ handlePreviousSkin: () => void;
6
+ handleNextSkin: () => void;
7
+ };
@@ -0,0 +1,7 @@
1
+ /// <reference types="react" />
2
+ import { IItemPack } from '@rpg-engine/shared';
3
+ export declare const usePackFiltering: (packs: IItemPack[]) => {
4
+ searchQuery: string;
5
+ setSearchQuery: import("react").Dispatch<import("react").SetStateAction<string>>;
6
+ filteredPacks: IItemPack[];
7
+ };
@@ -0,0 +1,10 @@
1
+ /// <reference types="react" />
2
+ export declare const useQuantityControl: (initialQuantity?: number, min?: number, max?: number) => {
3
+ quantity: number;
4
+ setQuantity: import("react").Dispatch<import("react").SetStateAction<number>>;
5
+ handleQuantityChange: (e: React.ChangeEvent<HTMLInputElement>) => void;
6
+ handleBlur: () => void;
7
+ incrementQuantity: () => void;
8
+ decrementQuantity: () => void;
9
+ resetQuantity: () => void;
10
+ };
@@ -0,0 +1,11 @@
1
+ /// <reference types="react" />
2
+ import { IProductBlueprint, ItemType } from '@rpg-engine/shared';
3
+ import { IOptionsProps } from '../components/Dropdown';
4
+ export declare const useStoreFiltering: (items: IProductBlueprint[]) => {
5
+ searchQuery: string;
6
+ setSearchQuery: import("react").Dispatch<import("react").SetStateAction<string>>;
7
+ selectedCategory: ItemType | "all";
8
+ setSelectedCategory: import("react").Dispatch<import("react").SetStateAction<ItemType | "all">>;
9
+ categoryOptions: IOptionsProps[];
10
+ filteredItems: IProductBlueprint[];
11
+ };
@@ -57966,25 +57966,13 @@ var EmptyMessage$1 = /*#__PURE__*/styled__default.div.withConfig({
57966
57966
  componentId: "sc-xhh2um-8"
57967
57967
  })(["text-align:center;color:#9ca3af;padding:2rem;flex:1;display:flex;align-items:center;justify-content:center;"]);
57968
57968
 
57969
- var StoreCharacterSkinRow = function StoreCharacterSkinRow(_ref) {
57970
- var _item$metadataConfig, _item$metadataConfig2, _item$metadataConfig3, _item$requiredAccount;
57971
- var item = _ref.item,
57972
- atlasJSON = _ref.atlasJSON,
57973
- atlasIMG = _ref.atlasIMG,
57974
- onAddToCart = _ref.onAddToCart,
57975
- userAccountType = _ref.userAccountType;
57969
+ var useCharacterSkinNavigation = function useCharacterSkinNavigation(availableCharacters, itemKey) {
57976
57970
  var _useState = React.useState(0),
57977
57971
  currentIndex = _useState[0],
57978
57972
  setCurrentIndex = _useState[1];
57979
- // Get available characters from metadata
57980
- var availableCharacters = item.metadataType === shared.MetadataType.CharacterSkin && ((_item$metadataConfig = item.metadataConfig) == null ? void 0 : _item$metadataConfig.availableCharacters) || [];
57981
- // Get the active character entity atlas info
57982
- var entityAtlasJSON = (_item$metadataConfig2 = item.metadataConfig) == null ? void 0 : _item$metadataConfig2.atlasJSON;
57983
- var entityAtlasIMG = (_item$metadataConfig3 = item.metadataConfig) == null ? void 0 : _item$metadataConfig3.atlasIMG;
57984
- // Effect to reset currentIndex when switching items
57985
57973
  React.useEffect(function () {
57986
57974
  setCurrentIndex(0);
57987
- }, [item.key]);
57975
+ }, [itemKey]);
57988
57976
  var handlePreviousSkin = function handlePreviousSkin() {
57989
57977
  setCurrentIndex(function (prevIndex) {
57990
57978
  return prevIndex === 0 ? availableCharacters.length - 1 : prevIndex - 1;
@@ -57995,6 +57983,31 @@ var StoreCharacterSkinRow = function StoreCharacterSkinRow(_ref) {
57995
57983
  return prevIndex === availableCharacters.length - 1 ? 0 : prevIndex + 1;
57996
57984
  });
57997
57985
  };
57986
+ var currentCharacter = availableCharacters[currentIndex];
57987
+ return {
57988
+ currentIndex: currentIndex,
57989
+ currentCharacter: currentCharacter,
57990
+ handlePreviousSkin: handlePreviousSkin,
57991
+ handleNextSkin: handleNextSkin
57992
+ };
57993
+ };
57994
+
57995
+ var StoreCharacterSkinRow = function StoreCharacterSkinRow(_ref) {
57996
+ var _item$metadataConfig, _item$metadataConfig2, _item$metadataConfig3, _item$requiredAccount, _item$store;
57997
+ var item = _ref.item,
57998
+ atlasJSON = _ref.atlasJSON,
57999
+ atlasIMG = _ref.atlasIMG,
58000
+ onAddToCart = _ref.onAddToCart,
58001
+ userAccountType = _ref.userAccountType;
58002
+ // Get available characters from metadata
58003
+ var availableCharacters = item.metadataType === shared.MetadataType.CharacterSkin && ((_item$metadataConfig = item.metadataConfig) == null ? void 0 : _item$metadataConfig.availableCharacters) || [];
58004
+ // Get the active character entity atlas info
58005
+ var entityAtlasJSON = (_item$metadataConfig2 = item.metadataConfig) == null ? void 0 : _item$metadataConfig2.atlasJSON;
58006
+ var entityAtlasIMG = (_item$metadataConfig3 = item.metadataConfig) == null ? void 0 : _item$metadataConfig3.atlasIMG;
58007
+ var _useCharacterSkinNavi = useCharacterSkinNavigation(availableCharacters, item.key),
58008
+ currentCharacter = _useCharacterSkinNavi.currentCharacter,
58009
+ handlePreviousSkin = _useCharacterSkinNavi.handlePreviousSkin,
58010
+ handleNextSkin = _useCharacterSkinNavi.handleNextSkin;
57998
58011
  var hasRequiredAccount = !((_item$requiredAccount = item.requiredAccountType) != null && _item$requiredAccount.length) || item.requiredAccountType.includes(userAccountType);
57999
58012
  var handleAddToCart = function handleAddToCart() {
58000
58013
  if (!hasRequiredAccount) return;
@@ -58011,8 +58024,9 @@ var StoreCharacterSkinRow = function StoreCharacterSkinRow(_ref) {
58011
58024
  var getSpriteKey = function getSpriteKey(textureKey) {
58012
58025
  return textureKey + '/down/standing/0.png';
58013
58026
  };
58014
- var currentCharacter = availableCharacters[currentIndex];
58015
- return React__default.createElement(ItemWrapper, null, React__default.createElement(ItemIconContainer$2, null, entityAtlasJSON && entityAtlasIMG && currentCharacter ? React__default.createElement(SpriteFromAtlas, {
58027
+ return React__default.createElement(ItemWrapper, {
58028
+ "$isHighlighted": ((_item$store = item.store) == null ? void 0 : _item$store.isHighlighted) || false
58029
+ }, React__default.createElement(ItemIconContainer$2, null, entityAtlasJSON && entityAtlasIMG && currentCharacter ? React__default.createElement(SpriteFromAtlas, {
58016
58030
  atlasJSON: entityAtlasJSON,
58017
58031
  atlasIMG: entityAtlasIMG,
58018
58032
  spriteKey: getSpriteKey(currentCharacter.textureKey),
@@ -58020,7 +58034,7 @@ var StoreCharacterSkinRow = function StoreCharacterSkinRow(_ref) {
58020
58034
  height: 32,
58021
58035
  imgScale: 2,
58022
58036
  centered: true
58023
- }) : React__default.createElement(SpriteFromAtlas, {
58037
+ }) : item.texturePath ? React__default.createElement(SpriteFromAtlas, {
58024
58038
  atlasJSON: atlasJSON,
58025
58039
  atlasIMG: atlasIMG,
58026
58040
  spriteKey: item.texturePath,
@@ -58028,7 +58042,7 @@ var StoreCharacterSkinRow = function StoreCharacterSkinRow(_ref) {
58028
58042
  height: 32,
58029
58043
  imgScale: 2,
58030
58044
  centered: true
58031
- })), React__default.createElement(ItemDetails$1, null, React__default.createElement(Header$8, null, React__default.createElement(ItemName$1, null, item.name)), availableCharacters.length > 0 && currentCharacter && React__default.createElement(SelectedSkinNav, null, React__default.createElement(SelectedSkin, null, "Selected:"), React__default.createElement(SkinNavArrow, {
58045
+ }) : React__default.createElement(DefaultIcon, null, "\uD83D\uDC64")), React__default.createElement(ItemDetails$1, null, React__default.createElement(Header$8, null, React__default.createElement(ItemName$1, null, item.name)), availableCharacters.length > 0 && currentCharacter && React__default.createElement(SelectedSkinNav, null, React__default.createElement(SelectedSkin, null, "Selected:"), React__default.createElement(SkinNavArrow, {
58032
58046
  direction: "left",
58033
58047
  onPointerDown: handlePreviousSkin,
58034
58048
  size: 24
@@ -58046,7 +58060,11 @@ var StoreCharacterSkinRow = function StoreCharacterSkinRow(_ref) {
58046
58060
  var ItemWrapper = /*#__PURE__*/styled__default.div.withConfig({
58047
58061
  displayName: "StoreCharacterSkinRow__ItemWrapper",
58048
58062
  componentId: "sc-81xqsx-0"
58049
- })(["display:flex;align-items:center;gap:1rem;padding:1rem;border-bottom:1px solid rgba(255,255,255,0.1);&:last-child{border-bottom:none;}"]);
58063
+ })(["display:flex;align-items:center;gap:0.75rem;padding:0.5rem 1rem;border-bottom:1px solid rgba(255,255,255,0.1);background:", ";border-left:", ";&:last-child{border-bottom:none;}"], function (props) {
58064
+ return props.$isHighlighted ? 'rgba(255, 215, 0, 0.1)' : 'transparent';
58065
+ }, function (props) {
58066
+ return props.$isHighlighted ? '3px solid #ffd700' : '3px solid transparent';
58067
+ });
58050
58068
  var ItemIconContainer$2 = /*#__PURE__*/styled__default.div.withConfig({
58051
58069
  displayName: "StoreCharacterSkinRow__ItemIconContainer",
58052
58070
  componentId: "sc-81xqsx-1"
@@ -58054,23 +58072,23 @@ var ItemIconContainer$2 = /*#__PURE__*/styled__default.div.withConfig({
58054
58072
  var ItemDetails$1 = /*#__PURE__*/styled__default.div.withConfig({
58055
58073
  displayName: "StoreCharacterSkinRow__ItemDetails",
58056
58074
  componentId: "sc-81xqsx-2"
58057
- })(["flex:1;display:flex;flex-direction:column;gap:0.5rem;"]);
58075
+ })(["flex:1;display:flex;flex-direction:column;gap:0.25rem;"]);
58058
58076
  var ItemName$1 = /*#__PURE__*/styled__default.div.withConfig({
58059
58077
  displayName: "StoreCharacterSkinRow__ItemName",
58060
58078
  componentId: "sc-81xqsx-3"
58061
- })(["font-family:'Press Start 2P',cursive;font-size:0.875rem;color:#ffffff;"]);
58079
+ })(["font-family:'Press Start 2P',cursive;font-size:0.75rem;color:#ffffff;"]);
58062
58080
  var SelectedSkin = /*#__PURE__*/styled__default.div.withConfig({
58063
58081
  displayName: "StoreCharacterSkinRow__SelectedSkin",
58064
58082
  componentId: "sc-81xqsx-4"
58065
- })(["font-family:'Press Start 2P',cursive;font-size:0.65rem;color:#fef08a;"]);
58083
+ })(["font-family:'Press Start 2P',cursive;font-size:0.5rem;color:#fef08a;"]);
58066
58084
  var ItemPrice = /*#__PURE__*/styled__default.div.withConfig({
58067
58085
  displayName: "StoreCharacterSkinRow__ItemPrice",
58068
58086
  componentId: "sc-81xqsx-5"
58069
- })(["font-family:'Press Start 2P',cursive;font-size:0.75rem;color:#fef08a;"]);
58087
+ })(["font-family:'Press Start 2P',cursive;font-size:0.625rem;color:#fef08a;"]);
58070
58088
  var Controls = /*#__PURE__*/styled__default.div.withConfig({
58071
58089
  displayName: "StoreCharacterSkinRow__Controls",
58072
58090
  componentId: "sc-81xqsx-6"
58073
- })(["display:flex;align-items:center;gap:1rem;min-width:fit-content;"]);
58091
+ })(["display:flex;align-items:center;gap:0.5rem;min-width:fit-content;"]);
58074
58092
  // Styled arrow override for inline nav arrows
58075
58093
  var SkinNavArrow = /*#__PURE__*/styled__default(SelectArrow).withConfig({
58076
58094
  displayName: "StoreCharacterSkinRow__SkinNavArrow",
@@ -58084,42 +58102,77 @@ var SelectedSkinNav = /*#__PURE__*/styled__default.div.withConfig({
58084
58102
  displayName: "StoreCharacterSkinRow__SelectedSkinNav",
58085
58103
  componentId: "sc-81xqsx-9"
58086
58104
  })(["display:flex;align-items:center;gap:0.5rem;"]);
58105
+ var DefaultIcon = /*#__PURE__*/styled__default.div.withConfig({
58106
+ displayName: "StoreCharacterSkinRow__DefaultIcon",
58107
+ componentId: "sc-81xqsx-10"
58108
+ })(["font-size:1.5rem;display:flex;align-items:center;justify-content:center;width:32px;height:32px;"]);
58087
58109
 
58088
- var StoreItemRow = function StoreItemRow(_ref) {
58089
- var _item$requiredAccount;
58090
- var item = _ref.item,
58091
- atlasJSON = _ref.atlasJSON,
58092
- atlasIMG = _ref.atlasIMG,
58093
- onAddToCart = _ref.onAddToCart,
58094
- userAccountType = _ref.userAccountType,
58095
- _ref$showTextInput = _ref.showTextInput,
58096
- showTextInput = _ref$showTextInput === void 0 ? false : _ref$showTextInput,
58097
- _ref$textInputPlaceho = _ref.textInputPlaceholder,
58098
- textInputPlaceholder = _ref$textInputPlaceho === void 0 ? item.inputPlaceholder : _ref$textInputPlaceho;
58099
- var _useState = React.useState(1),
58110
+ var useQuantityControl = function useQuantityControl(initialQuantity, min, max) {
58111
+ if (initialQuantity === void 0) {
58112
+ initialQuantity = 1;
58113
+ }
58114
+ if (min === void 0) {
58115
+ min = 1;
58116
+ }
58117
+ if (max === void 0) {
58118
+ max = 99;
58119
+ }
58120
+ var _useState = React.useState(initialQuantity),
58100
58121
  quantity = _useState[0],
58101
58122
  setQuantity = _useState[1];
58102
- var _useState2 = React.useState(''),
58103
- textInputValue = _useState2[0],
58104
- setTextInputValue = _useState2[1];
58105
58123
  var handleQuantityChange = function handleQuantityChange(e) {
58106
- var value = parseInt(e.target.value) || 1;
58107
- setQuantity(Math.min(Math.max(1, value), 99));
58124
+ var value = parseInt(e.target.value) || min;
58125
+ setQuantity(Math.min(Math.max(min, value), max));
58108
58126
  };
58109
58127
  var handleBlur = function handleBlur() {
58110
- if (quantity < 1) setQuantity(1);
58111
- if (quantity > 99) setQuantity(99);
58128
+ if (quantity < min) setQuantity(min);
58129
+ if (quantity > max) setQuantity(max);
58112
58130
  };
58113
58131
  var incrementQuantity = function incrementQuantity() {
58114
58132
  setQuantity(function (prev) {
58115
- return Math.min(prev + 1, 99);
58133
+ return Math.min(prev + 1, max);
58116
58134
  });
58117
58135
  };
58118
58136
  var decrementQuantity = function decrementQuantity() {
58119
58137
  setQuantity(function (prev) {
58120
- return Math.max(1, prev - 1);
58138
+ return Math.max(min, prev - 1);
58121
58139
  });
58122
58140
  };
58141
+ var resetQuantity = function resetQuantity() {
58142
+ setQuantity(initialQuantity);
58143
+ };
58144
+ return {
58145
+ quantity: quantity,
58146
+ setQuantity: setQuantity,
58147
+ handleQuantityChange: handleQuantityChange,
58148
+ handleBlur: handleBlur,
58149
+ incrementQuantity: incrementQuantity,
58150
+ decrementQuantity: decrementQuantity,
58151
+ resetQuantity: resetQuantity
58152
+ };
58153
+ };
58154
+
58155
+ var StoreItemRow = function StoreItemRow(_ref) {
58156
+ var _item$requiredAccount, _item$store;
58157
+ var item = _ref.item,
58158
+ atlasJSON = _ref.atlasJSON,
58159
+ atlasIMG = _ref.atlasIMG,
58160
+ onAddToCart = _ref.onAddToCart,
58161
+ userAccountType = _ref.userAccountType,
58162
+ _ref$showTextInput = _ref.showTextInput,
58163
+ showTextInput = _ref$showTextInput === void 0 ? false : _ref$showTextInput,
58164
+ _ref$textInputPlaceho = _ref.textInputPlaceholder,
58165
+ textInputPlaceholder = _ref$textInputPlaceho === void 0 ? item.inputPlaceholder : _ref$textInputPlaceho;
58166
+ var _useState = React.useState(''),
58167
+ textInputValue = _useState[0],
58168
+ setTextInputValue = _useState[1];
58169
+ var _useQuantityControl = useQuantityControl(),
58170
+ quantity = _useQuantityControl.quantity,
58171
+ handleQuantityChange = _useQuantityControl.handleQuantityChange,
58172
+ handleBlur = _useQuantityControl.handleBlur,
58173
+ incrementQuantity = _useQuantityControl.incrementQuantity,
58174
+ decrementQuantity = _useQuantityControl.decrementQuantity,
58175
+ resetQuantity = _useQuantityControl.resetQuantity;
58123
58176
  var hasRequiredAccount = !((_item$requiredAccount = item.requiredAccountType) != null && _item$requiredAccount.length) || item.requiredAccountType.includes(userAccountType);
58124
58177
  var handleAddToCartInternal = function handleAddToCartInternal() {
58125
58178
  if (!hasRequiredAccount) return;
@@ -58130,10 +58183,12 @@ var StoreItemRow = function StoreItemRow(_ref) {
58130
58183
  setTextInputValue('');
58131
58184
  } else {
58132
58185
  onAddToCart(item, quantity);
58133
- setQuantity(1);
58186
+ resetQuantity();
58134
58187
  }
58135
58188
  };
58136
- return React__default.createElement(ItemWrapper$1, null, React__default.createElement(ItemIconContainer$3, null, React__default.createElement(SpriteFromAtlas, {
58189
+ return React__default.createElement(ItemWrapper$1, {
58190
+ "$isHighlighted": ((_item$store = item.store) == null ? void 0 : _item$store.isHighlighted) || false
58191
+ }, React__default.createElement(ItemIconContainer$3, null, React__default.createElement(SpriteFromAtlas, {
58137
58192
  atlasJSON: atlasJSON,
58138
58193
  atlasIMG: atlasIMG,
58139
58194
  spriteKey: item.texturePath,
@@ -58175,7 +58230,11 @@ var StoreItemRow = function StoreItemRow(_ref) {
58175
58230
  var ItemWrapper$1 = /*#__PURE__*/styled__default.div.withConfig({
58176
58231
  displayName: "StoreItemRow__ItemWrapper",
58177
58232
  componentId: "sc-ptotuo-0"
58178
- })(["display:flex;align-items:center;gap:1rem;padding:1rem;border-bottom:1px solid rgba(255,255,255,0.1);&:last-child{border-bottom:none;}"]);
58233
+ })(["display:flex;align-items:center;gap:0.75rem;padding:0.5rem 1rem;border-bottom:1px solid rgba(255,255,255,0.1);background:", ";border-left:", ";&:last-child{border-bottom:none;}"], function (props) {
58234
+ return props.$isHighlighted ? 'rgba(255, 215, 0, 0.1)' : 'transparent';
58235
+ }, function (props) {
58236
+ return props.$isHighlighted ? '3px solid #ffd700' : '3px solid transparent';
58237
+ });
58179
58238
  var ItemIconContainer$3 = /*#__PURE__*/styled__default.div.withConfig({
58180
58239
  displayName: "StoreItemRow__ItemIconContainer",
58181
58240
  componentId: "sc-ptotuo-1"
@@ -58183,15 +58242,15 @@ var ItemIconContainer$3 = /*#__PURE__*/styled__default.div.withConfig({
58183
58242
  var ItemDetails$2 = /*#__PURE__*/styled__default.div.withConfig({
58184
58243
  displayName: "StoreItemRow__ItemDetails",
58185
58244
  componentId: "sc-ptotuo-2"
58186
- })(["flex:1;display:flex;flex-direction:column;gap:0.5rem;"]);
58245
+ })(["flex:1;display:flex;flex-direction:column;gap:0.25rem;"]);
58187
58246
  var ItemName$2 = /*#__PURE__*/styled__default.div.withConfig({
58188
58247
  displayName: "StoreItemRow__ItemName",
58189
58248
  componentId: "sc-ptotuo-3"
58190
- })(["font-family:'Press Start 2P',cursive;font-size:0.875rem;color:#ffffff;"]);
58249
+ })(["font-family:'Press Start 2P',cursive;font-size:0.75rem;color:#ffffff;"]);
58191
58250
  var ItemPrice$1 = /*#__PURE__*/styled__default.div.withConfig({
58192
58251
  displayName: "StoreItemRow__ItemPrice",
58193
58252
  componentId: "sc-ptotuo-4"
58194
- })(["font-family:'Press Start 2P',cursive;font-size:0.75rem;color:#fef08a;"]);
58253
+ })(["font-family:'Press Start 2P',cursive;font-size:0.625rem;color:#fef08a;"]);
58195
58254
  var ItemDescription = /*#__PURE__*/styled__default.div.withConfig({
58196
58255
  displayName: "StoreItemRow__ItemDescription",
58197
58256
  componentId: "sc-ptotuo-5"
@@ -58199,7 +58258,7 @@ var ItemDescription = /*#__PURE__*/styled__default.div.withConfig({
58199
58258
  var Controls$1 = /*#__PURE__*/styled__default.div.withConfig({
58200
58259
  displayName: "StoreItemRow__Controls",
58201
58260
  componentId: "sc-ptotuo-6"
58202
- })(["display:flex;align-items:center;gap:1rem;min-width:fit-content;"]);
58261
+ })(["display:flex;align-items:center;gap:0.5rem;min-width:fit-content;"]);
58203
58262
  var ArrowsContainer = /*#__PURE__*/styled__default.div.withConfig({
58204
58263
  displayName: "StoreItemRow__ArrowsContainer",
58205
58264
  componentId: "sc-ptotuo-7"
@@ -58213,6 +58272,50 @@ var TextInput = /*#__PURE__*/styled__default.input.withConfig({
58213
58272
  componentId: "sc-ptotuo-9"
58214
58273
  })(["width:120px;text-align:center;margin:0 auto;font-size:0.875rem;background:rgba(0,0,0,0.2);color:#ffffff;border:none;padding:0.25rem;"]);
58215
58274
 
58275
+ var useStoreFiltering = function useStoreFiltering(items) {
58276
+ var _useState = React.useState(''),
58277
+ searchQuery = _useState[0],
58278
+ setSearchQuery = _useState[1];
58279
+ var _useState2 = React.useState('all'),
58280
+ selectedCategory = _useState2[0],
58281
+ setSelectedCategory = _useState2[1];
58282
+ var categoryOptions = React.useMemo(function () {
58283
+ var uniqueCategories = Array.from(new Set(items.map(function (item) {
58284
+ return item.itemType;
58285
+ })));
58286
+ var allCategories = ['all'].concat(uniqueCategories);
58287
+ return allCategories.map(function (category, index) {
58288
+ return {
58289
+ id: index,
58290
+ value: category,
58291
+ option: category === 'all' ? 'All' : category
58292
+ };
58293
+ });
58294
+ }, [items]);
58295
+ var filteredItems = React.useMemo(function () {
58296
+ return items.filter(function (item) {
58297
+ var matchesSearch = item.name.toLowerCase().includes(searchQuery.toLowerCase());
58298
+ var matchesCategory = selectedCategory === 'all' || item.itemType === selectedCategory;
58299
+ return matchesSearch && matchesCategory;
58300
+ }).sort(function (a, b) {
58301
+ var _a$store, _b$store;
58302
+ var aHighlighted = ((_a$store = a.store) == null ? void 0 : _a$store.isHighlighted) || false;
58303
+ var bHighlighted = ((_b$store = b.store) == null ? void 0 : _b$store.isHighlighted) || false;
58304
+ if (aHighlighted && !bHighlighted) return -1;
58305
+ if (!aHighlighted && bHighlighted) return 1;
58306
+ return 0;
58307
+ });
58308
+ }, [items, searchQuery, selectedCategory]);
58309
+ return {
58310
+ searchQuery: searchQuery,
58311
+ setSearchQuery: setSearchQuery,
58312
+ selectedCategory: selectedCategory,
58313
+ setSelectedCategory: setSelectedCategory,
58314
+ categoryOptions: categoryOptions,
58315
+ filteredItems: filteredItems
58316
+ };
58317
+ };
58318
+
58216
58319
  var StoreItemsSection = function StoreItemsSection(_ref) {
58217
58320
  var items = _ref.items,
58218
58321
  onAddToCart = _ref.onAddToCart,
@@ -58221,12 +58324,12 @@ var StoreItemsSection = function StoreItemsSection(_ref) {
58221
58324
  userAccountType = _ref.userAccountType,
58222
58325
  _ref$textInputItemKey = _ref.textInputItemKeys,
58223
58326
  textInputItemKeys = _ref$textInputItemKey === void 0 ? [] : _ref$textInputItemKey;
58224
- var _useState = React.useState(''),
58225
- searchQuery = _useState[0],
58226
- setSearchQuery = _useState[1];
58227
- var filteredItems = items.filter(function (item) {
58228
- return item.name.toLowerCase().includes(searchQuery.toLowerCase());
58229
- });
58327
+ var _useStoreFiltering = useStoreFiltering(items),
58328
+ searchQuery = _useStoreFiltering.searchQuery,
58329
+ setSearchQuery = _useStoreFiltering.setSearchQuery,
58330
+ setSelectedCategory = _useStoreFiltering.setSelectedCategory,
58331
+ categoryOptions = _useStoreFiltering.categoryOptions,
58332
+ filteredItems = _useStoreFiltering.filteredItems;
58230
58333
  var renderStoreItem = function renderStoreItem(item) {
58231
58334
  // Prefer a specialized character skin row when needed
58232
58335
  if (item.metadataType === shared.MetadataType.CharacterSkin) {
@@ -58261,19 +58364,40 @@ var StoreItemsSection = function StoreItemsSection(_ref) {
58261
58364
  userAccountType: userAccountType || shared.UserAccountTypes.Free
58262
58365
  });
58263
58366
  };
58264
- return React__default.createElement(ScrollableContent, {
58367
+ return React__default.createElement(StoreContainer, null, React__default.createElement(SearchHeader$1, null, React__default.createElement(SearchBarContainer, null, React__default.createElement(SearchBar, {
58368
+ value: searchQuery,
58369
+ onChange: setSearchQuery,
58370
+ placeholder: "Search items..."
58371
+ })), React__default.createElement(DropdownContainer$1, null, React__default.createElement(Dropdown, {
58372
+ options: categoryOptions,
58373
+ onChange: function onChange(value) {
58374
+ return setSelectedCategory(value);
58375
+ },
58376
+ width: "100%"
58377
+ }))), React__default.createElement(ScrollableContent, {
58265
58378
  items: filteredItems,
58266
58379
  renderItem: renderStoreItem,
58267
- emptyMessage: "No items available.",
58268
- searchOptions: {
58269
- value: searchQuery,
58270
- onChange: setSearchQuery,
58271
- placeholder: 'Search items...'
58272
- },
58380
+ emptyMessage: "No items match your filters.",
58273
58381
  layout: "list",
58274
- maxHeight: "400px"
58275
- });
58382
+ maxHeight: "350px"
58383
+ }));
58276
58384
  };
58385
+ var StoreContainer = /*#__PURE__*/styled__default.div.withConfig({
58386
+ displayName: "StoreItemsSection__StoreContainer",
58387
+ componentId: "sc-l6f466-0"
58388
+ })(["display:flex;flex-direction:column;height:100%;gap:0.5rem;"]);
58389
+ var SearchHeader$1 = /*#__PURE__*/styled__default.div.withConfig({
58390
+ displayName: "StoreItemsSection__SearchHeader",
58391
+ componentId: "sc-l6f466-1"
58392
+ })(["display:flex;gap:0.5rem;align-items:center;padding-top:0.25rem;"]);
58393
+ var SearchBarContainer = /*#__PURE__*/styled__default.div.withConfig({
58394
+ displayName: "StoreItemsSection__SearchBarContainer",
58395
+ componentId: "sc-l6f466-2"
58396
+ })(["flex:0.75;"]);
58397
+ var DropdownContainer$1 = /*#__PURE__*/styled__default.div.withConfig({
58398
+ displayName: "StoreItemsSection__DropdownContainer",
58399
+ componentId: "sc-l6f466-3"
58400
+ })(["flex:0.25;min-width:140px;"]);
58277
58401
 
58278
58402
  var ShoppingCardHorizontal = function ShoppingCardHorizontal(_ref) {
58279
58403
  var title = _ref.title,
@@ -58338,13 +58462,30 @@ var CardFooter = /*#__PURE__*/styled__default.div.withConfig({
58338
58462
  componentId: "sc-ngkh06-6"
58339
58463
  })(["margin-top:auto;padding-top:8px;border-top:1px solid rgba(255,255,255,0.1);"]);
58340
58464
 
58465
+ var usePackFiltering = function usePackFiltering(packs) {
58466
+ var _useState = React.useState(''),
58467
+ searchQuery = _useState[0],
58468
+ setSearchQuery = _useState[1];
58469
+ var filteredPacks = React.useMemo(function () {
58470
+ return packs.filter(function (pack) {
58471
+ return pack.title.toLowerCase().includes(searchQuery.toLowerCase());
58472
+ });
58473
+ }, [packs, searchQuery]);
58474
+ return {
58475
+ searchQuery: searchQuery,
58476
+ setSearchQuery: setSearchQuery,
58477
+ filteredPacks: filteredPacks
58478
+ };
58479
+ };
58480
+
58341
58481
  var StorePacksSection = function StorePacksSection(_ref) {
58342
58482
  var packs = _ref.packs,
58343
58483
  onAddToCart = _ref.onAddToCart,
58344
58484
  onSelectPack = _ref.onSelectPack;
58345
- var _useState = React.useState(''),
58346
- searchQuery = _useState[0],
58347
- setSearchQuery = _useState[1];
58485
+ var _usePackFiltering = usePackFiltering(packs),
58486
+ searchQuery = _usePackFiltering.searchQuery,
58487
+ setSearchQuery = _usePackFiltering.setSearchQuery,
58488
+ filteredPacks = _usePackFiltering.filteredPacks;
58348
58489
  var renderPackFooter = React.useCallback(function (pack) {
58349
58490
  return React__default.createElement(FooterContainer, null, React__default.createElement(Price, null, "$", pack.priceUSD), React__default.createElement(CTAButton, {
58350
58491
  icon: React__default.createElement(fa.FaCartPlus, null),
@@ -58367,11 +58508,6 @@ var StorePacksSection = function StorePacksSection(_ref) {
58367
58508
  }
58368
58509
  });
58369
58510
  }, [onSelectPack, renderPackFooter]);
58370
- var filteredPacks = React.useMemo(function () {
58371
- return packs.filter(function (pack) {
58372
- return pack.title.toLowerCase().includes(searchQuery.toLowerCase());
58373
- });
58374
- }, [packs, searchQuery]);
58375
58511
  return React__default.createElement(ScrollableContent, {
58376
58512
  items: filteredPacks,
58377
58513
  renderItem: renderPack,