@shoppexio/storefront 1.0.79 → 1.0.80
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/CHANGELOG.md +5 -0
- package/dist/index.cjs +11 -13
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +11 -13
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -4121,8 +4121,7 @@ async function captureAffiliateFromUrl(param = "ref") {
|
|
|
4121
4121
|
if (!code) return null;
|
|
4122
4122
|
const held = getStoredAffiliate();
|
|
4123
4123
|
const holdsOtherCode = held !== null && held.code !== code;
|
|
4124
|
-
|
|
4125
|
-
if (!mayHoldFirstClick) {
|
|
4124
|
+
if (!holdsOtherCode) {
|
|
4126
4125
|
setAffiliateCode(code, held?.windowDays ?? DEFAULT_TTL_DAYS, held?.mode);
|
|
4127
4126
|
}
|
|
4128
4127
|
if (isInitialized()) {
|
|
@@ -4145,14 +4144,12 @@ async function captureAffiliateFromUrl(param = "ref") {
|
|
|
4145
4144
|
const heldMode = res.success && res.data?.held_attribution_mode ? normalizeMode(res.data.held_attribution_mode) : null;
|
|
4146
4145
|
const holdsFirstClick = holdsOtherCode && (heldMode ?? held?.mode) === "FIRST_CLICK";
|
|
4147
4146
|
if (holdsFirstClick && held) {
|
|
4148
|
-
|
|
4149
|
-
|
|
4150
|
-
|
|
4151
|
-
|
|
4152
|
-
|
|
4153
|
-
|
|
4154
|
-
});
|
|
4155
|
-
}
|
|
4147
|
+
restoreStoredAffiliate({
|
|
4148
|
+
code: held.code,
|
|
4149
|
+
expiresAt: held.expiresAt,
|
|
4150
|
+
windowDays: held.windowDays,
|
|
4151
|
+
mode: heldMode ?? held.mode
|
|
4152
|
+
});
|
|
4156
4153
|
return held.code;
|
|
4157
4154
|
}
|
|
4158
4155
|
if (res.success && res.data?.accepted && res.data.affiliate_code) {
|
|
@@ -4160,15 +4157,16 @@ async function captureAffiliateFromUrl(param = "ref") {
|
|
|
4160
4157
|
return res.data.affiliate_code;
|
|
4161
4158
|
}
|
|
4162
4159
|
if (res.success && res.data && res.data.accepted === false) {
|
|
4160
|
+
if (holdsOtherCode) return held.code;
|
|
4163
4161
|
clearAffiliateCode();
|
|
4164
4162
|
return null;
|
|
4165
4163
|
}
|
|
4166
|
-
return
|
|
4164
|
+
return holdsOtherCode ? held.code : code;
|
|
4167
4165
|
} catch {
|
|
4168
|
-
return
|
|
4166
|
+
return holdsOtherCode ? held.code : code;
|
|
4169
4167
|
}
|
|
4170
4168
|
}
|
|
4171
|
-
return
|
|
4169
|
+
return holdsOtherCode ? held.code : code;
|
|
4172
4170
|
}
|
|
4173
4171
|
|
|
4174
4172
|
// ../sdk/src/utils/cart-line-id.ts
|