@rpg-engine/long-bow 0.8.219 → 0.8.221
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/DraggableContainer.d.ts +0 -6
- package/dist/components/Store/CartView.d.ts +0 -2
- package/dist/components/Store/MetadataCollector.d.ts +2 -2
- package/dist/components/Store/Store.d.ts +10 -28
- package/dist/components/Store/StoreHeader.d.ts +14 -0
- package/dist/components/Store/hooks/useStoreCart.d.ts +2 -0
- package/dist/components/Store/hooks/useStoreMetadata.d.ts +4 -11
- package/dist/components/Store/hooks/useStoreTabs.d.ts +20 -0
- package/dist/components/Store/internal/packToBlueprint.d.ts +2 -0
- package/dist/components/Store/sections/StoreItemsSection.d.ts +5 -3
- package/dist/hooks/useStoreFiltering.d.ts +7 -4
- package/dist/long-bow.cjs.development.js +379 -441
- 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 +381 -443
- package/dist/long-bow.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/components/DraggableContainer.tsx +0 -24
- package/src/components/Store/CartView.tsx +116 -137
- package/src/components/Store/MetadataCollector.tsx +60 -40
- package/src/components/Store/Store.tsx +75 -285
- package/src/components/Store/StoreHeader.tsx +74 -0
- package/src/components/Store/__test__/MetadataCollector.spec.tsx +94 -164
- package/src/components/Store/__test__/Store.spec.tsx +4 -0
- package/src/components/Store/__test__/useStoreMetadata.spec.tsx +58 -156
- package/src/components/Store/__test__/useStoreTabs.spec.tsx +69 -0
- package/src/components/Store/hooks/useStoreCart.ts +5 -2
- package/src/components/Store/hooks/useStoreMetadata.ts +30 -48
- package/src/components/Store/hooks/useStoreTabs.ts +104 -0
- package/src/components/Store/internal/packToBlueprint.ts +21 -0
- package/src/components/Store/sections/StoreItemsSection.tsx +19 -60
- package/src/components/Store/sections/StorePacksSection.tsx +0 -1
- package/src/components/shared/ScrollableContent/ScrollableContent.tsx +3 -6
- package/src/hooks/useStoreFiltering.spec.tsx +79 -0
- package/src/hooks/useStoreFiltering.ts +27 -9
package/dist/long-bow.esm.js
CHANGED
|
@@ -2,11 +2,11 @@ import React, { useState, useEffect, Component, useRef, useCallback, useMemo, me
|
|
|
2
2
|
import styled, { css, createGlobalStyle, keyframes } 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, isMobileOrTablet, RewardType, DC_TO_GOLD_SWAP_RATE, ItemSlotType, NPCSubtype, EntityAttackType, NPCAlignment, VideoGuideCategory, VideoGuideLanguage, MarketplaceBuyOrderStatus, MarketplaceAcceptedCurrency, formatDCAmount, goldToDC, MarketplaceTransactionType, CharacterClass as CharacterClass$2, QuestStatus, getLevelFromXP, getSkillConstants, getLevelFromSPTiered, getXPForLevel, getSPForLevelTiered, MetadataType, PurchaseType,
|
|
5
|
+
import { GRID_WIDTH, GRID_HEIGHT, ShortcutType, getItemTextureKeyPath, ItemContainerType, ItemType, DepotSocketEvents, ItemSocketEvents, ItemSocketEventsDisplayLabels, ActionsForInventory, ActionsForEquipmentSet, ActionsForLoot, ActionsForMapContainer, ItemQualityLevel, ItemRarities, ItemSubType, isMobile, TaskType, TaskStatus, isMobileOrTablet, RewardType, DC_TO_GOLD_SWAP_RATE, ItemSlotType, NPCSubtype, EntityAttackType, NPCAlignment, VideoGuideCategory, VideoGuideLanguage, MarketplaceBuyOrderStatus, MarketplaceAcceptedCurrency, formatDCAmount, goldToDC, MarketplaceTransactionType, CharacterClass as CharacterClass$2, QuestStatus, getLevelFromXP, getSkillConstants, getLevelFromSPTiered, getXPForLevel, getSPForLevelTiered, MetadataType, PurchaseType, PaymentCurrency, UserAccountTypes, PeriodOfDay } from '@rpg-engine/shared';
|
|
6
6
|
export { MarketplaceAcceptedCurrency } from '@rpg-engine/shared';
|
|
7
7
|
import dayjs from 'dayjs';
|
|
8
8
|
import { ErrorBoundary as ErrorBoundary$1 } from 'react-error-boundary';
|
|
9
|
-
import { FaTimes, FaDiscord, FaWhatsapp, FaSearch, FaThumbtack, FaBoxOpen, FaChevronLeft, FaChevronRight, FaClipboardList, FaPaperPlane, FaShoppingCart, FaChevronUp, FaChevronDown, FaReddit, FaLock, FaRocket, FaHeadset, FaStar, FaShoppingBag, FaTrash,
|
|
9
|
+
import { FaTimes, FaDiscord, FaWhatsapp, FaSearch, FaThumbtack, FaBoxOpen, FaChevronLeft, FaChevronRight, FaClipboardList, FaPaperPlane, FaShoppingCart, FaChevronUp, FaChevronDown, FaReddit, FaLock, FaRocket, FaHeadset, FaStar, FaShoppingBag, FaTrash, FaInfoCircle, FaBolt, FaCartPlus, FaCheckCircle, FaTicketAlt, FaExclamationCircle, FaArrowLeft, FaUsers, FaWallet, FaHistory } from 'react-icons/fa';
|
|
10
10
|
import { RxMagnifyingGlass, RxCross2 } from 'react-icons/rx';
|
|
11
11
|
import { IoMdContract, IoMdExpand } from 'react-icons/io';
|
|
12
12
|
import ReactDOM, { createPortal } from 'react-dom';
|
|
@@ -2468,10 +2468,6 @@ var DraggableContainer = function DraggableContainer(_ref) {
|
|
|
2468
2468
|
height = _ref.height,
|
|
2469
2469
|
minHeight = _ref.minHeight,
|
|
2470
2470
|
minWidth = _ref.minWidth,
|
|
2471
|
-
mobileWidth = _ref.mobileWidth,
|
|
2472
|
-
mobileHeight = _ref.mobileHeight,
|
|
2473
|
-
_ref$mobileBreakpoint = _ref.mobileBreakpoint,
|
|
2474
|
-
mobileBreakpoint = _ref$mobileBreakpoint === void 0 ? 768 : _ref$mobileBreakpoint,
|
|
2475
2471
|
className = _ref.className,
|
|
2476
2472
|
_ref$type = _ref.type,
|
|
2477
2473
|
type = _ref$type === void 0 ? RPGUIContainerTypes.FramedGold : _ref$type,
|
|
@@ -2548,9 +2544,6 @@ var DraggableContainer = function DraggableContainer(_ref) {
|
|
|
2548
2544
|
height: height || 'auto',
|
|
2549
2545
|
minWidth: minWidth,
|
|
2550
2546
|
minHeight: minHeight,
|
|
2551
|
-
mobileWidth: mobileWidth,
|
|
2552
|
-
mobileHeight: mobileHeight,
|
|
2553
|
-
mobileBreakpoint: mobileBreakpoint,
|
|
2554
2547
|
className: "rpgui-container " + type + " " + className,
|
|
2555
2548
|
isFullScreen: isFullScreen,
|
|
2556
2549
|
opacity: opacity
|
|
@@ -2567,7 +2560,7 @@ var DraggableContainer = function DraggableContainer(_ref) {
|
|
|
2567
2560
|
var Container$a = /*#__PURE__*/styled.div.withConfig({
|
|
2568
2561
|
displayName: "DraggableContainer__Container",
|
|
2569
2562
|
componentId: "sc-184mpyl-0"
|
|
2570
|
-
})(["height:", ";width:", ";min-width:", ";min-height:", ";display:flex;flex-wrap:wrap;image-rendering:pixelated;overflow-y:hidden;", " ", "
|
|
2563
|
+
})(["height:", ";width:", ";min-width:", ";min-height:", ";display:flex;flex-wrap:wrap;image-rendering:pixelated;overflow-y:hidden;", " ", " &.rpgui-container{padding-top:1.5rem;}"], function (props) {
|
|
2571
2564
|
return props.height;
|
|
2572
2565
|
}, function (_ref2) {
|
|
2573
2566
|
var width = _ref2.width;
|
|
@@ -2584,11 +2577,6 @@ var Container$a = /*#__PURE__*/styled.div.withConfig({
|
|
|
2584
2577
|
}, function (_ref6) {
|
|
2585
2578
|
var isFullScreen = _ref6.isFullScreen;
|
|
2586
2579
|
return isFullScreen && css(["justify-content:center;align-items:flex-start;align-content:flex-start;"]);
|
|
2587
|
-
}, function (_ref7) {
|
|
2588
|
-
var mobileWidth = _ref7.mobileWidth,
|
|
2589
|
-
mobileHeight = _ref7.mobileHeight,
|
|
2590
|
-
mobileBreakpoint = _ref7.mobileBreakpoint;
|
|
2591
|
-
return (mobileWidth || mobileHeight) && css(["@media (max-width:", "px){", " ", "}"], mobileBreakpoint != null ? mobileBreakpoint : 768, mobileWidth && "width: " + mobileWidth + "; min-width: unset;", mobileHeight && "height: " + mobileHeight + "; min-height: unset;");
|
|
2592
2580
|
});
|
|
2593
2581
|
var CloseButton$4 = /*#__PURE__*/styled.div.withConfig({
|
|
2594
2582
|
displayName: "DraggableContainer__CloseButton",
|
|
@@ -2605,8 +2593,8 @@ var Title$1 = /*#__PURE__*/styled.h1.withConfig({
|
|
|
2605
2593
|
var Icon = /*#__PURE__*/styled.img.withConfig({
|
|
2606
2594
|
displayName: "DraggableContainer__Icon",
|
|
2607
2595
|
componentId: "sc-184mpyl-4"
|
|
2608
|
-
})(["color:white;z-index:22;font-size:", ";width:", ";margin-right:0.5rem;"], uiFonts.size.xsmall, function (
|
|
2609
|
-
var width =
|
|
2596
|
+
})(["color:white;z-index:22;font-size:", ";width:", ";margin-right:0.5rem;"], uiFonts.size.xsmall, function (_ref7) {
|
|
2597
|
+
var width = _ref7.width;
|
|
2610
2598
|
return width;
|
|
2611
2599
|
});
|
|
2612
2600
|
|
|
@@ -37569,7 +37557,6 @@ var CartView = function CartView(_ref2) {
|
|
|
37569
37557
|
paymentMethodLabel = _ref2.paymentMethodLabel,
|
|
37570
37558
|
trustSignals = _ref2.trustSignals,
|
|
37571
37559
|
onCloseStore = _ref2.onCloseStore,
|
|
37572
|
-
onBuyDC = _ref2.onBuyDC,
|
|
37573
37560
|
onCheckoutStart = _ref2.onCheckoutStart,
|
|
37574
37561
|
onPurchaseSuccess = _ref2.onPurchaseSuccess,
|
|
37575
37562
|
onPurchaseError = _ref2.onPurchaseError,
|
|
@@ -37648,11 +37635,6 @@ var CartView = function CartView(_ref2) {
|
|
|
37648
37635
|
return _ref3.apply(this, arguments);
|
|
37649
37636
|
};
|
|
37650
37637
|
}();
|
|
37651
|
-
// Show DC discount nudge when items have DC pricing and user might benefit
|
|
37652
|
-
var hasDCItems = cartItems.some(function (ci) {
|
|
37653
|
-
return ci.item.dcPrice;
|
|
37654
|
-
});
|
|
37655
|
-
var showDCNudge = hasDCItems && onBuyDC;
|
|
37656
37638
|
if (purchasedItems) {
|
|
37657
37639
|
return React.createElement(PurchaseSuccess, {
|
|
37658
37640
|
items: purchasedItems.map(function (ci) {
|
|
@@ -37677,9 +37659,8 @@ var CartView = function CartView(_ref2) {
|
|
|
37677
37659
|
return s + ci.quantity;
|
|
37678
37660
|
}, 0), ")"), React.createElement(CloseButton$h, {
|
|
37679
37661
|
onPointerDown: onClose
|
|
37680
|
-
}, React.createElement(FaTimes, null))), React.createElement(CartItems, null, cartItems.length === 0 ? React.createElement(EmptyCart, null, "Your cart is empty") : cartItems.map(function (cartItem) {
|
|
37662
|
+
}, React.createElement(FaTimes, null))), React.createElement(MainContent$1, null, React.createElement(CartItems, null, cartItems.length === 0 ? React.createElement(EmptyCart, null, "Your cart is empty") : cartItems.map(function (cartItem) {
|
|
37681
37663
|
var _cartItem$metadata, _cartItem$metadata2, _cartItem$item$region2, _cartItem$item$region3;
|
|
37682
|
-
console.log('Item metadataType: , texturePath:', cartItem.item.metadataType, cartItem.item.texturePath);
|
|
37683
37664
|
var getSpriteKey = function getSpriteKey(textureKey) {
|
|
37684
37665
|
return textureKey + '/down/standing/0.png';
|
|
37685
37666
|
};
|
|
@@ -37703,15 +37684,13 @@ var CartView = function CartView(_ref2) {
|
|
|
37703
37684
|
onRemoveFromCart(cartItem.item.key);
|
|
37704
37685
|
}
|
|
37705
37686
|
}));
|
|
37706
|
-
})), React.createElement(
|
|
37707
|
-
onPointerDown: onBuyDC
|
|
37708
|
-
}, React.createElement(FaCoins, null), React.createElement("span", null, "Save more with DC \u2014 volume discounts available"), React.createElement(DCNudgeLink, null, "Buy DC \u2192")), React.createElement(TrustBar, {
|
|
37709
|
-
signals: trustSignals
|
|
37710
|
-
}), React.createElement(TotalInfo, null, React.createElement(OrderSummaryLabel, null, "Order Summary"), React.createElement(TotalRow, null, React.createElement("span", null, "Subtotal:"), React.createElement("span", null, currencySymbol, formatPrice(total))), dcTotal > 0 && React.createElement(TotalRow, null, React.createElement("span", null, "DC:"), React.createElement("span", null, React.createElement(MMORPGNumber, {
|
|
37687
|
+
})), cartItems.length > 0 && React.createElement(OrderSummaryPanel, null, React.createElement(OrderSummaryLabel, null, "Order Summary"), React.createElement(TotalRow, null, React.createElement("span", null, "Subtotal:"), React.createElement("span", null, currencySymbol, formatPrice(total))), dcTotal > 0 && React.createElement(TotalRow, null, React.createElement("span", null, "DC:"), React.createElement("span", null, React.createElement(MMORPGNumber, {
|
|
37711
37688
|
value: dcTotal
|
|
37712
37689
|
}), " DC")), React.createElement(TotalRow, {
|
|
37713
37690
|
"$isTotal": true
|
|
37714
|
-
}, React.createElement("span", null, "Total:"), React.createElement("span", null, currencySymbol, formatPrice(total))), paymentMethodLabel && React.createElement(PaymentMethodRow, null, React.createElement("span", null, "Paying with:"), React.createElement("span", null, paymentMethodLabel)),
|
|
37691
|
+
}, React.createElement("span", null, "Total:"), React.createElement("span", null, currencySymbol, formatPrice(total))), paymentMethodLabel && React.createElement(PaymentMethodRow, null, React.createElement("span", null, "Paying with:"), React.createElement("span", null, paymentMethodLabel)))), React.createElement(Footer$2, null, React.createElement(TrustBar, {
|
|
37692
|
+
signals: trustSignals
|
|
37693
|
+
}), error && React.createElement(ErrorMessage$2, null, error), React.createElement(CTAButton, {
|
|
37715
37694
|
icon: React.createElement(FaShoppingBag, null),
|
|
37716
37695
|
label: isLoading ? 'Processing...' : "Pay " + currencySymbol + formatPrice(total),
|
|
37717
37696
|
onClick: handlePurchase,
|
|
@@ -37722,11 +37701,11 @@ var CartView = function CartView(_ref2) {
|
|
|
37722
37701
|
var Container$M = /*#__PURE__*/styled.div.withConfig({
|
|
37723
37702
|
displayName: "CartView__Container",
|
|
37724
37703
|
componentId: "sc-ydtyl1-0"
|
|
37725
|
-
})(["display:flex;flex-direction:column;width:100%;
|
|
37704
|
+
})(["display:flex;flex-direction:column;width:100%;height:100%;padding:1rem;overflow:hidden;box-sizing:border-box;"]);
|
|
37726
37705
|
var Header$g = /*#__PURE__*/styled.div.withConfig({
|
|
37727
37706
|
displayName: "CartView__Header",
|
|
37728
37707
|
componentId: "sc-ydtyl1-1"
|
|
37729
|
-
})(["display:flex;justify-content:space-between;align-items:center;"]);
|
|
37708
|
+
})(["display:flex;justify-content:space-between;align-items:center;flex-shrink:0;"]);
|
|
37730
37709
|
var Title$n = /*#__PURE__*/styled.h2.withConfig({
|
|
37731
37710
|
displayName: "CartView__Title",
|
|
37732
37711
|
componentId: "sc-ydtyl1-2"
|
|
@@ -37735,49 +37714,53 @@ var CloseButton$h = /*#__PURE__*/styled.div.withConfig({
|
|
|
37735
37714
|
displayName: "CartView__CloseButton",
|
|
37736
37715
|
componentId: "sc-ydtyl1-3"
|
|
37737
37716
|
})(["padding:0.5rem;min-width:unset;width:42px;height:42px;display:flex;font-size:1.5rem;align-items:center;color:white;justify-content:center;"]);
|
|
37717
|
+
var MainContent$1 = /*#__PURE__*/styled.div.withConfig({
|
|
37718
|
+
displayName: "CartView__MainContent",
|
|
37719
|
+
componentId: "sc-ydtyl1-4"
|
|
37720
|
+
})(["display:grid;grid-template-columns:1fr 260px;gap:1rem;flex:1;min-height:0;margin:1rem 0;@media (max-width:700px){grid-template-columns:1fr;gap:0.75rem;}"]);
|
|
37738
37721
|
var CartItems = /*#__PURE__*/styled.div.withConfig({
|
|
37739
37722
|
displayName: "CartView__CartItems",
|
|
37740
|
-
componentId: "sc-ydtyl1-
|
|
37741
|
-
})(["display:flex;flex-direction:column;gap:0.5rem;overflow-y:auto;
|
|
37723
|
+
componentId: "sc-ydtyl1-5"
|
|
37724
|
+
})(["display:flex;flex-direction:column;gap:0.5rem;min-height:0;overflow-y:auto;padding-right:0.5rem;&::-webkit-scrollbar{width:6px;}&::-webkit-scrollbar-track{background:rgba(0,0,0,0.2);border-radius:4px;}&::-webkit-scrollbar-thumb{background:#f59e0b;border-radius:4px;&:hover{background:#fbbf24;}}"]);
|
|
37725
|
+
var OrderSummaryPanel = /*#__PURE__*/styled.div.withConfig({
|
|
37726
|
+
displayName: "CartView__OrderSummaryPanel",
|
|
37727
|
+
componentId: "sc-ydtyl1-6"
|
|
37728
|
+
})(["display:flex;flex-direction:column;gap:0.5rem;padding:1rem;background:rgba(0,0,0,0.25);border:1px solid rgba(255,255,255,0.08);border-radius:6px;align-self:start;"]);
|
|
37742
37729
|
var EmptyCart = /*#__PURE__*/styled.div.withConfig({
|
|
37743
37730
|
displayName: "CartView__EmptyCart",
|
|
37744
|
-
componentId: "sc-ydtyl1-
|
|
37731
|
+
componentId: "sc-ydtyl1-7"
|
|
37745
37732
|
})(["display:flex;align-items:center;justify-content:center;height:100%;color:#ffffff;font-family:'Press Start 2P',cursive;font-size:0.875rem;opacity:0.7;"]);
|
|
37746
37733
|
var CartItemRow = /*#__PURE__*/styled.div.withConfig({
|
|
37747
37734
|
displayName: "CartView__CartItemRow",
|
|
37748
|
-
componentId: "sc-ydtyl1-
|
|
37735
|
+
componentId: "sc-ydtyl1-8"
|
|
37749
37736
|
})(["display:flex;align-items:center;gap:0.75rem;padding:0.5rem 0.75rem;background:rgba(0,0,0,0.2);border-radius:4px;"]);
|
|
37750
37737
|
var ItemIconContainer = /*#__PURE__*/styled.div.withConfig({
|
|
37751
37738
|
displayName: "CartView__ItemIconContainer",
|
|
37752
|
-
componentId: "sc-ydtyl1-
|
|
37739
|
+
componentId: "sc-ydtyl1-9"
|
|
37753
37740
|
})(["width:24px;height:24px;display:flex;align-items:center;justify-content:center;border-radius:4px;padding:2px;"]);
|
|
37754
37741
|
var ItemDetails$4 = /*#__PURE__*/styled.div.withConfig({
|
|
37755
37742
|
displayName: "CartView__ItemDetails",
|
|
37756
|
-
componentId: "sc-ydtyl1-
|
|
37743
|
+
componentId: "sc-ydtyl1-10"
|
|
37757
37744
|
})(["flex:1;display:flex;flex-direction:column;gap:0.5rem;"]);
|
|
37758
37745
|
var ItemName$6 = /*#__PURE__*/styled.div.withConfig({
|
|
37759
37746
|
displayName: "CartView__ItemName",
|
|
37760
|
-
componentId: "sc-ydtyl1-
|
|
37747
|
+
componentId: "sc-ydtyl1-11"
|
|
37761
37748
|
})(["font-family:'Press Start 2P',cursive;font-size:0.65rem;color:#ffffff;"]);
|
|
37762
37749
|
var ItemInfo$2 = /*#__PURE__*/styled.div.withConfig({
|
|
37763
37750
|
displayName: "CartView__ItemInfo",
|
|
37764
|
-
componentId: "sc-ydtyl1-
|
|
37751
|
+
componentId: "sc-ydtyl1-12"
|
|
37765
37752
|
})(["display:flex;align-items:center;gap:0.4rem;font-family:'Press Start 2P',cursive;font-size:0.55rem;color:#fef08a;"]);
|
|
37766
37753
|
var Footer$2 = /*#__PURE__*/styled.div.withConfig({
|
|
37767
37754
|
displayName: "CartView__Footer",
|
|
37768
|
-
componentId: "sc-ydtyl1-
|
|
37755
|
+
componentId: "sc-ydtyl1-13"
|
|
37769
37756
|
})(["display:flex;flex-direction:column;gap:1rem;padding-top:1rem;border-top:1px solid rgba(255,255,255,0.1);flex-shrink:0;@media (max-width:600px){gap:0.75rem;padding-top:0.75rem;}"]);
|
|
37770
|
-
var TotalInfo = /*#__PURE__*/styled.div.withConfig({
|
|
37771
|
-
displayName: "CartView__TotalInfo",
|
|
37772
|
-
componentId: "sc-ydtyl1-12"
|
|
37773
|
-
})(["display:flex;flex-direction:column;gap:0.5rem;"]);
|
|
37774
37757
|
var OrderSummaryLabel = /*#__PURE__*/styled.div.withConfig({
|
|
37775
37758
|
displayName: "CartView__OrderSummaryLabel",
|
|
37776
|
-
componentId: "sc-ydtyl1-
|
|
37759
|
+
componentId: "sc-ydtyl1-14"
|
|
37777
37760
|
})(["font-family:'Press Start 2P',cursive;font-size:0.55rem;color:rgba(255,255,255,0.5);text-transform:uppercase;letter-spacing:0.05em;margin-bottom:0.25rem;"]);
|
|
37778
37761
|
var TotalRow = /*#__PURE__*/styled.div.withConfig({
|
|
37779
37762
|
displayName: "CartView__TotalRow",
|
|
37780
|
-
componentId: "sc-ydtyl1-
|
|
37763
|
+
componentId: "sc-ydtyl1-15"
|
|
37781
37764
|
})(["display:flex;align-items:center;justify-content:space-between;gap:1rem;font-family:'Press Start 2P',cursive;font-size:", ";color:", ";", " span:last-child{color:#fef08a;}"], function (p) {
|
|
37782
37765
|
return p.$isTotal ? '1rem' : '0.75rem';
|
|
37783
37766
|
}, function (p) {
|
|
@@ -37787,35 +37770,27 @@ var TotalRow = /*#__PURE__*/styled.div.withConfig({
|
|
|
37787
37770
|
});
|
|
37788
37771
|
var PaymentMethodRow = /*#__PURE__*/styled.div.withConfig({
|
|
37789
37772
|
displayName: "CartView__PaymentMethodRow",
|
|
37790
|
-
componentId: "sc-ydtyl1-15"
|
|
37791
|
-
})(["display:flex;align-items:center;justify-content:space-between;gap:1rem;font-family:'Press Start 2P',cursive;font-size:0.5rem;color:rgba(255,255,255,0.5);margin-top:0.25rem;span:last-child{color:rgba(255,255,255,0.8);}"]);
|
|
37792
|
-
var DCNudge = /*#__PURE__*/styled.div.withConfig({
|
|
37793
|
-
displayName: "CartView__DCNudge",
|
|
37794
37773
|
componentId: "sc-ydtyl1-16"
|
|
37795
|
-
})(["display:flex;align-items:center;
|
|
37796
|
-
var DCNudgeLink = /*#__PURE__*/styled.span.withConfig({
|
|
37797
|
-
displayName: "CartView__DCNudgeLink",
|
|
37798
|
-
componentId: "sc-ydtyl1-17"
|
|
37799
|
-
})(["color:#f59e0b;white-space:nowrap;text-decoration:underline;flex:0 0 auto !important;"]);
|
|
37774
|
+
})(["display:flex;align-items:center;justify-content:space-between;gap:1rem;font-family:'Press Start 2P',cursive;font-size:0.5rem;color:rgba(255,255,255,0.5);margin-top:0.25rem;span:last-child{color:rgba(255,255,255,0.8);}"]);
|
|
37800
37775
|
var ErrorMessage$2 = /*#__PURE__*/styled.div.withConfig({
|
|
37801
37776
|
displayName: "CartView__ErrorMessage",
|
|
37802
|
-
componentId: "sc-ydtyl1-
|
|
37777
|
+
componentId: "sc-ydtyl1-17"
|
|
37803
37778
|
})(["color:#ef4444;font-size:0.875rem;font-family:'Press Start 2P',cursive;text-align:center;"]);
|
|
37804
37779
|
var MetadataInfo = /*#__PURE__*/styled.div.withConfig({
|
|
37805
37780
|
displayName: "CartView__MetadataInfo",
|
|
37806
|
-
componentId: "sc-ydtyl1-
|
|
37781
|
+
componentId: "sc-ydtyl1-18"
|
|
37807
37782
|
})(["display:flex;align-items:center;margin-top:0.25rem;gap:0.4rem;font-size:0.55rem;color:#a3e635;background:rgba(163,230,53,0.1);padding:0.2rem 0.4rem;border-radius:4px;"]);
|
|
37808
37783
|
var MetadataLabel = /*#__PURE__*/styled.div.withConfig({
|
|
37809
37784
|
displayName: "CartView__MetadataLabel",
|
|
37810
|
-
componentId: "sc-ydtyl1-
|
|
37785
|
+
componentId: "sc-ydtyl1-19"
|
|
37811
37786
|
})(["display:flex;align-items:center;gap:0.25rem;font-weight:bold;color:#d9f99d;"]);
|
|
37812
37787
|
var MetadataValue = /*#__PURE__*/styled.div.withConfig({
|
|
37813
37788
|
displayName: "CartView__MetadataValue",
|
|
37814
|
-
componentId: "sc-ydtyl1-
|
|
37789
|
+
componentId: "sc-ydtyl1-20"
|
|
37815
37790
|
})(["overflow:hidden;text-overflow:ellipsis;white-space:nowrap;"]);
|
|
37816
37791
|
var CartMeta = /*#__PURE__*/styled.div.withConfig({
|
|
37817
37792
|
displayName: "CartView__CartMeta",
|
|
37818
|
-
componentId: "sc-ydtyl1-
|
|
37793
|
+
componentId: "sc-ydtyl1-21"
|
|
37819
37794
|
})(["font-family:'Press Start 2P',cursive;font-size:0.55rem;color:#ffffff;opacity:0.8;margin-top:0.25rem;"]);
|
|
37820
37795
|
|
|
37821
37796
|
function calcTimeLeft(endsAt) {
|
|
@@ -38040,53 +38015,31 @@ var useStoreMetadata = function useStoreMetadata() {
|
|
|
38040
38015
|
var _useState = useState(false),
|
|
38041
38016
|
isCollectingMetadata = _useState[0],
|
|
38042
38017
|
setIsCollectingMetadata = _useState[1];
|
|
38043
|
-
var
|
|
38044
|
-
|
|
38045
|
-
|
|
38046
|
-
|
|
38047
|
-
|
|
38048
|
-
|
|
38049
|
-
|
|
38050
|
-
|
|
38051
|
-
|
|
38052
|
-
|
|
38053
|
-
|
|
38054
|
-
|
|
38055
|
-
|
|
38056
|
-
|
|
38057
|
-
|
|
38058
|
-
|
|
38059
|
-
|
|
38060
|
-
|
|
38061
|
-
|
|
38062
|
-
|
|
38063
|
-
},
|
|
38064
|
-
item: item
|
|
38065
|
-
};
|
|
38066
|
-
});
|
|
38067
|
-
case 6:
|
|
38068
|
-
return _context.abrupt("return", _context.sent);
|
|
38069
|
-
case 7:
|
|
38070
|
-
_context.prev = 7;
|
|
38071
|
-
setIsCollectingMetadata(false);
|
|
38072
|
-
// Clean up the resolvers
|
|
38073
|
-
if (window.__metadataResolvers) {
|
|
38074
|
-
delete window.__metadataResolvers;
|
|
38075
|
-
}
|
|
38076
|
-
return _context.finish(7);
|
|
38077
|
-
case 11:
|
|
38078
|
-
case "end":
|
|
38079
|
-
return _context.stop();
|
|
38080
|
-
}
|
|
38081
|
-
}, _callee, null, [[3,, 7, 11]]);
|
|
38082
|
-
}));
|
|
38083
|
-
return function collectMetadata(_x) {
|
|
38084
|
-
return _ref.apply(this, arguments);
|
|
38085
|
-
};
|
|
38086
|
-
}();
|
|
38018
|
+
var _useState2 = useState(null),
|
|
38019
|
+
currentMetadataItem = _useState2[0],
|
|
38020
|
+
setCurrentMetadataItem = _useState2[1];
|
|
38021
|
+
var resolverRef = useRef(null);
|
|
38022
|
+
var collectMetadata = function collectMetadata(item) {
|
|
38023
|
+
if (!item.metadataType || item.metadataType !== MetadataType.CharacterSkin) {
|
|
38024
|
+
return Promise.resolve(null);
|
|
38025
|
+
}
|
|
38026
|
+
setIsCollectingMetadata(true);
|
|
38027
|
+
setCurrentMetadataItem(item);
|
|
38028
|
+
return new Promise(function (resolve) {
|
|
38029
|
+
resolverRef.current = resolve;
|
|
38030
|
+
});
|
|
38031
|
+
};
|
|
38032
|
+
var resolveMetadata = function resolveMetadata(metadata) {
|
|
38033
|
+
resolverRef.current == null ? void 0 : resolverRef.current(metadata);
|
|
38034
|
+
resolverRef.current = null;
|
|
38035
|
+
setIsCollectingMetadata(false);
|
|
38036
|
+
setCurrentMetadataItem(null);
|
|
38037
|
+
};
|
|
38087
38038
|
return {
|
|
38088
38039
|
collectMetadata: collectMetadata,
|
|
38089
|
-
|
|
38040
|
+
resolveMetadata: resolveMetadata,
|
|
38041
|
+
isCollectingMetadata: isCollectingMetadata,
|
|
38042
|
+
currentMetadataItem: currentMetadataItem
|
|
38090
38043
|
};
|
|
38091
38044
|
};
|
|
38092
38045
|
|
|
@@ -38105,7 +38058,9 @@ var useStoreCart = function useStoreCart() {
|
|
|
38105
38058
|
}, []);
|
|
38106
38059
|
var _useStoreMetadata = useStoreMetadata(),
|
|
38107
38060
|
collectMetadata = _useStoreMetadata.collectMetadata,
|
|
38108
|
-
|
|
38061
|
+
resolveMetadata = _useStoreMetadata.resolveMetadata,
|
|
38062
|
+
isCollectingMetadata = _useStoreMetadata.isCollectingMetadata,
|
|
38063
|
+
currentMetadataItem = _useStoreMetadata.currentMetadataItem;
|
|
38109
38064
|
var handleAddToCart = /*#__PURE__*/function () {
|
|
38110
38065
|
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(item, quantity, preselectedMetadata) {
|
|
38111
38066
|
var metadata;
|
|
@@ -38237,7 +38192,9 @@ var useStoreCart = function useStoreCart() {
|
|
|
38237
38192
|
closeCart: closeCart,
|
|
38238
38193
|
getTotalItems: getTotalItems,
|
|
38239
38194
|
getTotalPrice: getTotalPrice,
|
|
38240
|
-
isCollectingMetadata: isCollectingMetadata
|
|
38195
|
+
isCollectingMetadata: isCollectingMetadata,
|
|
38196
|
+
currentMetadataItem: currentMetadataItem,
|
|
38197
|
+
resolveMetadata: resolveMetadata
|
|
38241
38198
|
};
|
|
38242
38199
|
};
|
|
38243
38200
|
// Helper functions
|
|
@@ -38266,23 +38223,42 @@ var MetadataCollector = function MetadataCollector(_ref) {
|
|
|
38266
38223
|
config = _ref.config,
|
|
38267
38224
|
onCollect = _ref.onCollect,
|
|
38268
38225
|
onCancel = _ref.onCancel;
|
|
38269
|
-
|
|
38226
|
+
var isPendingRef = useRef(true);
|
|
38227
|
+
var finalize = useCallback(function (callback) {
|
|
38228
|
+
if (!isPendingRef.current) {
|
|
38229
|
+
return;
|
|
38230
|
+
}
|
|
38231
|
+
isPendingRef.current = false;
|
|
38232
|
+
callback();
|
|
38233
|
+
}, []);
|
|
38234
|
+
var handleCollect = useCallback(function (metadata) {
|
|
38235
|
+
finalize(function () {
|
|
38236
|
+
return onCollect(metadata);
|
|
38237
|
+
});
|
|
38238
|
+
}, [finalize, onCollect]);
|
|
38239
|
+
var handleCancel = useCallback(function () {
|
|
38240
|
+
finalize(onCancel);
|
|
38241
|
+
}, [finalize, onCancel]);
|
|
38270
38242
|
useEffect(function () {
|
|
38271
38243
|
return function () {
|
|
38272
|
-
|
|
38273
|
-
|
|
38274
|
-
|
|
38275
|
-
|
|
38276
|
-
|
|
38244
|
+
handleCancel();
|
|
38245
|
+
};
|
|
38246
|
+
}, [handleCancel]);
|
|
38247
|
+
useEffect(function () {
|
|
38248
|
+
if (metadataType === MetadataType.CharacterSkin) {
|
|
38249
|
+
return undefined;
|
|
38250
|
+
}
|
|
38251
|
+
var timer = window.setTimeout(handleCancel, 0);
|
|
38252
|
+
return function () {
|
|
38253
|
+
return window.clearTimeout(timer);
|
|
38277
38254
|
};
|
|
38278
|
-
}, [
|
|
38279
|
-
|
|
38280
|
-
if (metadataType === 'CharacterSkin') {
|
|
38255
|
+
}, [handleCancel, metadataType]);
|
|
38256
|
+
if (metadataType === MetadataType.CharacterSkin) {
|
|
38281
38257
|
return React.createElement(CharacterSkinSelectionModal, {
|
|
38282
38258
|
isOpen: true,
|
|
38283
|
-
onClose:
|
|
38259
|
+
onClose: handleCancel,
|
|
38284
38260
|
onConfirm: function onConfirm(selectedSkin) {
|
|
38285
|
-
return
|
|
38261
|
+
return handleCollect({
|
|
38286
38262
|
selectedSkin: selectedSkin
|
|
38287
38263
|
});
|
|
38288
38264
|
},
|
|
@@ -38291,12 +38267,9 @@ var MetadataCollector = function MetadataCollector(_ref) {
|
|
|
38291
38267
|
atlasIMG: config.atlasIMG,
|
|
38292
38268
|
initialSelectedSkin: config.initialSelectedSkin
|
|
38293
38269
|
});
|
|
38294
|
-
} else {
|
|
38295
|
-
console.warn("No collector implemented for metadata type: " + metadataType);
|
|
38296
|
-
// Auto-cancel for unhandled types to prevent hanging promises
|
|
38297
|
-
setTimeout(onCancel, 0);
|
|
38298
|
-
return null;
|
|
38299
38270
|
}
|
|
38271
|
+
console.warn("No collector implemented for metadata type: " + metadataType);
|
|
38272
|
+
return null;
|
|
38300
38273
|
};
|
|
38301
38274
|
|
|
38302
38275
|
var PaymentMethodModal = function PaymentMethodModal(_ref) {
|
|
@@ -38446,6 +38419,159 @@ var ConfirmRow$1 = /*#__PURE__*/styled.div.withConfig({
|
|
|
38446
38419
|
componentId: "sc-1dxy6lr-12"
|
|
38447
38420
|
})(["display:flex;justify-content:center;margin-top:4px;"]);
|
|
38448
38421
|
|
|
38422
|
+
function packToBlueprint(pack) {
|
|
38423
|
+
return {
|
|
38424
|
+
key: pack.key,
|
|
38425
|
+
name: pack.title,
|
|
38426
|
+
description: pack.description || '',
|
|
38427
|
+
price: pack.priceUSD,
|
|
38428
|
+
currency: PaymentCurrency.USD,
|
|
38429
|
+
texturePath: pack.image["default"] || pack.image.src,
|
|
38430
|
+
type: PurchaseType.Pack,
|
|
38431
|
+
onPurchase: function () {
|
|
38432
|
+
var _onPurchase = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
38433
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
38434
|
+
while (1) switch (_context.prev = _context.next) {
|
|
38435
|
+
case 0:
|
|
38436
|
+
case "end":
|
|
38437
|
+
return _context.stop();
|
|
38438
|
+
}
|
|
38439
|
+
}, _callee);
|
|
38440
|
+
}));
|
|
38441
|
+
function onPurchase() {
|
|
38442
|
+
return _onPurchase.apply(this, arguments);
|
|
38443
|
+
}
|
|
38444
|
+
return onPurchase;
|
|
38445
|
+
}(),
|
|
38446
|
+
itemType: ItemType.Consumable,
|
|
38447
|
+
itemSubType: ItemSubType.Other,
|
|
38448
|
+
rarity: ItemRarities.Common,
|
|
38449
|
+
weight: 0,
|
|
38450
|
+
isStackable: false,
|
|
38451
|
+
maxStackSize: 1,
|
|
38452
|
+
isUsable: false
|
|
38453
|
+
};
|
|
38454
|
+
}
|
|
38455
|
+
|
|
38456
|
+
var DEFAULT_TAB_ORDER = ['premium', 'packs', 'items'];
|
|
38457
|
+
function isTabAvailable(tabId, params) {
|
|
38458
|
+
var hidePremiumTab = params.hidePremiumTab,
|
|
38459
|
+
hasCharacters = params.hasCharacters,
|
|
38460
|
+
hasRedeem = params.hasRedeem,
|
|
38461
|
+
hasWallet = params.hasWallet,
|
|
38462
|
+
hasHistory = params.hasHistory;
|
|
38463
|
+
if (tabId === 'premium') return !hidePremiumTab;
|
|
38464
|
+
if (tabId === 'characters') return !!hasCharacters;
|
|
38465
|
+
if (tabId === 'redeem') return !!hasRedeem;
|
|
38466
|
+
if (tabId === 'wallet') return !!hasWallet;
|
|
38467
|
+
if (tabId === 'history') return !!hasHistory;
|
|
38468
|
+
return true;
|
|
38469
|
+
}
|
|
38470
|
+
function getInitialActiveTab(availableTabIds, defaultActiveTab) {
|
|
38471
|
+
var _availableTabIds$;
|
|
38472
|
+
if (defaultActiveTab && availableTabIds.includes(defaultActiveTab)) {
|
|
38473
|
+
return defaultActiveTab;
|
|
38474
|
+
}
|
|
38475
|
+
return (_availableTabIds$ = availableTabIds[0]) != null ? _availableTabIds$ : 'items';
|
|
38476
|
+
}
|
|
38477
|
+
function buildAvailableTabIds(params) {
|
|
38478
|
+
var tabOrder = params.tabOrder,
|
|
38479
|
+
hasCharacters = params.hasCharacters,
|
|
38480
|
+
hasRedeem = params.hasRedeem,
|
|
38481
|
+
hasWallet = params.hasWallet,
|
|
38482
|
+
hasHistory = params.hasHistory;
|
|
38483
|
+
var ids = [].concat(tabOrder != null ? tabOrder : DEFAULT_TAB_ORDER, hasCharacters ? ['characters'] : [], hasRedeem ? ['redeem'] : [], hasWallet ? ['wallet'] : [], hasHistory ? ['history'] : []);
|
|
38484
|
+
return Array.from(new Set(ids.filter(function (id) {
|
|
38485
|
+
return isTabAvailable(id, params);
|
|
38486
|
+
})));
|
|
38487
|
+
}
|
|
38488
|
+
function useStoreTabs(params) {
|
|
38489
|
+
var tabOrder = params.tabOrder,
|
|
38490
|
+
hidePremiumTab = params.hidePremiumTab,
|
|
38491
|
+
hasCharacters = params.hasCharacters,
|
|
38492
|
+
hasRedeem = params.hasRedeem,
|
|
38493
|
+
hasWallet = params.hasWallet,
|
|
38494
|
+
hasHistory = params.hasHistory,
|
|
38495
|
+
defaultActiveTab = params.defaultActiveTab,
|
|
38496
|
+
onTabChange = params.onTabChange,
|
|
38497
|
+
getItemCount = params.getItemCount;
|
|
38498
|
+
var availableTabIds = useMemo(function () {
|
|
38499
|
+
return buildAvailableTabIds({
|
|
38500
|
+
tabOrder: tabOrder,
|
|
38501
|
+
hidePremiumTab: hidePremiumTab,
|
|
38502
|
+
hasCharacters: hasCharacters,
|
|
38503
|
+
hasRedeem: hasRedeem,
|
|
38504
|
+
hasWallet: hasWallet,
|
|
38505
|
+
hasHistory: hasHistory
|
|
38506
|
+
});
|
|
38507
|
+
}, [tabOrder, hidePremiumTab, hasCharacters, hasRedeem, hasWallet, hasHistory]);
|
|
38508
|
+
var _useState = useState(function () {
|
|
38509
|
+
return getInitialActiveTab(availableTabIds, defaultActiveTab);
|
|
38510
|
+
}),
|
|
38511
|
+
activeTab = _useState[0],
|
|
38512
|
+
setActiveTab = _useState[1];
|
|
38513
|
+
var resolvedActiveTab = availableTabIds.includes(activeTab) ? activeTab : getInitialActiveTab(availableTabIds, defaultActiveTab);
|
|
38514
|
+
useEffect(function () {
|
|
38515
|
+
if (resolvedActiveTab === activeTab) {
|
|
38516
|
+
return;
|
|
38517
|
+
}
|
|
38518
|
+
setActiveTab(resolvedActiveTab);
|
|
38519
|
+
}, [activeTab, resolvedActiveTab]);
|
|
38520
|
+
var handleTabChange = function handleTabChange(tabId) {
|
|
38521
|
+
var _getItemCount;
|
|
38522
|
+
var nextTab = tabId;
|
|
38523
|
+
if (!availableTabIds.includes(nextTab) || nextTab === resolvedActiveTab) {
|
|
38524
|
+
return;
|
|
38525
|
+
}
|
|
38526
|
+
setActiveTab(nextTab);
|
|
38527
|
+
onTabChange == null ? void 0 : onTabChange(nextTab, (_getItemCount = getItemCount == null ? void 0 : getItemCount(nextTab)) != null ? _getItemCount : 0);
|
|
38528
|
+
};
|
|
38529
|
+
return {
|
|
38530
|
+
availableTabIds: availableTabIds,
|
|
38531
|
+
activeTab: resolvedActiveTab,
|
|
38532
|
+
setActiveTab: setActiveTab,
|
|
38533
|
+
handleTabChange: handleTabChange
|
|
38534
|
+
};
|
|
38535
|
+
}
|
|
38536
|
+
|
|
38537
|
+
var StoreHeader = function StoreHeader(_ref) {
|
|
38538
|
+
var tabs = _ref.tabs,
|
|
38539
|
+
activeTabId = _ref.activeTabId,
|
|
38540
|
+
onTabChange = _ref.onTabChange,
|
|
38541
|
+
cartItemCount = _ref.cartItemCount,
|
|
38542
|
+
onOpenCart = _ref.onOpenCart;
|
|
38543
|
+
return React.createElement(HeaderRow, null, React.createElement(TabsFlexWrapper, null, React.createElement(Tabs, {
|
|
38544
|
+
options: tabs.map(function (t) {
|
|
38545
|
+
return {
|
|
38546
|
+
id: t.id,
|
|
38547
|
+
label: t.label,
|
|
38548
|
+
icon: t.icon
|
|
38549
|
+
};
|
|
38550
|
+
}),
|
|
38551
|
+
activeTabId: activeTabId,
|
|
38552
|
+
onTabChange: onTabChange
|
|
38553
|
+
})), React.createElement(CartButtonWrapper, null, React.createElement(CTAButton, {
|
|
38554
|
+
icon: React.createElement(FaShoppingCart, null),
|
|
38555
|
+
onClick: onOpenCart
|
|
38556
|
+
}), cartItemCount > 0 && React.createElement(CartBadge, null, cartItemCount)));
|
|
38557
|
+
};
|
|
38558
|
+
var HeaderRow = /*#__PURE__*/styled.div.withConfig({
|
|
38559
|
+
displayName: "StoreHeader__HeaderRow",
|
|
38560
|
+
componentId: "sc-1y26lw-0"
|
|
38561
|
+
})(["display:flex;align-items:flex-end;justify-content:space-between;margin-bottom:0.25rem;padding-top:10px;padding-right:12px;"]);
|
|
38562
|
+
var TabsFlexWrapper = /*#__PURE__*/styled.div.withConfig({
|
|
38563
|
+
displayName: "StoreHeader__TabsFlexWrapper",
|
|
38564
|
+
componentId: "sc-1y26lw-1"
|
|
38565
|
+
})(["flex:1;min-width:0;"]);
|
|
38566
|
+
var CartButtonWrapper = /*#__PURE__*/styled.div.withConfig({
|
|
38567
|
+
displayName: "StoreHeader__CartButtonWrapper",
|
|
38568
|
+
componentId: "sc-1y26lw-2"
|
|
38569
|
+
})(["position:relative;flex-shrink:0;"]);
|
|
38570
|
+
var CartBadge = /*#__PURE__*/styled.div.withConfig({
|
|
38571
|
+
displayName: "StoreHeader__CartBadge",
|
|
38572
|
+
componentId: "sc-1y26lw-3"
|
|
38573
|
+
})(["position:absolute;top:-8px;right:-8px;background:#ef4444;color:white;font-family:'Press Start 2P',cursive;font-size:0.5rem;padding:4px;border-radius:50%;border:2px solid #000;display:flex;align-items:center;justify-content:center;min-width:16px;min-height:16px;box-sizing:content-box;"]);
|
|
38574
|
+
|
|
38449
38575
|
var ScrollableContent = function ScrollableContent(_ref) {
|
|
38450
38576
|
var items = _ref.items,
|
|
38451
38577
|
renderItem = _ref.renderItem,
|
|
@@ -38458,8 +38584,7 @@ var ScrollableContent = function ScrollableContent(_ref) {
|
|
|
38458
38584
|
layout = _ref$layout === void 0 ? 'list' : _ref$layout,
|
|
38459
38585
|
_ref$gridColumns = _ref.gridColumns,
|
|
38460
38586
|
gridColumns = _ref$gridColumns === void 0 ? 4 : _ref$gridColumns,
|
|
38461
|
-
|
|
38462
|
-
maxHeight = _ref$maxHeight === void 0 ? '500px' : _ref$maxHeight;
|
|
38587
|
+
maxHeight = _ref.maxHeight;
|
|
38463
38588
|
if (items.length === 0) {
|
|
38464
38589
|
return React.createElement(EmptyMessage$3, null, emptyMessage);
|
|
38465
38590
|
}
|
|
@@ -38515,8 +38640,8 @@ var StyledDropdown$7 = /*#__PURE__*/styled(Dropdown).withConfig({
|
|
|
38515
38640
|
var Content$4 = /*#__PURE__*/styled.div.withConfig({
|
|
38516
38641
|
displayName: "ScrollableContent__Content",
|
|
38517
38642
|
componentId: "sc-xhh2um-7"
|
|
38518
|
-
})(["display:flex;flex-direction:column;gap:0.5rem;flex:1;padding:1rem;
|
|
38519
|
-
return
|
|
38643
|
+
})(["display:flex;flex-direction:column;gap:0.5rem;flex:1;padding:1rem;", " &.grid{display:grid;grid-template-columns:repeat( ", ",minmax(0,1fr) );gap:1rem;align-items:start;.ScrollableContent-item{display:flex;align-items:flex-start;}}&.list{display:flex;flex-direction:column;gap:0.5rem;}"], function (p) {
|
|
38644
|
+
return p.$maxHeight ? "max-height: " + p.$maxHeight + "; overflow-y: auto; overflow-x: hidden; scrollbar-gutter: stable;" : '';
|
|
38520
38645
|
}, function (props) {
|
|
38521
38646
|
return props.$gridColumns;
|
|
38522
38647
|
});
|
|
@@ -39098,7 +39223,7 @@ var TextInput = /*#__PURE__*/styled.input.withConfig({
|
|
|
39098
39223
|
componentId: "sc-ptotuo-12"
|
|
39099
39224
|
})(["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;"]);
|
|
39100
39225
|
|
|
39101
|
-
var useStoreFiltering = function useStoreFiltering(items) {
|
|
39226
|
+
var useStoreFiltering = function useStoreFiltering(items, overrideCategoryOptions) {
|
|
39102
39227
|
var _useState = useState(''),
|
|
39103
39228
|
searchQuery = _useState[0],
|
|
39104
39229
|
setSearchQuery = _useState[1];
|
|
@@ -39106,6 +39231,21 @@ var useStoreFiltering = function useStoreFiltering(items) {
|
|
|
39106
39231
|
selectedCategory = _useState2[0],
|
|
39107
39232
|
setSelectedCategory = _useState2[1];
|
|
39108
39233
|
var categoryOptions = useMemo(function () {
|
|
39234
|
+
if (overrideCategoryOptions) {
|
|
39235
|
+
var normalizedOptions = overrideCategoryOptions.some(function (opt) {
|
|
39236
|
+
return opt.value === 'all';
|
|
39237
|
+
}) ? overrideCategoryOptions : [{
|
|
39238
|
+
value: 'all',
|
|
39239
|
+
label: 'All'
|
|
39240
|
+
}].concat(overrideCategoryOptions);
|
|
39241
|
+
return normalizedOptions.map(function (opt, index) {
|
|
39242
|
+
return {
|
|
39243
|
+
id: index,
|
|
39244
|
+
value: opt.value,
|
|
39245
|
+
option: opt.label
|
|
39246
|
+
};
|
|
39247
|
+
});
|
|
39248
|
+
}
|
|
39109
39249
|
var uniqueCategories = Array.from(new Set(items.map(function (item) {
|
|
39110
39250
|
return item.itemType;
|
|
39111
39251
|
})));
|
|
@@ -39117,7 +39257,16 @@ var useStoreFiltering = function useStoreFiltering(items) {
|
|
|
39117
39257
|
option: category === 'all' ? 'All' : category
|
|
39118
39258
|
};
|
|
39119
39259
|
});
|
|
39120
|
-
}, [items]);
|
|
39260
|
+
}, [items, overrideCategoryOptions]);
|
|
39261
|
+
useEffect(function () {
|
|
39262
|
+
var _categoryOptions$0$va, _categoryOptions$;
|
|
39263
|
+
if (categoryOptions.some(function (option) {
|
|
39264
|
+
return option.value === selectedCategory;
|
|
39265
|
+
})) {
|
|
39266
|
+
return;
|
|
39267
|
+
}
|
|
39268
|
+
setSelectedCategory((_categoryOptions$0$va = (_categoryOptions$ = categoryOptions[0]) == null ? void 0 : _categoryOptions$.value) != null ? _categoryOptions$0$va : 'all');
|
|
39269
|
+
}, [categoryOptions, selectedCategory]);
|
|
39121
39270
|
var filteredItems = useMemo(function () {
|
|
39122
39271
|
return items.filter(function (item) {
|
|
39123
39272
|
var matchesSearch = item.name.toLowerCase().includes(searchQuery.toLowerCase());
|
|
@@ -39156,22 +39305,21 @@ var StoreItemsSection = function StoreItemsSection(_ref) {
|
|
|
39156
39305
|
onItemView = _ref.onItemView,
|
|
39157
39306
|
onCategoryChange = _ref.onCategoryChange,
|
|
39158
39307
|
_ref$currencySymbol = _ref.currencySymbol,
|
|
39159
|
-
currencySymbol = _ref$currencySymbol === void 0 ? '$' : _ref$currencySymbol
|
|
39160
|
-
|
|
39308
|
+
currencySymbol = _ref$currencySymbol === void 0 ? '$' : _ref$currencySymbol,
|
|
39309
|
+
categoryOptionsProp = _ref.categoryOptions;
|
|
39310
|
+
var _useStoreFiltering = useStoreFiltering(items, categoryOptionsProp),
|
|
39161
39311
|
searchQuery = _useStoreFiltering.searchQuery,
|
|
39162
39312
|
setSearchQuery = _useStoreFiltering.setSearchQuery,
|
|
39163
39313
|
selectedCategory = _useStoreFiltering.selectedCategory,
|
|
39164
39314
|
setSelectedCategory = _useStoreFiltering.setSelectedCategory,
|
|
39165
39315
|
categoryOptions = _useStoreFiltering.categoryOptions,
|
|
39166
39316
|
filteredItems = _useStoreFiltering.filteredItems;
|
|
39167
|
-
// Fire category change event when the filter changes
|
|
39168
39317
|
useEffect(function () {
|
|
39169
39318
|
onCategoryChange == null ? void 0 : onCategoryChange(selectedCategory, filteredItems.length);
|
|
39170
39319
|
}, [selectedCategory, filteredItems.length]);
|
|
39171
39320
|
var renderStoreItem = function renderStoreItem(item) {
|
|
39172
39321
|
var meta = itemBadges[item.key];
|
|
39173
39322
|
var position = filteredItems.indexOf(item);
|
|
39174
|
-
// Prefer a specialized character skin row when needed
|
|
39175
39323
|
if (item.metadataType === MetadataType.CharacterSkin) {
|
|
39176
39324
|
return React.createElement(StoreCharacterSkinRow, {
|
|
39177
39325
|
key: item.key,
|
|
@@ -39182,7 +39330,6 @@ var StoreItemsSection = function StoreItemsSection(_ref) {
|
|
|
39182
39330
|
userAccountType: userAccountType || UserAccountTypes.Free
|
|
39183
39331
|
});
|
|
39184
39332
|
}
|
|
39185
|
-
// Render text input row when configured for this item key
|
|
39186
39333
|
if (textInputItemKeys.includes(item.key)) {
|
|
39187
39334
|
return React.createElement(StoreItemRow, Object.assign({
|
|
39188
39335
|
key: item.key,
|
|
@@ -39198,7 +39345,6 @@ var StoreItemsSection = function StoreItemsSection(_ref) {
|
|
|
39198
39345
|
currencySymbol: currencySymbol
|
|
39199
39346
|
}, meta));
|
|
39200
39347
|
}
|
|
39201
|
-
// Fallback to standard arrow-based row
|
|
39202
39348
|
return React.createElement(StoreItemRow, Object.assign({
|
|
39203
39349
|
key: item.key,
|
|
39204
39350
|
item: item,
|
|
@@ -39212,19 +39358,7 @@ var StoreItemsSection = function StoreItemsSection(_ref) {
|
|
|
39212
39358
|
currencySymbol: currencySymbol
|
|
39213
39359
|
}, meta));
|
|
39214
39360
|
};
|
|
39215
|
-
|
|
39216
|
-
showFilters = _useState[0],
|
|
39217
|
-
setShowFilters = _useState[1];
|
|
39218
|
-
return React.createElement(StoreContainer, null, React.createElement(FilterBar, null, React.createElement(FilterToggle, {
|
|
39219
|
-
"$active": showFilters,
|
|
39220
|
-
onClick: function onClick() {
|
|
39221
|
-
return setShowFilters(function (prev) {
|
|
39222
|
-
return !prev;
|
|
39223
|
-
});
|
|
39224
|
-
}
|
|
39225
|
-
}, React.createElement(FaFilter, {
|
|
39226
|
-
size: 12
|
|
39227
|
-
}), React.createElement("span", null, "Filter"))), showFilters && React.createElement(SearchHeader$2, null, React.createElement(SearchBarContainer$1, null, React.createElement(SearchBar, {
|
|
39361
|
+
return React.createElement(StoreContainer, null, React.createElement(SearchHeader$2, null, React.createElement(SearchBarContainer$1, null, React.createElement(SearchBar, {
|
|
39228
39362
|
value: searchQuery,
|
|
39229
39363
|
onChange: setSearchQuery,
|
|
39230
39364
|
placeholder: "Search items..."
|
|
@@ -39236,15 +39370,12 @@ var StoreItemsSection = function StoreItemsSection(_ref) {
|
|
|
39236
39370
|
};
|
|
39237
39371
|
}),
|
|
39238
39372
|
activeId: selectedCategory,
|
|
39239
|
-
onChange:
|
|
39240
|
-
return setSelectedCategory(id);
|
|
39241
|
-
}
|
|
39373
|
+
onChange: setSelectedCategory
|
|
39242
39374
|
})), React.createElement(ScrollableContent, {
|
|
39243
39375
|
items: filteredItems,
|
|
39244
39376
|
renderItem: renderStoreItem,
|
|
39245
39377
|
emptyMessage: "No items match your filters.",
|
|
39246
|
-
layout: "list"
|
|
39247
|
-
maxHeight: "none"
|
|
39378
|
+
layout: "list"
|
|
39248
39379
|
}));
|
|
39249
39380
|
};
|
|
39250
39381
|
var StoreContainer = /*#__PURE__*/styled.div.withConfig({
|
|
@@ -39254,22 +39385,11 @@ var StoreContainer = /*#__PURE__*/styled.div.withConfig({
|
|
|
39254
39385
|
var SearchHeader$2 = /*#__PURE__*/styled.div.withConfig({
|
|
39255
39386
|
displayName: "StoreItemsSection__SearchHeader",
|
|
39256
39387
|
componentId: "sc-l6f466-1"
|
|
39257
|
-
})(["display:flex;gap:0.5rem;align-items:center;padding
|
|
39388
|
+
})(["display:flex;gap:0.5rem;align-items:center;padding:0.25rem 1rem 0;"]);
|
|
39258
39389
|
var SearchBarContainer$1 = /*#__PURE__*/styled.div.withConfig({
|
|
39259
39390
|
displayName: "StoreItemsSection__SearchBarContainer",
|
|
39260
39391
|
componentId: "sc-l6f466-2"
|
|
39261
39392
|
})(["flex:0.75;"]);
|
|
39262
|
-
var FilterBar = /*#__PURE__*/styled.div.withConfig({
|
|
39263
|
-
displayName: "StoreItemsSection__FilterBar",
|
|
39264
|
-
componentId: "sc-l6f466-3"
|
|
39265
|
-
})(["display:flex;padding-top:0.25rem;"]);
|
|
39266
|
-
var FilterToggle = /*#__PURE__*/styled.button.withConfig({
|
|
39267
|
-
displayName: "StoreItemsSection__FilterToggle",
|
|
39268
|
-
componentId: "sc-l6f466-4"
|
|
39269
|
-
})(["display:flex;align-items:center;gap:0.4rem;background:", ";border:1px solid rgba(255,255,255,0.3);color:#fff;padding:0.3rem 0.6rem;border-radius:4px;cursor:pointer;font-family:'Press Start 2P',cursive;font-size:0.55rem;&:hover{background:rgba(255,255,255,0.1);}"], function (_ref2) {
|
|
39270
|
-
var $active = _ref2.$active;
|
|
39271
|
-
return $active ? 'rgba(255,255,255,0.15)' : 'transparent';
|
|
39272
|
-
});
|
|
39273
39393
|
|
|
39274
39394
|
var usePackFiltering = function usePackFiltering(packs) {
|
|
39275
39395
|
var _useState = useState(''),
|
|
@@ -39417,8 +39537,7 @@ var StorePacksSection = function StorePacksSection(_ref2) {
|
|
|
39417
39537
|
onChange: setSearchQuery,
|
|
39418
39538
|
placeholder: 'Search packs...'
|
|
39419
39539
|
},
|
|
39420
|
-
layout: "list"
|
|
39421
|
-
maxHeight: "50vh"
|
|
39540
|
+
layout: "list"
|
|
39422
39541
|
});
|
|
39423
39542
|
};
|
|
39424
39543
|
var PackRow = /*#__PURE__*/styled(ItemRowWrapper).withConfig({
|
|
@@ -39722,7 +39841,7 @@ var Store = function Store(_ref) {
|
|
|
39722
39841
|
packs = _ref$packs === void 0 ? [] : _ref$packs,
|
|
39723
39842
|
atlasJSON = _ref.atlasJSON,
|
|
39724
39843
|
atlasIMG = _ref.atlasIMG,
|
|
39725
|
-
|
|
39844
|
+
_onPurchase = _ref.onPurchase,
|
|
39726
39845
|
onShowHistory = _ref.onShowHistory,
|
|
39727
39846
|
onShowWallet = _ref.onShowWallet,
|
|
39728
39847
|
walletLabel = _ref.walletLabel,
|
|
@@ -39743,11 +39862,6 @@ var Store = function Store(_ref) {
|
|
|
39743
39862
|
customHistoryContent = _ref.customHistoryContent,
|
|
39744
39863
|
_ref$fullScreen = _ref.fullScreen,
|
|
39745
39864
|
fullScreen = _ref$fullScreen === void 0 ? false : _ref$fullScreen,
|
|
39746
|
-
containerWidth = _ref.containerWidth,
|
|
39747
|
-
containerHeight = _ref.containerHeight,
|
|
39748
|
-
mobileContainerWidth = _ref.mobileContainerWidth,
|
|
39749
|
-
mobileContainerHeight = _ref.mobileContainerHeight,
|
|
39750
|
-
mobileBreakpoint = _ref.mobileBreakpoint,
|
|
39751
39865
|
_ref$packsTabLabel = _ref.packsTabLabel,
|
|
39752
39866
|
packsTabLabel = _ref$packsTabLabel === void 0 ? 'Packs' : _ref$packsTabLabel,
|
|
39753
39867
|
packsBadge = _ref.packsBadge,
|
|
@@ -39757,7 +39871,7 @@ var Store = function Store(_ref) {
|
|
|
39757
39871
|
packBadges = _ref.packBadges,
|
|
39758
39872
|
onItemView = _ref.onItemView,
|
|
39759
39873
|
onPackView = _ref.onPackView,
|
|
39760
|
-
|
|
39874
|
+
onTabChange = _ref.onTabChange,
|
|
39761
39875
|
onCategoryChange = _ref.onCategoryChange,
|
|
39762
39876
|
onCartOpen = _ref.onCartOpen,
|
|
39763
39877
|
onAddToCart = _ref.onAddToCart,
|
|
@@ -39765,29 +39879,19 @@ var Store = function Store(_ref) {
|
|
|
39765
39879
|
onCheckoutStart = _ref.onCheckoutStart,
|
|
39766
39880
|
onPurchaseSuccess = _ref.onPurchaseSuccess,
|
|
39767
39881
|
onPurchaseError = _ref.onPurchaseError,
|
|
39768
|
-
onBuyDC = _ref.onBuyDC,
|
|
39769
39882
|
_ref$currencySymbol = _ref.currencySymbol,
|
|
39770
39883
|
currencySymbol = _ref$currencySymbol === void 0 ? '$' : _ref$currencySymbol,
|
|
39771
39884
|
onRedeem = _ref.onRedeem,
|
|
39772
39885
|
onRedeemInputFocus = _ref.onRedeemInputFocus,
|
|
39773
|
-
onRedeemInputBlur = _ref.onRedeemInputBlur
|
|
39774
|
-
|
|
39886
|
+
onRedeemInputBlur = _ref.onRedeemInputBlur,
|
|
39887
|
+
_ref$width = _ref.width,
|
|
39888
|
+
width = _ref$width === void 0 ? '1000px' : _ref$width,
|
|
39889
|
+
_ref$height = _ref.height,
|
|
39890
|
+
height = _ref$height === void 0 ? 'min(85vh, 900px)' : _ref$height,
|
|
39891
|
+
itemCategoryOptions = _ref.itemCategoryOptions;
|
|
39775
39892
|
var _useState = useState(null),
|
|
39776
39893
|
selectedPack = _useState[0],
|
|
39777
39894
|
setSelectedPack = _useState[1];
|
|
39778
|
-
var _useState2 = useState(function () {
|
|
39779
|
-
var _validTabs$;
|
|
39780
|
-
var allTabIds = [].concat(tabOrder != null ? tabOrder : defaultTabOrder, customCharactersContent ? ['characters'] : [], onRedeem ? ['redeem'] : [], onShowWallet || customWalletContent ? ['wallet'] : [], onShowHistory || customHistoryContent ? ['history'] : []);
|
|
39781
|
-
var validTabs = Array.from(new Set(allTabIds.filter(function (id) {
|
|
39782
|
-
return !(hidePremiumTab && id === 'premium');
|
|
39783
|
-
})));
|
|
39784
|
-
if (defaultActiveTab && validTabs.includes(defaultActiveTab)) {
|
|
39785
|
-
return defaultActiveTab;
|
|
39786
|
-
}
|
|
39787
|
-
return (_validTabs$ = validTabs[0]) != null ? _validTabs$ : hidePremiumTab ? 'items' : 'premium';
|
|
39788
|
-
}),
|
|
39789
|
-
activeTab = _useState2[0],
|
|
39790
|
-
setActiveTab = _useState2[1];
|
|
39791
39895
|
var _useStoreCart = useStoreCart(),
|
|
39792
39896
|
cartItems = _useStoreCart.cartItems,
|
|
39793
39897
|
handleAddToCart = _useStoreCart.handleAddToCart,
|
|
@@ -39797,13 +39901,38 @@ var Store = function Store(_ref) {
|
|
|
39797
39901
|
closeCart = _useStoreCart.closeCart,
|
|
39798
39902
|
getTotalItems = _useStoreCart.getTotalItems,
|
|
39799
39903
|
getTotalPrice = _useStoreCart.getTotalPrice,
|
|
39800
|
-
isCartOpen = _useStoreCart.isCartOpen
|
|
39801
|
-
|
|
39802
|
-
|
|
39803
|
-
|
|
39804
|
-
var
|
|
39805
|
-
|
|
39806
|
-
|
|
39904
|
+
isCartOpen = _useStoreCart.isCartOpen,
|
|
39905
|
+
isCollectingMetadata = _useStoreCart.isCollectingMetadata,
|
|
39906
|
+
currentMetadataItem = _useStoreCart.currentMetadataItem,
|
|
39907
|
+
resolveMetadata = _useStoreCart.resolveMetadata;
|
|
39908
|
+
var filteredItems = useMemo(function () {
|
|
39909
|
+
return {
|
|
39910
|
+
items: items,
|
|
39911
|
+
premium: items.filter(function (item) {
|
|
39912
|
+
var _item$requiredAccount, _item$requiredAccount2;
|
|
39913
|
+
return ((_item$requiredAccount = (_item$requiredAccount2 = item.requiredAccountType) == null ? void 0 : _item$requiredAccount2.length) != null ? _item$requiredAccount : 0) > 0;
|
|
39914
|
+
})
|
|
39915
|
+
};
|
|
39916
|
+
}, [items]);
|
|
39917
|
+
var _useStoreTabs = useStoreTabs({
|
|
39918
|
+
tabOrder: tabOrder,
|
|
39919
|
+
defaultActiveTab: defaultActiveTab,
|
|
39920
|
+
hidePremiumTab: hidePremiumTab,
|
|
39921
|
+
hasCharacters: !!customCharactersContent,
|
|
39922
|
+
hasRedeem: !!onRedeem,
|
|
39923
|
+
hasWallet: !!(onShowWallet || customWalletContent),
|
|
39924
|
+
hasHistory: !!(onShowHistory || customHistoryContent),
|
|
39925
|
+
onTabChange: onTabChange,
|
|
39926
|
+
getItemCount: function getItemCount(tab) {
|
|
39927
|
+
if (tab === 'items') return filteredItems.items.length;
|
|
39928
|
+
if (tab === 'premium') return filteredItems.premium.length;
|
|
39929
|
+
if (tab === 'packs') return packs.length;
|
|
39930
|
+
return 0;
|
|
39931
|
+
}
|
|
39932
|
+
}),
|
|
39933
|
+
availableTabIds = _useStoreTabs.availableTabIds,
|
|
39934
|
+
activeTab = _useStoreTabs.activeTab,
|
|
39935
|
+
handleTabChange = _useStoreTabs.handleTabChange;
|
|
39807
39936
|
var handleOpenCart = function handleOpenCart() {
|
|
39808
39937
|
openCart();
|
|
39809
39938
|
onCartOpen == null ? void 0 : onCartOpen();
|
|
@@ -39820,85 +39949,13 @@ var Store = function Store(_ref) {
|
|
|
39820
39949
|
if (quantity === void 0) {
|
|
39821
39950
|
quantity = 1;
|
|
39822
39951
|
}
|
|
39823
|
-
var
|
|
39824
|
-
|
|
39825
|
-
|
|
39826
|
-
description: pack.description || '',
|
|
39827
|
-
price: pack.priceUSD,
|
|
39828
|
-
currency: PaymentCurrency.USD,
|
|
39829
|
-
texturePath: pack.image["default"] || pack.image.src,
|
|
39830
|
-
type: PurchaseType.Pack,
|
|
39831
|
-
onPurchase: function () {
|
|
39832
|
-
var _onPurchase = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
39833
|
-
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
39834
|
-
while (1) switch (_context.prev = _context.next) {
|
|
39835
|
-
case 0:
|
|
39836
|
-
case "end":
|
|
39837
|
-
return _context.stop();
|
|
39838
|
-
}
|
|
39839
|
-
}, _callee);
|
|
39840
|
-
}));
|
|
39841
|
-
function onPurchase() {
|
|
39842
|
-
return _onPurchase.apply(this, arguments);
|
|
39843
|
-
}
|
|
39844
|
-
return onPurchase;
|
|
39845
|
-
}(),
|
|
39846
|
-
itemType: ItemType.Consumable,
|
|
39847
|
-
itemSubType: ItemSubType.Other,
|
|
39848
|
-
rarity: ItemRarities.Common,
|
|
39849
|
-
weight: 0,
|
|
39850
|
-
isStackable: false,
|
|
39851
|
-
maxStackSize: 1,
|
|
39852
|
-
isUsable: false
|
|
39853
|
-
};
|
|
39854
|
-
handleAddToCart(packItem, quantity);
|
|
39855
|
-
onAddToCart == null ? void 0 : onAddToCart(packItem, quantity);
|
|
39856
|
-
};
|
|
39857
|
-
var filterItems = function filterItems(itemsToFilter, type) {
|
|
39858
|
-
return itemsToFilter.filter(function (item) {
|
|
39859
|
-
if (type === 'premium') {
|
|
39860
|
-
var _item$requiredAccount, _item$requiredAccount2;
|
|
39861
|
-
return (_item$requiredAccount = (_item$requiredAccount2 = item.requiredAccountType) == null ? void 0 : _item$requiredAccount2.length) != null ? _item$requiredAccount : 0 > 0;
|
|
39862
|
-
}
|
|
39863
|
-
return true;
|
|
39864
|
-
});
|
|
39865
|
-
};
|
|
39866
|
-
var filteredItems = useMemo(function () {
|
|
39867
|
-
return {
|
|
39868
|
-
items: filterItems(items, 'items'),
|
|
39869
|
-
premium: filterItems(items, 'premium')
|
|
39870
|
-
};
|
|
39871
|
-
}, [items]);
|
|
39872
|
-
var handleMetadataCollected = function handleMetadataCollected(metadata) {
|
|
39873
|
-
if (currentMetadataItem && window.__metadataResolvers) {
|
|
39874
|
-
// Resolve the promise in the useStoreMetadata hook
|
|
39875
|
-
window.__metadataResolvers.resolve(metadata);
|
|
39876
|
-
// Reset the metadata collection state
|
|
39877
|
-
setCurrentMetadataItem(null);
|
|
39878
|
-
// Removed unused setPendingMetadataQuantity call
|
|
39879
|
-
}
|
|
39952
|
+
var bp = packToBlueprint(pack);
|
|
39953
|
+
handleAddToCart(bp, quantity);
|
|
39954
|
+
onAddToCart == null ? void 0 : onAddToCart(bp, quantity);
|
|
39880
39955
|
};
|
|
39881
|
-
var
|
|
39882
|
-
|
|
39883
|
-
|
|
39884
|
-
window.__metadataResolvers.resolve(null);
|
|
39885
|
-
}
|
|
39886
|
-
// Reset the metadata collection state
|
|
39887
|
-
setCurrentMetadataItem(null);
|
|
39888
|
-
// Removed unused setPendingMetadataQuantity call
|
|
39889
|
-
setIsCollectingMetadata(false);
|
|
39890
|
-
};
|
|
39891
|
-
if (loading) {
|
|
39892
|
-
return React.createElement(LoadingMessage$1, null, "Loading...");
|
|
39893
|
-
}
|
|
39894
|
-
if (error) {
|
|
39895
|
-
return React.createElement(ErrorMessage$3, null, error);
|
|
39896
|
-
}
|
|
39897
|
-
// Build tabs dynamically based on props
|
|
39898
|
-
var tabIds = [].concat(tabOrder != null ? tabOrder : defaultTabOrder, customCharactersContent ? ['characters'] : [], onRedeem ? ['redeem'] : [], onShowWallet || customWalletContent ? ['wallet'] : [], onShowHistory || customHistoryContent ? ['history'] : []);
|
|
39899
|
-
var availableTabIds = Array.from(new Set(tabIds.filter(function (id) {
|
|
39900
|
-
return !(hidePremiumTab && id === 'premium');
|
|
39901
|
-
})));
|
|
39956
|
+
var makePackQuickBuy = onQuickBuy ? function (pack, qty) {
|
|
39957
|
+
return onQuickBuy(packToBlueprint(pack), qty);
|
|
39958
|
+
} : undefined;
|
|
39902
39959
|
var tabsMap = {
|
|
39903
39960
|
premium: {
|
|
39904
39961
|
id: 'premium',
|
|
@@ -39912,40 +39969,7 @@ var Store = function Store(_ref) {
|
|
|
39912
39969
|
return pack.priceUSD >= 9.99;
|
|
39913
39970
|
}),
|
|
39914
39971
|
onAddToCart: handleAddPackToCart,
|
|
39915
|
-
onQuickBuy:
|
|
39916
|
-
var bp = {
|
|
39917
|
-
key: pack.key,
|
|
39918
|
-
name: pack.title,
|
|
39919
|
-
description: pack.description || '',
|
|
39920
|
-
price: pack.priceUSD,
|
|
39921
|
-
currency: PaymentCurrency.USD,
|
|
39922
|
-
texturePath: pack.image["default"] || pack.image.src,
|
|
39923
|
-
type: PurchaseType.Pack,
|
|
39924
|
-
onPurchase: function () {
|
|
39925
|
-
var _onPurchase2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
|
|
39926
|
-
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
39927
|
-
while (1) switch (_context2.prev = _context2.next) {
|
|
39928
|
-
case 0:
|
|
39929
|
-
case "end":
|
|
39930
|
-
return _context2.stop();
|
|
39931
|
-
}
|
|
39932
|
-
}, _callee2);
|
|
39933
|
-
}));
|
|
39934
|
-
function onPurchase() {
|
|
39935
|
-
return _onPurchase2.apply(this, arguments);
|
|
39936
|
-
}
|
|
39937
|
-
return onPurchase;
|
|
39938
|
-
}(),
|
|
39939
|
-
itemType: ItemType.Consumable,
|
|
39940
|
-
itemSubType: ItemSubType.Other,
|
|
39941
|
-
rarity: ItemRarities.Common,
|
|
39942
|
-
weight: 0,
|
|
39943
|
-
isStackable: false,
|
|
39944
|
-
maxStackSize: 1,
|
|
39945
|
-
isUsable: false
|
|
39946
|
-
};
|
|
39947
|
-
onQuickBuy(bp, qty);
|
|
39948
|
-
} : undefined,
|
|
39972
|
+
onQuickBuy: makePackQuickBuy,
|
|
39949
39973
|
onSelectPack: setSelectedPack,
|
|
39950
39974
|
atlasJSON: atlasJSON,
|
|
39951
39975
|
atlasIMG: atlasIMG,
|
|
@@ -39970,40 +39994,7 @@ var Store = function Store(_ref) {
|
|
|
39970
39994
|
return pack.priceUSD < 9.99;
|
|
39971
39995
|
}),
|
|
39972
39996
|
onAddToCart: handleAddPackToCart,
|
|
39973
|
-
onQuickBuy:
|
|
39974
|
-
var bp = {
|
|
39975
|
-
key: pack.key,
|
|
39976
|
-
name: pack.title,
|
|
39977
|
-
description: pack.description || '',
|
|
39978
|
-
price: pack.priceUSD,
|
|
39979
|
-
currency: PaymentCurrency.USD,
|
|
39980
|
-
texturePath: pack.image["default"] || pack.image.src,
|
|
39981
|
-
type: PurchaseType.Pack,
|
|
39982
|
-
onPurchase: function () {
|
|
39983
|
-
var _onPurchase3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
|
|
39984
|
-
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
39985
|
-
while (1) switch (_context3.prev = _context3.next) {
|
|
39986
|
-
case 0:
|
|
39987
|
-
case "end":
|
|
39988
|
-
return _context3.stop();
|
|
39989
|
-
}
|
|
39990
|
-
}, _callee3);
|
|
39991
|
-
}));
|
|
39992
|
-
function onPurchase() {
|
|
39993
|
-
return _onPurchase3.apply(this, arguments);
|
|
39994
|
-
}
|
|
39995
|
-
return onPurchase;
|
|
39996
|
-
}(),
|
|
39997
|
-
itemType: ItemType.Consumable,
|
|
39998
|
-
itemSubType: ItemSubType.Other,
|
|
39999
|
-
rarity: ItemRarities.Common,
|
|
40000
|
-
weight: 0,
|
|
40001
|
-
isStackable: false,
|
|
40002
|
-
maxStackSize: 1,
|
|
40003
|
-
isUsable: false
|
|
40004
|
-
};
|
|
40005
|
-
onQuickBuy(bp, qty);
|
|
40006
|
-
} : undefined,
|
|
39997
|
+
onQuickBuy: makePackQuickBuy,
|
|
40007
39998
|
onSelectPack: setSelectedPack,
|
|
40008
39999
|
atlasJSON: atlasJSON,
|
|
40009
40000
|
atlasIMG: atlasIMG,
|
|
@@ -40022,7 +40013,7 @@ var Store = function Store(_ref) {
|
|
|
40022
40013
|
content: React.createElement(StoreItemsSection, {
|
|
40023
40014
|
items: filteredItems.items,
|
|
40024
40015
|
onAddToCart: handleAddToCartTracked,
|
|
40025
|
-
onQuickBuy: onQuickBuy ? function (item, qty
|
|
40016
|
+
onQuickBuy: onQuickBuy ? function (item, qty) {
|
|
40026
40017
|
return onQuickBuy(item, qty);
|
|
40027
40018
|
} : undefined,
|
|
40028
40019
|
atlasJSON: atlasJSON,
|
|
@@ -40032,7 +40023,8 @@ var Store = function Store(_ref) {
|
|
|
40032
40023
|
itemBadges: itemBadges,
|
|
40033
40024
|
onItemView: onItemView,
|
|
40034
40025
|
onCategoryChange: onCategoryChange,
|
|
40035
|
-
currencySymbol: currencySymbol
|
|
40026
|
+
currencySymbol: currencySymbol,
|
|
40027
|
+
categoryOptions: itemCategoryOptions
|
|
40036
40028
|
})
|
|
40037
40029
|
},
|
|
40038
40030
|
characters: {
|
|
@@ -40082,42 +40074,42 @@ var Store = function Store(_ref) {
|
|
|
40082
40074
|
}))
|
|
40083
40075
|
}
|
|
40084
40076
|
};
|
|
40077
|
+
if (loading) return React.createElement(LoadingMessage$1, null, "Loading...");
|
|
40078
|
+
if (error) return React.createElement(ErrorMessage$3, null, error);
|
|
40085
40079
|
return React.createElement(DraggableContainer, {
|
|
40086
|
-
title: "Store",
|
|
40087
40080
|
onCloseButton: onClose,
|
|
40088
|
-
width:
|
|
40081
|
+
width: width,
|
|
40089
40082
|
minWidth: "700px",
|
|
40090
|
-
height:
|
|
40091
|
-
mobileWidth: mobileContainerWidth != null ? mobileContainerWidth : "95vw",
|
|
40092
|
-
mobileHeight: mobileContainerHeight != null ? mobileContainerHeight : "95vh",
|
|
40093
|
-
mobileBreakpoint: mobileBreakpoint,
|
|
40083
|
+
height: height,
|
|
40094
40084
|
type: RPGUIContainerTypes.Framed,
|
|
40095
|
-
cancelDrag: "
|
|
40085
|
+
cancelDrag: ".store-scroll-area, [class*='CartView'], [class*='StoreItemDetails'], .close-button",
|
|
40096
40086
|
isFullScreen: fullScreen
|
|
40097
|
-
}, isCollectingMetadata && currentMetadataItem && currentMetadataItem.metadataType ? React.createElement(MetadataCollector, {
|
|
40087
|
+
}, isCollectingMetadata && currentMetadataItem != null && currentMetadataItem.metadataType ? React.createElement(MetadataCollector, {
|
|
40098
40088
|
metadataType: currentMetadataItem.metadataType,
|
|
40099
40089
|
config: currentMetadataItem.metadataConfig || {},
|
|
40100
|
-
onCollect:
|
|
40101
|
-
onCancel:
|
|
40090
|
+
onCollect: resolveMetadata,
|
|
40091
|
+
onCancel: function onCancel() {
|
|
40092
|
+
return resolveMetadata(null);
|
|
40093
|
+
}
|
|
40102
40094
|
}) : isCartOpen ? React.createElement(CartView, {
|
|
40103
40095
|
cartItems: cartItems,
|
|
40104
40096
|
onRemoveFromCart: handleRemoveFromCartTracked,
|
|
40105
40097
|
onClose: closeCart,
|
|
40106
40098
|
onPurchase: function () {
|
|
40107
|
-
var
|
|
40108
|
-
return _regeneratorRuntime().wrap(function
|
|
40109
|
-
while (1) switch (
|
|
40099
|
+
var _onPurchase2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
40100
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
40101
|
+
while (1) switch (_context.prev = _context.next) {
|
|
40110
40102
|
case 0:
|
|
40111
|
-
handleCartPurchase(
|
|
40112
|
-
return
|
|
40103
|
+
handleCartPurchase(_onPurchase);
|
|
40104
|
+
return _context.abrupt("return", true);
|
|
40113
40105
|
case 2:
|
|
40114
40106
|
case "end":
|
|
40115
|
-
return
|
|
40107
|
+
return _context.stop();
|
|
40116
40108
|
}
|
|
40117
|
-
},
|
|
40109
|
+
}, _callee);
|
|
40118
40110
|
}));
|
|
40119
40111
|
function onPurchase() {
|
|
40120
|
-
return
|
|
40112
|
+
return _onPurchase2.apply(this, arguments);
|
|
40121
40113
|
}
|
|
40122
40114
|
return onPurchase;
|
|
40123
40115
|
}(),
|
|
@@ -40126,7 +40118,6 @@ var Store = function Store(_ref) {
|
|
|
40126
40118
|
onCheckoutStart: onCheckoutStart,
|
|
40127
40119
|
onPurchaseSuccess: onPurchaseSuccess,
|
|
40128
40120
|
onPurchaseError: onPurchaseError,
|
|
40129
|
-
onBuyDC: onBuyDC,
|
|
40130
40121
|
currencySymbol: currencySymbol
|
|
40131
40122
|
}) : selectedPack ? React.createElement(StoreItemDetails, {
|
|
40132
40123
|
item: _extends({}, selectedPack, {
|
|
@@ -40141,7 +40132,9 @@ var Store = function Store(_ref) {
|
|
|
40141
40132
|
return handleAddPackToCart(selectedPack);
|
|
40142
40133
|
},
|
|
40143
40134
|
currencySymbol: currencySymbol
|
|
40144
|
-
}) : React.createElement(Container$Q,
|
|
40135
|
+
}) : React.createElement(Container$Q, {
|
|
40136
|
+
className: "store-scroll-area"
|
|
40137
|
+
}, featuredItems && featuredItems.length > 0 && React.createElement(FeaturedBanner, {
|
|
40145
40138
|
items: featuredItems,
|
|
40146
40139
|
atlasJSON: atlasJSON,
|
|
40147
40140
|
atlasIMG: atlasIMG,
|
|
@@ -40155,48 +40148,17 @@ var Store = function Store(_ref) {
|
|
|
40155
40148
|
var blueprint = items.find(function (bp) {
|
|
40156
40149
|
return bp.key === item.key;
|
|
40157
40150
|
});
|
|
40158
|
-
if (blueprint)
|
|
40151
|
+
if (blueprint) {
|
|
40152
|
+
onQuickBuy(blueprint, 1);
|
|
40153
|
+
} else {
|
|
40159
40154
|
var pack = packs.find(function (p) {
|
|
40160
40155
|
return p.key === item.key;
|
|
40161
40156
|
});
|
|
40162
|
-
if (pack)
|
|
40163
|
-
var packBlueprint = {
|
|
40164
|
-
key: pack.key,
|
|
40165
|
-
name: pack.title,
|
|
40166
|
-
description: pack.description || '',
|
|
40167
|
-
price: pack.priceUSD,
|
|
40168
|
-
currency: PaymentCurrency.USD,
|
|
40169
|
-
texturePath: pack.image["default"] || pack.image.src,
|
|
40170
|
-
type: PurchaseType.Pack,
|
|
40171
|
-
onPurchase: function () {
|
|
40172
|
-
var _onPurchase6 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {
|
|
40173
|
-
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
|
40174
|
-
while (1) switch (_context5.prev = _context5.next) {
|
|
40175
|
-
case 0:
|
|
40176
|
-
case "end":
|
|
40177
|
-
return _context5.stop();
|
|
40178
|
-
}
|
|
40179
|
-
}, _callee5);
|
|
40180
|
-
}));
|
|
40181
|
-
function onPurchase() {
|
|
40182
|
-
return _onPurchase6.apply(this, arguments);
|
|
40183
|
-
}
|
|
40184
|
-
return onPurchase;
|
|
40185
|
-
}(),
|
|
40186
|
-
itemType: ItemType.Consumable,
|
|
40187
|
-
itemSubType: ItemSubType.Other,
|
|
40188
|
-
rarity: ItemRarities.Common,
|
|
40189
|
-
weight: 0,
|
|
40190
|
-
isStackable: false,
|
|
40191
|
-
maxStackSize: 1,
|
|
40192
|
-
isUsable: false
|
|
40193
|
-
};
|
|
40194
|
-
onQuickBuy(packBlueprint, 1);
|
|
40195
|
-
}
|
|
40157
|
+
if (pack) onQuickBuy(packToBlueprint(pack), 1);
|
|
40196
40158
|
}
|
|
40197
40159
|
} : undefined
|
|
40198
|
-
}), React.createElement(MainContent$
|
|
40199
|
-
|
|
40160
|
+
}), React.createElement(MainContent$2, null, React.createElement(StoreHeader, {
|
|
40161
|
+
tabs: availableTabIds.map(function (id) {
|
|
40200
40162
|
var _tabsMap$id, _tabsMap$id2;
|
|
40201
40163
|
return {
|
|
40202
40164
|
id: id,
|
|
@@ -40205,20 +40167,12 @@ var Store = function Store(_ref) {
|
|
|
40205
40167
|
};
|
|
40206
40168
|
}),
|
|
40207
40169
|
activeTabId: activeTab,
|
|
40208
|
-
onTabChange:
|
|
40209
|
-
|
|
40210
|
-
|
|
40211
|
-
|
|
40212
|
-
var itemCount = nextTab === 'items' ? filteredItems.items.length : nextTab === 'premium' ? filteredItems.premium.length : nextTab === 'packs' ? packs.length : 0;
|
|
40213
|
-
_onTabChange(nextTab, itemCount);
|
|
40214
|
-
}
|
|
40215
|
-
}
|
|
40216
|
-
})), React.createElement(CartButtonWrapper, null, React.createElement(CTAButton, {
|
|
40170
|
+
onTabChange: handleTabChange,
|
|
40171
|
+
cartItemCount: getTotalItems(),
|
|
40172
|
+
onOpenCart: handleOpenCart
|
|
40173
|
+
}), React.createElement(TabContent, null, (_tabsMap$activeTab = tabsMap[activeTab]) == null ? void 0 : _tabsMap$activeTab.content)), cartItems.length > 0 && React.createElement(Footer$3, null, React.createElement(CTAButton, {
|
|
40217
40174
|
icon: React.createElement(FaShoppingCart, null),
|
|
40218
|
-
|
|
40219
|
-
}), getTotalItems() > 0 && React.createElement(CartBadge, null, getTotalItems()))), React.createElement(TabContent, null, (_tabsMap$activeTab = tabsMap[activeTab]) == null ? void 0 : _tabsMap$activeTab.content)), cartItems.length > 0 && React.createElement(Footer$3, null, React.createElement(CTAButton, {
|
|
40220
|
-
icon: React.createElement(FaShoppingCart, null),
|
|
40221
|
-
label: "Checkout \xB7 " + getTotalItems() + " item" + (getTotalItems() !== 1 ? 's' : '') + " (" + currencySymbol + getTotalPrice().toFixed(2) + ")",
|
|
40175
|
+
label: "Proceed to Checkout (" + currencySymbol + getTotalPrice().toFixed(2) + ")",
|
|
40222
40176
|
onClick: handleOpenCart,
|
|
40223
40177
|
fullWidth: true
|
|
40224
40178
|
}))));
|
|
@@ -40226,50 +40180,34 @@ var Store = function Store(_ref) {
|
|
|
40226
40180
|
var Container$Q = /*#__PURE__*/styled.div.withConfig({
|
|
40227
40181
|
displayName: "Store__Container",
|
|
40228
40182
|
componentId: "sc-64dj00-0"
|
|
40229
|
-
})(["display:flex;flex-direction:column;width:100%;height:
|
|
40230
|
-
var
|
|
40231
|
-
displayName: "Store__HeaderRow",
|
|
40232
|
-
componentId: "sc-64dj00-1"
|
|
40233
|
-
})(["display:flex;align-items:flex-end;justify-content:space-between;margin-bottom:0.25rem;padding-top:10px;padding-right:12px;"]);
|
|
40234
|
-
var TabsFlexWrapper = /*#__PURE__*/styled.div.withConfig({
|
|
40235
|
-
displayName: "Store__TabsFlexWrapper",
|
|
40236
|
-
componentId: "sc-64dj00-2"
|
|
40237
|
-
})(["flex:1;min-width:0;"]);
|
|
40238
|
-
var CartButtonWrapper = /*#__PURE__*/styled.div.withConfig({
|
|
40239
|
-
displayName: "Store__CartButtonWrapper",
|
|
40240
|
-
componentId: "sc-64dj00-3"
|
|
40241
|
-
})(["position:relative;flex-shrink:0;"]);
|
|
40242
|
-
var CartBadge = /*#__PURE__*/styled.div.withConfig({
|
|
40243
|
-
displayName: "Store__CartBadge",
|
|
40244
|
-
componentId: "sc-64dj00-4"
|
|
40245
|
-
})(["position:absolute;top:-8px;right:-8px;background:#ef4444;color:white;font-family:'Press Start 2P',cursive;font-size:0.5rem;padding:4px;border-radius:50%;border:2px solid #000;display:flex;align-items:center;justify-content:center;min-width:16px;min-height:16px;box-sizing:content-box;"]);
|
|
40246
|
-
var MainContent$1 = /*#__PURE__*/styled.div.withConfig({
|
|
40183
|
+
})(["display:flex;flex-direction:column;width:100%;height:100%;gap:0.5rem;position:relative;overflow:hidden;"]);
|
|
40184
|
+
var MainContent$2 = /*#__PURE__*/styled.div.withConfig({
|
|
40247
40185
|
displayName: "Store__MainContent",
|
|
40248
|
-
componentId: "sc-64dj00-
|
|
40186
|
+
componentId: "sc-64dj00-1"
|
|
40249
40187
|
})(["flex:1;display:flex;flex-direction:column;min-height:0;overflow:hidden;"]);
|
|
40250
40188
|
var TabContent = /*#__PURE__*/styled.div.withConfig({
|
|
40251
40189
|
displayName: "Store__TabContent",
|
|
40252
|
-
componentId: "sc-64dj00-
|
|
40190
|
+
componentId: "sc-64dj00-2"
|
|
40253
40191
|
})(["flex:1;overflow-y:auto;"]);
|
|
40254
40192
|
var Footer$3 = /*#__PURE__*/styled.div.withConfig({
|
|
40255
40193
|
displayName: "Store__Footer",
|
|
40256
|
-
componentId: "sc-64dj00-
|
|
40257
|
-
})(["padding:
|
|
40194
|
+
componentId: "sc-64dj00-3"
|
|
40195
|
+
})(["padding:1rem;border-top:2px solid #f59e0b;background:rgba(0,0,0,0.2);flex-shrink:0;"]);
|
|
40258
40196
|
var TabLabelWithBadge = /*#__PURE__*/styled.span.withConfig({
|
|
40259
40197
|
displayName: "Store__TabLabelWithBadge",
|
|
40260
|
-
componentId: "sc-64dj00-
|
|
40198
|
+
componentId: "sc-64dj00-4"
|
|
40261
40199
|
})(["display:inline-flex;align-items:center;gap:5px;"]);
|
|
40262
40200
|
var LoadingMessage$1 = /*#__PURE__*/styled.div.withConfig({
|
|
40263
40201
|
displayName: "Store__LoadingMessage",
|
|
40264
|
-
componentId: "sc-64dj00-
|
|
40202
|
+
componentId: "sc-64dj00-5"
|
|
40265
40203
|
})(["text-align:center;color:", ";padding:2rem;"], uiColors.white);
|
|
40266
40204
|
var ErrorMessage$3 = /*#__PURE__*/styled.div.withConfig({
|
|
40267
40205
|
displayName: "Store__ErrorMessage",
|
|
40268
|
-
componentId: "sc-64dj00-
|
|
40206
|
+
componentId: "sc-64dj00-6"
|
|
40269
40207
|
})(["text-align:center;color:", ";padding:2rem;"], uiColors.red);
|
|
40270
40208
|
var CenteredContent = /*#__PURE__*/styled.div.withConfig({
|
|
40271
40209
|
displayName: "Store__CenteredContent",
|
|
40272
|
-
componentId: "sc-64dj00-
|
|
40210
|
+
componentId: "sc-64dj00-7"
|
|
40273
40211
|
})(["display:flex;align-items:center;justify-content:center;height:100%;padding:2rem;"]);
|
|
40274
40212
|
|
|
40275
40213
|
var TextArea = function TextArea(_ref) {
|