ampscript-data 3.7.0 → 4.0.0
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/package.json +2 -2
- package/src/constants.js +47 -0
- package/src/derived.js +100 -0
- package/src/functions/content.js +1028 -0
- package/src/functions/data-extension.js +1117 -0
- package/src/functions/date-time.js +411 -0
- package/src/functions/einstein-email-recs.js +32 -0
- package/src/functions/encryption-encoding.js +545 -0
- package/src/functions/http.js +338 -0
- package/src/functions/index.js +203 -0
- package/src/functions/marketing-cloud-api.js +378 -0
- package/src/functions/math.js +167 -0
- package/src/functions/microsoft-dynamics.js +400 -0
- package/src/functions/mobileconnect.js +339 -0
- package/src/functions/sales-service-cloud.js +230 -0
- package/src/functions/social.js +151 -0
- package/src/functions/string.js +432 -0
- package/src/functions/utility.js +1118 -0
- package/src/globals.js +9 -0
- package/src/index.js +34 -7228
- package/src/keywords.js +121 -0
- package/src/operators.js +66 -0
- package/src/personalization.js +254 -0
package/src/keywords.js
ADDED
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
// AUTO-SPLIT from the original single-file src/index.js. Data moved verbatim.
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* AMPscript language keyword with completion metadata.
|
|
5
|
+
* - `name` the keyword as written in source
|
|
6
|
+
* - `description` short human-readable explanation
|
|
7
|
+
* - `snippet` completion body with `${n:placeholder}` tab stops
|
|
8
|
+
* - `handlebarsEquivalent` (OPTIONAL): name of the Handlebars helper/construct that plays the
|
|
9
|
+
* same role, or `null` when the keyword has no counterpart. Handlebars models control flow
|
|
10
|
+
* and logic as helpers, so language constructs (not just functions) map across.
|
|
11
|
+
* - `handlebarsNote` (OPTIONAL): human-readable caveat about how the Handlebars construct differs
|
|
12
|
+
* from the AMPscript keyword. Only set when `handlebarsEquivalent` is non-null.
|
|
13
|
+
*
|
|
14
|
+
* @type {{name: string, description: string, snippet: string, handlebarsEquivalent?: string | null, handlebarsNote?: string | null}[]}
|
|
15
|
+
*/
|
|
16
|
+
export const AMPSCRIPT_KEYWORDS = [
|
|
17
|
+
{
|
|
18
|
+
name: 'var',
|
|
19
|
+
description: 'Declares one or more variables',
|
|
20
|
+
snippet: 'var @${1:variableName}',
|
|
21
|
+
handlebarsEquivalent: 'set',
|
|
22
|
+
handlebarsNote: 'Handlebars set is block-scoped and does not persist outside its block.',
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
name: 'set',
|
|
26
|
+
description: 'Assigns a value to a variable',
|
|
27
|
+
snippet: 'set @${1:variableName} = ${2:value}',
|
|
28
|
+
handlebarsEquivalent: 'set',
|
|
29
|
+
handlebarsNote: 'Handlebars set is block-scoped and does not persist outside its block.',
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
name: 'if',
|
|
33
|
+
description: 'Begins a conditional block',
|
|
34
|
+
snippet: 'if ${1:condition} then\n\t${2}\nendif',
|
|
35
|
+
handlebarsEquivalent: 'if',
|
|
36
|
+
handlebarsNote: 'elseif/else become {{else if}} / {{else}} inside the same block.',
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
name: 'then',
|
|
40
|
+
description: 'Follows an if/elseif condition',
|
|
41
|
+
snippet: 'then',
|
|
42
|
+
handlebarsEquivalent: null,
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
name: 'elseif',
|
|
46
|
+
description: 'Additional condition in an if block',
|
|
47
|
+
snippet: 'elseif ${1:condition} then',
|
|
48
|
+
handlebarsEquivalent: 'if',
|
|
49
|
+
handlebarsNote: 'Written as {{else if condition}} inside the enclosing {{#if}} block.',
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
name: 'else',
|
|
53
|
+
description: 'Fallback branch in an if block',
|
|
54
|
+
snippet: 'else',
|
|
55
|
+
handlebarsEquivalent: 'if',
|
|
56
|
+
handlebarsNote: 'Written as {{else}} inside the enclosing {{#if}} block.',
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
name: 'endif',
|
|
60
|
+
description: 'Closes an if block',
|
|
61
|
+
snippet: 'endif',
|
|
62
|
+
handlebarsEquivalent: null,
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
name: 'for',
|
|
66
|
+
description: 'Begins a counting loop',
|
|
67
|
+
snippet: 'for @${1:i} = ${2:1} to ${3:rowCount} do\n\t${4}\nnext @${1:i}',
|
|
68
|
+
handlebarsEquivalent: 'each',
|
|
69
|
+
handlebarsNote:
|
|
70
|
+
'Use {{#repeat}} for a plain counting loop; {{#each}} iterates a collection.',
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
name: 'to',
|
|
74
|
+
description: 'Ascending direction in a for loop',
|
|
75
|
+
snippet: 'to',
|
|
76
|
+
handlebarsEquivalent: null,
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
name: 'downto',
|
|
80
|
+
description: 'Descending direction in a for loop',
|
|
81
|
+
snippet: 'downto',
|
|
82
|
+
handlebarsEquivalent: null,
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
name: 'do',
|
|
86
|
+
description: 'Marks the start of a loop body',
|
|
87
|
+
snippet: 'do',
|
|
88
|
+
handlebarsEquivalent: null,
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
name: 'next',
|
|
92
|
+
description: 'Ends a for loop iteration',
|
|
93
|
+
snippet: 'next',
|
|
94
|
+
handlebarsEquivalent: null,
|
|
95
|
+
},
|
|
96
|
+
{
|
|
97
|
+
name: 'and',
|
|
98
|
+
description: 'Logical AND operator',
|
|
99
|
+
snippet: 'and',
|
|
100
|
+
handlebarsEquivalent: 'and',
|
|
101
|
+
},
|
|
102
|
+
{ name: 'or', description: 'Logical OR operator', snippet: 'or', handlebarsEquivalent: 'or' },
|
|
103
|
+
{
|
|
104
|
+
name: 'not',
|
|
105
|
+
description: 'Logical NOT operator',
|
|
106
|
+
snippet: 'not',
|
|
107
|
+
handlebarsEquivalent: 'not',
|
|
108
|
+
},
|
|
109
|
+
{
|
|
110
|
+
name: 'true',
|
|
111
|
+
description: 'Boolean true constant',
|
|
112
|
+
snippet: 'true',
|
|
113
|
+
handlebarsEquivalent: null,
|
|
114
|
+
},
|
|
115
|
+
{
|
|
116
|
+
name: 'false',
|
|
117
|
+
description: 'Boolean false constant',
|
|
118
|
+
snippet: 'false',
|
|
119
|
+
handlebarsEquivalent: null,
|
|
120
|
+
},
|
|
121
|
+
];
|
package/src/operators.js
ADDED
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
// AUTO-SPLIT from the original single-file src/index.js. Data moved verbatim.
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* AMPscript symbolic operator with its Handlebars counterpart. These glyphs are not valid
|
|
5
|
+
* keyword names (they fail the identifier grammar), so they live in a dedicated export rather
|
|
6
|
+
* than in AMPSCRIPT_KEYWORDS.
|
|
7
|
+
* - `name` the operator glyph as written in source
|
|
8
|
+
* - `category` 'comparison' or 'assignment'
|
|
9
|
+
* - `description` short human-readable explanation
|
|
10
|
+
* - `handlebarsEquivalent` name of the Handlebars helper that plays the same role, or `null`
|
|
11
|
+
* - `handlebarsNote` caveat about how the Handlebars helper is invoked; only set when
|
|
12
|
+
* `handlebarsEquivalent` is non-null
|
|
13
|
+
*
|
|
14
|
+
* @type {{name: string, category: 'comparison' | 'assignment', description: string, handlebarsEquivalent: string | null, handlebarsNote: string | null}[]}
|
|
15
|
+
*/
|
|
16
|
+
export const AMPSCRIPT_OPERATORS = [
|
|
17
|
+
{
|
|
18
|
+
name: '==',
|
|
19
|
+
category: 'comparison',
|
|
20
|
+
description: 'Equality comparison',
|
|
21
|
+
handlebarsEquivalent: 'equals',
|
|
22
|
+
handlebarsNote: null,
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
name: '!=',
|
|
26
|
+
category: 'comparison',
|
|
27
|
+
description: 'Inequality comparison',
|
|
28
|
+
handlebarsEquivalent: 'compare',
|
|
29
|
+
handlebarsNote: 'Pass "!=" as the operator argument to compare.',
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
name: '>',
|
|
33
|
+
category: 'comparison',
|
|
34
|
+
description: 'Greater-than comparison',
|
|
35
|
+
handlebarsEquivalent: 'compare',
|
|
36
|
+
handlebarsNote: 'Pass ">" as the operator argument to compare.',
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
name: '>=',
|
|
40
|
+
category: 'comparison',
|
|
41
|
+
description: 'Greater-than-or-equal comparison',
|
|
42
|
+
handlebarsEquivalent: 'compare',
|
|
43
|
+
handlebarsNote: 'Pass ">=" as the operator argument to compare.',
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
name: '<',
|
|
47
|
+
category: 'comparison',
|
|
48
|
+
description: 'Less-than comparison',
|
|
49
|
+
handlebarsEquivalent: 'compare',
|
|
50
|
+
handlebarsNote: 'Pass "<" as the operator argument to compare.',
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
name: '<=',
|
|
54
|
+
category: 'comparison',
|
|
55
|
+
description: 'Less-than-or-equal comparison',
|
|
56
|
+
handlebarsEquivalent: 'compare',
|
|
57
|
+
handlebarsNote: 'Pass "<=" as the operator argument to compare.',
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
name: '=',
|
|
61
|
+
category: 'assignment',
|
|
62
|
+
description: 'Assignment operator (inside set)',
|
|
63
|
+
handlebarsEquivalent: 'set',
|
|
64
|
+
handlebarsNote: 'Handlebars set is block-scoped and does not persist outside its block.',
|
|
65
|
+
},
|
|
66
|
+
];
|
|
@@ -0,0 +1,254 @@
|
|
|
1
|
+
// AUTO-SPLIT from the original single-file src/index.js. Data moved verbatim.
|
|
2
|
+
|
|
3
|
+
export const PERSONALIZATION_STRINGS = [
|
|
4
|
+
{
|
|
5
|
+
name: '_subscriberkey',
|
|
6
|
+
mcnSince: null,
|
|
7
|
+
mcnNotes: null,
|
|
8
|
+
description: 'Unique identifier for the current subscriber or contact',
|
|
9
|
+
},
|
|
10
|
+
{ name: 'emailaddr', description: 'Email address associated with the current subscriber' },
|
|
11
|
+
{ name: 'subscriberid', description: 'Numeric identifier in the All Subscribers list' },
|
|
12
|
+
{ name: 'firstname', description: 'First name attribute of the subscriber' },
|
|
13
|
+
{
|
|
14
|
+
name: 'firstname_',
|
|
15
|
+
description: 'First name attribute of the subscriber (underscored alias)',
|
|
16
|
+
},
|
|
17
|
+
{ name: 'lastname', description: 'Last name attribute of the subscriber' },
|
|
18
|
+
{ name: 'lastname_', description: 'Last name attribute of the subscriber (underscored alias)' },
|
|
19
|
+
{ name: 'emailname_', description: 'Display name of the current email message' },
|
|
20
|
+
{ name: '_emailid', description: 'Numeric identifier of the current email' },
|
|
21
|
+
{ name: 'jobid', description: 'Numeric job identifier for the current send operation' },
|
|
22
|
+
{ name: '_JobSubscriberBatchID', description: 'Batch identifier within the current send job' },
|
|
23
|
+
{
|
|
24
|
+
name: '_PreHeader',
|
|
25
|
+
description:
|
|
26
|
+
'Preheader text associated with the current email; resolves only when retrieved through AttributeValue()',
|
|
27
|
+
},
|
|
28
|
+
{ name: '_DataSourceName', description: 'Name of the data source driving the current send' },
|
|
29
|
+
{
|
|
30
|
+
name: '_messagecontext',
|
|
31
|
+
mcnSince: null,
|
|
32
|
+
mcnNotes: null,
|
|
33
|
+
description:
|
|
34
|
+
'Render context indicator: SEND, PREVIEW, VAWP, FTAF, LANDINGPAGE, VALIDATION, LINKRESOLUTION, SMS, or SOCIAL',
|
|
35
|
+
},
|
|
36
|
+
{ name: '_IsTestSend', description: 'Flag indicating whether this is a test send' },
|
|
37
|
+
{
|
|
38
|
+
name: '_messagetypepreference',
|
|
39
|
+
mcnSince: null,
|
|
40
|
+
mcnNotes: null,
|
|
41
|
+
description: 'Subscriber preference for HTML or plain-text messages',
|
|
42
|
+
},
|
|
43
|
+
{ name: 'listid', description: 'Numeric identifier of the current send list' },
|
|
44
|
+
{ name: '_listname', description: 'Display name of the current send list' },
|
|
45
|
+
{
|
|
46
|
+
name: 'list_',
|
|
47
|
+
description: 'List identifier suffixed with _TEXT or _HTML for the subscriber email type',
|
|
48
|
+
},
|
|
49
|
+
{ name: 'listsubid', description: 'Subscriber identifier within a specific list' },
|
|
50
|
+
{ name: 'xtmonth', description: 'Full month name of the send date' },
|
|
51
|
+
{ name: 'xtmonthnumeric', description: 'Numeric month of the send date (1 through 12)' },
|
|
52
|
+
{ name: 'xtday', description: 'Day of month of the send date' },
|
|
53
|
+
{ name: 'xtdayofweek', description: 'Weekday name of the send date' },
|
|
54
|
+
{ name: 'xtyear', description: 'Four-digit year of the send date' },
|
|
55
|
+
{ name: 'xtshortdate', description: 'Send date in short date format' },
|
|
56
|
+
{ name: 'xtlongdate', description: 'Send date in long date format' },
|
|
57
|
+
{ name: 'replyname', description: 'From name configured for the current send' },
|
|
58
|
+
{
|
|
59
|
+
name: 'replyemailaddress',
|
|
60
|
+
mcnSince: null,
|
|
61
|
+
mcnNotes: null,
|
|
62
|
+
description: 'From email address configured for the current send',
|
|
63
|
+
},
|
|
64
|
+
{ name: 'memberid', description: 'Member ID (MID) of the sending business unit' },
|
|
65
|
+
{ name: 'member_busname', description: 'Business name of the sending business unit' },
|
|
66
|
+
{ name: 'member_addr', description: 'Street address of the sending business unit' },
|
|
67
|
+
{ name: 'member_city', description: 'City of the sending business unit' },
|
|
68
|
+
{ name: 'member_state', description: 'State or province of the sending business unit' },
|
|
69
|
+
{ name: 'member_postalcode', description: 'Postal code of the sending business unit' },
|
|
70
|
+
{ name: 'member_country', description: 'Country of the sending business unit' },
|
|
71
|
+
{ name: 'view_email_url', description: 'URL for the View as Web Page version of the email' },
|
|
72
|
+
{ name: 'ftaf_url', description: 'Forward to a Friend URL' },
|
|
73
|
+
{ name: 'subscription_center_url', description: 'URL to the subscription management center' },
|
|
74
|
+
{ name: 'profile_center_url', description: 'URL to the subscriber profile center' },
|
|
75
|
+
{ name: 'unsub_center_url', description: 'URL to the unsubscribe center' },
|
|
76
|
+
{ name: 'double_opt_in_url', description: 'URL for double opt-in confirmation' },
|
|
77
|
+
{
|
|
78
|
+
name: '_replycontent',
|
|
79
|
+
mcnSince: null,
|
|
80
|
+
mcnNotes: null,
|
|
81
|
+
description:
|
|
82
|
+
'Plain-text abstract of the first 10,000 characters from a subscriber reply via Reply Mail Management',
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
name: '_RMM_Headers',
|
|
86
|
+
description: 'Full email message header of the reply via Reply Mail Management',
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
name: '_RMM_ReplyBodyText',
|
|
90
|
+
description: 'Plain-text body of the reply via Reply Mail Management',
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
name: '_RMM_ReplyBodyHTML',
|
|
94
|
+
description: 'HTML body of the reply via Reply Mail Management',
|
|
95
|
+
},
|
|
96
|
+
{
|
|
97
|
+
name: '_RMM_ReplySubject',
|
|
98
|
+
description: 'Subject line of the reply via Reply Mail Management',
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
name: '_RMM_JobID',
|
|
102
|
+
description: 'Job ID of the email the subscriber replied to via Reply Mail Management',
|
|
103
|
+
},
|
|
104
|
+
{
|
|
105
|
+
name: '_RMM_ListID',
|
|
106
|
+
description: 'List ID of the email the subscriber replied to via Reply Mail Management',
|
|
107
|
+
},
|
|
108
|
+
{
|
|
109
|
+
name: '_RMM_BatchID',
|
|
110
|
+
description: 'Batch ID of the email the subscriber replied to via Reply Mail Management',
|
|
111
|
+
},
|
|
112
|
+
{
|
|
113
|
+
name: '_RMM_SubscriberID',
|
|
114
|
+
description: 'Subscriber ID of the replying subscriber via Reply Mail Management',
|
|
115
|
+
},
|
|
116
|
+
{
|
|
117
|
+
name: '_RMM_RecipientEmailAddress',
|
|
118
|
+
description: 'Email address of the replying subscriber via Reply Mail Management',
|
|
119
|
+
},
|
|
120
|
+
{
|
|
121
|
+
name: '_RMM_RecipientSubscriberKey',
|
|
122
|
+
description: 'Subscriber key of the replying subscriber via Reply Mail Management',
|
|
123
|
+
},
|
|
124
|
+
{ name: 'linkname', description: 'Alias or name assigned to the current tracked link' },
|
|
125
|
+
{
|
|
126
|
+
name: '_ImpressionRegionID',
|
|
127
|
+
mcnSince: null,
|
|
128
|
+
mcnNotes: null,
|
|
129
|
+
description: 'Numeric identifier of the current impression region',
|
|
130
|
+
},
|
|
131
|
+
{ name: '_ImpressionRegionName', description: 'Display name of the current impression region' },
|
|
132
|
+
{
|
|
133
|
+
name: 'AdditionalInfo_',
|
|
134
|
+
description:
|
|
135
|
+
'Value of the Additional Info field, appended to email links (Parameter Manager)',
|
|
136
|
+
},
|
|
137
|
+
{
|
|
138
|
+
name: '__AdditionalEmailAttribute[n]',
|
|
139
|
+
description:
|
|
140
|
+
'Value of an Additional Email Attribute field (n is 1 through 5), appended to email links (Parameter Manager)',
|
|
141
|
+
matcher: /^__AdditionalEmailAttribute[1-5]$/i,
|
|
142
|
+
},
|
|
143
|
+
{ name: 'PAGEURL', description: 'URL of the current CloudPages or microsite page' },
|
|
144
|
+
{ name: 'MOBILE_NUMBER', description: 'Mobile number of the inbound SMS sender' },
|
|
145
|
+
{ name: 'SHORT_CODE', description: 'Short code or long code that received the SMS' },
|
|
146
|
+
{ name: 'MSG(0)', description: 'Complete text of the inbound SMS message' },
|
|
147
|
+
{ name: 'MSG(0).VERB', description: 'First word (keyword) of the inbound SMS' },
|
|
148
|
+
{ name: 'MSG(0).NOUNS', description: 'All text following the keyword in the inbound SMS' },
|
|
149
|
+
{
|
|
150
|
+
name: 'MSG(0).NOUN([n])',
|
|
151
|
+
description: 'The nth word (noun) of the inbound SMS message, zero-based index',
|
|
152
|
+
matcher: /^MSG\(0\)\.NOUN\(\d+\)$/i,
|
|
153
|
+
},
|
|
154
|
+
{
|
|
155
|
+
name: 'MMS_CONTENT_URL([n])',
|
|
156
|
+
description: 'URL of the nth MMS attachment, zero-based index',
|
|
157
|
+
matcher: /^MMS_CONTENT_URL\(\d+\)$/i,
|
|
158
|
+
},
|
|
159
|
+
{ name: '_CarrierID', description: 'Carrier identifier for a MobileConnect contact' },
|
|
160
|
+
{ name: '_Channel', description: 'Messaging channel for a MobileConnect contact' },
|
|
161
|
+
{ name: '_City', description: 'City from MobileConnect contact demographics' },
|
|
162
|
+
{ name: '_ContactID', description: 'Contact identifier in MobileConnect' },
|
|
163
|
+
{ name: '_CountryCode', description: 'Country code from MobileConnect contact demographics' },
|
|
164
|
+
{ name: '_CreatedBy', description: 'User who created the MobileConnect contact record' },
|
|
165
|
+
{ name: '_CreatedDate', description: 'Timestamp when the MobileConnect contact was created' },
|
|
166
|
+
{ name: '_FirstName', description: 'First name of the MobileConnect contact' },
|
|
167
|
+
{
|
|
168
|
+
name: '_IsHonorDST',
|
|
169
|
+
description: "Whether the MobileConnect contact's time zone honors Daylight Savings Time",
|
|
170
|
+
},
|
|
171
|
+
{ name: '_LastName', description: 'Last name of the MobileConnect contact' },
|
|
172
|
+
{ name: '_MobileNumber', description: 'Mobile number of the MobileConnect contact' },
|
|
173
|
+
{ name: '_ModifiedBy', description: 'User who last modified the MobileConnect contact' },
|
|
174
|
+
{
|
|
175
|
+
name: '_ModifiedDate',
|
|
176
|
+
mcnSince: null,
|
|
177
|
+
mcnNotes: null,
|
|
178
|
+
description: 'Timestamp of the last modification to the MobileConnect contact',
|
|
179
|
+
},
|
|
180
|
+
{ name: '_Priority', description: 'Message priority for the MobileConnect contact' },
|
|
181
|
+
{
|
|
182
|
+
name: '_Source',
|
|
183
|
+
mcnSince: null,
|
|
184
|
+
mcnNotes: null,
|
|
185
|
+
description: 'Origin channel through which the MobileConnect contact was added',
|
|
186
|
+
},
|
|
187
|
+
{
|
|
188
|
+
name: '_SourceObjectID',
|
|
189
|
+
mcnSince: null,
|
|
190
|
+
mcnNotes: null,
|
|
191
|
+
description: 'Source object identifier for the MobileConnect contact',
|
|
192
|
+
},
|
|
193
|
+
{ name: '_State', description: 'State from MobileConnect contact demographics' },
|
|
194
|
+
{ name: '_Status', description: 'Subscription status of the MobileConnect contact' },
|
|
195
|
+
{ name: '_UTCOffset', description: 'UTC offset for the MobileConnect contact timezone' },
|
|
196
|
+
{ name: '_ZipCode', description: 'ZIP or postal code from MobileConnect contact demographics' },
|
|
197
|
+
{ name: 'LINE_ADDRESS_ID', description: 'LINE user address identifier for GroupConnect' },
|
|
198
|
+
{ name: 'LINE_JOB_ID', description: 'Unique LINE job identifier for GroupConnect' },
|
|
199
|
+
{
|
|
200
|
+
name: 'LINE_SUBSCRIBER_ID',
|
|
201
|
+
description: 'Corresponding Marketing Cloud subscriber identifier for GroupConnect',
|
|
202
|
+
},
|
|
203
|
+
{ name: 'TEXT', description: 'Complete inbound GroupConnect message text' },
|
|
204
|
+
{ name: 'VERB', description: 'First word (keyword) of the inbound GroupConnect message' },
|
|
205
|
+
{ name: 'TEXT.NOUN', description: 'All words after the verb in the GroupConnect message' },
|
|
206
|
+
{
|
|
207
|
+
name: 'TEXT.NOUN([n])',
|
|
208
|
+
description: 'The nth word (noun) of the GroupConnect message, zero-based index',
|
|
209
|
+
matcher: /^TEXT\.NOUN\(\d+\)$/i,
|
|
210
|
+
},
|
|
211
|
+
{
|
|
212
|
+
name: 'STKR.STKPKGID',
|
|
213
|
+
description: 'Package ID of a sticker in a LINE GroupConnect message',
|
|
214
|
+
},
|
|
215
|
+
{ name: 'STKR.STKID', description: 'ID of a sticker in a LINE GroupConnect message' },
|
|
216
|
+
{ name: 'STKR.STKTXT', description: 'Text of a sticker in a LINE GroupConnect message' },
|
|
217
|
+
];
|
|
218
|
+
|
|
219
|
+
/**
|
|
220
|
+
* Set of lowercase names for system personalization strings that are matched
|
|
221
|
+
* exactly (i.e. entries without a `matcher` pattern).
|
|
222
|
+
*/
|
|
223
|
+
const personalizationStringExactNames = new Set(
|
|
224
|
+
PERSONALIZATION_STRINGS.filter((entry) => !entry.matcher).map((entry) =>
|
|
225
|
+
entry.name.toLowerCase(),
|
|
226
|
+
),
|
|
227
|
+
);
|
|
228
|
+
|
|
229
|
+
/**
|
|
230
|
+
* Regex matchers for parameterized system personalization strings (e.g.
|
|
231
|
+
* `MSG(0).NOUN([n])`). Each matcher is anchored and case-insensitive.
|
|
232
|
+
*/
|
|
233
|
+
const personalizationStringMatchers = PERSONALIZATION_STRINGS.filter((entry) => entry.matcher).map(
|
|
234
|
+
(entry) => entry.matcher,
|
|
235
|
+
);
|
|
236
|
+
|
|
237
|
+
/**
|
|
238
|
+
* Returns true when the given name is a known Marketing Cloud system
|
|
239
|
+
* personalization string, either as an exact catalog entry or a valid
|
|
240
|
+
* parameterized form (e.g. `MSG(0).NOUN(0)`). Matching is case-insensitive.
|
|
241
|
+
*
|
|
242
|
+
* @param {string} name - Personalization string name to test (without brackets).
|
|
243
|
+
* @returns {boolean} True when the name is a known system personalization string.
|
|
244
|
+
*/
|
|
245
|
+
export function isSystemPersonalizationString(name) {
|
|
246
|
+
if (typeof name !== 'string' || name.length === 0) {
|
|
247
|
+
return false;
|
|
248
|
+
}
|
|
249
|
+
const trimmed = name.trim();
|
|
250
|
+
if (personalizationStringExactNames.has(trimmed.toLowerCase())) {
|
|
251
|
+
return true;
|
|
252
|
+
}
|
|
253
|
+
return personalizationStringMatchers.some((matcher) => matcher.test(trimmed));
|
|
254
|
+
}
|