loyalty-protocol 1.0.22 → 1.0.24

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.
@@ -0,0 +1,61 @@
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 __esm = (fn, res) => function __init() {
7
+ return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
8
+ };
9
+ var __export = (target, all) => {
10
+ for (var name in all)
11
+ __defProp(target, name, { get: all[name], enumerable: true });
12
+ };
13
+ var __copyProps = (to, from, except, desc) => {
14
+ if (from && typeof from === "object" || typeof from === "function") {
15
+ for (let key of __getOwnPropNames(from))
16
+ if (!__hasOwnProp.call(to, key) && key !== except)
17
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
18
+ }
19
+ return to;
20
+ };
21
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
22
+
23
+ // config/ht-kstore-india/index.js
24
+ var ht_kstore_india_exports = {};
25
+ __export(ht_kstore_india_exports, {
26
+ HT_CONFIG: () => HT_CONFIG
27
+ });
28
+ var HT_CONFIG;
29
+ var init_ht_kstore_india = __esm({
30
+ "config/ht-kstore-india/index.js"() {
31
+ "use strict";
32
+ HT_CONFIG = {
33
+ currency: {
34
+ name: "GO Coin",
35
+ logo: "https://images.rawpixel.com/image_png_800/cHJpdmF0ZS9sci9pbWFnZXMvd2Vic2l0ZS8yMDIyLTA0L3YxMTYxLWItMDQ0LnBuZw.png"
36
+ }
37
+ };
38
+ }
39
+ });
40
+
41
+ // config/indian-express/index.js
42
+ var indian_express_exports = {};
43
+ __export(indian_express_exports, {
44
+ INDIAN_EXPRESS: () => INDIAN_EXPRESS
45
+ });
46
+ var INDIAN_EXPRESS;
47
+ var init_indian_express = __esm({
48
+ "config/indian-express/index.js"() {
49
+ "use strict";
50
+ INDIAN_EXPRESS = {
51
+ currency: {
52
+ name: "Minecraft Coin",
53
+ logo: "https://p1.hiclipart.com/preview/896/990/447/minecraft-hd-icon-mac-pc-minecraft-icon-512-png-icon.jpg"
54
+ }
55
+ };
56
+ }
57
+ });
58
+
59
+ // config/config.js
60
+ var { HT_CONFIG: HT_CONFIG2 } = (init_ht_kstore_india(), __toCommonJS(ht_kstore_india_exports));
61
+ var { INDIAN_EXPRESS: INDIAN_EXPRESS2 } = (init_indian_express(), __toCommonJS(indian_express_exports));
package/dist/config.js ADDED
@@ -0,0 +1,60 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __esm = (fn, res) => function __init() {
6
+ return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
7
+ };
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
21
+
22
+ // config/ht-kstore-india/index.js
23
+ var ht_kstore_india_exports = {};
24
+ __export(ht_kstore_india_exports, {
25
+ HT_CONFIG: () => HT_CONFIG
26
+ });
27
+ var HT_CONFIG;
28
+ var init_ht_kstore_india = __esm({
29
+ "config/ht-kstore-india/index.js"() {
30
+ "use strict";
31
+ HT_CONFIG = {
32
+ currency: {
33
+ name: "GO Coin",
34
+ logo: "https://images.rawpixel.com/image_png_800/cHJpdmF0ZS9sci9pbWFnZXMvd2Vic2l0ZS8yMDIyLTA0L3YxMTYxLWItMDQ0LnBuZw.png"
35
+ }
36
+ };
37
+ }
38
+ });
39
+
40
+ // config/indian-express/index.js
41
+ var indian_express_exports = {};
42
+ __export(indian_express_exports, {
43
+ INDIAN_EXPRESS: () => INDIAN_EXPRESS
44
+ });
45
+ var INDIAN_EXPRESS;
46
+ var init_indian_express = __esm({
47
+ "config/indian-express/index.js"() {
48
+ "use strict";
49
+ INDIAN_EXPRESS = {
50
+ currency: {
51
+ name: "Minecraft Coin",
52
+ logo: "https://p1.hiclipart.com/preview/896/990/447/minecraft-hd-icon-mac-pc-minecraft-icon-512-png-icon.jpg"
53
+ }
54
+ };
55
+ }
56
+ });
57
+
58
+ // config/config.js
59
+ var { HT_CONFIG: HT_CONFIG2 } = (init_ht_kstore_india(), __toCommonJS(ht_kstore_india_exports));
60
+ var { INDIAN_EXPRESS: INDIAN_EXPRESS2 } = (init_indian_express(), __toCommonJS(indian_express_exports));
package/package.json CHANGED
@@ -1,34 +1,25 @@
1
1
  {
2
2
  "name": "loyalty-protocol",
3
- "version": "1.0.22",
3
+ "version": "1.0.24",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "exports": {
7
- ".": "./dist/index.js",
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 index.ts --format esm,cjs --dts"
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
  }
@@ -1,6 +0,0 @@
1
- const LOYALTY_PROTOCOL = {
2
- currency: {
3
- name: "GO Coin",
4
- logo: "https://images.rawpixel.com/image_png_800/cHJpdmF0ZS9sci9pbWFnZXMvd2Vic2l0ZS8yMDIyLTA0L3YxMTYxLWItMDQ0LnBuZw.png",
5
- },
6
- };
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
- };
@@ -1,6 +0,0 @@
1
- const LOYALTY_PROTOCOL = {
2
- currency: {
3
- name: "Minecraft Coin",
4
- logo: "https://p1.hiclipart.com/preview/896/990/447/minecraft-hd-icon-mac-pc-minecraft-icon-512-png-icon.jpg",
5
- },
6
- };
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