Skip to content

Commit 15a6b18

Browse files
committed
RTK identity traits
1 parent 5de0b42 commit 15a6b18

39 files changed

+1496
-1333
lines changed

frontend/common/code-help/create-user/create-user-php.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ module.exports = (
77
) => `use Flagsmith\\Flagsmith;
88
99
$flagsmith = new Flagsmith('${envId}'${
10-
Constants.isCustomFlagsmithUrl() && `,\n '${Constants.getFlagsmithSDKUrl()}'\n`
10+
Constants.isCustomFlagsmithUrl() &&
11+
`,\n '${Constants.getFlagsmithSDKUrl()}'\n`
1112
});
1213
1314
// Identify the user

frontend/common/code-help/init/init-dotnet.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,9 @@ module.exports = (
99
static FlagsmithClient _flagsmithClient;
1010
1111
_flagsmithClient = new("${envId}"${
12-
Constants.isCustomFlagsmithUrl() ? `, apiUrl: "${Constants.getFlagsmithSDKUrl()}"` : ''
12+
Constants.isCustomFlagsmithUrl()
13+
? `, apiUrl: "${Constants.getFlagsmithSDKUrl()}"`
14+
: ''
1315
});
1416
1517
var flags = await _flagsmithClient.GetEnvironmentFlags(); # This method triggers a network request

frontend/common/code-help/init/init-js.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,11 @@ module.exports = (
66
) => `import ${LIB_NAME} from "${NPM_CLIENT}"; // Add this line if you're using ${LIB_NAME} via npm
77
88
${LIB_NAME}.init({
9-
environmentID: "${envId}",${Constants.isCustomFlagsmithUrl() ? `\n api: "${Constants.getFlagsmithSDKUrl()}",` : ''}
9+
environmentID: "${envId}",${
10+
Constants.isCustomFlagsmithUrl()
11+
? `\n api: "${Constants.getFlagsmithSDKUrl()}",`
12+
: ''
13+
}
1014
onChange: (oldFlags, params) => { // Occurs whenever flags are changed
1115
// Determines if the update came from the server or local cached storage
1216
const { isFromServer } = params;

frontend/common/code-help/traits/traits-node.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import Constants from 'common/constants'
22

33
module.exports = (
44
envId,
5-
{ FEATURE_NAME, TRAIT_NAME, LIB_NAME, NPM_NODE_CLIENT, USER_ID },
5+
{ FEATURE_NAME, LIB_NAME, NPM_NODE_CLIENT, TRAIT_NAME, USER_ID },
66
userId,
77
) => `import Flagsmith from "${NPM_NODE_CLIENT}"; // Add this line if you're using ${LIB_NAME} via npm
88

frontend/common/code-help/traits/traits-php.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@ import Constants from 'common/constants'
22
module.exports = (envId, { TRAIT_NAME }, userId) => `use Flagsmith\\Flagsmith;
33
44
$flagsmith = new Flagsmith('${envId}'${
5-
Constants.isCustomFlagsmithUrl() && `,\n '${Constants.getFlagsmithSDKUrl()}'\n`
5+
Constants.isCustomFlagsmithUrl() &&
6+
`,\n '${Constants.getFlagsmithSDKUrl()}'\n`
67
});
78
89
$traits = (object) [ '${TRAIT_NAME}' => 42 ];

frontend/common/dispatcher/action-constants.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ const Actions = Object.assign({}, require('./base/_action-constants'), {
99
'CREATE_PROJECT': 'CREATE_PROJECT',
1010
'DELETE_CHANGE_REQUEST': 'DELETE_CHANGE_REQUEST',
1111
'DELETE_ENVIRONMENT': 'DELETE_ENVIRONMENT',
12-
'DELETE_IDENTITY_TRAIT': 'DELETE_IDENTITY_TRAIT',
1312
'DELETE_INVITE': 'DELETE_INVITE',
1413
'DELETE_ORGANISATION': 'DELETE_ORGANISATION',
1514
'DELETE_PROJECT': 'DELETE_PROJECT',
@@ -23,7 +22,6 @@ const Actions = Object.assign({}, require('./base/_action-constants'), {
2322
'EDIT_FEATURE_MV': 'EDIT_FEATURE_MV',
2423
'EDIT_ORGANISATION': 'EDIT_ORGANISATION',
2524
'EDIT_PROJECT': 'EDIT_PROJECT',
26-
'EDIT_TRAIT': 'EDIT_TRAIT',
2725
'EDIT_USER_FLAG': 'EDIT_USER_FLAG',
2826
'ENABLE_TWO_FACTOR': 'ENABLE_TWO_FACTOR',
2927
'GET_CHANGE_REQUEST': 'GET_CHANGE_REQUEST',

frontend/common/dispatcher/app-actions.js

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -70,14 +70,6 @@ const AppActions = Object.assign({}, require('./base/_app-actions'), {
7070
env,
7171
})
7272
},
73-
deleteIdentityTrait(envId, identity, id) {
74-
Dispatcher.handleViewAction({
75-
actionType: Actions.DELETE_IDENTITY_TRAIT,
76-
envId,
77-
id,
78-
identity,
79-
})
80-
},
8173
deleteInvite(id) {
8274
Dispatcher.handleViewAction({
8375
actionType: Actions.DELETE_INVITE,
@@ -188,12 +180,6 @@ const AppActions = Object.assign({}, require('./base/_app-actions'), {
188180
project,
189181
})
190182
},
191-
editTrait(params) {
192-
Dispatcher.handleViewAction({
193-
actionType: Actions.EDIT_TRAIT,
194-
...params,
195-
})
196-
},
197183
editUserFlag(params) {
198184
Dispatcher.handleViewAction({
199185
actionType: Actions.EDIT_USER_FLAG,

frontend/common/providers/IdentityProvider.js

Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ const IdentityProvider = class extends React.Component {
2424
identityFlags: IdentityStore.getIdentityFlags(),
2525
isLoading: IdentityStore.isLoading || FeatureListStore.isLoading,
2626
isSaving: IdentityStore.isSaving,
27-
traits: IdentityStore.getTraits(),
2827
})
2928
})
3029
this.listenTo(FeatureListStore, 'change', () => {
@@ -72,14 +71,6 @@ const IdentityProvider = class extends React.Component {
7271
})
7372
}
7473

75-
editTrait = ({ environmentId, identity, trait }) => {
76-
AppActions.editTrait({ environmentId, identity, trait })
77-
}
78-
79-
createTrait = ({ environmentId, identity, isCreate, trait }) => {
80-
AppActions.editTrait({ environmentId, identity, isCreate, trait })
81-
}
82-
8374
removeFlag = ({ environmentId, identity, identityFlag }) => {
8475
AppActions.removeUserFlag({ environmentId, identity, identityFlag })
8576
}
@@ -94,21 +85,12 @@ const IdentityProvider = class extends React.Component {
9485
}
9586

9687
render() {
97-
const {
98-
changeUserFlag,
99-
createTrait,
100-
editFeatureValue,
101-
editTrait,
102-
removeFlag,
103-
toggleFlag,
104-
} = this
88+
const { changeUserFlag, editFeatureValue, removeFlag, toggleFlag } = this
10589
return this.props.children(
10690
{ ...this.state },
10791
{
10892
changeUserFlag,
109-
createTrait,
11093
editFeatureValue,
111-
editTrait,
11294
removeFlag,
11395
toggleFlag,
11496
},

frontend/common/providers/Permission.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ import { useGetPermissionQuery } from 'common/services/usePermission'
33
import { PermissionLevel } from 'common/types/requests'
44
import AccountStore from 'common/stores/account-store'
55
import intersection from 'lodash/intersection'
6-
import { add } from 'ionicons/icons';
7-
import { cloneDeep } from 'lodash'; // we need this to make JSX compile
6+
import { add } from 'ionicons/icons'
7+
import { cloneDeep } from 'lodash' // we need this to make JSX compile
88

99
type PermissionType = {
1010
id: any

frontend/common/service.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ export const baseApiOptions = (queryArgs?: Partial<FetchBaseQueryArgs>) => {
1616
| 'extractRehydrationInfo'
1717
> = {
1818
baseQuery: fetchBaseQuery({
19-
credentials: Project.cookieAuthEnabled ? 'include' : undefined,
2019
baseUrl: Project.api,
20+
credentials: Project.cookieAuthEnabled ? 'include' : undefined,
2121
prepareHeaders: async (headers, { endpoint, getState }) => {
2222
// eslint-disable-next-line @typescript-eslint/no-unused-vars
2323
const state = getState() as StoreStateType
@@ -33,7 +33,7 @@ export const baseApiOptions = (queryArgs?: Partial<FetchBaseQueryArgs>) => {
3333
if (token && !Project.cookieAuthEnabled) {
3434
headers.set('Authorization', `Token ${token}`)
3535
}
36-
} catch (e) { }
36+
} catch (e) {}
3737
}
3838

3939
return headers

0 commit comments

Comments
 (0)