@rpg-engine/long-bow 0.8.232 → 0.8.234

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 (35) hide show
  1. package/dist/components/DCWallet/DCTransferPanel.d.ts +3 -0
  2. package/dist/components/DCWallet/DCWalletContent.d.ts +3 -0
  3. package/dist/components/Marketplace/CharacterListingModal.d.ts +1 -0
  4. package/dist/components/Marketplace/CharacterTradePanel.d.ts +1 -0
  5. package/dist/components/Marketplace/ManagmentPanel.d.ts +1 -0
  6. package/dist/components/Marketplace/Marketplace.d.ts +1 -0
  7. package/dist/components/Marketplace/MyCharacterListingsPanel.d.ts +1 -0
  8. package/dist/components/Store/CartView.d.ts +11 -1
  9. package/dist/components/Store/PaymentMethodModal.d.ts +1 -0
  10. package/dist/components/Store/Store.d.ts +2 -1
  11. package/dist/components/Store/hooks/useStoreCart.d.ts +2 -1
  12. package/dist/long-bow.cjs.development.js +146 -82
  13. package/dist/long-bow.cjs.development.js.map +1 -1
  14. package/dist/long-bow.cjs.production.min.js +1 -1
  15. package/dist/long-bow.cjs.production.min.js.map +1 -1
  16. package/dist/long-bow.esm.js +146 -82
  17. package/dist/long-bow.esm.js.map +1 -1
  18. package/package.json +1 -1
  19. package/src/components/DCWallet/DCTransferPanel.tsx +34 -4
  20. package/src/components/DCWallet/DCWalletContent.tsx +9 -1
  21. package/src/components/DCWallet/__test__/DCTransferPanel.spec.tsx +115 -0
  22. package/src/components/Marketplace/CharacterListingModal.tsx +16 -0
  23. package/src/components/Marketplace/CharacterTradePanel.tsx +3 -0
  24. package/src/components/Marketplace/ManagmentPanel.tsx +38 -1
  25. package/src/components/Marketplace/Marketplace.tsx +2 -1
  26. package/src/components/Marketplace/MyCharacterListingsPanel.tsx +3 -0
  27. package/src/components/Marketplace/__test__/CharacterListingModal.spec.tsx +114 -0
  28. package/src/components/Marketplace/__test__/ManagmentPanel.spec.tsx +125 -0
  29. package/src/components/Store/CartView.tsx +23 -5
  30. package/src/components/Store/PaymentMethodModal.tsx +19 -9
  31. package/src/components/Store/Store.tsx +2 -2
  32. package/src/components/Store/__test__/CartView.spec.tsx +190 -0
  33. package/src/components/Store/__test__/PaymentMethodModal.spec.tsx +108 -0
  34. package/src/components/Store/hooks/useStoreCart.ts +6 -4
  35. package/src/stories/Features/trading/Marketplace.stories.tsx +2 -1
@@ -5843,7 +5843,9 @@ var DCTransferPanel = function DCTransferPanel(_ref) {
5843
5843
  onInputFocus = _ref.onInputFocus,
5844
5844
  onInputBlur = _ref.onInputBlur,
5845
5845
  onSearchCharacter = _ref.onSearchCharacter,
5846
- searchResults = _ref.searchResults;
5846
+ searchResults = _ref.searchResults,
5847
+ _ref$feePercent = _ref.feePercent,
5848
+ feePercent = _ref$feePercent === void 0 ? 0 : _ref$feePercent;
5847
5849
  var _useState = useState(''),
5848
5850
  recipientName = _useState[0],
5849
5851
  setRecipientName = _useState[1];
@@ -5903,7 +5905,8 @@ var DCTransferPanel = function DCTransferPanel(_ref) {
5903
5905
  setValidationError('Amount must be a positive integer.');
5904
5906
  return false;
5905
5907
  }
5906
- if (parsedAmount > dcBalance) {
5908
+ var fee = Math.floor(parsedAmount * feePercent);
5909
+ if (parsedAmount + fee > dcBalance) {
5907
5910
  setValidationError('Insufficient DC balance.');
5908
5911
  return false;
5909
5912
  }
@@ -5913,13 +5916,16 @@ var DCTransferPanel = function DCTransferPanel(_ref) {
5913
5916
  var handleSendClick = useCallback(function () {
5914
5917
  if (!validate()) return;
5915
5918
  setShowConfirm(true);
5916
- }, [recipientName, amount, dcBalance, characterName]);
5919
+ }, [recipientName, amount, dcBalance, characterName, feePercent]);
5917
5920
  var handleConfirmTransfer = useCallback(function () {
5918
5921
  setShowConfirm(false);
5919
5922
  onSendTransfer(recipientName.trim(), parseInt(amount, 10));
5920
5923
  setRecipientName('');
5921
5924
  setAmount('');
5922
5925
  }, [recipientName, amount, onSendTransfer]);
5926
+ var transferAmount = parseInt(amount, 10);
5927
+ var transferFee = Math.floor(transferAmount * feePercent);
5928
+ var transferTotal = transferAmount + transferFee;
5923
5929
  return React.createElement(PanelContainer$1, null, React.createElement(FieldLabel, null, "Recipient Character Name"), React.createElement(AutocompleteWrapper, {
5924
5930
  ref: dropdownRef
5925
5931
  }, React.createElement(StyledInput, {
@@ -5965,7 +5971,7 @@ var DCTransferPanel = function DCTransferPanel(_ref) {
5965
5971
  onBlur: onInputBlur,
5966
5972
  placeholder: "0",
5967
5973
  disabled: transferLoading
5968
- }), validationError && React.createElement(ErrorMessage, null, validationError), React.createElement(ButtonRow, null, React.createElement(CTAButton, {
5974
+ }), feePercent > 0 && React.createElement(FeeDisclosure, null, feePercent * 100, "% transfer fee is added to the sender debit."), validationError && React.createElement(ErrorMessage, null, validationError), React.createElement(ButtonRow, null, React.createElement(CTAButton, {
5969
5975
  icon: React.createElement(FaPaperPlane, null),
5970
5976
  label: transferLoading ? 'Sending...' : 'Send',
5971
5977
  onClick: handleSendClick,
@@ -5973,8 +5979,8 @@ var DCTransferPanel = function DCTransferPanel(_ref) {
5973
5979
  fullWidth: true
5974
5980
  })), transferLoading && React.createElement(Spinner$1, null), transferResult && React.createElement(ResultMessage, {
5975
5981
  "$success": transferResult.success
5976
- }, transferResult.message), showConfirm && React.createElement(ConfirmModal, {
5977
- message: "Transfer " + parseInt(amount, 10) + " DC to \"" + recipientName.trim() + "\"?",
5982
+ }, transferResult.message, !!transferResult.fee && " \xB7 " + transferResult.fee.toLocaleString() + " DC fee"), showConfirm && React.createElement(ConfirmModal, {
5983
+ message: feePercent > 0 ? "Transfer " + transferAmount.toLocaleString() + " DC to \"" + recipientName.trim() + "\"? Fee: " + transferFee.toLocaleString() + " DC \xB7 Total: " + transferTotal.toLocaleString() + " DC" : "Transfer " + transferAmount.toLocaleString() + " DC to \"" + recipientName.trim() + "\"?",
5978
5984
  onConfirm: handleConfirmTransfer,
5979
5985
  onClose: function onClose() {
5980
5986
  return setShowConfirm(false);
@@ -6015,17 +6021,21 @@ var ErrorMessage = /*#__PURE__*/styled.div.withConfig({
6015
6021
  displayName: "DCTransferPanel__ErrorMessage",
6016
6022
  componentId: "sc-k1vvb1-6"
6017
6023
  })(["font-size:9px !important;color:", " !important;font-family:'Press Start 2P',cursive !important;"], uiColors.red);
6024
+ var FeeDisclosure = /*#__PURE__*/styled.p.withConfig({
6025
+ displayName: "DCTransferPanel__FeeDisclosure",
6026
+ componentId: "sc-k1vvb1-7"
6027
+ })(["margin:0;color:rgba(254,240,138,0.65);font-size:7px !important;line-height:1.4 !important;"]);
6018
6028
  var AutocompleteWrapper = /*#__PURE__*/styled.div.withConfig({
6019
6029
  displayName: "DCTransferPanel__AutocompleteWrapper",
6020
- componentId: "sc-k1vvb1-7"
6030
+ componentId: "sc-k1vvb1-8"
6021
6031
  })(["position:relative;width:100%;"]);
6022
6032
  var DropdownList = /*#__PURE__*/styled.ul.withConfig({
6023
6033
  displayName: "DCTransferPanel__DropdownList",
6024
- componentId: "sc-k1vvb1-8"
6034
+ componentId: "sc-k1vvb1-9"
6025
6035
  })(["position:absolute;top:100%;left:0;right:0;background:rgba(10,10,30,0.95);border:1px solid #f59e0b;border-top:none;list-style:none;padding:0;margin:0;max-height:120px;overflow-y:auto;z-index:10;"]);
6026
6036
  var DropdownItem = /*#__PURE__*/styled.li.withConfig({
6027
6037
  displayName: "DCTransferPanel__DropdownItem",
6028
- componentId: "sc-k1vvb1-9"
6038
+ componentId: "sc-k1vvb1-10"
6029
6039
  })(["padding:6px 8px;font-size:11px;font-family:'Press Start 2P',cursive;color:", ";cursor:pointer;&:hover{background:rgba(245,158,11,0.3);}"], uiColors.white);
6030
6040
 
6031
6041
  var DC_TO_USD$1 = 100;
@@ -6044,7 +6054,9 @@ var DCWalletContent = function DCWalletContent(_ref) {
6044
6054
  onInputBlur = _ref.onInputBlur,
6045
6055
  onBuyDC = _ref.onBuyDC,
6046
6056
  onSearchCharacter = _ref.onSearchCharacter,
6047
- searchResults = _ref.searchResults;
6057
+ searchResults = _ref.searchResults,
6058
+ _ref$feePercent = _ref.feePercent,
6059
+ feePercent = _ref$feePercent === void 0 ? 0 : _ref$feePercent;
6048
6060
  var usdValue = (dcBalance / DC_TO_USD$1).toFixed(2);
6049
6061
  var tabs = [{
6050
6062
  id: 'transfer',
@@ -6053,6 +6065,7 @@ var DCWalletContent = function DCWalletContent(_ref) {
6053
6065
  dcBalance: dcBalance,
6054
6066
  transferLoading: transferLoading,
6055
6067
  transferResult: transferResult,
6068
+ feePercent: feePercent,
6056
6069
  onSendTransfer: onSendTransfer,
6057
6070
  onClearTransferResult: onClearTransferResult,
6058
6071
  characterName: characterName,
@@ -13060,7 +13073,9 @@ var ManagmentPanel = function ManagmentPanel(_ref) {
13060
13073
  onMoneyWithdraw = _ref.onMoneyWithdraw,
13061
13074
  currentPage = _ref.currentPage,
13062
13075
  _ref$dcToGoldSwapRate = _ref.dcToGoldSwapRate,
13063
- dcToGoldSwapRate = _ref$dcToGoldSwapRate === void 0 ? 0 : _ref$dcToGoldSwapRate;
13076
+ dcToGoldSwapRate = _ref$dcToGoldSwapRate === void 0 ? 0 : _ref$dcToGoldSwapRate,
13077
+ _ref$commissionPercen = _ref.commissionPercent,
13078
+ commissionPercent = _ref$commissionPercen === void 0 ? 0 : _ref$commissionPercen;
13064
13079
  var _useState = useState(''),
13065
13080
  price = _useState[0],
13066
13081
  setPrice = _useState[1];
@@ -13078,6 +13093,10 @@ var ManagmentPanel = function ManagmentPanel(_ref) {
13078
13093
  var _itemsContainer$curre;
13079
13094
  (_itemsContainer$curre = itemsContainer.current) == null ? void 0 : _itemsContainer$curre.scrollTo(0, 0);
13080
13095
  }, [currentPage]);
13096
+ var parsedPrice = Number(price);
13097
+ var netGoldProceeds = parsedPrice - Math.floor(parsedPrice * commissionPercent);
13098
+ var netDCProceeds = goldToDC(netGoldProceeds);
13099
+ var netProceedsLabel = listingCurrency === MarketplaceAcceptedCurrency.Gold ? netGoldProceeds.toLocaleString() + " gold" : listingCurrency === MarketplaceAcceptedCurrency.Dc ? formatDCAmount(netDCProceeds) + " DC" : netGoldProceeds.toLocaleString() + " gold or " + formatDCAmount(netDCProceeds) + " DC";
13081
13100
  return React.createElement(React.Fragment, null, isCreatingOffer && React.createElement(ConfirmModal, {
13082
13101
  onClose: setIsCreatingOffer.bind(null, false),
13083
13102
  onConfirm: function onConfirm() {
@@ -13151,7 +13170,7 @@ var ManagmentPanel = function ManagmentPanel(_ref) {
13151
13170
  setIsCreatingOffer(true);
13152
13171
  }
13153
13172
  }
13154
- })), React.createElement(CurrencyToggleRow, null, React.createElement(CurrencyToggleLabel, null, "Accept:"), LISTING_CURRENCY_OPTIONS.map(function (opt) {
13173
+ })), commissionPercent > 0 && React.createElement(FeeDisclosure$1, null, commissionPercent * 100, "% marketplace commission is deducted from seller proceeds."), price && Number(price) > 0 && commissionPercent > 0 && React.createElement(NetProceeds, null, "You'll receive: ", netProceedsLabel, ' ', "(after ", commissionPercent * 100, "% commission)"), React.createElement(CurrencyToggleRow, null, React.createElement(CurrencyToggleLabel, null, "Accept:"), LISTING_CURRENCY_OPTIONS.map(function (opt) {
13155
13174
  return React.createElement(CurrencyToggleButton, {
13156
13175
  key: opt.value,
13157
13176
  "$active": listingCurrency === opt.value,
@@ -13236,48 +13255,56 @@ var SellDescription = /*#__PURE__*/styled.p.withConfig({
13236
13255
  var PriceInputWrapper = /*#__PURE__*/styled.div.withConfig({
13237
13256
  displayName: "ManagmentPanel__PriceInputWrapper",
13238
13257
  componentId: "sc-1yyi6jn-5"
13239
- })(["display:flex;flex-direction:column;flex-grow:1;p{margin:0 0 8px 0;font-size:0.6rem;color:#888;text-transform:uppercase;letter-spacing:0.5px;}.price-input{width:60px;height:32px;flex-grow:1;font-size:0.7rem;}.offer-btn{padding:10px 14px;height:32px;}"]);
13258
+ })(["display:flex;flex-direction:column;flex-grow:1;> p:first-child{margin:0 0 8px 0;font-size:0.6rem;color:#888;text-transform:uppercase;letter-spacing:0.5px;}.price-input{width:60px;height:32px;flex-grow:1;font-size:0.7rem;}.offer-btn{padding:10px 14px;height:32px;}"]);
13259
+ var NetProceeds = /*#__PURE__*/styled.p.withConfig({
13260
+ displayName: "ManagmentPanel__NetProceeds",
13261
+ componentId: "sc-1yyi6jn-6"
13262
+ })(["margin:8px 0 0;color:#fef08a;font-size:8px !important;line-height:1.5 !important;"]);
13263
+ var FeeDisclosure$1 = /*#__PURE__*/styled.p.withConfig({
13264
+ displayName: "ManagmentPanel__FeeDisclosure",
13265
+ componentId: "sc-1yyi6jn-7"
13266
+ })(["margin:6px 0 0;color:rgba(254,240,138,0.65);font-size:7px !important;line-height:1.4 !important;"]);
13240
13267
  var GoldIcon$3 = /*#__PURE__*/styled.div.withConfig({
13241
13268
  displayName: "ManagmentPanel__GoldIcon",
13242
- componentId: "sc-1yyi6jn-6"
13269
+ componentId: "sc-1yyi6jn-8"
13243
13270
  })(["position:relative;display:flex;align-items:center;justify-content:center;width:20px;height:20px;margin-right:4px;flex-shrink:0;top:-0.5rem;left:-0.5rem;"]);
13244
13271
  var WealthWrapper = /*#__PURE__*/styled.div.withConfig({
13245
13272
  displayName: "ManagmentPanel__WealthWrapper",
13246
- componentId: "sc-1yyi6jn-7"
13273
+ componentId: "sc-1yyi6jn-9"
13247
13274
  })(["display:flex;flex-direction:column;gap:8px;flex-grow:1;& > :last-child{margin-top:auto;}"]);
13248
13275
  var BalanceRow = /*#__PURE__*/styled.div.withConfig({
13249
13276
  displayName: "ManagmentPanel__BalanceRow",
13250
- componentId: "sc-1yyi6jn-8"
13277
+ componentId: "sc-1yyi6jn-10"
13251
13278
  })(["display:flex;align-items:center;justify-content:flex-end;gap:10px;background:rgba(0,0,0,0.3);border-radius:4px;border:1px solid rgba(255,255,255,0.05);padding:8px 12px;"]);
13252
13279
  var BalanceAmount$1 = /*#__PURE__*/styled.span.withConfig({
13253
13280
  displayName: "ManagmentPanel__BalanceAmount",
13254
- componentId: "sc-1yyi6jn-9"
13281
+ componentId: "sc-1yyi6jn-11"
13255
13282
  })(["font-family:'Press Start 2P',cursive;font-size:0.8rem;color:", ";text-shadow:0 2px 4px rgba(0,0,0,0.5);margin-left:auto;"], function (props) {
13256
13283
  return props.$disabled ? uiColors.lightGray : '#fef08a';
13257
13284
  });
13258
13285
  var BalanceCurrencyLabel = /*#__PURE__*/styled.span.withConfig({
13259
13286
  displayName: "ManagmentPanel__BalanceCurrencyLabel",
13260
- componentId: "sc-1yyi6jn-10"
13287
+ componentId: "sc-1yyi6jn-12"
13261
13288
  })(["font-size:0.5rem;color:#888;text-transform:uppercase;letter-spacing:0.5px;min-width:45px;text-align:right;"]);
13262
13289
  var ItemComponentScrollWrapper$2 = /*#__PURE__*/styled.div.withConfig({
13263
13290
  displayName: "ManagmentPanel__ItemComponentScrollWrapper",
13264
- componentId: "sc-1yyi6jn-11"
13291
+ componentId: "sc-1yyi6jn-13"
13265
13292
  })(["overflow-y:scroll;overflow-x:hidden;height:335px;width:95%;margin:1rem auto 0 auto;background:rgba(0,0,0,0.2);border:1px solid rgba(255,255,255,0.05);border-radius:4px;@media (max-width:950px){height:195px;}"]);
13266
13293
  var SmallCTAButton = /*#__PURE__*/styled(CTAButton).withConfig({
13267
13294
  displayName: "ManagmentPanel__SmallCTAButton",
13268
- componentId: "sc-1yyi6jn-12"
13295
+ componentId: "sc-1yyi6jn-14"
13269
13296
  })(["padding:8px 12px;height:32px;span{font-size:0.65rem;}svg{font-size:1.1rem;}"]);
13270
13297
  var CurrencyToggleRow = /*#__PURE__*/styled.div.withConfig({
13271
13298
  displayName: "ManagmentPanel__CurrencyToggleRow",
13272
- componentId: "sc-1yyi6jn-13"
13299
+ componentId: "sc-1yyi6jn-15"
13273
13300
  })(["display:flex;align-items:center;gap:6px;margin-top:8px;"]);
13274
13301
  var CurrencyToggleLabel = /*#__PURE__*/styled.span.withConfig({
13275
13302
  displayName: "ManagmentPanel__CurrencyToggleLabel",
13276
- componentId: "sc-1yyi6jn-14"
13303
+ componentId: "sc-1yyi6jn-16"
13277
13304
  })(["font-size:0.5rem;color:#888;text-transform:uppercase;letter-spacing:0.5px;white-space:nowrap;"]);
13278
13305
  var CurrencyToggleButton = /*#__PURE__*/styled.button.withConfig({
13279
13306
  displayName: "ManagmentPanel__CurrencyToggleButton",
13280
- componentId: "sc-1yyi6jn-15"
13307
+ componentId: "sc-1yyi6jn-17"
13281
13308
  })(["padding:3px 8px;font-family:'Press Start 2P',cursive !important;font-size:0.45rem !important;border-radius:4px;border:1px solid ", " !important;background:", " !important;color:", " !important;cursor:pointer;transition:border-color 0.15s,background 0.15s,color 0.15s;&:hover{border-color:", " !important;color:", " !important;}"], function (_ref3) {
13282
13309
  var $active = _ref3.$active;
13283
13310
  return $active ? '#f59e0b' : 'rgba(255,255,255,0.15)';
@@ -13296,7 +13323,7 @@ var CurrencyToggleButton = /*#__PURE__*/styled.button.withConfig({
13296
13323
  });
13297
13324
  var DCPreview = /*#__PURE__*/styled.span.withConfig({
13298
13325
  displayName: "ManagmentPanel__DCPreview",
13299
- componentId: "sc-1yyi6jn-16"
13326
+ componentId: "sc-1yyi6jn-18"
13300
13327
  })(["font-family:'Press Start 2P',cursive !important;font-size:0.4rem !important;color:rgba(167,139,250,0.8) !important;white-space:nowrap;margin-left:auto;"]);
13301
13328
 
13302
13329
  var CURRENCY_OPTIONS = [{
@@ -13939,7 +13966,9 @@ var CharacterListingModal = function CharacterListingModal(_ref) {
13939
13966
  characterAtlasIMG = _ref.characterAtlasIMG,
13940
13967
  onCharacterList = _ref.onCharacterList,
13941
13968
  enableHotkeys = _ref.enableHotkeys,
13942
- disableHotkeys = _ref.disableHotkeys;
13969
+ disableHotkeys = _ref.disableHotkeys,
13970
+ _ref$commissionPercen = _ref.commissionPercent,
13971
+ commissionPercent = _ref$commissionPercen === void 0 ? 0 : _ref$commissionPercen;
13943
13972
  var _useState = useState(null),
13944
13973
  selectedId = _useState[0],
13945
13974
  setSelectedId = _useState[1];
@@ -14057,7 +14086,7 @@ var CharacterListingModal = function CharacterListingModal(_ref) {
14057
14086
  centered: true
14058
14087
  })), React.createElement(PricePreviewAmount, null, React.createElement(MMORPGNumber, {
14059
14088
  value: Number(price)
14060
- }), " DC")), React.createElement(DCRateStrip, null)))));
14089
+ }), " DC")), price && Number(price) > 0 && commissionPercent > 0 && React.createElement(NetProceeds$1, null, "You'll receive:", ' ', (Number(price) - Math.floor(Number(price) * commissionPercent)).toLocaleString(), " DC", ' ', "(after ", commissionPercent * 100, "% commission)"), React.createElement(DCRateStrip, null)))));
14061
14090
  };
14062
14091
  var scaleIn$3 = /*#__PURE__*/keyframes(["from{transform:scale(0.85);opacity:0;}to{transform:scale(1);opacity:1;}"]);
14063
14092
  var Overlay$8 = /*#__PURE__*/styled.div.withConfig({
@@ -14072,25 +14101,29 @@ var ModalContent$6 = /*#__PURE__*/styled.div.withConfig({
14072
14101
  displayName: "CharacterListingModal__ModalContent",
14073
14102
  componentId: "sc-1uxkx35-2"
14074
14103
  })(["background:#1a1a2e;border:2px solid #f59e0b;border-radius:8px;padding:20px 24px;width:440px;max-width:92%;max-height:80dvh;display:flex;flex-direction:column;gap:16px;overflow:hidden;pointer-events:auto;animation:", " 0.15s ease-out;"], scaleIn$3);
14104
+ var NetProceeds$1 = /*#__PURE__*/styled.p.withConfig({
14105
+ displayName: "CharacterListingModal__NetProceeds",
14106
+ componentId: "sc-1uxkx35-3"
14107
+ })(["margin:0;color:#fef08a;font-size:8px !important;line-height:1.5 !important;"]);
14075
14108
  var Header$c = /*#__PURE__*/styled.div.withConfig({
14076
14109
  displayName: "CharacterListingModal__Header",
14077
- componentId: "sc-1uxkx35-3"
14110
+ componentId: "sc-1uxkx35-4"
14078
14111
  })(["display:flex;align-items:center;justify-content:space-between;"]);
14079
14112
  var Title$d = /*#__PURE__*/styled.h3.withConfig({
14080
14113
  displayName: "CharacterListingModal__Title",
14081
- componentId: "sc-1uxkx35-4"
14114
+ componentId: "sc-1uxkx35-5"
14082
14115
  })(["margin:0;font-family:'Press Start 2P',cursive !important;font-size:0.65rem !important;color:#fef08a !important;"]);
14083
14116
  var CloseButton$f = /*#__PURE__*/styled.button.withConfig({
14084
14117
  displayName: "CharacterListingModal__CloseButton",
14085
- componentId: "sc-1uxkx35-5"
14118
+ componentId: "sc-1uxkx35-6"
14086
14119
  })(["background:none;border:none;color:rgba(255,255,255,0.6);cursor:pointer;font-size:1rem;padding:4px;display:flex;align-items:center;pointer-events:auto;&:hover{color:#ffffff;}"]);
14087
14120
  var CharacterList$1 = /*#__PURE__*/styled.div.withConfig({
14088
14121
  displayName: "CharacterListingModal__CharacterList",
14089
- componentId: "sc-1uxkx35-6"
14122
+ componentId: "sc-1uxkx35-7"
14090
14123
  })(["display:flex;flex-direction:column;gap:6px;overflow-y:auto;max-height:260px;padding:2px;&::-webkit-scrollbar{width:6px;}&::-webkit-scrollbar-track{background:rgba(0,0,0,0.2);border-radius:4px;}&::-webkit-scrollbar-thumb{background:rgba(245,158,11,0.3);border-radius:4px;}"]);
14091
14124
  var CharacterRow = /*#__PURE__*/styled.div.withConfig({
14092
14125
  displayName: "CharacterListingModal__CharacterRow",
14093
- componentId: "sc-1uxkx35-7"
14126
+ componentId: "sc-1uxkx35-8"
14094
14127
  })(["display:flex;align-items:center;gap:12px;padding:10px 12px;border:1px solid ", ";border-radius:6px;background:", ";cursor:", ";opacity:", ";transition:border-color 0.15s,background 0.15s;&:hover{border-color:", ";background:", ";}&:focus-visible{outline:2px solid rgba(245,158,11,0.6);outline-offset:2px;}"], function (_ref2) {
14095
14128
  var $selected = _ref2.$selected,
14096
14129
  $disabled = _ref2.$disabled;
@@ -14116,7 +14149,7 @@ var CharacterRow = /*#__PURE__*/styled.div.withConfig({
14116
14149
  });
14117
14150
  var RadioCircle$1 = /*#__PURE__*/styled.div.withConfig({
14118
14151
  displayName: "CharacterListingModal__RadioCircle",
14119
- componentId: "sc-1uxkx35-8"
14152
+ componentId: "sc-1uxkx35-9"
14120
14153
  })(["width:14px;height:14px;border-radius:50%;border:2px solid ", ";flex-shrink:0;display:flex;align-items:center;justify-content:center;&::after{content:'';width:6px;height:6px;border-radius:50%;background:", ";opacity:", ";transition:opacity 0.15s;}"], function (_ref8) {
14121
14154
  var $selected = _ref8.$selected,
14122
14155
  $disabled = _ref8.$disabled;
@@ -14130,55 +14163,55 @@ var RadioCircle$1 = /*#__PURE__*/styled.div.withConfig({
14130
14163
  });
14131
14164
  var ActiveTag = /*#__PURE__*/styled.span.withConfig({
14132
14165
  displayName: "CharacterListingModal__ActiveTag",
14133
- componentId: "sc-1uxkx35-9"
14166
+ componentId: "sc-1uxkx35-10"
14134
14167
  })(["font-family:'Press Start 2P',cursive !important;font-size:0.35rem !important;color:#666 !important;background:rgba(255,255,255,0.06);padding:3px 6px;border-radius:3px;white-space:nowrap;margin-left:auto;"]);
14135
14168
  var SpriteWrapper$3 = /*#__PURE__*/styled.div.withConfig({
14136
14169
  displayName: "CharacterListingModal__SpriteWrapper",
14137
- componentId: "sc-1uxkx35-10"
14170
+ componentId: "sc-1uxkx35-11"
14138
14171
  })(["display:flex;align-items:center;justify-content:center;image-rendering:pixelated;flex-shrink:0;width:40px;height:40px;"]);
14139
14172
  var CharacterInfo$1 = /*#__PURE__*/styled.div.withConfig({
14140
14173
  displayName: "CharacterListingModal__CharacterInfo",
14141
- componentId: "sc-1uxkx35-11"
14174
+ componentId: "sc-1uxkx35-12"
14142
14175
  })(["display:flex;flex-direction:column;gap:4px;flex:1;"]);
14143
14176
  var CharacterName$3 = /*#__PURE__*/styled.span.withConfig({
14144
14177
  displayName: "CharacterListingModal__CharacterName",
14145
- componentId: "sc-1uxkx35-12"
14178
+ componentId: "sc-1uxkx35-13"
14146
14179
  })(["font-family:'Press Start 2P',cursive !important;font-size:0.5rem !important;color:#f3f4f6 !important;"]);
14147
14180
  var CharacterMeta$1 = /*#__PURE__*/styled.span.withConfig({
14148
14181
  displayName: "CharacterListingModal__CharacterMeta",
14149
- componentId: "sc-1uxkx35-13"
14182
+ componentId: "sc-1uxkx35-14"
14150
14183
  })(["font-family:'Press Start 2P',cursive !important;font-size:0.4rem !important;color:#888 !important;text-transform:uppercase;letter-spacing:0.5px;"]);
14151
14184
  var PricePreview = /*#__PURE__*/styled.div.withConfig({
14152
14185
  displayName: "CharacterListingModal__PricePreview",
14153
- componentId: "sc-1uxkx35-14"
14186
+ componentId: "sc-1uxkx35-15"
14154
14187
  })(["display:flex;align-items:center;gap:6px;"]);
14155
14188
  var DCCoinWrapper$4 = /*#__PURE__*/styled.span.withConfig({
14156
14189
  displayName: "CharacterListingModal__DCCoinWrapper",
14157
- componentId: "sc-1uxkx35-15"
14190
+ componentId: "sc-1uxkx35-16"
14158
14191
  })(["display:flex;align-items:center;justify-content:center;flex-shrink:0;"]);
14159
14192
  var PricePreviewAmount = /*#__PURE__*/styled.span.withConfig({
14160
14193
  displayName: "CharacterListingModal__PricePreviewAmount",
14161
- componentId: "sc-1uxkx35-16"
14194
+ componentId: "sc-1uxkx35-17"
14162
14195
  })(["font-family:'Press Start 2P',cursive !important;font-size:0.55rem !important;color:#fef08a !important;"]);
14163
14196
  var PriceSection$1 = /*#__PURE__*/styled.div.withConfig({
14164
14197
  displayName: "CharacterListingModal__PriceSection",
14165
- componentId: "sc-1uxkx35-17"
14198
+ componentId: "sc-1uxkx35-18"
14166
14199
  })(["display:flex;flex-direction:column;gap:8px;border-top:1px solid rgba(255,255,255,0.06);padding-top:12px;"]);
14167
14200
  var PriceLabel = /*#__PURE__*/styled.p.withConfig({
14168
14201
  displayName: "CharacterListingModal__PriceLabel",
14169
- componentId: "sc-1uxkx35-18"
14202
+ componentId: "sc-1uxkx35-19"
14170
14203
  })(["margin:0;font-family:'Press Start 2P',cursive !important;font-size:0.55rem !important;color:#888 !important;text-transform:uppercase;letter-spacing:0.5px;"]);
14171
14204
  var PriceRow$1 = /*#__PURE__*/styled.div.withConfig({
14172
14205
  displayName: "CharacterListingModal__PriceRow",
14173
- componentId: "sc-1uxkx35-19"
14206
+ componentId: "sc-1uxkx35-20"
14174
14207
  })(["display:flex;gap:8px;align-items:center;.price-input{flex:1;height:12px;}"]);
14175
14208
  var ListBtn = /*#__PURE__*/styled(CTAButton).withConfig({
14176
14209
  displayName: "CharacterListingModal__ListBtn",
14177
- componentId: "sc-1uxkx35-20"
14210
+ componentId: "sc-1uxkx35-21"
14178
14211
  })(["flex-shrink:0;padding:10px 16px;height:32px;span{font-size:0.6rem;}svg{font-size:1.1rem;}"]);
14179
14212
  var EmptyState$6 = /*#__PURE__*/styled.div.withConfig({
14180
14213
  displayName: "CharacterListingModal__EmptyState",
14181
- componentId: "sc-1uxkx35-21"
14214
+ componentId: "sc-1uxkx35-22"
14182
14215
  })(["display:flex;align-items:center;justify-content:center;padding:32px 16px;font-family:'Press Start 2P',cursive !important;font-size:0.5rem !important;color:#666 !important;text-transform:uppercase;letter-spacing:1px;"]);
14183
14216
 
14184
14217
  var MyCharacterListingsPanel = function MyCharacterListingsPanel(_ref) {
@@ -14196,7 +14229,9 @@ var MyCharacterListingsPanel = function MyCharacterListingsPanel(_ref) {
14196
14229
  characterAtlasJSON = _ref.characterAtlasJSON,
14197
14230
  characterAtlasIMG = _ref.characterAtlasIMG,
14198
14231
  enableHotkeys = _ref.enableHotkeys,
14199
- disableHotkeys = _ref.disableHotkeys;
14232
+ disableHotkeys = _ref.disableHotkeys,
14233
+ _ref$commissionPercen = _ref.commissionPercent,
14234
+ commissionPercent = _ref$commissionPercen === void 0 ? 0 : _ref$commissionPercen;
14200
14235
  var _useState = useState(null),
14201
14236
  delistingId = _useState[0],
14202
14237
  setDelistingId = _useState[1];
@@ -14239,7 +14274,8 @@ var MyCharacterListingsPanel = function MyCharacterListingsPanel(_ref) {
14239
14274
  setIsListingModalOpen(false);
14240
14275
  },
14241
14276
  enableHotkeys: enableHotkeys,
14242
- disableHotkeys: disableHotkeys
14277
+ disableHotkeys: disableHotkeys,
14278
+ commissionPercent: commissionPercent
14243
14279
  }), React.createElement(Toolbar, null, React.createElement(ListCharacterBtn, {
14244
14280
  icon: React.createElement(ShoppingBag, {
14245
14281
  width: 16,
@@ -14398,7 +14434,9 @@ var CharacterTradePanel = function CharacterTradePanel(_ref) {
14398
14434
  characterAtlasJSON = _ref.characterAtlasJSON,
14399
14435
  characterAtlasIMG = _ref.characterAtlasIMG,
14400
14436
  enableHotkeys = _ref.enableHotkeys,
14401
- disableHotkeys = _ref.disableHotkeys;
14437
+ disableHotkeys = _ref.disableHotkeys,
14438
+ _ref$commissionPercen = _ref.commissionPercent,
14439
+ commissionPercent = _ref$commissionPercen === void 0 ? 0 : _ref$commissionPercen;
14402
14440
  var _useState = useState('browse'),
14403
14441
  subTab = _useState[0],
14404
14442
  setSubTab = _useState[1];
@@ -14445,7 +14483,8 @@ var CharacterTradePanel = function CharacterTradePanel(_ref) {
14445
14483
  characterAtlasJSON: characterAtlasJSON != null ? characterAtlasJSON : atlasJSON,
14446
14484
  characterAtlasIMG: characterAtlasIMG != null ? characterAtlasIMG : atlasIMG,
14447
14485
  enableHotkeys: enableHotkeys,
14448
- disableHotkeys: disableHotkeys
14486
+ disableHotkeys: disableHotkeys,
14487
+ commissionPercent: commissionPercent
14449
14488
  }));
14450
14489
  };
14451
14490
  var CharacterSubTabs = /*#__PURE__*/styled.div.withConfig({
@@ -14665,7 +14704,8 @@ var Marketplace = function Marketplace(props) {
14665
14704
  characterAtlasJSON: characterAtlasJSON,
14666
14705
  characterAtlasIMG: characterAtlasIMG,
14667
14706
  enableHotkeys: props.enableHotkeys,
14668
- disableHotkeys: props.disableHotkeys
14707
+ disableHotkeys: props.disableHotkeys,
14708
+ commissionPercent: props.commissionPercent
14669
14709
  }), activeTab === 'sell' && React.createElement(ManagmentPanel, Object.assign({}, props, {
14670
14710
  acceptedCurrency: acceptedCurrency
14671
14711
  })), activeTab === 'buy-orders' && React.createElement(React.Fragment, null, React.createElement(BuyOrderPanel, {
@@ -38004,6 +38044,17 @@ var CloseLink = /*#__PURE__*/styled.div.withConfig({
38004
38044
  componentId: "sc-18z5q21-16"
38005
38045
  })(["font-family:'Press Start 2P',cursive;font-size:0.5rem;color:rgba(255,255,255,0.45);cursor:pointer;display:flex;align-items:center;gap:0.3rem;transition:color 0.15s;&:hover{color:rgba(255,255,255,0.7);}"]);
38006
38046
 
38047
+ var GENERIC_PURCHASE_FAILED_MESSAGE = 'Purchase failed. Please try again.';
38048
+ var normalizePurchaseResult = function normalizePurchaseResult(result) {
38049
+ if (typeof result === 'boolean') {
38050
+ return result ? {
38051
+ status: 'success'
38052
+ } : {
38053
+ status: 'failed'
38054
+ };
38055
+ }
38056
+ return result;
38057
+ };
38007
38058
  var MetadataDisplay = function MetadataDisplay(_ref) {
38008
38059
  var type = _ref.type,
38009
38060
  metadata = _ref.metadata;
@@ -38051,7 +38102,7 @@ var CartView = function CartView(_ref2) {
38051
38102
  };
38052
38103
  var handlePurchase = /*#__PURE__*/function () {
38053
38104
  var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
38054
- var snapshot, trackItems, success, errMsg, _errMsg;
38105
+ var snapshot, trackItems, purchaseResult, _purchaseResult$error, errMsg, _errMsg;
38055
38106
  return _regeneratorRuntime().wrap(function _callee$(_context) {
38056
38107
  while (1) switch (_context.prev = _context.next) {
38057
38108
  case 0:
@@ -38067,36 +38118,38 @@ var CartView = function CartView(_ref2) {
38067
38118
  };
38068
38119
  });
38069
38120
  onCheckoutStart == null ? void 0 : onCheckoutStart(trackItems, total);
38070
- _context.next = 8;
38121
+ _context.t0 = normalizePurchaseResult;
38122
+ _context.next = 9;
38071
38123
  return onPurchase();
38072
- case 8:
38073
- success = _context.sent;
38074
- if (success) {
38124
+ case 9:
38125
+ _context.t1 = _context.sent;
38126
+ purchaseResult = (0, _context.t0)(_context.t1);
38127
+ if (purchaseResult.status === 'success') {
38075
38128
  onPurchaseSuccess == null ? void 0 : onPurchaseSuccess(trackItems, total);
38076
38129
  setPurchasedItems(snapshot);
38077
- } else {
38078
- errMsg = 'Purchase failed. Please try again.';
38130
+ } else if (purchaseResult.status === 'failed') {
38131
+ errMsg = (_purchaseResult$error = purchaseResult.error) != null ? _purchaseResult$error : GENERIC_PURCHASE_FAILED_MESSAGE;
38079
38132
  onPurchaseError == null ? void 0 : onPurchaseError(errMsg);
38080
38133
  setError(errMsg);
38081
38134
  }
38082
- _context.next = 18;
38135
+ _context.next = 20;
38083
38136
  break;
38084
- case 12:
38085
- _context.prev = 12;
38086
- _context.t0 = _context["catch"](0);
38137
+ case 14:
38138
+ _context.prev = 14;
38139
+ _context.t2 = _context["catch"](0);
38087
38140
  _errMsg = 'An error occurred during purchase. Please try again.';
38088
38141
  onPurchaseError == null ? void 0 : onPurchaseError(_errMsg);
38089
38142
  setError(_errMsg);
38090
- console.error('Purchase error:', _context.t0);
38091
- case 18:
38092
- _context.prev = 18;
38143
+ console.error('Purchase error:', _context.t2);
38144
+ case 20:
38145
+ _context.prev = 20;
38093
38146
  setIsLoading(false);
38094
- return _context.finish(18);
38095
- case 21:
38147
+ return _context.finish(20);
38148
+ case 23:
38096
38149
  case "end":
38097
38150
  return _context.stop();
38098
38151
  }
38099
- }, _callee, null, [[0, 12, 18, 21]]);
38152
+ }, _callee, null, [[0, 14, 20, 23]]);
38100
38153
  }));
38101
38154
  return function handlePurchase() {
38102
38155
  return _ref3.apply(this, arguments);
@@ -38615,7 +38668,7 @@ var useStoreCart = function useStoreCart() {
38615
38668
  };
38616
38669
  var handlePurchase = /*#__PURE__*/function () {
38617
38670
  var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(onPurchase) {
38618
- var purchaseUnits, purchase, success;
38671
+ var purchaseUnits, purchase, result, success;
38619
38672
  return _regeneratorRuntime().wrap(function _callee2$(_context2) {
38620
38673
  while (1) switch (_context2.prev = _context2.next) {
38621
38674
  case 0:
@@ -38639,13 +38692,14 @@ var useStoreCart = function useStoreCart() {
38639
38692
  _context2.next = 4;
38640
38693
  return onPurchase(purchase);
38641
38694
  case 4:
38642
- success = _context2.sent;
38695
+ result = _context2.sent;
38696
+ success = typeof result === 'boolean' ? result : result.status === 'success';
38643
38697
  if (success && isMounted.current) {
38644
38698
  setCartItems([]);
38645
38699
  setIsCartOpen(false);
38646
38700
  }
38647
- return _context2.abrupt("return", success);
38648
- case 7:
38701
+ return _context2.abrupt("return", result);
38702
+ case 8:
38649
38703
  case "end":
38650
38704
  return _context2.stop();
38651
38705
  }
@@ -38779,7 +38833,9 @@ var PaymentMethodModal = function PaymentMethodModal(_ref) {
38779
38833
  onPayWithPix = _ref.onPayWithPix,
38780
38834
  onClose = _ref.onClose,
38781
38835
  _ref$showPix = _ref.showPix,
38782
- showPix = _ref$showPix === void 0 ? false : _ref$showPix;
38836
+ showPix = _ref$showPix === void 0 ? false : _ref$showPix,
38837
+ _ref$isProcessing = _ref.isProcessing,
38838
+ isProcessing = _ref$isProcessing === void 0 ? false : _ref$isProcessing;
38783
38839
  var _useState = useState('card'),
38784
38840
  selected = _useState[0],
38785
38841
  setSelected = _useState[1];
@@ -38793,6 +38849,7 @@ var PaymentMethodModal = function PaymentMethodModal(_ref) {
38793
38849
  e.stopPropagation();
38794
38850
  }, []);
38795
38851
  var handleConfirm = useCallback(function () {
38852
+ if (isProcessing) return;
38796
38853
  if (selected === 'dc' && !dcDisabled) {
38797
38854
  onPayWithDC();
38798
38855
  } else if (selected === 'pix') {
@@ -38800,7 +38857,10 @@ var PaymentMethodModal = function PaymentMethodModal(_ref) {
38800
38857
  } else {
38801
38858
  onPayWithCard();
38802
38859
  }
38803
- }, [selected, dcDisabled, onPayWithDC, onPayWithCard, onPayWithPix]);
38860
+ }, [selected, dcDisabled, isProcessing, onPayWithDC, onPayWithCard, onPayWithPix]);
38861
+ var handleClose = useCallback(function () {
38862
+ if (!isProcessing) onClose();
38863
+ }, [isProcessing, onClose]);
38804
38864
  var dcSubText = dcRequired !== undefined ? React.createElement(React.Fragment, null, React.createElement(MMORPGNumber, {
38805
38865
  value: dcBalance
38806
38866
  }), " DC available \xB7", ' ', React.createElement(MMORPGNumber, {
@@ -38809,40 +38869,44 @@ var PaymentMethodModal = function PaymentMethodModal(_ref) {
38809
38869
  value: dcBalance
38810
38870
  }), " DC available");
38811
38871
  return React.createElement(ModalPortal, null, React.createElement(Overlay$b, {
38812
- onPointerDown: onClose
38872
+ onPointerDown: handleClose
38813
38873
  }), React.createElement(ModalContainer$8, null, React.createElement(ModalContent$8, {
38814
38874
  onClick: stopPropagation,
38815
38875
  onTouchStart: stopPropagation,
38816
38876
  onPointerDown: stopPropagation
38817
38877
  }, React.createElement(Header$i, null, React.createElement(Title$p, null, "How would you like to pay?"), React.createElement(CloseButton$j, {
38818
- onPointerDown: onClose,
38819
- "aria-label": "Close"
38878
+ onPointerDown: handleClose,
38879
+ "aria-label": "Close",
38880
+ disabled: isProcessing
38820
38881
  }, React.createElement(Cancel, null))), React.createElement(Options$1, null, React.createElement(RadioOption$2, {
38821
38882
  "$selected": selected === 'card',
38822
- onPointerDown: function onPointerDown() {
38883
+ "$disabled": isProcessing,
38884
+ onPointerDown: isProcessing ? undefined : function () {
38823
38885
  return setSelected('card');
38824
38886
  }
38825
38887
  }, React.createElement(RadioCircle$3, {
38826
38888
  "$selected": selected === 'card'
38827
38889
  }), React.createElement(OptionText$1, null, React.createElement(OptionLabel$2, null, "Credit Card"), React.createElement(OptionSub$1, null, "Stripe secure checkout"))), showPix && React.createElement(RadioOption$2, {
38828
38890
  "$selected": selected === 'pix',
38829
- onPointerDown: function onPointerDown() {
38891
+ "$disabled": isProcessing,
38892
+ onPointerDown: isProcessing ? undefined : function () {
38830
38893
  return setSelected('pix');
38831
38894
  }
38832
38895
  }, React.createElement(RadioCircle$3, {
38833
38896
  "$selected": selected === 'pix'
38834
38897
  }), React.createElement(OptionText$1, null, React.createElement(OptionLabel$2, null, "Pix"), React.createElement(OptionSub$1, null, "Instant payment via Pix"))), React.createElement(RadioOption$2, {
38835
38898
  "$selected": selected === 'dc',
38836
- "$disabled": dcDisabled,
38837
- onPointerDown: dcDisabled ? undefined : function () {
38899
+ "$disabled": dcDisabled || isProcessing,
38900
+ onPointerDown: dcDisabled || isProcessing ? undefined : function () {
38838
38901
  return setSelected('dc');
38839
38902
  }
38840
38903
  }, React.createElement(RadioCircle$3, {
38841
38904
  "$selected": selected === 'dc'
38842
38905
  }), React.createElement(OptionText$1, null, React.createElement(OptionLabel$2, null, "Definya Coin"), React.createElement(OptionSub$1, null, dcSubText)))), React.createElement(ConfirmRow$1, null, React.createElement(Button, {
38843
38906
  buttonType: ButtonTypes.RPGUIButton,
38844
- onPointerDown: handleConfirm
38845
- }, "Confirm")))));
38907
+ onPointerDown: handleConfirm,
38908
+ disabled: isProcessing
38909
+ }, isProcessing ? 'Processing...' : 'Confirm')))));
38846
38910
  };
38847
38911
  var Overlay$b = /*#__PURE__*/styled.div.withConfig({
38848
38912
  displayName: "PaymentMethodModal__Overlay",