@sprucelabs/spruce-location-utils 3.0.4 → 3.1.1
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/build/esm/index-module.d.ts +1 -0
- package/build/esm/index-module.js +1 -0
- package/build/esm/renderers/locationRenderer.d.ts +5 -0
- package/build/esm/renderers/locationRenderer.js +8 -0
- package/build/esm/tests/utilities/organizationAssert.d.ts +8 -0
- package/build/esm/tests/utilities/organizationAssert.js +8 -0
- package/build/esm/viewControllers/LocationListCard.vc.js +3 -5
- package/build/index-module.d.ts +1 -0
- package/build/index-module.js +3 -1
- package/build/renderers/locationRenderer.d.ts +5 -0
- package/build/renderers/locationRenderer.js +10 -0
- package/build/tests/utilities/organizationAssert.d.ts +8 -0
- package/build/tests/utilities/organizationAssert.js +8 -0
- package/build/viewControllers/LocationListCard.vc.js +6 -5
- package/package.json +5 -1
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
export { default as organizationAssert } from './tests/utilities/organizationAssert';
|
|
2
2
|
export { default as LocationListCardViewController } from './viewControllers/LocationListCard.vc';
|
|
3
3
|
export * from './types-module';
|
|
4
|
+
export { default as locationRenderer } from './renderers/locationRenderer';
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
export { default as organizationAssert } from './tests/utilities/organizationAssert.js';
|
|
2
2
|
export { default as LocationListCardViewController } from './viewControllers/LocationListCard.vc.js';
|
|
3
3
|
export * from './types-module.js';
|
|
4
|
+
export { default as locationRenderer } from './renderers/locationRenderer.js';
|
|
@@ -1,12 +1,20 @@
|
|
|
1
1
|
import { SkillViewController } from '@sprucelabs/heartwood-view-controllers';
|
|
2
2
|
import { OrganizationFixture, ViewFixture } from '@sprucelabs/spruce-test-fixtures';
|
|
3
3
|
declare const organizationAssert: {
|
|
4
|
+
/**
|
|
5
|
+
*
|
|
6
|
+
* @deprecated use vcAssert.assertSkillViewIsScopedBy(this.vc, 'organization')
|
|
7
|
+
*/
|
|
4
8
|
assertRedirectsToAddOrgIfNoOrgExists(options: {
|
|
5
9
|
views: ViewFixture;
|
|
6
10
|
organizations: OrganizationFixture;
|
|
7
11
|
vc: SkillViewController<any>;
|
|
8
12
|
didAddOrgRedirectDestination: string;
|
|
9
13
|
}): Promise<void>;
|
|
14
|
+
/**
|
|
15
|
+
*
|
|
16
|
+
* @deprecated do not even do this anymore
|
|
17
|
+
*/
|
|
10
18
|
assertDoesNotRedirectToAddAOrgIfOrgExists(options: {
|
|
11
19
|
vc: SkillViewController<any>;
|
|
12
20
|
views: ViewFixture;
|
|
@@ -12,6 +12,10 @@ import { assertOptions } from '@sprucelabs/schema';
|
|
|
12
12
|
import { TestRouter, } from '@sprucelabs/spruce-test-fixtures';
|
|
13
13
|
import { assert } from '@sprucelabs/test';
|
|
14
14
|
const organizationAssert = {
|
|
15
|
+
/**
|
|
16
|
+
*
|
|
17
|
+
* @deprecated use vcAssert.assertSkillViewIsScopedBy(this.vc, 'organization')
|
|
18
|
+
*/
|
|
15
19
|
assertRedirectsToAddOrgIfNoOrgExists(options) {
|
|
16
20
|
return __awaiter(this, void 0, void 0, function* () {
|
|
17
21
|
assertOptions(options, [
|
|
@@ -39,6 +43,10 @@ const organizationAssert = {
|
|
|
39
43
|
TestRouter.setShouldThrowWhenRedirectingToBadSvc(true);
|
|
40
44
|
});
|
|
41
45
|
},
|
|
46
|
+
/**
|
|
47
|
+
*
|
|
48
|
+
* @deprecated do not even do this anymore
|
|
49
|
+
*/
|
|
42
50
|
assertDoesNotRedirectToAddAOrgIfOrgExists(options) {
|
|
43
51
|
return __awaiter(this, void 0, void 0, function* () {
|
|
44
52
|
assertOptions(options, ['views', 'vc', 'organizations']);
|
|
@@ -9,6 +9,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
};
|
|
10
10
|
import { AbstractViewController, buildActiveRecordCard, } from '@sprucelabs/heartwood-view-controllers';
|
|
11
11
|
import { eventResponseUtil } from '@sprucelabs/spruce-event-utils';
|
|
12
|
+
import locationRenderer from '../renderers/locationRenderer.js';
|
|
12
13
|
export default class LocationListCardViewController extends AbstractViewController {
|
|
13
14
|
constructor(options) {
|
|
14
15
|
super(options);
|
|
@@ -38,6 +39,7 @@ export default class LocationListCardViewController extends AbstractViewControll
|
|
|
38
39
|
}));
|
|
39
40
|
}
|
|
40
41
|
buildRow(location) {
|
|
42
|
+
const address = location.address;
|
|
41
43
|
return {
|
|
42
44
|
id: location.id,
|
|
43
45
|
isSelected: this.selectedLocationId === location.id,
|
|
@@ -51,11 +53,7 @@ export default class LocationListCardViewController extends AbstractViewControll
|
|
|
51
53
|
content: location.name,
|
|
52
54
|
},
|
|
53
55
|
subText: {
|
|
54
|
-
content:
|
|
55
|
-
? `${location.address.street1}${location.address.street2
|
|
56
|
-
? ` ${location.address.street2}`
|
|
57
|
-
: ``} ${location.address.city} ${location.address.zip}`
|
|
58
|
-
: ``}`,
|
|
56
|
+
content: locationRenderer.renderAddress(address),
|
|
59
57
|
},
|
|
60
58
|
},
|
|
61
59
|
{
|
package/build/index-module.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
export { default as organizationAssert } from './tests/utilities/organizationAssert';
|
|
2
2
|
export { default as LocationListCardViewController } from './viewControllers/LocationListCard.vc';
|
|
3
3
|
export * from './types-module';
|
|
4
|
+
export { default as locationRenderer } from './renderers/locationRenderer';
|
package/build/index-module.js
CHANGED
|
@@ -13,9 +13,11 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
13
13
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
14
14
|
};
|
|
15
15
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
|
-
exports.LocationListCardViewController = exports.organizationAssert = void 0;
|
|
16
|
+
exports.locationRenderer = exports.LocationListCardViewController = exports.organizationAssert = void 0;
|
|
17
17
|
var organizationAssert_1 = require("./tests/utilities/organizationAssert");
|
|
18
18
|
Object.defineProperty(exports, "organizationAssert", { enumerable: true, get: function () { return __importDefault(organizationAssert_1).default; } });
|
|
19
19
|
var LocationListCard_vc_1 = require("./viewControllers/LocationListCard.vc");
|
|
20
20
|
Object.defineProperty(exports, "LocationListCardViewController", { enumerable: true, get: function () { return __importDefault(LocationListCard_vc_1).default; } });
|
|
21
21
|
__exportStar(require("./types-module"), exports);
|
|
22
|
+
var locationRenderer_1 = require("./renderers/locationRenderer");
|
|
23
|
+
Object.defineProperty(exports, "locationRenderer", { enumerable: true, get: function () { return __importDefault(locationRenderer_1).default; } });
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const locationRenderer = {
|
|
4
|
+
renderAddress(address) {
|
|
5
|
+
return `${address
|
|
6
|
+
? `${address.street1}${address.street2 ? ` ${address.street2}` : ``} ${address.city} ${address.zip}`
|
|
7
|
+
: ``}`;
|
|
8
|
+
},
|
|
9
|
+
};
|
|
10
|
+
exports.default = locationRenderer;
|
|
@@ -1,12 +1,20 @@
|
|
|
1
1
|
import { SkillViewController } from '@sprucelabs/heartwood-view-controllers';
|
|
2
2
|
import { OrganizationFixture, ViewFixture } from '@sprucelabs/spruce-test-fixtures';
|
|
3
3
|
declare const organizationAssert: {
|
|
4
|
+
/**
|
|
5
|
+
*
|
|
6
|
+
* @deprecated use vcAssert.assertSkillViewIsScopedBy(this.vc, 'organization')
|
|
7
|
+
*/
|
|
4
8
|
assertRedirectsToAddOrgIfNoOrgExists(options: {
|
|
5
9
|
views: ViewFixture;
|
|
6
10
|
organizations: OrganizationFixture;
|
|
7
11
|
vc: SkillViewController<any>;
|
|
8
12
|
didAddOrgRedirectDestination: string;
|
|
9
13
|
}): Promise<void>;
|
|
14
|
+
/**
|
|
15
|
+
*
|
|
16
|
+
* @deprecated do not even do this anymore
|
|
17
|
+
*/
|
|
10
18
|
assertDoesNotRedirectToAddAOrgIfOrgExists(options: {
|
|
11
19
|
vc: SkillViewController<any>;
|
|
12
20
|
views: ViewFixture;
|
|
@@ -5,6 +5,10 @@ const schema_1 = require("@sprucelabs/schema");
|
|
|
5
5
|
const spruce_test_fixtures_1 = require("@sprucelabs/spruce-test-fixtures");
|
|
6
6
|
const test_1 = require("@sprucelabs/test");
|
|
7
7
|
const organizationAssert = {
|
|
8
|
+
/**
|
|
9
|
+
*
|
|
10
|
+
* @deprecated use vcAssert.assertSkillViewIsScopedBy(this.vc, 'organization')
|
|
11
|
+
*/
|
|
8
12
|
async assertRedirectsToAddOrgIfNoOrgExists(options) {
|
|
9
13
|
(0, schema_1.assertOptions)(options, [
|
|
10
14
|
'views',
|
|
@@ -30,6 +34,10 @@ const organizationAssert = {
|
|
|
30
34
|
});
|
|
31
35
|
spruce_test_fixtures_1.TestRouter.setShouldThrowWhenRedirectingToBadSvc(true);
|
|
32
36
|
},
|
|
37
|
+
/**
|
|
38
|
+
*
|
|
39
|
+
* @deprecated do not even do this anymore
|
|
40
|
+
*/
|
|
33
41
|
async assertDoesNotRedirectToAddAOrgIfOrgExists(options) {
|
|
34
42
|
(0, schema_1.assertOptions)(options, ['views', 'vc', 'organizations']);
|
|
35
43
|
const { vc, views, organizations } = options;
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
6
|
const heartwood_view_controllers_1 = require("@sprucelabs/heartwood-view-controllers");
|
|
4
7
|
const spruce_event_utils_1 = require("@sprucelabs/spruce-event-utils");
|
|
8
|
+
const locationRenderer_1 = __importDefault(require("../renderers/locationRenderer"));
|
|
5
9
|
class LocationListCardViewController extends heartwood_view_controllers_1.AbstractViewController {
|
|
6
10
|
constructor(options) {
|
|
7
11
|
super(options);
|
|
@@ -31,6 +35,7 @@ class LocationListCardViewController extends heartwood_view_controllers_1.Abstra
|
|
|
31
35
|
}));
|
|
32
36
|
}
|
|
33
37
|
buildRow(location) {
|
|
38
|
+
const address = location.address;
|
|
34
39
|
return {
|
|
35
40
|
id: location.id,
|
|
36
41
|
isSelected: this.selectedLocationId === location.id,
|
|
@@ -44,11 +49,7 @@ class LocationListCardViewController extends heartwood_view_controllers_1.Abstra
|
|
|
44
49
|
content: location.name,
|
|
45
50
|
},
|
|
46
51
|
subText: {
|
|
47
|
-
content:
|
|
48
|
-
? `${location.address.street1}${location.address.street2
|
|
49
|
-
? ` ${location.address.street2}`
|
|
50
|
-
: ``} ${location.address.city} ${location.address.zip}`
|
|
51
|
-
: ``}`,
|
|
52
|
+
content: locationRenderer_1.default.renderAddress(address),
|
|
52
53
|
},
|
|
53
54
|
},
|
|
54
55
|
{
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sprucelabs/spruce-location-utils",
|
|
3
3
|
"description": "Location Utilities",
|
|
4
|
-
"version": "3.
|
|
4
|
+
"version": "3.1.1",
|
|
5
5
|
"skill": {
|
|
6
6
|
"namespace": "locations"
|
|
7
7
|
},
|
|
@@ -16,12 +16,16 @@
|
|
|
16
16
|
"files": [
|
|
17
17
|
"build/index-module.js",
|
|
18
18
|
"build/index-module.d.ts",
|
|
19
|
+
"build/renderers/locationRenderer.js",
|
|
20
|
+
"build/renderers/locationRenderer.d.ts",
|
|
19
21
|
"build/tests/utilities/organizationAssert.js",
|
|
20
22
|
"build/tests/utilities/organizationAssert.d.ts",
|
|
21
23
|
"build/viewControllers/LocationListCard.vc.js",
|
|
22
24
|
"build/viewControllers/LocationListCard.vc.d.ts",
|
|
23
25
|
"build/esm/index-module.js",
|
|
24
26
|
"build/esm/index-module.d.ts",
|
|
27
|
+
"build/esm/renderers/locationRenderer.js",
|
|
28
|
+
"build/esm/renderers/locationRenderer.d.ts",
|
|
25
29
|
"build/esm/tests/utilities/organizationAssert.js",
|
|
26
30
|
"build/esm/tests/utilities/organizationAssert.d.ts",
|
|
27
31
|
"build/esm/viewControllers/LocationListCard.vc.js",
|