Module 67480

2,413 characters · in no known chunk
Dependencies
Source Raw
function(e,t,n){"use strict";let i;n.d(t,{A:()=>T});var r=n(17928),s=n(228366),a=n(32731),o=n(773669),l=n(760751);let u=new Map,c=new Set,d=new Set,_=new Map,f=new Map,h=new Map;function p(e){var t;let n=_.get(e.id),i=(t=a.A.createFromServer(e),null==n||(null==t.price&&null!=n.price&&(t.price=n.price),0===Object.keys(t.prices).length&&Object.keys(n.prices).length>0&&(t.prices=n.prices),null==t.orbsReward&&null!=n.orbsReward&&(t.orbsReward=n.orbsReward),0===t.eligibleOffers.length&&n.eligibleOffers.length>0&&(t.eligibleOffers=n.eligibleOffers)),t);_.set(e.id,i),c.delete(e.id),d.delete(e.id),e.bundled_sku_ids?.forEach(t=>{u.set(t,e.id)}),f.has(e.application_id)||f.set(e.application_id,new Set),f.get(e.application_id).add(e.id)}function E(e){p(e.sku),null!=e.child_skus&&e.child_skus.forEach(e=>p(e)),null!=e.alternative_skus&&e.alternative_skus.forEach(e=>p(e))}function m(e){let{entitlements:t}=e;for(let e of t)null!=e.sku&&p(e.sku)}function g(){u=new Map,c=new Set,d=new Set,_=new Map,f=new Map,h=new Map}function A(){if(i===o.default.locale)return!1;i=o.default.locale,g()}class I extends r.il{static displayName="SKUStore";initialize(){this.waitFor(o.default,l.A),this.syncWith([o.default],A),i=o.default.locale}get(e){return _.get(e)}getForApplication(e){let t=f.get(e);return null==t?[]:Array.from(t).map(e=>_.get(e))}isFetching(e){return c.has(e)}getFetchingSkuIds(){return[...c.keys()]}getSKUs(){return Object.fromEntries(_)}getParentSKU(e){let t=u.get(e);if(null!=t)return this.get(t)}didFetchingSkuFail(e){return d.has(e)}}let T=new I(s.h,{STORE_LISTINGS_FETCH_START:function(e){let{skuId:t}=e;c.add(t)},STORE_LISTINGS_FETCH_FAIL:function(e){let{skuId:t}=e;c.delete(t),d.add(t)},STORE_LISTINGS_FETCH_SUCCESS:function(e){let{storeListings:t}=e;for(let e of t)E(e)},STORE_LISTING_FETCH_SUCCESS:function(e){let{storeListing:t}=e;E(t)},GIFT_CODE_RESOLVE_SUCCESS:function(e){let{giftCode:t}=e;if(null==t.store_listing)return!1;p(t.store_listing.sku)},SKU_FETCH_START:function(e){let{skuId:t}=e;c.add(t)},SKU_FETCH_SUCCESS:function(e){let{sku:t}=e;p(t)},SKU_FETCH_FAIL:function(e){let{skuId:t}=e;c.delete(t),d.add(t)},SKUS_FETCH_SUCCESS:function(e){let{guildId:t,skus:n}=e;for(let e of n)p(e);null!=t&&h.set(t,new Set(n.map(e=>e.id)))},ENTITLEMENTS_GIFTABLE_FETCH_SUCCESS:m,APPLICATION_STORE_CLEAR_DATA:g,APPLICATION_SUBSCRIPTIONS_FETCH_ENTITLEMENTS_SUCCESS:m,ENTITLEMENTS_FETCH_FOR_USER_SUCCESS:m})}