@dataships/sdk 0.0.0-stage → 2.0.1
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/LICENSE +202 -0
- package/README.md +330 -2
- package/dist/adapters/custom-platform-checkout/index.d.ts +139 -0
- package/dist/adapters/custom-platform-checkout/index.js +354 -0
- package/dist/adapters/custom-platform-checkout/index.js.map +1 -0
- package/dist/adapters/custom-platform-signup/index.d.ts +119 -0
- package/dist/adapters/custom-platform-signup/index.js +338 -0
- package/dist/adapters/custom-platform-signup/index.js.map +1 -0
- package/dist/adapters/salesforce/index.d.ts +100 -0
- package/dist/adapters/salesforce/index.js +328 -0
- package/dist/adapters/salesforce/index.js.map +1 -0
- package/dist/adapters/shopify-checkout/index.d.ts +102 -0
- package/dist/adapters/shopify-checkout/index.js +228 -0
- package/dist/adapters/shopify-checkout/index.js.map +1 -0
- package/dist/beacon-B8v41O8P.d.ts +4 -0
- package/dist/dataships.min.js +6 -0
- package/dist/dataships.min.js.map +1 -0
- package/dist/index.d.ts +190 -0
- package/dist/index.js +763 -0
- package/dist/index.js.map +1 -0
- package/dist/integrity.json +9 -0
- package/dist/locale-B1o0kX7n.d.ts +9 -0
- package/dist/retry-CGwSrbz_.d.ts +130 -0
- package/dist/server.d.ts +72 -0
- package/dist/server.js +455 -0
- package/dist/server.js.map +1 -0
- package/dist/types-vPJjFMJw.d.ts +236 -0
- package/package.json +83 -4
|
@@ -0,0 +1,328 @@
|
|
|
1
|
+
var __typeError = (msg) => {
|
|
2
|
+
throw TypeError(msg);
|
|
3
|
+
};
|
|
4
|
+
var __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot " + msg);
|
|
5
|
+
var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
|
|
6
|
+
var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
|
7
|
+
var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), member.set(obj, value), value);
|
|
8
|
+
var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "access private method"), method);
|
|
9
|
+
|
|
10
|
+
// src/utils/uuid.ts
|
|
11
|
+
var randomUuid = (cryptoObj = globalThis.crypto) => {
|
|
12
|
+
if (cryptoObj && typeof cryptoObj.randomUUID === "function") {
|
|
13
|
+
return cryptoObj.randomUUID();
|
|
14
|
+
}
|
|
15
|
+
const bytes = new Uint8Array(16);
|
|
16
|
+
if (cryptoObj && typeof cryptoObj.getRandomValues === "function") {
|
|
17
|
+
cryptoObj.getRandomValues(bytes);
|
|
18
|
+
} else {
|
|
19
|
+
for (let i = 0; i < 16; i++) bytes[i] = Math.floor(Math.random() * 256);
|
|
20
|
+
}
|
|
21
|
+
bytes[6] = bytes[6] & 15 | 64;
|
|
22
|
+
bytes[8] = bytes[8] & 63 | 128;
|
|
23
|
+
const hex = Array.from(bytes, (b) => b.toString(16).padStart(2, "0"));
|
|
24
|
+
return hex.slice(0, 4).join("") + "-" + hex.slice(4, 6).join("") + "-" + hex.slice(6, 8).join("") + "-" + hex.slice(8, 10).join("") + "-" + hex.slice(10, 16).join("");
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
// src/types.ts
|
|
28
|
+
var SUPPORTED_LOCALES = [
|
|
29
|
+
"en",
|
|
30
|
+
"es",
|
|
31
|
+
"de",
|
|
32
|
+
"pt",
|
|
33
|
+
"ro",
|
|
34
|
+
"hr",
|
|
35
|
+
"da",
|
|
36
|
+
"fi",
|
|
37
|
+
"fr",
|
|
38
|
+
"hu",
|
|
39
|
+
"it",
|
|
40
|
+
"nb",
|
|
41
|
+
"pl",
|
|
42
|
+
"sk",
|
|
43
|
+
"sv",
|
|
44
|
+
"nl",
|
|
45
|
+
"el",
|
|
46
|
+
"cs",
|
|
47
|
+
"zh",
|
|
48
|
+
"ja",
|
|
49
|
+
"is"
|
|
50
|
+
];
|
|
51
|
+
|
|
52
|
+
// src/adapters/salesforce/bootstrap.ts
|
|
53
|
+
var DEFAULT_SELECTOR = "script[data-public-key]";
|
|
54
|
+
var getConfigFromScriptTag = (opts = {}) => {
|
|
55
|
+
const doc = opts.document ?? document;
|
|
56
|
+
const selector = opts.scriptSelector ?? DEFAULT_SELECTOR;
|
|
57
|
+
const element = doc.querySelector(selector);
|
|
58
|
+
if (!element) {
|
|
59
|
+
throw new Error(
|
|
60
|
+
`Dataships SDK: unable to locate the Dataships script tag using selector ${selector}`
|
|
61
|
+
);
|
|
62
|
+
}
|
|
63
|
+
const required = (name) => {
|
|
64
|
+
const value = element.getAttribute(name);
|
|
65
|
+
if (!value) {
|
|
66
|
+
throw new Error(
|
|
67
|
+
`Dataships SDK: Dataships script tag is missing required attribute ${name}`
|
|
68
|
+
);
|
|
69
|
+
}
|
|
70
|
+
return value;
|
|
71
|
+
};
|
|
72
|
+
const optional = (name) => {
|
|
73
|
+
const value = element.getAttribute(name);
|
|
74
|
+
return value && value.length > 0 ? value : null;
|
|
75
|
+
};
|
|
76
|
+
const bool = (name) => (optional(name) ?? "").toLowerCase() === "true";
|
|
77
|
+
return {
|
|
78
|
+
publicKey: required("data-public-key"),
|
|
79
|
+
token: optional("data-token"),
|
|
80
|
+
// Default to `local` (the local backend) when `data-env` is omitted. Preview
|
|
81
|
+
// mode is now a separate concern (see `data-preview-mode`), so an env-less
|
|
82
|
+
// cartridge no longer implies fake data — a real deploy must still set
|
|
83
|
+
// `data-env` explicitly to reach staging/production.
|
|
84
|
+
env: optional("data-env") ?? "local",
|
|
85
|
+
previewMode: bool("data-preview-mode"),
|
|
86
|
+
storeIdentifier: required("data-store-identifier"),
|
|
87
|
+
locale: localeFromSfcc(optional("data-locale")),
|
|
88
|
+
basketUuid: optional("data-basket-uuid"),
|
|
89
|
+
email: optional("data-email"),
|
|
90
|
+
phone: optional("data-phone"),
|
|
91
|
+
orderId: optional("data-order-id"),
|
|
92
|
+
orderToken: optional("data-order-token")
|
|
93
|
+
};
|
|
94
|
+
};
|
|
95
|
+
var localeFromSfcc = (raw) => {
|
|
96
|
+
if (!raw) return "en";
|
|
97
|
+
const head = raw.split(/[_-]/)[0]?.toLowerCase() ?? "";
|
|
98
|
+
return SUPPORTED_LOCALES.includes(head) ? head : "en";
|
|
99
|
+
};
|
|
100
|
+
|
|
101
|
+
// src/session/previewUpsertResponse.ts
|
|
102
|
+
var DEFAULT_EMAIL_OPT_IN_TEXT = "We would like to email you news and promotions. Tick to opt in.";
|
|
103
|
+
var DEFAULT_EMAIL_OPT_IN_CONSENT_DESCRIPTION = "Click here for an overview of how your personal data is processed for marketing purposes or see our Privacy Policy for further information.";
|
|
104
|
+
var DEFAULT_SMS_OPT_IN_TEXT = "We would like to text you news and promotions. Tick to opt in.";
|
|
105
|
+
var DEFAULT_SMS_OPT_IN_CONSENT_DESCRIPTION = "Based on the channel preferences set above, you agree to receive recurring automated marketing messages (e.g. AI content, cart reminders) from {{COMPANY_NAME}} at the number you provide. Consent is not a condition of purchase. We may share info with service providers per our Privacy Policy. Reply STOP to cancel or click the unsubscribe link (where available). For help reply HELP or email {{PRIVACY_EMAIL}}. Msg frequency varies. Msg & data rates may apply. By proceeding, you also agree to our Terms of Service (incl. arbitration) & Privacy Policy.";
|
|
106
|
+
var fakeEmailUpsertResponse = {
|
|
107
|
+
consentSessionId: "01HQB3QRZVV0737R0R25BTQBGF",
|
|
108
|
+
consents: [
|
|
109
|
+
{
|
|
110
|
+
channel: "EMAIL",
|
|
111
|
+
consentType: "OPT_IN",
|
|
112
|
+
checked: false,
|
|
113
|
+
widgetConfig: {
|
|
114
|
+
text: DEFAULT_EMAIL_OPT_IN_TEXT,
|
|
115
|
+
consentDescription: DEFAULT_EMAIL_OPT_IN_CONSENT_DESCRIPTION,
|
|
116
|
+
marketingInformation: '<h1>Marketing Information</h1>\n<p>We may send you direct marketing communications, product information and promotional offers. You can withdraw your consent at any time. See our <a href="https://dataships.io/privacy-centre">Privacy Policy</a> or contact us at <a href="mailto:privacy@example.com">privacy@example.com</a> for further information.</p>\n',
|
|
117
|
+
policyURL: "https://dataships.io/privacy-centre",
|
|
118
|
+
mobileTermsOfServiceURL: null,
|
|
119
|
+
privacyEmail: "privacy@example.com",
|
|
120
|
+
placeholderValues: null
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
],
|
|
124
|
+
userVerificationRequired: null,
|
|
125
|
+
lastHeartbeat: "2026-06-17T00:00:00Z",
|
|
126
|
+
identifier: null
|
|
127
|
+
};
|
|
128
|
+
var fakePhoneUpsertResponse = {
|
|
129
|
+
consentSessionId: "01HQB3QRZVV0737R0R25BTQBGG",
|
|
130
|
+
consents: [
|
|
131
|
+
{
|
|
132
|
+
channel: "SMS",
|
|
133
|
+
consentType: "OPT_IN",
|
|
134
|
+
checked: false,
|
|
135
|
+
widgetConfig: {
|
|
136
|
+
text: DEFAULT_SMS_OPT_IN_TEXT,
|
|
137
|
+
consentDescription: DEFAULT_SMS_OPT_IN_CONSENT_DESCRIPTION,
|
|
138
|
+
marketingInformation: '<h1>Marketing Information</h1>\n<p>We may send you marketing text messages about products and promotional offers. Message frequency varies. You can withdraw your consent at any time by replying STOP. See our <a href="https://dataships.io/privacy-centre">Privacy Policy</a> or contact us at <a href="mailto:privacy@example.com">privacy@example.com</a> for further information.</p>\n',
|
|
139
|
+
policyURL: "https://dataships.io/privacy-centre",
|
|
140
|
+
mobileTermsOfServiceURL: "https://dataships.io/mobile-terms",
|
|
141
|
+
privacyEmail: "privacy@example.com",
|
|
142
|
+
placeholderValues: null
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
],
|
|
146
|
+
userVerificationRequired: false,
|
|
147
|
+
lastHeartbeat: "2026-06-17T00:00:00Z",
|
|
148
|
+
identifier: null
|
|
149
|
+
};
|
|
150
|
+
var MARKETING_MODAL_HREF = "#dataships-marketing-modal";
|
|
151
|
+
var CHECKBOX_LABEL_BOLD_PHRASES = ["consent", "object", "opt in", "opt out", "STOP", "HELP"];
|
|
152
|
+
var CONSENT_DESCRIPTION_BOLD_PHRASES = ["STOP", "HELP"];
|
|
153
|
+
var escapeHtml = (text) => text.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """);
|
|
154
|
+
var escapeRegExp = (text) => text.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
155
|
+
var wrapPhrase = (html, phrase, wrap) => html.replace(
|
|
156
|
+
new RegExp(`${escapeRegExp(escapeHtml(phrase))}(?![^<]*>)(?![^<]*</a>)`, "gi"),
|
|
157
|
+
wrap
|
|
158
|
+
);
|
|
159
|
+
var toHtmlCopy = (text, widgetConfig, boldPhrases) => {
|
|
160
|
+
let html = escapeHtml(text);
|
|
161
|
+
const links = [
|
|
162
|
+
["Terms of Service", widgetConfig.mobileTermsOfServiceURL],
|
|
163
|
+
["Privacy Policy", widgetConfig.policyURL],
|
|
164
|
+
["Click here", MARKETING_MODAL_HREF]
|
|
165
|
+
];
|
|
166
|
+
for (const [phrase, href] of links) {
|
|
167
|
+
if (!href) continue;
|
|
168
|
+
html = wrapPhrase(html, phrase, (match) => `<a href="${escapeHtml(href)}">${match}</a>`);
|
|
169
|
+
}
|
|
170
|
+
for (const phrase of boldPhrases) {
|
|
171
|
+
html = wrapPhrase(html, phrase, (match) => `<strong>${match}</strong>`);
|
|
172
|
+
}
|
|
173
|
+
return `<p>${html}</p>`;
|
|
174
|
+
};
|
|
175
|
+
var withHtmlCopy = (response) => ({
|
|
176
|
+
...response,
|
|
177
|
+
consents: response.consents.map((consent) => {
|
|
178
|
+
const { widgetConfig } = consent;
|
|
179
|
+
return {
|
|
180
|
+
...consent,
|
|
181
|
+
widgetConfig: {
|
|
182
|
+
...widgetConfig,
|
|
183
|
+
text: widgetConfig.text === null ? null : toHtmlCopy(widgetConfig.text, widgetConfig, CHECKBOX_LABEL_BOLD_PHRASES),
|
|
184
|
+
consentDescription: widgetConfig.consentDescription === null ? null : toHtmlCopy(
|
|
185
|
+
widgetConfig.consentDescription,
|
|
186
|
+
widgetConfig,
|
|
187
|
+
CONSENT_DESCRIPTION_BOLD_PHRASES
|
|
188
|
+
)
|
|
189
|
+
}
|
|
190
|
+
};
|
|
191
|
+
})
|
|
192
|
+
});
|
|
193
|
+
var previewUpsertResponse = (identifierType, format = "json") => {
|
|
194
|
+
const response = identifierType === "PHONE" ? fakePhoneUpsertResponse : fakeEmailUpsertResponse;
|
|
195
|
+
return format === "html" ? withHtmlCopy(response) : response;
|
|
196
|
+
};
|
|
197
|
+
|
|
198
|
+
// src/adapters/salesforce/index.ts
|
|
199
|
+
var DATASHIPS_ORDER_UUID_KEY_PREFIX = "datashipsOrderUuid:";
|
|
200
|
+
var _window, _SalesforceAdapter_instances, resolveCollectionStep_fn, isCheckoutPath_fn, urlParams_fn, getOrSetOrderUuid_fn, orderUuidKey_fn, readStoredOrderUuid_fn, safeLocalStorage_fn;
|
|
201
|
+
var SalesforceAdapter = class {
|
|
202
|
+
constructor(opts = {}) {
|
|
203
|
+
__privateAdd(this, _SalesforceAdapter_instances);
|
|
204
|
+
this.name = "SalesforceAdapter";
|
|
205
|
+
this.sessionApi = "consent-session";
|
|
206
|
+
this.integrationType = "SALESFORCE_SNIPPET";
|
|
207
|
+
__privateAdd(this, _window);
|
|
208
|
+
__privateSet(this, _window, opts.window ?? globalThis.window);
|
|
209
|
+
this.config = opts.config ?? getConfigFromScriptTag({ document: opts.document });
|
|
210
|
+
this.previewMode = this.config.previewMode;
|
|
211
|
+
}
|
|
212
|
+
/** Synthetic upsert response served in {@link previewMode}; email-only at launch. */
|
|
213
|
+
getPreviewUpsertResponse(identifierType = "EMAIL", format) {
|
|
214
|
+
return previewUpsertResponse(identifierType, format);
|
|
215
|
+
}
|
|
216
|
+
getLocale() {
|
|
217
|
+
return this.config.locale;
|
|
218
|
+
}
|
|
219
|
+
getIdentifier(identifierType) {
|
|
220
|
+
const identifier = "PHONE" === identifierType ? this.config.phone : this.config.email;
|
|
221
|
+
return { identifier, identifierType };
|
|
222
|
+
}
|
|
223
|
+
async getSessionContext() {
|
|
224
|
+
const params = __privateMethod(this, _SalesforceAdapter_instances, urlParams_fn).call(this);
|
|
225
|
+
const orderId = this.config.orderId ?? params.get("ID");
|
|
226
|
+
const orderToken = this.config.orderToken ?? params.get("token");
|
|
227
|
+
const collectionStep = __privateMethod(this, _SalesforceAdapter_instances, resolveCollectionStep_fn).call(this, orderId, orderToken);
|
|
228
|
+
const isThankYou = collectionStep === "THANK_YOU";
|
|
229
|
+
return {
|
|
230
|
+
collectionStep,
|
|
231
|
+
datashipsOrderUuid: __privateMethod(this, _SalesforceAdapter_instances, getOrSetOrderUuid_fn).call(this),
|
|
232
|
+
basketUuid: isThankYou ? null : this.config.basketUuid,
|
|
233
|
+
orderId: isThankYou ? orderId : null,
|
|
234
|
+
orderToken: isThankYou ? orderToken : null
|
|
235
|
+
};
|
|
236
|
+
}
|
|
237
|
+
};
|
|
238
|
+
_window = new WeakMap();
|
|
239
|
+
_SalesforceAdapter_instances = new WeakSet();
|
|
240
|
+
/**
|
|
241
|
+
* Decide the collection step from the data the cartridge already renders: an
|
|
242
|
+
* order id/token means the order is placed (THANK_YOU); otherwise a basket
|
|
243
|
+
* means we're mid-checkout (CHECKOUT_INFORMATION). Fall back to path-sniffing
|
|
244
|
+
* only when neither signal is present (e.g. a checkout page before a basket
|
|
245
|
+
* exists).
|
|
246
|
+
*/
|
|
247
|
+
resolveCollectionStep_fn = function(orderId, orderToken) {
|
|
248
|
+
if (orderId || orderToken) return "THANK_YOU";
|
|
249
|
+
if (this.config.basketUuid) return "CHECKOUT_INFORMATION";
|
|
250
|
+
return __privateMethod(this, _SalesforceAdapter_instances, isCheckoutPath_fn).call(this) ? "CHECKOUT_INFORMATION" : "THANK_YOU";
|
|
251
|
+
};
|
|
252
|
+
isCheckoutPath_fn = function() {
|
|
253
|
+
const path = __privateGet(this, _window).location.pathname.toLowerCase();
|
|
254
|
+
if (path.includes("order-confirm")) return false;
|
|
255
|
+
return path.includes("checkout");
|
|
256
|
+
};
|
|
257
|
+
urlParams_fn = function() {
|
|
258
|
+
return new URLSearchParams(__privateGet(this, _window).location.search);
|
|
259
|
+
};
|
|
260
|
+
/**
|
|
261
|
+
* Resolve the datashipsOrderUuid for this page view.
|
|
262
|
+
*
|
|
263
|
+
* Lifecycle:
|
|
264
|
+
* - On checkout pages where SFCC has a basket: tie the UUID to that basket.
|
|
265
|
+
* Same `basketUuid` across visits → reuse the same UUID; new basket → fresh UUID.
|
|
266
|
+
* - On the confirmation page (no current basket but a stored entry exists):
|
|
267
|
+
* reuse the stored UUID so the THANK_YOU upsert correlates with the
|
|
268
|
+
* CHECKOUT_INFORMATION session backend-side.
|
|
269
|
+
* - No prior entry and no basket: generate a UUID for this page view only;
|
|
270
|
+
* nothing is persisted (we don't know what basket to associate it with). A
|
|
271
|
+
* confirmation reached without a stored entry — cleared storage, a different
|
|
272
|
+
* device, or a direct landing — therefore emits a fresh, non-correlating
|
|
273
|
+
* UUID. This is best-effort correlation by design.
|
|
274
|
+
*
|
|
275
|
+
* The localStorage key is scoped by `storeIdentifier` so multi-site SFCC
|
|
276
|
+
* instances sharing a hostname don't cross-correlate.
|
|
277
|
+
*/
|
|
278
|
+
getOrSetOrderUuid_fn = function() {
|
|
279
|
+
const storage = __privateMethod(this, _SalesforceAdapter_instances, safeLocalStorage_fn).call(this);
|
|
280
|
+
const key = __privateMethod(this, _SalesforceAdapter_instances, orderUuidKey_fn).call(this);
|
|
281
|
+
const currentBasketUuid = this.config.basketUuid;
|
|
282
|
+
const stored = storage ? __privateMethod(this, _SalesforceAdapter_instances, readStoredOrderUuid_fn).call(this, storage, key) : null;
|
|
283
|
+
if (stored) {
|
|
284
|
+
if (null !== currentBasketUuid && stored.basketUuid === currentBasketUuid) {
|
|
285
|
+
return stored.uuid;
|
|
286
|
+
}
|
|
287
|
+
if (null === currentBasketUuid) {
|
|
288
|
+
return stored.uuid;
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
const fresh = randomUuid(__privateGet(this, _window).crypto);
|
|
292
|
+
if (storage && null !== currentBasketUuid) {
|
|
293
|
+
try {
|
|
294
|
+
storage.setItem(
|
|
295
|
+
key,
|
|
296
|
+
JSON.stringify({ uuid: fresh, basketUuid: currentBasketUuid })
|
|
297
|
+
);
|
|
298
|
+
} catch {
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
return fresh;
|
|
302
|
+
};
|
|
303
|
+
orderUuidKey_fn = function() {
|
|
304
|
+
return `${DATASHIPS_ORDER_UUID_KEY_PREFIX}${this.config.storeIdentifier}`;
|
|
305
|
+
};
|
|
306
|
+
readStoredOrderUuid_fn = function(storage, key) {
|
|
307
|
+
const raw = storage.getItem(key);
|
|
308
|
+
if (!raw) return null;
|
|
309
|
+
try {
|
|
310
|
+
const parsed = JSON.parse(raw);
|
|
311
|
+
if (typeof parsed?.uuid !== "string") return null;
|
|
312
|
+
const basketUuid = typeof parsed.basketUuid === "string" ? parsed.basketUuid : null;
|
|
313
|
+
return { uuid: parsed.uuid, basketUuid };
|
|
314
|
+
} catch {
|
|
315
|
+
return null;
|
|
316
|
+
}
|
|
317
|
+
};
|
|
318
|
+
safeLocalStorage_fn = function() {
|
|
319
|
+
try {
|
|
320
|
+
return __privateGet(this, _window).localStorage;
|
|
321
|
+
} catch {
|
|
322
|
+
return null;
|
|
323
|
+
}
|
|
324
|
+
};
|
|
325
|
+
|
|
326
|
+
export { SalesforceAdapter, getConfigFromScriptTag };
|
|
327
|
+
//# sourceMappingURL=index.js.map
|
|
328
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/utils/uuid.ts","../../../src/types.ts","../../../src/adapters/salesforce/bootstrap.ts","../../../src/session/previewUpsertResponse.ts","../../../src/adapters/salesforce/index.ts"],"names":[],"mappings":";;;;;;;;;;AAUO,IAAM,UAAA,GAAa,CACxB,SAAA,GAAgC,UAAA,CAAW,MAAA,KAChC;AACX,EAAA,IAA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,IAAA,CAAK,OAAO,eAAe,CAAA,CAAA;AACzE,CAAA;AAEA,sBAAA,GAAoB,SAAC,SAAkB,GAAA,EAAqC;AAC1E,EAAA,MAAM,GAAA,GAAM,OAAA,CAAQ,OAAA,CAAQ,GAAG,CAAA;AAC/B,EAAA,IAAI,CAAC,KAAK,OAAO,IAAA;AACjB,EAAA,IAAI;AACF,IAAA,MAAM,MAAA,GAAS,IAAA,CAAK,KAAA,CAAM,GAAG,CAAA;AAC7B,IAAA,IAAI,OAAO,MAAA,EAAQ,IAAA,KAAS,QAAA,EAAU,OAAO,IAAA;AAC7C,IAAA,MAAM,aACJ,OAAO,MAAA,CAAO,UAAA,KAAe,QAAA,GAAW,OAAO,UAAA,GAAa,IAAA;AAC9D,IAAA,OAAO,EAAE,IAAA,EAAM,MAAA,CAAO,IAAA,EAAM,UAAA,EAAW;AAAA,EACzC,CAAA,CAAA,MAAQ;AACN,IAAA,OAAO,IAAA;AAAA,EACT;AACF,CAAA;AAEA,mBAAA,GAAiB,WAAmB;AAClC,EAAA,IAAI;AACF,IAAA,OAAO,mBAAK,OAAA,CAAA,CAAQ,YAAA;AAAA,EACtB,CAAA,CAAA,MAAQ;AACN,IAAA,OAAO,IAAA;AAAA,EACT;AACF,CAAA","file":"index.js"}
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import { C as ConsentSessionAdapter, I as IdentifierType, a as ConsentCopyFormat, U as UpsertSessionResponse, S as SupportedLocale, b as ConsentSessionIdentifier } from '../../types-vPJjFMJw.js';
|
|
2
|
+
export { c as coerceLocale } from '../../locale-B1o0kX7n.js';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Where in the Shopify checkout the extension renders. Mirrors core-api's
|
|
6
|
+
* `WidgetType` as accepted by the `SHOPIFY_CHECKOUT` integration:
|
|
7
|
+
*
|
|
8
|
+
* - `CHECKOUT_INFORMATION` — the contact / delivery step, before purchase.
|
|
9
|
+
* - `THANK_YOU` — the order confirmation page right after purchase.
|
|
10
|
+
*/
|
|
11
|
+
type ShopifyCheckoutCollectionStep = "CHECKOUT_INFORMATION" | "THANK_YOU";
|
|
12
|
+
/**
|
|
13
|
+
* Checkout facts the extension reads from the Shopify checkout API and that
|
|
14
|
+
* can change while the buyer is on the page (a wallet picked, the order id
|
|
15
|
+
* appearing on the thank-you page). Absent values are not sent.
|
|
16
|
+
*/
|
|
17
|
+
interface ShopifyCheckoutDetails {
|
|
18
|
+
/** The order id, once the order exists (thank-you page). */
|
|
19
|
+
orderId?: string | null;
|
|
20
|
+
/** `shopify.checkoutToken`. */
|
|
21
|
+
checkoutToken?: string | null;
|
|
22
|
+
/** Whether the buyer paid with an accelerated / express wallet. */
|
|
23
|
+
isAcceleratedPayment?: boolean | null;
|
|
24
|
+
/** The wallet's name, e.g. `shop_pay`, `apple_pay`. */
|
|
25
|
+
wallet?: string | null;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Integration-specific fields the Shopify checkout adapter contributes to the
|
|
29
|
+
* consent-session envelope, merged under `integration`. The client injects
|
|
30
|
+
* `type: "SHOPIFY_CHECKOUT"`; the identifier and `locale` travel at the top
|
|
31
|
+
* level; the shop is identified by the `X-Api-Key` header and the Shopify
|
|
32
|
+
* session token, never by the body.
|
|
33
|
+
*
|
|
34
|
+
* `datashipsOrderUuid` ties the email and SMS extensions and the thank-you page
|
|
35
|
+
* of one checkout together (the extension stores it as a cart attribute). It
|
|
36
|
+
* is optional: core-api needs one of it, `checkoutToken` or `orderId`.
|
|
37
|
+
*/
|
|
38
|
+
interface ShopifyCheckoutSessionContext extends ShopifyCheckoutDetails {
|
|
39
|
+
collectionStep: ShopifyCheckoutCollectionStep;
|
|
40
|
+
datashipsOrderUuid?: string;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/** `integration.type` discriminator core-api routes to the Shopify checkout lifecycle. */
|
|
44
|
+
declare const SHOPIFY_CHECKOUT_INTEGRATION_TYPE = "SHOPIFY_CHECKOUT";
|
|
45
|
+
|
|
46
|
+
interface ShopifyCheckoutAdapterOptions extends ShopifyCheckoutDetails {
|
|
47
|
+
/** Which checkout surface the extension renders on. Change it later with {@link ShopifyCheckoutAdapter.setCollectionStep}. */
|
|
48
|
+
collectionStep: ShopifyCheckoutCollectionStep;
|
|
49
|
+
/** The checkout's Dataships order UUID (the extension's cart attribute), when it has one. */
|
|
50
|
+
datashipsOrderUuid?: string | null;
|
|
51
|
+
/**
|
|
52
|
+
* The buyer's language, e.g. `shopify.localization.language.isoCode`. Any
|
|
53
|
+
* BCP 47 / POSIX style string is accepted; the first segment is used when it
|
|
54
|
+
* maps to a {@link SupportedLocale}, otherwise `"en"`.
|
|
55
|
+
*/
|
|
56
|
+
locale?: string;
|
|
57
|
+
/** Buyer email already known to the checkout. */
|
|
58
|
+
email?: string | null;
|
|
59
|
+
/** Buyer E.164 phone already known to the checkout. */
|
|
60
|
+
phone?: string | null;
|
|
61
|
+
/**
|
|
62
|
+
* When true the client never calls the API and serves synthetic email data
|
|
63
|
+
* instead. Defaults to false.
|
|
64
|
+
*/
|
|
65
|
+
previewMode?: boolean;
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Consent-session adapter for the Shopify checkout UI extensions. Drives the
|
|
69
|
+
* `SHOPIFY_CHECKOUT` upsert type on `POST /v1/consent-session`.
|
|
70
|
+
*
|
|
71
|
+
* Has no DOM or `window` dependency: checkout UI extensions run in a sandboxed
|
|
72
|
+
* worker, so every input comes from the Shopify checkout API through the
|
|
73
|
+
* options and setters. Pair it with `auth: { publicKey, getToken: () =>
|
|
74
|
+
* shopify.sessionToken.get() }` so each request carries a fresh session token.
|
|
75
|
+
*/
|
|
76
|
+
declare class ShopifyCheckoutAdapter implements ConsentSessionAdapter<ShopifyCheckoutSessionContext> {
|
|
77
|
+
#private;
|
|
78
|
+
readonly name: string;
|
|
79
|
+
readonly sessionApi: "consent-session";
|
|
80
|
+
readonly integrationType = "SHOPIFY_CHECKOUT";
|
|
81
|
+
readonly previewMode: boolean;
|
|
82
|
+
constructor(opts: ShopifyCheckoutAdapterOptions);
|
|
83
|
+
/** Synthetic upsert response served in {@link previewMode}, matching the requested identifier type. */
|
|
84
|
+
getPreviewUpsertResponse(identifierType?: IdentifierType, format?: ConsentCopyFormat): UpsertSessionResponse;
|
|
85
|
+
getLocale(): SupportedLocale;
|
|
86
|
+
setLocale(locale: string | null | undefined): void;
|
|
87
|
+
get collectionStep(): ShopifyCheckoutCollectionStep;
|
|
88
|
+
setCollectionStep(step: ShopifyCheckoutCollectionStep): void;
|
|
89
|
+
get datashipsOrderUuid(): string | null;
|
|
90
|
+
/** Merge checkout facts that changed since construction; an explicit `undefined` clears a field. */
|
|
91
|
+
setCheckoutDetails(details: ShopifyCheckoutDetails): void;
|
|
92
|
+
/**
|
|
93
|
+
* Remember an identifier the buyer typed so later calls (a refresh, a
|
|
94
|
+
* remount) resolve it without the caller passing it again. An explicit
|
|
95
|
+
* `upsertSession({ identifier })` still takes precedence.
|
|
96
|
+
*/
|
|
97
|
+
setIdentifier(identifierType: IdentifierType, value: string | null): void;
|
|
98
|
+
getIdentifier(identifierType: IdentifierType): ConsentSessionIdentifier;
|
|
99
|
+
getSessionContext(): Promise<ShopifyCheckoutSessionContext>;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
export { SHOPIFY_CHECKOUT_INTEGRATION_TYPE, ShopifyCheckoutAdapter, type ShopifyCheckoutAdapterOptions, type ShopifyCheckoutCollectionStep, type ShopifyCheckoutDetails, type ShopifyCheckoutSessionContext };
|