@rpg-engine/long-bow 0.8.70 → 0.8.72

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2,7 +2,7 @@ import React, { useState, useEffect, Component, useRef, useCallback, useContext,
2
2
  import styled, { css, keyframes, createGlobalStyle } 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, RewardType, isMobileOrTablet, ItemSlotType, NPCSubtype, EntityAttackType, NPCAlignment, VideoGuideCategory, VideoGuideLanguage, CharacterClass, QuestStatus, getSPForLevel, getXPForLevel, MetadataType, PurchaseType, UserAccountTypes, PeriodOfDay } from '@rpg-engine/shared';
5
+ import { GRID_WIDTH, GRID_HEIGHT, ShortcutType, getItemTextureKeyPath, ItemContainerType, ItemType, DepotSocketEvents, ItemSocketEvents, ItemSocketEventsDisplayLabels, ActionsForInventory, ActionsForEquipmentSet, ActionsForLoot, ActionsForMapContainer, ItemQualityLevel, ItemRarities, ItemSubType, isMobile, TaskType, TaskStatus, RewardType, isMobileOrTablet, ItemSlotType, NPCSubtype, EntityAttackType, NPCAlignment, VideoGuideCategory, VideoGuideLanguage, CharacterClass, QuestStatus, getSPForLevel, getXPForLevel, MetadataType, PurchaseType, UserAccountTypes, PaymentCurrency, PeriodOfDay } from '@rpg-engine/shared';
6
6
  import dayjs from 'dayjs';
7
7
  import { ErrorBoundary as ErrorBoundary$1 } from 'react-error-boundary';
8
8
  import { FaTimes, FaDiscord, FaWhatsapp, FaSearch, FaThumbtack, FaBoxOpen, FaChevronLeft, FaChevronRight, FaChevronUp, FaChevronDown, FaReddit, FaTrash, FaShoppingBag, FaInfoCircle, FaCartPlus, FaArrowLeft, FaHistory, FaShoppingCart } from 'react-icons/fa';
@@ -57512,7 +57512,7 @@ var CartView = function CartView(_ref2) {
57512
57512
  return React.createElement(Container$K, null, React.createElement(Header$7, null, React.createElement(Title$e, null, "Shopping Cart"), React.createElement(CloseButton$9, {
57513
57513
  onPointerDown: onClose
57514
57514
  }, React.createElement(FaTimes, null))), React.createElement(CartItems, null, cartItems.length === 0 ? React.createElement(EmptyCart, null, "Your cart is empty") : cartItems.map(function (cartItem) {
57515
- var _cartItem$metadata;
57515
+ var _cartItem$metadata, _cartItem$metadata2;
57516
57516
  console.log('Item metadataType: , texturePath:', cartItem.item.metadataType, cartItem.item.texturePath);
57517
57517
  var getSpriteKey = function getSpriteKey(textureKey) {
57518
57518
  return textureKey + '/down/standing/0.png';
@@ -57527,7 +57527,7 @@ var CartView = function CartView(_ref2) {
57527
57527
  height: 32,
57528
57528
  imgScale: 2,
57529
57529
  centered: true
57530
- })), React.createElement(ItemDetails, null, React.createElement(ItemName, null, cartItem.item.name), React.createElement(ItemInfo$1, null, React.createElement("span", null, "$", formatPrice(cartItem.item.price)), React.createElement("span", null, "\xD7"), React.createElement("span", null, cartItem.quantity), React.createElement("span", null, "="), React.createElement("span", null, "$", formatPrice(cartItem.item.price * cartItem.quantity))), cartItem.metadata && cartItem.item.metadataType && React.createElement(MetadataDisplay, {
57530
+ })), React.createElement(ItemDetails, null, React.createElement(ItemName, null, cartItem.item.name), ((_cartItem$metadata2 = cartItem.metadata) == null ? void 0 : _cartItem$metadata2.inputValue) && React.createElement(CartMeta, null, cartItem.metadata.inputValue), React.createElement(ItemInfo$1, null, React.createElement("span", null, "$", formatPrice(cartItem.item.price)), React.createElement("span", null, "\xD7"), React.createElement("span", null, cartItem.quantity), React.createElement("span", null, "="), React.createElement("span", null, "$", formatPrice(cartItem.item.price * cartItem.quantity))), cartItem.metadata && cartItem.item.metadataType && React.createElement(MetadataDisplay, {
57531
57531
  type: cartItem.item.metadataType,
57532
57532
  metadata: cartItem.metadata
57533
57533
  })), React.createElement(CTAButton, {
@@ -57617,6 +57617,10 @@ var MetadataValue = /*#__PURE__*/styled.div.withConfig({
57617
57617
  displayName: "CartView__MetadataValue",
57618
57618
  componentId: "sc-ydtyl1-17"
57619
57619
  })(["overflow:hidden;text-overflow:ellipsis;white-space:nowrap;"]);
57620
+ var CartMeta = /*#__PURE__*/styled.div.withConfig({
57621
+ displayName: "CartView__CartMeta",
57622
+ componentId: "sc-ydtyl1-18"
57623
+ })(["font-family:'Press Start 2P',cursive;font-size:0.75rem;color:#ffffff;opacity:0.8;margin-top:0.25rem;"]);
57620
57624
 
57621
57625
  var useStoreMetadata = function useStoreMetadata() {
57622
57626
  var _useState = useState(false),
@@ -57627,7 +57631,7 @@ var useStoreMetadata = function useStoreMetadata() {
57627
57631
  return _regeneratorRuntime().wrap(function _callee$(_context) {
57628
57632
  while (1) switch (_context.prev = _context.next) {
57629
57633
  case 0:
57630
- if (!(!item.metadataType || item.metadataType === MetadataType.None)) {
57634
+ if (!(!item.metadataType || item.metadataType !== MetadataType.CharacterSkin)) {
57631
57635
  _context.next = 2;
57632
57636
  break;
57633
57637
  }
@@ -57707,7 +57711,7 @@ var useStoreCart = function useStoreCart() {
57707
57711
  });
57708
57712
  return _context.abrupt("return");
57709
57713
  case 3:
57710
- if (!(item.metadataType && item.metadataType !== MetadataType.None)) {
57714
+ if (!(item.metadataType === MetadataType.CharacterSkin)) {
57711
57715
  _context.next = 12;
57712
57716
  break;
57713
57717
  }
@@ -57823,7 +57827,11 @@ var useStoreCart = function useStoreCart() {
57823
57827
  };
57824
57828
  // Helper functions
57825
57829
  function getPurchaseType(item) {
57826
- // Check if the item comes from a pack based on naming convention or other property
57830
+ // Use the type from IProductBlueprint if available, otherwise infer
57831
+ if (item.type) {
57832
+ return item.type;
57833
+ }
57834
+ // Fallback logic for backward compatibility
57827
57835
  if (item.key.startsWith('pack_')) {
57828
57836
  return PurchaseType.Pack;
57829
57837
  } else {
@@ -57973,7 +57981,7 @@ var StoreCharacterSkinRow = function StoreCharacterSkinRow(_ref) {
57973
57981
  // Effect to reset currentIndex when switching items
57974
57982
  useEffect(function () {
57975
57983
  setCurrentIndex(0);
57976
- }, [item._id]);
57984
+ }, [item.key]);
57977
57985
  var handlePreviousSkin = function handlePreviousSkin() {
57978
57986
  setCurrentIndex(function (prevIndex) {
57979
57987
  return prevIndex === 0 ? availableCharacters.length - 1 : prevIndex - 1;
@@ -58080,10 +58088,17 @@ var StoreItemRow = function StoreItemRow(_ref) {
58080
58088
  atlasJSON = _ref.atlasJSON,
58081
58089
  atlasIMG = _ref.atlasIMG,
58082
58090
  onAddToCart = _ref.onAddToCart,
58083
- userAccountType = _ref.userAccountType;
58091
+ userAccountType = _ref.userAccountType,
58092
+ _ref$showTextInput = _ref.showTextInput,
58093
+ showTextInput = _ref$showTextInput === void 0 ? false : _ref$showTextInput,
58094
+ _ref$textInputPlaceho = _ref.textInputPlaceholder,
58095
+ textInputPlaceholder = _ref$textInputPlaceho === void 0 ? item.inputPlaceholder : _ref$textInputPlaceho;
58084
58096
  var _useState = useState(1),
58085
58097
  quantity = _useState[0],
58086
58098
  setQuantity = _useState[1];
58099
+ var _useState2 = useState(''),
58100
+ textInputValue = _useState2[0],
58101
+ setTextInputValue = _useState2[1];
58087
58102
  var handleQuantityChange = function handleQuantityChange(e) {
58088
58103
  var value = parseInt(e.target.value) || 1;
58089
58104
  setQuantity(Math.min(Math.max(1, value), 99));
@@ -58103,10 +58118,17 @@ var StoreItemRow = function StoreItemRow(_ref) {
58103
58118
  });
58104
58119
  };
58105
58120
  var hasRequiredAccount = !((_item$requiredAccount = item.requiredAccountType) != null && _item$requiredAccount.length) || item.requiredAccountType.includes(userAccountType);
58106
- var handleAddToCart = function handleAddToCart() {
58121
+ var handleAddToCartInternal = function handleAddToCartInternal() {
58107
58122
  if (!hasRequiredAccount) return;
58108
- onAddToCart(item, quantity);
58109
- setQuantity(1); // Reset quantity after adding to cart
58123
+ if (showTextInput) {
58124
+ onAddToCart(item, 1, {
58125
+ inputValue: textInputValue
58126
+ });
58127
+ setTextInputValue('');
58128
+ } else {
58129
+ onAddToCart(item, quantity);
58130
+ setQuantity(1);
58131
+ }
58110
58132
  };
58111
58133
  return React.createElement(ItemWrapper$1, null, React.createElement(ItemIconContainer$3, null, React.createElement(SpriteFromAtlas, {
58112
58134
  atlasJSON: atlasJSON,
@@ -58116,7 +58138,15 @@ var StoreItemRow = function StoreItemRow(_ref) {
58116
58138
  height: 32,
58117
58139
  imgScale: 2,
58118
58140
  centered: true
58119
- })), React.createElement(ItemDetails$2, null, React.createElement(ItemName$2, null, item.name), React.createElement(ItemPrice$1, null, "$", item.price)), React.createElement(Controls$1, null, React.createElement(ArrowsContainer, null, React.createElement(SelectArrow, {
58141
+ })), React.createElement(ItemDetails$2, null, React.createElement(ItemName$2, null, item.name), React.createElement(ItemPrice$1, null, "$", item.price), React.createElement(ItemDescription, null, item.description)), React.createElement(Controls$1, null, showTextInput ? React.createElement(TextInput, {
58142
+ type: "text",
58143
+ value: textInputValue,
58144
+ placeholder: textInputPlaceholder,
58145
+ onChange: function onChange(e) {
58146
+ return setTextInputValue(e.target.value);
58147
+ },
58148
+ className: "rpgui-input"
58149
+ }) : item.isStackable ? React.createElement(ArrowsContainer, null, React.createElement(SelectArrow, {
58120
58150
  direction: "left",
58121
58151
  onPointerDown: decrementQuantity,
58122
58152
  size: 24
@@ -58132,10 +58162,10 @@ var StoreItemRow = function StoreItemRow(_ref) {
58132
58162
  direction: "right",
58133
58163
  onPointerDown: incrementQuantity,
58134
58164
  size: 24
58135
- })), React.createElement(CTAButton, {
58165
+ })) : null, React.createElement(CTAButton, {
58136
58166
  icon: React.createElement(FaCartPlus, null),
58137
58167
  label: "Add",
58138
- onClick: handleAddToCart,
58168
+ onClick: handleAddToCartInternal,
58139
58169
  disabled: !hasRequiredAccount
58140
58170
  })));
58141
58171
  };
@@ -58159,25 +58189,35 @@ var ItemPrice$1 = /*#__PURE__*/styled.div.withConfig({
58159
58189
  displayName: "StoreItemRow__ItemPrice",
58160
58190
  componentId: "sc-ptotuo-4"
58161
58191
  })(["font-family:'Press Start 2P',cursive;font-size:0.75rem;color:#fef08a;"]);
58192
+ var ItemDescription = /*#__PURE__*/styled.div.withConfig({
58193
+ displayName: "StoreItemRow__ItemDescription",
58194
+ componentId: "sc-ptotuo-5"
58195
+ })(["font-family:'Press Start 2P',cursive;font-size:0.625rem;color:rgba(255,255,255,0.7);line-height:1.4;"]);
58162
58196
  var Controls$1 = /*#__PURE__*/styled.div.withConfig({
58163
58197
  displayName: "StoreItemRow__Controls",
58164
- componentId: "sc-ptotuo-5"
58198
+ componentId: "sc-ptotuo-6"
58165
58199
  })(["display:flex;align-items:center;gap:1rem;min-width:fit-content;"]);
58166
58200
  var ArrowsContainer = /*#__PURE__*/styled.div.withConfig({
58167
58201
  displayName: "StoreItemRow__ArrowsContainer",
58168
- componentId: "sc-ptotuo-6"
58202
+ componentId: "sc-ptotuo-7"
58169
58203
  })(["position:relative;display:flex;align-items:center;width:120px;height:42px;justify-content:space-between;"]);
58170
58204
  var QuantityInput = /*#__PURE__*/styled.input.withConfig({
58171
58205
  displayName: "StoreItemRow__QuantityInput",
58172
- componentId: "sc-ptotuo-7"
58206
+ componentId: "sc-ptotuo-8"
58173
58207
  })(["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;}"]);
58208
+ var TextInput = /*#__PURE__*/styled.input.withConfig({
58209
+ displayName: "StoreItemRow__TextInput",
58210
+ componentId: "sc-ptotuo-9"
58211
+ })(["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;"]);
58174
58212
 
58175
58213
  var StoreItemsSection = function StoreItemsSection(_ref) {
58176
58214
  var items = _ref.items,
58177
58215
  onAddToCart = _ref.onAddToCart,
58178
58216
  atlasJSON = _ref.atlasJSON,
58179
58217
  atlasIMG = _ref.atlasIMG,
58180
- userAccountType = _ref.userAccountType;
58218
+ userAccountType = _ref.userAccountType,
58219
+ _ref$textInputItemKey = _ref.textInputItemKeys,
58220
+ textInputItemKeys = _ref$textInputItemKey === void 0 ? [] : _ref$textInputItemKey;
58181
58221
  var _useState = useState(''),
58182
58222
  searchQuery = _useState[0],
58183
58223
  setSearchQuery = _useState[1];
@@ -58185,10 +58225,10 @@ var StoreItemsSection = function StoreItemsSection(_ref) {
58185
58225
  return item.name.toLowerCase().includes(searchQuery.toLowerCase());
58186
58226
  });
58187
58227
  var renderStoreItem = function renderStoreItem(item) {
58188
- // Use the specialized character skin row for items with character skin metadata
58228
+ // Prefer a specialized character skin row when needed
58189
58229
  if (item.metadataType === MetadataType.CharacterSkin) {
58190
58230
  return React.createElement(StoreCharacterSkinRow, {
58191
- key: item._id,
58231
+ key: item.key,
58192
58232
  item: item,
58193
58233
  atlasJSON: atlasJSON,
58194
58234
  atlasIMG: atlasIMG,
@@ -58196,9 +58236,21 @@ var StoreItemsSection = function StoreItemsSection(_ref) {
58196
58236
  userAccountType: userAccountType || UserAccountTypes.Free
58197
58237
  });
58198
58238
  }
58199
- // Use the standard item row for all other items
58239
+ // Render text input row when configured for this item key
58240
+ if (textInputItemKeys.includes(item.key)) {
58241
+ return React.createElement(StoreItemRow, {
58242
+ key: item.key,
58243
+ item: item,
58244
+ atlasJSON: atlasJSON,
58245
+ atlasIMG: atlasIMG,
58246
+ onAddToCart: onAddToCart,
58247
+ userAccountType: userAccountType || UserAccountTypes.Free,
58248
+ showTextInput: true
58249
+ });
58250
+ }
58251
+ // Fallback to standard arrow-based row
58200
58252
  return React.createElement(StoreItemRow, {
58201
- key: item._id,
58253
+ key: item.key,
58202
58254
  item: item,
58203
58255
  atlasJSON: atlasJSON,
58204
58256
  atlasIMG: atlasIMG,
@@ -58415,7 +58467,7 @@ var Store = function Store(_ref) {
58415
58467
  packs = _ref$packs === void 0 ? [] : _ref$packs,
58416
58468
  atlasJSON = _ref.atlasJSON,
58417
58469
  atlasIMG = _ref.atlasIMG,
58418
- _onPurchase = _ref.onPurchase,
58470
+ _onPurchase2 = _ref.onPurchase,
58419
58471
  onShowHistory = _ref.onShowHistory,
58420
58472
  userAccountType = _ref.userAccountType,
58421
58473
  _ref$loading = _ref.loading,
@@ -58425,7 +58477,9 @@ var Store = function Store(_ref) {
58425
58477
  _ref$hidePremiumTab = _ref.hidePremiumTab,
58426
58478
  hidePremiumTab = _ref$hidePremiumTab === void 0 ? false : _ref$hidePremiumTab,
58427
58479
  tabOrder = _ref.tabOrder,
58428
- defaultActiveTab = _ref.defaultActiveTab;
58480
+ defaultActiveTab = _ref.defaultActiveTab,
58481
+ _ref$textInputItemKey = _ref.textInputItemKeys,
58482
+ textInputItemKeys = _ref$textInputItemKey === void 0 ? [] : _ref$textInputItemKey;
58429
58483
  var _useState = useState(null),
58430
58484
  selectedPack = _useState[0],
58431
58485
  setSelectedPack = _useState[1];
@@ -58458,29 +58512,35 @@ var Store = function Store(_ref) {
58458
58512
  setCurrentMetadataItem = _useState4[1];
58459
58513
  var handleAddPackToCart = function handleAddPackToCart(pack) {
58460
58514
  var packItem = {
58461
- _id: pack.key,
58462
58515
  key: pack.key,
58463
58516
  name: pack.title,
58517
+ description: pack.description || '',
58464
58518
  price: pack.priceUSD,
58519
+ currency: PaymentCurrency.USD,
58465
58520
  texturePath: pack.image["default"] || pack.image.src,
58466
- textureKey: pack.image["default"] || pack.image.src,
58467
- type: ItemType.Consumable,
58468
- subType: ItemSubType.Other,
58469
- description: pack.description || '',
58470
- fullDescription: pack.description || '',
58471
- textureAtlas: 'items',
58472
- weight: 0,
58521
+ type: PurchaseType.Pack,
58522
+ onPurchase: function () {
58523
+ var _onPurchase = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
58524
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
58525
+ while (1) switch (_context.prev = _context.next) {
58526
+ case 0:
58527
+ case "end":
58528
+ return _context.stop();
58529
+ }
58530
+ }, _callee);
58531
+ }));
58532
+ function onPurchase() {
58533
+ return _onPurchase.apply(this, arguments);
58534
+ }
58535
+ return onPurchase;
58536
+ }(),
58537
+ itemType: ItemType.Consumable,
58538
+ itemSubType: ItemSubType.Other,
58473
58539
  rarity: ItemRarities.Common,
58474
- allowedEquipSlotType: [],
58475
- isEquipable: false,
58540
+ weight: 0,
58476
58541
  isStackable: false,
58477
- isTwoHanded: false,
58478
- hasUseWith: false,
58479
58542
  maxStackSize: 1,
58480
- isUsable: false,
58481
- isStorable: true,
58482
- isSolid: false,
58483
- isItemContainer: false
58543
+ isUsable: false
58484
58544
  };
58485
58545
  handleAddToCart(packItem, 1);
58486
58546
  };
@@ -58560,7 +58620,8 @@ var Store = function Store(_ref) {
58560
58620
  onAddToCart: handleAddToCart,
58561
58621
  atlasJSON: atlasJSON,
58562
58622
  atlasIMG: atlasIMG,
58563
- userAccountType: userAccountType
58623
+ userAccountType: userAccountType,
58624
+ textInputItemKeys: textInputItemKeys
58564
58625
  })
58565
58626
  }
58566
58627
  };
@@ -58585,22 +58646,22 @@ var Store = function Store(_ref) {
58585
58646
  onRemoveFromCart: handleRemoveFromCart,
58586
58647
  onClose: closeCart,
58587
58648
  onPurchase: function () {
58588
- var _onPurchase2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
58589
- return _regeneratorRuntime().wrap(function _callee$(_context) {
58590
- while (1) switch (_context.prev = _context.next) {
58649
+ var _onPurchase3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
58650
+ return _regeneratorRuntime().wrap(function _callee2$(_context2) {
58651
+ while (1) switch (_context2.prev = _context2.next) {
58591
58652
  case 0:
58592
- _context.next = 2;
58593
- return handleCartPurchase(_onPurchase);
58653
+ _context2.next = 2;
58654
+ return handleCartPurchase(_onPurchase2);
58594
58655
  case 2:
58595
- return _context.abrupt("return", true);
58656
+ return _context2.abrupt("return", true);
58596
58657
  case 3:
58597
58658
  case "end":
58598
- return _context.stop();
58659
+ return _context2.stop();
58599
58660
  }
58600
- }, _callee);
58661
+ }, _callee2);
58601
58662
  }));
58602
58663
  function onPurchase() {
58603
- return _onPurchase2.apply(this, arguments);
58664
+ return _onPurchase3.apply(this, arguments);
58604
58665
  }
58605
58666
  return onPurchase;
58606
58667
  }(),