loyalty-protocol 1.0.22 → 1.0.23
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/config.cjs +51 -0
- package/dist/config.js +24 -0
- package/package.json +4 -13
- package/config/ht-kstore-india/config.js +0 -6
- package/config/index.js +0 -18
- package/config/indian-express/config.js +0 -6
- package/dist/index.cjs +0 -60
- package/dist/index.d.cts +0 -13
- package/dist/index.d.ts +0 -13
- package/dist/index.js +0 -33
- /package/{theme → dist}/theme.css +0 -0
package/dist/config.cjs
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// config/config.js
|
|
21
|
+
var config_exports = {};
|
|
22
|
+
__export(config_exports, {
|
|
23
|
+
LOYALTY_PROTOCOL_CONFIG: () => LOYALTY_PROTOCOL_CONFIG
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(config_exports);
|
|
26
|
+
|
|
27
|
+
// config/ht-kstore-india/index.js
|
|
28
|
+
var HT_CONFIG = {
|
|
29
|
+
currency: {
|
|
30
|
+
name: "GO Coin",
|
|
31
|
+
logo: "https://images.rawpixel.com/image_png_800/cHJpdmF0ZS9sci9pbWFnZXMvd2Vic2l0ZS8yMDIyLTA0L3YxMTYxLWItMDQ0LnBuZw.png"
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
// config/indian-express/index.js
|
|
36
|
+
var INDIAN_EXPRESS = {
|
|
37
|
+
currency: {
|
|
38
|
+
name: "Minecraft Coin",
|
|
39
|
+
logo: "https://p1.hiclipart.com/preview/896/990/447/minecraft-hd-icon-mac-pc-minecraft-icon-512-png-icon.jpg"
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
// config/config.js
|
|
44
|
+
var LOYALTY_PROTOCOL_CONFIG = {
|
|
45
|
+
"ht-kstore-india": HT_CONFIG,
|
|
46
|
+
"indian-express": INDIAN_EXPRESS
|
|
47
|
+
};
|
|
48
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
49
|
+
0 && (module.exports = {
|
|
50
|
+
LOYALTY_PROTOCOL_CONFIG
|
|
51
|
+
});
|
package/dist/config.js
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
// config/ht-kstore-india/index.js
|
|
2
|
+
var HT_CONFIG = {
|
|
3
|
+
currency: {
|
|
4
|
+
name: "GO Coin",
|
|
5
|
+
logo: "https://images.rawpixel.com/image_png_800/cHJpdmF0ZS9sci9pbWFnZXMvd2Vic2l0ZS8yMDIyLTA0L3YxMTYxLWItMDQ0LnBuZw.png"
|
|
6
|
+
}
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
// config/indian-express/index.js
|
|
10
|
+
var INDIAN_EXPRESS = {
|
|
11
|
+
currency: {
|
|
12
|
+
name: "Minecraft Coin",
|
|
13
|
+
logo: "https://p1.hiclipart.com/preview/896/990/447/minecraft-hd-icon-mac-pc-minecraft-icon-512-png-icon.jpg"
|
|
14
|
+
}
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
// config/config.js
|
|
18
|
+
var LOYALTY_PROTOCOL_CONFIG = {
|
|
19
|
+
"ht-kstore-india": HT_CONFIG,
|
|
20
|
+
"indian-express": INDIAN_EXPRESS
|
|
21
|
+
};
|
|
22
|
+
export {
|
|
23
|
+
LOYALTY_PROTOCOL_CONFIG
|
|
24
|
+
};
|
package/package.json
CHANGED
|
@@ -1,34 +1,25 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "loyalty-protocol",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.23",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"exports": {
|
|
7
|
-
".": "./dist
|
|
8
|
-
"./theme.css": "./theme.css"
|
|
7
|
+
".": "./dist"
|
|
9
8
|
},
|
|
10
9
|
"scripts": {
|
|
11
10
|
"test": "echo \"Error: no test specified\" && exit 1",
|
|
12
|
-
"build": "tsup
|
|
11
|
+
"build": "tsup config/config.js --format esm,cjs --out-dir dist && cp theme/theme.css dist/theme.css"
|
|
13
12
|
},
|
|
14
13
|
"keywords": [],
|
|
15
14
|
"author": "",
|
|
16
15
|
"license": "ISC",
|
|
17
16
|
"type": "module",
|
|
18
17
|
"private": false,
|
|
19
|
-
"dependencies": {
|
|
20
|
-
"loyalty-protocol": "^1.0.0",
|
|
21
|
-
"react": "19.1.1",
|
|
22
|
-
"react-dom": "19.1.1"
|
|
23
|
-
},
|
|
24
18
|
"devDependencies": {
|
|
25
|
-
"@types/react": "^19.1.12",
|
|
26
19
|
"tsup": "^8.5.0",
|
|
27
20
|
"typescript": "^5.9.2"
|
|
28
21
|
},
|
|
29
22
|
"files": [
|
|
30
|
-
"dist"
|
|
31
|
-
"theme/theme.css",
|
|
32
|
-
"config"
|
|
23
|
+
"dist"
|
|
33
24
|
]
|
|
34
25
|
}
|
package/config/index.js
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
const HT_CONFIG = {
|
|
2
|
-
currency: {
|
|
3
|
-
name: "GO Coin",
|
|
4
|
-
logo: "https://images.rawpixel.com/image_png_800/cHJpdmF0ZS9sci9pbWFnZXMvd2Vic2l0ZS8yMDIyLTA0L3YxMTYxLWItMDQ0LnBuZw.png",
|
|
5
|
-
},
|
|
6
|
-
};
|
|
7
|
-
|
|
8
|
-
const INDIAN_EXPRESS = {
|
|
9
|
-
currency: {
|
|
10
|
-
name: "Minecraft Coin",
|
|
11
|
-
logo: "https://p1.hiclipart.com/preview/896/990/447/minecraft-hd-icon-mac-pc-minecraft-icon-512-png-icon.jpg",
|
|
12
|
-
},
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
const LOYALTY_PROTOCOL_CONFIG = {
|
|
16
|
-
"ht-kstore-india": HT_CONFIG,
|
|
17
|
-
"indian-express": INDIAN_EXPRESS,
|
|
18
|
-
};
|
package/dist/index.cjs
DELETED
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
|
|
20
|
-
// index.ts
|
|
21
|
-
var index_exports = {};
|
|
22
|
-
__export(index_exports, {
|
|
23
|
-
default: () => index_default,
|
|
24
|
-
useLoyaltyChannel: () => useLoyaltyChannel
|
|
25
|
-
});
|
|
26
|
-
module.exports = __toCommonJS(index_exports);
|
|
27
|
-
|
|
28
|
-
// src/hooks/useLoyaltyChannel.ts
|
|
29
|
-
var import_react = require("react");
|
|
30
|
-
var useLoyaltyChannel = ({ message }) => {
|
|
31
|
-
const iframeRef = (0, import_react.useRef)(null);
|
|
32
|
-
const sendInformationToLoyaltyProtocol = (0, import_react.useCallback)(
|
|
33
|
-
({ data, url }) => {
|
|
34
|
-
const iframe = iframeRef.current;
|
|
35
|
-
if (!iframe || typeof iframe.contentWindow === "undefined")
|
|
36
|
-
return void console.warn(
|
|
37
|
-
`Element with ID: loyalty-protocol is not iframe window`
|
|
38
|
-
);
|
|
39
|
-
iframe.contentWindow?.postMessage(data, url);
|
|
40
|
-
},
|
|
41
|
-
[iframeRef.current]
|
|
42
|
-
);
|
|
43
|
-
(0, import_react.useEffect)(() => {
|
|
44
|
-
const eventHandler = ({ data }) => {
|
|
45
|
-
if (data?.eventName === "init-handshake") {
|
|
46
|
-
sendInformationToLoyaltyProtocol(message);
|
|
47
|
-
}
|
|
48
|
-
};
|
|
49
|
-
window.addEventListener("message", eventHandler);
|
|
50
|
-
return () => window.removeEventListener("message", eventHandler);
|
|
51
|
-
}, []);
|
|
52
|
-
return { iframeRef };
|
|
53
|
-
};
|
|
54
|
-
|
|
55
|
-
// index.ts
|
|
56
|
-
var index_default = useLoyaltyChannel;
|
|
57
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
58
|
-
0 && (module.exports = {
|
|
59
|
-
useLoyaltyChannel
|
|
60
|
-
});
|
package/dist/index.d.cts
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import * as react from 'react';
|
|
2
|
-
|
|
3
|
-
interface SendInformationArgs {
|
|
4
|
-
data: string;
|
|
5
|
-
url: string;
|
|
6
|
-
}
|
|
7
|
-
declare const useLoyaltyChannel: ({ message }: {
|
|
8
|
-
message: SendInformationArgs;
|
|
9
|
-
}) => {
|
|
10
|
-
iframeRef: react.RefObject<HTMLIFrameElement | null>;
|
|
11
|
-
};
|
|
12
|
-
|
|
13
|
-
export { useLoyaltyChannel as default, useLoyaltyChannel };
|
package/dist/index.d.ts
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import * as react from 'react';
|
|
2
|
-
|
|
3
|
-
interface SendInformationArgs {
|
|
4
|
-
data: string;
|
|
5
|
-
url: string;
|
|
6
|
-
}
|
|
7
|
-
declare const useLoyaltyChannel: ({ message }: {
|
|
8
|
-
message: SendInformationArgs;
|
|
9
|
-
}) => {
|
|
10
|
-
iframeRef: react.RefObject<HTMLIFrameElement | null>;
|
|
11
|
-
};
|
|
12
|
-
|
|
13
|
-
export { useLoyaltyChannel as default, useLoyaltyChannel };
|
package/dist/index.js
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
// src/hooks/useLoyaltyChannel.ts
|
|
2
|
-
import { useCallback, useEffect, useRef } from "react";
|
|
3
|
-
var useLoyaltyChannel = ({ message }) => {
|
|
4
|
-
const iframeRef = useRef(null);
|
|
5
|
-
const sendInformationToLoyaltyProtocol = useCallback(
|
|
6
|
-
({ data, url }) => {
|
|
7
|
-
const iframe = iframeRef.current;
|
|
8
|
-
if (!iframe || typeof iframe.contentWindow === "undefined")
|
|
9
|
-
return void console.warn(
|
|
10
|
-
`Element with ID: loyalty-protocol is not iframe window`
|
|
11
|
-
);
|
|
12
|
-
iframe.contentWindow?.postMessage(data, url);
|
|
13
|
-
},
|
|
14
|
-
[iframeRef.current]
|
|
15
|
-
);
|
|
16
|
-
useEffect(() => {
|
|
17
|
-
const eventHandler = ({ data }) => {
|
|
18
|
-
if (data?.eventName === "init-handshake") {
|
|
19
|
-
sendInformationToLoyaltyProtocol(message);
|
|
20
|
-
}
|
|
21
|
-
};
|
|
22
|
-
window.addEventListener("message", eventHandler);
|
|
23
|
-
return () => window.removeEventListener("message", eventHandler);
|
|
24
|
-
}, []);
|
|
25
|
-
return { iframeRef };
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
// index.ts
|
|
29
|
-
var index_default = useLoyaltyChannel;
|
|
30
|
-
export {
|
|
31
|
-
index_default as default,
|
|
32
|
-
useLoyaltyChannel
|
|
33
|
-
};
|
|
File without changes
|