@drawbridge/drawbridge-utils 0.0.169 → 0.0.170
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/dist/connections/index.cjs +10 -6
- package/dist/connections/index.d.cts +35 -7
- package/dist/connections/index.d.ts +35 -7
- package/dist/connections/index.js +10 -6
- package/dist/providers.cjs +10 -6
- package/dist/providers.js +10 -6
- package/package.json +1 -1
|
@@ -3337,6 +3337,7 @@ var klaviyo_default2 = {
|
|
|
3337
3337
|
if (!email) return { message: "That lead has no email address to sync.", skipped: true };
|
|
3338
3338
|
const person = (context == null ? void 0 : context.contact) || null;
|
|
3339
3339
|
const totals = (person == null ? void 0 : person.totals) || {};
|
|
3340
|
+
const count = (value) => typeof value === "number" ? value : (value == null ? void 0 : value.total) || 0;
|
|
3340
3341
|
const profile = await api2("/profile-import", {
|
|
3341
3342
|
fetcher,
|
|
3342
3343
|
method: "POST",
|
|
@@ -3350,13 +3351,13 @@ var klaviyo_default2 = {
|
|
|
3350
3351
|
drawbridge_campaigns: (person.campaigns || []).length,
|
|
3351
3352
|
drawbridge_draws: totals.draws || 0,
|
|
3352
3353
|
drawbridge_entries: totals.entries || 0,
|
|
3353
|
-
drawbridge_orders: totals.orders
|
|
3354
|
+
drawbridge_orders: count(totals.orders),
|
|
3354
3355
|
// Campaign-attributed, NOT lifetime. A merchant running
|
|
3355
3356
|
// Shopify already has lifetime revenue in Klaviyo through
|
|
3356
3357
|
// Klaviyo's own integration; what only we can say is how
|
|
3357
3358
|
// much a campaign drove. Named so the two cannot be
|
|
3358
3359
|
// mistaken for one another in a segment builder.
|
|
3359
|
-
drawbridge_revenue: totals.gross
|
|
3360
|
+
drawbridge_revenue: count(totals.gross)
|
|
3360
3361
|
},
|
|
3361
3362
|
// THE DRAWBRIDGE SEGMENTS THEY ARE IN, as a list property the
|
|
3362
3363
|
// merchant builds Klaviyo segments on top of. Klaviyo owns no
|
|
@@ -3861,7 +3862,8 @@ var api3 = async (path, { dc, fetcher = fetch, method = "GET", payload, token })
|
|
|
3861
3862
|
return response.status === 204 ? null : response.json();
|
|
3862
3863
|
};
|
|
3863
3864
|
var subscriberHash = (email) => (0, import_node_crypto5.createHash)("md5").update(String(email).trim().toLowerCase()).digest("hex");
|
|
3864
|
-
var
|
|
3865
|
+
var TAG_NAME_LIMIT = 100;
|
|
3866
|
+
var tagName = (title) => ("Drawbridge: " + title).slice(0, TAG_NAME_LIMIT);
|
|
3865
3867
|
var mailchimp_default2 = {
|
|
3866
3868
|
// OAUTH 2, authorization code. Every url below is quoted from
|
|
3867
3869
|
// mailchimp.com/developer/marketing/guides/access-user-data-oauth-2/ rather
|
|
@@ -4086,10 +4088,12 @@ var mailchimp_default2 = {
|
|
|
4086
4088
|
// on attaching people to it by name. Both address the same object. The
|
|
4087
4089
|
// segment schema says it outright: "The type of segment. Static segments
|
|
4088
4090
|
// are now known as tags"
|
|
4089
|
-
// (api.mailchimp.com/schema/3.0/
|
|
4091
|
+
// (api.mailchimp.com/schema/3.0/Definitions/Lists/Segments/Response.json,
|
|
4092
|
+
// fetched 2026-09-12 — the root Swagger.json carries no prose, only $refs
|
|
4093
|
+
// into fragment files like this one).
|
|
4090
4094
|
//
|
|
4091
|
-
// IDEMPOTENT ON EVERY PATH: called on create, on rename, on
|
|
4092
|
-
//
|
|
4095
|
+
// IDEMPOTENT ON EVERY PATH: called on create, on rename, on a connection
|
|
4096
|
+
// finishing its configuration, and on the backfill migration, it converges. That is what lets one hook serve
|
|
4093
4097
|
// all four without a create-vs-update branch anywhere else.
|
|
4094
4098
|
register: async ({ connection: connection2, context, manifest, settings, token, workflow }, { fetcher, read } = {}) => {
|
|
4095
4099
|
var _a;
|
|
@@ -3867,6 +3867,13 @@ var klaviyo = {
|
|
|
3867
3867
|
// fetched 2026-09-09).
|
|
3868
3868
|
//
|
|
3869
3869
|
// IT MERGES, and that is why the blocks below are conditional rather
|
|
3870
|
+
// GROUPED OR FLAT, read as one number. contact.totals.orders and .gross
|
|
3871
|
+
// are { total, conversions, redemptions } now, but a contact the
|
|
3872
|
+
// backfill has not reached still holds the old flat number — and a
|
|
3873
|
+
// naked `totals.orders || 0` would hand Klaviyo the whole object as a
|
|
3874
|
+
// profile property. Klaviyo gets the total either way.
|
|
3875
|
+
const count = ( value ) => typeof value === 'number' ? value : ( value?.total || 0 );
|
|
3876
|
+
|
|
3870
3877
|
// than defaulted. "Not including a field in your request will leave it
|
|
3871
3878
|
// unchanged" — so omitting the totals on a lead.insert preserves
|
|
3872
3879
|
// whatever the last segment run published, where sending zeros would
|
|
@@ -3884,13 +3891,13 @@ var klaviyo = {
|
|
|
3884
3891
|
drawbridge_campaigns : ( person.campaigns || [] ).length,
|
|
3885
3892
|
drawbridge_draws : totals.draws || 0,
|
|
3886
3893
|
drawbridge_entries : totals.entries || 0,
|
|
3887
|
-
drawbridge_orders : totals.orders
|
|
3894
|
+
drawbridge_orders : count( totals.orders ),
|
|
3888
3895
|
// Campaign-attributed, NOT lifetime. A merchant running
|
|
3889
3896
|
// Shopify already has lifetime revenue in Klaviyo through
|
|
3890
3897
|
// Klaviyo's own integration; what only we can say is how
|
|
3891
3898
|
// much a campaign drove. Named so the two cannot be
|
|
3892
3899
|
// mistaken for one another in a segment builder.
|
|
3893
|
-
drawbridge_revenue : totals.gross
|
|
3900
|
+
drawbridge_revenue : count( totals.gross )
|
|
3894
3901
|
}),
|
|
3895
3902
|
// THE DRAWBRIDGE SEGMENTS THEY ARE IN, as a list property the
|
|
3896
3903
|
// merchant builds Klaviyo segments on top of. Klaviyo owns no
|
|
@@ -4616,7 +4623,24 @@ const subscriberHash = ( email ) => createHash( 'md5' )
|
|
|
4616
4623
|
// THE TAG'S NAME, and the one place it is spelled. The member write and the
|
|
4617
4624
|
// register hook must agree character for character — they address the same
|
|
4618
4625
|
// object, one by name and one by id — so a prefix change is one edit here.
|
|
4619
|
-
|
|
4626
|
+
//
|
|
4627
|
+
// TRUNCATED TO 100, because that is Mailchimp's documented ceiling for a tag
|
|
4628
|
+
// name ("Tag names can be a maximum of 100 characters",
|
|
4629
|
+
// mailchimp.com/help/create-add-remove-tags, fetched 2026-09-12) and a segment
|
|
4630
|
+
// title can be 100 on its own — so the prefix pushes any title over 88 past it.
|
|
4631
|
+
// The limit is in their help centre and NOT in the API schema, which constrains
|
|
4632
|
+
// `name` to a bare string, so what the API does with an over-long name is
|
|
4633
|
+
// unspecified: it may reject the whole write or truncate server-side, and a
|
|
4634
|
+
// server-side truncation is the worse outcome because register would then look
|
|
4635
|
+
// for a name Mailchimp had silently changed.
|
|
4636
|
+
//
|
|
4637
|
+
// ponytail: two segments whose first 88 characters match would share one tag.
|
|
4638
|
+
// The upgrade is to append a short hash of the segment id, which costs the name
|
|
4639
|
+
// its readability in the merchant's own audience — not worth it until somebody
|
|
4640
|
+
// actually collides.
|
|
4641
|
+
const TAG_NAME_LIMIT = 100;
|
|
4642
|
+
|
|
4643
|
+
const tagName = ( title ) => ( 'Drawbridge: ' + title ).slice( 0, TAG_NAME_LIMIT );
|
|
4620
4644
|
|
|
4621
4645
|
// Mailchimp — contact sync, not a sender.
|
|
4622
4646
|
var mailchimp = {
|
|
@@ -4964,10 +4988,12 @@ var mailchimp = {
|
|
|
4964
4988
|
// on attaching people to it by name. Both address the same object. The
|
|
4965
4989
|
// segment schema says it outright: "The type of segment. Static segments
|
|
4966
4990
|
// are now known as tags"
|
|
4967
|
-
// (api.mailchimp.com/schema/3.0/
|
|
4991
|
+
// (api.mailchimp.com/schema/3.0/Definitions/Lists/Segments/Response.json,
|
|
4992
|
+
// fetched 2026-09-12 — the root Swagger.json carries no prose, only $refs
|
|
4993
|
+
// into fragment files like this one).
|
|
4968
4994
|
//
|
|
4969
|
-
// IDEMPOTENT ON EVERY PATH: called on create, on rename, on
|
|
4970
|
-
//
|
|
4995
|
+
// IDEMPOTENT ON EVERY PATH: called on create, on rename, on a connection
|
|
4996
|
+
// finishing its configuration, and on the backfill migration, it converges. That is what lets one hook serve
|
|
4971
4997
|
// all four without a create-vs-update branch anywhere else.
|
|
4972
4998
|
register : async ( { connection, context, manifest, settings, token, workflow }, { fetcher, read } = {} ) => {
|
|
4973
4999
|
|
|
@@ -5033,7 +5059,9 @@ var mailchimp = {
|
|
|
5033
5059
|
// tag-search matches on PREFIX, not on the exact name: "The search
|
|
5034
5060
|
// query will be compared to each tag as a prefix, so all tags that
|
|
5035
5061
|
// have a name starting with this field will be returned"
|
|
5036
|
-
// (api.mailchimp.com/schema/3.0/
|
|
5062
|
+
// (api.mailchimp.com/schema/3.0/Parameters/PrefixTagSearchName.json,
|
|
5063
|
+
// fetched 2026-09-12 — the TagSearch path only $refs this parameter, and
|
|
5064
|
+
// the root Swagger.json carries no prose at all). So
|
|
5037
5065
|
// "Drawbridge: VIP" answers for "Drawbridge: VIPs" too, and attaching
|
|
5038
5066
|
// the row to the first result would point this segment at a different
|
|
5039
5067
|
// merchant's tag. The exact name is filtered here.
|
|
@@ -3867,6 +3867,13 @@ var klaviyo = {
|
|
|
3867
3867
|
// fetched 2026-09-09).
|
|
3868
3868
|
//
|
|
3869
3869
|
// IT MERGES, and that is why the blocks below are conditional rather
|
|
3870
|
+
// GROUPED OR FLAT, read as one number. contact.totals.orders and .gross
|
|
3871
|
+
// are { total, conversions, redemptions } now, but a contact the
|
|
3872
|
+
// backfill has not reached still holds the old flat number — and a
|
|
3873
|
+
// naked `totals.orders || 0` would hand Klaviyo the whole object as a
|
|
3874
|
+
// profile property. Klaviyo gets the total either way.
|
|
3875
|
+
const count = ( value ) => typeof value === 'number' ? value : ( value?.total || 0 );
|
|
3876
|
+
|
|
3870
3877
|
// than defaulted. "Not including a field in your request will leave it
|
|
3871
3878
|
// unchanged" — so omitting the totals on a lead.insert preserves
|
|
3872
3879
|
// whatever the last segment run published, where sending zeros would
|
|
@@ -3884,13 +3891,13 @@ var klaviyo = {
|
|
|
3884
3891
|
drawbridge_campaigns : ( person.campaigns || [] ).length,
|
|
3885
3892
|
drawbridge_draws : totals.draws || 0,
|
|
3886
3893
|
drawbridge_entries : totals.entries || 0,
|
|
3887
|
-
drawbridge_orders : totals.orders
|
|
3894
|
+
drawbridge_orders : count( totals.orders ),
|
|
3888
3895
|
// Campaign-attributed, NOT lifetime. A merchant running
|
|
3889
3896
|
// Shopify already has lifetime revenue in Klaviyo through
|
|
3890
3897
|
// Klaviyo's own integration; what only we can say is how
|
|
3891
3898
|
// much a campaign drove. Named so the two cannot be
|
|
3892
3899
|
// mistaken for one another in a segment builder.
|
|
3893
|
-
drawbridge_revenue : totals.gross
|
|
3900
|
+
drawbridge_revenue : count( totals.gross )
|
|
3894
3901
|
}),
|
|
3895
3902
|
// THE DRAWBRIDGE SEGMENTS THEY ARE IN, as a list property the
|
|
3896
3903
|
// merchant builds Klaviyo segments on top of. Klaviyo owns no
|
|
@@ -4616,7 +4623,24 @@ const subscriberHash = ( email ) => createHash( 'md5' )
|
|
|
4616
4623
|
// THE TAG'S NAME, and the one place it is spelled. The member write and the
|
|
4617
4624
|
// register hook must agree character for character — they address the same
|
|
4618
4625
|
// object, one by name and one by id — so a prefix change is one edit here.
|
|
4619
|
-
|
|
4626
|
+
//
|
|
4627
|
+
// TRUNCATED TO 100, because that is Mailchimp's documented ceiling for a tag
|
|
4628
|
+
// name ("Tag names can be a maximum of 100 characters",
|
|
4629
|
+
// mailchimp.com/help/create-add-remove-tags, fetched 2026-09-12) and a segment
|
|
4630
|
+
// title can be 100 on its own — so the prefix pushes any title over 88 past it.
|
|
4631
|
+
// The limit is in their help centre and NOT in the API schema, which constrains
|
|
4632
|
+
// `name` to a bare string, so what the API does with an over-long name is
|
|
4633
|
+
// unspecified: it may reject the whole write or truncate server-side, and a
|
|
4634
|
+
// server-side truncation is the worse outcome because register would then look
|
|
4635
|
+
// for a name Mailchimp had silently changed.
|
|
4636
|
+
//
|
|
4637
|
+
// ponytail: two segments whose first 88 characters match would share one tag.
|
|
4638
|
+
// The upgrade is to append a short hash of the segment id, which costs the name
|
|
4639
|
+
// its readability in the merchant's own audience — not worth it until somebody
|
|
4640
|
+
// actually collides.
|
|
4641
|
+
const TAG_NAME_LIMIT = 100;
|
|
4642
|
+
|
|
4643
|
+
const tagName = ( title ) => ( 'Drawbridge: ' + title ).slice( 0, TAG_NAME_LIMIT );
|
|
4620
4644
|
|
|
4621
4645
|
// Mailchimp — contact sync, not a sender.
|
|
4622
4646
|
var mailchimp = {
|
|
@@ -4964,10 +4988,12 @@ var mailchimp = {
|
|
|
4964
4988
|
// on attaching people to it by name. Both address the same object. The
|
|
4965
4989
|
// segment schema says it outright: "The type of segment. Static segments
|
|
4966
4990
|
// are now known as tags"
|
|
4967
|
-
// (api.mailchimp.com/schema/3.0/
|
|
4991
|
+
// (api.mailchimp.com/schema/3.0/Definitions/Lists/Segments/Response.json,
|
|
4992
|
+
// fetched 2026-09-12 — the root Swagger.json carries no prose, only $refs
|
|
4993
|
+
// into fragment files like this one).
|
|
4968
4994
|
//
|
|
4969
|
-
// IDEMPOTENT ON EVERY PATH: called on create, on rename, on
|
|
4970
|
-
//
|
|
4995
|
+
// IDEMPOTENT ON EVERY PATH: called on create, on rename, on a connection
|
|
4996
|
+
// finishing its configuration, and on the backfill migration, it converges. That is what lets one hook serve
|
|
4971
4997
|
// all four without a create-vs-update branch anywhere else.
|
|
4972
4998
|
register : async ( { connection, context, manifest, settings, token, workflow }, { fetcher, read } = {} ) => {
|
|
4973
4999
|
|
|
@@ -5033,7 +5059,9 @@ var mailchimp = {
|
|
|
5033
5059
|
// tag-search matches on PREFIX, not on the exact name: "The search
|
|
5034
5060
|
// query will be compared to each tag as a prefix, so all tags that
|
|
5035
5061
|
// have a name starting with this field will be returned"
|
|
5036
|
-
// (api.mailchimp.com/schema/3.0/
|
|
5062
|
+
// (api.mailchimp.com/schema/3.0/Parameters/PrefixTagSearchName.json,
|
|
5063
|
+
// fetched 2026-09-12 — the TagSearch path only $refs this parameter, and
|
|
5064
|
+
// the root Swagger.json carries no prose at all). So
|
|
5037
5065
|
// "Drawbridge: VIP" answers for "Drawbridge: VIPs" too, and attaching
|
|
5038
5066
|
// the row to the first result would point this segment at a different
|
|
5039
5067
|
// merchant's tag. The exact name is filtered here.
|
|
@@ -3261,6 +3261,7 @@ var klaviyo_default2 = {
|
|
|
3261
3261
|
if (!email) return { message: "That lead has no email address to sync.", skipped: true };
|
|
3262
3262
|
const person = (context == null ? void 0 : context.contact) || null;
|
|
3263
3263
|
const totals = (person == null ? void 0 : person.totals) || {};
|
|
3264
|
+
const count = (value) => typeof value === "number" ? value : (value == null ? void 0 : value.total) || 0;
|
|
3264
3265
|
const profile = await api2("/profile-import", {
|
|
3265
3266
|
fetcher,
|
|
3266
3267
|
method: "POST",
|
|
@@ -3274,13 +3275,13 @@ var klaviyo_default2 = {
|
|
|
3274
3275
|
drawbridge_campaigns: (person.campaigns || []).length,
|
|
3275
3276
|
drawbridge_draws: totals.draws || 0,
|
|
3276
3277
|
drawbridge_entries: totals.entries || 0,
|
|
3277
|
-
drawbridge_orders: totals.orders
|
|
3278
|
+
drawbridge_orders: count(totals.orders),
|
|
3278
3279
|
// Campaign-attributed, NOT lifetime. A merchant running
|
|
3279
3280
|
// Shopify already has lifetime revenue in Klaviyo through
|
|
3280
3281
|
// Klaviyo's own integration; what only we can say is how
|
|
3281
3282
|
// much a campaign drove. Named so the two cannot be
|
|
3282
3283
|
// mistaken for one another in a segment builder.
|
|
3283
|
-
drawbridge_revenue: totals.gross
|
|
3284
|
+
drawbridge_revenue: count(totals.gross)
|
|
3284
3285
|
},
|
|
3285
3286
|
// THE DRAWBRIDGE SEGMENTS THEY ARE IN, as a list property the
|
|
3286
3287
|
// merchant builds Klaviyo segments on top of. Klaviyo owns no
|
|
@@ -3785,7 +3786,8 @@ var api3 = async (path, { dc, fetcher = fetch, method = "GET", payload, token })
|
|
|
3785
3786
|
return response.status === 204 ? null : response.json();
|
|
3786
3787
|
};
|
|
3787
3788
|
var subscriberHash = (email) => createHash2("md5").update(String(email).trim().toLowerCase()).digest("hex");
|
|
3788
|
-
var
|
|
3789
|
+
var TAG_NAME_LIMIT = 100;
|
|
3790
|
+
var tagName = (title) => ("Drawbridge: " + title).slice(0, TAG_NAME_LIMIT);
|
|
3789
3791
|
var mailchimp_default2 = {
|
|
3790
3792
|
// OAUTH 2, authorization code. Every url below is quoted from
|
|
3791
3793
|
// mailchimp.com/developer/marketing/guides/access-user-data-oauth-2/ rather
|
|
@@ -4010,10 +4012,12 @@ var mailchimp_default2 = {
|
|
|
4010
4012
|
// on attaching people to it by name. Both address the same object. The
|
|
4011
4013
|
// segment schema says it outright: "The type of segment. Static segments
|
|
4012
4014
|
// are now known as tags"
|
|
4013
|
-
// (api.mailchimp.com/schema/3.0/
|
|
4015
|
+
// (api.mailchimp.com/schema/3.0/Definitions/Lists/Segments/Response.json,
|
|
4016
|
+
// fetched 2026-09-12 — the root Swagger.json carries no prose, only $refs
|
|
4017
|
+
// into fragment files like this one).
|
|
4014
4018
|
//
|
|
4015
|
-
// IDEMPOTENT ON EVERY PATH: called on create, on rename, on
|
|
4016
|
-
//
|
|
4019
|
+
// IDEMPOTENT ON EVERY PATH: called on create, on rename, on a connection
|
|
4020
|
+
// finishing its configuration, and on the backfill migration, it converges. That is what lets one hook serve
|
|
4017
4021
|
// all four without a create-vs-update branch anywhere else.
|
|
4018
4022
|
register: async ({ connection: connection2, context, manifest, settings, token, workflow }, { fetcher, read } = {}) => {
|
|
4019
4023
|
var _a;
|
package/dist/providers.cjs
CHANGED
|
@@ -3246,6 +3246,7 @@ var klaviyo_default2 = {
|
|
|
3246
3246
|
if (!email) return { message: "That lead has no email address to sync.", skipped: true };
|
|
3247
3247
|
const person = (context == null ? void 0 : context.contact) || null;
|
|
3248
3248
|
const totals = (person == null ? void 0 : person.totals) || {};
|
|
3249
|
+
const count = (value) => typeof value === "number" ? value : (value == null ? void 0 : value.total) || 0;
|
|
3249
3250
|
const profile = await api2("/profile-import", {
|
|
3250
3251
|
fetcher,
|
|
3251
3252
|
method: "POST",
|
|
@@ -3259,13 +3260,13 @@ var klaviyo_default2 = {
|
|
|
3259
3260
|
drawbridge_campaigns: (person.campaigns || []).length,
|
|
3260
3261
|
drawbridge_draws: totals.draws || 0,
|
|
3261
3262
|
drawbridge_entries: totals.entries || 0,
|
|
3262
|
-
drawbridge_orders: totals.orders
|
|
3263
|
+
drawbridge_orders: count(totals.orders),
|
|
3263
3264
|
// Campaign-attributed, NOT lifetime. A merchant running
|
|
3264
3265
|
// Shopify already has lifetime revenue in Klaviyo through
|
|
3265
3266
|
// Klaviyo's own integration; what only we can say is how
|
|
3266
3267
|
// much a campaign drove. Named so the two cannot be
|
|
3267
3268
|
// mistaken for one another in a segment builder.
|
|
3268
|
-
drawbridge_revenue: totals.gross
|
|
3269
|
+
drawbridge_revenue: count(totals.gross)
|
|
3269
3270
|
},
|
|
3270
3271
|
// THE DRAWBRIDGE SEGMENTS THEY ARE IN, as a list property the
|
|
3271
3272
|
// merchant builds Klaviyo segments on top of. Klaviyo owns no
|
|
@@ -3770,7 +3771,8 @@ var api3 = async (path, { dc, fetcher = fetch, method = "GET", payload, token })
|
|
|
3770
3771
|
return response.status === 204 ? null : response.json();
|
|
3771
3772
|
};
|
|
3772
3773
|
var subscriberHash = (email) => (0, import_node_crypto5.createHash)("md5").update(String(email).trim().toLowerCase()).digest("hex");
|
|
3773
|
-
var
|
|
3774
|
+
var TAG_NAME_LIMIT = 100;
|
|
3775
|
+
var tagName = (title) => ("Drawbridge: " + title).slice(0, TAG_NAME_LIMIT);
|
|
3774
3776
|
var mailchimp_default2 = {
|
|
3775
3777
|
// OAUTH 2, authorization code. Every url below is quoted from
|
|
3776
3778
|
// mailchimp.com/developer/marketing/guides/access-user-data-oauth-2/ rather
|
|
@@ -3995,10 +3997,12 @@ var mailchimp_default2 = {
|
|
|
3995
3997
|
// on attaching people to it by name. Both address the same object. The
|
|
3996
3998
|
// segment schema says it outright: "The type of segment. Static segments
|
|
3997
3999
|
// are now known as tags"
|
|
3998
|
-
// (api.mailchimp.com/schema/3.0/
|
|
4000
|
+
// (api.mailchimp.com/schema/3.0/Definitions/Lists/Segments/Response.json,
|
|
4001
|
+
// fetched 2026-09-12 — the root Swagger.json carries no prose, only $refs
|
|
4002
|
+
// into fragment files like this one).
|
|
3999
4003
|
//
|
|
4000
|
-
// IDEMPOTENT ON EVERY PATH: called on create, on rename, on
|
|
4001
|
-
//
|
|
4004
|
+
// IDEMPOTENT ON EVERY PATH: called on create, on rename, on a connection
|
|
4005
|
+
// finishing its configuration, and on the backfill migration, it converges. That is what lets one hook serve
|
|
4002
4006
|
// all four without a create-vs-update branch anywhere else.
|
|
4003
4007
|
register: async ({ connection: connection2, context, manifest, settings, token, workflow }, { fetcher, read } = {}) => {
|
|
4004
4008
|
var _a;
|
package/dist/providers.js
CHANGED
|
@@ -3197,6 +3197,7 @@ var klaviyo_default2 = {
|
|
|
3197
3197
|
if (!email) return { message: "That lead has no email address to sync.", skipped: true };
|
|
3198
3198
|
const person = (context == null ? void 0 : context.contact) || null;
|
|
3199
3199
|
const totals = (person == null ? void 0 : person.totals) || {};
|
|
3200
|
+
const count = (value) => typeof value === "number" ? value : (value == null ? void 0 : value.total) || 0;
|
|
3200
3201
|
const profile = await api2("/profile-import", {
|
|
3201
3202
|
fetcher,
|
|
3202
3203
|
method: "POST",
|
|
@@ -3210,13 +3211,13 @@ var klaviyo_default2 = {
|
|
|
3210
3211
|
drawbridge_campaigns: (person.campaigns || []).length,
|
|
3211
3212
|
drawbridge_draws: totals.draws || 0,
|
|
3212
3213
|
drawbridge_entries: totals.entries || 0,
|
|
3213
|
-
drawbridge_orders: totals.orders
|
|
3214
|
+
drawbridge_orders: count(totals.orders),
|
|
3214
3215
|
// Campaign-attributed, NOT lifetime. A merchant running
|
|
3215
3216
|
// Shopify already has lifetime revenue in Klaviyo through
|
|
3216
3217
|
// Klaviyo's own integration; what only we can say is how
|
|
3217
3218
|
// much a campaign drove. Named so the two cannot be
|
|
3218
3219
|
// mistaken for one another in a segment builder.
|
|
3219
|
-
drawbridge_revenue: totals.gross
|
|
3220
|
+
drawbridge_revenue: count(totals.gross)
|
|
3220
3221
|
},
|
|
3221
3222
|
// THE DRAWBRIDGE SEGMENTS THEY ARE IN, as a list property the
|
|
3222
3223
|
// merchant builds Klaviyo segments on top of. Klaviyo owns no
|
|
@@ -3721,7 +3722,8 @@ var api3 = async (path, { dc, fetcher = fetch, method = "GET", payload, token })
|
|
|
3721
3722
|
return response.status === 204 ? null : response.json();
|
|
3722
3723
|
};
|
|
3723
3724
|
var subscriberHash = (email) => createHash2("md5").update(String(email).trim().toLowerCase()).digest("hex");
|
|
3724
|
-
var
|
|
3725
|
+
var TAG_NAME_LIMIT = 100;
|
|
3726
|
+
var tagName = (title) => ("Drawbridge: " + title).slice(0, TAG_NAME_LIMIT);
|
|
3725
3727
|
var mailchimp_default2 = {
|
|
3726
3728
|
// OAUTH 2, authorization code. Every url below is quoted from
|
|
3727
3729
|
// mailchimp.com/developer/marketing/guides/access-user-data-oauth-2/ rather
|
|
@@ -3946,10 +3948,12 @@ var mailchimp_default2 = {
|
|
|
3946
3948
|
// on attaching people to it by name. Both address the same object. The
|
|
3947
3949
|
// segment schema says it outright: "The type of segment. Static segments
|
|
3948
3950
|
// are now known as tags"
|
|
3949
|
-
// (api.mailchimp.com/schema/3.0/
|
|
3951
|
+
// (api.mailchimp.com/schema/3.0/Definitions/Lists/Segments/Response.json,
|
|
3952
|
+
// fetched 2026-09-12 — the root Swagger.json carries no prose, only $refs
|
|
3953
|
+
// into fragment files like this one).
|
|
3950
3954
|
//
|
|
3951
|
-
// IDEMPOTENT ON EVERY PATH: called on create, on rename, on
|
|
3952
|
-
//
|
|
3955
|
+
// IDEMPOTENT ON EVERY PATH: called on create, on rename, on a connection
|
|
3956
|
+
// finishing its configuration, and on the backfill migration, it converges. That is what lets one hook serve
|
|
3953
3957
|
// all four without a create-vs-update branch anywhere else.
|
|
3954
3958
|
register: async ({ connection: connection2, context, manifest, settings, token, workflow }, { fetcher, read } = {}) => {
|
|
3955
3959
|
var _a;
|
package/package.json
CHANGED