@rpg-engine/long-bow 0.8.162 → 0.8.163

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.
@@ -21,6 +21,7 @@ export interface IStoreProps {
21
21
  textInputItemKeys?: string[];
22
22
  customPacksContent?: React.ReactNode;
23
23
  customWalletContent?: React.ReactNode;
24
+ packsBadge?: string;
24
25
  }
25
26
  export declare const Store: React.FC<IStoreProps>;
26
27
  export {};
@@ -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;
@@ -70446,12 +70446,48 @@ var usePackFiltering = function usePackFiltering(packs) {
70446
70446
  };
70447
70447
  };
70448
70448
 
70449
- var StorePacksSection = function StorePacksSection(_ref) {
70450
- var packs = _ref.packs,
70449
+ var PackRowItem = function PackRowItem(_ref) {
70450
+ var pack = _ref.pack,
70451
70451
  onAddToCart = _ref.onAddToCart,
70452
- onSelectPack = _ref.onSelectPack,
70453
- atlasJSON = _ref.atlasJSON,
70454
- atlasIMG = _ref.atlasIMG;
70452
+ renderPackIcon = _ref.renderPackIcon;
70453
+ var _useQuantityControl = useQuantityControl(),
70454
+ quantity = _useQuantityControl.quantity,
70455
+ handleQuantityChange = _useQuantityControl.handleQuantityChange,
70456
+ handleBlur = _useQuantityControl.handleBlur,
70457
+ incrementQuantity = _useQuantityControl.incrementQuantity,
70458
+ decrementQuantity = _useQuantityControl.decrementQuantity,
70459
+ resetQuantity = _useQuantityControl.resetQuantity;
70460
+ var handleAdd = function handleAdd() {
70461
+ onAddToCart(pack, quantity);
70462
+ resetQuantity();
70463
+ };
70464
+ 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, {
70465
+ direction: "left",
70466
+ onPointerDown: decrementQuantity,
70467
+ size: 24
70468
+ }), React__default.createElement(QuantityInput$1, {
70469
+ type: "number",
70470
+ value: quantity,
70471
+ onChange: handleQuantityChange,
70472
+ onBlur: handleBlur,
70473
+ min: 1,
70474
+ max: 99,
70475
+ className: "rpgui-input"
70476
+ }), React__default.createElement(SelectArrow, {
70477
+ direction: "right",
70478
+ onPointerDown: incrementQuantity,
70479
+ size: 24
70480
+ })), React__default.createElement(CTAButton, {
70481
+ icon: React__default.createElement(fa.FaCartPlus, null),
70482
+ label: "Add",
70483
+ onClick: handleAdd
70484
+ })));
70485
+ };
70486
+ var StorePacksSection = function StorePacksSection(_ref2) {
70487
+ var packs = _ref2.packs,
70488
+ onAddToCart = _ref2.onAddToCart,
70489
+ atlasJSON = _ref2.atlasJSON,
70490
+ atlasIMG = _ref2.atlasIMG;
70455
70491
  var _usePackFiltering = usePackFiltering(packs),
70456
70492
  searchQuery = _usePackFiltering.searchQuery,
70457
70493
  setSearchQuery = _usePackFiltering.setSearchQuery,
@@ -70480,20 +70516,13 @@ var StorePacksSection = function StorePacksSection(_ref) {
70480
70516
  });
70481
70517
  }, [atlasJSON, atlasIMG]);
70482
70518
  var renderPack = React.useCallback(function (pack) {
70483
- return React__default.createElement(PackRow, {
70519
+ return React__default.createElement(PackRowItem, {
70484
70520
  key: pack.key,
70485
- onClick: function onClick() {
70486
- return onSelectPack == null ? void 0 : onSelectPack(pack);
70487
- }
70488
- }, 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(CTAButton, {
70489
- icon: React__default.createElement(fa.FaCartPlus, null),
70490
- label: "Add",
70491
- onClick: function onClick(e) {
70492
- e.stopPropagation();
70493
- onAddToCart(pack);
70494
- }
70495
- })));
70496
- }, [onSelectPack, onAddToCart]);
70521
+ pack: pack,
70522
+ onAddToCart: onAddToCart,
70523
+ renderPackIcon: renderPackIcon
70524
+ });
70525
+ }, [onAddToCart, renderPackIcon]);
70497
70526
  return React__default.createElement(ScrollableContent, {
70498
70527
  items: filteredPacks,
70499
70528
  renderItem: renderPack,
@@ -70510,7 +70539,7 @@ var StorePacksSection = function StorePacksSection(_ref) {
70510
70539
  var PackRow = /*#__PURE__*/styled__default(ItemRowWrapper).withConfig({
70511
70540
  displayName: "StorePacksSection__PackRow",
70512
70541
  componentId: "sc-ulazq3-0"
70513
- })(["cursor:pointer;"]);
70542
+ })([""]);
70514
70543
  var LeftSection$1 = /*#__PURE__*/styled__default.div.withConfig({
70515
70544
  displayName: "StorePacksSection__LeftSection",
70516
70545
  componentId: "sc-ulazq3-1"
@@ -70538,7 +70567,15 @@ var PackDescription = /*#__PURE__*/styled__default.div.withConfig({
70538
70567
  var Controls$2 = /*#__PURE__*/styled__default.div.withConfig({
70539
70568
  displayName: "StorePacksSection__Controls",
70540
70569
  componentId: "sc-ulazq3-7"
70541
- })(["display:flex;align-items:center;flex-shrink:0;"]);
70570
+ })(["display:flex;align-items:center;gap:0.5rem;flex-shrink:0;"]);
70571
+ var ArrowsContainer$1 = /*#__PURE__*/styled__default.div.withConfig({
70572
+ displayName: "StorePacksSection__ArrowsContainer",
70573
+ componentId: "sc-ulazq3-8"
70574
+ })(["position:relative;display:flex;align-items:center;width:120px;height:42px;justify-content:space-between;"]);
70575
+ var QuantityInput$1 = /*#__PURE__*/styled__default.input.withConfig({
70576
+ displayName: "StorePacksSection__QuantityInput",
70577
+ componentId: "sc-ulazq3-9"
70578
+ })(["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
70579
 
70543
70580
  var StoreItemDetails = function StoreItemDetails(_ref) {
70544
70581
  var item = _ref.item,
@@ -70634,7 +70671,8 @@ var Store = function Store(_ref) {
70634
70671
  customPacksContent = _ref.customPacksContent,
70635
70672
  customWalletContent = _ref.customWalletContent,
70636
70673
  _ref$packsTabLabel = _ref.packsTabLabel,
70637
- packsTabLabel = _ref$packsTabLabel === void 0 ? 'Packs' : _ref$packsTabLabel;
70674
+ packsTabLabel = _ref$packsTabLabel === void 0 ? 'Packs' : _ref$packsTabLabel,
70675
+ packsBadge = _ref.packsBadge;
70638
70676
  var _useState = React.useState(null),
70639
70677
  selectedPack = _useState[0],
70640
70678
  setSelectedPack = _useState[1];
@@ -70665,7 +70703,10 @@ var Store = function Store(_ref) {
70665
70703
  var _useState4 = React.useState(null),
70666
70704
  currentMetadataItem = _useState4[0],
70667
70705
  setCurrentMetadataItem = _useState4[1];
70668
- var handleAddPackToCart = function handleAddPackToCart(pack) {
70706
+ var handleAddPackToCart = function handleAddPackToCart(pack, quantity) {
70707
+ if (quantity === void 0) {
70708
+ quantity = 1;
70709
+ }
70669
70710
  var packItem = {
70670
70711
  key: pack.key,
70671
70712
  name: pack.title,
@@ -70697,7 +70738,7 @@ var Store = function Store(_ref) {
70697
70738
  maxStackSize: 1,
70698
70739
  isUsable: false
70699
70740
  };
70700
- handleAddToCart(packItem, 1);
70741
+ handleAddToCart(packItem, quantity);
70701
70742
  };
70702
70743
  var filterItems = function filterItems(itemsToFilter, type) {
70703
70744
  return itemsToFilter.filter(function (item) {
@@ -70764,7 +70805,11 @@ var Store = function Store(_ref) {
70764
70805
  },
70765
70806
  packs: {
70766
70807
  id: 'packs',
70767
- title: packsTabLabel,
70808
+ title: packsBadge ? React__default.createElement(TabLabelWithBadge, null, packsTabLabel, React__default.createElement(LabelPill, {
70809
+ background: "#f59e0b",
70810
+ borderColor: "#f59e0b",
70811
+ color: "#000"
70812
+ }, packsBadge)) : packsTabLabel,
70768
70813
  icon: React__default.createElement(Gift.Gift, {
70769
70814
  width: 18,
70770
70815
  height: 18
@@ -70922,13 +70967,17 @@ var CartInfo = /*#__PURE__*/styled__default.div.withConfig({
70922
70967
  displayName: "Store__CartInfo",
70923
70968
  componentId: "sc-64dj00-8"
70924
70969
  })(["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;}"]);
70970
+ var TabLabelWithBadge = /*#__PURE__*/styled__default.span.withConfig({
70971
+ displayName: "Store__TabLabelWithBadge",
70972
+ componentId: "sc-64dj00-9"
70973
+ })(["display:inline-flex;align-items:center;gap:5px;"]);
70925
70974
  var LoadingMessage$1 = /*#__PURE__*/styled__default.div.withConfig({
70926
70975
  displayName: "Store__LoadingMessage",
70927
- componentId: "sc-64dj00-9"
70976
+ componentId: "sc-64dj00-10"
70928
70977
  })(["text-align:center;color:", ";padding:2rem;"], uiColors.white);
70929
70978
  var ErrorMessage$3 = /*#__PURE__*/styled__default.div.withConfig({
70930
70979
  displayName: "Store__ErrorMessage",
70931
- componentId: "sc-64dj00-10"
70980
+ componentId: "sc-64dj00-11"
70932
70981
  })(["text-align:center;color:", ";padding:2rem;"], uiColors.red);
70933
70982
 
70934
70983
  var PaymentMethodModal = function PaymentMethodModal(_ref) {
@@ -71254,7 +71303,7 @@ var TradingItemRow = function TradingItemRow(_ref) {
71254
71303
  onPointerDown: function onPointerDown() {
71255
71304
  return onLeftClick();
71256
71305
  }
71257
- }), React__default.createElement(QuantityInput$1, {
71306
+ }), React__default.createElement(QuantityInput$2, {
71258
71307
  type: "text",
71259
71308
  value: inputQty,
71260
71309
  onChange: handleQuantityChange,
@@ -71304,7 +71353,7 @@ var QuantityContainer$1 = /*#__PURE__*/styled__default.div.withConfig({
71304
71353
  displayName: "TradingItemRow__QuantityContainer",
71305
71354
  componentId: "sc-mja0b5-6"
71306
71355
  })(["display:flex;min-width:90px;width:40%;justify-content:flex-end;align-items:center;flex:30%;gap:2px;position:relative;"]);
71307
- var QuantityInput$1 = /*#__PURE__*/styled__default.input.withConfig({
71356
+ var QuantityInput$2 = /*#__PURE__*/styled__default.input.withConfig({
71308
71357
  displayName: "TradingItemRow__QuantityInput",
71309
71358
  componentId: "sc-mja0b5-7"
71310
71359
  })(["width:30px;text-align:center;background-color:", ";color:white;border:none;padding:1px;font-size:", ";position:relative;right:4px;"], uiColors.darkGray, uiFonts.size.small);