@sonordev/site-kit 3.0.2 → 3.0.4
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/AnalyticsProvider-MLT26JRP.mjs +6 -0
- package/dist/{AnalyticsProvider-UKF7ESSP.mjs.map → AnalyticsProvider-MLT26JRP.mjs.map} +1 -1
- package/dist/AnalyticsProvider-WTOGN7LV.js +27 -0
- package/dist/{AnalyticsProvider-N3RNQXTK.js.map → AnalyticsProvider-WTOGN7LV.js.map} +1 -1
- package/dist/analytics/index.d.mts +1 -0
- package/dist/analytics/index.d.ts +1 -0
- package/dist/analytics/index.js +18 -9
- package/dist/analytics/index.mjs +3 -2
- package/dist/blog/index.d.mts +2 -2
- package/dist/blog/index.d.ts +2 -2
- package/dist/blog/index.js +10 -10
- package/dist/blog/index.mjs +1 -1
- package/dist/blog/server-ui.d.mts +18 -4
- package/dist/blog/server-ui.d.ts +18 -4
- package/dist/blog/server-ui.js +5 -5
- package/dist/blog/server-ui.mjs +1 -1
- package/dist/blog/server.d.mts +1 -1
- package/dist/blog/server.d.ts +1 -1
- package/dist/chunk-3DPXOZAU.mjs +26 -0
- package/dist/chunk-3DPXOZAU.mjs.map +1 -0
- package/dist/{chunk-7DW4SXNG.js → chunk-3GCEFS73.js} +5 -5
- package/dist/{chunk-7DW4SXNG.js.map → chunk-3GCEFS73.js.map} +1 -1
- package/dist/{chunk-ZDLBI3XX.mjs → chunk-65SMJBHW.mjs} +7 -2
- package/dist/chunk-65SMJBHW.mjs.map +1 -0
- package/dist/{chunk-S34XAPW2.mjs → chunk-AN4ATCYQ.mjs} +8 -8
- package/dist/chunk-AN4ATCYQ.mjs.map +1 -0
- package/dist/{chunk-XIGNKCHQ.js → chunk-EBJ4S5DU.js} +8 -8
- package/dist/chunk-EBJ4S5DU.js.map +1 -0
- package/dist/{chunk-EKJOYPPV.mjs → chunk-FT5JNCD4.mjs} +23 -7
- package/dist/chunk-FT5JNCD4.mjs.map +1 -0
- package/dist/chunk-HMFFAUCD.js +30 -0
- package/dist/chunk-HMFFAUCD.js.map +1 -0
- package/dist/{chunk-PBF2H23N.js → chunk-I5TJIESQ.js} +23 -7
- package/dist/chunk-I5TJIESQ.js.map +1 -0
- package/dist/{chunk-FLD5R2PT.js → chunk-IBDVZ6BF.js} +7 -2
- package/dist/{chunk-FLD5R2PT.js.map → chunk-IBDVZ6BF.js.map} +1 -1
- package/dist/{chunk-UZ63S7FE.mjs → chunk-KMZ527EM.mjs} +3 -3
- package/dist/{chunk-UZ63S7FE.mjs.map → chunk-KMZ527EM.mjs.map} +1 -1
- package/dist/{chunk-GBZHL2IT.js → chunk-NNZDHLXN.js} +3 -3
- package/dist/{chunk-GBZHL2IT.js.map → chunk-NNZDHLXN.js.map} +1 -1
- package/dist/{chunk-PAYGGILT.mjs → chunk-T4QBSRA4.mjs} +3 -3
- package/dist/{chunk-PAYGGILT.mjs.map → chunk-T4QBSRA4.mjs.map} +1 -1
- package/dist/client/index.d.mts +2 -0
- package/dist/client/index.d.ts +2 -0
- package/dist/client/index.js +9 -0
- package/dist/client/index.mjs +1 -0
- package/dist/commerce/index.js +49 -48
- package/dist/commerce/index.mjs +4 -3
- package/dist/dispatch-Cto83LLT.d.mts +28 -0
- package/dist/dispatch-DRQGcM8K.d.ts +28 -0
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +29 -28
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +4 -3
- package/dist/index.mjs.map +1 -1
- package/dist/layout/client.js +2 -2
- package/dist/layout/client.mjs +1 -1
- package/dist/layout/index.js +2 -2
- package/dist/layout/index.mjs +1 -1
- package/dist/{types-5P5B9RgV.d.mts → types-DYOumpUT.d.mts} +3 -0
- package/dist/{types-5P5B9RgV.d.ts → types-DYOumpUT.d.ts} +3 -0
- package/package.json +1 -1
- package/dist/AnalyticsProvider-N3RNQXTK.js +0 -26
- package/dist/AnalyticsProvider-UKF7ESSP.mjs +0 -5
- package/dist/chunk-EKJOYPPV.mjs.map +0 -1
- package/dist/chunk-PBF2H23N.js.map +0 -1
- package/dist/chunk-S34XAPW2.mjs.map +0 -1
- package/dist/chunk-XIGNKCHQ.js.map +0 -1
- package/dist/chunk-ZDLBI3XX.mjs.map +0 -1
package/dist/client/index.d.mts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
2
|
import React__default from 'react';
|
|
3
|
+
export { a as trackConversion, t as trackEvent } from '../dispatch-Cto83LLT.mjs';
|
|
4
|
+
export { a as TrackConversionOptions, T as TrackEventOptions } from '../types-DNSYU7qI.mjs';
|
|
3
5
|
|
|
4
6
|
/**
|
|
5
7
|
* @sonordev/site-kit — deferred activation hook
|
package/dist/client/index.d.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
2
|
import React__default from 'react';
|
|
3
|
+
export { a as trackConversion, t as trackEvent } from '../dispatch-DRQGcM8K.js';
|
|
4
|
+
export { a as TrackConversionOptions, T as TrackEventOptions } from '../types-DNSYU7qI.js';
|
|
3
5
|
|
|
4
6
|
/**
|
|
5
7
|
* @sonordev/site-kit — deferred activation hook
|
package/dist/client/index.js
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
'use strict';
|
|
3
3
|
|
|
4
4
|
var chunkHGNSJXWT_js = require('../chunk-HGNSJXWT.js');
|
|
5
|
+
var chunkHMFFAUCD_js = require('../chunk-HMFFAUCD.js');
|
|
5
6
|
var chunk3BNFUMLL_js = require('../chunk-3BNFUMLL.js');
|
|
6
7
|
require('../chunk-ZSMWDLMK.js');
|
|
7
8
|
|
|
@@ -11,6 +12,14 @@ Object.defineProperty(exports, "useDeferredActivation", {
|
|
|
11
12
|
enumerable: true,
|
|
12
13
|
get: function () { return chunkHGNSJXWT_js.useDeferredActivation; }
|
|
13
14
|
});
|
|
15
|
+
Object.defineProperty(exports, "trackConversion", {
|
|
16
|
+
enumerable: true,
|
|
17
|
+
get: function () { return chunkHMFFAUCD_js.trackConversion; }
|
|
18
|
+
});
|
|
19
|
+
Object.defineProperty(exports, "trackEvent", {
|
|
20
|
+
enumerable: true,
|
|
21
|
+
get: function () { return chunkHMFFAUCD_js.trackEvent; }
|
|
22
|
+
});
|
|
14
23
|
Object.defineProperty(exports, "SiteKitIdentityProvider", {
|
|
15
24
|
enumerable: true,
|
|
16
25
|
get: function () { return chunk3BNFUMLL_js.SiteKitIdentityProvider; }
|
package/dist/client/index.mjs
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
export { useDeferredActivation } from '../chunk-ZVBLXXNJ.mjs';
|
|
3
|
+
export { trackConversion, trackEvent } from '../chunk-3DPXOZAU.mjs';
|
|
3
4
|
export { SiteKitIdentityProvider, getOrCreateSessionId, getOrCreateVisitorId, useSiteKitIdentity } from '../chunk-EE6SFAZP.mjs';
|
|
4
5
|
import '../chunk-4XPGGLVP.mjs';
|
|
5
6
|
//# sourceMappingURL=index.mjs.map
|
package/dist/commerce/index.js
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
'use strict';
|
|
3
3
|
|
|
4
|
-
var
|
|
5
|
-
require('../chunk-
|
|
6
|
-
require('../chunk-
|
|
4
|
+
var chunk3GCEFS73_js = require('../chunk-3GCEFS73.js');
|
|
5
|
+
require('../chunk-EBJ4S5DU.js');
|
|
6
|
+
require('../chunk-IBDVZ6BF.js');
|
|
7
|
+
require('../chunk-HMFFAUCD.js');
|
|
7
8
|
require('../chunk-3BNFUMLL.js');
|
|
8
9
|
require('../chunk-ZSMWDLMK.js');
|
|
9
10
|
|
|
@@ -11,183 +12,183 @@ require('../chunk-ZSMWDLMK.js');
|
|
|
11
12
|
|
|
12
13
|
Object.defineProperty(exports, "CalendarView", {
|
|
13
14
|
enumerable: true,
|
|
14
|
-
get: function () { return
|
|
15
|
+
get: function () { return chunk3GCEFS73_js.CalendarView; }
|
|
15
16
|
});
|
|
16
17
|
Object.defineProperty(exports, "CheckoutForm", {
|
|
17
18
|
enumerable: true,
|
|
18
|
-
get: function () { return
|
|
19
|
+
get: function () { return chunk3GCEFS73_js.CheckoutForm; }
|
|
19
20
|
});
|
|
20
21
|
Object.defineProperty(exports, "EventCalendar", {
|
|
21
22
|
enumerable: true,
|
|
22
|
-
get: function () { return
|
|
23
|
+
get: function () { return chunk3GCEFS73_js.EventCalendar; }
|
|
23
24
|
});
|
|
24
25
|
Object.defineProperty(exports, "EventCheckout", {
|
|
25
26
|
enumerable: true,
|
|
26
|
-
get: function () { return
|
|
27
|
+
get: function () { return chunk3GCEFS73_js.EventCheckout; }
|
|
27
28
|
});
|
|
28
29
|
Object.defineProperty(exports, "EventEmbed", {
|
|
29
30
|
enumerable: true,
|
|
30
|
-
get: function () { return
|
|
31
|
+
get: function () { return chunk3GCEFS73_js.EventEmbed; }
|
|
31
32
|
});
|
|
32
33
|
Object.defineProperty(exports, "EventModal", {
|
|
33
34
|
enumerable: true,
|
|
34
|
-
get: function () { return
|
|
35
|
+
get: function () { return chunk3GCEFS73_js.EventModal; }
|
|
35
36
|
});
|
|
36
37
|
Object.defineProperty(exports, "EventTile", {
|
|
37
38
|
enumerable: true,
|
|
38
|
-
get: function () { return
|
|
39
|
+
get: function () { return chunk3GCEFS73_js.EventTile; }
|
|
39
40
|
});
|
|
40
41
|
Object.defineProperty(exports, "EventsWidget", {
|
|
41
42
|
enumerable: true,
|
|
42
|
-
get: function () { return
|
|
43
|
+
get: function () { return chunk3GCEFS73_js.EventsWidget; }
|
|
43
44
|
});
|
|
44
45
|
Object.defineProperty(exports, "OfferingCard", {
|
|
45
46
|
enumerable: true,
|
|
46
|
-
get: function () { return
|
|
47
|
+
get: function () { return chunk3GCEFS73_js.OfferingCard; }
|
|
47
48
|
});
|
|
48
49
|
Object.defineProperty(exports, "OfferingList", {
|
|
49
50
|
enumerable: true,
|
|
50
|
-
get: function () { return
|
|
51
|
+
get: function () { return chunk3GCEFS73_js.OfferingList; }
|
|
51
52
|
});
|
|
52
53
|
Object.defineProperty(exports, "ProductDetail", {
|
|
53
54
|
enumerable: true,
|
|
54
|
-
get: function () { return
|
|
55
|
+
get: function () { return chunk3GCEFS73_js.ProductDetail; }
|
|
55
56
|
});
|
|
56
57
|
Object.defineProperty(exports, "ProductEmbed", {
|
|
57
58
|
enumerable: true,
|
|
58
|
-
get: function () { return
|
|
59
|
+
get: function () { return chunk3GCEFS73_js.ProductEmbed; }
|
|
59
60
|
});
|
|
60
61
|
Object.defineProperty(exports, "ProductGrid", {
|
|
61
62
|
enumerable: true,
|
|
62
|
-
get: function () { return
|
|
63
|
+
get: function () { return chunk3GCEFS73_js.ProductGrid; }
|
|
63
64
|
});
|
|
64
65
|
Object.defineProperty(exports, "ProductPage", {
|
|
65
66
|
enumerable: true,
|
|
66
|
-
get: function () { return
|
|
67
|
+
get: function () { return chunk3GCEFS73_js.ProductPage; }
|
|
67
68
|
});
|
|
68
69
|
Object.defineProperty(exports, "RegistrationForm", {
|
|
69
70
|
enumerable: true,
|
|
70
|
-
get: function () { return
|
|
71
|
+
get: function () { return chunk3GCEFS73_js.RegistrationForm; }
|
|
71
72
|
});
|
|
72
73
|
Object.defineProperty(exports, "SizeChart", {
|
|
73
74
|
enumerable: true,
|
|
74
|
-
get: function () { return
|
|
75
|
+
get: function () { return chunk3GCEFS73_js.SizeChart; }
|
|
75
76
|
});
|
|
76
77
|
Object.defineProperty(exports, "UpcomingEvents", {
|
|
77
78
|
enumerable: true,
|
|
78
|
-
get: function () { return
|
|
79
|
+
get: function () { return chunk3GCEFS73_js.UpcomingEvents; }
|
|
79
80
|
});
|
|
80
81
|
Object.defineProperty(exports, "createCheckoutSession", {
|
|
81
82
|
enumerable: true,
|
|
82
|
-
get: function () { return
|
|
83
|
+
get: function () { return chunk3GCEFS73_js.createCheckoutSession; }
|
|
83
84
|
});
|
|
84
85
|
Object.defineProperty(exports, "createPaymentIntent", {
|
|
85
86
|
enumerable: true,
|
|
86
|
-
get: function () { return
|
|
87
|
+
get: function () { return chunk3GCEFS73_js.createPaymentIntent; }
|
|
87
88
|
});
|
|
88
89
|
Object.defineProperty(exports, "fetchActiveProcessor", {
|
|
89
90
|
enumerable: true,
|
|
90
|
-
get: function () { return
|
|
91
|
+
get: function () { return chunk3GCEFS73_js.fetchActiveProcessor; }
|
|
91
92
|
});
|
|
92
93
|
Object.defineProperty(exports, "fetchCategories", {
|
|
93
94
|
enumerable: true,
|
|
94
|
-
get: function () { return
|
|
95
|
+
get: function () { return chunk3GCEFS73_js.fetchCategories; }
|
|
95
96
|
});
|
|
96
97
|
Object.defineProperty(exports, "fetchLatestOffering", {
|
|
97
98
|
enumerable: true,
|
|
98
|
-
get: function () { return
|
|
99
|
+
get: function () { return chunk3GCEFS73_js.fetchLatestOffering; }
|
|
99
100
|
});
|
|
100
101
|
Object.defineProperty(exports, "fetchNextEvent", {
|
|
101
102
|
enumerable: true,
|
|
102
|
-
get: function () { return
|
|
103
|
+
get: function () { return chunk3GCEFS73_js.fetchNextEvent; }
|
|
103
104
|
});
|
|
104
105
|
Object.defineProperty(exports, "fetchOffering", {
|
|
105
106
|
enumerable: true,
|
|
106
|
-
get: function () { return
|
|
107
|
+
get: function () { return chunk3GCEFS73_js.fetchOffering; }
|
|
107
108
|
});
|
|
108
109
|
Object.defineProperty(exports, "fetchOfferings", {
|
|
109
110
|
enumerable: true,
|
|
110
|
-
get: function () { return
|
|
111
|
+
get: function () { return chunk3GCEFS73_js.fetchOfferings; }
|
|
111
112
|
});
|
|
112
113
|
Object.defineProperty(exports, "fetchProcessorConfig", {
|
|
113
114
|
enumerable: true,
|
|
114
|
-
get: function () { return
|
|
115
|
+
get: function () { return chunk3GCEFS73_js.fetchProcessorConfig; }
|
|
115
116
|
});
|
|
116
117
|
Object.defineProperty(exports, "fetchProductBySlug", {
|
|
117
118
|
enumerable: true,
|
|
118
|
-
get: function () { return
|
|
119
|
+
get: function () { return chunk3GCEFS73_js.fetchProductBySlug; }
|
|
119
120
|
});
|
|
120
121
|
Object.defineProperty(exports, "fetchProducts", {
|
|
121
122
|
enumerable: true,
|
|
122
|
-
get: function () { return
|
|
123
|
+
get: function () { return chunk3GCEFS73_js.fetchProducts; }
|
|
123
124
|
});
|
|
124
125
|
Object.defineProperty(exports, "fetchProductsPublic", {
|
|
125
126
|
enumerable: true,
|
|
126
|
-
get: function () { return
|
|
127
|
+
get: function () { return chunk3GCEFS73_js.fetchProductsPublic; }
|
|
127
128
|
});
|
|
128
129
|
Object.defineProperty(exports, "fetchServices", {
|
|
129
130
|
enumerable: true,
|
|
130
|
-
get: function () { return
|
|
131
|
+
get: function () { return chunk3GCEFS73_js.fetchServices; }
|
|
131
132
|
});
|
|
132
133
|
Object.defineProperty(exports, "fetchShippingRates", {
|
|
133
134
|
enumerable: true,
|
|
134
|
-
get: function () { return
|
|
135
|
+
get: function () { return chunk3GCEFS73_js.fetchShippingRates; }
|
|
135
136
|
});
|
|
136
137
|
Object.defineProperty(exports, "fetchUpcomingEvents", {
|
|
137
138
|
enumerable: true,
|
|
138
|
-
get: function () { return
|
|
139
|
+
get: function () { return chunk3GCEFS73_js.fetchUpcomingEvents; }
|
|
139
140
|
});
|
|
140
141
|
Object.defineProperty(exports, "formatDate", {
|
|
141
142
|
enumerable: true,
|
|
142
|
-
get: function () { return
|
|
143
|
+
get: function () { return chunk3GCEFS73_js.formatDate; }
|
|
143
144
|
});
|
|
144
145
|
Object.defineProperty(exports, "formatDateRange", {
|
|
145
146
|
enumerable: true,
|
|
146
|
-
get: function () { return
|
|
147
|
+
get: function () { return chunk3GCEFS73_js.formatDateRange; }
|
|
147
148
|
});
|
|
148
149
|
Object.defineProperty(exports, "formatDateTime", {
|
|
149
150
|
enumerable: true,
|
|
150
|
-
get: function () { return
|
|
151
|
+
get: function () { return chunk3GCEFS73_js.formatDateTime; }
|
|
151
152
|
});
|
|
152
153
|
Object.defineProperty(exports, "formatPrice", {
|
|
153
154
|
enumerable: true,
|
|
154
|
-
get: function () { return
|
|
155
|
+
get: function () { return chunk3GCEFS73_js.formatPrice; }
|
|
155
156
|
});
|
|
156
157
|
Object.defineProperty(exports, "formatTime", {
|
|
157
158
|
enumerable: true,
|
|
158
|
-
get: function () { return
|
|
159
|
+
get: function () { return chunk3GCEFS73_js.formatTime; }
|
|
159
160
|
});
|
|
160
161
|
Object.defineProperty(exports, "getOfferingUrl", {
|
|
161
162
|
enumerable: true,
|
|
162
|
-
get: function () { return
|
|
163
|
+
get: function () { return chunk3GCEFS73_js.getOfferingUrl; }
|
|
163
164
|
});
|
|
164
165
|
Object.defineProperty(exports, "getRelativeTimeUntil", {
|
|
165
166
|
enumerable: true,
|
|
166
|
-
get: function () { return
|
|
167
|
+
get: function () { return chunk3GCEFS73_js.getRelativeTimeUntil; }
|
|
167
168
|
});
|
|
168
169
|
Object.defineProperty(exports, "getSpotsRemaining", {
|
|
169
170
|
enumerable: true,
|
|
170
|
-
get: function () { return
|
|
171
|
+
get: function () { return chunk3GCEFS73_js.getSpotsRemaining; }
|
|
171
172
|
});
|
|
172
173
|
Object.defineProperty(exports, "isEventSoldOut", {
|
|
173
174
|
enumerable: true,
|
|
174
|
-
get: function () { return
|
|
175
|
+
get: function () { return chunk3GCEFS73_js.isEventSoldOut; }
|
|
175
176
|
});
|
|
176
177
|
Object.defineProperty(exports, "registerForEvent", {
|
|
177
178
|
enumerable: true,
|
|
178
|
-
get: function () { return
|
|
179
|
+
get: function () { return chunk3GCEFS73_js.registerForEvent; }
|
|
179
180
|
});
|
|
180
181
|
Object.defineProperty(exports, "useEventModal", {
|
|
181
182
|
enumerable: true,
|
|
182
|
-
get: function () { return
|
|
183
|
+
get: function () { return chunk3GCEFS73_js.useEventModal; }
|
|
183
184
|
});
|
|
184
185
|
Object.defineProperty(exports, "validateAddress", {
|
|
185
186
|
enumerable: true,
|
|
186
|
-
get: function () { return
|
|
187
|
+
get: function () { return chunk3GCEFS73_js.validateAddress; }
|
|
187
188
|
});
|
|
188
189
|
Object.defineProperty(exports, "validateDiscountCode", {
|
|
189
190
|
enumerable: true,
|
|
190
|
-
get: function () { return
|
|
191
|
+
get: function () { return chunk3GCEFS73_js.validateDiscountCode; }
|
|
191
192
|
});
|
|
192
193
|
//# sourceMappingURL=index.js.map
|
|
193
194
|
//# sourceMappingURL=index.js.map
|
package/dist/commerce/index.mjs
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
export { CalendarView, CheckoutForm, EventCalendar, EventCheckout, EventEmbed, EventModal, EventTile, EventsWidget, OfferingCard, OfferingList, ProductDetail, ProductEmbed, ProductGrid, ProductPage, RegistrationForm, SizeChart, UpcomingEvents, createCheckoutSession, createPaymentIntent, fetchActiveProcessor, fetchCategories, fetchLatestOffering, fetchNextEvent, fetchOffering, fetchOfferings, fetchProcessorConfig, fetchProductBySlug, fetchProducts, fetchProductsPublic, fetchServices, fetchShippingRates, fetchUpcomingEvents, formatDate, formatDateRange, formatDateTime, formatPrice, formatTime, getOfferingUrl, getRelativeTimeUntil, getSpotsRemaining, isEventSoldOut, registerForEvent, useEventModal, validateAddress, validateDiscountCode } from '../chunk-
|
|
3
|
-
import '../chunk-
|
|
4
|
-
import '../chunk-
|
|
2
|
+
export { CalendarView, CheckoutForm, EventCalendar, EventCheckout, EventEmbed, EventModal, EventTile, EventsWidget, OfferingCard, OfferingList, ProductDetail, ProductEmbed, ProductGrid, ProductPage, RegistrationForm, SizeChart, UpcomingEvents, createCheckoutSession, createPaymentIntent, fetchActiveProcessor, fetchCategories, fetchLatestOffering, fetchNextEvent, fetchOffering, fetchOfferings, fetchProcessorConfig, fetchProductBySlug, fetchProducts, fetchProductsPublic, fetchServices, fetchShippingRates, fetchUpcomingEvents, formatDate, formatDateRange, formatDateTime, formatPrice, formatTime, getOfferingUrl, getRelativeTimeUntil, getSpotsRemaining, isEventSoldOut, registerForEvent, useEventModal, validateAddress, validateDiscountCode } from '../chunk-T4QBSRA4.mjs';
|
|
3
|
+
import '../chunk-AN4ATCYQ.mjs';
|
|
4
|
+
import '../chunk-65SMJBHW.mjs';
|
|
5
|
+
import '../chunk-3DPXOZAU.mjs';
|
|
5
6
|
import '../chunk-EE6SFAZP.mjs';
|
|
6
7
|
import '../chunk-4XPGGLVP.mjs';
|
|
7
8
|
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { T as TrackEventOptions, a as TrackConversionOptions } from './types-DNSYU7qI.mjs';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @sonordev/site-kit — standalone analytics dispatch bridge
|
|
5
|
+
*
|
|
6
|
+
* The analytics API is hook-based (useAnalytics), which requires living
|
|
7
|
+
* inside <AnalyticsProvider>. But the house perf pattern mounts the provider
|
|
8
|
+
* as a childless deferred SIBLING of the page tree (see DeferredAnalytics on
|
|
9
|
+
* reference sites), so page components — and sibling packages like
|
|
10
|
+
* @sonordev/agency-site-kit — can never reach the context.
|
|
11
|
+
*
|
|
12
|
+
* This module is the bridge: AnalyticsProvider registers its trackEvent /
|
|
13
|
+
* trackConversion here on mount (single source of payload construction — do
|
|
14
|
+
* NOT re-implement the POST anywhere else), and the standalone functions
|
|
15
|
+
* below queue until it does. If the provider never mounts, calls no-op after
|
|
16
|
+
* the queue cap — tracking must never break a page.
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Track a custom analytics event from anywhere client-side — no provider
|
|
21
|
+
* context needed. Queues until AnalyticsProvider mounts; no-ops (bounded)
|
|
22
|
+
* if it never does.
|
|
23
|
+
*/
|
|
24
|
+
declare function trackEvent(options: TrackEventOptions): void;
|
|
25
|
+
/** Conversion twin of {@link trackEvent}. */
|
|
26
|
+
declare function trackConversion(options: TrackConversionOptions): void;
|
|
27
|
+
|
|
28
|
+
export { trackConversion as a, trackEvent as t };
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { T as TrackEventOptions, a as TrackConversionOptions } from './types-DNSYU7qI.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @sonordev/site-kit — standalone analytics dispatch bridge
|
|
5
|
+
*
|
|
6
|
+
* The analytics API is hook-based (useAnalytics), which requires living
|
|
7
|
+
* inside <AnalyticsProvider>. But the house perf pattern mounts the provider
|
|
8
|
+
* as a childless deferred SIBLING of the page tree (see DeferredAnalytics on
|
|
9
|
+
* reference sites), so page components — and sibling packages like
|
|
10
|
+
* @sonordev/agency-site-kit — can never reach the context.
|
|
11
|
+
*
|
|
12
|
+
* This module is the bridge: AnalyticsProvider registers its trackEvent /
|
|
13
|
+
* trackConversion here on mount (single source of payload construction — do
|
|
14
|
+
* NOT re-implement the POST anywhere else), and the standalone functions
|
|
15
|
+
* below queue until it does. If the provider never mounts, calls no-op after
|
|
16
|
+
* the queue cap — tracking must never break a page.
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Track a custom analytics event from anywhere client-side — no provider
|
|
21
|
+
* context needed. Queues until AnalyticsProvider mounts; no-ops (bounded)
|
|
22
|
+
* if it never does.
|
|
23
|
+
*/
|
|
24
|
+
declare function trackEvent(options: TrackEventOptions): void;
|
|
25
|
+
/** Conversion twin of {@link trackEvent}. */
|
|
26
|
+
declare function trackConversion(options: TrackConversionOptions): void;
|
|
27
|
+
|
|
28
|
+
export { trackConversion as a, trackEvent as t };
|
package/dist/index.d.mts
CHANGED
|
@@ -2,7 +2,7 @@ export { b as ManagedFAQData, M as ManagedMetadataResult, a as ManagedSchemaProp
|
|
|
2
2
|
export { c as AnalyticsConfig, b as AnalyticsEvent, P as PageView } from './types-DNSYU7qI.mjs';
|
|
3
3
|
export { C as ChatConfig, c as EngageElement, d as WidgetConfig } from './types-D_1iUxOQ.mjs';
|
|
4
4
|
export { a as FormField, F as FormSubmission, M as ManagedFormConfig } from './types-0dmq3k20.mjs';
|
|
5
|
-
export { a as BlogAuthor, b as BlogCategory, B as BlogPostType } from './types-
|
|
5
|
+
export { a as BlogAuthor, b as BlogCategory, B as BlogPostType } from './types-DYOumpUT.mjs';
|
|
6
6
|
export { d as Cart, e as CartItem, a as CommerceCategory, C as CommerceOffering, c as CommerceSchedule, b as CommerceVariant, O as OfferingType } from './types-iZM4Lz71.mjs';
|
|
7
7
|
export { d as CalendarView, C as CheckoutForm, t as CheckoutLineItem, f as EventCalendar, c as EventCheckout, s as EventCheckoutProps, b as EventEmbed, e as EventModal, E as EventTile, O as OfferingCard, a as OfferingList, P as ProductEmbed, R as RegistrationForm, U as UpcomingEvents, m as createCheckoutSession, l as fetchNextEvent, h as fetchOffering, g as fetchOfferings, i as fetchProducts, j as fetchServices, k as fetchUpcomingEvents, o as formatDate, p as formatDateTime, n as formatPrice, q as getOfferingUrl, r as registerForEvent, u as useEventModal } from './useEventModal-qJfX_1XG.mjs';
|
|
8
8
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
package/dist/index.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ export { b as ManagedFAQData, M as ManagedMetadataResult, a as ManagedSchemaProp
|
|
|
2
2
|
export { c as AnalyticsConfig, b as AnalyticsEvent, P as PageView } from './types-DNSYU7qI.js';
|
|
3
3
|
export { C as ChatConfig, c as EngageElement, d as WidgetConfig } from './types-D_1iUxOQ.js';
|
|
4
4
|
export { a as FormField, F as FormSubmission, M as ManagedFormConfig } from './types-0dmq3k20.js';
|
|
5
|
-
export { a as BlogAuthor, b as BlogCategory, B as BlogPostType } from './types-
|
|
5
|
+
export { a as BlogAuthor, b as BlogCategory, B as BlogPostType } from './types-DYOumpUT.js';
|
|
6
6
|
export { d as Cart, e as CartItem, a as CommerceCategory, C as CommerceOffering, c as CommerceSchedule, b as CommerceVariant, O as OfferingType } from './types-iZM4Lz71.js';
|
|
7
7
|
export { d as CalendarView, C as CheckoutForm, t as CheckoutLineItem, f as EventCalendar, c as EventCheckout, s as EventCheckoutProps, b as EventEmbed, e as EventModal, E as EventTile, O as OfferingCard, a as OfferingList, P as ProductEmbed, R as RegistrationForm, U as UpcomingEvents, m as createCheckoutSession, l as fetchNextEvent, h as fetchOffering, g as fetchOfferings, i as fetchProducts, j as fetchServices, k as fetchUpcomingEvents, o as formatDate, p as formatDateTime, n as formatPrice, q as getOfferingUrl, r as registerForEvent, u as useEventModal } from './useEventModal-CcxNZOvp.js';
|
|
8
8
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
package/dist/index.js
CHANGED
|
@@ -8,10 +8,11 @@ var chunkEHJANA5C_js = require('./chunk-EHJANA5C.js');
|
|
|
8
8
|
var chunkGSRT66PA_js = require('./chunk-GSRT66PA.js');
|
|
9
9
|
var chunkDGHPOWLU_js = require('./chunk-DGHPOWLU.js');
|
|
10
10
|
var chunkO7E6QVK3_js = require('./chunk-O7E6QVK3.js');
|
|
11
|
-
var
|
|
11
|
+
var chunk3GCEFS73_js = require('./chunk-3GCEFS73.js');
|
|
12
12
|
var chunkI2GTT2DG_js = require('./chunk-I2GTT2DG.js');
|
|
13
|
-
require('./chunk-
|
|
14
|
-
require('./chunk-
|
|
13
|
+
require('./chunk-EBJ4S5DU.js');
|
|
14
|
+
require('./chunk-IBDVZ6BF.js');
|
|
15
|
+
require('./chunk-HMFFAUCD.js');
|
|
15
16
|
require('./chunk-3BNFUMLL.js');
|
|
16
17
|
require('./chunk-ZSMWDLMK.js');
|
|
17
18
|
var react = require('react');
|
|
@@ -252,103 +253,103 @@ Object.defineProperty(exports, "useSignalOutcome", {
|
|
|
252
253
|
});
|
|
253
254
|
Object.defineProperty(exports, "CalendarView", {
|
|
254
255
|
enumerable: true,
|
|
255
|
-
get: function () { return
|
|
256
|
+
get: function () { return chunk3GCEFS73_js.CalendarView; }
|
|
256
257
|
});
|
|
257
258
|
Object.defineProperty(exports, "CheckoutForm", {
|
|
258
259
|
enumerable: true,
|
|
259
|
-
get: function () { return
|
|
260
|
+
get: function () { return chunk3GCEFS73_js.CheckoutForm; }
|
|
260
261
|
});
|
|
261
262
|
Object.defineProperty(exports, "EventCalendar", {
|
|
262
263
|
enumerable: true,
|
|
263
|
-
get: function () { return
|
|
264
|
+
get: function () { return chunk3GCEFS73_js.EventCalendar; }
|
|
264
265
|
});
|
|
265
266
|
Object.defineProperty(exports, "EventCheckout", {
|
|
266
267
|
enumerable: true,
|
|
267
|
-
get: function () { return
|
|
268
|
+
get: function () { return chunk3GCEFS73_js.EventCheckout; }
|
|
268
269
|
});
|
|
269
270
|
Object.defineProperty(exports, "EventEmbed", {
|
|
270
271
|
enumerable: true,
|
|
271
|
-
get: function () { return
|
|
272
|
+
get: function () { return chunk3GCEFS73_js.EventEmbed; }
|
|
272
273
|
});
|
|
273
274
|
Object.defineProperty(exports, "EventModal", {
|
|
274
275
|
enumerable: true,
|
|
275
|
-
get: function () { return
|
|
276
|
+
get: function () { return chunk3GCEFS73_js.EventModal; }
|
|
276
277
|
});
|
|
277
278
|
Object.defineProperty(exports, "EventTile", {
|
|
278
279
|
enumerable: true,
|
|
279
|
-
get: function () { return
|
|
280
|
+
get: function () { return chunk3GCEFS73_js.EventTile; }
|
|
280
281
|
});
|
|
281
282
|
Object.defineProperty(exports, "OfferingCard", {
|
|
282
283
|
enumerable: true,
|
|
283
|
-
get: function () { return
|
|
284
|
+
get: function () { return chunk3GCEFS73_js.OfferingCard; }
|
|
284
285
|
});
|
|
285
286
|
Object.defineProperty(exports, "OfferingList", {
|
|
286
287
|
enumerable: true,
|
|
287
|
-
get: function () { return
|
|
288
|
+
get: function () { return chunk3GCEFS73_js.OfferingList; }
|
|
288
289
|
});
|
|
289
290
|
Object.defineProperty(exports, "ProductEmbed", {
|
|
290
291
|
enumerable: true,
|
|
291
|
-
get: function () { return
|
|
292
|
+
get: function () { return chunk3GCEFS73_js.ProductEmbed; }
|
|
292
293
|
});
|
|
293
294
|
Object.defineProperty(exports, "RegistrationForm", {
|
|
294
295
|
enumerable: true,
|
|
295
|
-
get: function () { return
|
|
296
|
+
get: function () { return chunk3GCEFS73_js.RegistrationForm; }
|
|
296
297
|
});
|
|
297
298
|
Object.defineProperty(exports, "UpcomingEvents", {
|
|
298
299
|
enumerable: true,
|
|
299
|
-
get: function () { return
|
|
300
|
+
get: function () { return chunk3GCEFS73_js.UpcomingEvents; }
|
|
300
301
|
});
|
|
301
302
|
Object.defineProperty(exports, "createCheckoutSession", {
|
|
302
303
|
enumerable: true,
|
|
303
|
-
get: function () { return
|
|
304
|
+
get: function () { return chunk3GCEFS73_js.createCheckoutSession; }
|
|
304
305
|
});
|
|
305
306
|
Object.defineProperty(exports, "fetchNextEvent", {
|
|
306
307
|
enumerable: true,
|
|
307
|
-
get: function () { return
|
|
308
|
+
get: function () { return chunk3GCEFS73_js.fetchNextEvent; }
|
|
308
309
|
});
|
|
309
310
|
Object.defineProperty(exports, "fetchOffering", {
|
|
310
311
|
enumerable: true,
|
|
311
|
-
get: function () { return
|
|
312
|
+
get: function () { return chunk3GCEFS73_js.fetchOffering; }
|
|
312
313
|
});
|
|
313
314
|
Object.defineProperty(exports, "fetchOfferings", {
|
|
314
315
|
enumerable: true,
|
|
315
|
-
get: function () { return
|
|
316
|
+
get: function () { return chunk3GCEFS73_js.fetchOfferings; }
|
|
316
317
|
});
|
|
317
318
|
Object.defineProperty(exports, "fetchProducts", {
|
|
318
319
|
enumerable: true,
|
|
319
|
-
get: function () { return
|
|
320
|
+
get: function () { return chunk3GCEFS73_js.fetchProducts; }
|
|
320
321
|
});
|
|
321
322
|
Object.defineProperty(exports, "fetchServices", {
|
|
322
323
|
enumerable: true,
|
|
323
|
-
get: function () { return
|
|
324
|
+
get: function () { return chunk3GCEFS73_js.fetchServices; }
|
|
324
325
|
});
|
|
325
326
|
Object.defineProperty(exports, "fetchUpcomingEvents", {
|
|
326
327
|
enumerable: true,
|
|
327
|
-
get: function () { return
|
|
328
|
+
get: function () { return chunk3GCEFS73_js.fetchUpcomingEvents; }
|
|
328
329
|
});
|
|
329
330
|
Object.defineProperty(exports, "formatDate", {
|
|
330
331
|
enumerable: true,
|
|
331
|
-
get: function () { return
|
|
332
|
+
get: function () { return chunk3GCEFS73_js.formatDate; }
|
|
332
333
|
});
|
|
333
334
|
Object.defineProperty(exports, "formatDateTime", {
|
|
334
335
|
enumerable: true,
|
|
335
|
-
get: function () { return
|
|
336
|
+
get: function () { return chunk3GCEFS73_js.formatDateTime; }
|
|
336
337
|
});
|
|
337
338
|
Object.defineProperty(exports, "formatPrice", {
|
|
338
339
|
enumerable: true,
|
|
339
|
-
get: function () { return
|
|
340
|
+
get: function () { return chunk3GCEFS73_js.formatPrice; }
|
|
340
341
|
});
|
|
341
342
|
Object.defineProperty(exports, "getOfferingUrl", {
|
|
342
343
|
enumerable: true,
|
|
343
|
-
get: function () { return
|
|
344
|
+
get: function () { return chunk3GCEFS73_js.getOfferingUrl; }
|
|
344
345
|
});
|
|
345
346
|
Object.defineProperty(exports, "registerForEvent", {
|
|
346
347
|
enumerable: true,
|
|
347
|
-
get: function () { return
|
|
348
|
+
get: function () { return chunk3GCEFS73_js.registerForEvent; }
|
|
348
349
|
});
|
|
349
350
|
Object.defineProperty(exports, "useEventModal", {
|
|
350
351
|
enumerable: true,
|
|
351
|
-
get: function () { return
|
|
352
|
+
get: function () { return chunk3GCEFS73_js.useEventModal; }
|
|
352
353
|
});
|
|
353
354
|
Object.defineProperty(exports, "BookingWidget", {
|
|
354
355
|
enumerable: true,
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/affiliates/api.ts","../src/affiliates/useAffiliates.ts","../src/affiliates/AffiliatesWidget.tsx"],"names":["useState","useEffect","getTrackingUrl","jsx"],"mappings":";;;;;;;;;;;;;;;;;;;;AAaA,SAAS,YAAA,GAAe;AACtB,EAAA,MAAM,SAAS,OAAO,MAAA,KAAW,WAAA,GAC5B,MAAA,CAAe,wBAAwB,sBAAA,GACxC,sBAAA;AACJ,EAAA,MAAM,SAAS,OAAO,MAAA,KAAW,WAAA,GAC5B,MAAA,CAAe,wBAAwB,EAAA,GACxC,EAAA;AACJ,EAA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etching affiliate data for client sites.\n * All data goes through Portal API with API key auth - never Supabase directly.\n */\n\nimport type { Affiliate, AffiliateWithOffers, FetchAffiliatesOptions } from './types'\n\n// ============================================\n// API Config Helpers\n// ============================================\n\nfunction getApiConfig() {\n const apiUrl = typeof window !== 'undefined' \n ? (window as any).__SITE_KIT_API_URL__ || 'https://api.sonor.io'\n : 'https://api.sonor.io'\n const apiKey = typeof window !== 'undefined' \n ? (window as any).__SITE_KIT_API_KEY__ || ''\n : ''\n return { apiUrl, apiKey }\n}\n\nasync function apiGet<T>(endpoint: string): Promise<T | null> {\n const { apiUrl, apiKey } = getApiConfig()\n \n if (!apiKey) {\n console.error('[Affiliates] No API key configured')\n return null\n }\n \n try {\n const response = await fetch(`${apiUrl}${endpoint}`, {\n method: 'GET',\n headers: {\n 'x-api-key': apiKey,\n },\n })\n \n if (!response.ok) {\n console.error(`[Affiliates] API error: ${response.statusText}`)\n return null\n }\n \n return await response.json()\n } catch (error) {\n console.error('[Affiliates] Network error:', error)\n return null\n }\n}\n\n// ============================================\n// Fetch Affiliates\n// ============================================\n\n/**\n * Fetch all active affiliates for the project\n * \n * @example\n * ```ts\n * const affiliates = await fetchAffiliates()\n * ```\n */\nexport async function fetchAffiliates(\n options: FetchAffiliatesOptions = {}\n): Promise<AffiliateWithOffers[]> {\n const result = await apiGet<{ affiliates: AffiliateWithOffers[] }>(\n '/api/public/affiliates'\n )\n \n return result?.affiliates || []\n}\n\n/**\n * Build a tracking URL for an affiliate offer\n * When clicked, this redirects through our tracking endpoint and then to the destination\n * \n * @example\n * ```ts\n * const trackingUrl = getTrackingUrl(affiliate.id, offer.id)\n * // Returns: https://api.sonor.io/a/{affiliateId}/{offerId}\n * ```\n */\nexport function getTrackingUrl(affiliateId: string, offerId: string): string {\n const { apiUrl } = getApiConfig()\n return `${apiUrl}/a/${affiliateId}/${offerId}`\n}\n","/**\n * @sonordev/site-kit/affiliates - useAffiliates Hook\n * \n * React hook for fetching and displaying affiliates on client sites.\n */\n\n'use client'\n\nimport { useState, useEffect } from 'react'\nimport type { AffiliateWithOffers } from './types'\nimport { fetchAffiliates, getTrackingUrl } from './api'\n\nexport interface UseAffiliatesResult {\n affiliates: AffiliateWithOffers[]\n isLoading: boolean\n error: string | null\n getTrackingUrl: (affiliateId: string, offerId: string) => string\n}\n\n/**\n * Hook to fetch affiliates for display on client sites\n * \n * @example\n * ```tsx\n * function AffiliatesSection() {\n * const { affiliates, isLoading } = useAffiliates()\n * \n * if (isLoading) return <div>Loading...</div>\n * \n * return (\n * <div className=\"grid grid-cols-3 gap-4\">\n * {affiliates.map(affiliate => (\n * <AffiliateCard key={affiliate.id} affiliate={affiliate} />\n * ))}\n * </div>\n * )\n * }\n * ```\n */\nexport function useAffiliates(): UseAffiliatesResult {\n const [affiliates, setAffiliates] = useState<AffiliateWithOffers[]>([])\n const [isLoading, setIsLoading] = useState(true)\n const [error, setError] = useState<string | null>(null)\n\n useEffect(() => {\n async function load() {\n try {\n setIsLoading(true)\n setError(null)\n const data = await fetchAffiliates()\n setAffiliates(data)\n } catch (err) {\n setError(err instanceof Error ? err.message : 'Failed to load affiliates')\n } finally {\n setIsLoading(false)\n }\n }\n \n load()\n }, [])\n\n return {\n affiliates,\n isLoading,\n error,\n getTrackingUrl,\n }\n}\n","/**\n * @sonordev/site-kit/affiliates - AffiliatesWidget Component\n * \n * Unstyled, headless component for displaying affiliates.\n * Client sites can wrap this or use it directly with their own styling.\n */\n\n'use client'\n\nimport React from 'react'\nimport { useAffiliates } from './useAffiliates'\nimport type { AffiliateWithOffers, AffiliateOffer } from './types'\n\n// ============================================\n// Affiliate Card (Unstyled)\n// ============================================\n\nexport interface AffiliateCardProps {\n affiliate: AffiliateWithOffers\n className?: string\n /** Optional custom render for the logo */\n renderLogo?: (affiliate: AffiliateWithOffers) => React.ReactNode\n /** Show offers as links below the card */\n showOffers?: boolean\n}\n\n/**\n * Single affiliate card - unstyled, bring your own CSS\n * \n * @example\n * ```tsx\n * <AffiliateCard \n * affiliate={affiliate}\n * className=\"p-4 bg-white rounded-lg shadow\"\n * showOffers\n * />\n * ```\n */\nexport function AffiliateCard({\n affiliate,\n className = '',\n renderLogo,\n showOffers = false,\n}: AffiliateCardProps) {\n const { getTrackingUrl } = useAffiliates()\n \n const defaultLogo = (\n <div data-affiliate-logo className=\"affiliate-logo\">\n {affiliate.logo_url ? (\n <img \n src={affiliate.logo_url} \n alt={affiliate.name}\n loading=\"lazy\"\n />\n ) : (\n <span>{affiliate.name.charAt(0)}</span>\n )}\n </div>\n )\n\n return (\n <div className={className} data-affiliate-card data-affiliate-id={affiliate.id}>\n {/* Logo */}\n {renderLogo ? renderLogo(affiliate) : defaultLogo}\n \n {/* Name */}\n <div data-affiliate-name className=\"affiliate-name\">\n {affiliate.name}\n </div>\n \n {/* Website link */}\n {affiliate.website_url && (\n <a \n href={affiliate.website_url}\n target=\"_blank\"\n rel=\"noopener noreferrer sponsored\"\n data-affiliate-website\n className=\"affiliate-website\"\n >\n Visit Website\n </a>\n )}\n \n {/* Offers */}\n {showOffers && affiliate.offers && affiliate.offers.length > 0 && (\n <div data-affiliate-offers className=\"affiliate-offers\">\n {affiliate.offers.map(offer => (\n <a\n key={offer.id}\n href={getTrackingUrl(affiliate.id, offer.id)}\n target=\"_blank\"\n rel=\"noopener noreferrer sponsored\"\n data-affiliate-offer\n data-offer-id={offer.id}\n className=\"affiliate-offer\"\n >\n {offer.name}\n </a>\n ))}\n </div>\n )}\n </div>\n )\n}\n\n// ============================================\n// Affiliates Grid (Unstyled)\n// ============================================\n\nexport interface AffiliatesWidgetProps {\n className?: string\n /** Custom loading component */\n loadingComponent?: React.ReactNode\n /** Custom empty state component */\n emptyComponent?: React.ReactNode\n /** Custom error component */\n errorComponent?: React.ReactNode\n /** Show offers on each card */\n showOffers?: boolean\n /** Custom render function for each affiliate */\n renderAffiliate?: (affiliate: AffiliateWithOffers) => React.ReactNode\n /** Maximum number to display */\n limit?: number\n}\n\n/**\n * Display a grid of affiliates - unstyled, bring your own CSS\n * \n * @example\n * ```tsx\n * // Basic usage\n * <AffiliatesWidget className=\"grid grid-cols-3 gap-4\" />\n * \n * // With custom rendering\n * <AffiliatesWidget\n * renderAffiliate={(affiliate) => (\n * <MyCustomCard key={affiliate.id} data={affiliate} />\n * )}\n * />\n * ```\n */\nexport function AffiliatesWidget({\n className = '',\n loadingComponent,\n emptyComponent,\n errorComponent,\n showOffers = false,\n renderAffiliate,\n limit,\n}: AffiliatesWidgetProps) {\n const { affiliates, isLoading, error, getTrackingUrl } = useAffiliates()\n \n if (isLoading) {\n return loadingComponent || <div data-affiliates-loading>Loading affiliates...</div>\n }\n \n if (error) {\n return errorComponent || <div data-affiliates-error>{error}</div>\n }\n \n const displayAffiliates = limit ? affiliates.slice(0, limit) : affiliates\n \n if (displayAffiliates.length === 0) {\n return emptyComponent || null\n }\n \n return (\n <div className={className} data-affiliates-widget>\n {displayAffiliates.map(affiliate => \n renderAffiliate \n ? renderAffiliate(affiliate)\n : <AffiliateCard \n key={affiliate.id} \n affiliate={affiliate} \n showOffers={showOffers}\n />\n )}\n </div>\n )\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/affiliates/api.ts","../src/affiliates/useAffiliates.ts","../src/affiliates/AffiliatesWidget.tsx"],"names":["useState","useEffect","getTrackingUrl","jsx"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAaA,SAAS,YAAA,GAAe;AACtB,EAAA,MAAM,SAAS,OAAO,MAAA,KAAW,WAAA,GAC5B,MAAA,CAAe,wBAAwB,sBAAA,GACxC,sBAAA;AACJ,EAAA,MAAM,SAAS,OAAO,MAAA,KAAW,WAAA,GAC5B,MAAA,CAAe,wBAAwB,EAAA,GACxC,EAAA;AACJ,EAAA,OAAO,EAAE,QAAQ,MAAA,EAAO;AAC1B;AAEA,eAAe,OAAU,QAAA,EAAqC;AAC5D,EAAA,MAAM,EAAE,MAAA,EAAQ,MAAA,EAAO,GAAI,YAAA,EAAa;AAExC,EAAA,IAAI,CAAC,MAAA,EAAQ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AAA;AAAA,EACb,eAAA;AAAA,EACA;AACF,CAAA,EAA0B;AACxB,EAAA,MAAM,EAAE,UAAA,EAAY,SAAA,EAAW,OAAO,cAAA,EAAAA,eAAAA,KAAmB,aAAA,EAAc;AAEvE,EAAA,IAAI,SAAA,EAAW;AACb,IAAA,OAAO,gBAAA,oBAAoBC,cAAA,CAAC,KAAA,EAAA,EAAI,yBAAA,EAAuB,MAAC,QAAA,EAAA,uBAAA,EAAqB,CAAA;AAAA,EAC/E;AAEA,EAAA,IAAI,KAAA,EAAO;AACT,IAAA,OAAO,cAAA,oBAAkBA,cAAA,CAAC,KAAA,EAAA,EAAI,uBAAA,EAAqB,MAAE,QAAA,EAAA,KAAA,EAAM,CAAA;AAAA,EAC7D;AAEA,EAAA,MAAM,oBAAoB,KAAA,GAAQ,UAAA,CAAW,KAAA,CAAM,CAAA,EAAG,KAAK,CAAA,GAAI,UAAA;AAE/D,EAAA,IAAI,iBAAA,CAAkB,WAAW,CAAA,EAAG;AAClC,IAAA,OAAO,cAAA,IAAkB,IAAA;AAAA,EAC3B;AAEA,EAAA,uBACEA,cAAA,CAAC,KAAA,EAAA,EAAI,SAAA,EAAsB,wBAAA,EAAsB,MAC9C,QAAA,EAAA,iBAAA,CAAkB,GAAA;AAAA,IAAI,CAAA,SAAA,KACrB,eAAA,GACI,eAAA,CAAgB,SAAS,CAAA,mBACzBA,cAAA;AAAA,MAAC,aAAA;AAAA,MAAA;AAAA,QAEC,SAAA;AAAA,QACA;AAAA,OAAA;AAAA,MAFK,SAAA,CAAU;AAAA;AAGjB,GACN,EACF,CAAA;AAEJ","file":"index.js","sourcesContent":["/**\n * @sonordev/site-kit/affiliates - Affiliates API\n * \n * API functions for fetching affiliate data for client sites.\n * All data goes through Portal API with API key auth - never Supabase directly.\n */\n\nimport type { Affiliate, AffiliateWithOffers, FetchAffiliatesOptions } from './types'\n\n// ============================================\n// API Config Helpers\n// ============================================\n\nfunction getApiConfig() {\n const apiUrl = typeof window !== 'undefined' \n ? (window as any).__SITE_KIT_API_URL__ || 'https://api.sonor.io'\n : 'https://api.sonor.io'\n const apiKey = typeof window !== 'undefined' \n ? (window as any).__SITE_KIT_API_KEY__ || ''\n : ''\n return { apiUrl, apiKey }\n}\n\nasync function apiGet<T>(endpoint: string): Promise<T | null> {\n const { apiUrl, apiKey } = getApiConfig()\n \n if (!apiKey) {\n console.error('[Affiliates] No API key configured')\n return null\n }\n \n try {\n const response = await fetch(`${apiUrl}${endpoint}`, {\n method: 'GET',\n headers: {\n 'x-api-key': apiKey,\n },\n })\n \n if (!response.ok) {\n console.error(`[Affiliates] API error: ${response.statusText}`)\n return null\n }\n \n return await response.json()\n } catch (error) {\n console.error('[Affiliates] Network error:', error)\n return null\n }\n}\n\n// ============================================\n// Fetch Affiliates\n// ============================================\n\n/**\n * Fetch all active affiliates for the project\n * \n * @example\n * ```ts\n * const affiliates = await fetchAffiliates()\n * ```\n */\nexport async function fetchAffiliates(\n options: FetchAffiliatesOptions = {}\n): Promise<AffiliateWithOffers[]> {\n const result = await apiGet<{ affiliates: AffiliateWithOffers[] }>(\n '/api/public/affiliates'\n )\n \n return result?.affiliates || []\n}\n\n/**\n * Build a tracking URL for an affiliate offer\n * When clicked, this redirects through our tracking endpoint and then to the destination\n * \n * @example\n * ```ts\n * const trackingUrl = getTrackingUrl(affiliate.id, offer.id)\n * // Returns: https://api.sonor.io/a/{affiliateId}/{offerId}\n * ```\n */\nexport function getTrackingUrl(affiliateId: string, offerId: string): string {\n const { apiUrl } = getApiConfig()\n return `${apiUrl}/a/${affiliateId}/${offerId}`\n}\n","/**\n * @sonordev/site-kit/affiliates - useAffiliates Hook\n * \n * React hook for fetching and displaying affiliates on client sites.\n */\n\n'use client'\n\nimport { useState, useEffect } from 'react'\nimport type { AffiliateWithOffers } from './types'\nimport { fetchAffiliates, getTrackingUrl } from './api'\n\nexport interface UseAffiliatesResult {\n affiliates: AffiliateWithOffers[]\n isLoading: boolean\n error: string | null\n getTrackingUrl: (affiliateId: string, offerId: string) => string\n}\n\n/**\n * Hook to fetch affiliates for display on client sites\n * \n * @example\n * ```tsx\n * function AffiliatesSection() {\n * const { affiliates, isLoading } = useAffiliates()\n * \n * if (isLoading) return <div>Loading...</div>\n * \n * return (\n * <div className=\"grid grid-cols-3 gap-4\">\n * {affiliates.map(affiliate => (\n * <AffiliateCard key={affiliate.id} affiliate={affiliate} />\n * ))}\n * </div>\n * )\n * }\n * ```\n */\nexport function useAffiliates(): UseAffiliatesResult {\n const [affiliates, setAffiliates] = useState<AffiliateWithOffers[]>([])\n const [isLoading, setIsLoading] = useState(true)\n const [error, setError] = useState<string | null>(null)\n\n useEffect(() => {\n async function load() {\n try {\n setIsLoading(true)\n setError(null)\n const data = await fetchAffiliates()\n setAffiliates(data)\n } catch (err) {\n setError(err instanceof Error ? err.message : 'Failed to load affiliates')\n } finally {\n setIsLoading(false)\n }\n }\n \n load()\n }, [])\n\n return {\n affiliates,\n isLoading,\n error,\n getTrackingUrl,\n }\n}\n","/**\n * @sonordev/site-kit/affiliates - AffiliatesWidget Component\n * \n * Unstyled, headless component for displaying affiliates.\n * Client sites can wrap this or use it directly with their own styling.\n */\n\n'use client'\n\nimport React from 'react'\nimport { useAffiliates } from './useAffiliates'\nimport type { AffiliateWithOffers, AffiliateOffer } from './types'\n\n// ============================================\n// Affiliate Card (Unstyled)\n// ============================================\n\nexport interface AffiliateCardProps {\n affiliate: AffiliateWithOffers\n className?: string\n /** Optional custom render for the logo */\n renderLogo?: (affiliate: AffiliateWithOffers) => React.ReactNode\n /** Show offers as links below the card */\n showOffers?: boolean\n}\n\n/**\n * Single affiliate card - unstyled, bring your own CSS\n * \n * @example\n * ```tsx\n * <AffiliateCard \n * affiliate={affiliate}\n * className=\"p-4 bg-white rounded-lg shadow\"\n * showOffers\n * />\n * ```\n */\nexport function AffiliateCard({\n affiliate,\n className = '',\n renderLogo,\n showOffers = false,\n}: AffiliateCardProps) {\n const { getTrackingUrl } = useAffiliates()\n \n const defaultLogo = (\n <div data-affiliate-logo className=\"affiliate-logo\">\n {affiliate.logo_url ? (\n <img \n src={affiliate.logo_url} \n alt={affiliate.name}\n loading=\"lazy\"\n />\n ) : (\n <span>{affiliate.name.charAt(0)}</span>\n )}\n </div>\n )\n\n return (\n <div className={className} data-affiliate-card data-affiliate-id={affiliate.id}>\n {/* Logo */}\n {renderLogo ? renderLogo(affiliate) : defaultLogo}\n \n {/* Name */}\n <div data-affiliate-name className=\"affiliate-name\">\n {affiliate.name}\n </div>\n \n {/* Website link */}\n {affiliate.website_url && (\n <a \n href={affiliate.website_url}\n target=\"_blank\"\n rel=\"noopener noreferrer sponsored\"\n data-affiliate-website\n className=\"affiliate-website\"\n >\n Visit Website\n </a>\n )}\n \n {/* Offers */}\n {showOffers && affiliate.offers && affiliate.offers.length > 0 && (\n <div data-affiliate-offers className=\"affiliate-offers\">\n {affiliate.offers.map(offer => (\n <a\n key={offer.id}\n href={getTrackingUrl(affiliate.id, offer.id)}\n target=\"_blank\"\n rel=\"noopener noreferrer sponsored\"\n data-affiliate-offer\n data-offer-id={offer.id}\n className=\"affiliate-offer\"\n >\n {offer.name}\n </a>\n ))}\n </div>\n )}\n </div>\n )\n}\n\n// ============================================\n// Affiliates Grid (Unstyled)\n// ============================================\n\nexport interface AffiliatesWidgetProps {\n className?: string\n /** Custom loading component */\n loadingComponent?: React.ReactNode\n /** Custom empty state component */\n emptyComponent?: React.ReactNode\n /** Custom error component */\n errorComponent?: React.ReactNode\n /** Show offers on each card */\n showOffers?: boolean\n /** Custom render function for each affiliate */\n renderAffiliate?: (affiliate: AffiliateWithOffers) => React.ReactNode\n /** Maximum number to display */\n limit?: number\n}\n\n/**\n * Display a grid of affiliates - unstyled, bring your own CSS\n * \n * @example\n * ```tsx\n * // Basic usage\n * <AffiliatesWidget className=\"grid grid-cols-3 gap-4\" />\n * \n * // With custom rendering\n * <AffiliatesWidget\n * renderAffiliate={(affiliate) => (\n * <MyCustomCard key={affiliate.id} data={affiliate} />\n * )}\n * />\n * ```\n */\nexport function AffiliatesWidget({\n className = '',\n loadingComponent,\n emptyComponent,\n errorComponent,\n showOffers = false,\n renderAffiliate,\n limit,\n}: AffiliatesWidgetProps) {\n const { affiliates, isLoading, error, getTrackingUrl } = useAffiliates()\n \n if (isLoading) {\n return loadingComponent || <div data-affiliates-loading>Loading affiliates...</div>\n }\n \n if (error) {\n return errorComponent || <div data-affiliates-error>{error}</div>\n }\n \n const displayAffiliates = limit ? affiliates.slice(0, limit) : affiliates\n \n if (displayAffiliates.length === 0) {\n return emptyComponent || null\n }\n \n return (\n <div className={className} data-affiliates-widget>\n {displayAffiliates.map(affiliate => \n renderAffiliate \n ? renderAffiliate(affiliate)\n : <AffiliateCard \n key={affiliate.id} \n affiliate={affiliate} \n showOffers={showOffers}\n />\n )}\n </div>\n )\n}\n"]}
|
package/dist/index.mjs
CHANGED
|
@@ -6,10 +6,11 @@ export { TestimonialSection } from './chunk-VIGRGMWR.mjs';
|
|
|
6
6
|
export { fetchReviewStats, fetchReviews } from './chunk-MU7DTEUF.mjs';
|
|
7
7
|
export { ExperimentConversion, SignalExperiment, useExperimentVariant } from './chunk-EUDTPXUI.mjs';
|
|
8
8
|
export { SignalBridge, useSignal, useSignalConfig, useSignalEvent, useSignalExperiment, useSignalOutcome } from './chunk-YFGKIKXA.mjs';
|
|
9
|
-
export { CalendarView, CheckoutForm, EventCalendar, EventCheckout, EventEmbed, EventModal, EventTile, OfferingCard, OfferingList, ProductEmbed, RegistrationForm, UpcomingEvents, createCheckoutSession, fetchNextEvent, fetchOffering, fetchOfferings, fetchProducts, fetchServices, fetchUpcomingEvents, formatDate, formatDateTime, formatPrice, getOfferingUrl, registerForEvent, useEventModal } from './chunk-
|
|
9
|
+
export { CalendarView, CheckoutForm, EventCalendar, EventCheckout, EventEmbed, EventModal, EventTile, OfferingCard, OfferingList, ProductEmbed, RegistrationForm, UpcomingEvents, createCheckoutSession, fetchNextEvent, fetchOffering, fetchOfferings, fetchProducts, fetchServices, fetchUpcomingEvents, formatDate, formatDateTime, formatPrice, getOfferingUrl, registerForEvent, useEventModal } from './chunk-T4QBSRA4.mjs';
|
|
10
10
|
export { BookingWidget, createBooking, createSlotHold, detectTimezone, fetchAvailability, fetchAvailableDates, fetchBookingTypeDetails, fetchBookingTypes, formatDate as formatBookingDate, formatTime as formatBookingTime, formatDuration, releaseSlotHold } from './chunk-FMZOZQBV.mjs';
|
|
11
|
-
import './chunk-
|
|
12
|
-
import './chunk-
|
|
11
|
+
import './chunk-AN4ATCYQ.mjs';
|
|
12
|
+
import './chunk-65SMJBHW.mjs';
|
|
13
|
+
import './chunk-3DPXOZAU.mjs';
|
|
13
14
|
import './chunk-EE6SFAZP.mjs';
|
|
14
15
|
import './chunk-4XPGGLVP.mjs';
|
|
15
16
|
import { useState, useEffect } from 'react';
|