insert-affiliate-js-sdk 1.0.1 → 1.0.2
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/index.js +2 -2
- package/package.json +1 -1
- package/src/sdk/InsertAffiliate.ts +2 -2
package/dist/index.js
CHANGED
|
@@ -93,13 +93,13 @@ var InsertAffiliate = class {
|
|
|
93
93
|
}
|
|
94
94
|
static async setInsertAffiliateIdentifier(referringLink) {
|
|
95
95
|
const userId = await this.getOrCreateUserID();
|
|
96
|
-
const shortCode = /^[a-zA-Z0-9]{
|
|
96
|
+
const shortCode = /^[a-zA-Z0-9]{3,25}$/.test(referringLink) ? referringLink : await this.fetchShortLink(referringLink);
|
|
97
97
|
if (!shortCode) return null;
|
|
98
98
|
await saveValue("referrerLink", shortCode);
|
|
99
99
|
return `${shortCode}-${userId}`;
|
|
100
100
|
}
|
|
101
101
|
static async setShortCode(shortCode) {
|
|
102
|
-
const valid = /^[a-zA-Z0-9]{
|
|
102
|
+
const valid = /^[a-zA-Z0-9]{3,25}$/.test(shortCode);
|
|
103
103
|
if (!valid) {
|
|
104
104
|
console.warn("[Insert Affiliate] Invalid short code.");
|
|
105
105
|
return;
|
package/package.json
CHANGED
|
@@ -43,7 +43,7 @@ export class InsertAffiliate {
|
|
|
43
43
|
|
|
44
44
|
static async setInsertAffiliateIdentifier(referringLink: string): Promise<string | null> {
|
|
45
45
|
const userId = await this.getOrCreateUserID();
|
|
46
|
-
const shortCode = /^[a-zA-Z0-9]{
|
|
46
|
+
const shortCode = /^[a-zA-Z0-9]{3,25}$/.test(referringLink)
|
|
47
47
|
? referringLink
|
|
48
48
|
: await this.fetchShortLink(referringLink);
|
|
49
49
|
|
|
@@ -54,7 +54,7 @@ export class InsertAffiliate {
|
|
|
54
54
|
}
|
|
55
55
|
|
|
56
56
|
static async setShortCode(shortCode: string): Promise<void> {
|
|
57
|
-
const valid = /^[a-zA-Z0-9]{
|
|
57
|
+
const valid = /^[a-zA-Z0-9]{3,25}$/.test(shortCode);
|
|
58
58
|
if (!valid) {
|
|
59
59
|
console.warn('[Insert Affiliate] Invalid short code.');
|
|
60
60
|
return;
|