@drawbridge/drawbridge-utils 0.0.114 → 0.0.115
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 +263 -2
- package/dist/connections/index.d.cts +340 -3
- package/dist/connections/index.d.ts +340 -3
- package/dist/connections/index.js +262 -2
- package/dist/features.cjs +15 -0
- package/dist/features.d.cts +15 -0
- package/dist/features.d.ts +15 -0
- package/dist/features.js +15 -0
- package/dist/fields-validate.js +1 -1
- package/dist/phone.cjs +12 -0
- package/dist/phone.d.cts +30 -2
- package/dist/phone.d.ts +30 -2
- package/dist/phone.js +12 -1
- package/dist/plans.cjs +17 -0
- package/dist/plans.d.cts +2 -0
- package/dist/plans.d.ts +2 -0
- package/dist/plans.js +17 -0
- package/dist/pricing.cjs +17 -0
- package/dist/pricing.js +17 -0
- package/package.json +2 -2
package/dist/features.cjs
CHANGED
|
@@ -94,6 +94,21 @@ var field = {
|
|
|
94
94
|
}
|
|
95
95
|
};
|
|
96
96
|
var connection = {
|
|
97
|
+
attentive: {
|
|
98
|
+
key: "organization:connection:attentive",
|
|
99
|
+
error: "Plan does not include Attentive connection",
|
|
100
|
+
feature: "Attentive connection"
|
|
101
|
+
},
|
|
102
|
+
// Klaviyo shipped without an entry here, which meant no plan GRANTED its
|
|
103
|
+
// key and the feature gate denied every non-admin request — a latent 403
|
|
104
|
+
// found while adding Attentive. getPlanFeature answers granted:false for a
|
|
105
|
+
// key absent from the plan's map, so a manifest feature key that appears in
|
|
106
|
+
// no plan list is a connection only admins can manage.
|
|
107
|
+
klaviyo: {
|
|
108
|
+
key: "organization:connection:klaviyo",
|
|
109
|
+
error: "Plan does not include Klaviyo connection",
|
|
110
|
+
feature: "Klaviyo connection"
|
|
111
|
+
},
|
|
97
112
|
mailchimp: {
|
|
98
113
|
key: "organization:connection:mailchimp",
|
|
99
114
|
error: "Plan does not include Mailchimp connection",
|
package/dist/features.d.cts
CHANGED
|
@@ -68,6 +68,21 @@ const field = {
|
|
|
68
68
|
};
|
|
69
69
|
|
|
70
70
|
const connection = {
|
|
71
|
+
attentive : {
|
|
72
|
+
key : 'organization:connection:attentive',
|
|
73
|
+
error : 'Plan does not include Attentive connection',
|
|
74
|
+
feature : 'Attentive connection'
|
|
75
|
+
},
|
|
76
|
+
// Klaviyo shipped without an entry here, which meant no plan GRANTED its
|
|
77
|
+
// key and the feature gate denied every non-admin request — a latent 403
|
|
78
|
+
// found while adding Attentive. getPlanFeature answers granted:false for a
|
|
79
|
+
// key absent from the plan's map, so a manifest feature key that appears in
|
|
80
|
+
// no plan list is a connection only admins can manage.
|
|
81
|
+
klaviyo : {
|
|
82
|
+
key : 'organization:connection:klaviyo',
|
|
83
|
+
error : 'Plan does not include Klaviyo connection',
|
|
84
|
+
feature : 'Klaviyo connection'
|
|
85
|
+
},
|
|
71
86
|
mailchimp : {
|
|
72
87
|
key : 'organization:connection:mailchimp',
|
|
73
88
|
error : 'Plan does not include Mailchimp connection',
|
package/dist/features.d.ts
CHANGED
|
@@ -68,6 +68,21 @@ const field = {
|
|
|
68
68
|
};
|
|
69
69
|
|
|
70
70
|
const connection = {
|
|
71
|
+
attentive : {
|
|
72
|
+
key : 'organization:connection:attentive',
|
|
73
|
+
error : 'Plan does not include Attentive connection',
|
|
74
|
+
feature : 'Attentive connection'
|
|
75
|
+
},
|
|
76
|
+
// Klaviyo shipped without an entry here, which meant no plan GRANTED its
|
|
77
|
+
// key and the feature gate denied every non-admin request — a latent 403
|
|
78
|
+
// found while adding Attentive. getPlanFeature answers granted:false for a
|
|
79
|
+
// key absent from the plan's map, so a manifest feature key that appears in
|
|
80
|
+
// no plan list is a connection only admins can manage.
|
|
81
|
+
klaviyo : {
|
|
82
|
+
key : 'organization:connection:klaviyo',
|
|
83
|
+
error : 'Plan does not include Klaviyo connection',
|
|
84
|
+
feature : 'Klaviyo connection'
|
|
85
|
+
},
|
|
71
86
|
mailchimp : {
|
|
72
87
|
key : 'organization:connection:mailchimp',
|
|
73
88
|
error : 'Plan does not include Mailchimp connection',
|
package/dist/features.js
CHANGED
|
@@ -66,6 +66,21 @@ var field = {
|
|
|
66
66
|
}
|
|
67
67
|
};
|
|
68
68
|
var connection = {
|
|
69
|
+
attentive: {
|
|
70
|
+
key: "organization:connection:attentive",
|
|
71
|
+
error: "Plan does not include Attentive connection",
|
|
72
|
+
feature: "Attentive connection"
|
|
73
|
+
},
|
|
74
|
+
// Klaviyo shipped without an entry here, which meant no plan GRANTED its
|
|
75
|
+
// key and the feature gate denied every non-admin request — a latent 403
|
|
76
|
+
// found while adding Attentive. getPlanFeature answers granted:false for a
|
|
77
|
+
// key absent from the plan's map, so a manifest feature key that appears in
|
|
78
|
+
// no plan list is a connection only admins can manage.
|
|
79
|
+
klaviyo: {
|
|
80
|
+
key: "organization:connection:klaviyo",
|
|
81
|
+
error: "Plan does not include Klaviyo connection",
|
|
82
|
+
feature: "Klaviyo connection"
|
|
83
|
+
},
|
|
69
84
|
mailchimp: {
|
|
70
85
|
key: "organization:connection:mailchimp",
|
|
71
86
|
error: "Plan does not include Mailchimp connection",
|
package/dist/fields-validate.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// lib/phone.js
|
|
2
|
-
import { parsePhoneNumberFromString, isValidPhoneNumber } from "libphonenumber-js";
|
|
2
|
+
import { AsYouType, parsePhoneNumberFromString, isValidPhoneNumber } from "libphonenumber-js";
|
|
3
3
|
var isValid = (value, country) => {
|
|
4
4
|
if (!value) return false;
|
|
5
5
|
try {
|
package/dist/phone.cjs
CHANGED
|
@@ -19,6 +19,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
19
19
|
// lib/phone.js
|
|
20
20
|
var phone_exports = {};
|
|
21
21
|
__export(phone_exports, {
|
|
22
|
+
detectCountry: () => detectCountry,
|
|
22
23
|
isValid: () => isValid,
|
|
23
24
|
toE164: () => toE164
|
|
24
25
|
});
|
|
@@ -33,6 +34,16 @@ var toE164 = (value, country) => {
|
|
|
33
34
|
return null;
|
|
34
35
|
}
|
|
35
36
|
};
|
|
37
|
+
var detectCountry = (value) => {
|
|
38
|
+
if (!value) return null;
|
|
39
|
+
try {
|
|
40
|
+
const parser = new import_libphonenumber_js.AsYouType();
|
|
41
|
+
parser.input(String(value));
|
|
42
|
+
return parser.getCountry() || null;
|
|
43
|
+
} catch {
|
|
44
|
+
return null;
|
|
45
|
+
}
|
|
46
|
+
};
|
|
36
47
|
var isValid = (value, country) => {
|
|
37
48
|
if (!value) return false;
|
|
38
49
|
try {
|
|
@@ -43,6 +54,7 @@ var isValid = (value, country) => {
|
|
|
43
54
|
};
|
|
44
55
|
// Annotate the CommonJS export names for ESM import in node:
|
|
45
56
|
0 && (module.exports = {
|
|
57
|
+
detectCountry,
|
|
46
58
|
isValid,
|
|
47
59
|
toE164
|
|
48
60
|
});
|
package/dist/phone.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { isValidPhoneNumber, parsePhoneNumberFromString } from 'libphonenumber-js';
|
|
1
|
+
import { AsYouType, isValidPhoneNumber, parsePhoneNumberFromString } from 'libphonenumber-js';
|
|
2
2
|
|
|
3
3
|
// Canonicalize a phone value to E.164 (e.g. '+15551234567'), or null if it cannot
|
|
4
4
|
// be parsed. `country` (ISO 3166-1 alpha-2, e.g. 'US') is only needed for
|
|
@@ -24,6 +24,34 @@ const toE164 = ( value, country ) => {
|
|
|
24
24
|
|
|
25
25
|
};
|
|
26
26
|
|
|
27
|
+
// Resolve which country an entered number belongs to (ISO 3166-1 alpha-2), or null
|
|
28
|
+
// while it is still ambiguous. Backs the country selector on phone fields, which
|
|
29
|
+
// follows the number the visitor types rather than asking them to set it first.
|
|
30
|
+
// libphonenumber only commits to a country once the number is COMPLETE: '+1604…'
|
|
31
|
+
// stays null until the final digit because Canada and the US share the +1 calling
|
|
32
|
+
// code and are told apart by area code. Callers MUST treat null as "leave the
|
|
33
|
+
// current selection alone" — never as "reset it" — or every keystroke short of a
|
|
34
|
+
// finished number would wipe the visitor's country.
|
|
35
|
+
const detectCountry = ( value ) => {
|
|
36
|
+
|
|
37
|
+
if( ! value ) return null;
|
|
38
|
+
|
|
39
|
+
try {
|
|
40
|
+
|
|
41
|
+
const parser = new AsYouType();
|
|
42
|
+
|
|
43
|
+
parser.input( String( value ) );
|
|
44
|
+
|
|
45
|
+
return parser.getCountry() || null;
|
|
46
|
+
|
|
47
|
+
} catch {
|
|
48
|
+
|
|
49
|
+
return null;
|
|
50
|
+
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
};
|
|
54
|
+
|
|
27
55
|
// Strict validity check (wraps libphonenumber-js). Mirrors the validation
|
|
28
56
|
// drawbridge-api's submission route already performs on lead phone input.
|
|
29
57
|
const isValid = ( value, country ) => {
|
|
@@ -42,4 +70,4 @@ const isValid = ( value, country ) => {
|
|
|
42
70
|
|
|
43
71
|
};
|
|
44
72
|
|
|
45
|
-
export { isValid, toE164 };
|
|
73
|
+
export { detectCountry, isValid, toE164 };
|
package/dist/phone.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { isValidPhoneNumber, parsePhoneNumberFromString } from 'libphonenumber-js';
|
|
1
|
+
import { AsYouType, isValidPhoneNumber, parsePhoneNumberFromString } from 'libphonenumber-js';
|
|
2
2
|
|
|
3
3
|
// Canonicalize a phone value to E.164 (e.g. '+15551234567'), or null if it cannot
|
|
4
4
|
// be parsed. `country` (ISO 3166-1 alpha-2, e.g. 'US') is only needed for
|
|
@@ -24,6 +24,34 @@ const toE164 = ( value, country ) => {
|
|
|
24
24
|
|
|
25
25
|
};
|
|
26
26
|
|
|
27
|
+
// Resolve which country an entered number belongs to (ISO 3166-1 alpha-2), or null
|
|
28
|
+
// while it is still ambiguous. Backs the country selector on phone fields, which
|
|
29
|
+
// follows the number the visitor types rather than asking them to set it first.
|
|
30
|
+
// libphonenumber only commits to a country once the number is COMPLETE: '+1604…'
|
|
31
|
+
// stays null until the final digit because Canada and the US share the +1 calling
|
|
32
|
+
// code and are told apart by area code. Callers MUST treat null as "leave the
|
|
33
|
+
// current selection alone" — never as "reset it" — or every keystroke short of a
|
|
34
|
+
// finished number would wipe the visitor's country.
|
|
35
|
+
const detectCountry = ( value ) => {
|
|
36
|
+
|
|
37
|
+
if( ! value ) return null;
|
|
38
|
+
|
|
39
|
+
try {
|
|
40
|
+
|
|
41
|
+
const parser = new AsYouType();
|
|
42
|
+
|
|
43
|
+
parser.input( String( value ) );
|
|
44
|
+
|
|
45
|
+
return parser.getCountry() || null;
|
|
46
|
+
|
|
47
|
+
} catch {
|
|
48
|
+
|
|
49
|
+
return null;
|
|
50
|
+
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
};
|
|
54
|
+
|
|
27
55
|
// Strict validity check (wraps libphonenumber-js). Mirrors the validation
|
|
28
56
|
// drawbridge-api's submission route already performs on lead phone input.
|
|
29
57
|
const isValid = ( value, country ) => {
|
|
@@ -42,4 +70,4 @@ const isValid = ( value, country ) => {
|
|
|
42
70
|
|
|
43
71
|
};
|
|
44
72
|
|
|
45
|
-
export { isValid, toE164 };
|
|
73
|
+
export { detectCountry, isValid, toE164 };
|
package/dist/phone.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// lib/phone.js
|
|
2
|
-
import { parsePhoneNumberFromString, isValidPhoneNumber } from "libphonenumber-js";
|
|
2
|
+
import { AsYouType, parsePhoneNumberFromString, isValidPhoneNumber } from "libphonenumber-js";
|
|
3
3
|
var toE164 = (value, country) => {
|
|
4
4
|
if (!value) return null;
|
|
5
5
|
try {
|
|
@@ -9,6 +9,16 @@ var toE164 = (value, country) => {
|
|
|
9
9
|
return null;
|
|
10
10
|
}
|
|
11
11
|
};
|
|
12
|
+
var detectCountry = (value) => {
|
|
13
|
+
if (!value) return null;
|
|
14
|
+
try {
|
|
15
|
+
const parser = new AsYouType();
|
|
16
|
+
parser.input(String(value));
|
|
17
|
+
return parser.getCountry() || null;
|
|
18
|
+
} catch {
|
|
19
|
+
return null;
|
|
20
|
+
}
|
|
21
|
+
};
|
|
12
22
|
var isValid = (value, country) => {
|
|
13
23
|
if (!value) return false;
|
|
14
24
|
try {
|
|
@@ -18,6 +28,7 @@ var isValid = (value, country) => {
|
|
|
18
28
|
}
|
|
19
29
|
};
|
|
20
30
|
export {
|
|
31
|
+
detectCountry,
|
|
21
32
|
isValid,
|
|
22
33
|
toE164
|
|
23
34
|
};
|
package/dist/plans.cjs
CHANGED
|
@@ -105,6 +105,21 @@ var field = {
|
|
|
105
105
|
}
|
|
106
106
|
};
|
|
107
107
|
var connection = {
|
|
108
|
+
attentive: {
|
|
109
|
+
key: "organization:connection:attentive",
|
|
110
|
+
error: "Plan does not include Attentive connection",
|
|
111
|
+
feature: "Attentive connection"
|
|
112
|
+
},
|
|
113
|
+
// Klaviyo shipped without an entry here, which meant no plan GRANTED its
|
|
114
|
+
// key and the feature gate denied every non-admin request — a latent 403
|
|
115
|
+
// found while adding Attentive. getPlanFeature answers granted:false for a
|
|
116
|
+
// key absent from the plan's map, so a manifest feature key that appears in
|
|
117
|
+
// no plan list is a connection only admins can manage.
|
|
118
|
+
klaviyo: {
|
|
119
|
+
key: "organization:connection:klaviyo",
|
|
120
|
+
error: "Plan does not include Klaviyo connection",
|
|
121
|
+
feature: "Klaviyo connection"
|
|
122
|
+
},
|
|
108
123
|
mailchimp: {
|
|
109
124
|
key: "organization:connection:mailchimp",
|
|
110
125
|
error: "Plan does not include Mailchimp connection",
|
|
@@ -287,6 +302,8 @@ var unitAmountDecimal = (cents) => {
|
|
|
287
302
|
};
|
|
288
303
|
var all = {
|
|
289
304
|
features: (array = []) => featuresFor([
|
|
305
|
+
connection.attentive.key,
|
|
306
|
+
connection.klaviyo.key,
|
|
290
307
|
connection.mailchimp.key,
|
|
291
308
|
connection.sendgrid.key,
|
|
292
309
|
connection.shopify.key,
|
package/dist/plans.d.cts
CHANGED
package/dist/plans.d.ts
CHANGED
package/dist/plans.js
CHANGED
|
@@ -66,6 +66,21 @@ var field = {
|
|
|
66
66
|
}
|
|
67
67
|
};
|
|
68
68
|
var connection = {
|
|
69
|
+
attentive: {
|
|
70
|
+
key: "organization:connection:attentive",
|
|
71
|
+
error: "Plan does not include Attentive connection",
|
|
72
|
+
feature: "Attentive connection"
|
|
73
|
+
},
|
|
74
|
+
// Klaviyo shipped without an entry here, which meant no plan GRANTED its
|
|
75
|
+
// key and the feature gate denied every non-admin request — a latent 403
|
|
76
|
+
// found while adding Attentive. getPlanFeature answers granted:false for a
|
|
77
|
+
// key absent from the plan's map, so a manifest feature key that appears in
|
|
78
|
+
// no plan list is a connection only admins can manage.
|
|
79
|
+
klaviyo: {
|
|
80
|
+
key: "organization:connection:klaviyo",
|
|
81
|
+
error: "Plan does not include Klaviyo connection",
|
|
82
|
+
feature: "Klaviyo connection"
|
|
83
|
+
},
|
|
69
84
|
mailchimp: {
|
|
70
85
|
key: "organization:connection:mailchimp",
|
|
71
86
|
error: "Plan does not include Mailchimp connection",
|
|
@@ -248,6 +263,8 @@ var unitAmountDecimal = (cents) => {
|
|
|
248
263
|
};
|
|
249
264
|
var all = {
|
|
250
265
|
features: (array = []) => featuresFor([
|
|
266
|
+
connection.attentive.key,
|
|
267
|
+
connection.klaviyo.key,
|
|
251
268
|
connection.mailchimp.key,
|
|
252
269
|
connection.sendgrid.key,
|
|
253
270
|
connection.shopify.key,
|
package/dist/pricing.cjs
CHANGED
|
@@ -116,6 +116,21 @@ var field = {
|
|
|
116
116
|
}
|
|
117
117
|
};
|
|
118
118
|
var connection = {
|
|
119
|
+
attentive: {
|
|
120
|
+
key: "organization:connection:attentive",
|
|
121
|
+
error: "Plan does not include Attentive connection",
|
|
122
|
+
feature: "Attentive connection"
|
|
123
|
+
},
|
|
124
|
+
// Klaviyo shipped without an entry here, which meant no plan GRANTED its
|
|
125
|
+
// key and the feature gate denied every non-admin request — a latent 403
|
|
126
|
+
// found while adding Attentive. getPlanFeature answers granted:false for a
|
|
127
|
+
// key absent from the plan's map, so a manifest feature key that appears in
|
|
128
|
+
// no plan list is a connection only admins can manage.
|
|
129
|
+
klaviyo: {
|
|
130
|
+
key: "organization:connection:klaviyo",
|
|
131
|
+
error: "Plan does not include Klaviyo connection",
|
|
132
|
+
feature: "Klaviyo connection"
|
|
133
|
+
},
|
|
119
134
|
mailchimp: {
|
|
120
135
|
key: "organization:connection:mailchimp",
|
|
121
136
|
error: "Plan does not include Mailchimp connection",
|
|
@@ -298,6 +313,8 @@ var unitAmountDecimal = (cents) => {
|
|
|
298
313
|
};
|
|
299
314
|
var all = {
|
|
300
315
|
features: (array = []) => featuresFor([
|
|
316
|
+
connection.attentive.key,
|
|
317
|
+
connection.klaviyo.key,
|
|
301
318
|
connection.mailchimp.key,
|
|
302
319
|
connection.sendgrid.key,
|
|
303
320
|
connection.shopify.key,
|
package/dist/pricing.js
CHANGED
|
@@ -66,6 +66,21 @@ var field = {
|
|
|
66
66
|
}
|
|
67
67
|
};
|
|
68
68
|
var connection = {
|
|
69
|
+
attentive: {
|
|
70
|
+
key: "organization:connection:attentive",
|
|
71
|
+
error: "Plan does not include Attentive connection",
|
|
72
|
+
feature: "Attentive connection"
|
|
73
|
+
},
|
|
74
|
+
// Klaviyo shipped without an entry here, which meant no plan GRANTED its
|
|
75
|
+
// key and the feature gate denied every non-admin request — a latent 403
|
|
76
|
+
// found while adding Attentive. getPlanFeature answers granted:false for a
|
|
77
|
+
// key absent from the plan's map, so a manifest feature key that appears in
|
|
78
|
+
// no plan list is a connection only admins can manage.
|
|
79
|
+
klaviyo: {
|
|
80
|
+
key: "organization:connection:klaviyo",
|
|
81
|
+
error: "Plan does not include Klaviyo connection",
|
|
82
|
+
feature: "Klaviyo connection"
|
|
83
|
+
},
|
|
69
84
|
mailchimp: {
|
|
70
85
|
key: "organization:connection:mailchimp",
|
|
71
86
|
error: "Plan does not include Mailchimp connection",
|
|
@@ -248,6 +263,8 @@ var unitAmountDecimal = (cents) => {
|
|
|
248
263
|
};
|
|
249
264
|
var all = {
|
|
250
265
|
features: (array = []) => featuresFor([
|
|
266
|
+
connection.attentive.key,
|
|
267
|
+
connection.klaviyo.key,
|
|
251
268
|
connection.mailchimp.key,
|
|
252
269
|
connection.sendgrid.key,
|
|
253
270
|
connection.shopify.key,
|
package/package.json
CHANGED
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
"tinycolor2": "1.6.0"
|
|
14
14
|
},
|
|
15
15
|
"devDependencies": {
|
|
16
|
-
"@drawbridge/drawbridge-agents": "0.1.
|
|
16
|
+
"@drawbridge/drawbridge-agents": "0.1.40",
|
|
17
17
|
"@node-oauth/oauth2-server": "5.3.0",
|
|
18
18
|
"tsup": "8.5.1",
|
|
19
19
|
"typescript": "5.9.3",
|
|
@@ -210,5 +210,5 @@
|
|
|
210
210
|
"test": ". \"$HOME/.nvm/nvm.sh\" && nvm use && node --test"
|
|
211
211
|
},
|
|
212
212
|
"types": "dist/index.d.ts",
|
|
213
|
-
"version": "0.0.
|
|
213
|
+
"version": "0.0.115"
|
|
214
214
|
}
|