Skip to content

Commit 78d6c2c

Browse files
authored
Merge branch 'develop' into tanjinhong72-patch-3
2 parents f533cfa + 81816fb commit 78d6c2c

File tree

221 files changed

+10320
-6910
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

221 files changed

+10320
-6910
lines changed

.github/styles/Vocab/Docs/accept.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ deeplink
5252
Dev
5353
Doubleclick
5454
Eloqua
55+
Emarsys
5556
enablement
5657
endcapture
5758
endfor
@@ -73,6 +74,7 @@ https
7374
HTTPS
7475
Hubspot
7576
incrementality
77+
Innovid
7678
ios
7779
iOS
7880
Iterable
@@ -111,6 +113,7 @@ Okta
111113
Omnichannel
112114
onboarding
113115
Optimizely
116+
Outfunnel
114117
param(:?s)
115118
Pardot
116119
Passcode
@@ -120,6 +123,7 @@ Pipedrive
120123
Preact
121124
Qualtrics
122125
reformat(:?s)
126+
remarket
123127
Responsys
124128
Rokt
125129
Sabil
@@ -141,6 +145,7 @@ Twilio
141145
upsert
142146
US
143147
utm
148+
varchar
144149
Vero
145150
Vidora
146151
viewability

scripts/catalog_papi.js

Lines changed: 11 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -336,7 +336,6 @@ const updateSources = async () => {
336336
const updateDestinations = async () => {
337337
let destinations = []
338338
let destinationsUpdated = []
339-
let regionalDestinationsUpdated = []
340339
let destinationCategories = []
341340
let categories = new Set()
342341
let nextPageToken = "MA=="
@@ -357,25 +356,23 @@ const updateDestinations = async () => {
357356
return 0;
358357
})
359358

360-
const regionalDestinationEndpoints = regionalSupport.destinations.endpoint
361-
const regionalDestinationRegions = regionalSupport.destinations.region
362-
363359

364360
destinations.forEach(destination => {
365-
let endpoints = ['us']
366-
let regions = ['us']
361+
let endpoints = []
362+
let regions = []
367363

368364
let slug = slugify(destination.name)
369-
370-
if (regionalDestinationEndpoints.includes(slug)) {
371-
endpoints.push('eu')
365+
366+
if (typeof destination.supportedRegions != "undefined") {
367+
regions = destination.supportedRegions
368+
} else {
369+
regions.push('us-west-2','eu-west-1')
372370
}
373-
374-
if (regionalDestinationRegions.includes(slug)) {
375-
regions.push('eu')
371+
if (typeof destination.regionEndpoints != "undefined"){
372+
endpoints = destination.regionEndpoints
373+
} else {
374+
endpoints.push('US')
376375
}
377-
378-
379376
let url = `connections/destinations/catalog/${slug}`
380377

381378
let tempCategories = [destination.categories]
@@ -463,16 +460,6 @@ const updateDestinations = async () => {
463460
doesCatalogItemExist(updatedDestination)
464461
tempCategories.reduce((s, e) => s.add(e), categories)
465462

466-
let updatedRegionalDestination = {
467-
id: destination.id,
468-
display_name: destination.name,
469-
slug,
470-
url,
471-
regions,
472-
endpoints
473-
}
474-
475-
regionalDestinationsUpdated.push(updatedRegionalDestination)
476463
})
477464

478465

@@ -514,13 +501,6 @@ const updateDestinations = async () => {
514501
}, options);
515502
fs.writeFileSync(path.resolve(__dirname, `../src/_data/catalog/destination_categories.yml`), output);
516503

517-
// Append regional destinations to regional file
518-
output = yaml.dump({
519-
destinations: regionalDestinationsUpdated
520-
}, {
521-
noArrayIndent: false
522-
})
523-
fs.appendFileSync(path.resolve(__dirname, `../src/_data/catalog/regional-supported.yml`), output);
524504
console.log("destinations done")
525505
}
526506

scripts/private-destination.js

Lines changed: 59 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ require('dotenv').config();
1717
const PAPI_URL = "https://api.segmentapis.com"
1818

1919
const PRIVATE_DESTINATIONS = yaml.load(fs.readFileSync(path.resolve(__dirname, `../src/_data/catalog/destinations_private.yml`)))
20+
const slugOverrides = yaml.load(fs.readFileSync(path.resolve(__dirname, `../src/_data/catalog/slugs.yml`)))
21+
2022
const privateDests = PRIVATE_DESTINATIONS.items
2123
let private = []
2224
const getCatalog = async (url, page_token = "MA==") => {
@@ -37,25 +39,65 @@ const getCatalog = async (url, page_token = "MA==") => {
3739
return res.data
3840
} catch (err) {
3941
console.error("Error response:");
40-
console.error(err.response.data); // ***
41-
console.error(err.response.status); // ***
42+
console.error(err.response.data); // ***
43+
console.error(err.response.status); // ***
4244
console.error(err.response.headers); // ***
4345
} finally {
44-
46+
4547
}
4648
}
4749

50+
const slugify = (displayName) => {
51+
let slug = displayName
52+
.toLowerCase()
53+
.replace(/\s+/g, '-')
54+
.replace('-&-', '-')
55+
.replace('/', '-')
56+
.replace(/[\(\)]/g, '')
57+
.replace('.', '-')
58+
59+
for (key in slugOverrides) {
60+
let original = slugOverrides[key].original
61+
let override = slugOverrides[key].override
62+
63+
if (slug == original) {
64+
slug = override
65+
}
66+
}
67+
68+
return slug
69+
}
4870

4971
const checkDestinationStatus = async (id) => {
5072
const res = await getCatalog(`${PAPI_URL}/catalog/destinations/${id}`)
5173
let destination = res.data.destinationMetadata
5274
return destination
5375
}
76+
77+
const makeDestinationPublic = async (itemURL) => {
78+
const catalogPath = path.resolve('src/', itemURL, 'index.md')
79+
const f = fm(fs.readFileSync(catalogPath, 'utf8'));
80+
const fmatter = f.attributes
81+
fmatter.private = false
82+
fmatter.hidden = false
83+
let new_fm = ""
84+
for (const property in fmatter) {
85+
if (property == "versions") {
86+
console.log(`Need to fix versions on this one`)
87+
}
88+
//console.log(`${property}: ${fmatter[property]}`);
89+
new_fm += `${property}: ${fmatter[property]}\n`
90+
}
91+
const attr = `---\n${new_fm}\n---\n`
92+
const body = f.body
93+
const content = attr + body
94+
fs.writeFileSync(catalogPath, content)
95+
}
5496
const getDestinationData = async (id) => {
5597
const res = await getCatalog(`${PAPI_URL}/catalog/destinations/${id}`)
5698
if (res == null) {
5799
return
58-
}
100+
}
59101
let destination = res.data.destinationMetadata
60102
let settings = destination.options
61103
settings.sort((a, b) => {
@@ -69,11 +111,13 @@ const getDestinationData = async (id) => {
69111
})
70112
let actions = destination.actions
71113
let presets = destination.presets
114+
let slug = slugify(destination.name)
115+
let url = `connections/destinations/catalog/${slug}`
72116

73117
// Force screen method into supportedMethods object
74118
destination.supportedMethods.screen = false
75119
// Set it true for LiveLike, per request
76-
if (destination.id == '63e42b47479274407b671071'){
120+
if (destination.id == '63e42b47479274407b671071') {
77121
destination.supportedMethods.screen = true
78122
}
79123

@@ -93,8 +137,9 @@ const getDestinationData = async (id) => {
93137
id: destination.id,
94138
display_name: destination.name,
95139
name: destination.name,
96-
slug: destination.slug,
140+
slug: slugify(destination.name),
97141
previous_names: destination.previousNames,
142+
url,
98143
website: destination.website,
99144
status: destination.status,
100145
logo: {
@@ -119,6 +164,7 @@ const getDestinationData = async (id) => {
119164
private.push(updatePrivateDest)
120165
} else {
121166
console.log(`${destination.name} is public and will be removed`)
167+
makeDestinationPublic(url)
122168
}
123169

124170
const options = {
@@ -148,12 +194,18 @@ const checkExistingStatus = async () => {
148194
let id = existingIds[i]
149195
let destination = await checkDestinationStatus(id)
150196
let status = destination.status
197+
let slug = slugify(destination.name)
198+
let url = `connections/destinations/catalog/${slug}`
199+
200+
201+
151202

152203
if (status === "PRIVATE_BETA") {
153204
// console.log(`${destination.name} is private`)
154205
newIds.push(id)
155206
} else {
156-
// console.log(`${destination.name}is public`)
207+
console.log(`src/connections/${destination.name}is public`)
208+
makeDestinationPublic(url)
157209
}
158210
}
159211
return newIds

src/_data/catalog/destination_categories.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# AUTOGENERATED FROM PUBLIC API. DO NOT EDIT
2-
# destination categories last updated 2023-02-28
2+
# destination categories last updated 2023-03-30
33
items:
44
- display_name: A/B Testing
55
slug: a-b-testing

0 commit comments

Comments
 (0)