@rpg-engine/long-bow 0.8.66 → 0.8.68

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.
Files changed (37) hide show
  1. package/dist/components/Character/SkinSelectionGrid.d.ts +11 -0
  2. package/dist/components/Store/CartView.d.ts +1 -0
  3. package/dist/components/Store/MetadataCollector.d.ts +9 -0
  4. package/dist/components/Store/Store.d.ts +13 -1
  5. package/dist/components/Store/StoreCharacterSkinRow.d.ts +11 -0
  6. package/dist/components/Store/StoreItemRow.d.ts +1 -1
  7. package/dist/components/Store/hooks/useStoreCart.d.ts +6 -2
  8. package/dist/components/Store/hooks/useStoreMetadata.d.ts +15 -0
  9. package/dist/components/Store/sections/StoreItemsSection.d.ts +1 -1
  10. package/dist/index.d.ts +5 -1
  11. package/dist/long-bow.cjs.development.js +1581 -193
  12. package/dist/long-bow.cjs.development.js.map +1 -1
  13. package/dist/long-bow.cjs.production.min.js +1 -1
  14. package/dist/long-bow.cjs.production.min.js.map +1 -1
  15. package/dist/long-bow.esm.js +1549 -165
  16. package/dist/long-bow.esm.js.map +1 -1
  17. package/dist/stories/Character/SkinSelectionGrid.stories.d.ts +1 -0
  18. package/dist/stories/Character/character/CharacterSkinSelectionModal.stories.d.ts +1 -5
  19. package/dist/stories/Features/store/MetadataCollector.stories.d.ts +1 -0
  20. package/package.json +2 -2
  21. package/src/components/Character/CharacterSkinSelectionModal.tsx +18 -71
  22. package/src/components/Character/SkinSelectionGrid.tsx +179 -0
  23. package/src/components/Store/CartView.tsx +66 -7
  24. package/src/components/Store/MetadataCollector.tsx +48 -0
  25. package/src/components/Store/Store.tsx +69 -7
  26. package/src/components/Store/StoreCharacterSkinRow.tsx +286 -0
  27. package/src/components/Store/StoreItemRow.tsx +1 -1
  28. package/src/components/Store/__test__/MetadataCollector.spec.tsx +228 -0
  29. package/src/components/Store/__test__/useStoreMetadata.spec.tsx +181 -0
  30. package/src/components/Store/hooks/useStoreCart.ts +89 -44
  31. package/src/components/Store/hooks/useStoreMetadata.ts +55 -0
  32. package/src/components/Store/sections/StoreItemsSection.tsx +30 -11
  33. package/src/index.tsx +6 -3
  34. package/src/stories/Character/SkinSelectionGrid.stories.tsx +106 -0
  35. package/src/stories/Character/character/CharacterSkinSelectionModal.stories.tsx +86 -25
  36. package/src/stories/Features/store/MetadataCollector.stories.tsx +94 -0
  37. package/src/stories/Features/store/Store.stories.tsx +103 -3
@@ -1,15 +1,17 @@
1
- import { IItemPack, IPurchase, IStoreItem, UserAccountTypes } from '@rpg-engine/shared';
1
+ import { IItemPack, IPurchase, IStoreItem, ItemRarities, ItemSubType, ItemType, MetadataType, UserAccountTypes } from '@rpg-engine/shared';
2
2
  import type { Meta, StoryObj } from '@storybook/react';
3
3
  import React from 'react';
4
4
  import { RPGUIRoot } from '../../../components/RPGUI/RPGUIRoot';
5
5
  import customSkinImage from '../../../components/Store/sections/images/custom-skin.png';
6
6
  import { Store } from '../../../components/Store/Store';
7
+ import entitiesAtlasJSON from '../../../mocks/atlas/entities/entities.json';
8
+ import entitiesAtlasIMG from '../../../mocks/atlas/entities/entities.png';
7
9
  import itemsAtlasJSON from '../../../mocks/atlas/items/items.json';
8
10
  import itemsAtlasIMG from '../../../mocks/atlas/items/items.png';
9
11
  import { mockItems } from '../../../mocks/informationCenter.mocks';
10
12
 
11
13
  const meta = {
12
- title: 'Features/Store',
14
+ title: 'Features/Store/Store',
13
15
  component: Store,
14
16
  parameters: {
15
17
  layout: 'centered',
@@ -65,9 +67,104 @@ const storeItems: IStoreItem[] = mockItems.map((item, index) => ({
65
67
  requiredAccountType: item.rarity === 'Legendary' ? [UserAccountTypes.PremiumGold] : [],
66
68
  }));
67
69
 
70
+ // Sample character skins
71
+ const availableCharacters = [
72
+ {
73
+ id: 'black-knight',
74
+ name: 'Black Knight',
75
+ textureKey: 'black-knight',
76
+ },
77
+ {
78
+ id: 'dragon-knight',
79
+ name: 'Dragon Knight',
80
+ textureKey: 'dragon-knight',
81
+ },
82
+ {
83
+ id: 'senior-knight-1',
84
+ name: 'Senior Knight',
85
+ textureKey: 'senior-knight-1',
86
+ },
87
+ ];
88
+
89
+ // Create character skin items
90
+ const characterSkinItems: IStoreItem[] = [
91
+ {
92
+ _id: 'skin-character-customization',
93
+ key: 'skin-character-customization',
94
+ name: 'Character Skin Customization',
95
+ description: 'Customize your character\'s appearance with a variety of skins',
96
+ fullDescription: 'This premium item allows you to customize your character\'s appearance by selecting from a variety of available skins.',
97
+ texturePath: 'items/character_customization.png',
98
+ textureAtlas: 'items',
99
+ textureKey: 'items/character_customization.png',
100
+ price: 14.99,
101
+ type: ItemType.Other,
102
+ subType: ItemSubType.Other,
103
+ attack: 0,
104
+ defense: 0,
105
+ weight: 0,
106
+ rarity: ItemRarities.Rare,
107
+ isEquipable: false,
108
+ isStackable: false,
109
+ isUsable: true,
110
+ isStorable: true,
111
+ hasUseWith: false,
112
+ isSolid: false,
113
+ isTwoHanded: false,
114
+ isItemContainer: false,
115
+ layer: 1,
116
+ allowedEquipSlotType: [],
117
+ maxStackSize: 1,
118
+ // Add metadata type and config
119
+ metadataType: MetadataType.CharacterSkin,
120
+ metadataConfig: {
121
+ availableCharacters,
122
+ atlasJSON: entitiesAtlasJSON,
123
+ atlasIMG: entitiesAtlasIMG,
124
+ },
125
+ },
126
+ {
127
+ _id: 'skin-premium-character-pack',
128
+ key: 'skin-premium-character-pack',
129
+ name: 'Premium Character Skin Pack',
130
+ description: 'A premium collection of exclusive character skins',
131
+ fullDescription: 'This exclusive premium pack gives you access to rare and unique character skins to stand out from the crowd.',
132
+ texturePath: 'items/premium_character_pack.png',
133
+ textureAtlas: 'items',
134
+ textureKey: 'items/premium_character_pack.png',
135
+ price: 24.99,
136
+ type: ItemType.Other,
137
+ subType: ItemSubType.Other,
138
+ attack: 0,
139
+ defense: 0,
140
+ weight: 0,
141
+ rarity: ItemRarities.Epic,
142
+ isEquipable: false,
143
+ isStackable: false,
144
+ isUsable: true,
145
+ isStorable: true,
146
+ hasUseWith: false,
147
+ isSolid: false,
148
+ isTwoHanded: false,
149
+ isItemContainer: false,
150
+ layer: 1,
151
+ allowedEquipSlotType: [],
152
+ maxStackSize: 1,
153
+ requiredAccountType: [UserAccountTypes.PremiumSilver],
154
+ // Add metadata type and config with the same character options
155
+ metadataType: MetadataType.CharacterSkin,
156
+ metadataConfig: {
157
+ availableCharacters,
158
+ atlasJSON: entitiesAtlasJSON,
159
+ atlasIMG: entitiesAtlasIMG,
160
+ },
161
+ }
162
+ ];
163
+
68
164
  // Create duplicated items once with unique keys
69
165
  const duplicatedItems: IStoreItem[] = [
70
166
  ...storeItems,
167
+ ...characterSkinItems,
71
168
  ...storeItems.map((item, index) => ({
72
169
  ...item,
73
170
  _id: `copy1-${item.key}-${index}`,
@@ -141,9 +238,12 @@ export const Default: Story = {
141
238
  items={duplicatedItems}
142
239
  packs={mockPacks}
143
240
  userAccountType={UserAccountTypes.Free}
144
- onPurchase={(purchase: IPurchase) => {
241
+ onPurchase={(purchase: Partial<IPurchase>) => {
145
242
  console.log('Purchase details:', purchase);
243
+ return Promise.resolve(true);
146
244
  }}
245
+ onShowHistory={() => console.log('Show History clicked in story')}
246
+ onClose={() => console.log('Store closed')}
147
247
  atlasJSON={itemsAtlasJSON}
148
248
  atlasIMG={itemsAtlasIMG}
149
249
  />