@sprucelabs/spruce-feed-view-controllers 0.0.143 → 0.0.146
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/feed.types.d.ts +5 -5
- package/build/esm/index-module.d.ts +1 -1
- package/build/esm/index-module.js +1 -1
- package/build/esm/{viewControllers → root}/FeedCard.vc.d.ts +4 -20
- package/build/esm/{viewControllers → root}/FeedCard.vc.js +19 -81
- package/build/esm/types-module.d.ts +1 -1
- package/build/feed.types.d.ts +5 -5
- package/build/index-module.d.ts +1 -1
- package/build/index-module.js +1 -1
- package/build/{viewControllers → root}/FeedCard.vc.d.ts +4 -20
- package/build/{viewControllers → root}/FeedCard.vc.js +17 -75
- package/build/types-module.d.ts +1 -1
- package/package.json +5 -5
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { SpruceSchemas } from '@sprucelabs/spruce-core-schemas';
|
|
2
|
-
export
|
|
3
|
-
export
|
|
4
|
-
export
|
|
5
|
-
export
|
|
6
|
-
export
|
|
2
|
+
export type FeedPredicate = SpruceSchemas.Mercury.v2020_12_25.FeedPredicate;
|
|
3
|
+
export type FeedItem = SpruceSchemas.Spruce.v2020_07_22.FeedItem;
|
|
4
|
+
export type Feed = SpruceSchemas.Spruce.v2020_07_22.Feed;
|
|
5
|
+
export type CardSection = SpruceSchemas.HeartwoodViewControllers.v2021_02_11.CardSection;
|
|
6
|
+
export type Card = SpruceSchemas.HeartwoodViewControllers.v2021_02_11.Card;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { default as FeedCardViewController } from './
|
|
1
|
+
export { default as FeedCardViewController } from './root/FeedCard.vc';
|
|
2
2
|
export * from './types-module';
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { default as FeedCardViewController } from './
|
|
1
|
+
export { default as FeedCardViewController } from './root/FeedCard.vc.js';
|
|
2
2
|
export * from './types-module.js';
|
|
@@ -1,48 +1,32 @@
|
|
|
1
|
-
import { AbstractViewController, Authenticator, CardViewController,
|
|
1
|
+
import { AbstractViewController, Authenticator, CardViewController, FeedViewController, ViewControllerOptions } from '@sprucelabs/heartwood-view-controllers';
|
|
2
2
|
import { Card, FeedPredicate } from '../feed.types';
|
|
3
3
|
export default class FeedCardViewController extends AbstractViewController<Card> {
|
|
4
4
|
static id: string;
|
|
5
5
|
private isLoaded;
|
|
6
6
|
protected cardVc: CardViewController;
|
|
7
7
|
private predicates;
|
|
8
|
-
protected formVc: FormViewController<MessageFormSchema>;
|
|
9
|
-
private shouldEnableChat;
|
|
10
8
|
private auth;
|
|
11
9
|
private sentMessageCount;
|
|
12
10
|
private pendingAddedMessages;
|
|
11
|
+
protected feedVc: FeedViewController;
|
|
13
12
|
constructor(options: ViewControllerOptions & FeedCardViewControllerOptions);
|
|
13
|
+
private FeedVc;
|
|
14
14
|
private CardVc;
|
|
15
|
-
private FormVc;
|
|
16
|
-
private handleChangeForm;
|
|
17
15
|
private handleSubmitForm;
|
|
18
|
-
private setMessage;
|
|
19
16
|
private handleDidUpdateFeed;
|
|
20
17
|
private sendMessage;
|
|
21
18
|
private removeItem;
|
|
22
19
|
private pushItem;
|
|
23
20
|
private addSentMessage;
|
|
24
|
-
private getFeed;
|
|
25
21
|
getIsLoaded(): boolean;
|
|
26
22
|
load(options: {
|
|
27
23
|
predicates: FeedPredicate[];
|
|
28
24
|
authenticator: Authenticator;
|
|
29
25
|
}): Promise<void>;
|
|
30
26
|
private refresh;
|
|
31
|
-
getShouldEnableChat(): boolean;
|
|
32
27
|
private handleTryAgain;
|
|
33
28
|
render(): import("@sprucelabs/heartwood-view-controllers").SpruceSchemas.HeartwoodViewControllers.v2021_02_11.Card;
|
|
34
29
|
}
|
|
35
|
-
export
|
|
30
|
+
export type FeedCardViewControllerOptions = {
|
|
36
31
|
id?: string;
|
|
37
|
-
shouldEnableChat?: boolean;
|
|
38
32
|
};
|
|
39
|
-
declare const messageFormSchema: {
|
|
40
|
-
id: string;
|
|
41
|
-
fields: {
|
|
42
|
-
message: {
|
|
43
|
-
type: "text";
|
|
44
|
-
};
|
|
45
|
-
};
|
|
46
|
-
};
|
|
47
|
-
declare type MessageFormSchema = typeof messageFormSchema;
|
|
48
|
-
export {};
|
|
@@ -7,8 +7,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
7
7
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
|
-
import { AbstractViewController,
|
|
11
|
-
import { assertOptions
|
|
10
|
+
import { AbstractViewController, } from '@sprucelabs/heartwood-view-controllers';
|
|
11
|
+
import { assertOptions } from '@sprucelabs/schema';
|
|
12
12
|
export default class FeedCardViewController extends AbstractViewController {
|
|
13
13
|
constructor(options) {
|
|
14
14
|
super(options);
|
|
@@ -16,26 +16,23 @@ export default class FeedCardViewController extends AbstractViewController {
|
|
|
16
16
|
this.predicates = [];
|
|
17
17
|
this.sentMessageCount = 0;
|
|
18
18
|
this.pendingAddedMessages = [];
|
|
19
|
-
|
|
20
|
-
this.shouldEnableChat = !!shouldEnableChat;
|
|
21
|
-
this.formVc = this.FormVc();
|
|
19
|
+
this.feedVc = this.FeedVc();
|
|
22
20
|
this.cardVc = this.CardVc(options);
|
|
23
21
|
}
|
|
22
|
+
FeedVc() {
|
|
23
|
+
return this.Controller('feed', {
|
|
24
|
+
items: [],
|
|
25
|
+
onSubmitMessage: this.handleSubmitForm.bind(this),
|
|
26
|
+
});
|
|
27
|
+
}
|
|
24
28
|
CardVc(options) {
|
|
25
|
-
const { id
|
|
29
|
+
const { id } = options;
|
|
26
30
|
const sections = [
|
|
27
31
|
{
|
|
28
32
|
id: 'feed',
|
|
29
|
-
feed:
|
|
30
|
-
items: [],
|
|
31
|
-
},
|
|
33
|
+
feed: this.feedVc.render(),
|
|
32
34
|
},
|
|
33
35
|
];
|
|
34
|
-
if (shouldEnableChat) {
|
|
35
|
-
sections.push({
|
|
36
|
-
form: this.formVc.render(),
|
|
37
|
-
});
|
|
38
|
-
}
|
|
39
36
|
return this.Controller('card', {
|
|
40
37
|
id,
|
|
41
38
|
body: {
|
|
@@ -44,48 +41,9 @@ export default class FeedCardViewController extends AbstractViewController {
|
|
|
44
41
|
},
|
|
45
42
|
});
|
|
46
43
|
}
|
|
47
|
-
|
|
48
|
-
return this.Controller('form', buildForm({
|
|
49
|
-
id: 'message',
|
|
50
|
-
schema: messageFormSchema,
|
|
51
|
-
isEnabled: false,
|
|
52
|
-
onChange: this.handleChangeForm.bind(this),
|
|
53
|
-
onSubmit: this.handleSubmitForm.bind(this),
|
|
54
|
-
sections: [
|
|
55
|
-
{
|
|
56
|
-
fields: [
|
|
57
|
-
{
|
|
58
|
-
name: 'message',
|
|
59
|
-
renderAs: 'textarea',
|
|
60
|
-
},
|
|
61
|
-
],
|
|
62
|
-
},
|
|
63
|
-
],
|
|
64
|
-
shouldShowCancelButton: false,
|
|
65
|
-
}));
|
|
66
|
-
}
|
|
67
|
-
handleChangeForm() {
|
|
68
|
-
var _a;
|
|
69
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
70
|
-
const message = (_a = this.formVc.getValue('message')) !== null && _a !== void 0 ? _a : '';
|
|
71
|
-
if (message.length > 0) {
|
|
72
|
-
this.formVc.enable();
|
|
73
|
-
}
|
|
74
|
-
else {
|
|
75
|
-
this.formVc.disable();
|
|
76
|
-
}
|
|
77
|
-
});
|
|
78
|
-
}
|
|
79
|
-
handleSubmitForm() {
|
|
80
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
81
|
-
const message = this.formVc.getValue('message');
|
|
82
|
-
yield this.setMessage(null);
|
|
83
|
-
yield this.sendMessage(message);
|
|
84
|
-
});
|
|
85
|
-
}
|
|
86
|
-
setMessage(value) {
|
|
44
|
+
handleSubmitForm(message) {
|
|
87
45
|
return __awaiter(this, void 0, void 0, function* () {
|
|
88
|
-
|
|
46
|
+
return this.sendMessage(message);
|
|
89
47
|
});
|
|
90
48
|
}
|
|
91
49
|
handleDidUpdateFeed(item) {
|
|
@@ -116,24 +74,21 @@ export default class FeedCardViewController extends AbstractViewController {
|
|
|
116
74
|
}
|
|
117
75
|
catch (err) {
|
|
118
76
|
this.removeItem(added.id);
|
|
119
|
-
yield this.setMessage(added.message);
|
|
120
77
|
yield this.alert({
|
|
121
78
|
title: 'Failed to send message!',
|
|
122
79
|
message: err.message,
|
|
123
80
|
});
|
|
124
81
|
console.error((_a = err.stack) !== null && _a !== void 0 ? _a : err.message);
|
|
82
|
+
return false;
|
|
125
83
|
}
|
|
84
|
+
return true;
|
|
126
85
|
});
|
|
127
86
|
}
|
|
128
87
|
removeItem(id) {
|
|
129
|
-
|
|
130
|
-
feed.items = feed.items.filter((i) => i.id !== id);
|
|
131
|
-
this.cardVc.updateSection('feed', { feed });
|
|
88
|
+
this.feedVc.removeItem(id);
|
|
132
89
|
}
|
|
133
90
|
pushItem(item) {
|
|
134
|
-
|
|
135
|
-
items.push(item);
|
|
136
|
-
this.cardVc.triggerRender();
|
|
91
|
+
this.feedVc.addItem(item);
|
|
137
92
|
}
|
|
138
93
|
addSentMessage(message) {
|
|
139
94
|
const person = this.auth.getPerson();
|
|
@@ -142,7 +97,7 @@ export default class FeedCardViewController extends AbstractViewController {
|
|
|
142
97
|
isMe: true,
|
|
143
98
|
message: message,
|
|
144
99
|
fromCasualName: person.casualName,
|
|
145
|
-
dateCreated:
|
|
100
|
+
dateCreated: this.dates.date(),
|
|
146
101
|
avatar: person.avatar,
|
|
147
102
|
source: {
|
|
148
103
|
personId: person.id,
|
|
@@ -151,10 +106,6 @@ export default class FeedCardViewController extends AbstractViewController {
|
|
|
151
106
|
this.pushItem(item);
|
|
152
107
|
return item;
|
|
153
108
|
}
|
|
154
|
-
getFeed() {
|
|
155
|
-
const { feed } = this.cardVc.getSection('feed');
|
|
156
|
-
return feed;
|
|
157
|
-
}
|
|
158
109
|
getIsLoaded() {
|
|
159
110
|
return this.isLoaded;
|
|
160
111
|
}
|
|
@@ -181,9 +132,7 @@ export default class FeedCardViewController extends AbstractViewController {
|
|
|
181
132
|
},
|
|
182
133
|
});
|
|
183
134
|
feed.items.reverse();
|
|
184
|
-
this.
|
|
185
|
-
feed: Object.assign(Object.assign({}, feed), { shouldEnableChat: true }),
|
|
186
|
-
});
|
|
135
|
+
this.feedVc.setItems(feed.items);
|
|
187
136
|
}
|
|
188
137
|
catch (err) {
|
|
189
138
|
this.cardVc.setCriticalError({
|
|
@@ -201,9 +150,6 @@ export default class FeedCardViewController extends AbstractViewController {
|
|
|
201
150
|
this.cardVc.setIsBusy(false);
|
|
202
151
|
});
|
|
203
152
|
}
|
|
204
|
-
getShouldEnableChat() {
|
|
205
|
-
return this.shouldEnableChat;
|
|
206
|
-
}
|
|
207
153
|
handleTryAgain() {
|
|
208
154
|
return __awaiter(this, void 0, void 0, function* () {
|
|
209
155
|
this.cardVc.clearCriticalError();
|
|
@@ -215,11 +161,3 @@ export default class FeedCardViewController extends AbstractViewController {
|
|
|
215
161
|
}
|
|
216
162
|
}
|
|
217
163
|
FeedCardViewController.id = 'feed-card';
|
|
218
|
-
const messageFormSchema = buildSchema({
|
|
219
|
-
id: 'message',
|
|
220
|
-
fields: {
|
|
221
|
-
message: {
|
|
222
|
-
type: 'text',
|
|
223
|
-
},
|
|
224
|
-
},
|
|
225
|
-
});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { FeedCardViewController } from './index-module';
|
|
2
|
-
import { FeedCardViewControllerOptions } from './
|
|
2
|
+
import { FeedCardViewControllerOptions } from './root/FeedCard.vc';
|
|
3
3
|
declare module '@sprucelabs/heartwood-view-controllers/build/types/heartwood.types' {
|
|
4
4
|
interface ViewControllerMap {
|
|
5
5
|
feedCard: FeedCardViewController;
|
package/build/feed.types.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { SpruceSchemas } from '@sprucelabs/spruce-core-schemas';
|
|
2
|
-
export
|
|
3
|
-
export
|
|
4
|
-
export
|
|
5
|
-
export
|
|
6
|
-
export
|
|
2
|
+
export type FeedPredicate = SpruceSchemas.Mercury.v2020_12_25.FeedPredicate;
|
|
3
|
+
export type FeedItem = SpruceSchemas.Spruce.v2020_07_22.FeedItem;
|
|
4
|
+
export type Feed = SpruceSchemas.Spruce.v2020_07_22.Feed;
|
|
5
|
+
export type CardSection = SpruceSchemas.HeartwoodViewControllers.v2021_02_11.CardSection;
|
|
6
|
+
export type Card = SpruceSchemas.HeartwoodViewControllers.v2021_02_11.Card;
|
package/build/index-module.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { default as FeedCardViewController } from './
|
|
1
|
+
export { default as FeedCardViewController } from './root/FeedCard.vc';
|
|
2
2
|
export * from './types-module';
|
package/build/index-module.js
CHANGED
|
@@ -18,6 +18,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
18
18
|
};
|
|
19
19
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
20
20
|
exports.FeedCardViewController = void 0;
|
|
21
|
-
var FeedCard_vc_1 = require("./
|
|
21
|
+
var FeedCard_vc_1 = require("./root/FeedCard.vc");
|
|
22
22
|
Object.defineProperty(exports, "FeedCardViewController", { enumerable: true, get: function () { return __importDefault(FeedCard_vc_1).default; } });
|
|
23
23
|
__exportStar(require("./types-module"), exports);
|
|
@@ -1,48 +1,32 @@
|
|
|
1
|
-
import { AbstractViewController, Authenticator, CardViewController,
|
|
1
|
+
import { AbstractViewController, Authenticator, CardViewController, FeedViewController, ViewControllerOptions } from '@sprucelabs/heartwood-view-controllers';
|
|
2
2
|
import { Card, FeedPredicate } from '../feed.types';
|
|
3
3
|
export default class FeedCardViewController extends AbstractViewController<Card> {
|
|
4
4
|
static id: string;
|
|
5
5
|
private isLoaded;
|
|
6
6
|
protected cardVc: CardViewController;
|
|
7
7
|
private predicates;
|
|
8
|
-
protected formVc: FormViewController<MessageFormSchema>;
|
|
9
|
-
private shouldEnableChat;
|
|
10
8
|
private auth;
|
|
11
9
|
private sentMessageCount;
|
|
12
10
|
private pendingAddedMessages;
|
|
11
|
+
protected feedVc: FeedViewController;
|
|
13
12
|
constructor(options: ViewControllerOptions & FeedCardViewControllerOptions);
|
|
13
|
+
private FeedVc;
|
|
14
14
|
private CardVc;
|
|
15
|
-
private FormVc;
|
|
16
|
-
private handleChangeForm;
|
|
17
15
|
private handleSubmitForm;
|
|
18
|
-
private setMessage;
|
|
19
16
|
private handleDidUpdateFeed;
|
|
20
17
|
private sendMessage;
|
|
21
18
|
private removeItem;
|
|
22
19
|
private pushItem;
|
|
23
20
|
private addSentMessage;
|
|
24
|
-
private getFeed;
|
|
25
21
|
getIsLoaded(): boolean;
|
|
26
22
|
load(options: {
|
|
27
23
|
predicates: FeedPredicate[];
|
|
28
24
|
authenticator: Authenticator;
|
|
29
25
|
}): Promise<void>;
|
|
30
26
|
private refresh;
|
|
31
|
-
getShouldEnableChat(): boolean;
|
|
32
27
|
private handleTryAgain;
|
|
33
28
|
render(): import("@sprucelabs/heartwood-view-controllers").SpruceSchemas.HeartwoodViewControllers.v2021_02_11.Card;
|
|
34
29
|
}
|
|
35
|
-
export
|
|
30
|
+
export type FeedCardViewControllerOptions = {
|
|
36
31
|
id?: string;
|
|
37
|
-
shouldEnableChat?: boolean;
|
|
38
32
|
};
|
|
39
|
-
declare const messageFormSchema: {
|
|
40
|
-
id: string;
|
|
41
|
-
fields: {
|
|
42
|
-
message: {
|
|
43
|
-
type: "text";
|
|
44
|
-
};
|
|
45
|
-
};
|
|
46
|
-
};
|
|
47
|
-
declare type MessageFormSchema = typeof messageFormSchema;
|
|
48
|
-
export {};
|
|
@@ -9,26 +9,23 @@ class FeedCardViewController extends heartwood_view_controllers_1.AbstractViewCo
|
|
|
9
9
|
this.predicates = [];
|
|
10
10
|
this.sentMessageCount = 0;
|
|
11
11
|
this.pendingAddedMessages = [];
|
|
12
|
-
|
|
13
|
-
this.shouldEnableChat = !!shouldEnableChat;
|
|
14
|
-
this.formVc = this.FormVc();
|
|
12
|
+
this.feedVc = this.FeedVc();
|
|
15
13
|
this.cardVc = this.CardVc(options);
|
|
16
14
|
}
|
|
15
|
+
FeedVc() {
|
|
16
|
+
return this.Controller('feed', {
|
|
17
|
+
items: [],
|
|
18
|
+
onSubmitMessage: this.handleSubmitForm.bind(this),
|
|
19
|
+
});
|
|
20
|
+
}
|
|
17
21
|
CardVc(options) {
|
|
18
|
-
const { id
|
|
22
|
+
const { id } = options;
|
|
19
23
|
const sections = [
|
|
20
24
|
{
|
|
21
25
|
id: 'feed',
|
|
22
|
-
feed:
|
|
23
|
-
items: [],
|
|
24
|
-
},
|
|
26
|
+
feed: this.feedVc.render(),
|
|
25
27
|
},
|
|
26
28
|
];
|
|
27
|
-
if (shouldEnableChat) {
|
|
28
|
-
sections.push({
|
|
29
|
-
form: this.formVc.render(),
|
|
30
|
-
});
|
|
31
|
-
}
|
|
32
29
|
return this.Controller('card', {
|
|
33
30
|
id,
|
|
34
31
|
body: {
|
|
@@ -37,43 +34,8 @@ class FeedCardViewController extends heartwood_view_controllers_1.AbstractViewCo
|
|
|
37
34
|
},
|
|
38
35
|
});
|
|
39
36
|
}
|
|
40
|
-
|
|
41
|
-
return this.
|
|
42
|
-
id: 'message',
|
|
43
|
-
schema: messageFormSchema,
|
|
44
|
-
isEnabled: false,
|
|
45
|
-
onChange: this.handleChangeForm.bind(this),
|
|
46
|
-
onSubmit: this.handleSubmitForm.bind(this),
|
|
47
|
-
sections: [
|
|
48
|
-
{
|
|
49
|
-
fields: [
|
|
50
|
-
{
|
|
51
|
-
name: 'message',
|
|
52
|
-
renderAs: 'textarea',
|
|
53
|
-
},
|
|
54
|
-
],
|
|
55
|
-
},
|
|
56
|
-
],
|
|
57
|
-
shouldShowCancelButton: false,
|
|
58
|
-
}));
|
|
59
|
-
}
|
|
60
|
-
async handleChangeForm() {
|
|
61
|
-
var _a;
|
|
62
|
-
const message = (_a = this.formVc.getValue('message')) !== null && _a !== void 0 ? _a : '';
|
|
63
|
-
if (message.length > 0) {
|
|
64
|
-
this.formVc.enable();
|
|
65
|
-
}
|
|
66
|
-
else {
|
|
67
|
-
this.formVc.disable();
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
async handleSubmitForm() {
|
|
71
|
-
const message = this.formVc.getValue('message');
|
|
72
|
-
await this.setMessage(null);
|
|
73
|
-
await this.sendMessage(message);
|
|
74
|
-
}
|
|
75
|
-
async setMessage(value) {
|
|
76
|
-
await this.formVc.setValue('message', value);
|
|
37
|
+
async handleSubmitForm(message) {
|
|
38
|
+
return this.sendMessage(message);
|
|
77
39
|
}
|
|
78
40
|
handleDidUpdateFeed(item) {
|
|
79
41
|
const idx = this.pendingAddedMessages.indexOf(item.message);
|
|
@@ -102,23 +64,20 @@ class FeedCardViewController extends heartwood_view_controllers_1.AbstractViewCo
|
|
|
102
64
|
}
|
|
103
65
|
catch (err) {
|
|
104
66
|
this.removeItem(added.id);
|
|
105
|
-
await this.setMessage(added.message);
|
|
106
67
|
await this.alert({
|
|
107
68
|
title: 'Failed to send message!',
|
|
108
69
|
message: err.message,
|
|
109
70
|
});
|
|
110
71
|
console.error((_a = err.stack) !== null && _a !== void 0 ? _a : err.message);
|
|
72
|
+
return false;
|
|
111
73
|
}
|
|
74
|
+
return true;
|
|
112
75
|
}
|
|
113
76
|
removeItem(id) {
|
|
114
|
-
|
|
115
|
-
feed.items = feed.items.filter((i) => i.id !== id);
|
|
116
|
-
this.cardVc.updateSection('feed', { feed });
|
|
77
|
+
this.feedVc.removeItem(id);
|
|
117
78
|
}
|
|
118
79
|
pushItem(item) {
|
|
119
|
-
|
|
120
|
-
items.push(item);
|
|
121
|
-
this.cardVc.triggerRender();
|
|
80
|
+
this.feedVc.addItem(item);
|
|
122
81
|
}
|
|
123
82
|
addSentMessage(message) {
|
|
124
83
|
const person = this.auth.getPerson();
|
|
@@ -127,7 +86,7 @@ class FeedCardViewController extends heartwood_view_controllers_1.AbstractViewCo
|
|
|
127
86
|
isMe: true,
|
|
128
87
|
message: message,
|
|
129
88
|
fromCasualName: person.casualName,
|
|
130
|
-
dateCreated:
|
|
89
|
+
dateCreated: this.dates.date(),
|
|
131
90
|
avatar: person.avatar,
|
|
132
91
|
source: {
|
|
133
92
|
personId: person.id,
|
|
@@ -136,10 +95,6 @@ class FeedCardViewController extends heartwood_view_controllers_1.AbstractViewCo
|
|
|
136
95
|
this.pushItem(item);
|
|
137
96
|
return item;
|
|
138
97
|
}
|
|
139
|
-
getFeed() {
|
|
140
|
-
const { feed } = this.cardVc.getSection('feed');
|
|
141
|
-
return feed;
|
|
142
|
-
}
|
|
143
98
|
getIsLoaded() {
|
|
144
99
|
return this.isLoaded;
|
|
145
100
|
}
|
|
@@ -163,9 +118,7 @@ class FeedCardViewController extends heartwood_view_controllers_1.AbstractViewCo
|
|
|
163
118
|
},
|
|
164
119
|
});
|
|
165
120
|
feed.items.reverse();
|
|
166
|
-
this.
|
|
167
|
-
feed: Object.assign(Object.assign({}, feed), { shouldEnableChat: true }),
|
|
168
|
-
});
|
|
121
|
+
this.feedVc.setItems(feed.items);
|
|
169
122
|
}
|
|
170
123
|
catch (err) {
|
|
171
124
|
this.cardVc.setCriticalError({
|
|
@@ -182,9 +135,6 @@ class FeedCardViewController extends heartwood_view_controllers_1.AbstractViewCo
|
|
|
182
135
|
this.isLoaded = true;
|
|
183
136
|
this.cardVc.setIsBusy(false);
|
|
184
137
|
}
|
|
185
|
-
getShouldEnableChat() {
|
|
186
|
-
return this.shouldEnableChat;
|
|
187
|
-
}
|
|
188
138
|
async handleTryAgain() {
|
|
189
139
|
this.cardVc.clearCriticalError();
|
|
190
140
|
await this.refresh();
|
|
@@ -195,11 +145,3 @@ class FeedCardViewController extends heartwood_view_controllers_1.AbstractViewCo
|
|
|
195
145
|
}
|
|
196
146
|
exports.default = FeedCardViewController;
|
|
197
147
|
FeedCardViewController.id = 'feed-card';
|
|
198
|
-
const messageFormSchema = (0, schema_1.buildSchema)({
|
|
199
|
-
id: 'message',
|
|
200
|
-
fields: {
|
|
201
|
-
message: {
|
|
202
|
-
type: 'text',
|
|
203
|
-
},
|
|
204
|
-
},
|
|
205
|
-
});
|
package/build/types-module.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { FeedCardViewController } from './index-module';
|
|
2
|
-
import { FeedCardViewControllerOptions } from './
|
|
2
|
+
import { FeedCardViewControllerOptions } from './root/FeedCard.vc';
|
|
3
3
|
declare module '@sprucelabs/heartwood-view-controllers/build/types/heartwood.types' {
|
|
4
4
|
interface ViewControllerMap {
|
|
5
5
|
feedCard: FeedCardViewController;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sprucelabs/spruce-feed-view-controllers",
|
|
3
3
|
"description": "Spruce feed view controllers",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.146",
|
|
5
5
|
"skill": {
|
|
6
6
|
"namespace": "feed"
|
|
7
7
|
},
|
|
@@ -16,12 +16,12 @@
|
|
|
16
16
|
"files": [
|
|
17
17
|
"build/index-module.js",
|
|
18
18
|
"build/index-module.d.ts",
|
|
19
|
-
"build/
|
|
20
|
-
"build/
|
|
19
|
+
"build/root/FeedCard.vc.js",
|
|
20
|
+
"build/root/FeedCard.vc.d.ts",
|
|
21
21
|
"build/esm/index-module.js",
|
|
22
22
|
"build/esm/index-module.d.ts",
|
|
23
|
-
"build/esm/
|
|
24
|
-
"build/esm/
|
|
23
|
+
"build/esm/root/FeedCard.vc.js",
|
|
24
|
+
"build/esm/root/FeedCard.vc.d.ts",
|
|
25
25
|
"build/types-module.js",
|
|
26
26
|
"build/types-module.d.ts",
|
|
27
27
|
"build/esm/types-module.js",
|