@rpg-engine/long-bow 0.8.69 → 0.8.71
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/components/Store/Store.d.ts +6 -0
- package/dist/components/Store/StoreItemRow.d.ts +1 -0
- package/dist/components/Store/sections/StoreItemsSection.d.ts +1 -0
- package/dist/long-bow.cjs.development.js +158 -132
- package/dist/long-bow.cjs.development.js.map +1 -1
- package/dist/long-bow.cjs.production.min.js +1 -1
- package/dist/long-bow.cjs.production.min.js.map +1 -1
- package/dist/long-bow.esm.js +158 -132
- package/dist/long-bow.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/components/Store/CartView.tsx +11 -0
- package/src/components/Store/Store.tsx +32 -8
- package/src/components/Store/StoreCharacterSkinRow.tsx +37 -125
- package/src/components/Store/StoreItemRow.tsx +33 -3
- package/src/components/Store/__test__/MetadataCollector.spec.tsx +2 -1
- package/src/components/Store/__test__/useStoreMetadata.spec.tsx +10 -10
- package/src/components/Store/sections/StoreItemsSection.tsx +18 -3
- package/src/stories/Features/store/Store.stories.tsx +4 -0
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { IItemPack, IPurchase, IStoreItem, UserAccountTypes } from '@rpg-engine/shared';
|
|
2
2
|
import React from 'react';
|
|
3
|
+
declare type TabId = 'premium' | 'packs' | 'items';
|
|
3
4
|
export interface IStoreProps {
|
|
4
5
|
items: IStoreItem[];
|
|
5
6
|
packs?: IItemPack[];
|
|
@@ -11,5 +12,10 @@ export interface IStoreProps {
|
|
|
11
12
|
loading?: boolean;
|
|
12
13
|
error?: string;
|
|
13
14
|
onClose?: () => void;
|
|
15
|
+
hidePremiumTab?: boolean;
|
|
16
|
+
tabOrder?: TabId[];
|
|
17
|
+
defaultActiveTab?: TabId;
|
|
18
|
+
textInputItemKeys?: string[];
|
|
14
19
|
}
|
|
15
20
|
export declare const Store: React.FC<IStoreProps>;
|
|
21
|
+
export {};
|
|
@@ -6,6 +6,7 @@ interface IStoreItemRowProps {
|
|
|
6
6
|
atlasIMG: string;
|
|
7
7
|
onAddToCart: (item: IStoreItem, quantity: number, metadata?: Record<string, any>) => void;
|
|
8
8
|
userAccountType: UserAccountTypes;
|
|
9
|
+
showTextInput?: boolean;
|
|
9
10
|
}
|
|
10
11
|
export declare const StoreItemRow: React.FC<IStoreItemRowProps>;
|
|
11
12
|
export {};
|
|
@@ -57515,7 +57515,7 @@ var CartView = function CartView(_ref2) {
|
|
|
57515
57515
|
return React__default.createElement(Container$K, null, React__default.createElement(Header$7, null, React__default.createElement(Title$e, null, "Shopping Cart"), React__default.createElement(CloseButton$9, {
|
|
57516
57516
|
onPointerDown: onClose
|
|
57517
57517
|
}, React__default.createElement(fa.FaTimes, null))), React__default.createElement(CartItems, null, cartItems.length === 0 ? React__default.createElement(EmptyCart, null, "Your cart is empty") : cartItems.map(function (cartItem) {
|
|
57518
|
-
var _cartItem$metadata;
|
|
57518
|
+
var _cartItem$metadata, _cartItem$metadata2;
|
|
57519
57519
|
console.log('Item metadataType: , texturePath:', cartItem.item.metadataType, cartItem.item.texturePath);
|
|
57520
57520
|
var getSpriteKey = function getSpriteKey(textureKey) {
|
|
57521
57521
|
return textureKey + '/down/standing/0.png';
|
|
@@ -57530,7 +57530,7 @@ var CartView = function CartView(_ref2) {
|
|
|
57530
57530
|
height: 32,
|
|
57531
57531
|
imgScale: 2,
|
|
57532
57532
|
centered: true
|
|
57533
|
-
})), React__default.createElement(ItemDetails, null, React__default.createElement(ItemName, null, cartItem.item.name), React__default.createElement(ItemInfo$1, null, React__default.createElement("span", null, "$", formatPrice(cartItem.item.price)), React__default.createElement("span", null, "\xD7"), React__default.createElement("span", null, cartItem.quantity), React__default.createElement("span", null, "="), React__default.createElement("span", null, "$", formatPrice(cartItem.item.price * cartItem.quantity))), cartItem.metadata && cartItem.item.metadataType && React__default.createElement(MetadataDisplay, {
|
|
57533
|
+
})), React__default.createElement(ItemDetails, null, React__default.createElement(ItemName, null, cartItem.item.name), ((_cartItem$metadata2 = cartItem.metadata) == null ? void 0 : _cartItem$metadata2.inputValue) && React__default.createElement(CartMeta, null, cartItem.metadata.inputValue), React__default.createElement(ItemInfo$1, null, React__default.createElement("span", null, "$", formatPrice(cartItem.item.price)), React__default.createElement("span", null, "\xD7"), React__default.createElement("span", null, cartItem.quantity), React__default.createElement("span", null, "="), React__default.createElement("span", null, "$", formatPrice(cartItem.item.price * cartItem.quantity))), cartItem.metadata && cartItem.item.metadataType && React__default.createElement(MetadataDisplay, {
|
|
57534
57534
|
type: cartItem.item.metadataType,
|
|
57535
57535
|
metadata: cartItem.metadata
|
|
57536
57536
|
})), React__default.createElement(CTAButton, {
|
|
@@ -57620,6 +57620,10 @@ var MetadataValue = /*#__PURE__*/styled__default.div.withConfig({
|
|
|
57620
57620
|
displayName: "CartView__MetadataValue",
|
|
57621
57621
|
componentId: "sc-ydtyl1-17"
|
|
57622
57622
|
})(["overflow:hidden;text-overflow:ellipsis;white-space:nowrap;"]);
|
|
57623
|
+
var CartMeta = /*#__PURE__*/styled__default.div.withConfig({
|
|
57624
|
+
displayName: "CartView__CartMeta",
|
|
57625
|
+
componentId: "sc-ydtyl1-18"
|
|
57626
|
+
})(["font-family:'Press Start 2P',cursive;font-size:0.75rem;color:#ffffff;opacity:0.8;margin-top:0.25rem;"]);
|
|
57623
57627
|
|
|
57624
57628
|
var useStoreMetadata = function useStoreMetadata() {
|
|
57625
57629
|
var _useState = React.useState(false),
|
|
@@ -57965,12 +57969,9 @@ var StoreCharacterSkinRow = function StoreCharacterSkinRow(_ref) {
|
|
|
57965
57969
|
atlasIMG = _ref.atlasIMG,
|
|
57966
57970
|
onAddToCart = _ref.onAddToCart,
|
|
57967
57971
|
userAccountType = _ref.userAccountType;
|
|
57968
|
-
var _useState = React.useState(
|
|
57969
|
-
|
|
57970
|
-
|
|
57971
|
-
var _useState2 = React.useState(0),
|
|
57972
|
-
currentIndex = _useState2[0],
|
|
57973
|
-
setCurrentIndex = _useState2[1];
|
|
57972
|
+
var _useState = React.useState(0),
|
|
57973
|
+
currentIndex = _useState[0],
|
|
57974
|
+
setCurrentIndex = _useState[1];
|
|
57974
57975
|
// Get available characters from metadata
|
|
57975
57976
|
var availableCharacters = item.metadataType === shared.MetadataType.CharacterSkin && ((_item$metadataConfig = item.metadataConfig) == null ? void 0 : _item$metadataConfig.availableCharacters) || [];
|
|
57976
57977
|
// Get the active character entity atlas info
|
|
@@ -57980,24 +57981,6 @@ var StoreCharacterSkinRow = function StoreCharacterSkinRow(_ref) {
|
|
|
57980
57981
|
React.useEffect(function () {
|
|
57981
57982
|
setCurrentIndex(0);
|
|
57982
57983
|
}, [item._id]);
|
|
57983
|
-
var handleQuantityChange = function handleQuantityChange(e) {
|
|
57984
|
-
var value = parseInt(e.target.value) || 1;
|
|
57985
|
-
setQuantity(Math.min(Math.max(1, value), 99));
|
|
57986
|
-
};
|
|
57987
|
-
var handleBlur = function handleBlur() {
|
|
57988
|
-
if (quantity < 1) setQuantity(1);
|
|
57989
|
-
if (quantity > 99) setQuantity(99);
|
|
57990
|
-
};
|
|
57991
|
-
var incrementQuantity = function incrementQuantity() {
|
|
57992
|
-
setQuantity(function (prev) {
|
|
57993
|
-
return Math.min(prev + 1, 99);
|
|
57994
|
-
});
|
|
57995
|
-
};
|
|
57996
|
-
var decrementQuantity = function decrementQuantity() {
|
|
57997
|
-
setQuantity(function (prev) {
|
|
57998
|
-
return Math.max(1, prev - 1);
|
|
57999
|
-
});
|
|
58000
|
-
};
|
|
58001
57984
|
var handlePreviousSkin = function handlePreviousSkin() {
|
|
58002
57985
|
setCurrentIndex(function (prevIndex) {
|
|
58003
57986
|
return prevIndex === 0 ? availableCharacters.length - 1 : prevIndex - 1;
|
|
@@ -58011,26 +57994,21 @@ var StoreCharacterSkinRow = function StoreCharacterSkinRow(_ref) {
|
|
|
58011
57994
|
var hasRequiredAccount = !((_item$requiredAccount = item.requiredAccountType) != null && _item$requiredAccount.length) || item.requiredAccountType.includes(userAccountType);
|
|
58012
57995
|
var handleAddToCart = function handleAddToCart() {
|
|
58013
57996
|
if (!hasRequiredAccount) return;
|
|
58014
|
-
//
|
|
57997
|
+
// Always use a quantity of 1
|
|
58015
57998
|
if (availableCharacters.length > 0 && currentCharacter) {
|
|
58016
|
-
onAddToCart(item,
|
|
57999
|
+
onAddToCart(item, 1, {
|
|
58017
58000
|
selectedSkinName: currentCharacter.name,
|
|
58018
58001
|
selectedSkinTextureKey: currentCharacter.textureKey
|
|
58019
58002
|
});
|
|
58020
58003
|
} else {
|
|
58021
|
-
onAddToCart(item,
|
|
58004
|
+
onAddToCart(item, 1);
|
|
58022
58005
|
}
|
|
58023
|
-
setQuantity(1); // Reset quantity after adding to cart
|
|
58024
58006
|
};
|
|
58025
58007
|
var getSpriteKey = function getSpriteKey(textureKey) {
|
|
58026
58008
|
return textureKey + '/down/standing/0.png';
|
|
58027
58009
|
};
|
|
58028
58010
|
var currentCharacter = availableCharacters[currentIndex];
|
|
58029
|
-
return React__default.createElement(ItemWrapper, null, React__default.createElement(ItemIconContainer$2, null,
|
|
58030
|
-
direction: "left",
|
|
58031
|
-
onPointerDown: handlePreviousSkin,
|
|
58032
|
-
size: 24
|
|
58033
|
-
}), React__default.createElement(SpriteContainer$5, null, React__default.createElement(ErrorBoundary, null, React__default.createElement(SpriteFromAtlas, {
|
|
58011
|
+
return React__default.createElement(ItemWrapper, null, React__default.createElement(ItemIconContainer$2, null, entityAtlasJSON && entityAtlasIMG && currentCharacter ? React__default.createElement(SpriteFromAtlas, {
|
|
58034
58012
|
atlasJSON: entityAtlasJSON,
|
|
58035
58013
|
atlasIMG: entityAtlasIMG,
|
|
58036
58014
|
spriteKey: getSpriteKey(currentCharacter.textureKey),
|
|
@@ -58038,11 +58016,7 @@ var StoreCharacterSkinRow = function StoreCharacterSkinRow(_ref) {
|
|
|
58038
58016
|
height: 32,
|
|
58039
58017
|
imgScale: 2,
|
|
58040
58018
|
centered: true
|
|
58041
|
-
})
|
|
58042
|
-
direction: "right",
|
|
58043
|
-
onPointerDown: handleNextSkin,
|
|
58044
|
-
size: 24
|
|
58045
|
-
})) : React__default.createElement(SpriteFromAtlas, {
|
|
58019
|
+
}) : React__default.createElement(SpriteFromAtlas, {
|
|
58046
58020
|
atlasJSON: atlasJSON,
|
|
58047
58021
|
atlasIMG: atlasIMG,
|
|
58048
58022
|
spriteKey: item.texturePath,
|
|
@@ -58050,23 +58024,15 @@ var StoreCharacterSkinRow = function StoreCharacterSkinRow(_ref) {
|
|
|
58050
58024
|
height: 32,
|
|
58051
58025
|
imgScale: 2,
|
|
58052
58026
|
centered: true
|
|
58053
|
-
})), React__default.createElement(ItemDetails$1, null, React__default.createElement(ItemName$1, null, item.name), availableCharacters.length > 0 && currentCharacter && React__default.createElement(
|
|
58027
|
+
})), 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, {
|
|
58054
58028
|
direction: "left",
|
|
58055
|
-
onPointerDown:
|
|
58029
|
+
onPointerDown: handlePreviousSkin,
|
|
58056
58030
|
size: 24
|
|
58057
|
-
}), React__default.createElement(
|
|
58058
|
-
type: "number",
|
|
58059
|
-
value: quantity,
|
|
58060
|
-
onChange: handleQuantityChange,
|
|
58061
|
-
onBlur: handleBlur,
|
|
58062
|
-
min: 1,
|
|
58063
|
-
max: 99,
|
|
58064
|
-
className: "rpgui-input"
|
|
58065
|
-
}), React__default.createElement(SelectArrow, {
|
|
58031
|
+
}), React__default.createElement(SelectedSkin, null, currentCharacter.name), React__default.createElement(SkinNavArrow, {
|
|
58066
58032
|
direction: "right",
|
|
58067
|
-
onPointerDown:
|
|
58033
|
+
onPointerDown: handleNextSkin,
|
|
58068
58034
|
size: 24
|
|
58069
|
-
})), React__default.createElement(CTAButton, {
|
|
58035
|
+
})), React__default.createElement(ItemPrice, null, "$", item.price)), React__default.createElement(Controls, null, React__default.createElement(CTAButton, {
|
|
58070
58036
|
icon: React__default.createElement(fa.FaCartPlus, null),
|
|
58071
58037
|
label: "Add",
|
|
58072
58038
|
onClick: handleAddToCart,
|
|
@@ -58080,47 +58046,40 @@ var ItemWrapper = /*#__PURE__*/styled__default.div.withConfig({
|
|
|
58080
58046
|
var ItemIconContainer$2 = /*#__PURE__*/styled__default.div.withConfig({
|
|
58081
58047
|
displayName: "StoreCharacterSkinRow__ItemIconContainer",
|
|
58082
58048
|
componentId: "sc-81xqsx-1"
|
|
58083
|
-
})(["
|
|
58084
|
-
var CharacterSkinPreviewContainer = /*#__PURE__*/styled__default.div.withConfig({
|
|
58085
|
-
displayName: "StoreCharacterSkinRow__CharacterSkinPreviewContainer",
|
|
58086
|
-
componentId: "sc-81xqsx-2"
|
|
58087
|
-
})(["position:relative;display:flex;align-items:center;width:140px;height:42px;justify-content:space-between;"]);
|
|
58088
|
-
var SpriteContainer$5 = /*#__PURE__*/styled__default.div.withConfig({
|
|
58089
|
-
displayName: "StoreCharacterSkinRow__SpriteContainer",
|
|
58090
|
-
componentId: "sc-81xqsx-3"
|
|
58091
|
-
})(["display:flex;align-items:center;justify-content:center;position:absolute;left:50%;transform:translateX(-50%);"]);
|
|
58092
|
-
var NavArrow = /*#__PURE__*/styled__default(SelectArrow).withConfig({
|
|
58093
|
-
displayName: "StoreCharacterSkinRow__NavArrow",
|
|
58094
|
-
componentId: "sc-81xqsx-4"
|
|
58095
|
-
})(["z-index:2;"]);
|
|
58049
|
+
})(["width:32px;height:32px;display:flex;align-items:center;justify-content:center;border-radius:4px;padding:4px;"]);
|
|
58096
58050
|
var ItemDetails$1 = /*#__PURE__*/styled__default.div.withConfig({
|
|
58097
58051
|
displayName: "StoreCharacterSkinRow__ItemDetails",
|
|
58098
|
-
componentId: "sc-81xqsx-
|
|
58052
|
+
componentId: "sc-81xqsx-2"
|
|
58099
58053
|
})(["flex:1;display:flex;flex-direction:column;gap:0.5rem;"]);
|
|
58100
58054
|
var ItemName$1 = /*#__PURE__*/styled__default.div.withConfig({
|
|
58101
58055
|
displayName: "StoreCharacterSkinRow__ItemName",
|
|
58102
|
-
componentId: "sc-81xqsx-
|
|
58056
|
+
componentId: "sc-81xqsx-3"
|
|
58103
58057
|
})(["font-family:'Press Start 2P',cursive;font-size:0.875rem;color:#ffffff;"]);
|
|
58104
58058
|
var SelectedSkin = /*#__PURE__*/styled__default.div.withConfig({
|
|
58105
58059
|
displayName: "StoreCharacterSkinRow__SelectedSkin",
|
|
58106
|
-
componentId: "sc-81xqsx-
|
|
58060
|
+
componentId: "sc-81xqsx-4"
|
|
58107
58061
|
})(["font-family:'Press Start 2P',cursive;font-size:0.65rem;color:#fef08a;"]);
|
|
58108
58062
|
var ItemPrice = /*#__PURE__*/styled__default.div.withConfig({
|
|
58109
58063
|
displayName: "StoreCharacterSkinRow__ItemPrice",
|
|
58110
|
-
componentId: "sc-81xqsx-
|
|
58064
|
+
componentId: "sc-81xqsx-5"
|
|
58111
58065
|
})(["font-family:'Press Start 2P',cursive;font-size:0.75rem;color:#fef08a;"]);
|
|
58112
58066
|
var Controls = /*#__PURE__*/styled__default.div.withConfig({
|
|
58113
58067
|
displayName: "StoreCharacterSkinRow__Controls",
|
|
58114
|
-
componentId: "sc-81xqsx-
|
|
58068
|
+
componentId: "sc-81xqsx-6"
|
|
58115
58069
|
})(["display:flex;align-items:center;gap:1rem;min-width:fit-content;"]);
|
|
58116
|
-
|
|
58117
|
-
|
|
58118
|
-
|
|
58119
|
-
|
|
58120
|
-
|
|
58121
|
-
|
|
58122
|
-
|
|
58123
|
-
|
|
58070
|
+
// Styled arrow override for inline nav arrows
|
|
58071
|
+
var SkinNavArrow = /*#__PURE__*/styled__default(SelectArrow).withConfig({
|
|
58072
|
+
displayName: "StoreCharacterSkinRow__SkinNavArrow",
|
|
58073
|
+
componentId: "sc-81xqsx-7"
|
|
58074
|
+
})(["position:static;"]);
|
|
58075
|
+
var Header$8 = /*#__PURE__*/styled__default.div.withConfig({
|
|
58076
|
+
displayName: "StoreCharacterSkinRow__Header",
|
|
58077
|
+
componentId: "sc-81xqsx-8"
|
|
58078
|
+
})(["display:flex;align-items:center;gap:0.5rem;"]);
|
|
58079
|
+
var SelectedSkinNav = /*#__PURE__*/styled__default.div.withConfig({
|
|
58080
|
+
displayName: "StoreCharacterSkinRow__SelectedSkinNav",
|
|
58081
|
+
componentId: "sc-81xqsx-9"
|
|
58082
|
+
})(["display:flex;align-items:center;gap:0.5rem;"]);
|
|
58124
58083
|
|
|
58125
58084
|
var StoreItemRow = function StoreItemRow(_ref) {
|
|
58126
58085
|
var _item$requiredAccount;
|
|
@@ -58128,10 +58087,15 @@ var StoreItemRow = function StoreItemRow(_ref) {
|
|
|
58128
58087
|
atlasJSON = _ref.atlasJSON,
|
|
58129
58088
|
atlasIMG = _ref.atlasIMG,
|
|
58130
58089
|
onAddToCart = _ref.onAddToCart,
|
|
58131
|
-
userAccountType = _ref.userAccountType
|
|
58090
|
+
userAccountType = _ref.userAccountType,
|
|
58091
|
+
_ref$showTextInput = _ref.showTextInput,
|
|
58092
|
+
showTextInput = _ref$showTextInput === void 0 ? false : _ref$showTextInput;
|
|
58132
58093
|
var _useState = React.useState(1),
|
|
58133
58094
|
quantity = _useState[0],
|
|
58134
58095
|
setQuantity = _useState[1];
|
|
58096
|
+
var _useState2 = React.useState(''),
|
|
58097
|
+
textInputValue = _useState2[0],
|
|
58098
|
+
setTextInputValue = _useState2[1];
|
|
58135
58099
|
var handleQuantityChange = function handleQuantityChange(e) {
|
|
58136
58100
|
var value = parseInt(e.target.value) || 1;
|
|
58137
58101
|
setQuantity(Math.min(Math.max(1, value), 99));
|
|
@@ -58151,10 +58115,17 @@ var StoreItemRow = function StoreItemRow(_ref) {
|
|
|
58151
58115
|
});
|
|
58152
58116
|
};
|
|
58153
58117
|
var hasRequiredAccount = !((_item$requiredAccount = item.requiredAccountType) != null && _item$requiredAccount.length) || item.requiredAccountType.includes(userAccountType);
|
|
58154
|
-
var
|
|
58118
|
+
var handleAddToCartInternal = function handleAddToCartInternal() {
|
|
58155
58119
|
if (!hasRequiredAccount) return;
|
|
58156
|
-
|
|
58157
|
-
|
|
58120
|
+
if (showTextInput) {
|
|
58121
|
+
onAddToCart(item, 1, {
|
|
58122
|
+
inputValue: textInputValue
|
|
58123
|
+
});
|
|
58124
|
+
setTextInputValue('');
|
|
58125
|
+
} else {
|
|
58126
|
+
onAddToCart(item, quantity);
|
|
58127
|
+
setQuantity(1);
|
|
58128
|
+
}
|
|
58158
58129
|
};
|
|
58159
58130
|
return React__default.createElement(ItemWrapper$1, null, React__default.createElement(ItemIconContainer$3, null, React__default.createElement(SpriteFromAtlas, {
|
|
58160
58131
|
atlasJSON: atlasJSON,
|
|
@@ -58164,11 +58135,19 @@ var StoreItemRow = function StoreItemRow(_ref) {
|
|
|
58164
58135
|
height: 32,
|
|
58165
58136
|
imgScale: 2,
|
|
58166
58137
|
centered: true
|
|
58167
|
-
})), React__default.createElement(ItemDetails$2, null, React__default.createElement(ItemName$2, null, item.name), React__default.createElement(ItemPrice$1, null, "$", item.price)), React__default.createElement(Controls$1, null,
|
|
58138
|
+
})), React__default.createElement(ItemDetails$2, null, React__default.createElement(ItemName$2, null, item.name), React__default.createElement(ItemPrice$1, null, "$", item.price)), React__default.createElement(Controls$1, null, showTextInput ? React__default.createElement(TextInput, {
|
|
58139
|
+
type: "text",
|
|
58140
|
+
value: textInputValue,
|
|
58141
|
+
placeholder: "Enter value",
|
|
58142
|
+
onChange: function onChange(e) {
|
|
58143
|
+
return setTextInputValue(e.target.value);
|
|
58144
|
+
},
|
|
58145
|
+
className: "rpgui-input"
|
|
58146
|
+
}) : item.isStackable ? React__default.createElement(ArrowsContainer, null, React__default.createElement(SelectArrow, {
|
|
58168
58147
|
direction: "left",
|
|
58169
58148
|
onPointerDown: decrementQuantity,
|
|
58170
58149
|
size: 24
|
|
58171
|
-
}), React__default.createElement(QuantityInput
|
|
58150
|
+
}), React__default.createElement(QuantityInput, {
|
|
58172
58151
|
type: "number",
|
|
58173
58152
|
value: quantity,
|
|
58174
58153
|
onChange: handleQuantityChange,
|
|
@@ -58180,10 +58159,10 @@ var StoreItemRow = function StoreItemRow(_ref) {
|
|
|
58180
58159
|
direction: "right",
|
|
58181
58160
|
onPointerDown: incrementQuantity,
|
|
58182
58161
|
size: 24
|
|
58183
|
-
})), React__default.createElement(CTAButton, {
|
|
58162
|
+
})) : null, React__default.createElement(CTAButton, {
|
|
58184
58163
|
icon: React__default.createElement(fa.FaCartPlus, null),
|
|
58185
58164
|
label: "Add",
|
|
58186
|
-
onClick:
|
|
58165
|
+
onClick: handleAddToCartInternal,
|
|
58187
58166
|
disabled: !hasRequiredAccount
|
|
58188
58167
|
})));
|
|
58189
58168
|
};
|
|
@@ -58211,21 +58190,27 @@ var Controls$1 = /*#__PURE__*/styled__default.div.withConfig({
|
|
|
58211
58190
|
displayName: "StoreItemRow__Controls",
|
|
58212
58191
|
componentId: "sc-ptotuo-5"
|
|
58213
58192
|
})(["display:flex;align-items:center;gap:1rem;min-width:fit-content;"]);
|
|
58214
|
-
var ArrowsContainer
|
|
58193
|
+
var ArrowsContainer = /*#__PURE__*/styled__default.div.withConfig({
|
|
58215
58194
|
displayName: "StoreItemRow__ArrowsContainer",
|
|
58216
58195
|
componentId: "sc-ptotuo-6"
|
|
58217
58196
|
})(["position:relative;display:flex;align-items:center;width:120px;height:42px;justify-content:space-between;"]);
|
|
58218
|
-
var QuantityInput
|
|
58197
|
+
var QuantityInput = /*#__PURE__*/styled__default.input.withConfig({
|
|
58219
58198
|
displayName: "StoreItemRow__QuantityInput",
|
|
58220
58199
|
componentId: "sc-ptotuo-7"
|
|
58221
58200
|
})(["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;}"]);
|
|
58201
|
+
var TextInput = /*#__PURE__*/styled__default.input.withConfig({
|
|
58202
|
+
displayName: "StoreItemRow__TextInput",
|
|
58203
|
+
componentId: "sc-ptotuo-8"
|
|
58204
|
+
})(["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;"]);
|
|
58222
58205
|
|
|
58223
58206
|
var StoreItemsSection = function StoreItemsSection(_ref) {
|
|
58224
58207
|
var items = _ref.items,
|
|
58225
58208
|
onAddToCart = _ref.onAddToCart,
|
|
58226
58209
|
atlasJSON = _ref.atlasJSON,
|
|
58227
58210
|
atlasIMG = _ref.atlasIMG,
|
|
58228
|
-
userAccountType = _ref.userAccountType
|
|
58211
|
+
userAccountType = _ref.userAccountType,
|
|
58212
|
+
_ref$textInputItemKey = _ref.textInputItemKeys,
|
|
58213
|
+
textInputItemKeys = _ref$textInputItemKey === void 0 ? [] : _ref$textInputItemKey;
|
|
58229
58214
|
var _useState = React.useState(''),
|
|
58230
58215
|
searchQuery = _useState[0],
|
|
58231
58216
|
setSearchQuery = _useState[1];
|
|
@@ -58233,7 +58218,7 @@ var StoreItemsSection = function StoreItemsSection(_ref) {
|
|
|
58233
58218
|
return item.name.toLowerCase().includes(searchQuery.toLowerCase());
|
|
58234
58219
|
});
|
|
58235
58220
|
var renderStoreItem = function renderStoreItem(item) {
|
|
58236
|
-
//
|
|
58221
|
+
// Prefer a specialized character skin row when needed
|
|
58237
58222
|
if (item.metadataType === shared.MetadataType.CharacterSkin) {
|
|
58238
58223
|
return React__default.createElement(StoreCharacterSkinRow, {
|
|
58239
58224
|
key: item._id,
|
|
@@ -58244,7 +58229,19 @@ var StoreItemsSection = function StoreItemsSection(_ref) {
|
|
|
58244
58229
|
userAccountType: userAccountType || shared.UserAccountTypes.Free
|
|
58245
58230
|
});
|
|
58246
58231
|
}
|
|
58247
|
-
//
|
|
58232
|
+
// Render text input row when configured for this item key
|
|
58233
|
+
if (textInputItemKeys.includes(item.key) || textInputItemKeys.includes(item._id)) {
|
|
58234
|
+
return React__default.createElement(StoreItemRow, {
|
|
58235
|
+
key: item._id,
|
|
58236
|
+
item: item,
|
|
58237
|
+
atlasJSON: atlasJSON,
|
|
58238
|
+
atlasIMG: atlasIMG,
|
|
58239
|
+
onAddToCart: onAddToCart,
|
|
58240
|
+
userAccountType: userAccountType || shared.UserAccountTypes.Free,
|
|
58241
|
+
showTextInput: true
|
|
58242
|
+
});
|
|
58243
|
+
}
|
|
58244
|
+
// Fallback to standard arrow-based row
|
|
58248
58245
|
return React__default.createElement(StoreItemRow, {
|
|
58249
58246
|
key: item._id,
|
|
58250
58247
|
item: item,
|
|
@@ -58398,7 +58395,7 @@ var StoreItemDetails = function StoreItemDetails(_ref) {
|
|
|
58398
58395
|
if (typeof imageUrl === 'string') return imageUrl;
|
|
58399
58396
|
return imageUrl["default"] || imageUrl.src;
|
|
58400
58397
|
};
|
|
58401
|
-
return React__default.createElement(Container$M, null, React__default.createElement(Header$
|
|
58398
|
+
return React__default.createElement(Container$M, null, React__default.createElement(Header$9, null, React__default.createElement(BackButton, {
|
|
58402
58399
|
onClick: onBack
|
|
58403
58400
|
}, React__default.createElement(fa.FaArrowLeft, null), React__default.createElement("span", null, "Back"))), React__default.createElement(Content$5, null, React__default.createElement(DetailsGrid, null, React__default.createElement(ItemIcon, null, React__default.createElement("img", {
|
|
58404
58401
|
src: getImageSrc(),
|
|
@@ -58416,7 +58413,7 @@ var Container$M = /*#__PURE__*/styled__default.div.withConfig({
|
|
|
58416
58413
|
displayName: "StoreItemDetails__Container",
|
|
58417
58414
|
componentId: "sc-k3ho5z-0"
|
|
58418
58415
|
})(["display:flex;flex-direction:column;gap:1.5rem;padding:1.5rem;height:100%;"]);
|
|
58419
|
-
var Header$
|
|
58416
|
+
var Header$9 = /*#__PURE__*/styled__default.div.withConfig({
|
|
58420
58417
|
displayName: "StoreItemDetails__Header",
|
|
58421
58418
|
componentId: "sc-k3ho5z-1"
|
|
58422
58419
|
})(["display:flex;align-items:center;gap:1rem;"]);
|
|
@@ -58469,11 +58466,25 @@ var Store = function Store(_ref) {
|
|
|
58469
58466
|
_ref$loading = _ref.loading,
|
|
58470
58467
|
loading = _ref$loading === void 0 ? false : _ref$loading,
|
|
58471
58468
|
error = _ref.error,
|
|
58472
|
-
onClose = _ref.onClose
|
|
58469
|
+
onClose = _ref.onClose,
|
|
58470
|
+
_ref$hidePremiumTab = _ref.hidePremiumTab,
|
|
58471
|
+
hidePremiumTab = _ref$hidePremiumTab === void 0 ? false : _ref$hidePremiumTab,
|
|
58472
|
+
tabOrder = _ref.tabOrder,
|
|
58473
|
+
defaultActiveTab = _ref.defaultActiveTab,
|
|
58474
|
+
_ref$textInputItemKey = _ref.textInputItemKeys,
|
|
58475
|
+
textInputItemKeys = _ref$textInputItemKey === void 0 ? [] : _ref$textInputItemKey;
|
|
58473
58476
|
var _useState = React.useState(null),
|
|
58474
58477
|
selectedPack = _useState[0],
|
|
58475
58478
|
setSelectedPack = _useState[1];
|
|
58476
|
-
var _useState2 = React.useState(
|
|
58479
|
+
var _useState2 = React.useState(function () {
|
|
58480
|
+
var initialTabs = (tabOrder != null ? tabOrder : ['premium', 'packs', 'items']).filter(function (id) {
|
|
58481
|
+
return !(hidePremiumTab && id === 'premium');
|
|
58482
|
+
});
|
|
58483
|
+
if (defaultActiveTab && initialTabs.includes(defaultActiveTab)) {
|
|
58484
|
+
return defaultActiveTab;
|
|
58485
|
+
}
|
|
58486
|
+
return hidePremiumTab ? 'items' : 'premium';
|
|
58487
|
+
}),
|
|
58477
58488
|
activeTab = _useState2[0],
|
|
58478
58489
|
setActiveTab = _useState2[1];
|
|
58479
58490
|
var _useStoreCart = useStoreCart(),
|
|
@@ -58560,37 +58571,50 @@ var Store = function Store(_ref) {
|
|
|
58560
58571
|
if (error) {
|
|
58561
58572
|
return React__default.createElement(ErrorMessage$2, null, error);
|
|
58562
58573
|
}
|
|
58563
|
-
|
|
58564
|
-
|
|
58565
|
-
|
|
58566
|
-
|
|
58567
|
-
|
|
58568
|
-
|
|
58569
|
-
|
|
58570
|
-
|
|
58571
|
-
|
|
58572
|
-
|
|
58573
|
-
|
|
58574
|
-
|
|
58575
|
-
|
|
58576
|
-
|
|
58577
|
-
|
|
58578
|
-
|
|
58579
|
-
|
|
58580
|
-
|
|
58581
|
-
|
|
58582
|
-
|
|
58583
|
-
|
|
58584
|
-
|
|
58585
|
-
|
|
58586
|
-
|
|
58587
|
-
|
|
58588
|
-
|
|
58589
|
-
|
|
58590
|
-
|
|
58591
|
-
|
|
58592
|
-
|
|
58593
|
-
|
|
58574
|
+
// Build tabs dynamically based on props
|
|
58575
|
+
var tabIds = tabOrder != null ? tabOrder : ['premium', 'packs', 'items'];
|
|
58576
|
+
var availableTabIds = tabIds.filter(function (id) {
|
|
58577
|
+
return !(hidePremiumTab && id === 'premium');
|
|
58578
|
+
});
|
|
58579
|
+
var tabsMap = {
|
|
58580
|
+
premium: {
|
|
58581
|
+
id: 'premium',
|
|
58582
|
+
title: 'Premium',
|
|
58583
|
+
content: React__default.createElement(StorePacksSection, {
|
|
58584
|
+
packs: packs.filter(function (pack) {
|
|
58585
|
+
return pack.priceUSD >= 9.99;
|
|
58586
|
+
}),
|
|
58587
|
+
onAddToCart: handleAddPackToCart,
|
|
58588
|
+
onSelectPack: setSelectedPack
|
|
58589
|
+
})
|
|
58590
|
+
},
|
|
58591
|
+
packs: {
|
|
58592
|
+
id: 'packs',
|
|
58593
|
+
title: 'Packs',
|
|
58594
|
+
content: React__default.createElement(StorePacksSection, {
|
|
58595
|
+
packs: packs.filter(function (pack) {
|
|
58596
|
+
return pack.priceUSD < 9.99;
|
|
58597
|
+
}),
|
|
58598
|
+
onAddToCart: handleAddPackToCart,
|
|
58599
|
+
onSelectPack: setSelectedPack
|
|
58600
|
+
})
|
|
58601
|
+
},
|
|
58602
|
+
items: {
|
|
58603
|
+
id: 'items',
|
|
58604
|
+
title: 'Items',
|
|
58605
|
+
content: React__default.createElement(StoreItemsSection, {
|
|
58606
|
+
items: filteredItems.items,
|
|
58607
|
+
onAddToCart: handleAddToCart,
|
|
58608
|
+
atlasJSON: atlasJSON,
|
|
58609
|
+
atlasIMG: atlasIMG,
|
|
58610
|
+
userAccountType: userAccountType,
|
|
58611
|
+
textInputItemKeys: textInputItemKeys
|
|
58612
|
+
})
|
|
58613
|
+
}
|
|
58614
|
+
};
|
|
58615
|
+
var tabs = availableTabIds.map(function (id) {
|
|
58616
|
+
return tabsMap[id];
|
|
58617
|
+
});
|
|
58594
58618
|
return React__default.createElement(DraggableContainer, {
|
|
58595
58619
|
title: "Store",
|
|
58596
58620
|
onCloseButton: onClose,
|
|
@@ -58658,7 +58682,9 @@ var Store = function Store(_ref) {
|
|
|
58658
58682
|
borderColor: "#f59e0b",
|
|
58659
58683
|
hoverColor: "#fef3c7",
|
|
58660
58684
|
activeTab: activeTab,
|
|
58661
|
-
onTabChange:
|
|
58685
|
+
onTabChange: function onTabChange(tabId) {
|
|
58686
|
+
return setActiveTab(tabId);
|
|
58687
|
+
}
|
|
58662
58688
|
})), cartItems.length > 0 && React__default.createElement(Footer$2, null, React__default.createElement(CartSummary, null, React__default.createElement(CartInfo, null, React__default.createElement("span", null, "Items in cart:"), React__default.createElement("span", null, getTotalItems())), React__default.createElement(CartInfo, null, React__default.createElement("span", null, "Total:"), React__default.createElement("span", null, "$", getTotalPrice().toFixed(2)))), React__default.createElement(CTAButton, {
|
|
58663
58689
|
icon: React__default.createElement(fa.FaShoppingCart, null),
|
|
58664
58690
|
label: "Proceed to Checkout ($" + getTotalPrice().toFixed(2) + ")",
|
|
@@ -58867,7 +58893,7 @@ var TradingItemRow = function TradingItemRow(_ref) {
|
|
|
58867
58893
|
}
|
|
58868
58894
|
return null;
|
|
58869
58895
|
};
|
|
58870
|
-
return React__default.createElement(ItemWrapper$2, null, React__default.createElement(ItemIconContainer$4, null, React__default.createElement(SpriteContainer$
|
|
58896
|
+
return React__default.createElement(ItemWrapper$2, null, React__default.createElement(ItemIconContainer$4, null, React__default.createElement(SpriteContainer$5, null, React__default.createElement(ItemInfoWrapper, {
|
|
58871
58897
|
atlasIMG: atlasIMG,
|
|
58872
58898
|
atlasJSON: atlasJSON,
|
|
58873
58899
|
equipmentSet: equipmentSet,
|
|
@@ -58901,7 +58927,7 @@ var TradingItemRow = function TradingItemRow(_ref) {
|
|
|
58901
58927
|
onPointerDown: function onPointerDown() {
|
|
58902
58928
|
return onLeftClick();
|
|
58903
58929
|
}
|
|
58904
|
-
}), React__default.createElement(QuantityInput$
|
|
58930
|
+
}), React__default.createElement(QuantityInput$1, {
|
|
58905
58931
|
type: "text",
|
|
58906
58932
|
value: inputQty,
|
|
58907
58933
|
onChange: handleQuantityChange,
|
|
@@ -58939,7 +58965,7 @@ var ItemIconContainer$4 = /*#__PURE__*/styled__default.div.withConfig({
|
|
|
58939
58965
|
displayName: "TradingItemRow__ItemIconContainer",
|
|
58940
58966
|
componentId: "sc-mja0b5-3"
|
|
58941
58967
|
})(["display:flex;justify-content:flex-start;align-items:center;flex:0 0 40px;"]);
|
|
58942
|
-
var SpriteContainer$
|
|
58968
|
+
var SpriteContainer$5 = /*#__PURE__*/styled__default.div.withConfig({
|
|
58943
58969
|
displayName: "TradingItemRow__SpriteContainer",
|
|
58944
58970
|
componentId: "sc-mja0b5-4"
|
|
58945
58971
|
})(["position:relative;top:-0.5rem;left:0;"]);
|
|
@@ -58951,7 +58977,7 @@ var QuantityContainer$1 = /*#__PURE__*/styled__default.div.withConfig({
|
|
|
58951
58977
|
displayName: "TradingItemRow__QuantityContainer",
|
|
58952
58978
|
componentId: "sc-mja0b5-6"
|
|
58953
58979
|
})(["display:flex;min-width:90px;width:40%;justify-content:flex-end;align-items:center;flex:30%;gap:2px;position:relative;"]);
|
|
58954
|
-
var QuantityInput$
|
|
58980
|
+
var QuantityInput$1 = /*#__PURE__*/styled__default.input.withConfig({
|
|
58955
58981
|
displayName: "TradingItemRow__QuantityInput",
|
|
58956
58982
|
componentId: "sc-mja0b5-7"
|
|
58957
58983
|
})(["width:30px;text-align:center;background-color:", ";color:white;border:none;padding:1px;font-size:", ";position:relative;right:4px;"], uiColors.darkGray, uiFonts.size.small);
|