@rpg-engine/long-bow 0.8.71 → 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.
Files changed (34) hide show
  1. package/dist/components/Store/CartView.d.ts +7 -6
  2. package/dist/components/Store/Store.d.ts +2 -2
  3. package/dist/components/Store/StoreCharacterSkinRow.d.ts +3 -3
  4. package/dist/components/Store/StoreItemDetails.d.ts +3 -3
  5. package/dist/components/Store/StoreItemRow.d.ts +4 -3
  6. package/dist/components/Store/hooks/useStoreCart.d.ts +5 -3
  7. package/dist/components/Store/hooks/useStoreMetadata.d.ts +3 -3
  8. package/dist/components/Store/sections/StoreItemsSection.d.ts +3 -3
  9. package/dist/hooks/useCharacterSkinNavigation.d.ts +7 -0
  10. package/dist/hooks/usePackFiltering.d.ts +7 -0
  11. package/dist/hooks/useQuantityControl.d.ts +10 -0
  12. package/dist/hooks/useStoreFiltering.d.ts +11 -0
  13. package/dist/long-bow.cjs.development.js +264 -112
  14. package/dist/long-bow.cjs.development.js.map +1 -1
  15. package/dist/long-bow.cjs.production.min.js +1 -1
  16. package/dist/long-bow.cjs.production.min.js.map +1 -1
  17. package/dist/long-bow.esm.js +265 -113
  18. package/dist/long-bow.esm.js.map +1 -1
  19. package/package.json +2 -2
  20. package/src/components/Store/CartView.tsx +9 -6
  21. package/src/components/Store/Store.tsx +13 -21
  22. package/src/components/Store/StoreCharacterSkinRow.tsx +64 -46
  23. package/src/components/Store/StoreItemDetails.tsx +4 -4
  24. package/src/components/Store/StoreItemRow.tsx +64 -56
  25. package/src/components/Store/hooks/useStoreCart.ts +14 -9
  26. package/src/components/Store/hooks/useStoreMetadata.ts +5 -5
  27. package/src/components/Store/sections/StoreItemsSection.tsx +78 -27
  28. package/src/components/Store/sections/StorePacksSection.tsx +5 -10
  29. package/src/hooks/useCharacterSkinNavigation.ts +34 -0
  30. package/src/hooks/usePackFiltering.ts +20 -0
  31. package/src/hooks/useQuantityControl.ts +41 -0
  32. package/src/hooks/useStoreFiltering.ts +51 -0
  33. package/src/mocks/dailyTasks.mocks.ts +6 -6
  34. package/src/stories/Features/store/Store.stories.tsx +59 -72
@@ -2,7 +2,7 @@ import React, { useState, useEffect, Component, useRef, useCallback, useContext,
2
2
  import styled, { css, keyframes, createGlobalStyle } from 'styled-components';
3
3
  import { BeatLoader } from 'react-spinners';
4
4
  import { v4 } from 'uuid';
5
- import { GRID_WIDTH, GRID_HEIGHT, ShortcutType, getItemTextureKeyPath, ItemContainerType, ItemType, DepotSocketEvents, ItemSocketEvents, ItemSocketEventsDisplayLabels, ActionsForInventory, ActionsForEquipmentSet, ActionsForLoot, ActionsForMapContainer, ItemQualityLevel, ItemRarities, ItemSubType, isMobile, TaskType, TaskStatus, RewardType, isMobileOrTablet, ItemSlotType, NPCSubtype, EntityAttackType, NPCAlignment, VideoGuideCategory, VideoGuideLanguage, CharacterClass, QuestStatus, getSPForLevel, getXPForLevel, MetadataType, PurchaseType, UserAccountTypes, PeriodOfDay } from '@rpg-engine/shared';
5
+ import { GRID_WIDTH, GRID_HEIGHT, ShortcutType, getItemTextureKeyPath, ItemContainerType, ItemType, DepotSocketEvents, ItemSocketEvents, ItemSocketEventsDisplayLabels, ActionsForInventory, ActionsForEquipmentSet, ActionsForLoot, ActionsForMapContainer, ItemQualityLevel, ItemRarities, ItemSubType, isMobile, TaskType, TaskStatus, RewardType, isMobileOrTablet, ItemSlotType, NPCSubtype, EntityAttackType, NPCAlignment, VideoGuideCategory, VideoGuideLanguage, CharacterClass, QuestStatus, getSPForLevel, getXPForLevel, MetadataType, PurchaseType, UserAccountTypes, PaymentCurrency, PeriodOfDay } from '@rpg-engine/shared';
6
6
  import dayjs from 'dayjs';
7
7
  import { ErrorBoundary as ErrorBoundary$1 } from 'react-error-boundary';
8
8
  import { FaTimes, FaDiscord, FaWhatsapp, FaSearch, FaThumbtack, FaBoxOpen, FaChevronLeft, FaChevronRight, FaChevronUp, FaChevronDown, FaReddit, FaTrash, FaShoppingBag, FaInfoCircle, FaCartPlus, FaArrowLeft, FaHistory, FaShoppingCart } from 'react-icons/fa';
@@ -57631,7 +57631,7 @@ var useStoreMetadata = function useStoreMetadata() {
57631
57631
  return _regeneratorRuntime().wrap(function _callee$(_context) {
57632
57632
  while (1) switch (_context.prev = _context.next) {
57633
57633
  case 0:
57634
- if (!(!item.metadataType || item.metadataType === MetadataType.None)) {
57634
+ if (!(!item.metadataType || item.metadataType !== MetadataType.CharacterSkin)) {
57635
57635
  _context.next = 2;
57636
57636
  break;
57637
57637
  }
@@ -57711,7 +57711,7 @@ var useStoreCart = function useStoreCart() {
57711
57711
  });
57712
57712
  return _context.abrupt("return");
57713
57713
  case 3:
57714
- if (!(item.metadataType && item.metadataType !== MetadataType.None)) {
57714
+ if (!(item.metadataType === MetadataType.CharacterSkin)) {
57715
57715
  _context.next = 12;
57716
57716
  break;
57717
57717
  }
@@ -57827,7 +57827,11 @@ var useStoreCart = function useStoreCart() {
57827
57827
  };
57828
57828
  // Helper functions
57829
57829
  function getPurchaseType(item) {
57830
- // Check if the item comes from a pack based on naming convention or other property
57830
+ // Use the type from IProductBlueprint if available, otherwise infer
57831
+ if (item.type) {
57832
+ return item.type;
57833
+ }
57834
+ // Fallback logic for backward compatibility
57831
57835
  if (item.key.startsWith('pack_')) {
57832
57836
  return PurchaseType.Pack;
57833
57837
  } else {
@@ -57959,25 +57963,13 @@ var EmptyMessage$1 = /*#__PURE__*/styled.div.withConfig({
57959
57963
  componentId: "sc-xhh2um-8"
57960
57964
  })(["text-align:center;color:#9ca3af;padding:2rem;flex:1;display:flex;align-items:center;justify-content:center;"]);
57961
57965
 
57962
- var StoreCharacterSkinRow = function StoreCharacterSkinRow(_ref) {
57963
- var _item$metadataConfig, _item$metadataConfig2, _item$metadataConfig3, _item$requiredAccount;
57964
- var item = _ref.item,
57965
- atlasJSON = _ref.atlasJSON,
57966
- atlasIMG = _ref.atlasIMG,
57967
- onAddToCart = _ref.onAddToCart,
57968
- userAccountType = _ref.userAccountType;
57966
+ var useCharacterSkinNavigation = function useCharacterSkinNavigation(availableCharacters, itemKey) {
57969
57967
  var _useState = useState(0),
57970
57968
  currentIndex = _useState[0],
57971
57969
  setCurrentIndex = _useState[1];
57972
- // Get available characters from metadata
57973
- var availableCharacters = item.metadataType === MetadataType.CharacterSkin && ((_item$metadataConfig = item.metadataConfig) == null ? void 0 : _item$metadataConfig.availableCharacters) || [];
57974
- // Get the active character entity atlas info
57975
- var entityAtlasJSON = (_item$metadataConfig2 = item.metadataConfig) == null ? void 0 : _item$metadataConfig2.atlasJSON;
57976
- var entityAtlasIMG = (_item$metadataConfig3 = item.metadataConfig) == null ? void 0 : _item$metadataConfig3.atlasIMG;
57977
- // Effect to reset currentIndex when switching items
57978
57970
  useEffect(function () {
57979
57971
  setCurrentIndex(0);
57980
- }, [item._id]);
57972
+ }, [itemKey]);
57981
57973
  var handlePreviousSkin = function handlePreviousSkin() {
57982
57974
  setCurrentIndex(function (prevIndex) {
57983
57975
  return prevIndex === 0 ? availableCharacters.length - 1 : prevIndex - 1;
@@ -57988,6 +57980,31 @@ var StoreCharacterSkinRow = function StoreCharacterSkinRow(_ref) {
57988
57980
  return prevIndex === availableCharacters.length - 1 ? 0 : prevIndex + 1;
57989
57981
  });
57990
57982
  };
57983
+ var currentCharacter = availableCharacters[currentIndex];
57984
+ return {
57985
+ currentIndex: currentIndex,
57986
+ currentCharacter: currentCharacter,
57987
+ handlePreviousSkin: handlePreviousSkin,
57988
+ handleNextSkin: handleNextSkin
57989
+ };
57990
+ };
57991
+
57992
+ var StoreCharacterSkinRow = function StoreCharacterSkinRow(_ref) {
57993
+ var _item$metadataConfig, _item$metadataConfig2, _item$metadataConfig3, _item$requiredAccount, _item$store;
57994
+ var item = _ref.item,
57995
+ atlasJSON = _ref.atlasJSON,
57996
+ atlasIMG = _ref.atlasIMG,
57997
+ onAddToCart = _ref.onAddToCart,
57998
+ userAccountType = _ref.userAccountType;
57999
+ // Get available characters from metadata
58000
+ var availableCharacters = item.metadataType === MetadataType.CharacterSkin && ((_item$metadataConfig = item.metadataConfig) == null ? void 0 : _item$metadataConfig.availableCharacters) || [];
58001
+ // Get the active character entity atlas info
58002
+ var entityAtlasJSON = (_item$metadataConfig2 = item.metadataConfig) == null ? void 0 : _item$metadataConfig2.atlasJSON;
58003
+ var entityAtlasIMG = (_item$metadataConfig3 = item.metadataConfig) == null ? void 0 : _item$metadataConfig3.atlasIMG;
58004
+ var _useCharacterSkinNavi = useCharacterSkinNavigation(availableCharacters, item.key),
58005
+ currentCharacter = _useCharacterSkinNavi.currentCharacter,
58006
+ handlePreviousSkin = _useCharacterSkinNavi.handlePreviousSkin,
58007
+ handleNextSkin = _useCharacterSkinNavi.handleNextSkin;
57991
58008
  var hasRequiredAccount = !((_item$requiredAccount = item.requiredAccountType) != null && _item$requiredAccount.length) || item.requiredAccountType.includes(userAccountType);
57992
58009
  var handleAddToCart = function handleAddToCart() {
57993
58010
  if (!hasRequiredAccount) return;
@@ -58004,8 +58021,9 @@ var StoreCharacterSkinRow = function StoreCharacterSkinRow(_ref) {
58004
58021
  var getSpriteKey = function getSpriteKey(textureKey) {
58005
58022
  return textureKey + '/down/standing/0.png';
58006
58023
  };
58007
- var currentCharacter = availableCharacters[currentIndex];
58008
- return React.createElement(ItemWrapper, null, React.createElement(ItemIconContainer$2, null, entityAtlasJSON && entityAtlasIMG && currentCharacter ? React.createElement(SpriteFromAtlas, {
58024
+ return React.createElement(ItemWrapper, {
58025
+ "$isHighlighted": ((_item$store = item.store) == null ? void 0 : _item$store.isHighlighted) || false
58026
+ }, React.createElement(ItemIconContainer$2, null, entityAtlasJSON && entityAtlasIMG && currentCharacter ? React.createElement(SpriteFromAtlas, {
58009
58027
  atlasJSON: entityAtlasJSON,
58010
58028
  atlasIMG: entityAtlasIMG,
58011
58029
  spriteKey: getSpriteKey(currentCharacter.textureKey),
@@ -58013,7 +58031,7 @@ var StoreCharacterSkinRow = function StoreCharacterSkinRow(_ref) {
58013
58031
  height: 32,
58014
58032
  imgScale: 2,
58015
58033
  centered: true
58016
- }) : React.createElement(SpriteFromAtlas, {
58034
+ }) : item.texturePath ? React.createElement(SpriteFromAtlas, {
58017
58035
  atlasJSON: atlasJSON,
58018
58036
  atlasIMG: atlasIMG,
58019
58037
  spriteKey: item.texturePath,
@@ -58021,7 +58039,7 @@ var StoreCharacterSkinRow = function StoreCharacterSkinRow(_ref) {
58021
58039
  height: 32,
58022
58040
  imgScale: 2,
58023
58041
  centered: true
58024
- })), React.createElement(ItemDetails$1, null, React.createElement(Header$8, null, React.createElement(ItemName$1, null, item.name)), availableCharacters.length > 0 && currentCharacter && React.createElement(SelectedSkinNav, null, React.createElement(SelectedSkin, null, "Selected:"), React.createElement(SkinNavArrow, {
58042
+ }) : React.createElement(DefaultIcon, null, "\uD83D\uDC64")), React.createElement(ItemDetails$1, null, React.createElement(Header$8, null, React.createElement(ItemName$1, null, item.name)), availableCharacters.length > 0 && currentCharacter && React.createElement(SelectedSkinNav, null, React.createElement(SelectedSkin, null, "Selected:"), React.createElement(SkinNavArrow, {
58025
58043
  direction: "left",
58026
58044
  onPointerDown: handlePreviousSkin,
58027
58045
  size: 24
@@ -58039,7 +58057,11 @@ var StoreCharacterSkinRow = function StoreCharacterSkinRow(_ref) {
58039
58057
  var ItemWrapper = /*#__PURE__*/styled.div.withConfig({
58040
58058
  displayName: "StoreCharacterSkinRow__ItemWrapper",
58041
58059
  componentId: "sc-81xqsx-0"
58042
- })(["display:flex;align-items:center;gap:1rem;padding:1rem;border-bottom:1px solid rgba(255,255,255,0.1);&:last-child{border-bottom:none;}"]);
58060
+ })(["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) {
58061
+ return props.$isHighlighted ? 'rgba(255, 215, 0, 0.1)' : 'transparent';
58062
+ }, function (props) {
58063
+ return props.$isHighlighted ? '3px solid #ffd700' : '3px solid transparent';
58064
+ });
58043
58065
  var ItemIconContainer$2 = /*#__PURE__*/styled.div.withConfig({
58044
58066
  displayName: "StoreCharacterSkinRow__ItemIconContainer",
58045
58067
  componentId: "sc-81xqsx-1"
@@ -58047,23 +58069,23 @@ var ItemIconContainer$2 = /*#__PURE__*/styled.div.withConfig({
58047
58069
  var ItemDetails$1 = /*#__PURE__*/styled.div.withConfig({
58048
58070
  displayName: "StoreCharacterSkinRow__ItemDetails",
58049
58071
  componentId: "sc-81xqsx-2"
58050
- })(["flex:1;display:flex;flex-direction:column;gap:0.5rem;"]);
58072
+ })(["flex:1;display:flex;flex-direction:column;gap:0.25rem;"]);
58051
58073
  var ItemName$1 = /*#__PURE__*/styled.div.withConfig({
58052
58074
  displayName: "StoreCharacterSkinRow__ItemName",
58053
58075
  componentId: "sc-81xqsx-3"
58054
- })(["font-family:'Press Start 2P',cursive;font-size:0.875rem;color:#ffffff;"]);
58076
+ })(["font-family:'Press Start 2P',cursive;font-size:0.75rem;color:#ffffff;"]);
58055
58077
  var SelectedSkin = /*#__PURE__*/styled.div.withConfig({
58056
58078
  displayName: "StoreCharacterSkinRow__SelectedSkin",
58057
58079
  componentId: "sc-81xqsx-4"
58058
- })(["font-family:'Press Start 2P',cursive;font-size:0.65rem;color:#fef08a;"]);
58080
+ })(["font-family:'Press Start 2P',cursive;font-size:0.5rem;color:#fef08a;"]);
58059
58081
  var ItemPrice = /*#__PURE__*/styled.div.withConfig({
58060
58082
  displayName: "StoreCharacterSkinRow__ItemPrice",
58061
58083
  componentId: "sc-81xqsx-5"
58062
- })(["font-family:'Press Start 2P',cursive;font-size:0.75rem;color:#fef08a;"]);
58084
+ })(["font-family:'Press Start 2P',cursive;font-size:0.625rem;color:#fef08a;"]);
58063
58085
  var Controls = /*#__PURE__*/styled.div.withConfig({
58064
58086
  displayName: "StoreCharacterSkinRow__Controls",
58065
58087
  componentId: "sc-81xqsx-6"
58066
- })(["display:flex;align-items:center;gap:1rem;min-width:fit-content;"]);
58088
+ })(["display:flex;align-items:center;gap:0.5rem;min-width:fit-content;"]);
58067
58089
  // Styled arrow override for inline nav arrows
58068
58090
  var SkinNavArrow = /*#__PURE__*/styled(SelectArrow).withConfig({
58069
58091
  displayName: "StoreCharacterSkinRow__SkinNavArrow",
@@ -58077,40 +58099,77 @@ var SelectedSkinNav = /*#__PURE__*/styled.div.withConfig({
58077
58099
  displayName: "StoreCharacterSkinRow__SelectedSkinNav",
58078
58100
  componentId: "sc-81xqsx-9"
58079
58101
  })(["display:flex;align-items:center;gap:0.5rem;"]);
58102
+ var DefaultIcon = /*#__PURE__*/styled.div.withConfig({
58103
+ displayName: "StoreCharacterSkinRow__DefaultIcon",
58104
+ componentId: "sc-81xqsx-10"
58105
+ })(["font-size:1.5rem;display:flex;align-items:center;justify-content:center;width:32px;height:32px;"]);
58080
58106
 
58081
- var StoreItemRow = function StoreItemRow(_ref) {
58082
- var _item$requiredAccount;
58083
- var item = _ref.item,
58084
- atlasJSON = _ref.atlasJSON,
58085
- atlasIMG = _ref.atlasIMG,
58086
- onAddToCart = _ref.onAddToCart,
58087
- userAccountType = _ref.userAccountType,
58088
- _ref$showTextInput = _ref.showTextInput,
58089
- showTextInput = _ref$showTextInput === void 0 ? false : _ref$showTextInput;
58090
- var _useState = useState(1),
58107
+ var useQuantityControl = function useQuantityControl(initialQuantity, min, max) {
58108
+ if (initialQuantity === void 0) {
58109
+ initialQuantity = 1;
58110
+ }
58111
+ if (min === void 0) {
58112
+ min = 1;
58113
+ }
58114
+ if (max === void 0) {
58115
+ max = 99;
58116
+ }
58117
+ var _useState = useState(initialQuantity),
58091
58118
  quantity = _useState[0],
58092
58119
  setQuantity = _useState[1];
58093
- var _useState2 = useState(''),
58094
- textInputValue = _useState2[0],
58095
- setTextInputValue = _useState2[1];
58096
58120
  var handleQuantityChange = function handleQuantityChange(e) {
58097
- var value = parseInt(e.target.value) || 1;
58098
- setQuantity(Math.min(Math.max(1, value), 99));
58121
+ var value = parseInt(e.target.value) || min;
58122
+ setQuantity(Math.min(Math.max(min, value), max));
58099
58123
  };
58100
58124
  var handleBlur = function handleBlur() {
58101
- if (quantity < 1) setQuantity(1);
58102
- if (quantity > 99) setQuantity(99);
58125
+ if (quantity < min) setQuantity(min);
58126
+ if (quantity > max) setQuantity(max);
58103
58127
  };
58104
58128
  var incrementQuantity = function incrementQuantity() {
58105
58129
  setQuantity(function (prev) {
58106
- return Math.min(prev + 1, 99);
58130
+ return Math.min(prev + 1, max);
58107
58131
  });
58108
58132
  };
58109
58133
  var decrementQuantity = function decrementQuantity() {
58110
58134
  setQuantity(function (prev) {
58111
- return Math.max(1, prev - 1);
58135
+ return Math.max(min, prev - 1);
58112
58136
  });
58113
58137
  };
58138
+ var resetQuantity = function resetQuantity() {
58139
+ setQuantity(initialQuantity);
58140
+ };
58141
+ return {
58142
+ quantity: quantity,
58143
+ setQuantity: setQuantity,
58144
+ handleQuantityChange: handleQuantityChange,
58145
+ handleBlur: handleBlur,
58146
+ incrementQuantity: incrementQuantity,
58147
+ decrementQuantity: decrementQuantity,
58148
+ resetQuantity: resetQuantity
58149
+ };
58150
+ };
58151
+
58152
+ var StoreItemRow = function StoreItemRow(_ref) {
58153
+ var _item$requiredAccount, _item$store;
58154
+ var item = _ref.item,
58155
+ atlasJSON = _ref.atlasJSON,
58156
+ atlasIMG = _ref.atlasIMG,
58157
+ onAddToCart = _ref.onAddToCart,
58158
+ userAccountType = _ref.userAccountType,
58159
+ _ref$showTextInput = _ref.showTextInput,
58160
+ showTextInput = _ref$showTextInput === void 0 ? false : _ref$showTextInput,
58161
+ _ref$textInputPlaceho = _ref.textInputPlaceholder,
58162
+ textInputPlaceholder = _ref$textInputPlaceho === void 0 ? item.inputPlaceholder : _ref$textInputPlaceho;
58163
+ var _useState = useState(''),
58164
+ textInputValue = _useState[0],
58165
+ setTextInputValue = _useState[1];
58166
+ var _useQuantityControl = useQuantityControl(),
58167
+ quantity = _useQuantityControl.quantity,
58168
+ handleQuantityChange = _useQuantityControl.handleQuantityChange,
58169
+ handleBlur = _useQuantityControl.handleBlur,
58170
+ incrementQuantity = _useQuantityControl.incrementQuantity,
58171
+ decrementQuantity = _useQuantityControl.decrementQuantity,
58172
+ resetQuantity = _useQuantityControl.resetQuantity;
58114
58173
  var hasRequiredAccount = !((_item$requiredAccount = item.requiredAccountType) != null && _item$requiredAccount.length) || item.requiredAccountType.includes(userAccountType);
58115
58174
  var handleAddToCartInternal = function handleAddToCartInternal() {
58116
58175
  if (!hasRequiredAccount) return;
@@ -58121,10 +58180,12 @@ var StoreItemRow = function StoreItemRow(_ref) {
58121
58180
  setTextInputValue('');
58122
58181
  } else {
58123
58182
  onAddToCart(item, quantity);
58124
- setQuantity(1);
58183
+ resetQuantity();
58125
58184
  }
58126
58185
  };
58127
- return React.createElement(ItemWrapper$1, null, React.createElement(ItemIconContainer$3, null, React.createElement(SpriteFromAtlas, {
58186
+ return React.createElement(ItemWrapper$1, {
58187
+ "$isHighlighted": ((_item$store = item.store) == null ? void 0 : _item$store.isHighlighted) || false
58188
+ }, React.createElement(ItemIconContainer$3, null, React.createElement(SpriteFromAtlas, {
58128
58189
  atlasJSON: atlasJSON,
58129
58190
  atlasIMG: atlasIMG,
58130
58191
  spriteKey: item.texturePath,
@@ -58132,10 +58193,10 @@ var StoreItemRow = function StoreItemRow(_ref) {
58132
58193
  height: 32,
58133
58194
  imgScale: 2,
58134
58195
  centered: true
58135
- })), React.createElement(ItemDetails$2, null, React.createElement(ItemName$2, null, item.name), React.createElement(ItemPrice$1, null, "$", item.price)), React.createElement(Controls$1, null, showTextInput ? React.createElement(TextInput, {
58196
+ })), React.createElement(ItemDetails$2, null, React.createElement(ItemName$2, null, item.name), React.createElement(ItemPrice$1, null, "$", item.price), React.createElement(ItemDescription, null, item.description)), React.createElement(Controls$1, null, showTextInput ? React.createElement(TextInput, {
58136
58197
  type: "text",
58137
58198
  value: textInputValue,
58138
- placeholder: "Enter value",
58199
+ placeholder: textInputPlaceholder,
58139
58200
  onChange: function onChange(e) {
58140
58201
  return setTextInputValue(e.target.value);
58141
58202
  },
@@ -58166,7 +58227,11 @@ var StoreItemRow = function StoreItemRow(_ref) {
58166
58227
  var ItemWrapper$1 = /*#__PURE__*/styled.div.withConfig({
58167
58228
  displayName: "StoreItemRow__ItemWrapper",
58168
58229
  componentId: "sc-ptotuo-0"
58169
- })(["display:flex;align-items:center;gap:1rem;padding:1rem;border-bottom:1px solid rgba(255,255,255,0.1);&:last-child{border-bottom:none;}"]);
58230
+ })(["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) {
58231
+ return props.$isHighlighted ? 'rgba(255, 215, 0, 0.1)' : 'transparent';
58232
+ }, function (props) {
58233
+ return props.$isHighlighted ? '3px solid #ffd700' : '3px solid transparent';
58234
+ });
58170
58235
  var ItemIconContainer$3 = /*#__PURE__*/styled.div.withConfig({
58171
58236
  displayName: "StoreItemRow__ItemIconContainer",
58172
58237
  componentId: "sc-ptotuo-1"
@@ -58174,32 +58239,80 @@ var ItemIconContainer$3 = /*#__PURE__*/styled.div.withConfig({
58174
58239
  var ItemDetails$2 = /*#__PURE__*/styled.div.withConfig({
58175
58240
  displayName: "StoreItemRow__ItemDetails",
58176
58241
  componentId: "sc-ptotuo-2"
58177
- })(["flex:1;display:flex;flex-direction:column;gap:0.5rem;"]);
58242
+ })(["flex:1;display:flex;flex-direction:column;gap:0.25rem;"]);
58178
58243
  var ItemName$2 = /*#__PURE__*/styled.div.withConfig({
58179
58244
  displayName: "StoreItemRow__ItemName",
58180
58245
  componentId: "sc-ptotuo-3"
58181
- })(["font-family:'Press Start 2P',cursive;font-size:0.875rem;color:#ffffff;"]);
58246
+ })(["font-family:'Press Start 2P',cursive;font-size:0.75rem;color:#ffffff;"]);
58182
58247
  var ItemPrice$1 = /*#__PURE__*/styled.div.withConfig({
58183
58248
  displayName: "StoreItemRow__ItemPrice",
58184
58249
  componentId: "sc-ptotuo-4"
58185
- })(["font-family:'Press Start 2P',cursive;font-size:0.75rem;color:#fef08a;"]);
58250
+ })(["font-family:'Press Start 2P',cursive;font-size:0.625rem;color:#fef08a;"]);
58251
+ var ItemDescription = /*#__PURE__*/styled.div.withConfig({
58252
+ displayName: "StoreItemRow__ItemDescription",
58253
+ componentId: "sc-ptotuo-5"
58254
+ })(["font-family:'Press Start 2P',cursive;font-size:0.625rem;color:rgba(255,255,255,0.7);line-height:1.4;"]);
58186
58255
  var Controls$1 = /*#__PURE__*/styled.div.withConfig({
58187
58256
  displayName: "StoreItemRow__Controls",
58188
- componentId: "sc-ptotuo-5"
58189
- })(["display:flex;align-items:center;gap:1rem;min-width:fit-content;"]);
58257
+ componentId: "sc-ptotuo-6"
58258
+ })(["display:flex;align-items:center;gap:0.5rem;min-width:fit-content;"]);
58190
58259
  var ArrowsContainer = /*#__PURE__*/styled.div.withConfig({
58191
58260
  displayName: "StoreItemRow__ArrowsContainer",
58192
- componentId: "sc-ptotuo-6"
58261
+ componentId: "sc-ptotuo-7"
58193
58262
  })(["position:relative;display:flex;align-items:center;width:120px;height:42px;justify-content:space-between;"]);
58194
58263
  var QuantityInput = /*#__PURE__*/styled.input.withConfig({
58195
58264
  displayName: "StoreItemRow__QuantityInput",
58196
- componentId: "sc-ptotuo-7"
58265
+ componentId: "sc-ptotuo-8"
58197
58266
  })(["width:40px;text-align:center;margin:0 auto;font-size:0.875rem;background:rgba(0,0,0,0.2);color:#ffffff;border:none;padding:0.25rem;&::-webkit-inner-spin-button,&::-webkit-outer-spin-button{-webkit-appearance:none;margin:0;}"]);
58198
58267
  var TextInput = /*#__PURE__*/styled.input.withConfig({
58199
58268
  displayName: "StoreItemRow__TextInput",
58200
- componentId: "sc-ptotuo-8"
58269
+ componentId: "sc-ptotuo-9"
58201
58270
  })(["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;"]);
58202
58271
 
58272
+ var useStoreFiltering = function useStoreFiltering(items) {
58273
+ var _useState = useState(''),
58274
+ searchQuery = _useState[0],
58275
+ setSearchQuery = _useState[1];
58276
+ var _useState2 = useState('all'),
58277
+ selectedCategory = _useState2[0],
58278
+ setSelectedCategory = _useState2[1];
58279
+ var categoryOptions = useMemo(function () {
58280
+ var uniqueCategories = Array.from(new Set(items.map(function (item) {
58281
+ return item.itemType;
58282
+ })));
58283
+ var allCategories = ['all'].concat(uniqueCategories);
58284
+ return allCategories.map(function (category, index) {
58285
+ return {
58286
+ id: index,
58287
+ value: category,
58288
+ option: category === 'all' ? 'All' : category
58289
+ };
58290
+ });
58291
+ }, [items]);
58292
+ var filteredItems = useMemo(function () {
58293
+ return items.filter(function (item) {
58294
+ var matchesSearch = item.name.toLowerCase().includes(searchQuery.toLowerCase());
58295
+ var matchesCategory = selectedCategory === 'all' || item.itemType === selectedCategory;
58296
+ return matchesSearch && matchesCategory;
58297
+ }).sort(function (a, b) {
58298
+ var _a$store, _b$store;
58299
+ var aHighlighted = ((_a$store = a.store) == null ? void 0 : _a$store.isHighlighted) || false;
58300
+ var bHighlighted = ((_b$store = b.store) == null ? void 0 : _b$store.isHighlighted) || false;
58301
+ if (aHighlighted && !bHighlighted) return -1;
58302
+ if (!aHighlighted && bHighlighted) return 1;
58303
+ return 0;
58304
+ });
58305
+ }, [items, searchQuery, selectedCategory]);
58306
+ return {
58307
+ searchQuery: searchQuery,
58308
+ setSearchQuery: setSearchQuery,
58309
+ selectedCategory: selectedCategory,
58310
+ setSelectedCategory: setSelectedCategory,
58311
+ categoryOptions: categoryOptions,
58312
+ filteredItems: filteredItems
58313
+ };
58314
+ };
58315
+
58203
58316
  var StoreItemsSection = function StoreItemsSection(_ref) {
58204
58317
  var items = _ref.items,
58205
58318
  onAddToCart = _ref.onAddToCart,
@@ -58208,17 +58321,17 @@ var StoreItemsSection = function StoreItemsSection(_ref) {
58208
58321
  userAccountType = _ref.userAccountType,
58209
58322
  _ref$textInputItemKey = _ref.textInputItemKeys,
58210
58323
  textInputItemKeys = _ref$textInputItemKey === void 0 ? [] : _ref$textInputItemKey;
58211
- var _useState = useState(''),
58212
- searchQuery = _useState[0],
58213
- setSearchQuery = _useState[1];
58214
- var filteredItems = items.filter(function (item) {
58215
- return item.name.toLowerCase().includes(searchQuery.toLowerCase());
58216
- });
58324
+ var _useStoreFiltering = useStoreFiltering(items),
58325
+ searchQuery = _useStoreFiltering.searchQuery,
58326
+ setSearchQuery = _useStoreFiltering.setSearchQuery,
58327
+ setSelectedCategory = _useStoreFiltering.setSelectedCategory,
58328
+ categoryOptions = _useStoreFiltering.categoryOptions,
58329
+ filteredItems = _useStoreFiltering.filteredItems;
58217
58330
  var renderStoreItem = function renderStoreItem(item) {
58218
58331
  // Prefer a specialized character skin row when needed
58219
58332
  if (item.metadataType === MetadataType.CharacterSkin) {
58220
58333
  return React.createElement(StoreCharacterSkinRow, {
58221
- key: item._id,
58334
+ key: item.key,
58222
58335
  item: item,
58223
58336
  atlasJSON: atlasJSON,
58224
58337
  atlasIMG: atlasIMG,
@@ -58227,9 +58340,9 @@ var StoreItemsSection = function StoreItemsSection(_ref) {
58227
58340
  });
58228
58341
  }
58229
58342
  // Render text input row when configured for this item key
58230
- if (textInputItemKeys.includes(item.key) || textInputItemKeys.includes(item._id)) {
58343
+ if (textInputItemKeys.includes(item.key)) {
58231
58344
  return React.createElement(StoreItemRow, {
58232
- key: item._id,
58345
+ key: item.key,
58233
58346
  item: item,
58234
58347
  atlasJSON: atlasJSON,
58235
58348
  atlasIMG: atlasIMG,
@@ -58240,7 +58353,7 @@ var StoreItemsSection = function StoreItemsSection(_ref) {
58240
58353
  }
58241
58354
  // Fallback to standard arrow-based row
58242
58355
  return React.createElement(StoreItemRow, {
58243
- key: item._id,
58356
+ key: item.key,
58244
58357
  item: item,
58245
58358
  atlasJSON: atlasJSON,
58246
58359
  atlasIMG: atlasIMG,
@@ -58248,19 +58361,40 @@ var StoreItemsSection = function StoreItemsSection(_ref) {
58248
58361
  userAccountType: userAccountType || UserAccountTypes.Free
58249
58362
  });
58250
58363
  };
58251
- return React.createElement(ScrollableContent, {
58364
+ return React.createElement(StoreContainer, null, React.createElement(SearchHeader$1, null, React.createElement(SearchBarContainer, null, React.createElement(SearchBar, {
58365
+ value: searchQuery,
58366
+ onChange: setSearchQuery,
58367
+ placeholder: "Search items..."
58368
+ })), React.createElement(DropdownContainer$1, null, React.createElement(Dropdown, {
58369
+ options: categoryOptions,
58370
+ onChange: function onChange(value) {
58371
+ return setSelectedCategory(value);
58372
+ },
58373
+ width: "100%"
58374
+ }))), React.createElement(ScrollableContent, {
58252
58375
  items: filteredItems,
58253
58376
  renderItem: renderStoreItem,
58254
- emptyMessage: "No items available.",
58255
- searchOptions: {
58256
- value: searchQuery,
58257
- onChange: setSearchQuery,
58258
- placeholder: 'Search items...'
58259
- },
58377
+ emptyMessage: "No items match your filters.",
58260
58378
  layout: "list",
58261
- maxHeight: "400px"
58262
- });
58379
+ maxHeight: "350px"
58380
+ }));
58263
58381
  };
58382
+ var StoreContainer = /*#__PURE__*/styled.div.withConfig({
58383
+ displayName: "StoreItemsSection__StoreContainer",
58384
+ componentId: "sc-l6f466-0"
58385
+ })(["display:flex;flex-direction:column;height:100%;gap:0.5rem;"]);
58386
+ var SearchHeader$1 = /*#__PURE__*/styled.div.withConfig({
58387
+ displayName: "StoreItemsSection__SearchHeader",
58388
+ componentId: "sc-l6f466-1"
58389
+ })(["display:flex;gap:0.5rem;align-items:center;padding-top:0.25rem;"]);
58390
+ var SearchBarContainer = /*#__PURE__*/styled.div.withConfig({
58391
+ displayName: "StoreItemsSection__SearchBarContainer",
58392
+ componentId: "sc-l6f466-2"
58393
+ })(["flex:0.75;"]);
58394
+ var DropdownContainer$1 = /*#__PURE__*/styled.div.withConfig({
58395
+ displayName: "StoreItemsSection__DropdownContainer",
58396
+ componentId: "sc-l6f466-3"
58397
+ })(["flex:0.25;min-width:140px;"]);
58264
58398
 
58265
58399
  var ShoppingCardHorizontal = function ShoppingCardHorizontal(_ref) {
58266
58400
  var title = _ref.title,
@@ -58325,13 +58459,30 @@ var CardFooter = /*#__PURE__*/styled.div.withConfig({
58325
58459
  componentId: "sc-ngkh06-6"
58326
58460
  })(["margin-top:auto;padding-top:8px;border-top:1px solid rgba(255,255,255,0.1);"]);
58327
58461
 
58462
+ var usePackFiltering = function usePackFiltering(packs) {
58463
+ var _useState = useState(''),
58464
+ searchQuery = _useState[0],
58465
+ setSearchQuery = _useState[1];
58466
+ var filteredPacks = useMemo(function () {
58467
+ return packs.filter(function (pack) {
58468
+ return pack.title.toLowerCase().includes(searchQuery.toLowerCase());
58469
+ });
58470
+ }, [packs, searchQuery]);
58471
+ return {
58472
+ searchQuery: searchQuery,
58473
+ setSearchQuery: setSearchQuery,
58474
+ filteredPacks: filteredPacks
58475
+ };
58476
+ };
58477
+
58328
58478
  var StorePacksSection = function StorePacksSection(_ref) {
58329
58479
  var packs = _ref.packs,
58330
58480
  onAddToCart = _ref.onAddToCart,
58331
58481
  onSelectPack = _ref.onSelectPack;
58332
- var _useState = useState(''),
58333
- searchQuery = _useState[0],
58334
- setSearchQuery = _useState[1];
58482
+ var _usePackFiltering = usePackFiltering(packs),
58483
+ searchQuery = _usePackFiltering.searchQuery,
58484
+ setSearchQuery = _usePackFiltering.setSearchQuery,
58485
+ filteredPacks = _usePackFiltering.filteredPacks;
58335
58486
  var renderPackFooter = useCallback(function (pack) {
58336
58487
  return React.createElement(FooterContainer, null, React.createElement(Price, null, "$", pack.priceUSD), React.createElement(CTAButton, {
58337
58488
  icon: React.createElement(FaCartPlus, null),
@@ -58354,11 +58505,6 @@ var StorePacksSection = function StorePacksSection(_ref) {
58354
58505
  }
58355
58506
  });
58356
58507
  }, [onSelectPack, renderPackFooter]);
58357
- var filteredPacks = useMemo(function () {
58358
- return packs.filter(function (pack) {
58359
- return pack.title.toLowerCase().includes(searchQuery.toLowerCase());
58360
- });
58361
- }, [packs, searchQuery]);
58362
58508
  return React.createElement(ScrollableContent, {
58363
58509
  items: filteredPacks,
58364
58510
  renderItem: renderPack,
@@ -58457,7 +58603,7 @@ var Store = function Store(_ref) {
58457
58603
  packs = _ref$packs === void 0 ? [] : _ref$packs,
58458
58604
  atlasJSON = _ref.atlasJSON,
58459
58605
  atlasIMG = _ref.atlasIMG,
58460
- _onPurchase = _ref.onPurchase,
58606
+ _onPurchase2 = _ref.onPurchase,
58461
58607
  onShowHistory = _ref.onShowHistory,
58462
58608
  userAccountType = _ref.userAccountType,
58463
58609
  _ref$loading = _ref.loading,
@@ -58502,29 +58648,35 @@ var Store = function Store(_ref) {
58502
58648
  setCurrentMetadataItem = _useState4[1];
58503
58649
  var handleAddPackToCart = function handleAddPackToCart(pack) {
58504
58650
  var packItem = {
58505
- _id: pack.key,
58506
58651
  key: pack.key,
58507
58652
  name: pack.title,
58653
+ description: pack.description || '',
58508
58654
  price: pack.priceUSD,
58655
+ currency: PaymentCurrency.USD,
58509
58656
  texturePath: pack.image["default"] || pack.image.src,
58510
- textureKey: pack.image["default"] || pack.image.src,
58511
- type: ItemType.Consumable,
58512
- subType: ItemSubType.Other,
58513
- description: pack.description || '',
58514
- fullDescription: pack.description || '',
58515
- textureAtlas: 'items',
58516
- weight: 0,
58657
+ type: PurchaseType.Pack,
58658
+ onPurchase: function () {
58659
+ var _onPurchase = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
58660
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
58661
+ while (1) switch (_context.prev = _context.next) {
58662
+ case 0:
58663
+ case "end":
58664
+ return _context.stop();
58665
+ }
58666
+ }, _callee);
58667
+ }));
58668
+ function onPurchase() {
58669
+ return _onPurchase.apply(this, arguments);
58670
+ }
58671
+ return onPurchase;
58672
+ }(),
58673
+ itemType: ItemType.Consumable,
58674
+ itemSubType: ItemSubType.Other,
58517
58675
  rarity: ItemRarities.Common,
58518
- allowedEquipSlotType: [],
58519
- isEquipable: false,
58676
+ weight: 0,
58520
58677
  isStackable: false,
58521
- isTwoHanded: false,
58522
- hasUseWith: false,
58523
58678
  maxStackSize: 1,
58524
- isUsable: false,
58525
- isStorable: true,
58526
- isSolid: false,
58527
- isItemContainer: false
58679
+ isUsable: false
58528
58680
  };
58529
58681
  handleAddToCart(packItem, 1);
58530
58682
  };
@@ -58630,22 +58782,22 @@ var Store = function Store(_ref) {
58630
58782
  onRemoveFromCart: handleRemoveFromCart,
58631
58783
  onClose: closeCart,
58632
58784
  onPurchase: function () {
58633
- var _onPurchase2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
58634
- return _regeneratorRuntime().wrap(function _callee$(_context) {
58635
- while (1) switch (_context.prev = _context.next) {
58785
+ var _onPurchase3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
58786
+ return _regeneratorRuntime().wrap(function _callee2$(_context2) {
58787
+ while (1) switch (_context2.prev = _context2.next) {
58636
58788
  case 0:
58637
- _context.next = 2;
58638
- return handleCartPurchase(_onPurchase);
58789
+ _context2.next = 2;
58790
+ return handleCartPurchase(_onPurchase2);
58639
58791
  case 2:
58640
- return _context.abrupt("return", true);
58792
+ return _context2.abrupt("return", true);
58641
58793
  case 3:
58642
58794
  case "end":
58643
- return _context.stop();
58795
+ return _context2.stop();
58644
58796
  }
58645
- }, _callee);
58797
+ }, _callee2);
58646
58798
  }));
58647
58799
  function onPurchase() {
58648
- return _onPurchase2.apply(this, arguments);
58800
+ return _onPurchase3.apply(this, arguments);
58649
58801
  }
58650
58802
  return onPurchase;
58651
58803
  }(),