@rpg-engine/long-bow 0.8.71 → 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.
@@ -1,11 +1,12 @@
1
- import { IStoreItem } from '@rpg-engine/shared';
1
+ import { IProductBlueprint } from '@rpg-engine/shared';
2
2
  import React from 'react';
3
+ interface ICartItem {
4
+ item: IProductBlueprint;
5
+ quantity: number;
6
+ metadata?: Record<string, any>;
7
+ }
3
8
  interface ICartViewProps {
4
- cartItems: {
5
- item: IStoreItem;
6
- quantity: number;
7
- metadata?: Record<string, any>;
8
- }[];
9
+ cartItems: ICartItem[];
9
10
  onRemoveFromCart: (itemKey: string) => void;
10
11
  onClose: () => void;
11
12
  onPurchase: () => Promise<boolean>;
@@ -1,8 +1,8 @@
1
- import { IItemPack, IPurchase, IStoreItem, UserAccountTypes } from '@rpg-engine/shared';
1
+ import { IItemPack, IPurchase, IProductBlueprint, UserAccountTypes } from '@rpg-engine/shared';
2
2
  import React from 'react';
3
3
  declare type TabId = 'premium' | 'packs' | 'items';
4
4
  export interface IStoreProps {
5
- items: IStoreItem[];
5
+ items: IProductBlueprint[];
6
6
  packs?: IItemPack[];
7
7
  atlasJSON: any;
8
8
  atlasIMG: string;
@@ -1,10 +1,10 @@
1
- import { IStoreItem, UserAccountTypes } from '@rpg-engine/shared';
1
+ import { IProductBlueprint, UserAccountTypes } from '@rpg-engine/shared';
2
2
  import React from 'react';
3
3
  interface IStoreCharacterSkinRowProps {
4
- item: IStoreItem;
4
+ item: IProductBlueprint;
5
5
  atlasJSON: Record<string, any>;
6
6
  atlasIMG: string;
7
- onAddToCart: (item: IStoreItem, quantity: number, metadata?: Record<string, any>) => void;
7
+ onAddToCart: (item: IProductBlueprint, quantity: number, metadata?: Record<string, any>) => void;
8
8
  userAccountType: UserAccountTypes;
9
9
  }
10
10
  export declare const StoreCharacterSkinRow: React.FC<IStoreCharacterSkinRowProps>;
@@ -1,7 +1,7 @@
1
- import { IItemPack, IStoreItem } from '@rpg-engine/shared';
1
+ import { IItemPack, IProductBlueprint } from '@rpg-engine/shared';
2
2
  import React from 'react';
3
3
  interface IStoreItemDetailsProps {
4
- item: IStoreItem | (IItemPack & {
4
+ item: IProductBlueprint | (IItemPack & {
5
5
  name: string;
6
6
  texturePath: string;
7
7
  });
@@ -10,7 +10,7 @@ interface IStoreItemDetailsProps {
10
10
  default?: string;
11
11
  };
12
12
  onBack: () => void;
13
- onAddToCart: (item: IStoreItem) => void;
13
+ onAddToCart: (item: IProductBlueprint) => void;
14
14
  }
15
15
  export declare const StoreItemDetails: React.FC<IStoreItemDetailsProps>;
16
16
  export {};
@@ -1,12 +1,13 @@
1
- import { IStoreItem, UserAccountTypes } from '@rpg-engine/shared';
1
+ import { IProductBlueprint, UserAccountTypes } from '@rpg-engine/shared';
2
2
  import React from 'react';
3
3
  interface IStoreItemRowProps {
4
- item: IStoreItem;
4
+ item: IProductBlueprint;
5
5
  atlasJSON: Record<string, any>;
6
6
  atlasIMG: string;
7
- onAddToCart: (item: IStoreItem, quantity: number, metadata?: Record<string, any>) => void;
7
+ onAddToCart: (item: IProductBlueprint, quantity: number, metadata?: Record<string, any>) => void;
8
8
  userAccountType: UserAccountTypes;
9
9
  showTextInput?: boolean;
10
+ textInputPlaceholder?: string;
10
11
  }
11
12
  export declare const StoreItemRow: React.FC<IStoreItemRowProps>;
12
13
  export {};
@@ -1,11 +1,13 @@
1
- import { ICartItem as IBaseCartItem, IPurchase, IStoreItem } from '@rpg-engine/shared';
2
- interface ICartItem extends IBaseCartItem {
1
+ import { IPurchase, IProductBlueprint } from '@rpg-engine/shared';
2
+ interface ICartItem {
3
+ item: IProductBlueprint;
4
+ quantity: number;
3
5
  metadata?: Record<string, any>;
4
6
  }
5
7
  interface IUseStoreCart {
6
8
  cartItems: ICartItem[];
7
9
  isCartOpen: boolean;
8
- handleAddToCart: (item: IStoreItem, quantity: number, metadata?: Record<string, any>) => void;
10
+ handleAddToCart: (item: IProductBlueprint, quantity: number, metadata?: Record<string, any>) => void;
9
11
  handleRemoveFromCart: (itemKey: string) => void;
10
12
  handlePurchase: (onPurchase: (purchase: IPurchase) => void) => void;
11
13
  openCart: () => void;
@@ -1,6 +1,6 @@
1
- import { IStoreItem } from "@rpg-engine/shared";
1
+ import { IProductBlueprint } from "@rpg-engine/shared";
2
2
  interface IUseStoreMetadata {
3
- collectMetadata: (item: IStoreItem) => Promise<Record<string, any> | null>;
3
+ collectMetadata: (item: IProductBlueprint) => Promise<Record<string, any> | null>;
4
4
  isCollectingMetadata: boolean;
5
5
  }
6
6
  export declare const useStoreMetadata: () => IUseStoreMetadata;
@@ -8,7 +8,7 @@ declare global {
8
8
  interface Window {
9
9
  __metadataResolvers?: {
10
10
  resolve: (metadata: Record<string, any> | null) => void;
11
- item: IStoreItem;
11
+ item: IProductBlueprint;
12
12
  };
13
13
  }
14
14
  }
@@ -1,8 +1,8 @@
1
- import { IStoreItem, UserAccountTypes } from '@rpg-engine/shared';
1
+ import { IProductBlueprint, UserAccountTypes } from '@rpg-engine/shared';
2
2
  import React from 'react';
3
3
  interface IStoreItemsSectionProps {
4
- items: IStoreItem[];
5
- onAddToCart: (item: IStoreItem, quantity: number, metadata?: Record<string, any>) => void;
4
+ items: IProductBlueprint[];
5
+ onAddToCart: (item: IProductBlueprint, quantity: number, metadata?: Record<string, any>) => void;
6
6
  atlasJSON: Record<string, any>;
7
7
  atlasIMG: string;
8
8
  userAccountType?: UserAccountTypes;
@@ -57634,7 +57634,7 @@ var useStoreMetadata = function useStoreMetadata() {
57634
57634
  return _regeneratorRuntime().wrap(function _callee$(_context) {
57635
57635
  while (1) switch (_context.prev = _context.next) {
57636
57636
  case 0:
57637
- if (!(!item.metadataType || item.metadataType === shared.MetadataType.None)) {
57637
+ if (!(!item.metadataType || item.metadataType !== shared.MetadataType.CharacterSkin)) {
57638
57638
  _context.next = 2;
57639
57639
  break;
57640
57640
  }
@@ -57714,7 +57714,7 @@ var useStoreCart = function useStoreCart() {
57714
57714
  });
57715
57715
  return _context.abrupt("return");
57716
57716
  case 3:
57717
- if (!(item.metadataType && item.metadataType !== shared.MetadataType.None)) {
57717
+ if (!(item.metadataType === shared.MetadataType.CharacterSkin)) {
57718
57718
  _context.next = 12;
57719
57719
  break;
57720
57720
  }
@@ -57830,7 +57830,11 @@ var useStoreCart = function useStoreCart() {
57830
57830
  };
57831
57831
  // Helper functions
57832
57832
  function getPurchaseType(item) {
57833
- // Check if the item comes from a pack based on naming convention or other property
57833
+ // Use the type from IProductBlueprint if available, otherwise infer
57834
+ if (item.type) {
57835
+ return item.type;
57836
+ }
57837
+ // Fallback logic for backward compatibility
57834
57838
  if (item.key.startsWith('pack_')) {
57835
57839
  return shared.PurchaseType.Pack;
57836
57840
  } else {
@@ -57980,7 +57984,7 @@ var StoreCharacterSkinRow = function StoreCharacterSkinRow(_ref) {
57980
57984
  // Effect to reset currentIndex when switching items
57981
57985
  React.useEffect(function () {
57982
57986
  setCurrentIndex(0);
57983
- }, [item._id]);
57987
+ }, [item.key]);
57984
57988
  var handlePreviousSkin = function handlePreviousSkin() {
57985
57989
  setCurrentIndex(function (prevIndex) {
57986
57990
  return prevIndex === 0 ? availableCharacters.length - 1 : prevIndex - 1;
@@ -58089,7 +58093,9 @@ var StoreItemRow = function StoreItemRow(_ref) {
58089
58093
  onAddToCart = _ref.onAddToCart,
58090
58094
  userAccountType = _ref.userAccountType,
58091
58095
  _ref$showTextInput = _ref.showTextInput,
58092
- showTextInput = _ref$showTextInput === void 0 ? false : _ref$showTextInput;
58096
+ showTextInput = _ref$showTextInput === void 0 ? false : _ref$showTextInput,
58097
+ _ref$textInputPlaceho = _ref.textInputPlaceholder,
58098
+ textInputPlaceholder = _ref$textInputPlaceho === void 0 ? item.inputPlaceholder : _ref$textInputPlaceho;
58093
58099
  var _useState = React.useState(1),
58094
58100
  quantity = _useState[0],
58095
58101
  setQuantity = _useState[1];
@@ -58135,10 +58141,10 @@ var StoreItemRow = function StoreItemRow(_ref) {
58135
58141
  height: 32,
58136
58142
  imgScale: 2,
58137
58143
  centered: true
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, {
58144
+ })), 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(ItemDescription, null, item.description)), React__default.createElement(Controls$1, null, showTextInput ? React__default.createElement(TextInput, {
58139
58145
  type: "text",
58140
58146
  value: textInputValue,
58141
- placeholder: "Enter value",
58147
+ placeholder: textInputPlaceholder,
58142
58148
  onChange: function onChange(e) {
58143
58149
  return setTextInputValue(e.target.value);
58144
58150
  },
@@ -58186,21 +58192,25 @@ var ItemPrice$1 = /*#__PURE__*/styled__default.div.withConfig({
58186
58192
  displayName: "StoreItemRow__ItemPrice",
58187
58193
  componentId: "sc-ptotuo-4"
58188
58194
  })(["font-family:'Press Start 2P',cursive;font-size:0.75rem;color:#fef08a;"]);
58195
+ var ItemDescription = /*#__PURE__*/styled__default.div.withConfig({
58196
+ displayName: "StoreItemRow__ItemDescription",
58197
+ componentId: "sc-ptotuo-5"
58198
+ })(["font-family:'Press Start 2P',cursive;font-size:0.625rem;color:rgba(255,255,255,0.7);line-height:1.4;"]);
58189
58199
  var Controls$1 = /*#__PURE__*/styled__default.div.withConfig({
58190
58200
  displayName: "StoreItemRow__Controls",
58191
- componentId: "sc-ptotuo-5"
58201
+ componentId: "sc-ptotuo-6"
58192
58202
  })(["display:flex;align-items:center;gap:1rem;min-width:fit-content;"]);
58193
58203
  var ArrowsContainer = /*#__PURE__*/styled__default.div.withConfig({
58194
58204
  displayName: "StoreItemRow__ArrowsContainer",
58195
- componentId: "sc-ptotuo-6"
58205
+ componentId: "sc-ptotuo-7"
58196
58206
  })(["position:relative;display:flex;align-items:center;width:120px;height:42px;justify-content:space-between;"]);
58197
58207
  var QuantityInput = /*#__PURE__*/styled__default.input.withConfig({
58198
58208
  displayName: "StoreItemRow__QuantityInput",
58199
- componentId: "sc-ptotuo-7"
58209
+ componentId: "sc-ptotuo-8"
58200
58210
  })(["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
58211
  var TextInput = /*#__PURE__*/styled__default.input.withConfig({
58202
58212
  displayName: "StoreItemRow__TextInput",
58203
- componentId: "sc-ptotuo-8"
58213
+ componentId: "sc-ptotuo-9"
58204
58214
  })(["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;"]);
58205
58215
 
58206
58216
  var StoreItemsSection = function StoreItemsSection(_ref) {
@@ -58221,7 +58231,7 @@ var StoreItemsSection = function StoreItemsSection(_ref) {
58221
58231
  // Prefer a specialized character skin row when needed
58222
58232
  if (item.metadataType === shared.MetadataType.CharacterSkin) {
58223
58233
  return React__default.createElement(StoreCharacterSkinRow, {
58224
- key: item._id,
58234
+ key: item.key,
58225
58235
  item: item,
58226
58236
  atlasJSON: atlasJSON,
58227
58237
  atlasIMG: atlasIMG,
@@ -58230,9 +58240,9 @@ var StoreItemsSection = function StoreItemsSection(_ref) {
58230
58240
  });
58231
58241
  }
58232
58242
  // Render text input row when configured for this item key
58233
- if (textInputItemKeys.includes(item.key) || textInputItemKeys.includes(item._id)) {
58243
+ if (textInputItemKeys.includes(item.key)) {
58234
58244
  return React__default.createElement(StoreItemRow, {
58235
- key: item._id,
58245
+ key: item.key,
58236
58246
  item: item,
58237
58247
  atlasJSON: atlasJSON,
58238
58248
  atlasIMG: atlasIMG,
@@ -58243,7 +58253,7 @@ var StoreItemsSection = function StoreItemsSection(_ref) {
58243
58253
  }
58244
58254
  // Fallback to standard arrow-based row
58245
58255
  return React__default.createElement(StoreItemRow, {
58246
- key: item._id,
58256
+ key: item.key,
58247
58257
  item: item,
58248
58258
  atlasJSON: atlasJSON,
58249
58259
  atlasIMG: atlasIMG,
@@ -58460,7 +58470,7 @@ var Store = function Store(_ref) {
58460
58470
  packs = _ref$packs === void 0 ? [] : _ref$packs,
58461
58471
  atlasJSON = _ref.atlasJSON,
58462
58472
  atlasIMG = _ref.atlasIMG,
58463
- _onPurchase = _ref.onPurchase,
58473
+ _onPurchase2 = _ref.onPurchase,
58464
58474
  onShowHistory = _ref.onShowHistory,
58465
58475
  userAccountType = _ref.userAccountType,
58466
58476
  _ref$loading = _ref.loading,
@@ -58505,29 +58515,35 @@ var Store = function Store(_ref) {
58505
58515
  setCurrentMetadataItem = _useState4[1];
58506
58516
  var handleAddPackToCart = function handleAddPackToCart(pack) {
58507
58517
  var packItem = {
58508
- _id: pack.key,
58509
58518
  key: pack.key,
58510
58519
  name: pack.title,
58520
+ description: pack.description || '',
58511
58521
  price: pack.priceUSD,
58522
+ currency: shared.PaymentCurrency.USD,
58512
58523
  texturePath: pack.image["default"] || pack.image.src,
58513
- textureKey: pack.image["default"] || pack.image.src,
58514
- type: shared.ItemType.Consumable,
58515
- subType: shared.ItemSubType.Other,
58516
- description: pack.description || '',
58517
- fullDescription: pack.description || '',
58518
- textureAtlas: 'items',
58519
- weight: 0,
58524
+ type: shared.PurchaseType.Pack,
58525
+ onPurchase: function () {
58526
+ var _onPurchase = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
58527
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
58528
+ while (1) switch (_context.prev = _context.next) {
58529
+ case 0:
58530
+ case "end":
58531
+ return _context.stop();
58532
+ }
58533
+ }, _callee);
58534
+ }));
58535
+ function onPurchase() {
58536
+ return _onPurchase.apply(this, arguments);
58537
+ }
58538
+ return onPurchase;
58539
+ }(),
58540
+ itemType: shared.ItemType.Consumable,
58541
+ itemSubType: shared.ItemSubType.Other,
58520
58542
  rarity: shared.ItemRarities.Common,
58521
- allowedEquipSlotType: [],
58522
- isEquipable: false,
58543
+ weight: 0,
58523
58544
  isStackable: false,
58524
- isTwoHanded: false,
58525
- hasUseWith: false,
58526
58545
  maxStackSize: 1,
58527
- isUsable: false,
58528
- isStorable: true,
58529
- isSolid: false,
58530
- isItemContainer: false
58546
+ isUsable: false
58531
58547
  };
58532
58548
  handleAddToCart(packItem, 1);
58533
58549
  };
@@ -58633,22 +58649,22 @@ var Store = function Store(_ref) {
58633
58649
  onRemoveFromCart: handleRemoveFromCart,
58634
58650
  onClose: closeCart,
58635
58651
  onPurchase: function () {
58636
- var _onPurchase2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
58637
- return _regeneratorRuntime().wrap(function _callee$(_context) {
58638
- while (1) switch (_context.prev = _context.next) {
58652
+ var _onPurchase3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
58653
+ return _regeneratorRuntime().wrap(function _callee2$(_context2) {
58654
+ while (1) switch (_context2.prev = _context2.next) {
58639
58655
  case 0:
58640
- _context.next = 2;
58641
- return handleCartPurchase(_onPurchase);
58656
+ _context2.next = 2;
58657
+ return handleCartPurchase(_onPurchase2);
58642
58658
  case 2:
58643
- return _context.abrupt("return", true);
58659
+ return _context2.abrupt("return", true);
58644
58660
  case 3:
58645
58661
  case "end":
58646
- return _context.stop();
58662
+ return _context2.stop();
58647
58663
  }
58648
- }, _callee);
58664
+ }, _callee2);
58649
58665
  }));
58650
58666
  function onPurchase() {
58651
- return _onPurchase2.apply(this, arguments);
58667
+ return _onPurchase3.apply(this, arguments);
58652
58668
  }
58653
58669
  return onPurchase;
58654
58670
  }(),