@rpg-engine/long-bow 0.8.162 → 0.8.165
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/Store/Store.d.ts +1 -0
- package/dist/components/Store/sections/StorePacksSection.d.ts +1 -1
- package/dist/long-bow.cjs.development.js +84 -33
- 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 +84 -33
- package/dist/long-bow.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/components/Marketplace/BuyPanel.tsx +8 -4
- package/src/components/Store/Store.tsx +19 -4
- package/src/components/Store/sections/StorePacksSection.tsx +90 -30
- package/src/stories/Features/store/Store.stories.tsx +2 -1
|
@@ -2,7 +2,7 @@ import { IItemPack } from '@rpg-engine/shared';
|
|
|
2
2
|
import React from 'react';
|
|
3
3
|
interface IStorePacksSectionProps {
|
|
4
4
|
packs: IItemPack[];
|
|
5
|
-
onAddToCart: (pack: IItemPack) => void;
|
|
5
|
+
onAddToCart: (pack: IItemPack, quantity: number) => void;
|
|
6
6
|
onSelectPack?: (pack: IItemPack) => void;
|
|
7
7
|
atlasJSON?: any;
|
|
8
8
|
atlasIMG?: string;
|
|
@@ -46140,8 +46140,6 @@ var BuyPanel = function BuyPanel(_ref) {
|
|
|
46140
46140
|
dcToGoldSwapRate = _ref$dcToGoldSwapRate === void 0 ? 0 : _ref$dcToGoldSwapRate,
|
|
46141
46141
|
_ref$openBuyOrders = _ref.openBuyOrders,
|
|
46142
46142
|
openBuyOrders = _ref$openBuyOrders === void 0 ? [] : _ref$openBuyOrders,
|
|
46143
|
-
_ref$openBuyOrdersTot = _ref.openBuyOrdersTotal,
|
|
46144
|
-
openBuyOrdersTotal = _ref$openBuyOrdersTot === void 0 ? 0 : _ref$openBuyOrdersTot,
|
|
46145
46143
|
_ref$openBuyOrdersPag = _ref.openBuyOrdersPage,
|
|
46146
46144
|
openBuyOrdersPage = _ref$openBuyOrdersPag === void 0 ? 1 : _ref$openBuyOrdersPag,
|
|
46147
46145
|
onOpenBuyOrdersPageChange = _ref.onOpenBuyOrdersPageChange,
|
|
@@ -46252,6 +46250,10 @@ var BuyPanel = function BuyPanel(_ref) {
|
|
|
46252
46250
|
return totalGold(b) - totalGold(a);
|
|
46253
46251
|
});
|
|
46254
46252
|
}, [visibleBuyOrders]);
|
|
46253
|
+
var paginatedGroupedBuyOrders = React.useMemo(function () {
|
|
46254
|
+
var start = (openBuyOrdersPage - 1) * BUY_REQUESTS_PER_PAGE;
|
|
46255
|
+
return groupedBuyOrders.slice(start, start + BUY_REQUESTS_PER_PAGE);
|
|
46256
|
+
}, [groupedBuyOrders, openBuyOrdersPage]);
|
|
46255
46257
|
var showSellSection = browseMode === 'sell';
|
|
46256
46258
|
var showBuySection = browseMode === 'buy';
|
|
46257
46259
|
var hasVisibleContent = showSellSection && groupedItems.length > 0 || showBuySection && groupedBuyOrders.length > 0;
|
|
@@ -46425,7 +46427,7 @@ var BuyPanel = function BuyPanel(_ref) {
|
|
|
46425
46427
|
onBuy: setBuyingItemId,
|
|
46426
46428
|
onDCCoinClick: onDCCoinClick
|
|
46427
46429
|
});
|
|
46428
|
-
})), showBuySection && React__default.createElement(MarketSection, null, React__default.createElement(SectionHeader, null, React__default.createElement(SectionTitle$2, null, "Buy Requests"), React__default.createElement(SectionMeta, null, groupedBuyOrders.length, " groups")), groupedBuyOrders.length === 0 ? React__default.createElement(SectionEmpty, null, "No public buy requests found.") :
|
|
46430
|
+
})), showBuySection && React__default.createElement(MarketSection, null, React__default.createElement(SectionHeader, null, React__default.createElement(SectionTitle$2, null, "Buy Requests"), React__default.createElement(SectionMeta, null, groupedBuyOrders.length, " groups")), groupedBuyOrders.length === 0 ? React__default.createElement(SectionEmpty, null, "No public buy requests found.") : paginatedGroupedBuyOrders.map(function (_ref3) {
|
|
46429
46431
|
var bestOrder = _ref3.bestOrder,
|
|
46430
46432
|
otherOrders = _ref3.otherOrders;
|
|
46431
46433
|
return React__default.createElement(GroupedBuyOrderRow, {
|
|
@@ -46441,8 +46443,8 @@ var BuyPanel = function BuyPanel(_ref) {
|
|
|
46441
46443
|
currentPage: currentPage,
|
|
46442
46444
|
itemsPerPage: itemsPerPage,
|
|
46443
46445
|
onPageChange: onPageChange
|
|
46444
|
-
}), showBuySection &&
|
|
46445
|
-
totalItems:
|
|
46446
|
+
}), showBuySection && groupedBuyOrders.length > BUY_REQUESTS_PER_PAGE && React__default.createElement(Pager, {
|
|
46447
|
+
totalItems: groupedBuyOrders.length,
|
|
46446
46448
|
currentPage: openBuyOrdersPage,
|
|
46447
46449
|
itemsPerPage: BUY_REQUESTS_PER_PAGE,
|
|
46448
46450
|
onPageChange: onOpenBuyOrdersPageChange != null ? onOpenBuyOrdersPageChange : function () {}
|
|
@@ -70446,12 +70448,48 @@ var usePackFiltering = function usePackFiltering(packs) {
|
|
|
70446
70448
|
};
|
|
70447
70449
|
};
|
|
70448
70450
|
|
|
70449
|
-
var
|
|
70450
|
-
var
|
|
70451
|
+
var PackRowItem = function PackRowItem(_ref) {
|
|
70452
|
+
var pack = _ref.pack,
|
|
70451
70453
|
onAddToCart = _ref.onAddToCart,
|
|
70452
|
-
|
|
70453
|
-
|
|
70454
|
-
|
|
70454
|
+
renderPackIcon = _ref.renderPackIcon;
|
|
70455
|
+
var _useQuantityControl = useQuantityControl(),
|
|
70456
|
+
quantity = _useQuantityControl.quantity,
|
|
70457
|
+
handleQuantityChange = _useQuantityControl.handleQuantityChange,
|
|
70458
|
+
handleBlur = _useQuantityControl.handleBlur,
|
|
70459
|
+
incrementQuantity = _useQuantityControl.incrementQuantity,
|
|
70460
|
+
decrementQuantity = _useQuantityControl.decrementQuantity,
|
|
70461
|
+
resetQuantity = _useQuantityControl.resetQuantity;
|
|
70462
|
+
var handleAdd = function handleAdd() {
|
|
70463
|
+
onAddToCart(pack, quantity);
|
|
70464
|
+
resetQuantity();
|
|
70465
|
+
};
|
|
70466
|
+
return React__default.createElement(PackRow, null, React__default.createElement(LeftSection$1, null, React__default.createElement(PackIconContainer, null, renderPackIcon(pack)), React__default.createElement(PackDetails, null, React__default.createElement(PackName, null, pack.title), React__default.createElement(PackPrice, null, "$", pack.priceUSD), pack.description && React__default.createElement(PackDescription, null, pack.description))), React__default.createElement(Controls$2, null, React__default.createElement(ArrowsContainer$1, null, React__default.createElement(SelectArrow, {
|
|
70467
|
+
direction: "left",
|
|
70468
|
+
onPointerDown: decrementQuantity,
|
|
70469
|
+
size: 24
|
|
70470
|
+
}), React__default.createElement(QuantityInput$1, {
|
|
70471
|
+
type: "number",
|
|
70472
|
+
value: quantity,
|
|
70473
|
+
onChange: handleQuantityChange,
|
|
70474
|
+
onBlur: handleBlur,
|
|
70475
|
+
min: 1,
|
|
70476
|
+
max: 99,
|
|
70477
|
+
className: "rpgui-input"
|
|
70478
|
+
}), React__default.createElement(SelectArrow, {
|
|
70479
|
+
direction: "right",
|
|
70480
|
+
onPointerDown: incrementQuantity,
|
|
70481
|
+
size: 24
|
|
70482
|
+
})), React__default.createElement(CTAButton, {
|
|
70483
|
+
icon: React__default.createElement(fa.FaCartPlus, null),
|
|
70484
|
+
label: "Add",
|
|
70485
|
+
onClick: handleAdd
|
|
70486
|
+
})));
|
|
70487
|
+
};
|
|
70488
|
+
var StorePacksSection = function StorePacksSection(_ref2) {
|
|
70489
|
+
var packs = _ref2.packs,
|
|
70490
|
+
onAddToCart = _ref2.onAddToCart,
|
|
70491
|
+
atlasJSON = _ref2.atlasJSON,
|
|
70492
|
+
atlasIMG = _ref2.atlasIMG;
|
|
70455
70493
|
var _usePackFiltering = usePackFiltering(packs),
|
|
70456
70494
|
searchQuery = _usePackFiltering.searchQuery,
|
|
70457
70495
|
setSearchQuery = _usePackFiltering.setSearchQuery,
|
|
@@ -70480,20 +70518,13 @@ var StorePacksSection = function StorePacksSection(_ref) {
|
|
|
70480
70518
|
});
|
|
70481
70519
|
}, [atlasJSON, atlasIMG]);
|
|
70482
70520
|
var renderPack = React.useCallback(function (pack) {
|
|
70483
|
-
return React__default.createElement(
|
|
70521
|
+
return React__default.createElement(PackRowItem, {
|
|
70484
70522
|
key: pack.key,
|
|
70485
|
-
|
|
70486
|
-
|
|
70487
|
-
|
|
70488
|
-
}
|
|
70489
|
-
|
|
70490
|
-
label: "Add",
|
|
70491
|
-
onClick: function onClick(e) {
|
|
70492
|
-
e.stopPropagation();
|
|
70493
|
-
onAddToCart(pack);
|
|
70494
|
-
}
|
|
70495
|
-
})));
|
|
70496
|
-
}, [onSelectPack, onAddToCart]);
|
|
70523
|
+
pack: pack,
|
|
70524
|
+
onAddToCart: onAddToCart,
|
|
70525
|
+
renderPackIcon: renderPackIcon
|
|
70526
|
+
});
|
|
70527
|
+
}, [onAddToCart, renderPackIcon]);
|
|
70497
70528
|
return React__default.createElement(ScrollableContent, {
|
|
70498
70529
|
items: filteredPacks,
|
|
70499
70530
|
renderItem: renderPack,
|
|
@@ -70510,7 +70541,7 @@ var StorePacksSection = function StorePacksSection(_ref) {
|
|
|
70510
70541
|
var PackRow = /*#__PURE__*/styled__default(ItemRowWrapper).withConfig({
|
|
70511
70542
|
displayName: "StorePacksSection__PackRow",
|
|
70512
70543
|
componentId: "sc-ulazq3-0"
|
|
70513
|
-
})(["
|
|
70544
|
+
})([""]);
|
|
70514
70545
|
var LeftSection$1 = /*#__PURE__*/styled__default.div.withConfig({
|
|
70515
70546
|
displayName: "StorePacksSection__LeftSection",
|
|
70516
70547
|
componentId: "sc-ulazq3-1"
|
|
@@ -70538,7 +70569,15 @@ var PackDescription = /*#__PURE__*/styled__default.div.withConfig({
|
|
|
70538
70569
|
var Controls$2 = /*#__PURE__*/styled__default.div.withConfig({
|
|
70539
70570
|
displayName: "StorePacksSection__Controls",
|
|
70540
70571
|
componentId: "sc-ulazq3-7"
|
|
70541
|
-
})(["display:flex;align-items:center;flex-shrink:0;"]);
|
|
70572
|
+
})(["display:flex;align-items:center;gap:0.5rem;flex-shrink:0;"]);
|
|
70573
|
+
var ArrowsContainer$1 = /*#__PURE__*/styled__default.div.withConfig({
|
|
70574
|
+
displayName: "StorePacksSection__ArrowsContainer",
|
|
70575
|
+
componentId: "sc-ulazq3-8"
|
|
70576
|
+
})(["position:relative;display:flex;align-items:center;width:120px;height:42px;justify-content:space-between;"]);
|
|
70577
|
+
var QuantityInput$1 = /*#__PURE__*/styled__default.input.withConfig({
|
|
70578
|
+
displayName: "StorePacksSection__QuantityInput",
|
|
70579
|
+
componentId: "sc-ulazq3-9"
|
|
70580
|
+
})(["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;}"]);
|
|
70542
70581
|
|
|
70543
70582
|
var StoreItemDetails = function StoreItemDetails(_ref) {
|
|
70544
70583
|
var item = _ref.item,
|
|
@@ -70634,7 +70673,8 @@ var Store = function Store(_ref) {
|
|
|
70634
70673
|
customPacksContent = _ref.customPacksContent,
|
|
70635
70674
|
customWalletContent = _ref.customWalletContent,
|
|
70636
70675
|
_ref$packsTabLabel = _ref.packsTabLabel,
|
|
70637
|
-
packsTabLabel = _ref$packsTabLabel === void 0 ? 'Packs' : _ref$packsTabLabel
|
|
70676
|
+
packsTabLabel = _ref$packsTabLabel === void 0 ? 'Packs' : _ref$packsTabLabel,
|
|
70677
|
+
packsBadge = _ref.packsBadge;
|
|
70638
70678
|
var _useState = React.useState(null),
|
|
70639
70679
|
selectedPack = _useState[0],
|
|
70640
70680
|
setSelectedPack = _useState[1];
|
|
@@ -70665,7 +70705,10 @@ var Store = function Store(_ref) {
|
|
|
70665
70705
|
var _useState4 = React.useState(null),
|
|
70666
70706
|
currentMetadataItem = _useState4[0],
|
|
70667
70707
|
setCurrentMetadataItem = _useState4[1];
|
|
70668
|
-
var handleAddPackToCart = function handleAddPackToCart(pack) {
|
|
70708
|
+
var handleAddPackToCart = function handleAddPackToCart(pack, quantity) {
|
|
70709
|
+
if (quantity === void 0) {
|
|
70710
|
+
quantity = 1;
|
|
70711
|
+
}
|
|
70669
70712
|
var packItem = {
|
|
70670
70713
|
key: pack.key,
|
|
70671
70714
|
name: pack.title,
|
|
@@ -70697,7 +70740,7 @@ var Store = function Store(_ref) {
|
|
|
70697
70740
|
maxStackSize: 1,
|
|
70698
70741
|
isUsable: false
|
|
70699
70742
|
};
|
|
70700
|
-
handleAddToCart(packItem,
|
|
70743
|
+
handleAddToCart(packItem, quantity);
|
|
70701
70744
|
};
|
|
70702
70745
|
var filterItems = function filterItems(itemsToFilter, type) {
|
|
70703
70746
|
return itemsToFilter.filter(function (item) {
|
|
@@ -70764,7 +70807,11 @@ var Store = function Store(_ref) {
|
|
|
70764
70807
|
},
|
|
70765
70808
|
packs: {
|
|
70766
70809
|
id: 'packs',
|
|
70767
|
-
title: packsTabLabel,
|
|
70810
|
+
title: packsBadge ? React__default.createElement(TabLabelWithBadge, null, packsTabLabel, React__default.createElement(LabelPill, {
|
|
70811
|
+
background: "#f59e0b",
|
|
70812
|
+
borderColor: "#f59e0b",
|
|
70813
|
+
color: "#000"
|
|
70814
|
+
}, packsBadge)) : packsTabLabel,
|
|
70768
70815
|
icon: React__default.createElement(Gift.Gift, {
|
|
70769
70816
|
width: 18,
|
|
70770
70817
|
height: 18
|
|
@@ -70922,13 +70969,17 @@ var CartInfo = /*#__PURE__*/styled__default.div.withConfig({
|
|
|
70922
70969
|
displayName: "Store__CartInfo",
|
|
70923
70970
|
componentId: "sc-64dj00-8"
|
|
70924
70971
|
})(["display:flex;align-items:center;gap:0.75rem;font-family:'Press Start 2P',cursive;font-size:0.75rem;color:#ffffff;span:last-child{color:#fef08a;}"]);
|
|
70972
|
+
var TabLabelWithBadge = /*#__PURE__*/styled__default.span.withConfig({
|
|
70973
|
+
displayName: "Store__TabLabelWithBadge",
|
|
70974
|
+
componentId: "sc-64dj00-9"
|
|
70975
|
+
})(["display:inline-flex;align-items:center;gap:5px;"]);
|
|
70925
70976
|
var LoadingMessage$1 = /*#__PURE__*/styled__default.div.withConfig({
|
|
70926
70977
|
displayName: "Store__LoadingMessage",
|
|
70927
|
-
componentId: "sc-64dj00-
|
|
70978
|
+
componentId: "sc-64dj00-10"
|
|
70928
70979
|
})(["text-align:center;color:", ";padding:2rem;"], uiColors.white);
|
|
70929
70980
|
var ErrorMessage$3 = /*#__PURE__*/styled__default.div.withConfig({
|
|
70930
70981
|
displayName: "Store__ErrorMessage",
|
|
70931
|
-
componentId: "sc-64dj00-
|
|
70982
|
+
componentId: "sc-64dj00-11"
|
|
70932
70983
|
})(["text-align:center;color:", ";padding:2rem;"], uiColors.red);
|
|
70933
70984
|
|
|
70934
70985
|
var PaymentMethodModal = function PaymentMethodModal(_ref) {
|
|
@@ -71254,7 +71305,7 @@ var TradingItemRow = function TradingItemRow(_ref) {
|
|
|
71254
71305
|
onPointerDown: function onPointerDown() {
|
|
71255
71306
|
return onLeftClick();
|
|
71256
71307
|
}
|
|
71257
|
-
}), React__default.createElement(QuantityInput$
|
|
71308
|
+
}), React__default.createElement(QuantityInput$2, {
|
|
71258
71309
|
type: "text",
|
|
71259
71310
|
value: inputQty,
|
|
71260
71311
|
onChange: handleQuantityChange,
|
|
@@ -71304,7 +71355,7 @@ var QuantityContainer$1 = /*#__PURE__*/styled__default.div.withConfig({
|
|
|
71304
71355
|
displayName: "TradingItemRow__QuantityContainer",
|
|
71305
71356
|
componentId: "sc-mja0b5-6"
|
|
71306
71357
|
})(["display:flex;min-width:90px;width:40%;justify-content:flex-end;align-items:center;flex:30%;gap:2px;position:relative;"]);
|
|
71307
|
-
var QuantityInput$
|
|
71358
|
+
var QuantityInput$2 = /*#__PURE__*/styled__default.input.withConfig({
|
|
71308
71359
|
displayName: "TradingItemRow__QuantityInput",
|
|
71309
71360
|
componentId: "sc-mja0b5-7"
|
|
71310
71361
|
})(["width:30px;text-align:center;background-color:", ";color:white;border:none;padding:1px;font-size:", ";position:relative;right:4px;"], uiColors.darkGray, uiFonts.size.small);
|