@rpg-engine/long-bow 0.8.70 → 0.8.71

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.
@@ -15,6 +15,7 @@ export interface IStoreProps {
15
15
  hidePremiumTab?: boolean;
16
16
  tabOrder?: TabId[];
17
17
  defaultActiveTab?: TabId;
18
+ textInputItemKeys?: string[];
18
19
  }
19
20
  export declare const Store: React.FC<IStoreProps>;
20
21
  export {};
@@ -6,6 +6,7 @@ interface IStoreItemRowProps {
6
6
  atlasIMG: string;
7
7
  onAddToCart: (item: IStoreItem, quantity: number, metadata?: Record<string, any>) => void;
8
8
  userAccountType: UserAccountTypes;
9
+ showTextInput?: boolean;
9
10
  }
10
11
  export declare const StoreItemRow: React.FC<IStoreItemRowProps>;
11
12
  export {};
@@ -6,6 +6,7 @@ interface IStoreItemsSectionProps {
6
6
  atlasJSON: Record<string, any>;
7
7
  atlasIMG: string;
8
8
  userAccountType?: UserAccountTypes;
9
+ textInputItemKeys?: string[];
9
10
  }
10
11
  export declare const StoreItemsSection: React.FC<IStoreItemsSectionProps>;
11
12
  export {};
@@ -57515,7 +57515,7 @@ var CartView = function CartView(_ref2) {
57515
57515
  return React__default.createElement(Container$K, null, React__default.createElement(Header$7, null, React__default.createElement(Title$e, null, "Shopping Cart"), React__default.createElement(CloseButton$9, {
57516
57516
  onPointerDown: onClose
57517
57517
  }, React__default.createElement(fa.FaTimes, null))), React__default.createElement(CartItems, null, cartItems.length === 0 ? React__default.createElement(EmptyCart, null, "Your cart is empty") : cartItems.map(function (cartItem) {
57518
- var _cartItem$metadata;
57518
+ var _cartItem$metadata, _cartItem$metadata2;
57519
57519
  console.log('Item metadataType: , texturePath:', cartItem.item.metadataType, cartItem.item.texturePath);
57520
57520
  var getSpriteKey = function getSpriteKey(textureKey) {
57521
57521
  return textureKey + '/down/standing/0.png';
@@ -57530,7 +57530,7 @@ var CartView = function CartView(_ref2) {
57530
57530
  height: 32,
57531
57531
  imgScale: 2,
57532
57532
  centered: true
57533
- })), React__default.createElement(ItemDetails, null, React__default.createElement(ItemName, null, cartItem.item.name), React__default.createElement(ItemInfo$1, null, React__default.createElement("span", null, "$", formatPrice(cartItem.item.price)), React__default.createElement("span", null, "\xD7"), React__default.createElement("span", null, cartItem.quantity), React__default.createElement("span", null, "="), React__default.createElement("span", null, "$", formatPrice(cartItem.item.price * cartItem.quantity))), cartItem.metadata && cartItem.item.metadataType && React__default.createElement(MetadataDisplay, {
57533
+ })), React__default.createElement(ItemDetails, null, React__default.createElement(ItemName, null, cartItem.item.name), ((_cartItem$metadata2 = cartItem.metadata) == null ? void 0 : _cartItem$metadata2.inputValue) && React__default.createElement(CartMeta, null, cartItem.metadata.inputValue), React__default.createElement(ItemInfo$1, null, React__default.createElement("span", null, "$", formatPrice(cartItem.item.price)), React__default.createElement("span", null, "\xD7"), React__default.createElement("span", null, cartItem.quantity), React__default.createElement("span", null, "="), React__default.createElement("span", null, "$", formatPrice(cartItem.item.price * cartItem.quantity))), cartItem.metadata && cartItem.item.metadataType && React__default.createElement(MetadataDisplay, {
57534
57534
  type: cartItem.item.metadataType,
57535
57535
  metadata: cartItem.metadata
57536
57536
  })), React__default.createElement(CTAButton, {
@@ -57620,6 +57620,10 @@ var MetadataValue = /*#__PURE__*/styled__default.div.withConfig({
57620
57620
  displayName: "CartView__MetadataValue",
57621
57621
  componentId: "sc-ydtyl1-17"
57622
57622
  })(["overflow:hidden;text-overflow:ellipsis;white-space:nowrap;"]);
57623
+ var CartMeta = /*#__PURE__*/styled__default.div.withConfig({
57624
+ displayName: "CartView__CartMeta",
57625
+ componentId: "sc-ydtyl1-18"
57626
+ })(["font-family:'Press Start 2P',cursive;font-size:0.75rem;color:#ffffff;opacity:0.8;margin-top:0.25rem;"]);
57623
57627
 
57624
57628
  var useStoreMetadata = function useStoreMetadata() {
57625
57629
  var _useState = React.useState(false),
@@ -58083,10 +58087,15 @@ var StoreItemRow = function StoreItemRow(_ref) {
58083
58087
  atlasJSON = _ref.atlasJSON,
58084
58088
  atlasIMG = _ref.atlasIMG,
58085
58089
  onAddToCart = _ref.onAddToCart,
58086
- userAccountType = _ref.userAccountType;
58090
+ userAccountType = _ref.userAccountType,
58091
+ _ref$showTextInput = _ref.showTextInput,
58092
+ showTextInput = _ref$showTextInput === void 0 ? false : _ref$showTextInput;
58087
58093
  var _useState = React.useState(1),
58088
58094
  quantity = _useState[0],
58089
58095
  setQuantity = _useState[1];
58096
+ var _useState2 = React.useState(''),
58097
+ textInputValue = _useState2[0],
58098
+ setTextInputValue = _useState2[1];
58090
58099
  var handleQuantityChange = function handleQuantityChange(e) {
58091
58100
  var value = parseInt(e.target.value) || 1;
58092
58101
  setQuantity(Math.min(Math.max(1, value), 99));
@@ -58106,10 +58115,17 @@ var StoreItemRow = function StoreItemRow(_ref) {
58106
58115
  });
58107
58116
  };
58108
58117
  var hasRequiredAccount = !((_item$requiredAccount = item.requiredAccountType) != null && _item$requiredAccount.length) || item.requiredAccountType.includes(userAccountType);
58109
- var handleAddToCart = function handleAddToCart() {
58118
+ var handleAddToCartInternal = function handleAddToCartInternal() {
58110
58119
  if (!hasRequiredAccount) return;
58111
- onAddToCart(item, quantity);
58112
- setQuantity(1); // Reset quantity after adding to cart
58120
+ if (showTextInput) {
58121
+ onAddToCart(item, 1, {
58122
+ inputValue: textInputValue
58123
+ });
58124
+ setTextInputValue('');
58125
+ } else {
58126
+ onAddToCart(item, quantity);
58127
+ setQuantity(1);
58128
+ }
58113
58129
  };
58114
58130
  return React__default.createElement(ItemWrapper$1, null, React__default.createElement(ItemIconContainer$3, null, React__default.createElement(SpriteFromAtlas, {
58115
58131
  atlasJSON: atlasJSON,
@@ -58119,7 +58135,15 @@ var StoreItemRow = function StoreItemRow(_ref) {
58119
58135
  height: 32,
58120
58136
  imgScale: 2,
58121
58137
  centered: true
58122
- })), React__default.createElement(ItemDetails$2, null, React__default.createElement(ItemName$2, null, item.name), React__default.createElement(ItemPrice$1, null, "$", item.price)), React__default.createElement(Controls$1, null, React__default.createElement(ArrowsContainer, null, React__default.createElement(SelectArrow, {
58138
+ })), React__default.createElement(ItemDetails$2, null, React__default.createElement(ItemName$2, null, item.name), React__default.createElement(ItemPrice$1, null, "$", item.price)), React__default.createElement(Controls$1, null, showTextInput ? React__default.createElement(TextInput, {
58139
+ type: "text",
58140
+ value: textInputValue,
58141
+ placeholder: "Enter value",
58142
+ onChange: function onChange(e) {
58143
+ return setTextInputValue(e.target.value);
58144
+ },
58145
+ className: "rpgui-input"
58146
+ }) : item.isStackable ? React__default.createElement(ArrowsContainer, null, React__default.createElement(SelectArrow, {
58123
58147
  direction: "left",
58124
58148
  onPointerDown: decrementQuantity,
58125
58149
  size: 24
@@ -58135,10 +58159,10 @@ var StoreItemRow = function StoreItemRow(_ref) {
58135
58159
  direction: "right",
58136
58160
  onPointerDown: incrementQuantity,
58137
58161
  size: 24
58138
- })), React__default.createElement(CTAButton, {
58162
+ })) : null, React__default.createElement(CTAButton, {
58139
58163
  icon: React__default.createElement(fa.FaCartPlus, null),
58140
58164
  label: "Add",
58141
- onClick: handleAddToCart,
58165
+ onClick: handleAddToCartInternal,
58142
58166
  disabled: !hasRequiredAccount
58143
58167
  })));
58144
58168
  };
@@ -58174,13 +58198,19 @@ var QuantityInput = /*#__PURE__*/styled__default.input.withConfig({
58174
58198
  displayName: "StoreItemRow__QuantityInput",
58175
58199
  componentId: "sc-ptotuo-7"
58176
58200
  })(["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;}"]);
58201
+ var TextInput = /*#__PURE__*/styled__default.input.withConfig({
58202
+ displayName: "StoreItemRow__TextInput",
58203
+ componentId: "sc-ptotuo-8"
58204
+ })(["width:120px;text-align:center;margin:0 auto;font-size:0.875rem;background:rgba(0,0,0,0.2);color:#ffffff;border:none;padding:0.25rem;"]);
58177
58205
 
58178
58206
  var StoreItemsSection = function StoreItemsSection(_ref) {
58179
58207
  var items = _ref.items,
58180
58208
  onAddToCart = _ref.onAddToCart,
58181
58209
  atlasJSON = _ref.atlasJSON,
58182
58210
  atlasIMG = _ref.atlasIMG,
58183
- userAccountType = _ref.userAccountType;
58211
+ userAccountType = _ref.userAccountType,
58212
+ _ref$textInputItemKey = _ref.textInputItemKeys,
58213
+ textInputItemKeys = _ref$textInputItemKey === void 0 ? [] : _ref$textInputItemKey;
58184
58214
  var _useState = React.useState(''),
58185
58215
  searchQuery = _useState[0],
58186
58216
  setSearchQuery = _useState[1];
@@ -58188,7 +58218,7 @@ var StoreItemsSection = function StoreItemsSection(_ref) {
58188
58218
  return item.name.toLowerCase().includes(searchQuery.toLowerCase());
58189
58219
  });
58190
58220
  var renderStoreItem = function renderStoreItem(item) {
58191
- // Use the specialized character skin row for items with character skin metadata
58221
+ // Prefer a specialized character skin row when needed
58192
58222
  if (item.metadataType === shared.MetadataType.CharacterSkin) {
58193
58223
  return React__default.createElement(StoreCharacterSkinRow, {
58194
58224
  key: item._id,
@@ -58199,7 +58229,19 @@ var StoreItemsSection = function StoreItemsSection(_ref) {
58199
58229
  userAccountType: userAccountType || shared.UserAccountTypes.Free
58200
58230
  });
58201
58231
  }
58202
- // Use the standard item row for all other items
58232
+ // Render text input row when configured for this item key
58233
+ if (textInputItemKeys.includes(item.key) || textInputItemKeys.includes(item._id)) {
58234
+ return React__default.createElement(StoreItemRow, {
58235
+ key: item._id,
58236
+ item: item,
58237
+ atlasJSON: atlasJSON,
58238
+ atlasIMG: atlasIMG,
58239
+ onAddToCart: onAddToCart,
58240
+ userAccountType: userAccountType || shared.UserAccountTypes.Free,
58241
+ showTextInput: true
58242
+ });
58243
+ }
58244
+ // Fallback to standard arrow-based row
58203
58245
  return React__default.createElement(StoreItemRow, {
58204
58246
  key: item._id,
58205
58247
  item: item,
@@ -58428,7 +58470,9 @@ var Store = function Store(_ref) {
58428
58470
  _ref$hidePremiumTab = _ref.hidePremiumTab,
58429
58471
  hidePremiumTab = _ref$hidePremiumTab === void 0 ? false : _ref$hidePremiumTab,
58430
58472
  tabOrder = _ref.tabOrder,
58431
- defaultActiveTab = _ref.defaultActiveTab;
58473
+ defaultActiveTab = _ref.defaultActiveTab,
58474
+ _ref$textInputItemKey = _ref.textInputItemKeys,
58475
+ textInputItemKeys = _ref$textInputItemKey === void 0 ? [] : _ref$textInputItemKey;
58432
58476
  var _useState = React.useState(null),
58433
58477
  selectedPack = _useState[0],
58434
58478
  setSelectedPack = _useState[1];
@@ -58563,7 +58607,8 @@ var Store = function Store(_ref) {
58563
58607
  onAddToCart: handleAddToCart,
58564
58608
  atlasJSON: atlasJSON,
58565
58609
  atlasIMG: atlasIMG,
58566
- userAccountType: userAccountType
58610
+ userAccountType: userAccountType,
58611
+ textInputItemKeys: textInputItemKeys
58567
58612
  })
58568
58613
  }
58569
58614
  };