@funnelsgrove/runtime 0.1.6 → 0.1.7

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.
@@ -194,7 +194,7 @@ export const collectCurrentFunnelAttribution = (input = {}) => {
194
194
  language,
195
195
  platform,
196
196
  vendor,
197
- timeZone, deviceType: resolveDeviceType(userAgent), osFamily: resolveOsFamily(userAgent) }, posthogContext)),
197
+ timeZone, capturedAt: new Date().toISOString(), deviceType: resolveDeviceType(userAgent), osFamily: resolveOsFamily(userAgent) }, posthogContext)),
198
198
  };
199
199
  };
200
200
  export const mergeFunnelUserAttribution = (current, incoming) => {
@@ -64,6 +64,8 @@ export declare const RUNTIME_PUBLIC_DEFAULTS: {
64
64
  export declare const RUNTIME_PREVIEW_PAYMENT_DEFAULTS: {
65
65
  readonly funnelSdkPublishableKey: "pk_test_51SopXWPEfkEVo5kh6foOs9zVyKsVSKLhlQw8YsAfMMymRlGH3Qp8U5I7j5bHivmOB232oJiQZi8cEv1wkmV80QGg00vPcI1DZI";
66
66
  };
67
+ export type RuntimeStaticExportEnv = Record<string, string | undefined>;
68
+ export declare const resolveNextStaticExportRuntimeEnv: (env: RuntimeStaticExportEnv) => Record<string, string>;
67
69
  export declare const isSeedFunnelSdkPublishableKey: (value: string | null | undefined) => boolean;
68
70
  export declare const isPreviewPaymentPublishableKey: (value: string | null | undefined) => boolean;
69
71
  export declare const resolvePreviewPaymentPublishableKey: (value: string | null | undefined) => string;
@@ -89,6 +89,91 @@ export const RUNTIME_PUBLIC_DEFAULTS = {
89
89
  export const RUNTIME_PREVIEW_PAYMENT_DEFAULTS = {
90
90
  funnelSdkPublishableKey: DEFAULT_PREVIEW_PAYMENT_PUBLISHABLE_KEY,
91
91
  };
92
+ const NEXT_STATIC_EXPORT_RUNTIME_PUBLIC_KEYS = [
93
+ {
94
+ outputKey: 'NEXT_PUBLIC_APP_DEALS_API_BASE_URL',
95
+ inputKeys: ['NEXT_PUBLIC_APP_DEALS_API_BASE_URL'],
96
+ },
97
+ {
98
+ outputKey: 'NEXT_PUBLIC_FUNNEL_PUBLISHABLE_KEY',
99
+ inputKeys: [
100
+ 'NEXT_PUBLIC_FUNNEL_PUBLISHABLE_KEY',
101
+ 'NEXT_PUBLIC_FUNNEL_SDK_PUBLISHABLE_KEY',
102
+ ],
103
+ },
104
+ { outputKey: 'NEXT_PUBLIC_FUNNEL_ID', inputKeys: ['NEXT_PUBLIC_FUNNEL_ID'] },
105
+ { outputKey: 'NEXT_PUBLIC_FUNNEL_VERSION_ID', inputKeys: ['NEXT_PUBLIC_FUNNEL_VERSION_ID'] },
106
+ { outputKey: 'NEXT_PUBLIC_PROJECT_ID', inputKeys: ['NEXT_PUBLIC_PROJECT_ID'] },
107
+ {
108
+ outputKey: 'NEXT_PUBLIC_POSTHOG_PROJECT_API_KEY',
109
+ inputKeys: ['NEXT_PUBLIC_POSTHOG_PROJECT_API_KEY'],
110
+ },
111
+ { outputKey: 'NEXT_PUBLIC_FUNNEL_SUPPORT_EMAIL', inputKeys: ['NEXT_PUBLIC_FUNNEL_SUPPORT_EMAIL'] },
112
+ { outputKey: 'NEXT_PUBLIC_IOS_APP_STORE_URL', inputKeys: ['NEXT_PUBLIC_IOS_APP_STORE_URL'] },
113
+ { outputKey: 'NEXT_PUBLIC_ANDROID_PLAY_STORE_URL', inputKeys: ['NEXT_PUBLIC_ANDROID_PLAY_STORE_URL'] },
114
+ { outputKey: 'NEXT_PUBLIC_FUNNEL_APP_STORE_ID', inputKeys: ['NEXT_PUBLIC_FUNNEL_APP_STORE_ID'] },
115
+ { outputKey: 'NEXT_PUBLIC_FUNNEL_GOOGLE_STORE_ID', inputKeys: ['NEXT_PUBLIC_FUNNEL_GOOGLE_STORE_ID'] },
116
+ { outputKey: 'NEXT_PUBLIC_FUNNEL_TIMEZONE', inputKeys: ['NEXT_PUBLIC_FUNNEL_TIMEZONE'] },
117
+ { outputKey: 'NEXT_PUBLIC_FUNNEL_FAVICON_URL', inputKeys: ['NEXT_PUBLIC_FUNNEL_FAVICON_URL'] },
118
+ { outputKey: 'NEXT_PUBLIC_FUNNEL_PAGE_TITLE', inputKeys: ['NEXT_PUBLIC_FUNNEL_PAGE_TITLE'] },
119
+ {
120
+ outputKey: 'NEXT_PUBLIC_FUNNEL_PAGE_DESCRIPTION',
121
+ inputKeys: ['NEXT_PUBLIC_FUNNEL_PAGE_DESCRIPTION'],
122
+ },
123
+ {
124
+ outputKey: 'NEXT_PUBLIC_FUNNEL_PAGE_PREVIEW_IMAGE_URL',
125
+ inputKeys: ['NEXT_PUBLIC_FUNNEL_PAGE_PREVIEW_IMAGE_URL'],
126
+ },
127
+ { outputKey: 'NEXT_PUBLIC_FUNNEL_COMPANY_NAME', inputKeys: ['NEXT_PUBLIC_FUNNEL_COMPANY_NAME'] },
128
+ {
129
+ outputKey: 'NEXT_PUBLIC_FUNNEL_COMPANY_ADDRESS',
130
+ inputKeys: ['NEXT_PUBLIC_FUNNEL_COMPANY_ADDRESS'],
131
+ },
132
+ {
133
+ outputKey: 'NEXT_PUBLIC_FUNNEL_COMPANY_COUNTRY',
134
+ inputKeys: ['NEXT_PUBLIC_FUNNEL_COMPANY_COUNTRY'],
135
+ },
136
+ { outputKey: 'NEXT_PUBLIC_FUNNEL_PRIVACY_URL', inputKeys: ['NEXT_PUBLIC_FUNNEL_PRIVACY_URL'] },
137
+ { outputKey: 'NEXT_PUBLIC_FUNNEL_TERMS_URL', inputKeys: ['NEXT_PUBLIC_FUNNEL_TERMS_URL'] },
138
+ {
139
+ outputKey: 'NEXT_PUBLIC_FUNNEL_UNIVERSAL_LINK',
140
+ inputKeys: ['NEXT_PUBLIC_FUNNEL_UNIVERSAL_LINK'],
141
+ },
142
+ { outputKey: 'NEXT_PUBLIC_FUNNEL_IOS_DEEP_LINK', inputKeys: ['NEXT_PUBLIC_FUNNEL_IOS_DEEP_LINK'] },
143
+ {
144
+ outputKey: 'NEXT_PUBLIC_FUNNEL_ANDROID_DEEP_LINK',
145
+ inputKeys: ['NEXT_PUBLIC_FUNNEL_ANDROID_DEEP_LINK'],
146
+ },
147
+ { outputKey: 'NEXT_PUBLIC_FUNNEL_QR_TARGET', inputKeys: ['NEXT_PUBLIC_FUNNEL_QR_TARGET'] },
148
+ { outputKey: 'NEXT_PUBLIC_META_PIXEL_ENABLED', inputKeys: ['NEXT_PUBLIC_META_PIXEL_ENABLED'] },
149
+ { outputKey: 'NEXT_PUBLIC_META_PIXEL_ID', inputKeys: ['NEXT_PUBLIC_META_PIXEL_ID'] },
150
+ ];
151
+ const readNonEmptyStaticExportEnv = (env, keys) => {
152
+ var _a;
153
+ for (const key of keys) {
154
+ const value = ((_a = env[key]) === null || _a === void 0 ? void 0 : _a.trim()) || '';
155
+ if (value) {
156
+ return value;
157
+ }
158
+ }
159
+ return null;
160
+ };
161
+ export const resolveNextStaticExportRuntimeEnv = (env) => {
162
+ var _a, _b;
163
+ if (env.NEXT_EXPORT !== '1') {
164
+ return {};
165
+ }
166
+ if ((_a = env.NEXT_PUBLIC_PROJECT_ID) === null || _a === void 0 ? void 0 : _a.trim()) {
167
+ return Object.fromEntries(NEXT_STATIC_EXPORT_RUNTIME_PUBLIC_KEYS.flatMap(({ outputKey, inputKeys }) => {
168
+ const value = readNonEmptyStaticExportEnv(env, inputKeys);
169
+ return value ? [[outputKey, value]] : [];
170
+ }));
171
+ }
172
+ return {
173
+ NEXT_PUBLIC_FUNNEL_PUBLISHABLE_KEY: DEFAULT_PREVIEW_PAYMENT_PUBLISHABLE_KEY,
174
+ NEXT_PUBLIC_FUNNEL_ID: ((_b = env.NEXT_PUBLIC_RAG_FUNNEL_ID) === null || _b === void 0 ? void 0 : _b.trim()) || '',
175
+ };
176
+ };
92
177
  export const isSeedFunnelSdkPublishableKey = (value) => {
93
178
  const normalized = (value === null || value === void 0 ? void 0 : value.trim()) || '';
94
179
  return !normalized || normalized === DEFAULT_FUNNEL_SDK_PUBLISHABLE_KEY;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@funnelsgrove/runtime",
3
- "version": "0.1.6",
3
+ "version": "0.1.7",
4
4
  "type": "module",
5
5
  "private": false,
6
6
  "main": "./dist/index.js",