@rpg-engine/long-bow 0.8.70 → 0.8.72
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/CartView.d.ts +7 -6
- package/dist/components/Store/Store.d.ts +3 -2
- package/dist/components/Store/StoreCharacterSkinRow.d.ts +3 -3
- package/dist/components/Store/StoreItemDetails.d.ts +3 -3
- package/dist/components/Store/StoreItemRow.d.ts +5 -3
- package/dist/components/Store/hooks/useStoreCart.d.ts +5 -3
- package/dist/components/Store/hooks/useStoreMetadata.d.ts +3 -3
- package/dist/components/Store/sections/StoreItemsSection.d.ts +4 -3
- package/dist/long-bow.cjs.development.js +110 -49
- 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 +111 -50
- package/dist/long-bow.esm.js.map +1 -1
- package/package.json +2 -2
- package/src/components/Store/CartView.tsx +20 -6
- package/src/components/Store/Store.tsx +16 -21
- package/src/components/Store/StoreCharacterSkinRow.tsx +4 -4
- package/src/components/Store/StoreItemDetails.tsx +4 -4
- package/src/components/Store/StoreItemRow.tsx +46 -6
- package/src/components/Store/hooks/useStoreCart.ts +14 -9
- package/src/components/Store/hooks/useStoreMetadata.ts +5 -5
- package/src/components/Store/sections/StoreItemsSection.tsx +24 -9
- package/src/stories/Features/store/Store.stories.tsx +29 -68
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { IProductBlueprint } from '@rpg-engine/shared';
|
|
2
2
|
import React from 'react';
|
|
3
|
+
interface ICartItem {
|
|
4
|
+
item: IProductBlueprint;
|
|
5
|
+
quantity: number;
|
|
6
|
+
metadata?: Record<string, any>;
|
|
7
|
+
}
|
|
3
8
|
interface ICartViewProps {
|
|
4
|
-
cartItems:
|
|
5
|
-
item: IStoreItem;
|
|
6
|
-
quantity: number;
|
|
7
|
-
metadata?: Record<string, any>;
|
|
8
|
-
}[];
|
|
9
|
+
cartItems: ICartItem[];
|
|
9
10
|
onRemoveFromCart: (itemKey: string) => void;
|
|
10
11
|
onClose: () => void;
|
|
11
12
|
onPurchase: () => Promise<boolean>;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { IItemPack, IPurchase,
|
|
1
|
+
import { IItemPack, IPurchase, IProductBlueprint, UserAccountTypes } from '@rpg-engine/shared';
|
|
2
2
|
import React from 'react';
|
|
3
3
|
declare type TabId = 'premium' | 'packs' | 'items';
|
|
4
4
|
export interface IStoreProps {
|
|
5
|
-
items:
|
|
5
|
+
items: IProductBlueprint[];
|
|
6
6
|
packs?: IItemPack[];
|
|
7
7
|
atlasJSON: any;
|
|
8
8
|
atlasIMG: string;
|
|
@@ -15,6 +15,7 @@ export interface IStoreProps {
|
|
|
15
15
|
hidePremiumTab?: boolean;
|
|
16
16
|
tabOrder?: TabId[];
|
|
17
17
|
defaultActiveTab?: TabId;
|
|
18
|
+
textInputItemKeys?: string[];
|
|
18
19
|
}
|
|
19
20
|
export declare const Store: React.FC<IStoreProps>;
|
|
20
21
|
export {};
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { IProductBlueprint, UserAccountTypes } from '@rpg-engine/shared';
|
|
2
2
|
import React from 'react';
|
|
3
3
|
interface IStoreCharacterSkinRowProps {
|
|
4
|
-
item:
|
|
4
|
+
item: IProductBlueprint;
|
|
5
5
|
atlasJSON: Record<string, any>;
|
|
6
6
|
atlasIMG: string;
|
|
7
|
-
onAddToCart: (item:
|
|
7
|
+
onAddToCart: (item: IProductBlueprint, quantity: number, metadata?: Record<string, any>) => void;
|
|
8
8
|
userAccountType: UserAccountTypes;
|
|
9
9
|
}
|
|
10
10
|
export declare const StoreCharacterSkinRow: React.FC<IStoreCharacterSkinRowProps>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { IItemPack,
|
|
1
|
+
import { IItemPack, IProductBlueprint } from '@rpg-engine/shared';
|
|
2
2
|
import React from 'react';
|
|
3
3
|
interface IStoreItemDetailsProps {
|
|
4
|
-
item:
|
|
4
|
+
item: IProductBlueprint | (IItemPack & {
|
|
5
5
|
name: string;
|
|
6
6
|
texturePath: string;
|
|
7
7
|
});
|
|
@@ -10,7 +10,7 @@ interface IStoreItemDetailsProps {
|
|
|
10
10
|
default?: string;
|
|
11
11
|
};
|
|
12
12
|
onBack: () => void;
|
|
13
|
-
onAddToCart: (item:
|
|
13
|
+
onAddToCart: (item: IProductBlueprint) => void;
|
|
14
14
|
}
|
|
15
15
|
export declare const StoreItemDetails: React.FC<IStoreItemDetailsProps>;
|
|
16
16
|
export {};
|
|
@@ -1,11 +1,13 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { IProductBlueprint, UserAccountTypes } from '@rpg-engine/shared';
|
|
2
2
|
import React from 'react';
|
|
3
3
|
interface IStoreItemRowProps {
|
|
4
|
-
item:
|
|
4
|
+
item: IProductBlueprint;
|
|
5
5
|
atlasJSON: Record<string, any>;
|
|
6
6
|
atlasIMG: string;
|
|
7
|
-
onAddToCart: (item:
|
|
7
|
+
onAddToCart: (item: IProductBlueprint, quantity: number, metadata?: Record<string, any>) => void;
|
|
8
8
|
userAccountType: UserAccountTypes;
|
|
9
|
+
showTextInput?: boolean;
|
|
10
|
+
textInputPlaceholder?: string;
|
|
9
11
|
}
|
|
10
12
|
export declare const StoreItemRow: React.FC<IStoreItemRowProps>;
|
|
11
13
|
export {};
|
|
@@ -1,11 +1,13 @@
|
|
|
1
|
-
import {
|
|
2
|
-
interface ICartItem
|
|
1
|
+
import { IPurchase, IProductBlueprint } from '@rpg-engine/shared';
|
|
2
|
+
interface ICartItem {
|
|
3
|
+
item: IProductBlueprint;
|
|
4
|
+
quantity: number;
|
|
3
5
|
metadata?: Record<string, any>;
|
|
4
6
|
}
|
|
5
7
|
interface IUseStoreCart {
|
|
6
8
|
cartItems: ICartItem[];
|
|
7
9
|
isCartOpen: boolean;
|
|
8
|
-
handleAddToCart: (item:
|
|
10
|
+
handleAddToCart: (item: IProductBlueprint, quantity: number, metadata?: Record<string, any>) => void;
|
|
9
11
|
handleRemoveFromCart: (itemKey: string) => void;
|
|
10
12
|
handlePurchase: (onPurchase: (purchase: IPurchase) => void) => void;
|
|
11
13
|
openCart: () => void;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { IProductBlueprint } from "@rpg-engine/shared";
|
|
2
2
|
interface IUseStoreMetadata {
|
|
3
|
-
collectMetadata: (item:
|
|
3
|
+
collectMetadata: (item: IProductBlueprint) => Promise<Record<string, any> | null>;
|
|
4
4
|
isCollectingMetadata: boolean;
|
|
5
5
|
}
|
|
6
6
|
export declare const useStoreMetadata: () => IUseStoreMetadata;
|
|
@@ -8,7 +8,7 @@ declare global {
|
|
|
8
8
|
interface Window {
|
|
9
9
|
__metadataResolvers?: {
|
|
10
10
|
resolve: (metadata: Record<string, any> | null) => void;
|
|
11
|
-
item:
|
|
11
|
+
item: IProductBlueprint;
|
|
12
12
|
};
|
|
13
13
|
}
|
|
14
14
|
}
|
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { IProductBlueprint, UserAccountTypes } from '@rpg-engine/shared';
|
|
2
2
|
import React from 'react';
|
|
3
3
|
interface IStoreItemsSectionProps {
|
|
4
|
-
items:
|
|
5
|
-
onAddToCart: (item:
|
|
4
|
+
items: IProductBlueprint[];
|
|
5
|
+
onAddToCart: (item: IProductBlueprint, quantity: number, metadata?: Record<string, any>) => void;
|
|
6
6
|
atlasJSON: Record<string, any>;
|
|
7
7
|
atlasIMG: string;
|
|
8
8
|
userAccountType?: UserAccountTypes;
|
|
9
|
+
textInputItemKeys?: string[];
|
|
9
10
|
}
|
|
10
11
|
export declare const StoreItemsSection: React.FC<IStoreItemsSectionProps>;
|
|
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),
|
|
@@ -57630,7 +57634,7 @@ var useStoreMetadata = function useStoreMetadata() {
|
|
|
57630
57634
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
57631
57635
|
while (1) switch (_context.prev = _context.next) {
|
|
57632
57636
|
case 0:
|
|
57633
|
-
if (!(!item.metadataType || item.metadataType
|
|
57637
|
+
if (!(!item.metadataType || item.metadataType !== shared.MetadataType.CharacterSkin)) {
|
|
57634
57638
|
_context.next = 2;
|
|
57635
57639
|
break;
|
|
57636
57640
|
}
|
|
@@ -57710,7 +57714,7 @@ var useStoreCart = function useStoreCart() {
|
|
|
57710
57714
|
});
|
|
57711
57715
|
return _context.abrupt("return");
|
|
57712
57716
|
case 3:
|
|
57713
|
-
if (!(item.metadataType
|
|
57717
|
+
if (!(item.metadataType === shared.MetadataType.CharacterSkin)) {
|
|
57714
57718
|
_context.next = 12;
|
|
57715
57719
|
break;
|
|
57716
57720
|
}
|
|
@@ -57826,7 +57830,11 @@ var useStoreCart = function useStoreCart() {
|
|
|
57826
57830
|
};
|
|
57827
57831
|
// Helper functions
|
|
57828
57832
|
function getPurchaseType(item) {
|
|
57829
|
-
//
|
|
57833
|
+
// Use the type from IProductBlueprint if available, otherwise infer
|
|
57834
|
+
if (item.type) {
|
|
57835
|
+
return item.type;
|
|
57836
|
+
}
|
|
57837
|
+
// Fallback logic for backward compatibility
|
|
57830
57838
|
if (item.key.startsWith('pack_')) {
|
|
57831
57839
|
return shared.PurchaseType.Pack;
|
|
57832
57840
|
} else {
|
|
@@ -57976,7 +57984,7 @@ var StoreCharacterSkinRow = function StoreCharacterSkinRow(_ref) {
|
|
|
57976
57984
|
// Effect to reset currentIndex when switching items
|
|
57977
57985
|
React.useEffect(function () {
|
|
57978
57986
|
setCurrentIndex(0);
|
|
57979
|
-
}, [item.
|
|
57987
|
+
}, [item.key]);
|
|
57980
57988
|
var handlePreviousSkin = function handlePreviousSkin() {
|
|
57981
57989
|
setCurrentIndex(function (prevIndex) {
|
|
57982
57990
|
return prevIndex === 0 ? availableCharacters.length - 1 : prevIndex - 1;
|
|
@@ -58083,10 +58091,17 @@ var StoreItemRow = function StoreItemRow(_ref) {
|
|
|
58083
58091
|
atlasJSON = _ref.atlasJSON,
|
|
58084
58092
|
atlasIMG = _ref.atlasIMG,
|
|
58085
58093
|
onAddToCart = _ref.onAddToCart,
|
|
58086
|
-
userAccountType = _ref.userAccountType
|
|
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;
|
|
58087
58099
|
var _useState = React.useState(1),
|
|
58088
58100
|
quantity = _useState[0],
|
|
58089
58101
|
setQuantity = _useState[1];
|
|
58102
|
+
var _useState2 = React.useState(''),
|
|
58103
|
+
textInputValue = _useState2[0],
|
|
58104
|
+
setTextInputValue = _useState2[1];
|
|
58090
58105
|
var handleQuantityChange = function handleQuantityChange(e) {
|
|
58091
58106
|
var value = parseInt(e.target.value) || 1;
|
|
58092
58107
|
setQuantity(Math.min(Math.max(1, value), 99));
|
|
@@ -58106,10 +58121,17 @@ var StoreItemRow = function StoreItemRow(_ref) {
|
|
|
58106
58121
|
});
|
|
58107
58122
|
};
|
|
58108
58123
|
var hasRequiredAccount = !((_item$requiredAccount = item.requiredAccountType) != null && _item$requiredAccount.length) || item.requiredAccountType.includes(userAccountType);
|
|
58109
|
-
var
|
|
58124
|
+
var handleAddToCartInternal = function handleAddToCartInternal() {
|
|
58110
58125
|
if (!hasRequiredAccount) return;
|
|
58111
|
-
|
|
58112
|
-
|
|
58126
|
+
if (showTextInput) {
|
|
58127
|
+
onAddToCart(item, 1, {
|
|
58128
|
+
inputValue: textInputValue
|
|
58129
|
+
});
|
|
58130
|
+
setTextInputValue('');
|
|
58131
|
+
} else {
|
|
58132
|
+
onAddToCart(item, quantity);
|
|
58133
|
+
setQuantity(1);
|
|
58134
|
+
}
|
|
58113
58135
|
};
|
|
58114
58136
|
return React__default.createElement(ItemWrapper$1, null, React__default.createElement(ItemIconContainer$3, null, React__default.createElement(SpriteFromAtlas, {
|
|
58115
58137
|
atlasJSON: atlasJSON,
|
|
@@ -58119,7 +58141,15 @@ var StoreItemRow = function StoreItemRow(_ref) {
|
|
|
58119
58141
|
height: 32,
|
|
58120
58142
|
imgScale: 2,
|
|
58121
58143
|
centered: true
|
|
58122
|
-
})), React__default.createElement(ItemDetails$2, null, React__default.createElement(ItemName$2, null, item.name), React__default.createElement(ItemPrice$1, null, "$", item.price)
|
|
58144
|
+
})), 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(ItemDescription, null, item.description)), React__default.createElement(Controls$1, null, showTextInput ? React__default.createElement(TextInput, {
|
|
58145
|
+
type: "text",
|
|
58146
|
+
value: textInputValue,
|
|
58147
|
+
placeholder: textInputPlaceholder,
|
|
58148
|
+
onChange: function onChange(e) {
|
|
58149
|
+
return setTextInputValue(e.target.value);
|
|
58150
|
+
},
|
|
58151
|
+
className: "rpgui-input"
|
|
58152
|
+
}) : item.isStackable ? React__default.createElement(ArrowsContainer, null, React__default.createElement(SelectArrow, {
|
|
58123
58153
|
direction: "left",
|
|
58124
58154
|
onPointerDown: decrementQuantity,
|
|
58125
58155
|
size: 24
|
|
@@ -58135,10 +58165,10 @@ var StoreItemRow = function StoreItemRow(_ref) {
|
|
|
58135
58165
|
direction: "right",
|
|
58136
58166
|
onPointerDown: incrementQuantity,
|
|
58137
58167
|
size: 24
|
|
58138
|
-
})), React__default.createElement(CTAButton, {
|
|
58168
|
+
})) : null, React__default.createElement(CTAButton, {
|
|
58139
58169
|
icon: React__default.createElement(fa.FaCartPlus, null),
|
|
58140
58170
|
label: "Add",
|
|
58141
|
-
onClick:
|
|
58171
|
+
onClick: handleAddToCartInternal,
|
|
58142
58172
|
disabled: !hasRequiredAccount
|
|
58143
58173
|
})));
|
|
58144
58174
|
};
|
|
@@ -58162,25 +58192,35 @@ var ItemPrice$1 = /*#__PURE__*/styled__default.div.withConfig({
|
|
|
58162
58192
|
displayName: "StoreItemRow__ItemPrice",
|
|
58163
58193
|
componentId: "sc-ptotuo-4"
|
|
58164
58194
|
})(["font-family:'Press Start 2P',cursive;font-size:0.75rem;color:#fef08a;"]);
|
|
58195
|
+
var ItemDescription = /*#__PURE__*/styled__default.div.withConfig({
|
|
58196
|
+
displayName: "StoreItemRow__ItemDescription",
|
|
58197
|
+
componentId: "sc-ptotuo-5"
|
|
58198
|
+
})(["font-family:'Press Start 2P',cursive;font-size:0.625rem;color:rgba(255,255,255,0.7);line-height:1.4;"]);
|
|
58165
58199
|
var Controls$1 = /*#__PURE__*/styled__default.div.withConfig({
|
|
58166
58200
|
displayName: "StoreItemRow__Controls",
|
|
58167
|
-
componentId: "sc-ptotuo-
|
|
58201
|
+
componentId: "sc-ptotuo-6"
|
|
58168
58202
|
})(["display:flex;align-items:center;gap:1rem;min-width:fit-content;"]);
|
|
58169
58203
|
var ArrowsContainer = /*#__PURE__*/styled__default.div.withConfig({
|
|
58170
58204
|
displayName: "StoreItemRow__ArrowsContainer",
|
|
58171
|
-
componentId: "sc-ptotuo-
|
|
58205
|
+
componentId: "sc-ptotuo-7"
|
|
58172
58206
|
})(["position:relative;display:flex;align-items:center;width:120px;height:42px;justify-content:space-between;"]);
|
|
58173
58207
|
var QuantityInput = /*#__PURE__*/styled__default.input.withConfig({
|
|
58174
58208
|
displayName: "StoreItemRow__QuantityInput",
|
|
58175
|
-
componentId: "sc-ptotuo-
|
|
58209
|
+
componentId: "sc-ptotuo-8"
|
|
58176
58210
|
})(["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;}"]);
|
|
58211
|
+
var TextInput = /*#__PURE__*/styled__default.input.withConfig({
|
|
58212
|
+
displayName: "StoreItemRow__TextInput",
|
|
58213
|
+
componentId: "sc-ptotuo-9"
|
|
58214
|
+
})(["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;"]);
|
|
58177
58215
|
|
|
58178
58216
|
var StoreItemsSection = function StoreItemsSection(_ref) {
|
|
58179
58217
|
var items = _ref.items,
|
|
58180
58218
|
onAddToCart = _ref.onAddToCart,
|
|
58181
58219
|
atlasJSON = _ref.atlasJSON,
|
|
58182
58220
|
atlasIMG = _ref.atlasIMG,
|
|
58183
|
-
userAccountType = _ref.userAccountType
|
|
58221
|
+
userAccountType = _ref.userAccountType,
|
|
58222
|
+
_ref$textInputItemKey = _ref.textInputItemKeys,
|
|
58223
|
+
textInputItemKeys = _ref$textInputItemKey === void 0 ? [] : _ref$textInputItemKey;
|
|
58184
58224
|
var _useState = React.useState(''),
|
|
58185
58225
|
searchQuery = _useState[0],
|
|
58186
58226
|
setSearchQuery = _useState[1];
|
|
@@ -58188,10 +58228,10 @@ var StoreItemsSection = function StoreItemsSection(_ref) {
|
|
|
58188
58228
|
return item.name.toLowerCase().includes(searchQuery.toLowerCase());
|
|
58189
58229
|
});
|
|
58190
58230
|
var renderStoreItem = function renderStoreItem(item) {
|
|
58191
|
-
//
|
|
58231
|
+
// Prefer a specialized character skin row when needed
|
|
58192
58232
|
if (item.metadataType === shared.MetadataType.CharacterSkin) {
|
|
58193
58233
|
return React__default.createElement(StoreCharacterSkinRow, {
|
|
58194
|
-
key: item.
|
|
58234
|
+
key: item.key,
|
|
58195
58235
|
item: item,
|
|
58196
58236
|
atlasJSON: atlasJSON,
|
|
58197
58237
|
atlasIMG: atlasIMG,
|
|
@@ -58199,9 +58239,21 @@ var StoreItemsSection = function StoreItemsSection(_ref) {
|
|
|
58199
58239
|
userAccountType: userAccountType || shared.UserAccountTypes.Free
|
|
58200
58240
|
});
|
|
58201
58241
|
}
|
|
58202
|
-
//
|
|
58242
|
+
// Render text input row when configured for this item key
|
|
58243
|
+
if (textInputItemKeys.includes(item.key)) {
|
|
58244
|
+
return React__default.createElement(StoreItemRow, {
|
|
58245
|
+
key: item.key,
|
|
58246
|
+
item: item,
|
|
58247
|
+
atlasJSON: atlasJSON,
|
|
58248
|
+
atlasIMG: atlasIMG,
|
|
58249
|
+
onAddToCart: onAddToCart,
|
|
58250
|
+
userAccountType: userAccountType || shared.UserAccountTypes.Free,
|
|
58251
|
+
showTextInput: true
|
|
58252
|
+
});
|
|
58253
|
+
}
|
|
58254
|
+
// Fallback to standard arrow-based row
|
|
58203
58255
|
return React__default.createElement(StoreItemRow, {
|
|
58204
|
-
key: item.
|
|
58256
|
+
key: item.key,
|
|
58205
58257
|
item: item,
|
|
58206
58258
|
atlasJSON: atlasJSON,
|
|
58207
58259
|
atlasIMG: atlasIMG,
|
|
@@ -58418,7 +58470,7 @@ var Store = function Store(_ref) {
|
|
|
58418
58470
|
packs = _ref$packs === void 0 ? [] : _ref$packs,
|
|
58419
58471
|
atlasJSON = _ref.atlasJSON,
|
|
58420
58472
|
atlasIMG = _ref.atlasIMG,
|
|
58421
|
-
|
|
58473
|
+
_onPurchase2 = _ref.onPurchase,
|
|
58422
58474
|
onShowHistory = _ref.onShowHistory,
|
|
58423
58475
|
userAccountType = _ref.userAccountType,
|
|
58424
58476
|
_ref$loading = _ref.loading,
|
|
@@ -58428,7 +58480,9 @@ var Store = function Store(_ref) {
|
|
|
58428
58480
|
_ref$hidePremiumTab = _ref.hidePremiumTab,
|
|
58429
58481
|
hidePremiumTab = _ref$hidePremiumTab === void 0 ? false : _ref$hidePremiumTab,
|
|
58430
58482
|
tabOrder = _ref.tabOrder,
|
|
58431
|
-
defaultActiveTab = _ref.defaultActiveTab
|
|
58483
|
+
defaultActiveTab = _ref.defaultActiveTab,
|
|
58484
|
+
_ref$textInputItemKey = _ref.textInputItemKeys,
|
|
58485
|
+
textInputItemKeys = _ref$textInputItemKey === void 0 ? [] : _ref$textInputItemKey;
|
|
58432
58486
|
var _useState = React.useState(null),
|
|
58433
58487
|
selectedPack = _useState[0],
|
|
58434
58488
|
setSelectedPack = _useState[1];
|
|
@@ -58461,29 +58515,35 @@ var Store = function Store(_ref) {
|
|
|
58461
58515
|
setCurrentMetadataItem = _useState4[1];
|
|
58462
58516
|
var handleAddPackToCart = function handleAddPackToCart(pack) {
|
|
58463
58517
|
var packItem = {
|
|
58464
|
-
_id: pack.key,
|
|
58465
58518
|
key: pack.key,
|
|
58466
58519
|
name: pack.title,
|
|
58520
|
+
description: pack.description || '',
|
|
58467
58521
|
price: pack.priceUSD,
|
|
58522
|
+
currency: shared.PaymentCurrency.USD,
|
|
58468
58523
|
texturePath: pack.image["default"] || pack.image.src,
|
|
58469
|
-
|
|
58470
|
-
|
|
58471
|
-
|
|
58472
|
-
|
|
58473
|
-
|
|
58474
|
-
|
|
58475
|
-
|
|
58524
|
+
type: shared.PurchaseType.Pack,
|
|
58525
|
+
onPurchase: function () {
|
|
58526
|
+
var _onPurchase = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
58527
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
58528
|
+
while (1) switch (_context.prev = _context.next) {
|
|
58529
|
+
case 0:
|
|
58530
|
+
case "end":
|
|
58531
|
+
return _context.stop();
|
|
58532
|
+
}
|
|
58533
|
+
}, _callee);
|
|
58534
|
+
}));
|
|
58535
|
+
function onPurchase() {
|
|
58536
|
+
return _onPurchase.apply(this, arguments);
|
|
58537
|
+
}
|
|
58538
|
+
return onPurchase;
|
|
58539
|
+
}(),
|
|
58540
|
+
itemType: shared.ItemType.Consumable,
|
|
58541
|
+
itemSubType: shared.ItemSubType.Other,
|
|
58476
58542
|
rarity: shared.ItemRarities.Common,
|
|
58477
|
-
|
|
58478
|
-
isEquipable: false,
|
|
58543
|
+
weight: 0,
|
|
58479
58544
|
isStackable: false,
|
|
58480
|
-
isTwoHanded: false,
|
|
58481
|
-
hasUseWith: false,
|
|
58482
58545
|
maxStackSize: 1,
|
|
58483
|
-
isUsable: false
|
|
58484
|
-
isStorable: true,
|
|
58485
|
-
isSolid: false,
|
|
58486
|
-
isItemContainer: false
|
|
58546
|
+
isUsable: false
|
|
58487
58547
|
};
|
|
58488
58548
|
handleAddToCart(packItem, 1);
|
|
58489
58549
|
};
|
|
@@ -58563,7 +58623,8 @@ var Store = function Store(_ref) {
|
|
|
58563
58623
|
onAddToCart: handleAddToCart,
|
|
58564
58624
|
atlasJSON: atlasJSON,
|
|
58565
58625
|
atlasIMG: atlasIMG,
|
|
58566
|
-
userAccountType: userAccountType
|
|
58626
|
+
userAccountType: userAccountType,
|
|
58627
|
+
textInputItemKeys: textInputItemKeys
|
|
58567
58628
|
})
|
|
58568
58629
|
}
|
|
58569
58630
|
};
|
|
@@ -58588,22 +58649,22 @@ var Store = function Store(_ref) {
|
|
|
58588
58649
|
onRemoveFromCart: handleRemoveFromCart,
|
|
58589
58650
|
onClose: closeCart,
|
|
58590
58651
|
onPurchase: function () {
|
|
58591
|
-
var
|
|
58592
|
-
return _regeneratorRuntime().wrap(function
|
|
58593
|
-
while (1) switch (
|
|
58652
|
+
var _onPurchase3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
|
|
58653
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
58654
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
58594
58655
|
case 0:
|
|
58595
|
-
|
|
58596
|
-
return handleCartPurchase(
|
|
58656
|
+
_context2.next = 2;
|
|
58657
|
+
return handleCartPurchase(_onPurchase2);
|
|
58597
58658
|
case 2:
|
|
58598
|
-
return
|
|
58659
|
+
return _context2.abrupt("return", true);
|
|
58599
58660
|
case 3:
|
|
58600
58661
|
case "end":
|
|
58601
|
-
return
|
|
58662
|
+
return _context2.stop();
|
|
58602
58663
|
}
|
|
58603
|
-
},
|
|
58664
|
+
}, _callee2);
|
|
58604
58665
|
}));
|
|
58605
58666
|
function onPurchase() {
|
|
58606
|
-
return
|
|
58667
|
+
return _onPurchase3.apply(this, arguments);
|
|
58607
58668
|
}
|
|
58608
58669
|
return onPurchase;
|
|
58609
58670
|
}(),
|