Skip to content

Commit d78ac7f

Browse files
BernardGattBernard Gatt
andauthored
Updated SDK to allow remote injection of in-app plugin (#54)
* Uses remotely injected configuration if present * Updated to use latest version of gist-web --------- Co-authored-by: Bernard Gatt <[email protected]>
1 parent ff9973e commit d78ac7f

File tree

3 files changed

+23
-13
lines changed

3 files changed

+23
-13
lines changed

packages/browser/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@
5252
"@lukeed/uuid": "^2.0.0",
5353
"@segment/analytics.js-video-plugins": "^0.2.1",
5454
"@segment/facade": "^3.4.9",
55-
"customerio-gist-web": "3.15.3",
55+
"customerio-gist-web": "3.15.6",
5656
"dset": "^3.1.2",
5757
"js-cookie": "3.0.1",
5858
"node-fetch": "^2.6.7",

packages/browser/src/browser/index.ts

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -195,9 +195,9 @@ async function registerPlugins(
195195
const schemaFilter = opts.plan?.track
196196
? await import(
197197
/* webpackChunkName: "schemaFilter" */ '../plugins/schema-filter'
198-
).then((mod) => {
199-
return mod.schemaFilter(opts.plan?.track, legacySettings)
200-
})
198+
).then((mod) => {
199+
return mod.schemaFilter(opts.plan?.track, legacySettings)
200+
})
201201
: undefined
202202

203203
const mergedSettings = mergedOptions(legacySettings, options)
@@ -209,12 +209,22 @@ async function registerPlugins(
209209
tsubMiddleware
210210
).catch(() => [])
211211

212-
const inAppPlugin = options.integrations?.['Customer.io In-App Plugin'] as InAppPluginSettings
212+
const inAppPluginName = 'Customer.io In-App Plugin'
213+
let inAppPluginSettings = mergedSettings[
214+
inAppPluginName
215+
] as InAppPluginSettings
216+
if (!inAppPluginSettings) {
217+
inAppPluginSettings = options.integrations?.[
218+
inAppPluginName
219+
] as InAppPluginSettings
220+
}
221+
222+
const inAppPlugin = inAppPluginSettings
213223
? await import(
214224
/* webpackChunkName: "inAppPlugin" */ '../plugins/in-app-plugin'
215-
).then((mod) => {
216-
return mod.InAppPlugin(options.integrations?.['Customer.io In-App Plugin'] as InAppPluginSettings)
217-
})
225+
).then((mod) => {
226+
return mod.InAppPlugin(inAppPluginSettings)
227+
})
218228
: undefined
219229

220230
const toRegister = [

yarn.lock

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -777,7 +777,7 @@ __metadata:
777777
aws-sdk: ^2.814.0
778778
circular-dependency-plugin: ^5.2.2
779779
compression-webpack-plugin: ^8.0.1
780-
customerio-gist-web: 3.15.3
780+
customerio-gist-web: 3.15.6
781781
dset: ^3.1.2
782782
execa: ^4.1.0
783783
flat: ^5.0.2
@@ -5505,12 +5505,12 @@ __metadata:
55055505
languageName: node
55065506
linkType: hard
55075507

5508-
"customerio-gist-web@npm:3.15.3":
5509-
version: 3.15.3
5510-
resolution: "customerio-gist-web@npm:3.15.3"
5508+
"customerio-gist-web@npm:3.15.6":
5509+
version: 3.15.6
5510+
resolution: "customerio-gist-web@npm:3.15.6"
55115511
dependencies:
55125512
uuid: ^8.3.2
5513-
checksum: c14cdefbf29e08fb1fde35f18843255071e0c71e5467e50e2614f93459ca3b1f18b2afc8b88c132bac3da854127271e90409dbb96b5d39e9bfcf6603c342f7b5
5513+
checksum: 4ecbdfe4a24b06bc718401f063b7c825135fcb413b2d708fa8314505a65f9b698baca9d5425e75fb4cd4c9a61a513edba9e598780f7774847c7ed1284373eae2
55145514
languageName: node
55155515
linkType: hard
55165516

0 commit comments

Comments
 (0)