decentraland-dapps 12.49.0 → 12.52.0
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.
- package/dist/modules/analytics/sagas.js +1 -0
- package/dist/modules/analytics/sagas.js.map +1 -1
- package/dist/modules/analytics/utils.d.ts +1 -1
- package/dist/modules/analytics/utils.js.map +1 -1
- package/dist/modules/features/actions.d.ts +18 -0
- package/dist/modules/features/actions.js +18 -0
- package/dist/modules/features/actions.js.map +1 -0
- package/dist/modules/features/reducer.d.ts +11 -0
- package/dist/modules/features/reducer.js +29 -0
- package/dist/modules/features/reducer.js.map +1 -0
- package/dist/modules/features/sagas.d.ts +11 -0
- package/dist/modules/features/sagas.js +47 -0
- package/dist/modules/features/sagas.js.map +1 -0
- package/dist/modules/features/selectors.d.ts +23 -0
- package/dist/modules/features/selectors.js +46 -0
- package/dist/modules/features/selectors.js.map +1 -0
- package/dist/modules/features/types.d.ts +35 -0
- package/dist/modules/features/types.js +15 -0
- package/dist/modules/features/types.js.map +1 -0
- package/dist/modules/features/utils.d.ts +2 -0
- package/dist/modules/features/utils.js +32 -0
- package/dist/modules/features/utils.js.map +1 -0
- package/package.json +4 -4
|
@@ -24,6 +24,7 @@ function handleConnectWalletSuccess(action) {
|
|
|
24
24
|
// Not using the add function from utils to track the action automatically because
|
|
25
25
|
// the analytics middleware will call this before the identify.
|
|
26
26
|
utils_1.trackConnectWallet({
|
|
27
|
+
address: wallet.address,
|
|
27
28
|
providerType: wallet.providerType
|
|
28
29
|
});
|
|
29
30
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sagas.js","sourceRoot":"","sources":["../../../src/modules/analytics/sagas.ts"],"names":[],"mappings":";;;AAAA,gDAAsE;AACtE,mCAA0D;AAC1D,+CAG0B;AAM1B,SAAgB,mBAAmB,CACjC,UAAgC;IAC9B,eAAe,EAAE,0BAA0B;CAC5C;IAED,MAAM,EAAE,eAAe,EAAE,GAAG,OAAO,C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;IACpE,MAAM,EAAE,MAAM,EAAE,GAAG,MAAM,CAAC,OAAO,CAAA;IACjC,MAAM,SAAS,GAAG,oBAAY,EAAE,CAAA;IAEhC,IAAI,SAAS,EAAE;QACb,6CAA6C;QAC7C,SAAS,CAAC,QAAQ,CAAC,EAAE,UAAU,EAAE,MAAM,CAAC,OAAO,EAAE,CAAC,CAAA;QAElD,gCAAgC;QAChC,kFAAkF;QAClF,+DAA+D;QAC/D,0BAAkB,CAAC;YACjB,OAAO,EAAE,MAAM,CAAC,OAAO;YACvB,YAAY,EAAE,MAAM,CAAC,YAAY;SAClC,CAAC,CAAA;KACH;AACH,CAAC;AAED,cAAc;AACd,SAAS,oBAAoB;IAC3B,MAAM,SAAS,GAAG,oBAAY,EAAE,CAAA;IAEhC,IAAI,SAAS,EAAE;QACb,SAAS,CAAC,IAAI,EAAE,CAAA;KACjB;AACH,CAAC"}
|
|
@@ -16,4 +16,4 @@ export declare function configure(params: {
|
|
|
16
16
|
* Useful function for when you are not integrating the analytics module into your project
|
|
17
17
|
* and want to manually track this event the same way as if the saga was integrated.
|
|
18
18
|
*/
|
|
19
|
-
export declare function trackConnectWallet(props: Pick<Wallet, 'providerType'>): void;
|
|
19
|
+
export declare function trackConnectWallet(props: Pick<Wallet, 'address' | 'providerType'>): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/modules/analytics/utils.ts"],"names":[],"mappings":";;;AAWa,QAAA,cAAc,GAAuC,EAAE,CAAA;AAEpE,IAAI,gBAAgB,GAA4B,IAAI,CAAA;AAEpD,SAAgB,GAAG,CACjB,UAAsB,EACtB,SAAqB,EACrB,UAAuB;IAEvB,IAAI,UAAU,IAAI,sBAAc,EAAE;QAChC,OAAO,CAAC,IAAI,CACV,+BAA+B,UAAU,6BAA6B,CACvE,CAAA;QACD,OAAM;KACP;IACD,sBAAc,CAAC,UAAU,CAAC,GAAG,EAAE,UAAU,EAAE,SAAS,EAAE,U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;AA1BD,sBA0BC;AAED,SAAgB,WAAW,CAAC,MAAiB;IAC3C,IAAI,MAAM,IAAI,MAAM,CAAC,IAAI,EAAE;QACzB,OAAO,MAAM,CAAC,IAAI,IAAI,sBAAc,CAAA;KACrC;IACD,OAAO,CAAC,IAAI,CAAC,8BAA8B,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,GAAG,CAAC,CAAA;IACrE,OAAO,KAAK,CAAA;AACd,CAAC;AAND,kCAMC;AAED,SAAgB,YAAY;IAC1B,OAAQ,MAA0B,CAAC,SAAS,CAAA;AAC9C,CAAC;AAFD,oCAEC;AAED,SAAgB,SAAS,CAAC,MAA+C;IACvE,IAAI,MAAM,CAAC,gBAAgB,EAAE;QAC3B,gBAAgB,GAAG,MAAM,CAAC,gBAAgB,CAAA;KAC3C;AACH,CAAC;AAJD,8BAIC;AAED;;;GAGG;AACH,SAAgB,kBAAkB,CAChC,KAA+C;IAE/C,MAAM,SAAS,GAAG,YAAY,EAAE,CAAA;IAEhC,IAAI,SAAS,EAAE;QACb,SAAS,CAAC,KAAK,CAAC,gBAAgB,EAAE,KAAK,CAAC,CAAA;KACzC;AACH,CAAC;AARD,gDAQC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { ApplicationName, ApplicationFeatures } from './types';
|
|
2
|
+
export declare const FETCH_APPLICATION_FEATURES_REQUEST = "[Request] Fetch application features";
|
|
3
|
+
export declare const FETCH_APPLICATION_FEATURES_SUCCESS = "[Success] Fetch application features";
|
|
4
|
+
export declare const FETCH_APPLICATION_FEATURES_FAILURE = "[Failure] Fetch application features";
|
|
5
|
+
export declare const fetchApplicationFeaturesRequest: (apps: ApplicationName[]) => import("typesafe-actions/dist/types").PayloadAction<"[Request] Fetch application features", {
|
|
6
|
+
apps: ApplicationName[];
|
|
7
|
+
}>;
|
|
8
|
+
export declare const fetchApplicationFeaturesSuccess: (apps: ApplicationName[], features: Record<ApplicationName, ApplicationFeatures>) => import("typesafe-actions/dist/types").PayloadAction<"[Success] Fetch application features", {
|
|
9
|
+
apps: ApplicationName[];
|
|
10
|
+
features: Record<ApplicationName, ApplicationFeatures>;
|
|
11
|
+
}>;
|
|
12
|
+
export declare const fetchApplicationFeaturesFailure: (apps: ApplicationName[], error: string) => import("typesafe-actions/dist/types").PayloadAction<"[Failure] Fetch application features", {
|
|
13
|
+
apps: ApplicationName[];
|
|
14
|
+
error: string;
|
|
15
|
+
}>;
|
|
16
|
+
export declare type FetchApplicationFeaturesRequestAction = ReturnType<typeof fetchApplicationFeaturesRequest>;
|
|
17
|
+
export declare type FetchApplicationFeaturesSuccessAction = ReturnType<typeof fetchApplicationFeaturesSuccess>;
|
|
18
|
+
export declare type FetchApplicationFeaturesFailureAction = ReturnType<typeof fetchApplicationFeaturesFailure>;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.fetchApplicationFeaturesFailure = exports.fetchApplicationFeaturesSuccess = exports.fetchApplicationFeaturesRequest = exports.FETCH_APPLICATION_FEATURES_FAILURE = exports.FETCH_APPLICATION_FEATURES_SUCCESS = exports.FETCH_APPLICATION_FEATURES_REQUEST = void 0;
|
|
4
|
+
const typesafe_actions_1 = require("typesafe-actions");
|
|
5
|
+
// Fetch all application features
|
|
6
|
+
exports.FETCH_APPLICATION_FEATURES_REQUEST = '[Request] Fetch application features';
|
|
7
|
+
exports.FETCH_APPLICATION_FEATURES_SUCCESS = '[Success] Fetch application features';
|
|
8
|
+
exports.FETCH_APPLICATION_FEATURES_FAILURE = '[Failure] Fetch application features';
|
|
9
|
+
const fetchApplicationFeaturesRequest = (apps) => typesafe_actions_1.action(exports.FETCH_APPLICATION_FEATURES_REQUEST, { apps });
|
|
10
|
+
exports.fetchApplicationFeaturesRequest = fetchApplicationFeaturesRequest;
|
|
11
|
+
const fetchApplicationFeaturesSuccess = (apps, features) => typesafe_actions_1.action(exports.FETCH_APPLICATION_FEATURES_SUCCESS, {
|
|
12
|
+
apps,
|
|
13
|
+
features
|
|
14
|
+
});
|
|
15
|
+
exports.fetchApplicationFeaturesSuccess = fetchApplicationFeaturesSuccess;
|
|
16
|
+
const fetchApplicationFeaturesFailure = (apps, error) => typesafe_actions_1.action(exports.FETCH_APPLICATION_FEATURES_FAILURE, { apps, error });
|
|
17
|
+
exports.fetchApplicationFeaturesFailure = fetchApplicationFeaturesFailure;
|
|
18
|
+
//# sourceMappingURL=actions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"actions.js","sourceRoot":"","sources":["../../../src/modules/features/actions.ts"],"names":[],"mappings":";;;AAAA,uDAAyC;AAGzC,iCAAiC;AAEpB,QAAA,kCAAkC,GAC7C,sCAAsC,CAAA;AAE3B,QAAA,kCAAkC,GAC7C,sCAAsC,CAAA;AAE3B,QAAA,kCAAkC,GAC7C,sCAAsC,CAAA;AAEjC,MAAM,+BAA+B,GAAG,CAAC,IAAuB,EAAE,EAAE,CACzE,yBAAM,CAAC,0CAAkC,EAAE,EAAE,IAAI,EAAE,CAAC,CAAA;AADzC,QAAA,+BAA+B,mCACU;AAE/C,MAAM,+BAA+B,GAAG,CAC7C,IAAuB,EACvB,QAAsD,EACtD,EAAE,CACF,yBAAM,CAAC,0CAAkC,EAAE;IACzC,IAAI;IACJ,QAAQ;CACT,CAAC,CAAA;AAPS,QAAA,+BAA+B,mCAOxC;AAEG,MAAM,+BAA+B,GAAG,CAC7C,IAAuB,EACvB,KAAa,EACb,EAAE,CAAC,yBAAM,CAAC,0CAAkC,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,CAAA;AAHnD,QAAA,+BAA+B,mCAGoB"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { LoadingState } from '../loading/reducer';
|
|
2
|
+
import { FetchApplicationFeaturesFailureAction, FetchApplicationFeaturesRequestAction, FetchApplicationFeaturesSuccessAction } from './actions';
|
|
3
|
+
import { ApplicationFeatures } from './types';
|
|
4
|
+
export declare type FeaturesState = {
|
|
5
|
+
data: Record<string, ApplicationFeatures>;
|
|
6
|
+
loading: LoadingState;
|
|
7
|
+
error: string | null;
|
|
8
|
+
};
|
|
9
|
+
export declare const INITIAL_STATE: FeaturesState;
|
|
10
|
+
export declare type FeaturesReducerAction = FetchApplicationFeaturesRequestAction | FetchApplicationFeaturesSuccessAction | FetchApplicationFeaturesFailureAction;
|
|
11
|
+
export declare const featuresReducer: (state: FeaturesState | undefined, action: FeaturesReducerAction) => FeaturesState;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.featuresReducer = exports.INITIAL_STATE = void 0;
|
|
4
|
+
const reducer_1 = require("../loading/reducer");
|
|
5
|
+
const actions_1 = require("./actions");
|
|
6
|
+
exports.INITIAL_STATE = {
|
|
7
|
+
data: {},
|
|
8
|
+
loading: [],
|
|
9
|
+
error: null
|
|
10
|
+
};
|
|
11
|
+
const featuresReducer = (state = exports.INITIAL_STATE, action) => {
|
|
12
|
+
switch (action.type) {
|
|
13
|
+
case actions_1.FETCH_APPLICATION_FEATURES_REQUEST: {
|
|
14
|
+
return Object.assign(Object.assign({}, state), { loading: reducer_1.loadingReducer(state.loading, action), error: null });
|
|
15
|
+
}
|
|
16
|
+
case actions_1.FETCH_APPLICATION_FEATURES_SUCCESS: {
|
|
17
|
+
const { features } = action.payload;
|
|
18
|
+
return Object.assign(Object.assign({}, state), { loading: reducer_1.loadingReducer(state.loading, action), data: features });
|
|
19
|
+
}
|
|
20
|
+
case actions_1.FETCH_APPLICATION_FEATURES_FAILURE: {
|
|
21
|
+
const { error } = action.payload;
|
|
22
|
+
return Object.assign(Object.assign({}, state), { loading: reducer_1.loadingReducer(state.loading, action), error });
|
|
23
|
+
}
|
|
24
|
+
default:
|
|
25
|
+
return state;
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
exports.featuresReducer = featuresReducer;
|
|
29
|
+
//# sourceMappingURL=reducer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reducer.js","sourceRoot":"","sources":["../../../src/modules/features/reducer.ts"],"names":[],"mappings":";;;AAAA,gDAAiE;AACjE,uCAOkB;AASL,QAAA,aAAa,GAAkB;IAC1C,IAAI,EAAE,EAAE;IACR,OAAO,EAAE,EAAE;IACX,KAAK,EAAE,IAAI;CACZ,CAAA;AAOM,MAAM,eAAe,GAAG,CAC7B,KAAK,GAAG,qBAAa,EACrB,MAA6B,EACd,EAAE;IACjB,QAAQ,MAAM,CAAC,IAAI,EAAE;QACnB,KAAK,4CAAkC,CAAC,CAAC;YACvC,uCACK,KAAK,KACR,OAAO,EAAE,wBAAc,CAAC,KAAK,CAAC,OAAO,EAAE,MAAM,CAAC,EAC9C,KAAK,EAAE,IAAI,IACZ;SACF;QACD,KAAK,4CAAkC,CAAC,CAAC;YACvC,MAAM,EAAE,QAAQ,EAAE,GAAG,MAAM,CAAC,OAAO,CAAA;YAEnC,uCACK,KAAK,KACR,OAAO,EAAE,wBAAc,CAAC,KAAK,CAAC,OAAO,EAAE,MAAM,CAAC,EAC9C,IAAI,EAAE,QAAQ,IACf;SACF;QACD,KAAK,4CAAkC,CAAC,CAAC;YACvC,MAAM,EAAE,KAAK,EAAE,GAAG,MAAM,CAAC,OAAO,CAAA;YAChC,uCACK,KAAK,KACR,OAAO,EAAE,wBAAc,CAAC,KAAK,CAAC,OAAO,EAAE,MAAM,CAAC,EAC9C,KAAK,IACN;SACF;QACD;YACE,OAAO,KAAK,CAAA;KACf;AACH,CAAC,CAAA;AAhCY,QAAA,eAAe,mBAgC3B"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { ApplicationName, FeatureSagasConfig, Polling } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Include this saga to be able to fetch feature flags for different applications.
|
|
4
|
+
* By providing the polling object in the config, this saga will take care of polling every
|
|
5
|
+
* certain amount of time the feature flags for the defined applications.
|
|
6
|
+
* @param config Configuration for the saga
|
|
7
|
+
*/
|
|
8
|
+
export declare function featuresSaga(config: FeatureSagasConfig): Generator<import("redux-saga/effects").ForkEffect<never>, void, unknown>;
|
|
9
|
+
export declare const getFetchApplicationFeaturesIntervalGenerator: (polling: Polling) => () => Generator<import("redux-saga/effects").PutEffect<import("typesafe-actions/dist/types").PayloadAction<"[Request] Fetch application features", {
|
|
10
|
+
apps: ApplicationName[];
|
|
11
|
+
}>> | import("redux-saga/effects").RaceEffect<import("redux-saga/effects").TakeEffect> | import("redux-saga/effects").CallEffect<true>, never, unknown>;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getFetchApplicationFeaturesIntervalGenerator = exports.featuresSaga = void 0;
|
|
4
|
+
const effects_1 = require("redux-saga/effects");
|
|
5
|
+
const actions_1 = require("./actions");
|
|
6
|
+
const utils_1 = require("./utils");
|
|
7
|
+
/**
|
|
8
|
+
* Include this saga to be able to fetch feature flags for different applications.
|
|
9
|
+
* By providing the polling object in the config, this saga will take care of polling every
|
|
10
|
+
* certain amount of time the feature flags for the defined applications.
|
|
11
|
+
* @param config Configuration for the saga
|
|
12
|
+
*/
|
|
13
|
+
function* featuresSaga(config) {
|
|
14
|
+
const { polling } = config;
|
|
15
|
+
yield effects_1.takeEvery(actions_1.FETCH_APPLICATION_FEATURES_REQUEST, handleFetchApplicationFeaturesRequest);
|
|
16
|
+
if (polling) {
|
|
17
|
+
yield effects_1.spawn(exports.getFetchApplicationFeaturesIntervalGenerator(polling));
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
exports.featuresSaga = featuresSaga;
|
|
21
|
+
function* handleFetchApplicationFeaturesRequest(action) {
|
|
22
|
+
const { apps } = action.payload;
|
|
23
|
+
try {
|
|
24
|
+
const features = yield effects_1.call(utils_1.fetchApplicationFeatures, apps);
|
|
25
|
+
yield effects_1.put(actions_1.fetchApplicationFeaturesSuccess(apps, features));
|
|
26
|
+
}
|
|
27
|
+
catch (e) {
|
|
28
|
+
yield effects_1.put(actions_1.fetchApplicationFeaturesFailure(apps, e.message));
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
const getFetchApplicationFeaturesIntervalGenerator = (polling) => {
|
|
32
|
+
return function* () {
|
|
33
|
+
while (true) {
|
|
34
|
+
// Fetch application features for the configured applications.
|
|
35
|
+
yield effects_1.put(actions_1.fetchApplicationFeaturesRequest(polling.apps));
|
|
36
|
+
// Wait for the request to finish so there is no request overlap.
|
|
37
|
+
yield effects_1.race({
|
|
38
|
+
success: effects_1.take(actions_1.FETCH_APPLICATION_FEATURES_SUCCESS),
|
|
39
|
+
failure: effects_1.take(actions_1.FETCH_APPLICATION_FEATURES_FAILURE)
|
|
40
|
+
});
|
|
41
|
+
// Wait for a certain amount of time before making the next request.
|
|
42
|
+
yield effects_1.delay(polling.delay);
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
};
|
|
46
|
+
exports.getFetchApplicationFeaturesIntervalGenerator = getFetchApplicationFeaturesIntervalGenerator;
|
|
47
|
+
//# sourceMappingURL=sagas.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sagas.js","sourceRoot":"","sources":["../../../src/modules/features/sagas.ts"],"names":[],"mappings":";;;AAAA,gDAQ2B;AAC3B,uCAQkB;AAOlB,mCAAkD;AAElD;;;;;GAKG;AACH,QAAe,CAAC,CAAC,YAAY,CAAC,MAA0B;IACtD,MAAM,EAAE,OAAO,EAAE,GAAG,MAAM,CAAA;IAE1B,MAAM,mBAAS,CACb,4CAAkC,EAClC,qCAAqC,CACtC,CAAA;IAED,IAAI,OAAO,EAAE;QACX,MAAM,eAAK,CAAC,oDAA4C,CAAC,OAAO,CAAC,CAAC,CAAA;KACnE;AACH,CAAC;AAXD,oCAWC;AAED,QAAQ,CAAC,CAAC,qCAAqC,CAC7C,MAA6C;IAE7C,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,CAAC,OAAO,CAAA;IAE/B,IAAI;QACF,MAAM,QAAQ,GAAiD,MAAM,cAAI,CACvE,gCAAwB,EACxB,IAAI,CACL,CAAA;QAED,MAAM,aAAG,CAAC,yCAA+B,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC,CAAA;KAC3D;IAAC,OAAO,CAAC,EAAE;QACV,MAAM,aAAG,CAAC,yCAA+B,CAAC,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,CAAC,CAAA;KAC5D;AACH,CAAC;AAEM,MAAM,4CAA4C,GAAG,CAC1D,OAAgB,EAChB,EAAE;IACF,OAAO,QAAQ,CAAC;QACd,OAAO,IAAI,EAAE;YACX,8DAA8D;YAC9D,MAAM,aAAG,CAAC,yCAA+B,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAA;YACxD,iEAAiE;YACjE,MAAM,cAAI,CAAC;gBACT,OAAO,EAAE,cAAI,CAAC,4CAAkC,CAAC;gBACjD,OAAO,EAAE,cAAI,CAAC,4CAAkC,CAAC;aAClD,CAAC,CAAA;YACF,oEAAoE;YACpE,MAAM,eAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAA;SAC3B;IACH,CAAC,CAAA;AACH,CAAC,CAAA;AAhBY,QAAA,4CAA4C,gDAgBxD"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { LoadingState } from '../loading/reducer';
|
|
2
|
+
import { FeaturesState } from './reducer';
|
|
3
|
+
import { ApplicationName, ApplicationFeatures, StateWithFeatures } from './types';
|
|
4
|
+
export declare const getState: (state: StateWithFeatures) => FeaturesState;
|
|
5
|
+
export declare const getData: (state: StateWithFeatures) => Record<ApplicationName, ApplicationFeatures>;
|
|
6
|
+
export declare const getLoading: (state: StateWithFeatures) => LoadingState;
|
|
7
|
+
export declare const getError: (state: StateWithFeatures) => string | null;
|
|
8
|
+
/**
|
|
9
|
+
* Helper to get whether a feature flag is enabled or disabled.
|
|
10
|
+
* It will first look into your env file for the feature flag, if it is not defined there,
|
|
11
|
+
* it will look it in the requested and stored features data.
|
|
12
|
+
* The env key will be determined from the application and the flag. For example, if the
|
|
13
|
+
* application is "explorer" and the flag is "some-crazy-feature", it will look
|
|
14
|
+
* for it as REACT_APP_FF_EXPLORER_SOME_CRAZY_FEATURE.
|
|
15
|
+
*
|
|
16
|
+
* @param state Redux state of the application.
|
|
17
|
+
* @param app Appplication name.
|
|
18
|
+
* @param feature Feature key without the application name prefix. For example for the "builder-feature".
|
|
19
|
+
* You need to provide only "feature"
|
|
20
|
+
*
|
|
21
|
+
* @returns Whether the feature is enabled or not.
|
|
22
|
+
*/
|
|
23
|
+
export declare const getIsFeatureEnabled: (state: StateWithFeatures, app: ApplicationName, feature: string) => boolean;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getIsFeatureEnabled = exports.getError = exports.getLoading = exports.getData = exports.getState = void 0;
|
|
4
|
+
const getState = (state) => state.features;
|
|
5
|
+
exports.getState = getState;
|
|
6
|
+
const getData = (state) => exports.getState(state).data;
|
|
7
|
+
exports.getData = getData;
|
|
8
|
+
const getLoading = (state) => exports.getState(state).loading;
|
|
9
|
+
exports.getLoading = getLoading;
|
|
10
|
+
const getError = (state) => exports.getState(state).error;
|
|
11
|
+
exports.getError = getError;
|
|
12
|
+
/**
|
|
13
|
+
* Helper to get whether a feature flag is enabled or disabled.
|
|
14
|
+
* It will first look into your env file for the feature flag, if it is not defined there,
|
|
15
|
+
* it will look it in the requested and stored features data.
|
|
16
|
+
* The env key will be determined from the application and the flag. For example, if the
|
|
17
|
+
* application is "explorer" and the flag is "some-crazy-feature", it will look
|
|
18
|
+
* for it as REACT_APP_FF_EXPLORER_SOME_CRAZY_FEATURE.
|
|
19
|
+
*
|
|
20
|
+
* @param state Redux state of the application.
|
|
21
|
+
* @param app Appplication name.
|
|
22
|
+
* @param feature Feature key without the application name prefix. For example for the "builder-feature".
|
|
23
|
+
* You need to provide only "feature"
|
|
24
|
+
*
|
|
25
|
+
* @returns Whether the feature is enabled or not.
|
|
26
|
+
*/
|
|
27
|
+
const getIsFeatureEnabled = (state, app, feature) => {
|
|
28
|
+
const envValue = getFromEnv(app, feature);
|
|
29
|
+
if (envValue !== null) {
|
|
30
|
+
return envValue;
|
|
31
|
+
}
|
|
32
|
+
const features = exports.getData(state);
|
|
33
|
+
const appFeatures = features[app];
|
|
34
|
+
if (!appFeatures) {
|
|
35
|
+
throw new Error(`Application "${app}" not found`);
|
|
36
|
+
}
|
|
37
|
+
return !!appFeatures.flags[`${app}-${feature}`];
|
|
38
|
+
};
|
|
39
|
+
exports.getIsFeatureEnabled = getIsFeatureEnabled;
|
|
40
|
+
const getFromEnv = (application, flag) => {
|
|
41
|
+
const envify = (word) => word.toUpperCase().replace('-', '_');
|
|
42
|
+
const key = `REACT_APP_FF_${envify(application)}_${envify(flag)}`;
|
|
43
|
+
const value = process.env[key];
|
|
44
|
+
return !value || value === '' ? null : value === '1' ? true : false;
|
|
45
|
+
};
|
|
46
|
+
//# sourceMappingURL=selectors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"selectors.js","sourceRoot":"","sources":["../../../src/modules/features/selectors.ts"],"names":[],"mappings":";;;AAQO,MAAM,QAAQ,GAAG,CAAC,KAAwB,EAAiB,EAAE,CAClE,KAAK,CAAC,QAAS,CAAA;AADJ,QAAA,QAAQ,YACJ;AAEV,MAAM,OAAO,GAAG,CACrB,KAAwB,EACsB,EAAE,CAAC,gBAAQ,CAAC,KAAK,CAAC,CAAC,IAAI,CAAA;AAF1D,QAAA,OAAO,WAEmD;AAEhE,MAAM,UAAU,GAAG,CAAC,KAAwB,EAAgB,EAAE,CACnE,gBAAQ,CAAC,KAAK,CAAC,CAAC,OAAO,CAAA;AADZ,QAAA,UAAU,cACE;AAElB,MAAM,QAAQ,GAAG,CAAC,KAAwB,EAAiB,EAAE,C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+
import { FeaturesState } from './reducer';
|
|
2
|
+
export declare type Payload = {
|
|
3
|
+
type: string;
|
|
4
|
+
value: string;
|
|
5
|
+
};
|
|
6
|
+
export declare type Variant = {
|
|
7
|
+
name: string;
|
|
8
|
+
payload: Payload;
|
|
9
|
+
enabled: boolean;
|
|
10
|
+
};
|
|
11
|
+
export declare type ApplicationFeatures = {
|
|
12
|
+
name: ApplicationName;
|
|
13
|
+
flags: Record<string, boolean>;
|
|
14
|
+
variants: Record<string, Variant>;
|
|
15
|
+
};
|
|
16
|
+
export declare enum ApplicationName {
|
|
17
|
+
EXPLORER = "explorer",
|
|
18
|
+
BUILDER = "builder",
|
|
19
|
+
MARKETPLACE = "marketplace",
|
|
20
|
+
ACCOUNT = "account",
|
|
21
|
+
DAO = "dao",
|
|
22
|
+
EVENTS = "events",
|
|
23
|
+
LANDING = "landing",
|
|
24
|
+
TEST = "test"
|
|
25
|
+
}
|
|
26
|
+
export declare type Polling = {
|
|
27
|
+
apps: ApplicationName[];
|
|
28
|
+
delay: number;
|
|
29
|
+
};
|
|
30
|
+
export declare type FeatureSagasConfig = {
|
|
31
|
+
polling?: Polling;
|
|
32
|
+
};
|
|
33
|
+
export declare type StateWithFeatures = {
|
|
34
|
+
features: FeaturesState;
|
|
35
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ApplicationName = void 0;
|
|
4
|
+
var ApplicationName;
|
|
5
|
+
(function (ApplicationName) {
|
|
6
|
+
ApplicationName["EXPLORER"] = "explorer";
|
|
7
|
+
ApplicationName["BUILDER"] = "builder";
|
|
8
|
+
ApplicationName["MARKETPLACE"] = "marketplace";
|
|
9
|
+
ApplicationName["ACCOUNT"] = "account";
|
|
10
|
+
ApplicationName["DAO"] = "dao";
|
|
11
|
+
ApplicationName["EVENTS"] = "events";
|
|
12
|
+
ApplicationName["LANDING"] = "landing";
|
|
13
|
+
ApplicationName["TEST"] = "test";
|
|
14
|
+
})(ApplicationName = exports.ApplicationName || (exports.ApplicationName = {}));
|
|
15
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/modules/features/types.ts"],"names":[],"mappings":";;;AAmBA,IAAY,eASX;AATD,WAAY,eAAe;IACzB,wCAAqB,CAAA;IACrB,sCAAmB,CAAA;IACnB,8CAA2B,CAAA;IAC3B,sCAAmB,CAAA;IACnB,8BAAW,CAAA;IACX,oCAAiB,CAAA;IACjB,sCAAmB,CAAA;IACnB,gCAAa,CAAA;AACf,CAAC,EATW,eAAe,GAAf,uBAAe,KAAf,uBAAe,QAS1B"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.fetchApplicationFeatures = void 0;
|
|
13
|
+
const fetchApplicationFeatures = (apps) => __awaiter(void 0, void 0, void 0, function* () {
|
|
14
|
+
const promises = apps.map(a => fetchSingleApplicationFeatures(a));
|
|
15
|
+
const features = yield Promise.all(promises);
|
|
16
|
+
return features.reduce((acc, feature) => {
|
|
17
|
+
acc[feature.name] = feature;
|
|
18
|
+
return acc;
|
|
19
|
+
}, {});
|
|
20
|
+
});
|
|
21
|
+
exports.fetchApplicationFeatures = fetchApplicationFeatures;
|
|
22
|
+
const fetchSingleApplicationFeatures = (app) => __awaiter(void 0, void 0, void 0, function* () {
|
|
23
|
+
const url = `https://feature-flags.decentraland.org/${app}.json`;
|
|
24
|
+
const response = yield fetch(url);
|
|
25
|
+
const json = yield response.json();
|
|
26
|
+
return {
|
|
27
|
+
name: app,
|
|
28
|
+
flags: json.flags,
|
|
29
|
+
variants: json.variants
|
|
30
|
+
};
|
|
31
|
+
});
|
|
32
|
+
//# sourceMappingURL=utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/modules/features/utils.ts"],"names":[],"mappings":";;;;;;;;;;;;AAEO,MAAM,wBAAwB,GAAG,CAAO,IAAuB,EAAE,EAAE;IACxE,MAAM,QAAQ,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,8BAA8B,CAAC,CAAC,CAAC,CAAC,CAAA;IACjE,MAAM,QAAQ,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAA;IAE5C,OAAO,QAAQ,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,OAAO,EAAE,EAAE;QACtC,GAAG,CAAC,OAAO,CAAC,IAAI,CAAC,GAAG,OAAO,CAAA;QAC3B,OAAO,GAAG,CAAA;IACZ,CAAC,EAAE,EAAkD,CAAC,CAAA;AACxD,CAAC,CAAA,CAAA;AARY,QAAA,wBAAwB,4BAQpC;AAED,MAAM,8BAA8B,GAAG,CACrC,GAAoB,EACU,EAAE;IAChC,MAAM,GAAG,GAAG,0CAA0C,GAAG,OAAO,CAAA;IAChE,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,GAAG,CAAC,CAAA;IACjC,MAAM,IAAI,GAAG,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAA;IAElC,OAAO;QACL,IAAI,EAAE,GAAG;QACT,KAAK,EAAE,IAAI,CAAC,KAAK;QACjB,QAAQ,EAAE,IAAI,CAAC,QAAQ;KACxB,CAAA;AACH,CAAC,CAAA,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "decentraland-dapps",
|
|
3
|
-
"version": "12.
|
|
3
|
+
"version": "12.52.0",
|
|
4
4
|
"dependencies": {
|
|
5
5
|
"@0xsequence/multicall": "^0.25.1",
|
|
6
6
|
"@0xsequence/relayer": "^0.25.1",
|
|
@@ -11,9 +11,9 @@
|
|
|
11
11
|
"date-fns": "^1.29.0",
|
|
12
12
|
"dcl-catalyst-client": "^11.3.2",
|
|
13
13
|
"dcl-catalyst-commons": "^8.2.0",
|
|
14
|
-
"decentraland-connect": "^3.
|
|
14
|
+
"decentraland-connect": "^3.3.0",
|
|
15
15
|
"decentraland-transactions": "^1.35.0",
|
|
16
|
-
"decentraland-ui": "^3.
|
|
16
|
+
"decentraland-ui": "^3.37.0",
|
|
17
17
|
"events": "^3.3.0",
|
|
18
18
|
"flat": "^4.1.0",
|
|
19
19
|
"react-intl": "^5.20.7",
|
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
"react-redux": "^7.2.4",
|
|
54
54
|
"redux": "^4.1.0",
|
|
55
55
|
"redux-saga": "^1.1.3",
|
|
56
|
-
"redux-saga-test-plan": "^4.0.
|
|
56
|
+
"redux-saga-test-plan": "^4.0.5",
|
|
57
57
|
"rimraf": "^2.6.3",
|
|
58
58
|
"semantic-release": "^17.3.9",
|
|
59
59
|
"ts-jest": "^27.0.5",
|