@velastack/patterns 0.8.0 → 0.9.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.
Files changed (26) hide show
  1. package/dist/chunks/{collections-BrEA7a62.js → collections-DZOuRpvS.js} +6 -1
  2. package/dist/chunks/collections-DZOuRpvS.js.map +1 -0
  3. package/dist/chunks/{generate-BZ741GPx.js → currency.server-Bb2Ndutg.js} +6 -3
  4. package/dist/chunks/{generate-BZ741GPx.js.map → currency.server-Bb2Ndutg.js.map} +1 -1
  5. package/dist/chunks/{generate-6JS05dWK.js → generate-B-cqjI-U.js} +62 -55
  6. package/dist/chunks/generate-B-cqjI-U.js.map +1 -0
  7. package/dist/chunks/{generate.runtime-BOl3LpPB.js → generate.runtime-BnqS_Zq8.js} +84 -158
  8. package/dist/chunks/generate.runtime-BnqS_Zq8.js.map +1 -0
  9. package/dist/chunks/{generate.runtime-KrQk7mqG.js → generate.runtime-DG9Lp3vR.js} +39 -37
  10. package/dist/chunks/generate.runtime-DG9Lp3vR.js.map +1 -0
  11. package/dist/chunks/{generate.runtime-Dt3Edp8-.js → generate.runtime-X-uAteso.js} +123 -104
  12. package/dist/chunks/generate.runtime-X-uAteso.js.map +1 -0
  13. package/dist/chunks/load-function-Dmkhg1pQ.js +79 -0
  14. package/dist/chunks/load-function-Dmkhg1pQ.js.map +1 -0
  15. package/dist/chunks/root-layout.svelte-CUVbnlX-.js +302 -0
  16. package/dist/chunks/root-layout.svelte-CUVbnlX-.js.map +1 -0
  17. package/dist/index.js +15 -15
  18. package/dist/index.js.map +1 -1
  19. package/package.json +1 -1
  20. package/dist/chunks/collections-BrEA7a62.js.map +0 -1
  21. package/dist/chunks/generate-6JS05dWK.js.map +0 -1
  22. package/dist/chunks/generate.runtime-BOl3LpPB.js.map +0 -1
  23. package/dist/chunks/generate.runtime-Dt3Edp8-.js.map +0 -1
  24. package/dist/chunks/generate.runtime-KrQk7mqG.js.map +0 -1
  25. package/dist/chunks/root-layout.svelte-CsJ2QJYi.js +0 -93
  26. package/dist/chunks/root-layout.svelte-CsJ2QJYi.js.map +0 -1
@@ -124,6 +124,11 @@ var i = "users", a = "stripe_customers", o = "stripe_payment_methods", s = {
124
124
  required: !1,
125
125
  type: "text"
126
126
  },
127
+ {
128
+ name: "currency_options",
129
+ required: !1,
130
+ type: "json"
131
+ },
127
132
  {
128
133
  name: "created",
129
134
  onCreate: !0,
@@ -306,4 +311,4 @@ var i = "users", a = "stripe_customers", o = "stripe_payment_methods", s = {
306
311
  //#endregion
307
312
  export { r as a, s as i, f as n, c as r, p as t };
308
313
 
309
- //# sourceMappingURL=collections-BrEA7a62.js.map
314
+ //# sourceMappingURL=collections-DZOuRpvS.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"collections-DZOuRpvS.js","names":["dedent","_templateObject","buyPageSnippet","_taggedTemplateLiteral","variantId","users","stripeCustomers","stripePaymentMethods","STRIPE_PRODUCTS","STRIPE_PRICES","stripeCustomersCollection","stripePaymentMethodsCollection","transactions","PAYMENTS_BASE_COLLECTIONS","PAYMENTS_APP_MODE_COLLECTIONS"],"sources":["../../src/patterns/enable/payments/shopify-page.ts","../../src/patterns/enable/payments/runtime/collections.ts"],"sourcesContent":["import dedent from \"dedent\";\n\n/** The demo page: one Buy button for the variant named on the command line. */\nexport function buyPageSnippet(variantId: string): string {\n return dedent`\n <script lang=\"ts\">\n import BuyButton from '#lib/components/payments/buy-button.svelte';\n </script>\n\n <section data-role=\"content\">\n <BuyButton variantId=\"${variantId}\" />\n </section>\n `;\n}\n","import type { CollectionSpec } from \"../../../../core/types\";\n\nconst users = \"users\";\nconst stripeCustomers = \"stripe_customers\";\nconst stripePaymentMethods = \"stripe_payment_methods\";\n\n/**\n * The Stripe catalog as `sync-stripe-catalog.ts` copies it: the fields the\n * payment and billing pages read, plus what a store page shows (description,\n * images, metadata, the product URL, a price's nickname and lookup key).\n * `setupStripe` creates these and adds any field an older project's\n * collection lacks.\n */\nexport const STRIPE_PRODUCTS: CollectionSpec = {\n name: \"stripe_products\",\n type: \"base\",\n fields: [\n {\n name: \"id\",\n pattern: \"^[a-zA-Z0-9_]+$\",\n primaryKey: true,\n required: true,\n system: true,\n type: \"text\",\n },\n { name: \"name\", required: false, type: \"text\" },\n { name: \"active\", required: false, type: \"text\" },\n { name: \"default_price\", required: false, type: \"text\" },\n { name: \"description\", required: false, type: \"text\" },\n // Stripe's list of image URLs, and its free-form key/value metadata.\n { name: \"images\", required: false, type: \"json\" },\n { name: \"metadata\", required: false, type: \"json\" },\n { name: \"url\", required: false, type: \"text\" },\n { name: \"created\", onCreate: true, onUpdate: false, type: \"autodate\" },\n { name: \"updated\", onCreate: true, onUpdate: true, type: \"autodate\" },\n ],\n};\n\nexport const STRIPE_PRICES: CollectionSpec = {\n name: \"stripe_prices\",\n type: \"base\",\n fields: [\n {\n name: \"id\",\n pattern: \"^[a-zA-Z0-9_]+$\",\n primaryKey: true,\n required: true,\n system: true,\n type: \"text\",\n },\n { name: \"billing_scheme\", required: false, type: \"text\" },\n { name: \"currency\", required: false, type: \"text\" },\n { name: \"product\", required: false, type: \"text\" },\n { name: \"recurring\", required: false, type: \"json\" },\n { name: \"type\", required: false, type: \"text\" },\n { name: \"unit_amount\", required: false, type: \"number\" },\n { name: \"active\", required: false, type: \"bool\" },\n { name: \"nickname\", required: false, type: \"text\" },\n { name: \"lookup_key\", required: false, type: \"text\" },\n // Fixed amounts in other currencies, set in the dashboard: `{ eur: { unit_amount: 1800 } }`.\n { name: \"currency_options\", required: false, type: \"json\" },\n { name: \"created\", onCreate: true, onUpdate: false, type: \"autodate\" },\n { name: \"updated\", onCreate: true, onUpdate: true, type: \"autodate\" },\n ],\n};\n\nconst stripeCustomersCollection: CollectionSpec = {\n name: stripeCustomers,\n type: \"base\",\n fields: [\n {\n name: \"id\",\n pattern: \"^[a-zA-Z0-9_]+$\",\n primaryKey: true,\n required: true,\n type: \"text\",\n },\n {\n collectionId: users,\n maxSelect: 1,\n minSelect: 0,\n name: \"user\",\n required: true,\n type: \"relation\",\n },\n {\n collectionId: stripePaymentMethods,\n maxSelect: 1,\n minSelect: 0,\n name: \"default_payment_method\",\n required: false,\n type: \"relation\",\n },\n { name: \"created\", onCreate: true, onUpdate: false, type: \"autodate\" },\n { name: \"updated\", onCreate: true, onUpdate: true, type: \"autodate\" },\n ],\n};\n\nconst stripePaymentMethodsCollection: CollectionSpec = {\n name: stripePaymentMethods,\n type: \"base\",\n fields: [\n {\n name: \"id\",\n pattern: \"^[a-zA-Z0-9_]+$\",\n primaryKey: true,\n required: true,\n type: \"text\",\n },\n { name: \"brand\", required: true, type: \"text\" },\n { name: \"last4\", required: true, type: \"text\" },\n { name: \"exp_month\", required: true, type: \"number\" },\n { name: \"exp_year\", required: true, type: \"number\" },\n {\n collectionId: stripeCustomers,\n maxSelect: 1,\n minSelect: 0,\n name: \"customer\",\n required: true,\n type: \"relation\",\n cascadeDelete: true,\n },\n { name: \"created\", onCreate: true, onUpdate: false, type: \"autodate\" },\n { name: \"updated\", onCreate: true, onUpdate: true, type: \"autodate\" },\n ],\n};\n\nconst transactions: CollectionSpec = {\n name: \"transactions\",\n type: \"base\",\n fields: [\n {\n autogeneratePattern: \"[a-z0-9]{15}\",\n max: 15,\n min: 15,\n name: \"id\",\n pattern: \"^[a-z0-9]+$\",\n primaryKey: true,\n required: true,\n type: \"text\",\n },\n { name: \"stripe_payment_intent\", required: true, type: \"text\" },\n { name: \"amount\", required: true, type: \"number\" },\n { name: \"currency\", required: true, type: \"text\" },\n { name: \"last4\", required: true, type: \"text\" },\n { name: \"brand\", required: true, type: \"text\" },\n { name: \"created\", required: true, type: \"date\" },\n { name: \"stripe_charge\", required: true, type: \"text\" },\n { name: \"stripe_customer\", required: true, type: \"text\" },\n {\n collectionId: users,\n maxSelect: 1,\n minSelect: 0,\n name: \"user\",\n required: true,\n type: \"relation\",\n },\n { name: \"receipt_url\", required: true, type: \"url\" },\n ],\n};\n\nexport const PAYMENTS_BASE_COLLECTIONS: CollectionSpec[] = [\n STRIPE_PRODUCTS,\n STRIPE_PRICES,\n];\n\nexport const PAYMENTS_APP_MODE_COLLECTIONS: CollectionSpec[] = [\n stripeCustomersCollection,\n stripePaymentMethodsCollection,\n transactions,\n];\n"],"mappings":";;;;AAGA,SAAgBE,EAAe,GAA2B;CACxD,OAAOF,EAAA,AAAAC,MAAAE,EAAA,CAAA,+LAAA,2BAAA,CAAA,GAMqBC,CAE5B;AACF;;;ACXA,IAAMC,IAAQ,SACRC,IAAkB,oBAClBC,IAAuB,0BAShBC,IAAkC;CAC7C,MAAM;CACN,MAAM;CACN,QAAQ;EACN;GACE,MAAM;GACN,SAAS;GACT,YAAY;GACZ,UAAU;GACV,QAAQ;GACR,MAAM;EACR;EACA;GAAE,MAAM;GAAQ,UAAU;GAAO,MAAM;EAAO;EAC9C;GAAE,MAAM;GAAU,UAAU;GAAO,MAAM;EAAO;EAChD;GAAE,MAAM;GAAiB,UAAU;GAAO,MAAM;EAAO;EACvD;GAAE,MAAM;GAAe,UAAU;GAAO,MAAM;EAAO;EAErD;GAAE,MAAM;GAAU,UAAU;GAAO,MAAM;EAAO;EAChD;GAAE,MAAM;GAAY,UAAU;GAAO,MAAM;EAAO;EAClD;GAAE,MAAM;GAAO,UAAU;GAAO,MAAM;EAAO;EAC7C;GAAE,MAAM;GAAW,UAAU;GAAM,UAAU;GAAO,MAAM;EAAW;EACrE;GAAE,MAAM;GAAW,UAAU;GAAM,UAAU;GAAM,MAAM;EAAW;CACtE;AACF,GAEaC,IAAgC;CAC3C,MAAM;CACN,MAAM;CACN,QAAQ;EACN;GACE,MAAM;GACN,SAAS;GACT,YAAY;GACZ,UAAU;GACV,QAAQ;GACR,MAAM;EACR;EACA;GAAE,MAAM;GAAkB,UAAU;GAAO,MAAM;EAAO;EACxD;GAAE,MAAM;GAAY,UAAU;GAAO,MAAM;EAAO;EAClD;GAAE,MAAM;GAAW,UAAU;GAAO,MAAM;EAAO;EACjD;GAAE,MAAM;GAAa,UAAU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