Skip to content

Commit b42e772

Browse files
Merge branch 'next' into rachelsaunders-githubrepo
2 parents f563358 + c87ead1 commit b42e772

File tree

29 files changed

+174
-304
lines changed

29 files changed

+174
-304
lines changed

auth-mailchimp-sync/README.md

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,19 +8,21 @@
88

99
**CONFIGURATION PARAMETERS:**
1010

11-
* Deployment location: *Where should the extension be deployed? For help selecting a location, refer to the [location selection guide](https://firebase.google.com/docs/functions/locations).*
11+
* Deployment location: Where should the extension be deployed? For help selecting a location, refer to the [location selection guide](https://firebase.google.com/docs/functions/locations).
1212

13-
* Mailchimp API key: *What is your Mailchimp API key? To obtain a Mailchimp API key, go to your [Mailchimp account](https://admin.mailchimp.com/account/api/).*
13+
* Mailchimp API key: What is your Mailchimp API key? To obtain a Mailchimp API key, go to your [Mailchimp account](https://admin.mailchimp.com/account/api/).
1414

15-
* Audience ID: *What is the Mailchimp Audience ID to which you want to subscribe new users? To find your Audience ID: visit https://admin.mailchimp.com/lists, click on the desired audience or create a new audience, then select **Settings**. Look for **Audience ID** (for example, `27735fc60a`).*
15+
* Audience ID: What is the Mailchimp Audience ID to which you want to subscribe new users? To find your Audience ID: visit https://admin.mailchimp.com/lists, click on the desired audience or create a new audience, then select **Settings**. Look for **Audience ID** (for example, `27735fc60a`).
1616

17+
* Contact status: When a new contact is added to the Mailchimp list/audience, what is their initial status? If the status is `subscribed` the contact can immediately receive campaigns. If the status is `pending`, a double opt-in confirmation email will be sent to the user. Once accepted they will be set to a `subscribed` status.
1718

1819

19-
**NON-CLOUD FUNCTION RESOURCES CREATED**:
2020

21-
* addUserToList (firebaseextensions.v1beta.function)
21+
**CLOUD FUNCTIONS CREATED:**
2222

23-
* removeUserFromList (firebaseextensions.v1beta.function)
23+
* addUserToList (providers/firebase.auth/eventTypes/user.create)
24+
25+
* removeUserFromList (providers/firebase.auth/eventTypes/user.delete)
2426

2527

2628

auth-mailchimp-sync/extension.yaml

Lines changed: 33 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ description:
2222

2323
license: Apache-2.0
2424
billingRequired: true
25-
sourceUrl: https://accounts.google.com/AccountChooser/signinchooser?service=gerritcodereview&continue=https%3A%2F%2Fdev-partners.googlesource.com%2Flogin%2Fsamples%2Ffirebase%2Fmods%2F%2B%2Fmaster%2Fauth-mailchimp-sync
26-
releaseNotesUrl: https://dev-partners.googlesource.com/samples/firebase/mods/+log
25+
sourceUrl: https://github.com/firebase/extensions/tree/master/auth-mailchimp-sync
26+
releaseNotesUrl: https://github.com/firebase/extensions/commits/master
2727

2828
author:
2929
authorName: Firebase
@@ -35,6 +35,9 @@ contributors:
3535
- authorName: Chris Bianca
3636
email: chris@csfrequency.com
3737
url: https://github.com/chrisbianca
38+
- authorName: Elliot Hesp
39+
email: elliot@invertase.io
40+
url: https://github.com/ehesp
3841

3942
resources:
4043
- name: addUserToList
@@ -51,8 +54,9 @@ resources:
5154
- name: removeUserFromList
5255
type: firebaseextensions.v1beta.function
5356
description:
54-
Listens for existing user accounts to be deleted (as managed by Firebase Authentication),
55-
then automatically removes them from your specified MailChimp audience.
57+
Listens for existing user accounts to be deleted (as managed by Firebase
58+
Authentication), then automatically removes them from your specified
59+
MailChimp audience.
5660
properties:
5761
sourceDirectory: .
5862
location: ${LOCATION}
@@ -65,9 +69,9 @@ params:
6569
type: select
6670
label: Deployment location
6771
description: >-
68-
Where should the extension be deployed?
69-
For help selecting a location, refer to the
70-
[location selection guide](https://firebase.google.com/docs/functions/locations).
72+
Where should the extension be deployed? For help selecting a location,
73+
refer to the [location selection
74+
guide](https://firebase.google.com/docs/functions/locations).
7175
options:
7276
- label: Iowa (us-central1)
7377
value: us-central1
@@ -90,18 +94,34 @@ params:
9094
type: string
9195
label: Mailchimp API key
9296
description: >-
93-
What is your Mailchimp API key?
94-
To obtain a Mailchimp API key, go to your [Mailchimp account](https://admin.mailchimp.com/account/api/).
97+
What is your Mailchimp API key? To obtain a Mailchimp API key, go to your
98+
[Mailchimp account](https://admin.mailchimp.com/account/api/).
9599
example: a1b2c3d4e5f6g7
96100
required: true
97101

98102
- param: MAILCHIMP_AUDIENCE_ID
99103
type: string
100104
label: Audience ID
101105
description: >-
102-
What is the Mailchimp Audience ID to which you want to subscribe new users?
103-
To find your Audience ID: visit https://admin.mailchimp.com/lists,
104-
click on the desired audience or create a new audience, then select **Settings**.
105-
Look for **Audience ID** (for example, `27735fc60a`).
106+
What is the Mailchimp Audience ID to which you want to subscribe new
107+
users? To find your Audience ID: visit https://admin.mailchimp.com/lists,
108+
click on the desired audience or create a new audience, then select
109+
**Settings**. Look for **Audience ID** (for example, `27735fc60a`).
106110
example: 1ab2345c67
107111
required: true
112+
113+
- param: MAILCHIMP_CONTACT_STATUS
114+
type: select
115+
label: Contact status
116+
description: >-
117+
When the extension adds a new user to the Mailchimp audience, what is
118+
their initial status? This value can be `subscribed` or `pending`.
119+
`subscribed` means the user can receive campaigns; `pending` means the
120+
user still needs to opt-in to receive campaigns.
121+
options:
122+
- label: Subscribed
123+
value: subscribed
124+
- label: Pending
125+
value: pending
126+
default: subscribed
127+
required: true

auth-mailchimp-sync/functions/lib/config.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,5 @@ exports.default = {
1919
location: process.env.LOCATION,
2020
mailchimpApiKey: process.env.MAILCHIMP_API_KEY,
2121
mailchimpAudienceId: process.env.MAILCHIMP_AUDIENCE_ID,
22+
mailchimpContactStatus: process.env.MAILCHIMP_CONTACT_STATUS,
2223
};

auth-mailchimp-sync/functions/lib/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,9 @@ exports.addUserToList = functions.handler.auth.user.onCreate((user) => __awaiter
5252
logs.userAdding(uid, config_1.default.mailchimpAudienceId);
5353
const results = yield mailchimp.post(`/lists/${config_1.default.mailchimpAudienceId}/members`, {
5454
email_address: email,
55-
status: "subscribed",
55+
status: config_1.default.mailchimpContactStatus,
5656
});
57-
logs.userAdded(uid, config_1.default.mailchimpAudienceId, results.id);
57+
logs.userAdded(uid, config_1.default.mailchimpAudienceId, results.id, config_1.default.mailchimpContactStatus);
5858
logs.complete();
5959
}
6060
catch (err) {

auth-mailchimp-sync/functions/lib/logs.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@ exports.mailchimpNotInitialized = () => {
3838
exports.start = () => {
3939
console.log("Started execution of extension with configuration", obfuscatedConfig);
4040
};
41-
exports.userAdded = (userId, audienceId, mailchimpId) => {
42-
console.log(`Added user: ${userId} to Mailchimp audience: ${audienceId} with Mailchimp ID: ${mailchimpId}`);
41+
exports.userAdded = (userId, audienceId, mailchimpId, status) => {
42+
console.log(`Added user: ${userId} with status '${status}' to Mailchimp audience: ${audienceId} with Mailchimp ID: ${mailchimpId}`);
4343
};
4444
exports.userAdding = (userId, audienceId) => {
4545
console.log(`Adding user: ${userId} to Mailchimp audience: ${audienceId}`);

auth-mailchimp-sync/functions/src/config.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,5 @@ export default {
1818
location: process.env.LOCATION,
1919
mailchimpApiKey: process.env.MAILCHIMP_API_KEY,
2020
mailchimpAudienceId: process.env.MAILCHIMP_AUDIENCE_ID,
21+
mailchimpContactStatus: process.env.MAILCHIMP_CONTACT_STATUS,
2122
};

auth-mailchimp-sync/functions/src/index.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,15 @@ export const addUserToList = functions.handler.auth.user.onCreate(
5252
`/lists/${config.mailchimpAudienceId}/members`,
5353
{
5454
email_address: email,
55-
status: "subscribed",
55+
status: config.mailchimpContactStatus,
5656
}
5757
);
58-
logs.userAdded(uid, config.mailchimpAudienceId, results.id);
58+
logs.userAdded(
59+
uid,
60+
config.mailchimpAudienceId,
61+
results.id,
62+
config.mailchimpContactStatus
63+
);
5964
logs.complete();
6065
} catch (err) {
6166
logs.errorAddUser(err);

auth-mailchimp-sync/functions/src/logs.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,16 +48,20 @@ export const mailchimpNotInitialized = () => {
4848
};
4949

5050
export const start = () => {
51-
console.log("Started execution of extension with configuration", obfuscatedConfig);
51+
console.log(
52+
"Started execution of extension with configuration",
53+
obfuscatedConfig
54+
);
5255
};
5356

5457
export const userAdded = (
5558
userId: string,
5659
audienceId: string,
57-
mailchimpId: string
60+
mailchimpId: string,
61+
status: string
5862
) => {
5963
console.log(
60-
`Added user: ${userId} to Mailchimp audience: ${audienceId} with Mailchimp ID: ${mailchimpId}`
64+
`Added user: ${userId} with status '${status}' to Mailchimp audience: ${audienceId} with Mailchimp ID: ${mailchimpId}`
6165
);
6266
};
6367

delete-user-data/extension.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ description:
2323

2424
license: Apache-2.0
2525
billingRequired: false
26-
sourceUrl: https://accounts.google.com/AccountChooser/signinchooser?service=gerritcodereview&continue=https%3A%2F%2Fdev-partners.googlesource.com%2Flogin%2Fsamples%2Ffirebase%2Fmods%2F%2B%2Fmaster%2Fdelete-user-data
27-
releaseNotesUrl: https://dev-partners.googlesource.com/samples/firebase/mods/+log
26+
sourceUrl: https://github.com/firebase/extensions/tree/master/delete-user-data
27+
releaseNotesUrl: https://github.com/firebase/extensions/commits/master
2828

2929
author:
3030
authorName: Firebase

firestore-bigquery-export/POSTINSTALL.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ You can test out this extension right away:
2222
SELECT * FROM `${param:PROJECT_ID}.${param:DATASET_ID}.${param:TABLE_ID}_raw_latest`
2323
```
2424
25-
1. Delete the `bigquery-mirror-test` document from [Cloud Firestore](https://console.firebase.google.com/project/${param:PROJECT_ID}/database/firestore/data).
25+
1. Delete the `bigquery-mirror-test` document from [Cloud Firestore](https://console.firebase.google.com/project/${param:PROJECT_ID}/database/firestore/data).
2626
The `bigquery-mirror-test` document will disappear from the **latest view** and a `DELETE` event will be added to the **raw changelog table**.
2727
2828
1. You can check the changelogs of a single document with this query:

0 commit comments

Comments
 (0)