@tagadapay/plugin-sdk 4.0.6 → 4.1.0
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/README.md +25 -46
- package/dist/external-tracker.js +103 -36
- package/dist/external-tracker.min.js +2 -2
- package/dist/external-tracker.min.js.map +3 -3
- package/dist/react/types.d.ts +2 -2
- package/dist/tagada-react-sdk-minimal.min.js +2 -2
- package/dist/tagada-react-sdk-minimal.min.js.map +3 -3
- package/dist/tagada-react-sdk.js +148 -28
- package/dist/tagada-react-sdk.min.js +2 -2
- package/dist/tagada-react-sdk.min.js.map +4 -4
- package/dist/tagada-sdk.js +125 -45
- package/dist/tagada-sdk.min.js +2 -2
- package/dist/tagada-sdk.min.js.map +4 -4
- package/dist/v2/core/funnelClient.js +14 -9
- package/dist/v2/core/pixelMapping.d.ts +84 -0
- package/dist/v2/core/pixelMapping.js +102 -0
- package/dist/v2/core/pixelTracker.d.ts +1 -6
- package/dist/v2/core/pixelTracker.js +36 -2
- package/dist/v2/core/resources/credits.d.ts +13 -0
- package/dist/v2/core/resources/credits.js +7 -0
- package/dist/v2/core/resources/offers.d.ts +5 -1
- package/dist/v2/core/resources/offers.js +3 -2
- package/dist/v2/core/resources/payments.d.ts +1 -0
- package/dist/v2/core/resources/payments.js +1 -0
- package/dist/v2/core/types.d.ts +17 -2
- package/dist/v2/core/utils/authHandoff.d.ts +2 -1
- package/dist/v2/index.d.ts +3 -1
- package/dist/v2/index.js +4 -1
- package/dist/v2/react/components/FunnelScriptInjector.js +42 -7
- package/dist/v2/react/hooks/useAuth.d.ts +1 -0
- package/dist/v2/react/hooks/useAuth.js +1 -0
- package/dist/v2/react/hooks/useClubOffers.d.ts +16 -0
- package/dist/v2/react/hooks/useClubOffers.js +29 -3
- package/dist/v2/react/hooks/useCustomer.d.ts +1 -0
- package/dist/v2/react/hooks/useCustomer.js +1 -0
- package/dist/v2/react/hooks/useStore.d.ts +5 -0
- package/dist/v2/react/hooks/useStore.js +16 -0
- package/dist/v2/react/index.d.ts +1 -0
- package/dist/v2/react/index.js +1 -0
- package/dist/v2/standalone/index.js +134 -46
- package/dist/v2/standalone/payment-service.d.ts +2 -1
- package/dist/v2/standalone/payment-service.js +6 -4
- package/package.json +113 -115
package/README.md
CHANGED
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
A comprehensive React SDK for building plugins on the TagadaPay platform. Create custom checkout experiences, landing pages, and interactive components with automatic configuration injection and advanced routing capabilities.
|
|
4
4
|
|
|
5
|
-
> **🚀 V2
|
|
5
|
+
> **🚀 V2 is the supported surface.** TanStack Query integration, improved TypeScript support, and better performance. [See V2 Architecture](#-v2-architecture) for details.
|
|
6
6
|
>
|
|
7
|
-
> **Recommended**: Use `@tagadapay/plugin-sdk/
|
|
7
|
+
> **Recommended**: Use `@tagadapay/plugin-sdk/v2` for new projects. V1 (`/react`) is still supported for existing projects but no longer receives new features.
|
|
8
8
|
|
|
9
9
|
## 📚 Documentation
|
|
10
10
|
|
|
@@ -25,7 +25,6 @@ A comprehensive React SDK for building plugins on the TagadaPay platform. Create
|
|
|
25
25
|
- **[useCheckout (V1)](./docs/README-useCheckout.md)** - Legacy checkout state management
|
|
26
26
|
- **[setCheckoutInfo](./docs/README-setCheckoutInfo.md)** - Customer information and validation
|
|
27
27
|
- **[useOffers (V1)](./docs/README-useOffers.md)** - Legacy dynamic pricing
|
|
28
|
-
- **[usePromotionCodes](./docs/README-usePromotionCodes.md)** - Legacy promotion code management
|
|
29
28
|
- **[Money utilities](./docs/README-money.md)** - Currency formatting and calculations
|
|
30
29
|
- **[URL utilities](./docs/README-urlUtils.md)** - Navigation and routing helpers
|
|
31
30
|
|
|
@@ -147,7 +146,7 @@ import {
|
|
|
147
146
|
useISOData,
|
|
148
147
|
useCheckout,
|
|
149
148
|
formatMoney,
|
|
150
|
-
} from '@tagadapay/plugin-sdk/
|
|
149
|
+
} from '@tagadapay/plugin-sdk/v2';
|
|
151
150
|
|
|
152
151
|
function MyPlugin() {
|
|
153
152
|
const { config, storeId, accountId, basePath, loading } = usePluginConfig();
|
|
@@ -200,7 +199,7 @@ export default App;
|
|
|
200
199
|
|
|
201
200
|
### What's New in V2
|
|
202
201
|
|
|
203
|
-
The TagadaPay Plugin SDK
|
|
202
|
+
The TagadaPay Plugin SDK V2 introduces a clean architecture with significant improvements:
|
|
204
203
|
|
|
205
204
|
#### **🔄 TanStack Query Integration**
|
|
206
205
|
|
|
@@ -219,7 +218,7 @@ The TagadaPay Plugin SDK v3 introduces a clean architecture with significant imp
|
|
|
219
218
|
|
|
220
219
|
```tsx
|
|
221
220
|
// V2 (Recommended)
|
|
222
|
-
import { useCheckout, useOffers, TagadaProvider } from '@tagadapay/plugin-sdk/
|
|
221
|
+
import { useCheckout, useOffers, TagadaProvider } from '@tagadapay/plugin-sdk/v2';
|
|
223
222
|
|
|
224
223
|
// Legacy (Still supported)
|
|
225
224
|
import { useCheckout, useOffers, TagadaProvider } from '@tagadapay/plugin-sdk/react';
|
|
@@ -258,7 +257,7 @@ import {
|
|
|
258
257
|
useProducts,
|
|
259
258
|
usePluginConfig,
|
|
260
259
|
formatMoney,
|
|
261
|
-
} from '@tagadapay/plugin-sdk/
|
|
260
|
+
} from '@tagadapay/plugin-sdk/v2';
|
|
262
261
|
|
|
263
262
|
function CheckoutPage() {
|
|
264
263
|
const [checkoutToken, setCheckoutToken] = useState<string>();
|
|
@@ -356,7 +355,7 @@ function App() {
|
|
|
356
355
|
|
|
357
356
|
```tsx
|
|
358
357
|
import React from 'react';
|
|
359
|
-
import { TagadaProvider, useCheckout, useOffers, formatMoney } from '@tagadapay/plugin-sdk/
|
|
358
|
+
import { TagadaProvider, useCheckout, useOffers, formatMoney } from '@tagadapay/plugin-sdk/v2';
|
|
360
359
|
|
|
361
360
|
// Component 1: Cart Summary
|
|
362
361
|
function CartSummary({ checkoutToken }: { checkoutToken: string }) {
|
|
@@ -412,7 +411,7 @@ function CheckoutWithOffers() {
|
|
|
412
411
|
|
|
413
412
|
```tsx
|
|
414
413
|
import React from 'react';
|
|
415
|
-
import { useCheckout } from '@tagadapay/plugin-sdk/
|
|
414
|
+
import { useCheckout } from '@tagadapay/plugin-sdk/v2';
|
|
416
415
|
|
|
417
416
|
function QuantitySelector({
|
|
418
417
|
checkoutToken,
|
|
@@ -556,7 +555,7 @@ interface TagadaProviderProps {
|
|
|
556
555
|
#### V2 Enhanced Provider Features
|
|
557
556
|
|
|
558
557
|
```tsx
|
|
559
|
-
import { TagadaProvider } from '@tagadapay/plugin-sdk/
|
|
558
|
+
import { TagadaProvider } from '@tagadapay/plugin-sdk/v2';
|
|
560
559
|
|
|
561
560
|
function App() {
|
|
562
561
|
return (
|
|
@@ -578,7 +577,7 @@ function App() {
|
|
|
578
577
|
}
|
|
579
578
|
```
|
|
580
579
|
|
|
581
|
-
> **Version Compatibility:** V2 features require `@tagadapay/plugin-sdk/
|
|
580
|
+
> **Version Compatibility:** V2 features require `@tagadapay/plugin-sdk/v2`. The `blockUntilSessionReady` option was added in v2.3.0. For older versions, the blocking behavior was the default and only option.
|
|
582
581
|
|
|
583
582
|
### Development vs Production
|
|
584
583
|
|
|
@@ -819,7 +818,7 @@ const {
|
|
|
819
818
|
**Example:**
|
|
820
819
|
|
|
821
820
|
```tsx
|
|
822
|
-
import { useStoreConfig } from '@tagadapay/plugin-sdk/
|
|
821
|
+
import { useStoreConfig } from '@tagadapay/plugin-sdk/v2';
|
|
823
822
|
|
|
824
823
|
function StoreInfo() {
|
|
825
824
|
const { storeConfig, isLoading } = useStoreConfig();
|
|
@@ -898,7 +897,7 @@ import {
|
|
|
898
897
|
useInvalidateQuery,
|
|
899
898
|
usePreloadQuery,
|
|
900
899
|
queryKeys,
|
|
901
|
-
} from '@tagadapay/plugin-sdk/
|
|
900
|
+
} from '@tagadapay/plugin-sdk/v2';
|
|
902
901
|
|
|
903
902
|
// Custom API queries
|
|
904
903
|
const { data, isLoading } = useApiQuery({
|
|
@@ -928,7 +927,7 @@ preloadCheckout({
|
|
|
928
927
|
Enhanced money formatting with better TypeScript support:
|
|
929
928
|
|
|
930
929
|
```typescript
|
|
931
|
-
import { formatMoney, convertCurrency, getCurrencyInfo } from '@tagadapay/plugin-sdk/
|
|
930
|
+
import { formatMoney, convertCurrency, getCurrencyInfo } from '@tagadapay/plugin-sdk/v2';
|
|
932
931
|
|
|
933
932
|
// Format money with automatic currency detection
|
|
934
933
|
const formatted = formatMoney(2999, 'USD'); // "$29.99"
|
|
@@ -957,7 +956,7 @@ import {
|
|
|
957
956
|
ProductsResource,
|
|
958
957
|
PaymentsResource,
|
|
959
958
|
PluginConfigUtils,
|
|
960
|
-
} from '@tagadapay/plugin-sdk/
|
|
959
|
+
} from '@tagadapay/plugin-sdk/v2';
|
|
961
960
|
|
|
962
961
|
// Use core functions directly (useful for server-side or non-React contexts)
|
|
963
962
|
const checkoutResource = new CheckoutResource(apiClient);
|
|
@@ -973,7 +972,7 @@ const isValid = PluginConfigUtils.validateConfig(config);
|
|
|
973
972
|
V2 includes built-in debugging tools:
|
|
974
973
|
|
|
975
974
|
```tsx
|
|
976
|
-
import { TagadaProvider } from '@tagadapay/plugin-sdk/
|
|
975
|
+
import { TagadaProvider } from '@tagadapay/plugin-sdk/v2';
|
|
977
976
|
|
|
978
977
|
function App() {
|
|
979
978
|
return (
|
|
@@ -1120,7 +1119,7 @@ const handleTouchStart = (e) => {
|
|
|
1120
1119
|
### Multi-language Support
|
|
1121
1120
|
|
|
1122
1121
|
```typescript
|
|
1123
|
-
import { useTranslation } from '@tagadapay/plugin-sdk';
|
|
1122
|
+
import { useTranslation } from '@tagadapay/plugin-sdk/v2';
|
|
1124
1123
|
|
|
1125
1124
|
function CheckoutForm() {
|
|
1126
1125
|
const { t } = useTranslation();
|
|
@@ -1137,7 +1136,7 @@ function CheckoutForm() {
|
|
|
1137
1136
|
### Currency Support
|
|
1138
1137
|
|
|
1139
1138
|
```typescript
|
|
1140
|
-
import { useCurrency } from '@tagadapay/plugin-sdk';
|
|
1139
|
+
import { useCurrency } from '@tagadapay/plugin-sdk/v2';
|
|
1141
1140
|
|
|
1142
1141
|
function PriceDisplay({ amount }) {
|
|
1143
1142
|
const { formatPrice, currency } = useCurrency();
|
|
@@ -1146,39 +1145,19 @@ function PriceDisplay({ amount }) {
|
|
|
1146
1145
|
}
|
|
1147
1146
|
```
|
|
1148
1147
|
|
|
1149
|
-
## 📊 Analytics &
|
|
1148
|
+
## 📊 Analytics & Tracking
|
|
1150
1149
|
|
|
1151
|
-
|
|
1150
|
+
Pixel tracking (Facebook, TikTok, Snapchat, GTM) is configured per-step in
|
|
1151
|
+
the CRM step editor and auto-bootstrapped at runtime — no plugin code is
|
|
1152
|
+
required. For external (non-Tagadapay-hosted) pages, the lightweight
|
|
1153
|
+
external tracker is available:
|
|
1152
1154
|
|
|
1153
1155
|
```typescript
|
|
1154
|
-
import {
|
|
1155
|
-
|
|
1156
|
-
// Track user interactions
|
|
1157
|
-
trackEvent('checkout_started', {
|
|
1158
|
-
product_id: 'prod_123',
|
|
1159
|
-
value: 2999,
|
|
1160
|
-
currency: 'USD',
|
|
1161
|
-
});
|
|
1162
|
-
|
|
1163
|
-
// Track conversions
|
|
1164
|
-
trackEvent('purchase_completed', {
|
|
1165
|
-
transaction_id: 'txn_456',
|
|
1166
|
-
value: 2999,
|
|
1167
|
-
currency: 'USD',
|
|
1168
|
-
});
|
|
1156
|
+
import { TagadaExternalTracker } from '@tagadapay/plugin-sdk/external-tracker';
|
|
1169
1157
|
```
|
|
1170
1158
|
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
```typescript
|
|
1174
|
-
import { performance } from '@tagadapay/plugin-sdk';
|
|
1175
|
-
|
|
1176
|
-
// Measure load times
|
|
1177
|
-
performance.mark('checkout-start');
|
|
1178
|
-
// ... checkout logic
|
|
1179
|
-
performance.mark('checkout-end');
|
|
1180
|
-
performance.measure('checkout-duration', 'checkout-start', 'checkout-end');
|
|
1181
|
-
```
|
|
1159
|
+
See [External Page Tracker docs](../../mintlify/developer-tools/web-integration/external-page-tracker.mdx)
|
|
1160
|
+
for the full integration guide.
|
|
1182
1161
|
|
|
1183
1162
|
## 🤝 Contributing
|
|
1184
1163
|
|
package/dist/external-tracker.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* TagadaPay External Tracker v4.0
|
|
2
|
+
* TagadaPay External Tracker v4.1.0
|
|
3
3
|
* CDN Bundle - Standalone tracking for external pages (Debug Build)
|
|
4
4
|
* @license MIT
|
|
5
5
|
*/
|
|
@@ -1144,13 +1144,17 @@ var TagadaTrackerBundle = (() => {
|
|
|
1144
1144
|
}
|
|
1145
1145
|
return scripts.length > 0 ? scripts : void 0;
|
|
1146
1146
|
}
|
|
1147
|
+
function splitIds(rawId) {
|
|
1148
|
+
if (!rawId) return [];
|
|
1149
|
+
return rawId.split(/[;,]/).map((id) => id.trim()).filter((id) => id.length > 0);
|
|
1150
|
+
}
|
|
1147
1151
|
function splitPixelConfig(px) {
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
return ids.map((id) => __spreadProps(__spreadValues({}, px), {
|
|
1152
|
+
if ("containerId" in px) {
|
|
1153
|
+
const ids2 = splitIds(px.containerId);
|
|
1154
|
+
return ids2.length === 0 ? [px] : ids2.map((id) => __spreadProps(__spreadValues({}, px), { containerId: id }));
|
|
1155
|
+
}
|
|
1156
|
+
const ids = splitIds(px.pixelId);
|
|
1157
|
+
return ids.length === 0 ? [px] : ids.map((id) => __spreadProps(__spreadValues({}, px), { pixelId: id }));
|
|
1154
1158
|
}
|
|
1155
1159
|
function getAssignedPixels() {
|
|
1156
1160
|
const stepConfig = getAssignedStepConfig();
|
|
@@ -3572,48 +3576,111 @@ var TagadaTrackerBundle = (() => {
|
|
|
3572
3576
|
}
|
|
3573
3577
|
return [];
|
|
3574
3578
|
}
|
|
3575
|
-
function
|
|
3576
|
-
|
|
3577
|
-
const
|
|
3578
|
-
|
|
3579
|
-
|
|
3579
|
+
function classifyLooseChunk(chunk) {
|
|
3580
|
+
if (!chunk || /^<!--[\s\S]*?-->$/.test(chunk)) return null;
|
|
3581
|
+
const looksLikeMarkup = /^</.test(chunk) || /<\/?[a-zA-Z][\w-]*[\s/>]/.test(chunk);
|
|
3582
|
+
return looksLikeMarkup ? { type: "html", html: chunk } : { type: "inline", code: chunk };
|
|
3583
|
+
}
|
|
3584
|
+
function parseScriptContent(content) {
|
|
3585
|
+
const trimmed = content.trim();
|
|
3586
|
+
if (!/<(?:script|noscript)[\s>]/i.test(trimmed)) {
|
|
3587
|
+
return trimmed ? [{ type: "inline", code: trimmed }] : [];
|
|
3588
|
+
}
|
|
3589
|
+
const elements = [];
|
|
3590
|
+
const tagRegex = /<(script|noscript)([^>]*)>([\s\S]*?)<\/\1>/gi;
|
|
3591
|
+
let lastIndex = 0;
|
|
3592
|
+
let match2;
|
|
3593
|
+
while ((match2 = tagRegex.exec(trimmed)) !== null) {
|
|
3594
|
+
const between = classifyLooseChunk(trimmed.slice(lastIndex, match2.index).trim());
|
|
3595
|
+
if (between) elements.push(between);
|
|
3596
|
+
const [, tagName, attrs, body] = match2;
|
|
3597
|
+
if (tagName.toLowerCase() === "noscript") {
|
|
3598
|
+
if (body.trim()) elements.push({ type: "noscript", html: body.trim() });
|
|
3599
|
+
} else {
|
|
3600
|
+
const srcMatch = attrs.match(/src=["']([^"']+)["']/i);
|
|
3601
|
+
if (srcMatch) {
|
|
3602
|
+
elements.push({
|
|
3603
|
+
type: "external",
|
|
3604
|
+
src: srcMatch[1],
|
|
3605
|
+
async: /\basync\b/i.test(attrs),
|
|
3606
|
+
defer: /\bdefer\b/i.test(attrs)
|
|
3607
|
+
});
|
|
3608
|
+
}
|
|
3609
|
+
if (body.trim()) elements.push({ type: "inline", code: body.trim() });
|
|
3610
|
+
}
|
|
3611
|
+
lastIndex = match2.index + match2[0].length;
|
|
3580
3612
|
}
|
|
3581
|
-
|
|
3582
|
-
|
|
3583
|
-
|
|
3584
|
-
|
|
3585
|
-
|
|
3586
|
-
if (!scriptBody) return;
|
|
3587
|
-
const wrappedScript = "(function() {\n try {\n // Script: " + script.name + "\n" + scriptBody + '\n } catch (error) {\n console.error("[TagadaPay] StepConfig script error:", error);\n }\n})();';
|
|
3588
|
-
const scriptElement = document.createElement("script");
|
|
3589
|
-
scriptElement.id = scriptId;
|
|
3590
|
-
scriptElement.setAttribute("data-tagada-stepconfig-script", "true");
|
|
3591
|
-
scriptElement.setAttribute("data-script-name", script.name);
|
|
3592
|
-
scriptElement.textContent = wrappedScript;
|
|
3613
|
+
const trailing = classifyLooseChunk(trimmed.slice(lastIndex).trim());
|
|
3614
|
+
if (trailing) elements.push(trailing);
|
|
3615
|
+
return elements;
|
|
3616
|
+
}
|
|
3617
|
+
function injectAtPosition(element, position) {
|
|
3593
3618
|
switch (position) {
|
|
3594
3619
|
case "head-start":
|
|
3595
|
-
if (document.head.firstChild)
|
|
3596
|
-
|
|
3597
|
-
} else {
|
|
3598
|
-
document.head.appendChild(scriptElement);
|
|
3599
|
-
}
|
|
3620
|
+
if (document.head.firstChild) document.head.insertBefore(element, document.head.firstChild);
|
|
3621
|
+
else document.head.appendChild(element);
|
|
3600
3622
|
break;
|
|
3601
3623
|
case "head-end":
|
|
3602
|
-
document.head.appendChild(
|
|
3624
|
+
document.head.appendChild(element);
|
|
3603
3625
|
break;
|
|
3604
3626
|
case "body-start":
|
|
3605
|
-
if (document.body.firstChild)
|
|
3606
|
-
|
|
3607
|
-
} else {
|
|
3608
|
-
document.body.appendChild(scriptElement);
|
|
3609
|
-
}
|
|
3627
|
+
if (document.body.firstChild) document.body.insertBefore(element, document.body.firstChild);
|
|
3628
|
+
else document.body.appendChild(element);
|
|
3610
3629
|
break;
|
|
3611
3630
|
case "body-end":
|
|
3612
3631
|
default:
|
|
3613
|
-
document.body.appendChild(
|
|
3632
|
+
document.body.appendChild(element);
|
|
3614
3633
|
break;
|
|
3615
3634
|
}
|
|
3616
3635
|
}
|
|
3636
|
+
function injectScript(script, index) {
|
|
3637
|
+
const position = script.position || "body-end";
|
|
3638
|
+
const content = script.content.trim();
|
|
3639
|
+
if (!content) return;
|
|
3640
|
+
if (document.querySelector('[data-tagada-stepconfig-index="'.concat(index, '"]'))) {
|
|
3641
|
+
return;
|
|
3642
|
+
}
|
|
3643
|
+
parseScriptContent(content).forEach((element, elemIndex) => {
|
|
3644
|
+
const elemId = "tagada-stepconfig-script-".concat(index, "-").concat(elemIndex);
|
|
3645
|
+
if (element.type === "external") {
|
|
3646
|
+
const el = document.createElement("script");
|
|
3647
|
+
el.id = elemId;
|
|
3648
|
+
el.setAttribute("data-tagada-stepconfig-script", "true");
|
|
3649
|
+
el.setAttribute("data-tagada-stepconfig-index", String(index));
|
|
3650
|
+
el.setAttribute("data-script-name", script.name);
|
|
3651
|
+
el.src = element.src;
|
|
3652
|
+
if (element.async) el.async = true;
|
|
3653
|
+
if (element.defer) el.defer = true;
|
|
3654
|
+
injectAtPosition(el, position);
|
|
3655
|
+
} else if (element.type === "inline") {
|
|
3656
|
+
const el = document.createElement("script");
|
|
3657
|
+
el.id = elemId;
|
|
3658
|
+
el.setAttribute("data-tagada-stepconfig-script", "true");
|
|
3659
|
+
el.setAttribute("data-tagada-stepconfig-index", String(index));
|
|
3660
|
+
el.setAttribute("data-script-name", script.name);
|
|
3661
|
+
el.textContent = "(function() {\n try {\n // Script: " + script.name + "\n" + element.code + '\n } catch (error) {\n console.error("[TagadaPay] StepConfig script error:", error);\n }\n})();';
|
|
3662
|
+
injectAtPosition(el, position);
|
|
3663
|
+
} else if (element.type === "noscript") {
|
|
3664
|
+
const el = document.createElement("noscript");
|
|
3665
|
+
el.id = elemId;
|
|
3666
|
+
el.setAttribute("data-tagada-stepconfig-script", "true");
|
|
3667
|
+
el.setAttribute("data-tagada-stepconfig-index", String(index));
|
|
3668
|
+
el.innerHTML = element.html;
|
|
3669
|
+
injectAtPosition(el, position);
|
|
3670
|
+
} else if (element.type === "html") {
|
|
3671
|
+
const template = document.createElement("template");
|
|
3672
|
+
template.innerHTML = element.html;
|
|
3673
|
+
Array.from(template.content.childNodes).forEach((node) => {
|
|
3674
|
+
if (node.nodeType !== 1) return;
|
|
3675
|
+
const el = node;
|
|
3676
|
+
el.setAttribute("data-tagada-stepconfig-script", "true");
|
|
3677
|
+
el.setAttribute("data-tagada-stepconfig-index", String(index));
|
|
3678
|
+
el.setAttribute("data-script-name", script.name);
|
|
3679
|
+
injectAtPosition(el, position);
|
|
3680
|
+
});
|
|
3681
|
+
}
|
|
3682
|
+
});
|
|
3683
|
+
}
|
|
3617
3684
|
function injectStepConfigScripts() {
|
|
3618
3685
|
const scripts = parseStepConfigScripts();
|
|
3619
3686
|
if (scripts.length === 0) return;
|