@teleporthq/teleport-plugin-next-workflows 0.43.65 → 0.43.67
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/__tests__/_helpers/bind-workflow-utils.ts +30 -0
- package/__tests__/_helpers/run-generated-middleware.ts +11 -2
- package/__tests__/admin-form-row-hydration.test.ts +55 -0
- package/__tests__/cart-clear-db-mirror.test.ts +12 -0
- package/__tests__/cart-get-total-regional-pricing.test.ts +166 -0
- package/__tests__/client-config-redaction.test.ts +53 -0
- package/__tests__/continue-on-error.test.ts +119 -0
- package/__tests__/email-locale-module.test.ts +323 -0
- package/__tests__/email-locale-senders.test.ts +268 -0
- package/__tests__/invoice-delivery-fee.test.ts +104 -0
- package/__tests__/invoice-regional-tax.test.ts +126 -0
- package/__tests__/locale-aware-redirects.test.ts +355 -0
- package/__tests__/navigation-go-to-page.test.ts +43 -0
- package/__tests__/node-handler-file-inline-map.test.ts +29 -3
- package/__tests__/payment-redirect-and-order-notification.test.ts +6 -0
- package/__tests__/paypal-webhook-order-notification.test.ts +41 -0
- package/__tests__/resolve-config-localized-templates.test.ts +262 -0
- package/__tests__/sent-email-log-module.test.ts +381 -0
- package/__tests__/sent-email-log-wiring.test.ts +267 -0
- package/dist/cjs/account-delete-route-generator.d.ts +20 -0
- package/dist/cjs/account-delete-route-generator.d.ts.map +1 -1
- package/dist/cjs/account-delete-route-generator.js +29 -26
- package/dist/cjs/account-delete-route-generator.js.map +1 -1
- package/dist/cjs/api-route-generator.d.ts.map +1 -1
- package/dist/cjs/api-route-generator.js +57 -11
- package/dist/cjs/api-route-generator.js.map +1 -1
- package/dist/cjs/auth-generator.d.ts +2 -1
- package/dist/cjs/auth-generator.d.ts.map +1 -1
- package/dist/cjs/auth-generator.js +55 -18
- package/dist/cjs/auth-generator.js.map +1 -1
- package/dist/cjs/data-api-route-generator.d.ts.map +1 -1
- package/dist/cjs/data-api-route-generator.js +19 -0
- package/dist/cjs/data-api-route-generator.js.map +1 -1
- package/dist/cjs/email-locale/email-locale-code.d.ts +25 -0
- package/dist/cjs/email-locale/email-locale-code.d.ts.map +1 -0
- package/dist/cjs/email-locale/email-locale-code.js +228 -0
- package/dist/cjs/email-locale/email-locale-code.js.map +1 -0
- package/dist/cjs/email-locale/email-locale-scope.d.ts +46 -0
- package/dist/cjs/email-locale/email-locale-scope.d.ts.map +1 -0
- package/dist/cjs/email-locale/email-locale-scope.js +51 -0
- package/dist/cjs/email-locale/email-locale-scope.js.map +1 -0
- package/dist/cjs/email-locale/index.d.ts +11 -0
- package/dist/cjs/email-locale/index.d.ts.map +1 -0
- package/dist/cjs/email-locale/index.js +40 -0
- package/dist/cjs/email-locale/index.js.map +1 -0
- package/dist/cjs/executor-generator.d.ts +11 -1
- package/dist/cjs/executor-generator.d.ts.map +1 -1
- package/dist/cjs/executor-generator.js +49 -7
- package/dist/cjs/executor-generator.js.map +1 -1
- package/dist/cjs/index.d.ts +2 -0
- package/dist/cjs/index.d.ts.map +1 -1
- package/dist/cjs/index.js +9 -1
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/invoice/api-routes-code.d.ts.map +1 -1
- package/dist/cjs/invoice/api-routes-code.js +55 -6
- package/dist/cjs/invoice/api-routes-code.js.map +1 -1
- package/dist/cjs/invoice/email-sender-code.d.ts.map +1 -1
- package/dist/cjs/invoice/email-sender-code.js +72 -31
- package/dist/cjs/invoice/email-sender-code.js.map +1 -1
- package/dist/cjs/invoice/index.d.ts +1 -4
- package/dist/cjs/invoice/index.d.ts.map +1 -1
- package/dist/cjs/invoice/index.js +8 -19
- package/dist/cjs/invoice/index.js.map +1 -1
- package/dist/cjs/invoice/invoice-html-code.d.ts.map +1 -1
- package/dist/cjs/invoice/invoice-html-code.js +31 -8
- package/dist/cjs/invoice/invoice-html-code.js.map +1 -1
- package/dist/cjs/invoice/regional-invoice-tax-code.d.ts +25 -0
- package/dist/cjs/invoice/regional-invoice-tax-code.d.ts.map +1 -0
- package/dist/cjs/invoice/regional-invoice-tax-code.js +116 -0
- package/dist/cjs/invoice/regional-invoice-tax-code.js.map +1 -0
- package/dist/cjs/invoice/resolve-data-source.d.ts +6 -0
- package/dist/cjs/invoice/resolve-data-source.d.ts.map +1 -0
- package/dist/cjs/invoice/resolve-data-source.js +23 -0
- package/dist/cjs/invoice/resolve-data-source.js.map +1 -0
- package/dist/cjs/nodes/account/account-delete-current.d.ts.map +1 -1
- package/dist/cjs/nodes/account/account-delete-current.js +10 -3
- package/dist/cjs/nodes/account/account-delete-current.js.map +1 -1
- package/dist/cjs/nodes/account/account-login.d.ts.map +1 -1
- package/dist/cjs/nodes/account/account-login.js +3 -1
- package/dist/cjs/nodes/account/account-login.js.map +1 -1
- package/dist/cjs/nodes/account/account-logout.d.ts.map +1 -1
- package/dist/cjs/nodes/account/account-logout.js +4 -2
- package/dist/cjs/nodes/account/account-logout.js.map +1 -1
- package/dist/cjs/nodes/account/account-signup.d.ts.map +1 -1
- package/dist/cjs/nodes/account/account-signup.js +12 -2
- package/dist/cjs/nodes/account/account-signup.js.map +1 -1
- package/dist/cjs/nodes/account/account-social-login.d.ts.map +1 -1
- package/dist/cjs/nodes/account/account-social-login.js +4 -2
- package/dist/cjs/nodes/account/account-social-login.js.map +1 -1
- package/dist/cjs/nodes/cart/cart-clear.d.ts.map +1 -1
- package/dist/cjs/nodes/cart/cart-clear.js +6 -0
- package/dist/cjs/nodes/cart/cart-clear.js.map +1 -1
- package/dist/cjs/nodes/cart/cart-get-total.d.ts.map +1 -1
- package/dist/cjs/nodes/cart/cart-get-total.js +81 -5
- package/dist/cjs/nodes/cart/cart-get-total.js.map +1 -1
- package/dist/cjs/nodes/data/data-create-item.d.ts.map +1 -1
- package/dist/cjs/nodes/data/data-create-item.js +16 -0
- package/dist/cjs/nodes/data/data-create-item.js.map +1 -1
- package/dist/cjs/nodes/ecommerce/ecommerce-generate-invoice.d.ts.map +1 -1
- package/dist/cjs/nodes/ecommerce/ecommerce-generate-invoice.js +6 -0
- package/dist/cjs/nodes/ecommerce/ecommerce-generate-invoice.js.map +1 -1
- package/dist/cjs/nodes/navigation/navigation-go-to-page.d.ts.map +1 -1
- package/dist/cjs/nodes/navigation/navigation-go-to-page.js +4 -1
- package/dist/cjs/nodes/navigation/navigation-go-to-page.js.map +1 -1
- package/dist/cjs/nodes/navigation/navigation-navigate-to-url.d.ts.map +1 -1
- package/dist/cjs/nodes/navigation/navigation-navigate-to-url.js +5 -2
- package/dist/cjs/nodes/navigation/navigation-navigate-to-url.js.map +1 -1
- package/dist/cjs/nodes/payment/payment-charge-user.d.ts.map +1 -1
- package/dist/cjs/nodes/payment/payment-charge-user.js +7 -2
- package/dist/cjs/nodes/payment/payment-charge-user.js.map +1 -1
- package/dist/cjs/segment-splitter.d.ts +1 -1
- package/dist/cjs/segment-splitter.d.ts.map +1 -1
- package/dist/cjs/segment-splitter.js +29 -2
- package/dist/cjs/segment-splitter.js.map +1 -1
- package/dist/cjs/sent-email-log/index.d.ts +16 -0
- package/dist/cjs/sent-email-log/index.d.ts.map +1 -0
- package/dist/cjs/sent-email-log/index.js +53 -0
- package/dist/cjs/sent-email-log/index.js.map +1 -0
- package/dist/cjs/sent-email-log/sent-email-log-code.d.ts +4 -0
- package/dist/cjs/sent-email-log/sent-email-log-code.d.ts.map +1 -0
- package/dist/cjs/sent-email-log/sent-email-log-code.js +415 -0
- package/dist/cjs/sent-email-log/sent-email-log-code.js.map +1 -0
- package/dist/cjs/sent-email-log/sent-email-log-scope.d.ts +21 -0
- package/dist/cjs/sent-email-log/sent-email-log-scope.d.ts.map +1 -0
- package/dist/cjs/sent-email-log/sent-email-log-scope.js +36 -0
- package/dist/cjs/sent-email-log/sent-email-log-scope.js.map +1 -0
- package/dist/cjs/transactional-email-code.d.ts +39 -1
- package/dist/cjs/transactional-email-code.d.ts.map +1 -1
- package/dist/cjs/transactional-email-code.js +86 -12
- package/dist/cjs/transactional-email-code.js.map +1 -1
- package/dist/cjs/tsconfig.tsbuildinfo +1 -1
- package/dist/cjs/webhook-generator.d.ts.map +1 -1
- package/dist/cjs/webhook-generator.js +9 -2
- package/dist/cjs/webhook-generator.js.map +1 -1
- package/dist/cjs/workflow-component-plugin.js +4 -3
- package/dist/cjs/workflow-component-plugin.js.map +1 -1
- package/dist/cjs/workflow-project-plugin.d.ts.map +1 -1
- package/dist/cjs/workflow-project-plugin.js +31 -3
- package/dist/cjs/workflow-project-plugin.js.map +1 -1
- package/dist/cjs/workflow-utils-alias.d.ts +21 -0
- package/dist/cjs/workflow-utils-alias.d.ts.map +1 -0
- package/dist/cjs/workflow-utils-alias.js +27 -0
- package/dist/cjs/workflow-utils-alias.js.map +1 -0
- package/dist/esm/account-delete-route-generator.d.ts +20 -0
- package/dist/esm/account-delete-route-generator.d.ts.map +1 -1
- package/dist/esm/account-delete-route-generator.js +30 -27
- package/dist/esm/account-delete-route-generator.js.map +1 -1
- package/dist/esm/api-route-generator.d.ts.map +1 -1
- package/dist/esm/api-route-generator.js +57 -11
- package/dist/esm/api-route-generator.js.map +1 -1
- package/dist/esm/auth-generator.d.ts +2 -1
- package/dist/esm/auth-generator.d.ts.map +1 -1
- package/dist/esm/auth-generator.js +56 -19
- package/dist/esm/auth-generator.js.map +1 -1
- package/dist/esm/data-api-route-generator.d.ts.map +1 -1
- package/dist/esm/data-api-route-generator.js +19 -0
- package/dist/esm/data-api-route-generator.js.map +1 -1
- package/dist/esm/email-locale/email-locale-code.d.ts +25 -0
- package/dist/esm/email-locale/email-locale-code.d.ts.map +1 -0
- package/dist/esm/email-locale/email-locale-code.js +222 -0
- package/dist/esm/email-locale/email-locale-code.js.map +1 -0
- package/dist/esm/email-locale/email-locale-scope.d.ts +46 -0
- package/dist/esm/email-locale/email-locale-scope.d.ts.map +1 -0
- package/dist/esm/email-locale/email-locale-scope.js +47 -0
- package/dist/esm/email-locale/email-locale-scope.js.map +1 -0
- package/dist/esm/email-locale/index.d.ts +11 -0
- package/dist/esm/email-locale/index.d.ts.map +1 -0
- package/dist/esm/email-locale/index.js +28 -0
- package/dist/esm/email-locale/index.js.map +1 -0
- package/dist/esm/executor-generator.d.ts +11 -1
- package/dist/esm/executor-generator.d.ts.map +1 -1
- package/dist/esm/executor-generator.js +49 -7
- package/dist/esm/executor-generator.js.map +1 -1
- package/dist/esm/index.d.ts +2 -0
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/index.js +2 -0
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/invoice/api-routes-code.d.ts.map +1 -1
- package/dist/esm/invoice/api-routes-code.js +55 -6
- package/dist/esm/invoice/api-routes-code.js.map +1 -1
- package/dist/esm/invoice/email-sender-code.d.ts.map +1 -1
- package/dist/esm/invoice/email-sender-code.js +72 -31
- package/dist/esm/invoice/email-sender-code.js.map +1 -1
- package/dist/esm/invoice/index.d.ts +1 -4
- package/dist/esm/invoice/index.d.ts.map +1 -1
- package/dist/esm/invoice/index.js +7 -18
- package/dist/esm/invoice/index.js.map +1 -1
- package/dist/esm/invoice/invoice-html-code.d.ts.map +1 -1
- package/dist/esm/invoice/invoice-html-code.js +31 -8
- package/dist/esm/invoice/invoice-html-code.js.map +1 -1
- package/dist/esm/invoice/regional-invoice-tax-code.d.ts +25 -0
- package/dist/esm/invoice/regional-invoice-tax-code.d.ts.map +1 -0
- package/dist/esm/invoice/regional-invoice-tax-code.js +113 -0
- package/dist/esm/invoice/regional-invoice-tax-code.js.map +1 -0
- package/dist/esm/invoice/resolve-data-source.d.ts +6 -0
- package/dist/esm/invoice/resolve-data-source.d.ts.map +1 -0
- package/dist/esm/invoice/resolve-data-source.js +19 -0
- package/dist/esm/invoice/resolve-data-source.js.map +1 -0
- package/dist/esm/nodes/account/account-delete-current.d.ts.map +1 -1
- package/dist/esm/nodes/account/account-delete-current.js +10 -3
- package/dist/esm/nodes/account/account-delete-current.js.map +1 -1
- package/dist/esm/nodes/account/account-login.d.ts.map +1 -1
- package/dist/esm/nodes/account/account-login.js +3 -1
- package/dist/esm/nodes/account/account-login.js.map +1 -1
- package/dist/esm/nodes/account/account-logout.d.ts.map +1 -1
- package/dist/esm/nodes/account/account-logout.js +4 -2
- package/dist/esm/nodes/account/account-logout.js.map +1 -1
- package/dist/esm/nodes/account/account-signup.d.ts.map +1 -1
- package/dist/esm/nodes/account/account-signup.js +12 -2
- package/dist/esm/nodes/account/account-signup.js.map +1 -1
- package/dist/esm/nodes/account/account-social-login.d.ts.map +1 -1
- package/dist/esm/nodes/account/account-social-login.js +4 -2
- package/dist/esm/nodes/account/account-social-login.js.map +1 -1
- package/dist/esm/nodes/cart/cart-clear.d.ts.map +1 -1
- package/dist/esm/nodes/cart/cart-clear.js +6 -0
- package/dist/esm/nodes/cart/cart-clear.js.map +1 -1
- package/dist/esm/nodes/cart/cart-get-total.d.ts.map +1 -1
- package/dist/esm/nodes/cart/cart-get-total.js +81 -5
- package/dist/esm/nodes/cart/cart-get-total.js.map +1 -1
- package/dist/esm/nodes/data/data-create-item.d.ts.map +1 -1
- package/dist/esm/nodes/data/data-create-item.js +16 -0
- package/dist/esm/nodes/data/data-create-item.js.map +1 -1
- package/dist/esm/nodes/ecommerce/ecommerce-generate-invoice.d.ts.map +1 -1
- package/dist/esm/nodes/ecommerce/ecommerce-generate-invoice.js +6 -0
- package/dist/esm/nodes/ecommerce/ecommerce-generate-invoice.js.map +1 -1
- package/dist/esm/nodes/navigation/navigation-go-to-page.d.ts.map +1 -1
- package/dist/esm/nodes/navigation/navigation-go-to-page.js +4 -1
- package/dist/esm/nodes/navigation/navigation-go-to-page.js.map +1 -1
- package/dist/esm/nodes/navigation/navigation-navigate-to-url.d.ts.map +1 -1
- package/dist/esm/nodes/navigation/navigation-navigate-to-url.js +5 -2
- package/dist/esm/nodes/navigation/navigation-navigate-to-url.js.map +1 -1
- package/dist/esm/nodes/payment/payment-charge-user.d.ts.map +1 -1
- package/dist/esm/nodes/payment/payment-charge-user.js +7 -2
- package/dist/esm/nodes/payment/payment-charge-user.js.map +1 -1
- package/dist/esm/segment-splitter.d.ts +1 -1
- package/dist/esm/segment-splitter.d.ts.map +1 -1
- package/dist/esm/segment-splitter.js +29 -2
- package/dist/esm/segment-splitter.js.map +1 -1
- package/dist/esm/sent-email-log/index.d.ts +16 -0
- package/dist/esm/sent-email-log/index.d.ts.map +1 -0
- package/dist/esm/sent-email-log/index.js +45 -0
- package/dist/esm/sent-email-log/index.js.map +1 -0
- package/dist/esm/sent-email-log/sent-email-log-code.d.ts +4 -0
- package/dist/esm/sent-email-log/sent-email-log-code.d.ts.map +1 -0
- package/dist/esm/sent-email-log/sent-email-log-code.js +411 -0
- package/dist/esm/sent-email-log/sent-email-log-code.js.map +1 -0
- package/dist/esm/sent-email-log/sent-email-log-scope.d.ts +21 -0
- package/dist/esm/sent-email-log/sent-email-log-scope.d.ts.map +1 -0
- package/dist/esm/sent-email-log/sent-email-log-scope.js +31 -0
- package/dist/esm/sent-email-log/sent-email-log-scope.js.map +1 -0
- package/dist/esm/transactional-email-code.d.ts +39 -1
- package/dist/esm/transactional-email-code.d.ts.map +1 -1
- package/dist/esm/transactional-email-code.js +81 -10
- package/dist/esm/transactional-email-code.js.map +1 -1
- package/dist/esm/tsconfig.tsbuildinfo +1 -1
- package/dist/esm/webhook-generator.d.ts.map +1 -1
- package/dist/esm/webhook-generator.js +9 -2
- package/dist/esm/webhook-generator.js.map +1 -1
- package/dist/esm/workflow-component-plugin.js +4 -3
- package/dist/esm/workflow-component-plugin.js.map +1 -1
- package/dist/esm/workflow-project-plugin.d.ts.map +1 -1
- package/dist/esm/workflow-project-plugin.js +32 -4
- package/dist/esm/workflow-project-plugin.js.map +1 -1
- package/dist/esm/workflow-utils-alias.d.ts +21 -0
- package/dist/esm/workflow-utils-alias.d.ts.map +1 -0
- package/dist/esm/workflow-utils-alias.js +21 -0
- package/dist/esm/workflow-utils-alias.js.map +1 -0
- package/package.json +4 -4
- package/src/account-delete-route-generator.ts +36 -7
- package/src/api-route-generator.ts +64 -11
- package/src/auth-generator.ts +63 -18
- package/src/data-api-route-generator.ts +19 -0
- package/src/email-locale/email-locale-code.ts +239 -0
- package/src/email-locale/email-locale-scope.ts +65 -0
- package/src/email-locale/index.ts +46 -0
- package/src/executor-generator.ts +65 -7
- package/src/index.ts +8 -0
- package/src/invoice/api-routes-code.ts +65 -6
- package/src/invoice/email-sender-code.ts +72 -31
- package/src/invoice/index.ts +7 -23
- package/src/invoice/invoice-html-code.ts +31 -8
- package/src/invoice/regional-invoice-tax-code.ts +112 -0
- package/src/invoice/resolve-data-source.ts +25 -0
- package/src/nodes/account/account-delete-current.ts +10 -3
- package/src/nodes/account/account-login.ts +3 -1
- package/src/nodes/account/account-logout.ts +4 -2
- package/src/nodes/account/account-signup.ts +12 -2
- package/src/nodes/account/account-social-login.ts +7 -2
- package/src/nodes/cart/cart-clear.ts +6 -0
- package/src/nodes/cart/cart-get-total.ts +94 -5
- package/src/nodes/data/data-create-item.ts +16 -0
- package/src/nodes/ecommerce/ecommerce-generate-invoice.ts +6 -0
- package/src/nodes/navigation/navigation-go-to-page.ts +5 -1
- package/src/nodes/navigation/navigation-navigate-to-url.ts +6 -2
- package/src/nodes/payment/payment-charge-user.ts +13 -2
- package/src/nodes/workflow-utils-global.d.ts +12 -0
- package/src/segment-splitter.ts +33 -2
- package/src/sent-email-log/index.ts +57 -0
- package/src/sent-email-log/sent-email-log-code.ts +419 -0
- package/src/sent-email-log/sent-email-log-scope.ts +36 -0
- package/src/transactional-email-code.ts +112 -4
- package/src/webhook-generator.ts +11 -2
- package/src/workflow-component-plugin.ts +4 -3
- package/src/workflow-project-plugin.ts +36 -4
- package/src/workflow-utils-alias.ts +26 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"email-locale-code.js","sourceRoot":"","sources":["../../../src/email-locale/email-locale-code.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,uBAAuB,EACvB,mBAAmB,EAEnB,8BAA8B,EAC9B,kBAAkB,EAClB,2BAA2B,GAC5B,MAAM,sBAAsB,CAAA;AAE7B;;;;;;;;;;;;GAYG;AACH,MAAM,CAAC,MAAM,8BAA8B,GAAG,CAAC,MAAyB,EAAU,EAAE,CAAC;sBAC/D,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,OAAO,CAAC;6BACvB,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,aAAa,CAAC;4BACrC,IAAI,CAAC,SAAS,CAAC,mBAAmB,CAAC;2BACpC,IAAI,CAAC,SAAS,CAAC,kBAAkB,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA+H5D,CAAA;AAED;;;;;GAKG;AACH,MAAM,CAAC,MAAM,iCAAiC,GAAG,GAAW,EAAE,CAAC;;;;6EAIc,IAAI,CAAC,SAAS,CACvF,2BAA2B,CAC5B;;;;;;;;;;;qDAWkD,IAAI,CAAC,SAAS,CAAC,uBAAuB,CAAC;yCACnD,IAAI,CAAC,SAAS,CACjD,uBAAuB,CACxB;;yDAEoD,IAAI,CAAC,SAAS,CACnE,2BAA2B,CAC5B;;;;;;;;;mCASgC,IAAI,CAAC,SAAS,CAAC,8BAA8B,CAAC;;0EAEP,IAAI,CAAC,SAAS,CACpF,uBAAuB,CACxB;;;;;;;;;;4BAUyB,IAAI,CAAC,SAAS,CAAC,8BAA8B,CAAC;;0CAEhC,IAAI,CAAC,SAAS,CAAC,uBAAuB,CAAC;;CAEhF,CAAA;AAED,+EAA+E;AAC/E,MAAM,CAAC,MAAM,6BAA6B,GAAG,CAAC,MAAyB,EAAU,EAAE,CAAC;;;;;;;;;;;;EAYlF,8BAA8B,CAAC,MAAM,CAAC;;;;;;;;;;;CAWvC,CAAA"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { ProjectUIDL } from '@teleporthq/teleport-types';
|
|
2
|
+
/**
|
|
3
|
+
* The vocabulary every generated email sender shares to decide WHICH language a
|
|
4
|
+
* customer email goes out in. The module itself is emitted by
|
|
5
|
+
* `ensureEmailLocaleModule` (see `index.ts`); this file only holds the names
|
|
6
|
+
* the route generators, the workflow runtime and the UIDL mapper agree on.
|
|
7
|
+
*/
|
|
8
|
+
export declare const EMAIL_LOCALE_FILE_KEY = "email-locale";
|
|
9
|
+
export declare const EMAIL_LOCALE_PATH: string[];
|
|
10
|
+
export declare const EMAIL_LOCALE_FILE_NAME = "email-locale";
|
|
11
|
+
/**
|
|
12
|
+
* Request header the generated client runtime sends with every call to the
|
|
13
|
+
* app's own API routes, carrying the locale of the page the visitor is on.
|
|
14
|
+
*/
|
|
15
|
+
export declare const EMAIL_LOCALE_HEADER = "x-teleport-locale";
|
|
16
|
+
/** The cookie Next.js reads for locale detection; honoured as a fallback. */
|
|
17
|
+
export declare const NEXT_LOCALE_COOKIE = "NEXT_LOCALE";
|
|
18
|
+
/**
|
|
19
|
+
* Export-only node config key written by the editor's domain→UIDL mapper on a
|
|
20
|
+
* component-bodied email node: the per-language copies of its body/subject,
|
|
21
|
+
* keyed by locale short code (main language excluded). Consumed by the runtime
|
|
22
|
+
* (`resolveConfig`) and never by a handler.
|
|
23
|
+
*/
|
|
24
|
+
export declare const LOCALIZED_TEMPLATES_CONFIG_KEY = "localizedTemplates";
|
|
25
|
+
/**
|
|
26
|
+
* Node config key that pins an email to a language independently of the
|
|
27
|
+
* request: a lifecycle email bound to the order's stored locale, a reminder
|
|
28
|
+
* bound to the cart's. When the key is present its resolved value is
|
|
29
|
+
* authoritative — an empty one means the default language, never the locale of
|
|
30
|
+
* whoever triggered the workflow (an admin shipping an order is not the buyer).
|
|
31
|
+
*/
|
|
32
|
+
export declare const EMAIL_LOCALE_CONFIG_KEY = "emailLocale";
|
|
33
|
+
/** Workflow-context key carrying the request locale through a run. */
|
|
34
|
+
export declare const WORKFLOW_CONTEXT_LOCALE_KEY = "__locale";
|
|
35
|
+
/**
|
|
36
|
+
* The locales the generated app serves, as the email senders need them: the
|
|
37
|
+
* full list to validate an incoming value against and the default to fall back
|
|
38
|
+
* to. A project without internationalization has no locales at all — every
|
|
39
|
+
* sender then keeps its single template and nothing is ever localized.
|
|
40
|
+
*/
|
|
41
|
+
export interface EmailLocaleConfig {
|
|
42
|
+
locales: string[];
|
|
43
|
+
defaultLocale: string;
|
|
44
|
+
}
|
|
45
|
+
export declare const resolveEmailLocaleConfig: (uidl: ProjectUIDL) => EmailLocaleConfig;
|
|
46
|
+
//# sourceMappingURL=email-locale-scope.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"email-locale-scope.d.ts","sourceRoot":"","sources":["../../../src/email-locale/email-locale-scope.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAA;AAExD;;;;;GAKG;AAEH,eAAO,MAAM,qBAAqB,iBAAiB,CAAA;AACnD,eAAO,MAAM,iBAAiB,UAAqB,CAAA;AACnD,eAAO,MAAM,sBAAsB,iBAAiB,CAAA;AAEpD;;;GAGG;AACH,eAAO,MAAM,mBAAmB,sBAAsB,CAAA;AAEtD,6EAA6E;AAC7E,eAAO,MAAM,kBAAkB,gBAAgB,CAAA;AAE/C;;;;;GAKG;AACH,eAAO,MAAM,8BAA8B,uBAAuB,CAAA;AAElE;;;;;;GAMG;AACH,eAAO,MAAM,uBAAuB,gBAAgB,CAAA;AAEpD,sEAAsE;AACtE,eAAO,MAAM,2BAA2B,aAAa,CAAA;AAErD;;;;;GAKG;AACH,MAAM,WAAW,iBAAiB;IAChC,OAAO,EAAE,MAAM,EAAE,CAAA;IACjB,aAAa,EAAE,MAAM,CAAA;CACtB;AAED,eAAO,MAAM,wBAAwB,SAAU,WAAW,KAAG,iBAW5D,CAAA"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The vocabulary every generated email sender shares to decide WHICH language a
|
|
3
|
+
* customer email goes out in. The module itself is emitted by
|
|
4
|
+
* `ensureEmailLocaleModule` (see `index.ts`); this file only holds the names
|
|
5
|
+
* the route generators, the workflow runtime and the UIDL mapper agree on.
|
|
6
|
+
*/
|
|
7
|
+
export const EMAIL_LOCALE_FILE_KEY = 'email-locale';
|
|
8
|
+
export const EMAIL_LOCALE_PATH = ['utils', 'email'];
|
|
9
|
+
export const EMAIL_LOCALE_FILE_NAME = 'email-locale';
|
|
10
|
+
/**
|
|
11
|
+
* Request header the generated client runtime sends with every call to the
|
|
12
|
+
* app's own API routes, carrying the locale of the page the visitor is on.
|
|
13
|
+
*/
|
|
14
|
+
export const EMAIL_LOCALE_HEADER = 'x-teleport-locale';
|
|
15
|
+
/** The cookie Next.js reads for locale detection; honoured as a fallback. */
|
|
16
|
+
export const NEXT_LOCALE_COOKIE = 'NEXT_LOCALE';
|
|
17
|
+
/**
|
|
18
|
+
* Export-only node config key written by the editor's domain→UIDL mapper on a
|
|
19
|
+
* component-bodied email node: the per-language copies of its body/subject,
|
|
20
|
+
* keyed by locale short code (main language excluded). Consumed by the runtime
|
|
21
|
+
* (`resolveConfig`) and never by a handler.
|
|
22
|
+
*/
|
|
23
|
+
export const LOCALIZED_TEMPLATES_CONFIG_KEY = 'localizedTemplates';
|
|
24
|
+
/**
|
|
25
|
+
* Node config key that pins an email to a language independently of the
|
|
26
|
+
* request: a lifecycle email bound to the order's stored locale, a reminder
|
|
27
|
+
* bound to the cart's. When the key is present its resolved value is
|
|
28
|
+
* authoritative — an empty one means the default language, never the locale of
|
|
29
|
+
* whoever triggered the workflow (an admin shipping an order is not the buyer).
|
|
30
|
+
*/
|
|
31
|
+
export const EMAIL_LOCALE_CONFIG_KEY = 'emailLocale';
|
|
32
|
+
/** Workflow-context key carrying the request locale through a run. */
|
|
33
|
+
export const WORKFLOW_CONTEXT_LOCALE_KEY = '__locale';
|
|
34
|
+
export const resolveEmailLocaleConfig = (uidl) => {
|
|
35
|
+
var _a;
|
|
36
|
+
const i18n = uidl.internationalization;
|
|
37
|
+
if (!i18n) {
|
|
38
|
+
return { locales: [], defaultLocale: '' };
|
|
39
|
+
}
|
|
40
|
+
const defaultLocale = ((_a = i18n.main) === null || _a === void 0 ? void 0 : _a.locale) || '';
|
|
41
|
+
const locales = Object.keys(i18n.languages || {});
|
|
42
|
+
if (defaultLocale && locales.indexOf(defaultLocale) === -1) {
|
|
43
|
+
locales.unshift(defaultLocale);
|
|
44
|
+
}
|
|
45
|
+
return { locales, defaultLocale };
|
|
46
|
+
};
|
|
47
|
+
//# sourceMappingURL=email-locale-scope.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"email-locale-scope.js","sourceRoot":"","sources":["../../../src/email-locale/email-locale-scope.ts"],"names":[],"mappings":"AAEA;;;;;GAKG;AAEH,MAAM,CAAC,MAAM,qBAAqB,GAAG,cAAc,CAAA;AACnD,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,OAAO,EAAE,OAAO,CAAC,CAAA;AACnD,MAAM,CAAC,MAAM,sBAAsB,GAAG,cAAc,CAAA;AAEpD;;;GAGG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,mBAAmB,CAAA;AAEtD,6EAA6E;AAC7E,MAAM,CAAC,MAAM,kBAAkB,GAAG,aAAa,CAAA;AAE/C;;;;;GAKG;AACH,MAAM,CAAC,MAAM,8BAA8B,GAAG,oBAAoB,CAAA;AAElE;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAG,aAAa,CAAA;AAEpD,sEAAsE;AACtE,MAAM,CAAC,MAAM,2BAA2B,GAAG,UAAU,CAAA;AAarD,MAAM,CAAC,MAAM,wBAAwB,GAAG,CAAC,IAAiB,EAAqB,EAAE;;IAC/E,MAAM,IAAI,GAAG,IAAI,CAAC,oBAAoB,CAAA;IACtC,IAAI,CAAC,IAAI,EAAE;QACT,OAAO,EAAE,OAAO,EAAE,EAAE,EAAE,aAAa,EAAE,EAAE,EAAE,CAAA;KAC1C;IACD,MAAM,aAAa,GAAG,CAAA,MAAA,IAAI,CAAC,IAAI,0CAAE,MAAM,KAAI,EAAE,CAAA;IAC7C,MAAM,OAAO,GAAG,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,IAAI,EAAE,CAAC,CAAA;IACjD,IAAI,aAAa,IAAI,OAAO,CAAC,OAAO,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC,EAAE;QAC1D,OAAO,CAAC,OAAO,CAAC,aAAa,CAAC,CAAA;KAC/B;IACD,OAAO,EAAE,OAAO,EAAE,aAAa,EAAE,CAAA;AACnC,CAAC,CAAA"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { ProjectPluginStructure } from '@teleporthq/teleport-types';
|
|
2
|
+
export { EMAIL_LOCALE_CONFIG_KEY, EMAIL_LOCALE_HEADER, EmailLocaleConfig, LOCALIZED_TEMPLATES_CONFIG_KEY, WORKFLOW_CONTEXT_LOCALE_KEY, resolveEmailLocaleConfig, } from './email-locale-scope';
|
|
3
|
+
export { generateEmailLocaleHelpersCode, generateEmailLocaleModuleCode, generateWorkflowLocaleHelpersCode, } from './email-locale-code';
|
|
4
|
+
/**
|
|
5
|
+
* Writes `utils/email/email-locale.js` into the project, once. Like the
|
|
6
|
+
* sent-email ledger, every emitter of a send path that lives outside the
|
|
7
|
+
* workflow runtime calls this right where it emits the `require`, so the file
|
|
8
|
+
* exists exactly when something needs it, whichever plugin ran first.
|
|
9
|
+
*/
|
|
10
|
+
export declare const ensureEmailLocaleModule: (structure: ProjectPluginStructure) => void;
|
|
11
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/email-locale/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAY,sBAAsB,EAAE,MAAM,4BAA4B,CAAA;AAS7E,OAAO,EACL,uBAAuB,EACvB,mBAAmB,EACnB,iBAAiB,EACjB,8BAA8B,EAC9B,2BAA2B,EAC3B,wBAAwB,GACzB,MAAM,sBAAsB,CAAA;AAC7B,OAAO,EACL,8BAA8B,EAC9B,6BAA6B,EAC7B,iCAAiC,GAClC,MAAM,qBAAqB,CAAA;AAE5B;;;;;GAKG;AACH,eAAO,MAAM,uBAAuB,cAAe,sBAAsB,KAAG,IAgB3E,CAAA"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { FileType } from '@teleporthq/teleport-types';
|
|
2
|
+
import { generateEmailLocaleModuleCode } from './email-locale-code';
|
|
3
|
+
import { EMAIL_LOCALE_FILE_KEY, EMAIL_LOCALE_FILE_NAME, EMAIL_LOCALE_PATH, resolveEmailLocaleConfig, } from './email-locale-scope';
|
|
4
|
+
export { EMAIL_LOCALE_CONFIG_KEY, EMAIL_LOCALE_HEADER, LOCALIZED_TEMPLATES_CONFIG_KEY, WORKFLOW_CONTEXT_LOCALE_KEY, resolveEmailLocaleConfig, } from './email-locale-scope';
|
|
5
|
+
export { generateEmailLocaleHelpersCode, generateEmailLocaleModuleCode, generateWorkflowLocaleHelpersCode, } from './email-locale-code';
|
|
6
|
+
/**
|
|
7
|
+
* Writes `utils/email/email-locale.js` into the project, once. Like the
|
|
8
|
+
* sent-email ledger, every emitter of a send path that lives outside the
|
|
9
|
+
* workflow runtime calls this right where it emits the `require`, so the file
|
|
10
|
+
* exists exactly when something needs it, whichever plugin ran first.
|
|
11
|
+
*/
|
|
12
|
+
export const ensureEmailLocaleModule = (structure) => {
|
|
13
|
+
const { files, uidl } = structure;
|
|
14
|
+
if (files.has(EMAIL_LOCALE_FILE_KEY)) {
|
|
15
|
+
return;
|
|
16
|
+
}
|
|
17
|
+
files.set(EMAIL_LOCALE_FILE_KEY, {
|
|
18
|
+
path: EMAIL_LOCALE_PATH,
|
|
19
|
+
files: [
|
|
20
|
+
{
|
|
21
|
+
name: EMAIL_LOCALE_FILE_NAME,
|
|
22
|
+
fileType: FileType.JS,
|
|
23
|
+
content: generateEmailLocaleModuleCode(resolveEmailLocaleConfig(uidl)),
|
|
24
|
+
},
|
|
25
|
+
],
|
|
26
|
+
});
|
|
27
|
+
};
|
|
28
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/email-locale/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAA0B,MAAM,4BAA4B,CAAA;AAC7E,OAAO,EAAE,6BAA6B,EAAE,MAAM,qBAAqB,CAAA;AACnE,OAAO,EACL,qBAAqB,EACrB,sBAAsB,EACtB,iBAAiB,EACjB,wBAAwB,GACzB,MAAM,sBAAsB,CAAA;AAE7B,OAAO,EACL,uBAAuB,EACvB,mBAAmB,EAEnB,8BAA8B,EAC9B,2BAA2B,EAC3B,wBAAwB,GACzB,MAAM,sBAAsB,CAAA;AAC7B,OAAO,EACL,8BAA8B,EAC9B,6BAA6B,EAC7B,iCAAiC,GAClC,MAAM,qBAAqB,CAAA;AAE5B;;;;;GAKG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,SAAiC,EAAQ,EAAE;IACjF,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,GAAG,SAAS,CAAA;IACjC,IAAI,KAAK,CAAC,GAAG,CAAC,qBAAqB,CAAC,EAAE;QACpC,OAAM;KACP;IAED,KAAK,CAAC,GAAG,CAAC,qBAAqB,EAAE;QAC/B,IAAI,EAAE,iBAAiB;QACvB,KAAK,EAAE;YACL;gBACE,IAAI,EAAE,sBAAsB;gBAC5B,QAAQ,EAAE,QAAQ,CAAC,EAAE;gBACrB,OAAO,EAAE,6BAA6B,CAAC,wBAAwB,CAAC,IAAI,CAAC,CAAC;aACvE;SACF;KACF,CAAC,CAAA;AACJ,CAAC,CAAA"}
|
|
@@ -1,4 +1,14 @@
|
|
|
1
|
-
|
|
1
|
+
import { EmailLocaleConfig } from './email-locale';
|
|
2
|
+
export interface SharedRuntimeUtilsOptions {
|
|
3
|
+
/**
|
|
4
|
+
* The project's locales, baked in so the runtime can validate the locale a
|
|
5
|
+
* request or the browser reports and pick the matching copy of a localized
|
|
6
|
+
* email. Absent (a project without internationalization): no locale is ever
|
|
7
|
+
* recognised and every email keeps its single template.
|
|
8
|
+
*/
|
|
9
|
+
emailLocales?: EmailLocaleConfig;
|
|
10
|
+
}
|
|
11
|
+
export declare const generateSharedRuntimeUtilsCode: (options?: SharedRuntimeUtilsOptions) => string;
|
|
2
12
|
export declare const generateClientRuntimeCode: () => string;
|
|
3
13
|
export declare const generateServerRuntimeCode: () => string;
|
|
4
14
|
//# sourceMappingURL=executor-generator.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"executor-generator.d.ts","sourceRoot":"","sources":["../../src/executor-generator.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,8BAA8B,
|
|
1
|
+
{"version":3,"file":"executor-generator.d.ts","sourceRoot":"","sources":["../../src/executor-generator.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,iBAAiB,EAGlB,MAAM,gBAAgB,CAAA;AAEvB,MAAM,WAAW,yBAAyB;IACxC;;;;;OAKG;IACH,YAAY,CAAC,EAAE,iBAAiB,CAAA;CACjC;AAID,eAAO,MAAM,8BAA8B,aAAa,yBAAyB,KAAQ,MA2zCxF,CAAA;AAED,eAAO,MAAM,yBAAyB,QAAO,MA2lB5C,CAAA;AAED,eAAO,MAAM,yBAAyB,QAAO,MAK5C,CAAA"}
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
import { generateEmailLocaleHelpersCode, generateWorkflowLocaleHelpersCode, } from './email-locale';
|
|
2
|
+
const NO_EMAIL_LOCALES = { locales: [], defaultLocale: '' };
|
|
3
|
+
export const generateSharedRuntimeUtilsCode = (options = {}) => {
|
|
2
4
|
return `/**
|
|
3
5
|
* Workflow Runtime Utilities
|
|
4
6
|
*
|
|
@@ -8,7 +10,8 @@ export const generateSharedRuntimeUtilsCode = () => {
|
|
|
8
10
|
* - executeNodes: Executes a sequence of workflow nodes
|
|
9
11
|
* - executeWorkflow: Main workflow execution entry point
|
|
10
12
|
*/
|
|
11
|
-
|
|
13
|
+
${generateEmailLocaleHelpersCode(options.emailLocales || NO_EMAIL_LOCALES)}
|
|
14
|
+
${generateWorkflowLocaleHelpersCode()}
|
|
12
15
|
function resolveValue(value, context) {
|
|
13
16
|
if (value === null || value === undefined) return value;
|
|
14
17
|
if (Array.isArray(value)) {
|
|
@@ -522,6 +525,11 @@ function resolveConfig(config, context) {
|
|
|
522
525
|
//
|
|
523
526
|
// Runs after resolution on purpose: \`templateParams[].value\` is itself a
|
|
524
527
|
// workflow-context ref that the loop above has just resolved.
|
|
528
|
+
//
|
|
529
|
+
// The language is chosen first, for the same reason: a customer email carries
|
|
530
|
+
// one copy per project language, and the copy has to be picked before its
|
|
531
|
+
// tokens are filled.
|
|
532
|
+
applyLocalizedEmailTemplate(resolved, context);
|
|
525
533
|
if (Array.isArray(resolved.templateParams)) {
|
|
526
534
|
if (typeof resolved.body === 'string') {
|
|
527
535
|
resolved.body = applyTemplateParams(resolved.body, resolved.templateParams);
|
|
@@ -651,6 +659,12 @@ async function executeWorkflow(workflowConfig, triggerContext, nodeHandlers, opt
|
|
|
651
659
|
if (triggerContext && triggerContext.triggerElement) {
|
|
652
660
|
context.triggerElement = triggerContext.triggerElement;
|
|
653
661
|
}
|
|
662
|
+
// The language of the page this run started on, carried to every server
|
|
663
|
+
// segment (the context crosses whole) so a customer email can be sent in it.
|
|
664
|
+
var runLocale = getClientLocale();
|
|
665
|
+
if (runLocale) {
|
|
666
|
+
context.__locale = runLocale;
|
|
667
|
+
}
|
|
654
668
|
|
|
655
669
|
const callServerSegment = options.callServerSegment;
|
|
656
670
|
|
|
@@ -750,6 +764,15 @@ function isFireAndForgetNode(node) {
|
|
|
750
764
|
return !!node.config && node.config.awaitResult === false;
|
|
751
765
|
}
|
|
752
766
|
|
|
767
|
+
// A node the author marked \`continueOnError\`: a failed RESULT ({ success:
|
|
768
|
+
// false } / { error }) is published under the node's id like any other result
|
|
769
|
+
// instead of aborting the workflow, so a later if-statement can read
|
|
770
|
+
// \`success\` and warn. Only an explicit \`true\` opts in. A handler that THROWS
|
|
771
|
+
// still aborts — every provider handler reports failure as a result.
|
|
772
|
+
function continuesOnError(node) {
|
|
773
|
+
return !!(node && node.config && node.config.continueOnError === true);
|
|
774
|
+
}
|
|
775
|
+
|
|
753
776
|
// Starts a fire-and-forget node and returns a promise that ALWAYS resolves.
|
|
754
777
|
// The workflow has already moved on, so a failure here can neither abort it nor
|
|
755
778
|
// reach the error handler — it is reported to the console and swallowed, which
|
|
@@ -791,10 +814,13 @@ async function settlePendingNodePromises(context) {
|
|
|
791
814
|
for (var pass = 0; pass < 5; pass++) {
|
|
792
815
|
var pending = context.__pendingNodePromises;
|
|
793
816
|
if (!pending || pending.length === 0) return;
|
|
794
|
-
|
|
817
|
+
// Drained IN PLACE, never by swapping in a fresh array: a parallel branch
|
|
818
|
+
// that is still running holds a reference to this very array (its context
|
|
819
|
+
// is a shallow copy) and must keep landing on the queue the route drains.
|
|
820
|
+
var batch = pending.splice(0, pending.length);
|
|
795
821
|
// Every entry swallows its own rejection (see startFireAndForgetNode), so
|
|
796
822
|
// this can never reject.
|
|
797
|
-
await Promise.all(
|
|
823
|
+
await Promise.all(batch);
|
|
798
824
|
}
|
|
799
825
|
}
|
|
800
826
|
|
|
@@ -918,7 +944,7 @@ async function executeNodes(nodes, edges, context, nodeHandlers, workflowConfig,
|
|
|
918
944
|
await executeNodes(onStreamNodes, edges, context, nodeHandlers, workflowConfig, callServerSegment, executionId);
|
|
919
945
|
}
|
|
920
946
|
});
|
|
921
|
-
if (isFatalNodeResult(streamResult)) {
|
|
947
|
+
if (isFatalNodeResult(streamResult) && !continuesOnError(node)) {
|
|
922
948
|
throw new Error(fatalNodeResultMessage(streamResult));
|
|
923
949
|
}
|
|
924
950
|
context[node.id] = streamResult;
|
|
@@ -977,7 +1003,7 @@ async function executeNodes(nodes, edges, context, nodeHandlers, workflowConfig,
|
|
|
977
1003
|
throw earlyErr;
|
|
978
1004
|
}
|
|
979
1005
|
|
|
980
|
-
if (isFatalNodeResult(result)) {
|
|
1006
|
+
if (isFatalNodeResult(result) && !continuesOnError(node)) {
|
|
981
1007
|
throw new Error(fatalNodeResultMessage(result));
|
|
982
1008
|
}
|
|
983
1009
|
|
|
@@ -1276,6 +1302,13 @@ function internalRequestHeaders(req) {
|
|
|
1276
1302
|
|
|
1277
1303
|
module.exports = {
|
|
1278
1304
|
internalRequestHeaders,
|
|
1305
|
+
normalizeEmailLocale,
|
|
1306
|
+
resolveRequestLocale,
|
|
1307
|
+
resolveWorkflowLocale,
|
|
1308
|
+
resolveEmailLocale,
|
|
1309
|
+
getClientLocale,
|
|
1310
|
+
localizeHref,
|
|
1311
|
+
pickLocalizedTemplate,
|
|
1279
1312
|
resolveValue,
|
|
1280
1313
|
resolveSecret,
|
|
1281
1314
|
resolveConfig,
|
|
@@ -1299,6 +1332,7 @@ module.exports = {
|
|
|
1299
1332
|
isStreamingAINode,
|
|
1300
1333
|
isFatalNodeResult,
|
|
1301
1334
|
fatalNodeResultMessage,
|
|
1335
|
+
continuesOnError,
|
|
1302
1336
|
isFireAndForgetNode,
|
|
1303
1337
|
startFireAndForgetNode,
|
|
1304
1338
|
registerPendingNodePromise,
|
|
@@ -1544,6 +1578,11 @@ function buildContext(workflowConfig, triggerContext) {
|
|
|
1544
1578
|
if (triggerContext.__dynamicRouteParam) context.__dynamicRouteParam = triggerContext.__dynamicRouteParam;
|
|
1545
1579
|
if (triggerContext.triggerElement) context.triggerElement = triggerContext.triggerElement;
|
|
1546
1580
|
}
|
|
1581
|
+
// See executeWorkflow: the page's language travels with the run.
|
|
1582
|
+
var runLocale = utils.getClientLocale();
|
|
1583
|
+
if (runLocale) {
|
|
1584
|
+
context.__locale = runLocale;
|
|
1585
|
+
}
|
|
1547
1586
|
return context;
|
|
1548
1587
|
}
|
|
1549
1588
|
|
|
@@ -1871,7 +1910,10 @@ async function executeWorkflowWithSegments(workflowConfig, triggerContext, clien
|
|
|
1871
1910
|
if (__terminalResult) {
|
|
1872
1911
|
var __redirectUrl = __terminalResult.__redirectUrl;
|
|
1873
1912
|
if (typeof __redirectUrl === 'string' && __redirectUrl.length > 0 && typeof window !== 'undefined' && window.location) {
|
|
1874
|
-
|
|
1913
|
+
// A site-relative target keeps the visitor in the language of the
|
|
1914
|
+
// page the run started on (the provider's hosted page is absolute
|
|
1915
|
+
// and passes through untouched).
|
|
1916
|
+
window.location.href = utils.localizeHref(__redirectUrl, context.__locale);
|
|
1875
1917
|
}
|
|
1876
1918
|
break;
|
|
1877
1919
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"executor-generator.js","sourceRoot":"","sources":["../../src/executor-generator.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,8BAA8B,GAAG,
|
|
1
|
+
{"version":3,"file":"executor-generator.js","sourceRoot":"","sources":["../../src/executor-generator.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,8BAA8B,EAC9B,iCAAiC,GAClC,MAAM,gBAAgB,CAAA;AAYvB,MAAM,gBAAgB,GAAsB,EAAE,OAAO,EAAE,EAAE,EAAE,aAAa,EAAE,EAAE,EAAE,CAAA;AAE9E,MAAM,CAAC,MAAM,8BAA8B,GAAG,CAAC,UAAqC,EAAE,EAAU,EAAE;IAChG,OAAO;;;;;;;;;EASP,8BAA8B,CAAC,OAAO,CAAC,YAAY,IAAI,gBAAgB,CAAC;EACxE,iCAAiC,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;;;;;;;;;;;;;;;;;;;;CA+yCpC,CAAA;AACD,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,yBAAyB,GAAG,GAAW,EAAE;IACpD,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAylBR,CAAA;AACD,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,yBAAyB,GAAG,GAAW,EAAE;IACpD,OAAO;;;CAGR,CAAA;AACD,CAAC,CAAA"}
|
package/dist/esm/index.d.ts
CHANGED
|
@@ -7,6 +7,8 @@ export { generateClientRuntimeCode, generateServerRuntimeCode, generateSharedRun
|
|
|
7
7
|
export { generateServerSegmentAPIRoute, generateStreamingServerSegmentAPIRoute, generateCronAPIRoute, generateWebhookWorkflowAPIRoute, getAPIRouteFileName, getCronRouteFileName, getWebhookRouteFileName, getWebhookRoutePath, hasStreamingAINode, } from './api-route-generator';
|
|
8
8
|
export { generateTriggerCode } from './trigger-generator';
|
|
9
9
|
export { generatePgClientCode } from './pg-client-code';
|
|
10
|
+
export { ensureSentEmailLogModule } from './sent-email-log';
|
|
11
|
+
export { ensureEmailLocaleModule, EMAIL_LOCALE_CONFIG_KEY, EMAIL_LOCALE_HEADER, LOCALIZED_TEMPLATES_CONFIG_KEY, resolveEmailLocaleConfig, } from './email-locale';
|
|
10
12
|
export { SESSION_TOKEN_RESOLVER_FN, generateSessionTokenResolverCode, generateCommonJsSessionTokenResolverCode, } from './session-cookie-resolver';
|
|
11
13
|
export { projectUsesRealtime, REALTIME_NODE_TYPES, REALTIME_TRIGGER_TYPES } from './graph-utils';
|
|
12
14
|
export * from './realtime-generator';
|
package/dist/esm/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,MAAM,6BAA6B,CAAA;AACtE,OAAO,EAAE,yBAAyB,EAAE,MAAM,2BAA2B,CAAA;AACrE,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA;AACtC,OAAO,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAA;AAC5F,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAA;AACnD,OAAO,EACL,yBAAyB,EACzB,yBAAyB,EACzB,8BAA8B,GAC/B,MAAM,sBAAsB,CAAA;AAC7B,OAAO,EACL,6BAA6B,EAC7B,sCAAsC,EACtC,oBAAoB,EACpB,+BAA+B,EAC/B,mBAAmB,EACnB,oBAAoB,EACpB,uBAAuB,EACvB,mBAAmB,EACnB,kBAAkB,GACnB,MAAM,uBAAuB,CAAA;AAC9B,OAAO,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAA;AACzD,OAAO,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAA;AACvD,OAAO,EAC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9B,wBAAwB,GACzB,MAAM,gBAAgB,CAAA;AACvB,OAAO,EACL,yBAAyB,EACzB,gCAAgC,EAChC,wCAAwC,GACzC,MAAM,2BAA2B,CAAA;AAClC,OAAO,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,sBAAsB,EAAE,MAAM,eAAe,CAAA;AAChG,cAAc,sBAAsB,CAAA;AACpC,OAAO,EAAE,oBAAoB,EAAE,wBAAwB,EAAE,MAAM,WAAW,CAAA;AAC1E,OAAO,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAA;AAC1D,OAAO,EACL,wBAAwB,EACxB,iCAAiC,GAClC,MAAM,6BAA6B,CAAA;AACpC,cAAc,SAAS,CAAA"}
|
package/dist/esm/index.js
CHANGED
|
@@ -7,6 +7,8 @@ export { generateClientRuntimeCode, generateServerRuntimeCode, generateSharedRun
|
|
|
7
7
|
export { generateServerSegmentAPIRoute, generateStreamingServerSegmentAPIRoute, generateCronAPIRoute, generateWebhookWorkflowAPIRoute, getAPIRouteFileName, getCronRouteFileName, getWebhookRouteFileName, getWebhookRoutePath, hasStreamingAINode, } from './api-route-generator';
|
|
8
8
|
export { generateTriggerCode } from './trigger-generator';
|
|
9
9
|
export { generatePgClientCode } from './pg-client-code';
|
|
10
|
+
export { ensureSentEmailLogModule } from './sent-email-log';
|
|
11
|
+
export { ensureEmailLocaleModule, EMAIL_LOCALE_CONFIG_KEY, EMAIL_LOCALE_HEADER, LOCALIZED_TEMPLATES_CONFIG_KEY, resolveEmailLocaleConfig, } from './email-locale';
|
|
10
12
|
export { SESSION_TOKEN_RESOLVER_FN, generateSessionTokenResolverCode, generateCommonJsSessionTokenResolverCode, } from './session-cookie-resolver';
|
|
11
13
|
export { projectUsesRealtime, REALTIME_NODE_TYPES, REALTIME_TRIGGER_TYPES } from './graph-utils';
|
|
12
14
|
export * from './realtime-generator';
|
package/dist/esm/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,MAAM,6BAA6B,CAAA;AACtE,OAAO,EAAE,yBAAyB,EAAE,MAAM,2BAA2B,CAAA;AACrE,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA;AACtC,OAAO,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAA;AAC5F,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAA;AACnD,OAAO,EACL,yBAAyB,EACzB,yBAAyB,EACzB,8BAA8B,GAC/B,MAAM,sBAAsB,CAAA;AAC7B,OAAO,EACL,6BAA6B,EAC7B,sCAAsC,EACtC,oBAAoB,EACpB,+BAA+B,EAC/B,mBAAmB,EACnB,oBAAoB,EACpB,uBAAuB,EACvB,mBAAmB,EACnB,kBAAkB,GACnB,MAAM,uBAAuB,CAAA;AAC9B,OAAO,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAA;AACzD,OAAO,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAA;AACvD,OAAO,EACL,yBAAyB,EACzB,gCAAgC,EAChC,wCAAwC,GACzC,MAAM,2BAA2B,CAAA;AAClC,OAAO,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,sBAAsB,EAAE,MAAM,eAAe,CAAA;AAChG,cAAc,sBAAsB,CAAA;AACpC,OAAO,EAAE,oBAAoB,EAAE,wBAAwB,EAAE,MAAM,WAAW,CAAA;AAC1E,OAAO,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAA;AAC1D,OAAO,EACL,wBAAwB,EACxB,iCAAiC,GAClC,MAAM,6BAA6B,CAAA;AACpC,cAAc,SAAS,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,MAAM,6BAA6B,CAAA;AACtE,OAAO,EAAE,yBAAyB,EAAE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],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAA;
|
|
1
|
+
{"version":3,"file":"api-routes-code.d.ts","sourceRoot":"","sources":["../../../src/invoice/api-routes-code.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAA;AAGhE,eAAO,MAAM,gCAAgC,aAAc,mBAAmB,KAAG,MA8qBhF,CAAA;AAED,eAAO,MAAM,2BAA2B,QAAO,MAsD9C,CAAA"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { REGIONAL_INVOICE_TAX_CODE } from './regional-invoice-tax-code';
|
|
1
2
|
export const generateInvoiceGenerateRouteCode = (settings) => {
|
|
2
3
|
var _a, _b;
|
|
3
4
|
const prefix = settings.invoicePrefix || 'INV-';
|
|
@@ -18,7 +19,11 @@ export const generateInvoiceGenerateRouteCode = (settings) => {
|
|
|
18
19
|
|
|
19
20
|
var dataAccess = require('../../../utils/invoices/data-access');
|
|
20
21
|
var pdfGenerator = require('../../../utils/invoices/pdf-generator');
|
|
21
|
-
${emailEnabled
|
|
22
|
+
${emailEnabled
|
|
23
|
+
? `var emailSender = require('../../../utils/invoices/email-sender');
|
|
24
|
+
var sentEmailLog = require('../../../utils/email/sent-email-log');
|
|
25
|
+
var emailLocale = require('../../../utils/email/email-locale');`
|
|
26
|
+
: ''}
|
|
22
27
|
|
|
23
28
|
var INVOICE_PREFIX = ${JSON.stringify(prefix)};
|
|
24
29
|
var DEFAULT_TAX_RATE = ${defaultTaxRate};
|
|
@@ -26,6 +31,7 @@ var DEFAULT_CURRENCY = "USD";
|
|
|
26
31
|
var SHOW_DISCOUNT = ${showDiscount};
|
|
27
32
|
var TAX_INCLUDED_IN_PRICE = ${taxIncludedInPrice};
|
|
28
33
|
var TEMPLATE_DOCUMENT = ${templateDocumentJson};
|
|
34
|
+
${REGIONAL_INVOICE_TAX_CODE}
|
|
29
35
|
|
|
30
36
|
// Runtime storage configuration. When all three are set, the generated PDF
|
|
31
37
|
// is also POSTed to the storage worker so consumers (e.g. the payment
|
|
@@ -283,6 +289,9 @@ module.exports = async function handler(req, res) {
|
|
|
283
289
|
: hydratedItems.map(function (row) {
|
|
284
290
|
return {
|
|
285
291
|
productId: row.product_id || row.productId || null,
|
|
292
|
+
// Paired with \`productId\` to find the rate a line was charged at
|
|
293
|
+
// on an order priced by region (see resolveRegionalInvoiceTax).
|
|
294
|
+
variantId: row.variant_id || row.variantId || null,
|
|
286
295
|
name: row.product_name || row.name || 'Item',
|
|
287
296
|
variantLabel: row.variant_label || row.variantLabel || null,
|
|
288
297
|
variantSwatches: row.variant_swatches || row.variantSwatches || null,
|
|
@@ -379,6 +388,28 @@ module.exports = async function handler(req, res) {
|
|
|
379
388
|
}
|
|
380
389
|
var total = goodsTotal + shippingAmount;
|
|
381
390
|
|
|
391
|
+
// An order priced by region records the rate each line was charged at, so
|
|
392
|
+
// its invoice is computed from that record instead of the store default.
|
|
393
|
+
// A caller that states its own \`taxRate\` keeps the single-rate path.
|
|
394
|
+
var taxIncludedInPrice = TAX_INCLUDED_IN_PRICE;
|
|
395
|
+
var regionalTaxBreakdown = body.taxRate == null
|
|
396
|
+
? parseOrderTaxBreakdown(orderShippingSource.tax_breakdown)
|
|
397
|
+
: null;
|
|
398
|
+
if (regionalTaxBreakdown) {
|
|
399
|
+
var regionalTax = resolveRegionalInvoiceTax(regionalTaxBreakdown, items, discountAmount, shippingAmount);
|
|
400
|
+
taxRate = regionalTax.taxRate;
|
|
401
|
+
taxIncludedInPrice = regionalTax.taxIncluded;
|
|
402
|
+
subtotal = regionalTax.subtotal;
|
|
403
|
+
taxAmount = regionalTax.taxAmount;
|
|
404
|
+
shippingAmount = regionalTax.shippingNet;
|
|
405
|
+
total = regionalTax.total;
|
|
406
|
+
for (var ti = 0; ti < items.length; ti++) {
|
|
407
|
+
items[ti].taxRate = regionalTax.itemTax[ti].rate;
|
|
408
|
+
items[ti].taxIncluded = regionalTax.itemTax[ti].included;
|
|
409
|
+
items[ti].taxAmount = regionalTax.itemTax[ti].amount;
|
|
410
|
+
}
|
|
411
|
+
}
|
|
412
|
+
|
|
382
413
|
// Cross-check against the amount the order was actually placed for. The
|
|
383
414
|
// invoice is built from line items, the order carries the charged total,
|
|
384
415
|
// and the two must agree — when they don't, the invoice is being written
|
|
@@ -444,7 +475,17 @@ module.exports = async function handler(req, res) {
|
|
|
444
475
|
var fallbackPaymentProvider = orderRow.payment_provider || '';
|
|
445
476
|
var fallbackPaymentIntentId = orderRow.payment_intent_id || '';
|
|
446
477
|
var fallbackNotes = orderRow.notes || '';
|
|
447
|
-
|
|
478
|
+
${emailEnabled
|
|
479
|
+
? `
|
|
480
|
+
// The language the invoice email goes out in: the one stamped on the
|
|
481
|
+
// order at checkout (the buyer's storefront), else the one the caller
|
|
482
|
+
// named, else the language of the request itself. A cron or a webhook
|
|
483
|
+
// has neither of the last two and lands on the store's main language.
|
|
484
|
+
var invoiceLocale = emailLocale.normalizeEmailLocale(orderRow.locale)
|
|
485
|
+
|| emailLocale.normalizeEmailLocale(body.locale)
|
|
486
|
+
|| emailLocale.resolveRequestLocale(req);
|
|
487
|
+
`
|
|
488
|
+
: ''}
|
|
448
489
|
var invoiceData = {
|
|
449
490
|
id: body.id || require('crypto').randomUUID(),
|
|
450
491
|
invoiceNumber: invoiceNumber,
|
|
@@ -453,7 +494,7 @@ module.exports = async function handler(req, res) {
|
|
|
453
494
|
dueDate: dueDate,
|
|
454
495
|
paidAt: body.paidAt || null,
|
|
455
496
|
customerName: body.customerName || fallbackCustomerName || '',
|
|
456
|
-
customerEmail: body.customerEmail || fallbackCustomerEmail || '',
|
|
497
|
+
customerEmail: body.customerEmail || fallbackCustomerEmail || '',${emailEnabled ? '\n locale: invoiceLocale,' : ''}
|
|
457
498
|
customerAddress: body.customerAddress || fallbackCustomerAddress || '',
|
|
458
499
|
customerCity: body.customerCity || fallbackCustomerCity || '',
|
|
459
500
|
customerState: body.customerState || fallbackCustomerState || '',
|
|
@@ -481,7 +522,7 @@ module.exports = async function handler(req, res) {
|
|
|
481
522
|
// this flag the builder can't tell whether the stored unitPrice is
|
|
482
523
|
// a net (added on top) or a gross (included in price) value, and
|
|
483
524
|
// the line-item table renders blank cells.
|
|
484
|
-
taxIncludedInPrice:
|
|
525
|
+
taxIncludedInPrice: taxIncludedInPrice,
|
|
485
526
|
discountAmount: Math.round(discountAmount * 100) / 100,
|
|
486
527
|
// Delivery fee, surfaced so the PDF/HTML renderer can print its own line
|
|
487
528
|
// and the merchant's template can bind \`invoice.shippingAmount\`.
|
|
@@ -600,7 +641,12 @@ ${emailEnabled
|
|
|
600
641
|
currency: currency,
|
|
601
642
|
});
|
|
602
643
|
|
|
603
|
-
|
|
644
|
+
${emailEnabled
|
|
645
|
+
? ` // The email's ledger row is written in the background — land it before
|
|
646
|
+
// replying, a serverless function may be frozen the instant it responds.
|
|
647
|
+
await sentEmailLog.settleSentEmailLog();
|
|
648
|
+
`
|
|
649
|
+
: ''} res.status(200).json({
|
|
604
650
|
success: true,
|
|
605
651
|
invoiceId: invoiceData.id,
|
|
606
652
|
invoiceNumber: invoiceNumber,
|
|
@@ -620,7 +666,10 @@ ${emailEnabled
|
|
|
620
666
|
});
|
|
621
667
|
} catch (error) {
|
|
622
668
|
console.error('[invoice] Generation threw:', error && error.stack ? error.stack : error);
|
|
623
|
-
|
|
669
|
+
${emailEnabled
|
|
670
|
+
? ` await sentEmailLog.settleSentEmailLog();
|
|
671
|
+
`
|
|
672
|
+
: ''} res.status(500).json({ success: false, error: error.message || 'Failed to generate invoice' });
|
|
624
673
|
}
|
|
625
674
|
};
|
|
626
675
|
`;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api-routes-code.js","sourceRoot":"","sources":["../../../src/invoice/api-routes-code.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"api-routes-code.js","sourceRoot":"","sources":["../../../src/invoice/api-routes-code.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,y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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA6bzB,YAAY;QACV,CAAC,CAAC;;;;;;;;CAQL;QACG,CAAC,CAAC,EACN;;;;;;;;;yEAUQ,YAAY,CAAC,CAAC,CAAC,gCAAgC,CAAC,CAAC,CAAC,EACpD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAsHJ,YAAY;QACV,CAAC,CAAC;;;;;;;;;;;;;;;CAeL;QACG,CAAC,CAAC;;CAGN;;;;;;;;;;;EAYE,YAAY;QACV,CAAC,CAAC;;;CAGL;QACG,CAAC,CAAC,EACN;;;;;;;;;;;;;;;;;;;;EAqBE,YAAY;QACV,CAAC,CAAC;CACL;QACG,CAAC,CAAC,EACN;;;CAGC,CAAA;AACD,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,2BAA2B,GAAG,GAAW,EAAE;IACtD,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAoDR,CAAA;AACD,CAAC,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"email-sender-code.d.ts","sourceRoot":"","sources":["../../../src/invoice/email-sender-code.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,MAAM,4BAA4B,CAAA;AAErE,eAAO,MAAM,uBAAuB,kBAAmB,wBAAwB,KAAG,
|
|
1
|
+
{"version":3,"file":"email-sender-code.d.ts","sourceRoot":"","sources":["../../../src/invoice/email-sender-code.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,MAAM,4BAA4B,CAAA;AAErE,eAAO,MAAM,uBAAuB,kBAAmB,wBAAwB,KAAG,MAqGjF,CAAA;AAqND,eAAO,MAAM,4BAA4B,aAAc,MAAM,GAAG,IAAI,KAAG,OAAO,MAAM,EAAE,MAAM,CAkB3F,CAAA"}
|