Skip to content
Open
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions _emulator/extensions/sync-firestore-sheets.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
COLLECTION_PATH=sheets
LOCATION=us-central1
SHEET_ID=1DDMVqIN4lasb8y2EEVQyTKrlcLPZVLpqHyK26P9VtdU
FIELDS_TO_SYNC=name,email
3 changes: 2 additions & 1 deletion _emulator/firebase.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
"extensions": {
"export-user-data": "../extensions/export-user-data",
"firestore-record-acknowledgments": "../extensions/firestore-record-acknowledgments",
"image-processing-api": "../extensions/image-processing-api"
"image-processing-api": "../extensions/image-processing-api",
"sync-firestore-sheets": "../extensions/firestore-sheets-sync"
}
}
36 changes: 27 additions & 9 deletions docs/firestore-record-acknowledgments/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -50,18 +50,24 @@ To acknowledge a notice, the extension provides two callable functions which acc
For example, to acknowledge a notice:

```js
import { getFunctions, httpsCallable } from "firebase/functions";
import { getFunctions, httpsCallable } from 'firebase/functions';

const functions = getFunctions();
await httpsCallable(functions, 'ext-firestore-firestore-record-acknowledgments-acknowledgeNotice')({
await httpsCallable(
functions,
'ext-firestore-firestore-record-acknowledgments-acknowledgeNotice',
)({
noticeId: 'EA9QhZKKta9KXcckiasc',
});
```

In-case you need to capture custom preferences relating to an acknowledgment, you can provide custom metadata to the function, for example:

```js
await httpsCallable(functions, 'ext-firestore-firestore-record-acknowledgments-acknowledgeNotice')({
await httpsCallable(
functions,
'ext-firestore-firestore-record-acknowledgments-acknowledgeNotice',
)({
noticeId: 'EA9QhZKKta9KXcckiasc',
metadata: { preference1: true, preference2: false },
});
Expand All @@ -70,7 +76,10 @@ await httpsCallable(functions, 'ext-firestore-firestore-record-acknowledgments-a
You can also provide a custom “type” of acknowledgment (the default type is “seen”), for example:

```js
await httpsCallable(functions, 'ext-firestore-firestore-record-acknowledgments-acknowledgeNotice')({
await httpsCallable(
functions,
'ext-firestore-firestore-record-acknowledgments-acknowledgeNotice',
)({
noticeId: 'EA9QhZKKta9KXcckiasc',
type: 'seen',
});
Expand All @@ -79,7 +88,10 @@ await httpsCallable(functions, 'ext-firestore-firestore-record-acknowledgments-a
If you wish to unacknowledge a notice, call the `unacknowledgeNotice` function:

```js
await httpsCallable(functions, 'ext-firestore-firestore-record-acknowledgments-unacknowledgeNotice')({
await httpsCallable(
functions,
'ext-firestore-firestore-record-acknowledgments-unacknowledgeNotice',
)({
noticeId: 'EA9QhZKKta9KXcckiasc',
metadata: { reason: '...' },
});
Expand All @@ -90,19 +102,25 @@ await httpsCallable(functions, 'ext-firestore-firestore-record-acknowledgments-u
To retrieve all previous user notice acknowledgments, call the `getAcknowledgments` callable function. This function will return an ordered array of all acknowledgments along with the notice data:

```js
import { getFunctions, httpsCallable } from "firebase/functions";
import { getFunctions, httpsCallable } from 'firebase/functions';

const functions = getFunctions();
const acknowledgments = await httpsCallable(functions, 'ext-firestore-firestore-record-acknowledgments-getAcknowledgments')();
const acknowledgments = await httpsCallable(
functions,
'ext-firestore-firestore-record-acknowledgments-getAcknowledgments',
)();
```

By default this won’t include unacknowledgment documents, however if those are required you can provide a `includeUnacknowledgments` property to the call:

```js
import { getFunctions, httpsCallable } from "firebase/functions";
import { getFunctions, httpsCallable } from 'firebase/functions';

const functions = getFunctions();
const acknowledgments = await httpsCallable(functions, 'ext-firestore-firestore-record-acknowledgments-getAcknowledgments')({
const acknowledgments = await httpsCallable(
functions,
'ext-firestore-firestore-record-acknowledgments-getAcknowledgments',
)({
includeUnacknowledgments: true,
});
```
Expand Down
Loading