@annotation-studio/redux
Advanced tools
Comparing version 1.0.0-next.060662c8 to 1.0.0-next.2022bf79
@@ -42,2 +42,3 @@ import _extends from 'babel-runtime/helpers/extends'; | ||
var path = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : []; | ||
var name = arguments.length > 8 && arguments[8] !== undefined ? arguments[8] : null; | ||
@@ -52,3 +53,3 @@ return function (dispatch, getState) { | ||
// Choose the selector attached to the draft. | ||
dispatch(chooseDraftSelector(scope, id, immutableSelector)); | ||
dispatch(chooseDraftSelector(scope, id, immutableSelector, name)); | ||
}; | ||
@@ -59,2 +60,3 @@ } | ||
var immutableSelector = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null; | ||
var name = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null; | ||
@@ -66,2 +68,3 @@ return function (dispatch, getState) { | ||
dispatch(chooseSelector(currentTemplate.metaData.selector, { | ||
name: name, | ||
template: currentTemplate.id, | ||
@@ -228,3 +231,5 @@ scope: scope, | ||
return { type: DRAFT_UPDATE_FIELD_SELECTOR, payload: { id: id, selectors: (_selectors = {}, _selectors[fieldId] = selectorCompat(selector), _selectors) } }; | ||
var name = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null; | ||
return { type: DRAFT_UPDATE_FIELD_SELECTOR, payload: { id: id, selectors: (_selectors = {}, _selectors[fieldId] = _extends({}, selectorCompat(selector), { name: name }), _selectors) } }; | ||
} | ||
@@ -247,2 +252,4 @@ | ||
export function addSelectorToDraftFieldFromViewer(id, props, fieldId, done) { | ||
var name = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : null; | ||
return withViewer(function (Canvas, dispatch) { | ||
@@ -259,3 +266,3 @@ var topLeft = Canvas.createRelativePoint(props.x, props.y); | ||
}); | ||
dispatch(addSelectorToDraftField(id, selector, fieldId)); | ||
dispatch(addSelectorToDraftField(id, selector, fieldId, name)); | ||
if (done) { | ||
@@ -295,6 +302,8 @@ done(); | ||
export function addSelectorToDraftFromViewer(id, props, done) { | ||
var name = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null; | ||
return withViewer(function (Canvas, dispatch) { | ||
var selector = convertSelectorFromCanvas(Canvas, props); | ||
dispatch(addSelectorToDraft(id, selector)); | ||
dispatch(addSelectorToDraft(id, selector, name)); | ||
if (done) { | ||
@@ -307,5 +316,7 @@ done(); | ||
export function addSelectorToDraft(id, selector) { | ||
var name = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null; | ||
return function (dispatch, getState) { | ||
markDraftAs(id, DRAFT_LIFECYCLE_READ, DRAFT_LIFECYCLE_CHANGED)(dispatch, getState); | ||
dispatch({ type: DRAFT_UPDATE_SELECTOR, payload: { id: id, selector: selectorCompat(selector) } }); | ||
dispatch({ type: DRAFT_UPDATE_SELECTOR, payload: { id: id, selector: _extends({}, selectorCompat(selector), { name: name }) } }); | ||
}; | ||
@@ -312,0 +323,0 @@ } |
@@ -12,3 +12,5 @@ export var MANIFEST_ADD = 'MANIFEST_ADD'; | ||
dispatch({ type: MANIFEST_REQUEST, payload: { url: url } }); | ||
return fetch(url).then(function (response) { | ||
return fetch(url, { | ||
cache: process.env.NODE_ENV === 'production' ? 'default' : 'force-cache' | ||
}).then(function (response) { | ||
return response.json(); | ||
@@ -15,0 +17,0 @@ }).then(function (body) { |
@@ -75,3 +75,3 @@ import _extends from 'babel-runtime/helpers/extends'; | ||
return dispatch({ type: SELECTOR_COMMIT_TO_DRAFT_FIELD }); | ||
})); | ||
}, selector.source.name || null)); | ||
}; | ||
@@ -138,3 +138,3 @@ } | ||
return dispatch({ type: SELECTOR_COMMIT_TO_DRAFT }); | ||
})); | ||
}, selector.source.name || null)); | ||
} else { | ||
@@ -141,0 +141,0 @@ dispatch(addSelectorToDraft(currentDraft.id, selector)); |
@@ -54,3 +54,3 @@ import _extends from 'babel-runtime/helpers/extends'; | ||
Object.keys(currentDraft.selectors).forEach(function (k) { | ||
selectors.push(_extends({}, currentDraft.selectors[k], { id: k, isSecondary: true })); | ||
selectors.push(_extends({}, currentDraft.selectors[k], { id: k, isSecondary: true, name: currentDraft.name })); | ||
}); | ||
@@ -57,0 +57,0 @@ return selectors; |
@@ -105,3 +105,4 @@ import _regeneratorRuntime from 'babel-runtime/regenerator'; | ||
body: JSON.stringify(body), | ||
credentials: 'include', | ||
credentials: process.env.NODE_ENV === 'production' ? 'include' : null, | ||
cache: process.env.NODE_ENV === 'production' ? 'default' : 'force-cache', | ||
redirect: 'follow' | ||
@@ -108,0 +109,0 @@ }).then(function (response) { |
@@ -6,2 +6,10 @@ import _objectWithoutProperties from 'babel-runtime/helpers/objectWithoutProperties'; | ||
export function getResourceById(state, id) { | ||
if (!id) { | ||
console.warn('Capture model has no ID'); | ||
return null; | ||
} | ||
if (!state.resource.list[id]) { | ||
var newId = '/' + id.split('/').slice(3).join('/'); | ||
return state.resource.list[newId]; | ||
} | ||
return state.resource.list[id]; | ||
@@ -8,0 +16,0 @@ } |
@@ -95,2 +95,3 @@ 'use strict'; | ||
var path = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : []; | ||
var name = arguments.length > 8 && arguments[8] !== undefined ? arguments[8] : null; | ||
@@ -105,3 +106,3 @@ return function (dispatch, getState) { | ||
// Choose the selector attached to the draft. | ||
dispatch(chooseDraftSelector(scope, id, immutableSelector)); | ||
dispatch(chooseDraftSelector(scope, id, immutableSelector, name)); | ||
}; | ||
@@ -112,2 +113,3 @@ } | ||
var immutableSelector = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null; | ||
var name = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null; | ||
@@ -119,2 +121,3 @@ return function (dispatch, getState) { | ||
dispatch((0, _selectors2.chooseSelector)(currentTemplate.metaData.selector, { | ||
name: name, | ||
template: currentTemplate.id, | ||
@@ -281,3 +284,5 @@ scope: scope, | ||
return { type: DRAFT_UPDATE_FIELD_SELECTOR, payload: { id: id, selectors: (_selectors = {}, _selectors[fieldId] = (0, _utility.selectorCompat)(selector), _selectors) } }; | ||
var name = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null; | ||
return { type: DRAFT_UPDATE_FIELD_SELECTOR, payload: { id: id, selectors: (_selectors = {}, _selectors[fieldId] = (0, _extends3.default)({}, (0, _utility.selectorCompat)(selector), { name: name }), _selectors) } }; | ||
} | ||
@@ -300,2 +305,4 @@ | ||
function addSelectorToDraftFieldFromViewer(id, props, fieldId, done) { | ||
var name = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : null; | ||
return (0, _viewer.withViewer)(function (Canvas, dispatch) { | ||
@@ -312,3 +319,3 @@ var topLeft = Canvas.createRelativePoint(props.x, props.y); | ||
}); | ||
dispatch(addSelectorToDraftField(id, selector, fieldId)); | ||
dispatch(addSelectorToDraftField(id, selector, fieldId, name)); | ||
if (done) { | ||
@@ -348,6 +355,8 @@ done(); | ||
function addSelectorToDraftFromViewer(id, props, done) { | ||
var name = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null; | ||
return (0, _viewer.withViewer)(function (Canvas, dispatch) { | ||
var selector = convertSelectorFromCanvas(Canvas, props); | ||
dispatch(addSelectorToDraft(id, selector)); | ||
dispatch(addSelectorToDraft(id, selector, name)); | ||
if (done) { | ||
@@ -360,5 +369,7 @@ done(); | ||
function addSelectorToDraft(id, selector) { | ||
var name = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null; | ||
return function (dispatch, getState) { | ||
markDraftAs(id, DRAFT_LIFECYCLE_READ, DRAFT_LIFECYCLE_CHANGED)(dispatch, getState); | ||
dispatch({ type: DRAFT_UPDATE_SELECTOR, payload: { id: id, selector: (0, _utility.selectorCompat)(selector) } }); | ||
dispatch({ type: DRAFT_UPDATE_SELECTOR, payload: { id: id, selector: (0, _extends3.default)({}, (0, _utility.selectorCompat)(selector), { name: name }) } }); | ||
}; | ||
@@ -365,0 +376,0 @@ } |
@@ -20,3 +20,5 @@ 'use strict'; | ||
dispatch({ type: MANIFEST_REQUEST, payload: { url: url } }); | ||
return fetch(url).then(function (response) { | ||
return fetch(url, { | ||
cache: process.env.NODE_ENV === 'production' ? 'default' : 'force-cache' | ||
}).then(function (response) { | ||
return response.json(); | ||
@@ -23,0 +25,0 @@ }).then(function (body) { |
@@ -99,3 +99,3 @@ 'use strict'; | ||
return dispatch({ type: SELECTOR_COMMIT_TO_DRAFT_FIELD }); | ||
})); | ||
}, selector.source.name || null)); | ||
}; | ||
@@ -162,3 +162,3 @@ } | ||
return dispatch({ type: SELECTOR_COMMIT_TO_DRAFT }); | ||
})); | ||
}, selector.source.name || null)); | ||
} else { | ||
@@ -165,0 +165,0 @@ dispatch((0, _drafts.addSelectorToDraft)(currentDraft.id, selector)); |
@@ -78,3 +78,3 @@ 'use strict'; | ||
Object.keys(currentDraft.selectors).forEach(function (k) { | ||
selectors.push((0, _extends3.default)({}, currentDraft.selectors[k], { id: k, isSecondary: true })); | ||
selectors.push((0, _extends3.default)({}, currentDraft.selectors[k], { id: k, isSecondary: true, name: currentDraft.name })); | ||
}); | ||
@@ -81,0 +81,0 @@ return selectors; |
@@ -240,3 +240,4 @@ 'use strict'; | ||
body: JSON.stringify(body), | ||
credentials: 'include', | ||
credentials: process.env.NODE_ENV === 'production' ? 'include' : null, | ||
cache: process.env.NODE_ENV === 'production' ? 'default' : 'force-cache', | ||
redirect: 'follow' | ||
@@ -243,0 +244,0 @@ }).then(function (response) { |
@@ -29,2 +29,10 @@ 'use strict'; | ||
function getResourceById(state, id) { | ||
if (!id) { | ||
console.warn('Capture model has no ID'); | ||
return null; | ||
} | ||
if (!state.resource.list[id]) { | ||
var newId = '/' + id.split('/').slice(3).join('/'); | ||
return state.resource.list[newId]; | ||
} | ||
return state.resource.list[id]; | ||
@@ -31,0 +39,0 @@ } |
{ | ||
"name": "@annotation-studio/redux", | ||
"version": "1.0.0-next.060662c8", | ||
"version": "1.0.0-next.2022bf79", | ||
"description": "Describe annotation-redux here", | ||
@@ -25,2 +25,3 @@ "main": "es/index.js", | ||
"react-intl": "^2.4.0", | ||
"react-intl-redux": "^0.7.0", | ||
"react-redux": "^5.0.3", | ||
@@ -39,3 +40,3 @@ "redux": "^3.6.0", | ||
"devDependencies": { | ||
"@fesk/test-environment": "^1.0.0-next.060662c8", | ||
"@fesk/test-environment": "^1.0.0-next.2022bf79", | ||
"babel-jest": "^20.0.3", | ||
@@ -42,0 +43,0 @@ "babel-plugin-transform-async-to-generator": "^6.24.1", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
328109
8589
13
11
+ Addedreact-intl-redux@^0.7.0