{"id":20182132,"url":"https://github.com/nichoth/mycomoon","last_synced_at":"2026-05-10T18:57:08.355Z","repository":{"id":77400098,"uuid":"346185301","full_name":"nichoth/mycomoon","owner":"nichoth","description":null,"archived":false,"fork":false,"pushed_at":"2024-09-23T20:25:43.000Z","size":15260,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-01-13T17:26:34.979Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/nichoth.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-03-10T00:37:27.000Z","updated_at":"2021-06-26T05:23:25.000Z","dependencies_parsed_at":null,"dependency_job_id":"7cb8684b-da89-4de7-9bda-b71fb09419e6","html_url":"https://github.com/nichoth/mycomoon","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nichoth%2Fmycomoon","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nichoth%2Fmycomoon/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nichoth%2Fmycomoon/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nichoth%2Fmycomoon/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nichoth","download_url":"https://codeload.github.com/nichoth/mycomoon/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241616680,"owners_count":19991543,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-14T02:37:45.517Z","updated_at":"2026-05-10T18:57:03.307Z","avatar_url":"https://github.com/nichoth.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# mycomoon\n\n[![Netlify Status](https://api.netlify.com/api/v1/badges/ec517db2-97d2-48ac-803a-c21453d83cea/deploy-status)](https://app.netlify.com/sites/musing-kirch-9f2f0c/deploys)\n\nA website\n\n----------------------------------\n\n## chec\n\n.env is using the 'sandbox' keys\n\n\n--------------------------------------------------\n\n\nsquare stuff ----------------- vvvvv ----------------\n\n## test card number \n\ncard number -- \t4111 1111 1111 1111\ncvv -- 111\n\n## test cards for error views\n\nTest values | Desired error state\n------------------------------------------------\n```\nCVV: 911\tCard CVV incorrect\nPostal code: 99999\tCard postal code incorrect\nExpiration date: 01/40\tCard expiration date incorrect\nCard number: 4000000000000002\tCard declined number\nPAN: 4000000000000010\tCard on file auth declined\n```\n\n-----------------------------------------------------------------------\n\n## notes\n\n* https://medium.com/samsung-internet-dev/pwa-series-service-workers-the-basics-about-offline-a6e8f1d92dfd\n* https://www.smashingmagazine.com/2016/02/making-a-service-worker/\n\n---------------------------------------------\n\n* https://css-tricks.com/serviceworker-for-offline/\n\n\n--------------------------------------\n\nCould browserify the service worker js file, which would let us use the\nversion number from package.json.\n\n----------------------------------\n\n* https://blog.logrocket.com/every-website-deserves-a-service-worker/\n\n* https://github.com/okitavera/eleventy-plugin-pwa\n\n* https://www.smashingmagazine.com/2019/06/pwa-webpack-workbox/\n\n------------------------------------------------\n\n## 4-15-2021\n\n[branch deploys](https://docs.netlify.com/site-deploys/overview/#branch-deploy-controls)\n\n----------------------------------------\n\n* https://www.smashingmagazine.com/2016/08/a-beginners-guide-to-progressive-web-apps/\n\n-----^-------\n* uses a network-first strategy\n\n----------------------------------------------\n\n[caches.match](https://developer.mozilla.org/en-US/docs/Web/API/CacheStorage/match)\n\n\u003e Note: caches.match() is a convenience method. Equivalent functionality is to call cache.match() on each cache (in the order returned by caches.keys()) until a Response is returned.\n\n## todo\n\n* fix the cache system in service worker. \n\n-------------------------------------------------------\n\n## 4-16-2020\n\nThis is the colorful horizontally snapping one:\n\n\u003e here’s a pen where I made a fully responsive Swipe Views (Carousel) with CSS Grid and Snap Points where neither JavaScript nor CSS media queries are required to achieve the responsiveness.\n\n[Swipe Views with CSS Snap Points](https://medium.com/@_zouhir/swipe-views-with-css-snap-points-building-a-more-efficient-mobile-web-navigation-f9ac8c53dbc0)\n\n-----------------------------------------\n\nThis is the demo with the pink smooth scrolling boxes:\n\n[Creating horizontal scrolling containers the right way [CSS Grid]](https://uxdesign.cc/creating-horizontal-scrolling-containers-the-right-way-css-grid-c256f64fc585)\n\n----------------------------------------\n\n[Example 5: 2D image grid](https://css-tricks.com/practical-css-scroll-snapping/#example-5-2d-image-grid) -- could be cool\n\n\n----------------------------------------------\n\n## square\n\n1. copy the app id and secret to `.env.example`\n2. install `square` via npm\n3. set up netlify functions. see [build your first function](https://app.netlify.com/sites/mycomoon/functions)\n\n--------------------------------\n\nYou can start a local dev server with `netlify dev`\n\n```\nmy_functions/hello.js\nmy_functions/hello/hello.js\nmy_functions/hello/index.js\n```\n\n\u003e Any of the above formats would deploy a synchronous serverless function that can be called on the following endpoint, relative to the base URL of your site: `/.netlify/functions/hello`\n\n```\nhttps://dev--mycomoon.netlify.app/.netlify/functions/hello-world\n```\n\n\nhttps://docs.netlify.com/functions/build-with-javascript/\n\n-----------------------------------\n\n* [create order request](https://github.com/square/square-nodejs-sdk/blob/master/doc/models/create-order-request.md)\n\n----------------------------------------------\n\n[test values](https://developer.squareup.com/docs/testing/test-values)\n\nPayments.CreatePayment (card)\nnonce --\n```\ncnon:card-nonce-ok\n```\n\n-----------------------------------------\n\nWhat am I doing?\n\nNeed to create an order on square \nfrom the myco website\n\n\nGet the catalog_object_id for your line item \n\n## test file\n\nI found the access token here:\nhttps://developer.squareup.com/apps\n**In the 'account details' part** when you click on `myco-test`\n\nThis is different than after you click 'open' on the 'myco moon' website, or\nwhen you click 'open' on the sandbox `myco-test`.\nhttps://developer.squareup.com/apps/sq0idp-tQkeBZJNjlKlfjdxvaBxFg/settings\n\n--------------------------------\n\n## [how to find a location id?](https://www.sellercommunity.com/t5/Point-of-Sale-API/Square-s-API-How-do-I-find-my-Application-ID-Location-ID-amp/td-p/142543)\n\n* Go to https://developer.squareup.com\n* The Location ID(s) for your Square account can be found in the Locations tab of your Developer Dashboard.\n\n\n'default test' location in the 'real' site\n\nLTTBZ5XKA3MGS\n\n----------------------------------------\n\n\n[Batch Retrieve Inventory Counts](https://github.com/square/square-nodejs-sdk/blob/master/doc/api/inventory.md#batch-retrieve-inventory-counts)\n\n\n------------------------------------------------\n\n1. make a store type thing on square -- https://developer.squareup.com/apps,\nand make some products with pictures. This is done in the 'sandbox account' --\nhttps://squareupsandbox.com/dashboard/\n\n\nHave an index page that shows one item per item\n\nThen on the item page, you have the ability to select a variation for that item\n\n-----------------------------------------------\n\nin the catalog response, **low inventory alerts** are in `locationOverrides`:\n\n```js\n{\n    \"locationId\": \"LAZSTD2P84MEA\",\n    \"trackInventory\": true,\n    \"inventoryAlertType\": \"LOW_QUANTITY\",\n    \"inventoryAlertThreshold\": \"3n\"\n}\n```\n\nvs this one with no alert:\n```js\n{\n    \"locationId\": \"LAZSTD2P84MEA\",\n    \"trackInventory\": true\n}\n```\n\n\n------------------------------------------------\n\ngo through the catalog response, and map the item_variations to quntity\n\n```js\nitem.itemData.variations[0].id === inventory.counts[0].catalogObjectId\n```\n\nthe url for functions\n```\n/.netlify/functions/hello-world\n```\n\n`vmin` unit -- the lesser of `vw` and `vh`\n\n\n--------------------------------------------\n\n\n```js\n\"custom_attribute_values\": {\n    \"Square:9b562b5e-b18e-4a91-8877-5b0ea3d433ec\": {\n    \"name\": \"slug\",\n    \"string_value\": \"test-slug\",\n    \"custom_attribute_definition_id\": \"7KFDYZ54EAWBQ64SGDFIASRK\",\n    \"type\": \"STRING\",\n    \"key\": \"Square:9b562b5e-b18e-4a91-8877-5b0ea3d433ec\"\n    }\n},\n```\n\nIn the catalog list response:\n\n```\n{\n    \"type\": \"ITEM\",\n    \"id\": \"YEUQ7F6NHHZTFO666FQ5CUVI\",\n    \"updatedAt\": \"2021-04-29T14:39:41.468Z\",\n    \"version\": \"1619707181468n\",\n    \"isDeleted\": false,\n    \"customAttributeValues\": {\n      \"Square:9b562b5e-b18e-4a91-8877-5b0ea3d433ec\": {\n        \"name\": \"slug\",\n        \"stringValue\": \"test-slug\",\n        \"customAttributeDefinitionId\": \"7KFDYZ54EAWBQ64SGDFIASRK\",\n        \"type\": \"STRING\",\n        \"key\": \"Square:9b562b5e-b18e-4a91-8877-5b0ea3d433ec\"\n      }\n    },\n```\n\nThis shows the `customAttributeDefinitionId`\n\n-----------------------------------------------\n\n## slugs\n\nYou can use the same `customAttributeDefinitionId` string, and replace\nthe value `stringFilter` in the request. This example uses the same ID with different\nsearch values. In the square UI, I created a custom attribute on each\nitem with an attribute name of `slug`, and a different attribute value for each.\nIt re-used the same attribute id.\n\n```js\n    customAttributeFilters: [\n        {\n            \"stringFilter\": \"test-slug\",\n            // i got this id value from the `test-list-catalog` response\n            // not sure if it is visible in the square UI\n            \"customAttributeDefinitionId\": \"7KFDYZ54EAWBQ64SGDFIASRK\",\n        }\n    ]\n```\n\nvs\n\n```js\ncustomAttributeFilters: [\n    {\n        \"stringFilter\": \"oos-slug\",\n        \"customAttributeDefinitionId\": \"7KFDYZ54EAWBQ64SGDFIASRK\",\n    }\n]\n```\n\n------------------------------------------\n\nhttps://github.com/square/square-nodejs-sdk/issues/30#issuecomment-829522492\n\n\u003e you could just use `stringFilter` in the `SearchCatalogItems` instead of `customAttributeDefinitionId` to search by a specific string, I believe, instead of needing to know the actual definition id.\n\nsee `textFilter` here: https://github.com/square/square-nodejs-sdk/blob/master/doc/models/search-catalog-items-request.md#fields\n\n\n\n\n\n\n\n`ITEM.customAttributeValues` --\n\n```js\ncustomAttributeValues: {\n    Square:9b562b5e-b18e-4a91-8877-5b0ea3d433ec: {\n        customAttributeDefinitionId: \"7KFDYZ54EAWBQ64SGDFIASRK\"\n        key: \"Square:9b562b5e-b18e-4a91-8877-5b0ea3d433ec\"\n        name: \"slug\"\n        stringValue: \"test-slug\"\n        type: \"STRING\"\n        __proto__: Object\n        __proto__: Object\n    }\n}\n```\n\n\n\n-------------------------------\n\n## form validation\n\nhttps://css-tricks.com/form-validation-ux-html-css/#you-can-create-robust-validations\n\n\n\n\n\n## buying things\n-------------------------------------------------\n\nFirst you create an order, then you pay for it\n\n[payment walkthrough](https://developer.squareup.com/docs/payment-form/payment-form-walkthrough)\n\n\n* paste the square css for the square payment form -- see `mysqpaymentform.css`\n* get the square payment form JS -- has to be hosted by square --\n```js\n\u003cscript type=\"text/javascript\" src=\"https://js.squareupsandbox.com/v2/paymentform\"\u003e\u003c/script\u003e\n```\nThis adds a global -- `window.SqPaymentForm`\n* create a function in netlify -- `process-payment.js`\nThis function takes a nonce, idempotency key, and location ID. You want this to be server-side because it calls an api `paymentsApi.createPayment` (you need the app token)\n\nsee [Order-Ahead Sample Application](https://developer.squareup.com/docs/orders-api/quick-start/start)\n\n--------------------------------------\n\nsee [basic order ahead flow](https://github.com/square/connect-api-examples/tree/master/connect-examples/v2/node_orders-payments#basic-order-ahead-flow)\n\n* call `create order` -- https://github.com/square/connect-api-examples/blob/master/connect-examples/v2/node_orders-payments/routes/index.js#L80\n* pay for the order -- https://github.com/square/connect-api-examples/blob/master/connect-examples/v2/node_orders-payments/routes/checkout.js#L420\n\n------------------------------------\n\n\n\n* Calls createOrder (Orders API) to create an order \n* delivery info is added as `fulfillments` information in the order\n\nsee [fulfillment](https://github.com/square/square-nodejs-sdk/blob/master/doc/models/order-fulfillment.md)\n\n\n\n\n--------------------------------------------\n\n\n\nsee [take payments](https://developer.squareup.com/docs/payments-api/take-payments)\n\nsee [take card payments](https://developer.squareup.com/docs/payments-api/take-payments/card-payments)\n\n\u003e When Square receives a CreatePayment request, it charges the specified card and deposits the funds in the Square Balance of the account.\n\nsee [Square payments in your own website](https://developer.squareup.com/docs/online-payment-options#square-payments-in-your-own-website)\n\n\u003e Using the Square-provided client-side JavaScript library (`SqPaymentForm`)\n\n\u003e Using the SqPaymentForm library, you develop a payment form in your web page. \n\n----------------------\n\n`SqPaymentForm`\n\nfrom whammy -- https://github.com/nichoth/whammy/blob/square/src/buy-things/index.html\n\n```html\n\u003cscript src=\"https://js.squareupsandbox.com/v2/paymentform\"\u003e\u003c/script\u003e\n```\n\nhttps://github.com/nichoth/whammy/blob/b84a422cb4def79d86e1263b08599bdee6c21e17/src/js/pay.js\n\n```js\nfunction createPaymentForm (orderId, cart) {\n    return new SqPaymentForm({\n```\n\n---------------------------------------------------\n\n\n\nsee [Walkthrough: Integrate Square Payments in a Website](https://developer.squareup.com/docs/payment-form/payment-form-walkthrough)\n\n\u003e build a basic form that only takes a credit card on a web page\n\n-----------------------------------------\n\ncard number -- \t4111 1111 1111 1111\ncvv -- 111\n\n\n-------------------------------------------------\n\n\nCan make an order first with shipping addr only, then get a response from that\nand use the total in the next screen, where you pay.\n\nor\n\nShow the total \u0026 shipping on one screen because the total is calculated \nclient-side\n\n\n-------------------------------------------------\n\n## email receipts\n\n\u003e The `receipt_url` associated with a Sandbox payment is not valid and does not link to an actual Sandbox payment receipt.\n\nhttps://www.jennapederson.com/blog/2019/11/4/sending-email-with-netlify-functions/\n\n### Trying to send an email\n\n[the netlify q\u0026a thing](https://answers.netlify.com/t/support-guide-how-can-i-receive-emails-on-my-domain/178)\n\n\n[the google instructions](https://support.google.com/a/answer/174125?hl=en)\n\n\u003e Once the MX records are configured correctly, we recommend changing the TTL value from 3600 to 86400,\n\nWe've set it up to use `getmycomoon@gmail.com`, which will resolve to a name\n`@mycomoon.com`.\n\n\n------------------------------------\n\n\n* Use https://app.improvmx.com/ to forward `*@mycomoon.com` to\n`getmycomoon@gmail.com`.\n* Add the improvmx text records to netlify DNS settings\n\n\n----------------------------------------------------\n\n## 5-9-2021\n\n### transaction emails\nNeed to use a service like `send grid` to send the emails via API.\n\nRun `netlify dev`, then open a browser to `http://localhost:8888/.netlify/functions/send-contact-email?name=\"fooooo\"`\n\nIt will send an email to me.\n\n---------------------------------------------------------\n\n## 5-13-2021\n\nCommerce.js gives you a host for a shopping cart, and slighly different/better API for products.\n\n-----------------------------------------------------------\n\n## 5-15-2021\n\nDoing the error views\n\nhttps://developer.squareup.com/docs/testing/test-values\n\nTest values | Desired error state\n------------------------------------------------\n```\nCVV: 911\tCard CVV incorrect\nPostal code: 99999\tCard postal code incorrect\nExpiration date: 01/40\tCard expiration date incorrect\nCard number: 4000000000000002\tCard declined number\nPAN: 4000000000000010\tCard on file auth declined\n```\n\n\n------------------------------------------------------------------\n\n* https://css-tricks.com/snippets/css/turn-off-number-input-spinners/\n* https://css-tricks.com/numeric-inputs-a-comparison-of-browser-defaults/\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnichoth%2Fmycomoon","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnichoth%2Fmycomoon","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnichoth%2Fmycomoon/lists"}